@coasys/ad4m-connect 0.13.0-postmessage-ws-proxy.3 → 0.13.0-postmessage-ws-proxy.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -203,6 +203,79 @@ PostMessageWebSocket.CLOSING = 2;
203
203
  PostMessageWebSocket.CLOSED = 3;
204
204
  PostMessageWebSocket.CONNECT_TIMEOUT_MS = 3e4;
205
205
 
206
+ // src/PostMessageFetch.ts
207
+ var _idCounter = 0;
208
+ var PROXY_FETCH_TIMEOUT_MS = 6e4;
209
+ function serialiseHeaders(headers) {
210
+ if (!headers)
211
+ return {};
212
+ if (headers instanceof Headers) {
213
+ const out = {};
214
+ headers.forEach((v2, k2) => {
215
+ out[k2] = v2;
216
+ });
217
+ return out;
218
+ }
219
+ if (Array.isArray(headers)) {
220
+ return Object.fromEntries(headers);
221
+ }
222
+ return __spreadValues({}, headers);
223
+ }
224
+ function makePostMessageFetch(targetOrigin) {
225
+ return function postMessageFetch(input, init) {
226
+ return __async(this, null, function* () {
227
+ var _a;
228
+ const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
229
+ const method = (_a = init == null ? void 0 : init.method) != null ? _a : "GET";
230
+ const headers = serialiseHeaders(init == null ? void 0 : init.headers);
231
+ const id = String(++_idCounter);
232
+ let bodyBuffer = null;
233
+ if ((init == null ? void 0 : init.body) instanceof ArrayBuffer) {
234
+ const b2 = init.body;
235
+ bodyBuffer = b2.slice(0);
236
+ }
237
+ return new Promise((resolve, reject) => {
238
+ let timer = null;
239
+ const cleanup = () => {
240
+ window.removeEventListener("message", handler);
241
+ if (timer)
242
+ clearTimeout(timer);
243
+ };
244
+ const handler = (event) => {
245
+ if (event.source !== window.parent)
246
+ return;
247
+ if (event.origin !== targetOrigin)
248
+ return;
249
+ if (!event.data || event.data.id !== id)
250
+ return;
251
+ if (event.data.type === "AD4M_PROXY_HTTP_RESPONSE") {
252
+ cleanup();
253
+ const { status, statusText, body } = event.data;
254
+ resolve(new Response(body != null ? body : null, { status, statusText }));
255
+ return;
256
+ }
257
+ if (event.data.type === "AD4M_PROXY_HTTP_ERROR") {
258
+ cleanup();
259
+ reject(new TypeError(event.data.message || "Failed to fetch"));
260
+ return;
261
+ }
262
+ };
263
+ window.addEventListener("message", handler);
264
+ timer = setTimeout(() => {
265
+ cleanup();
266
+ reject(new TypeError(`AD4M proxy HTTP request timed out after ${PROXY_FETCH_TIMEOUT_MS}ms`));
267
+ }, PROXY_FETCH_TIMEOUT_MS);
268
+ const msg = { type: "AD4M_PROXY_HTTP_REQUEST", id, url, method, headers };
269
+ if (bodyBuffer) {
270
+ window.parent.postMessage(__spreadProps(__spreadValues({}, msg), { body: bodyBuffer }), targetOrigin, [bodyBuffer]);
271
+ } else {
272
+ window.parent.postMessage(__spreadProps(__spreadValues({}, msg), { body: null }), targetOrigin);
273
+ }
274
+ });
275
+ });
276
+ };
277
+ }
278
+
206
279
  // ../core/lib/index.js
