@coasys/ad4m-connect 0.13.0-test-6 → 0.13.0-test-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +608 -348
- package/dist/core.js.map +3 -3
- package/dist/index.js +608 -348
- package/dist/index.js.map +3 -3
- package/dist/web.js +2729 -170
- package/dist/web.js.map +3 -3
- package/package.json +2 -2
package/dist/core.js
CHANGED
|
@@ -389,7 +389,7 @@ var AgentStatus = class {
|
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
};
|
|
392
|
-
var __classPrivateFieldSet$
|
|
392
|
+
var __classPrivateFieldSet$c = function(receiver, state, value, kind, f) {
|
|
393
393
|
if (kind === "m")
|
|
394
394
|
throw new TypeError("Private method is not writable");
|
|
395
395
|
if (kind === "a" && !f)
|
|
@@ -398,7 +398,7 @@ var __classPrivateFieldSet$b = function(receiver, state, value, kind, f) {
|
|
|
398
398
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
399
399
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
400
400
|
};
|
|
401
|
-
var __classPrivateFieldGet$
|
|
401
|
+
var __classPrivateFieldGet$c = function(receiver, state, kind, f) {
|
|
402
402
|
if (kind === "a" && !f)
|
|
403
403
|
throw new TypeError("Private accessor was defined without a getter");
|
|
404
404
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -411,41 +411,41 @@ var NeighbourhoodProxy = class {
|
|
|
411
411
|
constructor(client, pID) {
|
|
412
412
|
_NeighbourhoodProxy_client.set(this, void 0);
|
|
413
413
|
_NeighbourhoodProxy_pID.set(this, void 0);
|
|
414
|
-
__classPrivateFieldSet$
|
|
415
|
-
__classPrivateFieldSet$
|
|
414
|
+
__classPrivateFieldSet$c(this, _NeighbourhoodProxy_client, client, "f");
|
|
415
|
+
__classPrivateFieldSet$c(this, _NeighbourhoodProxy_pID, pID, "f");
|
|
416
416
|
}
|
|
417
417
|
async otherAgents() {
|
|
418
|
-
return await __classPrivateFieldGet$
|
|
418
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"));
|
|
419
419
|
}
|
|
420
420
|
async hasTelepresenceAdapter() {
|
|
421
|
-
return await __classPrivateFieldGet$
|
|
421
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"));
|
|
422
422
|
}
|
|
423
423
|
async onlineAgents() {
|
|
424
|
-
return await __classPrivateFieldGet$
|
|
424
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"));
|
|
425
425
|
}
|
|
426
426
|
async setOnlineStatus(status) {
|
|
427
|
-
return await __classPrivateFieldGet$
|
|
427
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), status);
|
|
428
428
|
}
|
|
429
429
|
async setOnlineStatusU(status) {
|
|
430
|
-
return await __classPrivateFieldGet$
|
|
430
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), status);
|
|
431
431
|
}
|
|
432
432
|
async sendSignal(remoteAgentDid, payload) {
|
|
433
|
-
return await __classPrivateFieldGet$
|
|
433
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
|
|
434
434
|
}
|
|
435
435
|
async sendSignalU(remoteAgentDid, payload) {
|
|
436
|
-
return await __classPrivateFieldGet$
|
|
436
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
|
|
437
437
|
}
|
|
438
438
|
async sendBroadcast(payload, loopback = false) {
|
|
439
|
-
return await __classPrivateFieldGet$
|
|
439
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
|
|
440
440
|
}
|
|
441
441
|
async sendBroadcastU(payload, loopback = false) {
|
|
442
|
-
return await __classPrivateFieldGet$
|
|
442
|
+
return await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
|
|
443
443
|
}
|
|
444
444
|
async addSignalHandler(handler) {
|
|
445
|
-
await __classPrivateFieldGet$
|
|
445
|
+
await __classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), handler);
|
|
446
446
|
}
|
|
447
447
|
removeSignalHandler(handler) {
|
|
448
|
-
__classPrivateFieldGet$
|
|
448
|
+
__classPrivateFieldGet$c(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$c(this, _NeighbourhoodProxy_pID, "f"), handler);
|
|
449
449
|
}
|
|
450
450
|
};
|
|
451
451
|
_NeighbourhoodProxy_client = /* @__PURE__ */ new WeakMap(), _NeighbourhoodProxy_pID = /* @__PURE__ */ new WeakMap();
|
|
@@ -503,7 +503,7 @@ var LinkQuery = class {
|
|
|
503
503
|
return true;
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
|
-
var __classPrivateFieldSet$
|
|
506
|
+
var __classPrivateFieldSet$b = function(receiver, state, value, kind, f) {
|
|
507
507
|
if (kind === "m")
|
|
508
508
|
throw new TypeError("Private method is not writable");
|
|
509
509
|
if (kind === "a" && !f)
|
|
@@ -512,7 +512,7 @@ var __classPrivateFieldSet$a = function(receiver, state, value, kind, f) {
|
|
|
512
512
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
513
513
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
514
514
|
};
|
|
515
|
-
var __classPrivateFieldGet$
|
|
515
|
+
var __classPrivateFieldGet$b = function(receiver, state, kind, f) {
|
|
516
516
|
if (kind === "a" && !f)
|
|
517
517
|
throw new TypeError("Private accessor was defined without a getter");
|
|
518
518
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -535,44 +535,44 @@ var Literal = class {
|
|
|
535
535
|
if (url.startsWith("literal://"))
|
|
536
536
|
throw new Error("literal:// format is no longer supported. Use literal: instead.");
|
|
537
537
|
const l = new Literal();
|
|
538
|
-
__classPrivateFieldSet$
|
|
538
|
+
__classPrivateFieldSet$b(l, _Literal_url, url, "f");
|
|
539
539
|
return l;
|
|
540
540
|
}
|
|
541
541
|
static from(literal) {
|
|
542
542
|
const l = new Literal();
|
|
543
|
-
__classPrivateFieldSet$
|
|
543
|
+
__classPrivateFieldSet$b(l, _Literal_literal, literal, "f");
|
|
544
544
|
return l;
|
|
545
545
|
}
|
|
546
546
|
toUrl() {
|
|
547
|
-
if (__classPrivateFieldGet$
|
|
548
|
-
return __classPrivateFieldGet$
|
|
549
|
-
if (!__classPrivateFieldGet$
|
|
547
|
+
if (__classPrivateFieldGet$b(this, _Literal_url, "f") && !__classPrivateFieldGet$b(this, _Literal_literal, "f"))
|
|
548
|
+
return __classPrivateFieldGet$b(this, _Literal_url, "f");
|
|
549
|
+
if (!__classPrivateFieldGet$b(this, _Literal_url, "f") && (__classPrivateFieldGet$b(this, _Literal_literal, "f") === void 0 || __classPrivateFieldGet$b(this, _Literal_literal, "f") === "" || __classPrivateFieldGet$b(this, _Literal_literal, "f") === null))
|
|
550
550
|
throw new Error("Can't turn empty Literal into URL");
|
|
551
551
|
let encoded;
|
|
552
|
-
switch (typeof __classPrivateFieldGet$
|
|
552
|
+
switch (typeof __classPrivateFieldGet$b(this, _Literal_literal, "f")) {
|
|
553
553
|
case "string":
|
|
554
|
-
encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$
|
|
554
|
+
encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$b(this, _Literal_literal, "f"))}`;
|
|
555
555
|
break;
|
|
556
556
|
case "number":
|
|
557
|
-
encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$
|
|
557
|
+
encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$b(this, _Literal_literal, "f"))}`;
|
|
558
558
|
break;
|
|
559
559
|
case "boolean":
|
|
560
|
-
encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$
|
|
560
|
+
encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$b(this, _Literal_literal, "f"))}`;
|
|
561
561
|
break;
|
|
562
562
|
case "object":
|
|
563
|
-
encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$
|
|
563
|
+
encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$b(this, _Literal_literal, "f")))}`;
|
|
564
564
|
break;
|
|
565
565
|
}
|
|
566
566
|
return `literal:${encoded}`;
|
|
567
567
|
}
|
|
568
568
|
get() {
|
|
569
|
-
if (__classPrivateFieldGet$
|
|
570
|
-
return __classPrivateFieldGet$
|
|
571
|
-
if (!__classPrivateFieldGet$
|
|
569
|
+
if (__classPrivateFieldGet$b(this, _Literal_literal, "f"))
|
|
570
|
+
return __classPrivateFieldGet$b(this, _Literal_literal, "f");
|
|
571
|
+
if (!__classPrivateFieldGet$b(this, _Literal_url, "f"))
|
|
572
572
|
throw new Error("Can't render empty Literal");
|
|
573
|
-
if (!__classPrivateFieldGet$
|
|
573
|
+
if (!__classPrivateFieldGet$b(this, _Literal_url, "f").startsWith("literal:"))
|
|
574
574
|
throw new Error("Can't render Literal from non-literal URL");
|
|
575
|
-
const body = __classPrivateFieldGet$
|
|
575
|
+
const body = __classPrivateFieldGet$b(this, _Literal_url, "f").substring(8);
|
|
576
576
|
if (body.startsWith("string:")) {
|
|
577
577
|
return decodeURIComponent(body.substring(7));
|
|
578
578
|
}
|
|
@@ -1949,7 +1949,7 @@ var SHACLFlow = class {
|
|
|
1949
1949
|
return flow;
|
|
1950
1950
|
}
|
|
1951
1951
|
};
|
|
1952
|
-
var __classPrivateFieldSet$
|
|
1952
|
+
var __classPrivateFieldSet$a = function(receiver, state, value, kind, f) {
|
|
1953
1953
|
if (kind === "m")
|
|
1954
1954
|
throw new TypeError("Private method is not writable");
|
|
1955
1955
|
if (kind === "a" && !f)
|
|
@@ -1958,7 +1958,7 @@ var __classPrivateFieldSet$9 = function(receiver, state, value, kind, f) {
|
|
|
1958
1958
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1959
1959
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1960
1960
|
};
|
|
1961
|
-
var __classPrivateFieldGet$
|
|
1961
|
+
var __classPrivateFieldGet$a = function(receiver, state, kind, f) {
|
|
1962
1962
|
if (kind === "a" && !f)
|
|
1963
1963
|
throw new TypeError("Private accessor was defined without a getter");
|
|
1964
1964
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -2015,82 +2015,80 @@ var QuerySubscriptionProxy = class {
|
|
|
2015
2015
|
_QuerySubscriptionProxy_initReject.set(this, void 0);
|
|
2016
2016
|
_QuerySubscriptionProxy_initTimeoutId.set(this, void 0);
|
|
2017
2017
|
_QuerySubscriptionProxy_query.set(this, void 0);
|
|
2018
|
-
__classPrivateFieldSet$
|
|
2019
|
-
__classPrivateFieldSet$
|
|
2020
|
-
__classPrivateFieldSet$
|
|
2021
|
-
__classPrivateFieldSet$
|
|
2022
|
-
__classPrivateFieldSet$
|
|
2023
|
-
__classPrivateFieldSet$
|
|
2024
|
-
__classPrivateFieldSet$
|
|
2025
|
-
__classPrivateFieldSet$
|
|
2018
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_uuid, uuid, "f");
|
|
2019
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_query, query, "f");
|
|
2020
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_client, client, "f");
|
|
2021
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_callbacks, /* @__PURE__ */ new Set(), "f");
|
|
2022
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_latestResult, null, "f");
|
|
2023
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
|
|
2024
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
|
|
2025
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, reject, "f");
|
|
2026
2026
|
}), "f");
|
|
2027
2027
|
}
|
|
2028
2028
|
async subscribe() {
|
|
2029
|
-
if (__classPrivateFieldGet$
|
|
2030
|
-
__classPrivateFieldGet$
|
|
2031
|
-
__classPrivateFieldSet$
|
|
2029
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
|
|
2030
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
|
|
2031
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_unsubscribe, void 0, "f");
|
|
2032
2032
|
}
|
|
2033
|
-
if (__classPrivateFieldGet$
|
|
2034
|
-
clearTimeout(__classPrivateFieldGet$
|
|
2035
|
-
__classPrivateFieldSet$
|
|
2033
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
|
|
2034
|
+
clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
|
|
2035
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, void 0, "f");
|
|
2036
2036
|
}
|
|
2037
|
-
if (__classPrivateFieldGet$
|
|
2038
|
-
clearTimeout(__classPrivateFieldGet$
|
|
2039
|
-
__classPrivateFieldSet$
|
|
2037
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_keepaliveTimer, "f")) {
|
|
2038
|
+
clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
|
|
2039
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_keepaliveTimer, void 0, "f");
|
|
2040
2040
|
}
|
|
2041
2041
|
try {
|
|
2042
2042
|
let initialResult;
|
|
2043
|
-
initialResult = await __classPrivateFieldGet$
|
|
2044
|
-
__classPrivateFieldSet$
|
|
2043
|
+
initialResult = await __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").subscribeQuery(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_query, "f"));
|
|
2044
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_subscriptionId, initialResult.subscriptionId, "f");
|
|
2045
2045
|
if (initialResult.result !== void 0) {
|
|
2046
|
-
__classPrivateFieldSet$
|
|
2047
|
-
__classPrivateFieldGet$
|
|
2048
|
-
if (__classPrivateFieldGet$
|
|
2049
|
-
__classPrivateFieldGet$
|
|
2050
|
-
__classPrivateFieldSet$
|
|
2051
|
-
__classPrivateFieldSet$
|
|
2046
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_latestResult, initialResult.result, "f");
|
|
2047
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, initialResult.result);
|
|
2048
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f")) {
|
|
2049
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f").call(this, true);
|
|
2050
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, void 0, "f");
|
|
2051
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, void 0, "f");
|
|
2052
2052
|
}
|
|
2053
2053
|
} else {
|
|
2054
2054
|
console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!");
|
|
2055
|
-
__classPrivateFieldSet$
|
|
2055
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, setTimeout(() => {
|
|
2056
2056
|
console.error("Subscription initialization timed out after 30 seconds. Resubscribing...");
|
|
2057
2057
|
this.subscribe().catch((error) => {
|
|
2058
2058
|
console.error("Error during subscription retry after timeout:", error);
|
|
2059
2059
|
});
|
|
2060
2060
|
}, 3e4), "f");
|
|
2061
2061
|
}
|
|
2062
|
-
__classPrivateFieldSet$
|
|
2063
|
-
if (__classPrivateFieldGet$
|
|
2064
|
-
clearTimeout(__classPrivateFieldGet$
|
|
2065
|
-
__classPrivateFieldSet$
|
|
2062
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_unsubscribe, __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").subscribeToQueryUpdates(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f"), (updateResult) => {
|
|
2063
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
|
|
2064
|
+
clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
|
|
2065
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, void 0, "f");
|
|
2066
2066
|
}
|
|
2067
|
-
if (__classPrivateFieldGet$
|
|
2068
|
-
__classPrivateFieldGet$
|
|
2069
|
-
__classPrivateFieldSet$
|
|
2070
|
-
__classPrivateFieldSet$
|
|
2067
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f")) {
|
|
2068
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initResolve, "f").call(this, true);
|
|
2069
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, void 0, "f");
|
|
2070
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, void 0, "f");
|
|
2071
2071
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
__classPrivateFieldSet$9(this, _QuerySubscriptionProxy_latestResult, updateResult, "f");
|
|
2075
|
-
__classPrivateFieldGet$9(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, updateResult);
|
|
2072
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_latestResult, updateResult, "f");
|
|
2073
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_notifyCallbacks).call(this, updateResult);
|
|
2076
2074
|
}), "f");
|
|
2077
2075
|
} catch (error) {
|
|
2078
2076
|
console.error("Error setting up subscription:", error);
|
|
2079
|
-
if (__classPrivateFieldGet$
|
|
2080
|
-
__classPrivateFieldGet$
|
|
2081
|
-
__classPrivateFieldSet$
|
|
2082
|
-
__classPrivateFieldSet$
|
|
2077
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initReject, "f")) {
|
|
2078
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initReject, "f").call(this, error);
|
|
2079
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initResolve, void 0, "f");
|
|
2080
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initReject, void 0, "f");
|
|
2083
2081
|
}
|
|
2084
2082
|
throw error;
|
|
2085
2083
|
}
|
|
2086
2084
|
const keepaliveLoop = async () => {
|
|
2087
|
-
if (__classPrivateFieldGet$
|
|
2085
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_disposed, "f"))
|
|
2088
2086
|
return;
|
|
2089
2087
|
try {
|
|
2090
|
-
await __classPrivateFieldGet$
|
|
2088
|
+
await __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").keepAliveQuery(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f"));
|
|
2091
2089
|
} catch (e) {
|
|
2092
2090
|
console.error("Error in keepalive:", e);
|
|
2093
|
-
console.log("Reinitializing subscription for query:", __classPrivateFieldGet$
|
|
2091
|
+
console.log("Reinitializing subscription for query:", __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_query, "f"));
|
|
2094
2092
|
try {
|
|
2095
2093
|
await this.subscribe();
|
|
2096
2094
|
console.log("Subscription reinitialized");
|
|
@@ -2099,43 +2097,43 @@ var QuerySubscriptionProxy = class {
|
|
|
2099
2097
|
return;
|
|
2100
2098
|
}
|
|
2101
2099
|
}
|
|
2102
|
-
if (!__classPrivateFieldGet$
|
|
2103
|
-
__classPrivateFieldSet$
|
|
2100
|
+
if (!__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_disposed, "f")) {
|
|
2101
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 3e4), "f");
|
|
2104
2102
|
}
|
|
2105
2103
|
};
|
|
2106
|
-
__classPrivateFieldSet$
|
|
2104
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_keepaliveTimer, setTimeout(keepaliveLoop, 3e4), "f");
|
|
2107
2105
|
}
|
|
2108
2106
|
get id() {
|
|
2109
|
-
return __classPrivateFieldGet$
|
|
2107
|
+
return __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f");
|
|
2110
2108
|
}
|
|
2111
2109
|
get initialized() {
|
|
2112
|
-
return __classPrivateFieldGet$
|
|
2110
|
+
return __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initialized, "f");
|
|
2113
2111
|
}
|
|
2114
2112
|
get result() {
|
|
2115
|
-
return __classPrivateFieldGet$
|
|
2113
|
+
return __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_latestResult, "f");
|
|
2116
2114
|
}
|
|
2117
2115
|
onResult(callback) {
|
|
2118
|
-
__classPrivateFieldGet$
|
|
2119
|
-
return () => __classPrivateFieldGet$
|
|
2116
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
|
|
2117
|
+
return () => __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
|
|
2120
2118
|
}
|
|
2121
2119
|
dispose() {
|
|
2122
|
-
__classPrivateFieldSet$
|
|
2123
|
-
clearTimeout(__classPrivateFieldGet$
|
|
2124
|
-
if (__classPrivateFieldGet$
|
|
2125
|
-
__classPrivateFieldGet$
|
|
2120
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_disposed, true, "f");
|
|
2121
|
+
clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_keepaliveTimer, "f"));
|
|
2122
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f")) {
|
|
2123
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_unsubscribe, "f").call(this);
|
|
2126
2124
|
}
|
|
2127
|
-
__classPrivateFieldGet$
|
|
2128
|
-
if (__classPrivateFieldGet$
|
|
2129
|
-
clearTimeout(__classPrivateFieldGet$
|
|
2130
|
-
__classPrivateFieldSet$
|
|
2125
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f").clear();
|
|
2126
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f")) {
|
|
2127
|
+
clearTimeout(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_initTimeoutId, "f"));
|
|
2128
|
+
__classPrivateFieldSet$a(this, _QuerySubscriptionProxy_initTimeoutId, void 0, "f");
|
|
2131
2129
|
}
|
|
2132
|
-
if (__classPrivateFieldGet$
|
|
2133
|
-
__classPrivateFieldGet$
|
|
2130
|
+
if (__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f")) {
|
|
2131
|
+
__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_client, "f").disposeQuerySubscription(__classPrivateFieldGet$a(this, _QuerySubscriptionProxy_uuid, "f"), __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_subscriptionId, "f")).catch((e) => console.error("Error disposing query subscription:", e));
|
|
2134
2132
|
}
|
|
2135
2133
|
}
|
|
2136
2134
|
};
|
|
2137
2135
|
_QuerySubscriptionProxy_uuid = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_subscriptionId = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_client = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_callbacks = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_keepaliveTimer = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_unsubscribe = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_latestResult = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_disposed = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_initialized = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_initResolve = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_initReject = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_initTimeoutId = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_query = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_instances = /* @__PURE__ */ new WeakSet(), _QuerySubscriptionProxy_notifyCallbacks = function _QuerySubscriptionProxy_notifyCallbacks2(result) {
|
|
2138
|
-
for (const callback of __classPrivateFieldGet$
|
|
2136
|
+
for (const callback of __classPrivateFieldGet$a(this, _QuerySubscriptionProxy_callbacks, "f")) {
|
|
2139
2137
|
try {
|
|
2140
2138
|
callback(result);
|
|
2141
2139
|
} catch (e) {
|
|
@@ -2145,7 +2143,7 @@ _QuerySubscriptionProxy_uuid = /* @__PURE__ */ new WeakMap(), _QuerySubscription
|
|
|
2145
2143
|
};
|
|
2146
2144
|
var PerspectiveProxy = class {
|
|
2147
2145
|
get client() {
|
|
2148
|
-
return __classPrivateFieldGet$
|
|
2146
|
+
return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f");
|
|
2149
2147
|
}
|
|
2150
2148
|
constructor(handle, ad4m) {
|
|
2151
2149
|
_PerspectiveProxy_handle.set(this, void 0);
|
|
@@ -2158,28 +2156,28 @@ var PerspectiveProxy = class {
|
|
|
2158
2156
|
this,
|
|
2159
2157
|
/* @__PURE__ */ new Set()
|
|
2160
2158
|
);
|
|
2161
|
-
__classPrivateFieldSet$
|
|
2162
|
-
__classPrivateFieldSet$
|
|
2163
|
-
__classPrivateFieldSet$
|
|
2164
|
-
__classPrivateFieldSet$
|
|
2165
|
-
__classPrivateFieldSet$
|
|
2166
|
-
__classPrivateFieldSet$
|
|
2167
|
-
this.uuid = __classPrivateFieldGet$
|
|
2168
|
-
this.name = __classPrivateFieldGet$
|
|
2169
|
-
this.owners = __classPrivateFieldGet$
|
|
2170
|
-
this.sharedUrl = __classPrivateFieldGet$
|
|
2171
|
-
this.neighbourhood = __classPrivateFieldGet$
|
|
2172
|
-
this.state = __classPrivateFieldGet$
|
|
2173
|
-
__classPrivateFieldGet$
|
|
2174
|
-
__classPrivateFieldGet$
|
|
2175
|
-
__classPrivateFieldGet$
|
|
2176
|
-
__classPrivateFieldGet$
|
|
2159
|
+
__classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, [], "f");
|
|
2160
|
+
__classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, [], "f");
|
|
2161
|
+
__classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, [], "f");
|
|
2162
|
+
__classPrivateFieldSet$a(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, [], "f");
|
|
2163
|
+
__classPrivateFieldSet$a(this, _PerspectiveProxy_handle, handle, "f");
|
|
2164
|
+
__classPrivateFieldSet$a(this, _PerspectiveProxy_client, ad4m, "f");
|
|
2165
|
+
this.uuid = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid;
|
|
2166
|
+
this.name = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").name;
|
|
2167
|
+
this.owners = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").owners;
|
|
2168
|
+
this.sharedUrl = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").sharedUrl;
|
|
2169
|
+
this.neighbourhood = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").neighbourhood;
|
|
2170
|
+
this.state = __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").state;
|
|
2171
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveLinkAddedListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f"));
|
|
2172
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveLinkRemovedListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f"));
|
|
2173
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveLinkUpdatedListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f"));
|
|
2174
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addPerspectiveSyncStateChangeListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f"));
|
|
2177
2175
|
}
|
|
2178
2176
|
updateHandle(handle) {
|
|
2179
|
-
if (handle.uuid !== __classPrivateFieldGet$
|
|
2180
|
-
throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch \u2014 proxy is bound to "${__classPrivateFieldGet$
|
|
2177
|
+
if (handle.uuid !== __classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid) {
|
|
2178
|
+
throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch \u2014 proxy is bound to "${__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid}" but received handle with UUID "${handle.uuid}". This would silently diverge from listeners registered under the original UUID.`);
|
|
2181
2179
|
}
|
|
2182
|
-
__classPrivateFieldSet$
|
|
2180
|
+
__classPrivateFieldSet$a(this, _PerspectiveProxy_handle, handle, "f");
|
|
2183
2181
|
this.uuid = handle.uuid;
|
|
2184
2182
|
this.name = handle.name;
|
|
2185
2183
|
this.owners = handle.owners;
|
|
@@ -2191,106 +2189,106 @@ var PerspectiveProxy = class {
|
|
|
2191
2189
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2192
2190
|
}
|
|
2193
2191
|
async executeAction(actions, expression, parameters, batchId) {
|
|
2194
|
-
const result = await __classPrivateFieldGet$
|
|
2195
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2192
|
+
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);
|
|
2193
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2196
2194
|
return result;
|
|
2197
2195
|
}
|
|
2198
2196
|
async get(query) {
|
|
2199
|
-
return await __classPrivateFieldGet$
|
|
2197
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
|
|
2200
2198
|
}
|
|
2201
2199
|
async infer(query) {
|
|
2202
|
-
return await __classPrivateFieldGet$
|
|
2200
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
|
|
2203
2201
|
}
|
|
2204
2202
|
async querySparql(query) {
|
|
2205
|
-
const cached = getCachedResult(__classPrivateFieldGet$
|
|
2203
|
+
const cached = getCachedResult(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
|
|
2206
2204
|
if (cached !== void 0)
|
|
2207
2205
|
return cached;
|
|
2208
|
-
const result = await __classPrivateFieldGet$
|
|
2209
|
-
setCachedResult(__classPrivateFieldGet$
|
|
2206
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
|
|
2207
|
+
setCachedResult(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query, result);
|
|
2210
2208
|
return result;
|
|
2211
2209
|
}
|
|
2212
2210
|
async modelQuery(className, queryJson, shapeJson) {
|
|
2213
|
-
return await __classPrivateFieldGet$
|
|
2211
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, shapeJson);
|
|
2214
2212
|
}
|
|
2215
2213
|
async evaluateGetters(className, instanceIds, shapeJson, propertyNames) {
|
|
2216
|
-
return await __classPrivateFieldGet$
|
|
2214
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, shapeJson, propertyNames);
|
|
2217
2215
|
}
|
|
2218
2216
|
async modelSubscribe(className, queryJson, shapeJson) {
|
|
2219
|
-
return await __classPrivateFieldGet$
|
|
2217
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, shapeJson);
|
|
2220
2218
|
}
|
|
2221
2219
|
async add(link, status = "shared", batchId) {
|
|
2222
|
-
const result = await __classPrivateFieldGet$
|
|
2223
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2220
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
|
|
2221
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2224
2222
|
return result;
|
|
2225
2223
|
}
|
|
2226
2224
|
async addLinks(links, status = "shared", batchId) {
|
|
2227
|
-
const result = await __classPrivateFieldGet$
|
|
2228
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2225
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
|
|
2226
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2229
2227
|
return result;
|
|
2230
2228
|
}
|
|
2231
2229
|
async removeLinks(links, batchId) {
|
|
2232
|
-
const result = await __classPrivateFieldGet$
|
|
2233
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2230
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
|
|
2231
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2234
2232
|
return result;
|
|
2235
2233
|
}
|
|
2236
2234
|
async linkMutations(mutations, status = "shared") {
|
|
2237
|
-
const result = await __classPrivateFieldGet$
|
|
2238
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2235
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
|
|
2236
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2239
2237
|
return result;
|
|
2240
2238
|
}
|
|
2241
2239
|
async addLinkExpression(link, status = "shared", batchId) {
|
|
2242
|
-
return await __classPrivateFieldGet$
|
|
2240
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
|
|
2243
2241
|
}
|
|
2244
2242
|
async update(oldLink, newLink, batchId) {
|
|
2245
|
-
const result = await __classPrivateFieldGet$
|
|
2246
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2243
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
|
|
2244
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2247
2245
|
return result;
|
|
2248
2246
|
}
|
|
2249
2247
|
async remove(link, batchId) {
|
|
2250
|
-
const result = await __classPrivateFieldGet$
|
|
2251
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2248
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, link, batchId);
|
|
2249
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2252
2250
|
return result;
|
|
2253
2251
|
}
|
|
2254
2252
|
async createBatch() {
|
|
2255
|
-
return await __classPrivateFieldGet$
|
|
2253
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2256
2254
|
}
|
|
2257
2255
|
async commitBatch(batchId) {
|
|
2258
|
-
const result = await __classPrivateFieldGet$
|
|
2259
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
2256
|
+
const result = await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, batchId);
|
|
2257
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2260
2258
|
return result;
|
|
2261
2259
|
}
|
|
2262
2260
|
async getExpression(expressionURI) {
|
|
2263
|
-
return await __classPrivateFieldGet$
|
|
2261
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
|
|
2264
2262
|
}
|
|
2265
2263
|
async createExpression(content, languageAddress) {
|
|
2266
|
-
return await __classPrivateFieldGet$
|
|
2264
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
|
|
2267
2265
|
}
|
|
2268
2266
|
async addListener(type, cb) {
|
|
2269
2267
|
if (type === "link-added") {
|
|
2270
|
-
__classPrivateFieldGet$
|
|
2268
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").push(cb);
|
|
2271
2269
|
} else if (type === "link-removed") {
|
|
2272
|
-
__classPrivateFieldGet$
|
|
2270
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").push(cb);
|
|
2273
2271
|
} else if (type === "link-updated") {
|
|
2274
|
-
__classPrivateFieldGet$
|
|
2272
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").push(cb);
|
|
2275
2273
|
}
|
|
2276
2274
|
}
|
|
2277
2275
|
async addSyncStateChangeListener(cb) {
|
|
2278
|
-
__classPrivateFieldGet$
|
|
2276
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveSyncStateChangeCallbacks, "f").push(cb);
|
|
2279
2277
|
}
|
|
2280
2278
|
async removeListener(type, cb) {
|
|
2281
2279
|
if (type === "link-added") {
|
|
2282
|
-
const index = __classPrivateFieldGet$
|
|
2283
|
-
__classPrivateFieldGet$
|
|
2280
|
+
const index = __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").indexOf(cb);
|
|
2281
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkAddedCallbacks, "f").splice(index, 1);
|
|
2284
2282
|
} else if (type === "link-removed") {
|
|
2285
|
-
const index = __classPrivateFieldGet$
|
|
2286
|
-
__classPrivateFieldGet$
|
|
2283
|
+
const index = __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").indexOf(cb);
|
|
2284
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkRemovedCallbacks, "f").splice(index, 1);
|
|
2287
2285
|
} else if (type === "link-updated") {
|
|
2288
|
-
const index = __classPrivateFieldGet$
|
|
2289
|
-
__classPrivateFieldGet$
|
|
2286
|
+
const index = __classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").indexOf(cb);
|
|
2287
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_perspectiveLinkUpdatedCallbacks, "f").splice(index, 1);
|
|
2290
2288
|
}
|
|
2291
2289
|
}
|
|
2292
2290
|
async snapshot() {
|
|
2293
|
-
return __classPrivateFieldGet$
|
|
2291
|
+
return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
2294
2292
|
}
|
|
2295
2293
|
async loadSnapshot(snapshot) {
|
|
2296
2294
|
const cleanedSnapshot = JSON.parse(JSON.stringify(snapshot));
|
|
@@ -2479,7 +2477,7 @@ var PerspectiveProxy = class {
|
|
|
2479
2477
|
return typeof code2 === "string" ? code2 : null;
|
|
2480
2478
|
}
|
|
2481
2479
|
async addSdna(name, sdnaCode, sdnaType, shaclJson) {
|
|
2482
|
-
return __classPrivateFieldGet$
|
|
2480
|
+
return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
|
|
2483
2481
|
}
|
|
2484
2482
|
async addSubjectClass(name, shaclJson) {
|
|
2485
2483
|
return this.addSdna(name, "", "subject_class", shaclJson);
|
|
@@ -2631,7 +2629,7 @@ var PerspectiveProxy = class {
|
|
|
2631
2629
|
let className;
|
|
2632
2630
|
if (typeof subjectClass === "string") {
|
|
2633
2631
|
className = subjectClass;
|
|
2634
|
-
await __classPrivateFieldGet$
|
|
2632
|
+
await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
|
|
2635
2633
|
className,
|
|
2636
2634
|
initialValues
|
|
2637
2635
|
}), exprAddr, initialValues ? JSON.stringify(initialValues) : void 0, batchId);
|
|
@@ -2641,7 +2639,7 @@ var PerspectiveProxy = class {
|
|
|
2641
2639
|
if (!resolvedClassName) {
|
|
2642
2640
|
throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
|
|
2643
2641
|
}
|
|
2644
|
-
await __classPrivateFieldGet$
|
|
2642
|
+
await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
|
|
2645
2643
|
className: resolvedClassName,
|
|
2646
2644
|
initialValues
|
|
2647
2645
|
}), exprAddr, initialValues ? JSON.stringify(initialValues) : void 0, batchId);
|
|
@@ -2653,14 +2651,14 @@ var PerspectiveProxy = class {
|
|
|
2653
2651
|
}
|
|
2654
2652
|
async getSubjectData(subjectClass, exprAddr) {
|
|
2655
2653
|
if (typeof subjectClass === "string") {
|
|
2656
|
-
return JSON.parse(await __classPrivateFieldGet$
|
|
2654
|
+
return JSON.parse(await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
|
|
2657
2655
|
}
|
|
2658
2656
|
const obj = subjectClass;
|
|
2659
2657
|
const resolvedClassName = obj.className || obj.constructor?.className || obj.constructor?.prototype?.className || await this.findClassByProperties(obj);
|
|
2660
2658
|
if (!resolvedClassName) {
|
|
2661
2659
|
throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
|
|
2662
2660
|
}
|
|
2663
|
-
return JSON.parse(await __classPrivateFieldGet$
|
|
2661
|
+
return JSON.parse(await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
|
|
2664
2662
|
}
|
|
2665
2663
|
async getActionsFromSHACL(className, predicate) {
|
|
2666
2664
|
const escaped = this.escapeRegExp(className);
|
|
@@ -2909,7 +2907,7 @@ var PerspectiveProxy = class {
|
|
|
2909
2907
|
}
|
|
2910
2908
|
async ensureSubjectClass(jsClass) {
|
|
2911
2909
|
const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
|
|
2912
|
-
if (__classPrivateFieldGet$
|
|
2910
|
+
if (__classPrivateFieldGet$a(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
|
|
2913
2911
|
return;
|
|
2914
2912
|
if (!jsClass.generateSHACL) {
|
|
2915
2913
|
throw new Error(`Class ${jsClass.name} must have generateSHACL(). Use @Model decorator.`);
|
|
@@ -2917,10 +2915,10 @@ var PerspectiveProxy = class {
|
|
|
2917
2915
|
const { shape } = jsClass.generateSHACL();
|
|
2918
2916
|
const shaclJson = JSON.stringify(shape.toJSON());
|
|
2919
2917
|
await this.addSdna(className, "", "subject_class", shaclJson);
|
|
2920
|
-
__classPrivateFieldGet$
|
|
2918
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
|
|
2921
2919
|
}
|
|
2922
2920
|
clearEnsuredSubjectClasses() {
|
|
2923
|
-
__classPrivateFieldGet$
|
|
2921
|
+
__classPrivateFieldGet$a(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
|
|
2924
2922
|
}
|
|
2925
2923
|
async listRegisteredClasses() {
|
|
2926
2924
|
const results = await this.querySparql(`SELECT DISTINCT ?class WHERE { ?class <rdf://type> <ad4m://SubjectClass> . }`);
|
|
@@ -3048,26 +3046,26 @@ var PerspectiveProxy = class {
|
|
|
3048
3046
|
}));
|
|
3049
3047
|
}
|
|
3050
3048
|
getNeighbourhoodProxy() {
|
|
3051
|
-
return __classPrivateFieldGet$
|
|
3049
|
+
return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid);
|
|
3052
3050
|
}
|
|
3053
3051
|
get ai() {
|
|
3054
|
-
return __classPrivateFieldGet$
|
|
3052
|
+
return __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").aiClient;
|
|
3055
3053
|
}
|
|
3056
3054
|
async subscribeInfer(query) {
|
|
3057
|
-
const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$
|
|
3055
|
+
const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f"));
|
|
3058
3056
|
await subscriptionProxy.subscribe();
|
|
3059
3057
|
await subscriptionProxy.initialized;
|
|
3060
3058
|
return subscriptionProxy;
|
|
3061
3059
|
}
|
|
3062
3060
|
async subscribeQuery(query) {
|
|
3063
|
-
const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$
|
|
3061
|
+
const subscriptionProxy = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f"));
|
|
3064
3062
|
await subscriptionProxy.subscribe();
|
|
3065
3063
|
await subscriptionProxy.initialized;
|
|
3066
3064
|
return subscriptionProxy;
|
|
3067
3065
|
}
|
|
3068
3066
|
};
|
|
3069
3067
|
_PerspectiveProxy_handle = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_client = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_perspectiveLinkAddedCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_perspectiveLinkRemovedCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_perspectiveLinkUpdatedCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_perspectiveSyncStateChangeCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_ensuredSubjectClasses = /* @__PURE__ */ new WeakMap();
|
|
3070
|
-
var __classPrivateFieldSet$
|
|
3068
|
+
var __classPrivateFieldSet$9 = function(receiver, state, value, kind, f) {
|
|
3071
3069
|
if (kind === "m")
|
|
3072
3070
|
throw new TypeError("Private method is not writable");
|
|
3073
3071
|
if (kind === "a" && !f)
|
|
@@ -3076,7 +3074,7 @@ var __classPrivateFieldSet$8 = function(receiver, state, value, kind, f) {
|
|
|
3076
3074
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3077
3075
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3078
3076
|
};
|
|
3079
|
-
var __classPrivateFieldGet$
|
|
3077
|
+
var __classPrivateFieldGet$9 = function(receiver, state, kind, f) {
|
|
3080
3078
|
if (kind === "a" && !f)
|
|
3081
3079
|
throw new TypeError("Private accessor was defined without a getter");
|
|
3082
3080
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -3096,11 +3094,6 @@ var _PerspectiveClient_linkUnsubscribers;
|
|
|
3096
3094
|
var _PerspectiveClient_querySubscriptionUnsubscribers;
|
|
3097
3095
|
function normalizeQueryResult(raw, errorContext) {
|
|
3098
3096
|
let finalResult = raw;
|
|
3099
|
-
let isInit = false;
|
|
3100
|
-
if (typeof finalResult === "string" && finalResult.startsWith("#init#")) {
|
|
3101
|
-
finalResult = finalResult.substring(6);
|
|
3102
|
-
isInit = true;
|
|
3103
|
-
}
|
|
3104
3097
|
if (typeof finalResult === "string") {
|
|
3105
3098
|
try {
|
|
3106
3099
|
finalResult = JSON.parse(finalResult);
|
|
@@ -3108,10 +3101,7 @@ function normalizeQueryResult(raw, errorContext) {
|
|
|
3108
3101
|
console.error(errorContext, e);
|
|
3109
3102
|
}
|
|
3110
3103
|
}
|
|
3111
|
-
|
|
3112
|
-
finalResult.isInit = true;
|
|
3113
|
-
}
|
|
3114
|
-
return { result: finalResult, isInit };
|
|
3104
|
+
return finalResult;
|
|
3115
3105
|
}
|
|
3116
3106
|
var PerspectiveClient = class {
|
|
3117
3107
|
constructor(baseUrl, token, subscribe = true, sharedApiClient) {
|
|
@@ -3126,14 +3116,14 @@ var PerspectiveClient = class {
|
|
|
3126
3116
|
_PerspectiveClient_unsubscribers.set(this, void 0);
|
|
3127
3117
|
_PerspectiveClient_linkUnsubscribers.set(this, void 0);
|
|
3128
3118
|
_PerspectiveClient_querySubscriptionUnsubscribers.set(this, void 0);
|
|
3129
|
-
__classPrivateFieldSet$
|
|
3130
|
-
__classPrivateFieldSet$
|
|
3131
|
-
__classPrivateFieldSet$
|
|
3132
|
-
__classPrivateFieldSet$
|
|
3133
|
-
__classPrivateFieldSet$
|
|
3134
|
-
__classPrivateFieldSet$
|
|
3135
|
-
__classPrivateFieldSet$
|
|
3136
|
-
__classPrivateFieldSet$
|
|
3119
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
3120
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveAddedCallbacks, [], "f");
|
|
3121
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveUpdatedCallbacks, [], "f");
|
|
3122
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveRemovedCallbacks, [], "f");
|
|
3123
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, [], "f");
|
|
3124
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_unsubscribers, [], "f");
|
|
3125
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_linkUnsubscribers, /* @__PURE__ */ new Map(), "f");
|
|
3126
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, /* @__PURE__ */ new Map(), "f");
|
|
3137
3127
|
if (subscribe) {
|
|
3138
3128
|
this.subscribePerspectiveAdded();
|
|
3139
3129
|
this.subscribePerspectiveUpdated();
|
|
@@ -3141,24 +3131,24 @@ var PerspectiveClient = class {
|
|
|
3141
3131
|
}
|
|
3142
3132
|
}
|
|
3143
3133
|
setExpressionClient(client) {
|
|
3144
|
-
__classPrivateFieldSet$
|
|
3134
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_expressionClient, client, "f");
|
|
3145
3135
|
}
|
|
3146
3136
|
setNeighbourhoodClient(client) {
|
|
3147
|
-
__classPrivateFieldSet$
|
|
3137
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_neighbourhoodClient, client, "f");
|
|
3148
3138
|
}
|
|
3149
3139
|
setAIClient(client) {
|
|
3150
|
-
__classPrivateFieldSet$
|
|
3140
|
+
__classPrivateFieldSet$9(this, _PerspectiveClient_aiClient, client, "f");
|
|
3151
3141
|
}
|
|
3152
3142
|
get aiClient() {
|
|
3153
|
-
return __classPrivateFieldGet$
|
|
3143
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_aiClient, "f");
|
|
3154
3144
|
}
|
|
3155
3145
|
async all() {
|
|
3156
|
-
const perspectives = await __classPrivateFieldGet$
|
|
3146
|
+
const perspectives = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.all");
|
|
3157
3147
|
return perspectives.map((handle) => new PerspectiveProxy(handle, this));
|
|
3158
3148
|
}
|
|
3159
3149
|
async byUUID(uuid) {
|
|
3160
3150
|
try {
|
|
3161
|
-
const perspective = await __classPrivateFieldGet$
|
|
3151
|
+
const perspective = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.get", { uuid });
|
|
3162
3152
|
if (!perspective)
|
|
3163
3153
|
return null;
|
|
3164
3154
|
return new PerspectiveProxy(perspective, this);
|
|
@@ -3169,10 +3159,10 @@ var PerspectiveClient = class {
|
|
|
3169
3159
|
}
|
|
3170
3160
|
}
|
|
3171
3161
|
async snapshotByUUID(uuid) {
|
|
3172
|
-
return __classPrivateFieldGet$
|
|
3162
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.snapshot", { uuid });
|
|
3173
3163
|
}
|
|
3174
3164
|
async publishSnapshotByUUID(uuid) {
|
|
3175
|
-
return __classPrivateFieldGet$
|
|
3165
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.publishSnapshot", { uuid });
|
|
3176
3166
|
}
|
|
3177
3167
|
async queryLinks(uuid, query) {
|
|
3178
3168
|
const params = { uuid };
|
|
@@ -3188,59 +3178,59 @@ var PerspectiveClient = class {
|
|
|
3188
3178
|
params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate);
|
|
3189
3179
|
if (query.limit !== void 0)
|
|
3190
3180
|
params.limit = query.limit;
|
|
3191
|
-
return __classPrivateFieldGet$
|
|
3181
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.queryLinks", params);
|
|
3192
3182
|
}
|
|
3193
3183
|
async queryProlog(uuid, query) {
|
|
3194
|
-
const result = await __classPrivateFieldGet$
|
|
3184
|
+
const result = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.queryProlog", { uuid, query });
|
|
3195
3185
|
return JSON.parse(result);
|
|
3196
3186
|
}
|
|
3197
3187
|
async querySparql(uuid, query) {
|
|
3198
|
-
const result = await __classPrivateFieldGet$
|
|
3188
|
+
const result = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.querySparql", { uuid, engine: "sparql", query });
|
|
3199
3189
|
return JSON.parse(result);
|
|
3200
3190
|
}
|
|
3201
3191
|
async subscribeQuery(uuid, query) {
|
|
3202
|
-
const response = await __classPrivateFieldGet$
|
|
3192
|
+
const response = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.subscribeQuery", { uuid, query });
|
|
3203
3193
|
const { subscriptionId, result } = response;
|
|
3204
|
-
const
|
|
3205
|
-
return { subscriptionId, result:
|
|
3194
|
+
const parsed = normalizeQueryResult(result, "Error parsing subscribeQuery result:");
|
|
3195
|
+
return { subscriptionId, result: parsed };
|
|
3206
3196
|
}
|
|
3207
3197
|
async perspectiveKeepAliveQuery(uuid, subscriptionId) {
|
|
3208
|
-
return __classPrivateFieldGet$
|
|
3198
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.keepAliveQuery", { uuid, subscriptionId });
|
|
3209
3199
|
}
|
|
3210
3200
|
async perspectiveDisposeQuerySubscription(uuid, subscriptionId) {
|
|
3211
|
-
return __classPrivateFieldGet$
|
|
3201
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.disposeQuery", { uuid, subscriptionId });
|
|
3212
3202
|
}
|
|
3213
3203
|
subscribeToQueryUpdates(subscriptionId, onData) {
|
|
3214
|
-
const unsub = __classPrivateFieldGet$
|
|
3204
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3215
3205
|
const event = data;
|
|
3216
3206
|
if (event.type !== "query-subscription-update")
|
|
3217
3207
|
return;
|
|
3218
3208
|
const eventSubscriptionId = event.subscriptionId || event.subscription_id;
|
|
3219
3209
|
if (eventSubscriptionId !== subscriptionId)
|
|
3220
3210
|
return;
|
|
3221
|
-
const
|
|
3222
|
-
onData(
|
|
3211
|
+
const parsed = normalizeQueryResult(event.result, "Error parsing query subscription:");
|
|
3212
|
+
onData(parsed);
|
|
3223
3213
|
});
|
|
3224
|
-
__classPrivateFieldGet$
|
|
3214
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").set(subscriptionId, unsub);
|
|
3225
3215
|
return unsub;
|
|
3226
3216
|
}
|
|
3227
3217
|
async keepAliveQuery(uuid, subscriptionId) {
|
|
3228
|
-
return __classPrivateFieldGet$
|
|
3218
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.keepAliveQuery", { uuid, subscriptionId });
|
|
3229
3219
|
}
|
|
3230
3220
|
async disposeQuerySubscription(uuid, subscriptionId) {
|
|
3231
|
-
const unsub = __classPrivateFieldGet$
|
|
3221
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").get(subscriptionId);
|
|
3232
3222
|
if (unsub) {
|
|
3233
3223
|
unsub();
|
|
3234
|
-
__classPrivateFieldGet$
|
|
3224
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").delete(subscriptionId);
|
|
3235
3225
|
}
|
|
3236
|
-
return __classPrivateFieldGet$
|
|
3226
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.disposeQuery", { uuid, subscriptionId });
|
|
3237
3227
|
}
|
|
3238
3228
|
async modelQuery(uuid, className, queryJson, shapeJson) {
|
|
3239
|
-
const resultJson = await __classPrivateFieldGet$
|
|
3229
|
+
const resultJson = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.modelQuery", { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
|
|
3240
3230
|
return JSON.parse(resultJson);
|
|
3241
3231
|
}
|
|
3242
3232
|
async evaluateGetters(uuid, className, instanceIds, shapeJson, propertyNames) {
|
|
3243
|
-
const resultJson = await __classPrivateFieldGet$
|
|
3233
|
+
const resultJson = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.evaluateGetters", {
|
|
3244
3234
|
uuid,
|
|
3245
3235
|
class_name: className,
|
|
3246
3236
|
instance_ids: instanceIds,
|
|
@@ -3250,125 +3240,125 @@ var PerspectiveClient = class {
|
|
|
3250
3240
|
return JSON.parse(resultJson);
|
|
3251
3241
|
}
|
|
3252
3242
|
async modelSubscribe(uuid, className, queryJson, shapeJson) {
|
|
3253
|
-
const response = await __classPrivateFieldGet$
|
|
3243
|
+
const response = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.modelSubscribe", { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
|
|
3254
3244
|
return {
|
|
3255
3245
|
subscriptionId: response.subscription_id,
|
|
3256
3246
|
result: JSON.parse(response.result)
|
|
3257
3247
|
};
|
|
3258
3248
|
}
|
|
3259
3249
|
async add(name) {
|
|
3260
|
-
const handle = await __classPrivateFieldGet$
|
|
3250
|
+
const handle = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.create", { name });
|
|
3261
3251
|
return new PerspectiveProxy(handle, this);
|
|
3262
3252
|
}
|
|
3263
3253
|
async update(uuid, name) {
|
|
3264
|
-
const handle = await __classPrivateFieldGet$
|
|
3254
|
+
const handle = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.update", { uuid, name });
|
|
3265
3255
|
return new PerspectiveProxy(handle, this);
|
|
3266
3256
|
}
|
|
3267
3257
|
async remove(uuid) {
|
|
3268
|
-
const result = await __classPrivateFieldGet$
|
|
3258
|
+
const result = await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.remove", { uuid });
|
|
3269
3259
|
return { perspectiveRemove: result };
|
|
3270
3260
|
}
|
|
3271
3261
|
async addLink(uuid, link, status = "shared", batchId) {
|
|
3272
|
-
return __classPrivateFieldGet$
|
|
3262
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.addLink", { uuid, link, status, batchId });
|
|
3273
3263
|
}
|
|
3274
3264
|
async addLinks(uuid, links, status = "shared", batchId) {
|
|
3275
|
-
return __classPrivateFieldGet$
|
|
3265
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.addLinks", { uuid, links, status, batchId });
|
|
3276
3266
|
}
|
|
3277
3267
|
async removeLinks(uuid, links, batchId) {
|
|
3278
|
-
return __classPrivateFieldGet$
|
|
3268
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.removeLinks", { uuid, links, batchId });
|
|
3279
3269
|
}
|
|
3280
3270
|
async linkMutations(uuid, mutations, status) {
|
|
3281
|
-
return __classPrivateFieldGet$
|
|
3271
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.linkMutations", { uuid, mutations, status });
|
|
3282
3272
|
}
|
|
3283
3273
|
async addLinkExpression(uuid, link, status = "shared", batchId) {
|
|
3284
|
-
return __classPrivateFieldGet$
|
|
3274
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.addLinkExpression", { uuid, link, status, batchId });
|
|
3285
3275
|
}
|
|
3286
3276
|
async updateLink(uuid, oldLink, newLink, batchId) {
|
|
3287
|
-
return __classPrivateFieldGet$
|
|
3277
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.updateLink", { uuid, oldLink, newLink, batchId });
|
|
3288
3278
|
}
|
|
3289
3279
|
async removeLink(uuid, link, batchId) {
|
|
3290
3280
|
delete link.__typename;
|
|
3291
3281
|
delete link.data.__typename;
|
|
3292
3282
|
delete link.proof.__typename;
|
|
3293
3283
|
delete link.status;
|
|
3294
|
-
return __classPrivateFieldGet$
|
|
3284
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.removeLink", { uuid, link, batchId });
|
|
3295
3285
|
}
|
|
3296
3286
|
async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
|
|
3297
|
-
return __classPrivateFieldGet$
|
|
3287
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.addSdna", { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
|
|
3298
3288
|
}
|
|
3299
3289
|
async executeCommands(uuid, commands, expression, parameters, batchId) {
|
|
3300
|
-
return __classPrivateFieldGet$
|
|
3290
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.executeCommands", { uuid, commands, expression, parameters, batchId });
|
|
3301
3291
|
}
|
|
3302
3292
|
async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
|
|
3303
|
-
return __classPrivateFieldGet$
|
|
3293
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.createSubject", { uuid, subjectClass, expressionAddress, initialValues, batchId });
|
|
3304
3294
|
}
|
|
3305
3295
|
async getSubjectData(uuid, subjectClass, expressionAddress) {
|
|
3306
|
-
return __classPrivateFieldGet$
|
|
3296
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.getSubjectData", { uuid, subjectClass, expressionAddress });
|
|
3307
3297
|
}
|
|
3308
3298
|
async getExpression(expressionURI) {
|
|
3309
|
-
return await __classPrivateFieldGet$
|
|
3299
|
+
return await __classPrivateFieldGet$9(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
|
|
3310
3300
|
}
|
|
3311
3301
|
async createExpression(content, languageAddress) {
|
|
3312
|
-
return await __classPrivateFieldGet$
|
|
3302
|
+
return await __classPrivateFieldGet$9(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
|
|
3313
3303
|
}
|
|
3314
3304
|
addPerspectiveAddedListener(cb) {
|
|
3315
|
-
__classPrivateFieldGet$
|
|
3305
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").push(cb);
|
|
3316
3306
|
}
|
|
3317
3307
|
subscribePerspectiveAdded() {
|
|
3318
|
-
const unsub = __classPrivateFieldGet$
|
|
3308
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3319
3309
|
if (data.type === "perspective-added") {
|
|
3320
|
-
__classPrivateFieldGet$
|
|
3310
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").forEach((cb) => cb(data.perspective));
|
|
3321
3311
|
}
|
|
3322
3312
|
});
|
|
3323
|
-
__classPrivateFieldGet$
|
|
3313
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
3324
3314
|
}
|
|
3325
3315
|
addPerspectiveUpdatedListener(cb) {
|
|
3326
|
-
__classPrivateFieldGet$
|
|
3316
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").push(cb);
|
|
3327
3317
|
}
|
|
3328
3318
|
subscribePerspectiveUpdated() {
|
|
3329
|
-
const unsub = __classPrivateFieldGet$
|
|
3319
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3330
3320
|
if (data.type === "perspective-updated") {
|
|
3331
|
-
__classPrivateFieldGet$
|
|
3321
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").forEach((cb) => cb(data.perspective));
|
|
3332
3322
|
}
|
|
3333
3323
|
});
|
|
3334
|
-
__classPrivateFieldGet$
|
|
3324
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
3335
3325
|
}
|
|
3336
3326
|
addPerspectiveSyncedListener(cb) {
|
|
3337
|
-
__classPrivateFieldGet$
|
|
3327
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, "f").push(cb);
|
|
3338
3328
|
}
|
|
3339
3329
|
async addPerspectiveSyncStateChangeListener(uuid, cb) {
|
|
3340
|
-
const unsub = __classPrivateFieldGet$
|
|
3330
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3341
3331
|
if (data.type === "sync-state-change" && data.uuid === uuid) {
|
|
3342
3332
|
cb.forEach((c) => c(data.state));
|
|
3343
3333
|
}
|
|
3344
3334
|
});
|
|
3345
|
-
__classPrivateFieldGet$
|
|
3335
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
3346
3336
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
3347
3337
|
}
|
|
3348
3338
|
addPerspectiveRemovedListener(cb) {
|
|
3349
|
-
__classPrivateFieldGet$
|
|
3339
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").push(cb);
|
|
3350
3340
|
}
|
|
3351
3341
|
subscribePerspectiveRemoved() {
|
|
3352
|
-
const unsub = __classPrivateFieldGet$
|
|
3342
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3353
3343
|
if (data.type === "perspective-removed") {
|
|
3354
|
-
__classPrivateFieldGet$
|
|
3344
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").forEach((cb) => cb(data.uuid));
|
|
3355
3345
|
}
|
|
3356
3346
|
});
|
|
3357
|
-
__classPrivateFieldGet$
|
|
3347
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
3358
3348
|
}
|
|
3359
3349
|
async addPerspectiveLinkAddedListener(uuid, cb) {
|
|
3360
|
-
const unsub = __classPrivateFieldGet$
|
|
3350
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3361
3351
|
if (data.type === "link-added" && data.perspectiveUuid === uuid) {
|
|
3362
3352
|
cb.forEach((c) => c(data.link));
|
|
3363
3353
|
}
|
|
3364
3354
|
});
|
|
3365
|
-
let existing = __classPrivateFieldGet$
|
|
3355
|
+
let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
3366
3356
|
existing.push(unsub);
|
|
3367
|
-
__classPrivateFieldGet$
|
|
3368
|
-
await __classPrivateFieldGet$
|
|
3357
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
3358
|
+
await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
3369
3359
|
}
|
|
3370
3360
|
async addPerspectiveLinkRemovedListener(uuid, cb) {
|
|
3371
|
-
const unsub = __classPrivateFieldGet$
|
|
3361
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3372
3362
|
if (data.type === "link-removed" && data.perspectiveUuid === uuid) {
|
|
3373
3363
|
const link = data.link;
|
|
3374
3364
|
if (!link.status) {
|
|
@@ -3377,13 +3367,13 @@ var PerspectiveClient = class {
|
|
|
3377
3367
|
cb.forEach((c) => c(link));
|
|
3378
3368
|
}
|
|
3379
3369
|
});
|
|
3380
|
-
let existing = __classPrivateFieldGet$
|
|
3370
|
+
let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
3381
3371
|
existing.push(unsub);
|
|
3382
|
-
__classPrivateFieldGet$
|
|
3383
|
-
await __classPrivateFieldGet$
|
|
3372
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
3373
|
+
await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
3384
3374
|
}
|
|
3385
3375
|
async addPerspectiveLinkUpdatedListener(uuid, cb) {
|
|
3386
|
-
const unsub = __classPrivateFieldGet$
|
|
3376
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
3387
3377
|
if (data.type === "link-updated" && data.perspectiveUuid === uuid) {
|
|
3388
3378
|
const newLink = data.newLink;
|
|
3389
3379
|
const oldLink = data.oldLink;
|
|
@@ -3396,22 +3386,145 @@ var PerspectiveClient = class {
|
|
|
3396
3386
|
cb.forEach((c) => c(data));
|
|
3397
3387
|
}
|
|
3398
3388
|
});
|
|
3399
|
-
let existing = __classPrivateFieldGet$
|
|
3389
|
+
let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
3400
3390
|
existing.push(unsub);
|
|
3401
|
-
__classPrivateFieldGet$
|
|
3402
|
-
await __classPrivateFieldGet$
|
|
3391
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
3392
|
+
await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
3403
3393
|
}
|
|
3404
3394
|
getNeighbourhoodProxy(uuid) {
|
|
3405
|
-
return new NeighbourhoodProxy(__classPrivateFieldGet$
|
|
3395
|
+
return new NeighbourhoodProxy(__classPrivateFieldGet$9(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
|
|
3406
3396
|
}
|
|
3407
3397
|
async createBatch(uuid) {
|
|
3408
|
-
return __classPrivateFieldGet$
|
|
3398
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.createBatch", { uuid });
|
|
3409
3399
|
}
|
|
3410
3400
|
async commitBatch(uuid, batchId) {
|
|
3411
|
-
return __classPrivateFieldGet$
|
|
3401
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.commitBatch", { uuid, batchId });
|
|
3412
3402
|
}
|
|
3413
3403
|
};
|
|
3414
3404
|
_PerspectiveClient_apiClient = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_perspectiveAddedCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_perspectiveUpdatedCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_perspectiveRemovedCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_perspectiveSyncStateChangeCallbacks = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_expressionClient = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_neighbourhoodClient = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_aiClient = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_unsubscribers = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_linkUnsubscribers = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_querySubscriptionUnsubscribers = /* @__PURE__ */ new WeakMap();
|
|
3405
|
+
var __classPrivateFieldSet$8 = function(receiver, state, value, kind, f) {
|
|
3406
|
+
if (kind === "m")
|
|
3407
|
+
throw new TypeError("Private method is not writable");
|
|
3408
|
+
if (kind === "a" && !f)
|
|
3409
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
3410
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3411
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3412
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3413
|
+
};
|
|
3414
|
+
var __classPrivateFieldGet$8 = function(receiver, state, kind, f) {
|
|
3415
|
+
if (kind === "a" && !f)
|
|
3416
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
3417
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3418
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3419
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3420
|
+
};
|
|
3421
|
+
var _IDBCache_instances;
|
|
3422
|
+
var _IDBCache_dbName;
|
|
3423
|
+
var _IDBCache_storeName;
|
|
3424
|
+
var _IDBCache_dbPromise;
|
|
3425
|
+
var _IDBCache_version;
|
|
3426
|
+
var _IDBCache_open;
|
|
3427
|
+
var IDBCache = class {
|
|
3428
|
+
constructor(dbName, storeName) {
|
|
3429
|
+
_IDBCache_instances.add(this);
|
|
3430
|
+
_IDBCache_dbName.set(this, void 0);
|
|
3431
|
+
_IDBCache_storeName.set(this, void 0);
|
|
3432
|
+
_IDBCache_dbPromise.set(this, null);
|
|
3433
|
+
_IDBCache_version.set(this, 1);
|
|
3434
|
+
__classPrivateFieldSet$8(this, _IDBCache_dbName, dbName, "f");
|
|
3435
|
+
__classPrivateFieldSet$8(this, _IDBCache_storeName, storeName, "f");
|
|
3436
|
+
}
|
|
3437
|
+
async get(key) {
|
|
3438
|
+
try {
|
|
3439
|
+
const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
3440
|
+
return new Promise((resolve) => {
|
|
3441
|
+
const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), "readonly");
|
|
3442
|
+
const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
|
|
3443
|
+
const req = store.get(key);
|
|
3444
|
+
req.onsuccess = () => resolve(req.result ?? void 0);
|
|
3445
|
+
req.onerror = () => resolve(void 0);
|
|
3446
|
+
});
|
|
3447
|
+
} catch {
|
|
3448
|
+
return void 0;
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
async put(key, value) {
|
|
3452
|
+
try {
|
|
3453
|
+
const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
3454
|
+
return new Promise((resolve) => {
|
|
3455
|
+
const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), "readwrite");
|
|
3456
|
+
const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
|
|
3457
|
+
store.put(value, key);
|
|
3458
|
+
tx.oncomplete = () => resolve();
|
|
3459
|
+
tx.onerror = () => resolve();
|
|
3460
|
+
});
|
|
3461
|
+
} catch {
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
async delete(key) {
|
|
3465
|
+
try {
|
|
3466
|
+
const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
3467
|
+
return new Promise((resolve) => {
|
|
3468
|
+
const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), "readwrite");
|
|
3469
|
+
const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
|
|
3470
|
+
store.delete(key);
|
|
3471
|
+
tx.oncomplete = () => resolve();
|
|
3472
|
+
tx.onerror = () => resolve();
|
|
3473
|
+
});
|
|
3474
|
+
} catch {
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
async clear() {
|
|
3478
|
+
try {
|
|
3479
|
+
const db = await __classPrivateFieldGet$8(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
3480
|
+
return new Promise((resolve) => {
|
|
3481
|
+
const tx = db.transaction(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"), "readwrite");
|
|
3482
|
+
const store = tx.objectStore(__classPrivateFieldGet$8(this, _IDBCache_storeName, "f"));
|
|
3483
|
+
store.clear();
|
|
3484
|
+
tx.oncomplete = () => resolve();
|
|
3485
|
+
tx.onerror = () => resolve();
|
|
3486
|
+
});
|
|
3487
|
+
} catch {
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
};
|
|
3491
|
+
_IDBCache_dbName = /* @__PURE__ */ new WeakMap(), _IDBCache_storeName = /* @__PURE__ */ new WeakMap(), _IDBCache_dbPromise = /* @__PURE__ */ new WeakMap(), _IDBCache_version = /* @__PURE__ */ new WeakMap(), _IDBCache_instances = /* @__PURE__ */ new WeakSet(), _IDBCache_open = function _IDBCache_open2() {
|
|
3492
|
+
if (!__classPrivateFieldGet$8(this, _IDBCache_dbPromise, "f")) {
|
|
3493
|
+
__classPrivateFieldSet$8(this, _IDBCache_dbPromise, new Promise((resolve, reject) => {
|
|
3494
|
+
const storeName = __classPrivateFieldGet$8(this, _IDBCache_storeName, "f");
|
|
3495
|
+
const req = indexedDB.open(__classPrivateFieldGet$8(this, _IDBCache_dbName, "f"), __classPrivateFieldGet$8(this, _IDBCache_version, "f"));
|
|
3496
|
+
req.onupgradeneeded = () => {
|
|
3497
|
+
const db = req.result;
|
|
3498
|
+
if (!db.objectStoreNames.contains(storeName)) {
|
|
3499
|
+
db.createObjectStore(storeName);
|
|
3500
|
+
}
|
|
3501
|
+
};
|
|
3502
|
+
req.onsuccess = () => resolve(req.result);
|
|
3503
|
+
req.onerror = () => reject(req.error);
|
|
3504
|
+
}), "f");
|
|
3505
|
+
}
|
|
3506
|
+
return __classPrivateFieldGet$8(this, _IDBCache_dbPromise, "f");
|
|
3507
|
+
};
|
|
3508
|
+
var NullCache = class {
|
|
3509
|
+
async get(_key) {
|
|
3510
|
+
return void 0;
|
|
3511
|
+
}
|
|
3512
|
+
async put(_key, _value) {
|
|
3513
|
+
}
|
|
3514
|
+
async delete(_key) {
|
|
3515
|
+
}
|
|
3516
|
+
async clear() {
|
|
3517
|
+
}
|
|
3518
|
+
};
|
|
3519
|
+
function createPersistentCache(dbName, storeName) {
|
|
3520
|
+
try {
|
|
3521
|
+
if (typeof indexedDB !== "undefined") {
|
|
3522
|
+
return new IDBCache(dbName, storeName);
|
|
3523
|
+
}
|
|
3524
|
+
} catch {
|
|
3525
|
+
}
|
|
3526
|
+
return new NullCache();
|
|
3527
|
+
}
|
|
3415
3528
|
var __classPrivateFieldSet$7 = function(receiver, state, value, kind, f) {
|
|
3416
3529
|
if (kind === "m")
|
|
3417
3530
|
throw new TypeError("Private method is not writable");
|
|
@@ -3437,6 +3550,9 @@ var _AgentClient_agentStatusChangedCallbacks;
|
|
|
3437
3550
|
var _AgentClient_hostingUserInfoChangedCallbacks;
|
|
3438
3551
|
var _AgentClient_computeLogUpdatedCallbacks;
|
|
3439
3552
|
var _AgentClient_unsubscribers;
|
|
3553
|
+
var _AgentClient_memCache;
|
|
3554
|
+
var _AgentClient_persistent;
|
|
3555
|
+
var _AgentClient_selfDid;
|
|
3440
3556
|
var AgentClient = class {
|
|
3441
3557
|
constructor(baseUrl, token, subscribe = true, sharedApiClient) {
|
|
3442
3558
|
_AgentClient_apiClient.set(this, void 0);
|
|
@@ -3448,6 +3564,9 @@ var AgentClient = class {
|
|
|
3448
3564
|
_AgentClient_hostingUserInfoChangedCallbacks.set(this, void 0);
|
|
3449
3565
|
_AgentClient_computeLogUpdatedCallbacks.set(this, void 0);
|
|
3450
3566
|
_AgentClient_unsubscribers.set(this, void 0);
|
|
3567
|
+
_AgentClient_memCache.set(this, /* @__PURE__ */ new Map());
|
|
3568
|
+
_AgentClient_persistent.set(this, void 0);
|
|
3569
|
+
_AgentClient_selfDid.set(this, null);
|
|
3451
3570
|
__classPrivateFieldSet$7(this, _AgentClient_baseUrl, baseUrl, "f");
|
|
3452
3571
|
__classPrivateFieldSet$7(this, _AgentClient_token, token, "f");
|
|
3453
3572
|
__classPrivateFieldSet$7(this, _AgentClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
@@ -3457,6 +3576,7 @@ var AgentClient = class {
|
|
|
3457
3576
|
__classPrivateFieldSet$7(this, _AgentClient_hostingUserInfoChangedCallbacks, [], "f");
|
|
3458
3577
|
__classPrivateFieldSet$7(this, _AgentClient_computeLogUpdatedCallbacks, [], "f");
|
|
3459
3578
|
__classPrivateFieldSet$7(this, _AgentClient_unsubscribers, [], "f");
|
|
3579
|
+
__classPrivateFieldSet$7(this, _AgentClient_persistent, createPersistentCache("ad4m-agent-cache", "agents"), "f");
|
|
3460
3580
|
if (subscribe) {
|
|
3461
3581
|
this.subscribeAgentUpdated();
|
|
3462
3582
|
this.subscribeAgentStatusChanged();
|
|
@@ -3490,7 +3610,40 @@ var AgentClient = class {
|
|
|
3490
3610
|
return new AgentStatus(result);
|
|
3491
3611
|
}
|
|
3492
3612
|
async byDID(did) {
|
|
3493
|
-
|
|
3613
|
+
const now = Date.now();
|
|
3614
|
+
const cached = __classPrivateFieldGet$7(this, _AgentClient_memCache, "f").get(did);
|
|
3615
|
+
if (cached) {
|
|
3616
|
+
const isSelf = did === __classPrivateFieldGet$7(this, _AgentClient_selfDid, "f");
|
|
3617
|
+
if (isSelf || now - cached.ts < AgentClient.REMOTE_AGENT_TTL_MS) {
|
|
3618
|
+
return cached.promise;
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
const promise = (async () => {
|
|
3622
|
+
const persisted = await __classPrivateFieldGet$7(this, _AgentClient_persistent, "f").get(did);
|
|
3623
|
+
if (persisted) {
|
|
3624
|
+
return persisted;
|
|
3625
|
+
}
|
|
3626
|
+
const result = await __classPrivateFieldGet$7(this, _AgentClient_apiClient, "f").call("agent.byDid", { did });
|
|
3627
|
+
__classPrivateFieldGet$7(this, _AgentClient_persistent, "f").put(did, result);
|
|
3628
|
+
return result;
|
|
3629
|
+
})();
|
|
3630
|
+
__classPrivateFieldGet$7(this, _AgentClient_memCache, "f").set(did, { promise, ts: now });
|
|
3631
|
+
promise.catch(() => {
|
|
3632
|
+
if (__classPrivateFieldGet$7(this, _AgentClient_memCache, "f").get(did)?.promise === promise) {
|
|
3633
|
+
__classPrivateFieldGet$7(this, _AgentClient_memCache, "f").delete(did);
|
|
3634
|
+
}
|
|
3635
|
+
});
|
|
3636
|
+
return promise;
|
|
3637
|
+
}
|
|
3638
|
+
setSelfDid(did) {
|
|
3639
|
+
__classPrivateFieldSet$7(this, _AgentClient_selfDid, did, "f");
|
|
3640
|
+
}
|
|
3641
|
+
invalidateByDid(did) {
|
|
3642
|
+
__classPrivateFieldGet$7(this, _AgentClient_memCache, "f").delete(did);
|
|
3643
|
+
__classPrivateFieldGet$7(this, _AgentClient_persistent, "f").delete(did);
|
|
3644
|
+
}
|
|
3645
|
+
clearByDidCache() {
|
|
3646
|
+
__classPrivateFieldGet$7(this, _AgentClient_memCache, "f").clear();
|
|
3494
3647
|
}
|
|
3495
3648
|
async updatePublicPerspective(perspective) {
|
|
3496
3649
|
const cleanedPerspective = JSON.parse(JSON.stringify(perspective));
|
|
@@ -3551,7 +3704,15 @@ var AgentClient = class {
|
|
|
3551
3704
|
subscribeAgentUpdated() {
|
|
3552
3705
|
const unsub = __classPrivateFieldGet$7(this, _AgentClient_apiClient, "f").subscribe((data) => {
|
|
3553
3706
|
if (data.type === "agent-updated") {
|
|
3554
|
-
|
|
3707
|
+
const agent = data.agent || data;
|
|
3708
|
+
if (agent.did) {
|
|
3709
|
+
__classPrivateFieldGet$7(this, _AgentClient_memCache, "f").set(agent.did, {
|
|
3710
|
+
promise: Promise.resolve(agent),
|
|
3711
|
+
ts: Date.now()
|
|
3712
|
+
});
|
|
3713
|
+
__classPrivateFieldGet$7(this, _AgentClient_persistent, "f").put(agent.did, agent);
|
|
3714
|
+
}
|
|
3715
|
+
__classPrivateFieldGet$7(this, _AgentClient_updatedCallbacks, "f").forEach((cb) => cb(agent));
|
|
3555
3716
|
}
|
|
3556
3717
|
});
|
|
3557
3718
|
__classPrivateFieldGet$7(this, _AgentClient_unsubscribers, "f").push(unsub);
|
|
@@ -3648,7 +3809,8 @@ var AgentClient = class {
|
|
|
3648
3809
|
return __classPrivateFieldGet$7(this, _AgentClient_apiClient, "f").call("hosting.requestPayment", { amountHOT });
|
|
3649
3810
|
}
|
|
3650
3811
|
};
|
|
3651
|
-
_AgentClient_apiClient = /* @__PURE__ */ new WeakMap(), _AgentClient_baseUrl = /* @__PURE__ */ new WeakMap(), _AgentClient_token = /* @__PURE__ */ new WeakMap(), _AgentClient_appsChangedCallback = /* @__PURE__ */ new WeakMap(), _AgentClient_updatedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_agentStatusChangedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_hostingUserInfoChangedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_computeLogUpdatedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_unsubscribers = /* @__PURE__ */ new WeakMap();
|
|
3812
|
+
_AgentClient_apiClient = /* @__PURE__ */ new WeakMap(), _AgentClient_baseUrl = /* @__PURE__ */ new WeakMap(), _AgentClient_token = /* @__PURE__ */ new WeakMap(), _AgentClient_appsChangedCallback = /* @__PURE__ */ new WeakMap(), _AgentClient_updatedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_agentStatusChangedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_hostingUserInfoChangedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_computeLogUpdatedCallbacks = /* @__PURE__ */ new WeakMap(), _AgentClient_unsubscribers = /* @__PURE__ */ new WeakMap(), _AgentClient_memCache = /* @__PURE__ */ new WeakMap(), _AgentClient_persistent = /* @__PURE__ */ new WeakMap(), _AgentClient_selfDid = /* @__PURE__ */ new WeakMap();
|
|
3813
|
+
AgentClient.REMOTE_AGENT_TTL_MS = 5 * 6e4;
|
|
3652
3814
|
var __classPrivateFieldSet$6 = function(receiver, state, value, kind, f) {
|
|
3653
3815
|
if (kind === "m")
|
|
3654
3816
|
throw new TypeError("Private method is not writable");
|
|
@@ -4105,11 +4267,23 @@ var __classPrivateFieldGet$3 = function(receiver, state, kind, f) {
|
|
|
4105
4267
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4106
4268
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4107
4269
|
};
|
|
4270
|
+
var _ExpressionClient_instances;
|
|
4108
4271
|
var _ExpressionClient_apiClient;
|
|
4272
|
+
var _ExpressionClient_memCache;
|
|
4273
|
+
var _ExpressionClient_inflight;
|
|
4274
|
+
var _ExpressionClient_totalMemBytes;
|
|
4275
|
+
var _ExpressionClient_persistent;
|
|
4276
|
+
var _ExpressionClient_memCacheResult;
|
|
4109
4277
|
var ExpressionClient = class {
|
|
4110
4278
|
constructor(baseUrl, token, sharedApiClient) {
|
|
4279
|
+
_ExpressionClient_instances.add(this);
|
|
4111
4280
|
_ExpressionClient_apiClient.set(this, void 0);
|
|
4281
|
+
_ExpressionClient_memCache.set(this, /* @__PURE__ */ new Map());
|
|
4282
|
+
_ExpressionClient_inflight.set(this, /* @__PURE__ */ new Map());
|
|
4283
|
+
_ExpressionClient_totalMemBytes.set(this, 0);
|
|
4284
|
+
_ExpressionClient_persistent.set(this, void 0);
|
|
4112
4285
|
__classPrivateFieldSet$3(this, _ExpressionClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
4286
|
+
__classPrivateFieldSet$3(this, _ExpressionClient_persistent, createPersistentCache("ad4m-expression-cache", "expressions"), "f");
|
|
4113
4287
|
}
|
|
4114
4288
|
async get(url, alwaysGet = false) {
|
|
4115
4289
|
if (!alwaysGet) {
|
|
@@ -4123,10 +4297,71 @@ var ExpressionClient = class {
|
|
|
4123
4297
|
} catch (e) {
|
|
4124
4298
|
}
|
|
4125
4299
|
}
|
|
4126
|
-
|
|
4300
|
+
if (!alwaysGet) {
|
|
4301
|
+
const memHit = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(url);
|
|
4302
|
+
if (memHit)
|
|
4303
|
+
return memHit.data;
|
|
4304
|
+
}
|
|
4305
|
+
if (!alwaysGet) {
|
|
4306
|
+
const existing = __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").get(url);
|
|
4307
|
+
if (existing)
|
|
4308
|
+
return existing;
|
|
4309
|
+
}
|
|
4310
|
+
const promise = (async () => {
|
|
4311
|
+
if (!alwaysGet) {
|
|
4312
|
+
const persisted = await __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(url);
|
|
4313
|
+
if (persisted) {
|
|
4314
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, persisted);
|
|
4315
|
+
return persisted;
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call("expression.get", { url });
|
|
4319
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, result);
|
|
4320
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(url, result);
|
|
4321
|
+
return result;
|
|
4322
|
+
})();
|
|
4323
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").set(url, promise);
|
|
4324
|
+
try {
|
|
4325
|
+
return await promise;
|
|
4326
|
+
} finally {
|
|
4327
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
|
|
4328
|
+
}
|
|
4127
4329
|
}
|
|
4128
4330
|
async getMany(urls) {
|
|
4129
|
-
|
|
4331
|
+
const results = urls.map((u) => __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(u)?.data ?? null);
|
|
4332
|
+
let uncachedIndices = results.map((r, i) => r === null ? i : -1).filter((i) => i >= 0);
|
|
4333
|
+
if (uncachedIndices.length === 0)
|
|
4334
|
+
return results;
|
|
4335
|
+
const l2Results = await Promise.all(uncachedIndices.map((i) => __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(urls[i])));
|
|
4336
|
+
const stillMissing = [];
|
|
4337
|
+
for (let j = 0; j < uncachedIndices.length; j++) {
|
|
4338
|
+
const idx = uncachedIndices[j];
|
|
4339
|
+
if (l2Results[j]) {
|
|
4340
|
+
results[idx] = l2Results[j];
|
|
4341
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, urls[idx], l2Results[j]);
|
|
4342
|
+
} else {
|
|
4343
|
+
stillMissing.push(idx);
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
if (stillMissing.length === 0)
|
|
4347
|
+
return results;
|
|
4348
|
+
const uncachedUrls = stillMissing.map((i) => urls[i]);
|
|
4349
|
+
const fetched = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call("expression.getMany", { urls: uncachedUrls });
|
|
4350
|
+
for (let i = 0; i < stillMissing.length; i++) {
|
|
4351
|
+
const idx = stillMissing[i];
|
|
4352
|
+
results[idx] = fetched[i];
|
|
4353
|
+
if (fetched[i]) {
|
|
4354
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, uncachedUrls[i], fetched[i]);
|
|
4355
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(uncachedUrls[i], fetched[i]);
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
return results;
|
|
4359
|
+
}
|
|
4360
|
+
clearCache() {
|
|
4361
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").clear();
|
|
4362
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").clear();
|
|
4363
|
+
__classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, 0, "f");
|
|
4364
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").clear();
|
|
4130
4365
|
}
|
|
4131
4366
|
async getRaw(url) {
|
|
4132
4367
|
return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call("expression.get", { url, raw: true });
|
|
@@ -4139,10 +4374,28 @@ var ExpressionClient = class {
|
|
|
4139
4374
|
return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call("expression.interactions", { url });
|
|
4140
4375
|
}
|
|
4141
4376
|
async interact(url, interactionCall) {
|
|
4142
|
-
|
|
4377
|
+
const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call("expression.interact", { url, interactionCall });
|
|
4378
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(url);
|
|
4379
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
|
|
4380
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").delete(url);
|
|
4381
|
+
return result;
|
|
4143
4382
|
}
|
|
4144
4383
|
};
|
|
4145
|
-
_ExpressionClient_apiClient = /* @__PURE__ */ new WeakMap()
|
|
4384
|
+
_ExpressionClient_apiClient = /* @__PURE__ */ new WeakMap(), _ExpressionClient_memCache = /* @__PURE__ */ new WeakMap(), _ExpressionClient_inflight = /* @__PURE__ */ new WeakMap(), _ExpressionClient_totalMemBytes = /* @__PURE__ */ new WeakMap(), _ExpressionClient_persistent = /* @__PURE__ */ new WeakMap(), _ExpressionClient_instances = /* @__PURE__ */ new WeakSet(), _ExpressionClient_memCacheResult = function _ExpressionClient_memCacheResult2(url, data) {
|
|
4385
|
+
const size = JSON.stringify(data).length;
|
|
4386
|
+
while (__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").size >= ExpressionClient.MAX_MEM_ENTRIES || __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size > ExpressionClient.MAX_MEM_BYTES) {
|
|
4387
|
+
const oldest = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").keys().next().value;
|
|
4388
|
+
if (!oldest)
|
|
4389
|
+
break;
|
|
4390
|
+
const entry = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(oldest);
|
|
4391
|
+
__classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") - entry.size, "f");
|
|
4392
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(oldest);
|
|
4393
|
+
}
|
|
4394
|
+
__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").set(url, { data, size });
|
|
4395
|
+
__classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size, "f");
|
|
4396
|
+
};
|
|
4397
|
+
ExpressionClient.MAX_MEM_ENTRIES = 200;
|
|
4398
|
+
ExpressionClient.MAX_MEM_BYTES = 5 * 1024 * 1024;
|
|
4146
4399
|
var base64Js = {};
|
|
4147
4400
|
base64Js.byteLength = byteLength;
|
|
4148
4401
|
base64Js.toByteArray = toByteArray;
|
|
@@ -9093,7 +9346,11 @@ var ModelQueryBuilder = class {
|
|
|
9093
9346
|
const parseResults = (raw) => {
|
|
9094
9347
|
return ctor.parseModelResult(this.perspective, raw, this.queryParams.include, this.queryParams.properties);
|
|
9095
9348
|
};
|
|
9096
|
-
const
|
|
9349
|
+
const resolveAndReturn = async (instances) => {
|
|
9350
|
+
await ctor.resolveNonLiteralProps(this.perspective, instances);
|
|
9351
|
+
return instances;
|
|
9352
|
+
};
|
|
9353
|
+
const initialResults = await resolveAndReturn(parseResults(initialModelResult));
|
|
9097
9354
|
let lastResultFingerprint = null;
|
|
9098
9355
|
const buildFingerprint = (results) => {
|
|
9099
9356
|
if (results.length === 0)
|
|
@@ -9102,15 +9359,16 @@ var ModelQueryBuilder = class {
|
|
|
9102
9359
|
};
|
|
9103
9360
|
lastResultFingerprint = buildFingerprint(initialResults);
|
|
9104
9361
|
const unsubscribe = this.perspective.client.subscribeToQueryUpdates(subscriptionId, (rawResult) => {
|
|
9105
|
-
if (rawResult && rawResult.isInit)
|
|
9106
|
-
return;
|
|
9107
9362
|
try {
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9363
|
+
resolveAndReturn(parseResults(rawResult)).then((results) => {
|
|
9364
|
+
const fp = buildFingerprint(results);
|
|
9365
|
+
if (fp === lastResultFingerprint)
|
|
9366
|
+
return;
|
|
9367
|
+
lastResultFingerprint = fp;
|
|
9368
|
+
callback(results);
|
|
9369
|
+
}).catch((e) => {
|
|
9370
|
+
console.error("Model subscription update resolve error:", e);
|
|
9371
|
+
});
|
|
9114
9372
|
} catch (e) {
|
|
9115
9373
|
console.error("Model subscription update parse error:", e);
|
|
9116
9374
|
}
|
|
@@ -9158,8 +9416,6 @@ var ModelQueryBuilder = class {
|
|
|
9158
9416
|
};
|
|
9159
9417
|
const initialCount = parseCount(initialModelResult);
|
|
9160
9418
|
const unsubscribe = this.perspective.client.subscribeToQueryUpdates(subscriptionId, (rawResult) => {
|
|
9161
|
-
if (rawResult && rawResult.isInit)
|
|
9162
|
-
return;
|
|
9163
9419
|
try {
|
|
9164
9420
|
callback(parseCount(rawResult));
|
|
9165
9421
|
} catch (e) {
|
|
@@ -9215,8 +9471,6 @@ var ModelQueryBuilder = class {
|
|
|
9215
9471
|
callback({ results: results2, totalCount: totalCount2, pageSize, pageNumber });
|
|
9216
9472
|
};
|
|
9217
9473
|
const unsubscribe = this.perspective.client.subscribeToQueryUpdates(subscriptionId, (rawResult) => {
|
|
9218
|
-
if (rawResult && rawResult.isInit)
|
|
9219
|
-
return;
|
|
9220
9474
|
processResults().catch((e) => console.error("Paginate subscription error:", e));
|
|
9221
9475
|
});
|
|
9222
9476
|
let keepaliveFailures = 0;
|
|
@@ -9249,6 +9503,27 @@ function normalizeValue(value) {
|
|
|
9249
9503
|
}
|
|
9250
9504
|
return value;
|
|
9251
9505
|
}
|
|
9506
|
+
function defaultFileDecode(resolved) {
|
|
9507
|
+
if (resolved !== null && typeof resolved === "object" && "data_base64" in resolved) {
|
|
9508
|
+
const fd = resolved;
|
|
9509
|
+
let raw;
|
|
9510
|
+
try {
|
|
9511
|
+
raw = atob(fd.data_base64);
|
|
9512
|
+
} catch {
|
|
9513
|
+
return resolved;
|
|
9514
|
+
}
|
|
9515
|
+
const isJson = !fd.file_type || fd.file_type === "application/json";
|
|
9516
|
+
if (isJson) {
|
|
9517
|
+
try {
|
|
9518
|
+
return JSON.parse(raw);
|
|
9519
|
+
} catch {
|
|
9520
|
+
return raw;
|
|
9521
|
+
}
|
|
9522
|
+
}
|
|
9523
|
+
return raw;
|
|
9524
|
+
}
|
|
9525
|
+
return resolved;
|
|
9526
|
+
}
|
|
9252
9527
|
function enrichShapeForIncludes(metadata, include, allRelMeta) {
|
|
9253
9528
|
for (const [relName, includeVal] of Object.entries(include)) {
|
|
9254
9529
|
if (!includeVal)
|
|
@@ -9662,38 +9937,30 @@ var Ad4mModel = class {
|
|
|
9662
9937
|
try {
|
|
9663
9938
|
const TargetClass = meta.target();
|
|
9664
9939
|
const filter = buildConformanceFilter(meta.predicate, TargetClass);
|
|
9665
|
-
|
|
9940
|
+
if (filter) {
|
|
9941
|
+
rel.getter = filter.getter;
|
|
9942
|
+
}
|
|
9666
9943
|
if (rel.where) {
|
|
9667
9944
|
try {
|
|
9668
9945
|
const targetMetadata = TargetClass.getModelMetadata?.() ?? null;
|
|
9669
|
-
let allSparqlFilterable = true;
|
|
9670
9946
|
if (targetMetadata) {
|
|
9947
|
+
const predicates = {};
|
|
9671
9948
|
for (const propName of Object.keys(rel.where)) {
|
|
9672
9949
|
if (["id", "author", "timestamp"].includes(propName))
|
|
9673
9950
|
continue;
|
|
9674
9951
|
const propMeta = targetMetadata.properties[propName];
|
|
9675
|
-
if (propMeta?.
|
|
9676
|
-
|
|
9677
|
-
break;
|
|
9952
|
+
if (propMeta?.predicate) {
|
|
9953
|
+
predicates[propName] = propMeta.predicate;
|
|
9678
9954
|
}
|
|
9679
9955
|
}
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9956
|
+
if (Object.keys(predicates).length > 0) {
|
|
9957
|
+
rel.whereFilter = rel.where;
|
|
9958
|
+
rel.wherePredicates = predicates;
|
|
9959
|
+
}
|
|
9683
9960
|
}
|
|
9684
9961
|
} catch (_) {
|
|
9685
9962
|
}
|
|
9686
9963
|
}
|
|
9687
|
-
if (filter) {
|
|
9688
|
-
let getter = filter.getter;
|
|
9689
|
-
if (whereConditions.length > 0) {
|
|
9690
|
-
getter = getter.replace(/ \}$/, ` ${whereConditions.join(" ")} }`);
|
|
9691
|
-
}
|
|
9692
|
-
rel.getter = getter;
|
|
9693
|
-
} else if (whereConditions.length > 0) {
|
|
9694
|
-
const escapedPred = meta.predicate.replace(/[<>"{}|\\^`\u0000-\u0020]/g, "");
|
|
9695
|
-
rel.getter = `SELECT ?target WHERE { <Base> <${escapedPred}> ?target . ${whereConditions.join(" ")} }`;
|
|
9696
|
-
}
|
|
9697
9964
|
} catch (_) {
|
|
9698
9965
|
}
|
|
9699
9966
|
}
|
|
@@ -9711,6 +9978,36 @@ var Ad4mModel = class {
|
|
|
9711
9978
|
return [];
|
|
9712
9979
|
return arr.map((json) => jsonToModelInstance(this, perspective, json, include, properties));
|
|
9713
9980
|
}
|
|
9981
|
+
static async resolveNonLiteralProps(perspective, instances) {
|
|
9982
|
+
const propsMeta = getPropertiesMetadata(this);
|
|
9983
|
+
const resolveProps = Object.entries(propsMeta).filter(([, opts]) => opts.resolveLanguage != null && opts.resolveLanguage !== "literal");
|
|
9984
|
+
if (resolveProps.length === 0)
|
|
9985
|
+
return;
|
|
9986
|
+
await Promise.all(instances.map(async (inst) => {
|
|
9987
|
+
for (const [propName, opts] of resolveProps) {
|
|
9988
|
+
const val = inst[propName];
|
|
9989
|
+
const transform = opts.transform;
|
|
9990
|
+
const applyTransform = (resolved) => typeof transform === "function" ? transform(resolved) : defaultFileDecode(resolved);
|
|
9991
|
+
if (typeof val === "string" && val && !val.startsWith("literal:")) {
|
|
9992
|
+
try {
|
|
9993
|
+
const expression = await perspective.getExpression(val);
|
|
9994
|
+
if (expression) {
|
|
9995
|
+
let resolved;
|
|
9996
|
+
try {
|
|
9997
|
+
resolved = JSON.parse(expression.data);
|
|
9998
|
+
} catch {
|
|
9999
|
+
resolved = expression.data;
|
|
10000
|
+
}
|
|
10001
|
+
inst[propName] = applyTransform(resolved);
|
|
10002
|
+
}
|
|
10003
|
+
} catch (_) {
|
|
10004
|
+
}
|
|
10005
|
+
} else if (val !== null && val !== void 0 && typeof val === "object") {
|
|
10006
|
+
inst[propName] = applyTransform(val);
|
|
10007
|
+
}
|
|
10008
|
+
}
|
|
10009
|
+
}));
|
|
10010
|
+
}
|
|
9714
10011
|
static async executeModelQuery(perspective, query = {}, classNameOverride) {
|
|
9715
10012
|
const metadata = this.getModelMetadata();
|
|
9716
10013
|
const className = classNameOverride || metadata.className;
|
|
@@ -9793,79 +10090,41 @@ var Ad4mModel = class {
|
|
|
9793
10090
|
try {
|
|
9794
10091
|
const TargetClass = meta.target();
|
|
9795
10092
|
const filter = buildConformanceFilter(meta.predicate, TargetClass);
|
|
9796
|
-
|
|
10093
|
+
if (filter) {
|
|
10094
|
+
rel.getter = filter.getter;
|
|
10095
|
+
}
|
|
9797
10096
|
if (rel.where) {
|
|
9798
10097
|
try {
|
|
9799
10098
|
const targetMetadata = TargetClass.getModelMetadata?.() ?? null;
|
|
9800
|
-
let allSparqlFilterable = true;
|
|
9801
10099
|
if (targetMetadata) {
|
|
10100
|
+
const predicates = {};
|
|
9802
10101
|
for (const propName of Object.keys(rel.where)) {
|
|
9803
10102
|
if (["id", "author", "timestamp"].includes(propName))
|
|
9804
10103
|
continue;
|
|
9805
10104
|
const propMeta = targetMetadata.properties[propName];
|
|
9806
|
-
if (propMeta?.
|
|
9807
|
-
|
|
9808
|
-
break;
|
|
10105
|
+
if (propMeta?.predicate) {
|
|
10106
|
+
predicates[propName] = propMeta.predicate;
|
|
9809
10107
|
}
|
|
9810
10108
|
}
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
10109
|
+
if (Object.keys(predicates).length > 0) {
|
|
10110
|
+
rel.whereFilter = rel.where;
|
|
10111
|
+
rel.wherePredicates = predicates;
|
|
10112
|
+
}
|
|
9814
10113
|
}
|
|
9815
10114
|
} catch (_) {
|
|
9816
10115
|
}
|
|
9817
10116
|
}
|
|
9818
|
-
if (filter) {
|
|
9819
|
-
let getter = filter.getter;
|
|
9820
|
-
if (whereConditions.length > 0) {
|
|
9821
|
-
getter = getter.replace(/ \}$/, ` ${whereConditions.join(" ")} }`);
|
|
9822
|
-
}
|
|
9823
|
-
rel.getter = getter;
|
|
9824
|
-
} else if (whereConditions.length > 0) {
|
|
9825
|
-
const escapedPred = meta.predicate.replace(/[<>"{}|\\^`\u0000-\u0020]/g, "");
|
|
9826
|
-
rel.getter = `SELECT ?target WHERE { <Base> <${escapedPred}> ?target . ${whereConditions.join(" ")} }`;
|
|
9827
|
-
}
|
|
9828
10117
|
} catch (e) {
|
|
9829
10118
|
}
|
|
9830
10119
|
}
|
|
9831
10120
|
}
|
|
9832
10121
|
const shapeJson = JSON.stringify(metadata);
|
|
9833
10122
|
const queryJson = JSON.stringify(queryInput);
|
|
9834
|
-
for (const [relName, relMeta] of Object.entries(metadata.relations)) {
|
|
9835
|
-
const rel = relMeta;
|
|
9836
|
-
if (rel.where) {
|
|
9837
|
-
console.log(`[MODEL_QUERY_DEBUG] relation="${relName}" getter=${rel.getter ?? "NONE"} where=${JSON.stringify(rel.where)}`);
|
|
9838
|
-
}
|
|
9839
|
-
}
|
|
9840
10123
|
const result = await perspective.modelQuery(className, queryJson, shapeJson);
|
|
9841
10124
|
const instances = result.instances.map((json) => {
|
|
9842
10125
|
return jsonToModelInstance(this, perspective, json, query.include, query.properties);
|
|
9843
10126
|
});
|
|
9844
|
-
|
|
9845
|
-
const resolveProps = Object.entries(propsMeta).filter(([, opts]) => opts.resolveLanguage != null && opts.resolveLanguage !== "literal");
|
|
9846
|
-
if (resolveProps.length > 0) {
|
|
9847
|
-
await Promise.all(instances.map(async (inst) => {
|
|
9848
|
-
for (const [propName, opts] of resolveProps) {
|
|
9849
|
-
const val = inst[propName];
|
|
9850
|
-
if (typeof val !== "string" || !val || val.startsWith("literal:"))
|
|
9851
|
-
continue;
|
|
9852
|
-
try {
|
|
9853
|
-
const expression = await perspective.getExpression(val);
|
|
9854
|
-
if (expression) {
|
|
9855
|
-
let resolved;
|
|
9856
|
-
try {
|
|
9857
|
-
resolved = JSON.parse(expression.data);
|
|
9858
|
-
} catch {
|
|
9859
|
-
resolved = expression.data;
|
|
9860
|
-
}
|
|
9861
|
-
const transform = opts.transform;
|
|
9862
|
-
inst[propName] = typeof transform === "function" ? transform(resolved) : resolved;
|
|
9863
|
-
}
|
|
9864
|
-
} catch (_) {
|
|
9865
|
-
}
|
|
9866
|
-
}
|
|
9867
|
-
}));
|
|
9868
|
-
}
|
|
10127
|
+
await this.resolveNonLiteralProps(perspective, instances);
|
|
9869
10128
|
const snapshotRelations = queryInput.include;
|
|
9870
10129
|
for (const inst of instances) {
|
|
9871
10130
|
inst.takeSnapshot(snapshotRelations);
|
|
@@ -10390,6 +10649,7 @@ var Ad4mClient = class {
|
|
|
10390
10649
|
__classPrivateFieldGet$1(this, _Ad4mClient_agentClient, "f").subscribeAppsChanged();
|
|
10391
10650
|
}
|
|
10392
10651
|
close() {
|
|
10652
|
+
__classPrivateFieldGet$1(this, _Ad4mClient_agentClient, "f").clearByDidCache();
|
|
10393
10653
|
__classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f").closeAll();
|
|
10394
10654
|
}
|
|
10395
10655
|
};
|