@pod-os/core 0.18.1-rc.54389d8.0 → 0.18.1-rc.8722696.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
@@ -2821,6 +2821,12 @@ var Thing = class {
2821
2821
  this.store = store;
2822
2822
  this.editable = editable;
2823
2823
  }
2824
+ /**
2825
+ * Returns a human-readable label for this thing. Tries to match common RDF terms
2826
+ * used for labels, such as `rdfs:label`, `schema:name` and others.
2827
+ *
2828
+ * If no such term is present, it will derive a label from the URI.
2829
+ */
2824
2830
  label() {
2825
2831
  const value7 = this.anyValue(
2826
2832
  "http://www.w3.org/2006/vcard/ns#fn",
@@ -2840,6 +2846,9 @@ var Thing = class {
2840
2846
  }
2841
2847
  return labelFromUri(this.uri);
2842
2848
  }
2849
+ /**
2850
+ * Returns all the literal values that are linked to this thing
2851
+ */
2843
2852
  literals() {
2844
2853
  const statements = this.store.statementsMatching(namedNode(this.uri));
2845
2854
  const values2 = statements.filter((it) => isLiteral(it.object)).reduce(accumulateValues, {});
@@ -2849,6 +2858,9 @@ var Thing = class {
2849
2858
  values: values2[predicate4]
2850
2859
  }));
2851
2860
  }
2861
+ /**
2862
+ * Returns all the links from this thing to other resources
2863
+ */
2852
2864
  relations(predicate4) {
2853
2865
  const statements = this.store.statementsMatching(
2854
2866
  namedNode(this.uri),
@@ -2861,6 +2873,9 @@ var Thing = class {
2861
2873
  uris: values2[predicate5]
2862
2874
  }));
2863
2875
  }
2876
+ /**
2877
+ * Returns all the links from other resources to this thing
2878
+ */
2864
2879
  reverseRelations(predicate4) {
2865
2880
  const statements = this.store.statementsMatching(
2866
2881
  void 0,
@@ -2874,6 +2889,10 @@ var Thing = class {
2874
2889
  uris: values2[predicate5]
2875
2890
  }));
2876
2891
  }
