@pod-os/core 0.14.1-178554f.0 → 0.14.1-bcfffa2.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 +81 -15
- package/lib/index.js +83 -16
- package/package.json +1 -1
- package/types/Store.d.ts +2 -2
- package/types/index.d.ts +10 -2
- package/types/namespaces/index.d.ts +1 -0
- package/types/search/SearchGateway.d.ts +16 -0
- package/types/search/SearchGateway.integration.spec.d.ts +1 -0
- package/types/search/SearchIndex.d.ts +6 -1
- package/types/search/createDefaultLabelIndex.d.ts +5 -0
- package/types/search/createDefaultLabelIndex.spec.d.ts +1 -0
- package/types/search/index.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -13833,13 +13833,21 @@ var WebIdProfile = class extends Thing {
|
|
|
13833
13833
|
// src/search/SearchIndex.ts
|
|
13834
13834
|
var import_lunr = __toESM(require_lunr());
|
|
13835
13835
|
var SearchIndex = class {
|
|
13836
|
-
constructor(
|
|
13836
|
+
constructor(labelIndexes) {
|
|
13837
|
+
this.labelIndexes = labelIndexes;
|
|
13838
|
+
this.index = this.rebuild().index;
|
|
13839
|
+
}
|
|
13840
|
+
/**
|
|
13841
|
+
* Recreates the search index with the current data from all label indexes
|
|
13842
|
+
*/
|
|
13843
|
+
rebuild() {
|
|
13844
|
+
const labelIndexes = this.labelIndexes;
|
|
13837
13845
|
this.index = (0, import_lunr.default)(function() {
|
|
13838
13846
|
this.ref("uri");
|
|
13839
13847
|
this.field("uri");
|
|
13840
13848
|
this.field("label");
|
|
13841
13849
|
this.metadataWhitelist = ["position"];
|
|
13842
|
-
const items2 =
|
|
13850
|
+
const items2 = labelIndexes.flatMap((it) => it.getIndexedItems());
|
|
13843
13851
|
items2.forEach((item4) => {
|
|
13844
13852
|
this.add({
|
|
13845
13853
|
uri: item4.uri,
|
|
@@ -13847,6 +13855,7 @@ var SearchIndex = class {
|
|
|
13847
13855
|
});
|
|
13848
13856
|
});
|
|
13849
13857
|
});
|
|
13858
|
+
return this;
|
|
13850
13859
|
}
|
|
13851
13860
|
/**
|
|
13852
13861
|
* Search the index for a given term. It finds partial matches, but will rank exact matches higher.
|
|
@@ -13902,6 +13911,7 @@ var RdfDocument = class extends Thing {
|
|
|
13902
13911
|
|
|
13903
13912
|
// src/namespaces/index.ts
|
|
13904
13913
|
var rdfs = Namespace("http://www.w3.org/2000/01/rdf-schema#");
|
|
13914
|
+
var pim = Namespace("http://www.w3.org/ns/pim/space#");
|
|
13905
13915
|
|
|
13906
13916
|
// src/search/LabelIndex.ts
|
|
13907
13917
|
var LabelIndex = class extends RdfDocument {
|
|
@@ -13949,13 +13959,37 @@ function createEmptyTurtleFile(fetcher2, url7) {
|
|
|
13949
13959
|
// node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js
|
|
13950
13960
|
var rdf = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
|
|
13951
13961
|
var solid = Namespace("http://www.w3.org/ns/solid/terms#");
|
|
13952
|
-
var
|
|
13962
|
+
var pim2 = Namespace("http://www.w3.org/ns/pim/space#");
|
|
13953
13963
|
var ldp = Namespace("http://www.w3.org/ns/ldp#");
|
|
13954
13964
|
|
|
13955
13965
|
// node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
|
|
13956
13966
|
var import_short_unique_id = __toESM(require_short_unique_id(), 1);
|
|
13957
13967
|
var uid = new import_short_unique_id.default({ length: 10 });
|
|
13958
13968
|
|
|
13969
|
+
// src/search/createDefaultLabelIndex.ts
|
|
13970
|
+
function createDefaultLabelIndex(profile2) {
|
|
13971
|
+
const webId = namedNode(profile2.webId);
|
|
13972
|
+
const preferencesFile2 = profile2.getPreferencesFile();
|
|
13973
|
+
const defaultFileName = "privateLabelIndex.ttl";
|
|
13974
|
+
const indexUrl = preferencesFile2 ? new URL(defaultFileName, preferencesFile2).href : new URL(defaultFileName, webId.uri).href;
|
|
13975
|
+
const preferencesOrProfileDoc = preferencesFile2 ? namedNode(preferencesFile2) : webId.doc();
|
|
13976
|
+
const indexDocument = namedNode(indexUrl);
|
|
13977
|
+
return {
|
|
13978
|
+
uri: indexDocument.uri,
|
|
13979
|
+
insertions: [
|
|
13980
|
+
st(
|
|
13981
|
+
webId,
|
|
13982
|
+
solid("privateLabelIndex"),
|
|
13983
|
+
indexDocument,
|
|
13984
|
+
preferencesOrProfileDoc
|
|
13985
|
+
),
|
|
13986
|
+
st(indexDocument, rdfs("label"), lit("Default Index"), indexDocument)
|
|
13987
|
+
],
|
|
13988
|
+
deletions: [],
|
|
13989
|
+
filesToCreate: []
|
|
13990
|
+
};
|
|
13991
|
+
}
|
|
13992
|
+
|
|
13959
13993
|
// src/search/addToLabelIndex.ts
|
|
13960
13994
|
var addToLabelIndex = (thing, labelIndex) => {
|
|
13961
13995
|
return {
|
|
@@ -13972,6 +14006,36 @@ var addToLabelIndex = (thing, labelIndex) => {
|
|
|
13972
14006
|
};
|
|
13973
14007
|
};
|
|
13974
14008
|
|
|
14009
|
+
// src/search/SearchGateway.ts
|
|
14010
|
+
var SearchGateway = class {
|
|
14011
|
+
constructor(store) {
|
|
14012
|
+
this.store = store;
|
|
14013
|
+
}
|
|
14014
|
+
/**
|
|
14015
|
+
* Fetch the private label index for the given profile and build a search index from it
|
|
14016
|
+
* @param webId
|
|
14017
|
+
*/
|
|
14018
|
+
async buildSearchIndex(profile2) {
|
|
14019
|
+
const labelIndexUris = profile2.getPrivateLabelIndexes();
|
|
14020
|
+
if (labelIndexUris.length > 0) {
|
|
14021
|
+
await this.store.fetchAll(labelIndexUris);
|
|
14022
|
+
const labelIndex = labelIndexUris.map(
|
|
14023
|
+
(uri6) => this.store.get(uri6).assume(LabelIndex)
|
|
14024
|
+
);
|
|
14025
|
+
return new SearchIndex(labelIndex);
|
|
14026
|
+
}
|
|
14027
|
+
return new SearchIndex([]);
|
|
14028
|
+
}
|
|
14029
|
+
async addToLabelIndex(thing, labelIndex) {
|
|
14030
|
+
await this.store.executeUpdate(addToLabelIndex(thing, labelIndex));
|
|
14031
|
+
}
|
|
14032
|
+
async createDefaultLabelIndex(profile2) {
|
|
14033
|
+
const operation3 = createDefaultLabelIndex(profile2);
|
|
14034
|
+
await this.store.executeUpdate(operation3);
|
|
14035
|
+
return this.store.get(operation3.uri).assume(LabelIndex);
|
|
14036
|
+
}
|
|
14037
|
+
};
|
|
14038
|
+
|
|
13975
14039
|
// src/Store.ts
|
|
13976
14040
|
var Store = class {
|
|
13977
14041
|
constructor(session4) {
|
|
@@ -14056,8 +14120,7 @@ var Store = class {
|
|
|
14056
14120
|
}
|
|
14057
14121
|
);
|
|
14058
14122
|
}
|
|
14059
|
-
async
|
|
14060
|
-
const operation3 = addToLabelIndex(thing, labelIndex);
|
|
14123
|
+
async executeUpdate(operation3) {
|
|
14061
14124
|
await executeUpdate(this.fetcher, this.updater, operation3);
|
|
14062
14125
|
}
|
|
14063
14126
|
};
|
|
@@ -34412,6 +34475,7 @@ var PodOS = class {
|
|
|
34412
34475
|
constructor() {
|
|
34413
34476
|
this.session = new BrowserSession();
|
|
34414
34477
|
this.store = new Store(this.session);
|
|
34478
|
+
this.searchGateway = new SearchGateway(this.store);
|
|
34415
34479
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
34416
34480
|
this.uriService = new UriService(this.store);
|
|
34417
34481
|
this.fileFetcher = new FileFetcher(this.session);
|
|
@@ -34494,15 +34558,7 @@ var PodOS = class {
|
|
|
34494
34558
|
* @param webId
|
|
34495
34559
|
*/
|
|
34496
34560
|
async buildSearchIndex(profile2) {
|
|
34497
|
-
|
|
34498
|
-
if (labelIndexUris.length > 0) {
|
|
34499
|
-
await this.fetchAll(labelIndexUris);
|
|
34500
|
-
const labelIndex = labelIndexUris.map(
|
|
34501
|
-
(uri6) => this.store.get(uri6).assume(LabelIndex)
|
|
34502
|
-
);
|
|
34503
|
-
return new SearchIndex(labelIndex);
|
|
34504
|
-
}
|
|
34505
|
-
return new SearchIndex([]);
|
|
34561
|
+
return this.searchGateway.buildSearchIndex(profile2);
|
|
34506
34562
|
}
|
|
34507
34563
|
logout() {
|
|
34508
34564
|
return this.session.logout();
|
|
@@ -34519,7 +34575,16 @@ var PodOS = class {
|
|
|
34519
34575
|
* @param labelIndex - The index to update
|
|
34520
34576
|
*/
|
|
34521
34577
|
async addToLabelIndex(thing, labelIndex) {
|
|
34522
|
-
await this.
|
|
34578
|
+
await this.searchGateway.addToLabelIndex(thing, labelIndex);
|
|
34579
|
+
}
|
|
34580
|
+
/**
|
|
34581
|
+
* Creates a new label index document at a default location and links it to the user's profile or preferences document
|
|
34582
|
+
*
|
|
34583
|
+
* @param profile - The profile for that to create the index
|
|
34584
|
+
* @returns the newly created label index
|
|
34585
|
+
*/
|
|
34586
|
+
async createDefaultLabelIndex(profile2) {
|
|
34587
|
+
return await this.searchGateway.createDefaultLabelIndex(profile2);
|
|
34523
34588
|
}
|
|
34524
34589
|
};
|
|
34525
34590
|
export {
|
|
@@ -34531,6 +34596,7 @@ export {
|
|
|
34531
34596
|
LdpContainer,
|
|
34532
34597
|
PodOS,
|
|
34533
34598
|
RdfDocument,
|
|
34599
|
+
SearchGateway,
|
|
34534
34600
|
SearchIndex,
|
|
34535
34601
|
Thing,
|
|
34536
34602
|
WebIdProfile,
|
package/lib/index.js
CHANGED
|
@@ -41436,6 +41436,7 @@ _:patch
|
|
|
41436
41436
|
LdpContainer: () => LdpContainer,
|
|
41437
41437
|
PodOS: () => PodOS,
|
|
41438
41438
|
RdfDocument: () => RdfDocument,
|
|
41439
|
+
SearchGateway: () => SearchGateway,
|
|
41439
41440
|
SearchIndex: () => SearchIndex,
|
|
41440
41441
|
Thing: () => Thing,
|
|
41441
41442
|
WebIdProfile: () => WebIdProfile,
|
|
@@ -46795,13 +46796,21 @@ _:patch
|
|
|
46795
46796
|
// src/search/SearchIndex.ts
|
|
46796
46797
|
var import_lunr = __toESM(require_lunr());
|
|
46797
46798
|
var SearchIndex = class {
|
|
46798
|
-
constructor(
|
|
46799
|
+
constructor(labelIndexes) {
|
|
46800
|
+
this.labelIndexes = labelIndexes;
|
|
46801
|
+
this.index = this.rebuild().index;
|
|
46802
|
+
}
|
|
46803
|
+
/**
|
|
46804
|
+
* Recreates the search index with the current data from all label indexes
|
|
46805
|
+
*/
|
|
46806
|
+
rebuild() {
|
|
46807
|
+
const labelIndexes = this.labelIndexes;
|
|
46799
46808
|
this.index = (0, import_lunr.default)(function() {
|
|
46800
46809
|
this.ref("uri");
|
|
46801
46810
|
this.field("uri");
|
|
46802
46811
|
this.field("label");
|
|
46803
46812
|
this.metadataWhitelist = ["position"];
|
|
46804
|
-
const items2 =
|
|
46813
|
+
const items2 = labelIndexes.flatMap((it) => it.getIndexedItems());
|
|
46805
46814
|
items2.forEach((item4) => {
|
|
46806
46815
|
this.add({
|
|
46807
46816
|
uri: item4.uri,
|
|
@@ -46809,6 +46818,7 @@ _:patch
|
|
|
46809
46818
|
});
|
|
46810
46819
|
});
|
|
46811
46820
|
});
|
|
46821
|
+
return this;
|
|
46812
46822
|
}
|
|
46813
46823
|
/**
|
|
46814
46824
|
* Search the index for a given term. It finds partial matches, but will rank exact matches higher.
|
|
@@ -46869,6 +46879,7 @@ _:patch
|
|
|
46869
46879
|
// src/namespaces/index.ts
|
|
46870
46880
|
init_esm();
|
|
46871
46881
|
var rdfs = Namespace("http://www.w3.org/2000/01/rdf-schema#");
|
|
46882
|
+
var pim2 = Namespace("http://www.w3.org/ns/pim/space#");
|
|
46872
46883
|
|
|
46873
46884
|
// src/search/LabelIndex.ts
|
|
46874
46885
|
var LabelIndex = class extends RdfDocument {
|
|
@@ -46900,7 +46911,7 @@ _:patch
|
|
|
46900
46911
|
}
|
|
46901
46912
|
};
|
|
46902
46913
|
|
|
46903
|
-
// src/
|
|
46914
|
+
// src/search/createDefaultLabelIndex.ts
|
|
46904
46915
|
init_esm();
|
|
46905
46916
|
|
|
46906
46917
|
// node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
|
|
@@ -46920,13 +46931,37 @@ _:patch
|
|
|
46920
46931
|
init_esm();
|
|
46921
46932
|
var rdf4 = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
|
|
46922
46933
|
var solid2 = Namespace("http://www.w3.org/ns/solid/terms#");
|
|
46923
|
-
var
|
|
46934
|
+
var pim3 = Namespace("http://www.w3.org/ns/pim/space#");
|
|
46924
46935
|
var ldp2 = Namespace("http://www.w3.org/ns/ldp#");
|
|
46925
46936
|
|
|
46926
46937
|
// node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
|
|
46927
46938
|
var import_short_unique_id2 = __toESM(require_short_unique_id(), 1);
|
|
46928
46939
|
var uid2 = new import_short_unique_id2.default({ length: 10 });
|
|
46929
46940
|
|
|
46941
|
+
// src/search/createDefaultLabelIndex.ts
|
|
46942
|
+
function createDefaultLabelIndex(profile2) {
|
|
46943
|
+
const webId = namedNode(profile2.webId);
|
|
46944
|
+
const preferencesFile2 = profile2.getPreferencesFile();
|
|
46945
|
+
const defaultFileName = "privateLabelIndex.ttl";
|
|
46946
|
+
const indexUrl = preferencesFile2 ? new URL(defaultFileName, preferencesFile2).href : new URL(defaultFileName, webId.uri).href;
|
|
46947
|
+
const preferencesOrProfileDoc = preferencesFile2 ? namedNode(preferencesFile2) : webId.doc();
|
|
46948
|
+
const indexDocument = namedNode(indexUrl);
|
|
46949
|
+
return {
|
|
46950
|
+
uri: indexDocument.uri,
|
|
46951
|
+
insertions: [
|
|
46952
|
+
st(
|
|
46953
|
+
webId,
|
|
46954
|
+
solid2("privateLabelIndex"),
|
|
46955
|
+
indexDocument,
|
|
46956
|
+
preferencesOrProfileDoc
|
|
46957
|
+
),
|
|
46958
|
+
st(indexDocument, rdfs("label"), lit("Default Index"), indexDocument)
|
|
46959
|
+
],
|
|
46960
|
+
deletions: [],
|
|
46961
|
+
filesToCreate: []
|
|
46962
|
+
};
|
|
46963
|
+
}
|
|
46964
|
+
|
|
46930
46965
|
// src/search/addToLabelIndex.ts
|
|
46931
46966
|
init_esm();
|
|
46932
46967
|
var addToLabelIndex = (thing, labelIndex) => {
|
|
@@ -46944,7 +46979,38 @@ _:patch
|
|
|
46944
46979
|
};
|
|
46945
46980
|
};
|
|
46946
46981
|
|
|
46982
|
+
// src/search/SearchGateway.ts
|
|
46983
|
+
var SearchGateway = class {
|
|
46984
|
+
constructor(store) {
|
|
46985
|
+
this.store = store;
|
|
46986
|
+
}
|
|
46987
|
+
/**
|
|
46988
|
+
* Fetch the private label index for the given profile and build a search index from it
|
|
46989
|
+
* @param webId
|
|
46990
|
+
*/
|
|
46991
|
+
async buildSearchIndex(profile2) {
|
|
46992
|
+
const labelIndexUris = profile2.getPrivateLabelIndexes();
|
|
46993
|
+
if (labelIndexUris.length > 0) {
|
|
46994
|
+
await this.store.fetchAll(labelIndexUris);
|
|
46995
|
+
const labelIndex = labelIndexUris.map(
|
|
46996
|
+
(uri6) => this.store.get(uri6).assume(LabelIndex)
|
|
46997
|
+
);
|
|
46998
|
+
return new SearchIndex(labelIndex);
|
|
46999
|
+
}
|
|
47000
|
+
return new SearchIndex([]);
|
|
47001
|
+
}
|
|
47002
|
+
async addToLabelIndex(thing, labelIndex) {
|
|
47003
|
+
await this.store.executeUpdate(addToLabelIndex(thing, labelIndex));
|
|
47004
|
+
}
|
|
47005
|
+
async createDefaultLabelIndex(profile2) {
|
|
47006
|
+
const operation3 = createDefaultLabelIndex(profile2);
|
|
47007
|
+
await this.store.executeUpdate(operation3);
|
|
47008
|
+
return this.store.get(operation3.uri).assume(LabelIndex);
|
|
47009
|
+
}
|
|
47010
|
+
};
|
|
47011
|
+
|
|
46947
47012
|
// src/Store.ts
|
|
47013
|
+
init_esm();
|
|
46948
47014
|
var Store = class {
|
|
46949
47015
|
constructor(session4) {
|
|
46950
47016
|
this.graph = graph();
|
|
@@ -47028,8 +47094,7 @@ _:patch
|
|
|
47028
47094
|
}
|
|
47029
47095
|
);
|
|
47030
47096
|
}
|
|
47031
|
-
async
|
|
47032
|
-
const operation3 = addToLabelIndex(thing, labelIndex);
|
|
47097
|
+
async executeUpdate(operation3) {
|
|
47033
47098
|
await executeUpdate2(this.fetcher, this.updater, operation3);
|
|
47034
47099
|
}
|
|
47035
47100
|
};
|
|
@@ -67385,6 +67450,7 @@ _:patch
|
|
|
67385
67450
|
constructor() {
|
|
67386
67451
|
this.session = new BrowserSession();
|
|
67387
67452
|
this.store = new Store(this.session);
|
|
67453
|
+
this.searchGateway = new SearchGateway(this.store);
|
|
67388
67454
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
67389
67455
|
this.uriService = new UriService(this.store);
|
|
67390
67456
|
this.fileFetcher = new FileFetcher(this.session);
|
|
@@ -67467,15 +67533,7 @@ _:patch
|
|
|
67467
67533
|
* @param webId
|
|
67468
67534
|
*/
|
|
67469
67535
|
async buildSearchIndex(profile2) {
|
|
67470
|
-
|
|
67471
|
-
if (labelIndexUris.length > 0) {
|
|
67472
|
-
await this.fetchAll(labelIndexUris);
|
|
67473
|
-
const labelIndex = labelIndexUris.map(
|
|
67474
|
-
(uri6) => this.store.get(uri6).assume(LabelIndex)
|
|
67475
|
-
);
|
|
67476
|
-
return new SearchIndex(labelIndex);
|
|
67477
|
-
}
|
|
67478
|
-
return new SearchIndex([]);
|
|
67536
|
+
return this.searchGateway.buildSearchIndex(profile2);
|
|
67479
67537
|
}
|
|
67480
67538
|
logout() {
|
|
67481
67539
|
return this.session.logout();
|
|
@@ -67492,7 +67550,16 @@ _:patch
|
|
|
67492
67550
|
* @param labelIndex - The index to update
|
|
67493
67551
|
*/
|
|
67494
67552
|
async addToLabelIndex(thing, labelIndex) {
|
|
67495
|
-
await this.
|
|
67553
|
+
await this.searchGateway.addToLabelIndex(thing, labelIndex);
|
|
67554
|
+
}
|
|
67555
|
+
/**
|
|
67556
|
+
* Creates a new label index document at a default location and links it to the user's profile or preferences document
|
|
67557
|
+
*
|
|
67558
|
+
* @param profile - The profile for that to create the index
|
|
67559
|
+
* @returns the newly created label index
|
|
67560
|
+
*/
|
|
67561
|
+
async createDefaultLabelIndex(profile2) {
|
|
67562
|
+
return await this.searchGateway.createDefaultLabelIndex(profile2);
|
|
67496
67563
|
}
|
|
67497
67564
|
};
|
|
67498
67565
|
return __toCommonJS(index_exports);
|
package/package.json
CHANGED
package/types/Store.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fetcher, IndexedFormula, UpdateManager } from "rdflib";
|
|
2
2
|
import { PodOsSession } from "./authentication";
|
|
3
3
|
import { Thing } from "./thing";
|
|
4
|
-
import {
|
|
4
|
+
import { UpdateOperation } from "@solid-data-modules/rdflib-utils";
|
|
5
5
|
/**
|
|
6
6
|
* The store contains all data that is known locally.
|
|
7
7
|
* It can be used to fetch additional data from the web and also update data and sync it back to editable resources.
|
|
@@ -34,5 +34,5 @@ export declare class Store {
|
|
|
34
34
|
*/
|
|
35
35
|
addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
|
|
36
36
|
addNewThing(uri: string, name: string, type: string): Promise<void>;
|
|
37
|
-
|
|
37
|
+
executeUpdate(operation: UpdateOperation): Promise<void>;
|
|
38
38
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BehaviorSubject } from "rxjs";
|
|
|
3
3
|
import { SessionInfo } from "./authentication";
|
|
4
4
|
import { SolidFile } from "./files";
|
|
5
5
|
import { WebIdProfile } from "./profile";
|
|
6
|
-
import { LabelIndex
|
|
6
|
+
import { LabelIndex } from "./search";
|
|
7
7
|
import { Store } from "./Store";
|
|
8
8
|
import { Term } from "./terms";
|
|
9
9
|
import { Thing } from "./thing";
|
|
@@ -20,6 +20,7 @@ export declare class PodOS {
|
|
|
20
20
|
readonly store: Store;
|
|
21
21
|
readonly uriService: UriService;
|
|
22
22
|
private fileFetcher;
|
|
23
|
+
private searchGateway;
|
|
23
24
|
constructor();
|
|
24
25
|
private flagAuthorizationMetaDataOnSessionChange;
|
|
25
26
|
handleIncomingRedirect(restorePreviousSession?: boolean): void;
|
|
@@ -53,7 +54,7 @@ export declare class PodOS {
|
|
|
53
54
|
* Fetch the private label index for the given profile and build a search index from it
|
|
54
55
|
* @param webId
|
|
55
56
|
*/
|
|
56
|
-
buildSearchIndex(profile: WebIdProfile): Promise<SearchIndex>;
|
|
57
|
+
buildSearchIndex(profile: WebIdProfile): Promise<import("./search").SearchIndex>;
|
|
57
58
|
logout(): Promise<void>;
|
|
58
59
|
login(oidcIssuer?: string): Promise<void>;
|
|
59
60
|
loadContactsModule(): Promise<ContactsModule>;
|
|
@@ -63,4 +64,11 @@ export declare class PodOS {
|
|
|
63
64
|
* @param labelIndex - The index to update
|
|
64
65
|
*/
|
|
65
66
|
addToLabelIndex(thing: Thing, labelIndex: LabelIndex): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new label index document at a default location and links it to the user's profile or preferences document
|
|
69
|
+
*
|
|
70
|
+
* @param profile - The profile for that to create the index
|
|
71
|
+
* @returns the newly created label index
|
|
72
|
+
*/
|
|
73
|
+
createDefaultLabelIndex(profile: WebIdProfile): Promise<LabelIndex>;
|
|
66
74
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { WebIdProfile } from "../profile";
|
|
2
|
+
import { Store } from "../Store";
|
|
3
|
+
import { LabelIndex } from "./LabelIndex";
|
|
4
|
+
import { Thing } from "../thing";
|
|
5
|
+
import { SearchIndex } from "./SearchIndex";
|
|
6
|
+
export declare class SearchGateway {
|
|
7
|
+
private store;
|
|
8
|
+
constructor(store: Store);
|
|
9
|
+
/**
|
|
10
|
+
* Fetch the private label index for the given profile and build a search index from it
|
|
11
|
+
* @param webId
|
|
12
|
+
*/
|
|
13
|
+
buildSearchIndex(profile: WebIdProfile): Promise<SearchIndex>;
|
|
14
|
+
addToLabelIndex(thing: Thing, labelIndex: LabelIndex): Promise<void>;
|
|
15
|
+
createDefaultLabelIndex(profile: WebIdProfile): Promise<LabelIndex>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,8 +4,13 @@ import { Index } from "lunr";
|
|
|
4
4
|
* A fast, in-memory search index based on data from label indexes. Both labels and URIs are indexed.
|
|
5
5
|
*/
|
|
6
6
|
export declare class SearchIndex {
|
|
7
|
+
private labelIndexes;
|
|
7
8
|
private index;
|
|
8
|
-
constructor(
|
|
9
|
+
constructor(labelIndexes: LabelIndex[]);
|
|
10
|
+
/**
|
|
11
|
+
* Recreates the search index with the current data from all label indexes
|
|
12
|
+
*/
|
|
13
|
+
rebuild(): this;
|
|
9
14
|
/**
|
|
10
15
|
* Search the index for a given term. It finds partial matches, but will rank exact matches higher.
|
|
11
16
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/search/index.d.ts
CHANGED