@coasys/ad4m 0.13.0-test-5 → 0.13.0-test-6

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.
Files changed (63) hide show
  1. package/lib/index.cjs +610 -337
  2. package/lib/index.js +608 -338
  3. package/lib/src/Ad4mClient.d.ts +1 -1
  4. package/lib/src/Ad4mClient.js +2 -1
  5. package/lib/src/agent/AgentClient.d.ts +16 -0
  6. package/lib/src/agent/AgentClient.js +74 -4
  7. package/lib/src/cache/PersistentCache.d.ts +40 -0
  8. package/lib/src/cache/PersistentCache.js +139 -0
  9. package/lib/src/expression/ExpressionClient.d.ts +8 -0
  10. package/lib/src/expression/ExpressionClient.js +113 -5
  11. package/lib/src/index.d.ts +1 -0
  12. package/lib/src/index.js +1 -0
  13. package/lib/src/model/Ad4mModel.js +29 -57
  14. package/lib/src/model/Ad4mModel.test.js +688 -1434
  15. package/lib/src/model/ModelQueryBuilder.js +0 -9
  16. package/lib/src/model/Subject.js +6 -6
  17. package/lib/src/model/query-surreal.d.ts +44 -0
  18. package/lib/src/model/query-surreal.js +249 -0
  19. package/lib/src/model/relation-filtering.test.js +15 -15
  20. package/lib/src/model/surreal-utils.d.ts +42 -0
  21. package/lib/src/model/surreal-utils.js +128 -0
  22. package/lib/src/model/types.d.ts +0 -1
  23. package/lib/src/perspectives/PerspectiveClient.d.ts +0 -1
  24. package/lib/src/perspectives/PerspectiveClient.js +5 -13
  25. package/lib/src/perspectives/PerspectiveProxy.js +0 -3
  26. package/lib/src/perspectives/PerspectiveResolver.d.ts +1 -0
  27. package/lib/src/perspectives/PerspectiveResolver.js +11 -0
  28. package/lib/src/runtime/RuntimeResolver.d.ts +1 -28
  29. package/lib/src/runtime/RuntimeResolver.js +4 -197
  30. package/lib/src/schema.gql +1 -27
  31. package/lib/src/shacl/SHACLShape.test.js +0 -82
  32. package/package.json +1 -1
  33. package/src/Ad4mClient.test.ts +14 -4
  34. package/src/Ad4mClient.ts +2 -1
  35. package/src/agent/AgentClient.ts +84 -2
  36. package/src/cache/PersistentCache.ts +145 -0
  37. package/src/cache/cache.test.ts +713 -0
  38. package/src/expression/ExpressionClient.ts +137 -3
  39. package/src/index.ts +1 -0
  40. package/src/model/Ad4mModel.test.ts +1 -61
  41. package/src/model/Ad4mModel.ts +31 -57
  42. package/src/model/ModelQueryBuilder.ts +0 -6
  43. package/src/model/types.ts +1 -1
  44. package/src/perspectives/PerspectiveClient.ts +7 -17
  45. package/src/perspectives/PerspectiveProxy.ts +0 -3
  46. package/lib/src/model/hydration-batch.d.ts +0 -34
  47. package/lib/src/model/hydration-batch.js +0 -147
  48. package/lib/src/model/hydration-batching.test.d.ts +0 -7
  49. package/lib/src/model/hydration-batching.test.js +0 -456
  50. package/lib/src/model/model-manifest.d.ts +0 -41
  51. package/lib/src/model/model-manifest.js +0 -11
  52. package/lib/src/model/query-cache.test.d.ts +0 -1
  53. package/lib/src/model/query-cache.test.js +0 -43
  54. package/lib/src/model/query-sparql-batch.d.ts +0 -17
  55. package/lib/src/model/query-sparql-batch.js +0 -260
  56. package/lib/src/model/query-sparql.test.d.ts +0 -1
  57. package/lib/src/model/query-sparql.test.js +0 -312
  58. package/lib/src/model/subscription-delta.test.d.ts +0 -24
  59. package/lib/src/model/subscription-delta.test.js +0 -180
  60. package/lib/src/model/subscription-pool.d.ts +0 -39
  61. package/lib/src/model/subscription-pool.js +0 -165
  62. package/lib/src/perspectives/PerspectiveClient.test.d.ts +0 -1
  63. package/lib/src/perspectives/PerspectiveClient.test.js +0 -224
package/lib/index.cjs CHANGED
@@ -555,13 +555,13 @@ class AgentStatus {
555
555
  }
556
556
  }
557
557
 
558
- var __classPrivateFieldSet$b = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
558
+ var __classPrivateFieldSet$c = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
559
559
  if (kind === "m") throw new TypeError("Private method is not writable");
560
560
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
561
561
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
562
562
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
563
563
  };
564
- var __classPrivateFieldGet$b = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
564
+ var __classPrivateFieldGet$c = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
565
565
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
566
566
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
567
567
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -571,41 +571,41 @@ class NeighbourhoodProxy {
571
571
  constructor(client, pID) {
572
572
  _NeighbourhoodProxy_client.set(this, void 0);
573
573
  _NeighbourhoodProxy_pID.set(this, void 0);
574
- __classPrivateFieldSet$b(this, _NeighbourhoodProxy_client, client, "f");
575
- __classPrivateFieldSet$b(this, _NeighbourhoodProxy_pID, pID, "f");
574
+ __classPrivateFieldSet$c(this, _NeighbourhoodProxy_client, client, "f");
575
+ __classPrivateFieldSet$c(this, _NeighbourhoodProxy_pID, pID, "f");
576
576
  }
577
577
  async otherAgents() {
578
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"));
578
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"));
579
579
  }
580
580
  async hasTelepresenceAdapter() {
581
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"));
581
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"));
582
582
  }
583
583
  async onlineAgents() {
584
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"));
584
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"));
585
585
  }
586
586
  async setOnlineStatus(status) {
587
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), status);
587
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), status);
588
588
  }
589
589
  async setOnlineStatusU(status) {
590
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), status);
590
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), status);
591
591
  }
592
592
  async sendSignal(remoteAgentDid, payload) {
593
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
593
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
594
594
  }
595
595
  async sendSignalU(remoteAgentDid, payload) {
596
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
596
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
597
597
  }
598
598
  async sendBroadcast(payload, loopback = false) {
599
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
599
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
600
600
  }
601
601
  async sendBroadcastU(payload, loopback = false) {
602
- return await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
602
+ return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
603
603
  }
604
604
  async addSignalHandler(handler) {
605
- await __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), handler);
605
+ await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), handler);
606
606
  }
607
607
  removeSignalHandler(handler) {
608
- __classPrivateFieldGet$b(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$b(this, _NeighbourhoodProxy_pID, "f"), handler);
608
+ __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), handler);
609
609
  }
610
610
  }
611
611
  _NeighbourhoodProxy_client = new WeakMap(), _NeighbourhoodProxy_pID = new WeakMap();
@@ -699,13 +699,13 @@ class LinkQuery {
699
699
  }
700
700
  }
701
701
 
702
- var __classPrivateFieldSet$a = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
702
+ var __classPrivateFieldSet$b = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
703
703
  if (kind === "m") throw new TypeError("Private method is not writable");
704
704
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
705
705
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
706
706
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
707
707
  };
708
- var __classPrivateFieldGet$a = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
708
+ var __classPrivateFieldGet$b = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
709
709
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
710
710
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
711
711
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -726,44 +726,44 @@ class Literal {
726
726
  if (url.startsWith("literal://"))
727
727
  throw new Error("literal:// format is no longer supported. Use literal: instead.");
728
728
  const l = new Literal();
729
- __classPrivateFieldSet$a(l, _Literal_url, url, "f");
729
+ __classPrivateFieldSet$b(l, _Literal_url, url, "f");
730
730
  return l;
731
731
  }
732
732
  static from(literal) {
733
733
  const l = new Literal();
734
- __classPrivateFieldSet$a(l, _Literal_literal, literal, "f");
734
+ __classPrivateFieldSet$b(l, _Literal_literal, literal, "f");
735
735
  return l;
736
736
  }
737
737
  toUrl() {
738
- if (__classPrivateFieldGet$a(this, _Literal_url, "f") && !__classPrivateFieldGet$a(this, _Literal_literal, "f"))
739
- return __classPrivateFieldGet$a(this, _Literal_url, "f");
740
- if (!__classPrivateFieldGet$a(this, _Literal_url, "f") && (__classPrivateFieldGet$a(this, _Literal_literal, "f") === undefined || __classPrivateFieldGet$a(this, _Literal_literal, "f") === "" || __classPrivateFieldGet$a(this, _Literal_literal, "f") === null))
738
+ if (__classPrivateFieldGet$b(this, _Literal_url, "f") && !__classPrivateFieldGet$b(this, _Literal_literal, "f"))
739
+ return __classPrivateFieldGet$b(this, _Literal_url, "f");
740
+ if (!__classPrivateFieldGet$b(this, _Literal_url, "f") && (__classPrivateFieldGet$b(this, _Literal_literal, "f") === undefined || __classPrivateFieldGet$b(this, _Literal_literal, "f") === "" || __classPrivateFieldGet$b(this, _Literal_literal, "f") === null))
741
741
  throw new Error("Can't turn empty Literal into URL");
742
742
  let encoded;
743
- switch (typeof __classPrivateFieldGet$a(this, _Literal_literal, "f")) {
743
+ switch (typeof __classPrivateFieldGet$b(this, _Literal_literal, "f")) {
744
744
  case 'string':
745
- encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$a(this, _Literal_literal, "f"))}`;
745
+ encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$b(this, _Literal_literal, "f"))}`;
746
746
  break;
747
747
  case 'number':
748
- encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$a(this, _Literal_literal, "f"))}`;
748
+ encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$b(this, _Literal_literal, "f"))}`;
749
749
  break;
750
750
  case 'boolean':
751
- encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$a(this, _Literal_literal, "f"))}`;
751
+ encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$b(this, _Literal_literal, "f"))}`;
752
752
  break;
753
753
  case 'object':
754
- encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$a(this, _Literal_literal, "f")))}`;
754
+ encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$b(this, _Literal_literal, "f")))}`;
755
755
  break;
756
756
  }
757
757
  return `literal:${encoded}`;
758
758
  }
759
759
  get() {
760
- if (__classPrivateFieldGet$a(this, _Literal_literal, "f"))
761
- return __classPrivateFieldGet$a(this, _Literal_literal, "f");
762
- if (!__classPrivateFieldGet$a(this, _Literal_url, "f"))
760
+ if (__classPrivateFieldGet$b(this, _Literal_literal, "f"))
761
+ return __classPrivateFieldGet$b(this, _Literal_literal, "f");
762
+ if (!__classPrivateFieldGet$b(this, _Literal_url, "f"))
763
763
  throw new Error("Can't render empty Literal");
764
- if (!__classPrivateFieldGet$a(this, _Literal_url, "f").startsWith("literal:"))
764
+ if (!__classPrivateFieldGet$b(this, _Literal_url, "f").startsWith("literal:"))
765
765
  throw new Error("Can't render Literal from non-literal URL");
766
- const body = __classPrivateFieldGet$a(this, _Literal_url, "f").substring(8);
766
+ const body = __classPrivateFieldGet$b(this, _Literal_url, "f").substring(8);
767
767
  if (body.startsWith("string:")) {
768
768
  return decodeURIComponent(body.substring(7));
769
769
  }
@@ -3210,13 +3210,13 @@ class SHACLFlow {
3210
3210
  }
3211
3211
  }
