@noeldemartin/solid-utils 0.5.0 → 0.6.0-next.70fba2db4562da63a3ae210c80936d148acfc0de

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.
Files changed (55) hide show
  1. package/dist/io-CMHtz5bu.js +401 -0
  2. package/dist/io-CMHtz5bu.js.map +1 -0
  3. package/dist/noeldemartin-solid-utils.d.ts +13 -65
  4. package/dist/noeldemartin-solid-utils.js +224 -0
  5. package/dist/noeldemartin-solid-utils.js.map +1 -0
  6. package/dist/testing.d.ts +45 -0
  7. package/dist/testing.js +157 -0
  8. package/dist/testing.js.map +1 -0
  9. package/package.json +58 -63
  10. package/src/errors/UnauthorizedError.ts +1 -3
  11. package/src/errors/UnsuccessfulNetworkRequestError.ts +2 -2
  12. package/src/helpers/auth.test.ts +221 -0
  13. package/src/helpers/auth.ts +28 -27
  14. package/src/helpers/identifiers.test.ts +76 -0
  15. package/src/helpers/identifiers.ts +14 -17
  16. package/src/helpers/index.ts +0 -1
  17. package/src/helpers/interop.ts +23 -16
  18. package/src/helpers/io.test.ts +228 -0
  19. package/src/helpers/io.ts +57 -77
  20. package/src/helpers/jsonld.ts +6 -6
  21. package/src/helpers/vocabs.ts +3 -6
  22. package/src/helpers/wac.test.ts +64 -0
  23. package/src/helpers/wac.ts +10 -6
  24. package/src/index.ts +3 -0
  25. package/src/models/SolidDocument.test.ts +77 -0
  26. package/src/models/SolidDocument.ts +14 -18
  27. package/src/models/SolidStore.ts +22 -12
  28. package/src/models/SolidThing.ts +5 -7
  29. package/src/models/index.ts +2 -0
  30. package/src/{helpers/testing.ts → testing/helpers.ts} +24 -27
  31. package/src/testing/hepers.test.ts +329 -0
  32. package/src/testing/index.ts +2 -2
  33. package/src/testing/vitest/index.ts +15 -0
  34. package/src/testing/vitest/matchers.ts +68 -0
  35. package/src/types/n3.d.ts +0 -2
  36. package/.github/workflows/ci.yml +0 -16
  37. package/.nvmrc +0 -1
  38. package/CHANGELOG.md +0 -70
  39. package/dist/noeldemartin-solid-utils.cjs.js +0 -2
  40. package/dist/noeldemartin-solid-utils.cjs.js.map +0 -1
  41. package/dist/noeldemartin-solid-utils.esm.js +0 -2
  42. package/dist/noeldemartin-solid-utils.esm.js.map +0 -1
  43. package/dist/noeldemartin-solid-utils.umd.js +0 -90
  44. package/dist/noeldemartin-solid-utils.umd.js.map +0 -1
  45. package/noeldemartin.config.js +0 -9
  46. package/src/main.ts +0 -5
  47. package/src/plugins/chai/assertions.ts +0 -40
  48. package/src/plugins/chai/index.ts +0 -5
  49. package/src/plugins/cypress/types.d.ts +0 -15
  50. package/src/plugins/index.ts +0 -2
  51. package/src/plugins/jest/index.ts +0 -5
  52. package/src/plugins/jest/matchers.ts +0 -65
  53. package/src/plugins/jest/types.d.ts +0 -14
  54. package/src/testing/ResponseStub.ts +0 -46
  55. package/src/testing/mocking.ts +0 -33
