@pod-os/core 0.7.1-497f3ef.0 → 0.7.1-5e652ae.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.7.1-497f3ef.0",
3
+ "version": "0.7.1-5e652ae.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
@@ -25,23 +25,27 @@
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
27
  "@babel/preset-env": "^7.20.2",
28
- "@babel/preset-typescript": "^7.18.6",
29
- "@types/jest": "^29.2.5",
28
+ "@babel/preset-typescript": "^7.21.0",
29
+ "@types/jest": "^29.5.0",
30
30
  "@types/jest-when": "^3.5.2",
31
- "@typescript-eslint/eslint-plugin": "^5.48.1",
32
- "@typescript-eslint/parser": "^5.48.1",
33
- "esbuild": "^0.16.16",
34
- "eslint": "^8.31.0",
35
- "jest": "^29.3.1",
31
+ "@types/sparqljs": "^3.1.3",
32
+ "@typescript-eslint/eslint-plugin": "^5.56.0",
33
+ "@typescript-eslint/parser": "^5.56.0",
34
+ "esbuild": "^0.16.17",
35
+ "eslint": "^8.36.0",
36
+ "jest": "^29.5.0",
36
37
  "jest-when": "^3.5.2",
37
- "prettier": "^2.8.2",
38
+ "prettier": "^2.8.6",
39
+ "rdf-namespaces": "^1.10.1",
38
40
  "rimraf": "^3.0.2",
39
- "typescript": "^4.9.4"
41
+ "sparqljs": "^3.6.2",
42
+ "typescript": "^4.9.5"
40
43
  },
41
44
  "dependencies": {
42
- "@inrupt/solid-client-authn-browser": "^1.12.4",
45
+ "@inrupt/solid-client-authn-browser": "^1.13.4",
43
46
  "buffer": "^6.0.3",
44
- "rdflib": "^2.2.21"
47
+ "rdflib": "^2.2.31",
48
+ "url": "^0.11.0"
45
49
  },
46
50
  "directories": {
47
51
  "lib": "lib"
package/types/Store.d.ts CHANGED
@@ -1,10 +1,30 @@
1
- import { Fetcher, IndexedFormula } from "rdflib";
1
+ import { Fetcher, IndexedFormula, UpdateManager } from "rdflib";
2
2
  import { PodOsSession } from "./authentication";
3
3
  import { Thing } from "./thing";
4
+ /**
5
+ * The store contains all data that is known locally.
6
+ * It can be used to fetch additional data from the web and also update data and sync it back to editable resources.
7
+ */
4
8
  export declare class Store {
5
9
  fetcher: Fetcher;
10
+ updater: UpdateManager;
6
11
  graph: IndexedFormula;
7
12
  constructor(session: PodOsSession);
13
+ /**
14
+ * Fetch data for the given URI to the store
15
+ * @param uri
16
+ */
8
17
  fetch(uri: string): Promise<Response>;
18
+ /**
19
+ * Retrieve the thing identified by the given URI from the store
20
+ * @param uri
21
+ */
9
22
  get(uri: string): Thing;
23
+ /**
24
+ * Adds a new value to the property of the given thing
25
+ * @param thing
26
+ * @param property
27
+ * @param value
28
+ */
29
+ addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
10
30
  }
@@ -1 +1,3 @@
1
- export {};
1
+ /// <reference types="jest" />
2
+ import { AuthenticatedFetch } from "./authentication";
3
+ export declare function thenSparqlUpdateIsSentToUrl(fetchMock: jest.Mock<AuthenticatedFetch>, url: string, query: string): void;
package/types/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { ISessionInfo } from "@inrupt/solid-client-authn-browser";
2
2
  import { SolidFile } from "./files";
3
3
  import { Store } from "./Store";
4
+ import { Term } from "./terms";
5
+ import { Thing } from "./thing";
4
6
  export * from "./authentication";
5
7
  export * from "./files";
6
8
  export * from "./thing";
@@ -14,6 +16,8 @@ export declare class PodOS {
14
16
  handleIncomingRedirect(): void;
15
17
  fetch(uri: string): Promise<Response>;
16
18
  fetchFile(url: string): Promise<SolidFile>;
19
+ addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
20
+ listKnownTerms(): Term[];
17
21
  trackSession(callback: (session: ISessionInfo) => unknown): void;
18
22
  logout(): Promise<void>;
19
23
  login(oidcIssuer?: string): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -7,6 +7,7 @@ export interface ContainerContent {
7
7
  export declare class LdpContainer extends Thing {
8
8
  readonly uri: string;
9
9
  readonly store: IndexedFormula;
10
- constructor(uri: string, store: IndexedFormula);
10
+ readonly editable: boolean;
11
+ constructor(uri: string, store: IndexedFormula, editable?: boolean);
11
12
  contains(): ContainerContent[];
12
13
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -6,7 +6,8 @@ export interface Subject {
6
6
  export declare class RdfDocument extends Thing {
7
7
  readonly uri: string;
8
8
  readonly store: IndexedFormula;
9
- constructor(uri: string, store: IndexedFormula);
9
+ readonly editable: boolean;
10
+ constructor(uri: string, store: IndexedFormula, editable?: boolean);
10
11
  subjects(): {
11
12
  uri: string;
12
13
  }[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Represents a term from a RDF vocabulary
3
+ */
4
+ export interface Term {
5
+ /**
6
+ * Full URI of the term, e.g. http://xmlns.com/foaf/0.1/name
7
+ */
8
+ uri: string;
9
+ /**
10
+ * Shorthand syntax of the term, using a well-known prefix, e.g. foaf:name
11
+ */
12
+ shorthand: string;
13
+ }
@@ -0,0 +1,8 @@
1
+ export declare const createListOfTerms: (terms: {
2
+ [prefix: string]: {
3
+ [name: string]: string;
4
+ };
5
+ }) => {
6
+ uri: string;
7
+ shorthand: string;
8
+ }[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./Term";
2
+ export * from "./listKnownTerms";
@@ -0,0 +1,5 @@
1
+ import { Term } from "./Term";
2
+ /**
3
+ * Returns a list of terms from commonly used and well-known RDF vocabularies
4
+ */
5
+ export declare function listKnownTerms(): Term[];
@@ -0,0 +1 @@
1
+ export {};
@@ -14,7 +14,15 @@ export interface RdfType {
14
14
  export declare class Thing {
15
15
  readonly uri: string;
16
16
  readonly store: IndexedFormula;
17
- constructor(uri: string, store: IndexedFormula);
17
+ /**
18
+ * Whether the Thing can be edited according to its access control settings
19
+ */
20
+ readonly editable: boolean;
21
+ constructor(uri: string, store: IndexedFormula,
22
+ /**
23
+ * Whether the Thing can be edited according to its access control settings
24
+ */
25
+ editable?: boolean);
18
26
  label(): string;
19
27
  literals(): Literal[];
20
28
  relations(): Relation[];
@@ -26,5 +34,5 @@ export declare class Thing {
26
34
  } | null;
27
35
  private findActivityStreamsPicture;
28
36
  types(): RdfType[];
29
- assume<T>(SpecificThing: new (uri: string, store: IndexedFormula) => T): T;
37
+ assume<T>(SpecificThing: new (uri: string, store: IndexedFormula, editable: boolean) => T): T;
30
38
  }