Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): update sparql-http-client, environment, etc #99

Merged
merged 9 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fair-donkeys-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hydrofoil/talos": patch
---

Update `sparql-http-client` to v3
5 changes: 5 additions & 0 deletions .changeset/moody-cherries-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hydrofoil/talos-core": patch
---

Updated `@zazuko/env-node` to v2
1,970 changes: 897 additions & 1,073 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "talos",
"private": true,
"scripts": {
"prepare": "husky install",
"prepare": "husky install; patch-package",
"lint": "eslint . --ext .ts --quiet --ignore-path .gitignore --ignore-path .eslintignore",
"test": "wsrun --no-prefix -mc test",
"release": "changeset publish"
Expand Down Expand Up @@ -36,6 +36,7 @@
"eslint-import-resolver-typescript": "^3.6.0",
"husky": "^8.0.2",
"mocha": "^10.0.0",
"patch-package": "^8.0.0",
"rdf-dataset-ext": "^1.1.0",
"sinon-chai": "^3.7.0",
"ts-node": "^10.9.1",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/bin/talos.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env node
import 'anylogger-debug'
import '../index.js'
1 change: 1 addition & 0 deletions packages/cli/bin/talos.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env ts-node
import 'anylogger-debug'
import '../index.js'
2 changes: 1 addition & 1 deletion packages/cli/lib/command/put.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function put(directories: string[], { token, api, endpoint, updateE
updateUrl: updateEndpoint || endpoint,
user,
password,
})),
}), $rdf),
})

