@pod-os/core 0.31.0-rc.f50f005.0 → 0.31.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 CHANGED
@@ -28261,23 +28261,22 @@ var Fetcher = class _Fetcher {
28261
28261
  linkData(originalUri, rel2, uri6, why, reverse) {
28262
28262
  if (!uri6) return;
28263
28263
  let kb = this.store;
28264
- let predicate4;
28265
28264
  let obj = kb.rdfFactory.namedNode(join(uri6, originalUri.value));
28265
+ let predicates;
28266
28266
  if (rel2 === "alternate" || rel2 === "seeAlso" || rel2 === "meta" || rel2 === "describedby") {
28267
28267
  if (obj.value === originalUri.value) {
28268
28268
  return;
28269
28269
  }
28270
- predicate4 = this.ns.rdfs("seeAlso");
28270
+ predicates = [kb.rdfFactory.namedNode(this.ianaLinkRelation(rel2)), this.ns.rdfs("seeAlso")];
28271
28271
  } else if (rel2 === "type") {
28272
- predicate4 = kb.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
28272
+ predicates = [kb.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")];
28273
28273
  } else {
28274
- predicate4 = kb.rdfFactory.namedNode(join(encodeURIComponent(rel2), "http://www.iana.org/assignments/link-relations/"));
28275
- }
28276
- if (reverse) {
28277
- kb.add(obj, predicate4, originalUri, why);
28278
- } else {
28279
- kb.add(originalUri, predicate4, obj, why);
28274
+ predicates = [kb.rdfFactory.namedNode(this.ianaLinkRelation(rel2))];
28280
28275
  }
28276
+ kb.addAll(predicates.map((predicate4) => reverse ? kb.rdfFactory.quad(obj, predicate4, originalUri, why) : kb.rdfFactory.quad(originalUri, predicate4, obj, why)));
28277
+ }
28278
+ ianaLinkRelation(rel2) {
28279
+ return join(encodeURIComponent(rel2), "http://www.iana.org/assignments/link-relations/");
28281
28280
  }
28282
28281
  parseLinkHeader(linkHeader, originalUri, reqNode) {
28283
28282
  if (!linkHeader) {
@@ -29913,6 +29912,11 @@ var rdfs = Namespace("http://www.w3.org/2000/01/rdf-schema#");
29913
29912
  var pim = Namespace("http://www.w3.org/ns/pim/space#");
29914
29913
  var schema = Namespace("https://schema.org/");
29915
29914
  var flow = Namespace("http://www.w3.org/2005/01/wf/flow#");
29915
+ var iana = Namespace(
29916
+ "http://www.iana.org/assignments/link-relations/"
29917
+ );
29918
+ var link = Namespace("http://www.w3.org/2007/ont/link#");
29919
+ var internal = Namespace("urn:pod-os:internal");
29916
29920
 
29917
29921
  // src/thing/accumulateSubjects.ts
29918
29922
  var accumulateSubjects = (accumulator, current3) => {
@@ -30272,6 +30276,17 @@ var Thing = class {
30272
30276
  const uri6 = new URL(".", baseUri).toString();
30273
30277
  return { uri: uri6 };
30274
30278
  }
30279
+ rdfDocument() {
30280
+ const doc = namedNode2(this.uri).doc();
30281
+ const isRdf = this.store.get(doc.uri).hasType(link("RDFDocument").value);
30282
+ if (isRdf) {
30283
+ return doc.value;
30284
+ }
30285
+ return this.store.anyValue(doc, iana("describedby"), null, internal());
30286
+ }
30287
+ hasType(typeUri) {
30288
+ return this.types().map((it) => it.uri).includes(typeUri);
30289
+ }
30275
30290
  };
30276
30291
 
30277
30292
  // src/ldp-container/LdpContainer.ts
@@ -30826,6 +30841,7 @@ var AssumeAlwaysOnline = class {
30826
30841
  // src/Store.ts
30827
30842
  var Store = class {
30828
30843
  constructor(session4, offlineCache = new NoOfflineCache(), onlineStatus = new AssumeAlwaysOnline(), internalStore = graph()) {
30844
+ this.DESCRIBEDBY = iana("describedby");
30829
30845
  this.internalStore = internalStore;
30830
30846
  this.fetcher = new OfflineCapableFetcher(this.internalStore, {
30831
30847
  fetch: session4.authenticatedFetch,
@@ -30841,11 +30857,13 @@ var Store = class {
30841
30857
  );
30842
30858
  }
30843
30859
  /**
30844
- * Fetch data for the given URI to the internalStore
30860
+ * Fetch data for the given URI to the internalStore.
30861
+ * If the response includes a Link header with rel="describedby",
30862
+ * the metadata document will also be fetched automatically.
30845
30863
  * @param uri
30846
30864
  */
30847
- fetch(uri6) {
30848
- return this.fetcher.load(namedNode2(uri6), {
30865
+ async fetch(uri6) {
30866
+ const response6 = await this.fetcher.load(namedNode2(uri6), {
30849
30867
  // force fetching due to
30850
30868
  // https://github.com/linkeddata/rdflib.js/issues/247
30851
30869
  // and
@@ -30855,6 +30873,28 @@ var Store = class {
30855
30873
  // https://github.com/pod-os/PodOS/issues/17
30856
30874
  credentials: "omit"
30857
30875
  });
30876
+ const descriptionResourceUri = this.internalStore.any(
30877
+ namedNode2(uri6),
30878
+ this.DESCRIBEDBY,
30879
+ null,
30880
+ response6.req
30881
+ );
30882
+ if (descriptionResourceUri) {
30883
+ try {
30884
+ await this.fetcher.load(namedNode2(descriptionResourceUri.value), {
30885
+ force: true,
30886
+ credentials: "omit"
30887
+ });
30888
+ } catch {
30889
+ } finally {
30890
+ this.internalStore.add(
30891
+ namedNode2(uri6),
30892
+ this.DESCRIBEDBY,
30893
+ namedNode2(descriptionResourceUri.value),
30894
+ internal()
30895
+ );
30896
+ }
30897
+ }
30858
30898
  }
30859
30899
  /**
30860
30900
  * Fetch all the given URIs in parallel and put the data to the internalStore
@@ -30878,38 +30918,38 @@ var Store = class {
30878
30918
  * @param property
30879
30919
  * @param value
30880
30920
  */
30881
- addPropertyValue(thing, property4, value8) {
30882
- return this.updater.update(
30883
- [],
30884
- [st(namedNode2(thing.uri), namedNode2(property4), lit(value8), namedNode2(thing.uri).doc())],
30885
- void 0,
30886
- false,
30887
- {
30888
- // explicitly omit credentials due to
30889
- // https://github.com/pod-os/PodOS/issues/17
30890
- credentials: "omit"
30891
- }
30921
+ async addPropertyValue(thing, property4, value8) {
30922
+ const docUrl = this.determineDocumentToUpdate(thing);
30923
+ return this.insert(
30924
+ st(namedNode2(thing.uri), namedNode2(property4), lit(value8), namedNode2(docUrl))
30892
30925
  );
30893
30926
  }
30927
+ insert(statement2) {
30928
+ return this.updater.update([], [statement2], void 0, false, {
30929
+ // explicitly omit credentials due to
30930
+ // https://github.com/pod-os/PodOS/issues/17
30931
+ credentials: "omit"
30932
+ });
30933
+ }
30894
30934
  /**
30895
30935
  * Adds a new relation (link) from the thing to the given uri using the property
30896
30936
  * @param thing
30897
30937
  * @param property
30898
30938
  * @param uri
30899
30939
  */
30900
- addRelation(thing, property4, uri6) {
30901
- return this.updater.update(
30902
- [],
30903
- [st(namedNode2(thing.uri), namedNode2(property4), namedNode2(uri6), namedNode2(thing.uri).doc())],
30904
- void 0,
30905
- false,
30906
- {
30907
- // explicitly omit credentials due to
30908
- // https://github.com/pod-os/PodOS/issues/17
30909
- credentials: "omit"
30910
- }
30940
+ async addRelation(thing, property4, uri6) {
30941
+ const docUrl = this.determineDocumentToUpdate(thing);
30942
+ return this.insert(
30943
+ st(namedNode2(thing.uri), namedNode2(property4), namedNode2(uri6), namedNode2(docUrl))
30911
30944
  );
30912
30945
  }
30946
+ determineDocumentToUpdate(thing) {
30947
+ const docUrl = thing.rdfDocument();
30948
+ if (!docUrl) {
30949
+ throw new Error("Could not determine document to update");
30950
+ }
30951
+ return docUrl;
30952
+ }
30913
30953
  async addNewThing(uri6, name9, type5) {
30914
30954
  await this.updater.update(
30915
30955
  [],
@@ -31123,7 +31163,7 @@ __export(index_es_exports, {
31123
31163
  http: () => http,
31124
31164
  hydra: () => hydra,
31125
31165
  ldp: () => ldp2,
31126
- link: () => link3,
31166
+ link: () => link4,
31127
31167
  log: () => log2,
31128
31168
  meeting: () => meeting,
31129
31169
  owl: () => owl,
@@ -34636,7 +34676,7 @@ var referral = "http://hl7.org/fhir/referral";
34636
34676
  var _conditionality = "http://hl7.org/fhir/_conditionality";
34637
34677
  var AuditEventSourceComponent = "http://hl7.org/fhir/AuditEventSourceComponent";
34638
34678
  var _component = "http://hl7.org/fhir/_component";
34639
- var link = "http://hl7.org/fhir/link";
34679
+ var link2 = "http://hl7.org/fhir/link";
34640
34680
  var _hasStage = "http://hl7.org/fhir/_hasStage";
34641
34681
  var _contentReference = "http://hl7.org/fhir/_contentReference";
34642
34682
  var program = "http://hl7.org/fhir/program";
@@ -38871,7 +38911,7 @@ var fhirImport = /* @__PURE__ */ Object.freeze({
38871
38911
  _conditionality,
38872
38912
  AuditEventSourceComponent,
38873
38913
  _component,
38874
- link,
38914
+ link: link2,
38875
38915
  _hasStage,
38876
38916
  _contentReference,
38877
38917
  program,
@@ -51875,7 +51915,7 @@ var last_reply_date = "http://rdfs.org/sioc/ns#last_reply_date";
51875
51915
  var later_version = "http://rdfs.org/sioc/ns#later_version";
51876
51916
  var latest_version = "http://rdfs.org/sioc/ns#latest_version";
51877
51917
  var likes = "http://rdfs.org/sioc/ns#likes";
51878
- var link2 = "http://rdfs.org/sioc/ns#link";
51918
+ var link3 = "http://rdfs.org/sioc/ns#link";
51879
51919
  var links_to = "http://rdfs.org/sioc/ns#links_to";
51880
51920
  var member_of = "http://rdfs.org/sioc/ns#member_of";
51881
51921
  var mentions3 = "http://rdfs.org/sioc/ns#mentions";
@@ -51974,7 +52014,7 @@ var siocImport = /* @__PURE__ */ Object.freeze({
51974
52014
  later_version,
51975
52015
  latest_version,
51976
52016
  likes,
51977
- link: link2,
52017
+ link: link3,
51978
52018
  links_to,
51979
52019
  member_of,
51980
52020
  mentions: mentions3,
@@ -52755,7 +52795,7 @@ var foaf = foafImport;
52755
52795
  var http = httpImport;
52756
52796
  var hydra = hydraImport;
52757
52797
  var ldp2 = ldpImport;
52758
- var link3 = linkImport;
52798
+ var link4 = linkImport;
52759
52799
  var log2 = logImport;
52760
52800
  var meeting = meetingImport;
52761
52801
  var owl = owlImport;
package/lib/index.js CHANGED
@@ -17478,7 +17478,7 @@ var PodOS = (() => {
17478
17478
  if (!state2.link.hasOwnProperty(state2.graph)) {
17479
17479
  state2.link[state2.graph] = {};
17480
17480
  }
17481
- const link4 = state2.link[state2.graph];
17481
+ const link5 = state2.link[state2.graph];
17482
17482
  const matches = _filterSubjects(state2, subjects2, frame, flags3);
17483
17483
  const ids = Object.keys(matches).sort();
17484
17484
  for (const id4 of ids) {
@@ -17488,15 +17488,15 @@ var PodOS = (() => {
17488
17488
  } else {
17489
17489
  state2.uniqueEmbeds[state2.graph] = state2.uniqueEmbeds[state2.graph] || {};
17490
17490
  }
17491
- if (flags3.embed === "@link" && id4 in link4) {
17492
- _addFrameOutput(parent4, property4, link4[id4]);
17491
+ if (flags3.embed === "@link" && id4 in link5) {
17492
+ _addFrameOutput(parent4, property4, link5[id4]);
17493
17493
  continue;
17494
17494
  }
17495
17495
  const output2 = { "@id": id4 };
17496
17496
  if (id4.indexOf("_:") === 0) {
17497
17497
  util.addValue(state2.bnodeMap, id4, output2, { propertyIsArray: true });
17498
17498
  }
17499
- link4[id4] = output2;
17499
+ link5[id4] = output2;
17500
17500
  if ((flags3.embed === "@first" || flags3.embed === "@last") && state2.is11) {
17501
17501
  throw new JsonLdError(
17502
17502
  "Invalid JSON-LD syntax; invalid value of @embed.",
@@ -36698,23 +36698,22 @@ var PodOS = (() => {
36698
36698
  linkData(originalUri, rel2, uri6, why, reverse) {
36699
36699
  if (!uri6) return;
36700
36700
  let kb = this.store;
36701
- let predicate4;
36702
36701
  let obj = kb.rdfFactory.namedNode(join(uri6, originalUri.value));
36702
+ let predicates;
36703
36703
  if (rel2 === "alternate" || rel2 === "seeAlso" || rel2 === "meta" || rel2 === "describedby") {
36704
36704
  if (obj.value === originalUri.value) {
36705
36705
  return;
36706
36706
  }
36707
- predicate4 = this.ns.rdfs("seeAlso");
36707
+ predicates = [kb.rdfFactory.namedNode(this.ianaLinkRelation(rel2)), this.ns.rdfs("seeAlso")];
36708
36708
  } else if (rel2 === "type") {
36709
- predicate4 = kb.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
36709
+ predicates = [kb.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")];
36710
36710
  } else {
36711
- predicate4 = kb.rdfFactory.namedNode(join(encodeURIComponent(rel2), "http://www.iana.org/assignments/link-relations/"));
36712
- }
36713
- if (reverse) {
36714
- kb.add(obj, predicate4, originalUri, why);
36715
- } else {
36716
- kb.add(originalUri, predicate4, obj, why);
36711
+ predicates = [kb.rdfFactory.namedNode(this.ianaLinkRelation(rel2))];
36717
36712
  }
36713
+ kb.addAll(predicates.map((predicate4) => reverse ? kb.rdfFactory.quad(obj, predicate4, originalUri, why) : kb.rdfFactory.quad(originalUri, predicate4, obj, why)));
36714
+ }
36715
+ ianaLinkRelation(rel2) {
36716
+ return join(encodeURIComponent(rel2), "http://www.iana.org/assignments/link-relations/");
36718
36717
  }
36719
36718
  parseLinkHeader(linkHeader, originalUri, reqNode) {
36720
36719
  if (!linkHeader) {
@@ -38350,6 +38349,11 @@ _:patch
38350
38349
  var pim = Namespace("http://www.w3.org/ns/pim/space#");
38351
38350
  var schema = Namespace("https://schema.org/");
38352
38351
  var flow = Namespace("http://www.w3.org/2005/01/wf/flow#");
38352
+ var iana = Namespace(
38353
+ "http://www.iana.org/assignments/link-relations/"
38354
+ );
38355
+ var link = Namespace("http://www.w3.org/2007/ont/link#");
38356
+ var internal = Namespace("urn:pod-os:internal");
38353
38357
 
38354
38358
  // src/thing/accumulateSubjects.ts
38355
38359
  var accumulateSubjects = (accumulator, current3) => {
@@ -38709,6 +38713,17 @@ _:patch
38709
38713
  const uri6 = new URL(".", baseUri).toString();
38710
38714
  return { uri: uri6 };
38711
38715
  }
38716
+ rdfDocument() {
38717
+ const doc = namedNode2(this.uri).doc();
38718
+ const isRdf = this.store.get(doc.uri).hasType(link("RDFDocument").value);
38719
+ if (isRdf) {
38720
+ return doc.value;
38721
+ }
38722
+ return this.store.anyValue(doc, iana("describedby"), null, internal());
38723
+ }
38724
+ hasType(typeUri) {
38725
+ return this.types().map((it) => it.uri).includes(typeUri);
38726
+ }
38712
38727
  };
38713
38728
 
38714
38729
  // src/ldp-container/LdpContainer.ts
@@ -39263,6 +39278,7 @@ _:patch
39263
39278
  // src/Store.ts
39264
39279
  var Store = class {
39265
39280
  constructor(session4, offlineCache = new NoOfflineCache(), onlineStatus = new AssumeAlwaysOnline(), internalStore = graph()) {
39281
+ this.DESCRIBEDBY = iana("describedby");
39266
39282
  this.internalStore = internalStore;
39267
39283
  this.fetcher = new OfflineCapableFetcher(this.internalStore, {
39268
39284
  fetch: session4.authenticatedFetch,
@@ -39278,11 +39294,13 @@ _:patch
39278
39294
  );
39279
39295
  }
39280
39296
  /**
39281
- * Fetch data for the given URI to the internalStore
39297
+ * Fetch data for the given URI to the internalStore.
39298
+ * If the response includes a Link header with rel="describedby",
39299
+ * the metadata document will also be fetched automatically.
39282
39300
  * @param uri
39283
39301
  */
39284
- fetch(uri6) {
39285
- return this.fetcher.load(namedNode2(uri6), {
39302
+ async fetch(uri6) {
39303
+ const response6 = await this.fetcher.load(namedNode2(uri6), {
39286
39304
  // force fetching due to
39287
39305
  // https://github.com/linkeddata/rdflib.js/issues/247
39288
39306
  // and
@@ -39292,6 +39310,28 @@ _:patch
39292
39310
  // https://github.com/pod-os/PodOS/issues/17
39293
39311
  credentials: "omit"
39294
39312
  });
39313
+ const descriptionResourceUri = this.internalStore.any(
39314
+ namedNode2(uri6),
39315
+ this.DESCRIBEDBY,
39316
+ null,
39317
+ response6.req
39318
+ );
39319
+ if (descriptionResourceUri) {
39320
+ try {
39321
+ await this.fetcher.load(namedNode2(descriptionResourceUri.value), {
39322
+ force: true,
39323
+ credentials: "omit"
39324
+ });
39325
+ } catch {
39326
+ } finally {
39327
+ this.internalStore.add(
39328
+ namedNode2(uri6),
39329
+ this.DESCRIBEDBY,
39330
+ namedNode2(descriptionResourceUri.value),
39331
+ internal()
39332
+ );
39333
+ }
39334
+ }
39295
39335
  }
39296
39336
  /**
39297
39337
  * Fetch all the given URIs in parallel and put the data to the internalStore
@@ -39315,38 +39355,38 @@ _:patch
39315
39355
  * @param property
39316
39356
  * @param value
39317
39357
  */
39318
- addPropertyValue(thing, property4, value8) {
39319
- return this.updater.update(
39320
- [],
39321
- [st(namedNode2(thing.uri), namedNode2(property4), lit(value8), namedNode2(thing.uri).doc())],
39322
- void 0,
39323
- false,
39324
- {
39325
- // explicitly omit credentials due to
39326
- // https://github.com/pod-os/PodOS/issues/17
39327
- credentials: "omit"
39328
- }
39358
+ async addPropertyValue(thing, property4, value8) {
39359
+ const docUrl = this.determineDocumentToUpdate(thing);
39360
+ return this.insert(
39361
+ st(namedNode2(thing.uri), namedNode2(property4), lit(value8), namedNode2(docUrl))
39329
39362
  );
39330
39363
  }
39364
+ insert(statement2) {
39365
+ return this.updater.update([], [statement2], void 0, false, {
39366
+ // explicitly omit credentials due to
39367
+ // https://github.com/pod-os/PodOS/issues/17
39368
+ credentials: "omit"
39369
+ });
39370
+ }
39331
39371
  /**
39332
39372
  * Adds a new relation (link) from the thing to the given uri using the property
39333
39373
  * @param thing
39334
39374
  * @param property
39335
39375
  * @param uri
39336
39376
  */
39337
- addRelation(thing, property4, uri6) {
39338
- return this.updater.update(
39339
- [],
39340
- [st(namedNode2(thing.uri), namedNode2(property4), namedNode2(uri6), namedNode2(thing.uri).doc())],
39341
- void 0,
39342
- false,
39343
- {
39344
- // explicitly omit credentials due to
39345
- // https://github.com/pod-os/PodOS/issues/17
39346
- credentials: "omit"
39347
- }
39377
+ async addRelation(thing, property4, uri6) {
39378
+ const docUrl = this.determineDocumentToUpdate(thing);
39379
+ return this.insert(
39380
+ st(namedNode2(thing.uri), namedNode2(property4), namedNode2(uri6), namedNode2(docUrl))
39348
39381
  );
39349
39382
  }
39383
+ determineDocumentToUpdate(thing) {
39384
+ const docUrl = thing.rdfDocument();
39385
+ if (!docUrl) {
39386
+ throw new Error("Could not determine document to update");
39387
+ }
39388
+ return docUrl;
39389
+ }
39350
39390
  async addNewThing(uri6, name9, type5) {
39351
39391
  await this.updater.update(
39352
39392
  [],
@@ -39560,7 +39600,7 @@ _:patch
39560
39600
  http: () => http,
39561
39601
  hydra: () => hydra,
39562
39602
  ldp: () => ldp2,
39563
- link: () => link3,
39603
+ link: () => link4,
39564
39604
  log: () => log2,
39565
39605
  meeting: () => meeting,
39566
39606
  owl: () => owl,
@@ -43073,7 +43113,7 @@ _:patch
43073
43113
  var _conditionality = "http://hl7.org/fhir/_conditionality";
43074
43114
  var AuditEventSourceComponent = "http://hl7.org/fhir/AuditEventSourceComponent";
43075
43115
  var _component = "http://hl7.org/fhir/_component";
43076
- var link = "http://hl7.org/fhir/link";
43116
+ var link2 = "http://hl7.org/fhir/link";
43077
43117
  var _hasStage = "http://hl7.org/fhir/_hasStage";
43078
43118
  var _contentReference = "http://hl7.org/fhir/_contentReference";
43079
43119
  var program = "http://hl7.org/fhir/program";
@@ -47308,7 +47348,7 @@ _:patch
47308
47348
  _conditionality,
47309
47349
  AuditEventSourceComponent,
47310
47350
  _component,
47311
- link,
47351
+ link: link2,
47312
47352
  _hasStage,
47313
47353
  _contentReference,
47314
47354
  program,
@@ -60312,7 +60352,7 @@ _:patch
60312
60352
  var later_version = "http://rdfs.org/sioc/ns#later_version";
60313
60353
  var latest_version = "http://rdfs.org/sioc/ns#latest_version";
60314
60354
  var likes = "http://rdfs.org/sioc/ns#likes";
60315
- var link2 = "http://rdfs.org/sioc/ns#link";
60355
+ var link3 = "http://rdfs.org/sioc/ns#link";
60316
60356
  var links_to = "http://rdfs.org/sioc/ns#links_to";
60317
60357
  var member_of = "http://rdfs.org/sioc/ns#member_of";
60318
60358
  var mentions3 = "http://rdfs.org/sioc/ns#mentions";
@@ -60411,7 +60451,7 @@ _:patch
60411
60451
  later_version,
60412
60452
  latest_version,
60413
60453
  likes,
60414
- link: link2,
60454
+ link: link3,
60415
60455
  links_to,
60416
60456
  member_of,
60417
60457
  mentions: mentions3,
@@ -61192,7 +61232,7 @@ _:patch
61192
61232
  var http = httpImport;
61193
61233
  var hydra = hydraImport;
61194
61234
  var ldp2 = ldpImport;
61195
- var link3 = linkImport;
61235
+ var link4 = linkImport;
61196
61236
  var log2 = logImport;
61197
61237
  var meeting = meetingImport;
61198
61238
  var owl = owlImport;
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.31.0-rc.f50f005.0",
4
+ "version": "0.31.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./types/index.d.ts",
@@ -68,7 +68,7 @@
68
68
  "mime": "^4.1.0",
69
69
  "neverthrow": "^8.2.0",
70
70
  "rdf-namespaces": "^1.17.0",
71
- "rdflib": "2.3.9",
71
+ "rdflib": "2.4.0",
72
72
  "rxjs": "^7.8.2",
73
73
  "slugify": "^1.6.9",
74
74
  "url": "^0.11.4",
package/types/Store.d.ts CHANGED
@@ -16,16 +16,19 @@ export declare class Store {
16
16
  removals$: Subject<Quad>;
17
17
  private readonly internalStore;
18
18
  constructor(session: PodOsSession, offlineCache?: OfflineCache, onlineStatus?: OnlineStatus, internalStore?: IndexedFormula);
19
+ readonly DESCRIBEDBY: import("rdflib/lib/tf-types").NamedNode;
19
20
  /**
20
- * Fetch data for the given URI to the internalStore
21
+ * Fetch data for the given URI to the internalStore.
22
+ * If the response includes a Link header with rel="describedby",
23
+ * the metadata document will also be fetched automatically.
21
24
  * @param uri
22
25
  */
23
- fetch(uri: string): Promise<Response>;
26
+ fetch(uri: string): Promise<void>;
24
27
  /**
25
28
  * Fetch all the given URIs in parallel and put the data to the internalStore
26
29
  * @param uris
27
30
  */
28
- fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
31
+ fetchAll(uris: string[]): Promise<PromiseSettledResult<void>[]>;
29
32
  /**
30
33
  * Retrieve the thing identified by the given URI from the internalStore
31
34
  * @param uri
@@ -38,6 +41,7 @@ export declare class Store {
38
41
  * @param value
39
42
  */
40
43
  addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
44
+ private insert;
41
45
  /**
42
46
  * Adds a new relation (link) from the thing to the given uri using the property
43
47
  * @param thing
@@ -45,6 +49,7 @@ export declare class Store {
45
49
  * @param uri
46
50
  */
47
51
  addRelation(thing: Thing, property: string, uri: string): Promise<void>;
52
+ private determineDocumentToUpdate;
48
53
  addNewThing(uri: string, name: string, type: string): Promise<void>;
49
54
  executeUpdate(operation: UpdateOperation): Promise<void>;
50
55
  flagAuthorizationMetadata(): void;
package/types/index.d.ts CHANGED
@@ -48,8 +48,8 @@ export declare class PodOS {
48
48
  private readonly profileGateway;
49
49
  constructor({ session, offlineCache, onlineStatus, internalStore, }?: PodOsConfiguration);
50
50
  private flagAuthorizationMetaDataOnSessionChange;
51
- fetch(uri: string): Promise<Response>;
52
- fetchAll(uris: string[]): Promise<PromiseSettledResult<Response>[]>;
51
+ fetch(uri: string): Promise<void>;
52
+ fetchAll(uris: string[]): Promise<PromiseSettledResult<void>[]>;
53
53
  /**
54
54
  * @deprecated Use {@link FileFetcher.fetchFile} via {@link PodOS.files} instead
55
55
  * @param {string} url - URL identifying the file
@@ -1,4 +1,8 @@
1
+ import { NamedNode } from "rdflib";
1
2
  export declare const rdfs: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
2
3
  export declare const pim: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
3
4
  export declare const schema: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
4
5
  export declare const flow: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
6
+ export declare const iana: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
7
+ export declare const link: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
8
+ export declare const internal: () => NamedNode;
@@ -115,4 +115,6 @@ export declare class Thing {
115
115
  container(): {
116
116
  uri: string;
117
117
  };
118
+ rdfDocument(): string | undefined;
119
+ private hasType;
118
120
  }
@@ -0,0 +1 @@
1
+ export {};