@pod-os/core 0.32.0-rc.fde9f2d.0 → 0.33.0-rc.23dfab1.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.
@@ -5,7 +5,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
+ try {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ } catch (e) {
11
+ throw mod = 0, e;
12
+ }
9
13
  };
10
14
  var __export = (target, all) => {
11
15
  for (var name in all)
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  __commonJS,
3
3
  __export,
4
4
  __toESM
5
- } from "./chunk-U67V476Y.js";
5
+ } from "./chunk-CZ7CSFO4.js";
6
6
 
7
7
  // ../node_modules/@frogcat/ttl2jsonld/ttl2jsonld.js
8
8
  var require_ttl2jsonld = __commonJS({
@@ -6010,10 +6010,10 @@ var require_dom = __commonJS({
6010
6010
  return doc;
6011
6011
  }
6012
6012
  };
6013
- function Node3(symbol) {
6013
+ function Node4(symbol) {
6014
6014
  checkSymbol(symbol);
6015
6015
  }
6016
- Node3.prototype = {
6016
+ Node4.prototype = {
6017
6017
  /**
6018
6018
  * The first child of this node.
6019
6019
  *
@@ -6534,10 +6534,10 @@ var require_dom = __commonJS({
6534
6534
  function _xmlEncoder(c) {
6535
6535
  return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == '"' && "&quot;" || "&#" + c.charCodeAt() + ";";
6536
6536
  }
6537
- copy(NodeType, Node3);
6538
- copy(NodeType, Node3.prototype);
6539
- copy(DocumentPosition, Node3);
6540
- copy(DocumentPosition, Node3.prototype);
6537
+ copy(NodeType, Node4);
6538
+ copy(NodeType, Node4.prototype);
6539
+ copy(DocumentPosition, Node4);
6540
+ copy(DocumentPosition, Node4.prototype);
6541
6541
  function _visitNode(node3, callback) {
6542
6542
  walkDOM(node3, null, {
6543
6543
  enter: function(n3) {
@@ -6635,19 +6635,19 @@ var require_dom = __commonJS({
6635
6635
  return child2;
6636
6636
  }
6637
6637
  function hasValidParentNodeType(node3) {
6638
- return node3 && (node3.nodeType === Node3.DOCUMENT_NODE || node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node3.ELEMENT_NODE);
6638
+ return node3 && (node3.nodeType === Node4.DOCUMENT_NODE || node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node4.ELEMENT_NODE);
6639
6639
  }
6640
6640
  function hasInsertableNodeType(node3) {
6641
- return node3 && (node3.nodeType === Node3.CDATA_SECTION_NODE || node3.nodeType === Node3.COMMENT_NODE || node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node3.DOCUMENT_TYPE_NODE || node3.nodeType === Node3.ELEMENT_NODE || node3.nodeType === Node3.PROCESSING_INSTRUCTION_NODE || node3.nodeType === Node3.TEXT_NODE);
6641
+ return node3 && (node3.nodeType === Node4.CDATA_SECTION_NODE || node3.nodeType === Node4.COMMENT_NODE || node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node4.DOCUMENT_TYPE_NODE || node3.nodeType === Node4.ELEMENT_NODE || node3.nodeType === Node4.PROCESSING_INSTRUCTION_NODE || node3.nodeType === Node4.TEXT_NODE);
6642
6642
  }
6643
6643
  function isDocTypeNode(node3) {
6644
- return node3 && node3.nodeType === Node3.DOCUMENT_TYPE_NODE;
6644
+ return node3 && node3.nodeType === Node4.DOCUMENT_TYPE_NODE;
6645
6645
  }
6646
6646
  function isElementNode(node3) {
6647
- return node3 && node3.nodeType === Node3.ELEMENT_NODE;
6647
+ return node3 && node3.nodeType === Node4.ELEMENT_NODE;
6648
6648
  }
6649
6649
  function isTextNode(node3) {
6650
- return node3 && node3.nodeType === Node3.TEXT_NODE;
6650
+ return node3 && node3.nodeType === Node4.TEXT_NODE;
6651
6651
  }
6652
6652
  function isElementInsertionPossible(doc, child2) {
6653
6653
  var parentChildNodes = doc.childNodes || [];
@@ -6681,7 +6681,7 @@ var require_dom = __commonJS({
6681
6681
  // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0
6682
6682
  // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)
6683
6683
  // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException.
6684
- isDocTypeNode(node3) && parent4.nodeType !== Node3.DOCUMENT_NODE
6684
+ isDocTypeNode(node3) && parent4.nodeType !== Node4.DOCUMENT_NODE
6685
6685
  ) {
6686
6686
  throw new DOMException(
6687
6687
  DOMException.HIERARCHY_REQUEST_ERR,
@@ -6692,7 +6692,7 @@ var require_dom = __commonJS({
6692
6692
  function assertPreInsertionValidityInDocument(parent4, node3, child2) {
6693
6693
  var parentChildNodes = parent4.childNodes || [];
6694
6694
  var nodeChildNodes = node3.childNodes || [];
6695
- if (node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE) {
6695
+ if (node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE) {
6696
6696
  var nodeChildElements = nodeChildNodes.filter(isElementNode);
6697
6697
  if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
6698
6698
  throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
@@ -6722,7 +6722,7 @@ var require_dom = __commonJS({
6722
6722
  function assertPreReplacementValidityInDocument(parent4, node3, child2) {
6723
6723
  var parentChildNodes = parent4.childNodes || [];
6724
6724
  var nodeChildNodes = node3.childNodes || [];
6725
- if (node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE) {
6725
+ if (node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE) {
6726
6726
  var nodeChildElements = nodeChildNodes.filter(isElementNode);
6727
6727
  if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
6728
6728
  throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
@@ -6751,7 +6751,7 @@ var require_dom = __commonJS({
6751
6751
  }
6752
6752
  function _insertBefore(parent4, node3, child2, _inDocumentAssertion) {
6753
6753
  assertPreInsertionValidity1to5(parent4, node3, child2);
6754
- if (parent4.nodeType === Node3.DOCUMENT_NODE) {
6754
+ if (parent4.nodeType === Node4.DOCUMENT_NODE) {
6755
6755
  (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent4, node3, child2);
6756
6756
  }
6757
6757
  var cp = node3.parentNode;
@@ -7100,7 +7100,7 @@ var require_dom = __commonJS({
7100
7100
  return node3;
7101
7101
  }
7102
7102
  };
7103
- _extends2(Document6, Node3);
7103
+ _extends2(Document6, Node4);
7104
7104
  function Element2(symbol) {
7105
7105
  checkSymbol(symbol);
7106
7106
  this._nsMap = /* @__PURE__ */ Object.create(null);
@@ -7329,7 +7329,7 @@ var require_dom = __commonJS({
7329
7329
  Document6.prototype.getElementsByClassName = Element2.prototype.getElementsByClassName;
7330
7330
  Document6.prototype.getElementsByTagName = Element2.prototype.getElementsByTagName;
7331
7331
  Document6.prototype.getElementsByTagNameNS = Element2.prototype.getElementsByTagNameNS;
7332
- _extends2(Element2, Node3);
7332
+ _extends2(Element2, Node4);
7333
7333
  function Attr(symbol) {
7334
7334
  checkSymbol(symbol);
7335
7335
  this.namespaceURI = null;
@@ -7337,7 +7337,7 @@ var require_dom = __commonJS({
7337
7337
  this.ownerElement = null;
7338
7338
  }
7339
7339
  Attr.prototype.nodeType = ATTRIBUTE_NODE;
7340
- _extends2(Attr, Node3);
7340
+ _extends2(Attr, Node4);
7341
7341
  function CharacterData(symbol) {
7342
7342
  checkSymbol(symbol);
7343
7343
  }
@@ -7365,7 +7365,7 @@ var require_dom = __commonJS({
7365
7365
  this.length = text4.length;
7366
7366
  }
7367
7367
  };
7368
- _extends2(CharacterData, Node3);
7368
+ _extends2(CharacterData, Node4);
7369
7369
  function Text4(symbol) {
7370
7370
  checkSymbol(symbol);
7371
7371
  }
@@ -7406,28 +7406,28 @@ var require_dom = __commonJS({
7406
7406
  checkSymbol(symbol);
7407
7407
  }
7408
7408
  DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
7409
- _extends2(DocumentType, Node3);
7409
+ _extends2(DocumentType, Node4);
7410
7410
  function Notation(symbol) {
7411
7411
  checkSymbol(symbol);
7412
7412
  }
7413
7413
  Notation.prototype.nodeType = NOTATION_NODE;
7414
- _extends2(Notation, Node3);
7414
+ _extends2(Notation, Node4);
7415
7415
  function Entity2(symbol) {
7416
7416
  checkSymbol(symbol);
7417
7417
  }
7418
7418
  Entity2.prototype.nodeType = ENTITY_NODE;
7419
- _extends2(Entity2, Node3);
7419
+ _extends2(Entity2, Node4);
7420
7420
  function EntityReference(symbol) {
7421
7421
  checkSymbol(symbol);
7422
7422
  }
7423
7423
  EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
7424
- _extends2(EntityReference, Node3);
7424
+ _extends2(EntityReference, Node4);
7425
7425
  function DocumentFragment(symbol) {
7426
7426
  checkSymbol(symbol);
7427
7427
  }
7428
7428
  DocumentFragment.prototype.nodeName = "#document-fragment";
7429
7429
  DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
7430
- _extends2(DocumentFragment, Node3);
7430
+ _extends2(DocumentFragment, Node4);
7431
7431
  function ProcessingInstruction(symbol) {
7432
7432
  checkSymbol(symbol);
7433
7433
  }
@@ -7438,7 +7438,7 @@ var require_dom = __commonJS({
7438
7438
  XMLSerializer.prototype.serializeToString = function(node3, options) {
7439
7439
  return nodeSerializeToString.call(node3, options);
7440
7440
  };
7441
- Node3.prototype.toString = nodeSerializeToString;
7441
+ Node4.prototype.toString = nodeSerializeToString;
7442
7442
  function nodeSerializeToString(options) {
7443
7443
  var opts;
7444
7444
  if (typeof options === "function") {
@@ -7800,7 +7800,7 @@ var require_dom = __commonJS({
7800
7800
  return this.$$length;
7801
7801
  }
7802
7802
  });
7803
- Object.defineProperty(Node3.prototype, "textContent", {
7803
+ Object.defineProperty(Node4.prototype, "textContent", {
7804
7804
  get: function() {
7805
7805
  if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
7806
7806
  var buf = [];
@@ -7872,7 +7872,7 @@ var require_dom = __commonJS({
7872
7872
  exports.EntityReference = EntityReference;
7873
7873
  exports.LiveNodeList = LiveNodeList;
7874
7874
  exports.NamedNodeMap = NamedNodeMap;
7875
- exports.Node = Node3;
7875
+ exports.Node = Node4;
7876
7876
  exports.NodeList = NodeList;
7877
7877
  exports.Notation = Notation;
7878
7878
  exports.Text = Text4;
@@ -15495,6 +15495,16 @@ var require_short_unique_id = __commonJS({
15495
15495
  }
15496
15496
  });
15497
15497
 
15498
+ // node_modules/rdflib/lib/tf-types.js
15499
+ var require_tf_types = __commonJS({
15500
+ "node_modules/rdflib/lib/tf-types.js"(exports) {
15501
+ "use strict";
15502
+ Object.defineProperty(exports, "__esModule", {
15503
+ value: true
15504
+ });
15505
+ }
15506
+ });
15507
+
15498
15508
  // ../node_modules/slugify/slugify.js
15499
15509
  var require_slugify = __commonJS({
15500
15510
  "../node_modules/slugify/slugify.js"(exports, module3) {
@@ -24207,7 +24217,7 @@ function listToCollection(kb, obj) {
24207
24217
  }
24208
24218
  async function jsonldParser(str, kb, base2) {
24209
24219
  const baseString = base2 && Object.prototype.hasOwnProperty.call(base2, "termType") ? base2.value : base2;
24210
- const jsonld = await import("./jsonld-V2RB47OZ.js");
24220
+ const jsonld = await import("./jsonld-NUSJOINA.js");
24211
24221
  const jsonldLib = jsonld.default || jsonld;
24212
24222
  const flattened = await jsonldLib.flatten(JSON.parse(str), null, {
24213
24223
  base: baseString
@@ -30044,6 +30054,17 @@ var Thing = class {
30044
30054
  values: values2[predicate4]
30045
30055
  }));
30046
30056
  }
30057
+ /**
30058
+ * Observe changes in literal values linked to this thing
30059
+ */
30060
+ observeLiterals() {
30061
+ return this.observeSubjectChanges({
30062
+ observes: () => this.literals(),
30063
+ compare: (prev2, curr) => prev2.length === curr.length && prev2.every(
30064
+ (rel2, i) => rel2.predicate === curr[i].predicate && rel2.values.length === curr[i].values.length && rel2.values.every((val, j) => val === curr[i].values[j])
30065
+ )
30066
+ });
30067
+ }
30047
30068
  /**
30048
30069
  * Returns all the unique links from this thing to other resources. This only includes named nodes and excludes rdf:type relations.
30049
30070
  */
@@ -30063,18 +30084,59 @@ var Thing = class {
30063
30084
  * Observe changes in links from this thing to other resources
30064
30085
  */
30065
30086
  observeRelations(predicate4) {
30087
+ return this.observeSubjectChanges({
30088
+ observes: () => this.relations(predicate4),
30089
+ compare: (prev2, curr) => prev2.length === curr.length && prev2.every(
30090
+ (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
30091
+ )
30092
+ });
30093
+ }
30094
+ /**
30095
+ * Generic observable creator that watches the store for changes
30096
+ * that have this thing as a subject
30097
+ * @param args.observedValue Function that returns the current value to observe
30098
+ * @param args.compare Function that compares previous and current values for distinctUntilChanged
30099
+ */
30100
+ observeSubjectChanges(args) {
30101
+ const { observes, compare } = args;
30102
+ return this.observeChanges({
30103
+ filterFn: (quad3) => quad3.subject.value === this.uri,
30104
+ observes,
30105
+ compare
30106
+ });
30107
+ }
30108
+ /**
30109
+ * Generic observable creator that watches the store for changes
30110
+ * that have this thing as an object
30111
+ * @param args.observedValue Function that returns the current value to observe
30112
+ * @param args.compare Function that compares previous and current values for distinctUntilChanged
30113
+ */
30114
+ observeObjectChanges(args) {
30115
+ const { observes, compare } = args;
30116
+ return this.observeChanges({
30117
+ filterFn: (quad3) => quad3.object.value === this.uri,
30118
+ observes,
30119
+ compare
30120
+ });
30121
+ }
30122
+ /**
30123
+ * Generic observable creator that watches the store for changes
30124
+ * that match the given filter function before comparing values of this thing for possible changes.
30125
+ * The observable only emits a new value if relevant quads are added or removed, and in consequence
30126
+ * the observed value changes according to the compare function
30127
+ *
30128
+ * @param args.filterFn Filter for relevant quads
30129
+ * @param args.observedValue Function that returns the value to observe
30130
+ * @param args.compare Function that compares previous and current values
30131
+ */
30132
+ observeChanges(args) {
30133
+ const { observes, compare, filterFn } = args;
30066
30134
  return merge(this.store.additions$, this.store.removals$).pipe(
30067
- // Note: we assume that cost of filtering by the optional predicate is not worthwhile
30068
- filter((quad3) => quad3.subject.value === this.uri),
30135
+ filter(filterFn),
30069
30136
  debounceTime(250),
30070
- map(() => this.relations(predicate4)),
30071
- startWith(this.relations(predicate4)),
30072
- // Note: label is constructed from predicate and is therefore irrelevant to the comparison
30073
- distinctUntilChanged(
30074
- (prev2, curr) => prev2.length === curr.length && prev2.every(
30075
- (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
30076
- )
30077
- )
30137
+ map(observes),
30138
+ startWith(observes()),
30139
+ distinctUntilChanged(compare)
30078
30140
  );
30079
30141
  }
30080
30142
  /**
@@ -30097,19 +30159,12 @@ var Thing = class {
30097
30159
  * Observe changes in links from other resources to this thing
30098
30160
  */
30099
30161
  observeReverseRelations(predicate4) {
30100
- return merge(this.store.additions$, this.store.removals$).pipe(
30101
- // Note: we assume that cost of filtering by the optional predicate is not worthwhile
30102
- filter((quad3) => quad3.object.value === this.uri),
30103
- debounceTime(250),
30104
- map(() => this.reverseRelations(predicate4)),
30105
- startWith(this.reverseRelations(predicate4)),
30106
- // Note: label is constructed from predicate and is therefore irrelevant to the comparison
30107
- distinctUntilChanged(
30108
- (prev2, curr) => prev2.length === curr.length && prev2.every(
30109
- (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
30110
- )
30162
+ return this.observeObjectChanges({
30163
+ observes: () => this.reverseRelations(predicate4),
30164
+ compare: (prev2, curr) => prev2.length === curr.length && prev2.every(
30165
+ (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
30111
30166
  )
30112
- );
30167
+ });
30113
30168
  }
30114
30169
  /**
30115
30170
  * Returns any value linked from this thing via one of the given predicates
@@ -30839,6 +30894,7 @@ var AssumeAlwaysOnline = class {
30839
30894
  };
30840
30895
 
30841
30896
  // src/Store.ts
30897
+ var import_tf_types = __toESM(require_tf_types(), 1);
30842
30898
  var Store = class {
30843
30899
  constructor(session4, offlineCache = new NoOfflineCache(), onlineStatus = new AssumeAlwaysOnline(), internalStore = graph()) {
30844
30900
  this.DESCRIBEDBY = iana("describedby");
@@ -53265,6 +53321,7 @@ var PodOS = class {
53265
53321
  return proposeAppsFor(thing);
53266
53322
  }
53267
53323
  };
53324
+ var export_Quad = import_tf_types.Quad;
53268
53325
  export {
53269
53326
  AnonymousSession,
53270
53327
  AssumeAlwaysOnline,
@@ -53281,6 +53338,7 @@ export {
53281
53338
  PictureGateway,
53282
53339
  PodOS,
53283
53340
  ProfileGateway,
53341
+ export_Quad as Quad,
53284
53342
  RdfDocument,
53285
53343
  SearchGateway,
53286
53344
  SearchIndex,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __commonJS
3
- } from "./chunk-U67V476Y.js";
3
+ } from "./chunk-CZ7CSFO4.js";
4
4
 
5
5
  // ../node_modules/rdf-canonize/lib/IdentifierIssuer.js
6
6
  var require_IdentifierIssuer = __commonJS({
package/lib/index.js CHANGED
@@ -7,7 +7,11 @@ var PodOS = (() => {
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __commonJS = (cb, mod) => function __require() {
10
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ try {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ } catch (e) {
13
+ throw mod = 0, e;
14
+ }
11
15
  };
12
16
  var __export = (target6, all) => {
13
17
  for (var name9 in all)
@@ -6037,10 +6041,10 @@ var PodOS = (() => {
6037
6041
  return doc;
6038
6042
  }
6039
6043
  };
6040
- function Node3(symbol) {
6044
+ function Node4(symbol) {
6041
6045
  checkSymbol(symbol);
6042
6046
  }
6043
- Node3.prototype = {
6047
+ Node4.prototype = {
6044
6048
  /**
6045
6049
  * The first child of this node.
6046
6050
  *
@@ -6561,10 +6565,10 @@ var PodOS = (() => {
6561
6565
  function _xmlEncoder(c) {
6562
6566
  return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == '"' && "&quot;" || "&#" + c.charCodeAt() + ";";
6563
6567
  }
6564
- copy(NodeType, Node3);
6565
- copy(NodeType, Node3.prototype);
6566
- copy(DocumentPosition, Node3);
6567
- copy(DocumentPosition, Node3.prototype);
6568
+ copy(NodeType, Node4);
6569
+ copy(NodeType, Node4.prototype);
6570
+ copy(DocumentPosition, Node4);
6571
+ copy(DocumentPosition, Node4.prototype);
6568
6572
  function _visitNode(node3, callback) {
6569
6573
  walkDOM(node3, null, {
6570
6574
  enter: function(n3) {
@@ -6662,19 +6666,19 @@ var PodOS = (() => {
6662
6666
  return child2;
6663
6667
  }
6664
6668
  function hasValidParentNodeType(node3) {
6665
- return node3 && (node3.nodeType === Node3.DOCUMENT_NODE || node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node3.ELEMENT_NODE);
6669
+ return node3 && (node3.nodeType === Node4.DOCUMENT_NODE || node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node4.ELEMENT_NODE);
6666
6670
  }
6667
6671
  function hasInsertableNodeType(node3) {
6668
- return node3 && (node3.nodeType === Node3.CDATA_SECTION_NODE || node3.nodeType === Node3.COMMENT_NODE || node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node3.DOCUMENT_TYPE_NODE || node3.nodeType === Node3.ELEMENT_NODE || node3.nodeType === Node3.PROCESSING_INSTRUCTION_NODE || node3.nodeType === Node3.TEXT_NODE);
6672
+ return node3 && (node3.nodeType === Node4.CDATA_SECTION_NODE || node3.nodeType === Node4.COMMENT_NODE || node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE || node3.nodeType === Node4.DOCUMENT_TYPE_NODE || node3.nodeType === Node4.ELEMENT_NODE || node3.nodeType === Node4.PROCESSING_INSTRUCTION_NODE || node3.nodeType === Node4.TEXT_NODE);
6669
6673
  }
6670
6674
  function isDocTypeNode(node3) {
6671
- return node3 && node3.nodeType === Node3.DOCUMENT_TYPE_NODE;
6675
+ return node3 && node3.nodeType === Node4.DOCUMENT_TYPE_NODE;
6672
6676
  }
6673
6677
  function isElementNode(node3) {
6674
- return node3 && node3.nodeType === Node3.ELEMENT_NODE;
6678
+ return node3 && node3.nodeType === Node4.ELEMENT_NODE;
6675
6679
  }
6676
6680
  function isTextNode(node3) {
6677
- return node3 && node3.nodeType === Node3.TEXT_NODE;
6681
+ return node3 && node3.nodeType === Node4.TEXT_NODE;
6678
6682
  }
6679
6683
  function isElementInsertionPossible(doc, child2) {
6680
6684
  var parentChildNodes = doc.childNodes || [];
@@ -6708,7 +6712,7 @@ var PodOS = (() => {
6708
6712
  // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0
6709
6713
  // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)
6710
6714
  // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException.
6711
- isDocTypeNode(node3) && parent4.nodeType !== Node3.DOCUMENT_NODE
6715
+ isDocTypeNode(node3) && parent4.nodeType !== Node4.DOCUMENT_NODE
6712
6716
  ) {
6713
6717
  throw new DOMException(
6714
6718
  DOMException.HIERARCHY_REQUEST_ERR,
@@ -6719,7 +6723,7 @@ var PodOS = (() => {
6719
6723
  function assertPreInsertionValidityInDocument(parent4, node3, child2) {
6720
6724
  var parentChildNodes = parent4.childNodes || [];
6721
6725
  var nodeChildNodes = node3.childNodes || [];
6722
- if (node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE) {
6726
+ if (node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE) {
6723
6727
  var nodeChildElements = nodeChildNodes.filter(isElementNode);
6724
6728
  if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
6725
6729
  throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
@@ -6749,7 +6753,7 @@ var PodOS = (() => {
6749
6753
  function assertPreReplacementValidityInDocument(parent4, node3, child2) {
6750
6754
  var parentChildNodes = parent4.childNodes || [];
6751
6755
  var nodeChildNodes = node3.childNodes || [];
6752
- if (node3.nodeType === Node3.DOCUMENT_FRAGMENT_NODE) {
6756
+ if (node3.nodeType === Node4.DOCUMENT_FRAGMENT_NODE) {
6753
6757
  var nodeChildElements = nodeChildNodes.filter(isElementNode);
6754
6758
  if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
6755
6759
  throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
@@ -6778,7 +6782,7 @@ var PodOS = (() => {
6778
6782
  }
6779
6783
  function _insertBefore(parent4, node3, child2, _inDocumentAssertion) {
6780
6784
  assertPreInsertionValidity1to5(parent4, node3, child2);
6781
- if (parent4.nodeType === Node3.DOCUMENT_NODE) {
6785
+ if (parent4.nodeType === Node4.DOCUMENT_NODE) {
6782
6786
  (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent4, node3, child2);
6783
6787
  }
6784
6788
  var cp = node3.parentNode;
@@ -7127,7 +7131,7 @@ var PodOS = (() => {
7127
7131
  return node3;
7128
7132
  }
7129
7133
  };
7130
- _extends2(Document6, Node3);
7134
+ _extends2(Document6, Node4);
7131
7135
  function Element2(symbol) {
7132
7136
  checkSymbol(symbol);
7133
7137
  this._nsMap = /* @__PURE__ */ Object.create(null);
@@ -7356,7 +7360,7 @@ var PodOS = (() => {
7356
7360
  Document6.prototype.getElementsByClassName = Element2.prototype.getElementsByClassName;
7357
7361
  Document6.prototype.getElementsByTagName = Element2.prototype.getElementsByTagName;
7358
7362
  Document6.prototype.getElementsByTagNameNS = Element2.prototype.getElementsByTagNameNS;
7359
- _extends2(Element2, Node3);
7363
+ _extends2(Element2, Node4);
7360
7364
  function Attr(symbol) {
7361
7365
  checkSymbol(symbol);
7362
7366
  this.namespaceURI = null;
@@ -7364,7 +7368,7 @@ var PodOS = (() => {
7364
7368
  this.ownerElement = null;
7365
7369
  }
7366
7370
  Attr.prototype.nodeType = ATTRIBUTE_NODE;
7367
- _extends2(Attr, Node3);
7371
+ _extends2(Attr, Node4);
7368
7372
  function CharacterData(symbol) {
7369
7373
  checkSymbol(symbol);
7370
7374
  }
@@ -7392,7 +7396,7 @@ var PodOS = (() => {
7392
7396
  this.length = text4.length;
7393
7397
  }
7394
7398
  };
7395
- _extends2(CharacterData, Node3);
7399
+ _extends2(CharacterData, Node4);
7396
7400
  function Text4(symbol) {
7397
7401
  checkSymbol(symbol);
7398
7402
  }
@@ -7433,28 +7437,28 @@ var PodOS = (() => {
7433
7437
  checkSymbol(symbol);
7434
7438
  }
7435
7439
  DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
7436
- _extends2(DocumentType, Node3);
7440
+ _extends2(DocumentType, Node4);
7437
7441
  function Notation(symbol) {
7438
7442
  checkSymbol(symbol);
7439
7443
  }
7440
7444
  Notation.prototype.nodeType = NOTATION_NODE;
7441
- _extends2(Notation, Node3);
7445
+ _extends2(Notation, Node4);
7442
7446
  function Entity2(symbol) {
7443
7447
  checkSymbol(symbol);
7444
7448
  }
7445
7449
  Entity2.prototype.nodeType = ENTITY_NODE;
7446
- _extends2(Entity2, Node3);
7450
+ _extends2(Entity2, Node4);
7447
7451
  function EntityReference(symbol) {
7448
7452
  checkSymbol(symbol);
7449
7453
  }
7450
7454
  EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
7451
- _extends2(EntityReference, Node3);
7455
+ _extends2(EntityReference, Node4);
7452
7456
  function DocumentFragment(symbol) {
7453
7457
  checkSymbol(symbol);
7454
7458
  }
7455
7459
  DocumentFragment.prototype.nodeName = "#document-fragment";
7456
7460
  DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
7457
- _extends2(DocumentFragment, Node3);
7461
+ _extends2(DocumentFragment, Node4);
7458
7462
  function ProcessingInstruction(symbol) {
7459
7463
  checkSymbol(symbol);
7460
7464
  }
@@ -7465,7 +7469,7 @@ var PodOS = (() => {
7465
7469
  XMLSerializer.prototype.serializeToString = function(node3, options) {
7466
7470
  return nodeSerializeToString.call(node3, options);
7467
7471
  };
7468
- Node3.prototype.toString = nodeSerializeToString;
7472
+ Node4.prototype.toString = nodeSerializeToString;
7469
7473
  function nodeSerializeToString(options) {
7470
7474
  var opts;
7471
7475
  if (typeof options === "function") {
@@ -7827,7 +7831,7 @@ var PodOS = (() => {
7827
7831
  return this.$$length;
7828
7832
  }
7829
7833
  });
7830
- Object.defineProperty(Node3.prototype, "textContent", {
7834
+ Object.defineProperty(Node4.prototype, "textContent", {
7831
7835
  get: function() {
7832
7836
  if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
7833
7837
  var buf = [];
@@ -7899,7 +7903,7 @@ var PodOS = (() => {
7899
7903
  exports.EntityReference = EntityReference;
7900
7904
  exports.LiveNodeList = LiveNodeList;
7901
7905
  exports.NamedNodeMap = NamedNodeMap;
7902
- exports.Node = Node3;
7906
+ exports.Node = Node4;
7903
7907
  exports.NodeList = NodeList;
7904
7908
  exports.Notation = Notation;
7905
7909
  exports.Text = Text4;
@@ -13253,7 +13257,7 @@ var PodOS = (() => {
13253
13257
  "../node_modules/jsonld/node_modules/yallist/yallist.js"(exports, module3) {
13254
13258
  "use strict";
13255
13259
  module3.exports = Yallist;
13256
- Yallist.Node = Node3;
13260
+ Yallist.Node = Node4;
13257
13261
  Yallist.create = Yallist;
13258
13262
  function Yallist(list) {
13259
13263
  var self2 = this;
@@ -13567,7 +13571,7 @@ var PodOS = (() => {
13567
13571
  return this;
13568
13572
  };
13569
13573
  function insert(self2, node3, value8) {
13570
- var inserted = node3 === self2.head ? new Node3(value8, null, node3, self2) : new Node3(value8, node3, node3.next, self2);
13574
+ var inserted = node3 === self2.head ? new Node4(value8, null, node3, self2) : new Node4(value8, node3, node3.next, self2);
13571
13575
  if (inserted.next === null) {
13572
13576
  self2.tail = inserted;
13573
13577
  }
@@ -13578,22 +13582,22 @@ var PodOS = (() => {
13578
13582
  return inserted;
13579
13583
  }
13580
13584
  function push(self2, item4) {
13581
- self2.tail = new Node3(item4, self2.tail, null, self2);
13585
+ self2.tail = new Node4(item4, self2.tail, null, self2);
13582
13586
  if (!self2.head) {
13583
13587
  self2.head = self2.tail;
13584
13588
  }
13585
13589
  self2.length++;
13586
13590
  }
13587
13591
  function unshift(self2, item4) {
13588
- self2.head = new Node3(item4, null, self2.head, self2);
13592
+ self2.head = new Node4(item4, null, self2.head, self2);
13589
13593
  if (!self2.tail) {
13590
13594
  self2.tail = self2.head;
13591
13595
  }
13592
13596
  self2.length++;
13593
13597
  }
13594
- function Node3(value8, prev2, next4, list) {
13595
- if (!(this instanceof Node3)) {
13596
- return new Node3(value8, prev2, next4, list);
13598
+ function Node4(value8, prev2, next4, list) {
13599
+ if (!(this instanceof Node4)) {
13600
+ return new Node4(value8, prev2, next4, list);
13597
13601
  }
13598
13602
  this.list = list;
13599
13603
  this.value = value8;
@@ -23899,6 +23903,16 @@ var PodOS = (() => {
23899
23903
  }
23900
23904
  });
23901
23905
 
23906
+ // node_modules/rdflib/lib/tf-types.js
23907
+ var require_tf_types = __commonJS({
23908
+ "node_modules/rdflib/lib/tf-types.js"(exports) {
23909
+ "use strict";
23910
+ Object.defineProperty(exports, "__esModule", {
23911
+ value: true
23912
+ });
23913
+ }
23914
+ });
23915
+
23902
23916
  // ../node_modules/slugify/slugify.js
23903
23917
  var require_slugify = __commonJS({
23904
23918
  "../node_modules/slugify/slugify.js"(exports, module3) {
@@ -23967,6 +23981,7 @@ var PodOS = (() => {
23967
23981
  PictureGateway: () => PictureGateway,
23968
23982
  PodOS: () => PodOS,
23969
23983
  ProfileGateway: () => ProfileGateway,
23984
+ Quad: () => import_tf_types.Quad,
23970
23985
  RdfDocument: () => RdfDocument,
23971
23986
  SearchGateway: () => SearchGateway,
23972
23987
  SearchIndex: () => SearchIndex,
@@ -38481,6 +38496,17 @@ _:patch
38481
38496
  values: values2[predicate4]
38482
38497
  }));
38483
38498
  }
38499
+ /**
38500
+ * Observe changes in literal values linked to this thing
38501
+ */
38502
+ observeLiterals() {
38503
+ return this.observeSubjectChanges({
38504
+ observes: () => this.literals(),
38505
+ compare: (prev2, curr) => prev2.length === curr.length && prev2.every(
38506
+ (rel2, i) => rel2.predicate === curr[i].predicate && rel2.values.length === curr[i].values.length && rel2.values.every((val, j) => val === curr[i].values[j])
38507
+ )
38508
+ });
38509
+ }
38484
38510
  /**
38485
38511
  * Returns all the unique links from this thing to other resources. This only includes named nodes and excludes rdf:type relations.
38486
38512
  */
@@ -38500,18 +38526,59 @@ _:patch
38500
38526
  * Observe changes in links from this thing to other resources
38501
38527
  */
38502
38528
  observeRelations(predicate4) {
38529
+ return this.observeSubjectChanges({
38530
+ observes: () => this.relations(predicate4),
38531
+ compare: (prev2, curr) => prev2.length === curr.length && prev2.every(
38532
+ (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
38533
+ )
38534
+ });
38535
+ }
38536
+ /**
38537
+ * Generic observable creator that watches the store for changes
38538
+ * that have this thing as a subject
38539
+ * @param args.observedValue Function that returns the current value to observe
38540
+ * @param args.compare Function that compares previous and current values for distinctUntilChanged
38541
+ */
38542
+ observeSubjectChanges(args) {
38543
+ const { observes, compare } = args;
38544
+ return this.observeChanges({
38545
+ filterFn: (quad3) => quad3.subject.value === this.uri,
38546
+ observes,
38547
+ compare
38548
+ });
38549
+ }
38550
+ /**
38551
+ * Generic observable creator that watches the store for changes
38552
+ * that have this thing as an object
38553
+ * @param args.observedValue Function that returns the current value to observe
38554
+ * @param args.compare Function that compares previous and current values for distinctUntilChanged
38555
+ */
38556
+ observeObjectChanges(args) {
38557
+ const { observes, compare } = args;
38558
+ return this.observeChanges({
38559
+ filterFn: (quad3) => quad3.object.value === this.uri,
38560
+ observes,
38561
+ compare
38562
+ });
38563
+ }
38564
+ /**
38565
+ * Generic observable creator that watches the store for changes
38566
+ * that match the given filter function before comparing values of this thing for possible changes.
38567
+ * The observable only emits a new value if relevant quads are added or removed, and in consequence
38568
+ * the observed value changes according to the compare function
38569
+ *
38570
+ * @param args.filterFn Filter for relevant quads
38571
+ * @param args.observedValue Function that returns the value to observe
38572
+ * @param args.compare Function that compares previous and current values
38573
+ */
38574
+ observeChanges(args) {
38575
+ const { observes, compare, filterFn } = args;
38503
38576
  return merge(this.store.additions$, this.store.removals$).pipe(
38504
- // Note: we assume that cost of filtering by the optional predicate is not worthwhile
38505
- filter((quad3) => quad3.subject.value === this.uri),
38577
+ filter(filterFn),
38506
38578
  debounceTime(250),
38507
- map(() => this.relations(predicate4)),
38508
- startWith(this.relations(predicate4)),
38509
- // Note: label is constructed from predicate and is therefore irrelevant to the comparison
38510
- distinctUntilChanged(
38511
- (prev2, curr) => prev2.length === curr.length && prev2.every(
38512
- (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
38513
- )
38514
- )
38579
+ map(observes),
38580
+ startWith(observes()),
38581
+ distinctUntilChanged(compare)
38515
38582
  );
38516
38583
  }
38517
38584
  /**
@@ -38534,19 +38601,12 @@ _:patch
38534
38601
  * Observe changes in links from other resources to this thing
38535
38602
  */
38536
38603
  observeReverseRelations(predicate4) {
38537
- return merge(this.store.additions$, this.store.removals$).pipe(
38538
- // Note: we assume that cost of filtering by the optional predicate is not worthwhile
38539
- filter((quad3) => quad3.object.value === this.uri),
38540
- debounceTime(250),
38541
- map(() => this.reverseRelations(predicate4)),
38542
- startWith(this.reverseRelations(predicate4)),
38543
- // Note: label is constructed from predicate and is therefore irrelevant to the comparison
38544
- distinctUntilChanged(
38545
- (prev2, curr) => prev2.length === curr.length && prev2.every(
38546
- (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
38547
- )
38604
+ return this.observeObjectChanges({
38605
+ observes: () => this.reverseRelations(predicate4),
38606
+ compare: (prev2, curr) => prev2.length === curr.length && prev2.every(
38607
+ (rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
38548
38608
  )
38549
- );
38609
+ });
38550
38610
  }
38551
38611
  /**
38552
38612
  * Returns any value linked from this thing via one of the given predicates
@@ -39276,6 +39336,7 @@ _:patch
39276
39336
  };
39277
39337
 
39278
39338
  // src/Store.ts
39339
+ var import_tf_types = __toESM(require_tf_types(), 1);
39279
39340
  var Store = class {
39280
39341
  constructor(session4, offlineCache = new NoOfflineCache(), onlineStatus = new AssumeAlwaysOnline(), internalStore = graph()) {
39281
39342
  this.DESCRIBEDBY = iana("describedby");
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.32.0-rc.fde9f2d.0",
4
+ "version": "0.33.0-rc.23dfab1.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./types/index.d.ts",
@@ -41,23 +41,23 @@
41
41
  "author": "Angelo Veltens",
42
42
  "license": "MIT",
43
43
  "devDependencies": {
44
- "@babel/preset-env": "^7.29.5",
45
- "@babel/preset-typescript": "^7.28.5",
44
+ "@babel/preset-env": "^7.29.7",
45
+ "@babel/preset-typescript": "^7.28.7",
46
46
  "@eslint/js": "^10.0.0",
47
47
  "@types/jest": "^30.0.0",
48
48
  "@types/jest-when": "^3.5.5",
49
49
  "@types/sparqljs": "^3.1.12",
50
- "esbuild": "^0.28.0",
51
- "eslint": "^10.0.0",
50
+ "esbuild": "^0.28.2",
51
+ "eslint": "^10.8.1",
52
52
  "npm-run-all": "^4.1.5",
53
- "prettier": "^3.8.3",
53
+ "prettier": "^3.9.6",
54
54
  "rimraf": "^6.1.3",
55
55
  "sparqljs": "^3.7.4",
56
- "typedoc": "^0.28.19",
57
- "typedoc-plugin-markdown": "^4.11.0",
56
+ "typedoc": "^0.28.20",
57
+ "typedoc-plugin-markdown": "^4.12.0",
58
58
  "typescript": "^6.0.3",
59
- "typescript-eslint": "^8.59.4",
60
- "vitest": "^4.1.8",
59
+ "typescript-eslint": "^8.67.0",
60
+ "vitest": "^4.1.10",
61
61
  "vitest-when": "^0.10.0"
62
62
  },
63
63
  "dependencies": {
package/types/Store.d.ts CHANGED
@@ -5,6 +5,7 @@ import { ModuleConfig, PreferencesQuery, ProfileQuery, UpdateOperation } from "@
5
5
  import { OfflineCache, OnlineStatus } from "./offline-cache";
6
6
  import { Observable, Subject } from "rxjs";
7
7
  import { BlankNode, Quad, Quad_Graph, Quad_Object, Quad_Predicate, Quad_Subject, Term } from "rdflib/lib/tf-types";
8
+ export { Quad } from "rdflib/lib/tf-types";
8
9
  /**
9
10
  * The Store contains all data that is known locally.
10
11
  * It can be used to fetch additional data from the web and also update data and sync it back to editable resources.
@@ -41,6 +41,10 @@ export declare class Thing {
41
41
  * Returns all the literal values that are linked to this thing
42
42
  */
43
43
  literals(): Literal[];
44
+ /**
45
+ * Observe changes in literal values linked to this thing
46
+ */
47
+ observeLiterals(): Observable<Literal[]>;
44
48
  /**
45
49
  * Returns all the unique links from this thing to other resources. This only includes named nodes and excludes rdf:type relations.
46
50
  */
@@ -49,6 +53,31 @@ export declare class Thing {
49
53
  * Observe changes in links from this thing to other resources
50
54
  */
51
55
  observeRelations(predicate?: string): Observable<Relation[]>;
56
+ /**
57
+ * Generic observable creator that watches the store for changes
58
+ * that have this thing as a subject
59
+ * @param args.observedValue Function that returns the current value to observe
60
+ * @param args.compare Function that compares previous and current values for distinctUntilChanged
61
+ */
62
+ private observeSubjectChanges;
63
+ /**
64
+ * Generic observable creator that watches the store for changes
65
+ * that have this thing as an object
66
+ * @param args.observedValue Function that returns the current value to observe
67
+ * @param args.compare Function that compares previous and current values for distinctUntilChanged
68
+ */
69
+ private observeObjectChanges;
70
+ /**
71
+ * Generic observable creator that watches the store for changes
72
+ * that match the given filter function before comparing values of this thing for possible changes.
73
+ * The observable only emits a new value if relevant quads are added or removed, and in consequence
74
+ * the observed value changes according to the compare function
75
+ *
76
+ * @param args.filterFn Filter for relevant quads
77
+ * @param args.observedValue Function that returns the value to observe
78
+ * @param args.compare Function that compares previous and current values
79
+ */
80
+ private observeChanges;
52
81
  /**
53
82
  * Returns all the unique links from other resources to this thing
54
83
  */