await deleteApi({ apiUri, token, fetch })
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@
"url": "https://github.com/hypermedia-app/talos/issues"
},
"dependencies": {
"@hydrofoil/resource-store": "^0.1.1",
"@hydrofoil/resource-store": "^0.2.1",
"@hydrofoil/talos-core": "^0.1.0",
"@hydrofoil/vocabularies": "^1.1.0",
"@tpluscode/rdf-string": "^1.0.3",
"@tpluscode/sparql-builder": "^1.1.0",
"@zazuko/vocabularies": "^2.0.0",
"anylogger": "^1.0.11",
"anylogger-debug": "^1.0.3",
"@hydrofoil/vocabularies": "^2.1.1",
"@tpluscode/rdf-string": "^1.3.0",
"@tpluscode/sparql-builder": "^2.0.2",
"@zazuko/vocabularies": "^2.1.0",
"@zazuko/vocabulary-extras": "^2.0.6",
"anylogger": "^1.1.0-beta.5",
"anylogger-debug": "^1.1.0-beta.5",
"commander": "^9.4.0",
"debug": "^4.3.4",
"is-graph-pointer": "^2.1.0",
"node-fetch": "^3.3.0",
"rdf-dataset-ext": "^1.0.1",
"sparql-http-client": "^2.4.1"
"sparql-http-client": "^3.0.0"
},
"devDependencies": {
"@tpluscode/rdf-ns-builders": "^4.1.0",
"@wikibus/vocabularies": "^0.2.3",
"chai": "^4.3.6",
"sinon": "^15"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import StreamClient from 'sparql-http-client/StreamClient.js'
import { sparql } from '@tpluscode/rdf-string'
import { DELETE, INSERT } from '@tpluscode/sparql-builder'
import type { SparqlValue } from '@tpluscode/rdf-string/lib/sparql'
import type { SparqlValue } from '@tpluscode/rdf-string'

export const client = new StreamClient({
endpointUrl: 'http://db.talos.lndo.site/repositories/tests?infer=true',
Expand Down
24 changes: 12 additions & 12 deletions packages/cli/test/lib/command/put-vocabs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ParsingClient from 'sparql-http-client/ParsingClient.js'
import { ASK, DELETE, SELECT } from '@tpluscode/sparql-builder'
import { acl, as, hydra, rdfs } from '@tpluscode/rdf-ns-builders'
import { expect } from 'chai'
import * as wikibusVocabs from '@wikibus/vocabularies/builders/strict'
import * as externalVocabs from '@zazuko/vocabulary-extras/builders'
import { putVocabs, PutVocabs } from '../../../lib/command/put-vocabs.js'

describe('@hydrofoil/talos/lib/command/put-vocabs', function () {
Expand All @@ -23,7 +23,7 @@ describe('@hydrofoil/talos/lib/command/put-vocabs', function () {
})

before(async () => {
await DELETE`?s ?p ?o`.WHERE`?s ?p ?o`.execute(client.query)
await DELETE`?s ?p ?o`.WHERE`?s ?p ?o`.execute(client)
})

describe('--', () => {
Expand All @@ -44,34 +44,34 @@ describe('@hydrofoil/talos/lib/command/put-vocabs', function () {
it(`inserts ${prefix} into graph ${namespace.value}`, async () => {
const results = await SELECT`(count(*) as ?count)`
.WHERE`?s ?p ?o`
.FROM(namespace).execute(client.query)
.FROM(namespace).execute(client)

expect(parseInt(results[0].count.value)).to.be.greaterThan(0)
})
}
})

describe('--extraVocab', () => {
const vocabs = Object.values(wikibusVocabs).map((ns) => ns())
const vocabs = Object.values(externalVocabs).map((ns) => ns())

beforeEach(async () => {
await DELETE`?s ?p ?o`.WHERE`?s ?p ?o`.execute(client.query)
await DELETE`?s ?p ?o`.WHERE`?s ?p ?o`.execute(client)
})

it('inserts all vocabs when no specific prefixes selected', async () => {
// when
await putVocabs({
...params,
extraVocabs: [{
package: '@wikibus/vocabularies',
package: '@zazuko/vocabulary-extras',
}],
})

// then
for (const namespace of vocabs) {
const results = await SELECT`(count(*) as ?count)`
.WHERE`?s ?p ?o`
.FROM(namespace).execute(client.query)
.FROM(namespace).execute(client)

expect(parseInt(results[0].count.value)).to.be.greaterThan(0)
}
Expand All @@ -82,18 +82,18 @@ describe('@hydrofoil/talos/lib/command/put-vocabs', function () {
await putVocabs({
...params,
extraVocabs: [{
package: '@wikibus/vocabularies',
prefixes: ['wba'],
package: '@zazuko/vocabulary-extras',
prefixes: ['code'],
}],
})

// then
const hasWba = await ASK`?s ?p ?o`.FROM(wikibusVocabs.wba()).execute(client.query)
const hasWba = await ASK`?s ?p ?o`.FROM(externalVocabs.code()).execute(client)
expect(hasWba).to.be.true

const hasOther = await ASK`?s ?p ?o`
.FROM(wikibusVocabs.wbo()).FROM(wikibusVocabs.wb_events())
.execute(client.query)
.FROM(externalVocabs.b59()).FROM(externalVocabs.meta())
.execute(client)
expect(hasOther).to.be.false
})
})
Expand Down
48 changes: 24 additions & 24 deletions packages/cli/test/lib/command/put.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for (const api of apis) {
})

before(async () => {
await DELETE`?s ?p ?o`.WHERE`?s ?p ?o`.execute(client.query)
await DELETE`?s ?p ?o`.WHERE`?s ?p ?o`.execute(client)

await testData`
GRAPH ${ns('project/creta/user.group/admins')} {
Expand Down Expand Up @@ -69,7 +69,7 @@ for (const api of apis) {
const dataset = addAll($rdf.dataset(), await CONSTRUCT`?s ?p ?o`
.FROM(ns('project'))
.WHERE`?s ?p ?o`
.execute(client.query))
.execute(client))

expect(toCanonical(dataset)).to.matchSnapshot(this)
})
Expand All @@ -78,39 +78,39 @@ for (const api of apis) {
const dataset = addAll($rdf.dataset(), await CONSTRUCT`?s ?p ?o`
.FROM(ns('project/creta/user.group/admins'))
.WHERE`?s ?p ?o`
.execute(client.query))
.execute(client))

expect(toCanonical(dataset)).to.matchSnapshot(this)
})

it('inserts into graph constructed from path', async () => {
const userCreated = ASK`${ns('project/creta/user/tpluscode')} a ${schema.Person}`
.FROM(ns('project/creta/user/tpluscode'))
.execute(client.query)
.execute(client)

await expect(userCreated).to.eventually.be.true
})

it('escapes paths to produce valid URIs', async () => {
const userCreated = ASK`${ns('project/creta/user/Kov%C3%A1cs%20J%C3%A1nos')} a ${schema.Person}`
.FROM(ns('project/creta/user/Kov%C3%A1cs%20J%C3%A1nos'))
.execute(client.query)
.execute(client)

await expect(userCreated).to.eventually.be.true
})

it('allows dots in paths', async () => {
const userCreated = ASK`${ns('project/creta/user.group/john.doe')} a ${vcard.Group}`
.FROM(ns('project/creta/user.group/john.doe'))
.execute(client.query)
.execute(client)

await expect(userCreated).to.eventually.be.true
})

it('adds apiDocumentation link', async () => {
const [{ api }] = await SELECT`?api`.WHERE`${ns('project/creta/user/tpluscode')} ${hydra.apiDocumentation} ?api`
.FROM(ns('project/creta/user/tpluscode'))
.execute(client.query)
.execute(client)

expect(api).to.deep.eq(ns('api'))
})
Expand All @@ -122,7 +122,7 @@ for (const api of apis) {
${schema.project} ${ns('project/creta/project/creta')}
`
.FROM(ns('project/creta/user/tpluscode'))
.execute(client.query)
.execute(client)

await expect(hasExpectedLinks).to.eventually.be.true
})
Expand All @@ -132,7 +132,7 @@ for (const api of apis) {
${ns('project/creta/user/tpluscode')} a ${ns('api/Person')}
`
.FROM(ns('project/creta/user/tpluscode'))
.execute(client.query)
.execute(client)

await expect(hasExpectedType).to.eventually.be.true
})
Expand All @@ -146,7 +146,7 @@ for (const api of apis) {
.
`
.FROM(ns('project/creta/shape'))
.execute(client.query)
.execute(client)

expect(value.value).to.eq('<span>single line template</span>')
})
Expand All @@ -160,7 +160,7 @@ for (const api of apis) {
.
`
.FROM(ns('project/creta/shape'))
.execute(client.query)
.execute(client)

expect(value.value).to.eq(`<span>
multi
Expand All @@ -175,7 +175,7 @@ template
${ns('project')} a ${schema.Thing}
`
.FROM(ns('project'))
.execute(client.query)
.execute(client)

await expect(indexCorrectlyInserted).to.eventually.be.true
})
Expand All @@ -185,7 +185,7 @@ template
${$rdf.namedNode(api)} a ${schema.Thing}
`
.FROM($rdf.namedNode(api))
.execute(client.query)
.execute(client)

await expect(indexCorrectlyInserted).to.eventually.be.true
})
Expand All @@ -195,7 +195,7 @@ template
${ns('project')} ${schema.parentItem} <${api}>
`
.FROM(ns('project'))
.execute(client.query)
.execute(client)

await expect(indexCorrectlyInserted).to.eventually.be.true
})
Expand All @@ -205,7 +205,7 @@ template
${ns('project/creta/user/tpluscode')} ${schema.parentItem} ${ns('project/creta/')}
`
.FROM(ns('project/creta/user/tpluscode'))
.execute(client.query)
.execute(client)

await expect(indexCorrectlyInserted).to.eventually.be.true
})
Expand All @@ -218,7 +218,7 @@ template
${group} ${vcard.hasMember} ${ns('project/creta/user/tpluscode')} .
`
.FROM(group)
.execute(client.query)
.execute(client)

await expect(indexCorrectlyInserted).to.eventually.be.true
})
Expand All @@ -228,7 +228,7 @@ template
it('inserts into graph constructed from path', async () => {
const userCreated = ASK`${ns('project/creta/project/creta')} a ${doap.Project}`
.FROM(ns('project/creta/project/creta'))
.execute(client.query)
.execute(client)

await expect(userCreated).to.eventually.be.true
})
Expand All @@ -238,7 +238,7 @@ template
${ns('project/creta/project/creta')} ${schema.related} ${ns('project/roadshow')}
`
.FROM(ns('project/creta/project/creta'))
.execute(client.query)
.execute(client)

await expect(hasExpectedType).to.eventually.be.true
})
Expand All @@ -250,7 +250,7 @@ template
${ns('project/roadshow')} ${schema.related} ${ns('project/creta')}
`
.FROM(ns('project/roadshow'))
.execute(client.query)
.execute(client)

await expect(hasExpectedType).to.eventually.be.true
})
Expand All @@ -262,7 +262,7 @@ template
${ns('project/shaperone')} ${schema.related} ${ns('project/roadshow')}, ${ns('project/creta')}
`
.FROM(ns('project/shaperone'))
.execute(client.query)
.execute(client)

await expect(hasExpectedType).to.eventually.be.true
})
Expand All @@ -276,7 +276,7 @@ template
?resource <http://www.w3.org/ns/earl#test> "trig" ; a ?type
}
`
.execute(client.query)
.execute(client)

expect(results).to.deep.equalInAnyOrder([{
resource: ns('trig/users'),
Expand Down Expand Up @@ -314,7 +314,7 @@ template
.
`

await expect(ask.execute(client.query)).to.eventually.be.true
await expect(ask.execute(client)).to.eventually.be.true
})

it('merges statements from multiple dataset documents', async () => {
Expand All @@ -323,7 +323,7 @@ template
a ${foaf.Person} ;
${foaf.name} "Jane Doe" ;
.
`.execute(client.query)
`.execute(client)

await expect(ask).to.eventually.be.true
})
Expand All @@ -334,7 +334,7 @@ template
a ${foaf.Person} ;
${foaf.name} "John Doe" ;
.
`.execute(client.query)
`.execute(client)

await expect(ask).to.eventually.be.true
})
Expand Down
4 changes: 2 additions & 2 deletions packages/core/env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { create } from '@zazuko/env-node'
import parent, { Environment } from '@zazuko/env-node'
import { TalosNsFactory } from './lib/ns.js'

export default create(TalosNsFactory)
export default new Environment([TalosNsFactory], { parent })
Loading
Loading