@pod-os/core 0.11.2-f22ff2f.0 → 0.12.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.11.2-f22ff2f.0",
3
+ "version": "0.12.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
@@ -24,29 +24,31 @@
24
24
  "author": "Angelo Veltens",
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@babel/preset-env": "^7.23.8",
28
- "@babel/preset-typescript": "^7.23.3",
29
- "@types/jest": "^29.5.11",
27
+ "@babel/preset-env": "^7.24.5",
28
+ "@babel/preset-typescript": "^7.24.1",
29
+ "@types/jest": "^29.5.12",
30
30
  "@types/jest-when": "^3.5.5",
31
31
  "@types/sparqljs": "^3.1.10",
32
- "@typescript-eslint/eslint-plugin": "^6.18.1",
33
- "@typescript-eslint/parser": "^6.18.1",
34
- "esbuild": "^0.19.11",
35
- "eslint": "^8.56.0",
32
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
33
+ "@typescript-eslint/parser": "^6.21.0",
34
+ "esbuild": "^0.19.12",
35
+ "eslint": "^8.57.0",
36
36
  "jest": "^29.7.0",
37
37
  "jest-when": "^3.6.0",
38
- "prettier": "^3.2.1",
38
+ "prettier": "^3.2.5",
39
39
  "rdf-namespaces": "^1.12.0",
40
- "rimraf": "^5.0.5",
40
+ "rimraf": "^5.0.7",
41
41
  "sparqljs": "^3.7.1",
42
- "typescript": "^5.3.3"
42
+ "typescript": "^5.4.5"
43
43
  },
44
44
  "dependencies": {
45
45
  "@inrupt/solid-client-authn-browser": "^1.17.5",
46
+ "@solid-data-modules/contacts-rdflib": "^0.5.0",
46
47
  "@types/lunr": "^2.3.7",
47
48
  "buffer": "^6.0.3",
48
49
  "lunr": "^2.3.9",
49
- "rdflib": "^2.2.33",
50
+ "rdflib": "^2.2.35",
51
+ "rxjs": "^7.8.1",
50
52
  "slugify": "^1.6.6",
51
53
  "url": "^0.11.3"
52
54
  },
@@ -1,15 +1,23 @@
1
1
  import { ISessionInfo } from "@inrupt/solid-client-authn-browser";
2
+ import { BehaviorSubject } from "rxjs";
2
3
  export type AuthenticatedFetch = (url: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
4
+ export type SessionInfo = ISessionInfo;
3
5
  export interface PodOsSession {
4
6
  authenticatedFetch: AuthenticatedFetch;
5
7
  }
6
8
  export declare class BrowserSession implements PodOsSession {
7
9
  private readonly session;
8
10
  private readonly _authenticatedFetch;
11
+ private readonly sessionInfo$;
9
12
  get authenticatedFetch(): (url: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
10
13
  constructor();
11
- handleIncomingRedirect(): Promise<ISessionInfo | undefined>;
14
+ handleIncomingRedirect(restorePreviousSession?: boolean): Promise<ISessionInfo | undefined>;
12
15
  login(oidcIssuer: string): Promise<void>;
13
16
  logout(): Promise<void>;
14
- trackSession(callback: (session: ISessionInfo) => unknown): void;
17
+ /**
18
+ * @deprecated use observeSession instead
19
+ */
20
+ trackSession(callback: (session: SessionInfo) => unknown): void;
21
+ observeSession(): BehaviorSubject<SessionInfo>;
22
+ onSessionRestore(callback: (url: string) => void): void;
15
23
  }
@@ -0,0 +1,4 @@
1
+ import { Session } from "@inrupt/solid-client-authn-browser";
2
+ import { BehaviorSubject } from "rxjs";
3
+ import { SessionInfo } from "./index";
4
+ export declare function observeSession(session: Session): BehaviorSubject<SessionInfo>;
@@ -0,0 +1 @@
1
+ export {};
package/types/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { ISessionInfo } from "@inrupt/solid-client-authn-browser";
1
+ import { ContactsModule } from "@solid-data-modules/contacts-rdflib";
2
+ import { BehaviorSubject } from "rxjs";
3
+ import { SessionInfo } from "./authentication";
2
4
  import { SolidFile } from "./files";
3
5
  import { WebIdProfile } from "./profile";
4
- import { SearchIndex } from "./search/SearchIndex";
6
+ import { SearchIndex } from "./search";
5
7
  import { Store } from "./Store";
6
8
  import { Term } from "./terms";
7
9
  import { Thing } from "./thing";
@@ -19,7 +21,8 @@ export declare class PodOS {
19
21
  readonly uriService: UriService;
20
22
  private fileFetcher;
21
23
  constructor();
22
- handleIncomingRedirect(): void;
24
+ private flagAuthorizationMetaDataOnSessionChange;
25
+ handleIncomingRedirect(restorePreviousSession?: boolean): void;
23
26
  fetch(uri: string): Promise<Response>;
24
27
  fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
25
28
  fetchFile(url: string): Promise<SolidFile>;
@@ -27,7 +30,20 @@ export declare class PodOS {
27
30
  listKnownTerms(): Term[];
28
31
  addNewThing(uri: string, name: string, type: string): Promise<void>;
29
32
  proposeUriForNewThing(referenceUri: string, name: string): string;
30
- trackSession(callback: (session: ISessionInfo) => unknown): void;
33
+ /**
34
+ * @deprecated use observeSession instead
35
+ * @param callback
36
+ */
37
+ trackSession(callback: (session: SessionInfo) => unknown): void;
38
+ /**
39
+ * returns a behavior subject that can be used to observe changes in the session state
40
+ */
41
+ observeSession(): BehaviorSubject<SessionInfo>;
42
+ /**
43
+ * Calls the provided callback with the original URL that was open before the silent auth redirect
44
+ * @param callback
45
+ */
46
+ onSessionRestore(callback: (url: string) => unknown): void;
31
47
  /**
32
48
  * Fetch the WebId profile and preferences file for the given WebID
33
49
  * @param webId
@@ -40,4 +56,5 @@ export declare class PodOS {
40
56
  buildSearchIndex(profile: WebIdProfile): Promise<SearchIndex>;
41
57
  logout(): Promise<void>;
42
58
  login(oidcIssuer?: string): Promise<void>;
59
+ loadContactsModule(): Promise<ContactsModule>;
43
60
  }
@@ -0,0 +1,3 @@
1
+ import { ContactsModule } from "@solid-data-modules/contacts-rdflib";
2
+ import { Store } from "../Store";
3
+ export declare function loadContactsModule(store: Store): Promise<ContactsModule>;