@pod-os/core 0.3.0 → 0.3.1-e5ac107.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
@@ -25589,6 +25589,9 @@ function isQuad(obj) {
25589
25589
  function isNamedNode(obj) {
25590
25590
  return isTerm(obj) && obj.termType === "NamedNode";
25591
25591
  }
25592
+ function isBlankNode(obj) {
25593
+ return isTerm(obj) && "termType" in obj && obj.termType === "BlankNode";
25594
+ }
25592
25595
  function isSubject(obj) {
25593
25596
  return isTerm(obj) && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType || obj.termType === BlankNodeTermType);
25594
25597
  }
@@ -37848,6 +37851,47 @@ var Thing = class {
37848
37851
  "http://www.w3.org/2006/vcard/ns#note"
37849
37852
  );
37850
37853
  }
37854
+ picture() {
37855
+ const directUrl = this.anyValue(
37856
+ "http://schema.org/image",
37857
+ "https://schema.org/image",
37858
+ "http://schema.org/logo",
37859
+ "https://schema.org/logo",
37860
+ "http://www.w3.org/2006/vcard/ns#hasPhoto",
37861
+ "http://www.w3.org/2006/vcard/ns#photo",
37862
+ "http://www.w3.org/2006/vcard/ns#hasLogo",
37863
+ "http://www.w3.org/2006/vcard/ns#logo",
37864
+ "http://xmlns.com/foaf/0.1/img",
37865
+ "http://xmlns.com/foaf/0.1/depiction",
37866
+ "http://xmlns.com/foaf/0.1/thumbnail"
37867
+ );
37868
+ if (directUrl) {
37869
+ return {
37870
+ url: directUrl
37871
+ };
37872
+ } else {
37873
+ return this.findActivityStreamsPicture();
37874
+ }
37875
+ }
37876
+ findActivityStreamsPicture() {
37877
+ const activityStreamsImage = this.store.any(
37878
+ namedNode3(this.uri),
37879
+ namedNode3("https://www.w3.org/ns/activitystreams#image")
37880
+ ) || this.store.any(
37881
+ namedNode3(this.uri),
37882
+ namedNode3("https://www.w3.org/ns/activitystreams#icon")
37883
+ );
37884
+ if (!activityStreamsImage || !(isBlankNode(activityStreamsImage) || isNamedNode(activityStreamsImage))) {
37885
+ return null;
37886
+ }
37887
+ const url = this.store.anyValue(
37888
+ activityStreamsImage,
37889
+ namedNode3("https://www.w3.org/ns/activitystreams#url")
37890
+ );
37891
+ return url ? {
37892
+ url
37893
+ } : null;
37894
+ }
37851
37895
  };
37852
37896
 
37853
37897
  // src/Store.ts
@@ -37895,7 +37939,8 @@ export {
37895
37939
  BrokenFile,
37896
37940
  BrowserSession,
37897
37941
  HttpStatus,
37898
- PodOS
37942
+ PodOS,
37943
+ Thing
37899
37944
  };
37900
37945
  /*!
37901
37946
  * The buffer module from node.js, for the browser.
package/lib/index.js CHANGED
@@ -25105,7 +25105,8 @@ ${newlined}
25105
25105
  BrokenFile: () => BrokenFile,
25106
25106
  BrowserSession: () => BrowserSession,
25107
25107
  HttpStatus: () => HttpStatus,
25108
- PodOS: () => PodOS
25108
+ PodOS: () => PodOS,
25109
+ Thing: () => Thing
25109
25110
  });
25110
25111
 
25111
25112
  // src/authentication/index.ts
@@ -25558,6 +25559,9 @@ ${newlined}
25558
25559
  function isNamedNode(obj) {
25559
25560
  return isTerm(obj) && obj.termType === "NamedNode";
25560
25561
  }
25562
+ function isBlankNode(obj) {
25563
+ return isTerm(obj) && "termType" in obj && obj.termType === "BlankNode";
25564
+ }
25561
25565
  function isSubject(obj) {
25562
25566
  return isTerm(obj) && (obj.termType === NamedNodeTermType || obj.termType === VariableTermType || obj.termType === BlankNodeTermType);
25563
25567
  }
@@ -37819,6 +37823,47 @@ ${newlined}
37819
37823
  "http://www.w3.org/2006/vcard/ns#note"
37820
37824
  );
37821
37825
  }
37826
+ picture() {
37827
+ const directUrl = this.anyValue(
37828
+ "http://schema.org/image",
37829
+ "https://schema.org/image",
37830
+ "http://schema.org/logo",
37831
+ "https://schema.org/logo",
37832
+ "http://www.w3.org/2006/vcard/ns#hasPhoto",
37833
+ "http://www.w3.org/2006/vcard/ns#photo",
37834
+ "http://www.w3.org/2006/vcard/ns#hasLogo",
37835
+ "http://www.w3.org/2006/vcard/ns#logo",
37836
+ "http://xmlns.com/foaf/0.1/img",
37837
+ "http://xmlns.com/foaf/0.1/depiction",
37838
+ "http://xmlns.com/foaf/0.1/thumbnail"
37839
+ );
37840
+ if (directUrl) {
37841
+ return {
37842
+ url: directUrl
37843
+ };
37844
+ } else {
37845
+ return this.findActivityStreamsPicture();
37846
+ }
37847
+ }
37848
+ findActivityStreamsPicture() {
37849
+ const activityStreamsImage = this.store.any(
37850
+ namedNode3(this.uri),
37851
+ namedNode3("https://www.w3.org/ns/activitystreams#image")
37852
+ ) || this.store.any(
37853
+ namedNode3(this.uri),
37854
+ namedNode3("https://www.w3.org/ns/activitystreams#icon")
37855
+ );
37856
+ if (!activityStreamsImage || !(isBlankNode(activityStreamsImage) || isNamedNode(activityStreamsImage))) {
37857
+ return null;
37858
+ }
37859
+ const url = this.store.anyValue(
37860
+ activityStreamsImage,
37861
+ namedNode3("https://www.w3.org/ns/activitystreams#url")
37862
+ );
37863
+ return url ? {
37864
+ url
37865
+ } : null;
37866
+ }
37822
37867
  };
37823
37868
 
37824
37869
  // src/Store.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1-e5ac107.0",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { SolidFile } from "./files";
3
3
  import { Store } from "./Store";
4
4
  export * from "./authentication";
5
5
  export * from "./files";
6
+ export * from "./thing";
6
7
  export declare class PodOS {
7
8
  private readonly session;
8
9
  readonly store: Store;
@@ -18,4 +18,8 @@ export declare class Thing {
18
18
  }[];
19
19
  anyValue(...predicateUris: string[]): undefined;
20
20
  description(): undefined;
21
+ picture(): {
22
+ url: string;
23
+ } | null;
24
+ private findActivityStreamsPicture;
21
25
  }
@@ -0,0 +1 @@
1
+ export {};