@@ -0,0 +1,401 @@
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) {
9
+ return r ? `Malformed ${t} document found at ${r} - ${e}` : `Malformed ${t} document - ${e}`;
10
+ }
11
+ var m = /* @__PURE__ */ ((r) => (r.Turtle = "Turtle", r))(m || {});
12
+ class P extends h {
13
+ constructor(e, s, n) {
14
+ super(B(e, s, n));
15
+ i(this, "documentUrl");
16
+ i(this, "documentFormat");
17
+ i(this, "malformationDetails");
18
+ this.documentUrl = e, this.documentFormat = s, this.malformationDetails = n;
19
+ }
20
+ }
21
+ class U extends h {
22
+ constructor(e, s) {
23
+ super(`Request failed trying to fetch ${e}`, s);
24
+ i(this, "url");
25
+ this.url = e;
26
+ }
27
+ }
28
+ class p extends h {
29
+ constructor(e) {
30
+ super(`Document with '${e}' url not found`);
31
+ i(this, "url");
32
+ this.url = e;
33
+ }
34
+ }
35
+ function O(r, t) {
36
+ return `Unauthorized${t === 403 ? " (Forbidden)" : ""}: ${r}`;
37
+ }
38
+ class R extends h {
39
+ constructor(e, s) {
40
+ super(O(e, s));
41
+ i(this, "url");
42
+ i(this, "responseStatus");
43
+ this.url = e, this.responseStatus = s;
44
+ }
45
+ get forbidden() {
46
+ return typeof this.responseStatus < "u" ? this.responseStatus === 403 : void 0;
47
+ }
48
+ }
49
+ const j = {
50
+ acl: "http://www.w3.org/ns/auth/acl#",
51
+ foaf: "http://xmlns.com/foaf/0.1/",
52
+ ldp: "http://www.w3.org/ns/ldp#",
53
+ pim: "http://www.w3.org/ns/pim/space#",
54
+ purl: "http://purl.org/dc/terms/",
55
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
56
+ rdfs: "http://www.w3.org/2000/01/rdf-schema#",
57
+ schema: "https://schema.org/",
58
+ solid: "http://www.w3.org/ns/solid/terms#",
59
+ vcard: "http://www.w3.org/2006/vcard/ns#"
60
+ };
61
+ function ct(r, t) {
62
+ j[r] = t;
63
+ }
64
+ function l(r, t = {}) {
65
+ var n;
66
+ if (r.startsWith("http")) return r;
67
+ const [e, s] = r.split(":");
68
+ if (e && s) {
69
+ const a = j[e] ?? ((n = t.extraContext) == null ? void 0 : n[e]) ?? null;
70
+ if (!a) throw new Error(`Can't expand IRI with unknown prefix: '${r}'`);
71
+ return a + s;
72
+ }
73
+ if (!t.defaultPrefix) throw new Error(`Can't expand IRI without a default prefix: '${r}'`);
74
+ return t.defaultPrefix + e;
75
+ }
76
+ class J {
77
+ constructor(t, e) {
78
+ i(this, "url");
79
+ i(this, "quads");
80
+ this.url = t, this.quads = e;
81
+ }
82
+ value(t) {
83
+ var e;
84
+ return (e = this.quads.find((s) => s.predicate.value === l(t))) == null ? void 0 : e.object.value;
85
+ }
86
+ values(t) {
87
+ return this.quads.filter((e) => e.predicate.value === l(t)).map((e) => e.object.value);
88
+ }
89
+ }
90
+ class _ {
91
+ constructor(t = []) {
92
+ i(this, "quads");
93
+ this.quads = t;
94
+ }
95
+ isEmpty() {
96
+ return this.statements.length === 0;
97
+ }
98
+ getQuads() {
99
+ return this.quads.slice(0);
100
+ }
101
+ addQuads(t) {
102
+ this.quads.push(...t);
103
+ }
104
+ statements(t, e, s) {
105
+ return this.quads.filter(
106
+ (n) => (!s || this.termMatches(n.object, s)) && (!t || this.termMatches(n.subject, t)) && (!e || this.termMatches(n.predicate, e))
107
+ );
108
+ }
109
+ statement(t, e, s) {
110
+ return this.quads.find(
111
+ (a) => (!s || this.termMatches(a.object, s)) && (!t || this.termMatches(a.subject, t)) && (!e || this.termMatches(a.predicate, e))
112
+ ) ?? null;
113
+ }
114
+ contains(t, e, s) {
115
+ return this.statement(t, e, s) !== null;
116
+ }
117
+ getThing(t) {
118
+ const e = this.statements(t);
119
+ return new J(t, e);
120
+ }
121
+ expandIRI(t) {
122
+ return l(t);
123
+ }
124
+ termMatches(t, e) {
125
+ return typeof e == "string" ? this.expandIRI(e) === t.value : t.termType === t.termType && t.value === e.value;
126
+ }
127
+ }
128
+ var G = /* @__PURE__ */ ((r) => (r.Read = "read", r.Write = "write", r.Append = "append", r.Control = "control", r))(G || {});
129
+ class D extends _ {
130
+ constructor(e, s, n) {
131
+ super(s);
132
+ i(this, "url");
133
+ i(this, "headers");
134
+ this.url = e, this.headers = n;
135
+ }
136
+ isACPResource() {
137
+ var e;
138
+ return !!((e = this.headers.get("Link")) != null && e.match(/<http:\/\/www\.w3\.org\/ns\/solid\/acp#AccessControlResource>;[^,]+rel="type"/));
139
+ }
140
+ isPersonalProfile() {
141
+ return !!this.statement(this.url, l("rdf:type"), l("foaf:PersonalProfileDocument"));
142
+ }
143
+ isStorage() {
144
+ var e;
145
+ return !!((e = this.headers.get("Link")) != null && e.match(/<http:\/\/www\.w3\.org\/ns\/pim\/space#Storage>;[^,]+rel="type"/));
146
+ }
147
+ isUserWritable() {
148
+ return this.getUserPermissions().includes(
149
+ "write"
150
+ /* Write */
151
+ );
152
+ }
153
+ getUserPermissions() {
154
+ return this.getPermissionsFromWAC("user");
155
+ }
156
+ getPublicPermissions() {
157
+ return this.getPermissionsFromWAC("public");
158
+ }
159
+ getLastModified() {
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;
162
+ }
163
+ expandIRI(e) {
164
+ return l(e, { defaultPrefix: this.url });
165
+ }
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);
168
+ return e.length > 0 ? e.reduce((s, n) => s > n ? s : n) : null;
169
+ }
170
+ getPermissionsFromWAC(e) {
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([
174
+ n.includes("read") && "read",
175
+ n.includes("write") && "write",
176
+ n.includes("append") && "append",
177
+ n.includes("control") && "control"
178
+ /* Control */
179
+ ]);
180
+ }
181
+ }
182
+ async function dt(r) {
183
+ const t = await w.compact(r, {});
184
+ return "@graph" in t ? t : "@id" in t ? { "@graph": [t] } : { "@graph": [] };
185
+ }
186
+ function H(r) {
187
+ return "@graph" in r;
188
+ }
189
+ const g = "anonymous://", X = g.length;
190
+ async function Y(r, t) {
191
+ const e = {
192
+ headers: { Accept: "text/turtle" }
193
+ };
194
+ t != null && t.cache && (e.cache = t.cache);
195
+ try {
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);
199
+ return {
200
+ body: await n.text(),
201
+ headers: n.headers
202
+ };
203
+ } catch (s) {
204
+ throw s instanceof R || s instanceof p ? s : new U(r, { cause: s });
205
+ }
206
+ }
207
+ function V(r) {
208
+ const t = r.slice(0), e = {}, s = b(r).flatMap((n, a) => L(
209
+ v([
210
+ n.object.termType === "BlankNode" ? n.object.value : null,
211
+ n.subject.termType === "BlankNode" ? n.subject.value : null
212
+ ]),
213
+ (c) => c.forEach((o) => (e[o] ?? (e[o] = /* @__PURE__ */ new Set())).add(a))
214
+ )).filter().unique();
215
+ for (const n of s) {
216
+ const a = e[n], c = $(
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
+ );
219
+ for (const o of a) {
220
+ const u = t[o], d = {
221
+ subject: u.subject,
222
+ object: u.object
223
+ };
224
+ for (const [C, y] of Object.entries(d))
225
+ y.termType !== "BlankNode" || y.value !== n || (d[C] = new W(c));
226
+ F(
227
+ t,
228
+ u,
229
+ new z(d.subject, u.predicate, d.object)
230
+ );
231
+ }
232
+ }
233
+ return t;
234
+ }
235
+ function A(r) {
236
+ return r.map((t) => " " + rt(t)).sort().join(`
237
+ `);
238
+ }
239
+ function K(r) {
240
+ var t;
241
+ (t = r["@id"]) != null && t.startsWith("#") && (r["@id"] = g + r["@id"]);
242
+ }
243
+ function Z(r) {
244
+ for (const t of r)
245
+ t.subject.value.startsWith(g) && (t.subject.value = t.subject.value.slice(X));
246
+ }
247
+ async function lt(r, t, e) {
248
+ e = e ?? window.fetch.bind(window);
249
+ const s = await I(t);
250
+ return await e(r, {
251
+ method: "PUT",
252
+ headers: { "Content-Type": "text/turtle" },
253
+ body: t
254
+ }), new D(r, s, new Headers({}));
255
+ }
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);
259
+ }
260
+ async function ht(r, t) {
261
+ try {
262
+ return await M(r, t);
263
+ } catch (e) {
264
+ if (!(e instanceof p)) throw e;
265
+ return null;
266
+ }
267
+ }
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;
274
+ }
275
+ function ft(r) {
276
+ const t = st(r);
277
+ return Object.entries(t).reduce((e, [s, n]) => {
278
+ const a = A(n);
279
+ return e.concat(`${s.toUpperCase()} DATA {
280
+ ${a}
281
+ }`);
282
+ }, []).join(` ;
283
+ `);
284
+ }
285
+ function pt(r) {
286
+ const t = N(r);
287
+ return A(t);
288
+ }
289
+ function et(r, t = {}) {
290
+ const e = T({ baseIRI: t.baseIRI }), s = new q(e), n = {
291
+ quads: [],
292
+ containsRelativeIRIs: !1
293
+ };
294
+ return new Promise((a, c) => {
295
+ const o = s._resolveRelativeIRI;
296
+ s._resolveRelativeIRI = (...u) => (n.containsRelativeIRIs = !0, s._resolveRelativeIRI = o, s._resolveRelativeIRI(...u)), s.parse(r, (u, d) => {
297
+ if (u) {
298
+ c(
299
+ new P(t.baseIRI ?? null, m.Turtle, u.message)
300
+ );
301
+ return;
302
+ }
303
+ if (!d) {
304
+ a(n);
305
+ return;
306
+ }
307
+ n.quads.push(d);
308
+ });
309
+ });
310
+ }
311
+ async function wt(r) {
312
+ return {
313
+ "@graph": await w.fromRDF(r)
314
+ };
315
+ }
316
+ function mt(r) {
317
+ return new S().quadsToString(r);
318
+ }
319
+ function rt(r) {
320
+ return new S().quadsToString([r]).slice(0, -1);
321
+ }
322
+ async function gt(r, t) {
323
+ try {
324
+ return !(await M(r, t)).isEmpty();
325
+ } catch {
326
+ return !1;
327
+ }
328
+ }
329
+ async function It(r, t = {}) {
330
+ const e = x(r, /(\w+) DATA {([^}]+)}/g), s = {};
331
+ return await Promise.all(
332
+ [...e].map(async (n) => {
333
+ const a = n[1].toLowerCase(), c = n[2];
334
+ s[a] = await I(c, t);
335
+ })
336
+ ), s;
337
+ }
338
+ function st(r, t = {}) {
339
+ const e = x(r, /(\w+) DATA {([^}]+)}/g), s = {};
340
+ for (const n of e) {
341
+ const a = n[1].toLowerCase(), c = n[2];
342
+ s[a] = N(c, t);
343
+ }
344
+ return s;
345
+ }
346
+ async function I(r, t = {}) {
347
+ const { quads: e } = await et(r, t);
348
+ return e;
349
+ }
350
+ function N(r, t = {}) {
351
+ const e = T({ baseIRI: t.baseIRI }), s = new q(e);
352
+ try {
353
+ const n = s.parse(r);
354
+ return t.normalizeBlankNodes ? V(n) : n;
355
+ } catch (n) {
356
+ throw new P(
357
+ t.baseIRI ?? null,
358
+ m.Turtle,
359
+ n.message ?? ""
360
+ );
361
+ }
362
+ }
363
+ async function yt(r, t, e) {
364
+ e = e ?? window.fetch.bind(window), await e(r, {
365
+ method: "PATCH",
366
+ headers: { "Content-Type": "application/sparql-update" },
367
+ body: t
368
+ });
369
+ }
370
+ export {
371
+ P as M,
372
+ U as N,
373
+ _ as S,
374
+ R as U,
375
+ ht as a,
376
+ m as b,
377
+ lt as c,
378
+ p as d,
379
+ pt as e,
380
+ M as f,
381
+ mt as g,
382
+ rt as h,
383
+ It as i,
384
+ tt as j,
385
+ st as k,
386
+ N as l,
387
+ dt as m,
388
+ ft as n,
389
+ H as o,
390
+ et as p,
391
+ wt as q,
392
+ ct as r,
393
+ gt as s,
394
+ I as t,
395
+ yt as u,
396
+ l as v,
397
+ D as w,
398
+ G as x,
399
+ J as y
400
+ };
401
+ //# sourceMappingURL=io-CMHtz5bu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io-CMHtz5bu.js","sources":["../src/errors/MalformedSolidDocumentError.ts","../src/errors/NetworkRequestError.ts","../src/errors/NotFoundError.ts","../src/errors/UnauthorizedError.ts","../src/helpers/vocabs.ts","../src/models/SolidThing.ts","../src/models/SolidStore.ts","../src/models/SolidDocument.ts","../src/helpers/jsonld.ts","../src/helpers/io.ts"],"sourcesContent":["import { JSError } from '@noeldemartin/utils';\n\nfunction errorMessage(\n documentUrl: string | null,\n documentFormat: SolidDocumentFormat,\n malformationDetails: string,\n): string {\n return documentUrl\n ? `Malformed ${documentFormat} document found at ${documentUrl} - ${malformationDetails}`\n : `Malformed ${documentFormat} document - ${malformationDetails}`;\n}\n\nexport enum SolidDocumentFormat {\n Turtle = 'Turtle',\n}\n\nexport default class MalformedSolidDocumentError extends JSError {\n\n public readonly documentUrl: string | null;\n public readonly documentFormat: SolidDocumentFormat;\n public readonly malformationDetails: string;\n\n constructor(documentUrl: string | null, documentFormat: SolidDocumentFormat, malformationDetails: string) {\n super(errorMessage(documentUrl, documentFormat, malformationDetails));\n\n this.documentUrl = documentUrl;\n this.documentFormat = documentFormat;\n this.malformationDetails = malformationDetails;\n }\n\n}\n","import { JSError } from '@noeldemartin/utils';\nimport type { JSErrorOptions } from '@noeldemartin/utils';\n\nexport default class NetworkRequestError extends JSError {\n\n public readonly url: string;\n\n constructor(url: string, options?: JSErrorOptions) {\n super(`Request failed trying to fetch ${url}`, options);\n\n this.url = url;\n }\n\n}\n","import { JSError } from '@noeldemartin/utils';\n\nexport default class NotFoundError extends JSError {\n\n public readonly url: string;\n\n constructor(url: string) {\n super(`Document with '${url}' url not found`);\n\n this.url = url;\n }\n\n}\n","import { JSError } from '@noeldemartin/utils';\n\nfunction errorMessage(url: string, responseStatus?: number): string {\n const typeInfo = responseStatus === 403 ? ' (Forbidden)' : '';\n\n return `Unauthorized${typeInfo}: ${url}`;\n}\n\nexport default class UnauthorizedError extends JSError {\n\n public readonly url: string;\n public readonly responseStatus?: number;\n\n constructor(url: string, responseStatus?: number) {\n super(errorMessage(url, responseStatus));\n\n this.url = url;\n this.responseStatus = responseStatus;\n }\n\n public get forbidden(): boolean | undefined {\n return typeof this.responseStatus !== 'undefined' ? this.responseStatus === 403 : undefined;\n }\n\n}\n","export type RDFContext = Record<string, string>;\n\nexport interface ExpandIRIOptions {\n defaultPrefix: string;\n extraContext: RDFContext;\n}\n\nconst knownPrefixes: RDFContext = {\n acl: 'http://www.w3.org/ns/auth/acl#',\n foaf: 'http://xmlns.com/foaf/0.1/',\n ldp: 'http://www.w3.org/ns/ldp#',\n pim: 'http://www.w3.org/ns/pim/space#',\n purl: 'http://purl.org/dc/terms/',\n rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n rdfs: 'http://www.w3.org/2000/01/rdf-schema#',\n schema: 'https://schema.org/',\n solid: 'http://www.w3.org/ns/solid/terms#',\n vcard: 'http://www.w3.org/2006/vcard/ns#',\n};\n\nexport function defineIRIPrefix(name: string, value: string): void {\n knownPrefixes[name] = value;\n}\n\nexport function expandIRI(iri: string, options: Partial<ExpandIRIOptions> = {}): string {\n if (iri.startsWith('http')) return iri;\n\n const [prefix, name] = iri.split(':');\n\n if (prefix && name) {\n const expandedPrefix = knownPrefixes[prefix] ?? options.extraContext?.[prefix] ?? null;\n\n if (!expandedPrefix) throw new Error(`Can't expand IRI with unknown prefix: '${iri}'`);\n\n return expandedPrefix + name;\n }\n\n if (!options.defaultPrefix) throw new Error(`Can't expand IRI without a default prefix: '${iri}'`);\n\n return options.defaultPrefix + prefix;\n}\n","import type { Quad } from '@rdfjs/types';\n\nimport { expandIRI } from '@noeldemartin/solid-utils/helpers/vocabs';\n\nexport default class SolidThing {\n\n public readonly url: string;\n private quads: Quad[];\n\n public constructor(url: string, quads: Quad[]) {\n this.url = url;\n this.quads = quads;\n }\n\n public value(property: string): string | undefined {\n return this.quads.find((quad) => quad.predicate.value === expandIRI(property))?.object.value;\n }\n\n public values(property: string): string[] {\n return this.quads\n .filter((quad) => quad.predicate.value === expandIRI(property))\n .map((quad) => quad.object.value);\n }\n\n}\n","import type { BlankNode, Literal, NamedNode, Quad, Variable } from '@rdfjs/types';\n\nimport { expandIRI } from '@noeldemartin/solid-utils/helpers/vocabs';\n\nimport SolidThing from './SolidThing';\n\nexport type Term = NamedNode | Literal | BlankNode | Quad | Variable;\n\nexport default class SolidStore {\n\n private quads: Quad[];\n\n public constructor(quads: Quad[] = []) {\n this.quads = quads;\n }\n\n public isEmpty(): boolean {\n return this.statements.length === 0;\n }\n\n public getQuads(): Quad[] {\n return this.quads.slice(0);\n }\n\n public addQuads(quads: Quad[]): void {\n this.quads.push(...quads);\n }\n\n public statements(subject?: Term | string, predicate?: Term | string, object?: Term | string): Quad[] {\n return this.quads.filter(\n (statement) =>\n (!object || this.termMatches(statement.object, object)) &&\n (!subject || this.termMatches(statement.subject, subject)) &&\n (!predicate || this.termMatches(statement.predicate, predicate)),\n );\n }\n\n public statement(subject?: Term | string, predicate?: Term | string, object?: Term | string): Quad | null {\n const statement = this.quads.find(\n (_statement) =>\n (!object || this.termMatches(_statement.object, object)) &&\n (!subject || this.termMatches(_statement.subject, subject)) &&\n (!predicate || this.termMatches(_statement.predicate, predicate)),\n );\n\n return statement ?? null;\n }\n\n public contains(subject: string, predicate?: string, object?: string): boolean {\n return this.statement(subject, predicate, object) !== null;\n }\n\n public getThing(subject: string): SolidThing {\n const statements = this.statements(subject);\n\n return new SolidThing(subject, statements);\n }\n\n protected expandIRI(iri: string): string {\n return expandIRI(iri);\n }\n\n protected termMatches(term: Term, value: Term | string): boolean {\n if (typeof value === 'string') {\n return this.expandIRI(value) === term.value;\n }\n\n return term.termType === term.termType && term.value === value.value;\n }\n\n}\n","import { arrayFilter, parseDate, stringMatch } from '@noeldemartin/utils';\nimport type { Quad } from '@rdfjs/types';\n\nimport { expandIRI } from '@noeldemartin/solid-utils/helpers/vocabs';\n\nimport SolidStore from './SolidStore';\n\nexport enum SolidDocumentPermission {\n Read = 'read',\n Write = 'write',\n Append = 'append',\n Control = 'control',\n}\n\nexport default class SolidDocument extends SolidStore {\n\n public readonly url: string;\n public readonly headers: Headers;\n\n public constructor(url: string, quads: Quad[], headers: Headers) {\n super(quads);\n\n this.url = url;\n this.headers = headers;\n }\n\n public isACPResource(): boolean {\n return !!this.headers\n .get('Link')\n ?.match(/<http:\\/\\/www\\.w3\\.org\\/ns\\/solid\\/acp#AccessControlResource>;[^,]+rel=\"type\"/);\n }\n\n public isPersonalProfile(): boolean {\n return !!this.statement(this.url, expandIRI('rdf:type'), expandIRI('foaf:PersonalProfileDocument'));\n }\n\n public isStorage(): boolean {\n return !!this.headers.get('Link')?.match(/<http:\\/\\/www\\.w3\\.org\\/ns\\/pim\\/space#Storage>;[^,]+rel=\"type\"/);\n }\n\n public isUserWritable(): boolean {\n return this.getUserPermissions().includes(SolidDocumentPermission.Write);\n }\n\n public getUserPermissions(): SolidDocumentPermission[] {\n return this.getPermissionsFromWAC('user');\n }\n\n public getPublicPermissions(): SolidDocumentPermission[] {\n return this.getPermissionsFromWAC('public');\n }\n\n public getLastModified(): Date | null {\n return (\n parseDate(this.headers.get('last-modified')) ??\n parseDate(this.statement(this.url, 'purl:modified')?.object.value) ??\n this.getLatestDocumentDate() ??\n null\n );\n }\n\n protected expandIRI(iri: string): string {\n return expandIRI(iri, { defaultPrefix: this.url });\n }\n\n private getLatestDocumentDate(): Date | null {\n const dates = [...this.statements(undefined, 'purl:modified'), ...this.statements(undefined, 'purl:created')]\n .map((statement) => parseDate(statement.object.value))\n .filter((date): date is Date => date !== null);\n\n return dates.length > 0 ? dates.reduce((a, b) => (a > b ? a : b)) : null;\n }\n\n private getPermissionsFromWAC(type: string): SolidDocumentPermission[] {\n const wacAllow = this.headers.get('WAC-Allow') ?? '';\n const publicModes = stringMatch<2>(wacAllow, new RegExp(`${type}=\"([^\"]+)\"`))?.[1] ?? '';\n\n return arrayFilter([\n publicModes.includes('read') && SolidDocumentPermission.Read,\n publicModes.includes('write') && SolidDocumentPermission.Write,\n publicModes.includes('append') && SolidDocumentPermission.Append,\n publicModes.includes('control') && SolidDocumentPermission.Control,\n ]);\n }\n\n}\n","import jsonld from 'jsonld';\nimport type { JsonLdDocument } from 'jsonld';\n\nexport type JsonLD = Partial<{\n '@context': Record<string, unknown>;\n '@id': string;\n '@type': null | string | string[];\n}> & { [k: string]: unknown };\n\nexport type JsonLDResource = Omit<JsonLD, '@id'> & { '@id': string };\nexport type JsonLDGraph = {\n '@context'?: Record<string, unknown>;\n '@graph': JsonLDResource[];\n};\n\nexport async function compactJsonLDGraph(json: JsonLDGraph): Promise<JsonLDGraph> {\n const compactedJsonLD = await jsonld.compact(json as JsonLdDocument, {});\n\n if ('@graph' in compactedJsonLD) {\n return compactedJsonLD as JsonLDGraph;\n }\n\n if ('@id' in compactedJsonLD) {\n return { '@graph': [compactedJsonLD] } as JsonLDGraph;\n }\n\n return { '@graph': [] };\n}\n\nexport function isJsonLDGraph(json: JsonLD): json is JsonLDGraph {\n return '@graph' in json;\n}\n","import jsonld from 'jsonld';\nimport md5 from 'md5';\nimport { arr, arrayFilter, arrayReplace, objectWithoutEmpty, stringMatchAll, tap } from '@noeldemartin/utils';\nimport { BlankNode as N3BlankNode, Quad as N3Quad, Parser, Writer } from 'n3';\nimport type { JsonLdDocument } from 'jsonld';\nimport type { Quad } from '@rdfjs/types';\nimport type { Term } from 'n3';\n\nimport SolidDocument from '@noeldemartin/solid-utils/models/SolidDocument';\n\n// eslint-disable-next-line max-len\nimport MalformedSolidDocumentError, { SolidDocumentFormat } from '@noeldemartin/solid-utils/errors/MalformedSolidDocumentError';\nimport NetworkRequestError from '@noeldemartin/solid-utils/errors/NetworkRequestError';\nimport NotFoundError from '@noeldemartin/solid-utils/errors/NotFoundError';\nimport UnauthorizedError from '@noeldemartin/solid-utils/errors/UnauthorizedError';\nimport { isJsonLDGraph } from '@noeldemartin/solid-utils/helpers/jsonld';\nimport type { JsonLD, JsonLDGraph, JsonLDResource } from '@noeldemartin/solid-utils/helpers/jsonld';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare type AnyFetch = (input: any, options?: any) => Promise<Response>;\nexport declare type TypedFetch = (input: RequestInfo, options?: RequestInit) => Promise<Response>;\nexport declare type Fetch = TypedFetch | AnyFetch;\n\nconst ANONYMOUS_PREFIX = 'anonymous://';\nconst ANONYMOUS_PREFIX_LENGTH = ANONYMOUS_PREFIX.length;\n\nasync function fetchRawSolidDocument(\n url: string,\n options?: FetchSolidDocumentOptions,\n): Promise<{ body: string; headers: Headers }> {\n const requestOptions: RequestInit = {\n headers: { Accept: 'text/turtle' },\n };\n\n if (options?.cache) {\n requestOptions.cache = options.cache;\n }\n\n try {\n const fetch = options?.fetch ?? window.fetch;\n const response = await fetch(url, requestOptions);\n\n if (response.status === 404) throw new NotFoundError(url);\n\n if ([401, 403].includes(response.status)) throw new UnauthorizedError(url, response.status);\n\n const body = await response.text();\n\n return {\n body,\n headers: response.headers,\n };\n } catch (error) {\n if (error instanceof UnauthorizedError) throw error;\n\n if (error instanceof NotFoundError) throw error;\n\n throw new NetworkRequestError(url, { cause: error });\n }\n}\n\nfunction normalizeBlankNodes(quads: Quad[]): Quad[] {\n const normalizedQuads = quads.slice(0);\n const quadsIndexes: Record<string, Set<number>> = {};\n const blankNodeIds = arr(quads)\n .flatMap((quad, index) =>\n tap(\n arrayFilter([\n quad.object.termType === 'BlankNode' ? quad.object.value : null,\n quad.subject.termType === 'BlankNode' ? quad.subject.value : null,\n ]),\n (ids) => ids.forEach((id) => (quadsIndexes[id] ??= new Set()).add(index)),\n ))\n .filter()\n .unique();\n\n for (const originalId of blankNodeIds) {\n const quadIndexes = quadsIndexes[originalId] as Set<number>;\n const normalizedId = md5(\n arr(quadIndexes)\n .map((index) => quads[index] as Quad)\n .filter(({ subject: { termType, value } }) => termType === 'BlankNode' && value === originalId)\n .map(({ predicate, object }) =>\n object.termType === 'BlankNode' ? predicate.value : predicate.value + object.value)\n .sorted()\n .join(),\n );\n\n for (const index of quadIndexes) {\n const quad = normalizedQuads[index] as Quad;\n const terms: Record<string, Term> = {\n subject: quad.subject as Term,\n object: quad.object as Term,\n };\n\n for (const [termName, termValue] of Object.entries(terms)) {\n if (termValue.termType !== 'BlankNode' || termValue.value !== originalId) continue;\n\n terms[termName] = new N3BlankNode(normalizedId) as Term;\n }\n\n arrayReplace(\n normalizedQuads,\n quad,\n new N3Quad(terms.subject as Term, quad.predicate as Term, terms.object as Term),\n );\n }\n }\n\n return normalizedQuads;\n}\n\nfunction normalizeQuads(quads: Quad[]): string {\n return quads\n .map((quad) => ' ' + quadToTurtle(quad))\n .sort()\n .join('\\n');\n}\n\nfunction preprocessSubjects(json: JsonLD): void {\n if (!json['@id']?.startsWith('#')) {\n return;\n }\n\n json['@id'] = ANONYMOUS_PREFIX + json['@id'];\n}\n\nfunction postprocessSubjects(quads: Quad[]): void {\n for (const quad of quads) {\n if (!quad.subject.value.startsWith(ANONYMOUS_PREFIX)) {\n continue;\n }\n\n quad.subject.value = quad.subject.value.slice(ANONYMOUS_PREFIX_LENGTH);\n }\n}\n\nexport interface FetchSolidDocumentOptions {\n fetch?: Fetch;\n cache?: RequestCache;\n}\n\nexport interface ParsingOptions {\n baseIRI: string;\n normalizeBlankNodes: boolean;\n}\n\nexport interface RDFGraphData {\n quads: Quad[];\n containsRelativeIRIs: boolean;\n}\n\nexport async function createSolidDocument(url: string, body: string, fetch?: Fetch): Promise<SolidDocument> {\n fetch = fetch ?? window.fetch.bind(window);\n\n const statements = await turtleToQuads(body);\n\n await fetch(url, {\n method: 'PUT',\n headers: { 'Content-Type': 'text/turtle' },\n body,\n });\n\n return new SolidDocument(url, statements, new Headers({}));\n}\n\nexport async function fetchSolidDocument(url: string, options?: FetchSolidDocumentOptions): Promise<SolidDocument> {\n const { body: data, headers } = await fetchRawSolidDocument(url, options);\n const statements = await turtleToQuads(data, { baseIRI: url });\n\n return new SolidDocument(url, statements, headers);\n}\n\nexport async function fetchSolidDocumentIfFound(\n url: string,\n options?: FetchSolidDocumentOptions,\n): Promise<SolidDocument | null> {\n try {\n const document = await fetchSolidDocument(url, options);\n\n return document;\n } catch (error) {\n if (!(error instanceof NotFoundError)) throw error;\n\n return null;\n }\n}\n\nexport async function jsonldToQuads(json: JsonLD, baseIRI?: string): Promise<Quad[]> {\n if (isJsonLDGraph(json)) {\n const graphQuads = await Promise.all(json['@graph'].map((resource) => jsonldToQuads(resource, baseIRI)));\n\n return graphQuads.flat();\n }\n\n preprocessSubjects(json);\n\n const quads = await (jsonld.toRDF(json as JsonLdDocument, { base: baseIRI }) as Promise<Quad[]>);\n\n postprocessSubjects(quads);\n\n return quads;\n}\n\nexport function normalizeSparql(sparql: string): string {\n const quads = sparqlToQuadsSync(sparql);\n\n return Object.entries(quads)\n .reduce((normalizedOperations, [operation, _quads]) => {\n const normalizedQuads = normalizeQuads(_quads);\n\n return normalizedOperations.concat(`${operation.toUpperCase()} DATA {\\n${normalizedQuads}\\n}`);\n }, [] as string[])\n .join(' ;\\n');\n}\n\nexport function normalizeTurtle(sparql: string): string {\n const quads = turtleToQuadsSync(sparql);\n\n return normalizeQuads(quads);\n}\n\nexport function parseTurtle(turtle: string, options: Partial<ParsingOptions> = {}): Promise<RDFGraphData> {\n const parserOptions = objectWithoutEmpty({ baseIRI: options.baseIRI });\n const parser = new Parser(parserOptions);\n const data: RDFGraphData = {\n quads: [],\n containsRelativeIRIs: false,\n };\n\n return new Promise((resolve, reject) => {\n const resolveRelativeIRI = parser._resolveRelativeIRI;\n\n parser._resolveRelativeIRI = (...args) => {\n data.containsRelativeIRIs = true;\n parser._resolveRelativeIRI = resolveRelativeIRI;\n\n return parser._resolveRelativeIRI(...args);\n };\n\n parser.parse(turtle, (error, quad) => {\n if (error) {\n reject(\n new MalformedSolidDocumentError(options.baseIRI ?? null, SolidDocumentFormat.Turtle, error.message),\n );\n\n return;\n }\n\n if (!quad) {\n // data.quads = options.normalizeBlankNodes\n // ? normalizeBlankNodes(data.quads)\n // : data.quads;\n\n resolve(data);\n\n return;\n }\n\n data.quads.push(quad);\n });\n });\n}\n\nexport async function quadsToJsonLD(quads: Quad[]): Promise<JsonLDGraph> {\n const graph = await jsonld.fromRDF(quads);\n\n return {\n '@graph': graph as JsonLDResource[],\n };\n}\n\nexport function quadsToTurtle(quads: Quad[]): string {\n const writer = new Writer();\n\n return writer.quadsToString(quads);\n}\n\nexport function quadToTurtle(quad: Quad): string {\n const writer = new Writer();\n\n return writer.quadsToString([quad]).slice(0, -1);\n}\n\nexport async function solidDocumentExists(url: string, options?: FetchSolidDocumentOptions): Promise<boolean> {\n try {\n const document = await fetchSolidDocument(url, options);\n\n return !document.isEmpty();\n } catch (error) {\n return false;\n }\n}\n\nexport async function sparqlToQuads(\n sparql: string,\n options: Partial<ParsingOptions> = {},\n): Promise<Record<string, Quad[]>> {\n const operations = stringMatchAll<3>(sparql, /(\\w+) DATA {([^}]+)}/g);\n const quads: Record<string, Quad[]> = {};\n\n await Promise.all(\n [...operations].map(async (operation) => {\n const operationName = operation[1].toLowerCase();\n const operationBody = operation[2];\n\n quads[operationName] = await turtleToQuads(operationBody, options);\n }),\n );\n\n return quads;\n}\n\nexport function sparqlToQuadsSync(sparql: string, options: Partial<ParsingOptions> = {}): Record<string, Quad[]> {\n const operations = stringMatchAll<3>(sparql, /(\\w+) DATA {([^}]+)}/g);\n const quads: Record<string, Quad[]> = {};\n\n for (const operation of operations) {\n const operationName = operation[1].toLowerCase();\n const operationBody = operation[2];\n\n quads[operationName] = turtleToQuadsSync(operationBody, options);\n }\n\n return quads;\n}\n\nexport async function turtleToQuads(turtle: string, options: Partial<ParsingOptions> = {}): Promise<Quad[]> {\n const { quads } = await parseTurtle(turtle, options);\n\n return quads;\n}\n\nexport function turtleToQuadsSync(turtle: string, options: Partial<ParsingOptions> = {}): Quad[] {\n const parserOptions = objectWithoutEmpty({ baseIRI: options.baseIRI });\n const parser = new Parser(parserOptions);\n\n try {\n const quads = parser.parse(turtle);\n\n return options.normalizeBlankNodes ? normalizeBlankNodes(quads) : quads;\n } catch (error) {\n throw new MalformedSolidDocumentError(\n options.baseIRI ?? null,\n SolidDocumentFormat.Turtle,\n (error as Error).message ?? '',\n );\n }\n}\n\nexport async function updateSolidDocument(url: string, body: string, fetch?: Fetch): Promise<void> {\n fetch = fetch ?? window.fetch.bind(window);\n\n await fetch(url, {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/sparql-update' },\n body,\n });\n}\n"],"names":["errorMessage","documentUrl","documentFormat","malformationDetails","SolidDocumentFormat","MalformedSolidDocumentError","JSError","__publicField","NetworkRequestError","url","options","NotFoundError","responseStatus","UnauthorizedError","knownPrefixes","defineIRIPrefix","name","value","expandIRI","iri","prefix","expandedPrefix","_a","SolidThing","quads","property","quad","SolidStore","subject","predicate","object","statement","_statement","statements","term","SolidDocumentPermission","SolidDocument","headers","parseDate","dates","date","a","b","type","wacAllow","publicModes","stringMatch","arrayFilter","compactJsonLDGraph","json","compactedJsonLD","jsonld","isJsonLDGraph","ANONYMOUS_PREFIX","ANONYMOUS_PREFIX_LENGTH","fetchRawSolidDocument","requestOptions","response","error","normalizeBlankNodes","normalizedQuads","quadsIndexes","blankNodeIds","arr","index","tap","ids","id","originalId","quadIndexes","normalizedId","md5","termType","terms","termName","termValue","N3BlankNode","arrayReplace","N3Quad","normalizeQuads","quadToTurtle","preprocessSubjects","postprocessSubjects","createSolidDocument","body","fetch","turtleToQuads","fetchSolidDocument","data","fetchSolidDocumentIfFound","jsonldToQuads","baseIRI","resource","normalizeSparql","sparql","sparqlToQuadsSync","normalizedOperations","operation","_quads","normalizeTurtle","turtleToQuadsSync","parseTurtle","turtle","parserOptions","objectWithoutEmpty","parser","Parser","resolve","reject","resolveRelativeIRI","args","quadsToJsonLD","quadsToTurtle","Writer","solidDocumentExists","sparqlToQuads","operations","stringMatchAll","operationName","operationBody","updateSolidDocument"],"mappings":";;;;;;;AAEA,SAASA,EACLC,GACAC,GACAC,GACM;AACC,SAAAF,IACD,aAAaC,CAAc,sBAAsBD,CAAW,MAAME,CAAmB,KACrF,aAAaD,CAAc,eAAeC,CAAmB;AACvE;AAEY,IAAAC,sBAAAA,OACRA,EAAA,SAAS,UADDA,IAAAA,KAAA,CAAA,CAAA;AAIZ,MAAqBC,UAAoCC,EAAQ;AAAA,EAM7D,YAAYL,GAA4BC,GAAqCC,GAA6B;AACtG,UAAMH,EAAaC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R> {
7
- toEqualSparql(sparql: string): R;
8
- toEqualTurtle(turtle: string): R;
9
- toEqualJsonLD(jsonld: JsonLD): Promise<R>;
10
- }
11
-
12
- }
13
-
14
- }
1
+ import { BlankNode } from '@rdfjs/types';
15
2
  import { JSError } from '@noeldemartin/utils';
