@noeldemartin/solid-utils 0.6.0 → 0.6.1-next.0d15181b9561088547ef2d0f22a04aef565e06bb

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 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
@@ -1,4 +1,4 @@
1
- import { s as o, t as r } from "./helpers-DGXMj9cx.js";
1
+ import { s as o, t as r } from "./helpers-CIIrVGVG.js";
2
2
  const i = {
3
3
  turtle(t) {
4
4
  const s = this, c = s._obj, a = s.assert.bind(this), e = r(t, c);
@@ -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 "./io-wCcrq4b9.js";
2
+ import { j as m, q as T, s as E, a as y, t as w } from "./io-CT3AW8WO.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-DGXMj9cx.js.map
107
+ //# sourceMappingURL=helpers-CIIrVGVG.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers-DGXMj9cx.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/io';\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,CAAC;AACpD,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,EAAA;AAIhC;AAEA,SAASE,EAAyBC,GAAuBC,GAA2B;AAChF,aAAWJ,KAAgBG,GAAe;AAChC,UAAAE,IAAeD,EAAY,KAAK,CAACE,MAAeC,EAAWP,GAAcM,CAAU,CAAC;AAE1F,QAAI,CAACD,EAAoB,OAAA,IAAIP,EAA2BE,CAAY;AAEpE,IAAAQ,EAAYJ,GAAaC,CAAY;AAAA,EAAA;AAE7C;AAEA,SAASI,EAAiBC,GAAwB;AACvC,SAAA,4BAA4B,KAAKA,CAAK;AACjD;AAEA,SAASC,EAAoBC,GAA0B;AACnD,QAAMC,IAAiB,CAAC,GAClBC,IAAiBC,EAAyBH,GAAU,+BAA+B,GACnFI,IAAqB,CAAC;AAC5B,MAAIC,IAAiBL;AAErB,aAAWM,KAAgBJ;AACvB,IAAAI,EAAa,CAAC,KAAKL,EAAe,KAAKK,EAAa,CAAC,CAAC,GAE7CF,EAAA,KAAKE,EAAa,CAAC,CAAC,GAEZD,IAAAA,EAAe,QAAQC,EAAa,CAAC,GAAG,WAAWF,EAAS,SAAS,CAAC,GAAG;AAG7E,EAAAC,IAAAA,EAAe,QAAQ,4BAA4B,MAAM;AAE1E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AAA,IAAA;AAAA,EACJ;AAGJ,QAAMO,IAAsB,OAAO,KAAKH,CAAgB,EAAE,CAAC,KAAK;AAChE,SAAIG,IAA4BV,EAAO,IAAO,0BAA0BU,CAAmB,WAAW,IAE/FV,EAAO,IAAM,gBAAgB;AACxC;AAEgB,SAAAW,EAAa7B,GAAkBU,GAAgC;AAE7D,EAAAE,EAAA;AAEd,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;AAEjF,MAAAnB,EAAc,WAAWC,EAAY;AAC9B,WAAA0B,EAAO,IAAO,YAAY3B,EAAc,MAAM,mBAAmBC,EAAY,MAAM,GAAG;AAE7F,MAAA;AACA,IAAAF,EAAyBC,GAAeC,CAAW;AAAA,WAC9C6B,GAAO;AACR,QAAA,EAAEA,aAAiBnC,GAAmC,OAAAmC;AAEnD,WAAAH,EAAO,IAAOG,EAAM,OAAO;AAAA,EAAA;AAG/B,SAAAH,EAAO,IAAM,gBAAgB;AACxC;"}
1
+ {"version":3,"file":"helpers-CIIrVGVG.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/io';\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,CAAC;AACpD,MAAMC,IAA0C;AAAA,EAC5C,UAAU;AACd;AAEA,MAAMC,UAAmCC,EAAQ;AAAA,EAE7C,YAA4BC,GAAoB;AAC5C,UAAM,uCAAuCC,EAAaD,CAAY,CAAC,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AAA0B,EAAO,IAAO,YAAY3B,EAAc,MAAM,mBAAmBC,EAAY,MAAM,GAAG;AAE7F,MAAA;AACA,IAAAF,EAAyBC,GAAeC,CAAW;AAAA,WAC9C6B,GAAO;AACR,QAAA,EAAEA,aAAiBnC,GAAmC,OAAAmC;AAEnD,WAAAH,EAAO,IAAOG,EAAM,OAAO;AAAA,EAAA;AAG/B,SAAAH,EAAO,IAAM,gBAAgB;AACxC;"}
@@ -1,43 +1,43 @@
1
- var E = Object.defineProperty;
2
- var k = (r, t, e) => t in r ? E(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var i = (r, t, e) => k(r, typeof t != "symbol" ? t + "" : t, e);
4
- import w from "jsonld";
5
- import $ from "md5";
6
- import { JSError as h, parseDate as f, stringMatch as Q, arrayFilter as v, objectWithoutEmpty as T, stringMatchAll as x, arr as b, tap as L, arrayReplace as F } from "@noeldemartin/utils";
7
- import { Parser as q, Writer as S, BlankNode as W, Quad as z } from "n3";
8
- function B(r, t, e) {
1
+ var L = Object.defineProperty;
2
+ var Q = (r, t, e) => t in r ? L(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var i = (r, t, e) => Q(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import m from "jsonld";
5
+ import z from "md5";
6
+ import { JSError as f, parseDate as p, stringMatch as W, arrayFilter as T, objectWithoutEmpty as x, stringMatchAll as q, arr as b, tap as F, arrayReplace as B } from "@noeldemartin/utils";
7
+ import { Parser as j, Writer as S, BlankNode as O, Quad as U } from "n3";
8
+ function J(r, t, e) {
9
9
  return r ? `Malformed ${t} document found at ${r} - ${e}` : `Malformed ${t} document - ${e}`;
10
10
  }
11
- var m = /* @__PURE__ */ ((r) => (r.Turtle = "Turtle", r))(m || {});
12
- class P extends h {
11
+ var g = /* @__PURE__ */ ((r) => (r.Turtle = "Turtle", r))(g || {});
12
+ class P extends f {
13
13
  constructor(e, s, n) {
14
- super(B(e, s, n));
14
+ super(J(e, s, n));
15
15
  i(this, "documentUrl");
16
16
  i(this, "documentFormat");
17
17
  i(this, "malformationDetails");
18
18
  this.documentUrl = e, this.documentFormat = s, this.malformationDetails = n;
19
19
  }
20
20
  }
21
- class U extends h {
21
+ class _ extends f {
22
22
  constructor(e, s) {
23
23
  super(`Request failed trying to fetch ${e}`, s);
24
24
  i(this, "url");
25
25
  this.url = e;
26
26
  }
27
27
  }
28
- class p extends h {
28
+ class w extends f {
29
29
  constructor(e) {
30
30
  super(`Document with '${e}' url not found`);
31
31
  i(this, "url");
32
32
  this.url = e;
33
33
  }
34
34
  }
35
- function O(r, t) {
35
+ function G(r, t) {
36
36
  return `Unauthorized${t === 403 ? " (Forbidden)" : ""}: ${r}`;
37
37
  }
38
- class R extends h {
38
+ class v extends f {
39
39
  constructor(e, s) {
40
- super(O(e, s));
40
+ super(G(e, s));
41
41
  i(this, "url");
42
42
  i(this, "responseStatus");
43
43
  this.url = e, this.responseStatus = s;
@@ -46,7 +46,7 @@ class R extends h {
46
46
  return typeof this.responseStatus < "u" ? this.responseStatus === 403 : void 0;
47
47
  }
48
48
  }
49
- const j = {
49
+ const D = {
50
50
  acl: "http://www.w3.org/ns/auth/acl#",
51
51
  foaf: "http://xmlns.com/foaf/0.1/",
52
52
  ldp: "http://www.w3.org/ns/ldp#",
@@ -58,22 +58,22 @@ const j = {
58
58
  solid: "http://www.w3.org/ns/solid/terms#",
59
59
  vcard: "http://www.w3.org/2006/vcard/ns#"
60
60
  };
61
- function ct(r, t) {
62
- j[r] = t;
61
+ function lt(r, t) {
62
+ D[r] = t;
63
63
  }
64
- function l(r, t = {}) {
64
+ function d(r, t = {}) {
65
65
  var n;
66
66
  if (r.startsWith("http")) return r;
67
67
  const [e, s] = r.split(":");
68
68
  if (e && s) {
69
- const a = j[e] ?? ((n = t.extraContext) == null ? void 0 : n[e]) ?? null;
69
+ const a = D[e] ?? ((n = t.extraContext) == null ? void 0 : n[e]) ?? null;
70
70
  if (!a) throw new Error(`Can't expand IRI with unknown prefix: '${r}'`);
71
71
  return a + s;
72
72
  }
73
73
  if (!t.defaultPrefix) throw new Error(`Can't expand IRI without a default prefix: '${r}'`);
74
74
  return t.defaultPrefix + e;
75
75
  }
76
- class J {
76
+ class H {
77
77
  constructor(t, e) {
78
78
  i(this, "url");
79
79
  i(this, "quads");
@@ -81,13 +81,13 @@ class J {
81
81
  }
82
82
  value(t) {
83
83
  var e;
84
- return (e = this.quads.find((s) => s.predicate.value === l(t))) == null ? void 0 : e.object.value;
84
+ return (e = this.quads.find((s) => s.predicate.value === d(t))) == null ? void 0 : e.object.value;
85
85
  }
86
86
  values(t) {
87
- return this.quads.filter((e) => e.predicate.value === l(t)).map((e) => e.object.value);
87
+ return this.quads.filter((e) => e.predicate.value === d(t)).map((e) => e.object.value);
88
88
  }
89
89
  }
90
- class _ {
90
+ class X {
91
91
  constructor(t = []) {
92
92
  i(this, "quads");
93
93
  this.quads = t;
@@ -116,17 +116,17 @@ class _ {
116
116
  }
117
117
  getThing(t) {
118
118
  const e = this.statements(t);
119
- return new J(t, e);
119
+ return new H(t, e);
120
120
  }
121
121
  expandIRI(t) {
122
- return l(t);
122
+ return d(t);
123
123
  }
124
124
  termMatches(t, e) {
125
125
  return typeof e == "string" ? this.expandIRI(e) === t.value : t.termType === t.termType && t.value === e.value;
126
126
  }
127
127
  }
128
- var G = /* @__PURE__ */ ((r) => (r.Read = "read", r.Write = "write", r.Append = "append", r.Control = "control", r))(G || {});
129
- class D extends _ {
128
+ var Y = /* @__PURE__ */ ((r) => (r.Read = "read", r.Write = "write", r.Append = "append", r.Control = "control", r))(Y || {});
129
+ class A extends X {
130
130
  constructor(e, s, n) {
131
131
  super(s);
132
132
  i(this, "url");
@@ -138,7 +138,7 @@ class D extends _ {
138
138
  return !!((e = this.headers.get("Link")) != null && e.match(/<http:\/\/www\.w3\.org\/ns\/solid\/acp#AccessControlResource>;[^,]+rel="type"/));
139
139
  }
140
140
  isPersonalProfile() {
141
- return !!this.statement(this.url, l("rdf:type"), l("foaf:PersonalProfileDocument"));
141
+ return !!this.statement(this.url, d("rdf:type"), d("foaf:PersonalProfileDocument"));
142
142
  }
143
143
  isStorage() {
144
144
  var e;
@@ -158,19 +158,19 @@ class D extends _ {
158
158
  }
159
159
  getLastModified() {
160
160
  var e;
161
- return f(this.headers.get("last-modified")) ?? f((e = this.statement(this.url, "purl:modified")) == null ? void 0 : e.object.value) ?? this.getLatestDocumentDate() ?? null;
161
+ return p(this.headers.get("last-modified")) ?? p((e = this.statement(this.url, "purl:modified")) == null ? void 0 : e.object.value) ?? this.getLatestDocumentDate() ?? null;
162
162
  }
163
163
  expandIRI(e) {
164
- return l(e, { defaultPrefix: this.url });
164
+ return d(e, { defaultPrefix: this.url });
165
165
  }
166
166
  getLatestDocumentDate() {
167
- const e = [...this.statements(void 0, "purl:modified"), ...this.statements(void 0, "purl:created")].map((s) => f(s.object.value)).filter((s) => s !== null);
167
+ const e = [...this.statements(void 0, "purl:modified"), ...this.statements(void 0, "purl:created")].map((s) => p(s.object.value)).filter((s) => s !== null);
168
168
  return e.length > 0 ? e.reduce((s, n) => s > n ? s : n) : null;
169
169
  }
170
170
  getPermissionsFromWAC(e) {
171
171
  var a;
172
- const s = this.headers.get("WAC-Allow") ?? "", n = ((a = Q(s, new RegExp(`${e}="([^"]+)"`))) == null ? void 0 : a[1]) ?? "";
173
- return v([
172
+ const s = this.headers.get("WAC-Allow") ?? "", n = ((a = W(s, new RegExp(`${e}="([^"]+)"`))) == null ? void 0 : a[1]) ?? "";
173
+ return T([
174
174
  n.includes("read") && "read",
175
175
  n.includes("write") && "write",
176
176
  n.includes("append") && "append",
@@ -180,187 +180,195 @@ class D extends _ {
180
180
  }
181
181
  }
182
182
  async function dt(r) {
183
- const t = await w.compact(r, {});
183
+ const t = await m.compact(r, {});
184
184
  return "@graph" in t ? t : "@id" in t ? { "@graph": [t] } : { "@graph": [] };
185
185
  }
186
- function H(r) {
186
+ function V(r) {
187
187
  return "@graph" in r;
188
188
  }
189
- const g = "anonymous://", X = g.length;
190
- async function Y(r, t) {
189
+ const h = "anonymous://", R = h.length;
190
+ async function K(r, t) {
191
191
  const e = {
192
192
  headers: { Accept: "text/turtle" }
193
193
  };
194
194
  t != null && t.cache && (e.cache = t.cache);
195
195
  try {
196
196
  const n = await ((t == null ? void 0 : t.fetch) ?? window.fetch)(r, e);
197
- if (n.status === 404) throw new p(r);
198
- if ([401, 403].includes(n.status)) throw new R(r, n.status);
197
+ if (n.status === 404) throw new w(r);
198
+ if ([401, 403].includes(n.status)) throw new v(r, n.status);
199
199
  return {
200
200
  body: await n.text(),
201
201
  headers: n.headers
202
202
  };
203
203
  } catch (s) {
204
- throw s instanceof R || s instanceof p ? s : new U(r, { cause: s });
204
+ throw s instanceof v || s instanceof w ? s : new _(r, { cause: s });
205
205
  }
206
206
  }
207
- function V(r) {
208
- const t = r.slice(0), e = {}, s = b(r).flatMap((n, a) => L(
209
- v([
207
+ function Z(r) {
208
+ const t = r.slice(0), e = {}, s = b(r).flatMap((n, a) => F(
209
+ T([
210
210
  n.object.termType === "BlankNode" ? n.object.value : null,
211
211
  n.subject.termType === "BlankNode" ? n.subject.value : null
212
212
  ]),
213
213
  (c) => c.forEach((o) => (e[o] ?? (e[o] = /* @__PURE__ */ new Set())).add(a))
214
214
  )).filter().unique();
215
215
  for (const n of s) {
216
- const a = e[n], c = $(
216
+ const a = e[n], c = z(
217
217
  b(a).map((o) => r[o]).filter(({ subject: { termType: o, value: u } }) => o === "BlankNode" && u === n).map(({ predicate: o, object: u }) => u.termType === "BlankNode" ? o.value : o.value + u.value).sorted().join()
218
218
  );
219
219
  for (const o of a) {
220
- const u = t[o], d = {
220
+ const u = t[o], l = {
221
221
  subject: u.subject,
222
222
  object: u.object
223
223
  };
224
- for (const [C, y] of Object.entries(d))
225
- y.termType !== "BlankNode" || y.value !== n || (d[C] = new W(c));
226
- F(
224
+ for (const [$, I] of Object.entries(l))
225
+ I.termType !== "BlankNode" || I.value !== n || (l[$] = new O(c));
226
+ B(
227
227
  t,
228
228
  u,
229
- new z(d.subject, u.predicate, d.object)
229
+ new U(l.subject, u.predicate, l.object)
230
230
  );
231
231
  }
232
232
  }
233
233
  return t;
234
234
  }
235
- function A(r) {
236
- return r.map((t) => " " + rt(t)).sort().join(`
235
+ function M(r) {
236
+ return r.map((t) => " " + st(t)).sort().join(`
237
237
  `);
238
238
  }
239
- function K(r) {
239
+ function N(r) {
240
240
  var t;
241
- (t = r["@id"]) != null && t.startsWith("#") && (r["@id"] = g + r["@id"]);
241
+ if ((t = r["@id"]) != null && t.startsWith("#")) {
242
+ r["@id"] = h + r["@id"];
243
+ for (const [e, s] of Object.entries(r))
244
+ typeof s != "object" || s === null || !("@id" in s) || N(r[e]);
245
+ }
242
246
  }
243
- function Z(r) {
247
+ function tt(r) {
244
248
  for (const t of r)
245
- t.subject.value.startsWith(g) && (t.subject.value = t.subject.value.slice(X));
249
+ t.subject.value.startsWith(h) && (t.subject.value = t.subject.value.slice(R)), t.object.value.startsWith(h) && (t.object.value = t.object.value.slice(R));
246
250
  }
247
- async function lt(r, t, e) {
251
+ async function ht(r, t, e) {
248
252
  e = e ?? window.fetch.bind(window);
249
- const s = await I(t);
253
+ const s = await y(t);
250
254
  return await e(r, {
251
255
  method: "PUT",
252
256
  headers: { "Content-Type": "text/turtle" },
253
257
  body: t
254
- }), new D(r, s, new Headers({}));
258
+ }), new A(r, s, new Headers({}));
255
259
  }
256
- async function M(r, t) {
257
- const { body: e, headers: s } = await Y(r, t), n = await I(e, { baseIRI: r });
258
- return new D(r, n, s);
260
+ async function C(r, t) {
261
+ const { body: e, headers: s } = await K(r, t), n = await y(e, { baseIRI: r });
262
+ return new A(r, n, s);
259
263
  }
260
- async function ht(r, t) {
264
+ async function ft(r, t) {
261
265
  try {
262
- return await M(r, t);
266
+ return await C(r, t);
263
267
  } catch (e) {
264
- if (!(e instanceof p)) throw e;
268
+ if (!(e instanceof w)) throw e;
265
269
  return null;
266
270
  }
267
271
  }
268
- async function tt(r, t) {
269
- if (H(r))
270
- return (await Promise.all(r["@graph"].map((n) => tt(n, t)))).flat();
271
- K(r);
272
- const e = await w.toRDF(r, { base: t });
273
- return Z(e), e;
272
+ async function E(r, t) {
273
+ if (V(r))
274
+ return (await Promise.all(r["@graph"].map((n) => E(n, t)))).flat();
275
+ N(r);
276
+ const e = await m.toRDF(r, { base: t });
277
+ return tt(e), e;
278
+ }
279
+ async function pt(r, t) {
280
+ const e = await E(structuredClone(r), t);
281
+ return rt(e);
274
282
  }
275
- function ft(r) {
276
- const t = st(r);
283
+ function wt(r) {
284
+ const t = nt(r);
277
285
  return Object.entries(t).reduce((e, [s, n]) => {
278
- const a = A(n);
286
+ const a = M(n);
279
287
  return e.concat(`${s.toUpperCase()} DATA {
280
288
  ${a}
281
289
  }`);
282
290
  }, []).join(` ;
283
291
  `);
284
292
  }
285
- function pt(r) {
286
- const t = N(r);
287
- return A(t);
293
+ function mt(r) {
294
+ const t = k(r);
295
+ return M(t);
288
296
  }
289
297
  function et(r, t = {}) {
290
- const e = T({ baseIRI: t.baseIRI }), s = new q(e), n = {
298
+ const e = x({ baseIRI: t.baseIRI }), s = new j(e), n = {
291
299
  quads: [],
292
300
  containsRelativeIRIs: !1
293
301
  };
294
302
  return new Promise((a, c) => {
295
303
  const o = s._resolveRelativeIRI;
296
- s._resolveRelativeIRI = (...u) => (n.containsRelativeIRIs = !0, s._resolveRelativeIRI = o, s._resolveRelativeIRI(...u)), s.parse(r, (u, d) => {
304
+ s._resolveRelativeIRI = (...u) => (n.containsRelativeIRIs = !0, s._resolveRelativeIRI = o, s._resolveRelativeIRI(...u)), s.parse(r, (u, l) => {
297
305
  if (u) {
298
306
  c(
299
- new P(t.baseIRI ?? null, m.Turtle, u.message)
307
+ new P(t.baseIRI ?? null, g.Turtle, u.message)
300
308
  );
301
309
  return;
302
310
  }
303
- if (!d) {
311
+ if (!l) {
304
312
  a(n);
305
313
  return;
306
314
  }
307
- n.quads.push(d);
315
+ n.quads.push(l);
308
316
  });
309
317
  });
310
318
  }
311
- async function wt(r) {
319
+ async function rt(r) {
312
320
  return {
313
- "@graph": await w.fromRDF(r)
321
+ "@graph": await m.fromRDF(r)
314
322
  };
315
323
  }
316
- function mt(r) {
324
+ function gt(r) {
317
325
  return new S().quadsToString(r);
318
326
  }
319
- function rt(r) {
327
+ function st(r) {
320
328
  return new S().quadsToString([r]).slice(0, -1);
321
329
  }
322
- async function gt(r, t) {
330
+ async function yt(r, t) {
323
331
  try {
324
- return !(await M(r, t)).isEmpty();
332
+ return !(await C(r, t)).isEmpty();
325
333
  } catch {
326
334
  return !1;
327
335
  }
328
336
  }
329
337
  async function It(r, t = {}) {
330
- const e = x(r, /(\w+) DATA {([^}]+)}/g), s = {};
338
+ const e = q(r, /(\w+) DATA {([^}]+)}/g), s = {};
331
339
  return await Promise.all(
332
340
  [...e].map(async (n) => {
333
341
  const a = n[1].toLowerCase(), c = n[2];
334
- s[a] = await I(c, t);
342
+ s[a] = await y(c, t);
335
343
  })
336
344
  ), s;
337
345
  }
338
- function st(r, t = {}) {
339
- const e = x(r, /(\w+) DATA {([^}]+)}/g), s = {};
346
+ function nt(r, t = {}) {
347
+ const e = q(r, /(\w+) DATA {([^}]+)}/g), s = {};
340
348
  for (const n of e) {
341
349
  const a = n[1].toLowerCase(), c = n[2];
342
- s[a] = N(c, t);
350
+ s[a] = k(c, t);
343
351
  }
344
352
  return s;
345
353
  }
346
- async function I(r, t = {}) {
354
+ async function y(r, t = {}) {
347
355
  const { quads: e } = await et(r, t);
348
356
  return e;
349
357
  }
350
- function N(r, t = {}) {
351
- const e = T({ baseIRI: t.baseIRI }), s = new q(e);
358
+ function k(r, t = {}) {
359
+ const e = x({ baseIRI: t.baseIRI }), s = new j(e);
352
360
  try {
353
361
  const n = s.parse(r);
354
- return t.normalizeBlankNodes ? V(n) : n;
362
+ return t.normalizeBlankNodes ? Z(n) : n;
355
363
  } catch (n) {
356
364
  throw new P(
357
365
  t.baseIRI ?? null,
358
- m.Turtle,
366
+ g.Turtle,
359
367
  n.message ?? ""
360
368
  );
361
369
  }
362
370
  }
363
- async function yt(r, t, e) {
371
+ async function bt(r, t, e) {
364
372
  e = e ?? window.fetch.bind(window), await e(r, {
365
373
  method: "PATCH",
366
374
  headers: { "Content-Type": "application/sparql-update" },
@@ -369,33 +377,34 @@ async function yt(r, t, e) {
369
377
  }
370
378
  export {
371
379
  P as M,
372
- U as N,
373
- _ as S,
374
- R as U,
375
- rt as a,
376
- ft as b,
377
- lt as c,
378
- gt as d,
379
- ht as e,
380
- M as f,
381
- m as g,
382
- p as h,
383
- wt as i,
384
- tt as j,
385
- It as k,
386
- I as l,
387
- dt as m,
388
- pt as n,
389
- H as o,
380
+ _ as N,
381
+ X as S,
382
+ v as U,
383
+ st as a,
384
+ wt as b,
385
+ ht as c,
386
+ yt as d,
387
+ ft as e,
388
+ C as f,
389
+ g,
390
+ w as h,
391
+ pt as i,
392
+ E as j,
393
+ rt as k,
394
+ It as l,
395
+ y as m,
396
+ mt as n,
397
+ dt as o,
390
398
  et as p,
391
- mt as q,
392
- ct as r,
393
- st as s,
394
- N as t,
395
- yt as u,
396
- l as v,
397
- D as w,
398
- G as x,
399
- J as y
399
+ gt as q,
400
+ V as r,
401
+ nt as s,
402
+ k as t,
403
+ bt as u,
404
+ lt as v,
405
+ d as w,
406
+ A as x,
407
+ Y as y,
408
+ H as z
400
409
  };
401
- //# sourceMappingURL=io-wCcrq4b9.js.map
410
+ //# sourceMappingURL=io-CT3AW8WO.js.map