@pod-os/core 0.18.1-rc.e79414b.0 → 0.18.1-rc.f02795a.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-3LTXZPFZ.js → chunk-S4UXBIES.js} +37 -39
- package/dist/{dist-4BQLT63G.js → dist-O5YU2L4C.js} +1 -1
- package/dist/index.js +44 -4
- package/lib/index.js +79 -41
- package/package.json +2 -2
- package/types/Store.d.ts +1 -2
- package/types/index.d.ts +3 -1
- package/types/offline-cache/index.d.ts +1 -1
- package/types/search/SearchGateway.d.ts +1 -1
- package/types/thing/Thing.d.ts +38 -0
- package/types/uri/index.d.ts +1 -0
|
@@ -14259,16 +14259,13 @@ function listToCollection(kb, obj) {
|
|
|
14259
14259
|
}
|
|
14260
14260
|
return kb.rdfFactory.collection(obj.map((o) => jsonldObjectToTerm(kb, o)));
|
|
14261
14261
|
}
|
|
14262
|
-
function jsonldParser(str, kb, base
|
|
14262
|
+
async function jsonldParser(str, kb, base) {
|
|
14263
14263
|
const baseString = base && Object.prototype.hasOwnProperty.call(base, "termType") ? base.value : base;
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
kb = processResource(kb, base, flatResource);
|
|
14270
|
-
return kb;
|
|
14271
|
-
}, kb)).then(callback).catch(callback);
|
|
14264
|
+
const jsonld = await import("./jsonld-X74JI4TL.js");
|
|
14265
|
+
const flattened = await jsonld.default.flatten(JSON.parse(str), null, {
|
|
14266
|
+
base: baseString
|
|
14267
|
+
});
|
|
14268
|
+
return flattened.reduce((store, flatResource) => processResource(store, base, flatResource), kb);
|
|
14272
14269
|
}
|
|
14273
14270
|
function nodeType(kb, obj) {
|
|
14274
14271
|
if (obj["@id"].startsWith("_:")) {
|
|
@@ -18665,7 +18662,7 @@ function parse2(str, kb, base) {
|
|
|
18665
18662
|
sparqlUpdateParser(str, kb, base);
|
|
18666
18663
|
executeCallback();
|
|
18667
18664
|
} else if (contentType === JSONLDContentType) {
|
|
18668
|
-
jsonldParser(str, kb, base
|
|
18665
|
+
jsonldParser(str, kb, base).then(executeCallback).catch(executeErrorCallback);
|
|
18669
18666
|
} else if (contentType === NQuadsContentType || contentType === NQuadsAltContentType) {
|
|
18670
18667
|
var n3Parser = new N3Parser({
|
|
18671
18668
|
factory: extended_term_factory_default
|
|
@@ -20925,7 +20922,8 @@ var IndexedFormula = class _IndexedFormula extends Formula {
|
|
|
20925
20922
|
_defineProperty(this, "_universalVariables", void 0);
|
|
20926
20923
|
_defineProperty(this, "_existentialVariables", void 0);
|
|
20927
20924
|
_defineProperty(this, "rdfArrayRemove", void 0);
|
|
20928
|
-
_defineProperty(this, "dataCallbacks",
|
|
20925
|
+
_defineProperty(this, "dataCallbacks", []);
|
|
20926
|
+
_defineProperty(this, "dataRemovalCallbacks", []);
|
|
20929
20927
|
this.propertyActions = {};
|
|
20930
20928
|
this.classActions = {};
|
|
20931
20929
|
this.redirections = [];
|
|
@@ -20948,6 +20946,9 @@ var IndexedFormula = class _IndexedFormula extends Formula {
|
|
|
20948
20946
|
if (opts.dataCallback) {
|
|
20949
20947
|
this.dataCallbacks = [opts.dataCallback];
|
|
20950
20948
|
}
|
|
20949
|
+
if (opts.dataRemovalCallback) {
|
|
20950
|
+
this.dataRemovalCallbacks = [opts.dataRemovalCallback];
|
|
20951
|
+
}
|
|
20951
20952
|
this.initPropertyActions(this.features);
|
|
20952
20953
|
}
|
|
20953
20954
|
/**
|
|
@@ -20973,11 +20974,11 @@ var IndexedFormula = class _IndexedFormula extends Formula {
|
|
|
20973
20974
|
* @param cb
|
|
20974
20975
|
*/
|
|
20975
20976
|
addDataCallback(cb) {
|
|
20976
|
-
if (!this.dataCallbacks) {
|
|
20977
|
-
this.dataCallbacks = [];
|
|
20978
|
-
}
|
|
20979
20977
|
this.dataCallbacks.push(cb);
|
|
20980
20978
|
}
|
|
20979
|
+
addDataRemovalCallback(cb) {
|
|
20980
|
+
this.dataRemovalCallbacks.push(cb);
|
|
20981
|
+
}
|
|
20981
20982
|
/**
|
|
20982
20983
|
* Apply a set of statements to be deleted and to be inserted
|
|
20983
20984
|
*
|
|
@@ -21155,10 +21156,8 @@ var IndexedFormula = class _IndexedFormula extends Formula {
|
|
|
21155
21156
|
ix[h].push(st2);
|
|
21156
21157
|
}
|
|
21157
21158
|
this.statements.push(st2);
|
|
21158
|
-
|
|
21159
|
-
|
|
21160
|
-
callback(st2);
|
|
21161
|
-
}
|
|
21159
|
+
for (const callback of this.dataCallbacks) {
|
|
21160
|
+
callback(st2);
|
|
21162
21161
|
}
|
|
21163
21162
|
return st2;
|
|
21164
21163
|
}
|
|
@@ -21554,6 +21553,9 @@ var IndexedFormula = class _IndexedFormula extends Formula {
|
|
|
21554
21553
|
}
|
|
21555
21554
|
}
|
|
21556
21555
|
this.rdfArrayRemove(this.statements, st2);
|
|
21556
|
+
for (const callback of this.dataRemovalCallbacks) {
|
|
21557
|
+
callback(st2);
|
|
21558
|
+
}
|
|
21557
21559
|
return this;
|
|
21558
21560
|
}
|
|
21559
21561
|
/**
|
|
@@ -21832,7 +21834,9 @@ var XHTMLHandler = class extends Handler {
|
|
|
21832
21834
|
return "XHTMLHandler";
|
|
21833
21835
|
}
|
|
21834
21836
|
static register(fetcher2) {
|
|
21835
|
-
fetcher2.mediatypes[XHTMLContentType] = {
|
|
21837
|
+
fetcher2.mediatypes[XHTMLContentType] = {
|
|
21838
|
+
"q": 0.8
|
|
21839
|
+
};
|
|
21836
21840
|
}
|
|
21837
21841
|
parse(fetcher2, responseText, options) {
|
|
21838
21842
|
let relation, reverse;
|
|
@@ -21934,7 +21938,7 @@ var HTMLHandler = class extends Handler {
|
|
|
21934
21938
|
}
|
|
21935
21939
|
static register(fetcher2) {
|
|
21936
21940
|
fetcher2.mediatypes["text/html"] = {
|
|
21937
|
-
"q": 0.
|
|
21941
|
+
"q": 0.8
|
|
21938
21942
|
};
|
|
21939
21943
|
}
|
|
21940
21944
|
parse(fetcher2, responseText, options) {
|
|
@@ -21973,21 +21977,19 @@ var JsonLdHandler = class extends Handler {
|
|
|
21973
21977
|
"q": 0.9
|
|
21974
21978
|
};
|
|
21975
21979
|
}
|
|
21976
|
-
parse(fetcher2, responseText, options, response) {
|
|
21980
|
+
async parse(fetcher2, responseText, options, response) {
|
|
21977
21981
|
const kb = fetcher2.store;
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
}
|
|
21987
|
-
});
|
|
21982
|
+
try {
|
|
21983
|
+
await jsonldParser(responseText, kb, options.original.value);
|
|
21984
|
+
fetcher2.store.add(options.original, ns2.rdf("type"), ns2.link("RDFDocument"), fetcher2.appNode);
|
|
21985
|
+
return fetcher2.doneFetch(options, response);
|
|
21986
|
+
} catch (err) {
|
|
21987
|
+
const msg = "Error trying to parse " + options.resource + " as JSON-LD:\n" + err;
|
|
21988
|
+
return fetcher2.failFetch(options, msg, "parse_error", response);
|
|
21989
|
+
}
|
|
21988
21990
|
}
|
|
21989
21991
|
};
|
|
21990
|
-
JsonLdHandler.pattern = /application\/ld\+json/;
|
|
21992
|
+
JsonLdHandler.pattern = /application\/(ld\+json|activity\+json)/;
|
|
21991
21993
|
var TextHandler = class extends Handler {
|
|
21992
21994
|
static toString() {
|
|
21993
21995
|
return "TextHandler";
|
|
@@ -22018,12 +22020,8 @@ var N3Handler = class extends Handler {
|
|
|
22018
22020
|
return "N3Handler";
|
|
22019
22021
|
}
|
|
22020
22022
|
static register(fetcher2) {
|
|
22021
|
-
fetcher2.mediatypes["text/n3"] = {
|
|
22022
|
-
|
|
22023
|
-
};
|
|
22024
|
-
fetcher2.mediatypes["text/turtle"] = {
|
|
22025
|
-
"q": 1
|
|
22026
|
-
};
|
|
22023
|
+
fetcher2.mediatypes["text/n3"] = {};
|
|
22024
|
+
fetcher2.mediatypes["text/turtle"] = {};
|
|
22027
22025
|
}
|
|
22028
22026
|
parse(fetcher2, responseText, options, response) {
|
|
22029
22027
|
let kb = fetcher2.store;
|
|
@@ -22297,7 +22295,7 @@ var Fetcher = class _Fetcher {
|
|
|
22297
22295
|
options.baseURI = options.baseURI || uri;
|
|
22298
22296
|
options.original = kb.rdfFactory.namedNode(options.baseURI);
|
|
22299
22297
|
options.req = kb.bnode();
|
|
22300
|
-
options.headers = options.headers ||
|
|
22298
|
+
options.headers = options.headers || {};
|
|
22301
22299
|
if (options.contentType) {
|
|
22302
22300
|
options.headers["content-type"] = options.contentType;
|
|
22303
22301
|
}
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
serialize,
|
|
14
14
|
st,
|
|
15
15
|
termValue
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-S4UXBIES.js";
|
|
17
17
|
import {
|
|
18
18
|
__commonJS,
|
|
19
19
|
__export,
|
|
@@ -2752,7 +2752,7 @@ var FileFetcher = class {
|
|
|
2752
2752
|
|
|
2753
2753
|
// src/modules/contacts.ts
|
|
2754
2754
|
async function loadContactsModule(store) {
|
|
2755
|
-
const module2 = await import("./dist-
|
|
2755
|
+
const module2 = await import("./dist-O5YU2L4C.js");
|
|
2756
2756
|
return store.loadModule(module2);
|
|
2757
2757
|
}
|
|
2758
2758
|
|
|
@@ -2821,6 +2821,12 @@ var Thing = class {
|
|
|
2821
2821
|
this.store = store;
|
|
2822
2822
|
this.editable = editable;
|
|
2823
2823
|
}
|
|
2824
|
+
/**
|
|
2825
|
+
* Returns a human-readable label for this thing. Tries to match common RDF terms
|
|
2826
|
+
* used for labels, such as `rdfs:label`, `schema:name` and others.
|
|
2827
|
+
*
|
|
2828
|
+
* If no such term is present, it will derive a label from the URI.
|
|
2829
|
+
*/
|
|
2824
2830
|
label() {
|
|
2825
2831
|
const value7 = this.anyValue(
|
|
2826
2832
|
"http://www.w3.org/2006/vcard/ns#fn",
|
|
@@ -2840,6 +2846,9 @@ var Thing = class {
|
|
|
2840
2846
|
}
|
|
2841
2847
|
return labelFromUri(this.uri);
|
|
2842
2848
|
}
|
|
2849
|
+
/**
|
|
2850
|
+
* Returns all the literal values that are linked to this thing
|
|
2851
|
+
*/
|
|
2843
2852
|
literals() {
|
|
2844
2853
|
const statements = this.store.statementsMatching(namedNode(this.uri));
|
|
2845
2854
|
const values2 = statements.filter((it) => isLiteral(it.object)).reduce(accumulateValues, {});
|
|
@@ -2849,6 +2858,9 @@ var Thing = class {
|
|
|
2849
2858
|
values: values2[predicate4]
|
|
2850
2859
|
}));
|
|
2851
2860
|
}
|
|
2861
|
+
/**
|
|
2862
|
+
* Returns all the links from this thing to other resources
|
|
2863
|
+
*/
|
|
2852
2864
|
relations(predicate4) {
|
|
2853
2865
|
const statements = this.store.statementsMatching(
|
|
2854
2866
|
namedNode(this.uri),
|
|
@@ -2861,6 +2873,9 @@ var Thing = class {
|
|
|
2861
2873
|
uris: values2[predicate5]
|
|
2862
2874
|
}));
|
|
2863
2875
|
}
|
|
2876
|
+
/**
|
|
2877
|
+
* Returns all the links from other resources to this thing
|
|
2878
|
+
*/
|
|
2864
2879
|
reverseRelations(predicate4) {
|
|
2865
2880
|
const statements = this.store.statementsMatching(
|
|
2866
2881
|
void 0,
|
|
@@ -2874,6 +2889,10 @@ var Thing = class {
|
|
|
2874
2889
|
uris: values2[predicate5]
|
|
2875
2890
|
}));
|
|
2876
2891
|
}
|
|
2892
|
+
/**
|
|
2893
|
+
* Returns any value linked from this thing via one of the given predicates
|
|
2894
|
+
* @param predicateUris
|
|
2895
|
+
*/
|
|
2877
2896
|
anyValue(...predicateUris) {
|
|
2878
2897
|
let value7;
|
|
2879
2898
|
predicateUris.some((it) => {
|
|
@@ -2882,6 +2901,10 @@ var Thing = class {
|
|
|
2882
2901
|
});
|
|
2883
2902
|
return value7;
|
|
2884
2903
|
}
|
|
2904
|
+
/**
|
|
2905
|
+
* Returns a literal value that describes this thing. Tries to match common RDF terms
|
|
2906
|
+
* used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
|
|
2907
|
+
*/
|
|
2885
2908
|
description() {
|
|
2886
2909
|
return this.anyValue(
|
|
2887
2910
|
"http://purl.org/dc/terms/description",
|
|
@@ -2895,6 +2918,13 @@ var Thing = class {
|
|
|
2895
2918
|
"http://www.w3.org/2006/vcard/ns#note"
|
|
2896
2919
|
);
|
|
2897
2920
|
}
|
|
2921
|
+
/**
|
|
2922
|
+
* Returns the url of a picture or logo associated with this thing
|
|
2923
|
+
* Tries to match common RDF terms used for pictures like `schema:image`,
|
|
2924
|
+
* `vcard:photo` or `foaf:img`
|
|
2925
|
+
*
|
|
2926
|
+
* @return {Object} An object containing the `url` of the picture
|
|
2927
|
+
*/
|
|
2898
2928
|
picture() {
|
|
2899
2929
|
const directUrl = this.anyValue(
|
|
2900
2930
|
"http://schema.org/image",
|
|
@@ -2936,6 +2966,9 @@ var Thing = class {
|
|
|
2936
2966
|
url: url7
|
|
2937
2967
|
} : null;
|
|
2938
2968
|
}
|
|
2969
|
+
/**
|
|
2970
|
+
* Retrieves a list of RDF types for this thing.
|
|
2971
|
+
*/
|
|
2939
2972
|
types() {
|
|
2940
2973
|
const uriMap = this.store.findTypeURIs(namedNode(this.uri));
|
|
2941
2974
|
return Object.keys(uriMap).map((uri6) => ({
|
|
@@ -2943,6 +2976,11 @@ var Thing = class {
|
|
|
2943
2976
|
label: labelForType(uri6)
|
|
2944
2977
|
}));
|
|
2945
2978
|
}
|
|
2979
|
+
/**
|
|
2980
|
+
* Call this method to switch to a more specific subclass of Thing.
|
|
2981
|
+
*
|
|
2982
|
+
* @param SpecificThing - a subclass of Thing to assume
|
|
2983
|
+
*/
|
|
2946
2984
|
assume(SpecificThing) {
|
|
2947
2985
|
return new SpecificThing(this.uri, this.store, this.editable);
|
|
2948
2986
|
}
|
|
@@ -3175,7 +3213,7 @@ var SearchGateway = class {
|
|
|
3175
3213
|
}
|
|
3176
3214
|
/**
|
|
3177
3215
|
* Fetch the private label index for the given profile and build a search index from it
|
|
3178
|
-
* @param
|
|
3216
|
+
* @param profile
|
|
3179
3217
|
*/
|
|
3180
3218
|
async buildSearchIndex(profile2) {
|
|
3181
3219
|
const labelIndexUris = profile2.getPrivateLabelIndexes();
|
|
@@ -24836,7 +24874,7 @@ var PodOS = class {
|
|
|
24836
24874
|
}
|
|
24837
24875
|
/**
|
|
24838
24876
|
* Fetch the private label index for the given profile and build a search index from it
|
|
24839
|
-
* @param
|
|
24877
|
+
* @param profile
|
|
24840
24878
|
*/
|
|
24841
24879
|
async buildSearchIndex(profile2) {
|
|
24842
24880
|
return this.searchGateway.buildSearchIndex(profile2);
|
|
@@ -24883,7 +24921,9 @@ export {
|
|
|
24883
24921
|
RdfDocument,
|
|
24884
24922
|
SearchGateway,
|
|
24885
24923
|
SearchIndex,
|
|
24924
|
+
Store,
|
|
24886
24925
|
Thing,
|
|
24926
|
+
UriService,
|
|
24887
24927
|
WebIdProfile,
|
|
24888
24928
|
labelFromUri,
|
|
24889
24929
|
listKnownTerms
|
package/lib/index.js
CHANGED
|
@@ -12948,7 +12948,8 @@ var PodOS = (() => {
|
|
|
12948
12948
|
_defineProperty(this, "_universalVariables", void 0);
|
|
12949
12949
|
_defineProperty(this, "_existentialVariables", void 0);
|
|
12950
12950
|
_defineProperty(this, "rdfArrayRemove", void 0);
|
|
12951
|
-
_defineProperty(this, "dataCallbacks",
|
|
12951
|
+
_defineProperty(this, "dataCallbacks", []);
|
|
12952
|
+
_defineProperty(this, "dataRemovalCallbacks", []);
|
|
12952
12953
|
this.propertyActions = {};
|
|
12953
12954
|
this.classActions = {};
|
|
12954
12955
|
this.redirections = [];
|
|
@@ -12971,6 +12972,9 @@ var PodOS = (() => {
|
|
|
12971
12972
|
if (opts.dataCallback) {
|
|
12972
12973
|
this.dataCallbacks = [opts.dataCallback];
|
|
12973
12974
|
}
|
|
12975
|
+
if (opts.dataRemovalCallback) {
|
|
12976
|
+
this.dataRemovalCallbacks = [opts.dataRemovalCallback];
|
|
12977
|
+
}
|
|
12974
12978
|
this.initPropertyActions(this.features);
|
|
12975
12979
|
}
|
|
12976
12980
|
/**
|
|
@@ -12996,11 +13000,11 @@ var PodOS = (() => {
|
|
|
12996
13000
|
* @param cb
|
|
12997
13001
|
*/
|
|
12998
13002
|
addDataCallback(cb) {
|
|
12999
|
-
if (!this.dataCallbacks) {
|
|
13000
|
-
this.dataCallbacks = [];
|
|
13001
|
-
}
|
|
13002
13003
|
this.dataCallbacks.push(cb);
|
|
13003
13004
|
}
|
|
13005
|
+
addDataRemovalCallback(cb) {
|
|
13006
|
+
this.dataRemovalCallbacks.push(cb);
|
|
13007
|
+
}
|
|
13004
13008
|
/**
|
|
13005
13009
|
* Apply a set of statements to be deleted and to be inserted
|
|
13006
13010
|
*
|
|
@@ -13178,10 +13182,8 @@ var PodOS = (() => {
|
|
|
13178
13182
|
ix[h].push(st2);
|
|
13179
13183
|
}
|
|
13180
13184
|
this.statements.push(st2);
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
callback(st2);
|
|
13184
|
-
}
|
|
13185
|
+
for (const callback of this.dataCallbacks) {
|
|
13186
|
+
callback(st2);
|
|
13185
13187
|
}
|
|
13186
13188
|
return st2;
|
|
13187
13189
|
}
|
|
@@ -13577,6 +13579,9 @@ var PodOS = (() => {
|
|
|
13577
13579
|
}
|
|
13578
13580
|
}
|
|
13579
13581
|
this.rdfArrayRemove(this.statements, st2);
|
|
13582
|
+
for (const callback of this.dataRemovalCallbacks) {
|
|
13583
|
+
callback(st2);
|
|
13584
|
+
}
|
|
13580
13585
|
return this;
|
|
13581
13586
|
}
|
|
13582
13587
|
/**
|
|
@@ -23676,16 +23681,13 @@ var PodOS = (() => {
|
|
|
23676
23681
|
}
|
|
23677
23682
|
return kb.rdfFactory.collection(obj.map((o) => jsonldObjectToTerm(kb, o)));
|
|
23678
23683
|
}
|
|
23679
|
-
function jsonldParser(str, kb, base2
|
|
23684
|
+
async function jsonldParser(str, kb, base2) {
|
|
23680
23685
|
const baseString = base2 && Object.prototype.hasOwnProperty.call(base2, "termType") ? base2.value : base2;
|
|
23681
|
-
|
|
23682
|
-
|
|
23683
|
-
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
kb = processResource(kb, base2, flatResource);
|
|
23687
|
-
return kb;
|
|
23688
|
-
}, kb)).then(callback).catch(callback);
|
|
23686
|
+
const jsonld = await Promise.resolve().then(() => __toESM(require_jsonld()));
|
|
23687
|
+
const flattened = await jsonld.default.flatten(JSON.parse(str), null, {
|
|
23688
|
+
base: baseString
|
|
23689
|
+
});
|
|
23690
|
+
return flattened.reduce((store, flatResource) => processResource(store, base2, flatResource), kb);
|
|
23689
23691
|
}
|
|
23690
23692
|
function nodeType(kb, obj) {
|
|
23691
23693
|
if (obj["@id"].startsWith("_:")) {
|
|
@@ -28577,7 +28579,7 @@ var PodOS = (() => {
|
|
|
28577
28579
|
sparqlUpdateParser(str, kb, base2);
|
|
28578
28580
|
executeCallback();
|
|
28579
28581
|
} else if (contentType4 === JSONLDContentType) {
|
|
28580
|
-
jsonldParser(str, kb, base2
|
|
28582
|
+
jsonldParser(str, kb, base2).then(executeCallback).catch(executeErrorCallback);
|
|
28581
28583
|
} else if (contentType4 === NQuadsContentType || contentType4 === NQuadsAltContentType) {
|
|
28582
28584
|
var n3Parser = new N3Parser({
|
|
28583
28585
|
factory: extended_term_factory_default
|
|
@@ -29327,7 +29329,9 @@ var PodOS = (() => {
|
|
|
29327
29329
|
return "XHTMLHandler";
|
|
29328
29330
|
}
|
|
29329
29331
|
static register(fetcher2) {
|
|
29330
|
-
fetcher2.mediatypes[XHTMLContentType] = {
|
|
29332
|
+
fetcher2.mediatypes[XHTMLContentType] = {
|
|
29333
|
+
"q": 0.8
|
|
29334
|
+
};
|
|
29331
29335
|
}
|
|
29332
29336
|
parse(fetcher2, responseText, options) {
|
|
29333
29337
|
let relation4, reverse;
|
|
@@ -29429,7 +29433,7 @@ var PodOS = (() => {
|
|
|
29429
29433
|
}
|
|
29430
29434
|
static register(fetcher2) {
|
|
29431
29435
|
fetcher2.mediatypes["text/html"] = {
|
|
29432
|
-
"q": 0.
|
|
29436
|
+
"q": 0.8
|
|
29433
29437
|
};
|
|
29434
29438
|
}
|
|
29435
29439
|
parse(fetcher2, responseText, options) {
|
|
@@ -29468,21 +29472,19 @@ var PodOS = (() => {
|
|
|
29468
29472
|
"q": 0.9
|
|
29469
29473
|
};
|
|
29470
29474
|
}
|
|
29471
|
-
parse(fetcher2, responseText, options, response6) {
|
|
29475
|
+
async parse(fetcher2, responseText, options, response6) {
|
|
29472
29476
|
const kb = fetcher2.store;
|
|
29473
|
-
|
|
29474
|
-
|
|
29475
|
-
|
|
29476
|
-
|
|
29477
|
-
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
}
|
|
29482
|
-
});
|
|
29477
|
+
try {
|
|
29478
|
+
await jsonldParser(responseText, kb, options.original.value);
|
|
29479
|
+
fetcher2.store.add(options.original, ns2.rdf("type"), ns2.link("RDFDocument"), fetcher2.appNode);
|
|
29480
|
+
return fetcher2.doneFetch(options, response6);
|
|
29481
|
+
} catch (err) {
|
|
29482
|
+
const msg = "Error trying to parse " + options.resource + " as JSON-LD:\n" + err;
|
|
29483
|
+
return fetcher2.failFetch(options, msg, "parse_error", response6);
|
|
29484
|
+
}
|
|
29483
29485
|
}
|
|
29484
29486
|
};
|
|
29485
|
-
JsonLdHandler.pattern = /application\/ld\+json/;
|
|
29487
|
+
JsonLdHandler.pattern = /application\/(ld\+json|activity\+json)/;
|
|
29486
29488
|
TextHandler = class extends Handler {
|
|
29487
29489
|
static toString() {
|
|
29488
29490
|
return "TextHandler";
|
|
@@ -29513,12 +29515,8 @@ var PodOS = (() => {
|
|
|
29513
29515
|
return "N3Handler";
|
|
29514
29516
|
}
|
|
29515
29517
|
static register(fetcher2) {
|
|
29516
|
-
fetcher2.mediatypes["text/n3"] = {
|
|
29517
|
-
|
|
29518
|
-
};
|
|
29519
|
-
fetcher2.mediatypes["text/turtle"] = {
|
|
29520
|
-
"q": 1
|
|
29521
|
-
};
|
|
29518
|
+
fetcher2.mediatypes["text/n3"] = {};
|
|
29519
|
+
fetcher2.mediatypes["text/turtle"] = {};
|
|
29522
29520
|
}
|
|
29523
29521
|
parse(fetcher2, responseText, options, response6) {
|
|
29524
29522
|
let kb = fetcher2.store;
|
|
@@ -29776,7 +29774,7 @@ var PodOS = (() => {
|
|
|
29776
29774
|
options.baseURI = options.baseURI || uri6;
|
|
29777
29775
|
options.original = kb.rdfFactory.namedNode(options.baseURI);
|
|
29778
29776
|
options.req = kb.bnode();
|
|
29779
|
-
options.headers = options.headers ||
|
|
29777
|
+
options.headers = options.headers || {};
|
|
29780
29778
|
if (options.contentType) {
|
|
29781
29779
|
options.headers["content-type"] = options.contentType;
|
|
29782
29780
|
}
|
|
@@ -34756,7 +34754,9 @@ _:patch
|
|
|
34756
34754
|
RdfDocument: () => RdfDocument,
|
|
34757
34755
|
SearchGateway: () => SearchGateway,
|
|
34758
34756
|
SearchIndex: () => SearchIndex,
|
|
34757
|
+
Store: () => Store,
|
|
34759
34758
|
Thing: () => Thing,
|
|
34759
|
+
UriService: () => UriService,
|
|
34760
34760
|
WebIdProfile: () => WebIdProfile,
|
|
34761
34761
|
labelFromUri: () => labelFromUri,
|
|
34762
34762
|
listKnownTerms: () => listKnownTerms
|
|
@@ -35789,6 +35789,12 @@ _:patch
|
|
|
35789
35789
|
this.store = store;
|
|
35790
35790
|
this.editable = editable;
|
|
35791
35791
|
}
|
|
35792
|
+
/**
|
|
35793
|
+
* Returns a human-readable label for this thing. Tries to match common RDF terms
|
|
35794
|
+
* used for labels, such as `rdfs:label`, `schema:name` and others.
|
|
35795
|
+
*
|
|
35796
|
+
* If no such term is present, it will derive a label from the URI.
|
|
35797
|
+
*/
|
|
35792
35798
|
label() {
|
|
35793
35799
|
const value7 = this.anyValue(
|
|
35794
35800
|
"http://www.w3.org/2006/vcard/ns#fn",
|
|
@@ -35808,6 +35814,9 @@ _:patch
|
|
|
35808
35814
|
}
|
|
35809
35815
|
return labelFromUri(this.uri);
|
|
35810
35816
|
}
|
|
35817
|
+
/**
|
|
35818
|
+
* Returns all the literal values that are linked to this thing
|
|
35819
|
+
*/
|
|
35811
35820
|
literals() {
|
|
35812
35821
|
const statements = this.store.statementsMatching(namedNode(this.uri));
|
|
35813
35822
|
const values2 = statements.filter((it) => isLiteral(it.object)).reduce(accumulateValues, {});
|
|
@@ -35817,6 +35826,9 @@ _:patch
|
|
|
35817
35826
|
values: values2[predicate4]
|
|
35818
35827
|
}));
|
|
35819
35828
|
}
|
|
35829
|
+
/**
|
|
35830
|
+
* Returns all the links from this thing to other resources
|
|
35831
|
+
*/
|
|
35820
35832
|
relations(predicate4) {
|
|
35821
35833
|
const statements = this.store.statementsMatching(
|
|
35822
35834
|
namedNode(this.uri),
|
|
@@ -35829,6 +35841,9 @@ _:patch
|
|
|
35829
35841
|
uris: values2[predicate5]
|
|
35830
35842
|
}));
|
|
35831
35843
|
}
|
|
35844
|
+
/**
|
|
35845
|
+
* Returns all the links from other resources to this thing
|
|
35846
|
+
*/
|
|
35832
35847
|
reverseRelations(predicate4) {
|
|
35833
35848
|
const statements = this.store.statementsMatching(
|
|
35834
35849
|
void 0,
|
|
@@ -35842,6 +35857,10 @@ _:patch
|
|
|
35842
35857
|
uris: values2[predicate5]
|
|
35843
35858
|
}));
|
|
35844
35859
|
}
|
|
35860
|
+
/**
|
|
35861
|
+
* Returns any value linked from this thing via one of the given predicates
|
|
35862
|
+
* @param predicateUris
|
|
35863
|
+
*/
|
|
35845
35864
|
anyValue(...predicateUris) {
|
|
35846
35865
|
let value7;
|
|
35847
35866
|
predicateUris.some((it) => {
|
|
@@ -35850,6 +35869,10 @@ _:patch
|
|
|
35850
35869
|
});
|
|
35851
35870
|
return value7;
|
|
35852
35871
|
}
|
|
35872
|
+
/**
|
|
35873
|
+
* Returns a literal value that describes this thing. Tries to match common RDF terms
|
|
35874
|
+
* used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
|
|
35875
|
+
*/
|
|
35853
35876
|
description() {
|
|
35854
35877
|
return this.anyValue(
|
|
35855
35878
|
"http://purl.org/dc/terms/description",
|
|
@@ -35863,6 +35886,13 @@ _:patch
|
|
|
35863
35886
|
"http://www.w3.org/2006/vcard/ns#note"
|
|
35864
35887
|
);
|
|
35865
35888
|
}
|
|
35889
|
+
/**
|
|
35890
|
+
* Returns the url of a picture or logo associated with this thing
|
|
35891
|
+
* Tries to match common RDF terms used for pictures like `schema:image`,
|
|
35892
|
+
* `vcard:photo` or `foaf:img`
|
|
35893
|
+
*
|
|
35894
|
+
* @return {Object} An object containing the `url` of the picture
|
|
35895
|
+
*/
|
|
35866
35896
|
picture() {
|
|
35867
35897
|
const directUrl = this.anyValue(
|
|
35868
35898
|
"http://schema.org/image",
|
|
@@ -35904,6 +35934,9 @@ _:patch
|
|
|
35904
35934
|
url: url7
|
|
35905
35935
|
} : null;
|
|
35906
35936
|
}
|
|
35937
|
+
/**
|
|
35938
|
+
* Retrieves a list of RDF types for this thing.
|
|
35939
|
+
*/
|
|
35907
35940
|
types() {
|
|
35908
35941
|
const uriMap = this.store.findTypeURIs(namedNode(this.uri));
|
|
35909
35942
|
return Object.keys(uriMap).map((uri6) => ({
|
|
@@ -35911,6 +35944,11 @@ _:patch
|
|
|
35911
35944
|
label: labelForType(uri6)
|
|
35912
35945
|
}));
|
|
35913
35946
|
}
|
|
35947
|
+
/**
|
|
35948
|
+
* Call this method to switch to a more specific subclass of Thing.
|
|
35949
|
+
*
|
|
35950
|
+
* @param SpecificThing - a subclass of Thing to assume
|
|
35951
|
+
*/
|
|
35914
35952
|
assume(SpecificThing) {
|
|
35915
35953
|
return new SpecificThing(this.uri, this.store, this.editable);
|
|
35916
35954
|
}
|
|
@@ -36153,7 +36191,7 @@ _:patch
|
|
|
36153
36191
|
}
|
|
36154
36192
|
/**
|
|
36155
36193
|
* Fetch the private label index for the given profile and build a search index from it
|
|
36156
|
-
* @param
|
|
36194
|
+
* @param profile
|
|
36157
36195
|
*/
|
|
36158
36196
|
async buildSearchIndex(profile2) {
|
|
36159
36197
|
const labelIndexUris = profile2.getPrivateLabelIndexes();
|
|
@@ -57819,7 +57857,7 @@ _:patch
|
|
|
57819
57857
|
}
|
|
57820
57858
|
/**
|
|
57821
57859
|
* Fetch the private label index for the given profile and build a search index from it
|
|
57822
|
-
* @param
|
|
57860
|
+
* @param profile
|
|
57823
57861
|
*/
|
|
57824
57862
|
async buildSearchIndex(profile2) {
|
|
57825
57863
|
return this.searchGateway.buildSearchIndex(profile2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/core",
|
|
3
|
-
"version": "0.18.1-rc.
|
|
3
|
+
"version": "0.18.1-rc.f02795a.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"buffer": "^6.0.3",
|
|
54
54
|
"lunr": "^2.3.9",
|
|
55
55
|
"rdf-namespaces": "^1.16.0",
|
|
56
|
-
"rdflib": "
|
|
56
|
+
"rdflib": "2.3.0",
|
|
57
57
|
"rxjs": "^7.8.2",
|
|
58
58
|
"slugify": "^1.6.6",
|
|
59
59
|
"url": "^0.11.4"
|
package/types/Store.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export * from "./profile";
|
|
|
19
19
|
export * from "./search";
|
|
20
20
|
export * from "./offline-cache";
|
|
21
21
|
export * from "./terms";
|
|
22
|
+
export * from "./Store";
|
|
23
|
+
export * from "./uri";
|
|
22
24
|
export interface PodOsConfiguration {
|
|
23
25
|
offlineCache?: OfflineCache;
|
|
24
26
|
onlineStatus?: OnlineStatus;
|
|
@@ -52,7 +54,7 @@ export declare class PodOS {
|
|
|
52
54
|
fetchProfile(webId: string): Promise<WebIdProfile>;
|
|
53
55
|
/**
|
|
54
56
|
* Fetch the private label index for the given profile and build a search index from it
|
|
55
|
-
* @param
|
|
57
|
+
* @param profile
|
|
56
58
|
*/
|
|
57
59
|
buildSearchIndex(profile: WebIdProfile): Promise<import("./search").SearchIndex>;
|
|
58
60
|
logout(): Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { OfflineCapableFetcher } from "./OfflineCapableFetcher";
|
|
1
|
+
export { OfflineCapableFetcher, OfflineCapableFetcherOptions, } from "./OfflineCapableFetcher";
|
|
2
2
|
export { OfflineCache, CachedRdfDocument, NoOfflineCache, } from "./OfflineCache";
|
|
3
3
|
export { OnlineStatus, AssumeAlwaysOnline } from "./OnlineStatus";
|
|
@@ -8,7 +8,7 @@ export declare class SearchGateway {
|
|
|
8
8
|
constructor(store: Store);
|
|
9
9
|
/**
|
|
10
10
|
* Fetch the private label index for the given profile and build a search index from it
|
|
11
|
-
* @param
|
|
11
|
+
* @param profile
|
|
12
12
|
*/
|
|
13
13
|
buildSearchIndex(profile: WebIdProfile): Promise<SearchIndex>;
|
|
14
14
|
addToLabelIndex(thing: Thing, labelIndex: LabelIndex): Promise<void>;
|
package/types/thing/Thing.d.ts
CHANGED
|
@@ -25,16 +25,54 @@ export declare class Thing {
|
|
|
25
25
|
* Whether the Thing can be edited according to its access control settings
|
|
26
26
|
*/
|
|
27
27
|
editable?: boolean);
|
|
28
|
+
/**
|
|
29
|
+
* Returns a human-readable label for this thing. Tries to match common RDF terms
|
|
30
|
+
* used for labels, such as `rdfs:label`, `schema:name` and others.
|
|
31
|
+
*
|
|
32
|
+
* If no such term is present, it will derive a label from the URI.
|
|
33
|
+
*/
|
|
28
34
|
label(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Returns all the literal values that are linked to this thing
|
|
37
|
+
*/
|
|
29
38
|
literals(): Literal[];
|
|
39
|
+
/**
|
|
40
|
+
* Returns all the links from this thing to other resources
|
|
41
|
+
*/
|
|
30
42
|
relations(predicate?: string): Relation[];
|
|
43
|
+
/**
|
|
44
|
+
* Returns all the links from other resources to this thing
|
|
45
|
+
*/
|
|
31
46
|
reverseRelations(predicate?: string): Relation[];
|
|
47
|
+
/**
|
|
48
|
+
* Returns any value linked from this thing via one of the given predicates
|
|
49
|
+
* @param predicateUris
|
|
50
|
+
*/
|
|
32
51
|
anyValue(...predicateUris: string[]): undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a literal value that describes this thing. Tries to match common RDF terms
|
|
54
|
+
* used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
|
|
55
|
+
*/
|
|
33
56
|
description(): undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the url of a picture or logo associated with this thing
|
|
59
|
+
* Tries to match common RDF terms used for pictures like `schema:image`,
|
|
60
|
+
* `vcard:photo` or `foaf:img`
|
|
61
|
+
*
|
|
62
|
+
* @return {Object} An object containing the `url` of the picture
|
|
63
|
+
*/
|
|
34
64
|
picture(): {
|
|
35
65
|
url: string;
|
|
36
66
|
} | null;
|
|
37
67
|
private findActivityStreamsPicture;
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves a list of RDF types for this thing.
|
|
70
|
+
*/
|
|
38
71
|
types(): RdfType[];
|
|
72
|
+
/**
|
|
73
|
+
* Call this method to switch to a more specific subclass of Thing.
|
|
74
|
+
*
|
|
75
|
+
* @param SpecificThing - a subclass of Thing to assume
|
|
76
|
+
*/
|
|
39
77
|
assume<T>(SpecificThing: new (uri: string, store: IndexedFormula, editable: boolean) => T): T;
|
|
40
78
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UriService } from "./UriService";
|