@bounded-sh/core 0.0.67 → 0.0.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/client/subscribe-query.d.ts +12 -1
  2. package/dist/{index-TyXiW4Uf.mjs → index-C9h-Bnjk.mjs} +50 -11
  3. package/dist/{index-TyXiW4Uf.mjs.map → index-C9h-Bnjk.mjs.map} +1 -1
  4. package/dist/{index-DNZifL5j.js → index-C9w7qQpj.js} +51 -10
  5. package/dist/{index-DNZifL5j.js.map → index-C9w7qQpj.js.map} +1 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +3 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/{realtime-store-CpbnXM7q.mjs → realtime-store-B_Szs6F3.mjs} +2 -2
  11. package/dist/{realtime-store-CpbnXM7q.mjs.map → realtime-store-B_Szs6F3.mjs.map} +1 -1
  12. package/dist/{realtime-store-CINyAkPw.js → realtime-store-CQiij3zc.js} +2 -2
  13. package/dist/{realtime-store-CINyAkPw.js.map → realtime-store-CQiij3zc.js.map} +1 -1
  14. package/dist/{solana-message-Bycv-L5n.js → solana-message-DibkzgkZ.js} +2 -2
  15. package/dist/{solana-message-Bycv-L5n.js.map → solana-message-DibkzgkZ.js.map} +1 -1
  16. package/dist/{solana-message-DXXwC95Z.mjs → solana-message-ngQQt80s.mjs} +2 -2
  17. package/dist/{solana-message-DXXwC95Z.mjs.map → solana-message-ngQQt80s.mjs.map} +1 -1
  18. package/dist/{solana-operations-ChHG25O0.mjs → solana-operations-B0Q9UOHR.mjs} +2 -2
  19. package/dist/{solana-operations-ChHG25O0.mjs.map → solana-operations-B0Q9UOHR.mjs.map} +1 -1
  20. package/dist/{solana-operations-Dm_4VnlB.js → solana-operations-XjBhPOnu.js} +2 -2
  21. package/dist/{solana-operations-Dm_4VnlB.js.map → solana-operations-XjBhPOnu.js.map} +1 -1
  22. package/dist/types.d.ts +7 -4
  23. package/package.json +2 -2
@@ -4045,7 +4045,7 @@ class ServerSessionManager {
4045
4045
  const sessionConfig = (_a = this.sessionConfig) !== null && _a !== void 0 ? _a : undefined;
4046
4046
  /* fetch nonce from auth API (bound to the snapshotted app+issuer) */
4047
4047
  const nonce = await genAuthNonce(sessionConfig);
4048
- const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-Bycv-L5n.js'); });
4048
+ const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-DibkzgkZ.js'); });
4049
4049
  const message = await genSolanaMessage(address, nonce, sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.appId);
4050
4050
  /* sign the message */
4051
4051
  const sigBytes = nacl.sign.detached(new TextEncoder().encode(message), kp.secretKey);
@@ -6777,7 +6777,7 @@ async function doReconnectWithNewAuth() {
6777
6777
  console.warn('[WS v2] Failed to clear HTTP read cache on auth change:', error);
6778
6778
  }
6779
6779
  try {
6780
- const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-CINyAkPw.js'); });
6780
+ const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-CQiij3zc.js'); });
6781
6781
  await reconnectRealtimeStoreWithNewAuth();
6782
6782
  }
6783
6783
  catch (error) {
@@ -8719,7 +8719,7 @@ async function setMany(many, options) {
8719
8719
  'Nothing was signed or submitted.');
8720
8720
  }
8721
8721
  const solanaChain = workerChain;
8722
- const { handlePreBuiltTransaction } = await Promise.resolve().then(function () { return require('./solana-operations-Dm_4VnlB.js'); });
8722
+ const { handlePreBuiltTransaction } = await Promise.resolve().then(function () { return require('./solana-operations-XjBhPOnu.js'); });
8723
8723
  const solanaOutcome = await handlePreBuiltTransaction(curTx, authProvider, options, expectedWritePaths);
8724
8724
  // `shouldSubmitTx: false` signed WITHOUT sending — no signature exists,
8725
8725
  // and there is nothing to mirror, so no synchronization is attempted.
@@ -9617,9 +9617,40 @@ function sortDeep(value) {
9617
9617
  }
9618
9618
  return value;
9619
9619
  }
