@pod-os/core 0.10.1-68c4495.0 → 0.11.1-2de5854.0

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/dist/index.js CHANGED
@@ -37956,27 +37956,26 @@ var WebIdProfile = class extends Thing {
37956
37956
  );
37957
37957
  }
37958
37958
  /**
37959
- * Returns the URI of a private label index
37959
+ * Returns the URIs of the private label indexes
37960
37960
  */
37961
- getPrivateLabelIndex() {
37962
- const index2 = this.store.anyValue(
37961
+ getPrivateLabelIndexes() {
37962
+ const profileNodes = this.store.each(
37963
37963
  namedNode2(this.webId),
37964
37964
  namedNode2("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
37965
37965
  void 0,
37966
37966
  namedNode2(this.webId).doc()
37967
37967
  );
37968
- if (index2) {
37969
- return index2;
37968
+ const preferences = this.getPreferencesFile();
37969
+ if (preferences) {
37970
+ const preferencesNodes = this.store.each(
37971
+ namedNode2(this.webId),
37972
+ namedNode2("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
37973
+ void 0,
37974
+ namedNode2(preferences)
37975
+ );
37976
+ return [...profileNodes, ...preferencesNodes].map((it) => it.value);
37970
37977
  } else {
37971
- const preferences = this.getPreferencesFile();
37972
- if (preferences) {
37973
- return this.store.anyValue(
37974
- namedNode2(this.webId),
37975
- namedNode2("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
37976
- void 0,
37977
- namedNode2(preferences)
37978
- );
37979
- }
37978
+ return profileNodes.map((it) => it.value);
37980
37979
  }
37981
37980
  }
37982
37981
  };
@@ -38101,6 +38100,14 @@ var Store = class {
38101
38100
  credentials: "omit"
38102
38101
  });
38103
38102
  }
38103
+ /**
38104
+ * Fetch all the given URIs in parallel and put the data to the store
38105
+ * @param uris
38106
+ */
38107
+ fetchAll(uris) {
38108
+ const responses = uris.map((uri6) => this.fetch(uri6));
38109
+ return Promise.allSettled(responses);
38110
+ }
38104
38111
  /**
38105
38112
  * Retrieve the thing identified by the given URI from the store
38106
38113
  * @param uri
@@ -58515,6 +58522,9 @@ var PodOS = class {
58515
58522
  fetch(uri6) {
58516
58523
  return this.store.fetch(uri6);
58517
58524
  }
58525
+ fetchAll(uris) {
58526
+ return this.store.fetchAll(uris);
58527
+ }
58518
58528
  fetchFile(url7) {
58519
58529
  return this.fileFetcher.fetchFile(url7);
58520
58530
  }
@@ -58554,14 +58564,15 @@ var PodOS = class {
58554
58564
  * @param webId
58555
58565
  */
58556
58566
  async buildSearchIndex(profile2) {
58557
- const labelIndexUri = profile2.getPrivateLabelIndex();
58558
- const indexes = [];
58559
- if (labelIndexUri) {
58560
- await this.fetch(labelIndexUri);
58561
- const labelIndex = this.store.get(labelIndexUri).assume(LabelIndex);
58562
- indexes.push(labelIndex);
58563
- }
58564
- return new SearchIndex(indexes);
58567
+ const labelIndexUris = profile2.getPrivateLabelIndexes();
58568
+ if (labelIndexUris.length > 0) {
58569
+ await this.fetchAll(labelIndexUris);
58570
+ const labelIndex = labelIndexUris.map(
58571
+ (uri6) => this.store.get(uri6).assume(LabelIndex)
58572
+ );
58573
+ return new SearchIndex(labelIndex);
58574
+ }
58575
+ return new SearchIndex([]);
58565
58576
  }
58566
58577
  logout() {
58567
58578
  return this.session.logout();
package/lib/index.js CHANGED
@@ -46455,27 +46455,26 @@ var PodOS = (() => {
46455
46455
  );
46456
46456
  }
46457
46457
  /**
46458
- * Returns the URI of a private label index
46458
+ * Returns the URIs of the private label indexes
46459
46459
  */
46460
- getPrivateLabelIndex() {
46461
- const index2 = this.store.anyValue(
46460
+ getPrivateLabelIndexes() {
46461
+ const profileNodes = this.store.each(
46462
46462
  namedNode2(this.webId),
46463
46463
  namedNode2("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
46464
46464
  void 0,
46465
46465
  namedNode2(this.webId).doc()
46466
46466
  );
46467
- if (index2) {
46468
- return index2;
46467
+ const preferences = this.getPreferencesFile();
46468
+ if (preferences) {
46469
+ const preferencesNodes = this.store.each(
46470
+ namedNode2(this.webId),
46471
+ namedNode2("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
46472
+ void 0,
46473
+ namedNode2(preferences)
46474
+ );
46475
+ return [...profileNodes, ...preferencesNodes].map((it) => it.value);
46469
46476
  } else {
46470
- const preferences = this.getPreferencesFile();
46471
- if (preferences) {
46472
- return this.store.anyValue(
46473
- namedNode2(this.webId),
46474
- namedNode2("http://www.w3.org/ns/solid/terms#privateLabelIndex"),
46475
- void 0,
46476
- namedNode2(preferences)
46477
- );
46478
- }
46477
+ return profileNodes.map((it) => it.value);
46479
46478
  }
46480
46479
  }
46481
46480
  };
@@ -46600,6 +46599,14 @@ var PodOS = (() => {
46600
46599
  credentials: "omit"
46601
46600
  });
46602
46601
  }
46602
+ /**
46603
+ * Fetch all the given URIs in parallel and put the data to the store
46604
+ * @param uris
46605
+ */
46606
+ fetchAll(uris) {
46607
+ const responses = uris.map((uri6) => this.fetch(uri6));
46608
+ return Promise.allSettled(responses);
46609
+ }
46603
46610
  /**
46604
46611
  * Retrieve the thing identified by the given URI from the store
46605
46612
  * @param uri
@@ -67014,6 +67021,9 @@ var PodOS = (() => {
67014
67021
  fetch(uri6) {
67015
67022
  return this.store.fetch(uri6);
67016
67023
  }
67024
+ fetchAll(uris) {
67025
+ return this.store.fetchAll(uris);
67026
+ }
67017
67027
  fetchFile(url7) {
67018
67028
  return this.fileFetcher.fetchFile(url7);
67019
67029
  }
@@ -67053,14 +67063,15 @@ var PodOS = (() => {
67053
67063
  * @param webId
67054
67064
  */
67055
67065
  async buildSearchIndex(profile2) {
67056
- const labelIndexUri = profile2.getPrivateLabelIndex();
67057
- const indexes = [];
67058
- if (labelIndexUri) {
67059
- await this.fetch(labelIndexUri);
67060
- const labelIndex = this.store.get(labelIndexUri).assume(LabelIndex);
67061
- indexes.push(labelIndex);
67062
- }
67063
- return new SearchIndex(indexes);
67066
+ const labelIndexUris = profile2.getPrivateLabelIndexes();
67067
+ if (labelIndexUris.length > 0) {
67068
+ await this.fetchAll(labelIndexUris);
67069
+ const labelIndex = labelIndexUris.map(
67070
+ (uri6) => this.store.get(uri6).assume(LabelIndex)
67071
+ );
67072
+ return new SearchIndex(labelIndex);
67073
+ }
67074
+ return new SearchIndex([]);
67064
67075
  }
67065
67076
  logout() {
67066
67077
  return this.session.logout();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.10.1-68c4495.0",
3
+ "version": "0.11.1-2de5854.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
package/types/Store.d.ts CHANGED
@@ -15,6 +15,11 @@ export declare class Store {
15
15
  * @param uri
16
16
  */
17
17
  fetch(uri: string): Promise<Response>;
18
+ /**
19
+ * Fetch all the given URIs in parallel and put the data to the store
20
+ * @param uris
21
+ */
22
+ fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
18
23
  /**
19
24
  * Retrieve the thing identified by the given URI from the store
20
25
  * @param uri
package/types/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export declare class PodOS {
21
21
  constructor();
22
22
  handleIncomingRedirect(): void;
23
23
  fetch(uri: string): Promise<Response>;
24
+ fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
24
25
  fetchFile(url: string): Promise<SolidFile>;
25
26
  addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
26
27
  listKnownTerms(): Term[];
@@ -13,7 +13,7 @@ export declare class WebIdProfile extends Thing {
13
13
  */
14
14
  getPreferencesFile(): string | void;
15
15
  /**
16
- * Returns the URI of a private label index
16
+ * Returns the URIs of the private label indexes
17
17
  */
18
- getPrivateLabelIndex(): string | void;
18
+ getPrivateLabelIndexes(): string[];
19
19
  }