16
- import type { JSErrorOptions } from '@noeldemartin/utils';
17
- import type { Quad } from 'rdf-js';
3
+ import { JSErrorOptions } from '@noeldemartin/utils';
4
+ import { Literal } from '@rdfjs/types';
5
+ import { NamedNode } from '@rdfjs/types';
6
+ import { Quad } from '@rdfjs/types';
7
+ import { Variable } from '@rdfjs/types';
18
8
 
19
9
  export declare type AnyFetch = (input: any, options?: any) => Promise<Response>;
20
10
 
21
- export declare function compactJsonLDGraph(jsonld: JsonLDGraph): Promise<JsonLDGraph>;
11
+ export declare function compactJsonLDGraph(json: JsonLDGraph): Promise<JsonLDGraph>;
22
12
 
23
13
  /**
24
14
  * @deprecated Use soukai-solid instead
@@ -34,13 +24,6 @@ export declare function createSolidDocument(url: string, body: string, fetch?: F
34
24
 
35
25
  export declare function defineIRIPrefix(name: string, value: string): void;
36
26
 
37
- export declare interface EqualityResult {
38
- success: boolean;
39
- message: string;
40
- expected: string;
41
- actual: string;
42
- }
43
-
44
27
  export declare function expandIRI(iri: string, options?: Partial<ExpandIRIOptions>): string;
45
28
 
46
29
  export declare interface ExpandIRIOptions {
@@ -56,11 +39,6 @@ export declare interface FetchLoginUserProfileOptions extends FetchUserProfileOp
56
39
  required?: boolean;
57
40
  }
58
41
 
59
- export declare interface FetchMockMethods {
60
- mockResponse(body?: string, headers?: Record<string, string>, status?: number): void;
61
- mockNotFoundResponse(): void;
62
- }
63
-
64
42
  export declare function fetchSolidDocument(url: string, options?: FetchSolidDocumentOptions): Promise<SolidDocument>;
65
43
 
66
44
  export declare function fetchSolidDocumentACL(documentUrl: string, fetch: Fetch): Promise<{
@@ -91,11 +69,7 @@ export declare function findContainerRegistrations(typeIndexUrl: string, type: s
91
69
  */