2892
+ /**
2893
+ * Returns any value linked from this thing via one of the given predicates
2894
+ * @param predicateUris
2895
+ */
2877
2896
  anyValue(...predicateUris) {
2878
2897
  let value7;
2879
2898
  predicateUris.some((it) => {
@@ -2882,6 +2901,10 @@ var Thing = class {
2882
2901
  });
2883
2902
  return value7;
2884
2903
  }
2904
+ /**
2905
+ * Returns a literal value that describes this thing. Tries to match common RDF terms
2906
+ * used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
2907
+ */
2885
2908
  description() {
2886
2909
  return this.anyValue(
2887
2910
  "http://purl.org/dc/terms/description",
@@ -2895,6 +2918,13 @@ var Thing = class {
2895
2918
  "http://www.w3.org/2006/vcard/ns#note"
2896
2919
  );
2897
2920
  }
2921
+ /**
2922
+ * Returns the url of a picture or logo associated with this thing
2923
+ * Tries to match common RDF terms used for pictures like `schema:image`,
2924
+ * `vcard:photo` or `foaf:img`
2925
+ *
2926
+ * @return {Object} An object containing the `url` of the picture
2927
+ */
2898
2928
  picture() {
2899
2929
  const directUrl = this.anyValue(
2900
2930
  "http://schema.org/image",
@@ -2936,6 +2966,9 @@ var Thing = class {
2936
2966
  url: url7
2937
2967
  } : null;
2938
2968
  }
2969
+ /**
2970
+ * Retrieves a list of RDF types for this thing.
2971
+ */
2939
2972
  types() {
2940
2973
  const uriMap = this.store.findTypeURIs(namedNode(this.uri));
2941
2974
  return Object.keys(uriMap).map((uri6) => ({
@@ -2943,6 +2976,11 @@ var Thing = class {
2943
2976
  label: labelForType(uri6)
2944
2977
  }));
2945
2978
  }
2979
+ /**
2980
+ * Call this method to switch to a more specific subclass of Thing.
2981
+ *
2982
+ * @param SpecificThing - a subclass of Thing to assume
2983
+ */
2946
2984
  assume(SpecificThing) {
2947
2985
  return new SpecificThing(this.uri, this.store, this.editable);
2948
2986
  }
@@ -3175,7 +3213,7 @@ var SearchGateway = class {
3175
3213
  }
3176
3214
  /**
3177
3215
  * Fetch the private label index for the given profile and build a search index from it
3178
- * @param webId
3216
+ * @param profile
3179
3217
  */
3180
3218
  async buildSearchIndex(profile2) {
3181
3219
  const labelIndexUris = profile2.getPrivateLabelIndexes();
@@ -24836,7 +24874,7 @@ var PodOS = class {
24836
24874
  }
24837
24875
  /**
24838
24876
  * Fetch the private label index for the given profile and build a search index from it
24839
- * @param webId
24877
+ * @param profile
24840
24878
  */
24841
24879
  async buildSearchIndex(profile2) {
24842
24880
  return this.searchGateway.buildSearchIndex(profile2);
@@ -24883,7 +24921,9 @@ export {
24883
24921
  RdfDocument,
24884
24922
  SearchGateway,
24885
24923
  SearchIndex,
24924
+ Store,
24886
24925
  Thing,
24926
+ UriService,
24887
24927
  WebIdProfile,
24888
24928
  labelFromUri,
24889
24929
  listKnownTerms
package/lib/index.js CHANGED
@@ -34756,7 +34756,9 @@ _:patch
34756
34756
  RdfDocument: () => RdfDocument,
34757
34757
  SearchGateway: () => SearchGateway,
34758
34758
  SearchIndex: () => SearchIndex,
34759
+ Store: () => Store,
34759
34760
  Thing: () => Thing,
34761
+ UriService: () => UriService,
34760
34762
  WebIdProfile: () => WebIdProfile,
34761
34763
  labelFromUri: () => labelFromUri,
34762
34764
  listKnownTerms: () => listKnownTerms
@@ -35789,6 +35791,12 @@ _:patch
35789
35791
  this.store = store;
35790
35792
  this.editable = editable;
35791
35793
  }
35794
+ /**
35795
+ * Returns a human-readable label for this thing. Tries to match common RDF terms
35796
+ * used for labels, such as `rdfs:label`, `schema:name` and others.
35797
+ *
35798
+ * If no such term is present, it will derive a label from the URI.
35799
+ */
35792
35800
  label() {
35793
35801
  const value7 = this.anyValue(
35794
35802
  "http://www.w3.org/2006/vcard/ns#fn",
@@ -35808,6 +35816,9 @@ _:patch
35808
35816
  }
35809
35817
  return labelFromUri(this.uri);
35810
35818
  }
35819
+ /**
35820
+ * Returns all the literal values that are linked to this thing
35821
+ */
35811
35822
  literals() {
35812
35823
  const statements = this.store.statementsMatching(namedNode(this.uri));
35813
35824
  const values2 = statements.filter((it) => isLiteral(it.object)).reduce(accumulateValues, {});
@@ -35817,6 +35828,9 @@ _:patch
35817
35828
  values: values2[predicate4]
35818
35829
  }));
35819
35830
  }
35831
+ /**
35832
+ * Returns all the links from this thing to other resources
35833
+ */
35820
35834
  relations(predicate4) {
35821
35835
  const statements = this.store.statementsMatching(
35822
35836
  namedNode(this.uri),
@@ -35829,6 +35843,9 @@ _:patch
35829
35843
  uris: values2[predicate5]
35830
35844
  }));
35831
35845
  }
35846
+ /**
35847
+ * Returns all the links from other resources to this thing
35848
+ */
35832
35849
  reverseRelations(predicate4) {
35833
35850
  const statements = this.store.statementsMatching(
35834
35851
  void 0,
@@ -35842,6 +35859,10 @@ _:patch
35842
35859
  uris: values2[predicate5]
35843
35860
  }));
