solid-logic 1.3.17-ec29db42 → 1.3.17-f02a2f1a
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/acl/aclLogic.d.ts +3 -30
- package/lib/acl/aclLogic.d.ts.map +1 -1
- package/lib/acl/aclLogic.js +152 -119
- package/lib/acl/aclLogic.js.map +1 -1
- package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
- package/lib/authn/SolidAuthnLogic.js +2 -2
- package/lib/authn/SolidAuthnLogic.js.map +1 -1
- package/lib/chat/chatLogic.d.ts +3 -0
- package/lib/chat/chatLogic.d.ts.map +1 -0
- package/lib/chat/{ChatLogic.js → chatLogic.js} +82 -86
- package/lib/chat/chatLogic.js.map +1 -0
- package/lib/inbox/inboxLogic.d.ts +3 -0
- package/lib/inbox/inboxLogic.d.ts.map +1 -0
- package/lib/inbox/{InboxLogic.js → inboxLogic.js} +58 -64
- package/lib/inbox/inboxLogic.js.map +1 -0
- package/lib/index.d.ts +6 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -25
- package/lib/index.js.map +1 -1
- package/lib/logic/CustomError.d.ts +4 -0
- package/lib/logic/CustomError.d.ts.map +1 -1
- package/lib/logic/CustomError.js +17 -1
- package/lib/logic/CustomError.js.map +1 -1
- package/lib/logic/SolidLogic.d.ts +4 -46
- package/lib/logic/SolidLogic.d.ts.map +1 -1
- package/lib/logic/SolidLogic.js +44 -273
- 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 +2 -2
- package/lib/logic/solidLogicSingleton.js.map +1 -1
- package/lib/profile/profileLogic.d.ts +3 -0
- package/lib/profile/profileLogic.d.ts.map +1 -0
- package/lib/profile/profileLogic.js +246 -0
- package/lib/profile/profileLogic.js.map +1 -0
- package/lib/typeIndex/typeIndexLogic.d.ts +2 -21
- package/lib/typeIndex/typeIndexLogic.d.ts.map +1 -1
- package/lib/typeIndex/typeIndexLogic.js +304 -296
- package/lib/typeIndex/typeIndexLogic.js.map +1 -1
- package/lib/types.d.ts +82 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/util/containerLogic.d.ts +11 -0
- package/lib/util/containerLogic.d.ts.map +1 -0
- package/lib/{profile/ProfileLogic.js → util/containerLogic.js} +53 -44
- package/lib/util/containerLogic.js.map +1 -0
- package/lib/util/ns.d.ts +2 -0
- package/lib/util/ns.d.ts.map +1 -0
- package/lib/util/ns.js +34 -0
- package/lib/util/ns.js.map +1 -0
- package/lib/util/utilityLogic.d.ts +15 -0
- package/lib/util/utilityLogic.d.ts.map +1 -0
- package/lib/util/utilityLogic.js +272 -0
- package/lib/util/utilityLogic.js.map +1 -0
- package/lib/util/utils.d.ts +8 -0
- package/lib/util/utils.d.ts.map +1 -0
- package/lib/util/utils.js +48 -0
- package/lib/util/utils.js.map +1 -0
- package/package.json +3 -1
- package/src/acl/aclLogic.ts +137 -118
- package/src/authn/SolidAuthnLogic.ts +3 -2
- package/src/chat/chatLogic.ts +225 -0
- package/src/inbox/inboxLogic.ts +58 -0
- package/src/index.ts +11 -30
- package/src/logic/CustomError.ts +5 -1
- package/src/logic/SolidLogic.ts +42 -229
- package/src/logic/solidLogicSingleton.ts +3 -3
- package/src/profile/profileLogic.ts +126 -0
- package/src/typeIndex/typeIndexLogic.ts +175 -182
- package/src/types.ts +83 -4
- package/src/util/containerLogic.ts +54 -0
- package/src/util/ns.ts +5 -0
- package/src/util/utilityLogic.ts +155 -0
- package/src/util/utils.ts +52 -0
- package/test/aclLogic.test.ts +13 -4
- package/test/chatLogic.test.ts +70 -71
- package/test/container.test.ts +56 -0
- package/test/helpers/dataSetup.ts +134 -0
- package/test/helpers/setup.ts +4 -0
- package/test/inboxLogic.test.ts +39 -38
- package/test/logic.test.ts +10 -9
- package/test/profileLogic.test.ts +246 -0
- package/test/typeIndexLogic.test.ts +487 -30
- package/test/utilityLogic.test.ts +172 -126
- package/test/utils.test.ts +32 -0
- package/lib/chat/ChatLogic.d.ts +0 -26
- package/lib/chat/ChatLogic.d.ts.map +0 -1
- package/lib/chat/ChatLogic.js.map +0 -1
- package/lib/chat/determineChatContainer.d.ts +0 -3
- package/lib/chat/determineChatContainer.d.ts.map +0 -1
- package/lib/chat/determineChatContainer.js +0 -12
- package/lib/chat/determineChatContainer.js.map +0 -1
- package/lib/discovery/discoveryLogic.d.ts +0 -37
- package/lib/discovery/discoveryLogic.d.ts.map +0 -1
- package/lib/discovery/discoveryLogic.js +0 -507
- package/lib/discovery/discoveryLogic.js.map +0 -1
- package/lib/inbox/InboxLogic.d.ts +0 -18
- package/lib/inbox/InboxLogic.d.ts.map +0 -1
- package/lib/inbox/InboxLogic.js.map +0 -1
- package/lib/profile/ProfileLogic.d.ts +0 -13
- package/lib/profile/ProfileLogic.d.ts.map +0 -1
- package/lib/profile/ProfileLogic.js.map +0 -1
- package/lib/util/UtilityLogic.d.ts +0 -33
- package/lib/util/UtilityLogic.d.ts.map +0 -1
- package/lib/util/UtilityLogic.js +0 -240
- package/lib/util/UtilityLogic.js.map +0 -1
- package/lib/util/uri.d.ts +0 -3
- package/lib/util/uri.d.ts.map +0 -1
- package/lib/util/uri.js +0 -9
- package/lib/util/uri.js.map +0 -1
- package/src/chat/ChatLogic.ts +0 -244
- package/src/chat/determineChatContainer.ts +0 -14
- package/src/discovery/discoveryLogic.ts +0 -288
- package/src/inbox/InboxLogic.ts +0 -66
- package/src/profile/ProfileLogic.ts +0 -44
- package/src/util/UtilityLogic.ts +0 -161
- package/src/util/uri.ts +0 -5
- package/test/discoveryLogic.test.ts +0 -712
package/lib/logic/CustomError.js
CHANGED
|
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = void 0;
|
|
18
|
+
exports.FetchError = exports.WebOperationError = exports.NotEditableError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = void 0;
|
|
19
19
|
var CustomError = /** @class */ (function (_super) {
|
|
20
20
|
__extends(CustomError, _super);
|
|
21
21
|
function CustomError(message) {
|
|
@@ -60,6 +60,22 @@ var NotFoundError = /** @class */ (function (_super) {
|
|
|
60
60
|
return NotFoundError;
|
|
61
61
|
}(CustomError));
|
|
62
62
|
exports.NotFoundError = NotFoundError;
|
|
63
|
+
var NotEditableError = /** @class */ (function (_super) {
|
|
64
|
+
__extends(NotEditableError, _super);
|
|
65
|
+
function NotEditableError() {
|
|
66
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
67
|
+
}
|
|
68
|
+
return NotEditableError;
|
|
69
|
+
}(CustomError));
|
|
70
|
+
exports.NotEditableError = NotEditableError;
|
|
71
|
+
var WebOperationError = /** @class */ (function (_super) {
|
|
72
|
+
__extends(WebOperationError, _super);
|
|
73
|
+
function WebOperationError() {
|
|
74
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
75
|
+
}
|
|
76
|
+
return WebOperationError;
|
|
77
|
+
}(CustomError));
|
|
78
|
+
exports.WebOperationError = WebOperationError;
|
|
63
79
|
var FetchError = /** @class */ (function (_super) {
|
|
64
80
|
__extends(FetchError, _super);
|
|
65
81
|
function FetchError(status, message) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomError.js","sourceRoot":"","sources":["../../src/logic/CustomError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;IAA0B,+BAAK;IAC3B,qBAAY,OAAgB;;QAA5B,YACI,kBAAM,OAAO,CAAC,SAIjB;QAHG,0EAA0E;QAC1E,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,WAAW,SAAS,CAAC,CAAC,CAAC,0BAA0B;QAC7E,KAA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,CAAC,AAArD,CAAuC,WAAW,GAAG;AAAxC,8CAAiB;AAE9B;IAA+C,6CAAW;IAA1D;;IAA4D,CAAC;IAAD,gCAAC;AAAD,CAAC,AAA7D,CAA+C,WAAW,GAAG;AAAhD,8DAAyB;AAEtC;IAA8C,4CAAW;IAAzD;;IAA2D,CAAC;IAAD,+BAAC;AAAD,CAAC,AAA5D,CAA8C,WAAW,GAAG;AAA/C,4DAAwB;AAErC;IAAmC,iCAAW;IAA9C;;IAAgD,CAAC;IAAD,oBAAC;AAAD,CAAC,AAAjD,CAAmC,WAAW,GAAG;AAApC,sCAAa;AAE1B;IAAsC,oCAAW;IAAjD;;IAAoD,CAAC;IAAD,uBAAC;AAAD,CAAC,AAArD,CAAsC,WAAW,GAAI;AAAxC,4CAAgB;AAE7B;IAAuC,qCAAW;IAAlD;;IAAoD,CAAC;IAAD,wBAAC;AAAD,CAAC,AAArD,CAAuC,WAAW,GAAG;AAAxC,8CAAiB;AAE9B;IAAgC,8BAAW;IAGvC,oBAAY,MAAc,EAAE,OAAgB;QAA5C,YACI,kBAAM,OAAO,CAAC,SAEjB;QADG,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IACL,iBAAC;AAAD,CAAC,AAPD,CAAgC,WAAW,GAO1C;AAPY,gCAAU"}
|
|
@@ -1,48 +1,6 @@
|
|
|
1
1
|
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { AuthnLogic } from "../types";
|
|
7
|
-
import { UtilityLogic } from "../util/UtilityLogic";
|
|
8
|
-
export declare class SolidLogic {
|
|
9
|
-
cache: {
|
|
10
|
-
profileDocument: {
|
|
11
|
-
[WebID: string]: NamedNode;
|
|
12
|
-
};
|
|
13
|
-
preferencesFile: {
|
|
14
|
-
[WebID: string]: NamedNode;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
store: LiveStore;
|
|
18
|
-
me: string | undefined;
|
|
19
|
-
underlyingFetch: {
|
|
20
|
-
fetch: (url: string, options?: any) => any;
|
|
21
|
-
};
|
|
22
|
-
chat: ChatLogic;
|
|
23
|
-
profile: ProfileLogic;
|
|
24
|
-
authn: AuthnLogic;
|
|
25
|
-
util: UtilityLogic;
|
|
26
|
-
constructor(specialFetch: {
|
|
27
|
-
fetch: (url: any, requestInit: any) => any;
|
|
28
|
-
}, session: Session);
|
|
29
|
-
findAclDocUrl(url: string): Promise<string>;
|
|
30
|
-
loadProfile(me: NamedNode): Promise<NamedNode>;
|
|
31
|
-
loadPreferences(me: NamedNode): Promise<NamedNode>;
|
|
32
|
-
getTypeIndex(me: NamedNode | string, preferencesFile: NamedNode | string, isPublic: boolean): NamedNode[];
|
|
33
|
-
getRegistrations(instance: any, theClass: any): rdf.Node[];
|
|
34
|
-
load(doc: NamedNode | NamedNode[] | string): Promise<Response> | Promise<Response[]>;
|
|
35
|
-
loadIndexes(me: NamedNode | string, publicProfile: NamedNode | string | null, preferencesFile: NamedNode | string | null, onWarning?: (_err: Error) => Promise<undefined>): Promise<{
|
|
36
|
-
private: any;
|
|
37
|
-
public: any;
|
|
38
|
-
}>;
|
|
39
|
-
createEmptyRdfDoc(doc: NamedNode, comment: string): Promise<void>;
|
|
40
|
-
updatePromise(del: Array<Statement>, ins?: Array<Statement>): Promise<void>;
|
|
41
|
-
isContainer(url: string): boolean;
|
|
42
|
-
getContainerElements(containerNode: NamedNode): NamedNode[];
|
|
43
|
-
getContainerMembers(containerUrl: string): Promise<string[]>;
|
|
44
|
-
recursiveDelete(url: string): Promise<any>;
|
|
45
|
-
clearStore(): void;
|
|
46
|
-
fetch(url: string, options?: any): Promise<any>;
|
|
47
|
-
}
|
|
2
|
+
import { SolidLogic } from "../types";
|
|
3
|
+
export declare function createSolidLogic(specialFetch: {
|
|
4
|
+
fetch: (url: any, requestInit: any) => any;
|
|
5
|
+
}, session: Session): SolidLogic;
|
|
48
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
|
@@ -22,264 +22,47 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
-
};
|
|
64
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.
|
|
26
|
+
exports.createSolidLogic = void 0;
|
|
66
27
|
var rdf = __importStar(require("rdflib"));
|
|
67
|
-
var
|
|
28
|
+
var aclLogic_1 = require("../acl/aclLogic");
|
|
68
29
|
var SolidAuthnLogic_1 = require("../authn/SolidAuthnLogic");
|
|
69
|
-
var
|
|
70
|
-
var
|
|
30
|
+
var chatLogic_1 = require("../chat/chatLogic");
|
|
31
|
+
var inboxLogic_1 = require("../inbox/inboxLogic");
|
|
32
|
+
var profileLogic_1 = require("../profile/profileLogic");
|
|
33
|
+
var typeIndexLogic_1 = require("../typeIndex/typeIndexLogic");
|
|
34
|
+
var containerLogic_1 = require("../util/containerLogic");
|
|
35
|
+
var utilityLogic_1 = require("../util/utilityLogic");
|
|
71
36
|
var debug = __importStar(require("../util/debug"));
|
|
72
|
-
var UtilityLogic_1 = require("../util/UtilityLogic");
|
|
73
|
-
var CustomError_1 = require("./CustomError");
|
|
74
37
|
/*
|
|
75
38
|
** It is important to distinquish `fetch`, a function provided by the browser
|
|
76
39
|
** and `Fetcher`, a helper object for the rdflib Store which turns it
|
|
77
40
|
** into a `ConnectedStore` or a `LiveStore`. A Fetcher object is
|
|
78
41
|
** available at store.fetcher, and `fetch` function at `store.fetcher._fetch`,
|
|
79
42
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
debug.log('SolidAuthnLogic initialized');
|
|
98
|
-
this.profile = new ProfileLogic_1.ProfileLogic(this.store, ns, this.authn);
|
|
99
|
-
this.chat = new ChatLogic_1.ChatLogic(this.store, ns, this.profile);
|
|
100
|
-
this.util = new UtilityLogic_1.UtilityLogic(this.store, ns, this.underlyingFetch);
|
|
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);
|
|
101
60
|
}
|
|
102
|
-
SolidLogic.prototype.findAclDocUrl = function (url) {
|
|
103
|
-
return this.util.findAclDocUrl(url);
|
|
104
|
-
};
|
|
105
|
-
SolidLogic.prototype.loadProfile = function (me) {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
-
var profileDocument, err_1, message;
|
|
108
|
-
return __generator(this, function (_a) {
|
|
109
|
-
switch (_a.label) {
|
|
110
|
-
case 0:
|
|
111
|
-
/*
|
|
112
|
-
// console.log('loadProfile cache ', this.cache)
|
|
113
|
-
if (this.cache.profileDocument[me.value]) {
|
|
114
|
-
return this.cache.profileDocument[me.value];
|
|
115
|
-
} @@ just use the cache in the store
|
|
116
|
-
*/
|
|
117
|
-
console.log('loadProfile me ', me);
|
|
118
|
-
profileDocument = me.doc();
|
|
119
|
-
_a.label = 1;
|
|
120
|
-
case 1:
|
|
121
|
-
_a.trys.push([1, 3, , 4]);
|
|
122
|
-
return [4 /*yield*/, this.store.fetcher.load(profileDocument)];
|
|
123
|
-
case 2:
|
|
124
|
-
_a.sent();
|
|
125
|
-
return [2 /*return*/, profileDocument];
|
|
126
|
-
case 3:
|
|
127
|
-
err_1 = _a.sent();
|
|
128
|
-
message = "Cannot load profile ".concat(profileDocument, " : ").concat(err_1);
|
|
129
|
-
throw new Error(message);
|
|
130
|
-
case 4: return [2 /*return*/];
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
SolidLogic.prototype.loadPreferences = function (me) {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
// console.log('this.store.any()', this.store.any())
|
|
138
|
-
/**
|
|
139
|
-
* Are we working cross-origin?
|
|
140
|
-
* Returns True if we are in a webapp at an origin, and the file origin is different
|
|
141
|
-
*/
|
|
142
|
-
function differentOrigin() {
|
|
143
|
-
if (!preferencesFile) {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
return ("".concat(window.location.origin, "/") !== new URL(preferencesFile.value).origin);
|
|
147
|
-
}
|
|
148
|
-
var preferencesFile, err_2, status_1;
|
|
149
|
-
return __generator(this, function (_a) {
|
|
150
|
-
switch (_a.label) {
|
|
151
|
-
case 0:
|
|
152
|
-
console.log('loadPreferences cache ', this.cache);
|
|
153
|
-
if (this.cache.preferencesFile[me.value]) {
|
|
154
|
-
return [2 /*return*/, this.cache.preferencesFile[me.value]];
|
|
155
|
-
}
|
|
156
|
-
return [4 /*yield*/, this.loadProfile(me)]; // Load pointer to pref file
|
|
157
|
-
case 1:
|
|
158
|
-
_a.sent(); // Load pointer to pref file
|
|
159
|
-
preferencesFile = this.store.any(me, ns.space('preferencesFile'), null, me.doc());
|
|
160
|
-
if (!preferencesFile) {
|
|
161
|
-
throw new Error("Can't find a preference file pointer in profile ".concat(me.doc()));
|
|
162
|
-
}
|
|
163
|
-
_a.label = 2;
|
|
164
|
-
case 2:
|
|
165
|
-
_a.trys.push([2, 4, , 5]);
|
|
166
|
-
return [4 /*yield*/, this.store.fetcher.load(preferencesFile, {
|
|
167
|
-
withCredentials: true,
|
|
168
|
-
})];
|
|
169
|
-
case 3:
|
|
170
|
-
_a.sent();
|
|
171
|
-
return [3 /*break*/, 5];
|
|
172
|
-
case 4:
|
|
173
|
-
err_2 = _a.sent();
|
|
174
|
-
status_1 = err_2.status;
|
|
175
|
-
debug.log("HTTP status ".concat(status_1, " for preference file ").concat(preferencesFile));
|
|
176
|
-
if (status_1 === 401) {
|
|
177
|
-
throw new CustomError_1.UnauthorizedError();
|
|
178
|
-
}
|
|
179
|
-
if (status_1 === 403) {
|
|
180
|
-
if (differentOrigin()) {
|
|
181
|
-
throw new CustomError_1.CrossOriginForbiddenError();
|
|
182
|
-
}
|
|
183
|
-
throw new CustomError_1.SameOriginForbiddenError();
|
|
184
|
-
}
|
|
185
|
-
if (status_1 === 404) {
|
|
186
|
-
throw new CustomError_1.NotFoundError(preferencesFile.value);
|
|
187
|
-
}
|
|
188
|
-
throw new CustomError_1.FetchError(err_2.status, err_2.message);
|
|
189
|
-
case 5: return [2 /*return*/, preferencesFile];
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
SolidLogic.prototype.getTypeIndex = function (me, preferencesFile, isPublic) {
|
|
195
|
-
// console.log('getTypeIndex', this.store.each(me, undefined, undefined, preferencesFile), isPublic, preferencesFile)
|
|
196
|
-
return this.store.each(me, isPublic ? ns.solid("publicTypeIndex") : ns.solid("privateTypeIndex"), undefined, preferencesFile);
|
|
197
|
-
};
|
|
198
|
-
SolidLogic.prototype.getRegistrations = function (instance, theClass) {
|
|
199
|
-
var _this = this;
|
|
200
|
-
return this.store
|
|
201
|
-
.each(undefined, ns.solid("instance"), instance)
|
|
202
|
-
.filter(function (r) {
|
|
203
|
-
return _this.store.holds(r, ns.solid("forClass"), theClass);
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
SolidLogic.prototype.load = function (doc) {
|
|
207
|
-
return this.store.fetcher.load(doc);
|
|
208
|
-
};
|
|
209
|
-
SolidLogic.prototype.loadIndexes = function (me, publicProfile, preferencesFile, onWarning) {
|
|
210
|
-
var _this = this;
|
|
211
|
-
if (onWarning === void 0) { onWarning = function (_err) { return __awaiter(_this, void 0, void 0, function () {
|
|
212
|
-
return __generator(this, function (_a) {
|
|
213
|
-
return [2 /*return*/, undefined];
|
|
214
|
-
});
|
|
215
|
-
}); }; }
|
|
216
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
217
|
-
var privateIndexes, publicIndexes, err_3, err_4;
|
|
218
|
-
return __generator(this, function (_a) {
|
|
219
|
-
switch (_a.label) {
|
|
220
|
-
case 0:
|
|
221
|
-
privateIndexes = [];
|
|
222
|
-
publicIndexes = [];
|
|
223
|
-
if (!publicProfile) return [3 /*break*/, 4];
|
|
224
|
-
publicIndexes = this.getTypeIndex(me, publicProfile, true);
|
|
225
|
-
_a.label = 1;
|
|
226
|
-
case 1:
|
|
227
|
-
_a.trys.push([1, 3, , 4]);
|
|
228
|
-
return [4 /*yield*/, this.load(publicIndexes)];
|
|
229
|
-
case 2:
|
|
230
|
-
_a.sent();
|
|
231
|
-
return [3 /*break*/, 4];
|
|
232
|
-
case 3:
|
|
233
|
-
err_3 = _a.sent();
|
|
234
|
-
onWarning(new Error("loadIndex: loading public type index(es) ".concat(err_3)));
|
|
235
|
-
return [3 /*break*/, 4];
|
|
236
|
-
case 4:
|
|
237
|
-
if (!preferencesFile) return [3 /*break*/, 9];
|
|
238
|
-
privateIndexes = this.getTypeIndex(me, preferencesFile, false);
|
|
239
|
-
if (!(privateIndexes.length === 0)) return [3 /*break*/, 6];
|
|
240
|
-
return [4 /*yield*/, onWarning(new Error("Your preference file ".concat(preferencesFile, " does not point to a private type index.")))];
|
|
241
|
-
case 5:
|
|
242
|
-
_a.sent();
|
|
243
|
-
return [3 /*break*/, 9];
|
|
244
|
-
case 6:
|
|
245
|
-
_a.trys.push([6, 8, , 9]);
|
|
246
|
-
return [4 /*yield*/, this.load(privateIndexes)];
|
|
247
|
-
case 7:
|
|
248
|
-
_a.sent();
|
|
249
|
-
return [3 /*break*/, 9];
|
|
250
|
-
case 8:
|
|
251
|
-
err_4 = _a.sent();
|
|
252
|
-
onWarning(new Error("loadIndex: loading private type index(es) ".concat(err_4)));
|
|
253
|
-
return [3 /*break*/, 9];
|
|
254
|
-
case 9: return [2 /*return*/, {
|
|
255
|
-
private: privateIndexes,
|
|
256
|
-
public: publicIndexes,
|
|
257
|
-
}];
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
};
|
|
262
|
-
SolidLogic.prototype.createEmptyRdfDoc = function (doc, comment) {
|
|
263
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
264
|
-
return __generator(this, function (_a) {
|
|
265
|
-
switch (_a.label) {
|
|
266
|
-
case 0: return [4 /*yield*/, this.store.fetcher.webOperation("PUT", doc.uri, {
|
|
267
|
-
data: "# ".concat(new Date(), " ").concat(comment, "\n "),
|
|
268
|
-
contentType: "text/turtle",
|
|
269
|
-
})];
|
|
270
|
-
case 1:
|
|
271
|
-
_a.sent();
|
|
272
|
-
return [2 /*return*/];
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
61
|
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
278
|
-
|
|
279
|
-
var _this = this;
|
|
62
|
+
function updatePromise(del, ins) {
|
|
280
63
|
if (ins === void 0) { ins = []; }
|
|
281
64
|
return new Promise(function (resolve, reject) {
|
|
282
|
-
|
|
65
|
+
store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
283
66
|
if (!ok) {
|
|
284
67
|
reject(new Error(errorBody));
|
|
285
68
|
}
|
|
@@ -288,34 +71,22 @@ var SolidLogic = /** @class */ (function () {
|
|
|
288
71
|
}
|
|
289
72
|
}); // callback
|
|
290
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
|
|
291
89
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
};
|
|
295
|
-
SolidLogic.prototype.getContainerElements = function (containerNode) {
|
|
296
|
-
return this.util.getContainerElements(containerNode);
|
|
297
|
-
};
|
|
298
|
-
SolidLogic.prototype.getContainerMembers = function (containerUrl) {
|
|
299
|
-
return this.util.getContainerMembers(containerUrl);
|
|
300
|
-
};
|
|
301
|
-
SolidLogic.prototype.recursiveDelete = function (url) {
|
|
302
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
303
|
-
return __generator(this, function (_a) {
|
|
304
|
-
return [2 /*return*/, this.util.recursiveDelete(url)];
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
};
|
|
308
|
-
SolidLogic.prototype.clearStore = function () {
|
|
309
|
-
return this.util.clearStore();
|
|
310
|
-
};
|
|
311
|
-
SolidLogic.prototype.fetch = function (url, options) {
|
|
312
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
313
|
-
return __generator(this, function (_a) {
|
|
314
|
-
return [2 /*return*/, this.underlyingFetch.fetch(url, options)];
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
|
-
return SolidLogic;
|
|
319
|
-
}());
|
|
320
|
-
exports.SolidLogic = SolidLogic;
|
|
90
|
+
}
|
|
91
|
+
exports.createSolidLogic = createSolidLogic;
|
|
321
92
|
//# sourceMappingURL=SolidLogic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidLogic.js","sourceRoot":"","sources":["../../src/logic/SolidLogic.ts"],"names":[],"mappings":"
|
|
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,mDAAuC;AACvC;;;;;EAKE;AACF,SAAgB,gBAAgB,CAAC,YAA4D,EAAE,OAAgB;IAE3G,KAAK,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAA;IACrF,IAAM,KAAK,GAAc,GAAG,CAAC,KAAK,EAAe,CAAA;IACjD,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAC,KAAK,EAAE,YAAY,CAAC,KAAK,EAAC,CAAC,CAAC,CAAC,yCAAyC;IAC1F,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,2CAA2C;IACzF,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAA,CAAC,+CAA+C;IAEnE,IAAM,KAAK,GAAe,IAAI,iCAAe,CAAC,OAAO,CAAC,CAAA;IAEtD,IAAM,GAAG,GAAG,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAA;IACjC,IAAM,cAAc,GAAG,IAAA,qCAAoB,EAAC,KAAK,CAAC,CAAA;IAClD,IAAM,YAAY,GAAG,IAAA,iCAAkB,EAAC,KAAK,EAAE,GAAG,EAAE,cAAc,CAAC,CAAA;IACnE,IAAM,OAAO,GAAG,IAAA,iCAAkB,EAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;IAC9D,IAAM,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CAAA;AACL,CAAC;AAvDD,4CAuDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.d.ts","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.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"}
|
|
@@ -68,7 +68,7 @@ var _fetch = function (url, requestInit) { return __awaiter(void 0, void 0, void
|
|
|
68
68
|
return __generator(this, function (_a) {
|
|
69
69
|
omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
|
|
70
70
|
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
|
|
71
|
-
// In fact
|
|
71
|
+
// In fact fetch should respect credentials omit itself
|
|
72
72
|
return [2 /*return*/, authSession_1.authSession.fetch(url, requestInit)];
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
@@ -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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileLogic.d.ts","sourceRoot":"","sources":["../../src/profile/profileLogic.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,wBAAgB,kBAAkB,CAAC,KAAK,KAAA,EAAE,KAAK,KAAA,EAAE,YAAY,KAAA,GAAG,YAAY,CAqH3E"}
|