92
70
  export declare function findInstanceRegistrations(typeIndexUrl: string, type: string | string[], fetch?: Fetch): Promise<string[]>;
93
71
 
94
- export declare function installChaiPlugin(): void;
95
-
96
- export declare function installJestPlugin(): void;
97
-
98
- export declare function isJsonLDGraph(jsonld: JsonLD): jsonld is JsonLDGraph;
72
+ export declare function isJsonLDGraph(json: JsonLD): json is JsonLDGraph;
99
73
 
100
74
  export declare type JsonLD = Partial<{
101
75
  '@context': Record<string, unknown>;
@@ -105,8 +79,6 @@ export declare type JsonLD = Partial<{
105
79
  [k: string]: unknown;
106
80
  };
107
81
 
108
- export declare function jsonldEquals(expected: JsonLD, actual: JsonLD): Promise<EqualityResult>;
109
-
110
82
  export declare type JsonLDGraph = {
111
83
  '@context'?: Record<string, unknown>;
112
84
  '@graph': JsonLDResource[];
@@ -116,7 +88,7 @@ export declare type JsonLDResource = Omit<JsonLD, '@id'> & {
116
88
  '@id': string;
117
89
  };
118
90
 
119
- export declare function jsonldToQuads(jsonld: JsonLD, baseIRI?: string): Promise<Quad[]>;
91
+ export declare function jsonldToQuads(json: JsonLD, baseIRI?: string): Promise<Quad[]>;
120
92
 
121
93
  export declare class MalformedSolidDocumentError extends JSError {
122
94
  readonly documentUrl: string | null;
@@ -127,8 +99,6 @@ export declare class MalformedSolidDocumentError extends JSError {
127
99
 
128
100
  export declare function mintJsonLDIdentifiers(jsonld: JsonLD): JsonLDResource;
129
101
 
130
- export declare function mockFetch<T = any>(): T;
131
-
132
102
  export declare class NetworkRequestError extends JSError {
133
103
  readonly url: string;
134
104
  constructor(url: string, options?: JSErrorOptions);
@@ -165,27 +135,6 @@ export declare interface RDFGraphData {
165
135
  containsRelativeIRIs: boolean;
166
136
  }
167
137
 
168
- export declare class ResponseStub implements Response {
169
- private rawBody;
170
- readonly body: ReadableStream<Uint8Array> | null;
171
- readonly bodyUsed: boolean;
172
- readonly headers: Headers;
173
- readonly ok: boolean;
174
- readonly redirected: boolean;
175
- readonly status: number;
176
- readonly statusText: string;
177
- readonly trailer: Promise<Headers>;
178
- readonly type: ResponseType;
179
- readonly url: string;
180
- constructor(rawBody?: string, headers?: Record<string, string>, status?: number);
181
- arrayBuffer(): Promise<ArrayBuffer>;
182
- blob(): Promise<Blob>;
183
- formData(): Promise<FormData>;
184
- json(): Promise<unknown>;
185
- text(): Promise<string>;
186
- clone(): Response;
187
- }
188
-
189
138
  export declare class SolidDocument extends SolidStore {
190
139
  readonly url: string;
191
140
  readonly headers: Headers;
@@ -221,11 +170,12 @@ export declare class SolidStore {
221
170
  isEmpty(): boolean;
222
171
  getQuads(): Quad[];
223
172
  addQuads(quads: Quad[]): void;
224
- statements(subject?: string, predicate?: string, object?: string): Quad[];
225
- statement(subject?: string, predicate?: string, object?: string): Quad | null;
173
+ statements(subject?: Term | string, predicate?: Term | string, object?: Term | string): Quad[];
174
+ statement(subject?: Term | string, predicate?: Term | string, object?: Term | string): Quad | null;
226
175
  contains(subject: string, predicate?: string, object?: string): boolean;
227
176
  getThing(subject: string): SolidThing;
228
177
  protected expandIRI(iri: string): string;
178
+ protected termMatches(term: Term, value: Term | string): boolean;
229
179
  }
230
180
 
231
181
  export declare class SolidThing {
@@ -248,8 +198,6 @@ export declare interface SolidUserProfile {
248
198
  privateTypeIndexUrl?: string;
249
199
  }
250
200
 
251
- export declare function sparqlEquals(expected: string, actual: string): EqualityResult;
252
-
253
201
  export declare function sparqlToQuads(sparql: string, options?: Partial<ParsingOptions>): Promise<Record<string, Quad[]>>;
254
202
 
255
203
  export declare function sparqlToQuadsSync(sparql: string, options?: Partial<ParsingOptions>): Record<string, Quad[]>;
@@ -260,7 +208,7 @@ export declare interface SubjectParts {
260
208
  resourceHash?: string;
261
209
  }
262
210
 
263
- export declare function turtleEquals(expected: string, actual: string): EqualityResult;
211
+ export declare type Term = NamedNode | Literal | BlankNode | Quad | Variable;
264
212
 
265
213
  export declare function turtleToQuads(turtle: string, options?: Partial<ParsingOptions>): Promise<Quad[]>;
266
214