@noeldemartin/solid-utils 0.5.0 → 0.6.0-next.3e3ceb79b047f4ec87a416c2f920a13eda7a0df1
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/io-CMHtz5bu.js +401 -0
- package/dist/io-CMHtz5bu.js.map +1 -0
- package/dist/noeldemartin-solid-utils.d.ts +13 -65
- package/dist/noeldemartin-solid-utils.js +224 -0
- package/dist/noeldemartin-solid-utils.js.map +1 -0
- package/dist/testing.d.ts +45 -0
- package/dist/testing.js +157 -0
- package/dist/testing.js.map +1 -0
- package/package.json +61 -63
- package/src/errors/UnauthorizedError.ts +1 -3
- package/src/errors/UnsuccessfulNetworkRequestError.ts +2 -2
- package/src/helpers/auth.test.ts +221 -0
- package/src/helpers/auth.ts +28 -27
- package/src/helpers/identifiers.test.ts +76 -0
- package/src/helpers/identifiers.ts +14 -17
- package/src/helpers/index.ts +0 -1
- package/src/helpers/interop.ts +23 -16
- package/src/helpers/io.test.ts +228 -0
- package/src/helpers/io.ts +57 -77
- package/src/helpers/jsonld.ts +6 -6
- package/src/helpers/vocabs.ts +3 -6
- package/src/helpers/wac.test.ts +64 -0
- package/src/helpers/wac.ts +10 -6
- package/src/index.ts +3 -0
- package/src/models/SolidDocument.test.ts +77 -0
- package/src/models/SolidDocument.ts +14 -18
- package/src/models/SolidStore.ts +22 -12
- package/src/models/SolidThing.ts +5 -7
- package/src/models/index.ts +2 -0
- package/src/{helpers/testing.ts → testing/helpers.ts} +24 -27
- package/src/testing/hepers.test.ts +329 -0
- package/src/testing/index.ts +2 -2
- package/src/testing/vitest/index.ts +13 -0
- package/src/testing/vitest/matchers.ts +68 -0
- package/src/types/n3.d.ts +0 -2
- package/.github/workflows/ci.yml +0 -16
- package/.nvmrc +0 -1
- package/CHANGELOG.md +0 -70
- package/dist/noeldemartin-solid-utils.cjs.js +0 -2
- package/dist/noeldemartin-solid-utils.cjs.js.map +0 -1
- package/dist/noeldemartin-solid-utils.esm.js +0 -2
- package/dist/noeldemartin-solid-utils.esm.js.map +0 -1
- package/dist/noeldemartin-solid-utils.umd.js +0 -90
- package/dist/noeldemartin-solid-utils.umd.js.map +0 -1
- package/noeldemartin.config.js +0 -9
- package/src/main.ts +0 -5
- package/src/plugins/chai/assertions.ts +0 -40
- package/src/plugins/chai/index.ts +0 -5
- package/src/plugins/cypress/types.d.ts +0 -15
- package/src/plugins/index.ts +0 -2
- package/src/plugins/jest/index.ts +0 -5
- package/src/plugins/jest/matchers.ts +0 -65
- package/src/plugins/jest/types.d.ts +0 -14
- package/src/testing/ResponseStub.ts +0 -46
- package/src/testing/mocking.ts +0 -33
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var L = (t, e, r) => e in t ? I(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var f = (t, e, r) => L(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { f as m, S as k, U as Q, c as H, u as J, s as N, a as z } from "./io-CMHtz5bu.js";
|
|
5
|
+
import { M as yt, N as vt, d as Tt, w as gt, b as xt, x as Pt, y as Ut, m as bt, r as $t, v as Et, o as jt, j as St, n as Dt, e as qt, p as Ct, h as Rt, q as At, g as It, i as Lt, k as kt, t as Qt, l as Ht } from "./io-CMHtz5bu.js";
|
|
6
|
+
import { JSError as E, silenced as j, urlRoot as O, urlRoute as W, urlParentDirectory as U, objectWithoutEmpty as h, arrayUnique as F, tap as M, objectDeepClone as _, urlParse as B, uuid as S, isObject as b, isArray as G, arr as V, urlResolve as K, requireUrlParentDirectory as D } from "@noeldemartin/utils";
|
|
7
|
+
function X(t, e) {
|
|
8
|
+
return e = e ?? t, typeof t == "string" ? `${t} (returned ${e.status} status code)` : `Request to ${e.url} returned ${e.status} status code`;
|
|
9
|
+
}
|
|
10
|
+
class st extends E {
|
|
11
|
+
constructor(r, a) {
|
|
12
|
+
super(X(r, a));
|
|
13
|
+
f(this, "response");
|
|
14
|
+
this.response = a ?? r;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class Y extends E {
|
|
18
|
+
constructor(r, a, o) {
|
|
19
|
+
super(`The resource at ${r} is using an unsupported authorization protocol (${a})`, o);
|
|
20
|
+
f(this, "url");
|
|
21
|
+
f(this, "protocol");
|
|
22
|
+
this.url = r, this.protocol = a;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function Z(t, e) {
|
|
26
|
+
var u;
|
|
27
|
+
const r = new k(t.getQuads()), a = { [t.url]: t }, o = (n) => {
|
|
28
|
+
n.statements(void 0, "foaf:isPrimaryTopicOf").map((i) => i.object.value).forEach((i) => a[i] = a[i] ?? null), n.statements(void 0, "foaf:primaryTopic").map((i) => i.subject.value).forEach((i) => a[i] = a[i] ?? null);
|
|
29
|
+
}, s = async () => {
|
|
30
|
+
for (const [n, i] of Object.entries(a))
|
|
31
|
+
if (i === null)
|
|
32
|
+
try {
|
|
33
|
+
const c = await m(n, e);
|
|
34
|
+
a[n] = c, r.addQuads(c.getQuads()), o(c);
|
|
35
|
+
} catch (c) {
|
|
36
|
+
if (c instanceof Q) {
|
|
37
|
+
a[n] = !1;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
throw c;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
o(t);
|
|
44
|
+
do
|
|
45
|
+
await s();
|
|
46
|
+
while (Object.values(a).some((n) => n === null));
|
|
47
|
+
return {
|
|
48
|
+
store: r,
|
|
49
|
+
cloaked: Object.values(a).some((n) => n === !1),
|
|
50
|
+
writableProfileUrl: t.isUserWritable() ? t.url : ((u = Object.values(a).find(
|
|
51
|
+
(n) => !!n && n.isUserWritable()
|
|
52
|
+
)) == null ? void 0 : u.url) ?? null
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function $(t, e = {}) {
|
|
56
|
+
var y, v, T, g, x, P;
|
|
57
|
+
const r = {
|
|
58
|
+
fetch: e.fetch,
|
|
59
|
+
// Needed for CSS v7.1.3.
|
|
60
|
+
// See https://github.com/CommunitySolidServer/CommunitySolidServer/issues/1972
|
|
61
|
+
cache: "no-store"
|
|
62
|
+
}, a = W(t), o = await m(a, r);
|
|
63
|
+
if (!o.isPersonalProfile() && !o.contains(t, "solid:oidcIssuer"))
|
|
64
|
+
throw new Error(`${t} is not a valid webId.`);
|
|
65
|
+
const { store: s, writableProfileUrl: u, cloaked: n } = await Z(o, e), i = s.statements(t, "pim:storage").map((d) => d.object.value), c = s.statement(t, "solid:publicTypeIndex"), p = s.statement(t, "solid:privateTypeIndex");
|
|
66
|
+
let l = U(a);
|
|
67
|
+
for (; l && i.length === 0; ) {
|
|
68
|
+
const d = await j(m(l, r));
|
|
69
|
+
if (d != null && d.isStorage()) {
|
|
70
|
+
i.push(l);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
l = U(l);
|
|
74
|
+
}
|
|
75
|
+
if (i.length === 0)
|
|
76
|
+
throw new Error(`Could not find any storage for ${t}.`);
|
|
77
|
+
return await ((y = e.onLoaded) == null ? void 0 : y.call(e, s)), {
|
|
78
|
+
webId: t,
|
|
79
|
+
cloaked: n,
|
|
80
|
+
writableProfileUrl: u,
|
|
81
|
+
storageUrls: F(i),
|
|
82
|
+
...h({
|
|
83
|
+
name: ((v = s.statement(t, "vcard:fn")) == null ? void 0 : v.object.value) ?? ((T = s.statement(t, "foaf:name")) == null ? void 0 : T.object.value),
|
|
84
|
+
avatarUrl: ((g = s.statement(t, "vcard:hasPhoto")) == null ? void 0 : g.object.value) ?? ((x = s.statement(t, "foaf:img")) == null ? void 0 : x.object.value),
|
|
85
|
+
oidcIssuerUrl: (P = s.statement(t, "solid:oidcIssuer")) == null ? void 0 : P.object.value,
|
|
86
|
+
publicTypeIndexUrl: c == null ? void 0 : c.object.value,
|
|
87
|
+
privateTypeIndexUrl: p == null ? void 0 : p.object.value
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async function it(t, e = {}) {
|
|
92
|
+
if (e.required)
|
|
93
|
+
return $(t, e);
|
|
94
|
+
const r = j((a) => $(a, e));
|
|
95
|
+
return await r(t) ?? await r(t.replace(/\/$/, "").concat("/profile/card#me")) ?? await r(O(t).concat("/profile/card#me"));
|
|
96
|
+
}
|
|
97
|
+
function tt(t) {
|
|
98
|
+
return !t.path || !t.path.startsWith("/") ? null : t.path.match(/^\/[^/]*$/) ? "/" : `/${V(t.path.split("/")).filter().slice(0, -1).join("/")}/`.replace("//", "/");
|
|
99
|
+
}
|
|
100
|
+
function et(t) {
|
|
101
|
+
const e = tt(t);
|
|
102
|
+
return t.protocol && t.domain ? `${t.protocol}://${t.domain}${e ?? "/"}` : e;
|
|
103
|
+
}
|
|
104
|
+
function w(t) {
|
|
105
|
+
if (!(!("@type" in t) || "@value" in t)) {
|
|
106
|
+
t["@id"] = t["@id"] ?? S();
|
|
107
|
+
for (const e of Object.values(t))
|
|
108
|
+
b(e) && w(e), G(e) && e.forEach((r) => b(r) && w(r));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function ct(t) {
|
|
112
|
+
return M(_(t), (e) => w(e));
|
|
113
|
+
}
|
|
114
|
+
function ut(t) {
|
|
115
|
+
const e = B(t);
|
|
116
|
+
return e ? h({
|
|
117
|
+
containerUrl: et(e),
|
|
118
|
+
documentName: e.path ? e.path.split("/").pop() : null,
|
|
119
|
+
resourceHash: e.fragment
|
|
120
|
+
}) : {};
|
|
121
|
+
}
|
|
122
|
+
async function rt(t, e, r) {
|
|
123
|
+
r = r ?? window.fetch.bind(r);
|
|
124
|
+
const a = t.storageUrls[0], o = `${a}settings/${e}TypeIndex`;
|
|
125
|
+
return await N(o, { fetch: r }) ? `${a}settings/${e}TypeIndex-${S()}` : o;
|
|
126
|
+
}
|
|
127
|
+
async function q(t, e, r) {
|
|
128
|
+
if (t.writableProfileUrl === null)
|
|
129
|
+
throw new Error("Can't create type index without a writable profile document");
|
|
130
|
+
r = r ?? window.fetch.bind(r);
|
|
131
|
+
const a = await rt(t, e, r), o = e === "public" ? "<> a <http://www.w3.org/ns/solid/terms#TypeIndex> ." : `
|
|
132
|
+
<> a
|
|
133
|
+
<http://www.w3.org/ns/solid/terms#TypeIndex>,
|
|
134
|
+
<http://www.w3.org/ns/solid/terms#UnlistedDocument> .
|
|
135
|
+
`, s = `
|
|
136
|
+
INSERT DATA {
|
|
137
|
+
<${t.webId}> <http://www.w3.org/ns/solid/terms#${e}TypeIndex> <${a}> .
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
return await H(a, o, r), await J(t.writableProfileUrl, s, r), a;
|
|
141
|
+
}
|
|
142
|
+
async function C(t, e, r, a) {
|
|
143
|
+
const o = await m(t, { fetch: a });
|
|
144
|
+
return (Array.isArray(e) ? e : [e]).map((u) => o.statements(void 0, "rdf:type", "solid:TypeRegistration").filter((n) => o.contains(n.subject.value, "solid:forClass", u)).map((n) => o.statements(n.subject.value, r)).flat().map((n) => n.object.value).filter((n) => !!n)).flat();
|
|
145
|
+
}
|
|
146
|
+
async function lt(t, e) {
|
|
147
|
+
return q(t, "public", e);
|
|
148
|
+
}
|
|
149
|
+
async function dt(t, e) {
|
|
150
|
+
return q(t, "private", e);
|
|
151
|
+
}
|
|
152
|
+
async function ft(t, e, r) {
|
|
153
|
+
return C(t, e, "solid:instanceContainer", r);
|
|
154
|
+
}
|
|
155
|
+
async function mt(t, e, r) {
|
|
156
|
+
return C(t, e, "solid:instance", r);
|
|
157
|
+
}
|
|
158
|
+
async function R(t, e) {
|
|
159
|
+
var s;
|
|
160
|
+
e = e ?? window.fetch.bind(window);
|
|
161
|
+
const o = ((s = ((await e(t, { method: "HEAD" })).headers.get("Link") ?? "").match(/<([^>]+)>;\s*rel="acl"/)) == null ? void 0 : s[1]) ?? null;
|
|
162
|
+
if (!o)
|
|
163
|
+
throw new Error(`Could not find ACL Resource for '${t}'`);
|
|
164
|
+
return K(D(t), o);
|
|
165
|
+
}
|
|
166
|
+
async function A(t, e, r) {
|
|
167
|
+
r = r ?? await R(t, e);
|
|
168
|
+
const a = await z(r ?? "", { fetch: e });
|
|
169
|
+
if (!a)
|
|
170
|
+
return A(D(t), e);
|
|
171
|
+
if (a.isACPResource())
|
|
172
|
+
throw new Y(t, "ACP");
|
|
173
|
+
return a;
|
|
174
|
+
}
|
|
175
|
+
async function pt(t, e) {
|
|
176
|
+
const r = await R(t, e), a = await A(t, e, r);
|
|
177
|
+
return h({
|
|
178
|
+
url: r,
|
|
179
|
+
effectiveUrl: a.url,
|
|
180
|
+
document: a
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
export {
|
|
184
|
+
yt as MalformedSolidDocumentError,
|
|
185
|
+
vt as NetworkRequestError,
|
|
186
|
+
Tt as NotFoundError,
|
|
187
|
+
gt as SolidDocument,
|
|
188
|
+
xt as SolidDocumentFormat,
|
|
189
|
+
Pt as SolidDocumentPermission,
|
|
190
|
+
k as SolidStore,
|
|
191
|
+
Ut as SolidThing,
|
|
192
|
+
Q as UnauthorizedError,
|
|
193
|
+
st as UnsuccessfulNetworkRequestError,
|
|
194
|
+
Y as UnsupportedAuthorizationProtocolError,
|
|
195
|
+
bt as compactJsonLDGraph,
|
|
196
|
+
dt as createPrivateTypeIndex,
|
|
197
|
+
lt as createPublicTypeIndex,
|
|
198
|
+
H as createSolidDocument,
|
|
199
|
+
$t as defineIRIPrefix,
|
|
200
|
+
Et as expandIRI,
|
|
201
|
+
it as fetchLoginUserProfile,
|
|
202
|
+
m as fetchSolidDocument,
|
|
203
|
+
pt as fetchSolidDocumentACL,
|
|
204
|
+
z as fetchSolidDocumentIfFound,
|
|
205
|
+
ft as findContainerRegistrations,
|
|
206
|
+
mt as findInstanceRegistrations,
|
|
207
|
+
jt as isJsonLDGraph,
|
|
208
|
+
St as jsonldToQuads,
|
|
209
|
+
ct as mintJsonLDIdentifiers,
|
|
210
|
+
Dt as normalizeSparql,
|
|
211
|
+
qt as normalizeTurtle,
|
|
212
|
+
ut as parseResourceSubject,
|
|
213
|
+
Ct as parseTurtle,
|
|
214
|
+
Rt as quadToTurtle,
|
|
215
|
+
At as quadsToJsonLD,
|
|
216
|
+
It as quadsToTurtle,
|
|
217
|
+
N as solidDocumentExists,
|
|
218
|
+
Lt as sparqlToQuads,
|
|
219
|
+
kt as sparqlToQuadsSync,
|
|
220
|
+
Qt as turtleToQuads,
|
|
221
|
+
Ht as turtleToQuadsSync,
|
|
222
|
+
J as updateSolidDocument
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=noeldemartin-solid-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noeldemartin-solid-utils.js","sources":["../src/errors/UnsuccessfulNetworkRequestError.ts","../src/errors/UnsupportedAuthorizationProtocolError.ts","../src/helpers/auth.ts","../src/helpers/identifiers.ts","../src/helpers/interop.ts","../src/helpers/wac.ts"],"sourcesContent":["import { JSError } from '@noeldemartin/utils';\n\nfunction getErrorMessage(messageOrResponse: string | Response, response?: Response): string {\n response = response ?? (messageOrResponse as Response);\n\n return typeof messageOrResponse === 'string'\n ? `${messageOrResponse} (returned ${response.status} status code)`\n : `Request to ${response.url} returned ${response.status} status code`;\n}\n\nexport default class UnsuccessfulRequestError extends JSError {\n\n public response: Response;\n\n constructor(response: Response);\n constructor(message: string, response: Response);\n constructor(messageOrResponse: string | Response, response?: Response) {\n super(getErrorMessage(messageOrResponse, response));\n\n this.response = response ?? (messageOrResponse as Response);\n }\n\n}\n","import { JSError } from '@noeldemartin/utils';\nimport type { JSErrorOptions } from '@noeldemartin/utils';\n\nexport default class UnsupportedAuthorizationProtocolError extends JSError {\n\n public readonly url: string;\n public readonly protocol: string;\n\n constructor(url: string, protocol: string, options?: JSErrorOptions) {\n super(`The resource at ${url} is using an unsupported authorization protocol (${protocol})`, options);\n\n this.url = url;\n this.protocol = protocol;\n }\n\n}\n","import { arrayUnique, objectWithoutEmpty, silenced, urlParentDirectory, urlRoot, urlRoute } from '@noeldemartin/utils';\n\nimport SolidStore from '../models/SolidStore';\nimport UnauthorizedError from '../errors/UnauthorizedError';\nimport type SolidDocument from '../models/SolidDocument';\n\nimport { fetchSolidDocument } from './io';\nimport type { Fetch, FetchSolidDocumentOptions } from './io';\n\nexport interface SolidUserProfile {\n webId: string;\n storageUrls: [string, ...string[]];\n cloaked: boolean;\n writableProfileUrl: string | null;\n name?: string;\n avatarUrl?: string;\n oidcIssuerUrl?: string;\n publicTypeIndexUrl?: string;\n privateTypeIndexUrl?: string;\n}\n\nasync function fetchExtendedUserProfile(\n webIdDocument: SolidDocument,\n options?: FetchSolidDocumentOptions,\n): Promise<{\n store: SolidStore;\n cloaked: boolean;\n writableProfileUrl: string | null;\n}> {\n const store = new SolidStore(webIdDocument.getQuads());\n const documents: Record<string, SolidDocument | false | null> = { [webIdDocument.url]: webIdDocument };\n const addReferencedDocumentUrls = (document: SolidDocument) => {\n document\n .statements(undefined, 'foaf:isPrimaryTopicOf')\n .map((quad) => quad.object.value)\n .forEach((profileDocumentUrl) => (documents[profileDocumentUrl] = documents[profileDocumentUrl] ?? null));\n document\n .statements(undefined, 'foaf:primaryTopic')\n .map((quad) => quad.subject.value)\n .forEach((profileDocumentUrl) => (documents[profileDocumentUrl] = documents[profileDocumentUrl] ?? null));\n };\n const loadProfileDocuments = async (): Promise<void> => {\n for (const [url, document] of Object.entries(documents)) {\n if (document !== null) {\n continue;\n }\n\n try {\n const _document = await fetchSolidDocument(url, options);\n\n documents[url] = _document;\n store.addQuads(_document.getQuads());\n\n addReferencedDocumentUrls(_document);\n } catch (error) {\n if (error instanceof UnauthorizedError) {\n documents[url] = false;\n\n continue;\n }\n\n throw error;\n }\n }\n };\n\n addReferencedDocumentUrls(webIdDocument);\n\n do {\n await loadProfileDocuments();\n } while (Object.values(documents).some((document) => document === null));\n\n return {\n store,\n cloaked: Object.values(documents).some((document) => document === false),\n writableProfileUrl: webIdDocument.isUserWritable()\n ? webIdDocument.url\n : (Object.values(documents).find(\n (document): document is SolidDocument => !!document && document.isUserWritable(),\n )?.url ?? null),\n };\n}\n\nasync function fetchUserProfile(webId: string, options: FetchUserProfileOptions = {}): Promise<SolidUserProfile> {\n const requestOptions: FetchSolidDocumentOptions = {\n fetch: options.fetch,\n\n // Needed for CSS v7.1.3.\n // See https://github.com/CommunitySolidServer/CommunitySolidServer/issues/1972\n cache: 'no-store',\n };\n\n const documentUrl = urlRoute(webId);\n const document = await fetchSolidDocument(documentUrl, requestOptions);\n\n if (!document.isPersonalProfile() && !document.contains(webId, 'solid:oidcIssuer')) {\n throw new Error(`${webId} is not a valid webId.`);\n }\n\n const { store, writableProfileUrl, cloaked } = await fetchExtendedUserProfile(document, options);\n const storageUrls = store.statements(webId, 'pim:storage').map((storage) => storage.object.value);\n const publicTypeIndex = store.statement(webId, 'solid:publicTypeIndex');\n const privateTypeIndex = store.statement(webId, 'solid:privateTypeIndex');\n\n let parentUrl = urlParentDirectory(documentUrl);\n while (parentUrl && storageUrls.length === 0) {\n const parentDocument = await silenced(fetchSolidDocument(parentUrl, requestOptions));\n\n if (parentDocument?.isStorage()) {\n storageUrls.push(parentUrl);\n\n break;\n }\n\n parentUrl = urlParentDirectory(parentUrl);\n }\n\n if (storageUrls.length === 0) {\n throw new Error(`Could not find any storage for ${webId}.`);\n }\n\n await options.onLoaded?.(store);\n\n return {\n webId,\n cloaked,\n writableProfileUrl,\n storageUrls: arrayUnique(storageUrls) as [string, ...string[]],\n ...objectWithoutEmpty({\n name: store.statement(webId, 'vcard:fn')?.object.value ?? store.statement(webId, 'foaf:name')?.object.value,\n avatarUrl:\n store.statement(webId, 'vcard:hasPhoto')?.object.value ??\n store.statement(webId, 'foaf:img')?.object.value,\n oidcIssuerUrl: store.statement(webId, 'solid:oidcIssuer')?.object.value,\n publicTypeIndexUrl: publicTypeIndex?.object.value,\n privateTypeIndexUrl: privateTypeIndex?.object.value,\n }),\n };\n}\n\nexport interface FetchUserProfileOptions {\n fetch?: Fetch;\n onLoaded?(store: SolidStore): Promise<unknown> | unknown;\n}\n\nexport interface FetchLoginUserProfileOptions extends FetchUserProfileOptions {\n required?: boolean;\n}\n\nexport async function fetchLoginUserProfile(\n loginUrl: string,\n options: FetchLoginUserProfileOptions = {},\n): Promise<SolidUserProfile | null> {\n if (options.required) {\n return fetchUserProfile(loginUrl, options);\n }\n\n const fetchProfile = silenced((url) => fetchUserProfile(url, options));\n\n return (\n (await fetchProfile(loginUrl)) ??\n (await fetchProfile(loginUrl.replace(/\\/$/, '').concat('/profile/card#me'))) ??\n (await fetchProfile(urlRoot(loginUrl).concat('/profile/card#me')))\n );\n}\n","import { arr, isArray, isObject, objectDeepClone, objectWithoutEmpty, tap, urlParse, uuid } from '@noeldemartin/utils';\nimport type { UrlParts } from '@noeldemartin/utils';\nimport type { JsonLD, JsonLDResource } from '@noeldemartin/solid-utils/helpers';\n\nexport interface SubjectParts {\n containerUrl?: string;\n documentName?: string;\n resourceHash?: string;\n}\n\nfunction getContainerPath(parts: UrlParts): string | null {\n if (!parts.path || !parts.path.startsWith('/')) return null;\n\n if (parts.path.match(/^\\/[^/]*$/)) return '/';\n\n return `/${arr(parts.path.split('/')).filter().slice(0, -1).join('/')}/`.replace('//', '/');\n}\n\nfunction getContainerUrl(parts: UrlParts): string | null {\n const containerPath = getContainerPath(parts);\n\n return parts.protocol && parts.domain\n ? `${parts.protocol}://${parts.domain}${containerPath ?? '/'}`\n : containerPath;\n}\n\nfunction __mintJsonLDIdentifiers(jsonld: JsonLD): void {\n if (!('@type' in jsonld) || '@value' in jsonld) return;\n\n jsonld['@id'] = jsonld['@id'] ?? uuid();\n\n for (const propertyValue of Object.values(jsonld)) {\n if (isObject(propertyValue)) __mintJsonLDIdentifiers(propertyValue);\n\n if (isArray(propertyValue)) propertyValue.forEach((value) => isObject(value) && __mintJsonLDIdentifiers(value));\n }\n}\n\nexport function mintJsonLDIdentifiers(jsonld: JsonLD): JsonLDResource {\n return tap(objectDeepClone(jsonld) as JsonLDResource, (clone) => __mintJsonLDIdentifiers(clone));\n}\n\nexport function parseResourceSubject(subject: string): SubjectParts {\n const parts = urlParse(subject);\n\n return !parts\n ? {}\n : objectWithoutEmpty({\n containerUrl: getContainerUrl(parts),\n documentName: parts.path ? parts.path.split('/').pop() : null,\n resourceHash: parts.fragment,\n });\n}\n","import { uuid } from '@noeldemartin/utils';\n\nimport {\n createSolidDocument,\n fetchSolidDocument,\n solidDocumentExists,\n updateSolidDocument,\n} from '@noeldemartin/solid-utils/helpers/io';\nimport type { Fetch } from '@noeldemartin/solid-utils/helpers/io';\nimport type { SolidUserProfile } from '@noeldemartin/solid-utils/helpers/auth';\n\ntype TypeIndexType = 'public' | 'private';\n\nasync function mintTypeIndexUrl(user: SolidUserProfile, type: TypeIndexType, fetch?: Fetch): Promise<string> {\n fetch = fetch ?? window.fetch.bind(fetch);\n\n const storageUrl = user.storageUrls[0];\n const typeIndexUrl = `${storageUrl}settings/${type}TypeIndex`;\n\n return (await solidDocumentExists(typeIndexUrl, { fetch }))\n ? `${storageUrl}settings/${type}TypeIndex-${uuid()}`\n : typeIndexUrl;\n}\n\nasync function createTypeIndex(user: SolidUserProfile, type: TypeIndexType, fetch?: Fetch) {\n if (user.writableProfileUrl === null) {\n throw new Error('Can\\'t create type index without a writable profile document');\n }\n\n fetch = fetch ?? window.fetch.bind(fetch);\n\n const typeIndexUrl = await mintTypeIndexUrl(user, type, fetch);\n const typeIndexBody =\n type === 'public'\n ? '<> a <http://www.w3.org/ns/solid/terms#TypeIndex> .'\n : `\n <> a\n <http://www.w3.org/ns/solid/terms#TypeIndex>,\n <http://www.w3.org/ns/solid/terms#UnlistedDocument> .\n `;\n const profileUpdateBody = `\n INSERT DATA {\n <${user.webId}> <http://www.w3.org/ns/solid/terms#${type}TypeIndex> <${typeIndexUrl}> .\n }\n `;\n\n await createSolidDocument(typeIndexUrl, typeIndexBody, fetch);\n await updateSolidDocument(user.writableProfileUrl, profileUpdateBody, fetch);\n\n if (type === 'public') {\n // TODO This is currently implemented in soukai-solid.\n }\n\n return typeIndexUrl;\n}\n\n/**\n * @deprecated Use soukai-solid instead\n */\nasync function findRegistrations(\n typeIndexUrl: string,\n type: string | string[],\n predicate: string,\n fetch?: Fetch,\n): Promise<string[]> {\n const typeIndex = await fetchSolidDocument(typeIndexUrl, { fetch });\n const types = Array.isArray(type) ? type : [type];\n\n return types\n .map((_type) =>\n typeIndex\n .statements(undefined, 'rdf:type', 'solid:TypeRegistration')\n .filter((statement) => typeIndex.contains(statement.subject.value, 'solid:forClass', _type))\n .map((statement) => typeIndex.statements(statement.subject.value, predicate))\n .flat()\n .map((statement) => statement.object.value)\n .filter((url) => !!url))\n .flat();\n}\n\n/**\n * @deprecated Use soukai-solid instead\n */\nexport async function createPublicTypeIndex(user: SolidUserProfile, fetch?: Fetch): Promise<string> {\n return createTypeIndex(user, 'public', fetch);\n}\n\n/**\n * @deprecated Use soukai-solid instead\n */\nexport async function createPrivateTypeIndex(user: SolidUserProfile, fetch?: Fetch): Promise<string> {\n return createTypeIndex(user, 'private', fetch);\n}\n\n/**\n * @deprecated Use soukai-solid instead\n */\nexport async function findContainerRegistrations(\n typeIndexUrl: string,\n type: string | string[],\n fetch?: Fetch,\n): Promise<string[]> {\n return findRegistrations(typeIndexUrl, type, 'solid:instanceContainer', fetch);\n}\n\n/**\n * @deprecated Use soukai-solid instead\n */\nexport async function findInstanceRegistrations(\n typeIndexUrl: string,\n type: string | string[],\n fetch?: Fetch,\n): Promise<string[]> {\n return findRegistrations(typeIndexUrl, type, 'solid:instance', fetch);\n}\n","import { objectWithoutEmpty, requireUrlParentDirectory, urlResolve } from '@noeldemartin/utils';\n\n// eslint-disable-next-line max-len\nimport UnsupportedAuthorizationProtocolError from '@noeldemartin/solid-utils/errors/UnsupportedAuthorizationProtocolError';\nimport { fetchSolidDocumentIfFound } from '@noeldemartin/solid-utils/helpers/io';\nimport type SolidDocument from '@noeldemartin/solid-utils/models/SolidDocument';\nimport type { Fetch } from '@noeldemartin/solid-utils/helpers/io';\n\nasync function fetchACLResourceUrl(resourceUrl: string, fetch: Fetch): Promise<string> {\n fetch = fetch ?? window.fetch.bind(window);\n\n const resourceHead = await fetch(resourceUrl, { method: 'HEAD' });\n const linkHeader = resourceHead.headers.get('Link') ?? '';\n const url = linkHeader.match(/<([^>]+)>;\\s*rel=\"acl\"/)?.[1] ?? null;\n\n if (!url) {\n throw new Error(`Could not find ACL Resource for '${resourceUrl}'`);\n }\n\n return urlResolve(requireUrlParentDirectory(resourceUrl), url);\n}\n\nasync function fetchEffectiveACL(\n resourceUrl: string,\n fetch: Fetch,\n aclResourceUrl?: string | null,\n): Promise<SolidDocument> {\n aclResourceUrl = aclResourceUrl ?? (await fetchACLResourceUrl(resourceUrl, fetch));\n\n const aclDocument = await fetchSolidDocumentIfFound(aclResourceUrl ?? '', { fetch });\n\n if (!aclDocument) {\n return fetchEffectiveACL(requireUrlParentDirectory(resourceUrl), fetch);\n }\n\n if (aclDocument.isACPResource()) {\n throw new UnsupportedAuthorizationProtocolError(resourceUrl, 'ACP');\n }\n\n return aclDocument;\n}\n\nexport async function fetchSolidDocumentACL(\n documentUrl: string,\n fetch: Fetch,\n): Promise<{\n url: string;\n effectiveUrl: string;\n document: SolidDocument;\n}> {\n const url = await fetchACLResourceUrl(documentUrl, fetch);\n const document = await fetchEffectiveACL(documentUrl, fetch, url);\n\n return objectWithoutEmpty({\n url,\n effectiveUrl: document.url,\n document,\n });\n}\n"],"names":["getErrorMessage","messageOrResponse","response","UnsuccessfulRequestError","JSError","__publicField","UnsupportedAuthorizationProtocolError","url","protocol","options","fetchExtendedUserProfile","webIdDocument","store","SolidStore","documents","addReferencedDocumentUrls","document","quad","profileDocumentUrl","loadProfileDocuments","_document","fetchSolidDocument","error","UnauthorizedError","_a","fetchUserProfile","webId","requestOptions","documentUrl","urlRoute","writableProfileUrl","cloaked","storageUrls","storage","publicTypeIndex","privateTypeIndex","parentUrl","urlParentDirectory","parentDocument","silenced","arrayUnique","objectWithoutEmpty","_b","_c","_d","_e","_f","fetchLoginUserProfile","loginUrl","fetchProfile","urlRoot","getContainerPath","parts","arr","getContainerUrl","containerPath","__mintJsonLDIdentifiers","jsonld","uuid","propertyValue","isObject","isArray","value","mintJsonLDIdentifiers","tap","objectDeepClone","clone","parseResourceSubject","subject","urlParse","mintTypeIndexUrl","user","type","fetch","storageUrl","typeIndexUrl","solidDocumentExists","createTypeIndex","typeIndexBody","profileUpdateBody","createSolidDocument","updateSolidDocument","findRegistrations","predicate","typeIndex","_type","statement","createPublicTypeIndex","createPrivateTypeIndex","findContainerRegistrations","findInstanceRegistrations","fetchACLResourceUrl","resourceUrl","urlResolve","requireUrlParentDirectory","fetchEffectiveACL","aclResourceUrl","aclDocument","fetchSolidDocumentIfFound","fetchSolidDocumentACL"],"mappings":";;;;;;AAEA,SAASA,EAAgBC,GAAsCC,GAA6B;AACxF,SAAAA,IAAWA,KAAaD,GAEjB,OAAOA,KAAsB,WAC9B,GAAGA,CAAiB,cAAcC,EAAS,MAAM,kBACjD,cAAcA,EAAS,GAAG,aAAaA,EAAS,MAAM;AAChE;AAEA,MAAqBC,WAAiCC,EAAQ;AAAA,EAM1D,YAAYH,GAAsCC,GAAqB;AAC7D,UAAAF,EAAgBC,GAAmBC,CAAQ,CAAC;AAL/C,IAAAG,EAAA;AAOH,SAAK,WAAWH,KAAaD;AAAA,EAAA;AAGrC;ACnBA,MAAqBK,UAA8CF,EAAQ;AAAA,EAKvE,YAAYG,GAAaC,GAAkBC,GAA0B;AACjE,UAAM,mBAAmBF,CAAG,oDAAoDC,CAAQ,KAAKC,CAAO;AAJxF,IAAAJ,EAAA;AACA,IAAAA,EAAA;AAKZ,SAAK,MAAME,GACX,KAAK,WAAWC;AAAA,EAAA;AAGxB;ACMA,eAAeE,EACXC,GACAF,GAKD;;AACC,QAAMG,IAAQ,IAAIC,EAAWF,EAAc,UAAU,GAC/CG,IAA0D,EAAE,CAACH,EAAc,GAAG,GAAGA,EAAc,GAC/FI,IAA4B,CAACC,MAA4B;AAEtD,IAAAA,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AA6C,OAAM;AAE/D,MAAI,CAACjB;AACD,UAAM,IAAI,MAAM,oCAAoCqF,CAAW,GAAG;AAGtE,SAAOC,EAAWC,EAA0BF,CAAW,GAAGrF,CAAG;AACjE;AAEA,eAAewF,EACXH,GACAnB,GACAuB,GACsB;AACtB,EAAAA,IAAiBA,KAAmB,MAAML,EAAoBC,GAAanB,CAAK;AAEhF,QAAMwB,IAAc,MAAMC,EAA0BF,KAAkB,IAAI,EAAE,OAAAvB,GAAO;AAEnF,MAAI,CAACwB;AACD,WAAOF,EAAkBD,EAA0BF,CAAW,GAAGnB,CAAK;AAGtE,MAAAwB,EAAY;AACN,UAAA,IAAI3F,EAAsCsF,GAAa,KAAK;AAG/D,SAAAK;AACX;AAEsB,eAAAE,GAClBvE,GACA6C,GAKD;AACC,QAAMlE,IAAM,MAAMoF,EAAoB/D,GAAa6C,CAAK,GAClDzD,IAAW,MAAM+E,EAAkBnE,GAAa6C,GAAOlE,CAAG;AAEhE,SAAOkC,EAAmB;AAAA,IACtB,KAAAlC;AAAA,IACA,cAAcS,EAAS;AAAA,IACvB,UAAAA;AAAA,EAAA,CACH;AACL;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MatcherState } from '@vitest/expect';
|
|
2
|
+
|
|
3
|
+
declare const _default: {
|
|
4
|
+
toEqualJsonLD(this: MatcherState, received: any, expected: JsonLD): Promise<{
|
|
5
|
+
pass: boolean;
|
|
6
|
+
message: () => string;
|
|
7
|
+
}>;
|
|
8
|
+
toEqualSparql(this: MatcherState, received: any, expected: string): {
|
|
9
|
+
pass: boolean;
|
|
10
|
+
message: () => string;
|
|
11
|
+
};
|
|
12
|
+
toEqualTurtle(this: MatcherState, received: any, expected: string): {
|
|
13
|
+
pass: boolean;
|
|
14
|
+
message: () => string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export declare interface EqualityResult {
|
|
19
|
+
success: boolean;
|
|
20
|
+
message: string;
|
|
21
|
+
expected: string;
|
|
22
|
+
actual: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export declare function installVitestSolidMatchers(): void;
|
|
26
|
+
|
|
27
|
+
declare type JsonLD = Partial<{
|
|
28
|
+
'@context': Record<string, unknown>;
|
|
29
|
+
'@id': string;
|
|
30
|
+
'@type': null | string | string[];
|
|
31
|
+
}> & {
|
|
32
|
+
[k: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export declare function jsonldEquals(expected: JsonLD, actual: JsonLD): Promise<EqualityResult>;
|
|
36
|
+
|
|
37
|
+
export declare function sparqlEquals(expected: string, actual: string): EqualityResult;
|
|
38
|
+
|
|
39
|
+
export declare function turtleEquals(expected: string, actual: string): EqualityResult;
|
|
40
|
+
|
|
41
|
+
export declare type VitestSolidMatchers<R = unknown> = {
|
|
42
|
+
[K in keyof typeof _default]: (...args: Parameters<(typeof _default)[K]> extends [any, ...infer Rest] ? Rest : never) => ReturnType<(typeof _default)[K]> extends Promise<any> ? Promise<R> : R;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { }
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { expect as Q } from "vitest";
|
|
2
|
+
import { j as g, g as E, k as q, h as y, l as T, e as $, n as v } from "./io-CMHtz5bu.js";
|
|
3
|
+
import { pull as w, arrayRemove as b, JSError as R, stringMatchAll as S } from "@noeldemartin/utils";
|
|
4
|
+
let i = {};
|
|
5
|
+
const k = {
|
|
6
|
+
"%uuid%": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
|
|
7
|
+
};
|
|
8
|
+
class c extends R {
|
|
9
|
+
constructor(e) {
|
|
10
|
+
super(`Couldn't find the following triple: ${y(e)}`), this.expectedQuad = e;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function p(t, e) {
|
|
14
|
+
for (const n of t) {
|
|
15
|
+
const r = e.find((a) => z(n, a));
|
|
16
|
+
if (!r) throw new c(n);
|
|
17
|
+
b(e, r);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function j(t) {
|
|
21
|
+
return /\[\[(.*\]\[)?([^\]]+)\]\]/.test(t);
|
|
22
|
+
}
|
|
23
|
+
function x(t) {
|
|
24
|
+
const e = [], n = S(t, /\[\[((.*?)\]\[)?([^\]]+)\]\]/g), r = [];
|
|
25
|
+
let a = t;
|
|
26
|
+
for (const s of n)
|
|
27
|
+
s[2] && e.push(s[2]), r.push(s[3]), a = a.replace(s[0], `%PATTERN${r.length - 1}%`);
|
|
28
|
+
a = a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
29
|
+
for (const [s, o] of Object.entries(r))
|
|
30
|
+
a = a.replace(`%PATTERN${s}%`, k[o] ?? o);
|
|
31
|
+
return new RegExp(a);
|
|
32
|
+
}
|
|
33
|
+
function h(t, e) {
|
|
34
|
+
return j(t) ? (i[t] ?? (i[t] = x(t))).test(e) : t === e;
|
|
35
|
+
}
|
|
36
|
+
function O(t, e) {
|
|
37
|
+
if (t.termType !== e.termType) return !1;
|
|
38
|
+
if (t.termType === "Literal" && e.termType === "Literal") {
|
|
39
|
+
if (t.datatype.value !== e.datatype.value) return !1;
|
|
40
|
+
if (!j(t.value))
|
|
41
|
+
return t.datatype.value === "http://www.w3.org/2001/XMLSchema#dateTime" ? new Date(t.value).getTime() === new Date(e.value).getTime() : t.value === e.value;
|
|
42
|
+
}
|
|
43
|
+
return h(t.value, e.value);
|
|
44
|
+
}
|
|
45
|
+
function z(t, e) {
|
|
46
|
+
return O(t.object, e.object) && h(t.subject.value, e.subject.value) && h(t.predicate.value, e.predicate.value);
|
|
47
|
+
}
|
|
48
|
+
function m() {
|
|
49
|
+
i = {};
|
|
50
|
+
}
|
|
51
|
+
async function M(t, e) {
|
|
52
|
+
m();
|
|
53
|
+
const n = await g(t), r = await g(e), a = E(n), s = E(r), o = (u, l) => ({
|
|
54
|
+
success: u,
|
|
55
|
+
message: l,
|
|
56
|
+
expected: a,
|
|
57
|
+
actual: s
|
|
58
|
+
});
|
|
59
|
+
if (n.length !== r.length)
|
|
60
|
+
return o(!1, `Expected ${n.length} triples, found ${r.length}.`);
|
|
61
|
+
try {
|
|
62
|
+
p(n, r);
|
|
63
|
+
} catch (u) {
|
|
64
|
+
if (!(u instanceof c)) throw u;
|
|
65
|
+
return o(!1, u.message);
|
|
66
|
+
}
|
|
67
|
+
return o(!0, "jsonld matches");
|
|
68
|
+
}
|
|
69
|
+
function N(t, e) {
|
|
70
|
+
m();
|
|
71
|
+
const n = q(t, { normalizeBlankNodes: !0 }), r = q(e, { normalizeBlankNodes: !0 }), a = (o, u) => ({ success: o, message: u, expected: t, actual: e });
|
|
72
|
+
for (const o of Object.keys(n)) {
|
|
73
|
+
if (!(o in r)) return a(!1, `Couldn't find expected ${o} operation.`);
|
|
74
|
+
const u = w(n, o), l = w(r, o);
|
|
75
|
+
if (u.length !== l.length)
|
|
76
|
+
return a(!1, `Expected ${u.length} ${o} triples, found ${l.length}.`);
|
|
77
|
+
try {
|
|
78
|
+
p(u, l);
|
|
79
|
+
} catch (f) {
|
|
80
|
+
if (!(f instanceof c)) throw f;
|
|
81
|
+
return a(
|
|
82
|
+
!1,
|
|
83
|
+
`Couldn't find the following ${o} triple: ${y(f.expectedQuad)}`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const s = Object.keys(r)[0] ?? null;
|
|
88
|
+
return s ? a(!1, `Did not expect to find ${s} triples.`) : a(!0, "sparql matches");
|
|
89
|
+
}
|
|
90
|
+
function P(t, e) {
|
|
91
|
+
m();
|
|
92
|
+
const n = T(t, { normalizeBlankNodes: !0 }), r = T(e, { normalizeBlankNodes: !0 }), a = (s, o) => ({ success: s, message: o, expected: t, actual: e });
|
|
93
|
+
if (n.length !== r.length)
|
|
94
|
+
return a(!1, `Expected ${n.length} triples, found ${r.length}.`);
|
|
95
|
+
try {
|
|
96
|
+
p(n, r);
|
|
97
|
+
} catch (s) {
|
|
98
|
+
if (!(s instanceof c)) throw s;
|
|
99
|
+
return a(!1, s.message);
|
|
100
|
+
}
|
|
101
|
+
return a(!0, "turtle matches");
|
|
102
|
+
}
|
|
103
|
+
function d(t, e) {
|
|
104
|
+
const n = t.success, r = e.state.utils;
|
|
105
|
+
return { pass: n, message: n ? () => [t.message, r.matcherHint(e.hint)].join(`
|
|
106
|
+
|
|
107
|
+
`) : () => [
|
|
108
|
+
t.message,
|
|
109
|
+
r.matcherHint(e.hint),
|
|
110
|
+
[
|
|
111
|
+
`Expected: not ${r.printExpected(e.expected)}`,
|
|
112
|
+
`Received: ${r.printReceived(e.received)}`
|
|
113
|
+
].join(`
|
|
114
|
+
`)
|
|
115
|
+
].join(`
|
|
116
|
+
|
|
117
|
+
`) };
|
|
118
|
+
}
|
|
119
|
+
const A = {
|
|
120
|
+
async toEqualJsonLD(t, e) {
|
|
121
|
+
const n = await M(e, t);
|
|
122
|
+
return d(n, {
|
|
123
|
+
state: this,
|
|
124
|
+
hint: "toEqualJsonLD",
|
|
125
|
+
expected: e,
|
|
126
|
+
received: t
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
toEqualSparql(t, e) {
|
|
130
|
+
const n = N(e, t);
|
|
131
|
+
return d(n, {
|
|
132
|
+
state: this,
|
|
133
|
+
hint: "toEqualSparql",
|
|
134
|
+
expected: v(e),
|
|
135
|
+
received: v(t)
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
toEqualTurtle(t, e) {
|
|
139
|
+
const n = P(e, t);
|
|
140
|
+
return d(n, {
|
|
141
|
+
state: this,
|
|
142
|
+
hint: "toEqualTurtle",
|
|
143
|
+
expected: $(e),
|
|
144
|
+
received: $(t)
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function C() {
|
|
149
|
+
Q.extend(A);
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
C as installVitestSolidMatchers,
|
|
153
|
+
M as jsonldEquals,
|
|
154
|
+
N as sparqlEquals,
|
|
155
|
+
P as turtleEquals
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sources":["../src/testing/helpers.ts","../src/testing/vitest/matchers.ts","../src/testing/vitest/index.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","import type { MatcherState, MatchersObject } from '@vitest/expect';\n\nimport { normalizeSparql, normalizeTurtle } from '@noeldemartin/solid-utils/helpers/io';\nimport { jsonldEquals, sparqlEquals, turtleEquals } from '@noeldemartin/solid-utils/testing/helpers';\nimport type { EqualityResult } from '@noeldemartin/solid-utils/testing/helpers';\nimport type { JsonLD } from '@noeldemartin/solid-utils/helpers';\n\ninterface FormatResultOptions {\n state: MatcherState;\n hint: string;\n expected: unknown;\n received: unknown;\n}\n\nfunction formatResult(result: EqualityResult, options: FormatResultOptions) {\n const pass = result.success;\n const utils = options.state.utils;\n const message = pass\n ? () => [result.message, utils.matcherHint(options.hint)].join('\\n\\n')\n : () =>\n [\n result.message,\n utils.matcherHint(options.hint),\n [\n `Expected: not ${utils.printExpected(options.expected)}`,\n `Received: ${utils.printReceived(options.received)}`,\n ].join('\\n'),\n ].join('\\n\\n');\n\n return { pass, message };\n}\n\nexport function defineMatchers<T extends MatchersObject>(matchers: T): T {\n return matchers;\n}\n\nexport default defineMatchers({\n async toEqualJsonLD(received, expected: JsonLD) {\n const result = await jsonldEquals(expected, received);\n\n return formatResult(result, {\n state: this,\n hint: 'toEqualJsonLD',\n expected,\n received,\n });\n },\n toEqualSparql(received, expected: string) {\n const result = sparqlEquals(expected, received);\n\n return formatResult(result, {\n state: this,\n hint: 'toEqualSparql',\n expected: normalizeSparql(expected),\n received: normalizeSparql(received),\n });\n },\n toEqualTurtle(received, expected: string) {\n const result = turtleEquals(expected, received);\n\n return formatResult(result, {\n state: this,\n hint: 'toEqualTurtle',\n expected: normalizeTurtle(expected),\n received: normalizeTurtle(received),\n });\n },\n});\n","import { expect } from 'vitest';\n\nimport matchers from './matchers';\n\nexport type VitestSolidMatchers<R = unknown> = {\n [K in keyof typeof matchers]: (\n ...args: Parameters<(typeof matchers)[K]> extends [any, ...infer Rest] ? Rest : never\n ) => ReturnType<(typeof matchers)[K]> extends Promise<any> ? Promise<R> : R;\n};\n\nexport function installVitestSolidMatchers(): void {\n expect.extend(matchers);\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","formatResult","options","pass","utils","matchers","received","normalizeSparql","normalizeTurtle","installVitestSolidMatchers","expect"],"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;A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|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"typescript": "^4.2.4"
|
|
64
|
-
}
|
|
2
|
+
"name": "@noeldemartin/solid-utils",
|
|
3
|
+
"version": "0.6.0-next.3e3ceb79b047f4ec87a416c2f920a13eda7a0df1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/noeldemartin-solid-utils.d.ts",
|
|
9
|
+
"default": "./dist/noeldemartin-solid-utils.js"
|
|
10
|
+
},
|
|
11
|
+
"./testing": {
|
|
12
|
+
"types": "./dist/testing.d.ts",
|
|
13
|
+
"default": "./dist/testing.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Noel De Martin",
|
|
22
|
+
"repository": "github:NoelDeMartin/solid-utils",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"lint": "noeldemartin-lint src",
|
|
26
|
+
"test": "vitest --run",
|
|
27
|
+
"test:ci": "vitest --run --reporter verbose"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@noeldemartin/utils": "0.7.0-next.d98a97003e3b0af1b9fc05dbfd6e57fab3c2f181",
|
|
31
|
+
"@rdfjs/types": "^2.0.1",
|
|
32
|
+
"jsonld": "^8.3.3",
|
|
33
|
+
"md5": "^2.3.0",
|
|
34
|
+
"n3": "^1.24.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@noeldemartin/eslint-config-typescript": "^0.1.2",
|
|
38
|
+
"@noeldemartin/scripts": "0.3.0-next.f891bcbf278e01c7429bb641d0df38556b4ac151",
|
|
39
|
+
"@noeldemartin/testing": "0.0.0-next.cd489a93da5eaad3f89a4d9ae3734f7ef911b6f6",
|
|
40
|
+
"@tsconfig/node22": "^22.0.0",
|
|
41
|
+
"@types/jsonld": "^1.5.15",
|
|
42
|
+
"@types/md5": "^2.3.5",
|
|
43
|
+
"@types/n3": "^1.24.1",
|
|
44
|
+
"@types/node": "^22.13.10",
|
|
45
|
+
"@vitest/expect": "^3.0.9",
|
|
46
|
+
"eslint": "^8.57.1",
|
|
47
|
+
"prettier": "^3.5.3",
|
|
48
|
+
"prettier-eslint-cli": "^8.0.1",
|
|
49
|
+
"publint": "^0.3.9",
|
|
50
|
+
"typescript": "^5.8.2",
|
|
51
|
+
"vite": "^6.2.2",
|
|
52
|
+
"vite-plugin-dts": "^4.5.3",
|
|
53
|
+
"vitest": "^3.0.9"
|
|
54
|
+
},
|
|
55
|
+
"eslintConfig": {
|
|
56
|
+
"extends": [
|
|
57
|
+
"@noeldemartin/eslint-config-typescript"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"prettier": {
|
|
61
|
+
"printWidth": 120
|
|
62
|
+
}
|
|
65
63
|
}
|