35844
35861
  }
35862
+ /**
35863
+ * Returns any value linked from this thing via one of the given predicates
35864
+ * @param predicateUris
35865
+ */
35845
35866
  anyValue(...predicateUris) {
35846
35867
  let value7;
35847
35868
  predicateUris.some((it) => {
@@ -35850,6 +35871,10 @@ _:patch
35850
35871
  });
35851
35872
  return value7;
35852
35873
  }
35874
+ /**
35875
+ * Returns a literal value that describes this thing. Tries to match common RDF terms
35876
+ * used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
35877
+ */
35853
35878
  description() {
35854
35879
  return this.anyValue(
35855
35880
  "http://purl.org/dc/terms/description",
@@ -35863,6 +35888,13 @@ _:patch
35863
35888
  "http://www.w3.org/2006/vcard/ns#note"
35864
35889
  );
35865
35890
  }
35891
+ /**
35892
+ * Returns the url of a picture or logo associated with this thing
35893
+ * Tries to match common RDF terms used for pictures like `schema:image`,
35894
+ * `vcard:photo` or `foaf:img`
35895
+ *
35896
+ * @return {Object} An object containing the `url` of the picture
35897
+ */
35866
35898
  picture() {
35867
35899
  const directUrl = this.anyValue(
35868
35900
  "http://schema.org/image",
@@ -35904,6 +35936,9 @@ _:patch
35904
35936
  url: url7
35905
35937
  } : null;
35906
35938
  }
35939
+ /**
35940
+ * Retrieves a list of RDF types for this thing.
35941
+ */
35907
35942
  types() {
35908
35943
  const uriMap = this.store.findTypeURIs(namedNode(this.uri));
35909
35944
  return Object.keys(uriMap).map((uri6) => ({
@@ -35911,6 +35946,11 @@ _:patch
35911
35946
  label: labelForType(uri6)
35912
35947
  }));
35913
35948
  }
35949
+ /**
35950
+ * Call this method to switch to a more specific subclass of Thing.
35951
+ *
35952
+ * @param SpecificThing - a subclass of Thing to assume
35953
+ */
35914
35954
  assume(SpecificThing) {
35915
35955
  return new SpecificThing(this.uri, this.store, this.editable);
35916
35956
  }
@@ -36153,7 +36193,7 @@ _:patch
36153
36193
  }
36154
36194
  /**
36155
36195
  * Fetch the private label index for the given profile and build a search index from it
36156
- * @param webId
36196
+ * @param profile
36157
36197
  */
36158
36198
  async buildSearchIndex(profile2) {
36159
36199
  const labelIndexUris = profile2.getPrivateLabelIndexes();
@@ -57819,7 +57859,7 @@ _:patch
57819
57859
  }
57820
57860
  /**
57821
57861
  * Fetch the private label index for the given profile and build a search index from it
57822
- * @param webId
57862
+ * @param profile
57823
57863
  */