207
280
  var RpcError = class extends Error {
208
281
  constructor(status, body) {
@@ -215,12 +288,12 @@ var RpcError = class extends Error {
215
288
  var DEFAULT_TIMEOUT_MS = 3e4;
216
289
  var MAX_RECONNECT_DELAY_MS = 3e4;
217
290
  var INITIAL_RECONNECT_DELAY_MS = 500;
218
- var _idCounter = 0;
291
+ var _idCounter2 = 0;
219
292
  function nextId() {
220
- return String(++_idCounter);
293
+ return String(++_idCounter2);
221
294
  }
222
295
  var ApiClient = class {
223
- constructor(baseUrl, token, webSocketImpl) {
296
+ constructor(baseUrl, token, webSocketImpl, fetchImpl) {
224
297
  this._ws = null;
225
298
  this._wsCallbacks = /* @__PURE__ */ new Set();
226
299
  this._pendingCalls = /* @__PURE__ */ new Map();
@@ -233,6 +306,7 @@ var ApiClient = class {
233
306
  this.baseUrl = baseUrl;
234
307
  this.token = token;
235
308
  this._webSocketImpl = webSocketImpl;
309
+ this._fetchImpl = fetchImpl;
236
310
  }
237
311
  getBaseUrl() {
238
312
  return this.baseUrl;
@@ -240,14 +314,17 @@ var ApiClient = class {
240
314
  getToken() {
241
315
  return this.token;
242
316
  }
317
+ doFetch(url, init) {
318
+ return this._fetchImpl ? this._fetchImpl(url, init) : fetch(url, init);
319
+ }
243
320
  setToken(token) {
244
321
  this.token = token;
245
322
  }
246
323
  _getWsUrl() {
247
324
  const wsBase = this.baseUrl.replace(/^http:\/\//, "ws://").replace(/^https:\/\//, "wss://");
248
325
  const tokenParam = this.token ? `token=${encodeURIComponent(this.token)}` : "";
249
- const path = "/api/v1/ws";
250
- return tokenParam ? `${wsBase}${path}?${tokenParam}` : `${wsBase}${path}`;
326
+ const path2 = "/api/v1/ws";
327
+ return tokenParam ? `${wsBase}${path2}?${tokenParam}` : `${wsBase}${path2}`;
251
328
  }
252
329
  _ensureWs() {
253
330
  if (this._ws && (this._ws.readyState === 1 || this._ws.readyState === 0)) {
@@ -672,9 +749,9 @@ var Literal = class {
672
749
  __classPrivateFieldSet$b(l5, _Literal_url, url, "f");
673
750
  return l5;
674
751
  }
675
- static from(literal) {
752
+ static from(literal2) {
676
753
  const l5 = new Literal();
677
- __classPrivateFieldSet$b(l5, _Literal_literal, literal, "f");
754
+ __classPrivateFieldSet$b(l5, _Literal_literal, literal2, "f");
678
755
  return l5;
679
756
  }
680
757
  toUrl() {
@@ -881,6 +958,32 @@ function buildSDNA(subjectName, obj, properties, allRelationsMeta) {
881
958
  name: subjectName
882
959
  };
883
960
  }
961
+ function isNodeExpression(v2) {
962
+ if (typeof v2 !== "object" || v2 === null)
963
+ return false;
964
+ const obj = v2;
965
+ const type = obj.type;
966
+ switch (type) {
967
+ case "focus":
968
+ return typeof obj.type === "string";
969
+ case "literal":
970
+ return typeof obj.value === "string" || typeof obj.value === "number" || typeof obj.value === "boolean";
971
+ case "path":
972
+ return typeof obj.predicate === "string";
973
+ case "exists":
974
+ return isNodeExpression(obj.expr);
975
+ case "if":
976
+ return isNodeExpression(obj.cond) && isNodeExpression(obj.then) && (obj.else === void 0 || isNodeExpression(obj.else));
977
+ case "concat":
978
+ return Array.isArray(obj.args) && obj.args.every(isNodeExpression);
979
+ case "coalesce":
980
+ return Array.isArray(obj.args) && obj.args.every(isNodeExpression);
981
+ case "function":
982
+ return typeof obj.iri === "string" && Array.isArray(obj.args) && obj.args.every(isNodeExpression);
983
+ default:
984
+ return false;
985
+ }
986
+ }
884
987
  function extractNamespace(uri) {
885
988
  const hashIndex = uri.lastIndexOf("#");
886
989
  if (hashIndex !== -1) {
@@ -1141,7 +1244,7 @@ var SHACLShape = class {
1141
1244
  target: `literal:${prop.writable}`
1142
1245
  });
1143
1246
  }
1144
- if (prop.resolveLanguage) {
1247
+ if (prop.resolveLanguage != null) {
1145
1248
  links.push({
1146
1249
  source: propShapeId,
1147
1250
  predicate: "ad4m://resolveLanguage",
@@ -1232,6 +1335,13 @@ var SHACLShape = class {
1232
1335
  target: `literal:${prop.filter}`
1233
1336
  });
1234
1337
  }
1338
+ if (prop.transform && typeof prop.transform === "object") {
1339
+ links.push({
1340
+ source: propShapeId,
1341
+ predicate: "ad4m://transform",
1342
+ target: `literal:string:${JSON.stringify(prop.transform)}`
1343
+ });
1344
+ }
1235
1345
  }
1236
1346
  return links;
1237
1347
  }
@@ -1414,6 +1524,19 @@ var SHACLShape = class {
1414
1524
  val = val.substring(8);
1415
1525
  prop.filter = val === "true";
1416
1526
  }
1527
+ const transformLink = links.find((l5) => l5.source === propShapeId && l5.predicate === "ad4m://transform");
1528
+ if (transformLink) {
1529
+ const jsonStr = transformLink.target.replace(/^literal:\/\/string:|^literal:string:/, "");
1530
+ try {
1531
+ const parsed = JSON.parse(jsonStr);
1532
+ if (!isNodeExpression(parsed)) {
1533
+ throw new Error(`Invalid transform for property ${propShapeId}: payload is not a valid NodeExpression. Received: ${jsonStr}`);
1534
+ }
1535
+ prop.transform = parsed;
1536
+ } catch (e7) {
1537
+ throw new Error(`Failed to deserialize transform for property ${propShapeId}: ${e7 instanceof Error ? e7.message : String(e7)}. Payload: ${jsonStr}`);
1538
+ }
1539
+ }
1417
1540
  shape.addProperty(prop);
1418
1541
  }
1419
1542
  return shape;
@@ -1448,7 +1571,8 @@ var SHACLShape = class {
1448
1571
  target_class_name: p2.targetClassName,
1449
1572
  where_filter: p2.whereFilter,
1450
1573
  where_predicates: p2.wherePredicates,
1451
- filter: p2.filter
1574
+ filter: p2.filter,
1575
+ transform: p2.transform
1452
1576
  })),
1453
1577
  constructor_actions: this.constructor_actions,
1454
1578
  destructor_actions: this.destructor_actions
@@ -1457,6 +1581,9 @@ var SHACLShape = class {
1457
1581
  static fromJSON(json) {
1458
1582
  const shape = json.node_shape_uri ? new SHACLShape(json.node_shape_uri, json.target_class) : new SHACLShape(json.target_class);
1459
1583
  for (const p2 of json.properties || []) {
1584
+ if (p2.transform && !isNodeExpression(p2.transform)) {
1585
+ throw new Error(`Invalid transform for property ${p2.name}: payload is not a valid NodeExpression. Received: ${JSON.stringify(p2.transform)}`);
1586
+ }
1460
1587
  shape.addProperty({
1461
1588
  path: p2.path,
1462
1589
  name: p2.name,
@@ -1482,7 +1609,8 @@ var SHACLShape = class {
1482
1609
  targetClassName: p2.target_class_name,
1483
1610
  whereFilter: p2.where_filter,
1484
1611
  wherePredicates: p2.where_predicates,
1485
- filter: p2.filter
1612
+ filter: p2.filter,
1613
+ transform: p2.transform
1486
1614
  });
1487
1615
  }
1488
1616
  if (json.constructor_actions) {
@@ -1570,12 +1698,15 @@ function buildSHACL(subjectName, target, properties, allRelationsMeta, conforman
1570
1698
  if (propMeta.writable !== void 0) {
1571
1699
  propShape.writable = propMeta.writable;
1572
1700
  }
1573
- if (propMeta.resolveLanguage) {
1701
+ if (propMeta.resolveLanguage != null) {
1574
1702
  propShape.resolveLanguage = propMeta.resolveLanguage;
1575
1703
  }
1576
1704
  if (propMeta.getter) {
1577
1705
  propShape.getter = propMeta.getter;
1578
1706
  }
1707
+ if (propMeta.transform) {
1708
+ propShape.transform = propMeta.transform;
1709
+ }
1579
1710
  if (propMeta.prologSetter) {
1580
1711
  console.warn(`[SHACL Generation] Custom Prolog setter for property '${propName}' in class '${subjectName}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`);
1581
1712
  } else if (propMeta.writable && propMeta.through) {
@@ -8948,7 +9079,7 @@ var AIClient = class {
8948
9079
  const baseUrl = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").getBaseUrl();
8949
9080
  const token = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").getToken();
8950
9081
  const bodyBuffer = typedAudio.buffer.slice(typedAudio.byteOffset, typedAudio.byteOffset + typedAudio.byteLength);
8951
- const response = await fetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
9082
+ const response = await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").doFetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
8952
9083
  method: "POST",
8953
9084
  headers: {
8954
9085
  "Content-Type": "application/octet-stream",
@@ -8988,8 +9119,8 @@ function normalizeNamespaceString(namespace) {
8988
9119
  return "";
8989
9120
  if (namespace.includes("://")) {
8990
9121
  const [scheme, rest] = namespace.split("://");
8991
- const path = (rest || "").replace(/\/+$/, "");
8992
- return `${scheme}://${path}`;
9122
+ const path2 = (rest || "").replace(/\/+$/, "");
9123
+ return `${scheme}://${path2}`;
8993
9124
  } else {
8994
9125
  return namespace.replace(/\/+$/, "");
8995
9126
  }
@@ -9587,11 +9718,7 @@ var ModelQueryBuilder = class {
9587
9718
  const parseResults = (raw) => {
9588
9719
  return ctor.parseModelResult(this.perspective, raw, this.queryParams.include, this.queryParams.properties);
9589
9720
  };
9590
- const resolveAndReturn = async (instances) => {
9591
- await ctor.resolveNonLiteralProps(this.perspective, instances);
9592
- return instances;
9593
- };
9594
- const initialResults = await resolveAndReturn(parseResults(initialModelResult));
9721
+ const initialResults = parseResults(initialModelResult);
9595
9722
  let lastResultFingerprint = null;
9596
9723
  const buildFingerprint = (results) => {
9597
9724
  if (results.length === 0)
@@ -9601,20 +9728,16 @@ var ModelQueryBuilder = class {
9601
9728
  lastResultFingerprint = buildFingerprint(initialResults);
9602
9729
  const unsubscribe = this.perspective.client.subscribeToQueryUpdates(subscriptionId, (rawResult) => {
9603
9730
  try {
9604
- const parsed = parseResults(rawResult);
9605
- console.debug(`[ModelQueryBuilder.subscribe] Update received for ${subscriptionId}: ${parsed.length} instances`);
9606
- resolveAndReturn(parsed).then((results) => {
9607
- const fp = buildFingerprint(results);
9608
- if (fp === lastResultFingerprint) {
9609
- console.debug(`[ModelQueryBuilder.subscribe] Fingerprint unchanged, skipping callback`);
9610
- return;
9611
- }
9612
- console.debug(`[ModelQueryBuilder.subscribe] Fingerprint changed, calling callback with ${results.length} results`);
9613
- lastResultFingerprint = fp;
9614
- callback(results);
9615
- }).catch((e7) => {
9616
- console.error("Model subscription update resolve error:", e7);
9617
- });
9731
+ const results = parseResults(rawResult);
9732
+ console.debug(`[ModelQueryBuilder.subscribe] Update received for ${subscriptionId}: ${results.length} instances`);
9733
+ const fp = buildFingerprint(results);
9734
+ if (fp === lastResultFingerprint) {
9735
+ console.debug(`[ModelQueryBuilder.subscribe] Fingerprint unchanged, skipping callback`);
9736
+ return;
9737
+ }
9738
+ console.debug(`[ModelQueryBuilder.subscribe] Fingerprint changed, calling callback with ${results.length} results`);
9739
+ lastResultFingerprint = fp;
9740
+ callback(results);
9618
9741
  } catch (e7) {
9619
9742
  console.error("Model subscription update parse error:", e7);
9620
9743
  }
@@ -9828,27 +9951,6 @@ function normalizeValue(value) {
9828
9951
  }
9829
9952
  return value;
9830
9953
  }
9831
- function defaultFileDecode(resolved) {
9832
- if (resolved !== null && typeof resolved === "object" && "data_base64" in resolved) {
9833
- const fd = resolved;
9834
- let raw;
9835
- try {
9836
- raw = atob(fd.data_base64);
9837
- } catch {
9838
- return resolved;
9839
- }
9840
- const isJson = !fd.file_type || fd.file_type === "application/json";
9841
- if (isJson) {
9842
- try {
9843
- return JSON.parse(raw);
9844
- } catch {
9845
- return raw;
9846
- }
9847
- }
9848
- return raw;
9849
- }
9850
- return resolved;
9851
- }
9852
9954
  function jsonToModelInstance(ModelClass, perspective, json, include, properties) {
9853
9955
  const instance = new ModelClass(perspective, json.id || json.baseExpression);
9854
9956
  if (properties) {
@@ -9882,19 +9984,6 @@ function jsonToModelInstance(ModelClass, perspective, json, include, properties)
9882
9984
  }
9883
9985
  instance[key] = value;
9884
9986
  }
9885
- try {
9886
- const propsMeta = getPropertiesMetadata(ModelClass);
9887
- for (const [propName, opts] of Object.entries(propsMeta)) {
9888
- const o6 = opts;
9889
- if (typeof o6.transform !== "function" || !(propName in json))
9890
- continue;
9891
- if (o6.resolveLanguage != null && o6.resolveLanguage !== "literal")
9892
- continue;
9893
- instance[propName] = o6.transform(instance[propName]);
9894
- }
9895
- } catch (e7) {
9896
- console.debug("jsonToModelInstance: transform metadata unavailable:", e7);
9897
- }
9898
9987
  if (include) {
9899
9988
  const relMeta = getRelationsMetadata(ModelClass);
9900
9989
  for (const [relName, includeVal] of Object.entries(include)) {
@@ -9968,8 +10057,8 @@ var Ad4mModel = class {
9968
10057
  ...options.getter !== void 0 && { getter: options.getter },
9969
10058
  ...options.prologSetter !== void 0 && { prologSetter: options.prologSetter },
9970
10059
  ...options.local !== void 0 && { local: options.local },
9971
- ...options.transform !== void 0 && { transform: options.transform },
9972
- ...options.flag !== void 0 && { flag: options.flag }
10060
+ ...options.flag !== void 0 && { flag: options.flag },
10061
+ ...options.transform !== void 0 && { transform: options.transform }
9973
10062
  };
9974
10063
  }
9975
10064
  const relationsMetadata = {};
@@ -10271,44 +10360,12 @@ var Ad4mModel = class {
10271
10360
  return [];
10272
10361
  return arr.map((json) => jsonToModelInstance(this, perspective, json, include, properties));
10273
10362
  }
10274
- static async resolveNonLiteralProps(perspective, instances) {
10275
- const propsMeta = getPropertiesMetadata(this);
10276
- const resolveProps = Object.entries(propsMeta).filter(([, opts]) => opts.resolveLanguage != null && opts.resolveLanguage !== "literal");
10277
- if (resolveProps.length === 0)
10278
- return;
10279
- await Promise.all(instances.map(async (inst) => {
10280
- for (const [propName, opts] of resolveProps) {
10281
- const val = inst[propName];
10282
- const transform = opts.transform;
10283
- const applyTransform = (resolved) => typeof transform === "function" ? transform(resolved) : defaultFileDecode(resolved);
10284
- if (typeof val === "string" && val && !val.startsWith("literal:")) {
10285
- try {
10286
- const expression = await perspective.getExpression(val);
10287
- if (expression) {
10288
- let resolved;
10289
- try {
10290
- resolved = JSON.parse(expression.data);
10291
- } catch {
10292
- resolved = expression.data;
10293
- }
10294
- inst[propName] = applyTransform(resolved);
10295
- }
10296
- } catch (e7) {
10297
- console.debug(`resolveNonLiteralProps: resolution failed for '${propName}':`, e7);
10298
- }
10299
- } else if (val !== null && val !== void 0 && typeof val === "object") {
10300
- inst[propName] = applyTransform(val);
10301
- }
10302
- }
10303
- }));
10304
- }
10305
10363
  static async executeModelQuery(perspective, query = {}, classNameOverride) {
10306
10364
  const { className, queryJson } = this.prepareModelQueryParams(query, classNameOverride);
10307
10365
  const result = await perspective.modelQuery(className, queryJson);
10308
10366
  const instances = result.instances.map((json) => {
10309
10367
  return jsonToModelInstance(this, perspective, json, query.include, query.properties);
10310
10368
  });
10311
- await this.resolveNonLiteralProps(perspective, instances);
10312
10369
  const snapshotRelations = query.include ? Object.fromEntries(Object.entries(query.include).filter(([k2]) => !k2.startsWith("$"))) : void 0;
10313
10370
  for (const inst of instances) {
10314
10371
  inst.takeSnapshot(snapshotRelations && Object.keys(snapshotRelations).length > 0 ? snapshotRelations : void 0);
@@ -10774,7 +10831,7 @@ var Ad4mClient = class {
10774
10831
  _Ad4mClient_aiClient.set(this, void 0);
10775
10832
  __classPrivateFieldSet$1(this, _Ad4mClient_baseUrl, baseUrl, "f");
10776
10833
  __classPrivateFieldSet$1(this, _Ad4mClient_token, token, "f");
10777
- __classPrivateFieldSet$1(this, _Ad4mClient_apiClient, new ApiClient(baseUrl, token, options?.webSocketImpl), "f");
10834
+ __classPrivateFieldSet$1(this, _Ad4mClient_apiClient, new ApiClient(baseUrl, token, options?.webSocketImpl, options?.fetchImpl), "f");
10778
10835
  __classPrivateFieldSet$1(this, _Ad4mClient_agentClient, new AgentClient(baseUrl, token, subscribe, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
10779
10836
  __classPrivateFieldSet$1(this, _Ad4mClient_expressionClient, new ExpressionClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
10780
10837
  __classPrivateFieldSet$1(this, _Ad4mClient_languageClient, new LanguageClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
@@ -10852,6 +10909,44 @@ var _SmartLiteral_base;
10852
10909
  _SmartLiteral_perspective = /* @__PURE__ */ new WeakMap(), _SmartLiteral_base = /* @__PURE__ */ new WeakMap();
10853
10910
  var NeighbourhoodExpression = class extends ExpressionGeneric() {
10854
10911
  };
10912
+ function focus() {
10913
+ return Object.freeze({ type: "focus" });
10914
+ }
10915
+ function literal(value) {
10916
+ return Object.freeze({ type: "literal", value });
10917
+ }
10918
+ function path(predicate) {
10919
+ return Object.freeze({ type: "path", predicate });
10920
+ }
10921
+ function exists(expr) {
10922
+ return Object.freeze({ type: "exists", expr });
10923
+ }
10924
+ function ifExpr(cond) {
10925
+ return {
10926
+ then: (thenExpr) => ({
10927
+ else: (elseExpr) => {
10928
+ return Object.freeze({
10929
+ type: "if",
10930
+ cond,
10931
+ then: thenExpr,
10932
+ ...elseExpr !== void 0 && { else: elseExpr }
10933
+ });
10934
+ },
10935
+ toExpression: () => Object.freeze({
10936
+ type: "if",
10937
+ cond,
10938
+ then: thenExpr
10939
+ })
10940
+ })
10941
+ };
10942
+ }
10943
+ function concat(...args) {
10944
+ return Object.freeze({ type: "concat", args });
10945
+ }
10946
+ function coalesce(...args) {
10947
+ return Object.freeze({ type: "coalesce", args });
10948
+ }
10949
+ var fileToDataUri = ifExpr(exists(path("file_storage://data_base64"))).then(concat(literal("data:"), coalesce(path("file_storage://file_type"), literal("image/png")), literal(";base64,"), path("file_storage://data_base64"))).else(focus());
10855
10950
 
10856
10951
  // ../node_modules/.pnpm/auto-bind@5.0.1/node_modules/auto-bind/index.js
10857
10952
  var getAllProperties = (object) => {
@@ -11225,13 +11320,18 @@ var Ad4mConnect = class extends EventTarget {
11225
11320
  throw new Error("AD4M proxy mode requires a non-opaque parent origin. Ensure the host iframe is not sandboxed without allow-same-origin.");
11226
11321
  }
11227
11322
  const parentOrigin = event.origin;
11228
- const wsImpl = (url) => new PostMessageWebSocket(url, parentOrigin);
11323
+ class WsImpl extends PostMessageWebSocket {
11324
+ constructor(url) {
11325
+ super(url, parentOrigin);
11326
+ }
11327
+ }
11328
+ const fetchImpl = makePostMessageFetch(parentOrigin);
11229
11329
  this.notifyConnectionChange("connecting");
11230
11330
  this.ad4mClient = new Ad4mClient(
11231
11331
  "http://proxy",
11232
11332
  normalizedToken,
11233
11333
  false,
11234
- { webSocketImpl: wsImpl }
11334
+ { webSocketImpl: WsImpl, fetchImpl }
11235
11335
  );
11236
11336
  this.notifyConnectionChange("connected");
11237
11337
  yield this.checkAuth();