9620
- /** Deterministic key-sorted serialization of query args. */
9620
+ /**
9621
+ * Key-sorted deep copy that mirrors the JSON wire form byte-for-byte. Unlike
9622
+ * `sortDeep`, it assigns into NULL-PROTOTYPE objects so an own `__proto__` key is
9623
+ * kept as an ordinary JSON property instead of being swallowed by
9624
+ * `Object.prototype`'s `__proto__` setter (which would mutate the prototype and
9625
+ * drop the property, diverging from what `JSON.stringify` actually emits).
9626
+ */
9627
+ function sortDeepWire(value) {
9628
+ if (Array.isArray(value))
9629
+ return value.map(sortDeepWire);
9630
+ if (value && typeof value === 'object') {
9631
+ const out = Object.create(null);
9632
+ for (const k of Object.keys(value).sort())
9633
+ out[k] = sortDeepWire(value[k]);
9634
+ return out;
9635
+ }
9636
+ return value;
9637
+ }
9638
+ /**
9639
+ * Deterministic key-sorted serialization of query args, canonicalizing the EXACT
9640
+ * JSON wire representation the request serializer sends. Args are first projected
9641
+ * through `JSON.parse(JSON.stringify(...))` so `toJSON` runs (a `Date` becomes its
9642
+ * ISO string, not `{}`) and functions/`undefined` are dropped exactly as the wire
9643
+ * does, then key-sorted with null-prototype objects so an own `__proto__` key
9644
+ * round-trips as a property. This makes the dedupe key match what the server
9645
+ * actually receives, so two subscriptions can share a poller only when their wire
9646
+ * inputs are identical. Cyclic structures and other values the wire cannot
9647
+ * serialize (e.g. `BigInt`) are rejected by `JSON.stringify` here, exactly as they
9648
+ * would be on the wire.
9649
+ */
9621
9650
  function canonicalizeArgs(args) {
9622
- return JSON.stringify(sortDeep(args !== null && args !== void 0 ? args : null));
9651
+ var _a;
9652
+ const wire = JSON.parse((_a = JSON.stringify(args !== null && args !== void 0 ? args : null)) !== null && _a !== void 0 ? _a : 'null');
9653
+ return JSON.stringify(sortDeepWire(wire));
9623
9654
  }
9624
9655
  /**
9625
9656
  * Deterministic key-sorted serialization of a query RESULT for change detection.
@@ -10223,7 +10254,7 @@ function toMillis(seconds) {
10223
10254
 
10224
10255
  /** SIWS message creation is async already, so its onchain module can be lazy. */
10225
10256
  async function genSolanaMessage(address, nonce) {
10226
- const implementation = await Promise.resolve().then(function () { return require('./solana-message-Bycv-L5n.js'); });
10257
+ const implementation = await Promise.resolve().then(function () { return require('./solana-message-DibkzgkZ.js'); });
10227
10258
  return implementation.genSolanaMessage(address, nonce);
10228
10259
  }
10229
10260
 
@@ -10293,7 +10324,14 @@ async function invoke(name, args = {}, opts = {}) {
10293
10324
  const controller = new AbortController();
10294
10325
  const timeoutMs = (_e = opts.timeoutMs) !== null && _e !== void 0 ? _e : 60000;
10295
10326
  const timer = setTimeout(() => controller.abort(), timeoutMs);
10327
+ // `fetch` resolves as soon as the response HEADERS arrive, not when the body
10328
+ // has been received, so the abort timer must stay armed across `res.text()`
10329
+ // too. Clearing it in a `finally` that covers both the fetch AND the body read
10330
+ // means a dispatcher/network that returns headers then stalls (or drip-feeds)
10331
+ // the body is torn down at `timeoutMs` instead of leaving `invoke` pending
10332
+ // forever and accumulating open connections (DS3-0432).
10296
10333
  let res;
10334
+ let text;
10297
10335
  try {
10298
10336
  res = await fetch(`${base}/invoke`, {
10299
10337
  method: 'POST',
@@ -10301,17 +10339,18 @@ async function invoke(name, args = {}, opts = {}) {
10301
10339
  body: JSON.stringify({ appId: config.appId, functionName: name, args }),
10302
10340
  signal: controller.signal,
10303
10341
  });
10342
+ text = await res.text();
10304
10343
  }
10305
10344
  catch (err) {
10306
- clearTimeout(timer);
10307
10345
  if ((err === null || err === void 0 ? void 0 : err.name) === 'AbortError') {
10308
10346
  throw new FunctionInvokeError(`Function "${name}" invocation timed out after ${timeoutMs}ms`);
10309
10347
  }
10310
10348
  throw new FunctionInvokeError(`Failed to reach the functions dispatcher: ${(_f = err === null || err === void 0 ? void 0 : err.message) !== null && _f !== void 0 ? _f : String(err)}`);
10311
10349
  }
10312
- clearTimeout(timer);
10350
+ finally {
10351
+ clearTimeout(timer);
10352
+ }
10313
10353
  let body = null;
10314
- const text = await res.text();
10315
10354
  if (text) {
10316
10355
  try {
10317
10356
  body = JSON.parse(text);
@@ -10737,8 +10776,10 @@ exports.getCachedData = getCachedData;
10737
10776
  exports.getConfig = getConfig;
10738
10777
  exports.getConfiguredAppId = getConfiguredAppId;
10739
10778
  exports.getFiles = getFiles;
10779
+ exports.getFreshAuthToken = getFreshAuthToken;
10740
10780
  exports.getIdToken = getIdToken;
10741
10781
  exports.getMany = getMany;
10782
+ exports.getSessionGeneration = getSessionGeneration;
10742
10783
  exports.getWebhookKeysUrl = getWebhookKeysUrl;
10743
10784
  exports.hasActiveConnection = hasActiveConnection;
10744
10785
  exports.increment = increment;
@@ -10778,4 +10819,4 @@ exports.toMillis = toMillis;
10778
10819
  exports.toSeconds = toSeconds;
10779
10820
  exports.waitForSetResult = waitForSetResult;
10780
10821
  exports.withEffects = withEffects;
10781
- //# sourceMappingURL=index-DNZifL5j.js.map
10822
+ //# sourceMappingURL=index-C9w7qQpj.js.map