@noeldemartin/solid-utils 0.6.0 → 0.6.1-next.1553f43b2aa04a742457a6bd9f8a27569eee73f0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chai.d.ts +8 -8
- package/dist/chai.js +1 -1
- package/dist/chai.js.map +1 -1
- package/dist/{helpers-DGXMj9cx.js → helpers-DLm6Z1js.js} +2 -2
- package/dist/helpers-DLm6Z1js.js.map +1 -0
- package/dist/noeldemartin-solid-utils.d.ts +109 -23
- package/dist/noeldemartin-solid-utils.js +552 -181
- package/dist/noeldemartin-solid-utils.js.map +1 -1
- package/dist/rdf-B0lHGqhB.js +228 -0
- package/dist/rdf-B0lHGqhB.js.map +1 -0
- package/dist/testing.d.ts +9 -9
- package/dist/testing.js +1 -1
- package/dist/vitest.d.ts +9 -9
- package/dist/vitest.js +2 -2
- package/dist/vitest.js.map +1 -1
- package/package.json +70 -64
- package/src/errors/{NetworkRequestError.ts → NetworkRequestFailed.ts} +1 -1
- package/src/errors/{NotFoundError.ts → NotFound.ts} +1 -1
- package/src/errors/{UnauthorizedError.ts → Unauthorized.ts} +1 -1
- package/src/errors/{UnsuccessfulNetworkRequestError.ts → UnsuccessfulNetworkRequest.ts} +1 -1
- package/src/errors/{UnsupportedAuthorizationProtocolError.ts → UnsupportedAuthorizationProtocol.ts} +1 -1
- package/src/errors/index.ts +36 -6
- package/src/helpers/SolidClient.ts +66 -0
- package/src/helpers/auth.test.ts +23 -25
- package/src/helpers/auth.ts +2 -2
- package/src/helpers/index.ts +4 -0
- package/src/helpers/interop.ts +13 -8
- package/src/helpers/io.ts +114 -265
- package/src/helpers/jsonld.ts +1 -1
- package/src/helpers/patch-quads.ts +78 -0
- package/src/helpers/{io.test.ts → rdf.test.ts} +81 -2
- package/src/helpers/rdf.ts +268 -0
- package/src/helpers/vocabs.ts +1 -0
- package/src/helpers/wac.test.ts +17 -13
- package/src/helpers/wac.ts +2 -2
- package/src/index.ts +1 -0
- package/src/models/SolidDocument.ts +13 -3
- package/src/models/SolidStore.ts +29 -12
- package/src/rdf/RDFDefaultGraph.ts +12 -0
- package/src/rdf/RDFLiteral.ts +27 -0
- package/src/rdf/RDFNamedNode.ts +16 -0
- package/src/rdf/RDFQuad.ts +32 -0
- package/src/rdf/SparqlUpdate.ts +27 -0
- package/src/rdf/constants.ts +5 -0
- package/src/rdf/index.ts +5 -0
- package/src/testing/helpers.ts +1 -1
- package/src/testing/setup.ts +4 -0
- package/src/vitest/matchers.ts +1 -1
- package/dist/helpers-DGXMj9cx.js.map +0 -1
- package/dist/io-wCcrq4b9.js +0 -401
- package/dist/io-wCcrq4b9.js.map +0 -1
- /package/src/errors/{MalformedSolidDocumentError.ts → MalformedSolidDocument.ts} +0 -0
package/dist/chai.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export declare function installChaiSolidAssertions(): void;
|
|
|
13
13
|
export { }
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
declare module '@vitest/expect' {
|
|
17
|
+
interface Assertion<T> extends VitestSolidMatchers<T> {
|
|
18
|
+
}
|
|
19
|
+
interface AsymmetricMatchersContaining extends VitestSolidMatchers {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
16
24
|
declare global {
|
|
17
25
|
namespace Chai {
|
|
18
26
|
interface Assertion extends ChaiSolidAssertions {
|
|
@@ -21,11 +29,3 @@ declare global {
|
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
declare module '@vitest/expect' {
|
|
27
|
-
interface Assertion<T> extends VitestSolidMatchers<T> {
|
|
28
|
-
}
|
|
29
|
-
interface AsymmetricMatchersContaining extends VitestSolidMatchers {
|
|
30
|
-
}
|
|
31
|
-
}
|
package/dist/chai.js
CHANGED
package/dist/chai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chai.js","sources":["../src/chai/assertions.ts","../src/chai/index.ts"],"sourcesContent":["import { sparqlEquals, turtleEquals } from '@noeldemartin/solid-utils/testing/helpers';\nimport type { EqualityResult } from '@noeldemartin/solid-utils/testing/helpers';\n\nexport function defineChaiAssertions<T extends Record<string, (this: Chai.AssertionStatic, ...args: any[]) => void>>(\n assertions: T): T {\n return assertions;\n}\n\nexport default defineChaiAssertions({\n turtle(graph: string): void {\n const self = this as unknown as Chai.AssertionStatic;\n const actual = self._obj as string;\n const assert = self.assert.bind(this);\n const expected = graph;\n const result = turtleEquals(expected, actual);\n\n assert(result.success, result.message, '', result.expected, result.actual);\n },\n sparql(query: string): void {\n const self = this as unknown as Chai.AssertionStatic;\n const actual = self._obj as string;\n const assert = self.assert.bind(this);\n const expected = query;\n const result = sparqlEquals(expected, actual);\n\n assert(result.success, result.message, '', result.expected, result.actual);\n },\n equalityResult(): void {\n const self = this as unknown as Chai.AssertionStatic;\n const result = self._obj as EqualityResult;\n const assert = self.assert.bind(this);\n\n assert(result.success, result.message, '', result.expected, result.actual);\n },\n});\n","import assertions from './assertions';\n\nexport type ChaiSolidAssertions = {\n [assertion in keyof typeof assertions]: (typeof assertions)[assertion];\n};\n\nexport function installChaiSolidAssertions(): void {\n (globalThis as { chai?: Chai.ChaiStatic }).chai?.use((_chai) => {\n return Object.entries(assertions).forEach(([name, method]) => _chai.Assertion.addMethod(name, method));\n });\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Chai {\n interface Assertion extends ChaiSolidAssertions {}\n interface Include extends ChaiSolidAssertions {}\n }\n}\n"],"names":["assertions","graph","self","actual","assert","result","turtleEquals","query","sparqlEquals","installChaiSolidAssertions","_a","_chai","name","method"],"mappings":";AAQA,MAAAA,IAAoC;AAAA,EAChC,OAAOC,GAAqB;AACxB,UAAMC,IAAO,MACPC,IAASD,EAAK,MACdE,IAASF,EAAK,OAAO,KAAK,IAAI,GAE9BG,IAASC,EADEL,GACqBE,CAAM;
|
|
1
|
+
{"version":3,"file":"chai.js","sources":["../src/chai/assertions.ts","../src/chai/index.ts"],"sourcesContent":["import { sparqlEquals, turtleEquals } from '@noeldemartin/solid-utils/testing/helpers';\nimport type { EqualityResult } from '@noeldemartin/solid-utils/testing/helpers';\n\nexport function defineChaiAssertions<T extends Record<string, (this: Chai.AssertionStatic, ...args: any[]) => void>>(\n assertions: T): T {\n return assertions;\n}\n\nexport default defineChaiAssertions({\n turtle(graph: string): void {\n const self = this as unknown as Chai.AssertionStatic;\n const actual = self._obj as string;\n const assert = self.assert.bind(this);\n const expected = graph;\n const result = turtleEquals(expected, actual);\n\n assert(result.success, result.message, '', result.expected, result.actual);\n },\n sparql(query: string): void {\n const self = this as unknown as Chai.AssertionStatic;\n const actual = self._obj as string;\n const assert = self.assert.bind(this);\n const expected = query;\n const result = sparqlEquals(expected, actual);\n\n assert(result.success, result.message, '', result.expected, result.actual);\n },\n equalityResult(): void {\n const self = this as unknown as Chai.AssertionStatic;\n const result = self._obj as EqualityResult;\n const assert = self.assert.bind(this);\n\n assert(result.success, result.message, '', result.expected, result.actual);\n },\n});\n","import assertions from './assertions';\n\nexport type ChaiSolidAssertions = {\n [assertion in keyof typeof assertions]: (typeof assertions)[assertion];\n};\n\nexport function installChaiSolidAssertions(): void {\n (globalThis as { chai?: Chai.ChaiStatic }).chai?.use((_chai) => {\n return Object.entries(assertions).forEach(([name, method]) => _chai.Assertion.addMethod(name, method));\n });\n}\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Chai {\n interface Assertion extends ChaiSolidAssertions {}\n interface Include extends ChaiSolidAssertions {}\n }\n}\n"],"names":["assertions","graph","self","actual","assert","result","turtleEquals","query","sparqlEquals","installChaiSolidAssertions","_a","_chai","name","method"],"mappings":";AAQA,MAAAA,IAAoC;AAAA,EAChC,OAAOC,GAAqB;AACxB,UAAMC,IAAO,MACPC,IAASD,EAAK,MACdE,IAASF,EAAK,OAAO,KAAK,IAAI,GAE9BG,IAASC,EADEL,GACqBE,CAAM;AAE5C,IAAAC,EAAOC,EAAO,SAASA,EAAO,SAAS,IAAIA,EAAO,UAAUA,EAAO,MAAM;AAAA,EAC7E;AAAA,EACA,OAAOE,GAAqB;AACxB,UAAML,IAAO,MACPC,IAASD,EAAK,MACdE,IAASF,EAAK,OAAO,KAAK,IAAI,GAE9BG,IAASG,EADED,GACqBJ,CAAM;AAE5C,IAAAC,EAAOC,EAAO,SAASA,EAAO,SAAS,IAAIA,EAAO,UAAUA,EAAO,MAAM;AAAA,EAC7E;AAAA,EACA,iBAAuB;AACnB,UAAMH,IAAO,MACPG,IAASH,EAAK;AAGpB,IAFeA,EAAK,OAAO,KAAK,IAAI,EAE7BG,EAAO,SAASA,EAAO,SAAS,IAAIA,EAAO,UAAUA,EAAO,MAAM;AAAA,EAC7E;AACJ;AC5BO,SAASI,IAAmC;;AAC9C,GAAAC,IAAA,WAA0C,SAA1C,QAAAA,EAAgD,IAAI,CAACC,MAC3C,OAAO,QAAQX,CAAU,EAAE,QAAQ,CAAC,CAACY,GAAMC,CAAM,MAAMF,EAAM,UAAU,UAAUC,GAAMC,CAAM,CAAC;AAE7G;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pull as g, arrayRemove as q, JSError as v, stringMatchAll as j } from "@noeldemartin/utils";
|
|
2
|
-
import { j as m, q as T, s as E, a as y, t as w } from "./
|
|
2
|
+
import { j as m, q as T, s as E, a as y, t as w } from "./rdf-B0lHGqhB.js";
|
|
3
3
|
let i = {};
|
|
4
4
|
const Q = {
|
|
5
5
|
"%uuid%": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
|
|
@@ -104,4 +104,4 @@ export {
|
|
|
104
104
|
R as s,
|
|
105
105
|
z as t
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=helpers-
|
|
107
|
+
//# sourceMappingURL=helpers-DLm6Z1js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-DLm6Z1js.js","sources":["../src/testing/helpers.ts"],"sourcesContent":["import { JSError, arrayRemove, pull, stringMatchAll } from '@noeldemartin/utils';\nimport type { Quad, Quad_Object } from '@rdfjs/types';\n\nimport {\n jsonldToQuads,\n quadToTurtle,\n quadsToTurtle,\n sparqlToQuadsSync,\n turtleToQuadsSync,\n} from '@noeldemartin/solid-utils/helpers/rdf';\nimport type { JsonLD } from '@noeldemartin/solid-utils/helpers/jsonld';\n\nlet patternsRegExpsIndex: Record<string, RegExp> = {};\nconst builtInPatterns: Record<string, string> = {\n '%uuid%': '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',\n};\n\nclass ExpectedQuadAssertionError extends JSError {\n\n constructor(public readonly expectedQuad: Quad) {\n super(`Couldn't find the following triple: ${quadToTurtle(expectedQuad)}`);\n }\n\n}\n\nfunction assertExpectedQuadsExist(expectedQuads: Quad[], actualQuads: Quad[]): void {\n for (const expectedQuad of expectedQuads) {\n const matchingQuad = actualQuads.find((actualQuad) => quadEquals(expectedQuad, actualQuad));\n\n if (!matchingQuad) throw new ExpectedQuadAssertionError(expectedQuad);\n\n arrayRemove(actualQuads, matchingQuad);\n }\n}\n\nfunction containsPatterns(value: string): boolean {\n return /\\[\\[(.*\\]\\[)?([^\\]]+)\\]\\]/.test(value);\n}\n\nfunction createPatternRegexp(expected: string): RegExp {\n const patternAliases = [];\n const patternMatches = stringMatchAll<4, 1 | 2>(expected, /\\[\\[((.*?)\\]\\[)?([^\\]]+)\\]\\]/g);\n const patterns: string[] = [];\n let expectedRegExp = expected;\n\n for (const patternMatch of patternMatches) {\n patternMatch[2] && patternAliases.push(patternMatch[2]);\n\n patterns.push(patternMatch[3]);\n\n expectedRegExp = expectedRegExp.replace(patternMatch[0], `%PATTERN${patterns.length - 1}%`);\n }\n\n expectedRegExp = expectedRegExp.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n\n for (const [patternIndex, pattern] of Object.entries(patterns)) {\n expectedRegExp = expectedRegExp.replace(`%PATTERN${patternIndex}%`, builtInPatterns[pattern] ?? pattern);\n }\n\n return new RegExp(expectedRegExp);\n}\n\nfunction quadValueEquals(expected: string, actual: string): boolean {\n return containsPatterns(expected)\n ? (patternsRegExpsIndex[expected] ??= createPatternRegexp(expected)).test(actual)\n : expected === actual;\n}\n\nfunction quadObjectEquals(expected: Quad_Object, actual: Quad_Object): boolean {\n if (expected.termType !== actual.termType) return false;\n\n if (expected.termType === 'Literal' && actual.termType === 'Literal') {\n if (expected.datatype.value !== actual.datatype.value) return false;\n\n if (!containsPatterns(expected.value))\n return expected.datatype.value === 'http://www.w3.org/2001/XMLSchema#dateTime'\n ? new Date(expected.value).getTime() === new Date(actual.value).getTime()\n : expected.value === actual.value;\n }\n\n return quadValueEquals(expected.value, actual.value);\n}\n\nfunction quadEquals(expected: Quad, actual: Quad): boolean {\n return (\n quadObjectEquals(expected.object, actual.object) &&\n quadValueEquals(expected.subject.value, actual.subject.value) &&\n quadValueEquals(expected.predicate.value, actual.predicate.value)\n );\n}\n\nfunction resetPatterns(): void {\n patternsRegExpsIndex = {};\n}\n\nexport interface EqualityResult {\n success: boolean;\n message: string;\n expected: string;\n actual: string;\n}\n\nexport async function jsonldEquals(expected: JsonLD, actual: JsonLD): Promise<EqualityResult> {\n // TODO catch parsing errors and improve message.\n resetPatterns();\n\n const expectedQuads = await jsonldToQuads(expected);\n const actualQuads = await jsonldToQuads(actual);\n const expectedTurtle = quadsToTurtle(expectedQuads);\n const actualTurtle = quadsToTurtle(actualQuads);\n const result = (success: boolean, message: string) => ({\n success,\n message,\n expected: expectedTurtle,\n actual: actualTurtle,\n });\n\n if (expectedQuads.length !== actualQuads.length)\n return result(false, `Expected ${expectedQuads.length} triples, found ${actualQuads.length}.`);\n\n try {\n assertExpectedQuadsExist(expectedQuads, actualQuads);\n } catch (error) {\n if (!(error instanceof ExpectedQuadAssertionError)) throw error;\n\n return result(false, error.message);\n }\n\n return result(true, 'jsonld matches');\n}\n\nexport function sparqlEquals(expected: string, actual: string): EqualityResult {\n // TODO catch parsing errors and improve message.\n resetPatterns();\n\n const expectedOperations = sparqlToQuadsSync(expected, { normalizeBlankNodes: true });\n const actualOperations = sparqlToQuadsSync(actual, { normalizeBlankNodes: true });\n const result = (success: boolean, message: string) => ({ success, message, expected, actual });\n\n for (const operation of Object.keys(expectedOperations)) {\n if (!(operation in actualOperations)) return result(false, `Couldn't find expected ${operation} operation.`);\n\n const expectedQuads = pull(expectedOperations, operation);\n const actualQuads = pull(actualOperations, operation);\n\n if (expectedQuads.length !== actualQuads.length)\n return result(false, `Expected ${expectedQuads.length} ${operation} triples, found ${actualQuads.length}.`);\n\n try {\n assertExpectedQuadsExist(expectedQuads, actualQuads);\n } catch (error) {\n if (!(error instanceof ExpectedQuadAssertionError)) throw error;\n\n return result(\n false,\n `Couldn't find the following ${operation} triple: ${quadToTurtle(error.expectedQuad)}`,\n );\n }\n }\n\n const unexpectedOperation = Object.keys(actualOperations)[0] ?? null;\n if (unexpectedOperation) return result(false, `Did not expect to find ${unexpectedOperation} triples.`);\n\n return result(true, 'sparql matches');\n}\n\nexport function turtleEquals(expected: string, actual: string): EqualityResult {\n // TODO catch parsing errors and improve message.\n resetPatterns();\n\n const expectedQuads = turtleToQuadsSync(expected, { normalizeBlankNodes: true });\n const actualQuads = turtleToQuadsSync(actual, { normalizeBlankNodes: true });\n const result = (success: boolean, message: string) => ({ success, message, expected, actual });\n\n if (expectedQuads.length !== actualQuads.length)\n return result(false, `Expected ${expectedQuads.length} triples, found ${actualQuads.length}.`);\n\n try {\n assertExpectedQuadsExist(expectedQuads, actualQuads);\n } catch (error) {\n if (!(error instanceof ExpectedQuadAssertionError)) throw error;\n\n return result(false, error.message);\n }\n\n return result(true, 'turtle matches');\n}\n"],"names":["patternsRegExpsIndex","builtInPatterns","ExpectedQuadAssertionError","JSError","expectedQuad","quadToTurtle","assertExpectedQuadsExist","expectedQuads","actualQuads","matchingQuad","actualQuad","quadEquals","arrayRemove","containsPatterns","value","createPatternRegexp","expected","patternAliases","patternMatches","stringMatchAll","patterns","expectedRegExp","patternMatch","patternIndex","pattern","quadValueEquals","actual","quadObjectEquals","resetPatterns","jsonldEquals","jsonldToQuads","expectedTurtle","quadsToTurtle","actualTurtle","result","success","message","error","sparqlEquals","expectedOperations","sparqlToQuadsSync","actualOperations","operation","pull","unexpectedOperation","turtleEquals","turtleToQuadsSync"],"mappings":";;AAYA,IAAIA,IAA+C,CAAA;AACnD,MAAMC,IAA0C;AAAA,EAC5C,UAAU;AACd;AAEA,MAAMC,UAAmCC,EAAQ;AAAA,EAE7C,YAA4BC,GAAoB;AAC5C,UAAM,uCAAuCC,EAAaD,CAAY,CAAC,EAAE,GADjD,KAAA,eAAAA;AAAA,EAE5B;AAEJ;AAEA,SAASE,EAAyBC,GAAuBC,GAA2B;AAChF,aAAWJ,KAAgBG,GAAe;AACtC,UAAME,IAAeD,EAAY,KAAK,CAACE,MAAeC,EAAWP,GAAcM,CAAU,CAAC;AAE1F,QAAI,CAACD,EAAc,OAAM,IAAIP,EAA2BE,CAAY;AAEpE,IAAAQ,EAAYJ,GAAaC,CAAY;AAAA,EACzC;AACJ;AAEA,SAASI,EAAiBC,GAAwB;AAC9C,SAAO,4BAA4B,KAAKA,CAAK;AACjD;AAEA,SAASC,EAAoBC,GAA0B;AACnD,QAAMC,IAAiB,CAAA,GACjBC,IAAiBC,EAAyBH,GAAU,+BAA+B,GACnFI,IAAqB,CAAA;AAC3B,MAAIC,IAAiBL;AAErB,aAAWM,KAAgBJ;AACvB,IAAAI,EAAa,CAAC,KAAKL,EAAe,KAAKK,EAAa,CAAC,CAAC,GAEtDF,EAAS,KAAKE,EAAa,CAAC,CAAC,GAE7BD,IAAiBA,EAAe,QAAQC,EAAa,CAAC,GAAG,WAAWF,EAAS,SAAS,CAAC,GAAG;AAG9F,EAAAC,IAAiBA,EAAe,QAAQ,4BAA4B,MAAM;AAE1E,aAAW,CAAC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AAAA,IAE5F;AAAA,EACJ;AAEA,QAAMO,IAAsB,OAAO,KAAKH,CAAgB,EAAE,CAAC,KAAK;AAChE,SAAIG,IAA4BV,EAAO,IAAO,0BAA0BU,CAAmB,WAAW,IAE/FV,EAAO,IAAM,gBAAgB;AACxC;AAEO,SAASW,EAAa7B,GAAkBU,GAAgC;AAE3E,EAAAE,EAAA;AAEA,QAAMrB,IAAgBuC,EAAkB9B,GAAU,EAAE,qBAAqB,IAAM,GACzER,IAAcsC,EAAkBpB,GAAQ,EAAE,qBAAqB,IAAM,GACrEQ,IAAS,CAACC,GAAkBC,OAAqB,EAAE,SAAAD,GAAS,SAAAC,GAAS,UAAApB,GAAU,QAAAU;AAErF,MAAInB,EAAc,WAAWC,EAAY;AACrC,WAAO0B,EAAO,IAAO,YAAY3B,EAAc,MAAM,mBAAmBC,EAAY,MAAM,GAAG;AAEjG,MAAI;AACA,IAAAF,EAAyBC,GAAeC,CAAW;AAAA,EACvD,SAAS6B,GAAO;AACZ,QAAI,EAAEA,aAAiBnC,GAA6B,OAAMmC;AAE1D,WAAOH,EAAO,IAAOG,EAAM,OAAO;AAAA,EACtC;AAEA,SAAOH,EAAO,IAAM,gBAAgB;AACxC;"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { BlankNode } from '@rdfjs/types';
|
|
2
|
+
import { DefaultGraph } from '@rdfjs/types';
|
|
2
3
|
import { JSError } from '@noeldemartin/utils';
|
|
3
4
|
import { JSErrorOptions } from '@noeldemartin/utils';
|
|
4
5
|
import { Literal } from '@rdfjs/types';
|
|
5
6
|
import { MatcherState } from '@vitest/expect';
|
|
6
7
|
import { NamedNode } from '@rdfjs/types';
|
|
7
8
|
import { Quad } from '@rdfjs/types';
|
|
9
|
+
import { Quad_Graph } from '@rdfjs/types';
|
|
10
|
+
import { Quad_Object } from '@rdfjs/types';
|
|
11
|
+
import { Quad_Predicate } from '@rdfjs/types';
|
|
12
|
+
import { Quad_Subject } from '@rdfjs/types';
|
|
13
|
+
import { Term as Term_2 } from '@rdfjs/types';
|
|
8
14
|
import { Variable } from '@rdfjs/types';
|
|
9
15
|
|
|
10
16
|
export declare type AnyFetch = (input: any, options?: any) => Promise<Response>;
|
|
@@ -25,7 +31,13 @@ export declare function createPrivateTypeIndex(user: SolidUserProfile, fetch?: F
|
|
|
25
31
|
*/
|
|
26
32
|
export declare function createPublicTypeIndex(user: SolidUserProfile, fetch?: Fetch): Promise<string>;
|
|
27
33
|
|
|
28
|
-
export declare function
|
|
34
|
+
export declare function createSolidContainer(url: string, body: string | Quad[], options?: CreateSolidDocumentOptions): Promise<SolidDocument>;
|
|
35
|
+
|
|
36
|
+
export declare function createSolidDocument(url: string, body?: string | Quad[], options?: CreateSolidDocumentOptions): Promise<SolidDocument>;
|
|
37
|
+
|
|
38
|
+
export declare interface CreateSolidDocumentOptions extends FetchSolidDocumentOptions {
|
|
39
|
+
method?: 'PATCH' | 'PUT';
|
|
40
|
+
}
|
|
29
41
|
|
|
30
42
|
declare const _default: {
|
|
31
43
|
turtle(this: Chai.AssertionStatic, graph: string): void;
|
|
@@ -50,6 +62,8 @@ declare const _default_2: {
|
|
|
50
62
|
|
|
51
63
|
export declare function defineIRIPrefix(name: string, value: string): void;
|
|
52
64
|
|
|
65
|
+
export declare function deleteSolidDocument(url: string, options?: FetchSolidDocumentOptions): Promise<void>;
|
|
66
|
+
|
|
53
67
|
export declare function expandIRI(iri: string, options?: Partial<ExpandIRIOptions>): string;
|
|
54
68
|
|
|
55
69
|
export declare interface ExpandIRIOptions {
|
|
@@ -78,6 +92,8 @@ export declare function fetchSolidDocumentIfFound(url: string, options?: FetchSo
|
|
|
78
92
|
export declare interface FetchSolidDocumentOptions {
|
|
79
93
|
fetch?: Fetch;
|
|
80
94
|
cache?: RequestCache;
|
|
95
|
+
headers?: Record<string, string>;
|
|
96
|
+
base?: string;
|
|
81
97
|
}
|
|
82
98
|
|
|
83
99
|
export declare interface FetchUserProfileOptions {
|
|
@@ -98,7 +114,7 @@ export declare function findInstanceRegistrations(typeIndexUrl: string, type: st
|
|
|
98
114
|
export declare function isJsonLDGraph(json: JsonLD): json is JsonLDGraph;
|
|
99
115
|
|
|
100
116
|
export declare type JsonLD = Partial<{
|
|
101
|
-
'@context': Record<string, unknown
|
|
117
|
+
'@context': Record<string, unknown> | string;
|
|
102
118
|
'@id': string;
|
|
103
119
|
'@type': null | string | string[];
|
|
104
120
|
}> & {
|
|
@@ -116,28 +132,36 @@ export declare type JsonLDResource = Omit<JsonLD, '@id'> & {
|
|
|
116
132
|
|
|
117
133
|
export declare function jsonldToQuads(json: JsonLD, baseIRI?: string): Promise<Quad[]>;
|
|
118
134
|
|
|
119
|
-
|
|
135
|
+
declare class MalformedSolidDocumentError extends JSError {
|
|
120
136
|
readonly documentUrl: string | null;
|
|
121
137
|
readonly documentFormat: SolidDocumentFormat;
|
|
122
138
|
readonly malformationDetails: string;
|
|
123
139
|
constructor(documentUrl: string | null, documentFormat: SolidDocumentFormat, malformationDetails: string);
|
|
124
140
|
}
|
|
141
|
+
export { MalformedSolidDocumentError as MalformedSolidDocument }
|
|
142
|
+
export { MalformedSolidDocumentError }
|
|
125
143
|
|
|
126
144
|
export declare function mintJsonLDIdentifiers(jsonld: JsonLD): JsonLDResource;
|
|
127
145
|
|
|
128
|
-
|
|
146
|
+
declare class NetworkRequestFailed extends JSError {
|
|
129
147
|
readonly url: string;
|
|
130
148
|
constructor(url: string, options?: JSErrorOptions);
|
|
131
149
|
}
|
|
150
|
+
export { NetworkRequestFailed as NetworkRequestError }
|
|
151
|
+
export { NetworkRequestFailed }
|
|
152
|
+
|
|
153
|
+
export declare function normalizeJsonLD(json: JsonLD, baseIRI?: string): Promise<JsonLD>;
|
|
132
154
|
|
|
133
155
|
export declare function normalizeSparql(sparql: string): string;
|
|
134
156
|
|
|
135
157
|
export declare function normalizeTurtle(sparql: string): string;
|
|
136
158
|
|
|
137
|
-
|
|
159
|
+
declare class NotFound extends JSError {
|
|
138
160
|
readonly url: string;
|
|
139
161
|
constructor(url: string);
|
|
140
162
|
}
|
|
163
|
+
export { NotFound }
|
|
164
|
+
export { NotFound as NotFoundError }
|
|
141
165
|
|
|
142
166
|
export declare function parseResourceSubject(subject: string): SubjectParts;
|
|
143
167
|
|
|
@@ -156,15 +180,62 @@ export declare function quadToTurtle(quad: Quad): string;
|
|
|
156
180
|
|
|
157
181
|
export declare type RDFContext = Record<string, string>;
|
|
158
182
|
|
|
183
|
+
export declare class RDFDefaultGraph implements DefaultGraph {
|
|
184
|
+
termType: "DefaultGraph";
|
|
185
|
+
value: "";
|
|
186
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
187
|
+
}
|
|
188
|
+
|
|
159
189
|
export declare interface RDFGraphData {
|
|
160
190
|
quads: Quad[];
|
|
161
191
|
containsRelativeIRIs: boolean;
|
|
162
192
|
}
|
|
163
193
|
|
|
194
|
+
export declare class RDFLiteral implements Literal {
|
|
195
|
+
termType: "Literal";
|
|
196
|
+
value: string;
|
|
197
|
+
language: string;
|
|
198
|
+
datatype: NamedNode;
|
|
199
|
+
constructor(value: string, language?: string, datatype?: NamedNode);
|
|
200
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export declare class RDFNamedNode implements NamedNode {
|
|
204
|
+
termType: "NamedNode";
|
|
205
|
+
value: string;
|
|
206
|
+
constructor(value: string);
|
|
207
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export declare class RDFQuad implements Quad {
|
|
211
|
+
termType: "Quad";
|
|
212
|
+
value: "";
|
|
213
|
+
subject: Quad_Subject;
|
|
214
|
+
predicate: Quad_Predicate;
|
|
215
|
+
object: Quad_Object;
|
|
216
|
+
graph: Quad_Graph;
|
|
217
|
+
constructor(subject: string | Quad_Subject, predicate: string | Quad_Predicate, object: string | Quad_Object);
|
|
218
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export declare class SolidClient {
|
|
222
|
+
private options;
|
|
223
|
+
constructor(options?: SolidClientOptions);
|
|
224
|
+
getFetch(): Fetch | null;
|
|
225
|
+
create(url: string, body: string | Quad[], options?: Omit<CreateSolidDocumentOptions, keyof SolidClientOptions>): Promise<SolidDocument>;
|
|
226
|
+
exists(url: string): Promise<boolean>;
|
|
227
|
+
read(url: string): Promise<SolidDocument>;
|
|
228
|
+
readIfFound(url: string): Promise<SolidDocument | null>;
|
|
229
|
+
update(url: string, update: SparqlUpdate, options?: Omit<FetchSolidDocumentOptions, keyof SolidClientOptions>): Promise<void>;
|
|
230
|
+
delete(url: string): Promise<void>;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export declare type SolidClientOptions = Pick<FetchSolidDocumentOptions, 'fetch' | 'cache' | 'headers'>;
|
|
234
|
+
|
|
164
235
|
export declare class SolidDocument extends SolidStore {
|
|
165
236
|
readonly url: string;
|
|
166
237
|
readonly headers: Headers;
|
|
167
|
-
constructor(url: string, quads
|
|
238
|
+
constructor(url: string, quads?: Quad[], headers?: Headers);
|
|
168
239
|
isACPResource(): boolean;
|
|
169
240
|
isPersonalProfile(): boolean;
|
|
170
241
|
isStorage(): boolean;
|
|
@@ -172,6 +243,7 @@ export declare class SolidDocument extends SolidStore {
|
|
|
172
243
|
getUserPermissions(): SolidDocumentPermission[];
|
|
173
244
|
getPublicPermissions(): SolidDocumentPermission[];
|
|
174
245
|
getLastModified(): Date | null;
|
|
246
|
+
getDescriptionUrl(): string;
|
|
175
247
|
protected expandIRI(iri: string): string;
|
|
176
248
|
private getLatestDocumentDate;
|
|
177
249
|
private getPermissionsFromWAC;
|
|
@@ -196,11 +268,10 @@ export declare class SolidStore {
|
|
|
196
268
|
isEmpty(): boolean;
|
|
197
269
|
getQuads(): Quad[];
|
|
198
270
|
addQuads(quads: Quad[]): void;
|
|
199
|
-
statements(subject?:
|
|
200
|
-
statement(subject?:
|
|
201
|
-
contains(subject: string, predicate?: string, object?: string): boolean;
|
|
202
|
-
getThing(subject: string): SolidThing;
|
|
203
|
-
protected expandIRI(iri: string): string;
|
|
271
|
+
statements(subject?: Quad_Subject | string, predicate?: Quad_Predicate | string, object?: Quad_Object | string): Quad[];
|
|
272
|
+
statement(subject?: Quad_Subject | string, predicate?: Quad_Predicate | string, object?: Quad_Object | string): Quad | null;
|
|
273
|
+
contains(subject: Quad_Subject | string, predicate?: Quad_Predicate | string, object?: Quad_Object | string): boolean;
|
|
274
|
+
getThing(subject: Quad_Subject | string): SolidThing;
|
|
204
275
|
protected termMatches(term: Term, value: Term | string): boolean;
|
|
205
276
|
}
|
|
206
277
|
|
|
@@ -228,6 +299,15 @@ export declare function sparqlToQuads(sparql: string, options?: Partial<ParsingO
|
|
|
228
299
|
|
|
229
300
|
export declare function sparqlToQuadsSync(sparql: string, options?: Partial<ParsingOptions>): Record<string, Quad[]>;
|
|
230
301
|
|
|
302
|
+
export declare class SparqlUpdate {
|
|
303
|
+
inserts: Quad[];
|
|
304
|
+
deletes: Quad[];
|
|
305
|
+
private document?;
|
|
306
|
+
constructor(document?: SolidDocument);
|
|
307
|
+
insert(...quads: Array<Quad | Quad[]>): this;
|
|
308
|
+
delete(subject: Quad_Subject, predicate?: Quad_Predicate, object?: Quad_Object): this;
|
|
309
|
+
}
|
|
310
|
+
|
|
231
311
|
export declare interface SubjectParts {
|
|
232
312
|
containerUrl?: string;
|
|
233
313
|
documentName?: string;
|
|
@@ -242,26 +322,32 @@ export declare function turtleToQuadsSync(turtle: string, options?: Partial<Pars
|
|
|
242
322
|
|
|
243
323
|
export declare type TypedFetch = (input: RequestInfo, options?: RequestInit) => Promise<Response>;
|
|
244
324
|
|
|
245
|
-
|
|
325
|
+
declare class Unauthorized extends JSError {
|
|
246
326
|
readonly url: string;
|
|
247
327
|
readonly responseStatus?: number;
|
|
248
328
|
constructor(url: string, responseStatus?: number);
|
|
249
329
|
get forbidden(): boolean | undefined;
|
|
250
330
|
}
|
|
331
|
+
export { Unauthorized }
|
|
332
|
+
export { Unauthorized as UnauthorizedError }
|
|
251
333
|
|
|
252
|
-
|
|
334
|
+
declare class UnsuccessfulRequest extends JSError {
|
|
253
335
|
response: Response;
|
|
254
336
|
constructor(response: Response);
|
|
255
337
|
constructor(message: string, response: Response);
|
|
256
338
|
}
|
|
339
|
+
export { UnsuccessfulRequest as UnsuccessfulNetworkRequest }
|
|
340
|
+
export { UnsuccessfulRequest as UnsuccessfulNetworkRequestError }
|
|
257
341
|
|
|
258
|
-
|
|
342
|
+
declare class UnsupportedAuthorizationProtocol extends JSError {
|
|
259
343
|
readonly url: string;
|
|
260
344
|
readonly protocol: string;
|
|
261
345
|
constructor(url: string, protocol: string, options?: JSErrorOptions);
|
|
262
346
|
}
|
|
347
|
+
export { UnsupportedAuthorizationProtocol }
|
|
348
|
+
export { UnsupportedAuthorizationProtocol as UnsupportedAuthorizationProtocolError }
|
|
263
349
|
|
|
264
|
-
export declare function updateSolidDocument(url: string,
|
|
350
|
+
export declare function updateSolidDocument(url: string, update: SparqlUpdate, options?: FetchSolidDocumentOptions): Promise<void>;
|
|
265
351
|
|
|
266
352
|
export declare type VitestSolidMatchers<R = unknown> = {
|
|
267
353
|
[K in keyof typeof _default_2]: (...args: Parameters<(typeof _default_2)[K]> extends [any, ...infer Rest] ? Rest : never) => ReturnType<(typeof _default_2)[K]> extends Promise<any> ? Promise<R> : R;
|
|
@@ -270,6 +356,14 @@ export declare type VitestSolidMatchers<R = unknown> = {
|
|
|
270
356
|
export { }
|
|
271
357
|
|
|
272
358
|
|
|
359
|
+
declare module '@vitest/expect' {
|
|
360
|
+
interface Assertion<T> extends VitestSolidMatchers<T> {
|
|
361
|
+
}
|
|
362
|
+
interface AsymmetricMatchersContaining extends VitestSolidMatchers {
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
273
367
|
declare global {
|
|
274
368
|
namespace Chai {
|
|
275
369
|
interface Assertion extends ChaiSolidAssertions {
|
|
@@ -278,11 +372,3 @@ declare global {
|
|
|
278
372
|
}
|
|
279
373
|
}
|
|
280
374
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
declare module '@vitest/expect' {
|
|
284
|
-
interface Assertion<T> extends VitestSolidMatchers<T> {
|
|
285
|
-
}
|
|
286
|
-
interface AsymmetricMatchersContaining extends VitestSolidMatchers {
|
|
287
|
-
}
|
|
288
|
-
}
|