3212
3212
 
3213
- var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3213
+ var __classPrivateFieldSet$a = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3214
3214
  if (kind === "m") throw new TypeError("Private method is not writable");
3215
3215
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3216
3216
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3217
3217
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
3218
3218
  };
3219
- var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3219
+ var __classPrivateFieldGet$a = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3220
3220
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3221
3221
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3222
3222
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -3289,56 +3289,56 @@ class QuerySubscriptionProxy {
3289
3289
  _QuerySubscriptionProxy_initReject.set(this, void 0);
3290
3290
  _QuerySubscriptionProxy_initTimeoutId.set(this, void 0);
3291
3291
  _QuerySubscriptionProxy_query.set(this, void 0);
3292
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_uuid, uuid, "f");
3293
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_query, query, "f");
3294
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_client, client, "f");
3295
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_callbacks, new Set(), "f");
3296
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_latestResult, null, "f");
3292
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_uuid, uuid, "f");
3293
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_query, query, "f");
3294
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_client, client, "f");
3295
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_callbacks, new Set(), "f");
3296
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_latestResult, null, "f");
3297
3297
  // Create the promise once and store its resolve/reject
3298
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
3299
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
3300
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initReject, reject, "f");
3298
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
3299
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
3300
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, reject, "f");
3301
3301
  }), "f");
3302
3302
  }
3303
3303
  async subscribe() {
3304
3304
  // Clean up previous subscription attempt if retrying
3305
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
3306
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
3307
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_unsubscribe, undefined, "f");
3305
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
3306
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
3307
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_unsubscribe, undefined, "f");
3308
3308
  }
3309
3309
  // Clear any existing timeout
3310
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
3311
- clearTimeout(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
3312
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
3310
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
3311
+ clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
3312
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
3313
3313
  }
3314
3314
  // Clear any existing keepalive timer to prevent accumulation
3315
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_keepaliveTimer, "f")) {
3316
- clearTimeout(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
3317
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_keepaliveTimer, undefined, "f");
3315
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_keepaliveTimer, "f")) {
3316
+ clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
3317
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_keepaliveTimer, undefined, "f");
3318
3318
  }
3319
3319
  try {
3320
3320
  // Initialize the query subscription
3321
3321
  let initialResult;
3322
- initialResult = await __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_client, "f").subscribeQuery(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_query, "f"));
3323
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_subscriptionId, initialResult.subscriptionId, "f");
3322
+ initialResult = await __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").subscribeQuery(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_query, "f"));
3323
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_subscriptionId, initialResult.subscriptionId, "f");
3324
3324
  // Process the initial result immediately for fast UX.
3325
3325
  // The subscribeQuery() RPC call already returns the initial result,
3326
3326
  // so treat that as successful initialization instead of waiting for a
3327
3327
  // follow-up WebSocket update that may never arrive until the query changes.
3328
3328
  if (initialResult.result !== undefined) {
3329
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_latestResult, initialResult.result, "f");
3330
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, initialResult.result);
3331
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initResolve, "f")) {
3332
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initResolve, "f").call(this, true);
3333
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initResolve, undefined, "f");
3334
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initReject, undefined, "f");
3329
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_latestResult, initialResult.result, "f");
3330
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, initialResult.result);
3331
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f")) {
3332
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f").call(this, true);
3333
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, undefined, "f");
3334
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, undefined, "f");
3335
3335
  }
3336
3336
  }
3337
3337
  else {
3338
3338
  console.warn('⚠️ No initial result returned from subscribeQuery!');
3339
3339
  // Only keep the initialization timeout when the backend did not
3340
3340
  // provide an initial result up front.
3341
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initTimeoutId, setTimeout(() => {
3341
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, setTimeout(() => {
3342
3342
  console.error('Subscription initialization timed out after 30 seconds. Resubscribing...');
3343
3343
  // Recursively retry subscription, catching any errors
3344
3344
  this.subscribe().catch(error => {
@@ -3347,46 +3347,43 @@ class QuerySubscriptionProxy {
3347
3347
  }, 30000), "f");
3348
3348
  }
3349
3349
  // Subscribe to query updates
3350
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_unsubscribe, __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_client, "f").subscribeToQueryUpdates(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_subscriptionId, "f"), (updateResult) => {
3350
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_unsubscribe, __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").subscribeToQueryUpdates(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f"), (updateResult) => {
3351
3351
  // Clear timeout on first message
3352
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
3353
- clearTimeout(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
3354
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
3352
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
3353
+ clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
3354
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
3355
3355
  }
3356
3356
  // Resolve the initialization promise (only resolves once)
3357
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initResolve, "f")) {
3358
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initResolve, "f").call(this, true);
3359
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initResolve, undefined, "f"); // Prevent double-resolve
3360
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initReject, undefined, "f");
3357
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f")) {
3358
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f").call(this, true);
3359
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, undefined, "f"); // Prevent double-resolve
3360
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, undefined, "f");
3361
3361
  }
3362
- // Skip duplicate init messages
3363
- if (updateResult.isInit && __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_latestResult, "f"))
3364
- return;
3365
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_latestResult, updateResult, "f");
3366
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, updateResult);
3362
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_latestResult, updateResult, "f");
3363
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, updateResult);
3367
3364
  }), "f");
3368
3365
  }
3369
3366
  catch (error) {
3370
3367
  console.error('Error setting up subscription:', error);
3371
3368
  // Reject the promise if this is the first attempt
3372
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initReject, "f")) {
3373
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initReject, "f").call(this, error);
3374
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initResolve, undefined, "f");
3375
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initReject, undefined, "f");
3369
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initReject, "f")) {
3370
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initReject, "f").call(this, error);
3371
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, undefined, "f");
3372
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, undefined, "f");
3376
3373
  }
3377
3374
  throw error; // Re-throw so caller knows it failed
3378
3375
  }
3379
3376
  // Start keepalive loop using platform-agnostic setTimeout
3380
3377
  const keepaliveLoop = async () => {
3381
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_disposed, "f"))
3378
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_disposed, "f"))
3382
3379
  return;
3383
3380
  try {
3384
- await __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_client, "f").keepAliveQuery(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_subscriptionId, "f"));
3381
+ await __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").keepAliveQuery(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f"));
3385
3382
  }
3386
3383
  catch (e) {
3387
3384
  console.error('Error in keepalive:', e);
3388
3385
  // try to reinitialize the subscription
3389
- console.log('Reinitializing subscription for query:', __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_query, "f"));
3386
+ console.log('Reinitializing subscription for query:', __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_query, "f"));
3390
3387
  try {
3391
3388
  await this.subscribe();
3392
3389
  console.log('Subscription reinitialized');
@@ -3398,12 +3395,12 @@ class QuerySubscriptionProxy {
3398
3395
  }
3399
3396
  }
3400
3397
  // Schedule next keepalive if not disposed
3401
- if (!__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_disposed, "f")) {
3402
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 30000), "f");
3398
+ if (!__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_disposed, "f")) {
3399
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 30000), "f");
3403
3400
  }
3404
3401
  };
3405
3402
  // Start the first keepalive loop
3406
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 30000), "f");
3403
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 30000), "f");
3407
3404
  }
3408
3405
  /** Get the subscription ID for this query subscription
3409
3406
  *
@@ -3414,7 +3411,7 @@ class QuerySubscriptionProxy {
3414
3411
  * @returns The subscription ID string
3415
3412
  */
3416
3413
  get id() {
3417
- return __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_subscriptionId, "f");
3414
+ return __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f");
3418
3415
  }
3419
3416
  /** Promise that resolves when the subscription has received its first result
3420
3417
  * through the subscription channel. This ensures the subscription is fully
@@ -3428,7 +3425,7 @@ class QuerySubscriptionProxy {
3428
3425
  * creation methods (like subscribeInfer) already wait for initialization.
3429
3426
  */
3430
3427
  get initialized() {
3431
- return __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initialized, "f");
3428
+ return __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initialized, "f");
3432
3429
  }
3433
3430
  /** Get the latest query result
3434
3431
  *
@@ -3439,7 +3436,7 @@ class QuerySubscriptionProxy {
3439
3436
  * @returns The latest query result as a string (usually a JSON array of bindings)
3440
3437
  */
3441
3438
  get result() {
3442
- return __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_latestResult, "f");
3439
+ return __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_latestResult, "f");
3443
3440
  }
3444
3441
  /** Add a callback that will be called whenever new results arrive
3445
3442
  *
@@ -3461,8 +3458,8 @@ class QuerySubscriptionProxy {
3461
3458
  * ```
3462
3459
  */
3463
3460
  onResult(callback) {
3464
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
3465
- return () => __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
3461
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
3462
+ return () => __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
3466
3463
  }
3467
3464
  /** Clean up the subscription and stop keepalive signals
3468
3465
  *
@@ -3476,25 +3473,25 @@ class QuerySubscriptionProxy {
3476
3473
  * will not receive any more updates. The instance should be discarded.
3477
3474
  */
3478
3475
  dispose() {
3479
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_disposed, true, "f");
3480
- clearTimeout(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
3481
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
3482
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
3476
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_disposed, true, "f");
3477
+ clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
3478
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
3479
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
3483
3480
  }
3484
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_callbacks, "f").clear();
3485
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
3486
- clearTimeout(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
3487
- __classPrivateFieldSet$9(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
3481
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f").clear();
3482
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
3483
+ clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
3484
+ __classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, undefined, "f");
3488
3485
  }
3489
3486
  // Tell the backend to dispose of the subscription
3490
- if (__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_subscriptionId, "f")) {
3491
- __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_client, "f").disposeQuerySubscription(__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_subscriptionId, "f"))
3487
+ if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f")) {
3488
+ __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").disposeQuerySubscription(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f"))
3492
3489
  .catch(e => console.error('Error disposing query subscription:', e));
3493
3490
  }
3494
3491
  }
3495
3492
  }
