@pod-os/core 0.9.1-4851250.0 → 0.9.1-6931b20.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-EK4TMKVS.js → chunk-5NEDDTD5.js} +1 -7
- package/dist/index.js +11413 -13099
- package/dist/{jsonld-FFKAZS3C.js → jsonld-5UGKFKA6.js} +82 -17
- package/lib/index.js +12492 -14114
- package/package.json +20 -18
- package/types/index.d.ts +14 -0
- package/types/profile/WebIdProfile.d.ts +19 -0
- package/types/profile/WebIdProfile.spec.d.ts +1 -0
- package/types/profile/index.d.ts +1 -0
- package/types/rdf-document/index.d.ts +1 -1
- package/types/search/LabelIndex.d.ts +19 -0
- package/types/search/LabelIndex.spec.d.ts +1 -0
- package/types/search/SearchIndex.d.ts +27 -0
- package/types/search/SearchIndex.spec.d.ts +1 -0
- package/types/search/index.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/core",
|
|
3
|
-
"version": "0.9.1-
|
|
3
|
+
"version": "0.9.1-6931b20.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.22.
|
|
28
|
-
"@babel/preset-typescript": "^7.
|
|
29
|
-
"@types/jest": "^29.5.
|
|
30
|
-
"@types/jest-when": "^3.5.
|
|
31
|
-
"@types/sparqljs": "^3.1.
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
33
|
-
"@typescript-eslint/parser": "^6.
|
|
34
|
-
"esbuild": "^0.
|
|
35
|
-
"eslint": "^8.
|
|
36
|
-
"jest": "^29.
|
|
37
|
-
"jest-when": "^3.
|
|
38
|
-
"prettier": "^3.0.
|
|
39
|
-
"rdf-namespaces": "^1.
|
|
40
|
-
"rimraf": "^5.0.
|
|
27
|
+
"@babel/preset-env": "^7.22.20",
|
|
28
|
+
"@babel/preset-typescript": "^7.23.0",
|
|
29
|
+
"@types/jest": "^29.5.5",
|
|
30
|
+
"@types/jest-when": "^3.5.3",
|
|
31
|
+
"@types/sparqljs": "^3.1.5",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
|
33
|
+
"@typescript-eslint/parser": "^6.7.3",
|
|
34
|
+
"esbuild": "^0.19.4",
|
|
35
|
+
"eslint": "^8.50.0",
|
|
36
|
+
"jest": "^29.7.0",
|
|
37
|
+
"jest-when": "^3.6.0",
|
|
38
|
+
"prettier": "^3.0.3",
|
|
39
|
+
"rdf-namespaces": "^1.12.0",
|
|
40
|
+
"rimraf": "^5.0.5",
|
|
41
41
|
"sparqljs": "^3.7.1",
|
|
42
|
-
"typescript": "^5.
|
|
42
|
+
"typescript": "^5.2.2"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@inrupt/solid-client-authn-browser": "^1.
|
|
45
|
+
"@inrupt/solid-client-authn-browser": "^1.17.2",
|
|
46
|
+
"@types/lunr": "^2.3.5",
|
|
46
47
|
"buffer": "^6.0.3",
|
|
48
|
+
"lunr": "^2.3.9",
|
|
47
49
|
"rdflib": "^2.2.32",
|
|
48
50
|
"slugify": "^1.6.6",
|
|
49
|
-
"url": "^0.11.
|
|
51
|
+
"url": "^0.11.3"
|
|
50
52
|
},
|
|
51
53
|
"directories": {
|
|
52
54
|
"lib": "lib"
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ISessionInfo } from "@inrupt/solid-client-authn-browser";
|
|
2
2
|
import { SolidFile } from "./files";
|
|
3
|
+
import { WebIdProfile } from "./profile";
|
|
4
|
+
import { SearchIndex } from "./search/SearchIndex";
|
|
3
5
|
import { Store } from "./Store";
|
|
4
6
|
import { Term } from "./terms";
|
|
5
7
|
import { Thing } from "./thing";
|
|
@@ -9,6 +11,8 @@ export * from "./files";
|
|
|
9
11
|
export * from "./thing";
|
|
10
12
|
export * from "./rdf-document";
|
|
11
13
|
export * from "./ldp-container";
|
|
14
|
+
export * from "./profile";
|
|
15
|
+
export * from "./search";
|
|
12
16
|
export declare class PodOS {
|
|
13
17
|
private readonly session;
|
|
14
18
|
readonly store: Store;
|
|
@@ -23,6 +27,16 @@ export declare class PodOS {
|
|
|
23
27
|
addNewThing(uri: string, name: string, type: string): Promise<void>;
|
|
24
28
|
proposeUriForNewThing(referenceUri: string, name: string): string;
|
|
25
29
|
trackSession(callback: (session: ISessionInfo) => unknown): void;
|
|
30
|
+
/**
|
|
31
|
+
* Fetch the WebId profile and preferences file for the given WebID
|
|
32
|
+
* @param webId
|
|
33
|
+
*/
|
|
34
|
+
fetchProfile(webId: string): Promise<WebIdProfile>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetch the private label index for the given profile and build a search index from it
|
|
37
|
+
* @param webId
|
|
38
|
+
*/
|
|
39
|
+
buildSearchIndex(profile: WebIdProfile): Promise<SearchIndex>;
|
|
26
40
|
logout(): Promise<void>;
|
|
27
41
|
login(oidcIssuer?: string): Promise<void>;
|
|
28
42
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IndexedFormula } from "rdflib";
|
|
2
|
+
import { Thing } from "../thing";
|
|
3
|
+
/**
|
|
4
|
+
* Allows to find things related to the WebID and their profile document
|
|
5
|
+
*/
|
|
6
|
+
export declare class WebIdProfile extends Thing {
|
|
7
|
+
readonly webId: string;
|
|
8
|
+
readonly store: IndexedFormula;
|
|
9
|
+
readonly editable: boolean;
|
|
10
|
+
constructor(webId: string, store: IndexedFormula, editable?: boolean);
|
|
11
|
+
/**
|
|
12
|
+
* Returns te URI of the preferences document
|
|
13
|
+
*/
|
|
14
|
+
getPreferencesFile(): string | void;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the URI of a private label index
|
|
17
|
+
*/
|
|
18
|
+
getPrivateLabelIndex(): string | void;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WebIdProfile } from "./WebIdProfile";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./RdfDocument";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IndexedFormula } from "rdflib";
|
|
2
|
+
import { RdfDocument } from "../rdf-document";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a label index document as described in
|
|
5
|
+
* https://github.com/pod-os/PodOS/blob/main/docs/features/full-text-search.md
|
|
6
|
+
*/
|
|
7
|
+
export declare class LabelIndex extends RdfDocument {
|
|
8
|
+
readonly uri: string;
|
|
9
|
+
readonly store: IndexedFormula;
|
|
10
|
+
readonly editable: boolean;
|
|
11
|
+
constructor(uri: string, store: IndexedFormula, editable?: boolean);
|
|
12
|
+
/**
|
|
13
|
+
* Returns the URIs and labels for all the things listed in the document.
|
|
14
|
+
*/
|
|
15
|
+
getIndexedItems(): {
|
|
16
|
+
uri: string;
|
|
17
|
+
label: string;
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LabelIndex } from "./LabelIndex";
|
|
2
|
+
import { Index } from "lunr";
|
|
3
|
+
/**
|
|
4
|
+
* A fast, in-memory search index based on data from label indexes. Both labels and URIs are indexed.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SearchIndex {
|
|
7
|
+
private index;
|
|
8
|
+
constructor(indexes: LabelIndex[]);
|
|
9
|
+
/**
|
|
10
|
+
* Search the index for a given term. It finds partial matches, but will rank exact matches higher.
|
|
11
|
+
*
|
|
12
|
+
* The rank order is:
|
|
13
|
+
*
|
|
14
|
+
* 1. exact matches
|
|
15
|
+
* 2. prefix matches
|
|
16
|
+
* 3. suffix matches
|
|
17
|
+
* 4. any matches inside a literal
|
|
18
|
+
*
|
|
19
|
+
* @param term The (partial) term to search for
|
|
20
|
+
* @param maxResults The maximum number of results to return (defaults to 10)
|
|
21
|
+
*/
|
|
22
|
+
search(term: string, maxResults?: number): Index.Result[];
|
|
23
|
+
/**
|
|
24
|
+
* Remove all data from the search index.
|
|
25
|
+
*/
|
|
26
|
+
clear(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|