solid-logic 1.3.17-0abe2b84 → 1.3.17-1274f5aa

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.
@@ -24,7 +24,7 @@ export declare function loadTypeIndexesFor(store: LiveStore, user: NamedNode): P
24
24
  export declare function loadCommunityTypeIndexes(store: LiveStore, user: NamedNode): Promise<TypeIndexScope[][]>;
25
25
  export declare function loadAllTypeIndexes(store: LiveStore, user: NamedNode): Promise<TypeIndexScope[]>;
26
26
  export declare function uniqueNodes(arr: NamedNode[]): NamedNode[];
27
- export declare function getScopedAppsfromIndex(store: any, scope: any, theClass: NamedNode): Promise<{
27
+ export declare function getScopedAppsFromIndex(store: any, scope: any, theClass: NamedNode | null): Promise<{
28
28
  instance: NamedNode;
29
29
  scope: any;
30
30
  }[]>;
@@ -36,5 +36,6 @@ export declare function getAppInstances(store: LiveStore, klass: NamedNode): Pro
36
36
  * Returns the registration object if successful else null
37
37
  */
38
38
  export declare function registerInstanceInTypeIndex(store: LiveStore, instance: NamedNode, index: NamedNode, theClass: NamedNode): Promise<NamedNode | null>;
39
+ export declare function deleteTypeIndexRegistration(store: LiveStore, item: any): Promise<void>;
39
40
  export {};
40
41
  //# sourceMappingURL=discoveryLogic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"discoveryLogic.d.ts","sourceRoot":"","sources":["../../src/discovery/discoveryLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,SAAS,EAAW,MAAM,QAAQ,CAAC;AASlE,aAAK,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAE;AAC7E,aAAK,SAAS,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAA;AAiB/D;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAE,KAAK,EAA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AE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAE,SAAS,GAAG,SAAS,CAAE,CAkB1G;AAED,wBAAsB,kBAAkB,CAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAwC1G;AAED,wBAAsB,wBAAwB,CAAE,KAAK,EAAC,SAAS,EAAE,IAAI,EAAC,SAAS,GAAG,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAa5G;AAED,wBAAsB,kBAAkB,CAAE,KAAK,EAAC,SAAS,EAAE,IAAI,EAAC,SAAS,6BAExE;AAID,wBAAgB,WAAW,CAAE,GAAG,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAM1D;AAED,wBAAsB,sBAAsB,CAAE,KAAK,KAAA,EAAE,KAAK,KAAA,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI;;;KAwBrF;AAGD,wBAAsB,qBAAqB,CAAE,KAAK,EAAC,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAQpH;AAID,wBAAsB,eAAe,CAAE,KAAK,EAAC,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAK9F;AACD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAC,SAAS,EACf,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,SAAS,GAElB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAgB3B;AAED,wBAAsB,2BAA2B,CAAE,KAAK,EAAE,SAAS,EAAE,IAAI,KAAA,iBAKxE"}
@@ -36,10 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
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;
39
+ exports.deleteTypeIndexRegistration = 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
41
  var solidLogicSingleton_1 = require("../logic/solidLogicSingleton");
44
42
  var uri_1 = require("../util/uri");
45
43
  var authn = solidLogicSingleton_1.solidLogicSingleton.authn;
@@ -76,27 +74,21 @@ function loadOrCreateIfNotExists(store, doc) {
76
74
  case 2:
77
75
  err_1 = _a.sent();
78
76
  if (err_1.response.status === 404) {
79
- // console.log('createIfNotExists doc does NOT exist, will create: ' + doc)
80
77
  try {
81
78
  store.fetcher.webOperation('PUT', doc, { data: '', contentType: 'text/turtle' });
82
79
  }
83
80
  catch (err) {
84
81
  msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err;
85
- // console.log(msg)
86
82
  throw new Error(msg);
87
83
  }
88
84
  delete store.fetcher.requested[doc.uri]; // delete cached 404 error
89
- // console.log('createIfNotExists doc created ok ' + doc)
90
85
  }
91
86
  else {
92
87
  msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err_1;
93
- // console.log(msg)
94
88
  throw new Error(msg); // @@ add nested errors
95
89
  }
96
90
  return [3 /*break*/, 3];
97
- case 3:
98
- // console.log('createIfNotExists doc exists, all good ' + doc)
99
- return [2 /*return*/, response];
91
+ case 3: return [2 /*return*/, response];
100
92
  }
101
93
  });
102
94
  });
@@ -134,12 +126,9 @@ function followOrCreateLink(store, subject, predicate, object, doc) {
134
126
  case 1:
135
127
  _a.sent();
136
128
  result = store.any(subject, predicate, null, doc);
137
- // console.log('@@ followOrCreateLink result ', result)
138
129
  if (result)
139
130
  return [2 /*return*/, result];
140
131
  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
132
  return [2 /*return*/, null];
144
133
  }
145
134
  _a.label = 2;
@@ -165,9 +154,7 @@ function followOrCreateLink(store, subject, predicate, object, doc) {
165
154
  err_3 = _a.sent();
166
155
  console.warn("followOrCreateLink: Error loading or saving new linked document: ".concat(object, ": ").concat(err_3));
167
156
  return [3 /*break*/, 8];
168
- case 8:
169
- // console.log(`followOrCreateLink: Success loading or saving new linked document: ${object}.`)
170
- return [2 /*return*/, object];
157
+ case 8: return [2 /*return*/, object];
171
158
  }
172
159
  });
173
160
  });
