@coasys/ad4m-connect 0.13.1-staging.6 → 0.13.1-staging.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 +908 -628
- package/dist/core.js.map +2 -2
- package/dist/index.js +908 -628
- package/dist/index.js.map +3 -3
- package/dist/utils.js +1 -1
- package/dist/web.js +435 -255
- package/dist/web.js.map +3 -3
- package/package.json +3 -3
package/dist/core.js
CHANGED
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// ../package.json
|
|
42
|
-
var version = "0.13.1-staging.
|
|
42
|
+
var version = "0.13.1-staging.7";
|
|
43
43
|
|
|
44
44
|
// src/utils.ts
|
|
45
45
|
function isEmbedded() {
|
|
@@ -281,6 +281,12 @@ var READ_METHODS = /* @__PURE__ */ new Set([
|
|
|
281
281
|
"hosting.info",
|
|
282
282
|
"hosting.wallet",
|
|
283
283
|
"hosting.walletHistory",
|
|
284
|
+
"identity.devices",
|
|
285
|
+
"identity.joinStatus",
|
|
286
|
+
"identity.log",
|
|
287
|
+
"identity.offers",
|
|
288
|
+
"identity.resolve",
|
|
289
|
+
"identity.status",
|
|
284
290
|
"language.all",
|
|
285
291
|
"language.get",
|
|
286
292
|
"language.meta",
|
|
@@ -371,6 +377,7 @@ var MAX_WATCH_RETRIES = 5;
|
|
|
371
377
|
var PING_INTERVAL_MS = 1e4;
|
|
372
378
|
var SLOWEST_LINK_BYTES_PER_MS = 16;
|
|
373
379
|
var PONG_RETURN_MS = 5e3;
|
|
380
|
+
var CHECK_CONNECTION_DEADLINE_MS = 2e3;
|
|
374
381
|
function utf8Length(text) {
|
|
375
382
|
let bytes = text.length;
|
|
376
383
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -404,12 +411,17 @@ var ApiClient = class {
|
|
|
404
411
|
this._wsPingedAt = null;
|
|
405
412
|
this._wsPingArrivesBy = 0;
|
|
406
413
|
this._wsSentBy = 0;
|
|
414
|
+
this._wsProbeTimer = null;
|
|
407
415
|
this._watching = "{}";
|
|
408
416
|
this._watchScheduled = false;
|
|
409
417
|
this._watchDone = Promise.resolve();
|
|
410
418
|
this._watchSent = Promise.resolve();
|
|
411
419
|
this._watchRetries = 0;
|
|
412
420
|
this._watchRetryTimer = null;
|
|
421
|
+
this._networkCallbacks = /* @__PURE__ */ new Set();
|
|
422
|
+
this._unlistenNetwork = null;
|
|
423
|
+
this._networkChanged = false;
|
|
424
|
+
this._networkDial = null;
|
|
413
425
|
this._wakeListening = false;
|
|
414
426
|
this._onWake = (event) => {
|
|
415
427
|
if (event.type === "visibilitychange" && typeof document !== "undefined" && document.visibilityState !== "visible")
|
|
@@ -440,6 +452,7 @@ var ApiClient = class {
|
|
|
440
452
|
return;
|
|
441
453
|
if (this._authFailed !== null)
|
|
442
454
|
throw new RpcError(401, this._authFailed);
|
|
455
|
+
this._listenForNetworkChanges();
|
|
443
456
|
this._cancelReconnect();
|
|
444
457
|
const WsImpl = this._webSocketImpl ?? globalThis.WebSocket;
|
|
445
458
|
const ws = new WsImpl(this._getWsUrl());
|
|
@@ -461,8 +474,10 @@ var ApiClient = class {
|
|
|
461
474
|
this._wsOpen.catch(() => {
|
|
462
475
|
});
|
|
463
476
|
ws.onmessage = (event) => {
|
|
464
|
-
if (this._ws === ws)
|
|
477
|
+
if (this._ws === ws) {
|
|
465
478
|
this._wsPingedAt = null;
|
|
479
|
+
this._endProbe();
|
|
480
|
+
}
|
|
466
481
|
let parsed;
|
|
467
482
|
try {
|
|
468
483
|
parsed = JSON.parse(event.data);
|
|
@@ -525,6 +540,56 @@ var ApiClient = class {
|
|
|
525
540
|
}
|
|
526
541
|
}
|
|
527
542
|
this._hasConnectedOnce = true;
|
|
543
|
+
if (this._networkChanged) {
|
|
544
|
+
this._networkChanged = false;
|
|
545
|
+
this._notifyNetworkChange();
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
_listenForNetworkChanges() {
|
|
549
|
+
if (this._unlistenNetwork)
|
|
550
|
+
return;
|
|
551
|
+
const handler = () => this._onNetworkChange();
|
|
552
|
+
const removers = [];
|
|
553
|
+
const target = globalThis;
|
|
554
|
+
if (typeof target.addEventListener === "function") {
|
|
555
|
+
target.addEventListener("online", handler);
|
|
556
|
+
removers.push(() => target.removeEventListener?.("online", handler));
|
|
557
|
+
}
|
|
558
|
+
const connection = globalThis.navigator?.connection;
|
|
559
|
+
if (typeof connection?.addEventListener === "function") {
|
|
560
|
+
const probe = () => this.checkConnection();
|
|
561
|
+
connection.addEventListener("change", probe);
|
|
562
|
+
removers.push(() => connection.removeEventListener?.("change", probe));
|
|
563
|
+
}
|
|
564
|
+
this._unlistenNetwork = () => {
|
|
565
|
+
for (const remove of removers)
|
|
566
|
+
remove();
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
_onNetworkChange() {
|
|
570
|
+
if (this._authFailed !== null)
|
|
571
|
+
return;
|
|
572
|
+
const ws = this._ws;
|
|
573
|
+
if (ws && ws === this._networkDial && ws.readyState === 0)
|
|
574
|
+
return;
|
|
575
|
+
if (ws) {
|
|
576
|
+
console.info("Network changed; reconnecting the WebSocket");
|
|
577
|
+
this._onClose(ws);
|
|
578
|
+
ws.close();
|
|
579
|
+
}
|
|
580
|
+
this._cancelReconnect();
|
|
581
|
+
this._wsReconnectDelay = INITIAL_RECONNECT_DELAY_MS;
|
|
582
|
+
if (this._handlers.size === 0 && this._pendingCalls.size === 0) {
|
|
583
|
+
this._notifyNetworkChange();
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
this._networkChanged = true;
|
|
587
|
+
this._ensureWs();
|
|
588
|
+
this._networkDial = this._ws;
|
|
589
|
+
}
|
|
590
|
+
_notifyNetworkChange() {
|
|
591
|
+
for (const cb of [...this._networkCallbacks])
|
|
592
|
+
callSafely(cb, "Error in network-change callback:");
|
|
528
593
|
}
|
|
529
594
|
_onClose(ws, reason) {
|
|
530
595
|
if (this._ws !== ws)
|
|
@@ -563,6 +628,8 @@ var ApiClient = class {
|
|
|
563
628
|
this._wsPingTimer = setInterval(() => {
|
|
564
629
|
if (this._ws !== ws)
|
|
565
630
|
return;
|
|
631
|
+
if (this._wsProbeTimer)
|
|
632
|
+
return;
|
|
566
633
|
const ping = JSON.stringify({ type: "ping" });
|
|
567
634
|
if (this._wsPingedAt === null) {
|
|
568
635
|
this._wsPingedAt = performance.now();
|
|
@@ -592,6 +659,13 @@ var ApiClient = class {
|
|
|
592
659
|
clearInterval(this._wsPingTimer);
|
|
593
660
|
this._wsPingTimer = null;
|
|
594
661
|
}
|
|
662
|
+
this._endProbe();
|
|
663
|
+
}
|
|
664
|
+
_endProbe() {
|
|
665
|
+
if (this._wsProbeTimer) {
|
|
666
|
+
clearTimeout(this._wsProbeTimer);
|
|
667
|
+
this._wsProbeTimer = null;
|
|
668
|
+
}
|
|
595
669
|
}
|
|
596
670
|
_scheduleReconnect() {
|
|
597
671
|
if (this._wsReconnectTimer || this._authFailed !== null)
|
|
@@ -799,6 +873,32 @@ var ApiClient = class {
|
|
|
799
873
|
this._reconnectCallbacks.delete(callback);
|
|
800
874
|
};
|
|
801
875
|
}
|
|
876
|
+
onNetworkChange(callback) {
|
|
877
|
+
this._networkCallbacks.add(callback);
|
|
878
|
+
this._listenForNetworkChanges();
|
|
879
|
+
return () => {
|
|
880
|
+
this._networkCallbacks.delete(callback);
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
checkConnection(deadlineMs = CHECK_CONNECTION_DEADLINE_MS) {
|
|
884
|
+
const ws = this._ws;
|
|
885
|
+
if (!ws || ws.readyState !== 1 || this._wsProbeTimer)
|
|
886
|
+
return;
|
|
887
|
+
const first = this._wsPingedAt === null;
|
|
888
|
+
if (first)
|
|
889
|
+
this._wsPingedAt = performance.now();
|
|
890
|
+
this._send(ws, JSON.stringify({ type: "ping" }));
|
|
891
|
+
if (first)
|
|
892
|
+
this._wsPingArrivesBy = this._wsSentBy;
|
|
893
|
+
const wait = Math.max(deadlineMs, this._wsSentBy - performance.now() + deadlineMs / 2);
|
|
894
|
+
this._wsProbeTimer = setTimeout(() => {
|
|
895
|
+
this._wsProbeTimer = null;
|
|
896
|
+
if (this._ws !== ws)
|
|
897
|
+
return;
|
|
898
|
+
console.warn(`WebSocket silent for ${wait} ms after a check; reconnecting`);
|
|
899
|
+
this._onNetworkChange();
|
|
900
|
+
}, wait);
|
|
901
|
+
}
|
|
802
902
|
onAuthFailed(callback) {
|
|
803
903
|
this._authFailedCallbacks.add(callback);
|
|
804
904
|
return () => {
|
|
@@ -813,6 +913,11 @@ var ApiClient = class {
|
|
|
813
913
|
this._handlers.clear();
|
|
814
914
|
this._reconnectCallbacks.clear();
|
|
815
915
|
this._authFailedCallbacks.clear();
|
|
916
|
+
this._networkCallbacks.clear();
|
|
917
|
+
this._unlistenNetwork?.();
|
|
918
|
+
this._unlistenNetwork = null;
|
|
919
|
+
this._networkChanged = false;
|
|
920
|
+
this._networkDial = null;
|
|
816
921
|
this._hasConnectedOnce = false;
|
|
817
922
|
}
|
|
818
923
|
};
|
|
@@ -975,6 +1080,9 @@ var Agent = class {
|
|
|
975
1080
|
static fromWire(wire) {
|
|
976
1081
|
const agent = new Agent(wire.did, Perspective.fromWire(wire.perspective));
|
|
977
1082
|
agent.directMessageLanguage = wire.directMessageLanguage;
|
|
1083
|
+
if ("identity" in wire && wire.identity) {
|
|
1084
|
+
agent.identity = wire.identity;
|
|
1085
|
+
}
|
|
978
1086
|
return agent;
|
|
979
1087
|
}
|
|
980
1088
|
};
|
|
@@ -1002,13 +1110,14 @@ var AgentStatus = class {
|
|
|
1002
1110
|
this.did = obj.did;
|
|
1003
1111
|
this.didDocument = obj.didDocument;
|
|
1004
1112
|
this.error = obj.error;
|
|
1113
|
+
this.identity = obj.identity ?? null;
|
|
1005
1114
|
} else {
|
|
1006
1115
|
this.isInitialized = false;
|
|
1007
1116
|
this.isUnlocked = false;
|
|
1008
1117
|
}
|
|
1009
1118
|
}
|
|
1010
1119
|
};
|
|
1011
|
-
var __classPrivateFieldSet$
|
|
1120
|
+
var __classPrivateFieldSet$e = function(receiver, state, value, kind, f) {
|
|
1012
1121
|
if (kind === "m")
|
|
1013
1122
|
throw new TypeError("Private method is not writable");
|
|
1014
1123
|
if (kind === "a" && !f)
|
|
@@ -1017,7 +1126,7 @@ var __classPrivateFieldSet$d = function(receiver, state, value, kind, f) {
|
|
|
1017
1126
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1018
1127
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1019
1128
|
};
|
|
1020
|
-
var __classPrivateFieldGet$
|
|
1129
|
+
var __classPrivateFieldGet$e = function(receiver, state, kind, f) {
|
|
1021
1130
|
if (kind === "a" && !f)
|
|
1022
1131
|
throw new TypeError("Private accessor was defined without a getter");
|
|
1023
1132
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -1037,15 +1146,15 @@ var IDBCache = class {
|
|
|
1037
1146
|
_IDBCache_storeName.set(this, void 0);
|
|
1038
1147
|
_IDBCache_dbPromise.set(this, null);
|
|
1039
1148
|
_IDBCache_version.set(this, 1);
|
|
1040
|
-
__classPrivateFieldSet$
|
|
1041
|
-
__classPrivateFieldSet$
|
|
1149
|
+
__classPrivateFieldSet$e(this, _IDBCache_dbName, dbName, "f");
|
|
1150
|
+
__classPrivateFieldSet$e(this, _IDBCache_storeName, storeName, "f");
|
|
1042
1151
|
}
|
|
1043
1152
|
async get(key) {
|
|
1044
1153
|
try {
|
|
1045
|
-
const db = await __classPrivateFieldGet$
|
|
1154
|
+
const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
1046
1155
|
return new Promise((resolve) => {
|
|
1047
|
-
const tx = db.transaction(__classPrivateFieldGet$
|
|
1048
|
-
const store = tx.objectStore(__classPrivateFieldGet$
|
|
1156
|
+
const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), "readonly");
|
|
1157
|
+
const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
|
|
1049
1158
|
const req = store.get(key);
|
|
1050
1159
|
req.onsuccess = () => resolve(req.result ?? void 0);
|
|
1051
1160
|
req.onerror = () => resolve(void 0);
|
|
@@ -1056,10 +1165,10 @@ var IDBCache = class {
|
|
|
1056
1165
|
}
|
|
1057
1166
|
async put(key, value) {
|
|
1058
1167
|
try {
|
|
1059
|
-
const db = await __classPrivateFieldGet$
|
|
1168
|
+
const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
1060
1169
|
return new Promise((resolve) => {
|
|
1061
|
-
const tx = db.transaction(__classPrivateFieldGet$
|
|
1062
|
-
const store = tx.objectStore(__classPrivateFieldGet$
|
|
1170
|
+
const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), "readwrite");
|
|
1171
|
+
const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
|
|
1063
1172
|
store.put(value, key);
|
|
1064
1173
|
tx.oncomplete = () => resolve();
|
|
1065
1174
|
tx.onerror = () => resolve();
|
|
@@ -1069,10 +1178,10 @@ var IDBCache = class {
|
|
|
1069
1178
|
}
|
|
1070
1179
|
async delete(key) {
|
|
1071
1180
|
try {
|
|
1072
|
-
const db = await __classPrivateFieldGet$
|
|
1181
|
+
const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
1073
1182
|
return new Promise((resolve) => {
|
|
1074
|
-
const tx = db.transaction(__classPrivateFieldGet$
|
|
1075
|
-
const store = tx.objectStore(__classPrivateFieldGet$
|
|
1183
|
+
const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), "readwrite");
|
|
1184
|
+
const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
|
|
1076
1185
|
store.delete(key);
|
|
1077
1186
|
tx.oncomplete = () => resolve();
|
|
1078
1187
|
tx.onerror = () => resolve();
|
|
@@ -1082,10 +1191,10 @@ var IDBCache = class {
|
|
|
1082
1191
|
}
|
|
1083
1192
|
async clear() {
|
|
1084
1193
|
try {
|
|
1085
|
-
const db = await __classPrivateFieldGet$
|
|
1194
|
+
const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
|
|
1086
1195
|
return new Promise((resolve) => {
|
|
1087
|
-
const tx = db.transaction(__classPrivateFieldGet$
|
|
1088
|
-
const store = tx.objectStore(__classPrivateFieldGet$
|
|
1196
|
+
const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), "readwrite");
|
|
1197
|
+
const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
|
|
1089
1198
|
store.clear();
|
|
1090
1199
|
tx.oncomplete = () => resolve();
|
|
1091
1200
|
tx.onerror = () => resolve();
|
|
@@ -1095,10 +1204,10 @@ var IDBCache = class {
|
|
|
1095
1204
|
}
|
|
1096
1205
|
};
|
|
1097
1206
|
_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() {
|
|
1098
|
-
if (!__classPrivateFieldGet$
|
|
1099
|
-
__classPrivateFieldSet$
|
|
1100
|
-
const storeName = __classPrivateFieldGet$
|
|
1101
|
-
const req = indexedDB.open(__classPrivateFieldGet$
|
|
1207
|
+
if (!__classPrivateFieldGet$e(this, _IDBCache_dbPromise, "f")) {
|
|
1208
|
+
__classPrivateFieldSet$e(this, _IDBCache_dbPromise, new Promise((resolve, reject) => {
|
|
1209
|
+
const storeName = __classPrivateFieldGet$e(this, _IDBCache_storeName, "f");
|
|
1210
|
+
const req = indexedDB.open(__classPrivateFieldGet$e(this, _IDBCache_dbName, "f"), __classPrivateFieldGet$e(this, _IDBCache_version, "f"));
|
|
1102
1211
|
req.onupgradeneeded = () => {
|
|
1103
1212
|
const db = req.result;
|
|
1104
1213
|
if (!db.objectStoreNames.contains(storeName)) {
|
|
@@ -1109,7 +1218,7 @@ _IDBCache_dbName = /* @__PURE__ */ new WeakMap(), _IDBCache_storeName = /* @__PU
|
|
|
1109
1218
|
req.onerror = () => reject(req.error);
|
|
1110
1219
|
}), "f");
|
|
1111
1220
|
}
|
|
1112
|
-
return __classPrivateFieldGet$
|
|
1221
|
+
return __classPrivateFieldGet$e(this, _IDBCache_dbPromise, "f");
|
|
1113
1222
|
};
|
|
1114
1223
|
var NullCache = class {
|
|
1115
1224
|
async get(_key) {
|
|
@@ -1131,7 +1240,7 @@ function createPersistentCache(dbName, storeName) {
|
|
|
1131
1240
|
}
|
|
1132
1241
|
return new NullCache();
|
|
1133
1242
|
}
|
|
1134
|
-
var __classPrivateFieldSet$
|
|
1243
|
+
var __classPrivateFieldSet$d = function(receiver, state, value, kind, f) {
|
|
1135
1244
|
if (kind === "m")
|
|
1136
1245
|
throw new TypeError("Private method is not writable");
|
|
1137
1246
|
if (kind === "a" && !f)
|
|
@@ -1140,7 +1249,7 @@ var __classPrivateFieldSet$c = function(receiver, state, value, kind, f) {
|
|
|
1140
1249
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1141
1250
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1142
1251
|
};
|
|
1143
|
-
var __classPrivateFieldGet$
|
|
1252
|
+
var __classPrivateFieldGet$d = function(receiver, state, kind, f) {
|
|
1144
1253
|
if (kind === "a" && !f)
|
|
1145
1254
|
throw new TypeError("Private accessor was defined without a getter");
|
|
1146
1255
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -1167,74 +1276,74 @@ var AgentClient = class {
|
|
|
1167
1276
|
_AgentClient_persistent.set(this, void 0);
|
|
1168
1277
|
_AgentClient_selfDid.set(this, null);
|
|
1169
1278
|
_AgentClient_onAgentUpdated.set(this, (event) => {
|
|
1170
|
-
__classPrivateFieldGet$
|
|
1279
|
+
__classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, Agent.fromWire(event.agent));
|
|
1171
1280
|
});
|
|
1172
|
-
__classPrivateFieldSet$
|
|
1173
|
-
__classPrivateFieldSet$
|
|
1281
|
+
__classPrivateFieldSet$d(this, _AgentClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
1282
|
+
__classPrivateFieldSet$d(this, _AgentClient_persistent, createPersistentCache("ad4m-agent-cache", "agents"), "f");
|
|
1174
1283
|
}
|
|
1175
1284
|
async me() {
|
|
1176
|
-
const agentObject = toAgent(await __classPrivateFieldGet$
|
|
1177
|
-
if (agentObject.did && !__classPrivateFieldGet$
|
|
1178
|
-
__classPrivateFieldSet$
|
|
1285
|
+
const agentObject = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.get", {}));
|
|
1286
|
+
if (agentObject.did && !__classPrivateFieldGet$d(this, _AgentClient_selfDid, "f")) {
|
|
1287
|
+
__classPrivateFieldSet$d(this, _AgentClient_selfDid, agentObject.did, "f");
|
|
1179
1288
|
}
|
|
1180
1289
|
return agentObject;
|
|
1181
1290
|
}
|
|
1182
1291
|
async status() {
|
|
1183
|
-
const agentStatus = await __classPrivateFieldGet$
|
|
1292
|
+
const agentStatus = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.status", {});
|
|
1184
1293
|
return new AgentStatus(agentStatus);
|
|
1185
1294
|
}
|
|
1186
1295
|
async generate(passphrase, options) {
|
|
1187
|
-
const result = await __classPrivateFieldGet$
|
|
1296
|
+
const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.generate", { passphrase }, options);
|
|
1188
1297
|
return new AgentStatus(result);
|
|
1189
1298
|
}
|
|
1190
1299
|
async import(args) {
|
|
1191
|
-
const result = await __classPrivateFieldGet$
|
|
1300
|
+
const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.import", { ...args });
|
|
1192
1301
|
return new AgentStatus(result);
|
|
1193
1302
|
}
|
|
1194
1303
|
async lock(passphrase) {
|
|
1195
|
-
const result = await __classPrivateFieldGet$
|
|
1304
|
+
const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.lock", { passphrase });
|
|
1196
1305
|
return new AgentStatus(result);
|
|
1197
1306
|
}
|
|
1198
1307
|
async unlock(passphrase, holochain = true, options) {
|
|
1199
|
-
const result = await __classPrivateFieldGet$
|
|
1308
|
+
const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.unlock", { passphrase, holochain }, options);
|
|
1200
1309
|
return new AgentStatus(result);
|
|
1201
1310
|
}
|
|
1202
1311
|
async byDID(did) {
|
|
1203
|
-
__classPrivateFieldGet$
|
|
1312
|
+
__classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
|
|
1204
1313
|
const now = Date.now();
|
|
1205
|
-
const cached = __classPrivateFieldGet$
|
|
1314
|
+
const cached = __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").get(did);
|
|
1206
1315
|
if (cached) {
|
|
1207
|
-
const isSelf = did === __classPrivateFieldGet$
|
|
1316
|
+
const isSelf = did === __classPrivateFieldGet$d(this, _AgentClient_selfDid, "f");
|
|
1208
1317
|
if (isSelf || now - cached.ts < AgentClient.REMOTE_AGENT_TTL_MS) {
|
|
1209
1318
|
return cached.promise;
|
|
1210
1319
|
}
|
|
1211
1320
|
}
|
|
1212
1321
|
const promise = (async () => {
|
|
1213
|
-
const entry = await __classPrivateFieldGet$
|
|
1322
|
+
const entry = await __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").get(did);
|
|
1214
1323
|
if (entry?.agent && now - (entry.ts ?? 0) < AgentClient.REMOTE_AGENT_TTL_L2_MS) {
|
|
1215
1324
|
return entry.agent;
|
|
1216
1325
|
}
|
|
1217
|
-
const result = toAgent(await __classPrivateFieldGet$
|
|
1218
|
-
__classPrivateFieldGet$
|
|
1326
|
+
const result = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.byDid", { did }));
|
|
1327
|
+
__classPrivateFieldGet$d(this, _AgentClient_persistent, "f").put(did, { agent: result, ts: Date.now() });
|
|
1219
1328
|
return result;
|
|
1220
1329
|
})();
|
|
1221
|
-
__classPrivateFieldGet$
|
|
1330
|
+
__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").set(did, { promise, ts: now });
|
|
1222
1331
|
promise.catch(() => {
|
|
1223
|
-
if (__classPrivateFieldGet$
|
|
1224
|
-
__classPrivateFieldGet$
|
|
1332
|
+
if (__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").get(did)?.promise === promise) {
|
|
1333
|
+
__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").delete(did);
|
|
1225
1334
|
}
|
|
1226
1335
|
});
|
|
1227
1336
|
return promise;
|
|
1228
1337
|
}
|
|
1229
1338
|
setSelfDid(did) {
|
|
1230
|
-
__classPrivateFieldSet$
|
|
1339
|
+
__classPrivateFieldSet$d(this, _AgentClient_selfDid, did, "f");
|
|
1231
1340
|
}
|
|
1232
1341
|
invalidateByDid(did) {
|
|
1233
|
-
__classPrivateFieldGet$
|
|
1234
|
-
__classPrivateFieldGet$
|
|
1342
|
+
__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").delete(did);
|
|
1343
|
+
__classPrivateFieldGet$d(this, _AgentClient_persistent, "f").delete(did);
|
|
1235
1344
|
}
|
|
1236
1345
|
clearByDidCache() {
|
|
1237
|
-
__classPrivateFieldGet$
|
|
1346
|
+
__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").clear();
|
|
1238
1347
|
}
|
|
1239
1348
|
async updatePublicPerspective(perspective) {
|
|
1240
1349
|
const publicPerspective = {
|
|
@@ -1245,77 +1354,77 @@ var AgentClient = class {
|
|
|
1245
1354
|
proof: { key: proof.key, signature: proof.signature, valid: proof.valid, invalid: proof.invalid }
|
|
1246
1355
|
}))
|
|
1247
1356
|
};
|
|
1248
|
-
const agent = toAgent(await __classPrivateFieldGet$
|
|
1249
|
-
__classPrivateFieldGet$
|
|
1357
|
+
const agent = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.updateProfile", { publicPerspective }));
|
|
1358
|
+
__classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
|
|
1250
1359
|
return agent;
|
|
1251
1360
|
}
|
|
1252
1361
|
async mutatePublicPerspective({ additions, removals }) {
|
|
1253
|
-
const added = additions.length > 0 ? await __classPrivateFieldGet$
|
|
1362
|
+
const added = additions.length > 0 ? await __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_signLinks).call(this, additions) : [];
|
|
1254
1363
|
const { perspective } = await this.me();
|
|
1255
1364
|
const kept = (perspective?.links ?? []).filter((link) => !removals.some((r) => linkEqual(link, r)));
|
|
1256
1365
|
return this.updatePublicPerspective({ links: [...kept, ...added] });
|
|
1257
1366
|
}
|
|
1258
1367
|
async updateDirectMessageLanguage(directMessageLanguage) {
|
|
1259
|
-
const agent = toAgent(await __classPrivateFieldGet$
|
|
1260
|
-
__classPrivateFieldGet$
|
|
1368
|
+
const agent = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.updateProfile", { dmLanguage: directMessageLanguage }));
|
|
1369
|
+
__classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
|
|
1261
1370
|
return agent;
|
|
1262
1371
|
}
|
|
1263
1372
|
async addEntanglementProofs(proofs) {
|
|
1264
|
-
return __classPrivateFieldGet$
|
|
1373
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.addEntanglementProofs", { proofs });
|
|
1265
1374
|
}
|
|
1266
1375
|
async deleteEntanglementProofs(proofs) {
|
|
1267
|
-
return __classPrivateFieldGet$
|
|
1376
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.deleteEntanglementProofs", { proofs });
|
|
1268
1377
|
}
|
|
1269
1378
|
async getEntanglementProofs() {
|
|
1270
|
-
return __classPrivateFieldGet$
|
|
1379
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.getEntanglementProofs", {});
|
|
1271
1380
|
}
|
|
1272
1381
|
async entanglementProofPreFlight(deviceKey, deviceKeyType) {
|
|
1273
|
-
return __classPrivateFieldGet$
|
|
1382
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.entanglementProofPreflight", { deviceKey, deviceKeyType });
|
|
1274
1383
|
}
|
|
1275
1384
|
async requestCapability(authInfo, agent) {
|
|
1276
|
-
return __classPrivateFieldGet$
|
|
1385
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.requestCapability", agent === void 0 ? { authInfo } : { authInfo, agent });
|
|
1277
1386
|
}
|
|
1278
1387
|
async permitCapability(auth) {
|
|
1279
|
-
return __classPrivateFieldGet$
|
|
1388
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.permitCapability", { auth });
|
|
1280
1389
|
}
|
|
1281
1390
|
async generateJwt(requestId, rand) {
|
|
1282
|
-
return __classPrivateFieldGet$
|
|
1391
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.generateJwt", { requestId, rand });
|
|
1283
1392
|
}
|
|
1284
1393
|
async getApps() {
|
|
1285
|
-
return __classPrivateFieldGet$
|
|
1394
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.getApps", {});
|
|
1286
1395
|
}
|
|
1287
1396
|
async removeApp(requestId) {
|
|
1288
|
-
return __classPrivateFieldGet$
|
|
1397
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.removeApp", { id: requestId });
|
|
1289
1398
|
}
|
|
1290
1399
|
async revokeToken(requestId) {
|
|
1291
|
-
return __classPrivateFieldGet$
|
|
1400
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.revokeToken", { token: requestId });
|
|
1292
1401
|
}
|
|
1293
1402
|
async isLocked() {
|
|
1294
|
-
return __classPrivateFieldGet$
|
|
1403
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.isLocked", {});
|
|
1295
1404
|
}
|
|
1296
1405
|
async signMessage(message) {
|
|
1297
|
-
return __classPrivateFieldGet$
|
|
1406
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("agent.sign", { message });
|
|
1298
1407
|
}
|
|
1299
1408
|
async createUser(email, password) {
|
|
1300
|
-
return __classPrivateFieldGet$
|
|
1409
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("user.create", { email, password });
|
|
1301
1410
|
}
|
|
1302
1411
|
async loginUser(email, password) {
|
|
1303
|
-
return __classPrivateFieldGet$
|
|
1412
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("user.login", { email, password });
|
|
1304
1413
|
}
|
|
1305
1414
|
async requestLoginVerification(email, appInfo) {
|
|
1306
|
-
return __classPrivateFieldGet$
|
|
1415
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("user.requestVerification", { email, appInfo });
|
|
1307
1416
|
}
|
|
1308
1417
|
async verifyEmailCode(email, code2, verificationType) {
|
|
1309
|
-
return __classPrivateFieldGet$
|
|
1418
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("user.verifyEmail", { email, code: code2, verificationType });
|
|
1310
1419
|
}
|
|
1311
1420
|
async logout() {
|
|
1312
|
-
return __classPrivateFieldGet$
|
|
1421
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("user.logout", {});
|
|
1313
1422
|
}
|
|
1314
1423
|
async revokeAllSessions(email) {
|
|
1315
|
-
return __classPrivateFieldGet$
|
|
1424
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("user.revokeAllSessions", email === void 0 ? {} : { email });
|
|
1316
1425
|
}
|
|
1317
1426
|
async hostingUserInfo() {
|
|
1318
|
-
const info = (await __classPrivateFieldGet$
|
|
1427
|
+
const info = (await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("hosting.info", {})).userInfo ?? {
|
|
1319
1428
|
email: "",
|
|
1320
1429
|
credits: null,
|
|
1321
1430
|
hotWalletAddress: null,
|
|
@@ -1324,34 +1433,34 @@ var AgentClient = class {
|
|
|
1324
1433
|
return new HostingUserInfo(info.email, info.freeAccess ? "unlimited" : String(info.credits ?? 0), info.hotWalletAddress || void 0, !!info.freeAccess);
|
|
1325
1434
|
}
|
|
1326
1435
|
async computeLog(since, limit, userEmail) {
|
|
1327
|
-
return __classPrivateFieldGet$
|
|
1436
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("runtime.computeLog", { since, limit, userEmail });
|
|
1328
1437
|
}
|
|
1329
1438
|
async setHotWalletAddress(address) {
|
|
1330
|
-
return __classPrivateFieldGet$
|
|
1439
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("hosting.setHotWallet", { address });
|
|
1331
1440
|
}
|
|
1332
1441
|
async requestPayment(amountHOT) {
|
|
1333
|
-
return __classPrivateFieldGet$
|
|
1442
|
+
return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("hosting.requestPayment", { amountHOT });
|
|
1334
1443
|
}
|
|
1335
1444
|
};
|
|
1336
1445
|
_AgentClient_apiClient = /* @__PURE__ */ new WeakMap(), _AgentClient_memCache = /* @__PURE__ */ new WeakMap(), _AgentClient_persistent = /* @__PURE__ */ new WeakMap(), _AgentClient_selfDid = /* @__PURE__ */ new WeakMap(), _AgentClient_onAgentUpdated = /* @__PURE__ */ new WeakMap(), _AgentClient_instances = /* @__PURE__ */ new WeakSet(), _AgentClient_cacheAgent = function _AgentClient_cacheAgent2(agent) {
|
|
1337
1446
|
if (!agent.did)
|
|
1338
1447
|
return;
|
|
1339
|
-
__classPrivateFieldGet$
|
|
1340
|
-
__classPrivateFieldGet$
|
|
1341
|
-
__classPrivateFieldGet$
|
|
1448
|
+
__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").set(agent.did, { promise: Promise.resolve(agent), ts: Date.now() });
|
|
1449
|
+
__classPrivateFieldGet$d(this, _AgentClient_persistent, "f").put(agent.did, { agent, ts: Date.now() });
|
|
1450
|
+
__classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
|
|
1342
1451
|
}, _AgentClient_signLinks = async function _AgentClient_signLinks2(links) {
|
|
1343
|
-
const { uuid } = await __classPrivateFieldGet$
|
|
1452
|
+
const { uuid } = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("perspective.create", { name: "Agent Perspective Proxy" });
|
|
1344
1453
|
try {
|
|
1345
|
-
return (await __classPrivateFieldGet$
|
|
1454
|
+
return (await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("perspective.addLinks", { uuid, links, status: "SHARED" })).map(LinkExpression.fromWire);
|
|
1346
1455
|
} finally {
|
|
1347
|
-
await __classPrivateFieldGet$
|
|
1456
|
+
await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call("perspective.remove", { uuid });
|
|
1348
1457
|
}
|
|
1349
1458
|
}, _AgentClient_listen = function _AgentClient_listen2() {
|
|
1350
|
-
__classPrivateFieldGet$
|
|
1459
|
+
__classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").on("agent-updated", __classPrivateFieldGet$d(this, _AgentClient_onAgentUpdated, "f"));
|
|
1351
1460
|
};
|
|
1352
1461
|
AgentClient.REMOTE_AGENT_TTL_MS = 5 * 6e4;
|
|
1353
1462
|
AgentClient.REMOTE_AGENT_TTL_L2_MS = 5 * 6e4;
|
|
1354
|
-
var __classPrivateFieldSet$
|
|
1463
|
+
var __classPrivateFieldSet$c = function(receiver, state, value, kind, f) {
|
|
1355
1464
|
if (kind === "m")
|
|
1356
1465
|
throw new TypeError("Private method is not writable");
|
|
1357
1466
|
if (kind === "a" && !f)
|
|
@@ -1360,7 +1469,7 @@ var __classPrivateFieldSet$b = function(receiver, state, value, kind, f) {
|
|
|
1360
1469
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1361
1470
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1362
1471
|
};
|
|
1363
|
-
var __classPrivateFieldGet$
|
|
1472
|
+
var __classPrivateFieldGet$c = function(receiver, state, kind, f) {
|
|
1364
1473
|
if (kind === "a" && !f)
|
|
1365
1474
|
throw new TypeError("Private accessor was defined without a getter");
|
|
1366
1475
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -1371,34 +1480,34 @@ var _LanguageClient_apiClient;
|
|
|
1371
1480
|
var LanguageClient = class {
|
|
1372
1481
|
constructor(baseUrl, token, sharedApiClient) {
|
|
1373
1482
|
_LanguageClient_apiClient.set(this, void 0);
|
|
1374
|
-
__classPrivateFieldSet$
|
|
1483
|
+
__classPrivateFieldSet$c(this, _LanguageClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
1375
1484
|
}
|
|
1376
1485
|
async byAddress(address) {
|
|
1377
|
-
return __classPrivateFieldGet$
|
|
1486
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.get", { address });
|
|
1378
1487
|
}
|
|
1379
1488
|
async byFilter(filter) {
|
|
1380
|
-
return __classPrivateFieldGet$
|
|
1489
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.all", { filter });
|
|
1381
1490
|
}
|
|
1382
1491
|
async all() {
|
|
1383
|
-
return __classPrivateFieldGet$
|
|
1492
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.all", {});
|
|
1384
1493
|
}
|
|
1385
1494
|
async writeSettings(languageAddress, settings) {
|
|
1386
|
-
return __classPrivateFieldGet$
|
|
1495
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.writeSettings", { address: languageAddress, settings });
|
|
1387
1496
|
}
|
|
1388
1497
|
async applyTemplateAndPublish(sourceLanguageHash, templateData, options) {
|
|
1389
|
-
return __classPrivateFieldGet$
|
|
1498
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.applyTemplate", { sourceLanguageHash, templateData }, options);
|
|
1390
1499
|
}
|
|
1391
1500
|
async publish(languagePath, languageMeta, options) {
|
|
1392
|
-
return __classPrivateFieldGet$
|
|
1501
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.publish", { languagePath, languageMeta }, options);
|
|
1393
1502
|
}
|
|
1394
1503
|
async meta(address) {
|
|
1395
|
-
return __classPrivateFieldGet$
|
|
1504
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.meta", { address });
|
|
1396
1505
|
}
|
|
1397
1506
|
async source(address) {
|
|
1398
|
-
return __classPrivateFieldGet$
|
|
1507
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.source", { address });
|
|
1399
1508
|
}
|
|
1400
1509
|
async remove(address) {
|
|
1401
|
-
return __classPrivateFieldGet$
|
|
1510
|
+
return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call("language.remove", { address });
|
|
1402
1511
|
}
|
|
1403
1512
|
};
|
|
1404
1513
|
_LanguageClient_apiClient = /* @__PURE__ */ new WeakMap();
|
|
@@ -1440,7 +1549,7 @@ function neighbourhoodExpressionFromWire(wire) {
|
|
|
1440
1549
|
const meta = new Perspective(wire.data.meta.links.map(LinkExpression.fromWire));
|
|
1441
1550
|
return new NeighbourhoodExpression(wire.author, wire.timestamp, new Neighbourhood(wire.data.linkLanguage, meta), wire.proof);
|
|
1442
1551
|
}
|
|
1443
|
-
var __classPrivateFieldSet$
|
|
1552
|
+
var __classPrivateFieldSet$b = function(receiver, state, value, kind, f) {
|
|
1444
1553
|
if (kind === "m")
|
|
1445
1554
|
throw new TypeError("Private method is not writable");
|
|
1446
1555
|
if (kind === "a" && !f)
|
|
@@ -1449,7 +1558,7 @@ var __classPrivateFieldSet$a = function(receiver, state, value, kind, f) {
|
|
|
1449
1558
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1450
1559
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1451
1560
|
};
|
|
1452
|
-
var __classPrivateFieldGet$
|
|
1561
|
+
var __classPrivateFieldGet$b = function(receiver, state, kind, f) {
|
|
1453
1562
|
if (kind === "a" && !f)
|
|
1454
1563
|
throw new TypeError("Private accessor was defined without a getter");
|
|
1455
1564
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -1464,47 +1573,47 @@ var NeighbourhoodClient = class {
|
|
|
1464
1573
|
_NeighbourhoodClient_apiClient.set(this, void 0);
|
|
1465
1574
|
_NeighbourhoodClient_signalHandlers.set(this, /* @__PURE__ */ new Map());
|
|
1466
1575
|
_NeighbourhoodClient_signalUnsubscribers.set(this, /* @__PURE__ */ new Map());
|
|
1467
|
-
__classPrivateFieldSet$
|
|
1576
|
+
__classPrivateFieldSet$b(this, _NeighbourhoodClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
1468
1577
|
}
|
|
1469
1578
|
async publishFromPerspective(perspectiveUUID, linkLanguage, meta, options) {
|
|
1470
|
-
return __classPrivateFieldGet$
|
|
1579
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.publish", {
|
|
1471
1580
|
perspectiveUuid: perspectiveUUID,
|
|
1472
1581
|
linkLanguage,
|
|
1473
1582
|
meta: Perspective.toWire(meta)
|
|
1474
1583
|
}, options);
|
|
1475
1584
|
}
|
|
1476
1585
|
async joinFromUrl(url, options) {
|
|
1477
|
-
return PerspectiveHandle.fromWire(await __classPrivateFieldGet$
|
|
1586
|
+
return PerspectiveHandle.fromWire(await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.join", { url }, options));
|
|
1478
1587
|
}
|
|
1479
1588
|
async otherAgents(perspectiveUUID) {
|
|
1480
|
-
return __classPrivateFieldGet$
|
|
1589
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.otherAgents", { uuid: perspectiveUUID });
|
|
1481
1590
|
}
|
|
1482
1591
|
async hasTelepresenceAdapter(perspectiveUUID) {
|
|
1483
|
-
return __classPrivateFieldGet$
|
|
1592
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.hasTelepresence", { uuid: perspectiveUUID });
|
|
1484
1593
|
}
|
|
1485
1594
|
async onlineAgents(perspectiveUUID) {
|
|
1486
|
-
const agents = await __classPrivateFieldGet$
|
|
1595
|
+
const agents = await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.onlineAgents", { uuid: perspectiveUUID });
|
|
1487
1596
|
return agents.map(({ did, status }) => ({ did, status: PerspectiveExpression.fromWire(status) }));
|
|
1488
1597
|
}
|
|
1489
1598
|
async ownOnlineStatus(perspectiveUUID) {
|
|
1490
|
-
const status = await __classPrivateFieldGet$
|
|
1599
|
+
const status = await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.ownOnlineStatus", { uuid: perspectiveUUID });
|
|
1491
1600
|
return status ? PerspectiveExpression.fromWire(status) : null;
|
|
1492
1601
|
}
|
|
1493
1602
|
async setOnlineStatus(perspectiveUUID, status) {
|
|
1494
|
-
return __classPrivateFieldGet$
|
|
1603
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.setOnlineStatus", { uuid: perspectiveUUID, status: Perspective.toWire(status) });
|
|
1495
1604
|
}
|
|
1496
1605
|
async setOnlineStatusU(perspectiveUUID, status) {
|
|
1497
|
-
return __classPrivateFieldGet$
|
|
1606
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.setOnlineStatus", { uuid: perspectiveUUID, status, signed: false });
|
|
1498
1607
|
}
|
|
1499
1608
|
async sendSignal(perspectiveUUID, remoteAgentDid, payload) {
|
|
1500
|
-
return __classPrivateFieldGet$
|
|
1609
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.sendSignal", {
|
|
1501
1610
|
uuid: perspectiveUUID,
|
|
1502
1611
|
remoteAgentDid,
|
|
1503
1612
|
payload: Perspective.toWire(payload)
|
|
1504
1613
|
});
|
|
1505
1614
|
}
|
|
1506
1615
|
async sendSignalU(perspectiveUUID, remoteAgentDid, payload) {
|
|
1507
|
-
return __classPrivateFieldGet$
|
|
1616
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.sendSignal", {
|
|
1508
1617
|
uuid: perspectiveUUID,
|
|
1509
1618
|
remoteAgentDid,
|
|
1510
1619
|
payload,
|
|
@@ -1512,14 +1621,14 @@ var NeighbourhoodClient = class {
|
|
|
1512
1621
|
});
|
|
1513
1622
|
}
|
|
1514
1623
|
async sendBroadcast(perspectiveUUID, payload, loopback = false) {
|
|
1515
|
-
return __classPrivateFieldGet$
|
|
1624
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.sendBroadcast", {
|
|
1516
1625
|
uuid: perspectiveUUID,
|
|
1517
1626
|
payload: Perspective.toWire(payload),
|
|
1518
1627
|
loopback
|
|
1519
1628
|
});
|
|
1520
1629
|
}
|
|
1521
1630
|
async sendBroadcastU(perspectiveUUID, payload, loopback = false) {
|
|
1522
|
-
return __classPrivateFieldGet$
|
|
1631
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("neighbourhood.sendBroadcast", {
|
|
1523
1632
|
uuid: perspectiveUUID,
|
|
1524
1633
|
payload,
|
|
1525
1634
|
loopback,
|
|
@@ -1527,7 +1636,7 @@ var NeighbourhoodClient = class {
|
|
|
1527
1636
|
});
|
|
1528
1637
|
}
|
|
1529
1638
|
dispatchSignal(perspectiveUUID, signal) {
|
|
1530
|
-
const handlers = __classPrivateFieldGet$
|
|
1639
|
+
const handlers = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
|
|
1531
1640
|
if (handlers) {
|
|
1532
1641
|
for (const handler of handlers) {
|
|
1533
1642
|
try {
|
|
@@ -1539,15 +1648,15 @@ var NeighbourhoodClient = class {
|
|
|
1539
1648
|
}
|
|
1540
1649
|
}
|
|
1541
1650
|
async subscribeToSignals(perspectiveUUID) {
|
|
1542
|
-
const unsub = __classPrivateFieldGet$
|
|
1543
|
-
__classPrivateFieldGet$
|
|
1544
|
-
await __classPrivateFieldGet$
|
|
1651
|
+
const unsub = __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("signal", (event) => this.dispatchSignal(perspectiveUUID, PerspectiveExpression.fromWire(event.signal)), { perspective: perspectiveUUID });
|
|
1652
|
+
__classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").set(perspectiveUUID, unsub);
|
|
1653
|
+
await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").watchApplied();
|
|
1545
1654
|
}
|
|
1546
1655
|
async addSignalHandler(perspectiveUUID, handler) {
|
|
1547
|
-
let handlersForPerspective = __classPrivateFieldGet$
|
|
1656
|
+
let handlersForPerspective = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
|
|
1548
1657
|
if (!handlersForPerspective) {
|
|
1549
1658
|
handlersForPerspective = [];
|
|
1550
|
-
__classPrivateFieldGet$
|
|
1659
|
+
__classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").set(perspectiveUUID, handlersForPerspective);
|
|
1551
1660
|
handlersForPerspective.push(handler);
|
|
1552
1661
|
await this.subscribeToSignals(perspectiveUUID);
|
|
1553
1662
|
} else {
|
|
@@ -1555,76 +1664,85 @@ var NeighbourhoodClient = class {
|
|
|
1555
1664
|
}
|
|
1556
1665
|
}
|
|
1557
1666
|
removeSignalHandler(perspectiveUUID, handler) {
|
|
1558
|
-
const handlersForPerspective = __classPrivateFieldGet$
|
|
1667
|
+
const handlersForPerspective = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
|
|
1559
1668
|
if (handlersForPerspective) {
|
|
1560
1669
|
const index = handlersForPerspective.indexOf(handler);
|
|
1561
1670
|
if (index > -1) {
|
|
1562
1671
|
handlersForPerspective.splice(index, 1);
|
|
1563
1672
|
}
|
|
1564
1673
|
if (handlersForPerspective.length === 0) {
|
|
1565
|
-
__classPrivateFieldGet$
|
|
1566
|
-
const unsub = __classPrivateFieldGet$
|
|
1674
|
+
__classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").delete(perspectiveUUID);
|
|
1675
|
+
const unsub = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").get(perspectiveUUID);
|
|
1567
1676
|
if (unsub) {
|
|
1568
1677
|
unsub();
|
|
1569
|
-
__classPrivateFieldGet$
|
|
1678
|
+
__classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").delete(perspectiveUUID);
|
|
1570
1679
|
}
|
|
1571
1680
|
}
|
|
1572
1681
|
}
|
|
1573
1682
|
}
|
|
1574
1683
|
async sfuStartRoom(neighbourhoodUrl, roomName) {
|
|
1575
|
-
return __classPrivateFieldGet$
|
|
1684
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.startRoom", { neighbourhoodUrl, roomName });
|
|
1576
1685
|
}
|
|
1577
1686
|
async sfuStopRoom(neighbourhoodUrl, roomName) {
|
|
1578
|
-
return __classPrivateFieldGet$
|
|
1687
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.stopRoom", { neighbourhoodUrl, roomName });
|
|
1579
1688
|
}
|
|
1580
1689
|
async sfuListRooms() {
|
|
1581
|
-
return __classPrivateFieldGet$
|
|
1690
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.listRooms", {});
|
|
1582
1691
|
}
|
|
1583
1692
|
async sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer) {
|
|
1584
|
-
return __classPrivateFieldGet$
|
|
1693
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callJoin", {
|
|
1585
1694
|
neighbourhoodUrl,
|
|
1586
1695
|
roomName,
|
|
1587
1696
|
sdpOffer
|
|
1588
1697
|
});
|
|
1589
1698
|
}
|
|
1590
1699
|
async sfuCallLeave(neighbourhoodUrl, roomName) {
|
|
1591
|
-
return __classPrivateFieldGet$
|
|
1700
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callLeave", { neighbourhoodUrl, roomName });
|
|
1592
1701
|
}
|
|
1593
1702
|
async sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference) {
|
|
1594
|
-
return __classPrivateFieldGet$
|
|
1703
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callSetQualityPreference", {
|
|
1595
1704
|
neighbourhoodUrl,
|
|
1596
1705
|
roomName,
|
|
1597
1706
|
preference
|
|
1598
1707
|
});
|
|
1599
1708
|
}
|
|
1600
1709
|
async sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer) {
|
|
1601
|
-
return __classPrivateFieldGet$
|
|
1710
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callAnswerServerOffer", {
|
|
1602
1711
|
neighbourhoodUrl,
|
|
1603
1712
|
roomName,
|
|
1604
1713
|
sdpAnswer
|
|
1605
1714
|
});
|
|
1606
1715
|
}
|
|
1716
|
+
async sfuCallRestartIce(neighbourhoodUrl, roomName) {
|
|
1717
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callRestartIce", { neighbourhoodUrl, roomName });
|
|
1718
|
+
}
|
|
1719
|
+
onNetworkChange(callback) {
|
|
1720
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").onNetworkChange(callback);
|
|
1721
|
+
}
|
|
1722
|
+
checkConnection() {
|
|
1723
|
+
__classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").checkConnection();
|
|
1724
|
+
}
|
|
1607
1725
|
async sfuGetConfig(neighbourhoodUrl) {
|
|
1608
|
-
return __classPrivateFieldGet$
|
|
1726
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.getConfig", { neighbourhoodUrl });
|
|
1609
1727
|
}
|
|
1610
1728
|
async sfuSetConfig(neighbourhoodUrl, config) {
|
|
1611
|
-
return __classPrivateFieldGet$
|
|
1729
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.setConfig", { neighbourhoodUrl, config });
|
|
1612
1730
|
}
|
|
1613
1731
|
async sfuPeerForNeighbourhood(neighbourhoodUrl) {
|
|
1614
|
-
return __classPrivateFieldGet$
|
|
1732
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeerForNeighbourhood", { neighbourhoodUrl });
|
|
1615
1733
|
}
|
|
1616
1734
|
async sfuPeersForNeighbourhood(neighbourhoodUrl) {
|
|
1617
|
-
return __classPrivateFieldGet$
|
|
1735
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeersForNeighbourhood", { neighbourhoodUrl });
|
|
1618
1736
|
}
|
|
1619
1737
|
async sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate) {
|
|
1620
|
-
return __classPrivateFieldGet$
|
|
1738
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.addIceCandidate", {
|
|
1621
1739
|
neighbourhoodUrl,
|
|
1622
1740
|
roomName,
|
|
1623
1741
|
candidate
|
|
1624
1742
|
});
|
|
1625
1743
|
}
|
|
1626
1744
|
async sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary = false) {
|
|
1627
|
-
return __classPrivateFieldGet$
|
|
1745
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sendData", {
|
|
1628
1746
|
neighbourhoodUrl,
|
|
1629
1747
|
roomName,
|
|
1630
1748
|
channelLabel,
|
|
@@ -1633,13 +1751,13 @@ var NeighbourhoodClient = class {
|
|
|
1633
1751
|
});
|
|
1634
1752
|
}
|
|
1635
1753
|
subscribeSfuDataChannel(callback) {
|
|
1636
|
-
return __classPrivateFieldGet$
|
|
1754
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-data", (message) => callback(message));
|
|
1637
1755
|
}
|
|
1638
1756
|
subscribeSfuRoomRoster(callback) {
|
|
1639
|
-
return __classPrivateFieldGet$
|
|
1757
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-room-roster", (roster) => callback(roster));
|
|
1640
1758
|
}
|
|
1641
1759
|
subscribeSfuCallRenegotiationOffer(targetDid, callback) {
|
|
1642
|
-
return __classPrivateFieldGet$
|
|
1760
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-call-renegotiation-offer", (event) => {
|
|
1643
1761
|
if (event.targetDid !== targetDid)
|
|
1644
1762
|
return;
|
|
1645
1763
|
callback({
|
|
@@ -1652,7 +1770,7 @@ var NeighbourhoodClient = class {
|
|
|
1652
1770
|
});
|
|
1653
1771
|
}
|
|
1654
1772
|
subscribeSfuMigrateEvent(targetDid, callback) {
|
|
1655
|
-
return __classPrivateFieldGet$
|
|
1773
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-migrate", (event) => {
|
|
1656
1774
|
if (event.targetDid !== targetDid)
|
|
1657
1775
|
return;
|
|
1658
1776
|
callback({
|
|
@@ -1664,22 +1782,22 @@ var NeighbourhoodClient = class {
|
|
|
1664
1782
|
});
|
|
1665
1783
|
}
|
|
1666
1784
|
async sfuServesAllMembers(perspectiveId) {
|
|
1667
|
-
return __classPrivateFieldGet$
|
|
1785
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.servesAllMembers", { uuid: perspectiveId });
|
|
1668
1786
|
}
|
|
1669
1787
|
async callerDid() {
|
|
1670
|
-
return (await __classPrivateFieldGet$
|
|
1788
|
+
return (await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("agent.status", {})).did;
|
|
1671
1789
|
}
|
|
1672
1790
|
async sfuStatus() {
|
|
1673
|
-
return __classPrivateFieldGet$
|
|
1791
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.status", {});
|
|
1674
1792
|
}
|
|
1675
1793
|
async sfuCascadeStatus() {
|
|
1676
|
-
return __classPrivateFieldGet$
|
|
1794
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.cascadeStatus", {});
|
|
1677
1795
|
}
|
|
1678
1796
|
async sfuQualityPreferences() {
|
|
1679
|
-
return __classPrivateFieldGet$
|
|
1797
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.qualityPreferences", {});
|
|
1680
1798
|
}
|
|
1681
1799
|
async sfuEnsureMembership(neighbourhoodUrl, did) {
|
|
1682
|
-
return __classPrivateFieldGet$
|
|
1800
|
+
return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.ensureMembership", {
|
|
1683
1801
|
neighbourhoodUrl,
|
|
1684
1802
|
did
|
|
1685
1803
|
});
|
|
@@ -1701,10 +1819,12 @@ var SfuManager = class {
|
|
|
1701
1819
|
this.replacedTracks = /* @__PURE__ */ new Map();
|
|
1702
1820
|
this.qualityPreference = null;
|
|
1703
1821
|
this.offerQueue = Promise.resolve();
|
|
1822
|
+
this.answeredOffer = null;
|
|
1704
1823
|
this.renegotiationUnsubscribe = null;
|
|
1705
1824
|
this.rosterUnsubscribe = null;
|
|
1706
1825
|
this.dataChannelUnsubscribe = null;
|
|
1707
|
-
this.
|
|
1826
|
+
this.restartTimer = null;
|
|
1827
|
+
this.networkUnsubscribe = null;
|
|
1708
1828
|
this.unlistedTimer = null;
|
|
1709
1829
|
this.neighbourhood = neighbourhood;
|
|
1710
1830
|
this.neighbourhoodUrl = neighbourhoodUrl || "";
|
|
@@ -1742,6 +1862,7 @@ var SfuManager = class {
|
|
|
1742
1862
|
}
|
|
1743
1863
|
console.info(`SFU: connection failed, reconnecting (${this.reconnectAttempts}/${SfuManager.MAX_RECONNECTS})`);
|
|
1744
1864
|
this.reconnecting = true;
|
|
1865
|
+
this.endRestart();
|
|
1745
1866
|
try {
|
|
1746
1867
|
const deadline = Date.now() + SfuManager.REJOIN_WINDOW_MS;
|
|
1747
1868
|
for (let delay = 1e3; ; delay = Math.min(delay * 2, 1e4)) {
|
|
@@ -1780,6 +1901,28 @@ var SfuManager = class {
|
|
|
1780
1901
|
this.reconnecting = false;
|
|
1781
1902
|
}
|
|
1782
1903
|
}
|
|
1904
|
+
restartIce(pc) {
|
|
1905
|
+
if (this.restartTimer || this.reconnecting || this.state.peerConnection !== pc)
|
|
1906
|
+
return;
|
|
1907
|
+
console.info("SFU: restarting ICE");
|
|
1908
|
+
this.restartTimer = setTimeout(() => {
|
|
1909
|
+
this.restartTimer = null;
|
|
1910
|
+
if (this.state.peerConnection !== pc)
|
|
1911
|
+
return;
|
|
1912
|
+
if (pc.iceConnectionState === "connected" || pc.iceConnectionState === "completed")
|
|
1913
|
+
return;
|
|
1914
|
+
void this.reconnect();
|
|
1915
|
+
}, SfuManager.RESTART_TIMEOUT_MS);
|
|
1916
|
+
this.neighbourhood.sfuCallRestartIce(this.neighbourhoodUrl, this.roomId).catch((err2) => {
|
|
1917
|
+
console.warn("SFU: ICE restart refused:", err2);
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
endRestart() {
|
|
1921
|
+
if (this.restartTimer) {
|
|
1922
|
+
clearTimeout(this.restartTimer);
|
|
1923
|
+
this.restartTimer = null;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1783
1926
|
on(event, callback) {
|
|
1784
1927
|
if (!this.callbacks.has(event)) {
|
|
1785
1928
|
this.callbacks.set(event, []);
|
|
@@ -1820,30 +1963,25 @@ var SfuManager = class {
|
|
|
1820
1963
|
if (this.state.peerConnection !== pc)
|
|
1821
1964
|
return;
|
|
1822
1965
|
if (pc.iceConnectionState === "failed") {
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
this.disconnectedTimer = null;
|
|
1826
|
-
}
|
|
1827
|
-
this.reconnect();
|
|
1966
|
+
this.endRestart();
|
|
1967
|
+
void this.reconnect();
|
|
1828
1968
|
} else if (pc.iceConnectionState === "disconnected") {
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
}
|
|
1835
|
-
}, SfuManager.DISCONNECT_GRACE_MS);
|
|
1836
|
-
}
|
|
1837
|
-
} else {
|
|
1838
|
-
if (pc.iceConnectionState === "connected" || pc.iceConnectionState === "completed") {
|
|
1839
|
-
this.reconnectAttempts = 0;
|
|
1840
|
-
}
|
|
1841
|
-
if (this.disconnectedTimer) {
|
|
1842
|
-
clearTimeout(this.disconnectedTimer);
|
|
1843
|
-
this.disconnectedTimer = null;
|
|
1844
|
-
}
|
|
1969
|
+
this.neighbourhood.checkConnection();
|
|
1970
|
+
this.restartIce(pc);
|
|
1971
|
+
} else if (pc.iceConnectionState === "connected" || pc.iceConnectionState === "completed") {
|
|
1972
|
+
this.reconnectAttempts = 0;
|
|
1973
|
+
this.endRestart();
|
|
1845
1974
|
}
|
|
1846
1975
|
};
|
|
1976
|
+
if (!this.networkUnsubscribe) {
|
|
1977
|
+
this.networkUnsubscribe = this.neighbourhood.onNetworkChange(() => {
|
|
1978
|
+
const current = this.state.peerConnection;
|
|
1979
|
+
if (!current || this.reconnecting)
|
|
1980
|
+
return;
|
|
1981
|
+
this.endRestart();
|
|
1982
|
+
this.restartIce(current);
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1847
1985
|
this.senders.clear();
|
|
1848
1986
|
for (const kind of ["audio", "video"]) {
|
|
1849
1987
|
const track = this.replacedTracks.has(kind) ? this.replacedTracks.get(kind) : localStream.getTracks().find((t) => t.kind === kind);
|
|
@@ -1980,7 +2118,7 @@ var SfuManager = class {
|
|
|
1980
2118
|
unsubscribe?.();
|
|
1981
2119
|
}
|
|
1982
2120
|
async applyServerOffer(pc, event) {
|
|
1983
|
-
if (this.state.peerConnection !== pc)
|
|
2121
|
+
if (this.state.peerConnection !== pc || event.sdpOffer === this.answeredOffer)
|
|
1984
2122
|
return;
|
|
1985
2123
|
for (const entry of event.trackMapping ?? []) {
|
|
1986
2124
|
this.midToParticipant.set(entry.mid, entry.agentDid);
|
|
@@ -1989,6 +2127,7 @@ var SfuManager = class {
|
|
|
1989
2127
|
await pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(event.sdpOffer)));
|
|
1990
2128
|
await pc.setLocalDescription(await pc.createAnswer());
|
|
1991
2129
|
await this.neighbourhood.sfuCallAnswerServerOffer(this.neighbourhoodUrl, event.roomName, JSON.stringify(pc.localDescription));
|
|
2130
|
+
this.answeredOffer = event.sdpOffer;
|
|
1992
2131
|
} catch (err2) {
|
|
1993
2132
|
if (this.state.peerConnection !== pc)
|
|
1994
2133
|
return;
|
|
@@ -2038,10 +2177,9 @@ var SfuManager = class {
|
|
|
2038
2177
|
async leave() {
|
|
2039
2178
|
this.generation++;
|
|
2040
2179
|
this.releaseServerEvents();
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
}
|
|
2180
|
+
this.endRestart();
|
|
2181
|
+
this.networkUnsubscribe?.();
|
|
2182
|
+
this.networkUnsubscribe = null;
|
|
2045
2183
|
this.senders.clear();
|
|
2046
2184
|
this.replacedTracks.clear();
|
|
2047
2185
|
this.qualityPreference = null;
|
|
@@ -2138,7 +2276,7 @@ var SfuManager = class {
|
|
|
2138
2276
|
};
|
|
2139
2277
|
SfuManager.MAX_RECONNECTS = 3;
|
|
2140
2278
|
SfuManager.REJOIN_WINDOW_MS = 12e4;
|
|
2141
|
-
SfuManager.
|
|
2279
|
+
SfuManager.RESTART_TIMEOUT_MS = 5e3;
|
|
2142
2280
|
SfuManager.UNLISTED_GRACE_MS = 3e3;
|
|
2143
2281
|
var CALL_PROTOCOL_VERSION = 1;
|
|
2144
2282
|
function parseCallMessage(payload) {
|
|
@@ -2289,6 +2427,7 @@ var MeshManager = class {
|
|
|
2289
2427
|
this.outstanding = 0;
|
|
2290
2428
|
this.lastRepairAt = 0;
|
|
2291
2429
|
this.renegotiationRepairs = /* @__PURE__ */ new Map();
|
|
2430
|
+
this.unwatchNetwork = null;
|
|
2292
2431
|
this.channel = options.channel;
|
|
2293
2432
|
this.callId = options.callId;
|
|
2294
2433
|
this.selfId = options.selfId;
|
|
@@ -2299,6 +2438,8 @@ var MeshManager = class {
|
|
|
2299
2438
|
this.createPeerConnection = options.createPeerConnection ?? ((configuration) => new RTCPeerConnection(configuration));
|
|
2300
2439
|
this.now = options.now ?? (() => Date.now());
|
|
2301
2440
|
this.sweepMs = options.sweepMs ?? SWEEP_INTERVAL_MS;
|
|
2441
|
+
this.onNetworkChange = options.onNetworkChange;
|
|
2442
|
+
this.checkConnection = options.checkConnection;
|
|
2302
2443
|
}
|
|
2303
2444
|
on(event, callback) {
|
|
2304
2445
|
if (!this.callbacks.has(event))
|
|
@@ -2383,6 +2524,7 @@ var MeshManager = class {
|
|
|
2383
2524
|
this.publish({ v: CALL_PROTOCOL_VERSION, call: this.callId, warm: true });
|
|
2384
2525
|
if (this.sweepMs > 0)
|
|
2385
2526
|
this.sweep = setInterval(() => this.tick(), this.sweepMs);
|
|
2527
|
+
this.unwatchNetwork = this.onNetworkChange?.(() => this.restartAll()) ?? null;
|
|
2386
2528
|
}
|
|
2387
2529
|
async leave() {
|
|
2388
2530
|
this.closed = true;
|
|
@@ -2390,6 +2532,8 @@ var MeshManager = class {
|
|
|
2390
2532
|
clearInterval(this.sweep);
|
|
2391
2533
|
this.sweep = null;
|
|
2392
2534
|
}
|
|
2535
|
+
this.unwatchNetwork?.();
|
|
2536
|
+
this.unwatchNetwork = null;
|
|
2393
2537
|
this.unwatchPublish?.();
|
|
2394
2538
|
this.unwatchPublish = null;
|
|
2395
2539
|
if (this.channelUnsubscribe) {
|
|
@@ -2623,8 +2767,10 @@ var MeshManager = class {
|
|
|
2623
2767
|
if (slot.offerDeferred && pc.signalingState === "stable")
|
|
2624
2768
|
void negotiate();
|
|
2625
2769
|
}
|
|
2626
|
-
if (state === "disconnected" && !slot.disconnectedAt)
|
|
2770
|
+
if (state === "disconnected" && !slot.disconnectedAt) {
|
|
2627
2771
|
slot.disconnectedAt = this.now();
|
|
2772
|
+
this.checkConnection?.();
|
|
2773
|
+
}
|
|
2628
2774
|
if (state === "connected" || state === "failed")
|
|
2629
2775
|
slot.disconnectedAt = 0;
|
|
2630
2776
|
this.emit("peer-state", peerId, state);
|
|
@@ -2853,6 +2999,23 @@ var MeshManager = class {
|
|
|
2853
2999
|
slot.attempts = attempts - 1;
|
|
2854
3000
|
this.rebuild(peerId, { announce: true, rung: "rebuild" });
|
|
2855
3001
|
}
|
|
3002
|
+
restartAll() {
|
|
3003
|
+
if (this.closed)
|
|
3004
|
+
return;
|
|
3005
|
+
const at = this.now();
|
|
3006
|
+
for (const [peerId, slot] of this.slots) {
|
|
3007
|
+
if (!slot.remoteReady || typeof slot.pc.restartIce !== "function")
|
|
3008
|
+
continue;
|
|
3009
|
+
slot.lastAttempt = at;
|
|
3010
|
+
try {
|
|
3011
|
+
slot.pc.restartIce();
|
|
3012
|
+
this.emit("peer-recovery", peerId, { rung: "ice-restart", attempts: slot.attempts });
|
|
3013
|
+
} catch (error) {
|
|
3014
|
+
this.fail(`restarting ice with ${peerId}`, error);
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
this.lastRepairAt = at;
|
|
3018
|
+
}
|
|
2856
3019
|
dueForRepair(peerId, slot, at) {
|
|
2857
3020
|
const state = slot.pc.connectionState;
|
|
2858
3021
|
if (slot.attempts >= MAX_RECOVERY_ATTEMPTS)
|
|
@@ -3074,7 +3237,9 @@ function createSession(config) {
|
|
|
3074
3237
|
channel,
|
|
3075
3238
|
callId: roomId,
|
|
3076
3239
|
selfId: agentDid,
|
|
3077
|
-
...meshIce.length > 0 ? { iceServers: meshIce } : {}
|
|
3240
|
+
...meshIce.length > 0 ? { iceServers: meshIce } : {},
|
|
3241
|
+
onNetworkChange: (cb) => api.onNetworkChange(cb),
|
|
3242
|
+
checkConnection: () => api.checkConnection()
|
|
3078
3243
|
});
|
|
3079
3244
|
meshManager = mesh;
|
|
3080
3245
|
wireMeshEvents(mesh);
|
|
@@ -3237,7 +3402,7 @@ function createSession(config) {
|
|
|
3237
3402
|
};
|
|
3238
3403
|
return session;
|
|
3239
3404
|
}
|
|
3240
|
-
var __classPrivateFieldSet$
|
|
3405
|
+
var __classPrivateFieldSet$a = function(receiver, state, value, kind, f) {
|
|
3241
3406
|
if (kind === "m")
|
|
3242
3407
|
throw new TypeError("Private method is not writable");
|
|
3243
3408
|
if (kind === "a" && !f)
|
|
@@ -3246,7 +3411,7 @@ var __classPrivateFieldSet$9 = function(receiver, state, value, kind, f) {
|
|
|
3246
3411
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3247
3412
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3248
3413
|
};
|
|
3249
|
-
var __classPrivateFieldGet$
|
|
3414
|
+
var __classPrivateFieldGet$a = function(receiver, state, kind, f) {
|
|
3250
3415
|
if (kind === "a" && !f)
|
|
3251
3416
|
throw new TypeError("Private accessor was defined without a getter");
|
|
3252
3417
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -3268,144 +3433,144 @@ var NeighbourhoodProxy = class {
|
|
|
3268
3433
|
[]
|
|
3269
3434
|
);
|
|
3270
3435
|
_NeighbourhoodProxy_sfuStatusCache.set(this, null);
|
|
3271
|
-
__classPrivateFieldSet$
|
|
3272
|
-
__classPrivateFieldSet$
|
|
3273
|
-
__classPrivateFieldSet$
|
|
3436
|
+
__classPrivateFieldSet$a(this, _NeighbourhoodProxy_client, client, "f");
|
|
3437
|
+
__classPrivateFieldSet$a(this, _NeighbourhoodProxy_pID, pID, "f");
|
|
3438
|
+
__classPrivateFieldSet$a(this, _NeighbourhoodProxy_agentDid, agentDid, "f");
|
|
3274
3439
|
}
|
|
3275
3440
|
async otherAgents() {
|
|
3276
|
-
return await __classPrivateFieldGet$
|
|
3441
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
|
|
3277
3442
|
}
|
|
3278
3443
|
async hasTelepresenceAdapter() {
|
|
3279
|
-
return await __classPrivateFieldGet$
|
|
3444
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
|
|
3280
3445
|
}
|
|
3281
3446
|
async onlineAgents() {
|
|
3282
|
-
return await __classPrivateFieldGet$
|
|
3447
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
|
|
3283
3448
|
}
|
|
3284
3449
|
async ownOnlineStatus() {
|
|
3285
|
-
return await __classPrivateFieldGet$
|
|
3450
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").ownOnlineStatus(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
|
|
3286
3451
|
}
|
|
3287
3452
|
async setOnlineStatus(status) {
|
|
3288
|
-
return await __classPrivateFieldGet$
|
|
3453
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), status);
|
|
3289
3454
|
}
|
|
3290
3455
|
async setOnlineStatusU(status) {
|
|
3291
|
-
return await __classPrivateFieldGet$
|
|
3456
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), status);
|
|
3292
3457
|
}
|
|
3293
3458
|
async sendSignal(remoteAgentDid, payload) {
|
|
3294
|
-
return await __classPrivateFieldGet$
|
|
3459
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
|
|
3295
3460
|
}
|
|
3296
3461
|
async sendSignalU(remoteAgentDid, payload) {
|
|
3297
|
-
return await __classPrivateFieldGet$
|
|
3462
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
|
|
3298
3463
|
}
|
|
3299
3464
|
async sendBroadcast(payload, loopback = false) {
|
|
3300
|
-
return await __classPrivateFieldGet$
|
|
3465
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
|
|
3301
3466
|
}
|
|
3302
3467
|
async sendBroadcastU(payload, loopback = false) {
|
|
3303
|
-
return await __classPrivateFieldGet$
|
|
3468
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
|
|
3304
3469
|
}
|
|
3305
3470
|
async addSignalHandler(handler) {
|
|
3306
|
-
await __classPrivateFieldGet$
|
|
3471
|
+
await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), handler);
|
|
3307
3472
|
}
|
|
3308
3473
|
removeSignalHandler(handler) {
|
|
3309
|
-
__classPrivateFieldGet$
|
|
3474
|
+
__classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), handler);
|
|
3310
3475
|
}
|
|
3311
3476
|
get sessions() {
|
|
3312
|
-
return __classPrivateFieldGet$
|
|
3477
|
+
return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f");
|
|
3313
3478
|
}
|
|
3314
3479
|
async createSession(roomName, options) {
|
|
3315
|
-
if (!__classPrivateFieldGet$
|
|
3316
|
-
__classPrivateFieldSet$
|
|
3480
|
+
if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f")) {
|
|
3481
|
+
__classPrivateFieldSet$a(this, _NeighbourhoodProxy_agentDid, await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").callerDid() ?? "", "f");
|
|
3317
3482
|
}
|
|
3318
|
-
if (!__classPrivateFieldGet$
|
|
3483
|
+
if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f")) {
|
|
3319
3484
|
throw new Error("Cannot create a call session: the executor reports no agent DID");
|
|
3320
3485
|
}
|
|
3321
|
-
if (!__classPrivateFieldGet$
|
|
3486
|
+
if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_sfuStatusCache, "f")) {
|
|
3322
3487
|
try {
|
|
3323
|
-
__classPrivateFieldSet$
|
|
3488
|
+
__classPrivateFieldSet$a(this, _NeighbourhoodProxy_sfuStatusCache, await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStatus(), "f");
|
|
3324
3489
|
} catch {
|
|
3325
3490
|
}
|
|
3326
3491
|
}
|
|
3327
3492
|
const proxy = this;
|
|
3328
3493
|
const session = createSession({
|
|
3329
|
-
api: __classPrivateFieldGet$
|
|
3494
|
+
api: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f"),
|
|
3330
3495
|
roomId: roomName,
|
|
3331
|
-
agentDid: __classPrivateFieldGet$
|
|
3496
|
+
agentDid: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f"),
|
|
3332
3497
|
neighbourhoodUrl: options?.neighbourhoodUrl ?? "",
|
|
3333
3498
|
topology: options?.topology ?? "auto",
|
|
3334
3499
|
sfuConfig: options?.sfuConfig,
|
|
3335
3500
|
iceServers: options?.iceServers,
|
|
3336
|
-
localSfuStatus: __classPrivateFieldGet$
|
|
3337
|
-
sfuServesAllMembers: () => __classPrivateFieldGet$
|
|
3338
|
-
channel: createTelepresenceChannel(proxy, __classPrivateFieldGet$
|
|
3501
|
+
localSfuStatus: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sfuStatusCache, "f") ?? void 0,
|
|
3502
|
+
sfuServesAllMembers: () => __classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_client, "f").sfuServesAllMembers(__classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_pID, "f")),
|
|
3503
|
+
channel: createTelepresenceChannel(proxy, __classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_agentDid, "f")),
|
|
3339
3504
|
ownOnlineStatus: () => proxy.ownOnlineStatus(),
|
|
3340
3505
|
setOnlineStatus: (status) => proxy.setOnlineStatusU(status),
|
|
3341
3506
|
onlineAgents: () => proxy.onlineAgents()
|
|
3342
3507
|
});
|
|
3343
|
-
__classPrivateFieldGet$
|
|
3508
|
+
__classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").push(session);
|
|
3344
3509
|
session.on("state-changed", (state) => {
|
|
3345
3510
|
if (state === "closed") {
|
|
3346
|
-
const idx = __classPrivateFieldGet$
|
|
3511
|
+
const idx = __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").indexOf(session);
|
|
3347
3512
|
if (idx !== -1)
|
|
3348
|
-
__classPrivateFieldGet$
|
|
3513
|
+
__classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").splice(idx, 1);
|
|
3349
3514
|
}
|
|
3350
3515
|
});
|
|
3351
3516
|
return session;
|
|
3352
3517
|
}
|
|
3353
3518
|
async sfuConfig(neighbourhoodUrl) {
|
|
3354
|
-
return await __classPrivateFieldGet$
|
|
3519
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuGetConfig(neighbourhoodUrl);
|
|
3355
3520
|
}
|
|
3356
3521
|
async setSfuConfig(neighbourhoodUrl, config) {
|
|
3357
|
-
return await __classPrivateFieldGet$
|
|
3522
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuSetConfig(neighbourhoodUrl, config);
|
|
3358
3523
|
}
|
|
3359
3524
|
async sfuPeer(neighbourhoodUrl) {
|
|
3360
|
-
return await __classPrivateFieldGet$
|
|
3525
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuPeerForNeighbourhood(neighbourhoodUrl);
|
|
3361
3526
|
}
|
|
3362
3527
|
async sfuPeers(neighbourhoodUrl) {
|
|
3363
|
-
return await __classPrivateFieldGet$
|
|
3528
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuPeersForNeighbourhood(neighbourhoodUrl);
|
|
3364
3529
|
}
|
|
3365
3530
|
async sfuStartRoom(neighbourhoodUrl, roomName) {
|
|
3366
|
-
return await __classPrivateFieldGet$
|
|
3531
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStartRoom(neighbourhoodUrl, roomName);
|
|
3367
3532
|
}
|
|
3368
3533
|
async sfuStopRoom(neighbourhoodUrl, roomName) {
|
|
3369
|
-
return await __classPrivateFieldGet$
|
|
3534
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStopRoom(neighbourhoodUrl, roomName);
|
|
3370
3535
|
}
|
|
3371
3536
|
async sfuListRooms() {
|
|
3372
|
-
return await __classPrivateFieldGet$
|
|
3537
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuListRooms();
|
|
3373
3538
|
}
|
|
3374
3539
|
async callJoin(neighbourhoodUrl, roomName, sdpOffer) {
|
|
3375
|
-
return await __classPrivateFieldGet$
|
|
3540
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer);
|
|
3376
3541
|
}
|
|
3377
3542
|
async callLeave(neighbourhoodUrl, roomName) {
|
|
3378
|
-
return await __classPrivateFieldGet$
|
|
3543
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallLeave(neighbourhoodUrl, roomName);
|
|
3379
3544
|
}
|
|
3380
3545
|
async callSetQualityPreference(neighbourhoodUrl, roomName, preference) {
|
|
3381
|
-
return await __classPrivateFieldGet$
|
|
3546
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference);
|
|
3382
3547
|
}
|
|
3383
3548
|
async callAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer) {
|
|
3384
|
-
return await __classPrivateFieldGet$
|
|
3549
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer);
|
|
3385
3550
|
}
|
|
3386
3551
|
subscribeCallRenegotiationOffer(targetDid, callback) {
|
|
3387
|
-
return __classPrivateFieldGet$
|
|
3552
|
+
return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuCallRenegotiationOffer(targetDid, callback);
|
|
3388
3553
|
}
|
|
3389
3554
|
subscribeMigrateEvent(targetDid, callback) {
|
|
3390
|
-
return __classPrivateFieldGet$
|
|
3555
|
+
return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuMigrateEvent(targetDid, callback);
|
|
3391
3556
|
}
|
|
3392
3557
|
async addIceCandidate(neighbourhoodUrl, roomName, candidate) {
|
|
3393
|
-
return await __classPrivateFieldGet$
|
|
3558
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate);
|
|
3394
3559
|
}
|
|
3395
3560
|
async sendData(neighbourhoodUrl, roomName, channelLabel, data, binary = false) {
|
|
3396
|
-
return await __classPrivateFieldGet$
|
|
3561
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary);
|
|
3397
3562
|
}
|
|
3398
3563
|
subscribeDataChannel(callback) {
|
|
3399
|
-
return __classPrivateFieldGet$
|
|
3564
|
+
return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuDataChannel(callback);
|
|
3400
3565
|
}
|
|
3401
3566
|
async sfuCascadeStatus() {
|
|
3402
|
-
return await __classPrivateFieldGet$
|
|
3567
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCascadeStatus();
|
|
3403
3568
|
}
|
|
3404
3569
|
async sfuQualityPreferences() {
|
|
3405
|
-
return await __classPrivateFieldGet$
|
|
3570
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuQualityPreferences();
|
|
3406
3571
|
}
|
|
3407
3572
|
async sfuEnsureMembership(neighbourhoodUrl, did) {
|
|
3408
|
-
return await __classPrivateFieldGet$
|
|
3573
|
+
return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuEnsureMembership(neighbourhoodUrl, did);
|
|
3409
3574
|
}
|
|
3410
3575
|
};
|
|
3411
3576
|
_NeighbourhoodProxy_client = /* @__PURE__ */ new WeakMap(), _NeighbourhoodProxy_pID = /* @__PURE__ */ new WeakMap(), _NeighbourhoodProxy_agentDid = /* @__PURE__ */ new WeakMap(), _NeighbourhoodProxy_sessions = /* @__PURE__ */ new WeakMap(), _NeighbourhoodProxy_sfuStatusCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3442,7 +3607,7 @@ var LinkQuery = class {
|
|
|
3442
3607
|
return true;
|
|
3443
3608
|
}
|
|
3444
3609
|
};
|
|
3445
|
-
var __classPrivateFieldSet$
|
|
3610
|
+
var __classPrivateFieldSet$9 = function(receiver, state, value, kind, f) {
|
|
3446
3611
|
if (kind === "m")
|
|
3447
3612
|
throw new TypeError("Private method is not writable");
|
|
3448
3613
|
if (kind === "a" && !f)
|
|
@@ -3451,7 +3616,7 @@ var __classPrivateFieldSet$8 = function(receiver, state, value, kind, f) {
|
|
|
3451
3616
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3452
3617
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3453
3618
|
};
|
|
3454
|
-
var __classPrivateFieldGet$
|
|
3619
|
+
var __classPrivateFieldGet$9 = function(receiver, state, kind, f) {
|
|
3455
3620
|
if (kind === "a" && !f)
|
|
3456
3621
|
throw new TypeError("Private accessor was defined without a getter");
|
|
3457
3622
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -3474,44 +3639,44 @@ var Literal = class {
|
|
|
3474
3639
|
if (url.startsWith("literal://"))
|
|
3475
3640
|
throw new Error("literal:// format is no longer supported. Use literal: instead.");
|
|
3476
3641
|
const l = new Literal();
|
|
3477
|
-
__classPrivateFieldSet$
|
|
3642
|
+
__classPrivateFieldSet$9(l, _Literal_url, url, "f");
|
|
3478
3643
|
return l;
|
|
3479
3644
|
}
|
|
3480
3645
|
static from(literal2) {
|
|
3481
3646
|
const l = new Literal();
|
|
3482
|
-
__classPrivateFieldSet$
|
|
3647
|
+
__classPrivateFieldSet$9(l, _Literal_literal, literal2, "f");
|
|
3483
3648
|
return l;
|
|
3484
3649
|
}
|
|
3485
3650
|
toUrl() {
|
|
3486
|
-
if (__classPrivateFieldGet$
|
|
3487
|
-
return __classPrivateFieldGet$
|
|
3488
|
-
if (__classPrivateFieldGet$
|
|
3651
|
+
if (__classPrivateFieldGet$9(this, _Literal_url, "f") && __classPrivateFieldGet$9(this, _Literal_literal, "f") === void 0)
|
|
3652
|
+
return __classPrivateFieldGet$9(this, _Literal_url, "f");
|
|
3653
|
+
if (__classPrivateFieldGet$9(this, _Literal_literal, "f") === void 0)
|
|
3489
3654
|
throw new Error("Can't turn empty Literal into URL");
|
|
3490
3655
|
let encoded;
|
|
3491
|
-
switch (typeof __classPrivateFieldGet$
|
|
3656
|
+
switch (typeof __classPrivateFieldGet$9(this, _Literal_literal, "f")) {
|
|
3492
3657
|
case "string":
|
|
3493
|
-
encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$
|
|
3658
|
+
encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
|
|
3494
3659
|
break;
|
|
3495
3660
|
case "number":
|
|
3496
|
-
encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$
|
|
3661
|
+
encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
|
|
3497
3662
|
break;
|
|
3498
3663
|
case "boolean":
|
|
3499
|
-
encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$
|
|
3664
|
+
encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
|
|
3500
3665
|
break;
|
|
3501
3666
|
case "object":
|
|
3502
|
-
encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$
|
|
3667
|
+
encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$9(this, _Literal_literal, "f")))}`;
|
|
3503
3668
|
break;
|
|
3504
3669
|
}
|
|
3505
3670
|
return `literal:${encoded}`;
|
|
3506
3671
|
}
|
|
3507
3672
|
get() {
|
|
3508
|
-
if (__classPrivateFieldGet$
|
|
3509
|
-
return __classPrivateFieldGet$
|
|
3510
|
-
if (!__classPrivateFieldGet$
|
|
3673
|
+
if (__classPrivateFieldGet$9(this, _Literal_literal, "f") !== void 0)
|
|
3674
|
+
return __classPrivateFieldGet$9(this, _Literal_literal, "f");
|
|
3675
|
+
if (!__classPrivateFieldGet$9(this, _Literal_url, "f"))
|
|
3511
3676
|
throw new Error("Can't render empty Literal");
|
|
3512
|
-
if (!__classPrivateFieldGet$
|
|
3677
|
+
if (!__classPrivateFieldGet$9(this, _Literal_url, "f").startsWith("literal:"))
|
|
3513
3678
|
throw new Error("Can't render Literal from non-literal URL");
|
|
3514
|
-
const body = __classPrivateFieldGet$
|
|
3679
|
+
const body = __classPrivateFieldGet$9(this, _Literal_url, "f").substring(8);
|
|
3515
3680
|
if (body.startsWith("string:")) {
|
|
3516
3681
|
return decodeURIComponent(body.substring(7));
|
|
3517
3682
|
}
|
|
@@ -4894,7 +5059,7 @@ function invalidatePerspectiveCache(perspectiveUUID) {
|
|
|
4894
5059
|
}
|
|
4895
5060
|
}
|
|
4896
5061
|
}
|
|
4897
|
-
var __classPrivateFieldSet$
|
|
5062
|
+
var __classPrivateFieldSet$8 = function(receiver, state, value, kind, f) {
|
|
4898
5063
|
if (kind === "m")
|
|
4899
5064
|
throw new TypeError("Private method is not writable");
|
|
4900
5065
|
if (kind === "a" && !f)
|
|
@@ -4903,7 +5068,7 @@ var __classPrivateFieldSet$7 = function(receiver, state, value, kind, f) {
|
|
|
4903
5068
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
4904
5069
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
4905
5070
|
};
|
|
4906
|
-
var __classPrivateFieldGet$
|
|
5071
|
+
var __classPrivateFieldGet$8 = function(receiver, state, kind, f) {
|
|
4907
5072
|
if (kind === "a" && !f)
|
|
4908
5073
|
throw new TypeError("Private accessor was defined without a getter");
|
|
4909
5074
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -4995,102 +5160,102 @@ var LiveQuery = class {
|
|
|
4995
5160
|
this,
|
|
4996
5161
|
/* @__PURE__ */ new Set()
|
|
4997
5162
|
);
|
|
4998
|
-
__classPrivateFieldSet$
|
|
4999
|
-
__classPrivateFieldSet$
|
|
5000
|
-
__classPrivateFieldSet$
|
|
5001
|
-
__classPrivateFieldSet$
|
|
5002
|
-
__classPrivateFieldSet$
|
|
5003
|
-
__classPrivateFieldSet$
|
|
5163
|
+
__classPrivateFieldSet$8(this, _LiveQuery_client, client, "f");
|
|
5164
|
+
__classPrivateFieldSet$8(this, _LiveQuery_uuid, uuid, "f");
|
|
5165
|
+
__classPrivateFieldSet$8(this, _LiveQuery_open, open, "f");
|
|
5166
|
+
__classPrivateFieldSet$8(this, _LiveQuery_onResult, onResult, "f");
|
|
5167
|
+
__classPrivateFieldSet$8(this, _LiveQuery_unlisten, client.onQueryUpdate((update) => __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update)), "f");
|
|
5168
|
+
__classPrivateFieldSet$8(this, _LiveQuery_unreconnect, client.onReconnect(() => __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this)), "f");
|
|
5004
5169
|
}
|
|
5005
5170
|
get id() {
|
|
5006
|
-
return __classPrivateFieldGet$
|
|
5171
|
+
return __classPrivateFieldGet$8(this, _LiveQuery_id, "f");
|
|
5007
5172
|
}
|
|
5008
5173
|
get result() {
|
|
5009
|
-
return __classPrivateFieldGet$
|
|
5174
|
+
return __classPrivateFieldGet$8(this, _LiveQuery_result, "f");
|
|
5010
5175
|
}
|
|
5011
5176
|
get reopening() {
|
|
5012
|
-
return __classPrivateFieldGet$
|
|
5177
|
+
return __classPrivateFieldGet$8(this, _LiveQuery_reopening, "f");
|
|
5013
5178
|
}
|
|
5014
5179
|
onStatus(listener) {
|
|
5015
|
-
__classPrivateFieldGet$
|
|
5016
|
-
return () => __classPrivateFieldGet$
|
|
5180
|
+
__classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").add(listener);
|
|
5181
|
+
return () => __classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").delete(listener);
|
|
5017
5182
|
}
|
|
5018
5183
|
start() {
|
|
5019
5184
|
var _a;
|
|
5020
|
-
__classPrivateFieldGet$
|
|
5021
|
-
__classPrivateFieldSet$
|
|
5022
|
-
return __classPrivateFieldGet$
|
|
5185
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
|
|
5186
|
+
__classPrivateFieldSet$8(this, _LiveQuery_latest, __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_start).call(this, __classPrivateFieldSet$8(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"), ++_a), "f")), "f");
|
|
5187
|
+
return __classPrivateFieldGet$8(this, _LiveQuery_latest, "f");
|
|
5023
5188
|
}
|
|
5024
5189
|
dispose(options = {}) {
|
|
5025
5190
|
var _a;
|
|
5026
|
-
__classPrivateFieldSet$
|
|
5027
|
-
__classPrivateFieldSet$
|
|
5028
|
-
__classPrivateFieldGet$
|
|
5029
|
-
__classPrivateFieldGet$
|
|
5030
|
-
__classPrivateFieldGet$
|
|
5031
|
-
__classPrivateFieldGet$
|
|
5191
|
+
__classPrivateFieldSet$8(this, _LiveQuery_disposed, true, "f");
|
|
5192
|
+
__classPrivateFieldSet$8(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"), _a++, _a), "f");
|
|
5193
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
|
|
5194
|
+
__classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").clear();
|
|
5195
|
+
__classPrivateFieldGet$8(this, _LiveQuery_unlisten, "f").call(this);
|
|
5196
|
+
__classPrivateFieldGet$8(this, _LiveQuery_unreconnect, "f").call(this);
|
|
5032
5197
|
if (options.cancelOpening)
|
|
5033
|
-
__classPrivateFieldGet$
|
|
5034
|
-
if (__classPrivateFieldGet$
|
|
5035
|
-
__classPrivateFieldGet$
|
|
5198
|
+
__classPrivateFieldGet$8(this, _LiveQuery_opening, "f")?.abort();
|
|
5199
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_id, "f"))
|
|
5200
|
+
__classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), __classPrivateFieldGet$8(this, _LiveQuery_id, "f")).catch(() => {
|
|
5036
5201
|
});
|
|
5037
5202
|
}
|
|
5038
5203
|
};
|
|
5039
5204
|
_LiveQuery_client = /* @__PURE__ */ new WeakMap(), _LiveQuery_uuid = /* @__PURE__ */ new WeakMap(), _LiveQuery_open = /* @__PURE__ */ new WeakMap(), _LiveQuery_onResult = /* @__PURE__ */ new WeakMap(), _LiveQuery_id = /* @__PURE__ */ new WeakMap(), _LiveQuery_revision = /* @__PURE__ */ new WeakMap(), _LiveQuery_result = /* @__PURE__ */ new WeakMap(), _LiveQuery_started = /* @__PURE__ */ new WeakMap(), _LiveQuery_disposed = /* @__PURE__ */ new WeakMap(), _LiveQuery_generation = /* @__PURE__ */ new WeakMap(), _LiveQuery_latest = /* @__PURE__ */ new WeakMap(), _LiveQuery_buffer = /* @__PURE__ */ new WeakMap(), _LiveQuery_unlisten = /* @__PURE__ */ new WeakMap(), _LiveQuery_unreconnect = /* @__PURE__ */ new WeakMap(), _LiveQuery_opening = /* @__PURE__ */ new WeakMap(), _LiveQuery_retryTimer = /* @__PURE__ */ new WeakMap(), _LiveQuery_reopening = /* @__PURE__ */ new WeakMap(), _LiveQuery_statusListeners = /* @__PURE__ */ new WeakMap(), _LiveQuery_instances = /* @__PURE__ */ new WeakSet(), _LiveQuery_start = async function _LiveQuery_start2(generation) {
|
|
5040
|
-
__classPrivateFieldSet$
|
|
5205
|
+
__classPrivateFieldSet$8(this, _LiveQuery_buffer, [], "f");
|
|
5041
5206
|
const opening = new AbortController();
|
|
5042
|
-
__classPrivateFieldSet$
|
|
5207
|
+
__classPrivateFieldSet$8(this, _LiveQuery_opening, opening, "f");
|
|
5043
5208
|
let subscribed;
|
|
5044
5209
|
try {
|
|
5045
|
-
subscribed = await __classPrivateFieldGet$
|
|
5210
|
+
subscribed = await __classPrivateFieldGet$8(this, _LiveQuery_open, "f").call(this, opening.signal);
|
|
5046
5211
|
} catch (e) {
|
|
5047
|
-
if (generation === __classPrivateFieldGet$
|
|
5048
|
-
__classPrivateFieldSet$
|
|
5212
|
+
if (generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
|
|
5213
|
+
__classPrivateFieldSet$8(this, _LiveQuery_buffer, null, "f");
|
|
5049
5214
|
throw e;
|
|
5050
5215
|
} finally {
|
|
5051
|
-
if (__classPrivateFieldGet$
|
|
5052
|
-
__classPrivateFieldSet$
|
|
5216
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_opening, "f") === opening)
|
|
5217
|
+
__classPrivateFieldSet$8(this, _LiveQuery_opening, void 0, "f");
|
|
5053
5218
|
}
|
|
5054
|
-
if (__classPrivateFieldGet$
|
|
5055
|
-
__classPrivateFieldGet$
|
|
5219
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f")) {
|
|
5220
|
+
__classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), subscribed.subscriptionId).catch(() => {
|
|
5056
5221
|
});
|
|
5057
|
-
return __classPrivateFieldGet$
|
|
5222
|
+
return __classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") ? __classPrivateFieldGet$8(this, _LiveQuery_result, "f") ?? subscribed.result : __classPrivateFieldGet$8(this, _LiveQuery_latest, "f");
|
|
5058
5223
|
}
|
|
5059
|
-
__classPrivateFieldSet$
|
|
5060
|
-
__classPrivateFieldGet$
|
|
5061
|
-
return __classPrivateFieldGet$
|
|
5224
|
+
__classPrivateFieldSet$8(this, _LiveQuery_id, subscribed.subscriptionId, "f");
|
|
5225
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, subscribed.revision, subscribed.result);
|
|
5226
|
+
return __classPrivateFieldGet$8(this, _LiveQuery_result, "f");
|
|
5062
5227
|
}, _LiveQuery_reopen = function _LiveQuery_reopen2(failures = 0) {
|
|
5063
|
-
if (__classPrivateFieldGet$
|
|
5228
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f"))
|
|
5064
5229
|
return;
|
|
5065
5230
|
const reopened = this.start();
|
|
5066
|
-
const generation = __classPrivateFieldGet$
|
|
5231
|
+
const generation = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f");
|
|
5067
5232
|
reopened.then(() => {
|
|
5068
|
-
if (__classPrivateFieldGet$
|
|
5233
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f") || !__classPrivateFieldGet$8(this, _LiveQuery_reopening, "f"))
|
|
5069
5234
|
return;
|
|
5070
|
-
__classPrivateFieldSet$
|
|
5071
|
-
__classPrivateFieldGet$
|
|
5235
|
+
__classPrivateFieldSet$8(this, _LiveQuery_reopening, false, "f");
|
|
5236
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: "open" });
|
|
5072
5237
|
}, (error) => {
|
|
5073
|
-
if (__classPrivateFieldGet$
|
|
5238
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
|
|
5074
5239
|
return;
|
|
5075
5240
|
const retryInMs = reopenDelay(failures + 1);
|
|
5076
5241
|
console.error(`Error re-opening live query (attempt ${failures + 1}), retrying in ${Math.round(retryInMs)}ms:`, error);
|
|
5077
|
-
__classPrivateFieldSet$
|
|
5078
|
-
__classPrivateFieldGet$
|
|
5242
|
+
__classPrivateFieldSet$8(this, _LiveQuery_reopening, true, "f");
|
|
5243
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: "reopening", error, retryInMs });
|
|
5079
5244
|
const timer = setTimeout(() => {
|
|
5080
|
-
__classPrivateFieldSet$
|
|
5081
|
-
__classPrivateFieldGet$
|
|
5245
|
+
__classPrivateFieldSet$8(this, _LiveQuery_retryTimer, void 0, "f");
|
|
5246
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen2).call(this, failures + 1);
|
|
5082
5247
|
}, retryInMs);
|
|
5083
5248
|
if (typeof timer?.unref === "function")
|
|
5084
5249
|
timer.unref();
|
|
5085
|
-
__classPrivateFieldSet$
|
|
5250
|
+
__classPrivateFieldSet$8(this, _LiveQuery_retryTimer, timer, "f");
|
|
5086
5251
|
});
|
|
5087
5252
|
}, _LiveQuery_clearRetry = function _LiveQuery_clearRetry2() {
|
|
5088
|
-
if (__classPrivateFieldGet$
|
|
5253
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_retryTimer, "f") === void 0)
|
|
5089
5254
|
return;
|
|
5090
|
-
clearTimeout(__classPrivateFieldGet$
|
|
5091
|
-
__classPrivateFieldSet$
|
|
5255
|
+
clearTimeout(__classPrivateFieldGet$8(this, _LiveQuery_retryTimer, "f"));
|
|
5256
|
+
__classPrivateFieldSet$8(this, _LiveQuery_retryTimer, void 0, "f");
|
|
5092
5257
|
}, _LiveQuery_emit = function _LiveQuery_emit2(status) {
|
|
5093
|
-
for (const listener of [...__classPrivateFieldGet$
|
|
5258
|
+
for (const listener of [...__classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f")]) {
|
|
5094
5259
|
try {
|
|
5095
5260
|
listener(status);
|
|
5096
5261
|
} catch (e) {
|
|
@@ -5098,56 +5263,86 @@ _LiveQuery_client = /* @__PURE__ */ new WeakMap(), _LiveQuery_uuid = /* @__PURE_
|
|
|
5098
5263
|
}
|
|
5099
5264
|
}
|
|
5100
5265
|
}, _LiveQuery_replace = function _LiveQuery_replace2(revision, result) {
|
|
5101
|
-
__classPrivateFieldSet$
|
|
5102
|
-
__classPrivateFieldSet$
|
|
5103
|
-
const buffered = __classPrivateFieldGet$
|
|
5104
|
-
__classPrivateFieldSet$
|
|
5105
|
-
if (__classPrivateFieldGet$
|
|
5106
|
-
__classPrivateFieldGet$
|
|
5107
|
-
__classPrivateFieldSet$
|
|
5266
|
+
__classPrivateFieldSet$8(this, _LiveQuery_revision, revision, "f");
|
|
5267
|
+
__classPrivateFieldSet$8(this, _LiveQuery_result, result, "f");
|
|
5268
|
+
const buffered = __classPrivateFieldGet$8(this, _LiveQuery_buffer, "f") ?? [];
|
|
5269
|
+
__classPrivateFieldSet$8(this, _LiveQuery_buffer, null, "f");
|
|
5270
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_started, "f"))
|
|
5271
|
+
__classPrivateFieldGet$8(this, _LiveQuery_onResult, "f").call(this, result);
|
|
5272
|
+
__classPrivateFieldSet$8(this, _LiveQuery_started, true, "f");
|
|
5108
5273
|
for (const update of buffered)
|
|
5109
|
-
__classPrivateFieldGet$
|
|
5274
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update);
|
|
5110
5275
|
}, _LiveQuery_receive = function _LiveQuery_receive2(update) {
|
|
5111
|
-
if (__classPrivateFieldGet$
|
|
5112
|
-
__classPrivateFieldGet$
|
|
5276
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_buffer, "f")) {
|
|
5277
|
+
__classPrivateFieldGet$8(this, _LiveQuery_buffer, "f").push(update);
|
|
5113
5278
|
return;
|
|
5114
5279
|
}
|
|
5115
5280
|
if ("lagged" in update) {
|
|
5116
|
-
if (__classPrivateFieldGet$
|
|
5117
|
-
__classPrivateFieldGet$
|
|
5281
|
+
if (__classPrivateFieldGet$8(this, _LiveQuery_id, "f"))
|
|
5282
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
|
|
5118
5283
|
return;
|
|
5119
5284
|
}
|
|
5120
|
-
if (update.subscriptionId !== __classPrivateFieldGet$
|
|
5285
|
+
if (update.subscriptionId !== __classPrivateFieldGet$8(this, _LiveQuery_id, "f") || update.revision <= __classPrivateFieldGet$8(this, _LiveQuery_revision, "f"))
|
|
5121
5286
|
return;
|
|
5122
|
-
if (update.revision !== __classPrivateFieldGet$
|
|
5123
|
-
__classPrivateFieldGet$
|
|
5287
|
+
if (update.revision !== __classPrivateFieldGet$8(this, _LiveQuery_revision, "f") + 1) {
|
|
5288
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
|
|
5124
5289
|
return;
|
|
5125
5290
|
}
|
|
5126
5291
|
let result;
|
|
5127
5292
|
try {
|
|
5128
|
-
result = applyUpdate(__classPrivateFieldGet$
|
|
5293
|
+
result = applyUpdate(__classPrivateFieldGet$8(this, _LiveQuery_result, "f"), update);
|
|
5129
5294
|
} catch {
|
|
5130
|
-
__classPrivateFieldGet$
|
|
5295
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
|
|
5131
5296
|
return;
|
|
5132
5297
|
}
|
|
5133
|
-
__classPrivateFieldSet$
|
|
5134
|
-
__classPrivateFieldSet$
|
|
5135
|
-
__classPrivateFieldGet$
|
|
5298
|
+
__classPrivateFieldSet$8(this, _LiveQuery_revision, update.revision, "f");
|
|
5299
|
+
__classPrivateFieldSet$8(this, _LiveQuery_result, result, "f");
|
|
5300
|
+
__classPrivateFieldGet$8(this, _LiveQuery_onResult, "f").call(this, __classPrivateFieldGet$8(this, _LiveQuery_result, "f"));
|
|
5136
5301
|
}, _LiveQuery_resync = function _LiveQuery_resync2() {
|
|
5137
|
-
const generation = __classPrivateFieldGet$
|
|
5138
|
-
const id = __classPrivateFieldGet$
|
|
5139
|
-
__classPrivateFieldSet$
|
|
5140
|
-
__classPrivateFieldGet$
|
|
5141
|
-
if (!__classPrivateFieldGet$
|
|
5142
|
-
__classPrivateFieldGet$
|
|
5302
|
+
const generation = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f");
|
|
5303
|
+
const id = __classPrivateFieldGet$8(this, _LiveQuery_id, "f");
|
|
5304
|
+
__classPrivateFieldSet$8(this, _LiveQuery_buffer, [], "f");
|
|
5305
|
+
__classPrivateFieldGet$8(this, _LiveQuery_client, "f").resyncSubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), id).then(({ revision, result }) => {
|
|
5306
|
+
if (!__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
|
|
5307
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, revision, result);
|
|
5143
5308
|
}, () => {
|
|
5144
|
-
if (!__classPrivateFieldGet$
|
|
5145
|
-
__classPrivateFieldGet$
|
|
5309
|
+
if (!__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f")) {
|
|
5310
|
+
__classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), id).catch(() => {
|
|
5146
5311
|
});
|
|
5147
|
-
__classPrivateFieldGet$
|
|
5312
|
+
__classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this);
|
|
5148
5313
|
}
|
|
5149
5314
|
});
|
|
5150
5315
|
};
|
|
5316
|
+
function compareCodePoints(a, b) {
|
|
5317
|
+
const as = Array.from(a);
|
|
5318
|
+
const bs = Array.from(b);
|
|
5319
|
+
const n = Math.min(as.length, bs.length);
|
|
5320
|
+
for (let i = 0; i < n; i++) {
|
|
5321
|
+
const d = as[i].codePointAt(0) - bs[i].codePointAt(0);
|
|
5322
|
+
if (d !== 0)
|
|
5323
|
+
return d;
|
|
5324
|
+
}
|
|
5325
|
+
return as.length - bs.length;
|
|
5326
|
+
}
|
|
5327
|
+
var STATE_VALUE_DECIMAL = /^[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;
|
|
5328
|
+
var STATE_VALUE_INFINITE = /^[+-]?[iI][nN][fF](?:[iI][nN][iI][tT][yY])?$/;
|
|
5329
|
+
function decodeStateValue(target) {
|
|
5330
|
+
const payload = target.startsWith("literal:number:") ? target.slice("literal:number:".length) : void 0;
|
|
5331
|
+
if (payload === void 0)
|
|
5332
|
+
return NaN;
|
|
5333
|
+
let decoded;
|
|
5334
|
+
try {
|
|
5335
|
+
decoded = decodeURIComponent(payload);
|
|
5336
|
+
} catch {
|
|
5337
|
+
return NaN;
|
|
5338
|
+
}
|
|
5339
|
+
if (STATE_VALUE_DECIMAL.test(decoded))
|
|
5340
|
+
return Number(decoded);
|
|
5341
|
+
if (STATE_VALUE_INFINITE.test(decoded)) {
|
|
5342
|
+
return decoded.startsWith("-") ? -Infinity : Infinity;
|
|
5343
|
+
}
|
|
5344
|
+
return NaN;
|
|
5345
|
+
}
|
|
5151
5346
|
function isModelQueryShape(v) {
|
|
5152
5347
|
if (typeof v !== "object" || v === null || typeof v.className !== "string" || v.className.length === 0) {
|
|
5153
5348
|
return false;
|
|
@@ -5427,7 +5622,7 @@ var SHACLFlow = class {
|
|
|
5427
5622
|
const stateName = nameLink ? Literal.fromUrl(nameLink.target).get() : "";
|
|
5428
5623
|
stateUriToName.set(stateUri, stateName);
|
|
5429
5624
|
const valueLink = links.find((l) => l.source === stateUri && l.predicate === "ad4m://stateValue");
|
|
5430
|
-
const stateValue = valueLink ?
|
|
5625
|
+
const stateValue = valueLink ? decodeStateValue(valueLink.target) : 0;
|
|
5431
5626
|
const hintLink = links.find((l) => l.source === stateUri && l.predicate === "ad4m://interpretationHint");
|
|
5432
5627
|
let interpretationHint;
|
|
5433
5628
|
if (hintLink) {
|
|
@@ -5483,7 +5678,18 @@ var SHACLFlow = class {
|
|
|
5483
5678
|
...consensusRule !== void 0 ? { consensusRule } : {}
|
|
5484
5679
|
});
|
|
5485
5680
|
}
|
|
5486
|
-
flow._states.sort((a, b) =>
|
|
5681
|
+
flow._states.sort((a, b) => {
|
|
5682
|
+
const aNaN = Number.isNaN(a.value);
|
|
5683
|
+
const bNaN = Number.isNaN(b.value);
|
|
5684
|
+
if (aNaN !== bNaN)
|
|
5685
|
+
return aNaN ? 1 : -1;
|
|
5686
|
+
if (!aNaN && a.value !== b.value)
|
|
5687
|
+
return a.value < b.value ? -1 : 1;
|
|
5688
|
+
return compareCodePoints(a.name, b.name);
|
|
5689
|
+
});
|
|
5690
|
+
if (flow._states.length > 1 && !Number.isNaN(flow._states[0].value) && flow._states[0].value === flow._states[1].value) {
|
|
5691
|
+
console.warn(`flow \`${flowUri}\`: states \`${flow._states[0].name}\` and \`${flow._states[1].name}\` tie on the lowest value ${flow._states[0].value}; \`${flow._states[0].name}\` is the initial state by name order (#1202)`);
|
|
5692
|
+
}
|
|
5487
5693
|
const transitionLinks = links.filter((l) => l.source === flowUri && l.predicate === "ad4m://hasTransition");
|
|
5488
5694
|
for (const transitionLink of transitionLinks) {
|
|
5489
5695
|
const transitionUri = transitionLink.target;
|
|
@@ -5602,14 +5808,14 @@ SHACLFlow.STATE_AND_TRANSITION_PREDICATES = [
|
|
|
5602
5808
|
"ad4m://toState",
|
|
5603
5809
|
"ad4m://transitionActions"
|
|
5604
5810
|
];
|
|
5605
|
-
var __classPrivateFieldGet$
|
|
5811
|
+
var __classPrivateFieldGet$7 = function(receiver, state, kind, f) {
|
|
5606
5812
|
if (kind === "a" && !f)
|
|
5607
5813
|
throw new TypeError("Private accessor was defined without a getter");
|
|
5608
5814
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
5609
5815
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5610
5816
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5611
5817
|
};
|
|
5612
|
-
var __classPrivateFieldSet$
|
|
5818
|
+
var __classPrivateFieldSet$7 = function(receiver, state, value, kind, f) {
|
|
5613
5819
|
if (kind === "m")
|
|
5614
5820
|
throw new TypeError("Private method is not writable");
|
|
5615
5821
|
if (kind === "a" && !f)
|
|
@@ -5651,51 +5857,51 @@ var QuerySubscriptionProxy = class {
|
|
|
5651
5857
|
_QuerySubscriptionProxy_initResolve.set(this, void 0);
|
|
5652
5858
|
_QuerySubscriptionProxy_initReject.set(this, void 0);
|
|
5653
5859
|
const open = className === void 0 ? (signal) => client.subscribeQuery(uuid, query, { signal }) : (signal) => client.modelSubscribe(uuid, className, query, { signal });
|
|
5654
|
-
__classPrivateFieldSet$
|
|
5655
|
-
__classPrivateFieldSet$
|
|
5656
|
-
__classPrivateFieldSet$
|
|
5657
|
-
__classPrivateFieldSet$
|
|
5860
|
+
__classPrivateFieldSet$7(this, _QuerySubscriptionProxy_live, new LiveQuery(client, uuid, open, (result) => __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, result)), "f");
|
|
5861
|
+
__classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
|
|
5862
|
+
__classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
|
|
5863
|
+
__classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, reject, "f");
|
|
5658
5864
|
}), "f");
|
|
5659
|
-
__classPrivateFieldGet$
|
|
5865
|
+
__classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initialized, "f").catch(() => {
|
|
5660
5866
|
});
|
|
5661
5867
|
}
|
|
5662
5868
|
async subscribe() {
|
|
5663
5869
|
try {
|
|
5664
|
-
__classPrivateFieldGet$
|
|
5870
|
+
__classPrivateFieldGet$7(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, await __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").start());
|
|
5665
5871
|
} catch (error) {
|
|
5666
|
-
__classPrivateFieldGet$
|
|
5667
|
-
__classPrivateFieldSet$
|
|
5872
|
+
__classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initReject, "f")?.call(this, error);
|
|
5873
|
+
__classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, void 0, "f"), "f");
|
|
5668
5874
|
throw error;
|
|
5669
5875
|
}
|
|
5670
5876
|
}
|
|
5671
5877
|
get id() {
|
|
5672
|
-
return __classPrivateFieldGet$
|
|
5878
|
+
return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").id;
|
|
5673
5879
|
}
|
|
5674
5880
|
get initialized() {
|
|
5675
|
-
return __classPrivateFieldGet$
|
|
5881
|
+
return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initialized, "f");
|
|
5676
5882
|
}
|
|
5677
5883
|
get result() {
|
|
5678
|
-
return __classPrivateFieldGet$
|
|
5884
|
+
return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").result;
|
|
5679
5885
|
}
|
|
5680
5886
|
onResult(callback) {
|
|
5681
|
-
__classPrivateFieldGet$
|
|
5682
|
-
return () => __classPrivateFieldGet$
|
|
5887
|
+
__classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
|
|
5888
|
+
return () => __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
|
|
5683
5889
|
}
|
|
5684
5890
|
get reopening() {
|
|
5685
|
-
return __classPrivateFieldGet$
|
|
5891
|
+
return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").reopening;
|
|
5686
5892
|
}
|
|
5687
5893
|
onStatus(listener) {
|
|
5688
|
-
return __classPrivateFieldGet$
|
|
5894
|
+
return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").onStatus(listener);
|
|
5689
5895
|
}
|
|
5690
5896
|
dispose(options = {}) {
|
|
5691
|
-
__classPrivateFieldGet$
|
|
5692
|
-
__classPrivateFieldGet$
|
|
5897
|
+
__classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").dispose(options);
|
|
5898
|
+
__classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").clear();
|
|
5693
5899
|
}
|
|
5694
5900
|
};
|
|
5695
5901
|
_QuerySubscriptionProxy_live = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_callbacks = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_initialized = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_initResolve = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_initReject = /* @__PURE__ */ new WeakMap(), _QuerySubscriptionProxy_instances = /* @__PURE__ */ new WeakSet(), _QuerySubscriptionProxy_deliver = function _QuerySubscriptionProxy_deliver2(result) {
|
|
5696
|
-
__classPrivateFieldGet$
|
|
5697
|
-
__classPrivateFieldSet$
|
|
5698
|
-
for (const callback of __classPrivateFieldGet$
|
|
5902
|
+
__classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initResolve, "f")?.call(this, true);
|
|
5903
|
+
__classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, void 0, "f"), "f");
|
|
5904
|
+
for (const callback of __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f")) {
|
|
5699
5905
|
try {
|
|
5700
5906
|
callback(result);
|
|
5701
5907
|
} catch (e) {
|
|
@@ -5705,7 +5911,7 @@ _QuerySubscriptionProxy_live = /* @__PURE__ */ new WeakMap(), _QuerySubscription
|
|
|
5705
5911
|
};
|
|
5706
5912
|
var PerspectiveProxy = class {
|
|
5707
5913
|
get client() {
|
|
5708
|
-
return __classPrivateFieldGet$
|
|
5914
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f");
|
|
5709
5915
|
}
|
|
5710
5916
|
constructor(handle, ad4m) {
|
|
5711
5917
|
_PerspectiveProxy_handle.set(this, void 0);
|
|
@@ -5719,20 +5925,20 @@ var PerspectiveProxy = class {
|
|
|
5719
5925
|
this,
|
|
5720
5926
|
null
|
|
5721
5927
|
);
|
|
5722
|
-
__classPrivateFieldSet$
|
|
5723
|
-
__classPrivateFieldSet$
|
|
5724
|
-
this.uuid = __classPrivateFieldGet$
|
|
5725
|
-
this.name = __classPrivateFieldGet$
|
|
5726
|
-
this.owners = __classPrivateFieldGet$
|
|
5727
|
-
this.sharedUrl = __classPrivateFieldGet$
|
|
5728
|
-
this.neighbourhood = __classPrivateFieldGet$
|
|
5729
|
-
this.state = __classPrivateFieldGet$
|
|
5928
|
+
__classPrivateFieldSet$7(this, _PerspectiveProxy_handle, handle, "f");
|
|
5929
|
+
__classPrivateFieldSet$7(this, _PerspectiveProxy_client, ad4m, "f");
|
|
5930
|
+
this.uuid = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid;
|
|
5931
|
+
this.name = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").name;
|
|
5932
|
+
this.owners = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").owners;
|
|
5933
|
+
this.sharedUrl = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").sharedUrl;
|
|
5934
|
+
this.neighbourhood = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").neighbourhood;
|
|
5935
|
+
this.state = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").state;
|
|
5730
5936
|
}
|
|
5731
5937
|
updateHandle(handle) {
|
|
5732
|
-
if (handle.uuid !== __classPrivateFieldGet$
|
|
5733
|
-
throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch \u2014 proxy is bound to "${__classPrivateFieldGet$
|
|
5938
|
+
if (handle.uuid !== __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid) {
|
|
5939
|
+
throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch \u2014 proxy is bound to "${__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid}" but received handle with UUID "${handle.uuid}". This would silently diverge from listeners registered under the original UUID.`);
|
|
5734
5940
|
}
|
|
5735
|
-
__classPrivateFieldSet$
|
|
5941
|
+
__classPrivateFieldSet$7(this, _PerspectiveProxy_handle, handle, "f");
|
|
5736
5942
|
this.uuid = handle.uuid;
|
|
5737
5943
|
this.name = handle.name;
|
|
5738
5944
|
this.owners = handle.owners;
|
|
@@ -5744,135 +5950,135 @@ var PerspectiveProxy = class {
|
|
|
5744
5950
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5745
5951
|
}
|
|
5746
5952
|
async executeAction(actions, expression, parameters, batchId) {
|
|
5747
|
-
const result = await __classPrivateFieldGet$
|
|
5748
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
5953
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").executeCommands(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify(actions), expression, JSON.stringify(parameters), batchId);
|
|
5954
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5749
5955
|
return result;
|
|
5750
5956
|
}
|
|
5751
5957
|
async get(query, options) {
|
|
5752
|
-
return await __classPrivateFieldGet$
|
|
5958
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
|
|
5753
5959
|
}
|
|
5754
5960
|
async runInterpretation(transcript, basePrefix, classes, options) {
|
|
5755
5961
|
const { existingScope, mintScope, observe, ...callOptions } = options ?? {};
|
|
5756
|
-
return await __classPrivateFieldGet$
|
|
5962
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, callOptions);
|
|
5757
5963
|
}
|
|
5758
5964
|
async runInterpretationWithHarness(transcript, basePrefix, maxToolCalls, classes, modelOverride, observationId, emitDebugEvents, options) {
|
|
5759
|
-
return await __classPrivateFieldGet$
|
|
5965
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runInterpretationWithHarness(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, maxToolCalls, classes, modelOverride, void 0, observationId, emitDebugEvents, options);
|
|
5760
5966
|
}
|
|
5761
5967
|
async runAgent(messages2, settings, options) {
|
|
5762
|
-
return await __classPrivateFieldGet$
|
|
5968
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runAgent(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, messages2, settings, options);
|
|
5763
5969
|
}
|
|
5764
5970
|
async addAutoProcessor(config) {
|
|
5765
|
-
return await __classPrivateFieldGet$
|
|
5971
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addAutoProcessor(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, config);
|
|
5766
5972
|
}
|
|
5767
5973
|
async removeAutoProcessor(processorId) {
|
|
5768
|
-
return await __classPrivateFieldGet$
|
|
5974
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeAutoProcessor(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, processorId);
|
|
5769
5975
|
}
|
|
5770
5976
|
async interpretationOverlays() {
|
|
5771
|
-
if (__classPrivateFieldGet$
|
|
5772
|
-
return [...await __classPrivateFieldGet$
|
|
5977
|
+
if (__classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f")) {
|
|
5978
|
+
return [...await __classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f")];
|
|
5773
5979
|
}
|
|
5774
|
-
const pending = __classPrivateFieldGet$
|
|
5775
|
-
__classPrivateFieldSet$
|
|
5980
|
+
const pending = __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").interpretationOverlays(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5981
|
+
__classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, pending, "f");
|
|
5776
5982
|
try {
|
|
5777
5983
|
return [...await pending];
|
|
5778
5984
|
} finally {
|
|
5779
|
-
if (__classPrivateFieldGet$
|
|
5780
|
-
__classPrivateFieldSet$
|
|
5985
|
+
if (__classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f") === pending) {
|
|
5986
|
+
__classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
|
|
5781
5987
|
}
|
|
5782
5988
|
}
|
|
5783
5989
|
}
|
|
5784
5990
|
async acceptInterpretation(base, property) {
|
|
5785
5991
|
try {
|
|
5786
|
-
return await __classPrivateFieldGet$
|
|
5992
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").acceptInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, base, property);
|
|
5787
5993
|
} finally {
|
|
5788
|
-
__classPrivateFieldSet$
|
|
5994
|
+
__classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
|
|
5789
5995
|
}
|
|
5790
5996
|
}
|
|
5791
5997
|
async rejectInterpretation(base, property) {
|
|
5792
5998
|
try {
|
|
5793
|
-
return await __classPrivateFieldGet$
|
|
5999
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").rejectInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, base, property);
|
|
5794
6000
|
} finally {
|
|
5795
|
-
__classPrivateFieldSet$
|
|
6001
|
+
__classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
|
|
5796
6002
|
}
|
|
5797
6003
|
}
|
|
5798
6004
|
async proposeFlowTransition(instanceUri, toState, rationale, outputs) {
|
|
5799
|
-
return await __classPrivateFieldGet$
|
|
6005
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").proposeFlowTransition(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instanceUri, toState, rationale, outputs);
|
|
5800
6006
|
}
|
|
5801
6007
|
async acceptFlowProposal(proposalUri) {
|
|
5802
|
-
return await __classPrivateFieldGet$
|
|
6008
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").acceptFlowProposal(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
|
|
5803
6009
|
}
|
|
5804
6010
|
async rejectFlowProposal(proposalUri) {
|
|
5805
|
-
return await __classPrivateFieldGet$
|
|
6011
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").rejectFlowProposal(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
|
|
5806
6012
|
}
|
|
5807
6013
|
async verifyFlowReceipt(receipt) {
|
|
5808
|
-
return await __classPrivateFieldGet$
|
|
6014
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").verifyFlowReceipt(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, receipt);
|
|
5809
6015
|
}
|
|
5810
6016
|
async flowValidOutputs(flow, state) {
|
|
5811
|
-
return await __classPrivateFieldGet$
|
|
6017
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowValidOutputs(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, flow, state);
|
|
5812
6018
|
}
|
|
5813
6019
|
async flowStates(instances) {
|
|
5814
|
-
return await __classPrivateFieldGet$
|
|
6020
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowStates(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instances);
|
|
5815
6021
|
}
|
|
5816
6022
|
async flowFired(instance) {
|
|
5817
|
-
return await __classPrivateFieldGet$
|
|
6023
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowFired(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instance);
|
|
5818
6024
|
}
|
|
5819
6025
|
onFlowStateChanged(handler) {
|
|
5820
6026
|
return this.on("flow-state-changed", handler);
|
|
5821
6027
|
}
|
|
5822
6028
|
async mintFlowReceipt(instanceUri) {
|
|
5823
|
-
return await __classPrivateFieldGet$
|
|
6029
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").mintFlowReceipt(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instanceUri);
|
|
5824
6030
|
}
|
|
5825
6031
|
async infer(query, options) {
|
|
5826
|
-
return await __classPrivateFieldGet$
|
|
6032
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
|
|
5827
6033
|
}
|
|
5828
6034
|
async querySparql(query, options) {
|
|
5829
|
-
const cached = getCachedResult(__classPrivateFieldGet$
|
|
6035
|
+
const cached = getCachedResult(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query);
|
|
5830
6036
|
if (cached !== void 0)
|
|
5831
6037
|
return cached;
|
|
5832
|
-
const result = await __classPrivateFieldGet$
|
|
5833
|
-
setCachedResult(__classPrivateFieldGet$
|
|
6038
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
|
|
6039
|
+
setCachedResult(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, result);
|
|
5834
6040
|
return result;
|
|
5835
6041
|
}
|
|
5836
6042
|
async modelQuery(className, queryJson, options) {
|
|
5837
|
-
return await __classPrivateFieldGet$
|
|
6043
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, options);
|
|
5838
6044
|
}
|
|
5839
6045
|
async subjectClassesOf(uris) {
|
|
5840
6046
|
if (uris.length === 0)
|
|
5841
6047
|
return {};
|
|
5842
|
-
return await __classPrivateFieldGet$
|
|
6048
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").subjectClassesOf(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, uris);
|
|
5843
6049
|
}
|
|
5844
6050
|
async evaluateGetters(className, instanceIds, propertyNames) {
|
|
5845
|
-
return await __classPrivateFieldGet$
|
|
6051
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, propertyNames);
|
|
5846
6052
|
}
|
|
5847
6053
|
async modelSubscribe(className, queryJson) {
|
|
5848
|
-
return await __classPrivateFieldGet$
|
|
6054
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson);
|
|
5849
6055
|
}
|
|
5850
6056
|
async add(link, status = "shared", batchId) {
|
|
5851
|
-
const result = await __classPrivateFieldGet$
|
|
5852
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6057
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
|
|
6058
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5853
6059
|
return result;
|
|
5854
6060
|
}
|
|
5855
6061
|
async addLinks(links, status = "shared", batchId) {
|
|
5856
|
-
const result = await __classPrivateFieldGet$
|
|
5857
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6062
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
|
|
6063
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5858
6064
|
return result;
|
|
5859
6065
|
}
|
|
5860
6066
|
async removeLinks(links, batchId) {
|
|
5861
|
-
const result = await __classPrivateFieldGet$
|
|
5862
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6067
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
|
|
6068
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5863
6069
|
return result;
|
|
5864
6070
|
}
|
|
5865
6071
|
async linkMutations(mutations, status = "shared") {
|
|
5866
|
-
const result = await __classPrivateFieldGet$
|
|
5867
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6072
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
|
|
6073
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5868
6074
|
return result;
|
|
5869
6075
|
}
|
|
5870
6076
|
async addLinkExpression(link, status = "shared", batchId) {
|
|
5871
|
-
return await __classPrivateFieldGet$
|
|
6077
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
|
|
5872
6078
|
}
|
|
5873
6079
|
async update(oldLink, newLink, batchId) {
|
|
5874
|
-
const result = await __classPrivateFieldGet$
|
|
5875
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6080
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
|
|
6081
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5876
6082
|
return result;
|
|
5877
6083
|
}
|
|
5878
6084
|
async remove(link, batchId) {
|
|
@@ -5893,39 +6099,39 @@ var PerspectiveProxy = class {
|
|
|
5893
6099
|
} else {
|
|
5894
6100
|
resolvedLink = link;
|
|
5895
6101
|
}
|
|
5896
|
-
const result = await __classPrivateFieldGet$
|
|
5897
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6102
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, resolvedLink, batchId);
|
|
6103
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5898
6104
|
return result;
|
|
5899
6105
|
}
|
|
5900
6106
|
async createBatch() {
|
|
5901
|
-
return await __classPrivateFieldGet$
|
|
6107
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5902
6108
|
}
|
|
5903
6109
|
async commitBatch(batchId) {
|
|
5904
|
-
const result = await __classPrivateFieldGet$
|
|
5905
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6110
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, batchId);
|
|
6111
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5906
6112
|
return result;
|
|
5907
6113
|
}
|
|
5908
6114
|
async getExpression(expressionURI) {
|
|
5909
|
-
return await __classPrivateFieldGet$
|
|
6115
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
|
|
5910
6116
|
}
|
|
5911
6117
|
async createExpression(content, languageAddress) {
|
|
5912
|
-
return await __classPrivateFieldGet$
|
|
6118
|
+
return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
|
|
5913
6119
|
}
|
|
5914
6120
|
on(type, handler) {
|
|
5915
|
-
const release = __classPrivateFieldGet$
|
|
6121
|
+
const release = __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").on(type, (event) => handler(event), { perspective: __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid });
|
|
5916
6122
|
const releaseOnce = () => {
|
|
5917
|
-
if (__classPrivateFieldGet$
|
|
6123
|
+
if (__classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f").delete(releaseOnce))
|
|
5918
6124
|
release();
|
|
5919
6125
|
};
|
|
5920
|
-
__classPrivateFieldGet$
|
|
6126
|
+
__classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f").add(releaseOnce);
|
|
5921
6127
|
return releaseOnce;
|
|
5922
6128
|
}
|
|
5923
6129
|
dispose() {
|
|
5924
|
-
for (const release of [...__classPrivateFieldGet$
|
|
6130
|
+
for (const release of [...__classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f")])
|
|
5925
6131
|
release();
|
|
5926
6132
|
}
|
|
5927
6133
|
async snapshot() {
|
|
5928
|
-
return __classPrivateFieldGet$
|
|
6134
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
5929
6135
|
}
|
|
5930
6136
|
async loadSnapshot(snapshot) {
|
|
5931
6137
|
const cleanedSnapshot = JSON.parse(JSON.stringify(snapshot));
|
|
@@ -6033,10 +6239,10 @@ var PerspectiveProxy = class {
|
|
|
6033
6239
|
return typeof code2 === "string" ? code2 : null;
|
|
6034
6240
|
}
|
|
6035
6241
|
async addSdna(name, sdnaCode, sdnaType, shaclJson) {
|
|
6036
|
-
return __classPrivateFieldGet$
|
|
6242
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
|
|
6037
6243
|
}
|
|
6038
6244
|
async addSdnaAll(entries) {
|
|
6039
|
-
return __classPrivateFieldGet$
|
|
6245
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addSdnaBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, entries);
|
|
6040
6246
|
}
|
|
6041
6247
|
async ensureSubjectClasses(jsClasses) {
|
|
6042
6248
|
const entries = [];
|
|
@@ -6044,7 +6250,7 @@ var PerspectiveProxy = class {
|
|
|
6044
6250
|
if (Object.prototype.hasOwnProperty.call(jsClass, "builtinUri"))
|
|
6045
6251
|
continue;
|
|
6046
6252
|
const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
|
|
6047
|
-
if (__classPrivateFieldGet$
|
|
6253
|
+
if (__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
|
|
6048
6254
|
continue;
|
|
6049
6255
|
if (!jsClass.generateSHACL) {
|
|
6050
6256
|
throw new Error(`Class ${jsClass.name} must have generateSHACL(). Use @Model decorator.`);
|
|
@@ -6060,26 +6266,26 @@ var PerspectiveProxy = class {
|
|
|
6060
6266
|
return;
|
|
6061
6267
|
await this.addSdnaAll(entries);
|
|
6062
6268
|
for (const entry of entries) {
|
|
6063
|
-
__classPrivateFieldGet$
|
|
6269
|
+
__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(entry.name);
|
|
6064
6270
|
}
|
|
6065
6271
|
}
|
|
6066
6272
|
async addShacl(name, shape) {
|
|
6067
6273
|
await this.addSdna(name, "", "subject_class", JSON.stringify(shape.toJSON()));
|
|
6068
6274
|
}
|
|
6069
6275
|
async getShacl(name) {
|
|
6070
|
-
const result = await __classPrivateFieldGet$
|
|
6276
|
+
const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShacl(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name);
|
|
6071
6277
|
if (!result)
|
|
6072
6278
|
return null;
|
|
6073
6279
|
return SHACLShape.fromLinks(result.links, result.shapeUri);
|
|
6074
6280
|
}
|
|
6075
6281
|
async getShaclNames() {
|
|
6076
|
-
return __classPrivateFieldGet$
|
|
6282
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShaclNames(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
6077
6283
|
}
|
|
6078
6284
|
async getShaclTargetClass(name) {
|
|
6079
|
-
return __classPrivateFieldGet$
|
|
6285
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShaclTargetClass(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name);
|
|
6080
6286
|
}
|
|
6081
6287
|
async getAllShacl() {
|
|
6082
|
-
const entries = await __classPrivateFieldGet$
|
|
6288
|
+
const entries = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getAllShacl(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
6083
6289
|
const shapes = [];
|
|
6084
6290
|
for (const { name, shapeUri, links } of entries) {
|
|
6085
6291
|
try {
|
|
@@ -6168,7 +6374,7 @@ var PerspectiveProxy = class {
|
|
|
6168
6374
|
let className;
|
|
6169
6375
|
if (typeof subjectClass === "string") {
|
|
6170
6376
|
className = subjectClass;
|
|
6171
|
-
await __classPrivateFieldGet$
|
|
6377
|
+
await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
|
|
6172
6378
|
className,
|
|
6173
6379
|
initialValues
|
|
6174
6380
|
}), exprAddr, initialValues ? JSON.stringify(initialValues) : void 0, batchId);
|
|
@@ -6178,7 +6384,7 @@ var PerspectiveProxy = class {
|
|
|
6178
6384
|
if (!resolvedClassName) {
|
|
6179
6385
|
throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
|
|
6180
6386
|
}
|
|
6181
|
-
await __classPrivateFieldGet$
|
|
6387
|
+
await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
|
|
6182
6388
|
className: resolvedClassName,
|
|
6183
6389
|
initialValues
|
|
6184
6390
|
}), exprAddr, initialValues ? JSON.stringify(initialValues) : void 0, batchId);
|
|
@@ -6189,19 +6395,19 @@ var PerspectiveProxy = class {
|
|
|
6189
6395
|
return exprAddr;
|
|
6190
6396
|
}
|
|
6191
6397
|
async updateSubject(className, exprAddr, values, batchId) {
|
|
6192
|
-
await __classPrivateFieldGet$
|
|
6193
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6398
|
+
await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").updateSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, JSON.stringify(values), batchId);
|
|
6399
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
6194
6400
|
}
|
|
6195
6401
|
async getSubjectData(subjectClass, exprAddr) {
|
|
6196
6402
|
if (typeof subjectClass === "string") {
|
|
6197
|
-
return JSON.parse(await __classPrivateFieldGet$
|
|
6403
|
+
return JSON.parse(await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
|
|
6198
6404
|
}
|
|
6199
6405
|
const obj = subjectClass;
|
|
6200
6406
|
const resolvedClassName = obj.className || obj.constructor?.className || obj.constructor?.prototype?.className || await this.findClassByProperties(obj);
|
|
6201
6407
|
if (!resolvedClassName) {
|
|
6202
6408
|
throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
|
|
6203
6409
|
}
|
|
6204
|
-
return JSON.parse(await __classPrivateFieldGet$
|
|
6410
|
+
return JSON.parse(await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
|
|
6205
6411
|
}
|
|
6206
6412
|
async getActionsFromSHACL(className, predicate) {
|
|
6207
6413
|
const escaped = this.escapeRegExp(className);
|
|
@@ -6231,16 +6437,16 @@ var PerspectiveProxy = class {
|
|
|
6231
6437
|
async removeSubject(subjectClass, exprAddr, batchId) {
|
|
6232
6438
|
const ctor = subjectClass?.constructor;
|
|
6233
6439
|
if (typeof subjectClass === "object" && ctor && Object.prototype.hasOwnProperty.call(ctor, "builtinUri")) {
|
|
6234
|
-
await __classPrivateFieldGet$
|
|
6235
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6440
|
+
await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, ctor.builtinUri, exprAddr, batchId);
|
|
6441
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
6236
6442
|
return;
|
|
6237
6443
|
}
|
|
6238
6444
|
let className = await this.stringOrTemplateObjectToSubjectClassName(subjectClass);
|
|
6239
6445
|
const shapePattern = new RegExp(`[/:#]${this.escapeRegExp(className)}Shape$`);
|
|
6240
6446
|
const markers = await this.get(new LinkQuery({ predicate: "ad4m://abstract" }));
|
|
6241
6447
|
if (markers.some((link) => shapePattern.test(link.data.source))) {
|
|
6242
|
-
await __classPrivateFieldGet$
|
|
6243
|
-
invalidatePerspectiveCache(__classPrivateFieldGet$
|
|
6448
|
+
await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, batchId);
|
|
6449
|
+
invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
6244
6450
|
return;
|
|
6245
6451
|
}
|
|
6246
6452
|
let actions = await this.getActionsFromSHACL(className, "ad4m://destructor");
|
|
@@ -6465,7 +6671,7 @@ var PerspectiveProxy = class {
|
|
|
6465
6671
|
if (Object.prototype.hasOwnProperty.call(jsClass, "builtinUri"))
|
|
6466
6672
|
return;
|
|
6467
6673
|
const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
|
|
6468
|
-
if (__classPrivateFieldGet$
|
|
6674
|
+
if (__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
|
|
6469
6675
|
return;
|
|
6470
6676
|
if (!jsClass.generateSHACL) {
|
|
6471
6677
|
throw new Error(`Class ${jsClass.name} must have generateSHACL(). Use @Model decorator.`);
|
|
@@ -6473,10 +6679,10 @@ var PerspectiveProxy = class {
|
|
|
6473
6679
|
const { shape } = jsClass.generateSHACL();
|
|
6474
6680
|
const shaclJson = JSON.stringify(shape.toJSON());
|
|
6475
6681
|
await this.addSdna(className, "", "subject_class", shaclJson);
|
|
6476
|
-
__classPrivateFieldGet$
|
|
6682
|
+
__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
|
|
6477
6683
|
}
|
|
6478
6684
|
clearEnsuredSubjectClasses() {
|
|
6479
|
-
__classPrivateFieldGet$
|
|
6685
|
+
__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
|
|
6480
6686
|
}
|
|
6481
6687
|
async listRegisteredClasses() {
|
|
6482
6688
|
const results = await this.querySparql(`SELECT DISTINCT ?class WHERE { ?class <rdf://type> <ad4m://SubjectClass> . }`);
|
|
@@ -6604,13 +6810,13 @@ var PerspectiveProxy = class {
|
|
|
6604
6810
|
}));
|
|
6605
6811
|
}
|
|
6606
6812
|
getNeighbourhoodProxy() {
|
|
6607
|
-
return __classPrivateFieldGet$
|
|
6813
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
|
|
6608
6814
|
}
|
|
6609
6815
|
get ai() {
|
|
6610
|
-
return __classPrivateFieldGet$
|
|
6816
|
+
return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").aiClient;
|
|
6611
6817
|
}
|
|
6612
6818
|
async subscribeQuery(query) {
|
|
6613
|
-
const subscription = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$
|
|
6819
|
+
const subscription = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f"));
|
|
6614
6820
|
try {
|
|
6615
6821
|
await subscription.subscribe();
|
|
6616
6822
|
} catch (e) {
|
|
@@ -6621,7 +6827,7 @@ var PerspectiveProxy = class {
|
|
|
6621
6827
|
}
|
|
6622
6828
|
};
|
|
6623
6829
|
_PerspectiveProxy_handle = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_client = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_releases = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_ensuredSubjectClasses = /* @__PURE__ */ new WeakMap(), _PerspectiveProxy_overlaysInFlight = /* @__PURE__ */ new WeakMap();
|
|
6624
|
-
var __classPrivateFieldSet$
|
|
6830
|
+
var __classPrivateFieldSet$6 = function(receiver, state, value, kind, f) {
|
|
6625
6831
|
if (kind === "m")
|
|
6626
6832
|
throw new TypeError("Private method is not writable");
|
|
6627
6833
|
if (kind === "a" && !f)
|
|
@@ -6630,7 +6836,7 @@ var __classPrivateFieldSet$5 = function(receiver, state, value, kind, f) {
|
|
|
6630
6836
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6631
6837
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
6632
6838
|
};
|
|
6633
|
-
var __classPrivateFieldGet$
|
|
6839
|
+
var __classPrivateFieldGet$6 = function(receiver, state, kind, f) {
|
|
6634
6840
|
if (kind === "a" && !f)
|
|
6635
6841
|
throw new TypeError("Private accessor was defined without a getter");
|
|
6636
6842
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -6650,27 +6856,27 @@ var PerspectiveClient = class {
|
|
|
6650
6856
|
_PerspectiveClient_expressionClient.set(this, void 0);
|
|
6651
6857
|
_PerspectiveClient_neighbourhoodClient.set(this, void 0);
|
|
6652
6858
|
_PerspectiveClient_aiClient.set(this, void 0);
|
|
6653
|
-
__classPrivateFieldSet$
|
|
6859
|
+
__classPrivateFieldSet$6(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
6654
6860
|
}
|
|
6655
6861
|
setExpressionClient(client) {
|
|
6656
|
-
__classPrivateFieldSet$
|
|
6862
|
+
__classPrivateFieldSet$6(this, _PerspectiveClient_expressionClient, client, "f");
|
|
6657
6863
|
}
|
|
6658
6864
|
setNeighbourhoodClient(client) {
|
|
6659
|
-
__classPrivateFieldSet$
|
|
6865
|
+
__classPrivateFieldSet$6(this, _PerspectiveClient_neighbourhoodClient, client, "f");
|
|
6660
6866
|
}
|
|
6661
6867
|
setAIClient(client) {
|
|
6662
|
-
__classPrivateFieldSet$
|
|
6868
|
+
__classPrivateFieldSet$6(this, _PerspectiveClient_aiClient, client, "f");
|
|
6663
6869
|
}
|
|
6664
6870
|
get aiClient() {
|
|
6665
|
-
return __classPrivateFieldGet$
|
|
6871
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_aiClient, "f");
|
|
6666
6872
|
}
|
|
6667
6873
|
async all() {
|
|
6668
|
-
const perspectives = await __classPrivateFieldGet$
|
|
6874
|
+
const perspectives = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.all", {});
|
|
6669
6875
|
return perspectives.map((handle) => new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this));
|
|
6670
6876
|
}
|
|
6671
6877
|
async byUUID(uuid) {
|
|
6672
6878
|
try {
|
|
6673
|
-
const perspective = await __classPrivateFieldGet$
|
|
6879
|
+
const perspective = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.get", { uuid });
|
|
6674
6880
|
if (!perspective)
|
|
6675
6881
|
return null;
|
|
6676
6882
|
return new PerspectiveProxy(PerspectiveHandle.fromWire(perspective), this);
|
|
@@ -6681,11 +6887,11 @@ var PerspectiveClient = class {
|
|
|
6681
6887
|
}
|
|
6682
6888
|
}
|
|
6683
6889
|
async snapshotByUUID(uuid) {
|
|
6684
|
-
const snapshot = await __classPrivateFieldGet$
|
|
6890
|
+
const snapshot = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.snapshot", { uuid });
|
|
6685
6891
|
return snapshot ? new Perspective(snapshot.links.map(LinkExpression.fromWire)) : null;
|
|
6686
6892
|
}
|
|
6687
6893
|
async publishSnapshotByUUID(uuid) {
|
|
6688
|
-
return __classPrivateFieldGet$
|
|
6894
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.publishSnapshot", { uuid });
|
|
6689
6895
|
}
|
|
6690
6896
|
async queryLinks(uuid, query, options) {
|
|
6691
6897
|
const params = { uuid };
|
|
@@ -6701,38 +6907,38 @@ var PerspectiveClient = class {
|
|
|
6701
6907
|
params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate);
|
|
6702
6908
|
if (query.limit !== void 0)
|
|
6703
6909
|
params.limit = query.limit;
|
|
6704
|
-
const links = await __classPrivateFieldGet$
|
|
6910
|
+
const links = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.queryLinks", params, options);
|
|
6705
6911
|
return links.map(LinkExpression.fromWire);
|
|
6706
6912
|
}
|
|
6707
6913
|
async queryProlog(uuid, query, options) {
|
|
6708
|
-
const result = await __classPrivateFieldGet$
|
|
6914
|
+
const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.queryProlog", { uuid, query }, options);
|
|
6709
6915
|
return JSON.parse(result);
|
|
6710
6916
|
}
|
|
6711
6917
|
async querySparql(uuid, query, options) {
|
|
6712
|
-
const result = await __classPrivateFieldGet$
|
|
6918
|
+
const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.querySparql", { uuid, engine: "sparql", query }, options);
|
|
6713
6919
|
return JSON.parse(result);
|
|
6714
6920
|
}
|
|
6715
6921
|
async subscribeQuery(uuid, query, options) {
|
|
6716
|
-
return __classPrivateFieldGet$
|
|
6922
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.subscribeQuery", { uuid, query }, options);
|
|
6717
6923
|
}
|
|
6718
6924
|
onQueryUpdate(cb) {
|
|
6719
|
-
return __classPrivateFieldGet$
|
|
6925
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").on("query-subscription-update", cb);
|
|
6720
6926
|
}
|
|
6721
6927
|
async resyncSubscription(uuid, subscriptionId) {
|
|
6722
|
-
return __classPrivateFieldGet$
|
|
6928
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.resyncSubscription", { uuid, subscriptionId });
|
|
6723
6929
|
}
|
|
6724
6930
|
async disposeQuerySubscription(uuid, subscriptionId) {
|
|
6725
|
-
return __classPrivateFieldGet$
|
|
6931
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.disposeQuery", { uuid, subscriptionId });
|
|
6726
6932
|
}
|
|
6727
6933
|
async modelQuery(uuid, className, queryJson, options) {
|
|
6728
|
-
const resultJson = await __classPrivateFieldGet$
|
|
6934
|
+
const resultJson = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.modelQuery", { uuid, ...classParams(className), query_json: queryJson }, options);
|
|
6729
6935
|
return JSON.parse(resultJson);
|
|
6730
6936
|
}
|
|
6731
6937
|
async subjectClassesOf(uuid, uris) {
|
|
6732
|
-
return await __classPrivateFieldGet$
|
|
6938
|
+
return await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.subjectClassesOf", { uuid, uris });
|
|
6733
6939
|
}
|
|
6734
6940
|
async evaluateGetters(uuid, className, instanceIds, propertyNames) {
|
|
6735
|
-
const resultJson = await __classPrivateFieldGet$
|
|
6941
|
+
const resultJson = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.evaluateGetters", {
|
|
6736
6942
|
uuid,
|
|
6737
6943
|
class_name: className,
|
|
6738
6944
|
instance_ids: instanceIds,
|
|
@@ -6741,38 +6947,38 @@ var PerspectiveClient = class {
|
|
|
6741
6947
|
return JSON.parse(resultJson);
|
|
6742
6948
|
}
|
|
6743
6949
|
async modelSubscribe(uuid, className, queryJson, options) {
|
|
6744
|
-
return __classPrivateFieldGet$
|
|
6950
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.modelSubscribe", { uuid, ...classParams(className), query_json: queryJson }, options);
|
|
6745
6951
|
}
|
|
6746
6952
|
async add(name) {
|
|
6747
|
-
const handle = await __classPrivateFieldGet$
|
|
6953
|
+
const handle = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.create", { name });
|
|
6748
6954
|
return new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this);
|
|
6749
6955
|
}
|
|
6750
6956
|
async update(uuid, name) {
|
|
6751
|
-
const handle = await __classPrivateFieldGet$
|
|
6957
|
+
const handle = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.update", { uuid, name });
|
|
6752
6958
|
return new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this);
|
|
6753
6959
|
}
|
|
6754
6960
|
async remove(uuid) {
|
|
6755
|
-
const result = await __classPrivateFieldGet$
|
|
6961
|
+
const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.remove", { uuid });
|
|
6756
6962
|
return { perspectiveRemove: result };
|
|
6757
6963
|
}
|
|
6758
6964
|
async addLink(uuid, link, status = "shared", batchId) {
|
|
6759
|
-
const added = await __classPrivateFieldGet$
|
|
6965
|
+
const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.addLink", { uuid, link, status, batchId });
|
|
6760
6966
|
return LinkExpression.fromWire(added);
|
|
6761
6967
|
}
|
|
6762
6968
|
async addLinks(uuid, links, status = "shared", batchId) {
|
|
6763
|
-
const added = await __classPrivateFieldGet$
|
|
6969
|
+
const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.addLinks", { uuid, links, status, batchId });
|
|
6764
6970
|
return added.map(LinkExpression.fromWire);
|
|
6765
6971
|
}
|
|
6766
6972
|
async removeLinks(uuid, links, batchId) {
|
|
6767
|
-
const removed = await __classPrivateFieldGet$
|
|
6973
|
+
const removed = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.removeLinks", { uuid, links: links.map(linkExpressionInputToWire), batchId });
|
|
6768
6974
|
return removed.map(LinkExpression.fromWire);
|
|
6769
6975
|
}
|
|
6770
6976
|
async linkMutations(uuid, mutations, status) {
|
|
6771
|
-
const diff = await __classPrivateFieldGet$
|
|
6977
|
+
const diff = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.linkMutations", { uuid, mutations: linkMutationsToWire(mutations), status });
|
|
6772
6978
|
return LinkExpressionMutations.fromWire(diff);
|
|
6773
6979
|
}
|
|
6774
6980
|
async runInterpretation(uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, options) {
|
|
6775
|
-
return __classPrivateFieldGet$
|
|
6981
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.runInterpretation", {
|
|
6776
6982
|
uuid,
|
|
6777
6983
|
transcript,
|
|
6778
6984
|
basePrefix,
|
|
@@ -6784,7 +6990,7 @@ var PerspectiveClient = class {
|
|
|
6784
6990
|
}, options);
|
|
6785
6991
|
}
|
|
6786
6992
|
async runInterpretationWithHarness(uuid, transcript, basePrefix, maxToolCalls, classes, modelOverride, existingScope, observationId, emitDebugEvents, options) {
|
|
6787
|
-
return __classPrivateFieldGet$
|
|
6993
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.runInterpretationWithHarness", {
|
|
6788
6994
|
uuid,
|
|
6789
6995
|
transcript,
|
|
6790
6996
|
basePrefix,
|
|
@@ -6797,16 +7003,16 @@ var PerspectiveClient = class {
|
|
|
6797
7003
|
}, options);
|
|
6798
7004
|
}
|
|
6799
7005
|
async runAgent(uuid, messages2, settings, options) {
|
|
6800
|
-
return __classPrivateFieldGet$
|
|
7006
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.runAgent", { uuid, messages: messages2, ...settings }, options);
|
|
6801
7007
|
}
|
|
6802
7008
|
async addAutoProcessor(uuid, config) {
|
|
6803
|
-
return __classPrivateFieldGet$
|
|
7009
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.addAutoProcessor", { ...config, uuid });
|
|
6804
7010
|
}
|
|
6805
7011
|
async removeAutoProcessor(uuid, processorId) {
|
|
6806
|
-
return __classPrivateFieldGet$
|
|
7012
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.removeAutoProcessor", { uuid, processorId });
|
|
6807
7013
|
}
|
|
6808
7014
|
async interpretationOverlays(uuid) {
|
|
6809
|
-
const overlays = await __classPrivateFieldGet$
|
|
7015
|
+
const overlays = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.interpretationOverlays", { uuid });
|
|
6810
7016
|
return overlays.map(({ base, kind, run, inferred }) => ({
|
|
6811
7017
|
base,
|
|
6812
7018
|
run,
|
|
@@ -6815,109 +7021,109 @@ var PerspectiveClient = class {
|
|
|
6815
7021
|
}));
|
|
6816
7022
|
}
|
|
6817
7023
|
async acceptInterpretation(uuid, base, property) {
|
|
6818
|
-
return __classPrivateFieldGet$
|
|
7024
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.acceptInterpretation", { uuid, base, property });
|
|
6819
7025
|
}
|
|
6820
7026
|
async rejectInterpretation(uuid, base, property) {
|
|
6821
|
-
return __classPrivateFieldGet$
|
|
7027
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.rejectInterpretation", { uuid, base, property });
|
|
6822
7028
|
}
|
|
6823
7029
|
async proposeFlowTransition(uuid, instanceUri, toState, rationale, outputs) {
|
|
6824
|
-
return __classPrivateFieldGet$
|
|
7030
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.proposeFlowTransition", { uuid, instanceUri, toState, rationale, outputs });
|
|
6825
7031
|
}
|
|
6826
7032
|
async acceptFlowProposal(uuid, proposalUri) {
|
|
6827
|
-
return __classPrivateFieldGet$
|
|
7033
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.acceptFlowProposal", { uuid, proposalUri });
|
|
6828
7034
|
}
|
|
6829
7035
|
async rejectFlowProposal(uuid, proposalUri) {
|
|
6830
|
-
const result = await __classPrivateFieldGet$
|
|
7036
|
+
const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.rejectFlowProposal", { uuid, proposalUri });
|
|
6831
7037
|
return result.retractedLinks;
|
|
6832
7038
|
}
|
|
6833
7039
|
async verifyFlowReceipt(uuid, receipt) {
|
|
6834
|
-
return __classPrivateFieldGet$
|
|
7040
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.verifyFlowReceipt", { uuid, receipt });
|
|
6835
7041
|
}
|
|
6836
7042
|
async flowValidOutputs(uuid, flow, state) {
|
|
6837
|
-
return __classPrivateFieldGet$
|
|
7043
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.flowValidOutputs", { uuid, flow, state });
|
|
6838
7044
|
}
|
|
6839
7045
|
async flowStates(uuid, instances) {
|
|
6840
|
-
return __classPrivateFieldGet$
|
|
7046
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.flowStates", { uuid, instances });
|
|
6841
7047
|
}
|
|
6842
7048
|
async flowFired(uuid, instance) {
|
|
6843
|
-
return __classPrivateFieldGet$
|
|
7049
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.flowFired", { uuid, instance });
|
|
6844
7050
|
}
|
|
6845
7051
|
async mintFlowReceipt(uuid, instanceUri) {
|
|
6846
|
-
return __classPrivateFieldGet$
|
|
7052
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.mintFlowReceipt", { uuid, instanceUri });
|
|
6847
7053
|
}
|
|
6848
7054
|
async addLinkExpression(uuid, link, status = "shared", batchId) {
|
|
6849
|
-
const added = await __classPrivateFieldGet$
|
|
7055
|
+
const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.addLinkExpression", { uuid, link: linkExpressionToWire(link), status, batchId });
|
|
6850
7056
|
return LinkExpression.fromWire(added);
|
|
6851
7057
|
}
|
|
6852
7058
|
async updateLink(uuid, oldLink, newLink, batchId) {
|
|
6853
|
-
const updated = await __classPrivateFieldGet$
|
|
7059
|
+
const updated = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.updateLink", { uuid, oldLink: linkExpressionInputToWire(oldLink), newLink, batchId });
|
|
6854
7060
|
return LinkExpression.fromWire(updated);
|
|
6855
7061
|
}
|
|
6856
7062
|
async removeLink(uuid, link, batchId) {
|
|
6857
7063
|
const { status, ...wire } = linkExpressionInputToWire(link);
|
|
6858
|
-
return __classPrivateFieldGet$
|
|
7064
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.removeLink", { uuid, link: wire, batchId });
|
|
6859
7065
|
}
|
|
6860
7066
|
async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
|
|
6861
|
-
const result = await __classPrivateFieldGet$
|
|
7067
|
+
const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.addSdna", { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
|
|
6862
7068
|
return typeof result === "boolean" ? result : result.every(Boolean);
|
|
6863
7069
|
}
|
|
6864
7070
|
async addSdnaBatch(uuid, entries) {
|
|
6865
|
-
const result = await __classPrivateFieldGet$
|
|
7071
|
+
const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.addSdna", { uuid, entries: entries.map((e) => ({ ...e, sdnaCode: e.sdnaCode || "" })) });
|
|
6866
7072
|
return typeof result === "boolean" ? [result] : result;
|
|
6867
7073
|
}
|
|
6868
7074
|
async executeCommands(uuid, commands, expression, parameters, batchId) {
|
|
6869
|
-
return __classPrivateFieldGet$
|
|
7075
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.executeCommands", { uuid, commands, expression, parameters, batchId });
|
|
6870
7076
|
}
|
|
6871
7077
|
async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
|
|
6872
|
-
return __classPrivateFieldGet$
|
|
7078
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.createSubject", { uuid, subjectClass, expressionAddress, initialValues, batchId });
|
|
6873
7079
|
}
|
|
6874
7080
|
async updateSubject(uuid, subjectClass, expressionAddress, values, batchId) {
|
|
6875
|
-
return __classPrivateFieldGet$
|
|
7081
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.updateSubject", { uuid, subjectClass, expressionAddress, values, batchId });
|
|
6876
7082
|
}
|
|
6877
7083
|
async removeSubject(uuid, subjectClass, expressionAddress, batchId) {
|
|
6878
|
-
return __classPrivateFieldGet$
|
|
7084
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.removeSubject", { uuid, subjectClass, expressionAddress, batchId });
|
|
6879
7085
|
}
|
|
6880
7086
|
async getSubjectData(uuid, subjectClass, expressionAddress) {
|
|
6881
|
-
return __classPrivateFieldGet$
|
|
7087
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.getSubjectData", { uuid, subjectClass, expressionAddress });
|
|
6882
7088
|
}
|
|
6883
7089
|
async getShaclNames(uuid) {
|
|
6884
|
-
return __classPrivateFieldGet$
|
|
7090
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.getShaclNames", { uuid });
|
|
6885
7091
|
}
|
|
6886
7092
|
async getShaclTargetClass(uuid, name) {
|
|
6887
|
-
const result = await __classPrivateFieldGet$
|
|
7093
|
+
const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.getShaclTargetClass", { uuid, name });
|
|
6888
7094
|
return result ?? void 0;
|
|
6889
7095
|
}
|
|
6890
7096
|
async getShacl(uuid, name) {
|
|
6891
|
-
return __classPrivateFieldGet$
|
|
7097
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.getShacl", { uuid, name });
|
|
6892
7098
|
}
|
|
6893
7099
|
async getAllShacl(uuid) {
|
|
6894
|
-
return __classPrivateFieldGet$
|
|
7100
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.getAllShacl", { uuid });
|
|
6895
7101
|
}
|
|
6896
7102
|
async getExpression(expressionURI) {
|
|
6897
|
-
return await __classPrivateFieldGet$
|
|
7103
|
+
return await __classPrivateFieldGet$6(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
|
|
6898
7104
|
}
|
|
6899
7105
|
async createExpression(content, languageAddress) {
|
|
6900
|
-
return await __classPrivateFieldGet$
|
|
7106
|
+
return await __classPrivateFieldGet$6(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
|
|
6901
7107
|
}
|
|
6902
7108
|
on(type, handler, filter) {
|
|
6903
|
-
return __classPrivateFieldGet$
|
|
7109
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").on(type, handler, filter);
|
|
6904
7110
|
}
|
|
6905
7111
|
getNeighbourhoodProxy(uuid) {
|
|
6906
|
-
return new NeighbourhoodProxy(__classPrivateFieldGet$
|
|
7112
|
+
return new NeighbourhoodProxy(__classPrivateFieldGet$6(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
|
|
6907
7113
|
}
|
|
6908
7114
|
async createBatch(uuid) {
|
|
6909
|
-
return __classPrivateFieldGet$
|
|
7115
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.createBatch", { uuid });
|
|
6910
7116
|
}
|
|
6911
7117
|
async commitBatch(uuid, batchId) {
|
|
6912
|
-
const diff = await __classPrivateFieldGet$
|
|
7118
|
+
const diff = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call("perspective.commitBatch", { uuid, batchId });
|
|
6913
7119
|
return LinkExpressionMutations.fromWire(diff);
|
|
6914
7120
|
}
|
|
6915
7121
|
onReconnect(callback) {
|
|
6916
|
-
return __classPrivateFieldGet$
|
|
7122
|
+
return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").onReconnect(callback);
|
|
6917
7123
|
}
|
|
6918
7124
|
};
|
|
6919
7125
|
_PerspectiveClient_apiClient = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_expressionClient = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_neighbourhoodClient = /* @__PURE__ */ new WeakMap(), _PerspectiveClient_aiClient = /* @__PURE__ */ new WeakMap();
|
|
6920
|
-
var __classPrivateFieldSet$
|
|
7126
|
+
var __classPrivateFieldSet$5 = function(receiver, state, value, kind, f) {
|
|
6921
7127
|
if (kind === "m")
|
|
6922
7128
|
throw new TypeError("Private method is not writable");
|
|
6923
7129
|
if (kind === "a" && !f)
|
|
@@ -6926,7 +7132,7 @@ var __classPrivateFieldSet$4 = function(receiver, state, value, kind, f) {
|
|
|
6926
7132
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6927
7133
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
6928
7134
|
};
|
|
6929
|
-
var __classPrivateFieldGet$
|
|
7135
|
+
var __classPrivateFieldGet$5 = function(receiver, state, kind, f) {
|
|
6930
7136
|
if (kind === "a" && !f)
|
|
6931
7137
|
throw new TypeError("Private accessor was defined without a getter");
|
|
6932
7138
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -6937,183 +7143,183 @@ var _RuntimeClient_apiClient;
|
|
|
6937
7143
|
var RuntimeClient = class {
|
|
6938
7144
|
constructor(baseUrl, token, sharedApiClient) {
|
|
6939
7145
|
_RuntimeClient_apiClient.set(this, void 0);
|
|
6940
|
-
__classPrivateFieldSet$
|
|
7146
|
+
__classPrivateFieldSet$5(this, _RuntimeClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
6941
7147
|
}
|
|
6942
7148
|
async info() {
|
|
6943
|
-
return __classPrivateFieldGet$
|
|
7149
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.info", {});
|
|
6944
7150
|
}
|
|
6945
7151
|
async tlsDomain() {
|
|
6946
|
-
return __classPrivateFieldGet$
|
|
7152
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.tlsDomain", {});
|
|
6947
7153
|
}
|
|
6948
7154
|
async quit() {
|
|
6949
|
-
return __classPrivateFieldGet$
|
|
7155
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.quit", {});
|
|
6950
7156
|
}
|
|
6951
7157
|
async openLink(url) {
|
|
6952
|
-
return __classPrivateFieldGet$
|
|
7158
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.openLink", { url });
|
|
6953
7159
|
}
|
|
6954
7160
|
async addTrustedAgents(agents) {
|
|
6955
|
-
return __classPrivateFieldGet$
|
|
7161
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("agent.addTrustedAgents", { agents });
|
|
6956
7162
|
}
|
|
6957
7163
|
async deleteTrustedAgents(agents) {
|
|
6958
|
-
return __classPrivateFieldGet$
|
|
7164
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("agent.deleteTrustedAgents", { agents });
|
|
6959
7165
|
}
|
|
6960
7166
|
async getTrustedAgents() {
|
|
6961
|
-
return __classPrivateFieldGet$
|
|
7167
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("agent.getTrustedAgents", {});
|
|
6962
7168
|
}
|
|
6963
7169
|
async addKnownLinkLanguageTemplates(addresses) {
|
|
6964
|
-
return __classPrivateFieldGet$
|
|
7170
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.addLinkLanguageTemplates", { addresses });
|
|
6965
7171
|
}
|
|
6966
7172
|
async removeKnownLinkLanguageTemplates(addresses) {
|
|
6967
|
-
return __classPrivateFieldGet$
|
|
7173
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.removeLinkLanguageTemplates", { addresses });
|
|
6968
7174
|
}
|
|
6969
7175
|
async knownLinkLanguageTemplates() {
|
|
6970
|
-
return __classPrivateFieldGet$
|
|
7176
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.linkLanguageTemplates", {});
|
|
6971
7177
|
}
|
|
6972
7178
|
async addFriends(dids) {
|
|
6973
|
-
return __classPrivateFieldGet$
|
|
7179
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.addFriends", { dids });
|
|
6974
7180
|
}
|
|
6975
7181
|
async removeFriends(dids) {
|
|
6976
|
-
return __classPrivateFieldGet$
|
|
7182
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.removeFriends", { dids });
|
|
6977
7183
|
}
|
|
6978
7184
|
async friends() {
|
|
6979
|
-
return __classPrivateFieldGet$
|
|
7185
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.friends", {});
|
|
6980
7186
|
}
|
|
6981
7187
|
async hcAgentInfos() {
|
|
6982
|
-
return __classPrivateFieldGet$
|
|
7188
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.hcAgentInfos", {});
|
|
6983
7189
|
}
|
|
6984
7190
|
async getNetworkMetrics() {
|
|
6985
|
-
return __classPrivateFieldGet$
|
|
7191
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.networkMetrics", {});
|
|
6986
7192
|
}
|
|
6987
7193
|
async restartHolochain(options) {
|
|
6988
|
-
return __classPrivateFieldGet$
|
|
7194
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.restartHolochain", {}, options);
|
|
6989
7195
|
}
|
|
6990
7196
|
async hcAddAgentInfos(agentInfos) {
|
|
6991
|
-
return __classPrivateFieldGet$
|
|
7197
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.addHcAgentInfos", { agentInfos });
|
|
6992
7198
|
}
|
|
6993
7199
|
async verifyStringSignedByDid(did, didSigningKeyId, data, signedData) {
|
|
6994
|
-
return __classPrivateFieldGet$
|
|
7200
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.verifySignature", { did, data, signedData });
|
|
6995
7201
|
}
|
|
6996
7202
|
async setStatus(perspective) {
|
|
6997
|
-
return __classPrivateFieldGet$
|
|
7203
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.setStatus", { status: Perspective.toWire(perspective) });
|
|
6998
7204
|
}
|
|
6999
7205
|
async friendStatus(did) {
|
|
7000
|
-
const status = await __classPrivateFieldGet$
|
|
7206
|
+
const status = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.friendStatus", { did });
|
|
7001
7207
|
return status ? PerspectiveExpression.fromWire(status) : null;
|
|
7002
7208
|
}
|
|
7003
7209
|
async friendSendMessage(did, message) {
|
|
7004
|
-
return __classPrivateFieldGet$
|
|
7210
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.sendFriendMessage", { did, message: Perspective.toWire(message) });
|
|
7005
7211
|
}
|
|
7006
7212
|
async messageInbox() {
|
|
7007
|
-
return (await __classPrivateFieldGet$
|
|
7213
|
+
return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.inbox", {})).map(PerspectiveExpression.fromWire);
|
|
7008
7214
|
}
|
|
7009
7215
|
async messageOutbox() {
|
|
7010
|
-
const sent = await __classPrivateFieldGet$
|
|
7216
|
+
const sent = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.outbox", {});
|
|
7011
7217
|
return sent.map(({ recipient, message }) => ({ recipient, message: PerspectiveExpression.fromWire(message) }));
|
|
7012
7218
|
}
|
|
7013
7219
|
async requestInstallNotification(notification) {
|
|
7014
|
-
return __classPrivateFieldGet$
|
|
7220
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.createNotification", { ...notification });
|
|
7015
7221
|
}
|
|
7016
7222
|
async grantNotification(id) {
|
|
7017
|
-
return __classPrivateFieldGet$
|
|
7223
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.grantNotification", { id, granted: true });
|
|
7018
7224
|
}
|
|
7019
7225
|
async exportDb(filePath) {
|
|
7020
|
-
return __classPrivateFieldGet$
|
|
7226
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.exportData", { type: "db", filePath });
|
|
7021
7227
|
}
|
|
7022
7228
|
async importDb(filePath) {
|
|
7023
|
-
const result = await __classPrivateFieldGet$
|
|
7229
|
+
const result = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.importData", { type: "db", filePath });
|
|
7024
7230
|
if ("success" in result)
|
|
7025
7231
|
throw new Error('runtime.importData answered a perspective import for type "db"');
|
|
7026
7232
|
return result;
|
|
7027
7233
|
}
|
|
7028
7234
|
async notifications() {
|
|
7029
|
-
return __classPrivateFieldGet$
|
|
7235
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.notifications", {});
|
|
7030
7236
|
}
|
|
7031
7237
|
async updateNotification(id, notification) {
|
|
7032
|
-
return __classPrivateFieldGet$
|
|
7238
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.updateNotification", { ...notification, id });
|
|
7033
7239
|
}
|
|
7034
7240
|
async removeNotification(id) {
|
|
7035
|
-
return __classPrivateFieldGet$
|
|
7241
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.deleteNotification", { id });
|
|
7036
7242
|
}
|
|
7037
7243
|
async exportPerspective(uuid, filePath) {
|
|
7038
|
-
return __classPrivateFieldGet$
|
|
7244
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.exportData", { type: "perspective", perspectiveUuid: uuid, filePath });
|
|
7039
7245
|
}
|
|
7040
7246
|
async importPerspective(filePath) {
|
|
7041
|
-
const result = await __classPrivateFieldGet$
|
|
7247
|
+
const result = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.importData", { type: "perspective", filePath });
|
|
7042
7248
|
return "success" in result && result.success;
|
|
7043
7249
|
}
|
|
7044
7250
|
async multiUserEnabled() {
|
|
7045
|
-
return __classPrivateFieldGet$
|
|
7251
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.multiUserEnabled", {});
|
|
7046
7252
|
}
|
|
7047
7253
|
async setMultiUserEnabled(enabled) {
|
|
7048
|
-
return __classPrivateFieldGet$
|
|
7254
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.setMultiUserEnabled", { enabled });
|
|
7049
7255
|
}
|
|
7050
7256
|
async freeHostingEnabled() {
|
|
7051
|
-
return __classPrivateFieldGet$
|
|
7257
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.freeHostingEnabled", {});
|
|
7052
7258
|
}
|
|
7053
7259
|
async setFreeHostingEnabled(enabled) {
|
|
7054
|
-
return __classPrivateFieldGet$
|
|
7260
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.setFreeHostingEnabled", { enabled });
|
|
7055
7261
|
}
|
|
7056
7262
|
async listUsers() {
|
|
7057
|
-
return __classPrivateFieldGet$
|
|
7263
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.list", {});
|
|
7058
7264
|
}
|
|
7059
7265
|
async userWalletAddress(email) {
|
|
7060
|
-
return __classPrivateFieldGet$
|
|
7266
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.wallet", { email });
|
|
7061
7267
|
}
|
|
7062
7268
|
async emailTestModeEnable() {
|
|
7063
|
-
return await __classPrivateFieldGet$
|
|
7269
|
+
return await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.emailTest", { action: "enable" }) === true;
|
|
7064
7270
|
}
|
|
7065
7271
|
async emailTestModeDisable() {
|
|
7066
|
-
return await __classPrivateFieldGet$
|
|
7272
|
+
return await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.emailTest", { action: "disable" }) === true;
|
|
7067
7273
|
}
|
|
7068
7274
|
async emailTestGetCode(email) {
|
|
7069
|
-
const code2 = await __classPrivateFieldGet$
|
|
7275
|
+
const code2 = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.emailTest", { action: "get-code", email });
|
|
7070
7276
|
return typeof code2 === "string" ? code2 : null;
|
|
7071
7277
|
}
|
|
7072
7278
|
async emailTestClearCodes() {
|
|
7073
|
-
return await __classPrivateFieldGet$
|
|
7279
|
+
return await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.emailTest", { action: "clear-codes" }) === true;
|
|
7074
7280
|
}
|
|
7075
7281
|
async emailTestSetExpiry(email, verificationType, expiresAt) {
|
|
7076
|
-
return await __classPrivateFieldGet$
|
|
7282
|
+
return await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.emailTest", { action: "set-expiry", email, verificationType, expiresAt }) === true;
|
|
7077
7283
|
}
|
|
7078
7284
|
async unytAgentKey() {
|
|
7079
|
-
return __classPrivateFieldGet$
|
|
7285
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.unytAgentKey", {});
|
|
7080
7286
|
}
|
|
7081
7287
|
async unytHotAgentPubkey() {
|
|
7082
|
-
return __classPrivateFieldGet$
|
|
7288
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.unytHotAgentPubkey", {});
|
|
7083
7289
|
}
|
|
7084
7290
|
async unytWalletBalance() {
|
|
7085
|
-
return __classPrivateFieldGet$
|
|
7291
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.unytWalletBalance", {});
|
|
7086
7292
|
}
|
|
7087
7293
|
async unytWalletHistory(page, perPage) {
|
|
7088
|
-
return __classPrivateFieldGet$
|
|
7294
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.unytWalletHistory", { page, perPage });
|
|
7089
7295
|
}
|
|
7090
7296
|
async unytVersionInfo() {
|
|
7091
|
-
return __classPrivateFieldGet$
|
|
7297
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.unytVersionInfo", {});
|
|
7092
7298
|
}
|
|
7093
7299
|
async setUnytMembraneProof(proof) {
|
|
7094
|
-
return __classPrivateFieldGet$
|
|
7300
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.setUnytMembraneProof", { proof });
|
|
7095
7301
|
}
|
|
7096
7302
|
async unytReinstallDna() {
|
|
7097
|
-
return __classPrivateFieldGet$
|
|
7303
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.unytReinstallDna", {});
|
|
7098
7304
|
}
|
|
7099
7305
|
async unytSendHot(recipient, amount) {
|
|
7100
|
-
return __classPrivateFieldGet$
|
|
7306
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.unytSendHot", { recipient, amount });
|
|
7101
7307
|
}
|
|
7102
7308
|
async setUserCredits(email, amount) {
|
|
7103
|
-
return __classPrivateFieldGet$
|
|
7309
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.credits", { email, amount });
|
|
7104
7310
|
}
|
|
7105
7311
|
async setUserFreeAccess(email, enabled) {
|
|
7106
|
-
return __classPrivateFieldGet$
|
|
7312
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("user.freeAccess", { email, enabled });
|
|
7107
7313
|
}
|
|
7108
7314
|
async setHostRates(rates) {
|
|
7109
|
-
return __classPrivateFieldGet$
|
|
7315
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.setHostRates", { rates });
|
|
7110
7316
|
}
|
|
7111
7317
|
async hostRates() {
|
|
7112
|
-
return __classPrivateFieldGet$
|
|
7318
|
+
return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call("runtime.hostRates", {});
|
|
7113
7319
|
}
|
|
7114
7320
|
};
|
|
7115
7321
|
_RuntimeClient_apiClient = /* @__PURE__ */ new WeakMap();
|
|
7116
|
-
var __classPrivateFieldSet$
|
|
7322
|
+
var __classPrivateFieldSet$4 = function(receiver, state, value, kind, f) {
|
|
7117
7323
|
if (kind === "m")
|
|
7118
7324
|
throw new TypeError("Private method is not writable");
|
|
7119
7325
|
if (kind === "a" && !f)
|
|
@@ -7122,7 +7328,7 @@ var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
|
7122
7328
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
7123
7329
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
7124
7330
|
};
|
|
7125
|
-
var __classPrivateFieldGet$
|
|
7331
|
+
var __classPrivateFieldGet$4 = function(receiver, state, kind, f) {
|
|
7126
7332
|
if (kind === "a" && !f)
|
|
7127
7333
|
throw new TypeError("Private accessor was defined without a getter");
|
|
7128
7334
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -7144,8 +7350,8 @@ var ExpressionClient = class {
|
|
|
7144
7350
|
_ExpressionClient_inflight.set(this, /* @__PURE__ */ new Map());
|
|
7145
7351
|
_ExpressionClient_totalMemBytes.set(this, 0);
|
|
7146
7352
|
_ExpressionClient_persistent.set(this, void 0);
|
|
7147
|
-
__classPrivateFieldSet$
|
|
7148
|
-
__classPrivateFieldSet$
|
|
7353
|
+
__classPrivateFieldSet$4(this, _ExpressionClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
7354
|
+
__classPrivateFieldSet$4(this, _ExpressionClient_persistent, createPersistentCache("ad4m-expression-cache", "expressions"), "f");
|
|
7149
7355
|
}
|
|
7150
7356
|
async get(url, alwaysGet = false) {
|
|
7151
7357
|
if (!alwaysGet) {
|
|
@@ -7160,47 +7366,47 @@ var ExpressionClient = class {
|
|
|
7160
7366
|
}
|
|
7161
7367
|
}
|
|
7162
7368
|
if (!alwaysGet) {
|
|
7163
|
-
const memHit = __classPrivateFieldGet$
|
|
7369
|
+
const memHit = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(url);
|
|
7164
7370
|
if (memHit)
|
|
7165
7371
|
return memHit.data;
|
|
7166
7372
|
}
|
|
7167
7373
|
if (!alwaysGet) {
|
|
7168
|
-
const existing = __classPrivateFieldGet$
|
|
7374
|
+
const existing = __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").get(url);
|
|
7169
7375
|
if (existing)
|
|
7170
7376
|
return existing;
|
|
7171
7377
|
}
|
|
7172
7378
|
const promise = (async () => {
|
|
7173
7379
|
if (!alwaysGet) {
|
|
7174
|
-
const persisted = await __classPrivateFieldGet$
|
|
7380
|
+
const persisted = await __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").get(url);
|
|
7175
7381
|
if (persisted) {
|
|
7176
|
-
__classPrivateFieldGet$
|
|
7382
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, persisted);
|
|
7177
7383
|
return persisted;
|
|
7178
7384
|
}
|
|
7179
7385
|
}
|
|
7180
|
-
const result = await __classPrivateFieldGet$
|
|
7181
|
-
__classPrivateFieldGet$
|
|
7182
|
-
__classPrivateFieldGet$
|
|
7386
|
+
const result = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call("expression.get", { url });
|
|
7387
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, result);
|
|
7388
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").put(url, result);
|
|
7183
7389
|
return result;
|
|
7184
7390
|
})();
|
|
7185
|
-
__classPrivateFieldGet$
|
|
7391
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").set(url, promise);
|
|
7186
7392
|
try {
|
|
7187
7393
|
return await promise;
|
|
7188
7394
|
} finally {
|
|
7189
|
-
__classPrivateFieldGet$
|
|
7395
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").delete(url);
|
|
7190
7396
|
}
|
|
7191
7397
|
}
|
|
7192
7398
|
async getMany(urls) {
|
|
7193
|
-
const results = urls.map((u) => __classPrivateFieldGet$
|
|
7399
|
+
const results = urls.map((u) => __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(u)?.data ?? null);
|
|
7194
7400
|
let uncachedIndices = results.map((r, i) => r === null ? i : -1).filter((i) => i >= 0);
|
|
7195
7401
|
if (uncachedIndices.length === 0)
|
|
7196
7402
|
return results;
|
|
7197
|
-
const l2Results = await Promise.all(uncachedIndices.map((i) => __classPrivateFieldGet$
|
|
7403
|
+
const l2Results = await Promise.all(uncachedIndices.map((i) => __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").get(urls[i])));
|
|
7198
7404
|
const stillMissing = [];
|
|
7199
7405
|
for (let j = 0; j < uncachedIndices.length; j++) {
|
|
7200
7406
|
const idx = uncachedIndices[j];
|
|
7201
7407
|
if (l2Results[j]) {
|
|
7202
7408
|
results[idx] = l2Results[j];
|
|
7203
|
-
__classPrivateFieldGet$
|
|
7409
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, urls[idx], l2Results[j]);
|
|
7204
7410
|
} else {
|
|
7205
7411
|
stillMissing.push(idx);
|
|
7206
7412
|
}
|
|
@@ -7208,53 +7414,53 @@ var ExpressionClient = class {
|
|
|
7208
7414
|
if (stillMissing.length === 0)
|
|
7209
7415
|
return results;
|
|
7210
7416
|
const uncachedUrls = stillMissing.map((i) => urls[i]);
|
|
7211
|
-
const fetched = await __classPrivateFieldGet$
|
|
7417
|
+
const fetched = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call("expression.getMany", { urls: uncachedUrls });
|
|
7212
7418
|
for (let i = 0; i < stillMissing.length; i++) {
|
|
7213
7419
|
const idx = stillMissing[i];
|
|
7214
7420
|
results[idx] = fetched[i];
|
|
7215
7421
|
if (fetched[i]) {
|
|
7216
|
-
__classPrivateFieldGet$
|
|
7217
|
-
__classPrivateFieldGet$
|
|
7422
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, uncachedUrls[i], fetched[i]);
|
|
7423
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").put(uncachedUrls[i], fetched[i]);
|
|
7218
7424
|
}
|
|
7219
7425
|
}
|
|
7220
7426
|
return results;
|
|
7221
7427
|
}
|
|
7222
7428
|
clearCache() {
|
|
7223
|
-
__classPrivateFieldGet$
|
|
7224
|
-
__classPrivateFieldGet$
|
|
7225
|
-
__classPrivateFieldSet$
|
|
7226
|
-
__classPrivateFieldGet$
|
|
7429
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").clear();
|
|
7430
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").clear();
|
|
7431
|
+
__classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, 0, "f");
|
|
7432
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").clear();
|
|
7227
7433
|
}
|
|
7228
7434
|
async getRaw(url) {
|
|
7229
|
-
return __classPrivateFieldGet$
|
|
7435
|
+
return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call("expression.getRaw", { url });
|
|
7230
7436
|
}
|
|
7231
7437
|
async create(content, languageAddress) {
|
|
7232
7438
|
const serialized = JSON.stringify(content);
|
|
7233
|
-
return __classPrivateFieldGet$
|
|
7439
|
+
return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call("expression.create", { content: serialized, languageAddress });
|
|
7234
7440
|
}
|
|
7235
7441
|
async interactions(url) {
|
|
7236
|
-
return __classPrivateFieldGet$
|
|
7442
|
+
return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call("expression.interactions", { url });
|
|
7237
7443
|
}
|
|
7238
7444
|
async interact(url, interactionCall) {
|
|
7239
|
-
const result = await __classPrivateFieldGet$
|
|
7240
|
-
__classPrivateFieldGet$
|
|
7241
|
-
__classPrivateFieldGet$
|
|
7242
|
-
__classPrivateFieldGet$
|
|
7445
|
+
const result = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call("expression.interact", { url, interactionCall });
|
|
7446
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").delete(url);
|
|
7447
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").delete(url);
|
|
7448
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").delete(url);
|
|
7243
7449
|
return result;
|
|
7244
7450
|
}
|
|
7245
7451
|
};
|
|
7246
7452
|
_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) {
|
|
7247
7453
|
const size = JSON.stringify(data).length;
|
|
7248
|
-
while (__classPrivateFieldGet$
|
|
7249
|
-
const oldest = __classPrivateFieldGet$
|
|
7454
|
+
while (__classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").size >= ExpressionClient.MAX_MEM_ENTRIES || __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") + size > ExpressionClient.MAX_MEM_BYTES) {
|
|
7455
|
+
const oldest = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").keys().next().value;
|
|
7250
7456
|
if (!oldest)
|
|
7251
7457
|
break;
|
|
7252
|
-
const entry = __classPrivateFieldGet$
|
|
7253
|
-
__classPrivateFieldSet$
|
|
7254
|
-
__classPrivateFieldGet$
|
|
7458
|
+
const entry = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(oldest);
|
|
7459
|
+
__classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") - entry.size, "f");
|
|
7460
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").delete(oldest);
|
|
7255
7461
|
}
|
|
7256
|
-
__classPrivateFieldGet$
|
|
7257
|
-
__classPrivateFieldSet$
|
|
7462
|
+
__classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").set(url, { data, size });
|
|
7463
|
+
__classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") + size, "f");
|
|
7258
7464
|
};
|
|
7259
7465
|
ExpressionClient.MAX_MEM_ENTRIES = 200;
|
|
7260
7466
|
ExpressionClient.MAX_MEM_BYTES = 5 * 1024 * 1024;
|
|
@@ -11454,7 +11660,7 @@ var AITaskInput = class {
|
|
|
11454
11660
|
this.metaData = metaData;
|
|
11455
11661
|
}
|
|
11456
11662
|
};
|
|
11457
|
-
var __classPrivateFieldSet$
|
|
11663
|
+
var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
11458
11664
|
if (kind === "m")
|
|
11459
11665
|
throw new TypeError("Private method is not writable");
|
|
11460
11666
|
if (kind === "a" && !f)
|
|
@@ -11463,7 +11669,7 @@ var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
|
11463
11669
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11464
11670
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
11465
11671
|
};
|
|
11466
|
-
var __classPrivateFieldGet$
|
|
11672
|
+
var __classPrivateFieldGet$3 = function(receiver, state, kind, f) {
|
|
11467
11673
|
if (kind === "a" && !f)
|
|
11468
11674
|
throw new TypeError("Private accessor was defined without a getter");
|
|
11469
11675
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -11478,44 +11684,44 @@ var AIClient = class {
|
|
|
11478
11684
|
_AIClient_apiClient.set(this, void 0);
|
|
11479
11685
|
_AIClient_transcriptionUnsubscribers.set(this, /* @__PURE__ */ new Map());
|
|
11480
11686
|
_AIClient_pendingStreamIds.set(this, /* @__PURE__ */ new Set());
|
|
11481
|
-
__classPrivateFieldSet$
|
|
11687
|
+
__classPrivateFieldSet$3(this, _AIClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
11482
11688
|
}
|
|
11483
11689
|
serializeModelInput({ modelType, ...model }) {
|
|
11484
11690
|
return { ...model, type: modelType };
|
|
11485
11691
|
}
|
|
11486
11692
|
async getModels() {
|
|
11487
|
-
return __classPrivateFieldGet$
|
|
11693
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.models", {});
|
|
11488
11694
|
}
|
|
11489
11695
|
async discoverModels(baseUrl, apiKey, apiType) {
|
|
11490
|
-
return __classPrivateFieldGet$
|
|
11696
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.discoverModels", { baseUrl, apiKey, apiType });
|
|
11491
11697
|
}
|
|
11492
11698
|
async addModel(model, options) {
|
|
11493
|
-
return __classPrivateFieldGet$
|
|
11699
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.addModel", { model: this.serializeModelInput(model) }, options);
|
|
11494
11700
|
}
|
|
11495
11701
|
async updateModel(modelId, model) {
|
|
11496
|
-
return __classPrivateFieldGet$
|
|
11702
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.updateModel", { id: modelId, model: this.serializeModelInput(model) });
|
|
11497
11703
|
}
|
|
11498
11704
|
async removeModel(modelId) {
|
|
11499
|
-
return __classPrivateFieldGet$
|
|
11705
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.removeModel", { id: modelId });
|
|
11500
11706
|
}
|
|
11501
11707
|
async setDefaultModel(modelType, modelId) {
|
|
11502
|
-
return __classPrivateFieldGet$
|
|
11708
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.setDefaultModel", { id: modelId, modelType });
|
|
11503
11709
|
}
|
|
11504
11710
|
async getDefaultModel(modelType) {
|
|
11505
|
-
return __classPrivateFieldGet$
|
|
11711
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.getDefaultModel", { modelType });
|
|
11506
11712
|
}
|
|
11507
11713
|
async tasks() {
|
|
11508
|
-
return __classPrivateFieldGet$
|
|
11714
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.tasks", {});
|
|
11509
11715
|
}
|
|
11510
11716
|
async addTask(name, modelId, systemPrompt, promptExamples, metaData) {
|
|
11511
11717
|
const task = new AITaskInput(name, modelId, systemPrompt, promptExamples, metaData);
|
|
11512
|
-
return __classPrivateFieldGet$
|
|
11718
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.addTask", { task });
|
|
11513
11719
|
}
|
|
11514
11720
|
async removeTask(taskId) {
|
|
11515
|
-
return __classPrivateFieldGet$
|
|
11721
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.removeTask", { id: taskId });
|
|
11516
11722
|
}
|
|
11517
11723
|
async updateTask(taskId, task) {
|
|
11518
|
-
return __classPrivateFieldGet$
|
|
11724
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.updateTask", {
|
|
11519
11725
|
task: {
|
|
11520
11726
|
taskId,
|
|
11521
11727
|
name: task.name,
|
|
@@ -11529,34 +11735,34 @@ var AIClient = class {
|
|
|
11529
11735
|
});
|
|
11530
11736
|
}
|
|
11531
11737
|
async modelLoadingStatus(model) {
|
|
11532
|
-
return __classPrivateFieldGet$
|
|
11738
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.modelLoadingStatus", { model });
|
|
11533
11739
|
}
|
|
11534
11740
|
async prompt(taskId, prompt, options) {
|
|
11535
|
-
return __classPrivateFieldGet$
|
|
11741
|
+
return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.prompt", { taskId, prompt }, options);
|
|
11536
11742
|
}
|
|
11537
11743
|
async embed(modelId, text, options) {
|
|
11538
|
-
const aiEmbed = await __classPrivateFieldGet$
|
|
11744
|
+
const aiEmbed = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.embed", { modelId, text }, options);
|
|
11539
11745
|
const compressed = base64Js.toByteArray(aiEmbed);
|
|
11540
11746
|
const inflated = pako.inflate(compressed);
|
|
11541
11747
|
const decompressed = JSON.parse(new TextDecoder("utf-8").decode(inflated));
|
|
11542
11748
|
return decompressed;
|
|
11543
11749
|
}
|
|
11544
11750
|
async openTranscriptionStream(modelId, streamCallback, params) {
|
|
11545
|
-
const streamId = await __classPrivateFieldGet$
|
|
11546
|
-
const unsub = __classPrivateFieldGet$
|
|
11751
|
+
const streamId = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.transcriptionOpen", { modelId, params });
|
|
11752
|
+
const unsub = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").on("transcription-text", (event) => {
|
|
11547
11753
|
if (event.streamId === streamId && event.text)
|
|
11548
11754
|
streamCallback(event.text);
|
|
11549
11755
|
});
|
|
11550
|
-
__classPrivateFieldGet$
|
|
11756
|
+
__classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").set(streamId, unsub);
|
|
11551
11757
|
return streamId;
|
|
11552
11758
|
}
|
|
11553
11759
|
async closeTranscriptionStream(streamId) {
|
|
11554
|
-
__classPrivateFieldGet$
|
|
11760
|
+
__classPrivateFieldGet$3(this, _AIClient_pendingStreamIds, "f").delete(streamId);
|
|
11555
11761
|
try {
|
|
11556
|
-
await __classPrivateFieldGet$
|
|
11762
|
+
await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call("ai.transcriptionClose", { streamId });
|
|
11557
11763
|
} finally {
|
|
11558
|
-
__classPrivateFieldGet$
|
|
11559
|
-
__classPrivateFieldGet$
|
|
11764
|
+
__classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").get(streamId)?.();
|
|
11765
|
+
__classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").delete(streamId);
|
|
11560
11766
|
}
|
|
11561
11767
|
}
|
|
11562
11768
|
async feedTranscriptionStream(streamIds, audio) {
|
|
@@ -11565,10 +11771,10 @@ var AIClient = class {
|
|
|
11565
11771
|
if (ids.length === 0 || typedAudio.length === 0) {
|
|
11566
11772
|
return;
|
|
11567
11773
|
}
|
|
11568
|
-
const baseUrl = __classPrivateFieldGet$
|
|
11569
|
-
const token = __classPrivateFieldGet$
|
|
11774
|
+
const baseUrl = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").getBaseUrl();
|
|
11775
|
+
const token = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").getToken();
|
|
11570
11776
|
const bodyBuffer = typedAudio.buffer.slice(typedAudio.byteOffset, typedAudio.byteOffset + typedAudio.byteLength);
|
|
11571
|
-
const response = await __classPrivateFieldGet$
|
|
11777
|
+
const response = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").doFetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
|
|
11572
11778
|
method: "POST",
|
|
11573
11779
|
headers: {
|
|
11574
11780
|
"Content-Type": "application/octet-stream",
|
|
@@ -11584,6 +11790,67 @@ var AIClient = class {
|
|
|
11584
11790
|
}
|
|
11585
11791
|
};
|
|
11586
11792
|
_AIClient_apiClient = /* @__PURE__ */ new WeakMap(), _AIClient_transcriptionUnsubscribers = /* @__PURE__ */ new WeakMap(), _AIClient_pendingStreamIds = /* @__PURE__ */ new WeakMap();
|
|
11793
|
+
var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
11794
|
+
if (kind === "m")
|
|
11795
|
+
throw new TypeError("Private method is not writable");
|
|
11796
|
+
if (kind === "a" && !f)
|
|
11797
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
11798
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
11799
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11800
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
11801
|
+
};
|
|
11802
|
+
var __classPrivateFieldGet$2 = function(receiver, state, kind, f) {
|
|
11803
|
+
if (kind === "a" && !f)
|
|
11804
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
11805
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
11806
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11807
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11808
|
+
};
|
|
11809
|
+
var _IdentityClient_apiClient;
|
|
11810
|
+
var IdentityClient = class {
|
|
11811
|
+
constructor(baseUrl, token, sharedApiClient) {
|
|
11812
|
+
_IdentityClient_apiClient.set(this, void 0);
|
|
11813
|
+
__classPrivateFieldSet$2(this, _IdentityClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
11814
|
+
}
|
|
11815
|
+
async status() {
|
|
11816
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.status", {});
|
|
11817
|
+
}
|
|
11818
|
+
async log(did, from, fresh) {
|
|
11819
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.log", { did, from, fresh });
|
|
11820
|
+
}
|
|
11821
|
+
async resolve(didUrl, options = {}) {
|
|
11822
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.resolve", {
|
|
11823
|
+
didUrl,
|
|
11824
|
+
fresh: options.fresh,
|
|
11825
|
+
accept: options.accept
|
|
11826
|
+
});
|
|
11827
|
+
}
|
|
11828
|
+
async resetLog(did) {
|
|
11829
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.resetLog", { did });
|
|
11830
|
+
}
|
|
11831
|
+
async cosignIncept(event) {
|
|
11832
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.cosignIncept", { event });
|
|
11833
|
+
}
|
|
11834
|
+
async publish(events) {
|
|
11835
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.publish", { events });
|
|
11836
|
+
}
|
|
11837
|
+
async openOffer(signedOffer) {
|
|
11838
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.openOffer", { signedOffer });
|
|
11839
|
+
}
|
|
11840
|
+
async offers(request, wait) {
|
|
11841
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.offers", { request, wait });
|
|
11842
|
+
}
|
|
11843
|
+
async claimOffer(offer, hint) {
|
|
11844
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.claimOffer", { offer, hint });
|
|
11845
|
+
}
|
|
11846
|
+
async joinStatus(offerId) {
|
|
11847
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.joinStatus", { offerId });
|
|
11848
|
+
}
|
|
11849
|
+
async devices() {
|
|
11850
|
+
return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.devices", {});
|
|
11851
|
+
}
|
|
11852
|
+
};
|
|
11853
|
+
_IdentityClient_apiClient = /* @__PURE__ */ new WeakMap();
|
|
11587
11854
|
function isContainmentTraversal(scope) {
|
|
11588
11855
|
return isTraverseScope(scope) && !("predicate" in scope && scope.predicate) && !("model" in scope && scope.model);
|
|
11589
11856
|
}
|
|
@@ -12756,7 +13023,10 @@ var Ad4mModel = class {
|
|
|
12756
13023
|
}
|
|
12757
13024
|
constructor(perspective, baseExpression) {
|
|
12758
13025
|
this._snapshot = null;
|
|
13026
|
+
this._idMinted = false;
|
|
13027
|
+
this._relationsWritten = /* @__PURE__ */ new Set();
|
|
12759
13028
|
this._baseExpression = baseExpression ? baseExpression : `ad4m://obj/${makeRandomId(24)}`;
|
|
13029
|
+
this._idMinted = !baseExpression;
|
|
12760
13030
|
this._perspective = perspective;
|
|
12761
13031
|
}
|
|
12762
13032
|
get id() {
|
|
@@ -13191,6 +13461,7 @@ var Ad4mModel = class {
|
|
|
13191
13461
|
console.warn(`Relation "${key}" has no metadata, skipping`);
|
|
13192
13462
|
return;
|
|
13193
13463
|
}
|
|
13464
|
+
this._relationsWritten.add(metadata.predicate);
|
|
13194
13465
|
const abstractName = this.abstractName();
|
|
13195
13466
|
if (abstractName) {
|
|
13196
13467
|
if (value != null)
|
|
@@ -13212,6 +13483,7 @@ var Ad4mModel = class {
|
|
|
13212
13483
|
console.warn(`Relation "${key}" has no metadata, skipping`);
|
|
13213
13484
|
return;
|
|
13214
13485
|
}
|
|
13486
|
+
this._relationsWritten.add(metadata.predicate);
|
|
13215
13487
|
const abstractName = this.abstractName();
|
|
13216
13488
|
if (abstractName) {
|
|
13217
13489
|
if (value != null)
|
|
@@ -13381,6 +13653,8 @@ var Ad4mModel = class {
|
|
|
13381
13653
|
break;
|
|
13382
13654
|
}
|
|
13383
13655
|
} else if (Array.isArray(value)) {
|
|
13656
|
+
if (value.length === 0 && !this._snapshot && this._idMinted && !this._relationsWritten.has(this.getRelationOptions(key)?.predicate ?? key))
|
|
13657
|
+
continue;
|
|
13384
13658
|
await this.setRelationValues(key, value, batchId);
|
|
13385
13659
|
} else if (value !== void 0 && value !== null && value !== "") {
|
|
13386
13660
|
const relationMeta = this.getRelationOptions(key);
|
|
@@ -13614,6 +13888,7 @@ var _Ad4mClient_neighbourhoodClient;
|
|
|
13614
13888
|
var _Ad4mClient_perspectiveClient;
|
|
13615
13889
|
var _Ad4mClient_runtimeClient;
|
|
13616
13890
|
var _Ad4mClient_aiClient;
|
|
13891
|
+
var _Ad4mClient_identityClient;
|
|
13617
13892
|
var Ad4mClient = class {
|
|
13618
13893
|
constructor(baseUrl, token, options) {
|
|
13619
13894
|
_Ad4mClient_baseUrl.set(this, void 0);
|
|
@@ -13626,6 +13901,7 @@ var Ad4mClient = class {
|
|
|
13626
13901
|
_Ad4mClient_perspectiveClient.set(this, void 0);
|
|
13627
13902
|
_Ad4mClient_runtimeClient.set(this, void 0);
|
|
13628
13903
|
_Ad4mClient_aiClient.set(this, void 0);
|
|
13904
|
+
_Ad4mClient_identityClient.set(this, void 0);
|
|
13629
13905
|
__classPrivateFieldSet$1(this, _Ad4mClient_baseUrl, baseUrl, "f");
|
|
13630
13906
|
__classPrivateFieldSet$1(this, _Ad4mClient_token, token, "f");
|
|
13631
13907
|
__classPrivateFieldSet$1(this, _Ad4mClient_apiClient, new ApiClient(baseUrl, token, options?.webSocketImpl, options?.fetchImpl), "f");
|
|
@@ -13639,6 +13915,7 @@ var Ad4mClient = class {
|
|
|
13639
13915
|
__classPrivateFieldGet$1(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet$1(this, _Ad4mClient_neighbourhoodClient, "f"));
|
|
13640
13916
|
__classPrivateFieldGet$1(this, _Ad4mClient_perspectiveClient, "f").setAIClient(__classPrivateFieldGet$1(this, _Ad4mClient_aiClient, "f"));
|
|
13641
13917
|
__classPrivateFieldSet$1(this, _Ad4mClient_runtimeClient, new RuntimeClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
|
|
13918
|
+
__classPrivateFieldSet$1(this, _Ad4mClient_identityClient, new IdentityClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
|
|
13642
13919
|
try {
|
|
13643
13920
|
const dt = globalThis.__AD4M_DEVTOOLS__;
|
|
13644
13921
|
if (dt) {
|
|
@@ -13669,6 +13946,9 @@ var Ad4mClient = class {
|
|
|
13669
13946
|
get ai() {
|
|
13670
13947
|
return __classPrivateFieldGet$1(this, _Ad4mClient_aiClient, "f");
|
|
13671
13948
|
}
|
|
13949
|
+
get identity() {
|
|
13950
|
+
return __classPrivateFieldGet$1(this, _Ad4mClient_identityClient, "f");
|
|
13951
|
+
}
|
|
13672
13952
|
on(type, handler, filter) {
|
|
13673
13953
|
return __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f").on(type, handler, filter);
|
|
13674
13954
|
}
|
|
@@ -13683,7 +13963,7 @@ var Ad4mClient = class {
|
|
|
13683
13963
|
__classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f").closeAll();
|
|
13684
13964
|
}
|
|
13685
13965
|
};
|
|
13686
|
-
_Ad4mClient_baseUrl = /* @__PURE__ */ new WeakMap(), _Ad4mClient_token = /* @__PURE__ */ new WeakMap(), _Ad4mClient_apiClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_agentClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_expressionClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_languageClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_neighbourhoodClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_perspectiveClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_runtimeClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_aiClient = /* @__PURE__ */ new WeakMap();
|
|
13966
|
+
_Ad4mClient_baseUrl = /* @__PURE__ */ new WeakMap(), _Ad4mClient_token = /* @__PURE__ */ new WeakMap(), _Ad4mClient_apiClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_agentClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_expressionClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_languageClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_neighbourhoodClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_perspectiveClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_runtimeClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_aiClient = /* @__PURE__ */ new WeakMap(), _Ad4mClient_identityClient = /* @__PURE__ */ new WeakMap();
|
|
13687
13967
|
var ExceptionType;
|
|
13688
13968
|
(function(ExceptionType2) {
|
|
13689
13969
|
ExceptionType2["LanguageIsNotLoaded"] = "LANGUAGE_IS_NOT_LOADED";
|