@pod-os/core 0.34.0-rc.d2d66c6.0 → 0.34.0-rc.decd61b.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 +96 -44
- package/lib/index.js +96 -44
- package/package.json +3 -3
- package/types/Store.d.ts +1 -1
- package/types/index.d.ts +8 -4
- package/types/search/SearchGateway.d.ts +17 -7
package/dist/index.js
CHANGED
|
@@ -17179,6 +17179,40 @@ function from(input2, scheduler) {
|
|
|
17179
17179
|
return scheduler ? scheduled(input2, scheduler) : innerFrom(input2);
|
|
17180
17180
|
}
|
|
17181
17181
|
|
|
17182
|
+
// ../node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
|
|
17183
|
+
var EmptyError = createErrorClass(function(_super) {
|
|
17184
|
+
return function EmptyErrorImpl() {
|
|
17185
|
+
_super(this);
|
|
17186
|
+
this.name = "EmptyError";
|
|
17187
|
+
this.message = "no elements in sequence";
|
|
17188
|
+
};
|
|
17189
|
+
});
|
|
17190
|
+
|
|
17191
|
+
// ../node_modules/rxjs/dist/esm5/internal/lastValueFrom.js
|
|
17192
|
+
function lastValueFrom(source10, config2) {
|
|
17193
|
+
var hasConfig = typeof config2 === "object";
|
|
17194
|
+
return new Promise(function(resolve, reject) {
|
|
17195
|
+
var _hasValue = false;
|
|
17196
|
+
var _value2;
|
|
17197
|
+
source10.subscribe({
|
|
17198
|
+
next: function(value8) {
|
|
17199
|
+
_value2 = value8;
|
|
17200
|
+
_hasValue = true;
|
|
17201
|
+
},
|
|
17202
|
+
error: reject,
|
|
17203
|
+
complete: function() {
|
|
17204
|
+
if (_hasValue) {
|
|
17205
|
+
resolve(_value2);
|
|
17206
|
+
} else if (hasConfig) {
|
|
17207
|
+
resolve(config2.defaultValue);
|
|
17208
|
+
} else {
|
|
17209
|
+
reject(new EmptyError());
|
|
17210
|
+
}
|
|
17211
|
+
}
|
|
17212
|
+
});
|
|
17213
|
+
});
|
|
17214
|
+
}
|
|
17215
|
+
|
|
17182
17216
|
// ../node_modules/rxjs/dist/esm5/internal/operators/map.js
|
|
17183
17217
|
function map(project, thisArg) {
|
|
17184
17218
|
return operate(function(source10, subscriber3) {
|
|
@@ -18428,7 +18462,8 @@ var Mime = class {
|
|
|
18428
18462
|
getAllExtensions(type5) {
|
|
18429
18463
|
if (typeof type5 !== "string")
|
|
18430
18464
|
return null;
|
|
18431
|
-
|
|
18465
|
+
type5 = type5.split(";")[0].trim().toLowerCase();
|
|
18466
|
+
return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type5) ?? null;
|
|
18432
18467
|
}
|
|
18433
18468
|
_freeze() {
|
|
18434
18469
|
this.define = () => {
|
|
@@ -30796,15 +30831,30 @@ var addToLabelIndex = (thing, labelIndex) => {
|
|
|
30796
30831
|
|
|
30797
30832
|
// src/search/SearchGateway.ts
|
|
30798
30833
|
var SearchGateway = class {
|
|
30799
|
-
constructor(store) {
|
|
30834
|
+
constructor(store, session4, profileGateway) {
|
|
30800
30835
|
this.store = store;
|
|
30836
|
+
this.session = session4;
|
|
30837
|
+
this.profileGateway = profileGateway;
|
|
30801
30838
|
}
|
|
30802
30839
|
/**
|
|
30803
|
-
*
|
|
30804
|
-
*
|
|
30805
|
-
*
|
|
30840
|
+
* Build a search index on demand.
|
|
30841
|
+
*
|
|
30842
|
+
* While logged in, the profile is resolved from the current session's webId
|
|
30843
|
+
* and the index is built from the profile's label indexes and cached, so that
|
|
30844
|
+
* repeated calls return the same instance.
|
|
30845
|
+
*
|
|
30846
|
+
* While logged out, a fresh empty index is returned that is NOT cached —
|
|
30847
|
+
* the next call after login is a cache miss and builds.
|
|
30806
30848
|
*/
|
|
30807
|
-
async buildSearchIndex(
|
|
30849
|
+
async buildSearchIndex() {
|
|
30850
|
+
const session4 = await lastValueFrom(
|
|
30851
|
+
this.session.observeSession().pipe(take(1))
|
|
30852
|
+
);
|
|
30853
|
+
if (!session4.isLoggedIn) {
|
|
30854
|
+
return new SearchIndex([]);
|
|
30855
|
+
}
|
|
30856
|
+
const webId = session4.webId;
|
|
30857
|
+
const profile2 = await this.profileGateway.fetchProfile(webId);
|
|
30808
30858
|
if (!this.cached) {
|
|
30809
30859
|
const labelIndexUris = profile2.getPrivateLabelIndexes();
|
|
30810
30860
|
this.cached = await this.buildIndex(labelIndexUris);
|
|
@@ -30812,10 +30862,12 @@ var SearchGateway = class {
|
|
|
30812
30862
|
return this.cached;
|
|
30813
30863
|
}
|
|
30814
30864
|
/**
|
|
30815
|
-
*
|
|
30816
|
-
*
|
|
30865
|
+
* Empties the cached search index in place and drops the cache reference, so
|
|
30866
|
+
* that consumers already holding the instance see an empty index immediately
|
|
30867
|
+
* and the next call to {@link buildSearchIndex} builds a new index.
|
|
30817
30868
|
*/
|
|
30818
30869
|
clear() {
|
|
30870
|
+
this.cached?.clear();
|
|
30819
30871
|
this.cached = void 0;
|
|
30820
30872
|
}
|
|
30821
30873
|
async buildIndex(labelIndexUris) {
|
|
@@ -30956,11 +31008,6 @@ var Store = class {
|
|
|
30956
31008
|
*/
|
|
30957
31009
|
async fetch(uri6) {
|
|
30958
31010
|
const response6 = await this.fetcher.load(namedNode2(uri6), {
|
|
30959
|
-
// force fetching due to
|
|
30960
|
-
// https://github.com/linkeddata/rdflib.js/issues/247
|
|
30961
|
-
// and
|
|
30962
|
-
// https://github.com/linkeddata/rdflib.js/issues/441
|
|
30963
|
-
force: true,
|
|
30964
31011
|
// explicitly omit credentials due to
|
|
30965
31012
|
// https://github.com/pod-os/PodOS/issues/17
|
|
30966
31013
|
credentials: "omit"
|
|
@@ -30974,7 +31021,6 @@ var Store = class {
|
|
|
30974
31021
|
if (descriptionResourceUri) {
|
|
30975
31022
|
try {
|
|
30976
31023
|
await this.fetcher.load(namedNode2(descriptionResourceUri.value), {
|
|
30977
|
-
force: true,
|
|
30978
31024
|
credentials: "omit"
|
|
30979
31025
|
});
|
|
30980
31026
|
} catch {
|
|
@@ -31070,30 +31116,28 @@ var Store = class {
|
|
|
31070
31116
|
return docUrl;
|
|
31071
31117
|
}
|
|
31072
31118
|
async addNewThing(uri6, name9, type5) {
|
|
31073
|
-
|
|
31074
|
-
|
|
31075
|
-
|
|
31076
|
-
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
|
|
31083
|
-
|
|
31084
|
-
|
|
31085
|
-
|
|
31086
|
-
|
|
31087
|
-
)
|
|
31088
|
-
|
|
31089
|
-
|
|
31090
|
-
|
|
31091
|
-
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
}
|
|
31096
|
-
);
|
|
31119
|
+
const typeInsertion = type5 ? [
|
|
31120
|
+
st(
|
|
31121
|
+
namedNode2(uri6),
|
|
31122
|
+
namedNode2("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
|
|
31123
|
+
namedNode2(type5),
|
|
31124
|
+
namedNode2(uri6).doc()
|
|
31125
|
+
)
|
|
31126
|
+
] : [];
|
|
31127
|
+
const insertions = [
|
|
31128
|
+
...typeInsertion,
|
|
31129
|
+
st(
|
|
31130
|
+
namedNode2(uri6),
|
|
31131
|
+
namedNode2("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
31132
|
+
lit(name9),
|
|
31133
|
+
namedNode2(uri6).doc()
|
|
31134
|
+
)
|
|
31135
|
+
];
|
|
31136
|
+
await this.updater.update([], insertions, void 0, false, {
|
|
31137
|
+
// explicitly omit credentials due to
|
|
31138
|
+
// https://github.com/pod-os/PodOS/issues/17
|
|
31139
|
+
credentials: "omit"
|
|
31140
|
+
});
|
|
31097
31141
|
}
|
|
31098
31142
|
async executeUpdate(operation3) {
|
|
31099
31143
|
await executeUpdate(this.fetcher, this.updater, operation3);
|
|
@@ -53234,14 +53278,18 @@ var PodOS = class {
|
|
|
53234
53278
|
onlineStatus,
|
|
53235
53279
|
internalStore
|
|
53236
53280
|
);
|
|
53237
|
-
this.
|
|
53281
|
+
this.profileGateway = new ProfileGateway(this.store);
|
|
53282
|
+
this.searchGateway = new SearchGateway(
|
|
53283
|
+
this.store,
|
|
53284
|
+
this.session,
|
|
53285
|
+
this.profileGateway
|
|
53286
|
+
);
|
|
53238
53287
|
this.fileFetcher = new FileFetcher(this.session);
|
|
53239
53288
|
this.fileGateway = new FileGateway(this.store, this.fileFetcher);
|
|
53240
53289
|
this.attachmentGateway = new AttachmentGateway(this.fileGateway);
|
|
53241
53290
|
this.pictureGateway = new PictureGateway(this.fileGateway);
|
|
53242
53291
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
53243
53292
|
this.uriService = new UriService(this.store);
|
|
53244
|
-
this.profileGateway = new ProfileGateway(this.store);
|
|
53245
53293
|
}
|
|
53246
53294
|
/*
|
|
53247
53295
|
Flagging authorization metadata is necessary every time the user
|
|
@@ -53330,11 +53378,15 @@ var PodOS = class {
|
|
|
53330
53378
|
return this.profileGateway.fetchProfile(webId);
|
|
53331
53379
|
}
|
|
53332
53380
|
/**
|
|
53333
|
-
*
|
|
53334
|
-
*
|
|
53381
|
+
* Build the search index on demand.
|
|
53382
|
+
*
|
|
53383
|
+
* While logged in, the index is built from the logged-in user's label indexes
|
|
53384
|
+
* and cached, so repeated calls return the same instance.
|
|
53385
|
+
*
|
|
53386
|
+
* While logged out, a fresh empty index is returned that is not cached.
|
|
53335
53387
|
*/
|
|
53336
|
-
async buildSearchIndex(
|
|
53337
|
-
return this.searchGateway.buildSearchIndex(
|
|
53388
|
+
async buildSearchIndex() {
|
|
53389
|
+
return this.searchGateway.buildSearchIndex();
|
|
53338
53390
|
}
|
|
53339
53391
|
logout() {
|
|
53340
53392
|
this.offlineCache.clear();
|
package/lib/index.js
CHANGED
|
@@ -25621,6 +25621,40 @@ var PodOS = (() => {
|
|
|
25621
25621
|
return scheduler ? scheduled(input2, scheduler) : innerFrom(input2);
|
|
25622
25622
|
}
|
|
25623
25623
|
|
|
25624
|
+
// ../node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
|
|
25625
|
+
var EmptyError = createErrorClass(function(_super) {
|
|
25626
|
+
return function EmptyErrorImpl() {
|
|
25627
|
+
_super(this);
|
|
25628
|
+
this.name = "EmptyError";
|
|
25629
|
+
this.message = "no elements in sequence";
|
|
25630
|
+
};
|
|
25631
|
+
});
|
|
25632
|
+
|
|
25633
|
+
// ../node_modules/rxjs/dist/esm5/internal/lastValueFrom.js
|
|
25634
|
+
function lastValueFrom(source10, config2) {
|
|
25635
|
+
var hasConfig = typeof config2 === "object";
|
|
25636
|
+
return new Promise(function(resolve, reject) {
|
|
25637
|
+
var _hasValue = false;
|
|
25638
|
+
var _value2;
|
|
25639
|
+
source10.subscribe({
|
|
25640
|
+
next: function(value8) {
|
|
25641
|
+
_value2 = value8;
|
|
25642
|
+
_hasValue = true;
|
|
25643
|
+
},
|
|
25644
|
+
error: reject,
|
|
25645
|
+
complete: function() {
|
|
25646
|
+
if (_hasValue) {
|
|
25647
|
+
resolve(_value2);
|
|
25648
|
+
} else if (hasConfig) {
|
|
25649
|
+
resolve(config2.defaultValue);
|
|
25650
|
+
} else {
|
|
25651
|
+
reject(new EmptyError());
|
|
25652
|
+
}
|
|
25653
|
+
}
|
|
25654
|
+
});
|
|
25655
|
+
});
|
|
25656
|
+
}
|
|
25657
|
+
|
|
25624
25658
|
// ../node_modules/rxjs/dist/esm5/internal/operators/map.js
|
|
25625
25659
|
function map(project, thisArg) {
|
|
25626
25660
|
return operate(function(source10, subscriber3) {
|
|
@@ -26870,7 +26904,8 @@ var PodOS = (() => {
|
|
|
26870
26904
|
getAllExtensions(type5) {
|
|
26871
26905
|
if (typeof type5 !== "string")
|
|
26872
26906
|
return null;
|
|
26873
|
-
|
|
26907
|
+
type5 = type5.split(";")[0].trim().toLowerCase();
|
|
26908
|
+
return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type5) ?? null;
|
|
26874
26909
|
}
|
|
26875
26910
|
_freeze() {
|
|
26876
26911
|
this.define = () => {
|
|
@@ -39238,15 +39273,30 @@ _:patch
|
|
|
39238
39273
|
|
|
39239
39274
|
// src/search/SearchGateway.ts
|
|
39240
39275
|
var SearchGateway = class {
|
|
39241
|
-
constructor(store) {
|
|
39276
|
+
constructor(store, session4, profileGateway) {
|
|
39242
39277
|
this.store = store;
|
|
39278
|
+
this.session = session4;
|
|
39279
|
+
this.profileGateway = profileGateway;
|
|
39243
39280
|
}
|
|
39244
39281
|
/**
|
|
39245
|
-
*
|
|
39246
|
-
*
|
|
39247
|
-
*
|
|
39282
|
+
* Build a search index on demand.
|
|
39283
|
+
*
|
|
39284
|
+
* While logged in, the profile is resolved from the current session's webId
|
|
39285
|
+
* and the index is built from the profile's label indexes and cached, so that
|
|
39286
|
+
* repeated calls return the same instance.
|
|
39287
|
+
*
|
|
39288
|
+
* While logged out, a fresh empty index is returned that is NOT cached —
|
|
39289
|
+
* the next call after login is a cache miss and builds.
|
|
39248
39290
|
*/
|
|
39249
|
-
async buildSearchIndex(
|
|
39291
|
+
async buildSearchIndex() {
|
|
39292
|
+
const session4 = await lastValueFrom(
|
|
39293
|
+
this.session.observeSession().pipe(take(1))
|
|
39294
|
+
);
|
|
39295
|
+
if (!session4.isLoggedIn) {
|
|
39296
|
+
return new SearchIndex([]);
|
|
39297
|
+
}
|
|
39298
|
+
const webId = session4.webId;
|
|
39299
|
+
const profile2 = await this.profileGateway.fetchProfile(webId);
|
|
39250
39300
|
if (!this.cached) {
|
|
39251
39301
|
const labelIndexUris = profile2.getPrivateLabelIndexes();
|
|
39252
39302
|
this.cached = await this.buildIndex(labelIndexUris);
|
|
@@ -39254,10 +39304,12 @@ _:patch
|
|
|
39254
39304
|
return this.cached;
|
|
39255
39305
|
}
|
|
39256
39306
|
/**
|
|
39257
|
-
*
|
|
39258
|
-
*
|
|
39307
|
+
* Empties the cached search index in place and drops the cache reference, so
|
|
39308
|
+
* that consumers already holding the instance see an empty index immediately
|
|
39309
|
+
* and the next call to {@link buildSearchIndex} builds a new index.
|
|
39259
39310
|
*/
|
|
39260
39311
|
clear() {
|
|
39312
|
+
this.cached?.clear();
|
|
39261
39313
|
this.cached = void 0;
|
|
39262
39314
|
}
|
|
39263
39315
|
async buildIndex(labelIndexUris) {
|
|
@@ -39398,11 +39450,6 @@ _:patch
|
|
|
39398
39450
|
*/
|
|
39399
39451
|
async fetch(uri6) {
|
|
39400
39452
|
const response6 = await this.fetcher.load(namedNode2(uri6), {
|
|
39401
|
-
// force fetching due to
|
|
39402
|
-
// https://github.com/linkeddata/rdflib.js/issues/247
|
|
39403
|
-
// and
|
|
39404
|
-
// https://github.com/linkeddata/rdflib.js/issues/441
|
|
39405
|
-
force: true,
|
|
39406
39453
|
// explicitly omit credentials due to
|
|
39407
39454
|
// https://github.com/pod-os/PodOS/issues/17
|
|
39408
39455
|
credentials: "omit"
|
|
@@ -39416,7 +39463,6 @@ _:patch
|
|
|
39416
39463
|
if (descriptionResourceUri) {
|
|
39417
39464
|
try {
|
|
39418
39465
|
await this.fetcher.load(namedNode2(descriptionResourceUri.value), {
|
|
39419
|
-
force: true,
|
|
39420
39466
|
credentials: "omit"
|
|
39421
39467
|
});
|
|
39422
39468
|
} catch {
|
|
@@ -39512,30 +39558,28 @@ _:patch
|
|
|
39512
39558
|
return docUrl;
|
|
39513
39559
|
}
|
|
39514
39560
|
async addNewThing(uri6, name9, type5) {
|
|
39515
|
-
|
|
39516
|
-
|
|
39517
|
-
|
|
39518
|
-
|
|
39519
|
-
|
|
39520
|
-
|
|
39521
|
-
|
|
39522
|
-
|
|
39523
|
-
|
|
39524
|
-
|
|
39525
|
-
|
|
39526
|
-
|
|
39527
|
-
|
|
39528
|
-
|
|
39529
|
-
)
|
|
39530
|
-
|
|
39531
|
-
|
|
39532
|
-
|
|
39533
|
-
|
|
39534
|
-
|
|
39535
|
-
|
|
39536
|
-
|
|
39537
|
-
}
|
|
39538
|
-
);
|
|
39561
|
+
const typeInsertion = type5 ? [
|
|
39562
|
+
st(
|
|
39563
|
+
namedNode2(uri6),
|
|
39564
|
+
namedNode2("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
|
|
39565
|
+
namedNode2(type5),
|
|
39566
|
+
namedNode2(uri6).doc()
|
|
39567
|
+
)
|
|
39568
|
+
] : [];
|
|
39569
|
+
const insertions = [
|
|
39570
|
+
...typeInsertion,
|
|
39571
|
+
st(
|
|
39572
|
+
namedNode2(uri6),
|
|
39573
|
+
namedNode2("http://www.w3.org/2000/01/rdf-schema#label"),
|
|
39574
|
+
lit(name9),
|
|
39575
|
+
namedNode2(uri6).doc()
|
|
39576
|
+
)
|
|
39577
|
+
];
|
|
39578
|
+
await this.updater.update([], insertions, void 0, false, {
|
|
39579
|
+
// explicitly omit credentials due to
|
|
39580
|
+
// https://github.com/pod-os/PodOS/issues/17
|
|
39581
|
+
credentials: "omit"
|
|
39582
|
+
});
|
|
39539
39583
|
}
|
|
39540
39584
|
async executeUpdate(operation3) {
|
|
39541
39585
|
await executeUpdate(this.fetcher, this.updater, operation3);
|
|
@@ -61676,14 +61720,18 @@ _:patch
|
|
|
61676
61720
|
onlineStatus,
|
|
61677
61721
|
internalStore
|
|
61678
61722
|
);
|
|
61679
|
-
this.
|
|
61723
|
+
this.profileGateway = new ProfileGateway(this.store);
|
|
61724
|
+
this.searchGateway = new SearchGateway(
|
|
61725
|
+
this.store,
|
|
61726
|
+
this.session,
|
|
61727
|
+
this.profileGateway
|
|
61728
|
+
);
|
|
61680
61729
|
this.fileFetcher = new FileFetcher(this.session);
|
|
61681
61730
|
this.fileGateway = new FileGateway(this.store, this.fileFetcher);
|
|
61682
61731
|
this.attachmentGateway = new AttachmentGateway(this.fileGateway);
|
|
61683
61732
|
this.pictureGateway = new PictureGateway(this.fileGateway);
|
|
61684
61733
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
61685
61734
|
this.uriService = new UriService(this.store);
|
|
61686
|
-
this.profileGateway = new ProfileGateway(this.store);
|
|
61687
61735
|
}
|
|
61688
61736
|
/*
|
|
61689
61737
|
Flagging authorization metadata is necessary every time the user
|
|
@@ -61772,11 +61820,15 @@ _:patch
|
|
|
61772
61820
|
return this.profileGateway.fetchProfile(webId);
|
|
61773
61821
|
}
|
|
61774
61822
|
/**
|
|
61775
|
-
*
|
|
61776
|
-
*
|
|
61823
|
+
* Build the search index on demand.
|
|
61824
|
+
*
|
|
61825
|
+
* While logged in, the index is built from the logged-in user's label indexes
|
|
61826
|
+
* and cached, so repeated calls return the same instance.
|
|
61827
|
+
*
|
|
61828
|
+
* While logged out, a fresh empty index is returned that is not cached.
|
|
61777
61829
|
*/
|
|
61778
|
-
async buildSearchIndex(
|
|
61779
|
-
return this.searchGateway.buildSearchIndex(
|
|
61830
|
+
async buildSearchIndex() {
|
|
61831
|
+
return this.searchGateway.buildSearchIndex();
|
|
61780
61832
|
}
|
|
61781
61833
|
logout() {
|
|
61782
61834
|
this.offlineCache.clear();
|
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.34.0-rc.
|
|
4
|
+
"version": "0.34.0-rc.decd61b.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"rimraf": "^6.1.3",
|
|
54
54
|
"sparqljs": "^3.7.4",
|
|
55
55
|
"typedoc": "^0.28.20",
|
|
56
|
-
"typedoc-plugin-markdown": "^4.
|
|
56
|
+
"typedoc-plugin-markdown": "^4.14.0",
|
|
57
57
|
"typescript": "^6.0.3",
|
|
58
58
|
"typescript-eslint": "^8.71.0",
|
|
59
59
|
"vitest": "^4.1.11",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/lunr": "^2.3.7",
|
|
65
65
|
"buffer": "^6.0.3",
|
|
66
66
|
"lunr": "^2.3.9",
|
|
67
|
-
"mime": "^4.1.
|
|
67
|
+
"mime": "^4.1.1",
|
|
68
68
|
"neverthrow": "^8.2.0",
|
|
69
69
|
"rdf-namespaces": "^1.17.0",
|
|
70
70
|
"rdflib": "2.4.1",
|
package/types/Store.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class Store {
|
|
|
59
59
|
*/
|
|
60
60
|
addRelation(thing: Thing, property: string, uri: string): Promise<void>;
|
|
61
61
|
private determineDocumentToUpdate;
|
|
62
|
-
addNewThing(uri: string, name: string, type
|
|
62
|
+
addNewThing(uri: string, name: string, type?: string): Promise<void>;
|
|
63
63
|
executeUpdate(operation: UpdateOperation): Promise<void>;
|
|
64
64
|
flagAuthorizationMetadata(): void;
|
|
65
65
|
loadModule<T>(module: PodOsModule<T>): T;
|
package/types/index.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export declare class PodOS {
|
|
|
84
84
|
*/
|
|
85
85
|
addRelation(thing: Thing, property: string, value: string): Promise<void>;
|
|
86
86
|
listKnownTerms(): Term[];
|
|
87
|
-
addNewThing(uri: string, name: string, type
|
|
87
|
+
addNewThing(uri: string, name: string, type?: string): Promise<void>;
|
|
88
88
|
proposeUriForNewThing(referenceUri: string, name: string): string;
|
|
89
89
|
/**
|
|
90
90
|
* returns a behavior subject that can be used to observe changes in the session state
|
|
@@ -96,10 +96,14 @@ export declare class PodOS {
|
|
|
96
96
|
*/
|
|
97
97
|
fetchProfile(webId: string): Promise<WebIdProfile>;
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
99
|
+
* Build the search index on demand.
|
|
100
|
+
*
|
|
101
|
+
* While logged in, the index is built from the logged-in user's label indexes
|
|
102
|
+
* and cached, so repeated calls return the same instance.
|
|
103
|
+
*
|
|
104
|
+
* While logged out, a fresh empty index is returned that is not cached.
|
|
101
105
|
*/
|
|
102
|
-
buildSearchIndex(
|
|
106
|
+
buildSearchIndex(): Promise<import("./search").SearchIndex>;
|
|
103
107
|
logout(): Promise<void>;
|
|
104
108
|
login(oidcIssuer?: string): Promise<void>;
|
|
105
109
|
/**
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { WebIdProfile } from "../profile";
|
|
2
|
+
import { ProfileGateway } from "../profile";
|
|
2
3
|
import { Store } from "../Store";
|
|
3
4
|
import { LabelIndex } from "./LabelIndex";
|
|
5
|
+
import { PodOsSession } from "../authentication";
|
|
4
6
|
import { Thing } from "../thing";
|
|
5
7
|
import { SearchIndex } from "./SearchIndex";
|
|
6
8
|
export declare class SearchGateway {
|
|
7
9
|
private readonly store;
|
|
10
|
+
private readonly profileGateway;
|
|
11
|
+
private readonly session;
|
|
8
12
|
private cached?;
|
|
9
|
-
constructor(store: Store);
|
|
13
|
+
constructor(store: Store, session: PodOsSession, profileGateway: ProfileGateway);
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
15
|
+
* Build a search index on demand.
|
|
16
|
+
*
|
|
17
|
+
* While logged in, the profile is resolved from the current session's webId
|
|
18
|
+
* and the index is built from the profile's label indexes and cached, so that
|
|
19
|
+
* repeated calls return the same instance.
|
|
20
|
+
*
|
|
21
|
+
* While logged out, a fresh empty index is returned that is NOT cached —
|
|
22
|
+
* the next call after login is a cache miss and builds.
|
|
14
23
|
*/
|
|
15
|
-
buildSearchIndex(
|
|
24
|
+
buildSearchIndex(): Promise<SearchIndex>;
|
|
16
25
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
26
|
+
* Empties the cached search index in place and drops the cache reference, so
|
|
27
|
+
* that consumers already holding the instance see an empty index immediately
|
|
28
|
+
* and the next call to {@link buildSearchIndex} builds a new index.
|
|
19
29
|
*/
|
|
20
30
|
clear(): void;
|
|
21
31
|
private buildIndex;
|