@pod-os/core 0.34.0-rc.62b04bb.0 → 0.34.0-rc.8dbc7e9.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 +74 -20
- package/lib/index.js +74 -20
- package/package.json +3 -3
- package/types/index.d.ts +7 -3
- 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 {
|
|
@@ -53234,14 +53280,18 @@ var PodOS = class {
|
|
|
53234
53280
|
onlineStatus,
|
|
53235
53281
|
internalStore
|
|
53236
53282
|
);
|
|
53237
|
-
this.
|
|
53283
|
+
this.profileGateway = new ProfileGateway(this.store);
|
|
53284
|
+
this.searchGateway = new SearchGateway(
|
|
53285
|
+
this.store,
|
|
53286
|
+
this.session,
|
|
53287
|
+
this.profileGateway
|
|
53288
|
+
);
|
|
53238
53289
|
this.fileFetcher = new FileFetcher(this.session);
|
|
53239
53290
|
this.fileGateway = new FileGateway(this.store, this.fileFetcher);
|
|
53240
53291
|
this.attachmentGateway = new AttachmentGateway(this.fileGateway);
|
|
53241
53292
|
this.pictureGateway = new PictureGateway(this.fileGateway);
|
|
53242
53293
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
53243
53294
|
this.uriService = new UriService(this.store);
|
|
53244
|
-
this.profileGateway = new ProfileGateway(this.store);
|
|
53245
53295
|
}
|
|
53246
53296
|
/*
|
|
53247
53297
|
Flagging authorization metadata is necessary every time the user
|
|
@@ -53330,11 +53380,15 @@ var PodOS = class {
|
|
|
53330
53380
|
return this.profileGateway.fetchProfile(webId);
|
|
53331
53381
|
}
|
|
53332
53382
|
/**
|
|
53333
|
-
*
|
|
53334
|
-
*
|
|
53383
|
+
* Build the search index on demand.
|
|
53384
|
+
*
|
|
53385
|
+
* While logged in, the index is built from the logged-in user's label indexes
|
|
53386
|
+
* and cached, so repeated calls return the same instance.
|
|
53387
|
+
*
|
|
53388
|
+
* While logged out, a fresh empty index is returned that is not cached.
|
|
53335
53389
|
*/
|
|
53336
|
-
async buildSearchIndex(
|
|
53337
|
-
return this.searchGateway.buildSearchIndex(
|
|
53390
|
+
async buildSearchIndex() {
|
|
53391
|
+
return this.searchGateway.buildSearchIndex();
|
|
53338
53392
|
}
|
|
53339
53393
|
logout() {
|
|
53340
53394
|
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 {
|
|
@@ -61676,14 +61722,18 @@ _:patch
|
|
|
61676
61722
|
onlineStatus,
|
|
61677
61723
|
internalStore
|
|
61678
61724
|
);
|
|
61679
|
-
this.
|
|
61725
|
+
this.profileGateway = new ProfileGateway(this.store);
|
|
61726
|
+
this.searchGateway = new SearchGateway(
|
|
61727
|
+
this.store,
|
|
61728
|
+
this.session,
|
|
61729
|
+
this.profileGateway
|
|
61730
|
+
);
|
|
61680
61731
|
this.fileFetcher = new FileFetcher(this.session);
|
|
61681
61732
|
this.fileGateway = new FileGateway(this.store, this.fileFetcher);
|
|
61682
61733
|
this.attachmentGateway = new AttachmentGateway(this.fileGateway);
|
|
61683
61734
|
this.pictureGateway = new PictureGateway(this.fileGateway);
|
|
61684
61735
|
this.flagAuthorizationMetaDataOnSessionChange();
|
|
61685
61736
|
this.uriService = new UriService(this.store);
|
|
61686
|
-
this.profileGateway = new ProfileGateway(this.store);
|
|
61687
61737
|
}
|
|
61688
61738
|
/*
|
|
61689
61739
|
Flagging authorization metadata is necessary every time the user
|
|
@@ -61772,11 +61822,15 @@ _:patch
|
|
|
61772
61822
|
return this.profileGateway.fetchProfile(webId);
|
|
61773
61823
|
}
|
|
61774
61824
|
/**
|
|
61775
|
-
*
|
|
61776
|
-
*
|
|
61825
|
+
* Build the search index on demand.
|
|
61826
|
+
*
|
|
61827
|
+
* While logged in, the index is built from the logged-in user's label indexes
|
|
61828
|
+
* and cached, so repeated calls return the same instance.
|
|
61829
|
+
*
|
|
61830
|
+
* While logged out, a fresh empty index is returned that is not cached.
|
|
61777
61831
|
*/
|
|
61778
|
-
async buildSearchIndex(
|
|
61779
|
-
return this.searchGateway.buildSearchIndex(
|
|
61832
|
+
async buildSearchIndex() {
|
|
61833
|
+
return this.searchGateway.buildSearchIndex();
|
|
61780
61834
|
}
|
|
61781
61835
|
logout() {
|
|
61782
61836
|
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.8dbc7e9.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/index.d.ts
CHANGED
|
@@ -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;
|