solid-logic 1.3.17-c3748797 → 1.3.17-cd4cd566
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/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/logic/SolidLogic.d.ts +4 -20
- package/lib/logic/SolidLogic.d.ts.map +1 -1
- package/lib/logic/SolidLogic.js +37 -32
- package/lib/logic/SolidLogic.js.map +1 -1
- package/lib/logic/solidLogicSingleton.d.ts +1 -2
- package/lib/logic/solidLogicSingleton.d.ts.map +1 -1
- package/lib/logic/solidLogicSingleton.js +1 -1
- package/lib/logic/solidLogicSingleton.js.map +1 -1
- package/lib/types.d.ts +13 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -2
- package/src/logic/SolidLogic.ts +36 -42
- package/src/logic/solidLogicSingleton.ts +2 -2
- package/src/types.ts +13 -1
package/lib/index.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ declare const store: import("rdflib").LiveStore;
|
|
|
5
5
|
export { ACL_LINK } from './acl/aclLogic';
|
|
6
6
|
export { offlineTestID, appContext } from './authn/authUtil';
|
|
7
7
|
export { getSuggestedIssuers } from './issuer/issuerLogic';
|
|
8
|
-
export { SolidLogic } from './
|
|
9
|
-
export { AppDetails, SolidNamespace, AuthenticationContext } from './types';
|
|
8
|
+
export { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic } from './types';
|
|
10
9
|
export { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError';
|
|
11
10
|
export { solidLogicSingleton, // solidLogicSingleton is exported entirely because it is used in solid-panes
|
|
12
11
|
store, authn, authSession };
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,QAAA,MAAM,KAAK,8BAA4B,CAAA;AACvC,QAAA,MAAM,WAAW,sDAAwC,CAAA;AACzD,QAAA,MAAM,KAAK,4BAA4B,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,QAAA,MAAM,KAAK,8BAA4B,CAAA;AACvC,QAAA,MAAM,WAAW,sDAAwC,CAAA;AACzD,QAAA,MAAM,KAAK,4BAA4B,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACvF,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5K,OAAO,EACL,mBAAmB,EAAE,6EAA6E;AAClG,KAAK,EACL,KAAK,EACL,WAAW,EACZ,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.authSession = exports.authn = exports.store = exports.solidLogicSingleton = exports.WebOperationError = exports.NotEditableError = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.
|
|
3
|
+
exports.authSession = exports.authn = exports.store = exports.solidLogicSingleton = exports.WebOperationError = exports.NotEditableError = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.getSuggestedIssuers = exports.appContext = exports.offlineTestID = exports.ACL_LINK = void 0;
|
|
4
4
|
// Make these variables directly accessible as it is what you need most of the time
|
|
5
5
|
// This also makes these variable globaly accesible in mashlib
|
|
6
6
|
var solidLogicSingleton_1 = require("./logic/solidLogicSingleton");
|
|
@@ -18,8 +18,6 @@ Object.defineProperty(exports, "offlineTestID", { enumerable: true, get: functio
|
|
|
18
18
|
Object.defineProperty(exports, "appContext", { enumerable: true, get: function () { return authUtil_1.appContext; } });
|
|
19
19
|
var issuerLogic_1 = require("./issuer/issuerLogic");
|
|
20
20
|
Object.defineProperty(exports, "getSuggestedIssuers", { enumerable: true, get: function () { return issuerLogic_1.getSuggestedIssuers; } });
|
|
21
|
-
var SolidLogic_1 = require("./logic/SolidLogic");
|
|
22
|
-
Object.defineProperty(exports, "SolidLogic", { enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } });
|
|
23
21
|
var CustomError_1 = require("./logic/CustomError");
|
|
24
22
|
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return CustomError_1.UnauthorizedError; } });
|
|
25
23
|
Object.defineProperty(exports, "CrossOriginForbiddenError", { enumerable: true, get: function () { return CustomError_1.CrossOriginForbiddenError; } });
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,8DAA8D;AAC9D,mEAAiE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,8DAA8D;AAC9D,mEAAiE;AAa/D,oGAbO,yCAAmB,OAaP;AAXrB,IAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAarC,sBAAK;AAZP,IAAM,WAAW,GAAG,yCAAmB,CAAC,KAAK,CAAC,WAAW,CAAA;AAavD,kCAAW;AAZb,IAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAUrC,sBAAK;AARP,2CAAyC;AAAhC,oGAAA,QAAQ,OAAA;AACjB,6CAA4D;AAAnD,yGAAA,aAAa,OAAA;AAAE,sGAAA,UAAU,OAAA;AAClC,oDAA0D;AAAjD,kHAAA,mBAAmB,OAAA;AAE5B,mDAA4K;AAAnK,gHAAA,iBAAiB,OAAA;AAAE,wHAAA,yBAAyB,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAAE,4GAAA,aAAa,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAAE,gHAAA,iBAAiB,OAAA"}
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
me: string | undefined;
|
|
7
|
-
authn: AuthnLogic;
|
|
8
|
-
readonly acl: any;
|
|
9
|
-
readonly profile: any;
|
|
10
|
-
readonly inbox: any;
|
|
11
|
-
readonly typeIndex: any;
|
|
12
|
-
readonly chat: any;
|
|
13
|
-
private readonly containerLogic;
|
|
14
|
-
private readonly utilityLogic;
|
|
15
|
-
constructor(specialFetch: {
|
|
16
|
-
fetch: (url: any, requestInit: any) => any;
|
|
17
|
-
}, session: Session);
|
|
18
|
-
load(doc: NamedNode | NamedNode[] | string): Promise<Response> | Promise<Response[]>;
|
|
19
|
-
updatePromise(del: Array<Statement>, ins?: Array<Statement>): Promise<void>;
|
|
20
|
-
clearStore(): void;
|
|
21
|
-
}
|
|
2
|
+
import { SolidLogic } from "../types";
|
|
3
|
+
export declare function createSolidLogic(specialFetch: {
|
|
4
|
+
fetch: (url: any, requestInit: any) => any;
|
|
5
|
+
}, session: Session): SolidLogic;
|
|
22
6
|
//# sourceMappingURL=SolidLogic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidLogic.d.ts","sourceRoot":"","sources":["../../src/logic/SolidLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"SolidLogic.d.ts","sourceRoot":"","sources":["../../src/logic/SolidLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAW7D,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAQlD,wBAAgB,gBAAgB,CAAC,YAAY,EAAE;IAAE,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,KAAK,GAAG,CAAA;CAAE,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,CAuD3H"}
|
package/lib/logic/SolidLogic.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.createSolidLogic = void 0;
|
|
27
27
|
var rdf = __importStar(require("rdflib"));
|
|
28
28
|
var aclLogic_1 = require("../acl/aclLogic");
|
|
29
29
|
var SolidAuthnLogic_1 = require("../authn/SolidAuthnLogic");
|
|
@@ -40,35 +40,29 @@ var debug = __importStar(require("../util/debug"));
|
|
|
40
40
|
** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
|
|
41
41
|
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.inbox = (0, inboxLogic_1.createInboxLogic)(this.store, this.profile, this.utilityLogic, this.containerLogic, this.acl);
|
|
61
|
-
this.typeIndex = (0, typeIndexLogic_1.createTypeIndexLogic)(this.store, this.authn, this.profile, this.utilityLogic);
|
|
43
|
+
function createSolidLogic(specialFetch, session) {
|
|
44
|
+
debug.log("SolidLogic: Unique instance created. There should only be one of these.");
|
|
45
|
+
var store = rdf.graph();
|
|
46
|
+
rdf.fetcher(store, { fetch: specialFetch.fetch }); // Attach a web I/O module, store.fetcher
|
|
47
|
+
store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
|
|
48
|
+
store.features = []; // disable automatic node merging on store load
|
|
49
|
+
var authn = new SolidAuthnLogic_1.SolidAuthnLogic(session);
|
|
50
|
+
var acl = (0, aclLogic_1.createAclLogic)(store);
|
|
51
|
+
var containerLogic = (0, containerLogic_1.createContainerLogic)(store);
|
|
52
|
+
var utilityLogic = (0, utilityLogic_1.createUtilityLogic)(store, acl, containerLogic);
|
|
53
|
+
var profile = (0, profileLogic_1.createProfileLogic)(store, authn, utilityLogic);
|
|
54
|
+
var chat = (0, chatLogic_1.createChatLogic)(store, profile);
|
|
55
|
+
var inbox = (0, inboxLogic_1.createInboxLogic)(store, profile, utilityLogic, containerLogic, acl);
|
|
56
|
+
var typeIndex = (0, typeIndexLogic_1.createTypeIndexLogic)(store, authn, profile, utilityLogic);
|
|
57
|
+
debug.log('SolidAuthnLogic initialized');
|
|
58
|
+
function load(doc) {
|
|
59
|
+
return store.fetcher.load(doc);
|
|
62
60
|
}
|
|
63
|
-
SolidLogic.prototype.load = function (doc) {
|
|
64
|
-
return this.store.fetcher.load(doc);
|
|
65
|
-
};
|
|
66
61
|
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
67
|
-
|
|
68
|
-
var _this = this;
|
|
62
|
+
function updatePromise(del, ins) {
|
|
69
63
|
if (ins === void 0) { ins = []; }
|
|
70
64
|
return new Promise(function (resolve, reject) {
|
|
71
|
-
|
|
65
|
+
store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
72
66
|
if (!ok) {
|
|
73
67
|
reject(new Error(errorBody));
|
|
74
68
|
}
|
|
@@ -77,11 +71,22 @@ var SolidLogic = /** @class */ (function () {
|
|
|
77
71
|
}
|
|
78
72
|
}); // callback
|
|
79
73
|
}); // promise
|
|
74
|
+
}
|
|
75
|
+
function clearStore() {
|
|
76
|
+
store.statements.slice().forEach(store.remove.bind(store));
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
store: store,
|
|
80
|
+
authn: authn,
|
|
81
|
+
acl: acl,
|
|
82
|
+
inbox: inbox,
|
|
83
|
+
chat: chat,
|
|
84
|
+
profile: profile,
|
|
85
|
+
typeIndex: typeIndex,
|
|
86
|
+
load: load,
|
|
87
|
+
updatePromise: updatePromise,
|
|
88
|
+
clearStore: clearStore
|
|
80
89
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
return SolidLogic;
|
|
85
|
-
}());
|
|
86
|
-
exports.SolidLogic = SolidLogic;
|
|
90
|
+
}
|
|
91
|
+
exports.createSolidLogic = createSolidLogic;
|
|
87
92
|
//# sourceMappingURL=SolidLogic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidLogic.js","sourceRoot":"","sources":["../../src/logic/SolidLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAA8B;AAE9B,4CAAiD;AACjD,4DAA2D;AAC3D,+CAAoD;AACpD,kDAAuD;AACvD,wDAA6D;AAC7D,8DAAmE;AACnE,yDAA8D;AAC9D,qDAA0D;AAE1D,mD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.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,mBAAmB,yBAAmD,CAAA;AAI5E,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -78,7 +78,7 @@ var _fetch = function (url, requestInit) { return __awaiter(void 0, void 0, void
|
|
|
78
78
|
});
|
|
79
79
|
}); };
|
|
80
80
|
//this const makes solidLogicSingleton global accessible in mashlib
|
|
81
|
-
var solidLogicSingleton =
|
|
81
|
+
var solidLogicSingleton = (0, SolidLogic_1.createSolidLogic)({ fetch: _fetch }, authSession_1.authSession);
|
|
82
82
|
exports.solidLogicSingleton = solidLogicSingleton;
|
|
83
83
|
debug.log('Unique quadstore initialized.');
|
|
84
84
|
//# sourceMappingURL=solidLogicSingleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsC;AACtC,0DAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsC;AACtC,0DAAwD;AACxD,2CAA+C;AAE/C,IAAM,MAAM,GAAG,UAAO,GAAG,EAAE,WAAW;;;QAC5B,SAAS,GAAG,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,IAAI,MAAM,CAAA;QAC7F,IAAI,yBAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,EAAE,oDAAoD;YAC5F,uDAAuD;YACvD,sBAAO,yBAAW,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;SAC7C;aAAM;YACH,sBAAO,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,EAAA;SACxC;;;KACJ,CAAA;AAED,mEAAmE;AACnE,IAAM,mBAAmB,GAAG,IAAA,6BAAgB,EAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,yBAAW,CAAC,CAAA;AAInE,kDAAmB;AAF5B,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import { NamedNode } from "rdflib";
|
|
2
|
+
import { LiveStore, NamedNode, Statement } from "rdflib";
|
|
3
3
|
export declare type AppDetails = {
|
|
4
4
|
noun: string;
|
|
5
5
|
appPathSegment: string;
|
|
@@ -97,4 +97,16 @@ export interface TypeIndexLogic {
|
|
|
97
97
|
deleteTypeIndexRegistration: (item: any) => Promise<void>;
|
|
98
98
|
getScopedAppsFromIndex: (scope: TypeIndexScope, theClass: NamedNode | null) => Promise<ScopedApp[]>;
|
|
99
99
|
}
|
|
100
|
+
export interface SolidLogic {
|
|
101
|
+
store: LiveStore;
|
|
102
|
+
authn: AuthnLogic;
|
|
103
|
+
acl: AclLogic;
|
|
104
|
+
profile: ProfileLogic;
|
|
105
|
+
inbox: InboxLogic;
|
|
106
|
+
typeIndex: TypeIndexLogic;
|
|
107
|
+
chat: ChatLogic;
|
|
108
|
+
load: (doc: NamedNode | NamedNode[] | string) => void;
|
|
109
|
+
updatePromise: (del: Array<Statement>, ins: Array<Statement>) => Promise<void>;
|
|
110
|
+
clearStore: () => void;
|
|
111
|
+
}
|
|
100
112
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","s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,SAAS,EAAE,QAAQ,EAAE,SAAS,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC/G,2BAA2B,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD,sBAAsB,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAA;CACtG;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,QAAQ,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,cAAc,CAAC;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,MAAM,KAAK,IAAI,CAAC;IACtD,aAAa,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,UAAU,EAAE,MAAM,IAAI,CAAA;CACzB"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -9,8 +9,7 @@ const store = solidLogicSingleton.store
|
|
|
9
9
|
export { ACL_LINK } from './acl/aclLogic'
|
|
10
10
|
export { offlineTestID, appContext } from './authn/authUtil'
|
|
11
11
|
export { getSuggestedIssuers } from './issuer/issuerLogic'
|
|
12
|
-
export { SolidLogic } from './
|
|
13
|
-
export { AppDetails, SolidNamespace, AuthenticationContext } from './types'
|
|
12
|
+
export { AppDetails, SolidNamespace, AuthenticationContext, SolidLogic } from './types'
|
|
14
13
|
export { UnauthorizedError, CrossOriginForbiddenError, SameOriginForbiddenError, NotFoundError, FetchError, NotEditableError, WebOperationError } from './logic/CustomError'
|
|
15
14
|
|
|
16
15
|
export {
|
package/src/logic/SolidLogic.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { createProfileLogic } from "../profile/profileLogic";
|
|
|
9
9
|
import { createTypeIndexLogic } from "../typeIndex/typeIndexLogic";
|
|
10
10
|
import { createContainerLogic } from "../util/containerLogic";
|
|
11
11
|
import { createUtilityLogic } from "../util/utilityLogic";
|
|
12
|
-
import { AuthnLogic } from "../types";
|
|
12
|
+
import { AuthnLogic, SolidLogic } from "../types";
|
|
13
13
|
import * as debug from "../util/debug";
|
|
14
14
|
/*
|
|
15
15
|
** It is important to distinquish `fetch`, a function provided by the browser
|
|
@@ -17,55 +17,36 @@ import * as debug from "../util/debug";
|
|
|
17
17
|
** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
|
|
18
18
|
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export function createSolidLogic(specialFetch: { fetch: (url: any, requestInit: any) => any }, session: Session): SolidLogic {
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
debug.log("SolidLogic: Unique instance created. There should only be one of these.")
|
|
23
|
+
const store: LiveStore = rdf.graph() as LiveStore
|
|
24
|
+
rdf.fetcher(store, {fetch: specialFetch.fetch}); // Attach a web I/O module, store.fetcher
|
|
25
|
+
store.updater = new rdf.UpdateManager(store); // Add real-time live updates store.updater
|
|
26
|
+
store.features = [] // disable automatic node merging on store load
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const authn: AuthnLogic = new SolidAuthnLogic(session)
|
|
29
|
+
|
|
30
|
+
const acl = createAclLogic(store)
|
|
31
|
+
const containerLogic = createContainerLogic(store)
|
|
32
|
+
const utilityLogic = createUtilityLogic(store, acl, containerLogic)
|
|
33
|
+
const profile = createProfileLogic(store, authn, utilityLogic)
|
|
34
|
+
const chat = createChatLogic(store, profile)
|
|
35
|
+
const inbox = createInboxLogic(store, profile, utilityLogic, containerLogic, acl)
|
|
36
|
+
const typeIndex = createTypeIndexLogic(store, authn, profile, utilityLogic)
|
|
37
|
+
debug.log('SolidAuthnLogic initialized')
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// would xpect to be able to do it this way: but get TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation status: 999
|
|
37
|
-
// this.store = new rdf.LiveStore({})
|
|
38
|
-
// this.store.fetcher._fetch = fetch
|
|
39
|
-
debug.log("SolidLogic: Unique instance created. There should only be one of these.")
|
|
40
|
-
this.store = rdf.graph() as LiveStore; // Make a Quad store
|
|
41
|
-
rdf.fetcher(this.store, { fetch: specialFetch.fetch}); // Attach a web I/O module, store.fetcher
|
|
42
|
-
this.store.updater = new rdf.UpdateManager(this.store); // Add real-time live updates store.updater
|
|
43
|
-
this.store.features = [] // disable automatic node merging on store load
|
|
44
|
-
|
|
45
|
-
this.authn = new SolidAuthnLogic(session)
|
|
46
|
-
|
|
47
|
-
debug.log('SolidAuthnLogic initialized')
|
|
48
|
-
|
|
49
|
-
this.acl = createAclLogic(this.store)
|
|
50
|
-
this.containerLogic = createContainerLogic(this.store)
|
|
51
|
-
this.utilityLogic = createUtilityLogic(this.store, this.acl, this.containerLogic)
|
|
52
|
-
this.profile = createProfileLogic(this.store, this.authn, this.utilityLogic)
|
|
53
|
-
this.chat = createChatLogic(this.store, this.profile)
|
|
54
|
-
this.inbox = createInboxLogic(this.store, this.profile, this.utilityLogic, this.containerLogic, this.acl)
|
|
55
|
-
this.typeIndex = createTypeIndexLogic(this.store, this.authn, this.profile, this.utilityLogic)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
load(doc: NamedNode | NamedNode[] | string) {
|
|
59
|
-
return this.store.fetcher.load(doc);
|
|
39
|
+
function load(doc: NamedNode | NamedNode[] | string) {
|
|
40
|
+
return store.fetcher.load(doc);
|
|
60
41
|
}
|
|
61
42
|
|
|
62
43
|
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
63
|
-
updatePromise(
|
|
44
|
+
function updatePromise(
|
|
64
45
|
del: Array<Statement>,
|
|
65
46
|
ins: Array<Statement> = []
|
|
66
47
|
): Promise<void> {
|
|
67
48
|
return new Promise((resolve, reject) => {
|
|
68
|
-
|
|
49
|
+
store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
69
50
|
if (!ok) {
|
|
70
51
|
reject(new Error(errorBody));
|
|
71
52
|
} else {
|
|
@@ -75,7 +56,20 @@ export class SolidLogic {
|
|
|
75
56
|
}); // promise
|
|
76
57
|
}
|
|
77
58
|
|
|
78
|
-
clearStore() {
|
|
79
|
-
|
|
59
|
+
function clearStore() {
|
|
60
|
+
store.statements.slice().forEach(store.remove.bind(store));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
store,
|
|
65
|
+
authn,
|
|
66
|
+
acl,
|
|
67
|
+
inbox,
|
|
68
|
+
chat,
|
|
69
|
+
profile,
|
|
70
|
+
typeIndex,
|
|
71
|
+
load,
|
|
72
|
+
updatePromise,
|
|
73
|
+
clearStore
|
|
80
74
|
}
|
|
81
75
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as debug from "../util/debug"
|
|
2
2
|
import { authSession } from "../authSession/authSession"
|
|
3
|
-
import {
|
|
3
|
+
import { createSolidLogic } from "./SolidLogic"
|
|
4
4
|
|
|
5
5
|
const _fetch = async (url, requestInit) => {
|
|
6
6
|
const omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit'
|
|
@@ -13,7 +13,7 @@ const _fetch = async (url, requestInit) => {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
//this const makes solidLogicSingleton global accessible in mashlib
|
|
16
|
-
const solidLogicSingleton =
|
|
16
|
+
const solidLogicSingleton = createSolidLogic({ fetch: _fetch }, authSession)
|
|
17
17
|
|
|
18
18
|
debug.log('Unique quadstore initialized.')
|
|
19
19
|
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Session } from "@inrupt/solid-client-authn-browser"
|
|
2
|
-
import { NamedNode } from "rdflib"
|
|
2
|
+
import { LiveStore, NamedNode, Statement } from "rdflib"
|
|
3
3
|
|
|
4
4
|
export type AppDetails = {
|
|
5
5
|
noun: string
|
|
@@ -105,6 +105,18 @@ export interface TypeIndexLogic {
|
|
|
105
105
|
registerInTypeIndex: (instance: NamedNode, index: NamedNode, theClass: NamedNode) => Promise<NamedNode | null>,
|
|
106
106
|
deleteTypeIndexRegistration: (item: any) => Promise<void>
|
|
107
107
|
getScopedAppsFromIndex: (scope: TypeIndexScope, theClass: NamedNode | null) => Promise<ScopedApp[]>
|
|
108
|
+
}
|
|
108
109
|
|
|
110
|
+
export interface SolidLogic {
|
|
111
|
+
store: LiveStore,
|
|
112
|
+
authn: AuthnLogic,
|
|
113
|
+
acl: AclLogic,
|
|
114
|
+
profile: ProfileLogic,
|
|
115
|
+
inbox: InboxLogic,
|
|
116
|
+
typeIndex: TypeIndexLogic,
|
|
117
|
+
chat: ChatLogic,
|
|
118
|
+
load: (doc: NamedNode | NamedNode[] | string) => void,
|
|
119
|
+
updatePromise: (del: Array<Statement>, ins: Array<Statement>) => Promise<void>,
|
|
120
|
+
clearStore: () => void
|
|
109
121
|
}
|
|
110
122
|
|