57824
57864
  async buildSearchIndex(profile2) {
57825
57865
  return this.searchGateway.buildSearchIndex(profile2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.18.1-rc.54389d8.0",
3
+ "version": "0.18.1-rc.8722696.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
package/types/Store.d.ts CHANGED
@@ -39,7 +39,6 @@ export declare class Store {
39
39
  flagAuthorizationMetadata(): void;
40
40
  loadModule<T>(module: PodOsModule<T>): T;
41
41
  }
42
- interface PodOsModule<T> {
42
+ export interface PodOsModule<T> {
43
43
  readonly default: new (config: ModuleConfig) => T;
44
44
  }
45
- export {};
package/types/index.d.ts CHANGED
@@ -19,6 +19,8 @@ export * from "./profile";
19
19
  export * from "./search";
20
20
  export * from "./offline-cache";
21
21
  export * from "./terms";
22
+ export * from "./Store";
23
+ export * from "./uri";
22
24
  export interface PodOsConfiguration {
23
25
  offlineCache?: OfflineCache;
24
26
  onlineStatus?: OnlineStatus;
@@ -52,7 +54,7 @@ export declare class PodOS {
52
54
  fetchProfile(webId: string): Promise<WebIdProfile>;
53
55
  /**
54
56
  * Fetch the private label index for the given profile and build a search index from it
55
- * @param webId
57
+ * @param profile
56
58
  */
57
59
  buildSearchIndex(profile: WebIdProfile): Promise<import("./search").SearchIndex>;
58
60
  logout(): Promise<void>;
@@ -1,3 +1,3 @@
1
- export { OfflineCapableFetcher } from "./OfflineCapableFetcher";
1
+ export { OfflineCapableFetcher, OfflineCapableFetcherOptions, } from "./OfflineCapableFetcher";
2
2
  export { OfflineCache, CachedRdfDocument, NoOfflineCache, } from "./OfflineCache";
3
3
  export { OnlineStatus, AssumeAlwaysOnline } from "./OnlineStatus";
@@ -8,7 +8,7 @@ export declare class SearchGateway {
8
8
  constructor(store: Store);
9
9
  /**
10
10
  * Fetch the private label index for the given profile and build a search index from it
11
- * @param webId
11
+ * @param profile
12
12
  */
13
13
  buildSearchIndex(profile: WebIdProfile): Promise<SearchIndex>;
14
14
  addToLabelIndex(thing: Thing, labelIndex: LabelIndex): Promise<void>;
@@ -25,16 +25,54 @@ export declare class Thing {
25
25
  * Whether the Thing can be edited according to its access control settings
26
26
  */
27
27
  editable?: boolean);
28
+ /**
29
+ * Returns a human-readable label for this thing. Tries to match common RDF terms
30
+ * used for labels, such as `rdfs:label`, `schema:name` and others.
31
+ *
32
+ * If no such term is present, it will derive a label from the URI.
33
+ */
28
34
  label(): string;
35
+ /**
36
+ * Returns all the literal values that are linked to this thing
37
+ */
29
38
  literals(): Literal[];
39
+ /**
40
+ * Returns all the links from this thing to other resources
41
+ */
30
42
  relations(predicate?: string): Relation[];
43
+ /**
44
+ * Returns all the links from other resources to this thing
45
+ */
31
46
  reverseRelations(predicate?: string): Relation[];
47
+ /**
48
+ * Returns any value linked from this thing via one of the given predicates
49
+ * @param predicateUris
50
+ */
32
51
  anyValue(...predicateUris: string[]): undefined;
52
+ /**
53
+ * Returns a literal value that describes this thing. Tries to match common RDF terms
54
+ * used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
55
+ */
33
56
  description(): undefined;
57
+ /**
58
+ * Returns the url of a picture or logo associated with this thing
59
+ * Tries to match common RDF terms used for pictures like `schema:image`,
60
+ * `vcard:photo` or `foaf:img`
61
+ *
62
+ * @return {Object} An object containing the `url` of the picture
63
+ */
34
64
  picture(): {
35
65
  url: string;
36
66
  } | null;
37
67
  private findActivityStreamsPicture;
68
+ /**
69
+ * Retrieves a list of RDF types for this thing.
70
+ */
38
71
  types(): RdfType[];
72
+ /**
73
+ * Call this method to switch to a more specific subclass of Thing.
74
+ *
75
+ * @param SpecificThing - a subclass of Thing to assume
76
+ */
39
77
  assume<T>(SpecificThing: new (uri: string, store: IndexedFormula, editable: boolean) => T): T;
40
78
  }
@@ -0,0 +1 @@
1
+ export { UriService } from "./UriService";