@pod-os/core 0.17.1-rc.f4329bf.0 → 0.18.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/{chunk-VGZLO2LW.js → chunk-3LTXZPFZ.js} +14 -14
- package/dist/{dist-UG2BEWCW.js → dist-4BQLT63G.js} +1 -1
- package/dist/index.js +2660 -13393
- package/lib/index.js +30573 -41306
- package/package.json +13 -11
- package/types/Store.d.ts +16 -10
- package/types/authentication/index.d.ts +10 -14
- package/types/index.d.ts +6 -14
- package/types/thing/Thing.d.ts +1 -1
- package/types/authentication/observeSession.d.ts +0 -4
- package/types/authentication/observeSession.spec.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"build:bundle": "rimraf lib && node esbuild/build-bundle.mjs",
|
|
16
16
|
"build:esm": "rimraf dist && node esbuild/build-esm.mjs",
|
|
17
17
|
"build:types": "rimraf types && tsc --emitDeclarationOnly --outDir types",
|
|
18
|
+
"build:types:watch": "rimraf types && tsc --emitDeclarationOnly --outDir types --watch",
|
|
18
19
|
"build:watch": "node esbuild/watch-esm.mjs",
|
|
20
|
+
"dev": "run-p build:types:watch build:watch",
|
|
19
21
|
"build": " npm run build:bundle && npm run build:types && npm run build:esm"
|
|
20
22
|
},
|
|
21
23
|
"keywords": [
|
|
@@ -24,31 +26,31 @@
|
|
|
24
26
|
"author": "Angelo Veltens",
|
|
25
27
|
"license": "MIT",
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"@babel/preset-env": "^7.
|
|
29
|
+
"@babel/preset-env": "^7.28.3",
|
|
28
30
|
"@babel/preset-typescript": "^7.27.1",
|
|
29
|
-
"@eslint/js": "^9.
|
|
30
|
-
"@types/jest": "^
|
|
31
|
+
"@eslint/js": "^9.34.0",
|
|
32
|
+
"@types/jest": "^30.0.0",
|
|
31
33
|
"@types/jest-when": "^3.5.5",
|
|
32
34
|
"@types/sparqljs": "^3.1.12",
|
|
33
|
-
"esbuild": "^0.25.
|
|
34
|
-
"eslint": "^9.
|
|
35
|
-
"jest": "^
|
|
35
|
+
"esbuild": "^0.25.9",
|
|
36
|
+
"eslint": "^9.34.0",
|
|
37
|
+
"jest": "^30.1.2",
|
|
36
38
|
"jest-when": "^3.7.0",
|
|
39
|
+
"npm-run-all": "^4.1.5",
|
|
37
40
|
"prettier": "^3.6.2",
|
|
38
41
|
"rimraf": "^6.0.1",
|
|
39
42
|
"sparqljs": "^3.7.3",
|
|
40
|
-
"typescript": "5.
|
|
41
|
-
"typescript-eslint": "^8.
|
|
43
|
+
"typescript": "5.9.2",
|
|
44
|
+
"typescript-eslint": "^8.41.0"
|
|
42
45
|
},
|
|
43
46
|
"dependencies": {
|
|
44
|
-
"@inrupt/solid-client-authn-browser": "^2.3.0",
|
|
45
47
|
"@solid-data-modules/contacts-rdflib": "^0.7.0",
|
|
46
48
|
"@solid-data-modules/rdflib-utils": "^0.6.0",
|
|
47
49
|
"@types/lunr": "^2.3.7",
|
|
48
50
|
"buffer": "^6.0.3",
|
|
49
51
|
"lunr": "^2.3.9",
|
|
52
|
+
"rdf-namespaces": "^1.16.0",
|
|
50
53
|
"rdflib": "^2.2.37",
|
|
51
|
-
"rdf-namespaces": "^1.14.0",
|
|
52
54
|
"rxjs": "^7.8.2",
|
|
53
55
|
"slugify": "^1.6.6",
|
|
54
56
|
"url": "^0.11.4"
|
package/types/Store.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IndexedFormula } from "rdflib";
|
|
2
2
|
import { PodOsSession } from "./authentication";
|
|
3
3
|
import { Thing } from "./thing";
|
|
4
|
-
import { UpdateOperation } from "@solid-data-modules/rdflib-utils";
|
|
4
|
+
import { ModuleConfig, UpdateOperation } from "@solid-data-modules/rdflib-utils";
|
|
5
5
|
import { OfflineCache, OnlineStatus } from "./offline-cache";
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The internalStore contains all data that is known locally.
|
|
8
8
|
* It can be used to fetch additional data from the web and also update data and sync it back to editable resources.
|
|
9
9
|
*/
|
|
10
10
|
export declare class Store {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
constructor(session: PodOsSession, offlineCache?: OfflineCache, onlineStatus?: OnlineStatus);
|
|
11
|
+
private readonly internalStore;
|
|
12
|
+
private readonly fetcher;
|
|
13
|
+
private readonly updater;
|
|
14
|
+
constructor(session: PodOsSession, offlineCache?: OfflineCache, onlineStatus?: OnlineStatus, internalStore?: IndexedFormula);
|
|
15
15
|
/**
|
|
16
|
-
* Fetch data for the given URI to the
|
|
16
|
+
* Fetch data for the given URI to the internalStore
|
|
17
17
|
* @param uri
|
|
18
18
|
*/
|
|
19
19
|
fetch(uri: string): Promise<Response>;
|
|
20
20
|
/**
|
|
21
|
-
* Fetch all the given URIs in parallel and put the data to the
|
|
21
|
+
* Fetch all the given URIs in parallel and put the data to the internalStore
|
|
22
22
|
* @param uris
|
|
23
23
|
*/
|
|
24
24
|
fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
|
|
25
25
|
/**
|
|
26
|
-
* Retrieve the thing identified by the given URI from the
|
|
26
|
+
* Retrieve the thing identified by the given URI from the internalStore
|
|
27
27
|
* @param uri
|
|
28
28
|
*/
|
|
29
29
|
get(uri: string): Thing;
|
|
@@ -36,4 +36,10 @@ export declare class Store {
|
|
|
36
36
|
addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
|
|
37
37
|
addNewThing(uri: string, name: string, type: string): Promise<void>;
|
|
38
38
|
executeUpdate(operation: UpdateOperation): Promise<void>;
|
|
39
|
+
flagAuthorizationMetadata(): void;
|
|
40
|
+
loadModule<T>(module: PodOsModule<T>): T;
|
|
39
41
|
}
|
|
42
|
+
interface PodOsModule<T> {
|
|
43
|
+
readonly default: new (config: ModuleConfig) => T;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { ISessionInfo } from "@inrupt/solid-client-authn-browser";
|
|
2
1
|
import { BehaviorSubject } from "rxjs";
|
|
3
2
|
export type AuthenticatedFetch = (url: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
|
|
4
|
-
export type SessionInfo =
|
|
3
|
+
export type SessionInfo = {
|
|
4
|
+
isLoggedIn: boolean;
|
|
5
|
+
webId?: string;
|
|
6
|
+
};
|
|
5
7
|
export interface PodOsSession {
|
|
6
8
|
authenticatedFetch: AuthenticatedFetch;
|
|
9
|
+
observeSession: () => BehaviorSubject<SessionInfo>;
|
|
10
|
+
login: (oidcIssuer: string) => Promise<void>;
|
|
11
|
+
logout: () => Promise<void>;
|
|
7
12
|
}
|
|
8
|
-
export declare class
|
|
9
|
-
private readonly session;
|
|
10
|
-
private readonly _authenticatedFetch;
|
|
13
|
+
export declare class AnonymousSession implements PodOsSession {
|
|
11
14
|
private readonly sessionInfo$;
|
|
12
15
|
get authenticatedFetch(): (url: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
|
|
13
|
-
constructor();
|
|
14
|
-
handleIncomingRedirect(restorePreviousSession?: boolean): Promise<ISessionInfo | undefined>;
|
|
15
|
-
login(oidcIssuer: string): Promise<void>;
|
|
16
|
-
logout(): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated use observeSession instead
|
|
19
|
-
*/
|
|
20
|
-
trackSession(callback: (session: SessionInfo) => unknown): void;
|
|
21
16
|
observeSession(): BehaviorSubject<SessionInfo>;
|
|
22
|
-
|
|
17
|
+
login(): Promise<void>;
|
|
18
|
+
logout(): Promise<void>;
|
|
23
19
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContactsModule } from "@solid-data-modules/contacts-rdflib";
|
|
2
2
|
import { BehaviorSubject } from "rxjs";
|
|
3
|
-
import {
|
|
3
|
+
import { SessionInfo, PodOsSession } from "./authentication";
|
|
4
4
|
import { SolidFile } from "./files";
|
|
5
5
|
import { WebIdProfile } from "./profile";
|
|
6
6
|
import { LabelIndex } from "./search";
|
|
@@ -9,6 +9,7 @@ import { Term } from "./terms";
|
|
|
9
9
|
import { Thing } from "./thing";
|
|
10
10
|
import { UriService } from "./uri/UriService";
|
|
11
11
|
import { OfflineCache, OnlineStatus } from "./offline-cache";
|
|
12
|
+
import { IndexedFormula } from "rdflib";
|
|
12
13
|
export * from "./authentication";
|
|
13
14
|
export * from "./files";
|
|
14
15
|
export * from "./thing";
|
|
@@ -17,10 +18,12 @@ export * from "./ldp-container";
|
|
|
17
18
|
export * from "./profile";
|
|
18
19
|
export * from "./search";
|
|
19
20
|
export * from "./offline-cache";
|
|
21
|
+
export * from "./terms";
|
|
20
22
|
export interface PodOsConfiguration {
|
|
21
23
|
offlineCache?: OfflineCache;
|
|
22
24
|
onlineStatus?: OnlineStatus;
|
|
23
|
-
session?:
|
|
25
|
+
session?: PodOsSession;
|
|
26
|
+
internalStore?: IndexedFormula;
|
|
24
27
|
}
|
|
25
28
|
export declare class PodOS {
|
|
26
29
|
private readonly session;
|
|
@@ -29,9 +32,8 @@ export declare class PodOS {
|
|
|
29
32
|
private readonly fileFetcher;
|
|
30
33
|
private readonly searchGateway;
|
|
31
34
|
private readonly offlineCache;
|
|
32
|
-
constructor({ session, offlineCache, onlineStatus, }?: PodOsConfiguration);
|
|
35
|
+
constructor({ session, offlineCache, onlineStatus, internalStore, }?: PodOsConfiguration);
|
|
33
36
|
private flagAuthorizationMetaDataOnSessionChange;
|
|
34
|
-
handleIncomingRedirect(restorePreviousSession?: boolean): void;
|
|
35
37
|
fetch(uri: string): Promise<Response>;
|
|
36
38
|
fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
|
|
37
39
|
fetchFile(url: string): Promise<SolidFile>;
|
|
@@ -39,20 +41,10 @@ export declare class PodOS {
|
|
|
39
41
|
listKnownTerms(): Term[];
|
|
40
42
|
addNewThing(uri: string, name: string, type: string): Promise<void>;
|
|
41
43
|
proposeUriForNewThing(referenceUri: string, name: string): string;
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated use observeSession instead
|
|
44
|
-
* @param callback
|
|
45
|
-
*/
|
|
46
|
-
trackSession(callback: (session: SessionInfo) => unknown): void;
|
|
47
44
|
/**
|
|
48
45
|
* returns a behavior subject that can be used to observe changes in the session state
|
|
49
46
|
*/
|
|
50
47
|
observeSession(): BehaviorSubject<SessionInfo>;
|
|
51
|
-
/**
|
|
52
|
-
* Calls the provided callback with the original URL that was open before the silent auth redirect
|
|
53
|
-
* @param callback
|
|
54
|
-
*/
|
|
55
|
-
onSessionRestore(callback: (url: string) => unknown): void;
|
|
56
48
|
/**
|
|
57
49
|
* Fetch the WebId profile and preferences file for the given WebID
|
|
58
50
|
* @param webId
|
package/types/thing/Thing.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class Thing {
|
|
|
28
28
|
label(): string;
|
|
29
29
|
literals(): Literal[];
|
|
30
30
|
relations(predicate?: string): Relation[];
|
|
31
|
-
reverseRelations(): Relation[];
|
|
31
|
+
reverseRelations(predicate?: string): Relation[];
|
|
32
32
|
anyValue(...predicateUris: string[]): undefined;
|
|
33
33
|
description(): undefined;
|
|
34
34
|
picture(): {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|