solid-logic 6.0.0-0 → 6.0.0-2
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/authSession/authSession.cjs.js +1 -1
- package/dist/authSession/authSession.cjs.js.map +1 -1
- package/dist/authSession/authSession.esm.js +25 -10
- package/dist/authSession/authSession.esm.js.map +1 -1
- package/dist/authSession/events.cjs.js.map +1 -1
- package/dist/authSession/events.esm.js.map +1 -1
- package/dist/authSession/flagAuthorizationOnTransitions.cjs.js +2 -0
- package/dist/authSession/flagAuthorizationOnTransitions.cjs.js.map +1 -0
- package/dist/authSession/flagAuthorizationOnTransitions.esm.js +59 -0
- package/dist/authSession/flagAuthorizationOnTransitions.esm.js.map +1 -0
- package/dist/authSession/identityState.cjs.js +2 -0
- package/dist/authSession/identityState.cjs.js.map +1 -0
- package/dist/authSession/identityState.esm.js +198 -0
- package/dist/authSession/identityState.esm.js.map +1 -0
- package/dist/authn/SolidAuthnLogic.cjs.js +1 -1
- package/dist/authn/SolidAuthnLogic.cjs.js.map +1 -1
- package/dist/authn/SolidAuthnLogic.esm.js +47 -40
- package/dist/authn/SolidAuthnLogic.esm.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/logic/solidLogic.cjs.js +1 -1
- package/dist/logic/solidLogic.cjs.js.map +1 -1
- package/dist/logic/solidLogic.esm.js +35 -30
- package/dist/logic/solidLogic.esm.js.map +1 -1
- package/dist/logic/solidLogicSingleton.cjs.js +1 -1
- package/dist/logic/solidLogicSingleton.cjs.js.map +1 -1
- package/dist/logic/solidLogicSingleton.esm.js +14 -13
- package/dist/logic/solidLogicSingleton.esm.js.map +1 -1
- package/dist/util/utilityLogic.cjs.js +2 -2
- package/dist/util/utilityLogic.cjs.js.map +1 -1
- package/dist/util/utilityLogic.esm.js +62 -55
- package/dist/util/utilityLogic.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogic.esm.js","names":[],"sources":["../../src/logic/solidLogic.ts"],"sourcesContent":["import * as rdf from 'rdflib'\nimport { LiveStore, NamedNode, Statement } from 'rdflib'\nimport { createAclLogic } from '../acl/aclLogic'\nimport { SolidAuthnLogic } from '../authn/SolidAuthnLogic'\nimport type { SessionWithLegacyEvents } from '../authSession/authSession'\nimport { createChatLogic } from '../chat/chatLogic'\nimport { createInboxLogic } from '../inbox/inboxLogic'\nimport { createResourceLogic } from '../resource/resourceLogic'\nimport { createProfileLogic } from '../profile/profileLogic'\nimport { createTypeIndexLogic } from '../typeIndex/typeIndexLogic'\nimport { createContainerLogic } from '../util/containerLogic'\nimport { createUtilityLogic } from '../util/utilityLogic'\nimport type { AuthnLogic, SolidLogic } from '../types'\nimport * as debug from '../util/debug'\n/*\n** It is important to distinquish `fetch`, a function provided by the browser\n** and `Fetcher`, a helper object for the rdflib Store which turns it\n** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is\n** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,\n*/\nexport function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: SessionWithLegacyEvents): SolidLogic {\n\n debug.log('SolidLogic: Unique instance created. There should only be one of these.')\n const store: LiveStore = rdf.graph() as LiveStore\n rdf.fetcher(store, {fetch: specialFetch.fetch}) // Attach a web I/O module, store.fetcher\n store.updater = new rdf.UpdateManager(store) // Add real-time live updates store.updater\n store.features = [] // disable automatic node merging on store load\n\n const authn: AuthnLogic = new SolidAuthnLogic(session)\n \n const acl = createAclLogic(store)\n const containerLogic = createContainerLogic(store)\n const utilityLogic = createUtilityLogic(store, acl, containerLogic)\n const profile = createProfileLogic(store, authn, utilityLogic)\n const chat = createChatLogic(store, profile)\n const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)\n const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)\n const resource = createResourceLogic(store, acl, containerLogic, typeIndex)\n debug.log('SolidAuthnLogic initialized')\n\n function load(doc: NamedNode | NamedNode[] | string) {\n return store.fetcher.load(doc)\n }\n\n // @@@@ use the one in rdflib.js when it is available and delete this\n function updatePromise(\n del: Array<Statement>,\n ins: Array<Statement> = []\n ): Promise<void> {\n return new Promise((resolve, reject) => {\n store.updater.update(del, ins, function (_uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }) // callback\n }) // promise\n }\n\n function clearStore() {\n store.statements.slice().forEach(store.remove.bind(store))\n }\n\n return {\n store,\n authn,\n acl,\n resource,\n inbox,\n chat,\n profile,\n typeIndex,\n load,\n updatePromise,\n clearStore\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogic.esm.js","names":[],"sources":["../../src/logic/solidLogic.ts"],"sourcesContent":["import * as rdf from 'rdflib'\nimport { LiveStore, NamedNode, Statement } from 'rdflib'\nimport { createAclLogic } from '../acl/aclLogic'\nimport { SolidAuthnLogic } from '../authn/SolidAuthnLogic'\nimport type { SessionWithLegacyEvents } from '../authSession/authSession'\nimport { flagAuthorizationOnSessionTransitions } from '../authSession/flagAuthorizationOnTransitions'\nimport { createChatLogic } from '../chat/chatLogic'\nimport { createInboxLogic } from '../inbox/inboxLogic'\nimport { createResourceLogic } from '../resource/resourceLogic'\nimport { createProfileLogic } from '../profile/profileLogic'\nimport { createTypeIndexLogic } from '../typeIndex/typeIndexLogic'\nimport { createContainerLogic } from '../util/containerLogic'\nimport { createUtilityLogic } from '../util/utilityLogic'\nimport type { AuthnLogic, SolidLogic } from '../types'\nimport * as debug from '../util/debug'\n/*\n** It is important to distinquish `fetch`, a function provided by the browser\n** and `Fetcher`, a helper object for the rdflib Store which turns it\n** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is\n** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,\n*/\nexport function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: SessionWithLegacyEvents): SolidLogic {\n\n debug.log('SolidLogic: Unique instance created. There should only be one of these.')\n const store: LiveStore = rdf.graph() as LiveStore\n rdf.fetcher(store, {fetch: specialFetch.fetch}) // Attach a web I/O module, store.fetcher\n store.updater = new rdf.UpdateManager(store) // Add real-time live updates store.updater\n store.features = [] // disable automatic node merging on store load\n // Whose credentials a request would carry changed: mark every recorded\n // response out-of-date so editability answers \"unknown\" instead of the\n // previous identity's access. Decision points repair with\n // ensureDocumentAuthorization() (see flagAuthorizationOnTransitions.ts).\n const unsubscribeAuthorization = flagAuthorizationOnSessionTransitions(store, session)\n\n const authn: AuthnLogic = new SolidAuthnLogic(session)\n\n // The subscription is released with the auth logic: both belong to this\n // instance's lifetime, so replacing a SolidLogic instance does not leave\n // the old store subscribed to the session.\n const disposeAuthn = authn.dispose?.bind(authn)\n authn.dispose = (): void => {\n unsubscribeAuthorization()\n disposeAuthn?.()\n }\n \n const acl = createAclLogic(store)\n const containerLogic = createContainerLogic(store)\n const utilityLogic = createUtilityLogic(store, acl, containerLogic)\n const profile = createProfileLogic(store, authn, utilityLogic)\n const chat = createChatLogic(store, profile)\n const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)\n const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)\n const resource = createResourceLogic(store, acl, containerLogic, typeIndex)\n debug.log('SolidAuthnLogic initialized')\n\n function load(doc: NamedNode | NamedNode[] | string) {\n return store.fetcher.load(doc)\n }\n\n // @@@@ use the one in rdflib.js when it is available and delete this\n function updatePromise(\n del: Array<Statement>,\n ins: Array<Statement> = []\n ): Promise<void> {\n return new Promise((resolve, reject) => {\n store.updater.update(del, ins, function (_uri, ok, errorBody) {\n if (!ok) {\n reject(new Error(errorBody))\n } else {\n resolve()\n }\n }) // callback\n }) // promise\n }\n\n function clearStore() {\n store.statements.slice().forEach(store.remove.bind(store))\n }\n\n return {\n store,\n authn,\n acl,\n resource,\n inbox,\n chat,\n profile,\n typeIndex,\n load,\n updatePromise,\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
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../util/debug.cjs.js"),t=require("../authSession/
|
|
1
|
+
const e=require("../util/debug.cjs.js"),t=require("../authSession/identityState.cjs.js"),n=require("../authSession/authSession.cjs.js"),r=require("./solidLogic.cjs.js");var i=async(e,r)=>{let i=r&&r.credentials&&r.credentials==`omit`,a=n.authSession;if(!t.sessionExplicitlyInactive(a)&&(a?.info?.webId||a?.webId)&&!i){let t=typeof a.fetch==`function`?a.fetch.bind(a):typeof a.authFetch==`function`?a.authFetch.bind(a):null;return t?t(e,r):window.fetch(e,r)}else return window.fetch(e,r)},a=Symbol.for(`solid-logic-singleton`),o=typeof window<`u`?window:global;function s(){return o[a]?e.log(`SolidLogic: Using existing global singleton instance.`):(e.log(`SolidLogic: Creating new global singleton instance.`),o[a]=r.createSolidLogic({fetch:i},n.authSession),e.log(`Unique quadstore initialized.`)),o[a]}var c=s();exports.solidLogicSingleton=c;
|
|
2
2
|
//# sourceMappingURL=solidLogicSingleton.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.cjs.js","names":[],"sources":["../../src/logic/solidLogicSingleton.ts"],"sourcesContent":["import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { createSolidLogic } from './solidLogic'\nimport { SolidLogic } from '../types'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n const sessionAny = authSession as any\n const sessionWebId = sessionAny?.info?.webId || sessionAny?.webId\n if (sessionWebId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n const authenticatedFetch = (typeof sessionAny.fetch === 'function')\n ? sessionAny.fetch.bind(sessionAny)\n : (typeof sessionAny.authFetch === 'function' ? sessionAny.authFetch.bind(sessionAny) : null)\n if (authenticatedFetch) {\n return authenticatedFetch(url, requestInit)\n }\n return window.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n// Global singleton pattern to ensure unique store across library versions\nconst SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton')\n\n// Type the global object properly with the singleton\ninterface GlobalWithSingleton {\n [SINGLETON_SYMBOL]?: SolidLogic\n}\n\nconst globalTarget = (typeof window !== 'undefined' ? window : global) as GlobalWithSingleton\n\nfunction getOrCreateSingleton(): SolidLogic {\n if (!globalTarget[SINGLETON_SYMBOL]) {\n debug.log('SolidLogic: Creating new global singleton instance.')\n globalTarget[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession)\n debug.log('Unique quadstore initialized.')\n } else {\n debug.log('SolidLogic: Using existing global singleton instance.')\n }\n return globalTarget[SINGLETON_SYMBOL]!\n}\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = getOrCreateSingleton()\n\nexport { solidLogicSingleton }"],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.cjs.js","names":[],"sources":["../../src/logic/solidLogicSingleton.ts"],"sourcesContent":["import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { sessionExplicitlyInactive } from '../authSession/identityState'\nimport { createSolidLogic } from './solidLogic'\nimport { SolidLogic } from '../types'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n const sessionAny = authSession as any\n // A session that explicitly reports itself inactive must not keep\n // identifying the last user: with a retained WebID, choosing the\n // authenticated fetch would send the previous identity's credentials.\n const sessionWebId = sessionExplicitlyInactive(sessionAny)\n ? undefined\n : (sessionAny?.info?.webId || sessionAny?.webId)\n if (sessionWebId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n const authenticatedFetch = (typeof sessionAny.fetch === 'function')\n ? sessionAny.fetch.bind(sessionAny)\n : (typeof sessionAny.authFetch === 'function' ? sessionAny.authFetch.bind(sessionAny) : null)\n if (authenticatedFetch) {\n return authenticatedFetch(url, requestInit)\n }\n return window.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n// Global singleton pattern to ensure unique store across library versions\nconst SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton')\n\n// Type the global object properly with the singleton\ninterface GlobalWithSingleton {\n [SINGLETON_SYMBOL]?: SolidLogic\n}\n\nconst globalTarget = (typeof window !== 'undefined' ? window : global) as GlobalWithSingleton\n\nfunction getOrCreateSingleton(): SolidLogic {\n if (!globalTarget[SINGLETON_SYMBOL]) {\n debug.log('SolidLogic: Creating new global singleton instance.')\n globalTarget[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession)\n debug.log('Unique quadstore initialized.')\n } else {\n debug.log('SolidLogic: Using existing global singleton instance.')\n }\n return globalTarget[SINGLETON_SYMBOL]!\n}\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = getOrCreateSingleton()\n\nexport { solidLogicSingleton }"],"mappings":"yKAMA,IAAM,EAAS,MAAO,EAAK,IAAgB,CACvC,IAAM,EAAY,GAAe,EAAY,aAAe,EAAY,aAAe,OACjF,EAAa,EAAA,YAOnB,GAHqB,GAAA,0BAA0B,CAAU,IAElD,GAAY,MAAM,OAAS,GAAY,QAC1B,CAAC,EAAW,CAE5B,IAAM,EAAsB,OAAO,EAAW,OAAU,WAClD,EAAW,MAAM,KAAK,CAAU,EAC/B,OAAO,EAAW,WAAc,WAAa,EAAW,UAAU,KAAK,CAAU,EAAI,KAI5F,OAHI,EACO,EAAmB,EAAK,CAAW,EAEvC,OAAO,MAAM,EAAK,CAAW,CACxC,MACI,OAAO,OAAO,MAAM,EAAK,CAAW,CAE5C,EAGM,EAAmB,OAAO,IAAI,uBAAuB,EAOrD,EAAgB,OAAO,OAAW,IAAc,OAAS,OAE/D,SAAS,GAAmC,CAQxC,OAPK,EAAa,GAKd,EAAA,IAAU,uDAAuD,GAJjE,EAAA,IAAU,qDAAqD,EAC/D,EAAa,GAAoB,EAAA,iBAAiB,CAAE,MAAO,CAAO,EAAG,EAAA,WAAW,EAChF,EAAA,IAAU,+BAA+B,GAItC,EAAa,EACxB,CAEA,IAAM,EAAsB,EAAqB"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { log as e } from "../util/debug.esm.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { sessionExplicitlyInactive as t } from "../authSession/identityState.esm.js";
|
|
3
|
+
import { authSession as n } from "../authSession/authSession.esm.js";
|
|
4
|
+
import { createSolidLogic as r } from "./solidLogic.esm.js";
|
|
4
5
|
//#region src/logic/solidLogicSingleton.ts
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
if ((
|
|
8
|
-
let t = typeof
|
|
9
|
-
return t ? t(e,
|
|
10
|
-
} else return window.fetch(e,
|
|
11
|
-
},
|
|
12
|
-
function
|
|
13
|
-
return a
|
|
6
|
+
var i = async (e, r) => {
|
|
7
|
+
let i = r && r.credentials && r.credentials == "omit", a = n;
|
|
8
|
+
if (!t(a) && (a?.info?.webId || a?.webId) && !i) {
|
|
9
|
+
let t = typeof a.fetch == "function" ? a.fetch.bind(a) : typeof a.authFetch == "function" ? a.authFetch.bind(a) : null;
|
|
10
|
+
return t ? t(e, r) : window.fetch(e, r);
|
|
11
|
+
} else return window.fetch(e, r);
|
|
12
|
+
}, a = Symbol.for("solid-logic-singleton"), o = typeof window < "u" ? window : global;
|
|
13
|
+
function s() {
|
|
14
|
+
return o[a] ? e("SolidLogic: Using existing global singleton instance.") : (e("SolidLogic: Creating new global singleton instance."), o[a] = r({ fetch: i }, n), e("Unique quadstore initialized.")), o[a];
|
|
14
15
|
}
|
|
15
|
-
var
|
|
16
|
+
var c = s();
|
|
16
17
|
//#endregion
|
|
17
|
-
export {
|
|
18
|
+
export { c as solidLogicSingleton };
|
|
18
19
|
|
|
19
20
|
//# sourceMappingURL=solidLogicSingleton.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.esm.js","names":[],"sources":["../../src/logic/solidLogicSingleton.ts"],"sourcesContent":["import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { createSolidLogic } from './solidLogic'\nimport { SolidLogic } from '../types'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n const sessionAny = authSession as any\n const sessionWebId = sessionAny?.info?.webId || sessionAny?.webId\n if (sessionWebId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n const authenticatedFetch = (typeof sessionAny.fetch === 'function')\n ? sessionAny.fetch.bind(sessionAny)\n : (typeof sessionAny.authFetch === 'function' ? sessionAny.authFetch.bind(sessionAny) : null)\n if (authenticatedFetch) {\n return authenticatedFetch(url, requestInit)\n }\n return window.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n// Global singleton pattern to ensure unique store across library versions\nconst SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton')\n\n// Type the global object properly with the singleton\ninterface GlobalWithSingleton {\n [SINGLETON_SYMBOL]?: SolidLogic\n}\n\nconst globalTarget = (typeof window !== 'undefined' ? window : global) as GlobalWithSingleton\n\nfunction getOrCreateSingleton(): SolidLogic {\n if (!globalTarget[SINGLETON_SYMBOL]) {\n debug.log('SolidLogic: Creating new global singleton instance.')\n globalTarget[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession)\n debug.log('Unique quadstore initialized.')\n } else {\n debug.log('SolidLogic: Using existing global singleton instance.')\n }\n return globalTarget[SINGLETON_SYMBOL]!\n}\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = getOrCreateSingleton()\n\nexport { solidLogicSingleton }"],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.esm.js","names":[],"sources":["../../src/logic/solidLogicSingleton.ts"],"sourcesContent":["import * as debug from '../util/debug'\nimport { authSession } from '../authSession/authSession'\nimport { sessionExplicitlyInactive } from '../authSession/identityState'\nimport { createSolidLogic } from './solidLogic'\nimport { SolidLogic } from '../types'\n\nconst _fetch = async (url, requestInit) => {\n const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'\n const sessionAny = authSession as any\n // A session that explicitly reports itself inactive must not keep\n // identifying the last user: with a retained WebID, choosing the\n // authenticated fetch would send the previous identity's credentials.\n const sessionWebId = sessionExplicitlyInactive(sessionAny)\n ? undefined\n : (sessionAny?.info?.webId || sessionAny?.webId)\n if (sessionWebId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114\n // In fact fetch should respect credentials omit itself\n const authenticatedFetch = (typeof sessionAny.fetch === 'function')\n ? sessionAny.fetch.bind(sessionAny)\n : (typeof sessionAny.authFetch === 'function' ? sessionAny.authFetch.bind(sessionAny) : null)\n if (authenticatedFetch) {\n return authenticatedFetch(url, requestInit)\n }\n return window.fetch(url, requestInit)\n } else {\n return window.fetch(url, requestInit)\n }\n}\n\n// Global singleton pattern to ensure unique store across library versions\nconst SINGLETON_SYMBOL = Symbol.for('solid-logic-singleton')\n\n// Type the global object properly with the singleton\ninterface GlobalWithSingleton {\n [SINGLETON_SYMBOL]?: SolidLogic\n}\n\nconst globalTarget = (typeof window !== 'undefined' ? window : global) as GlobalWithSingleton\n\nfunction getOrCreateSingleton(): SolidLogic {\n if (!globalTarget[SINGLETON_SYMBOL]) {\n debug.log('SolidLogic: Creating new global singleton instance.')\n globalTarget[SINGLETON_SYMBOL] = createSolidLogic({ fetch: _fetch }, authSession)\n debug.log('Unique quadstore initialized.')\n } else {\n debug.log('SolidLogic: Using existing global singleton instance.')\n }\n return globalTarget[SINGLETON_SYMBOL]!\n}\n//this const makes solidLogicSingleton global accessible in mashlib\nconst solidLogicSingleton = getOrCreateSingleton()\n\nexport { solidLogicSingleton }"],"mappings":";;;;;AAMA,IAAM,IAAS,OAAO,GAAK,MAAgB;CACvC,IAAM,IAAY,KAAe,EAAY,eAAe,EAAY,eAAe,QACjF,IAAa;CAOnB,IAHqB,GAA0B,CAAU,MAElD,GAAY,MAAM,SAAS,GAAY,UAC1B,CAAC,GAAW;EAE5B,IAAM,IAAsB,OAAO,EAAW,SAAU,aAClD,EAAW,MAAM,KAAK,CAAU,IAC/B,OAAO,EAAW,aAAc,aAAa,EAAW,UAAU,KAAK,CAAU,IAAI;EAI5F,OAHI,IACO,EAAmB,GAAK,CAAW,IAEvC,OAAO,MAAM,GAAK,CAAW;CACxC,OACI,OAAO,OAAO,MAAM,GAAK,CAAW;AAE5C,GAGM,IAAmB,OAAO,IAAI,uBAAuB,GAOrD,IAAgB,OAAO,SAAW,MAAc,SAAS;AAE/D,SAAS,IAAmC;CAQxC,OAPK,EAAa,KAKd,EAAU,uDAAuD,KAJjE,EAAU,qDAAqD,GAC/D,EAAa,KAAoB,EAAiB,EAAE,OAAO,EAAO,GAAG,CAAW,GAChF,EAAU,+BAA+B,IAItC,EAAa;AACxB;AAEA,IAAM,IAAsB,EAAqB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const e=require("./debug.cjs.js"),t=require("./utils.cjs.js"),
|
|
1
|
+
const e=require("./debug.cjs.js"),t=require("../authSession/flagAuthorizationOnTransitions.cjs.js"),n=require("./utils.cjs.js"),r=require("../logic/CustomError.cjs.js");let i=require("rdflib");function a(a,o,s){async function c(e){try{return await a.fetcher.load(e)}catch(t){if(t?.response?.status===404){try{await a.fetcher.webOperation(`PUT`,e.uri,{data:``,contentType:`text/turtle`,headers:{"If-None-Match":`*`}})}catch(t){if((t?.response?.status??t?.status)!==412)throw new r.WebOperationError(`createIfNotExists: PUT FAILED: ${e}: ${t}`)}return await a.fetcher.load(e)}if(t?.response?.status===401)throw new r.UnauthorizedError;if(t?.response?.status===403)throw n.differentOrigin(e)?new r.CrossOriginForbiddenError:new r.SameOriginForbiddenError;let i=`createIfNotExists doc load error: ${e}: ${t}`;throw new r.FetchError(t?.status,`${t?.message||``}${i}`)}}async function l(e,t){try{return await a.fetcher.load(e),!1}catch(e){if((e?.response?.status??e?.status)!==404)throw e}try{return await a.fetcher.webOperation(`PUT`,e.uri,{data:t,contentType:`text/turtle`,headers:{"If-None-Match":`*`}}),!0}catch(e){if((e?.response?.status??e?.status)===412)return!1;throw e}}async function u(n,o,s,l){if(!await t.loadAuthorizedDocument(a,l)){let t=`followOrCreateLink: cannot establish the authorization of ${l.value}`;throw e.warn(t),new r.NotEditableError(t)}let u=a.any(n,o,null,l);if(u)return u;if(!a.updater.editable(l)){let t=`followOrCreateLink: cannot edit ${l.value}`;throw e.warn(t),new r.NotEditableError(t)}try{await a.updater.update([],[(0,i.st)(n,o,s,l)])}catch(t){let n=`followOrCreateLink: Error making link in ${l} to ${s}: ${t}`;throw e.warn(n),new r.WebOperationError(t)}try{await c(s)}catch(t){throw e.warn(`followOrCreateLink: Error loading or saving new linked document: ${s}: ${t}`),t}return s}async function d(n,o,s,c,u){if(!await t.loadAuthorizedDocument(a,c)){let t=`followOrCreateLinkWithContentOnCreate: cannot establish the authorization of ${c.value}`;throw e.warn(t),new r.NotEditableError(t)}let d=a.any(n,o,null,c);if(d)return d;if(!a.updater.editable(c)){let t=`followOrCreateLinkWithContentOnCreate: cannot edit ${c.value}`;throw e.warn(t),new r.NotEditableError(t)}try{await a.updater.update([],[(0,i.st)(n,o,s,c)])}catch(t){let n=`followOrCreateLinkWithContentOnCreate: Error making link in ${c} to ${s}: ${t}`;throw e.warn(n),new r.WebOperationError(n)}try{await l(s,u)}catch(t){throw e.warn(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${s}: ${t}`),t}return s}async function f(e){let t=[`@prefix acl: <http://www.w3.org/ns/auth/acl#>.`,``,`<#alice> a acl:Authorization;
|
|
2
2
|
acl:agent <`+e.ownerWebId+`>;`,` acl:accessTo <${e.target}>;`,` acl:default <${e.target}>;`,` acl:mode acl:Read, acl:Write, acl:Control.`,``].join(`
|
|
3
3
|
`);e.accessToModes&&(t+=[`<#bobAccessTo> a acl:Authorization;`,` acl:agent <${e.peerWebId}>;`,` acl:accessTo <${e.target}>;`,` acl:mode ${e.accessToModes}.`,``].join(`
|
|
4
4
|
`)),e.defaultModes&&(t+=[`<#bobDefault> a acl:Authorization;`,` acl:agent <${e.peerWebId}>;`,` acl:default <${e.target}>;`,` acl:mode ${e.defaultModes}.`,``].join(`
|
|
5
|
-
`));let n=await
|
|
5
|
+
`));let n=await o.findAclDocUrl((0,i.sym)(e.target));return a.fetcher._fetch(n,{method:`PUT`,body:t,headers:[[`Content-Type`,`text/turtle`]]})}async function p(e,t){await a.fetcher.webOperation(`PUT`,e.uri,{data:`# ${new Date} ${t}\n`,contentType:`text/turtle`})}return{setSinglePeerAccess:f,createEmptyRdfDoc:p,followOrCreateLink:u,followOrCreateLinkWithContentOnCreate:d,loadOrCreateIfNotExists:c,loadOrCreateWithContentOnCreate:l}}exports.createUtilityLogic=a;
|
|
6
6
|
//# sourceMappingURL=utilityLogic.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilityLogic.cjs.js","names":[],"sources":["../../src/util/utilityLogic.ts"],"sourcesContent":["import { NamedNode, st, sym } from 'rdflib'\nimport {\n CrossOriginForbiddenError,\n FetchError,\n NotEditableError,\n SameOriginForbiddenError,\n UnauthorizedError,\n WebOperationError\n} from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { differentOrigin } from './utils'\n\nexport function createUtilityLogic(store, aclLogic, containerLogic) {\n\n /**\n * Create a resource if it really does not exist.\n * Be absolutely sure something does not exist before creating a new empty file,\n * as otherwise existing content could be deleted.\n */\n async function loadOrCreateIfNotExists(doc: NamedNode) {\n try {\n return await store.fetcher.load(doc)\n } catch (err: any) {\n if (err?.response?.status === 404) {\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: '',\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n } catch (putErr: any) {\n const status = putErr?.response?.status ?? putErr?.status\n if (status !== 412) {\n const msg = `createIfNotExists: PUT FAILED: ${doc}: ${putErr}`\n throw new WebOperationError(msg)\n }\n }\n return await store.fetcher.load(doc)\n }\n if (err?.response?.status === 401) {\n throw new UnauthorizedError()\n }\n if (err?.response?.status === 403) {\n if (differentOrigin(doc)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n const msg = `createIfNotExists doc load error: ${doc}: ${err}`\n throw new FetchError(err?.status, `${err?.message || ''}${msg}`)\n }\n }\n\n async function loadOrCreateWithContentOnCreate(doc: NamedNode, data: string): Promise<boolean> {\n try {\n await store.fetcher.load(doc)\n return false\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status !== 404) {\n throw err\n }\n }\n\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data,\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n return true\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status === 412) {\n // Another client created the resource between our 404 check and PUT.\n return false\n }\n throw err\n }\n }\n\n /*\n * Follow link from this doc to another thing, or else make a new link.\n * Returns existing object, or creates it if non-existent.\n */\n async function followOrCreateLink(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode\n ): Promise<NamedNode | null> {\n await store.fetcher.load(doc)\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLink: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLink: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(err)\n }\n\n try {\n await loadOrCreateIfNotExists(object)\n } catch (err) {\n debug.warn(`followOrCreateLink: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n async function followOrCreateLinkWithContentOnCreate(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode,\n data: string\n ): Promise<NamedNode | null> {\n await store.fetcher.load(doc)\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLinkWithContentOnCreate: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLinkWithContentOnCreate: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(msg)\n }\n\n try {\n await loadOrCreateWithContentOnCreate(object, data)\n } catch (err) {\n debug.warn(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n // Copied from\n // https://github.com/solidos/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5\n async function setSinglePeerAccess(options: {\n ownerWebId: string,\n peerWebId: string,\n accessToModes?: string,\n defaultModes?: string,\n target: string\n }) {\n let str = [\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '',\n '<#alice> a acl:Authorization;\\n acl:agent <' + options.ownerWebId + '>;',\n ` acl:accessTo <${options.target}>;`,\n ` acl:default <${options.target}>;`,\n ' acl:mode acl:Read, acl:Write, acl:Control.',\n ''\n ].join('\\n')\n\n if (options.accessToModes) {\n str += [\n '<#bobAccessTo> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:accessTo <${options.target}>;`,\n ` acl:mode ${options.accessToModes}.`,\n ''\n ].join('\\n')\n }\n\n if (options.defaultModes) {\n str += [\n '<#bobDefault> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:default <${options.target}>;`,\n ` acl:mode ${options.defaultModes}.`,\n ''\n ].join('\\n')\n }\n\n const aclDocUrl = await aclLogic.findAclDocUrl(sym(options.target))\n return store.fetcher._fetch(aclDocUrl, {\n method: 'PUT',\n body: str,\n headers: [['Content-Type', 'text/turtle']]\n })\n }\n\n async function createEmptyRdfDoc(doc: NamedNode, comment: string) {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: `# ${new Date()} ${comment}\\n`,\n contentType: 'text/turtle'\n })\n }\n\n return {\n setSinglePeerAccess,\n createEmptyRdfDoc,\n followOrCreateLink,\n followOrCreateLinkWithContentOnCreate,\n loadOrCreateIfNotExists,\n loadOrCreateWithContentOnCreate\n }\n}\n"],"mappings":"+HAYA,SAAgB,EAAmB,EAAO,EAAU,EAAgB,CAOlE,eAAe,EAAwB,EAAgB,CACrD,GAAI,CACF,OAAO,MAAM,EAAM,QAAQ,KAAK,CAAG,CACrC,OAAS,EAAU,CACjB,GAAI,GAAK,UAAU,SAAW,IAAK,CACjC,GAAI,CACF,MAAM,EAAM,QAAQ,aAAa,MAAO,EAAI,IAAK,CAC/C,KAAM,GACN,YAAa,cACb,QAAS,CAAE,gBAAiB,GAAI,CAClC,CAAC,CACH,OAAS,EAAa,CAEpB,IADe,GAAQ,UAAU,QAAU,GAAQ,UACpC,IAEb,MAAM,IAAI,EAAA,kBAAkB,kCADkB,EAAI,IAAI,GACvB,CAEnC,CACA,OAAO,MAAM,EAAM,QAAQ,KAAK,CAAG,CACrC,CACA,GAAI,GAAK,UAAU,SAAW,IAC5B,MAAM,IAAI,EAAA,kBAEZ,GAAI,GAAK,UAAU,SAAW,IAI5B,MAHI,EAAA,gBAAgB,CAAG,EACf,IAAI,EAAA,0BAEN,IAAI,EAAA,yBAEZ,IAAM,EAAM,qCAAqC,EAAI,IAAI,IACzD,MAAM,IAAI,EAAA,WAAW,GAAK,OAAQ,GAAG,GAAK,SAAW,KAAK,GAAK,CACjE,CACF,CAEA,eAAe,EAAgC,EAAgB,EAAgC,CAC7F,GAAI,CAEF,OADA,MAAM,EAAM,QAAQ,KAAK,CAAG,EACrB,EACT,OAAS,EAAU,CAEjB,IADe,GAAK,UAAU,QAAU,GAAK,UAC9B,IACb,MAAM,CAEV,CAEA,GAAI,CAMF,OALA,MAAM,EAAM,QAAQ,aAAa,MAAO,EAAI,IAAK,CAC/C,OACA,YA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ic.cjs.js","names":[],"sources":["../../src/util/utilityLogic.ts"],"sourcesContent":["import { NamedNode, st, sym } from 'rdflib'\nimport { loadAuthorizedDocument } from '../authSession/flagAuthorizationOnTransitions'\nimport {\n CrossOriginForbiddenError,\n FetchError,\n NotEditableError,\n SameOriginForbiddenError,\n UnauthorizedError,\n WebOperationError\n} from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { differentOrigin } from './utils'\n\nexport function createUtilityLogic(store, aclLogic, containerLogic) {\n\n /**\n * Create a resource if it really does not exist.\n * Be absolutely sure something does not exist before creating a new empty file,\n * as otherwise existing content could be deleted.\n */\n async function loadOrCreateIfNotExists(doc: NamedNode) {\n try {\n return await store.fetcher.load(doc)\n } catch (err: any) {\n if (err?.response?.status === 404) {\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: '',\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n } catch (putErr: any) {\n const status = putErr?.response?.status ?? putErr?.status\n if (status !== 412) {\n const msg = `createIfNotExists: PUT FAILED: ${doc}: ${putErr}`\n throw new WebOperationError(msg)\n }\n }\n return await store.fetcher.load(doc)\n }\n if (err?.response?.status === 401) {\n throw new UnauthorizedError()\n }\n if (err?.response?.status === 403) {\n if (differentOrigin(doc)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n const msg = `createIfNotExists doc load error: ${doc}: ${err}`\n throw new FetchError(err?.status, `${err?.message || ''}${msg}`)\n }\n }\n\n async function loadOrCreateWithContentOnCreate(doc: NamedNode, data: string): Promise<boolean> {\n try {\n await store.fetcher.load(doc)\n return false\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status !== 404) {\n throw err\n }\n }\n\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data,\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n return true\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status === 412) {\n // Another client created the resource between our 404 check and PUT.\n return false\n }\n throw err\n }\n }\n\n /*\n * Follow link from this doc to another thing, or else make a new link.\n * Returns existing object, or creates it if non-existent.\n */\n async function followOrCreateLink(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode\n ): Promise<NamedNode | null> {\n // A response begun before an identity transition can be recorded after it,\n // and on rdflib 2.4.0 a plain load does not refetch a flagged document: the\n // helper owns the load, checks it was not overtaken and repairs before\n // anything is read (see flagAuthorizationOnTransitions.ts).\n if (!(await loadAuthorizedDocument(store, doc))) {\n const msg = `followOrCreateLink: cannot establish the authorization of ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLink: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLink: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(err)\n }\n\n try {\n await loadOrCreateIfNotExists(object)\n } catch (err) {\n debug.warn(`followOrCreateLink: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n async function followOrCreateLinkWithContentOnCreate(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode,\n data: string\n ): Promise<NamedNode | null> {\n // A response begun before an identity transition can be recorded after it,\n // and on rdflib 2.4.0 a plain load does not refetch a flagged document: the\n // helper owns the load, checks it was not overtaken and repairs before\n // anything is read (see flagAuthorizationOnTransitions.ts).\n if (!(await loadAuthorizedDocument(store, doc))) {\n const msg = `followOrCreateLinkWithContentOnCreate: cannot establish the authorization of ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLinkWithContentOnCreate: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLinkWithContentOnCreate: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(msg)\n }\n\n try {\n await loadOrCreateWithContentOnCreate(object, data)\n } catch (err) {\n debug.warn(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n // Copied from\n // https://github.com/solidos/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5\n async function setSinglePeerAccess(options: {\n ownerWebId: string,\n peerWebId: string,\n accessToModes?: string,\n defaultModes?: string,\n target: string\n }) {\n let str = [\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '',\n '<#alice> a acl:Authorization;\\n acl:agent <' + options.ownerWebId + '>;',\n ` acl:accessTo <${options.target}>;`,\n ` acl:default <${options.target}>;`,\n ' acl:mode acl:Read, acl:Write, acl:Control.',\n ''\n ].join('\\n')\n\n if (options.accessToModes) {\n str += [\n '<#bobAccessTo> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:accessTo <${options.target}>;`,\n ` acl:mode ${options.accessToModes}.`,\n ''\n ].join('\\n')\n }\n\n if (options.defaultModes) {\n str += [\n '<#bobDefault> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:default <${options.target}>;`,\n ` acl:mode ${options.defaultModes}.`,\n ''\n ].join('\\n')\n }\n\n const aclDocUrl = await aclLogic.findAclDocUrl(sym(options.target))\n return store.fetcher._fetch(aclDocUrl, {\n method: 'PUT',\n body: str,\n headers: [['Content-Type', 'text/turtle']]\n })\n }\n\n async function createEmptyRdfDoc(doc: NamedNode, comment: string) {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: `# ${new Date()} ${comment}\\n`,\n contentType: 'text/turtle'\n })\n }\n\n return {\n setSinglePeerAccess,\n createEmpty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AAQ,IACjC,YAAa,aACf,CAAC,CACH,CAEA,MAAO,CACL,sBACA,oBACA,qBACA,wCACA,0BACA,iCACF,CACF"}
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { warn as e } from "./debug.esm.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { loadAuthorizedDocument as t } from "../authSession/flagAuthorizationOnTransitions.esm.js";
|
|
3
|
+
import { differentOrigin as n } from "./utils.esm.js";
|
|
4
|
+
import { CrossOriginForbiddenError as r, FetchError as i, NotEditableError as a, SameOriginForbiddenError as o, UnauthorizedError as s, WebOperationError as c } from "../logic/CustomError.esm.js";
|
|
5
|
+
import { st as l, sym as u } from "rdflib";
|
|
5
6
|
//#region src/util/utilityLogic.ts
|
|
6
|
-
function
|
|
7
|
-
async function
|
|
7
|
+
function d(d, f, p) {
|
|
8
|
+
async function m(e) {
|
|
8
9
|
try {
|
|
9
|
-
return await
|
|
10
|
-
} catch (
|
|
11
|
-
if (
|
|
10
|
+
return await d.fetcher.load(e);
|
|
11
|
+
} catch (t) {
|
|
12
|
+
if (t?.response?.status === 404) {
|
|
12
13
|
try {
|
|
13
|
-
await
|
|
14
|
+
await d.fetcher.webOperation("PUT", e.uri, {
|
|
14
15
|
data: "",
|
|
15
16
|
contentType: "text/turtle",
|
|
16
17
|
headers: { "If-None-Match": "*" }
|
|
17
18
|
});
|
|
18
19
|
} catch (t) {
|
|
19
|
-
if ((t?.response?.status ?? t?.status) !== 412) throw new
|
|
20
|
+
if ((t?.response?.status ?? t?.status) !== 412) throw new c(`createIfNotExists: PUT FAILED: ${e}: ${t}`);
|
|
20
21
|
}
|
|
21
|
-
return await
|
|
22
|
+
return await d.fetcher.load(e);
|
|
22
23
|
}
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
25
|
-
let
|
|
26
|
-
throw new
|
|
24
|
+
if (t?.response?.status === 401) throw new s();
|
|
25
|
+
if (t?.response?.status === 403) throw n(e) ? new r() : new o();
|
|
26
|
+
let a = `createIfNotExists doc load error: ${e}: ${t}`;
|
|
27
|
+
throw new i(t?.status, `${t?.message || ""}${a}`);
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
async function
|
|
30
|
+
async function h(e, t) {
|
|
30
31
|
try {
|
|
31
|
-
return await
|
|
32
|
+
return await d.fetcher.load(e), !1;
|
|
32
33
|
} catch (e) {
|
|
33
34
|
if ((e?.response?.status ?? e?.status) !== 404) throw e;
|
|
34
35
|
}
|
|
35
36
|
try {
|
|
36
|
-
return await
|
|
37
|
+
return await d.fetcher.webOperation("PUT", e.uri, {
|
|
37
38
|
data: t,
|
|
38
39
|
contentType: "text/turtle",
|
|
39
40
|
headers: { "If-None-Match": "*" }
|
|
@@ -43,48 +44,54 @@ function u(u, d, f) {
|
|
|
43
44
|
throw e;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
async function
|
|
47
|
-
await
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
async function g(n, r, i, o) {
|
|
48
|
+
if (!await t(d, o)) {
|
|
49
|
+
let t = `followOrCreateLink: cannot establish the authorization of ${o.value}`;
|
|
50
|
+
throw e(t), new a(t);
|
|
51
|
+
}
|
|
52
|
+
let s = d.any(n, r, null, o);
|
|
53
|
+
if (s) return s;
|
|
54
|
+
if (!d.updater.editable(o)) {
|
|
55
|
+
let t = `followOrCreateLink: cannot edit ${o.value}`;
|
|
56
|
+
throw e(t), new a(t);
|
|
53
57
|
}
|
|
54
58
|
try {
|
|
55
|
-
await
|
|
59
|
+
await d.updater.update([], [l(n, r, i, o)]);
|
|
56
60
|
} catch (t) {
|
|
57
|
-
throw e(`followOrCreateLink: Error making link in ${
|
|
61
|
+
throw e(`followOrCreateLink: Error making link in ${o} to ${i}: ${t}`), new c(t);
|
|
58
62
|
}
|
|
59
63
|
try {
|
|
60
|
-
await
|
|
64
|
+
await m(i);
|
|
61
65
|
} catch (t) {
|
|
62
|
-
throw e(`followOrCreateLink: Error loading or saving new linked document: ${
|
|
66
|
+
throw e(`followOrCreateLink: Error loading or saving new linked document: ${i}: ${t}`), t;
|
|
63
67
|
}
|
|
64
|
-
return
|
|
68
|
+
return i;
|
|
65
69
|
}
|
|
66
|
-
async function
|
|
67
|
-
await
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
async function _(n, r, i, o, s) {
|
|
71
|
+
if (!await t(d, o)) {
|
|
72
|
+
let t = `followOrCreateLinkWithContentOnCreate: cannot establish the authorization of ${o.value}`;
|
|
73
|
+
throw e(t), new a(t);
|
|
74
|
+
}
|
|
75
|
+
let u = d.any(n, r, null, o);
|
|
76
|
+
if (u) return u;
|
|
77
|
+
if (!d.updater.editable(o)) {
|
|
78
|
+
let t = `followOrCreateLinkWithContentOnCreate: cannot edit ${o.value}`;
|
|
79
|
+
throw e(t), new a(t);
|
|
73
80
|
}
|
|
74
81
|
try {
|
|
75
|
-
await
|
|
82
|
+
await d.updater.update([], [l(n, r, i, o)]);
|
|
76
83
|
} catch (t) {
|
|
77
|
-
let n = `followOrCreateLinkWithContentOnCreate: Error making link in ${
|
|
78
|
-
throw e(n), new
|
|
84
|
+
let n = `followOrCreateLinkWithContentOnCreate: Error making link in ${o} to ${i}: ${t}`;
|
|
85
|
+
throw e(n), new c(n);
|
|
79
86
|
}
|
|
80
87
|
try {
|
|
81
|
-
await
|
|
88
|
+
await h(i, s);
|
|
82
89
|
} catch (t) {
|
|
83
|
-
throw e(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${
|
|
90
|
+
throw e(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${i}: ${t}`), t;
|
|
84
91
|
}
|
|
85
|
-
return
|
|
92
|
+
return i;
|
|
86
93
|
}
|
|
87
|
-
async function
|
|
94
|
+
async function v(e) {
|
|
88
95
|
let t = [
|
|
89
96
|
"@prefix acl: <http://www.w3.org/ns/auth/acl#>.",
|
|
90
97
|
"",
|
|
@@ -107,29 +114,29 @@ function u(u, d, f) {
|
|
|
107
114
|
` acl:mode ${e.defaultModes}.`,
|
|
108
115
|
""
|
|
109
116
|
].join("\n"));
|
|
110
|
-
let n = await
|
|
111
|
-
return
|
|
117
|
+
let n = await f.findAclDocUrl(u(e.target));
|
|
118
|
+
return d.fetcher._fetch(n, {
|
|
112
119
|
method: "PUT",
|
|
113
120
|
body: t,
|
|
114
121
|
headers: [["Content-Type", "text/turtle"]]
|
|
115
122
|
});
|
|
116
123
|
}
|
|
117
|
-
async function
|
|
118
|
-
await
|
|
124
|
+
async function y(e, t) {
|
|
125
|
+
await d.fetcher.webOperation("PUT", e.uri, {
|
|
119
126
|
data: `# ${/* @__PURE__ */ new Date()} ${t}\n`,
|
|
120
127
|
contentType: "text/turtle"
|
|
121
128
|
});
|
|
122
129
|
}
|
|
123
130
|
return {
|
|
124
|
-
setSinglePeerAccess:
|
|
125
|
-
createEmptyRdfDoc:
|
|
126
|
-
followOrCreateLink:
|
|
127
|
-
followOrCreateLinkWithContentOnCreate:
|
|
128
|
-
loadOrCreateIfNotExists:
|
|
129
|
-
loadOrCreateWithContentOnCreate:
|
|
131
|
+
setSinglePeerAccess: v,
|
|
132
|
+
createEmptyRdfDoc: y,
|
|
133
|
+
followOrCreateLink: g,
|
|
134
|
+
followOrCreateLinkWithContentOnCreate: _,
|
|
135
|
+
loadOrCreateIfNotExists: m,
|
|
136
|
+
loadOrCreateWithContentOnCreate: h
|
|
130
137
|
};
|
|
131
138
|
}
|
|
132
139
|
//#endregion
|
|
133
|
-
export {
|
|
140
|
+
export { d as createUtilityLogic };
|
|
134
141
|
|
|
135
142
|
//# sourceMappingURL=utilityLogic.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilityLogic.esm.js","names":[],"sources":["../../src/util/utilityLogic.ts"],"sourcesContent":["import { NamedNode, st, sym } from 'rdflib'\nimport {\n CrossOriginForbiddenError,\n FetchError,\n NotEditableError,\n SameOriginForbiddenError,\n UnauthorizedError,\n WebOperationError\n} from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { differentOrigin } from './utils'\n\nexport function createUtilityLogic(store, aclLogic, containerLogic) {\n\n /**\n * Create a resource if it really does not exist.\n * Be absolutely sure something does not exist before creating a new empty file,\n * as otherwise existing content could be deleted.\n */\n async function loadOrCreateIfNotExists(doc: NamedNode) {\n try {\n return await store.fetcher.load(doc)\n } catch (err: any) {\n if (err?.response?.status === 404) {\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: '',\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n } catch (putErr: any) {\n const status = putErr?.response?.status ?? putErr?.status\n if (status !== 412) {\n const msg = `createIfNotExists: PUT FAILED: ${doc}: ${putErr}`\n throw new WebOperationError(msg)\n }\n }\n return await store.fetcher.load(doc)\n }\n if (err?.response?.status === 401) {\n throw new UnauthorizedError()\n }\n if (err?.response?.status === 403) {\n if (differentOrigin(doc)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n const msg = `createIfNotExists doc load error: ${doc}: ${err}`\n throw new FetchError(err?.status, `${err?.message || ''}${msg}`)\n }\n }\n\n async function loadOrCreateWithContentOnCreate(doc: NamedNode, data: string): Promise<boolean> {\n try {\n await store.fetcher.load(doc)\n return false\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status !== 404) {\n throw err\n }\n }\n\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data,\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n return true\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status === 412) {\n // Another client created the resource between our 404 check and PUT.\n return false\n }\n throw err\n }\n }\n\n /*\n * Follow link from this doc to another thing, or else make a new link.\n * Returns existing object, or creates it if non-existent.\n */\n async function followOrCreateLink(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode\n ): Promise<NamedNode | null> {\n await store.fetcher.load(doc)\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLink: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLink: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(err)\n }\n\n try {\n await loadOrCreateIfNotExists(object)\n } catch (err) {\n debug.warn(`followOrCreateLink: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n async function followOrCreateLinkWithContentOnCreate(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode,\n data: string\n ): Promise<NamedNode | null> {\n await store.fetcher.load(doc)\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLinkWithContentOnCreate: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLinkWithContentOnCreate: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(msg)\n }\n\n try {\n await loadOrCreateWithContentOnCreate(object, data)\n } catch (err) {\n debug.warn(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n // Copied from\n // https://github.com/solidos/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5\n async function setSinglePeerAccess(options: {\n ownerWebId: string,\n peerWebId: string,\n accessToModes?: string,\n defaultModes?: string,\n target: string\n }) {\n let str = [\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '',\n '<#alice> a acl:Authorization;\\n acl:agent <' + options.ownerWebId + '>;',\n ` acl:accessTo <${options.target}>;`,\n ` acl:default <${options.target}>;`,\n ' acl:mode acl:Read, acl:Write, acl:Control.',\n ''\n ].join('\\n')\n\n if (options.accessToModes) {\n str += [\n '<#bobAccessTo> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:accessTo <${options.target}>;`,\n ` acl:mode ${options.accessToModes}.`,\n ''\n ].join('\\n')\n }\n\n if (options.defaultModes) {\n str += [\n '<#bobDefault> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:default <${options.target}>;`,\n ` acl:mode ${options.defaultModes}.`,\n ''\n ].join('\\n')\n }\n\n const aclDocUrl = await aclLogic.findAclDocUrl(sym(options.target))\n return store.fetcher._fetch(aclDocUrl, {\n method: 'PUT',\n body: str,\n headers: [['Content-Type', 'text/turtle']]\n })\n }\n\n async function createEmptyRdfDoc(doc: NamedNode, comment: string) {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: `# ${new Date()} ${comment}\\n`,\n contentType: 'text/turtle'\n })\n }\n\n return {\n setSinglePeerAccess,\n createEmptyRdfDoc,\n followOrCreateLink,\n followOrCreateLinkWithContentOnCreate,\n loadOrCreateIfNotExists,\n loadOrCreateWithContentOnCreate\n }\n}\n"],"mappings":";;;;;AAYA,SAAgB,EAAmB,GAAO,GAAU,GAAgB;CAOlE,eAAe,EAAwB,GAAgB;EACrD,IAAI;GACF,OAAO,MAAM,EAAM,QAAQ,KAAK,CAAG;EACrC,SAAS,GAAU;GACjB,IAAI,GAAK,UAAU,WAAW,KAAK;IACjC,IAAI;KACF,MAAM,EAAM,QAAQ,aAAa,OAAO,EAAI,KAAK;MAC/C,MAAM;MACN,aAAa;MACb,SAAS,EAAE,iBAAiB,IAAI;KAClC,CAAC;IACH,SAAS,GAAa;KAEpB,KADe,GAAQ,UAAU,UAAU,GAAQ,YACpC,KAEb,MAAM,IAAI,EAAkB,kCADkB,EAAI,IAAI,GACvB;IAEnC;IACA,OAAO,MAAM,EAAM,QAAQ,KAAK,CAAG;GACrC;GACA,IAAI,GA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,CAAC;EAClE,OAAO,EAAM,QAAQ,OAAO,GAAW;GACrC,QAAQ;GACR,MAAM;GACN,SAAS,CAAC,CAAC,gBAAgB,aAAa,CAAC;EAC3C,CAAC;CACH;CAEA,eAAe,EAAkB,GAAgB,GAAiB;EAChE,MAAM,EAAM,QAAQ,aAAa,OAAO,EAAI,KAAK;GAC/C,MAAM,qBAAK,IAAI,KAAK,EAAE,GAAG,EAAQ;GACjC,aAAa;EACf,CAAC;CACH;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"utilityLogic.esm.js","names":[],"sources":["../../src/util/utilityLogic.ts"],"sourcesContent":["import { NamedNode, st, sym } from 'rdflib'\nimport { loadAuthorizedDocument } from '../authSession/flagAuthorizationOnTransitions'\nimport {\n CrossOriginForbiddenError,\n FetchError,\n NotEditableError,\n SameOriginForbiddenError,\n UnauthorizedError,\n WebOperationError\n} from '../logic/CustomError'\nimport * as debug from '../util/debug'\nimport { differentOrigin } from './utils'\n\nexport function createUtilityLogic(store, aclLogic, containerLogic) {\n\n /**\n * Create a resource if it really does not exist.\n * Be absolutely sure something does not exist before creating a new empty file,\n * as otherwise existing content could be deleted.\n */\n async function loadOrCreateIfNotExists(doc: NamedNode) {\n try {\n return await store.fetcher.load(doc)\n } catch (err: any) {\n if (err?.response?.status === 404) {\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: '',\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n } catch (putErr: any) {\n const status = putErr?.response?.status ?? putErr?.status\n if (status !== 412) {\n const msg = `createIfNotExists: PUT FAILED: ${doc}: ${putErr}`\n throw new WebOperationError(msg)\n }\n }\n return await store.fetcher.load(doc)\n }\n if (err?.response?.status === 401) {\n throw new UnauthorizedError()\n }\n if (err?.response?.status === 403) {\n if (differentOrigin(doc)) {\n throw new CrossOriginForbiddenError()\n }\n throw new SameOriginForbiddenError()\n }\n const msg = `createIfNotExists doc load error: ${doc}: ${err}`\n throw new FetchError(err?.status, `${err?.message || ''}${msg}`)\n }\n }\n\n async function loadOrCreateWithContentOnCreate(doc: NamedNode, data: string): Promise<boolean> {\n try {\n await store.fetcher.load(doc)\n return false\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status !== 404) {\n throw err\n }\n }\n\n try {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data,\n contentType: 'text/turtle',\n headers: { 'If-None-Match': '*' }\n })\n return true\n } catch (err: any) {\n const status = err?.response?.status ?? err?.status\n if (status === 412) {\n // Another client created the resource between our 404 check and PUT.\n return false\n }\n throw err\n }\n }\n\n /*\n * Follow link from this doc to another thing, or else make a new link.\n * Returns existing object, or creates it if non-existent.\n */\n async function followOrCreateLink(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode\n ): Promise<NamedNode | null> {\n // A response begun before an identity transition can be recorded after it,\n // and on rdflib 2.4.0 a plain load does not refetch a flagged document: the\n // helper owns the load, checks it was not overtaken and repairs before\n // anything is read (see flagAuthorizationOnTransitions.ts).\n if (!(await loadAuthorizedDocument(store, doc))) {\n const msg = `followOrCreateLink: cannot establish the authorization of ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLink: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLink: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(err)\n }\n\n try {\n await loadOrCreateIfNotExists(object)\n } catch (err) {\n debug.warn(`followOrCreateLink: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n async function followOrCreateLinkWithContentOnCreate(\n subject: NamedNode,\n predicate: NamedNode,\n object: NamedNode,\n doc: NamedNode,\n data: string\n ): Promise<NamedNode | null> {\n // A response begun before an identity transition can be recorded after it,\n // and on rdflib 2.4.0 a plain load does not refetch a flagged document: the\n // helper owns the load, checks it was not overtaken and repairs before\n // anything is read (see flagAuthorizationOnTransitions.ts).\n if (!(await loadAuthorizedDocument(store, doc))) {\n const msg = `followOrCreateLinkWithContentOnCreate: cannot establish the authorization of ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n const result = store.any(subject, predicate, null, doc)\n\n if (result) return result as NamedNode\n if (!store.updater.editable(doc)) {\n const msg = `followOrCreateLinkWithContentOnCreate: cannot edit ${doc.value}`\n debug.warn(msg)\n throw new NotEditableError(msg)\n }\n\n try {\n await store.updater.update([], [st(subject, predicate, object, doc)])\n } catch (err) {\n const msg = `followOrCreateLinkWithContentOnCreate: Error making link in ${doc} to ${object}: ${err}`\n debug.warn(msg)\n throw new WebOperationError(msg)\n }\n\n try {\n await loadOrCreateWithContentOnCreate(object, data)\n } catch (err) {\n debug.warn(`followOrCreateLinkWithContentOnCreate: Error loading or saving new linked document: ${object}: ${err}`)\n throw err\n }\n return object\n }\n\n // Copied from\n // https://github.com/solidos/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5\n async function setSinglePeerAccess(options: {\n ownerWebId: string,\n peerWebId: string,\n accessToModes?: string,\n defaultModes?: string,\n target: string\n }) {\n let str = [\n '@prefix acl: <http://www.w3.org/ns/auth/acl#>.',\n '',\n '<#alice> a acl:Authorization;\\n acl:agent <' + options.ownerWebId + '>;',\n ` acl:accessTo <${options.target}>;`,\n ` acl:default <${options.target}>;`,\n ' acl:mode acl:Read, acl:Write, acl:Control.',\n ''\n ].join('\\n')\n\n if (options.accessToModes) {\n str += [\n '<#bobAccessTo> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:accessTo <${options.target}>;`,\n ` acl:mode ${options.accessToModes}.`,\n ''\n ].join('\\n')\n }\n\n if (options.defaultModes) {\n str += [\n '<#bobDefault> a acl:Authorization;',\n ` acl:agent <${options.peerWebId}>;`,\n ` acl:default <${options.target}>;`,\n ` acl:mode ${options.defaultModes}.`,\n ''\n ].join('\\n')\n }\n\n const aclDocUrl = await aclLogic.findAclDocUrl(sym(options.target))\n return store.fetcher._fetch(aclDocUrl, {\n method: 'PUT',\n body: str,\n headers: [['Content-Type', 'text/turtle']]\n })\n }\n\n async function createEmptyRdfDoc(doc: NamedNode, comment: string) {\n await store.fetcher.webOperation('PUT', doc.uri, {\n data: `# ${new Date()} ${comment}\\n`,\n contentType: 'text/turtle'\n })\n }\n\n return {\n setSinglePeerAccess,\n createEmptyRdfDoc,\n followOrCreateLink,\n followOrCreateLinkWithContentOnCreate,\n loadOrCreateIfNotExists,\n loadOrCreateWithContentOnCreate\n }\n}\n"],"mappings":";;;;;;AAaA,SAAgB,EAAmB,GAAO,GAAU,GAAgB;CAOlE,eAAe,EAAwB,GAAgB;EACrD,IAAI;GACF,OAAO,MAAM,EAAM,QAAQ,KAAK,CAAG;EACrC,SAAS,GAAU;GACjB,IAAI,GAAK,UAAU,WAAW,KAAK;IACjC,IAAI;KACF,MAAM,EAAM,QAAQ,aAAa,OAAO,EAAI,KAAK;MAC/C,MAAM;MACN,aAAa;MACb,SAAS,EAAE,iBAAiB,IAAI;KAClC,CAAC;IACH,SAAS,GAAa;KAEpB,KADe,GAAQ,UAAU,UAAU,GAAQ,YACpC,KAEb,MAAM,IAAI,EAAkB,kCADkB,EAAI,IAAI,GACvB;IAEnC;IACA,OAAO,MAAM,EAAM,QAAQ,KAAK,CAAG;GACrC;GACA,IAAI,GAAK,UAAU,WAAW,KAC5B,MAAM,IAAI,EAAkB;GAE9B,IAAI,GAAK,UAAU,WAAW,KAI5B,MAHI,EAAgB,CAAG,IACf,IAAI,EAA0B,IAEhC,IAAI,EAAyB;GAErC,IAAM,IAAM,qCAAqC,EAAI,IAAI;GACzD,MAAM,IAAI,EAAW,GAAK,QAAQ,GAAG,GAAK,WAAW,KAAK,GAAK;EACjE;CACF;CAEA,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M;GACN,SAAS,CAAC,CAAC,gBAAgB,aAAa,CAAC;EAC3C,CAAC;CACH;CAEA,eAAe,EAAkB,GAAgB,GAAiB;EAChE,MAAM,EAAM,QAAQ,aAAa,OAAO,EAAI,KAAK;GAC/C,MAAM,qBAAK,IAAI,KAAK,EAAE,GAAG,EAAQ;GACjC,aAAa;EACf,CAAC;CACH;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-logic",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-2",
|
|
4
4
|
"description": "Core business logic of SolidOS",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"eslint-plugin-import": "^2.32.0",
|
|
56
56
|
"vitest": "^4.1.9",
|
|
57
57
|
"jsdom": "^21.1.0",
|
|
58
|
-
"rdflib": "^2.4.
|
|
58
|
+
"rdflib": "^2.4.1",
|
|
59
59
|
"ts-loader": "^9.6.1",
|
|
60
60
|
"tslib": "^2.8.1",
|
|
61
61
|
"typescript": "^5.9.3",
|