@noeldemartin/solid-utils 0.6.0 → 0.6.1-next.155f4c9bba38ecc37a2ab5fda9f9d04b272aad72
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 +93 -23
- package/dist/noeldemartin-solid-utils.js +546 -189
- 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 +6 -6
- package/src/helpers/SolidClient.ts +50 -0
- package/src/helpers/auth.test.ts +23 -25
- package/src/helpers/auth.ts +2 -2
- package/src/helpers/index.ts +3 -0
- package/src/helpers/interop.ts +13 -8
- package/src/helpers/io.ts +107 -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 +17 -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,C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A;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,7 @@ 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>;
|
|
81
96
|
}
|
|
82
97
|
|
|
83
98
|
export declare interface FetchUserProfileOptions {
|
|
@@ -98,7 +113,7 @@ export declare function findInstanceRegistrations(typeIndexUrl: string, type: st
|
|
|
98
113
|
export declare function isJsonLDGraph(json: JsonLD): json is JsonLDGraph;
|
|
99
114
|
|
|
100
115
|
export declare type JsonLD = Partial<{
|
|
101
|
-
'@context': Record<string, unknown
|
|
116
|
+
'@context': Record<string, unknown> | string;
|
|
102
117
|
'@id': string;
|
|
103
118
|
'@type': null | string | string[];
|
|
104
119
|
}> & {
|
|
@@ -116,7 +131,7 @@ export declare type JsonLDResource = Omit<JsonLD, '@id'> & {
|
|
|
116
131
|
|
|
117
132
|
export declare function jsonldToQuads(json: JsonLD, baseIRI?: string): Promise<Quad[]>;
|
|
118
133
|
|
|
119
|
-
export declare class
|
|
134
|
+
export declare class MalformedSolidDocument extends JSError {
|
|
120
135
|
readonly documentUrl: string | null;
|
|
121
136
|
readonly documentFormat: SolidDocumentFormat;
|
|
122
137
|
readonly malformationDetails: string;
|
|
@@ -125,16 +140,18 @@ export declare class MalformedSolidDocumentError extends JSError {
|
|
|
125
140
|
|
|
126
141
|
export declare function mintJsonLDIdentifiers(jsonld: JsonLD): JsonLDResource;
|
|
127
142
|
|
|
128
|
-
export declare class
|
|
143
|
+
export declare class NetworkRequestFailed extends JSError {
|
|
129
144
|
readonly url: string;
|
|
130
145
|
constructor(url: string, options?: JSErrorOptions);
|
|
131
146
|
}
|
|
132
147
|
|
|
148
|
+
export declare function normalizeJsonLD(json: JsonLD, baseIRI?: string): Promise<JsonLD>;
|
|
149
|
+
|
|
133
150
|
export declare function normalizeSparql(sparql: string): string;
|
|
134
151
|
|
|
135
152
|
export declare function normalizeTurtle(sparql: string): string;
|
|
136
153
|
|
|
137
|
-
export declare class
|
|
154
|
+
export declare class NotFound extends JSError {
|
|
138
155
|
readonly url: string;
|
|
139
156
|
constructor(url: string);
|
|
140
157
|
}
|
|
@@ -156,15 +173,59 @@ export declare function quadToTurtle(quad: Quad): string;
|
|
|
156
173
|
|
|
157
174
|
export declare type RDFContext = Record<string, string>;
|
|
158
175
|
|
|
176
|
+
export declare class RDFDefaultGraph implements DefaultGraph {
|
|
177
|
+
termType: "DefaultGraph";
|
|
178
|
+
value: "";
|
|
179
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
159
182
|
export declare interface RDFGraphData {
|
|
160
183
|
quads: Quad[];
|
|
161
184
|
containsRelativeIRIs: boolean;
|
|
162
185
|
}
|
|
163
186
|
|
|
187
|
+
export declare class RDFLiteral implements Literal {
|
|
188
|
+
termType: "Literal";
|
|
189
|
+
value: string;
|
|
190
|
+
language: string;
|
|
191
|
+
datatype: NamedNode;
|
|
192
|
+
constructor(value: string, language?: string, datatype?: NamedNode);
|
|
193
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export declare class RDFNamedNode implements NamedNode {
|
|
197
|
+
termType: "NamedNode";
|
|
198
|
+
value: string;
|
|
199
|
+
constructor(value: string);
|
|
200
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export declare class RDFQuad implements Quad {
|
|
204
|
+
termType: "Quad";
|
|
205
|
+
value: "";
|
|
206
|
+
subject: Quad_Subject;
|
|
207
|
+
predicate: Quad_Predicate;
|
|
208
|
+
object: Quad_Object;
|
|
209
|
+
graph: Quad_Graph;
|
|
210
|
+
constructor(subject: string | Quad_Subject, predicate: string | Quad_Predicate, object: string | Quad_Object);
|
|
211
|
+
equals(other: Term_2 | null | undefined): boolean;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export declare class SolidClient {
|
|
215
|
+
private options;
|
|
216
|
+
constructor(options?: FetchSolidDocumentOptions);
|
|
217
|
+
create(url: string, body: string | Quad[], options?: Omit<CreateSolidDocumentOptions, keyof FetchSolidDocumentOptions>): Promise<SolidDocument>;
|
|
218
|
+
exists(url: string): Promise<boolean>;
|
|
219
|
+
read(url: string): Promise<SolidDocument>;
|
|
220
|
+
readIfFound(url: string): Promise<SolidDocument | null>;
|
|
221
|
+
update(url: string, update: SparqlUpdate): Promise<void>;
|
|
222
|
+
delete(url: string): Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
|
|
164
225
|
export declare class SolidDocument extends SolidStore {
|
|
165
226
|
readonly url: string;
|
|
166
227
|
readonly headers: Headers;
|
|
167
|
-
constructor(url: string, quads
|
|
228
|
+
constructor(url: string, quads?: Quad[], headers?: Headers);
|
|
168
229
|
isACPResource(): boolean;
|
|
169
230
|
isPersonalProfile(): boolean;
|
|
170
231
|
isStorage(): boolean;
|
|
@@ -172,6 +233,7 @@ export declare class SolidDocument extends SolidStore {
|
|
|
172
233
|
getUserPermissions(): SolidDocumentPermission[];
|
|
173
234
|
getPublicPermissions(): SolidDocumentPermission[];
|
|
174
235
|
getLastModified(): Date | null;
|
|
236
|
+
getDescriptionUrl(): string | undefined;
|
|
175
237
|
protected expandIRI(iri: string): string;
|
|
176
238
|
private getLatestDocumentDate;
|
|
177
239
|
private getPermissionsFromWAC;
|
|
@@ -196,11 +258,10 @@ export declare class SolidStore {
|
|
|
196
258
|
isEmpty(): boolean;
|
|
197
259
|
getQuads(): Quad[];
|
|
198
260
|
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;
|
|
261
|
+
statements(subject?: Quad_Subject | string, predicate?: Quad_Predicate | string, object?: Quad_Object | string): Quad[];
|
|
262
|
+
statement(subject?: Quad_Subject | string, predicate?: Quad_Predicate | string, object?: Quad_Object | string): Quad | null;
|
|
263
|
+
contains(subject: Quad_Subject | string, predicate?: Quad_Predicate | string, object?: Quad_Object | string): boolean;
|
|
264
|
+
getThing(subject: Quad_Subject | string): SolidThing;
|
|
204
265
|
protected termMatches(term: Term, value: Term | string): boolean;
|
|
205
266
|
}
|
|
206
267
|
|
|
@@ -228,6 +289,15 @@ export declare function sparqlToQuads(sparql: string, options?: Partial<ParsingO
|
|
|
228
289
|
|
|
229
290
|
export declare function sparqlToQuadsSync(sparql: string, options?: Partial<ParsingOptions>): Record<string, Quad[]>;
|
|
230
291
|
|
|
292
|
+
export declare class SparqlUpdate {
|
|
293
|
+
inserts: Quad[];
|
|
294
|
+
deletes: Quad[];
|
|
295
|
+
private document?;
|
|
296
|
+
constructor(document?: SolidDocument);
|
|
297
|
+
insert(...quads: Array<Quad | Quad[]>): this;
|
|
298
|
+
delete(subject: Quad_Subject, predicate?: Quad_Predicate, object?: Quad_Object): this;
|
|
299
|
+
}
|
|
300
|
+
|
|
231
301
|
export declare interface SubjectParts {
|
|
232
302
|
containerUrl?: string;
|
|
233
303
|
documentName?: string;
|
|
@@ -242,26 +312,26 @@ export declare function turtleToQuadsSync(turtle: string, options?: Partial<Pars
|
|
|
242
312
|
|
|
243
313
|
export declare type TypedFetch = (input: RequestInfo, options?: RequestInit) => Promise<Response>;
|
|
244
314
|
|
|
245
|
-
export declare class
|
|
315
|
+
export declare class Unauthorized extends JSError {
|
|
246
316
|
readonly url: string;
|
|
247
317
|
readonly responseStatus?: number;
|
|
248
318
|
constructor(url: string, responseStatus?: number);
|
|
249
319
|
get forbidden(): boolean | undefined;
|
|
250
320
|
}
|
|
251
321
|
|
|
252
|
-
export declare class
|
|
322
|
+
export declare class UnsuccessfulNetworkRequest extends JSError {
|
|
253
323
|
response: Response;
|
|
254
324
|
constructor(response: Response);
|
|
255
325
|
constructor(message: string, response: Response);
|
|
256
326
|
}
|
|
257
327
|
|
|
258
|
-
export declare class
|
|
328
|
+
export declare class UnsupportedAuthorizationProtocol extends JSError {
|
|
259
329
|
readonly url: string;
|
|
260
330
|
readonly protocol: string;
|
|
261
331
|
constructor(url: string, protocol: string, options?: JSErrorOptions);
|
|
262
332
|
}
|
|
263
333
|
|
|
264
|
-
export declare function updateSolidDocument(url: string,
|
|
334
|
+
export declare function updateSolidDocument(url: string, update: SparqlUpdate, options?: FetchSolidDocumentOptions): Promise<void>;
|
|
265
335
|
|
|
266
336
|
export declare type VitestSolidMatchers<R = unknown> = {
|
|
267
337
|
[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 +340,14 @@ export declare type VitestSolidMatchers<R = unknown> = {
|
|
|
270
340
|
export { }
|
|
271
341
|
|
|
272
342
|
|
|
343
|
+
declare module '@vitest/expect' {
|
|
344
|
+
interface Assertion<T> extends VitestSolidMatchers<T> {
|
|
345
|
+
}
|
|
346
|
+
interface AsymmetricMatchersContaining extends VitestSolidMatchers {
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
|
|
273
351
|
declare global {
|
|
274
352
|
namespace Chai {
|
|
275
353
|
interface Assertion extends ChaiSolidAssertions {
|
|
@@ -278,11 +356,3 @@ declare global {
|
|
|
278
356
|
}
|
|
279
357
|
}
|
|
280
358
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
declare module '@vitest/expect' {
|
|
284
|
-
interface Assertion<T> extends VitestSolidMatchers<T> {
|
|
285
|
-
}
|
|
286
|
-
interface AsymmetricMatchersContaining extends VitestSolidMatchers {
|
|
287
|
-
}
|
|
288
|
-
}
|