solid-logic 1.3.16-8afe9dc4 → 1.3.17-0abe2b84
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/jest.config.js +1 -1
- package/lib/authn/SolidAuthnLogic.js +1 -1
- package/lib/authn/SolidAuthnLogic.js.map +1 -1
- package/lib/authn/authUtil.js +1 -1
- package/lib/authn/authUtil.js.map +1 -1
- package/lib/discovery/discoveryLogic.d.ts +33 -6
- package/lib/discovery/discoveryLogic.d.ts.map +1 -1
- package/lib/discovery/discoveryLogic.js +377 -86
- package/lib/discovery/discoveryLogic.js.map +1 -1
- package/lib/logic/solidLogicSingleton.js +1 -1
- package/lib/logic/solidLogicSingleton.js.map +1 -1
- package/lib/typeIndex/typeIndexLogic.d.ts +2 -2
- package/lib/typeIndex/typeIndexLogic.js +4 -4
- package/lib/typeIndex/typeIndexLogic.js.map +1 -1
- package/lib/util/UtilityLogic.js +2 -2
- package/lib/util/UtilityLogic.js.map +1 -1
- package/package.json +7 -7
- package/src/authn/SolidAuthnLogic.ts +5 -5
- package/src/authn/authUtil.ts +1 -1
- package/src/discovery/discoveryLogic.ts +269 -48
- package/src/logic/solidLogicSingleton.ts +1 -1
- package/src/typeIndex/typeIndexLogic.ts +5 -5
- package/src/util/UtilityLogic.ts +3 -3
- package/test/discoveryLogic.test.ts +740 -0
- package/test/helpers/setup.ts +3 -0
- package/test/typeIndexLogic.test.ts +5 -4
|
@@ -36,32 +36,165 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = void 0;
|
|
39
|
+
exports.registerInstanceInTypeIndex = exports.getAppInstances = exports.getScopedAppInstances = exports.getScopedAppsfromIndex = exports.uniqueNodes = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.followOrCreateLink = exports.suggestPrivateTypeIndex = exports.suggestPublicTypeIndex = exports.suggestPreferencesFile = exports.loadOrCreateIfNotExists = void 0;
|
|
40
40
|
var rdflib_1 = require("rdflib");
|
|
41
|
+
// import * as debug from '../util/debug'
|
|
42
|
+
// import { getContainerMembers } from '../util/UtilityLogic'
|
|
43
|
+
var solidLogicSingleton_1 = require("../logic/solidLogicSingleton");
|
|
44
|
+
var uri_1 = require("../util/uri");
|
|
45
|
+
var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
|
|
46
|
+
var currentUser = authn.currentUser;
|
|
41
47
|
var ns = {
|
|
48
|
+
dct: (0, rdflib_1.Namespace)('http://purl.org/dc/terms/'),
|
|
49
|
+
ldp: (0, rdflib_1.Namespace)('http://www.w3.org/ns/ldp#'),
|
|
50
|
+
meeting: (0, rdflib_1.Namespace)('http://www.w3.org/ns/pim/meeting#'),
|
|
51
|
+
rdf: (0, rdflib_1.Namespace)('http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
|
|
52
|
+
schema: (0, rdflib_1.Namespace)('http://schema.org/'),
|
|
42
53
|
solid: (0, rdflib_1.Namespace)('http://www.w3.org/ns/solid/terms#'),
|
|
43
|
-
space: (0, rdflib_1.Namespace)('http://www.w3.org/ns/pim/space#')
|
|
54
|
+
space: (0, rdflib_1.Namespace)('http://www.w3.org/ns/pim/space#'),
|
|
55
|
+
stat: (0, rdflib_1.Namespace)('http://www.w3.org/ns/posix/stat#'),
|
|
56
|
+
vcard: (0, rdflib_1.Namespace)('http://www.w3.org/2006/vcard/ns#'),
|
|
57
|
+
wf: (0, rdflib_1.Namespace)('http://www.w3.org/2005/01/wf/flow#'),
|
|
58
|
+
xsd: (0, rdflib_1.Namespace)('http://www.w3.org/2001/XMLSchema#')
|
|
44
59
|
};
|
|
60
|
+
/** Create a resource if it really does not exist
|
|
61
|
+
* Be absolutely sure something does not exist before creating a new empty file
|
|
62
|
+
* as otherwise existing could be deleted.
|
|
63
|
+
* @param doc {NamedNode} - The resource
|
|
64
|
+
*/
|
|
65
|
+
function loadOrCreateIfNotExists(store, doc) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
+
var response, err_1, msg, msg;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
_a.trys.push([0, 2, , 3]);
|
|
72
|
+
return [4 /*yield*/, store.fetcher.load(doc)];
|
|
73
|
+
case 1:
|
|
74
|
+
response = _a.sent();
|
|
75
|
+
return [3 /*break*/, 3];
|
|
76
|
+
case 2:
|
|
77
|
+
err_1 = _a.sent();
|
|
78
|
+
if (err_1.response.status === 404) {
|
|
79
|
+
// console.log('createIfNotExists doc does NOT exist, will create: ' + doc)
|
|
80
|
+
try {
|
|
81
|
+
store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' });
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err;
|
|
85
|
+
// console.log(msg)
|
|
86
|
+
throw new Error(msg);
|
|
87
|
+
}
|
|
88
|
+
delete store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
89
|
+
// console.log('createIfNotExists doc created ok ' + doc)
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err_1;
|
|
93
|
+
// console.log(msg)
|
|
94
|
+
throw new Error(msg); // @@ add nested errors
|
|
95
|
+
}
|
|
96
|
+
return [3 /*break*/, 3];
|
|
97
|
+
case 3:
|
|
98
|
+
// console.log('createIfNotExists doc exists, all good ' + doc)
|
|
99
|
+
return [2 /*return*/, response];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
exports.loadOrCreateIfNotExists = loadOrCreateIfNotExists;
|
|
105
|
+
function suggestPreferencesFile(me) {
|
|
106
|
+
var stripped = me.uri.replace('/profile/', '/').replace('/public/', '/');
|
|
107
|
+
// const stripped = me.uri.replace(\/[p|P]rofile/\g, '/').replace(\/[p|P]ublic/\g, '/')
|
|
108
|
+
var folderURI = stripped.split('/').slice(0, -1).join('/') + '/Settings/';
|
|
109
|
+
var fileURI = folderURI + 'Preferences.ttl';
|
|
110
|
+
return (0, rdflib_1.sym)(fileURI);
|
|
111
|
+
}
|
|
112
|
+
exports.suggestPreferencesFile = suggestPreferencesFile;
|
|
113
|
+
function suggestPublicTypeIndex(me) {
|
|
114
|
+
var _a;
|
|
115
|
+
return (0, rdflib_1.sym)(((_a = me.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'publicTypeIndex.ttl');
|
|
116
|
+
}
|
|
117
|
+
exports.suggestPublicTypeIndex = suggestPublicTypeIndex;
|
|
118
|
+
// Note this one is based off the pref file not the profile
|
|
119
|
+
function suggestPrivateTypeIndex(preferencesFile) {
|
|
120
|
+
var _a;
|
|
121
|
+
return (0, rdflib_1.sym)(((_a = preferencesFile.doc().dir()) === null || _a === void 0 ? void 0 : _a.uri) + 'privateTypeIndex.ttl');
|
|
122
|
+
}
|
|
123
|
+
exports.suggestPrivateTypeIndex = suggestPrivateTypeIndex;
|
|
124
|
+
/* Follow link from this doc to another thing, or else make a new link
|
|
125
|
+
**
|
|
126
|
+
** return: null no ld one and failed to make a new one
|
|
127
|
+
*/
|
|
128
|
+
function followOrCreateLink(store, subject, predicate, object, doc) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
+
var result, err_2, err_3;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
|
+
case 0: return [4 /*yield*/, store.fetcher.load(doc)];
|
|
134
|
+
case 1:
|
|
135
|
+
_a.sent();
|
|
136
|
+
result = store.any(subject, predicate, null, doc);
|
|
137
|
+
// console.log('@@ followOrCreateLink result ', result)
|
|
138
|
+
if (result)
|
|
139
|
+
return [2 /*return*/, result];
|
|
140
|
+
if (!store.updater.editable(doc)) {
|
|
141
|
+
// console.log(`followOrCreateLink: Can't modify ${doc} so can't make new link to ${object}.`)
|
|
142
|
+
// console.log('followOrCreateLink @@ connectedStatements', store.connectedStatements(subject))
|
|
143
|
+
return [2 /*return*/, null];
|
|
144
|
+
}
|
|
145
|
+
_a.label = 2;
|
|
146
|
+
case 2:
|
|
147
|
+
_a.trys.push([2, 4, , 5]);
|
|
148
|
+
return [4 /*yield*/, store.updater.update([], [(0, rdflib_1.st)(subject, predicate, object, doc)])];
|
|
149
|
+
case 3:
|
|
150
|
+
_a.sent();
|
|
151
|
+
return [3 /*break*/, 5];
|
|
152
|
+
case 4:
|
|
153
|
+
err_2 = _a.sent();
|
|
154
|
+
console.warn("followOrCreateLink: Error making link in ".concat(doc, " to ").concat(object, ": ").concat(err_2));
|
|
155
|
+
return [2 /*return*/, null];
|
|
156
|
+
case 5:
|
|
157
|
+
_a.trys.push([5, 7, , 8]);
|
|
158
|
+
return [4 /*yield*/, loadOrCreateIfNotExists(store, object)
|
|
159
|
+
// store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})
|
|
160
|
+
];
|
|
161
|
+
case 6:
|
|
162
|
+
_a.sent();
|
|
163
|
+
return [3 /*break*/, 8];
|
|
164
|
+
case 7:
|
|
165
|
+
err_3 = _a.sent();
|
|
166
|
+
console.warn("followOrCreateLink: Error loading or saving new linked document: ".concat(object, ": ").concat(err_3));
|
|
167
|
+
return [3 /*break*/, 8];
|
|
168
|
+
case 8:
|
|
169
|
+
// console.log(`followOrCreateLink: Success loading or saving new linked document: ${object}.`)
|
|
170
|
+
return [2 /*return*/, object];
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
exports.followOrCreateLink = followOrCreateLink;
|
|
45
176
|
function loadProfile(store, user) {
|
|
46
177
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var err_1;
|
|
48
178
|
return __generator(this, function (_a) {
|
|
49
179
|
switch (_a.label) {
|
|
50
180
|
case 0:
|
|
181
|
+
// console.log(' @@ loadProfile: user', user)
|
|
51
182
|
if (!user) {
|
|
52
183
|
throw new Error("loadProfile: no user given.");
|
|
53
184
|
}
|
|
54
|
-
|
|
185
|
+
// try {
|
|
186
|
+
return [4 /*yield*/, store.fetcher.load(user.doc())
|
|
187
|
+
// } catch (err) {
|
|
188
|
+
// throw new Error(`Unable to load profile of user ${user}: ${err}`)
|
|
189
|
+
//}
|
|
190
|
+
];
|
|
55
191
|
case 1:
|
|
56
|
-
|
|
57
|
-
return [4 /*yield*/, store.fetcher.load(user.doc())];
|
|
58
|
-
case 2:
|
|
192
|
+
// try {
|
|
59
193
|
_a.sent();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
case 4: return [2 /*return*/, user.doc()];
|
|
194
|
+
// } catch (err) {
|
|
195
|
+
// throw new Error(`Unable to load profile of user ${user}: ${err}`)
|
|
196
|
+
//}
|
|
197
|
+
return [2 /*return*/, user.doc()];
|
|
65
198
|
}
|
|
66
199
|
});
|
|
67
200
|
});
|
|
@@ -69,27 +202,43 @@ function loadProfile(store, user) {
|
|
|
69
202
|
exports.loadProfile = loadProfile;
|
|
70
203
|
function loadPreferences(store, user) {
|
|
71
204
|
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var
|
|
205
|
+
var possiblePreferencesFile, preferencesFile, message, err_4;
|
|
73
206
|
return __generator(this, function (_a) {
|
|
74
207
|
switch (_a.label) {
|
|
75
|
-
case 0:
|
|
208
|
+
case 0:
|
|
209
|
+
// console.log('loadPreferences @@ user', user)
|
|
210
|
+
return [4 /*yield*/, loadProfile(store, user)];
|
|
76
211
|
case 1:
|
|
77
|
-
|
|
78
|
-
|
|
212
|
+
// console.log('loadPreferences @@ user', user)
|
|
213
|
+
_a.sent();
|
|
214
|
+
possiblePreferencesFile = suggestPreferencesFile(user);
|
|
215
|
+
return [4 /*yield*/, followOrCreateLink(store, user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())
|
|
216
|
+
// const preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile)
|
|
217
|
+
// console.log('loadPreferences @@ pref file', preferencesFile)
|
|
218
|
+
];
|
|
219
|
+
case 2:
|
|
220
|
+
preferencesFile = _a.sent();
|
|
221
|
+
// const preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile)
|
|
222
|
+
// console.log('loadPreferences @@ pref file', preferencesFile)
|
|
79
223
|
if (!preferencesFile) {
|
|
80
|
-
|
|
224
|
+
message = "User ".concat(user, " has no pointer in profile to preferences file.");
|
|
225
|
+
console.warn(message);
|
|
226
|
+
// throw new Error()
|
|
81
227
|
return [2 /*return*/, undefined];
|
|
82
228
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
229
|
+
_a.label = 3;
|
|
230
|
+
case 3:
|
|
231
|
+
_a.trys.push([3, 5, , 6]);
|
|
232
|
+
return [4 /*yield*/, store.fetcher.load(preferencesFile)];
|
|
233
|
+
case 4:
|
|
234
|
+
_a.sent();
|
|
235
|
+
return [3 /*break*/, 6];
|
|
236
|
+
case 5:
|
|
237
|
+
err_4 = _a.sent();
|
|
238
|
+
return [2 /*return*/, undefined
|
|
90
239
|
// throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
|
|
91
|
-
|
|
92
|
-
|
|
240
|
+
];
|
|
241
|
+
case 6: return [2 /*return*/, preferencesFile];
|
|
93
242
|
}
|
|
94
243
|
});
|
|
95
244
|
});
|
|
@@ -97,39 +246,68 @@ function loadPreferences(store, user) {
|
|
|
97
246
|
exports.loadPreferences = loadPreferences;
|
|
98
247
|
function loadTypeIndexesFor(store, user) {
|
|
99
248
|
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
-
var profile,
|
|
249
|
+
var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_5, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_6;
|
|
101
250
|
return __generator(this, function (_b) {
|
|
102
251
|
switch (_b.label) {
|
|
103
252
|
case 0:
|
|
253
|
+
// console.log('@@ loadTypeIndexesFor user', user)
|
|
104
254
|
if (!user)
|
|
105
255
|
throw new Error("loadTypeIndexesFor: No user given");
|
|
106
256
|
return [4 /*yield*/, loadProfile(store, user)];
|
|
107
257
|
case 1:
|
|
108
258
|
profile = _b.sent();
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
259
|
+
suggestion = suggestPublicTypeIndex(user);
|
|
260
|
+
return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('publicTypeIndex'), suggestion, profile)
|
|
261
|
+
// const publicTypeIndex = store.any(user, ns.solid('publicTypeIndex'), undefined, profile)
|
|
262
|
+
// console.log('@@ loadTypeIndexesFor publicTypeIndex', publicTypeIndex)
|
|
263
|
+
];
|
|
112
264
|
case 2:
|
|
113
|
-
_b.
|
|
114
|
-
|
|
265
|
+
publicTypeIndex = _b.sent();
|
|
266
|
+
publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
|
|
267
|
+
_b.label = 3;
|
|
115
268
|
case 3:
|
|
116
|
-
_b.
|
|
117
|
-
return [
|
|
269
|
+
_b.trys.push([3, 5, , 6]);
|
|
270
|
+
return [4 /*yield*/, loadPreferences(store, user)];
|
|
118
271
|
case 4:
|
|
119
|
-
|
|
120
|
-
return [3 /*break*/,
|
|
272
|
+
preferencesFile = _b.sent();
|
|
273
|
+
return [3 /*break*/, 6];
|
|
121
274
|
case 5:
|
|
122
|
-
|
|
123
|
-
|
|
275
|
+
err_5 = _b.sent();
|
|
276
|
+
preferencesFile = null;
|
|
277
|
+
return [3 /*break*/, 6];
|
|
124
278
|
case 6:
|
|
125
|
-
preferencesFile
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
279
|
+
if (!preferencesFile) return [3 /*break*/, 9];
|
|
280
|
+
suggestedPrivateTypeIndex = suggestPrivateTypeIndex(preferencesFile);
|
|
281
|
+
_a = store.any(user, ns.solid('privateTypeIndex'), undefined, profile);
|
|
282
|
+
if (_a) return [3 /*break*/, 8];
|
|
283
|
+
return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('privateTypeIndex'), suggestedPrivateTypeIndex, preferencesFile)];
|
|
284
|
+
case 7:
|
|
285
|
+
_a = (_b.sent());
|
|
286
|
+
_b.label = 8;
|
|
287
|
+
case 8:
|
|
288
|
+
privateTypeIndex = _a;
|
|
289
|
+
privateScopes = privateTypeIndex ? [{ label: 'private', index: privateTypeIndex, agent: user }] : [];
|
|
290
|
+
return [3 /*break*/, 10];
|
|
291
|
+
case 9:
|
|
292
|
+
privateScopes = [];
|
|
293
|
+
_b.label = 10;
|
|
294
|
+
case 10:
|
|
295
|
+
scopes = publicScopes.concat(privateScopes);
|
|
296
|
+
if (scopes.length === 0)
|
|
297
|
+
return [2 /*return*/, scopes];
|
|
298
|
+
files = scopes.map(function (scope) { return scope.index; });
|
|
299
|
+
_b.label = 11;
|
|
300
|
+
case 11:
|
|
301
|
+
_b.trys.push([11, 13, , 14]);
|
|
302
|
+
return [4 /*yield*/, store.fetcher.load(files)];
|
|
303
|
+
case 12:
|
|
304
|
+
_b.sent();
|
|
305
|
+
return [3 /*break*/, 14];
|
|
306
|
+
case 13:
|
|
307
|
+
err_6 = _b.sent();
|
|
308
|
+
console.warn('Problems loading type index: ', err_6);
|
|
309
|
+
return [3 /*break*/, 14];
|
|
310
|
+
case 14: return [2 /*return*/, scopes];
|
|
133
311
|
}
|
|
134
312
|
});
|
|
135
313
|
});
|
|
@@ -137,44 +315,33 @@ function loadTypeIndexesFor(store, user) {
|
|
|
137
315
|
exports.loadTypeIndexesFor = loadTypeIndexesFor;
|
|
138
316
|
function loadCommunityTypeIndexes(store, user) {
|
|
139
317
|
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var preferencesFile, communities,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
switch (_a.label) {
|
|
318
|
+
var preferencesFile, communities, result, _i, communities_1, org, _a, _b;
|
|
319
|
+
return __generator(this, function (_c) {
|
|
320
|
+
switch (_c.label) {
|
|
144
321
|
case 0: return [4 /*yield*/, loadPreferences(store, user)];
|
|
145
322
|
case 1:
|
|
146
|
-
preferencesFile =
|
|
147
|
-
if (preferencesFile)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
// const communityTypeIndexes = await Promise.all(communityTypeIndexesPromise)
|
|
169
|
-
/*
|
|
170
|
-
let result = [] as TypeIndex[]
|
|
171
|
-
for(const community of communities) {
|
|
172
|
-
result = result.concat(await loadTypeIndexesFor(store, community as NamedNode)) as TypeIndex[] // @@ how oto make functional with async?
|
|
173
|
-
}
|
|
174
|
-
*/
|
|
175
|
-
// return communityTypeIndexesPromise.resolve()
|
|
176
|
-
}
|
|
177
|
-
return [2 /*return*/, []];
|
|
323
|
+
preferencesFile = _c.sent();
|
|
324
|
+
if (!preferencesFile) return [3 /*break*/, 6];
|
|
325
|
+
communities = store.each(user, ns.solid('community'), undefined, preferencesFile);
|
|
326
|
+
result = [];
|
|
327
|
+
_i = 0, communities_1 = communities;
|
|
328
|
+
_c.label = 2;
|
|
329
|
+
case 2:
|
|
330
|
+
if (!(_i < communities_1.length)) return [3 /*break*/, 5];
|
|
331
|
+
org = communities_1[_i];
|
|
332
|
+
_b = (_a = result).concat;
|
|
333
|
+
return [4 /*yield*/, loadTypeIndexesFor(store, org)];
|
|
334
|
+
case 3:
|
|
335
|
+
result = _b.apply(_a, [_c.sent()]);
|
|
336
|
+
_c.label = 4;
|
|
337
|
+
case 4:
|
|
338
|
+
_i++;
|
|
339
|
+
return [3 /*break*/, 2];
|
|
340
|
+
case 5:
|
|
341
|
+
// const communityTypeIndexesPromises = communities.map(async community => await loadTypeIndexesFor(store, community as NamedNode))
|
|
342
|
+
// const result1 = Promise.all(communityTypeIndexesPromises)
|
|
343
|
+
return [2 /*return*/, result];
|
|
344
|
+
case 6: return [2 /*return*/, []]; // No communities
|
|
178
345
|
}
|
|
179
346
|
});
|
|
180
347
|
});
|
|
@@ -195,9 +362,133 @@ function loadAllTypeIndexes(store, user) {
|
|
|
195
362
|
});
|
|
196
363
|
}
|
|
197
364
|
exports.loadAllTypeIndexes = loadAllTypeIndexes;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
365
|
+
// Utility: remove duplicates from Array of NamedNodes
|
|
366
|
+
function uniqueNodes(arr) {
|
|
367
|
+
var uris = arr.map(function (x) { return x.uri; });
|
|
368
|
+
var set = new Set(uris);
|
|
369
|
+
var uris2 = Array.from(set);
|
|
370
|
+
var arr2 = uris2.map(function (u) { return new rdflib_1.NamedNode(u); });
|
|
371
|
+
return arr2; // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
|
|
201
372
|
}
|
|
202
|
-
|
|
373
|
+
exports.uniqueNodes = uniqueNodes;
|
|
374
|
+
function getScopedAppsfromIndex(store, scope, theClass) {
|
|
375
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
376
|
+
var index, registrations, directInstances, instances, instanceContainers, containers, i, cont, contents;
|
|
377
|
+
return __generator(this, function (_a) {
|
|
378
|
+
switch (_a.label) {
|
|
379
|
+
case 0:
|
|
380
|
+
index = scope.index;
|
|
381
|
+
registrations = store.each(undefined, ns.solid('forClass'), theClass, index);
|
|
382
|
+
directInstances = registrations.map(function (reg) { return store.each(reg, ns.solid('instance'), null, index); }).flat();
|
|
383
|
+
instances = uniqueNodes(directInstances);
|
|
384
|
+
instanceContainers = registrations.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
|
|
385
|
+
containers = uniqueNodes(instanceContainers);
|
|
386
|
+
i = 0;
|
|
387
|
+
_a.label = 1;
|
|
388
|
+
case 1:
|
|
389
|
+
if (!(i < containers.length)) return [3 /*break*/, 4];
|
|
390
|
+
cont = containers[i];
|
|
391
|
+
return [4 /*yield*/, store.fetcher.load(cont)];
|
|
392
|
+
case 2:
|
|
393
|
+
_a.sent();
|
|
394
|
+
contents = store.each(cont, ns.ldp('contains'), null, cont);
|
|
395
|
+
// if (contents.length) console.log('getScopedAppsfromIndex @@ instanceContainer contents:', contents)
|
|
396
|
+
instances = instances.concat(contents);
|
|
397
|
+
_a.label = 3;
|
|
398
|
+
case 3:
|
|
399
|
+
i++;
|
|
400
|
+
return [3 /*break*/, 1];
|
|
401
|
+
case 4: return [2 /*return*/, instances.map(function (instance) { return { instance: instance, scope: scope }; })];
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
exports.getScopedAppsfromIndex = getScopedAppsfromIndex;
|
|
407
|
+
function getScopedAppInstances(store, klass, user) {
|
|
408
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
409
|
+
var scopes, scopedApps, _i, scopes_1, scope, scopedApps0;
|
|
410
|
+
return __generator(this, function (_a) {
|
|
411
|
+
switch (_a.label) {
|
|
412
|
+
case 0: return [4 /*yield*/, loadAllTypeIndexes(store, user)];
|
|
413
|
+
case 1:
|
|
414
|
+
scopes = _a.sent();
|
|
415
|
+
scopedApps = [];
|
|
416
|
+
_i = 0, scopes_1 = scopes;
|
|
417
|
+
_a.label = 2;
|
|
418
|
+
case 2:
|
|
419
|
+
if (!(_i < scopes_1.length)) return [3 /*break*/, 5];
|
|
420
|
+
scope = scopes_1[_i];
|
|
421
|
+
return [4 /*yield*/, getScopedAppsfromIndex(store, scope, klass)];
|
|
422
|
+
case 3:
|
|
423
|
+
scopedApps0 = _a.sent();
|
|
424
|
+
scopedApps = scopedApps.concat(scopedApps0);
|
|
425
|
+
_a.label = 4;
|
|
426
|
+
case 4:
|
|
427
|
+
_i++;
|
|
428
|
+
return [3 /*break*/, 2];
|
|
429
|
+
case 5: return [2 /*return*/, scopedApps];
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
exports.getScopedAppInstances = getScopedAppInstances;
|
|
435
|
+
// This is the function signature which used to be in solid-ui/logic
|
|
436
|
+
// Recommended to use getScopedAppInstances instead as it provides more information.
|
|
437
|
+
//
|
|
438
|
+
function getAppInstances(store, klass) {
|
|
439
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
440
|
+
var user, scopedAppInstances;
|
|
441
|
+
return __generator(this, function (_a) {
|
|
442
|
+
switch (_a.label) {
|
|
443
|
+
case 0:
|
|
444
|
+
user = currentUser();
|
|
445
|
+
if (!user)
|
|
446
|
+
throw new Error('getAppInstances: Must be logged in to find apps.');
|
|
447
|
+
return [4 /*yield*/, getScopedAppInstances(store, klass, user)];
|
|
448
|
+
case 1:
|
|
449
|
+
scopedAppInstances = _a.sent();
|
|
450
|
+
return [2 /*return*/, scopedAppInstances.map(function (scoped) { return scoped.instance; })];
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
exports.getAppInstances = getAppInstances;
|
|
456
|
+
/**
|
|
457
|
+
* Register a new app in a type index
|
|
458
|
+
* used in chat in bookmark.js (solid-ui)
|
|
459
|
+
* Returns the registration object if successful else null
|
|
460
|
+
*/
|
|
461
|
+
function registerInstanceInTypeIndex(store, instance, index, theClass) {
|
|
462
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
463
|
+
var registration, ins, err_7, msg;
|
|
464
|
+
return __generator(this, function (_a) {
|
|
465
|
+
switch (_a.label) {
|
|
466
|
+
case 0:
|
|
467
|
+
registration = (0, uri_1.newThing)(index);
|
|
468
|
+
ins = [
|
|
469
|
+
// See https://github.com/solid/solid/blob/main/proposals/data-discovery.md
|
|
470
|
+
(0, rdflib_1.st)(registration, ns.rdf('type'), ns.solid('TypeRegistration'), index),
|
|
471
|
+
(0, rdflib_1.st)(registration, ns.solid('forClass'), theClass, index),
|
|
472
|
+
(0, rdflib_1.st)(registration, ns.solid('instance'), instance, index)
|
|
473
|
+
];
|
|
474
|
+
_a.label = 1;
|
|
475
|
+
case 1:
|
|
476
|
+
_a.trys.push([1, 3, , 4]);
|
|
477
|
+
console.log('patching index', ins);
|
|
478
|
+
return [4 /*yield*/, store.updater.update([], ins)];
|
|
479
|
+
case 2:
|
|
480
|
+
_a.sent();
|
|
481
|
+
return [3 /*break*/, 4];
|
|
482
|
+
case 3:
|
|
483
|
+
err_7 = _a.sent();
|
|
484
|
+
msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_7);
|
|
485
|
+
console.warn(msg);
|
|
486
|
+
return [2 /*return*/, null];
|
|
487
|
+
case 4: return [2 /*return*/, registration];
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
exports.registerInstanceInTypeIndex = registerInstanceInTypeIndex;
|
|
493
|
+
// ENDS
|
|
203
494
|
//# sourceMappingURL=discoveryLogic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discoveryLogic.js","sourceRoot":"","sources":["../../src/discovery/discoveryLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"discoveryLogic.js","sourceRoot":"","sources":["../../src/discovery/discoveryLogic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAkE;AAClE,yCAAyC;AACzC,6DAA6D;AAC7D,oEAAkE;AAClE,mCAAsC;AAE7B,IAAA,KAAK,GAAK,yCAAmB,MAAxB,C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O,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,EAAA;;oBAAnC,SAAmC,CAAA;;;;oBAE7B,GAAG,GAAG,6BAAsB,QAAQ,uBAAa,KAAK,eAAK,KAAG,CAAE,CAAA;oBACtE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;oBACjB,sBAAO,IAAI,EAAA;wBAEf,sBAAO,YAAY,EAAA;;;;CACtB;AAvBD,kEAuBC;AACD,OAAO"}
|
|
@@ -67,7 +67,7 @@ var _fetch = function (url, requestInit) { return __awaiter(void 0, void 0, void
|
|
|
67
67
|
var omitCreds;
|
|
68
68
|
return __generator(this, function (_a) {
|
|
69
69
|
omitCreds = requestInit && requestInit.credentials && requestInit.credentials == 'omit';
|
|
70
|
-
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/
|
|
70
|
+
if (authSession_1.authSession.info.webId && !omitCreds) { // see https://github.com/solidos/solidos/issues/114
|
|
71
71
|
// In fact ftech should respect crentials omit itself
|
|
72
72
|
return [2 /*return*/, authSession_1.authSession.fetch(url, requestInit)];
|
|
73
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsC;AACtC,0DAAwD;AACxD,2CAAyC;AAEzC,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,
|
|
1
|
+
{"version":3,"file":"solidLogicSingleton.js","sourceRoot":"","sources":["../../src/logic/solidLogicSingleton.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsC;AACtC,0DAAwD;AACxD,2CAAyC;AAEzC,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,qDAAqD;YACrD,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,IAAI,uBAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,yBAAW,CAAC,CAAA;AAIjE,kDAAmB;AAF5B,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA"}
|
|
@@ -5,13 +5,13 @@ export declare const ns: any;
|
|
|
5
5
|
* Resolves with the same context, outputting
|
|
6
6
|
* output: index.public, index.private
|
|
7
7
|
* @@ This is a very bizare function
|
|
8
|
-
* @see https://github.com/
|
|
8
|
+
* @see https://github.com/solidos/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
9
9
|
*/
|
|
10
10
|
export declare function loadIndex(context: AuthenticationContext, isPublic: boolean): Promise<AuthenticationContext>;
|
|
11
11
|
export declare function loadTypeIndexes(context: AuthenticationContext): Promise<AuthenticationContext | undefined>;
|
|
12
12
|
/**
|
|
13
13
|
* Resolves with the same context, outputting
|
|
14
|
-
* @see https://github.com/
|
|
14
|
+
* @see https://github.com/solidos/solid/blob/main/proposals/data-discovery.md#discoverability
|
|
15
15
|
*/
|
|
16
16
|
export declare function ensureTypeIndexes(context: AuthenticationContext, agent?: NamedNode): Promise<AuthenticationContext>;
|
|
17
17
|
/**
|