3496
3493
  _QuerySubscriptionProxy_uuid = new WeakMap(), _QuerySubscriptionProxy_subscriptionId = new WeakMap(), _QuerySubscriptionProxy_client = new WeakMap(), _QuerySubscriptionProxy_callbacks = new WeakMap(), _QuerySubscriptionProxy_keepaliveTimer = new WeakMap(), _QuerySubscriptionProxy_unsubscribe = new WeakMap(), _QuerySubscriptionProxy_latestResult = new WeakMap(), _QuerySubscriptionProxy_disposed = new WeakMap(), _QuerySubscriptionProxy_initialized = new WeakMap(), _QuerySubscriptionProxy_initResolve = new WeakMap(), _QuerySubscriptionProxy_initReject = new WeakMap(), _QuerySubscriptionProxy_initTimeoutId = new WeakMap(), _QuerySubscriptionProxy_query = new WeakMap(), _QuerySubscriptionProxy_instances = new WeakSet(), _QuerySubscriptionProxy_notifyCallbacks = function _QuerySubscriptionProxy_notifyCallbacks(result) {
3497
- for (const callback of __classPrivateFieldGet$9(this, _QuerySubscriptionProxy_callbacks, "f")) {
3494
+ for (const callback of __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f")) {
3498
3495
  try {
3499
3496
  callback(result);
3500
3497
  }
@@ -3544,7 +3541,7 @@ _QuerySubscriptionProxy_uuid = new WeakMap(), _QuerySubscriptionProxy_subscripti
3544
3541
  */
3545
3542
  class PerspectiveProxy {
3546
3543
  /** @internal Exposed for ModelQueryBuilder subscription management */
3547
- get client() { return __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f"); }
3544
+ get client() { return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f"); }
3548
3545
  /**
3549
3546
  * Creates a new PerspectiveProxy instance.
3550
3547
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
@@ -3562,31 +3559,31 @@ class PerspectiveProxy {
3562
3559
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
3563
3560
  */
3564
3561
  );
3565
- __classPrivateFieldSet$9(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, [], "f");
3566
- __classPrivateFieldSet$9(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, [], "f");
3567
- __classPrivateFieldSet$9(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, [], "f");
3568
- __classPrivateFieldSet$9(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, [], "f");
3569
- __classPrivateFieldSet$9(this, _PerspectiveProxy_handle, handle, "f");
3570
- __classPrivateFieldSet$9(this, _PerspectiveProxy_client, ad4m, "f");
3571
- this.uuid = __classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid;
3572
- this.name = __classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").name;
3573
- this.owners = __classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").owners;
3574
- this.sharedUrl = __classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").sharedUrl;
3575
- this.neighbourhood = __classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").neighbourhood;
3576
- this.state = __classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").state;
3577
- __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addPerspectiveLinkAddedListener(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f"));
3578
- __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addPerspectiveLinkRemovedListener(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f"));
3579
- __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addPerspectiveLinkUpdatedListener(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f"));
3580
- __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addPerspectiveSyncStateChangeListener(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f"));
3562
+ __classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, [], "f");
3563
+ __classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, [], "f");
3564
+ __classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, [], "f");
3565
+ __classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, [], "f");
3566
+ __classPrivateFieldSet$a(this, _PerspectiveProxy_handle, handle, "f");
3567
+ __classPrivateFieldSet$a(this, _PerspectiveProxy_client, ad4m, "f");
3568
+ this.uuid = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid;
3569
+ this.name = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").name;
3570
+ this.owners = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").owners;
3571
+ this.sharedUrl = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").sharedUrl;
3572
+ this.neighbourhood = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").neighbourhood;
3573
+ this.state = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").state;
3574
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveLinkAddedListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f"));
3575
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveLinkRemovedListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f"));
3576
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveLinkUpdatedListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f"));
3577
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveSyncStateChangeListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f"));
3581
3578
  }
3582
3579
  /** Update the proxy's internal handle and public fields in-place.
3583
3580
  * Keeps the same object reference so all holders see the update. */
3584
3581
  updateHandle(handle) {
3585
- if (handle.uuid !== __classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid) {
3586
- throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch — proxy is bound to "${__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid}" but received handle with UUID "${handle.uuid}". ` +
3582
+ if (handle.uuid !== __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid) {
3583
+ throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch — proxy is bound to "${__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid}" but received handle with UUID "${handle.uuid}". ` +
3587
3584
  `This would silently diverge from listeners registered under the original UUID.`);
3588
3585
  }
3589
- __classPrivateFieldSet$9(this, _PerspectiveProxy_handle, handle, "f");
3586
+ __classPrivateFieldSet$a(this, _PerspectiveProxy_handle, handle, "f");
3590
3587
  this.uuid = handle.uuid;
3591
3588
  this.name = handle.name;
3592
3589
  this.owners = handle.owners;
@@ -3667,8 +3664,8 @@ class PerspectiveProxy {
3667
3664
  * @param batchId - Optional batch ID to group this operation with others
3668
3665
  */
3669
3666
  async executeAction(actions, expression, parameters, batchId) {
3670
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").executeCommands(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify(actions), expression, JSON.stringify(parameters), batchId);
3671
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3667
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").executeCommands(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify(actions), expression, JSON.stringify(parameters), batchId);
3668
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3672
3669
  return result;
3673
3670
  }
3674
3671
  /**
@@ -3693,7 +3690,7 @@ class PerspectiveProxy {
3693
3690
  * ```
3694
3691
  */
3695
3692
  async get(query) {
3696
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, query);
3693
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
3697
3694
  }
3698
3695
  /**
3699
3696
  * Executes a Prolog query against the perspective's knowledge base.
@@ -3719,7 +3716,7 @@ class PerspectiveProxy {
3719
3716
  * ```
3720
3717
  */
3721
3718
  async infer(query) {
3722
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, query);
3719
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
3723
3720
  }
3724
3721
  /**
3725
3722
  * Executes a SPARQL query against the perspective's link cache.
@@ -3738,11 +3735,11 @@ class PerspectiveProxy {
3738
3735
  * @returns Query results as parsed JSON
3739
3736
  */
3740
3737
  async querySparql(query) {
3741
- const cached = getCachedResult(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, query);
3738
+ const cached = getCachedResult(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
3742
3739
  if (cached !== undefined)
3743
3740
  return cached;
3744
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, query);
3745
- setCachedResult(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, query, result);
3741
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
3742
+ setCachedResult(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query, result);
3746
3743
  return result;
3747
3744
  }
3748
3745
  /**
@@ -3754,7 +3751,7 @@ class PerspectiveProxy {
3754
3751
  * @returns Object with `instances` array and `totalCount`
3755
3752
  */
3756
3753
  async modelQuery(className, queryJson, shapeJson) {
3757
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, shapeJson);
3754
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, shapeJson);
3758
3755
  }
3759
3756
  /**
3760
3757
  * Evaluate property getters for a batch of instances in a single RPC call.
@@ -3770,7 +3767,7 @@ class PerspectiveProxy {
3770
3767
  * @returns Map of instance ID → evaluated property values
3771
3768
  */
3772
3769
  async evaluateGetters(className, instanceIds, shapeJson, propertyNames) {
3773
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, shapeJson, propertyNames);
3770
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, shapeJson, propertyNames);
3774
3771
  }
3775
3772
  /**
3776
3773
  * Subscribe to model query changes. Builds trigger SPARQL from the model shape
@@ -3786,7 +3783,7 @@ class PerspectiveProxy {
3786
3783
  * @returns Object with `subscriptionId` and initial `result`
3787
3784
  */
3788
3785
  async modelSubscribe(className, queryJson, shapeJson) {
3789
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, shapeJson);
3786
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, shapeJson);
3790
3787
  }
3791
3788
  /**
3792
3789
  * Adds a new link to the perspective.
@@ -3814,8 +3811,8 @@ class PerspectiveProxy {
3814
3811
  * ```
3815
3812
  */
3816
3813
  async add(link, status = 'shared', batchId) {
3817
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
3818
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3814
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
3815
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3819
3816
  return result;
3820
3817
  }
3821
3818
  /**
@@ -3828,8 +3825,8 @@ class PerspectiveProxy {
3828
3825
  * @returns Array of created LinkExpressions
3829
3826
  */
3830
3827
  async addLinks(links, status = 'shared', batchId) {
3831
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
3832
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3828
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
3829
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3833
3830
  return result;
3834
3831
  }
3835
3832
  /**
@@ -3840,8 +3837,8 @@ class PerspectiveProxy {
3840
3837
  * @returns Array of removed LinkExpressions
3841
3838
  */
3842
3839
  async removeLinks(links, batchId) {
3843
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
3844
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3840
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
3841
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3845
3842
  return result;
3846
3843
  }
3847
3844
  /**
@@ -3853,8 +3850,8 @@ class PerspectiveProxy {
3853
3850
  * @returns Object containing results of the mutations
3854
3851
  */
3855
3852
  async linkMutations(mutations, status = 'shared') {
3856
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
3857
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3853
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
3854
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3858
3855
  return result;
3859
3856
  }
3860
3857
  /**
@@ -3866,7 +3863,7 @@ class PerspectiveProxy {
3866
3863
  * @returns The added LinkExpression
3867
3864
  */
3868
3865
  async addLinkExpression(link, status = 'shared', batchId) {
3869
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
3866
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
3870
3867
  }
3871
3868
  /**
3872
3869
  * Updates an existing link with new data.
@@ -3876,8 +3873,8 @@ class PerspectiveProxy {
3876
3873
  * @param batchId - Optional batch ID to group this operation with others
3877
3874
  */
3878
3875
  async update(oldLink, newLink, batchId) {
3879
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
3880
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3876
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
3877
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3881
3878
  return result;
3882
3879
  }
3883
3880
  /**
@@ -3887,18 +3884,18 @@ class PerspectiveProxy {
3887
3884
  * @param batchId - Optional batch ID to group this operation with others
3888
3885
  */
3889
3886
  async remove(link, batchId) {
3890
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, link, batchId);
3891
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3887
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, link, batchId);
3888
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3892
3889
  return result;
3893
3890
  }
3894
3891
  /** Creates a new batch for grouping operations */
3895
3892
  async createBatch() {
3896
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3893
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3897
3894
  }
3898
3895
  /** Commits a batch of operations */
3899
3896
  async commitBatch(batchId) {
3900
- const result = await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, batchId);
3901
- invalidatePerspectiveCache(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3897
+ const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, batchId);
3898
+ invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3902
3899
  return result;
3903
3900
  }
3904
3901
  /**
@@ -3908,7 +3905,7 @@ class PerspectiveProxy {
3908
3905
  * @returns The rendered Expression
3909
3906
  */
3910
3907
  async getExpression(expressionURI) {
3911
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
3908
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
3912
3909
  }
3913
3910
  /**
3914
3911
  * Creates a new Expression in the specified Language.
@@ -3918,7 +3915,7 @@ class PerspectiveProxy {
3918
3915
  * @returns URI of the created Expression
3919
3916
  */
3920
3917
  async createExpression(content, languageAddress) {
3921
- return await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
3918
+ return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
3922
3919
  }
3923
3920
  /**
3924
3921
  * Subscribes to link changes in the perspective.
@@ -3941,13 +3938,13 @@ class PerspectiveProxy {
3941
3938
  */
3942
3939
  async addListener(type, cb) {
3943
3940
  if (type === 'link-added') {
3944
- __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").push(cb);
3941
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").push(cb);
3945
3942
  }
3946
3943
  else if (type === 'link-removed') {
3947
- __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").push(cb);
3944
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").push(cb);
3948
3945
  }
3949
3946
  else if (type === 'link-updated') {
3950
- __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").push(cb);
3947
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").push(cb);
3951
3948
  }
3952
3949
  }
3953
3950
  /**
@@ -3963,7 +3960,7 @@ class PerspectiveProxy {
3963
3960
  * ```
3964
3961
  */
3965
3962
  async addSyncStateChangeListener(cb) {
3966
- __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f").push(cb);
3963
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f").push(cb);
3967
3964
  }
3968
3965
  /**
3969
3966
  * Unsubscribes from link changes.
@@ -3973,16 +3970,16 @@ class PerspectiveProxy {
3973
3970
  */
