@pod-os/core 0.31.0-rc.ecee84c.0 → 0.31.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 +4118 -1888
- package/lib/index.js +4458 -2228
- package/package.json +10 -10
- package/types/Store.d.ts +8 -3
- package/types/Store.spec.d.ts +2 -2
- package/types/index.d.ts +2 -2
- package/types/namespaces/index.d.ts +4 -0
- package/types/test-support/expectRequests.d.ts +8 -0
- package/types/test-support/index.d.ts +2 -0
- package/types/test-support/mockResponses.d.ts +24 -0
- package/types/test-support/mockResponses.spec.d.ts +1 -0
- package/types/thing/Thing.d.ts +2 -0
- package/types/thing/Thing.rdfDocument.spec.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/core",
|
|
3
3
|
"description": "Core module of PodOS",
|
|
4
|
-
"version": "0.31.0
|
|
4
|
+
"version": "0.31.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"node": ">=18.0.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"test": "
|
|
25
|
-
"test:watch": "
|
|
24
|
+
"test": "vitest --watch=false",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
26
|
"typecheck": "tsc --noEmit",
|
|
27
27
|
"lint": "eslint ./src",
|
|
28
28
|
"build:bundle": "rimraf lib && node esbuild/build-bundle.mjs",
|
|
@@ -43,14 +43,12 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@babel/preset-env": "^7.29.5",
|
|
45
45
|
"@babel/preset-typescript": "^7.28.5",
|
|
46
|
-
"@eslint/js": "^
|
|
46
|
+
"@eslint/js": "^10.0.0",
|
|
47
47
|
"@types/jest": "^30.0.0",
|
|
48
48
|
"@types/jest-when": "^3.5.5",
|
|
49
49
|
"@types/sparqljs": "^3.1.12",
|
|
50
50
|
"esbuild": "^0.28.0",
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"jest": "^30.4.0",
|
|
53
|
-
"jest-when": "^4.0.3",
|
|
51
|
+
"eslint": "^10.0.0",
|
|
54
52
|
"npm-run-all": "^4.1.5",
|
|
55
53
|
"prettier": "^3.8.3",
|
|
56
54
|
"rimraf": "^6.1.3",
|
|
@@ -58,7 +56,9 @@
|
|
|
58
56
|
"typedoc": "^0.28.19",
|
|
59
57
|
"typedoc-plugin-markdown": "^4.11.0",
|
|
60
58
|
"typescript": "^6.0.3",
|
|
61
|
-
"typescript-eslint": "^8.59.
|
|
59
|
+
"typescript-eslint": "^8.59.4",
|
|
60
|
+
"vitest": "^4.1.8",
|
|
61
|
+
"vitest-when": "^0.10.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@solid-data-modules/rdflib-utils": "^0.6.0",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"lunr": "^2.3.9",
|
|
68
68
|
"mime": "^4.1.0",
|
|
69
69
|
"neverthrow": "^8.2.0",
|
|
70
|
-
"rdf-namespaces": "^1.
|
|
71
|
-
"rdflib": "2.
|
|
70
|
+
"rdf-namespaces": "^1.17.0",
|
|
71
|
+
"rdflib": "2.4.0",
|
|
72
72
|
"rxjs": "^7.8.2",
|
|
73
73
|
"slugify": "^1.6.9",
|
|
74
74
|
"url": "^0.11.4",
|
package/types/Store.d.ts
CHANGED
|
@@ -16,16 +16,19 @@ export declare class Store {
|
|
|
16
16
|
removals$: Subject<Quad>;
|
|
17
17
|
private readonly internalStore;
|
|
18
18
|
constructor(session: PodOsSession, offlineCache?: OfflineCache, onlineStatus?: OnlineStatus, internalStore?: IndexedFormula);
|
|
19
|
+
readonly DESCRIBEDBY: import("rdflib/lib/tf-types").NamedNode;
|
|
19
20
|
/**
|
|
20
|
-
* Fetch data for the given URI to the internalStore
|
|
21
|
+
* Fetch data for the given URI to the internalStore.
|
|
22
|
+
* If the response includes a Link header with rel="describedby",
|
|
23
|
+
* the metadata document will also be fetched automatically.
|
|
21
24
|
* @param uri
|
|
22
25
|
*/
|
|
23
|
-
fetch(uri: string): Promise<
|
|
26
|
+
fetch(uri: string): Promise<void>;
|
|
24
27
|
/**
|
|
25
28
|
* Fetch all the given URIs in parallel and put the data to the internalStore
|
|
26
29
|
* @param uris
|
|
27
30
|
*/
|
|
28
|
-
fetchAll(uris: string[]): Promise<PromiseSettledResult<
|
|
31
|
+
fetchAll(uris: string[]): Promise<PromiseSettledResult<void>[]>;
|
|
29
32
|
/**
|
|
30
33
|
* Retrieve the thing identified by the given URI from the internalStore
|
|
31
34
|
* @param uri
|
|
@@ -38,6 +41,7 @@ export declare class Store {
|
|
|
38
41
|
* @param value
|
|
39
42
|
*/
|
|
40
43
|
addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
|
|
44
|
+
private insert;
|
|
41
45
|
/**
|
|
42
46
|
* Adds a new relation (link) from the thing to the given uri using the property
|
|
43
47
|
* @param thing
|
|
@@ -45,6 +49,7 @@ export declare class Store {
|
|
|
45
49
|
* @param uri
|
|
46
50
|
*/
|
|
47
51
|
addRelation(thing: Thing, property: string, uri: string): Promise<void>;
|
|
52
|
+
private determineDocumentToUpdate;
|
|
48
53
|
addNewThing(uri: string, name: string, type: string): Promise<void>;
|
|
49
54
|
executeUpdate(operation: UpdateOperation): Promise<void>;
|
|
50
55
|
flagAuthorizationMetadata(): void;
|
package/types/Store.spec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function thenSparqlUpdateIsSentToUrl(fetchMock:
|
|
1
|
+
import { Mock } from "vitest";
|
|
2
|
+
export declare function thenSparqlUpdateIsSentToUrl(fetchMock: Mock, url: string, query: string): void;
|
package/types/index.d.ts
CHANGED
|
@@ -48,8 +48,8 @@ export declare class PodOS {
|
|
|
48
48
|
private readonly profileGateway;
|
|
49
49
|
constructor({ session, offlineCache, onlineStatus, internalStore, }?: PodOsConfiguration);
|
|
50
50
|
private flagAuthorizationMetaDataOnSessionChange;
|
|
51
|
-
fetch(uri: string): Promise<
|
|
52
|
-
fetchAll(uris: string[]): Promise<PromiseSettledResult<
|
|
51
|
+
fetch(uri: string): Promise<void>;
|
|
52
|
+
fetchAll(uris: string[]): Promise<PromiseSettledResult<void>[]>;
|
|
53
53
|
/**
|
|
54
54
|
* @deprecated Use {@link FileFetcher.fetchFile} via {@link PodOS.files} instead
|
|
55
55
|
* @param {string} url - URL identifying the file
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { NamedNode } from "rdflib";
|
|
1
2
|
export declare const rdfs: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
|
|
2
3
|
export declare const pim: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
|
|
3
4
|
export declare const schema: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
|
|
4
5
|
export declare const flow: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
|
|
6
|
+
export declare const iana: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
|
|
7
|
+
export declare const link: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
|
|
8
|
+
export declare const internal: () => NamedNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Mock } from "vitest";
|
|
2
|
+
/**
|
|
3
|
+
* Expect that a PATCH request has been performed
|
|
4
|
+
* @param authenticatedFetch - A mocked fetch function
|
|
5
|
+
* @param url - The expected URL to PATCH
|
|
6
|
+
* @param expectedBody - The expected request body
|
|
7
|
+
*/
|
|
8
|
+
export declare function expectPatchRequest(authenticatedFetch: Mock, url: string, expectedBody: string): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Mock } from "vitest";
|
|
2
|
+
/**
|
|
3
|
+
* Mock a turtle document at the given URL
|
|
4
|
+
* @param fetch - A mocked fetch function
|
|
5
|
+
* @param url - The URL to mock
|
|
6
|
+
* @param ttl - The mocked turtle file content
|
|
7
|
+
* @param additionalHeaders - Additional headers to include in the response
|
|
8
|
+
*/
|
|
9
|
+
export declare function mockTurtleDocument(fetch: Mock, url: string, ttl: string, additionalHeaders?: Record<string, string>): void;
|
|
10
|
+
/**
|
|
11
|
+
* Mock a LDP container at the given URL
|
|
12
|
+
* @param fetch - A mocked fetch function
|
|
13
|
+
* @param url - The URL to mock
|
|
14
|
+
* @param contains - List of URLs of documents contained in this container
|
|
15
|
+
* @param moreTurtle - Additional turtle to include into the response
|
|
16
|
+
* @param additionalHeaders - Additional headers to include in the response
|
|
17
|
+
*/
|
|
18
|
+
export declare function mockLdpContainer(fetch: Mock, url: string, contains?: string[], moreTurtle?: string, additionalHeaders?: Record<string, string>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Mock a 404 - Not Found response for the given URL
|
|
21
|
+
* @param fetch - A mocked fetch function
|
|
22
|
+
* @param url - The URL to mock
|
|
23
|
+
*/
|
|
24
|
+
export declare function mockNotFound(fetch: Mock, url: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/thing/Thing.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|