solid-logic 1.3.12 → 1.3.13
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/chat/ChatLogic.d.ts +2 -2
- package/lib/chat/ChatLogic.d.ts.map +1 -1
- package/lib/chat/ChatLogic.js +37 -32
- package/lib/chat/ChatLogic.js.map +1 -1
- package/lib/inbox/InboxLogic.d.ts +2 -2
- package/lib/inbox/InboxLogic.d.ts.map +1 -1
- package/lib/inbox/InboxLogic.js +14 -13
- package/lib/inbox/InboxLogic.js.map +1 -1
- package/lib/index.d.ts +2 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/profile/ProfileLogic.d.ts +2 -2
- package/lib/profile/ProfileLogic.d.ts.map +1 -1
- package/lib/profile/ProfileLogic.js +10 -8
- package/lib/profile/ProfileLogic.js.map +1 -1
- package/lib/util/UtilityLogic.d.ts +2 -2
- package/lib/util/UtilityLogic.d.ts.map +1 -1
- package/lib/util/UtilityLogic.js +10 -8
- package/lib/util/UtilityLogic.js.map +1 -1
- package/package.json +2 -2
- package/src/chat/ChatLogic.ts +12 -12
- package/src/inbox/InboxLogic.ts +3 -3
- package/src/index.ts +3 -2
- package/src/profile/ProfileLogic.ts +4 -4
- package/src/util/UtilityLogic.ts +4 -4
- package/lib/index-alain.d.ts +0 -75
- package/lib/index-alain.d.ts.map +0 -1
- package/lib/index-alain.js +0 -398
- package/lib/index-alain.js.map +0 -1
- package/lib/util/UtilityLogic-alain.d.ts +0 -32
- package/lib/util/UtilityLogic-alain.d.ts.map +0 -1
- package/lib/util/UtilityLogic-alain.js +0 -248
- package/lib/util/UtilityLogic-alain.js.map +0 -1
- package/src/index-alain.txt +0 -316
- package/src/util/UtilityLogic-alain.txt +0 -181
package/lib/index-alain.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-alain.js","sourceRoot":"","sources":["../src/index-alain.ts"],"names":[],"mappings":";;;;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AAC,KAAI,EAAE,WAAW,SAAS,CAAC,CAAC,CAAC,0BAA0B;QAC7E,KAAI,CAAC,IAAI,GAAG,WAAW,IAAI,CAAC,CAAC,qCAAqC;;IACpE,CAAC;IACH,kBAAC;AAAD,CAAC,AAPD,CAA0B,KAAK,GAO9B;AAED;IAAuC,qCAAW;IAAlD;;IAAoD,CAAC;IAAD,wBAAC;AAAD,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;IAAgC,8BAAW;IAGzC,oBAAY,MAAc,EAAE,OAAgB;QAA5C,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACvB,CAAC;IACH,iBAAC;AAAD,CAAC,AAPD,CAAgC,WAAW,GAO1C;AAPY,gCAAU"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { NamedNode } from "rdflib";
|
|
2
|
-
import { LiveStore, SolidNamespace } from "../index";
|
|
3
|
-
export declare const ACL_LINK: NamedNode;
|
|
4
|
-
/**
|
|
5
|
-
* Utility-related logic
|
|
6
|
-
*/
|
|
7
|
-
export declare class UtilityLogic {
|
|
8
|
-
store: LiveStore;
|
|
9
|
-
ns: SolidNamespace;
|
|
10
|
-
fetcher: any;
|
|
11
|
-
_fetch: Function;
|
|
12
|
-
constructor(store: LiveStore, ns: SolidNamespace, fetcher: {
|
|
13
|
-
fetch: (url: string, options?: any) => any;
|
|
14
|
-
});
|
|
15
|
-
findAclDocUrl(url: string): Promise<string>;
|
|
16
|
-
setSinglePeerAccess(options: {
|
|
17
|
-
ownerWebId: string;
|
|
18
|
-
peerWebId: string;
|
|
19
|
-
accessToModes?: string;
|
|
20
|
-
defaultModes?: string;
|
|
21
|
-
target: string;
|
|
22
|
-
}): Promise<any>;
|
|
23
|
-
loadDoc(doc: NamedNode): Promise<void>;
|
|
24
|
-
isContainer(url: string): boolean;
|
|
25
|
-
createContainer(url: string): Promise<void>;
|
|
26
|
-
getContainerElements(containerNode: NamedNode): NamedNode[];
|
|
27
|
-
getContainerMembers(containerUrl: string): Promise<string[]>;
|
|
28
|
-
recursiveDelete(url: string): Promise<any>;
|
|
29
|
-
clearStore(): void;
|
|
30
|
-
getArchiveUrl(baseUrl: string, date: Date): string;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=UtilityLogic-alain.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityLogic-alain.d.ts","sourceRoot":"","sources":["../../src/util/UtilityLogic-alain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkC,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAKrD,eAAO,MAAM,QAAQ,WAEpB,CAAC;AAYF;;GAEG;AACH,qBAAa,YAAY;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,EAAE,cAAc,CAAC;IACnB,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC;gBAEL,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,CAAA;KAAE;IAYnG,aAAa,CAAC,GAAG,EAAE,MAAM;IAWzB,mBAAmB,CAAC,OAAO,EAAE;QACjC,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAA;KACf;IAsCK,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C,WAAW,CAAC,GAAG,EAAE,MAAM;IAIjB,eAAe,CAAC,GAAG,EAAE,MAAM;IAmBjC,oBAAoB,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,EAAE;IAWrD,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAO5D,eAAe,CAAC,GAAG,EAAE,MAAM;IAgBjC,UAAU;IAIV,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;CAQ1C"}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.UtilityLogic = exports.ACL_LINK = void 0;
|
|
43
|
-
var rdflib_1 = require("rdflib");
|
|
44
|
-
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
45
|
-
exports.ACL_LINK = (0, rdflib_1.sym)("http://www.iana.org/assignments/link-relations/acl");
|
|
46
|
-
/**
|
|
47
|
-
* Utility-related logic
|
|
48
|
-
*/
|
|
49
|
-
var UtilityLogic = /** @class */ (function () {
|
|
50
|
-
function UtilityLogic(store, ns, fetcher) {
|
|
51
|
-
this.store = store;
|
|
52
|
-
this.ns = ns;
|
|
53
|
-
this._fetch = fetcher.fetch
|
|
54
|
-
|| (typeof global !== 'undefined' && global.solidFetch)
|
|
55
|
-
|| (typeof window !== 'undefined' && window.solidFetch)
|
|
56
|
-
|| cross_fetch_1.default;
|
|
57
|
-
if (!this._fetch) {
|
|
58
|
-
throw new Error('No _fetch function available for Fetcher');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
UtilityLogic.prototype.findAclDocUrl = function (url) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var doc, docNode;
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
switch (_a.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
doc = this.store.sym(url);
|
|
68
|
-
return [4 /*yield*/, this.store.fetcher.load(doc)];
|
|
69
|
-
case 1:
|
|
70
|
-
_a.sent();
|
|
71
|
-
docNode = this.store.any(doc, exports.ACL_LINK);
|
|
72
|
-
if (!docNode) {
|
|
73
|
-
throw new Error("No ACL link discovered for ".concat(url));
|
|
74
|
-
}
|
|
75
|
-
return [2 /*return*/, docNode.value];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
// Copied from https://github.com/solid/web-access-control-tests/blob/v3.0.0/test/surface/delete.test.ts#L5
|
|
81
|
-
UtilityLogic.prototype.setSinglePeerAccess = function (options) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
var str, aclDocUrl;
|
|
84
|
-
return __generator(this, function (_a) {
|
|
85
|
-
switch (_a.label) {
|
|
86
|
-
case 0:
|
|
87
|
-
str = [
|
|
88
|
-
'@prefix acl: <http://www.w3.org/ns/auth/acl#>.',
|
|
89
|
-
'',
|
|
90
|
-
"<#alice> a acl:Authorization;\n acl:agent <".concat(options.ownerWebId, ">;"),
|
|
91
|
-
" acl:accessTo <".concat(options.target, ">;"),
|
|
92
|
-
" acl:default <".concat(options.target, ">;"),
|
|
93
|
-
' acl:mode acl:Read, acl:Write, acl:Control.',
|
|
94
|
-
''
|
|
95
|
-
].join('\n');
|
|
96
|
-
if (options.accessToModes) {
|
|
97
|
-
str += [
|
|
98
|
-
'<#bobAccessTo> a acl:Authorization;',
|
|
99
|
-
" acl:agent <".concat(options.peerWebId, ">;"),
|
|
100
|
-
" acl:accessTo <".concat(options.target, ">;"),
|
|
101
|
-
" acl:mode ".concat(options.accessToModes, "."),
|
|
102
|
-
''
|
|
103
|
-
].join('\n');
|
|
104
|
-
}
|
|
105
|
-
if (options.defaultModes) {
|
|
106
|
-
str += [
|
|
107
|
-
'<#bobDefault> a acl:Authorization;',
|
|
108
|
-
" acl:agent <".concat(options.peerWebId, ">;"),
|
|
109
|
-
" acl:default <".concat(options.target, ">;"),
|
|
110
|
-
" acl:mode ".concat(options.defaultModes, "."),
|
|
111
|
-
''
|
|
112
|
-
].join('\n');
|
|
113
|
-
}
|
|
114
|
-
return [4 /*yield*/, this.findAclDocUrl(options.target)];
|
|
115
|
-
case 1:
|
|
116
|
-
aclDocUrl = _a.sent();
|
|
117
|
-
return [2 /*return*/, this._fetch(aclDocUrl, {
|
|
118
|
-
method: 'PUT',
|
|
119
|
-
body: str,
|
|
120
|
-
headers: [
|
|
121
|
-
['Content-Type', 'text/turtle']
|
|
122
|
-
]
|
|
123
|
-
})];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
UtilityLogic.prototype.loadDoc = function (doc) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
-
return __generator(this, function (_a) {
|
|
131
|
-
switch (_a.label) {
|
|
132
|
-
case 0:
|
|
133
|
-
// Load a document into the knowledge base (fetcher.store)
|
|
134
|
-
// withCredentials: Web arch should let us just load by turning off creds helps CORS
|
|
135
|
-
// reload: Gets around a specific old Chrome bug caching/origin/cors
|
|
136
|
-
// console.log('loading', profileDocument)
|
|
137
|
-
if (!this.store.fetcher) {
|
|
138
|
-
throw new Error("Cannot load doc, have no fetcher");
|
|
139
|
-
}
|
|
140
|
-
return [4 /*yield*/, this.store.fetcher.load(doc, {
|
|
141
|
-
withCredentials: false,
|
|
142
|
-
cache: "reload",
|
|
143
|
-
})];
|
|
144
|
-
case 1:
|
|
145
|
-
_a.sent();
|
|
146
|
-
return [2 /*return*/];
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
UtilityLogic.prototype.isContainer = function (url) {
|
|
152
|
-
return url.substr(-1) === "/";
|
|
153
|
-
};
|
|
154
|
-
UtilityLogic.prototype.createContainer = function (url) {
|
|
155
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
-
var result;
|
|
157
|
-
return __generator(this, function (_a) {
|
|
158
|
-
switch (_a.label) {
|
|
159
|
-
case 0:
|
|
160
|
-
if (!this.isContainer(url)) {
|
|
161
|
-
throw new Error("Not a container URL ".concat(url));
|
|
162
|
-
}
|
|
163
|
-
return [4 /*yield*/, this._fetch(url, {
|
|
164
|
-
method: "PUT",
|
|
165
|
-
headers: {
|
|
166
|
-
"Content-Type": "text/turtle",
|
|
167
|
-
"If-None-Match": "*",
|
|
168
|
-
Link: '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"', // See https://github.com/solid/node-solid-server/issues/1465
|
|
169
|
-
},
|
|
170
|
-
body: " ", // work around https://github.com/michielbdejong/community-server/issues/4#issuecomment-776222863
|
|
171
|
-
})];
|
|
172
|
-
case 1:
|
|
173
|
-
result = _a.sent();
|
|
174
|
-
if (result.status.toString()[0] !== '2') {
|
|
175
|
-
throw new Error("Not OK: got ".concat(result.status, " response while creating container at ").concat(url));
|
|
176
|
-
}
|
|
177
|
-
return [2 /*return*/];
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
UtilityLogic.prototype.getContainerElements = function (containerNode) {
|
|
183
|
-
return this.store
|
|
184
|
-
.statementsMatching(containerNode, this.store.sym("http://www.w3.org/ns/ldp#contains"), undefined, containerNode.doc())
|
|
185
|
-
.map(function (st) { return st.object; });
|
|
186
|
-
};
|
|
187
|
-
UtilityLogic.prototype.getContainerMembers = function (containerUrl) {
|
|
188
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
189
|
-
var containerNode, nodes;
|
|
190
|
-
return __generator(this, function (_a) {
|
|
191
|
-
switch (_a.label) {
|
|
192
|
-
case 0:
|
|
193
|
-
containerNode = this.store.sym(containerUrl);
|
|
194
|
-
return [4 /*yield*/, this.store.fetcher.load(containerNode)];
|
|
195
|
-
case 1:
|
|
196
|
-
_a.sent();
|
|
197
|
-
nodes = this.getContainerElements(containerNode);
|
|
198
|
-
return [2 /*return*/, nodes.map(function (node) { return node.value; })];
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
UtilityLogic.prototype.recursiveDelete = function (url) {
|
|
204
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
205
|
-
var aclDocUrl, containerMembers, e_1;
|
|
206
|
-
var _this = this;
|
|
207
|
-
return __generator(this, function (_a) {
|
|
208
|
-
switch (_a.label) {
|
|
209
|
-
case 0:
|
|
210
|
-
_a.trys.push([0, 6, , 7]);
|
|
211
|
-
if (!this.isContainer(url)) return [3 /*break*/, 5];
|
|
212
|
-
return [4 /*yield*/, this.findAclDocUrl(url)];
|
|
213
|
-
case 1:
|
|
214
|
-
aclDocUrl = _a.sent();
|
|
215
|
-
return [4 /*yield*/, this._fetch(aclDocUrl, { method: "DELETE" })];
|
|
216
|
-
case 2:
|
|
217
|
-
_a.sent();
|
|
218
|
-
return [4 /*yield*/, this.getContainerMembers(url)];
|
|
219
|
-
case 3:
|
|
220
|
-
containerMembers = _a.sent();
|
|
221
|
-
return [4 /*yield*/, Promise.all(containerMembers.map(function (url) { return _this.recursiveDelete(url); }))];
|
|
222
|
-
case 4:
|
|
223
|
-
_a.sent();
|
|
224
|
-
_a.label = 5;
|
|
225
|
-
case 5: return [2 /*return*/, this._fetch(url, { method: "DELETE" })];
|
|
226
|
-
case 6:
|
|
227
|
-
e_1 = _a.sent();
|
|
228
|
-
return [3 /*break*/, 7];
|
|
229
|
-
case 7: return [2 /*return*/];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
UtilityLogic.prototype.clearStore = function () {
|
|
235
|
-
this.store.statements.slice().forEach(this.store.remove.bind(this.store));
|
|
236
|
-
};
|
|
237
|
-
UtilityLogic.prototype.getArchiveUrl = function (baseUrl, date) {
|
|
238
|
-
var year = date.getUTCFullYear();
|
|
239
|
-
var month = ('0' + (date.getUTCMonth() + 1)).slice(-2);
|
|
240
|
-
var day = ('0' + (date.getUTCDate())).slice(-2);
|
|
241
|
-
var parts = baseUrl.split('/');
|
|
242
|
-
var filename = parts[parts.length - 1];
|
|
243
|
-
return new URL("./archive/".concat(year, "/").concat(month, "/").concat(day, "/").concat(filename), baseUrl).toString();
|
|
244
|
-
};
|
|
245
|
-
return UtilityLogic;
|
|
246
|
-
}());
|
|
247
|
-
exports.UtilityLogic = UtilityLogic;
|
|
248
|
-
//# sourceMappingURL=UtilityLogic-alain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityLogic-alain.js","sourceRoot":"","sources":["../../src/util/UtilityLogic-alain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmE;AAInE,4DAAqC;AAExB,QAAA,QAAQ,GAAG,IAAA,YAAG,EACzB,oDAAoD,CAC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CAAC,CAAC,CAAC;QACvD,IAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,IAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAE,CAAC,CAAE,CAAC;QACzC,OAAO,IAAI,GAAG,CAAC,oBAAa,IAAI,cAAI,KAAK,cAAI,GAAG,cAAI,QAAQ,CAAE,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IACtF,CAAC;IACH,mBAAC;AAAD,CAAC,AA7JD,IA6JC;AA7JY,oCAAY"}
|
package/src/index-alain.txt
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { Session } from "@inrupt/solid-client-authn-browser";
|
|
2
|
-
import * as rdf from "rdflib";
|
|
3
|
-
import { Fetcher, NamedNode, Statement, Store, UpdateManager } from "rdflib";
|
|
4
|
-
import solidNamespace from "solid-namespace";
|
|
5
|
-
import { AuthnLogic } from "./authn";
|
|
6
|
-
import { NoAuthnLogic } from "./authn/NoAuthnLogic";
|
|
7
|
-
import { SolidAuthnLogic } from "./authn/SolidAuthnLogic";
|
|
8
|
-
import crossFetch from 'cross-fetch';
|
|
9
|
-
|
|
10
|
-
import { ChatLogic } from "./chat/ChatLogic";
|
|
11
|
-
import * as debug from "./debug";
|
|
12
|
-
import { ProfileLogic } from "./profile/ProfileLogic";
|
|
13
|
-
import { UtilityLogic } from "./util/UtilityLogic";
|
|
14
|
-
|
|
15
|
-
export { ACL_LINK } from './util/UtilityLogic';
|
|
16
|
-
|
|
17
|
-
const ns: SolidNamespace = solidNamespace(rdf);
|
|
18
|
-
|
|
19
|
-
interface ConnectedStore extends Store {
|
|
20
|
-
fetcher: Fetcher;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface LiveStore extends ConnectedStore {
|
|
24
|
-
updater: UpdateManager;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface SolidNamespace {
|
|
28
|
-
[key: string]: (term: string) => NamedNode;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class SolidLogic {
|
|
32
|
-
cache: {
|
|
33
|
-
profileDocument: {
|
|
34
|
-
[WebID: string]: NamedNode;
|
|
35
|
-
};
|
|
36
|
-
preferencesFile: {
|
|
37
|
-
[WebID: string]: NamedNode;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
store: LiveStore;
|
|
42
|
-
me: string | undefined;
|
|
43
|
-
fetcher: { fetch: (url: string, options?: any) => any };
|
|
44
|
-
_fetch: Function;
|
|
45
|
-
|
|
46
|
-
chat: ChatLogic;
|
|
47
|
-
profile: ProfileLogic;
|
|
48
|
-
authn: AuthnLogic;
|
|
49
|
-
util: UtilityLogic;
|
|
50
|
-
|
|
51
|
-
constructor(fetcher: { fetch: (url: any, requestInit: any) => any }, solidAuthSession: Session) {
|
|
52
|
-
this.store = rdf.graph() as LiveStore; // Make a Quad store
|
|
53
|
-
rdf.fetcher(this.store, fetcher); // Attach a web I/O module, store.fetcher
|
|
54
|
-
this.store.updater = new rdf.UpdateManager(this.store); // Add real-time live updates store.updater
|
|
55
|
-
this.cache = {
|
|
56
|
-
profileDocument: {},
|
|
57
|
-
preferencesFile: {},
|
|
58
|
-
};
|
|
59
|
-
this.fetcher = fetcher
|
|
60
|
-
/*this._fetch = this.fetcher.fetch
|
|
61
|
-
|| typeof global !== 'undefined' && global.solidFetch
|
|
62
|
-
|| typeof window !== 'undefined' && window.solidFetch
|
|
63
|
-
|| crossFetch
|
|
64
|
-
if (!this._fetch) {
|
|
65
|
-
throw new Error('No _fetch function available for Fetcher')
|
|
66
|
-
} */
|
|
67
|
-
if (solidAuthSession) {
|
|
68
|
-
this.authn = new SolidAuthnLogic(solidAuthSession);
|
|
69
|
-
} else {
|
|
70
|
-
this.authn = new NoAuthnLogic();
|
|
71
|
-
}
|
|
72
|
-
this.profile = new ProfileLogic(this.store, ns, this.authn);
|
|
73
|
-
this.chat = new ChatLogic(this.store, ns, this.profile);
|
|
74
|
-
this.util = new UtilityLogic(this.store, ns, this.fetcher);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
findAclDocUrl(url: string) {
|
|
78
|
-
return this.util.findAclDocUrl(url);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
loadDoc(doc: NamedNode): Promise<void> {
|
|
82
|
-
return this.util.loadDoc(doc);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async loadProfile(me: NamedNode): Promise<NamedNode> {
|
|
86
|
-
// console.log('loadProfile', me)
|
|
87
|
-
if (this.cache.profileDocument[me.value]) {
|
|
88
|
-
return this.cache.profileDocument[me.value];
|
|
89
|
-
}
|
|
90
|
-
let profileDocument;
|
|
91
|
-
try {
|
|
92
|
-
profileDocument = me.doc();
|
|
93
|
-
await this.loadDoc(profileDocument);
|
|
94
|
-
return profileDocument;
|
|
95
|
-
} catch (err) {
|
|
96
|
-
const message = `Logged in but cannot load profile ${profileDocument} : ${err}`;
|
|
97
|
-
throw new Error(message);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async loadPreferences(me: NamedNode): Promise<NamedNode> {
|
|
102
|
-
// console.log('loadPreferences', me)
|
|
103
|
-
if (this.cache.preferencesFile[me.value]) {
|
|
104
|
-
return this.cache.preferencesFile[me.value];
|
|
105
|
-
}
|
|
106
|
-
const preferencesFile = this.store.any(me, ns.space("preferencesFile"));
|
|
107
|
-
|
|
108
|
-
// console.log('this.store.any()', this.store.any())
|
|
109
|
-
/**
|
|
110
|
-
* Are we working cross-origin?
|
|
111
|
-
* Returns True if we are in a webapp at an origin, and the file origin is different
|
|
112
|
-
*/
|
|
113
|
-
function differentOrigin(): boolean {
|
|
114
|
-
if (!preferencesFile) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
return (
|
|
118
|
-
`${window.location.origin}/` !== new URL(preferencesFile.value).origin
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!preferencesFile) {
|
|
123
|
-
throw new Error(
|
|
124
|
-
`Can't find a preference file pointer in profile ${me.doc()}`
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (!this.store.fetcher) {
|
|
129
|
-
throw new Error("Cannot load doc, have no fetcher");
|
|
130
|
-
}
|
|
131
|
-
// //// Load preference file
|
|
132
|
-
try {
|
|
133
|
-
await this.store.fetcher.load(preferencesFile as NamedNode, {
|
|
134
|
-
withCredentials: true,
|
|
135
|
-
});
|
|
136
|
-
} catch (err) {
|
|
137
|
-
// Really important to look at why
|
|
138
|
-
const status = err.status;
|
|
139
|
-
debug.log(`HTTP status ${status} for preference file ${preferencesFile}`);
|
|
140
|
-
if (status === 401) {
|
|
141
|
-
throw new UnauthorizedError();
|
|
142
|
-
}
|
|
143
|
-
if (status === 403) {
|
|
144
|
-
if (differentOrigin()) {
|
|
145
|
-
throw new CrossOriginForbiddenError();
|
|
146
|
-
}
|
|
147
|
-
throw new SameOriginForbiddenError();
|
|
148
|
-
}
|
|
149
|
-
if (status === 404) {
|
|
150
|
-
throw new NotFoundError(preferencesFile.value);
|
|
151
|
-
}
|
|
152
|
-
throw new FetchError(err.status, err.message);
|
|
153
|
-
}
|
|
154
|
-
return preferencesFile as NamedNode;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
getTypeIndex(
|
|
158
|
-
me: NamedNode | string,
|
|
159
|
-
preferencesFile: NamedNode | string,
|
|
160
|
-
isPublic: boolean
|
|
161
|
-
): NamedNode[] {
|
|
162
|
-
// console.log('getTypeIndex', this.store.each(me, undefined, undefined, preferencesFile), isPublic, preferencesFile)
|
|
163
|
-
return this.store.each(
|
|
164
|
-
me as NamedNode,
|
|
165
|
-
isPublic ? ns.solid("publicTypeIndex") : ns.solid("privateTypeIndex"),
|
|
166
|
-
undefined,
|
|
167
|
-
preferencesFile as NamedNode
|
|
168
|
-
) as NamedNode[];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
getRegistrations(instance, theClass) {
|
|
172
|
-
return this.store
|
|
173
|
-
.each(undefined, ns.solid("instance"), instance)
|
|
174
|
-
.filter((r) => {
|
|
175
|
-
return this.store.holds(r, ns.solid("forClass"), theClass);
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
load(doc: NamedNode | NamedNode[] | string) {
|
|
180
|
-
if (!this.store.fetcher) {
|
|
181
|
-
throw new Error("Cannot load doc(s), have no fetcher");
|
|
182
|
-
}
|
|
183
|
-
return this.store.fetcher.load(doc);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
async loadIndexes(
|
|
187
|
-
me: NamedNode | string,
|
|
188
|
-
publicProfile: NamedNode | string | null,
|
|
189
|
-
preferencesFile: NamedNode | string | null,
|
|
190
|
-
onWarning = async (_err: Error) => {
|
|
191
|
-
return undefined;
|
|
192
|
-
}
|
|
193
|
-
): Promise<{
|
|
194
|
-
private: any;
|
|
195
|
-
public: any;
|
|
196
|
-
}> {
|
|
197
|
-
let privateIndexes: any[] = [];
|
|
198
|
-
let publicIndexes: any[] = [];
|
|
199
|
-
if (publicProfile) {
|
|
200
|
-
publicIndexes = this.getTypeIndex(me, publicProfile, true);
|
|
201
|
-
try {
|
|
202
|
-
await this.load(publicIndexes as NamedNode[]);
|
|
203
|
-
} catch (err) {
|
|
204
|
-
onWarning(new Error(`loadIndex: loading public type index(es) ${err}`));
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (preferencesFile) {
|
|
208
|
-
privateIndexes = this.getTypeIndex(me, preferencesFile, false);
|
|
209
|
-
// console.log({ privateIndexes })
|
|
210
|
-
if (privateIndexes.length === 0) {
|
|
211
|
-
await onWarning(
|
|
212
|
-
new Error(
|
|
213
|
-
`Your preference file ${preferencesFile} does not point to a private type index.`
|
|
214
|
-
)
|
|
215
|
-
);
|
|
216
|
-
} else {
|
|
217
|
-
try {
|
|
218
|
-
await this.load(privateIndexes);
|
|
219
|
-
} catch (err) {
|
|
220
|
-
onWarning(
|
|
221
|
-
new Error(`loadIndex: loading private type index(es) ${err}`)
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
// } else {
|
|
226
|
-
// debug.log(
|
|
227
|
-
// 'We know your preference file is not available, so we are not bothering with private type indexes.'
|
|
228
|
-
// )
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return {
|
|
232
|
-
private: privateIndexes,
|
|
233
|
-
public: publicIndexes,
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
async createEmptyRdfDoc(doc: NamedNode, comment: string) {
|
|
238
|
-
if (!this.store.fetcher) {
|
|
239
|
-
throw new Error("Cannot create empty rdf doc, have no fetcher");
|
|
240
|
-
}
|
|
241
|
-
await this.store.fetcher.webOperation("PUT", doc.uri, {
|
|
242
|
-
data: `# ${new Date()} ${comment}
|
|
243
|
-
`,
|
|
244
|
-
contentType: "text/turtle",
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// @@@@ use the one in rdflib.js when it is available and delete this
|
|
249
|
-
updatePromise(
|
|
250
|
-
del: Array<Statement>,
|
|
251
|
-
ins: Array<Statement> = []
|
|
252
|
-
): Promise<void> {
|
|
253
|
-
return new Promise((resolve, reject) => {
|
|
254
|
-
if (!this.store.updater) {
|
|
255
|
-
throw new Error("Cannot updatePromise, have no updater");
|
|
256
|
-
}
|
|
257
|
-
this.store.updater.update(del, ins, function (_uri, ok, errorBody) {
|
|
258
|
-
if (!ok) {
|
|
259
|
-
reject(new Error(errorBody));
|
|
260
|
-
} else {
|
|
261
|
-
resolve();
|
|
262
|
-
}
|
|
263
|
-
}); // callback
|
|
264
|
-
}); // promise
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
isContainer(url: string) {
|
|
268
|
-
return this.util.isContainer(url);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
getContainerElements(containerNode: NamedNode): NamedNode[] {
|
|
272
|
-
return this.util.getContainerElements(containerNode);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
getContainerMembers(containerUrl: string): Promise<string[]> {
|
|
276
|
-
return this.util.getContainerMembers(containerUrl);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
async recursiveDelete(url: string) {
|
|
280
|
-
return this.util.recursiveDelete(url);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
clearStore() {
|
|
284
|
-
return this.util.clearStore();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
async fetch(url: string, options?: any) {
|
|
288
|
-
return this.fetcher.fetch(url, options);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
class CustomError extends Error {
|
|
293
|
-
constructor(message?: string) {
|
|
294
|
-
super(message);
|
|
295
|
-
// see: typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html
|
|
296
|
-
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
|
|
297
|
-
this.name = new.target.name; // stack traces display correctly now
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export class UnauthorizedError extends CustomError {}
|
|
302
|
-
|
|
303
|
-
export class CrossOriginForbiddenError extends CustomError {}
|
|
304
|
-
|
|
305
|
-
export class SameOriginForbiddenError extends CustomError {}
|
|
306
|
-
|
|
307
|
-
export class NotFoundError extends CustomError {}
|
|
308
|
-
|
|
309
|
-
export class FetchError extends CustomError {
|
|
310
|
-
status: number;
|
|
311
|
-
|
|
312
|
-
constructor(status: number, message?: string) {
|
|
313
|
-
super(message);
|
|
314
|
-
this.status = status;
|
|
315
|
-
}
|
|
316
|
-
}
|