3974
3971
  async removeListener(type, cb) {
3975
3972
  if (type === 'link-added') {
3976
- const index = __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").indexOf(cb);
3977
- __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").splice(index, 1);
3973
+ const index = __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").indexOf(cb);
3974
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").splice(index, 1);
3978
3975
  }
3979
3976
  else if (type === 'link-removed') {
3980
- const index = __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").indexOf(cb);
3981
- __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").splice(index, 1);
3977
+ const index = __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").indexOf(cb);
3978
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").splice(index, 1);
3982
3979
  }
3983
3980
  else if (type === 'link-updated') {
3984
- const index = __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").indexOf(cb);
3985
- __classPrivateFieldGet$9(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").splice(index, 1);
3981
+ const index = __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").indexOf(cb);
3982
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").splice(index, 1);
3986
3983
  }
3987
3984
  }
3988
3985
  /**
@@ -3992,7 +3989,7 @@ class PerspectiveProxy {
3992
3989
  * @returns Perspective object containing all links
3993
3990
  */
3994
3991
  async snapshot() {
3995
- return __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
3992
+ return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
3996
3993
  }
3997
3994
  /**
3998
3995
  * Loads a perspective snapshot, replacing current content.
@@ -4272,7 +4269,7 @@ class PerspectiveProxy {
4272
4269
  * await perspective.addSdna('Recipe', prologCode, 'subject_class');
4273
4270
  */
4274
4271
  async addSdna(name, sdnaCode, sdnaType, shaclJson) {
4275
- return __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
4272
+ return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
4276
4273
  }
4277
4274
  /**
4278
4275
  * Adds a subject class to the perspective.
@@ -4542,7 +4539,7 @@ class PerspectiveProxy {
4542
4539
  let className;
4543
4540
  if (typeof subjectClass === "string") {
4544
4541
  className = subjectClass;
4545
- await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
4542
+ await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
4546
4543
  className,
4547
4544
  initialValues
4548
4545
  }), exprAddr, initialValues ? JSON.stringify(initialValues) : undefined, batchId);
@@ -4554,7 +4551,7 @@ class PerspectiveProxy {
4554
4551
  if (!resolvedClassName) {
4555
4552
  throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
4556
4553
  }
4557
- await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
4554
+ await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
4558
4555
  className: resolvedClassName,
4559
4556
  initialValues
4560
4557
  }), exprAddr, initialValues ? JSON.stringify(initialValues) : undefined, batchId);
@@ -4569,7 +4566,7 @@ class PerspectiveProxy {
4569
4566
  }
4570
4567
  async getSubjectData(subjectClass, exprAddr) {
4571
4568
  if (typeof subjectClass === "string") {
4572
- return JSON.parse(await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
4569
+ return JSON.parse(await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
4573
4570
  }
4574
4571
  const obj = subjectClass;
4575
4572
  const resolvedClassName = obj.className || obj.constructor?.className || obj.constructor?.prototype?.className
@@ -4577,7 +4574,7 @@ class PerspectiveProxy {
4577
4574
  if (!resolvedClassName) {
4578
4575
  throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
4579
4576
  }
4580
- return JSON.parse(await __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
4577
+ return JSON.parse(await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
4581
4578
  }
4582
4579
  /**
4583
4580
  * Gets actions from SHACL links for a given predicate (e.g., ad4m://constructor, ad4m://destructor).
@@ -4941,7 +4938,7 @@ class PerspectiveProxy {
4941
4938
  // Get the class name from the JS class
4942
4939
  const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
4943
4940
  // Skip if already registered for this perspective instance
4944
- if (__classPrivateFieldGet$9(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
4941
+ if (__classPrivateFieldGet$a(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
4945
4942
  return;
4946
4943
  // Note: Duplicate checking is handled on the Rust side in add_sdna
4947
4944
  // Generate SHACL SDNA (Prolog-free)
@@ -4956,13 +4953,13 @@ class PerspectiveProxy {
4956
4953
  // Backend stores SHACL links directly
4957
4954
  await this.addSdna(className, '', 'subject_class', shaclJson);
4958
4955
  // Mark as registered for this perspective instance
4959
- __classPrivateFieldGet$9(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
4956
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
4960
4957
  }
4961
4958
  /** Clear the per-instance ensured subject class cache.
4962
4959
  * Call this after wiping a perspective's links so that
4963
4960
  * subsequent register() calls re-add SHACL definitions. */
4964
4961
  clearEnsuredSubjectClasses() {
4965
- __classPrivateFieldGet$9(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
4962
+ __classPrivateFieldGet$a(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
4966
4963
  }
4967
4964
  /**
4968
4965
  * Returns a list of all class names that have been registered as SHACL
@@ -5137,7 +5134,7 @@ class PerspectiveProxy {
5137
5134
  }));
5138
5135
  }
5139
5136
  getNeighbourhoodProxy() {
5140
- return __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$9(this, _PerspectiveProxy_handle, "f").uuid);
5137
+ return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
5141
5138
  }
5142
5139
  /**
5143
5140
  * Returns a proxy object for working with AI capabilities.
@@ -5154,7 +5151,7 @@ class PerspectiveProxy {
5154
5151
  * ```
5155
5152
  */
5156
5153
  get ai() {
5157
- return __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f").aiClient;
5154
+ return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").aiClient;
5158
5155
  }
5159
5156
  /**
5160
5157
  * Creates a subscription for a Prolog query that updates in real-time.
@@ -5196,7 +5193,7 @@ class PerspectiveProxy {
5196
5193
  * ```
5197
5194
  */
5198
5195
  async subscribeInfer(query) {
5199
- const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f"));
5196
+ const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f"));
5200
5197
  // Start the subscription on the Rust side first to get the real subscription ID
5201
5198
  await subscriptionProxy.subscribe();
5202
5199
  // Wait for the initial result
@@ -5224,7 +5221,7 @@ class PerspectiveProxy {
5224
5221
  * @returns Initialized QuerySubscriptionProxy instance
5225
5222
  */
5226
5223
  async subscribeQuery(query) {
5227
- const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$9(this, _PerspectiveProxy_client, "f"));
5224
+ const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f"));
5228
5225
  // Start the subscription on the Rust side first to get the real subscription ID
5229
5226
  await subscriptionProxy.subscribe();
5230
5227
  // Wait for the initial result
@@ -5234,13 +5231,13 @@ class PerspectiveProxy {
5234
5231
  }
5235
5232
  _PerspectiveProxy_handle = new WeakMap(), _PerspectiveProxy_client = new WeakMap(), _PerspectiveProxy_perspectiveLinkAddedCallbacks = new WeakMap(), _PerspectiveProxy_perspectiveLinkRemovedCallbacks = new WeakMap(), _PerspectiveProxy_perspectiveLinkUpdatedCallbacks = new WeakMap(), _PerspectiveProxy_perspectiveSyncStateChangeCallbacks = new WeakMap(), _PerspectiveProxy_ensuredSubjectClasses = new WeakMap();
5236
5233
 
5237
- var __classPrivateFieldSet$8 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
5234
+ var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
5238
5235
  if (kind === "m") throw new TypeError("Private method is not writable");
5239
5236
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5240
5237
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5241
5238
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
5242
5239
  };
5243
- var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
5240
+ var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
5244
5241
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5245
5242
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5246
5243
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -5248,11 +5245,6 @@ var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) |
5248
5245
  var _PerspectiveClient_apiClient, _PerspectiveClient_perspectiveAddedCallbacks, _PerspectiveClient_perspectiveUpdatedCallbacks, _PerspectiveClient_perspectiveRemovedCallbacks, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, _PerspectiveClient_expressionClient, _PerspectiveClient_neighbourhoodClient, _PerspectiveClient_aiClient, _PerspectiveClient_unsubscribers, _PerspectiveClient_linkUnsubscribers, _PerspectiveClient_querySubscriptionUnsubscribers;
5249
5246
  function normalizeQueryResult(raw, errorContext) {
5250
5247
  let finalResult = raw;
5251
- let isInit = false;
5252
- if (typeof finalResult === 'string' && finalResult.startsWith('#init#')) {
5253
- finalResult = finalResult.substring(6);
5254
- isInit = true;
5255
- }
5256
5248
  if (typeof finalResult === 'string') {
5257
5249
  try {
5258
5250
  finalResult = JSON.parse(finalResult);
@@ -5261,10 +5253,7 @@ function normalizeQueryResult(raw, errorContext) {
5261
5253
  console.error(errorContext, e);
5262
5254
  }
5263
5255
  }
5264
- if (isInit && typeof finalResult === 'object' && finalResult !== null) {
5265
- finalResult.isInit = true;
5266
- }
5267
- return { result: finalResult, isInit };
5256
+ return finalResult;
5268
5257
  }
5269
5258
  class PerspectiveClient {
5270
5259
  constructor(baseUrl, token, subscribe = true, sharedApiClient) {
@@ -5279,14 +5268,14 @@ class PerspectiveClient {
5279
5268
  _PerspectiveClient_unsubscribers.set(this, void 0);
5280
5269
  _PerspectiveClient_linkUnsubscribers.set(this, void 0);
5281
5270
  _PerspectiveClient_querySubscriptionUnsubscribers.set(this, void 0);
5282
- __classPrivateFieldSet$8(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
5283
- __classPrivateFieldSet$8(this, _PerspectiveClient_perspectiveAddedCallbacks, [], "f");
5284
- __classPrivateFieldSet$8(this, _PerspectiveClient_perspectiveUpdatedCallbacks, [], "f");
5285
- __classPrivateFieldSet$8(this, _PerspectiveClient_perspectiveRemovedCallbacks, [], "f");
5286
- __classPrivateFieldSet$8(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, [], "f");
5287
- __classPrivateFieldSet$8(this, _PerspectiveClient_unsubscribers, [], "f");
5288
- __classPrivateFieldSet$8(this, _PerspectiveClient_linkUnsubscribers, new Map(), "f");
5289
- __classPrivateFieldSet$8(this, _PerspectiveClient_querySubscriptionUnsubscribers, new Map(), "f");
5271
+ __classPrivateFieldSet$9(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
5272
+ __classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveAddedCallbacks, [], "f");
5273
+ __classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveUpdatedCallbacks, [], "f");
5274
+ __classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveRemovedCallbacks, [], "f");
5275
+ __classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, [], "f");
5276
+ __classPrivateFieldSet$9(this, _PerspectiveClient_unsubscribers, [], "f");
5277
+ __classPrivateFieldSet$9(this, _PerspectiveClient_linkUnsubscribers, new Map(), "f");
5278
+ __classPrivateFieldSet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, new Map(), "f");
5290
5279
  if (subscribe) {
5291
5280
  this.subscribePerspectiveAdded();
5292
5281
  this.subscribePerspectiveUpdated();
@@ -5294,24 +5283,24 @@ class PerspectiveClient {
5294
5283
  }
5295
5284
  }
5296
5285
  setExpressionClient(client) {
5297
- __classPrivateFieldSet$8(this, _PerspectiveClient_expressionClient, client, "f");
5286
+ __classPrivateFieldSet$9(this, _PerspectiveClient_expressionClient, client, "f");
5298
5287
  }
5299
5288
  setNeighbourhoodClient(client) {
5300
- __classPrivateFieldSet$8(this, _PerspectiveClient_neighbourhoodClient, client, "f");
5289
+ __classPrivateFieldSet$9(this, _PerspectiveClient_neighbourhoodClient, client, "f");
5301
5290
  }
5302
5291
  setAIClient(client) {
5303
- __classPrivateFieldSet$8(this, _PerspectiveClient_aiClient, client, "f");
5292
+ __classPrivateFieldSet$9(this, _PerspectiveClient_aiClient, client, "f");
5304
5293
  }
5305
5294
  get aiClient() {
5306
- return __classPrivateFieldGet$8(this, _PerspectiveClient_aiClient, "f");
5295
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_aiClient, "f");
5307
5296
  }
5308
5297
  async all() {
5309
- const perspectives = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.all');
5298
+ const perspectives = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.all');
5310
5299
  return perspectives.map(handle => new PerspectiveProxy(handle, this));
5311
5300
  }
5312
5301
  async byUUID(uuid) {
5313
5302
  try {
5314
- const perspective = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.get', { uuid });
5303
+ const perspective = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.get', { uuid });
5315
5304
  if (!perspective)
5316
5305
  return null;
5317
5306
  return new PerspectiveProxy(perspective, this);
@@ -5323,10 +5312,10 @@ class PerspectiveClient {
5323
5312
  }
5324
5313
  }
5325
5314
  async snapshotByUUID(uuid) {
5326
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
5315
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
5327
5316
  }
5328
5317
  async publishSnapshotByUUID(uuid) {
5329
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
5318
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
5330
5319
  }
5331
5320
  async queryLinks(uuid, query) {
5332
5321
  const params = { uuid };
@@ -5342,59 +5331,59 @@ class PerspectiveClient {
5342
5331
  params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate);
5343
5332
  if (query.limit !== undefined)
5344
5333
  params.limit = query.limit;
5345
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params);
5334
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params);
5346
5335
  }
5347
5336
  async queryProlog(uuid, query) {
5348
- const result = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query });
5337
+ const result = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query });
5349
5338
  return JSON.parse(result);
