Skip to content

Commit

Permalink
build(deps): update sparql-http-client, environment, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Apr 8, 2024
1 parent 783a375 commit 6d87c04
Show file tree
Hide file tree
Showing 13 changed files with 535 additions and 1,068 deletions.
1,486 changes: 476 additions & 1,010 deletions package-lock.json

Large diffs are not rendered by default.

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
14 changes: 7 additions & 7 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",
"@hydrofoil/vocabularies": "^2.1.0",
"@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.0.11",
"anylogger-debug": "^1.0.3",
"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
22 changes: 11 additions & 11 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,18 +44,18 @@ 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 () => {
Expand All @@ -71,7 +71,7 @@ describe('@hydrofoil/talos/lib/command/put-vocabs', function () {
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 })
2 changes: 1 addition & 1 deletion packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path'
import fs from 'fs'
import { NamedNode, DatasetCore } from 'rdf-js'
import walk from '@fcostarodrigo/walk'
import type { Dataset } from '@zazuko/env/lib/Dataset'
import type { Dataset } from '@zazuko/env/lib/DatasetExt.js'
import $rdf from './env.js'
import log from './lib/log.js'
import { getPatchedStream } from './lib/fileStream.js'
Expand Down
6 changes: 3 additions & 3 deletions packages/core/lib/ns.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NsBuildersFactory } from '@tpluscode/rdf-ns-builders/Factory'
import type { NamespaceFactory } from '@rdfjs/namespace/Factory'
import type { Environment } from '@rdfjs/environment/Environment'
import type NsBuildersFactory from '@tpluscode/rdf-ns-builders'
import type { NamespaceFactory } from '@rdfjs/namespace/Factory.js'
import type { Environment } from '@rdfjs/environment/Environment.js'
import type { NamespaceBuilder } from '@rdfjs/namespace'

type TalosTerms =
Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
},
"dependencies": {
"@fcostarodrigo/walk": "^5.0.1",
"@zazuko/env-node": "^1.0.0",
"@zazuko/env-node": "^2.1.2",
"anylogger": "^1.0.11",
"is-absolute-url": "^4.0.1",
"mime-types": "^2.1.35",
"replacestream": "^4.0.3"
},
"devDependencies": {
"@rdfjs-elements/formats-pretty": "^0.6.4",
"@rdfjs-elements/formats-pretty": "^0.6.7",
"@zazuko/env": "^2",
"chai": "^4.3.8",
"get-stream": "^8.0.1",
"into-stream": "^8.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path'
import url from 'url'
import { expect } from 'chai'
import formats from '@rdfjs-elements/formats-pretty'
import type { Dataset } from '@zazuko/env/lib/Dataset'
import type { Dataset } from '@zazuko/env/lib/DatasetExt.js'
import $rdf from '../env.js'
import { fromDirectories } from '../index.js'

Expand Down
Loading

0 comments on commit 6d87c04

Please sign in to comment.