@@ -175,26 +162,24 @@ function followOrCreateLink(store, subject, predicate, object, doc) {
175
162
  exports.followOrCreateLink = followOrCreateLink;
176
163
  function loadProfile(store, user) {
177
164
  return __awaiter(this, void 0, void 0, function () {
165
+ var err_4;
178
166
  return __generator(this, function (_a) {
179
167
  switch (_a.label) {
180
168
  case 0:
181
- // console.log(' @@ loadProfile: user', user)
182
169
  if (!user) {
183
170
  throw new Error("loadProfile: no user given.");
184
171
  }
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
- ];
172
+ _a.label = 1;
191
173
  case 1:
192
- // try {
174
+ _a.trys.push([1, 3, , 4]);
175
+ return [4 /*yield*/, store.fetcher.load(user.doc())];
176
+ case 2:
193
177
  _a.sent();
194
- // } catch (err) {
195
- // throw new Error(`Unable to load profile of user ${user}: ${err}`)
196
- //}
197
- return [2 /*return*/, user.doc()];
178
+ return [3 /*break*/, 4];
179
+ case 3:
180
+ err_4 = _a.sent();
181
+ throw new Error("Unable to load profile of user ".concat(user, ": ").concat(err_4));
182
+ case 4: return [2 /*return*/, user.doc()];
198
183
  }
199
184
  });
200
185
  });
@@ -202,28 +187,19 @@ function loadProfile(store, user) {
202
187
  exports.loadProfile = loadProfile;
203
188
  function loadPreferences(store, user) {
204
189
  return __awaiter(this, void 0, void 0, function () {
205
- var possiblePreferencesFile, preferencesFile, message, err_4;
190
+ var possiblePreferencesFile, preferencesFile, message, err_5;
206
191
  return __generator(this, function (_a) {
207
192
  switch (_a.label) {
208
- case 0:
209
- // console.log('loadPreferences @@ user', user)
210
- return [4 /*yield*/, loadProfile(store, user)];
193
+ case 0: return [4 /*yield*/, loadProfile(store, user)];
211
194
  case 1:
212
- // console.log('loadPreferences @@ user', user)
213
195
  _a.sent();
214
196
  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
- ];
197
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.space('preferencesFile'), possiblePreferencesFile, user.doc())];
219
198
  case 2:
220
199
  preferencesFile = _a.sent();
221
- // const preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile)
222
- // console.log('loadPreferences @@ pref file', preferencesFile)
223
200
  if (!preferencesFile) {
224
201
  message = "User ".concat(user, " has no pointer in profile to preferences file.");
225
202
  console.warn(message);
226
- // throw new Error()
227
203
  return [2 /*return*/, undefined];
228
204
  }
229
205
  _a.label = 3;
@@ -234,10 +210,8 @@ function loadPreferences(store, user) {
234
210
  _a.sent();
235
211
  return [3 /*break*/, 6];
236
212
  case 5:
237
- err_4 = _a.sent();
238
- return [2 /*return*/, undefined
239
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
240
- ];
213
+ err_5 = _a.sent();
214
+ return [2 /*return*/, undefined];
241
215
  case 6: return [2 /*return*/, preferencesFile];
242
216
  }
243
217
  });
@@ -246,21 +220,17 @@ function loadPreferences(store, user) {
246
220
  exports.loadPreferences = loadPreferences;
247
221
  function loadTypeIndexesFor(store, user) {
248
222
  return __awaiter(this, void 0, void 0, function () {
249
- var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_5, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_6;
223
+ var profile, suggestion, publicTypeIndex, publicScopes, preferencesFile, err_6, privateScopes, suggestedPrivateTypeIndex, privateTypeIndex, _a, scopes, files, err_7;
250
224
  return __generator(this, function (_b) {
251
225
  switch (_b.label) {
252
226
  case 0:
253
- // console.log('@@ loadTypeIndexesFor user', user)
254
227
  if (!user)
255
228
  throw new Error("loadTypeIndexesFor: No user given");
256
229
  return [4 /*yield*/, loadProfile(store, user)];
257
230
  case 1:
258
231
  profile = _b.sent();
259
232
  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
- ];
233
+ return [4 /*yield*/, followOrCreateLink(store, user, ns.solid('publicTypeIndex'), suggestion, profile)];
264
234
  case 2:
265
235
  publicTypeIndex = _b.sent();
266
236
  publicScopes = publicTypeIndex ? [{ label: 'public', index: publicTypeIndex, agent: user }] : [];
@@ -272,7 +242,7 @@ function loadTypeIndexesFor(store, user) {
272
242
  preferencesFile = _b.sent();
273
243
  return [3 /*break*/, 6];
274
244
  case 5:
275
- err_5 = _b.sent();
245
+ err_6 = _b.sent();
276
246
  preferencesFile = null;
277
247
  return [3 /*break*/, 6];
278
248
  case 6:
@@ -304,8 +274,8 @@ function loadTypeIndexesFor(store, user) {
304
274
  _b.sent();
305
275
  return [3 /*break*/, 14];
306
276
  case 13:
307
- err_6 = _b.sent();
308
- console.warn('Problems loading type index: ', err_6);
277
+ err_7 = _b.sent();
278
+ console.warn('Problems loading type index: ', err_7);
309
279
  return [3 /*break*/, 14];
310
280
  case 14: return [2 /*return*/, scopes];
311
281
  }
@@ -322,7 +292,7 @@ function loadCommunityTypeIndexes(store, user) {
322
292
  case 1:
323
293
  preferencesFile = _c.sent();
324
294
  if (!preferencesFile) return [3 /*break*/, 6];
325
- communities = store.each(user, ns.solid('community'), undefined, preferencesFile);
295
+ communities = store.each(user, ns.solid('community'), undefined, preferencesFile).concat(store.each(user, ns.solid('community'), undefined, user.doc()));
326
296
  result = [];
327
297
  _i = 0, communities_1 = communities;
328
298
  _c.label = 2;
@@ -337,10 +307,7 @@ function loadCommunityTypeIndexes(store, user) {
337
307
  case 4:
338
308
  _i++;
339
309
  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];
310
+ case 5: return [2 /*return*/, result];
344
311
  case 6: return [2 /*return*/, []]; // No communities
345
312
  }
346
313
  });
@@ -371,18 +338,25 @@ function uniqueNodes(arr) {
371
338
  return arr2; // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
372
339
  }
373
340
  exports.uniqueNodes = uniqueNodes;
374
- function getScopedAppsfromIndex(store, scope, theClass) {
341
+ function getScopedAppsFromIndex(store, scope, theClass) {
375
342
  return __awaiter(this, void 0, void 0, function () {
376
- var index, registrations, directInstances, instances, instanceContainers, containers, i, cont, contents;
343
+ var index, registrations, relevant, directInstances, instances, instanceContainers, containers, i, cont, contents;
377
344
  return __generator(this, function (_a) {
378
345
  switch (_a.label) {
379
346
  case 0:
380
347
  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();
348
+ registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
349
+ .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
350
+ .map(function (st) { return st.subject; });
351
+ relevant = theClass ? registrations.filter(function (reg) { return store.any(reg, ns.solid('forClass'), null, index).sameTerm(theClass); })
352
+ : registrations;
353
+ directInstances = relevant.map(function (reg) { return store.each(reg, ns.solid('instance'), null, index); }).flat();
383
354
  instances = uniqueNodes(directInstances);
384
- instanceContainers = registrations.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
355
+ instanceContainers = relevant.map(function (reg) { return store.each(reg, ns.solid('instanceContainer'), null, index); }).flat();
385
356
  containers = uniqueNodes(instanceContainers);
357
+ if (containers.length > 0) {
358
+ console.log('@@ getScopedAppsFromIndex containers ', containers);
359
+ }
386
360
  i = 0;
387
361
  _a.label = 1;
388
362
  case 1:
@@ -392,7 +366,6 @@ function getScopedAppsfromIndex(store, scope, theClass) {
392
366
  case 2:
393
367
  _a.sent();
394
368
  contents = store.each(cont, ns.ldp('contains'), null, cont);
395
- // if (contents.length) console.log('getScopedAppsfromIndex @@ instanceContainer contents:', contents)
396
369
  instances = instances.concat(contents);
397
370
  _a.label = 3;
398
371
  case 3:
@@ -403,7 +376,7 @@ function getScopedAppsfromIndex(store, scope, theClass) {
403
376
  });
404
377
  });
405
378
  }
406
- exports.getScopedAppsfromIndex = getScopedAppsfromIndex;
379
+ exports.getScopedAppsFromIndex = getScopedAppsFromIndex;
407
380
  function getScopedAppInstances(store, klass, user) {
408
381
  return __awaiter(this, void 0, void 0, function () {
409
382
  var scopes, scopedApps, _i, scopes_1, scope, scopedApps0;
@@ -418,7 +391,7 @@ function getScopedAppInstances(store, klass, user) {
418
391
  case 2:
419
392
  if (!(_i < scopes_1.length)) return [3 /*break*/, 5];
420
393
  scope = scopes_1[_i];
421
- return [4 /*yield*/, getScopedAppsfromIndex(store, scope, klass)];
394
+ return [4 /*yield*/, getScopedAppsFromIndex(store, scope, klass)];
422
395
  case 3:
423
396
  scopedApps0 = _a.sent();
424
397
  scopedApps = scopedApps.concat(scopedApps0);
@@ -460,7 +433,7 @@ exports.getAppInstances = getAppInstances;
460
433
  */
461
434
  function registerInstanceInTypeIndex(store, instance, index, theClass) {
462
435
  return __awaiter(this, void 0, void 0, function () {
463
- var registration, ins, err_7, msg;
436
+ var registration, ins, err_8, msg;
464
437
  return __generator(this, function (_a) {
465
438
  switch (_a.label) {
466
439
  case 0:
@@ -474,14 +447,13 @@ function registerInstanceInTypeIndex(store, instance, index, theClass) {
474
447
  _a.label = 1;
475
448
  case 1:
476
449
  _a.trys.push([1, 3, , 4]);
477
- console.log('patching index', ins);
478
450
  return [4 /*yield*/, store.updater.update([], ins)];
479
451
  case 2:
480
452
  _a.sent();
481
453
  return [3 /*break*/, 4];
482
454
  case 3:
483
- err_7 = _a.sent();
484
- msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_7);
455
+ err_8 = _a.sent();
456
+ msg = "Unable to register ".concat(instance, " in index ").concat(index, ": ").concat(err_8);
485
457
  console.warn(msg);
486
458
  return [2 /*return*/, null];
487
459
  case 4: return [2 /*return*/, registration];
@@ -490,5 +462,24 @@ function registerInstanceInTypeIndex(store, instance, index, theClass) {
490
462
  });
491
463
  }
492
464
  exports.registerInstanceInTypeIndex = registerInstanceInTypeIndex;
465
+ function deleteTypeIndexRegistration(store, item) {
466
+ return __awaiter(this, void 0, void 0, function () {
467
+ var reg, statements;
468
+ return __generator(this, function (_a) {
469
+ switch (_a.label) {
470
+ case 0:
471
+ reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index);
472
+ if (!reg)
473
+ throw new Error("deleteTypeIndexRegistration: No registration found for ".concat(item.instance));
474
+ statements = store.statementsMatching(reg, null, null, item.scope.index);
475
+ return [4 /*yield*/, store.updater.update(statements, [])];
476
+ case 1:
477
+ _a.sent();
478
+ return [2 /*return*/];
479
+ }
480
+ });
481
+ });
482
+ }
483
+ exports.deleteTypeIndexRegistration = deleteTypeIndexRegistration;
493
484
  // ENDS
494
485
  //# sourceMappingURL=discoveryLogic.js.map
@@ -1 +1 @@
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,CAAwB;AAC9B,IAAA,WAAW,GAAK,KAAK,YAAV,CAAU;AAK7B,IAAM,EAAE,GAAG;IACT,GAAG,EAAM,IAAA,kBAAS,EAAC,2BAA2B,CAAC;IAC/C,GAAG,EAAM,IAAA,kBAAS,EAAC,2BAA2B,CAAC;IAC/C,OAAO,EAAE,IAAA,kBAAS,EAAC,mCAAmC,CAAC;IACvD,GAAG,EAAM,IAAA,kBAAS,EAAC,6CAA6C,CAAC;IACjE,MAAM,EAAG,IAAA,kBAAS,EAAC,oBAAoB,CAAC;IACxC,KAAK,EAAI,IAAA,kBAAS,EAAC,mCAAmC,CAAC;IACvD,KAAK,EAAI,IAAA,kBAAS,EAAC,iCAAiC,CAAC;IACrD,IAAI,EAAK,IAAA,kBAAS,EAAC,kCAAkC,CAAC;IACtD,KAAK,EAAI,IAAA,kBAAS,EAAC,kCAAkC,CAAC;IACtD,EAAE,EAAO,IAAA,kBAAS,EAAC,oCAAoC,CAAC;IACxD,GAAG,EAAM,IAAA,kBAAS,EAAC,mCAAmC,CAAC;CAExD,CAAA;AAED;;;;GAIG;AACH,SAAsB,uBAAuB,CAAE,KAAgB,EAAE,GAAc;;;;;;;oBAI9D,qBAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAA;;oB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AG,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;AAtBD,kEAsBC;AAED,SAAsB,2BAA2B,CAAE,KAAgB,EAAE,IAAI;;;;;;oBACjE,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAc,CAAA;oBAC/F,IAAI,CAAC,GAAG;wBAAE,MAAM,IAAI,KAAK,CAAC,iEAA0D,IAAI,CAAC,QAAQ,CAAE,CAAC,CAAA;oBAC9F,UAAU,GAAG,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;oBAC9E,qBAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC,EAAA;;oBAA1C,SAA0C,CAAA;;;;;CAC3C;AALD,kEAKC;AAED,OAAO"}
package/lib/index.d.ts CHANGED
@@ -5,7 +5,7 @@ declare const chat: import("./chat/ChatLogic").ChatLogic;
5
5
  declare const profile: import("./profile/ProfileLogic").ProfileLogic;
6
6
  export { setACLUserPublic, genACLText } from './acl/aclLogic';
7
7
  export { ensureTypeIndexes, loadTypeIndexes, registerInTypeIndex, loadIndex } from './typeIndex/typeIndexLogic';
8
- export { loadProfile, loadPreferences, loadTypeIndexesFor, loadCommunityTypeIndexes, loadAllTypeIndexes } from './discovery/discoveryLogic';
8
+ export { deleteTypeIndexRegistration, followOrCreateLink, getAppInstances, getScopedAppInstances, getScopedAppsFromIndex, loadAllTypeIndexes, loadCommunityTypeIndexes, loadOrCreateIfNotExists, loadPreferences, loadProfile, loadTypeIndexesFor, registerInstanceInTypeIndex, suggestPreferencesFile, suggestPrivateTypeIndex, suggestPublicTypeIndex, uniqueNodes } from './discovery/discoveryLogic';
9
9
  export { SolidLogic } from './logic/SolidLogic';
10
10
  export { offlineTestID, appContext } from './authn/authUtil';
11
11
  export { ACL_LINK } from './util/UtilityLogic';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,KAAK,8BAA4B,CAAA;AACvC,QAAA,MAAM,WAAW,sDAAwC,CAAA;AACzD,QAAA,MAAM,KAAK,4BAA4B,CAAA;AAEvC,QAAA,MAAM,IAAI,sCAA2B,CAAA;AACrC,QAAA,MAAM,OAAO,+CAA8B,CAAA;AAE3C,OAAO,EACL,gBAAgB,EAChB,UAAU,EACX,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,SAAS,EACV,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,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EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.loadAllTypeIndexes = exports.loadCommunityTypeIndexes = exports.loadTypeIndexesFor = exports.loadPreferences = exports.loadProfile = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = void 0;
3
+ exports.profile = exports.chat = exports.store = exports.authSession = exports.authn = exports.FetchError = exports.NotFoundError = exports.SameOriginForbiddenError = exports.CrossOriginForbiddenError = exports.UnauthorizedError = exports.solidLogicSingleton = exports.getSuggestedIssuers = exports.ACL_LINK = exports.appContext = exports.offlineTestID = exports.SolidLogic = exports.uniqueNodes = exports.suggestPublicTypeIndex = exports.suggestPrivateTypeIndex = exports.suggestPreferencesFile = exports.registerInstanceInTypeIndex = exports.loadTypeIndexesFor = exports.loadProfile = exports.loadPreferences = exports.loadOrCreateIfNotExists = exports.loadCommunityTypeIndexes = exports.loadAllTypeIndexes = exports.getScopedAppsFromIndex = exports.getScopedAppInstances = exports.getAppInstances = exports.followOrCreateLink = exports.deleteTypeIndexRegistration = exports.loadIndex = exports.registerInTypeIndex = exports.loadTypeIndexes = exports.ensureTypeIndexes = exports.genACLText = exports.setACLUserPublic = 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");
@@ -22,12 +22,25 @@ Object.defineProperty(exports, "ensureTypeIndexes", { enumerable: true, get: fun
22
22
  Object.defineProperty(exports, "loadTypeIndexes", { enumerable: true, get: function () { return typeIndexLogic_1.loadTypeIndexes; } });
23
23
  Object.defineProperty(exports, "registerInTypeIndex", { enumerable: true, get: function () { return typeIndexLogic_1.registerInTypeIndex; } });
24
24
  Object.defineProperty(exports, "loadIndex", { enumerable: true, get: function () { return typeIndexLogic_1.loadIndex; } });
25
+ // Generate by
26
+ // grep export src/discovery/discoveryLogic.ts | sed -e 's/export //g' | sed -e 's/async //g'| sed -e 's/function //g' | sed -e 's/ .*/,/g' | sort
25
27
  var discoveryLogic_1 = require("./discovery/discoveryLogic");
26
- Object.defineProperty(exports, "loadProfile", { enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } });
28
+ Object.defineProperty(exports, "deleteTypeIndexRegistration", { enumerable: true, get: function () { return discoveryLogic_1.deleteTypeIndexRegistration; } });
29
+ Object.defineProperty(exports, "followOrCreateLink", { enumerable: true, get: function () { return discoveryLogic_1.followOrCreateLink; } });
30
+ Object.defineProperty(exports, "getAppInstances", { enumerable: true, get: function () { return discoveryLogic_1.getAppInstances; } });
31
+ Object.defineProperty(exports, "getScopedAppInstances", { enumerable: true, get: function () { return discoveryLogic_1.getScopedAppInstances; } });
32
+ Object.defineProperty(exports, "getScopedAppsFromIndex", { enumerable: true, get: function () { return discoveryLogic_1.getScopedAppsFromIndex; } });
33
+ Object.defineProperty(exports, "loadAllTypeIndexes", { enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } });
34
+ Object.defineProperty(exports, "loadCommunityTypeIndexes", { enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } });
35
+ Object.defineProperty(exports, "loadOrCreateIfNotExists", { enumerable: true, get: function () { return discoveryLogic_1.loadOrCreateIfNotExists; } });
27
36
  Object.defineProperty(exports, "loadPreferences", { enumerable: true, get: function () { return discoveryLogic_1.loadPreferences; } });
37
+ Object.defineProperty(exports, "loadProfile", { enumerable: true, get: function () { return discoveryLogic_1.loadProfile; } });
28
38
  Object.defineProperty(exports, "loadTypeIndexesFor", { enumerable: true, get: function () { return discoveryLogic_1.loadTypeIndexesFor; } });
29
- Object.defineProperty(exports, "loadCommunityTypeIndexes", { enumerable: true, get: function () { return discoveryLogic_1.loadCommunityTypeIndexes; } });
30
- Object.defineProperty(exports, "loadAllTypeIndexes", { enumerable: true, get: function () { return discoveryLogic_1.loadAllTypeIndexes; } });
39
+ Object.defineProperty(exports, "registerInstanceInTypeIndex", { enumerable: true, get: function () { return discoveryLogic_1.registerInstanceInTypeIndex; } });
40
+ Object.defineProperty(exports, "suggestPreferencesFile", { enumerable: true, get: function () { return discoveryLogic_1.suggestPreferencesFile; } });
41
+ Object.defineProperty(exports, "suggestPrivateTypeIndex", { enumerable: true, get: function () { return discoveryLogic_1.suggestPrivateTypeIndex; } });
42
+ Object.defineProperty(exports, "suggestPublicTypeIndex", { enumerable: true, get: function () { return discoveryLogic_1.suggestPublicTypeIndex; } });
43
+ Object.defineProperty(exports, "uniqueNodes", { enumerable: true, get: function () { return discoveryLogic_1.uniqueNodes; } });
31
44
  var SolidLogic_1 = require("./logic/SolidLogic");
32
45
  Object.defineProperty(exports, "SolidLogic", { enumerable: true, get: function () { return SolidLogic_1.SolidLogic; } });
33
46
  var authUtil_1 = require("./authn/authUtil");
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;AACjE,IAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAmC9B,sBAAK;AAlCd,IAAM,WAAW,GAAG,yCAAmB,CAAC,KAAK,CAAC,WAAW,CAAA;AAkCzC,kCAAW;AAjC3B,IAAM,KAAK,GAAG,yCAAmB,CAAC,KAAK,CAAA;AAiCV,sBAAK;AA/BlC,IAAM,IAAI,GAAG,yCAAmB,CAAC,IAAI,CAAA;AA+BD,oBAAI;AA9BxC,I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OAAO,CAAA;AA2CD,0BAAO;AAzCjD,2CAGuB;AAFrB,4GAAA,gBAAgB,OAAA;AAChB,sGAAA,UAAU,OAAA;AAGZ,6DAKmC;AAJjC,mHAAA,iBAAiB,OAAA;AACjB,iHAAA,eAAe,OAAA;AACf,qHAAA,mBAAmB,OAAA;AACnB,2GAAA,SAAS,OAAA;AAGX,cAAc;AACd,oJAAoJ;AACpJ,6DAiBmC;AAhBjC,6HAAA,2BAA2B,OAAA;AAC3B,oHAAA,kBAAkB,OAAA;AAClB,iHAAA,eAAe,OAAA;AACf,uHAAA,qBAAqB,OAAA;AACrB,wHAAA,sBAAsB,OAAA;AACtB,oHAAA,kBAAkB,OAAA;AAClB,0HAAA,wBAAwB,OAAA;AACxB,yHAAA,uBAAuB,OAAA;AACvB,iHAAA,eAAe,OAAA;AACf,6GAAA,WAAW,OAAA;AACX,oHAAA,kBAAkB,OAAA;AAClB,6HAAA,2BAA2B,OAAA;AAC3B,wHAAA,sBAAsB,OAAA;AACtB,yHAAA,uBAAuB,OAAA;AACvB,wHAAA,sBAAsB,OAAA;AACtB,6GAAA,WAAW,OAAA;AAGb,iDAA+C;AAAtC,wGAAA,UAAU,OAAA;AACnB,6CAA4D;AAAnD,yGAAA,aAAa,OAAA;AAAE,sGAAA,UAAU,OAAA;AAClC,oDAA8C;AAArC,wGAAA,QAAQ,OAAA;AACjB,oDAA0D;AAAjD,kHAAA,mBAAmB,OAAA;AAE5B,6EAA6E;AAC7E,mEAAiE;AAAxD,0HAAA,mBAAmB,OAAA;AAC5B,mDAAuI;AAA9H,gHAAA,iBAAiB,OAAA;AAAE,wHAAA,yBAAyB,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAAE,4GAAA,aAAa,OAAA;AAAE,yGAAA,UAAU,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-logic",
3
- "version": "1.3.17-0abe2b84",
3
+ "version": "1.3.17-1274f5aa",
4
4
  "description": "Core business logic of Solid OS",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -8,6 +8,7 @@
8
8
  "clean": "rm -rf lib",
9
9
  "lint": "eslint ./src",
10
10
  "test": "jest",
11
+ "test-debug": "node --inspect-brk ./node_modules/.bin/jest -i --env jest-environment-node-debug",
11
12
  "preversion": "npm test",
12
13
  "postversion": "git push --follow-tags",
13
14
  "ignore:prepublishOnly": "npm run build",
@@ -35,6 +36,7 @@
35
36
  "@typescript-eslint/parser": "^5.19.0",
36
37
  "eslint": "^8.13.0",
37
38
  "jest": "^27.5.1",
39
+ "jest-environment-node-debug": "^2.0.0",
38
40
  "jest-fetch-mock": "^3.0.3",
39
41
  "typescript": "^4.6.3"
40
42
  },
@@ -1,9 +1,6 @@
1
1
  import { NamedNode, Namespace, LiveStore, sym, st } from "rdflib";
2
- // import * as debug from '../util/debug'
3
- // import { getContainerMembers } from '../util/UtilityLogic'
4
2
  import { solidLogicSingleton } from "../logic/solidLogicSingleton"
5
3
  import { newThing } from "../util/uri"
6
-
7
4
  const { authn } = solidLogicSingleton
8
5
  const { currentUser } = authn
9
6
 
@@ -32,28 +29,22 @@ const ns = {
32
29
  */
33
30
  export async function loadOrCreateIfNotExists (store: LiveStore, doc: NamedNode) {
34
31
  let response
35
- // console.log('@@ loadOrCreateIfNotExists doc ', doc)
36
32
  try {
37
33
  response = await store.fetcher.load(doc)
38
34
  } catch (err) {
39
35
  if (err.response.status === 404) {
40
- // console.log('createIfNotExists doc does NOT exist, will create: ' + doc)
41
36
  try {
42
37
  store.fetcher.webOperation('PUT', doc, {data: '', contentType: 'text/turtle'})
43
38
  } catch (err) {
44
39
  const msg = 'createIfNotExists: PUT FAILED: ' + doc + ': ' + err
45
- // console.log(msg)
46
40
  throw new Error(msg)
47
41
  }
48
42
  delete store.fetcher.requested[doc.uri] // delete cached 404 error
49
- // console.log('createIfNotExists doc created ok ' + doc)
50
43
  } else {
51
44
  const msg = 'createIfNotExists doc load error NOT 404: ' + doc + ': ' + err
52
- // console.log(msg)
53
45
  throw new Error(msg) // @@ add nested errors
54
46
  }
55
47
  }
56
- // console.log('createIfNotExists doc exists, all good ' + doc)
57
48
  return response
58
49
  }
59
50
 
@@ -77,16 +68,13 @@ export function suggestPrivateTypeIndex (preferencesFile:NamedNode) {
77
68
  **
78
69
  ** return: null no ld one and failed to make a new one
79
70
  */
80
- export async function followOrCreateLink(store: LiveStore, subject: NamedNode, predicate: NamedNode,
71
+ export async function followOrCreateLink (store: LiveStore, subject: NamedNode, predicate: NamedNode,
81
72
  object: NamedNode, doc:NamedNode):Promise<NamedNode | null> {
82
73
  await store.fetcher.load(doc)
83
74
  const result = store.any(subject, predicate, null, doc)
84
- // console.log('@@ followOrCreateLink result ', result)
85
75
 
86
76
  if (result) return result as NamedNode
87
77
  if (!store.updater.editable(doc)) {
88
- // console.log(`followOrCreateLink: Can't modify ${doc} so can't make new link to ${object}.`)
89
- // console.log('followOrCreateLink @@ connectedStatements', store.connectedStatements(subject))
90
78
  return null
91
79
  }
92
80
  try {
@@ -96,58 +84,48 @@ export async function followOrCreateLink(store: LiveStore, subject: NamedNode, p
96
84
  return null
97
85
  }
98
86
 
99
- // console.log(`Success making link in ${doc} to ${object}` )
100
-
101
87
  try {
102
88
  await loadOrCreateIfNotExists(store, object)
103
89
  // store.fetcher.webOperation('PUT', object, { data: '', contentType: 'text/turtle'})
104
90
  } catch (err) {
105
91
  console.warn(`followOrCreateLink: Error loading or saving new linked document: ${object}: ${err}`)
106
92
  }
107
- // console.log(`followOrCreateLink: Success loading or saving new linked document: ${object}.`)
108
93
  return object
109
94
  }
110
95
 
111
- export async function loadProfile(store: LiveStore, user: NamedNode) {
112
- // console.log(' @@ loadProfile: user', user)
96
+ export async function loadProfile (store: LiveStore, user: NamedNode) {
113
97
  if (!user) {
114
98
  throw new Error(`loadProfile: no user given.`)
115
99
  }
116
- // try {
100
+ try {
117
101
  await store.fetcher.load(user.doc())
118
- // } catch (err) {
119
- // throw new Error(`Unable to load profile of user ${user}: ${err}`)
120
- //}
102
+ } catch (err) {
103
+ throw new Error(`Unable to load profile of user ${user}: ${err}`)
104
+ }
121
105
  return user.doc()
122
106
  }
123
107
 
124
- export async function loadPreferences(store: LiveStore, user: NamedNode): Promise <NamedNode | undefined > {
125
- // console.log('loadPreferences @@ user', user)
108
+ export async function loadPreferences (store: LiveStore, user: NamedNode): Promise <NamedNode | undefined > {
126
109
  await loadProfile(store as LiveStore, user)
127
110
 
128
111
  const possiblePreferencesFile = suggestPreferencesFile(user)
129
112
 
130
113
  const preferencesFile = await followOrCreateLink(store, user, ns.space('preferencesFile') as NamedNode, possiblePreferencesFile, user.doc())
131
- // const preferencesFile = store.any(user, ns.space('preferencesFile'), undefined, profile)
132
114
 
133
- // console.log('loadPreferences @@ pref file', preferencesFile)
134
115
  if (!preferencesFile) {
135
116
  const message = `User ${user} has no pointer in profile to preferences file.`
136
117
  console.warn(message)
137
- // throw new Error()
138
118
  return undefined
139
119
  }
140
120
  try {
141
121
  await store.fetcher.load(preferencesFile as NamedNode)
142
122
  } catch (err) { // Mabeb a permission propblem or origin problem
143
123
  return undefined
144
- // throw new Error(`Unable to load preferences file ${preferencesFile} of user <${user}>: ${err}`)
145
124
  }
146
125
  return preferencesFile as NamedNode
147
126
  }
148
127
 
149
- export async function loadTypeIndexesFor(store: LiveStore, user:NamedNode): Promise<Array<TypeIndexScope>> {
150
- // console.log('@@ loadTypeIndexesFor user', user)
128
+ export async function loadTypeIndexesFor (store: LiveStore, user:NamedNode): Promise<Array<TypeIndexScope>> {
151
129
  if (!user) throw new Error(`loadTypeIndexesFor: No user given`)
152
130
  const profile = await loadProfile(store, user)
153
131
 
@@ -155,9 +133,6 @@ export async function loadTypeIndexesFor(store: LiveStore, user:NamedNode): Prom
155
133
 
156
134
  const publicTypeIndex = await followOrCreateLink(store, user, ns.solid('publicTypeIndex') as NamedNode, suggestion, profile)
157
135
 
158
- // const publicTypeIndex = store.any(user, ns.solid('publicTypeIndex'), undefined, profile)
159
- // console.log('@@ loadTypeIndexesFor publicTypeIndex', publicTypeIndex)
160
-
161
136
  const publicScopes = publicTypeIndex ? [ { label: 'public', index: publicTypeIndex as NamedNode, agent: user } ] : []
162
137
 
163
138
  let preferencesFile
@@ -184,7 +159,6 @@ export async function loadTypeIndexesFor(store: LiveStore, user:NamedNode): Prom
184
159
  const scopes = publicScopes.concat(privateScopes)
185
160
  if (scopes.length === 0) return scopes
186
161
  const files = scopes.map(scope => scope.index)
187
- // console.log('@@ loadTypeIndexesFor files ', files)
188
162
  try {
189
163
  await store.fetcher.load(files)
190
164
  } catch (err) {
@@ -196,14 +170,13 @@ export async function loadTypeIndexesFor(store: LiveStore, user:NamedNode): Prom
196
170
  export async function loadCommunityTypeIndexes (store:LiveStore, user:NamedNode): Promise<TypeIndexScope[][]> {
197
171
  const preferencesFile = await loadPreferences(store, user)
198
172
  if (preferencesFile) { // For now, pick up communities as simple links from the preferences file.
199
- const communities = store.each(user, ns.solid('community'), undefined, preferencesFile as NamedNode)
200
- // console.log('loadCommunityTypeIndexes communities: ',communities)
173
+ const communities = store.each(user, ns.solid('community'), undefined, preferencesFile as NamedNode).concat(
174
+ store.each(user, ns.solid('community'), undefined, user.doc() as NamedNode)
175
+ )
201
176
  let result = []
202
177
  for (const org of communities) {
203
178
  result = result.concat(await loadTypeIndexesFor(store, org as NamedNode) as any)
204
179
  }
205
- // const communityTypeIndexesPromises = communities.map(async community => await loadTypeIndexesFor(store, community as NamedNode))
206
- // const result1 = Promise.all(communityTypeIndexesPromises)
207
180
  return result
208
181
  }
209
182
  return [] // No communities
@@ -223,37 +196,27 @@ export function uniqueNodes (arr: NamedNode[]): NamedNode[] {
223
196
  return arr2 // Array.from(new Set(arr.map(x => x.uri))).map(u => sym(u))
224
197
  }
225
198
 
226
- export async function getScopedAppsfromIndex (store, scope, theClass: NamedNode) {
227
- // console.log(`getScopedAppsfromIndex agent ${scope.agent} index: ${scope.index}` )
199
+ export async function getScopedAppsFromIndex (store, scope, theClass: NamedNode | null) {
228
200
  const index = scope.index
229
- const registrations = store.each(undefined, ns.solid('forClass'), theClass, index)
230
- // console.log(' registrations', registrations )
231
-
232
- const directInstances = registrations.map(reg => store.each(reg as NamedNode, ns.solid('instance'), null, index)).flat()
233
- // console.log(' directInstances', directInstances )
201
+ const registrations = store.statementsMatching(null, ns.solid('instance'), null, index)
202
+ .concat(store.statementsMatching(null, ns.solid('instanceContainer'), null, index))
203
+ .map(st => st.subject)
204
+ const relevant = theClass ? registrations.filter(reg => store.any(reg, ns.solid('forClass'), null, index).sameTerm(theClass))
205
+ : registrations
206
+ const directInstances = relevant.map(reg => store.each(reg as NamedNode, ns.solid('instance'), null, index)).flat()
234
207
  let instances = uniqueNodes(directInstances)
235
208
 
236
- /*
237
- let instanceContainers = []
238
- for (const reg of registrations) {
239
- const cont = store.any(reg as NamedNode, ns.solid('instanceContainer'), null, index)
240
- if (cont) {
241
- // console.log(' @@ getScopedAppsfromIndex got one: ', cont)
242
- instanceContainers.push(cont)
243
- }
244
- }
245
- */
246
- const instanceContainers = registrations.map(
209
+ const instanceContainers = relevant.map(
247
210
  reg => store.each(reg as NamedNode, ns.solid('instanceContainer'), null, index)).flat()
248
211
 
249
212
  // instanceContainers may be deprocatable if no one has used them
250
213
 
251
214
  const containers = uniqueNodes(instanceContainers)
215
+ if (containers.length > 0) { console.log('@@ getScopedAppsFromIndex containers ', containers)}
252
216
  for (let i = 0; i < containers.length; i++) {
253
217
  const cont = containers[i]
254
218
  await store.fetcher.load(cont)
255
219
  const contents = store.each(cont, ns.ldp('contains'), null, cont)
256
- // if (contents.length) console.log('getScopedAppsfromIndex @@ instanceContainer contents:', contents)
257
220
  instances = instances.concat(contents)
258
221
  }
259
222
  return instances.map(instance => { return {instance, scope}})
@@ -261,11 +224,10 @@ export async function getScopedAppsfromIndex (store, scope, theClass: NamedNode)
261
224
 
262
225
 
263
226
  export async function getScopedAppInstances (store:LiveStore, klass: NamedNode, user: NamedNode):Promise<ScopedApp[]> {
264
- // console.log('getScopedAppInstances @@ ' + user)
265
227
  const scopes = await loadAllTypeIndexes(store, user)
266
228
  let scopedApps = []
267
229
  for (const scope of scopes) {
268
- const scopedApps0 = await getScopedAppsfromIndex(store, scope, klass) as any
230
+ const scopedApps0 = await getScopedAppsFromIndex(store, scope, klass) as any
269
231
  scopedApps = scopedApps.concat(scopedApps0)
270
232
  }
271
233
  return scopedApps
@@ -299,7 +261,6 @@ export async function registerInstanceInTypeIndex (
299
261
  st(registration, ns.solid('instance'), instance, index)
300
262
  ]
301
263
  try {
302
- console.log('patching index', ins)
303
264
  await store.updater.update([], ins)
304
265
  } catch (err) {
305
266
  const msg = `Unable to register ${instance} in index ${index}: ${err}`
@@ -308,4 +269,12 @@ export async function registerInstanceInTypeIndex (
308
269
  }
309
270
  return registration
310
271
  }
272
+
273
+ export async function deleteTypeIndexRegistration (store: LiveStore, item) {
274
+ const reg = store.the(null, ns.solid('instance'), item.instance, item.scope.index) as NamedNode
275
+ if (!reg) throw new Error(`deleteTypeIndexRegistration: No registration found for ${item.instance}`)
276
+ const statements = store.statementsMatching(reg, null, null, item.scope.index)
277
+ await store.updater.update(statements, [])
278
+ }
279
+
311
280
  // ENDS
package/src/index.ts CHANGED
@@ -20,12 +20,25 @@ export {
20
20
  loadIndex
21
21
  } from './typeIndex/typeIndexLogic'
22
22
 
23
+ // Generate by
24
+ // grep export src/discovery/discoveryLogic.ts | sed -e 's/export //g' | sed -e 's/async //g'| sed -e 's/function //g' | sed -e 's/ .*/,/g' | sort
23
25
  export {
24
- loadProfile,
26
+ deleteTypeIndexRegistration,
27
+ followOrCreateLink,
28
+ getAppInstances,
29
+ getScopedAppInstances,
30
+ getScopedAppsFromIndex,
31
+ loadAllTypeIndexes,
32
+ loadCommunityTypeIndexes,
33
+ loadOrCreateIfNotExists,
25
34
  loadPreferences,
35
+ loadProfile,
26
36
  loadTypeIndexesFor,
27
- loadCommunityTypeIndexes,
28
- loadAllTypeIndexes
37
+ registerInstanceInTypeIndex,
38
+ suggestPreferencesFile,
39
+ suggestPrivateTypeIndex,
40
+ suggestPublicTypeIndex,
41
+ uniqueNodes
29
42
  } from './discovery/discoveryLogic'
30
43
 
31
44
  export { SolidLogic } from './logic/SolidLogic'
@@ -410,7 +410,7 @@ const ClubScopes =
410
410
  expect(loadCommunityTypeIndexes).toBeInstanceOf(Function)
411
411
  })
412
412
  it('loads data', async () => {
413
- const result = await loadCommunityTypeIndexes(store, user) // @@ tbd
413
+ const result = await loadCommunityTypeIndexes(store, user)
414
414
  expect(result).toEqual(ClubScopes)
415
415
  })
416
416
  })