5350
5339
  }
5351
5340
  async querySparql(uuid, query) {
5352
- const result = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query });
5341
+ const result = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query });
5353
5342
  return JSON.parse(result);
5354
5343
  }
5355
5344
  async subscribeQuery(uuid, query) {
5356
- const response = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.subscribeQuery', { uuid, query });
5345
+ const response = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.subscribeQuery', { uuid, query });
5357
5346
  const { subscriptionId, result } = response;
5358
- const normalized = normalizeQueryResult(result, 'Error parsing subscribeQuery result:');
5359
- return { subscriptionId, result: normalized.result, isInit: normalized.isInit };
5347
+ const parsed = normalizeQueryResult(result, 'Error parsing subscribeQuery result:');
5348
+ return { subscriptionId, result: parsed };
5360
5349
  }
5361
5350
  async perspectiveKeepAliveQuery(uuid, subscriptionId) {
5362
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.keepAliveQuery', { uuid, subscriptionId });
5351
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.keepAliveQuery', { uuid, subscriptionId });
5363
5352
  }
5364
5353
  async perspectiveDisposeQuerySubscription(uuid, subscriptionId) {
5365
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
5354
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
5366
5355
  }
5367
5356
  subscribeToQueryUpdates(subscriptionId, onData) {
5368
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5357
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5369
5358
  const event = data;
5370
5359
  if (event.type !== 'query-subscription-update')
5371
5360
  return;
5372
5361
  const eventSubscriptionId = event.subscriptionId || event.subscription_id;
5373
5362
  if (eventSubscriptionId !== subscriptionId)
5374
5363
  return;
5375
- const normalized = normalizeQueryResult(event.result, 'Error parsing query subscription:');
5376
- onData(normalized.result);
5364
+ const parsed = normalizeQueryResult(event.result, 'Error parsing query subscription:');
5365
+ onData(parsed);
5377
5366
  });
5378
- __classPrivateFieldGet$8(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").set(subscriptionId, unsub);
5367
+ __classPrivateFieldGet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").set(subscriptionId, unsub);
5379
5368
  return unsub;
5380
5369
  }
5381
5370
  async keepAliveQuery(uuid, subscriptionId) {
5382
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.keepAliveQuery', { uuid, subscriptionId });
5371
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.keepAliveQuery', { uuid, subscriptionId });
5383
5372
  }
5384
5373
  async disposeQuerySubscription(uuid, subscriptionId) {
5385
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").get(subscriptionId);
5374
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").get(subscriptionId);
5386
5375
  if (unsub) {
5387
5376
  unsub();
5388
- __classPrivateFieldGet$8(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").delete(subscriptionId);
5377
+ __classPrivateFieldGet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").delete(subscriptionId);
5389
5378
  }
5390
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
5379
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
5391
5380
  }
5392
5381
  async modelQuery(uuid, className, queryJson, shapeJson) {
5393
- const resultJson = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
5382
+ const resultJson = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
5394
5383
  return JSON.parse(resultJson);
5395
5384
  }
5396
5385
  async evaluateGetters(uuid, className, instanceIds, shapeJson, propertyNames) {
5397
- const resultJson = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.evaluateGetters', {
5386
+ const resultJson = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.evaluateGetters', {
5398
5387
  uuid,
5399
5388
  class_name: className,
5400
5389
  instance_ids: instanceIds,
@@ -5404,127 +5393,127 @@ class PerspectiveClient {
5404
5393
  return JSON.parse(resultJson);
5405
5394
  }
5406
5395
  async modelSubscribe(uuid, className, queryJson, shapeJson) {
5407
- const response = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.modelSubscribe', { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
5396
+ const response = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.modelSubscribe', { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
5408
5397
  return {
5409
5398
  subscriptionId: response.subscription_id,
5410
5399
  result: JSON.parse(response.result)
5411
5400
  };
5412
5401
  }
5413
5402
  async add(name) {
5414
- const handle = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
5403
+ const handle = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
5415
5404
  return new PerspectiveProxy(handle, this);
5416
5405
  }
5417
5406
  async update(uuid, name) {
5418
- const handle = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
5407
+ const handle = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
5419
5408
  return new PerspectiveProxy(handle, this);
5420
5409
  }
5421
5410
  async remove(uuid) {
5422
- const result = await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
5411
+ const result = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
5423
5412
  return { perspectiveRemove: result };
5424
5413
  }
5425
5414
  async addLink(uuid, link, status = 'shared', batchId) {
5426
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
5415
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
5427
5416
  }
5428
5417
  async addLinks(uuid, links, status = 'shared', batchId) {
5429
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
5418
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
5430
5419
  }
5431
5420
  async removeLinks(uuid, links, batchId) {
5432
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links, batchId });
5421
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links, batchId });
5433
5422
  }
5434
5423
  async linkMutations(uuid, mutations, status) {
5435
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations, status });
5424
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations, status });
5436
5425
  }
5437
5426
  async addLinkExpression(uuid, link, status = 'shared', batchId) {
5438
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link, status, batchId });
5427
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link, status, batchId });
5439
5428
  }
5440
5429
  async updateLink(uuid, oldLink, newLink, batchId) {
5441
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink, newLink, batchId });
5430
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink, newLink, batchId });
5442
5431
  }
5443
5432
  async removeLink(uuid, link, batchId) {
5444
5433
  delete link.__typename;
5445
5434
  delete link.data.__typename;
5446
5435
  delete link.proof.__typename;
5447
5436
  delete link.status;
5448
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link, batchId });
5437
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link, batchId });
5449
5438
  }
5450
5439
  async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
5451
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
5440
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
5452
5441
  }
5453
5442
  async executeCommands(uuid, commands, expression, parameters, batchId) {
5454
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
5443
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
5455
5444
  }
5456
5445
  async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
5457
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
5446
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
5458
5447
  }
5459
5448
  async getSubjectData(uuid, subjectClass, expressionAddress) {
5460
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
5449
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
5461
5450
  }
5462
5451
  // ExpressionClient functions, needed for Subjects:
5463
5452
  async getExpression(expressionURI) {
5464
- return await __classPrivateFieldGet$8(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
5453
+ return await __classPrivateFieldGet$9(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
5465
5454
  }
5466
5455
  async createExpression(content, languageAddress) {
5467
- return await __classPrivateFieldGet$8(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
5456
+ return await __classPrivateFieldGet$9(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
5468
5457
  }
5469
5458
  // Subscriptions:
5470
5459
  addPerspectiveAddedListener(cb) {
5471
- __classPrivateFieldGet$8(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").push(cb);
5460
+ __classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").push(cb);
5472
5461
  }
5473
5462
  subscribePerspectiveAdded() {
5474
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5463
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5475
5464
  if (data.type === 'perspective-added') {
5476
- __classPrivateFieldGet$8(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").forEach(cb => cb(data.perspective));
5465
+ __classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").forEach(cb => cb(data.perspective));
5477
5466
  }
5478
5467
  });
5479
- __classPrivateFieldGet$8(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5468
+ __classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5480
5469
  }
5481
5470
  addPerspectiveUpdatedListener(cb) {
5482
- __classPrivateFieldGet$8(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").push(cb);
5471
+ __classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").push(cb);
5483
5472
  }
5484
5473
  subscribePerspectiveUpdated() {
5485
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5474
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5486
5475
  if (data.type === 'perspective-updated') {
5487
- __classPrivateFieldGet$8(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").forEach(cb => cb(data.perspective));
5476
+ __classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").forEach(cb => cb(data.perspective));
5488
5477
  }
5489
5478
  });
5490
- __classPrivateFieldGet$8(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5479
+ __classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5491
5480
  }
5492
5481
  addPerspectiveSyncedListener(cb) {
5493
- __classPrivateFieldGet$8(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, "f").push(cb);
5482
+ __classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, "f").push(cb);
5494
5483
  }
5495
5484
  async addPerspectiveSyncStateChangeListener(uuid, cb) {
5496
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5485
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5497
5486
  if (data.type === 'sync-state-change' && data.uuid === uuid) {
5498
5487
  cb.forEach(c => c(data.state));
5499
5488
  }
5500
5489
  });
5501
- __classPrivateFieldGet$8(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5490
+ __classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5502
5491
  await new Promise(resolve => setTimeout(resolve, 500));
5503
5492
  }
5504
5493
  addPerspectiveRemovedListener(cb) {
5505
- __classPrivateFieldGet$8(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").push(cb);
5494
+ __classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").push(cb);
5506
5495
  }
5507
5496
  subscribePerspectiveRemoved() {
5508
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5497
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5509
5498
  if (data.type === 'perspective-removed') {
5510
- __classPrivateFieldGet$8(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").forEach(cb => cb(data.uuid));
5499
+ __classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").forEach(cb => cb(data.uuid));
5511
5500
  }
5512
5501
  });
5513
- __classPrivateFieldGet$8(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5502
+ __classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
5514
5503
  }
5515
5504
  async addPerspectiveLinkAddedListener(uuid, cb) {
5516
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5505
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5517
5506
  if (data.type === 'link-added' && data.perspectiveUuid === uuid) {
5518
5507
  cb.forEach(c => c(data.link));
5519
5508
  }
5520
5509
  });
5521
- let existing = __classPrivateFieldGet$8(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
5510
+ let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
5522
5511
  existing.push(unsub);
5523
- __classPrivateFieldGet$8(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
5524
- await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
5512
+ __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
5513
+ await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
5525
5514
  }
5526
5515
  async addPerspectiveLinkRemovedListener(uuid, cb) {
5527
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5516
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5528
5517
  if (data.type === 'link-removed' && data.perspectiveUuid === uuid) {
5529
5518
  const link = data.link;
5530
5519
  if (!link.status) {
@@ -5533,13 +5522,13 @@ class PerspectiveClient {
5533
5522
  cb.forEach(c => c(link));
5534
5523
  }
5535
5524
  });
5536
- let existing = __classPrivateFieldGet$8(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
5525
+ let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
5537
5526
  existing.push(unsub);
5538
- __classPrivateFieldGet$8(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
5539
- await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
5527
+ __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
5528
+ await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
5540
5529
  }
5541
5530
  async addPerspectiveLinkUpdatedListener(uuid, cb) {
5542
- const unsub = __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5531
+ const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
5543
5532
  if (data.type === 'link-updated' && data.perspectiveUuid === uuid) {
5544
5533
  const newLink = data.newLink;
5545
5534
  const oldLink = data.oldLink;
@@ -5552,23 +5541,163 @@ class PerspectiveClient {
5552
5541
  cb.forEach(c => c(data));
5553
5542
  }
5554
5543
  });
5555
- let existing = __classPrivateFieldGet$8(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
5544
+ let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
5556
5545
  existing.push(unsub);
5557
- __classPrivateFieldGet$8(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
5558
- await __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
5546
+ __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
5547
+ await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
5559
5548
  }
5560
5549
  getNeighbourhoodProxy(uuid) {
5561
- return new NeighbourhoodProxy(__classPrivateFieldGet$8(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
5550
+ return new NeighbourhoodProxy(__classPrivateFieldGet$9(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
5562
5551
  }
5563
5552
  async createBatch(uuid) {
5564
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
5553
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
5565
5554
  }
5566
5555
  async commitBatch(uuid, batchId) {
5567
- return __classPrivateFieldGet$8(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
5556
+ return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
5568
5557
  }
5569
5558
  }
5570
5559
  _PerspectiveClient_apiClient = new WeakMap(), _PerspectiveClient_perspectiveAddedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveUpdatedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveRemovedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveSyncStateChangeCallbacks = new WeakMap(), _PerspectiveClient_expressionClient = new WeakMap(), _PerspectiveClient_neighbourhoodClient = new WeakMap(), _PerspectiveClient_aiClient = new WeakMap(), _PerspectiveClient_unsubscribers = new WeakMap(), _PerspectiveClient_linkUnsubscribers = new WeakMap(), _PerspectiveClient_querySubscriptionUnsubscribers = new WeakMap();
5571
5560
 
5561
+ /**
5562
+ * PersistentCache — two-tier persistent key-value cache abstraction.
5563
+ *
5564
+ * Provides an IndexedDB-backed implementation for browsers and a no-op
5565
+ * NullCache fallback for Node.js / environments without IndexedDB.
5566
+ *
5567
+ * Design goals:
5568
+ * - Lazy open: IDB connection is deferred until first access
5569
+ * - Fire-and-forget writes: put() resolves immediately (best-effort persistence)
5570
+ * - Graceful degradation: all IDB errors resolve (never reject), so callers
5571
+ * never need try/catch around cache operations
5572
+ * - Tree-shakeable: import only what you need
5573
+ */
5574
+ var __classPrivateFieldSet$8 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
5575
+ if (kind === "m") throw new TypeError("Private method is not writable");
5576
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5577
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5578
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
5579
+ };
5580
+ var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
5581
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5582
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5583
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5584
+ };
5585
+ var _IDBCache_instances, _IDBCache_dbName, _IDBCache_storeName, _IDBCache_dbPromise, _IDBCache_version, _IDBCache_open;
5586
+ // ── IndexedDB Implementation ─────────────────────────────────────────
5587
+ class IDBCache {
5588
+ constructor(dbName, storeName) {
5589
+ _IDBCache_instances.add(this);
5590
+ _IDBCache_dbName.set(this, void 0);
5591
+ _IDBCache_storeName.set(this, void 0);
5592
+ _IDBCache_dbPromise.set(this, null);
5593
+ _IDBCache_version.set(this, 1);
5594
+ __classPrivateFieldSet$8(this, _IDBCache_dbName, dbName, "f");
5595
+ __classPrivateFieldSet$8(this, _IDBCache_storeName, storeName, "f");
5596
+ }
5597
+ async get(key) {
5598
+ try {
5599
+ const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
5600
+ return new Promise((resolve) => {
5601
+ const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), 'readonly');
5602
+ const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
5603
+ const req = store.get(key);
5604
+ req.onsuccess = () => resolve(req.result ?? undefined);
5605
+ req.onerror = () => resolve(undefined);
5606
+ });
5607
+ }
5608
+ catch {
5609
+ return undefined;
5610
+ }
5611
+ }
5612
+ async put(key, value) {
5613
+ try {
5614
+ const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
5615
+ return new Promise((resolve) => {
5616
+ const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), 'readwrite');
5617
+ const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
5618
+ store.put(value, key);
5619
+ tx.oncomplete = () => resolve();
5620
+ tx.onerror = () => resolve(); // fire-and-forget
5621
+ });
5622
+ }
5623
+ catch {
5624
+ // degrade gracefully
5625
+ }
5626
+ }
5627
+ async delete(key) {
5628
+ try {
5629
+ const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
5630
+ return new Promise((resolve) => {
5631
+ const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), 'readwrite');
5632
+ const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
5633
+ store.delete(key);
5634
+ tx.oncomplete = () => resolve();
5635
+ tx.onerror = () => resolve();
5636
+ });
5637
+ }
5638
+ catch {
5639
+ // degrade gracefully
5640
+ }
5641
+ }
5642
+ async clear() {
5643
+ try {
5644
+ const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
5645
+ return new Promise((resolve) => {
5646
+ const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), 'readwrite');
5647
+ const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
5648
+ store.clear();
5649
+ tx.oncomplete = () => resolve();
5650
+ tx.onerror = () => resolve();
5651
+ });
5652
+ }
5653
+ catch {
5654
+ // degrade gracefully
5655
+ }
5656
+ }
5657
+ }
5658
+ _IDBCache_dbName = new WeakMap(), _IDBCache_storeName = new WeakMap(), _IDBCache_dbPromise = new WeakMap(), _IDBCache_version = new WeakMap(), _IDBCache_instances = new WeakSet(), _IDBCache_open = function _IDBCache_open() {
5659
+ if (!__classPrivateFieldGet$8(this, _IDBCache_dbPromise, "f")) {
5660
+ __classPrivateFieldSet$8(this, _IDBCache_dbPromise, new Promise((resolve, reject) => {
5661
+ const storeName = __classPrivateFieldGet$8(this, _IDBCache_storeName, "f");
5662
+ const req = indexedDB.open(__classPrivateFieldGet$8(this, _IDBCache_dbName, "f"), __classPrivateFieldGet$8(this, _IDBCache_version, "f"));
5663
+ req.onupgradeneeded = () => {
5664
+ const db = req.result;
5665
+ if (!db.objectStoreNames.contains(storeName)) {
5666
+ db.createObjectStore(storeName);
5667
+ }
5668
+ };
5669
+ req.onsuccess = () => resolve(req.result);
5670
+ req.onerror = () => reject(req.error);
5671
+ }), "f");
5672
+ }
5673
+ return __classPrivateFieldGet$8(this, _IDBCache_dbPromise, "f");
5674
+ };
5675
+ // ── NullCache (no-op fallback for Node.js) ───────────────────────────
5676
+ class NullCache {
5677
+ async get(_key) { return undefined; }
5678
+ async put(_key, _value) { }
5679
+ async delete(_key) { }
5680
+ async clear() { }
5681
+ }
5682
+ // ── Factory ──────────────────────────────────────────────────────────
5683
+ /**
5684
+ * Create a PersistentCache backed by IndexedDB (browser) or NullCache (Node.js).
5685
+ *
5686
+ * @param dbName - IndexedDB database name
5687
+ * @param storeName - IndexedDB object store name
5688
+ */
5689
+ function createPersistentCache(dbName, storeName) {
5690
+ try {
5691
+ if (typeof indexedDB !== 'undefined') {
5692
+ return new IDBCache(dbName, storeName);
5693
+ }
5694
+ }
5695
+ catch {
5696
+ // indexedDB access threw (e.g. in a worker with restricted globals)
5697
+ }
5698
+ return new NullCache();
5699
+ }
5700
+
5572
5701
  var __classPrivateFieldSet$7 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
5573
5702
  if (kind === "m") throw new TypeError("Private method is not writable");
5574
5703
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -5580,7 +5709,7 @@ var __classPrivateFieldGet$7 = (undefined && undefined.__classPrivateFieldGet) |
5580
5709
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5581
5710
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5582
5711
  };
5583
- var _AgentClient_apiClient, _AgentClient_baseUrl, _AgentClient_token, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks, _AgentClient_hostingUserInfoChangedCallbacks, _AgentClient_computeLogUpdatedCallbacks, _AgentClient_unsubscribers;
5712
+ var _AgentClient_apiClient, _AgentClient_baseUrl, _AgentClient_token, _AgentClient_appsChangedCallback, _AgentClient_updatedCallbacks, _AgentClient_agentStatusChangedCallbacks, _AgentClient_hostingUserInfoChangedCallbacks, _AgentClient_computeLogUpdatedCallbacks, _AgentClient_unsubscribers, _AgentClient_memCache, _AgentClient_persistent, _AgentClient_selfDid;
5584
5713
  class AgentClient {
5585
5714
  constructor(baseUrl, token, subscribe = true, sharedApiClient) {
5586
5715
  _AgentClient_apiClient.set(this, void 0);
@@ -5592,6 +5721,13 @@ class AgentClient {
5592
5721
  _AgentClient_hostingUserInfoChangedCallbacks.set(this, void 0);
5593
5722
  _AgentClient_computeLogUpdatedCallbacks.set(this, void 0);
5594
5723
  _AgentClient_unsubscribers.set(this, void 0);
5724
+ // ── byDID cache ────────────────────────────────────────────────────
5725
+ // L1: in-memory promise cache with timestamps for TTL
5726
+ _AgentClient_memCache.set(this, new Map());
5727
+ // L2: persistent cache (IndexedDB in browser, NullCache in Node)
5728
+ _AgentClient_persistent.set(this, void 0);
5729
+ // Self-DID for event-driven invalidation (no TTL for own profile)
5730
+ _AgentClient_selfDid.set(this, null);
5595
5731
  __classPrivateFieldSet$7(this, _AgentClient_baseUrl, baseUrl, "f");
5596
5732
  __classPrivateFieldSet$7(this, _AgentClient_token, token, "f");
5597
5733
  __classPrivateFieldSet$7(this, _AgentClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
@@ -5601,6 +5737,7 @@ class AgentClient {
5601
5737
  __classPrivateFieldSet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, [], "f");
5602
5738
  __classPrivateFieldSet$7(this, _AgentClient_computeLogUpdatedCallbacks, [], "f");
5603
5739
  __classPrivateFieldSet$7(this, _AgentClient_unsubscribers, [], "f");
5740
+ __classPrivateFieldSet$7(this, _AgentClient_persistent, createPersistentCache('ad4m-agent-cache', 'agents'), "f");
5604
5741
  if (subscribe) {
5605
5742
  this.subscribeAgentUpdated();
5606
5743
  this.subscribeAgentStatusChanged();
@@ -5634,7 +5771,57 @@ class AgentClient {
5634
5771
  return new AgentStatus(result);
5635
5772
  }
5636
5773
  async byDID(did) {
5637
- return __classPrivateFieldGet$7(this, _AgentClient_apiClient, "f").call('agent.byDid', { did });
5774
+ const now = Date.now();
5775
+ const cached = __classPrivateFieldGet$7(this, _AgentClient_memCache, "f").get(did);
5776
+ if (cached) {
5777
+ const isSelf = did === __classPrivateFieldGet$7(this, _AgentClient_selfDid, "f");
5778
+ // Self-DID: L1 always valid (event-driven invalidation)
5779
+ // Remote DID: L1 valid within TTL
5780
+ if (isSelf || (now - cached.ts) < AgentClient.REMOTE_AGENT_TTL_MS) {
5781
+ return cached.promise;
5782
+ }
5783
+ }
5784
+ // Deduplicate: store the promise immediately so concurrent calls share one RPC
5785
+ const promise = (async () => {
5786
+ // L2: check persistent cache before network
5787
+ const persisted = await __classPrivateFieldGet$7(this, _AgentClient_persistent, "f").get(did);
5788
+ if (persisted) {
5789
+ return persisted;
5790
+ }
5791
+ // L3: network fetch
5792
+ const result = await __classPrivateFieldGet$7(this, _AgentClient_apiClient, "f").call('agent.byDid', { did });
5793
+ __classPrivateFieldGet$7(this, _AgentClient_persistent, "f").put(did, result); // fire-and-forget write to L2
5794
+ return result;
5795
+ })();
5796
+ __classPrivateFieldGet$7(this, _AgentClient_memCache, "f").set(did, { promise, ts: now });
5797
+ // Clean up on failure so next call retries
5798
+ promise.catch(() => {
5799
+ if (__classPrivateFieldGet$7(this, _AgentClient_memCache, "f").get(did)?.promise === promise) {
5800
+ __classPrivateFieldGet$7(this, _AgentClient_memCache, "f").delete(did);
5801
+ }
5802
+ });
5803
+ return promise;
5804
+ }
5805
+ /**
5806
+ * Set the current agent's own DID.
5807
+ * The self-DID receives event-driven invalidation and is never TTL-expired.
5808
+ */
5809
+ setSelfDid(did) {
5810
+ __classPrivateFieldSet$7(this, _AgentClient_selfDid, did, "f");
5811
+ }
5812
+ /**
5813
+ * Invalidate a specific DID's cache entry in both L1 and L2.
5814
+ */
5815
+ invalidateByDid(did) {
5816
+ __classPrivateFieldGet$7(this, _AgentClient_memCache, "f").delete(did);
5817
+ __classPrivateFieldGet$7(this, _AgentClient_persistent, "f").delete(did); // fire-and-forget
5818
+ }
5819
+ /**
5820
+ * Clear the entire L1 (memory) byDID cache.
5821
+ * L2 (IndexedDB) is preserved — agent data remains valid across sessions.
5822
+ */
5823
+ clearByDidCache() {
5824
+ __classPrivateFieldGet$7(this, _AgentClient_memCache, "f").clear();
5638
5825
  }
5639
5826
  async updatePublicPerspective(perspective) {
5640
5827
  const cleanedPerspective = JSON.parse(JSON.stringify(perspective));
@@ -5695,7 +5882,16 @@ class AgentClient {
5695
5882
  subscribeAgentUpdated() {
5696
5883
  const unsub = __classPrivateFieldGet$7(this, _AgentClient_apiClient, "f").subscribe((data) => {
5697
5884
  if (data.type === 'agent-updated') {
5698
- __classPrivateFieldGet$7(this, _AgentClient_updatedCallbacks, "f").forEach((cb) => cb((data.agent || data)));
5885
+ const agent = (data.agent || data);
5886
+ // Update L1 and L2 cache from the event payload
5887
+ if (agent.did) {
5888
+ __classPrivateFieldGet$7(this, _AgentClient_memCache, "f").set(agent.did, {
5889
+ promise: Promise.resolve(agent),
5890
+ ts: Date.now(),
5891
+ });
5892
+ __classPrivateFieldGet$7(this, _AgentClient_persistent, "f").put(agent.did, agent); // fire-and-forget
5893
+ }
5894
+ __classPrivateFieldGet$7(this, _AgentClient_updatedCallbacks, "f").forEach((cb) => cb(agent));
5699
5895
  }
5700
5896
  });
5701
5897
  __classPrivateFieldGet$7(this, _AgentClient_unsubscribers, "f").push(unsub);
@@ -5794,7 +5990,9 @@ class AgentClient {
5794
5990
  return __classPrivateFieldGet$7(this, _AgentClient_apiClient, "f").call('hosting.requestPayment', { amountHOT });
5795
5991
  }
5796
5992
  }
5797
- _AgentClient_apiClient = new WeakMap(), _AgentClient_baseUrl = new WeakMap(), _AgentClient_token = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap(), _AgentClient_hostingUserInfoChangedCallbacks = new WeakMap(), _AgentClient_computeLogUpdatedCallbacks = new WeakMap(), _AgentClient_unsubscribers = new WeakMap();
5993
+ _AgentClient_apiClient = new WeakMap(), _AgentClient_baseUrl = new WeakMap(), _AgentClient_token = new WeakMap(), _AgentClient_appsChangedCallback = new WeakMap(), _AgentClient_updatedCallbacks = new WeakMap(), _AgentClient_agentStatusChangedCallbacks = new WeakMap(), _AgentClient_hostingUserInfoChangedCallbacks = new WeakMap(), _AgentClient_computeLogUpdatedCallbacks = new WeakMap(), _AgentClient_unsubscribers = new WeakMap(), _AgentClient_memCache = new WeakMap(), _AgentClient_persistent = new WeakMap(), _AgentClient_selfDid = new WeakMap();
5994
+ /** TTL for remote (non-self) agent profiles in L1 cache (ms). */
5995
+ AgentClient.REMOTE_AGENT_TTL_MS = 5 * 60000; // 5 minutes
5798
5996
 
5799
5997
  var __classPrivateFieldSet$6 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
5800
5998
  if (kind === "m") throw new TypeError("Private method is not writable");
@@ -6223,13 +6421,22 @@ var __classPrivateFieldGet$3 = (undefined && undefined.__classPrivateFieldGet) |
6223
6421
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
6224
6422
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6225
6423
  };
6226
- var _ExpressionClient_apiClient;
6424
+ var _ExpressionClient_instances, _ExpressionClient_apiClient, _ExpressionClient_memCache, _ExpressionClient_inflight, _ExpressionClient_totalMemBytes, _ExpressionClient_persistent, _ExpressionClient_memCacheResult;
6227
6425
  class ExpressionClient {
6228
6426
  constructor(baseUrl, token, sharedApiClient) {
6427
+ _ExpressionClient_instances.add(this);
6229
6428
  _ExpressionClient_apiClient.set(this, void 0);
6429
+ // L1: in-memory LRU cache (hot path, sub-ms)
6430
+ _ExpressionClient_memCache.set(this, new Map());
6431
+ _ExpressionClient_inflight.set(this, new Map());
6432
+ _ExpressionClient_totalMemBytes.set(this, 0);
6433
+ // L2: persistent cache (IndexedDB in browser, NullCache in Node)
6434
+ _ExpressionClient_persistent.set(this, void 0);
6230
6435
  __classPrivateFieldSet$3(this, _ExpressionClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
6436
+ __classPrivateFieldSet$3(this, _ExpressionClient_persistent, createPersistentCache('ad4m-expression-cache', 'expressions'), "f");
6231
6437
  }
6232
6438
  async get(url, alwaysGet = false) {
6439
+ // Existing literal fast-path
6233
6440
  if (!alwaysGet) {
6234
6441
  try {
6235
6442
  let literalValue = Literal.fromUrl(url).get();
@@ -6241,10 +6448,85 @@ class ExpressionClient {
6241
6448
  }
6242
6449
  catch (e) { }
6243
6450
  }
6244
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.get', { url });
6451
+ // L1: memory hit
6452
+ if (!alwaysGet) {
6453
+ const memHit = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(url);
6454
+ if (memHit)
6455
+ return memHit.data;
6456
+ }
6457
+ // Deduplicate in-flight requests
6458
+ if (!alwaysGet) {
6459
+ const existing = __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").get(url);
6460
+ if (existing)
6461
+ return existing;
6462
+ }
6463
+ // L2 check + L3 network
6464
+ const promise = (async () => {
6465
+ if (!alwaysGet) {
6466
+ const persisted = await __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(url);
6467
+ if (persisted) {
6468
+ __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, persisted); // promote to L1
6469
+ return persisted;
6470
+ }
6471
+ }
6472
+ // L3: network fetch
6473
+ const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.get', { url });
6474
+ __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, result);
6475
+ __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(url, result); // fire-and-forget write to L2
6476
+ return result;
6477
+ })();
6478
+ __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").set(url, promise);
6479
+ try {
6480
+ return await promise;
6481
+ }
6482
+ finally {
6483
+ __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
6484
+ }
6245
6485
  }
6246
6486
  async getMany(urls) {
6247
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.getMany', { urls });
6487
+ // Check L1 first
6488
+ const results = urls.map(u => __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(u)?.data ?? null);
6489
+ let uncachedIndices = results
6490
+ .map((r, i) => r === null ? i : -1)
6491
+ .filter(i => i >= 0);
6492
+ if (uncachedIndices.length === 0)
6493
+ return results;
6494
+ // Check L2 for remaining misses
6495
+ const l2Results = await Promise.all(uncachedIndices.map(i => __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(urls[i])));
6496
+ const stillMissing = [];
6497
+ for (let j = 0; j < uncachedIndices.length; j++) {
6498
+ const idx = uncachedIndices[j];
6499
+ if (l2Results[j]) {
6500
+ results[idx] = l2Results[j];
6501
+ __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, urls[idx], l2Results[j]); // promote to L1
6502
+ }
6503
+ else {
6504
+ stillMissing.push(idx);
6505
+ }
6506
+ }
6507
+ if (stillMissing.length === 0)
6508
+ return results;
6509
+ // L3: fetch only truly uncached URLs
6510
+ const uncachedUrls = stillMissing.map(i => urls[i]);
6511
+ const fetched = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.getMany', { urls: uncachedUrls });
6512
+ for (let i = 0; i < stillMissing.length; i++) {
6513
+ const idx = stillMissing[i];
6514
+ results[idx] = fetched[i];
6515
+ if (fetched[i]) {
6516
+ __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, uncachedUrls[i], fetched[i]);
6517
+ __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(uncachedUrls[i], fetched[i]); // fire-and-forget
6518
+ }
6519
+ }
6520
+ return results;
6521
+ }
6522
+ /**
6523
+ * Clear both L1 (memory) and L2 (persistent) expression caches.
6524
+ */
6525
+ clearCache() {
6526
+ __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").clear();
6527
+ __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").clear();
6528
+ __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, 0, "f");
6529
+ __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").clear(); // fire-and-forget
6248
6530
  }
6249
6531
  async getRaw(url) {
6250
6532
  return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.get', { url, raw: true });
@@ -6257,10 +6539,33 @@ class ExpressionClient {
6257
6539
  return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.interactions', { url });
6258
6540
  }
6259
6541
  async interact(url, interactionCall) {
6260
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.interact', { url, interactionCall });
6542
+ const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.interact', { url, interactionCall });
6543
+ // Interactions can mutate the expression — invalidate cache so next get() fetches fresh
6544
+ __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(url);
6545
+ __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
6546
+ __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").delete(url); // fire-and-forget
6547
+ return result;
6261
6548
  }
6262
6549
  }
6263
- _ExpressionClient_apiClient = new WeakMap();
6550
+ _ExpressionClient_apiClient = new WeakMap(), _ExpressionClient_memCache = new WeakMap(), _ExpressionClient_inflight = new WeakMap(), _ExpressionClient_totalMemBytes = new WeakMap(), _ExpressionClient_persistent = new WeakMap(), _ExpressionClient_instances = new WeakSet(), _ExpressionClient_memCacheResult = function _ExpressionClient_memCacheResult(url, data) {
6551
+ const size = JSON.stringify(data).length;
6552
+ // Evict oldest entries if we'd exceed limits
6553
+ while (__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").size >= ExpressionClient.MAX_MEM_ENTRIES ||
6554
+ __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size > ExpressionClient.MAX_MEM_BYTES) {
6555
+ const oldest = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").keys().next().value;
6556
+ if (!oldest)
6557
+ break;
6558
+ const entry = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(oldest);
6559
+ __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") - entry.size, "f");
6560
+ __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(oldest);
6561
+ }
6562
+ __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").set(url, { data, size });
6563
+ __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size, "f");
6564
+ };
6565
+ /** Maximum number of entries in the L1 memory cache. */
6566
+ ExpressionClient.MAX_MEM_ENTRIES = 200;
6567
+ /** Maximum total size (in bytes) of L1 memory cache values. */
6568
+ ExpressionClient.MAX_MEM_BYTES = 5 * 1024 * 1024; // 5 MB
6264
6569
 
6265
6570
  var base64Js = {};
6266
6571
 
@@ -14638,11 +14943,6 @@ class ModelQueryBuilder {
14638
14943
  // Listen for subscription updates via the same GraphQL subscription channel.
14639
14944
  // When Rust re-runs the model query and finds changed results, it pushes them.
14640
14945
  const unsubscribe = this.perspective.client.subscribeToQueryUpdates(subscriptionId, (rawResult) => {
14641
- // Skip delayed #init# messages — initial data was already returned
14642
- // synchronously from modelSubscribe(). Late init messages contain stale
14643
- // data that would overwrite real subscription updates.
14644
- if (rawResult && rawResult.isInit)
14645
- return;
14646
14946
  try {
14647
14947
  const results = parseResults(rawResult);
14648
14948
  const fp = buildFingerprint(results);
@@ -14749,8 +15049,6 @@ class ModelQueryBuilder {
14749
15049
  };
14750
15050
  const initialCount = parseCount(initialModelResult);
14751
15051
  const unsubscribe = this.perspective.client.subscribeToQueryUpdates(subscriptionId, (rawResult) => {
14752
- if (rawResult && rawResult.isInit)
14753
- return;
14754
15052
  try {
14755
15053
  callback(parseCount(rawResult));
14756
15054
  }
@@ -14864,8 +15162,6 @@ class ModelQueryBuilder {
14864
15162
  callback({ results, totalCount, pageSize, pageNumber });
14865
15163
  };
14866
15164
  const unsubscribe = this.perspective.client.subscribeToQueryUpdates(subscriptionId, (rawResult) => {
14867
- if (rawResult && rawResult.isInit)
14868
- return;
14869
15165
  processResults().catch(e => console.error('Paginate subscription error:', e));
14870
15166
  });
14871
15167
  let keepaliveFailures = 0;
@@ -15671,7 +15967,11 @@ class Ad4mModel {
15671
15967
  const allRelMeta = getRelationsMetadata(this);
15672
15968
  enrichShapeForIncludes(metadata, query.include, allRelMeta);
15673
15969
  }
15674
- // Pre-compute conformance getters (with where-clause support)
15970
+ // Pre-compute conformance getters for Rust-side evaluation.
15971
+ // Where clauses are NOT compiled into getter SPARQL because stored
15972
+ // property values are signed expression envelopes (literal:json:...),
15973
+ // not simple literal:string:X values. Instead, where clauses are
15974
+ // attached as metadata for Rust-side post-evaluation filtering.
15675
15975
  {
15676
15976
  const allRelMeta = getRelationsMetadata(this);
15677
15977
  for (const [relName, relMeta] of Object.entries(metadata.relations)) {
@@ -15684,43 +15984,31 @@ class Ad4mModel {
15684
15984
  try {
15685
15985
  const TargetClass = meta.target();
15686
15986
  const filter = buildConformanceFilter(meta.predicate, TargetClass);
15687
- // Compile where clauses to SPARQL when all target properties use
15688
- // literal encoding (literal:string:X etc.) which is SPARQL-matchable.
15689
- // Properties with a non-literal resolveLanguage store expression hashes
15690
- // that can't be matched by value in SPARQL.
15691
- let whereConditions = [];
15987
+ if (filter) {
15988
+ rel.getter = filter.getter;
15989
+ }
15990
+ // Attach where-clause metadata for Rust-side post-getter filtering
15692
15991
  if (rel.where) {
15693
15992
  try {
15694
15993
  const targetMetadata = TargetClass.getModelMetadata?.() ?? null;
15695
- let allSparqlFilterable = true;
15696
15994
  if (targetMetadata) {
15995
+ const predicates = {};
15697
15996
  for (const propName of Object.keys(rel.where)) {
15698
15997
  if (['id', 'author', 'timestamp'].includes(propName))
15699
15998
  continue;
15700
15999
  const propMeta = targetMetadata.properties[propName];
15701
- if (propMeta?.resolveLanguage && propMeta.resolveLanguage !== 'literal') {
15702
- allSparqlFilterable = false;
15703
- break;
16000
+ if (propMeta?.predicate) {
16001
+ predicates[propName] = propMeta.predicate;
15704
16002
  }
15705
16003
  }
15706
- }
15707
- if (allSparqlFilterable) {
15708
- whereConditions = compileWhereClause(rel.where, targetMetadata);
16004
+ if (Object.keys(predicates).length > 0) {
16005
+ rel.whereFilter = rel.where;
16006
+ rel.wherePredicates = predicates;
16007
+ }
15709
16008
  }
15710
16009
  }
15711
16010
  catch (_) { }
15712
16011
  }
15713
- if (filter) {
15714
- let getter = filter.getter;
15715
- if (whereConditions.length > 0) {
15716
- getter = getter.replace(/ \}$/, ` ${whereConditions.join(' ')} }`);
15717
- }
15718
- rel.getter = getter;
15719
- }
15720
- else if (whereConditions.length > 0) {
15721
- const escapedPred = meta.predicate.replace(/[<>"{}|\\^`\u0000-\u0020]/g, '');
15722
- rel.getter = `SELECT ?target WHERE { <Base> <${escapedPred}> ?target . ${whereConditions.join(' ')} }`;
15723
- }
15724
16012
  }
15725
16013
  catch (_) { }
15726
16014
  }
@@ -15853,45 +16141,33 @@ class Ad4mModel {
15853
16141
  try {
15854
16142
  const TargetClass = meta.target();
15855
16143
  const filter = buildConformanceFilter(meta.predicate, TargetClass);
15856
- // Compile where clauses to SPARQL when all target properties use
15857
- // literal encoding (literal:string:X etc.) which is SPARQL-matchable.
15858
- // Properties with a non-literal resolveLanguage store expression hashes
15859
- // that can't be matched by value in SPARQL.
15860
- let whereConditions = [];
16144
+ if (filter) {
16145
+ rel.getter = filter.getter;
16146
+ }
16147
+ // Attach where-clause metadata for Rust-side post-getter filtering.
16148
+ // Property values are signed expression envelopes (literal:json:...)
16149
+ // and cannot be matched by SPARQL FILTER on the raw IRI.
15861
16150
  if (rel.where) {
15862
16151
  try {
15863
16152
  const targetMetadata = TargetClass.getModelMetadata?.() ?? null;
15864
- let allSparqlFilterable = true;
15865
16153
  if (targetMetadata) {
16154
+ const predicates = {};
15866
16155
  for (const propName of Object.keys(rel.where)) {
15867
16156
  if (['id', 'author', 'timestamp'].includes(propName))
15868
16157
  continue;
15869
16158
  const propMeta = targetMetadata.properties[propName];
15870
- if (propMeta?.resolveLanguage && propMeta.resolveLanguage !== 'literal') {
15871
- allSparqlFilterable = false;
15872
- break;
16159
+ if (propMeta?.predicate) {
16160
+ predicates[propName] = propMeta.predicate;
15873
16161
  }
15874
16162
  }
15875
- }
15876
- if (allSparqlFilterable) {
15877
- whereConditions = compileWhereClause(rel.where, targetMetadata);
16163
+ if (Object.keys(predicates).length > 0) {
16164
+ rel.whereFilter = rel.where;
16165
+ rel.wherePredicates = predicates;
16166
+ }
15878
16167
  }
15879
16168
  }
15880
16169
  catch (_) { /* target metadata unavailable */ }
15881
16170
  }
15882
- if (filter) {
15883
- let getter = filter.getter;
15884
- if (whereConditions.length > 0) {
15885
- // Append where conditions before the closing }
15886
- getter = getter.replace(/ \}$/, ` ${whereConditions.join(' ')} }`);
15887
- }
15888
- rel.getter = getter;
15889
- }
15890
- else if (whereConditions.length > 0) {
15891
- // No conformance filter but where clause exists — build getter from where alone
15892
- const escapedPred = meta.predicate.replace(/[<>"{}|\\^`\u0000-\u0020]/g, '');
15893
- rel.getter = `SELECT ?target WHERE { <Base> <${escapedPred}> ?target . ${whereConditions.join(' ')} }`;
15894
- }
15895
16171
  }
15896
16172
  catch (e) {
15897
16173
  // Target class may not be available; skip silently
@@ -15903,13 +16179,6 @@ class Ad4mModel {
15903
16179
  // the TS decorators are the definitive source of truth.
15904
16180
  const shapeJson = JSON.stringify(metadata);
15905
16181
  const queryJson = JSON.stringify(queryInput);
15906
- // TEMP DEBUG: Log getters with where-clause filters to diagnose CI failure
15907
- for (const [relName, relMeta] of Object.entries(metadata.relations)) {
15908
- const rel = relMeta;
15909
- if (rel.where) {
15910
- console.log(`[MODEL_QUERY_DEBUG] relation="${relName}" getter=${rel.getter ?? 'NONE'} where=${JSON.stringify(rel.where)}`);
15911
- }
15912
- }
15913
16182
  const result = await perspective.modelQuery(className, queryJson, shapeJson);
15914
16183
  // Convert JSON instances to model class instances, recursively constructing
15915
16184
  // class instances for any included relations resolved by Rust.
@@ -17014,8 +17283,9 @@ class Ad4mClient {
17014
17283
  __classPrivateFieldGet$1(this, _Ad4mClient_agentClient, "f").subscribeAgentStatusChanged();
17015
17284
  __classPrivateFieldGet$1(this, _Ad4mClient_agentClient, "f").subscribeAppsChanged();
17016
17285
  }
17017
- /** Close all event connections */
17286
+ /** Close all event connections and clear in-memory caches */
17018
17287
  close() {
17288
+ __classPrivateFieldGet$1(this, _Ad4mClient_agentClient, "f").clearByDidCache();
17019
17289
  __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f").closeAll();
17020
17290
  }
17021
17291
  }
@@ -17526,6 +17796,7 @@ exports.Flag = Flag;
17526
17796
  exports.HasMany = HasMany;
17527
17797
  exports.HasOne = HasOne;
17528
17798
  exports.HostingUserInfo = HostingUserInfo;
17799
+ exports.IDBCache = IDBCache;
17529
17800
  exports.Icon = Icon;
17530
17801
  exports.ImportResult = ImportResult;
17531
17802
  exports.ImportStats = ImportStats;
@@ -17560,6 +17831,7 @@ exports.NeighbourhoodExpression = NeighbourhoodExpression;
17560
17831
  exports.NeighbourhoodProxy = NeighbourhoodProxy;
17561
17832
  exports.Notification = Notification;
17562
17833
  exports.NotificationInput = NotificationInput;
17834
+ exports.NullCache = NullCache;
17563
17835
  exports.OnlineAgent = OnlineAgent;
17564
17836
  exports.Optional = Optional;
17565
17837
  exports.PaymentRequestResult = PaymentRequestResult;
@@ -17603,6 +17875,7 @@ exports.buildWhereCondition = buildWhereCondition;
17603
17875
  exports.capSentence = capSentence;
17604
17876
  exports.clearQueryCache = clearQueryCache;
17605
17877
  exports.compileWhereClause = compileWhereClause;
17878
+ exports.createPersistentCache = createPersistentCache;
17606
17879
  exports.determineNamespace = determineNamespace;
17607
17880
  exports.determinePredicate = determinePredicate;
17608
17881
  exports.escapeQueryString = escapeQueryString;