@pooflabs/web 0.0.89-ux.2 → 0.0.90

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 (60) hide show
  1. package/dist/{index-BLbguAbm.js → index-BZ_W-sR0.js} +2 -2
  2. package/dist/index-BZ_W-sR0.js.map +1 -0
  3. package/dist/{index-CEr58d1y.esm.js → index-C65AsRIA.esm.js} +364 -14
  4. package/dist/index-C65AsRIA.esm.js.map +1 -0
  5. package/dist/{index-DsyaaxjP.js → index-CqpErQap.js} +363 -13
  6. package/dist/index-CqpErQap.js.map +1 -0
  7. package/dist/{index-D_H81ZZs.esm.js → index-CzVM_hix.esm.js} +142 -7
  8. package/dist/index-CzVM_hix.esm.js.map +1 -0
  9. package/dist/index-D72o3sHT.esm.js +6 -0
  10. package/dist/index-D72o3sHT.esm.js.map +1 -0
  11. package/dist/{index-BhMsVVRC.esm.js → index-DOYZMq5N.esm.js} +363 -13
  12. package/dist/index-DOYZMq5N.esm.js.map +1 -0
  13. package/dist/{index-BsAk0dF_.js → index-Eb2uyla3.js} +147 -6
  14. package/dist/index-Eb2uyla3.js.map +1 -0
  15. package/dist/{index-DV-v3Udi.js → index-lt7AQ69U.js} +364 -14
  16. package/dist/index-lt7AQ69U.js.map +1 -0
  17. package/dist/{index.browser-AsD3ML3C.js → index.browser-BltIkY00.js} +2 -2
  18. package/dist/{index.browser-AsD3ML3C.js.map → index.browser-BltIkY00.js.map} +1 -1
  19. package/dist/{index.browser-CmvrvtVk.js → index.browser-C81ODkjH.js} +2 -2
  20. package/dist/{index.browser-CmvrvtVk.js.map → index.browser-C81ODkjH.js.map} +1 -1
  21. package/dist/{index.browser-Cdrgfw30.esm.js → index.browser-D1uNEi4e.esm.js} +2 -2
  22. package/dist/{index.browser-Cdrgfw30.esm.js.map → index.browser-D1uNEi4e.esm.js.map} +1 -1
  23. package/dist/{index.browser-Ctdjdn7K.esm.js → index.browser-zlnKOqcR.esm.js} +2 -2
  24. package/dist/{index.browser-Ctdjdn7K.esm.js.map → index.browser-zlnKOqcR.esm.js.map} +1 -1
  25. package/dist/index.esm.js +1 -1
  26. package/dist/index.js +7 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/{index.native-CujLdGqC.esm.js → index.native-Czk4F68O.esm.js} +142 -7
  29. package/dist/index.native-Czk4F68O.esm.js.map +1 -0
  30. package/dist/{index.native-TmE1_ksX.js → index.native-DYddSSgT.js} +147 -6
  31. package/dist/index.native-DYddSSgT.js.map +1 -0
  32. package/dist/index.native.esm.js +1 -1
  33. package/dist/index.native.js +7 -1
  34. package/dist/index.native.js.map +1 -1
  35. package/dist/{phantom-wallet-provider-DsB9i0xD.esm.js → phantom-wallet-provider-0tX0Zs72.esm.js} +4 -4
  36. package/dist/{phantom-wallet-provider-DsB9i0xD.esm.js.map → phantom-wallet-provider-0tX0Zs72.esm.js.map} +1 -1
  37. package/dist/{phantom-wallet-provider-Drxxai7b.js → phantom-wallet-provider-DR5qAGcS.js} +4 -4
  38. package/dist/{phantom-wallet-provider-Drxxai7b.js.map → phantom-wallet-provider-DR5qAGcS.js.map} +1 -1
  39. package/dist/{privy-wallet-provider-_PkLjOQV.js → privy-wallet-provider-BqTsdJPZ.js} +3 -3
  40. package/dist/privy-wallet-provider-BqTsdJPZ.js.map +1 -0
  41. package/dist/{privy-wallet-provider-Bh5qilM2.esm.js → privy-wallet-provider-ChMUFAEp.esm.js} +3 -3
  42. package/dist/privy-wallet-provider-ChMUFAEp.esm.js.map +1 -0
  43. package/dist/{solana-mobile-wallet-provider-xzJFY_GQ.esm.js → solana-mobile-wallet-provider-Cq2H4eoW.esm.js} +4 -4
  44. package/dist/{solana-mobile-wallet-provider-xzJFY_GQ.esm.js.map → solana-mobile-wallet-provider-Cq2H4eoW.esm.js.map} +1 -1
  45. package/dist/{solana-mobile-wallet-provider-wzJ_5N_z.js → solana-mobile-wallet-provider-DiXPSf8n.js} +4 -4
  46. package/dist/{solana-mobile-wallet-provider-wzJ_5N_z.js.map → solana-mobile-wallet-provider-DiXPSf8n.js.map} +1 -1
  47. package/package.json +2 -2
  48. package/dist/index-BLbguAbm.js.map +0 -1
  49. package/dist/index-BhMsVVRC.esm.js.map +0 -1
  50. package/dist/index-BsAk0dF_.js.map +0 -1
  51. package/dist/index-CEr58d1y.esm.js.map +0 -1
  52. package/dist/index-DV-v3Udi.js.map +0 -1
  53. package/dist/index-D_H81ZZs.esm.js.map +0 -1
  54. package/dist/index-DsyaaxjP.js.map +0 -1
  55. package/dist/index-udwtZBLu.esm.js +0 -6
  56. package/dist/index-udwtZBLu.esm.js.map +0 -1
  57. package/dist/index.native-CujLdGqC.esm.js.map +0 -1
  58. package/dist/index.native-TmE1_ksX.js.map +0 -1
  59. package/dist/privy-wallet-provider-Bh5qilM2.esm.js.map +0 -1
  60. package/dist/privy-wallet-provider-_PkLjOQV.js.map +0 -1
@@ -11117,6 +11117,7 @@ async function getOrCreateConnection(appId, isServer) {
11117
11117
  subscriptions: new Map(),
11118
11118
  pendingSubscriptions: new Map(),
11119
11119
  pendingUnsubscriptions: new Map(),
11120
+ pendingRequests: new Map(),
11120
11121
  isConnecting: false,
11121
11122
  isConnected: false,
11122
11123
  appId,
@@ -11215,11 +11216,17 @@ async function getOrCreateConnection(appId, isServer) {
11215
11216
  clearInterval(connection.tokenRefreshTimer);
11216
11217
  connection.tokenRefreshTimer = null;
11217
11218
  }
11219
+ // Reject all pending WS CRUD requests on disconnect (fail fast)
11220
+ for (const [id, pending] of connection.pendingRequests) {
11221
+ clearTimeout(pending.timer);
11222
+ pending.reject(new Error('WebSocket disconnected'));
11223
+ }
11224
+ connection.pendingRequests.clear();
11218
11225
  });
11219
11226
  return connection;
11220
11227
  }
11221
11228
  function handleServerMessage(connection, message) {
11222
- var _a;
11229
+ var _a, _b;
11223
11230
  switch (message.type) {
11224
11231
  case 'subscribed': {
11225
11232
  const subscription = connection.subscriptions.get(message.subscriptionId);
@@ -11264,8 +11271,45 @@ function handleServerMessage(connection, message) {
11264
11271
  }
11265
11272
  break;
11266
11273
  }
11274
+ case 'response': {
11275
+ const pendingReq = connection.pendingRequests.get(message.requestId);
11276
+ if (pendingReq) {
11277
+ connection.pendingRequests.delete(message.requestId);
11278
+ clearTimeout(pendingReq.timer);
11279
+ if (message.status >= 400) {
11280
+ pendingReq.reject(new Error(`Request failed with status ${message.status}`));
11281
+ }
11282
+ else {
11283
+ pendingReq.resolve(message.data);
11284
+ }
11285
+ }
11286
+ break;
11287
+ }
11288
+ case 'setResponse': {
11289
+ const pendingSet = connection.pendingRequests.get(message.requestId);
11290
+ if (pendingSet) {
11291
+ connection.pendingRequests.delete(message.requestId);
11292
+ clearTimeout(pendingSet.timer);
11293
+ if (message.statusCode >= 400) {
11294
+ pendingSet.reject(new Error(((_a = message.body) === null || _a === void 0 ? void 0 : _a.message) || `Set failed with status ${message.statusCode}`));
11295
+ }
11296
+ else {
11297
+ pendingSet.resolve(message.body);
11298
+ }
11299
+ }
11300
+ break;
11301
+ }
11267
11302
  case 'error': {
11268
11303
  console.error('[WS v2] Server error:', message.code, message.message);
11304
+ // Handle CRUD request errors (requestId present)
11305
+ if (message.requestId) {
11306
+ const pendingReq = connection.pendingRequests.get(message.requestId);
11307
+ if (pendingReq) {
11308
+ connection.pendingRequests.delete(message.requestId);
11309
+ clearTimeout(pendingReq.timer);
11310
+ pendingReq.reject(new Error(`${message.code}: ${message.message}`));
11311
+ }
11312
+ }
11269
11313
  if (message.subscriptionId) {
11270
11314
  // Reject pending subscription if this is a subscription error
11271
11315
  const pending = connection.pendingSubscriptions.get(message.subscriptionId);
@@ -11277,7 +11321,7 @@ function handleServerMessage(connection, message) {
11277
11321
  const subscription = connection.subscriptions.get(message.subscriptionId);
11278
11322
  if (subscription) {
11279
11323
  for (const callback of subscription.callbacks) {
11280
- (_a = callback.onError) === null || _a === void 0 ? void 0 : _a.call(callback, new Error(`${message.code}: ${message.message}`));
11324
+ (_b = callback.onError) === null || _b === void 0 ? void 0 : _b.call(callback, new Error(`${message.code}: ${message.message}`));
11281
11325
  }
11282
11326
  }
11283
11327
  }
@@ -11566,6 +11610,97 @@ async function doReconnectWithNewAuth() {
11566
11610
  }
11567
11611
  }
11568
11612
  }
11613
+ // ============ CRUD over WebSocket ============
11614
+ const WS_REQUEST_TIMEOUT_MS = 30000;
11615
+ function generateRequestId() {
11616
+ return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
11617
+ }
11618
+ /**
11619
+ * Returns true if there is an active v2 WebSocket connection open.
11620
+ */
11621
+ function hasActiveConnection() {
11622
+ for (const connection of connections.values()) {
11623
+ if (connection.ws && connection.isConnected) {
11624
+ return true;
11625
+ }
11626
+ }
11627
+ return false;
11628
+ }
11629
+ async function sendRequest(msgBuilder) {
11630
+ const config = await getConfig();
11631
+ const appId = config.appId;
11632
+ const connection = await getOrCreateConnection(appId, config.isServer);
11633
+ // Wait for the connection to be open (getOrCreateConnection may return
11634
+ // while still connecting).
11635
+ if (!connection.isConnected && connection.ws) {
11636
+ await new Promise((resolve, reject) => {
11637
+ const timeout = setTimeout(() => {
11638
+ var _a;
11639
+ (_a = connection.ws) === null || _a === void 0 ? void 0 : _a.removeEventListener('open', onOpen);
11640
+ reject(new Error('WebSocket connection timeout'));
11641
+ }, 10000);
11642
+ const onOpen = () => { clearTimeout(timeout); resolve(); };
11643
+ if (connection.isConnected) {
11644
+ clearTimeout(timeout);
11645
+ resolve();
11646
+ return;
11647
+ }
11648
+ connection.ws.addEventListener('open', onOpen);
11649
+ });
11650
+ }
11651
+ if (!connection.ws || !connection.isConnected) {
11652
+ throw new Error('WebSocket connection not available');
11653
+ }
11654
+ const requestId = generateRequestId();
11655
+ const message = msgBuilder(requestId);
11656
+ return new Promise((resolve, reject) => {
11657
+ const timer = setTimeout(() => {
11658
+ connection.pendingRequests.delete(requestId);
11659
+ reject(new Error(`WebSocket request timed out after ${WS_REQUEST_TIMEOUT_MS}ms`));
11660
+ }, WS_REQUEST_TIMEOUT_MS);
11661
+ connection.pendingRequests.set(requestId, { resolve, reject, timer });
11662
+ try {
11663
+ connection.ws.send(JSON.stringify(message));
11664
+ }
11665
+ catch (error) {
11666
+ connection.pendingRequests.delete(requestId);
11667
+ clearTimeout(timer);
11668
+ reject(error);
11669
+ }
11670
+ });
11671
+ }
11672
+ async function wsGet(path) {
11673
+ return sendRequest((requestId) => ({
11674
+ type: 'get',
11675
+ requestId,
11676
+ path,
11677
+ }));
11678
+ }
11679
+ async function wsSet(documents) {
11680
+ return sendRequest((requestId) => ({
11681
+ type: 'set',
11682
+ requestId,
11683
+ documents,
11684
+ }));
11685
+ }
11686
+ async function wsQuery(path, opts) {
11687
+ return sendRequest((requestId) => (Object.assign(Object.assign(Object.assign(Object.assign({ type: 'query', requestId,
11688
+ path }, ((opts === null || opts === void 0 ? void 0 : opts.filter) ? { filter: opts.filter } : {})), ((opts === null || opts === void 0 ? void 0 : opts.sort) ? { sort: opts.sort } : {})), ((opts === null || opts === void 0 ? void 0 : opts.limit) !== undefined ? { limit: opts.limit } : {})), ((opts === null || opts === void 0 ? void 0 : opts.includeSubPaths) ? { includeSubPaths: opts.includeSubPaths } : {}))));
11689
+ }
11690
+ async function wsDelete(path) {
11691
+ return sendRequest((requestId) => ({
11692
+ type: 'delete',
11693
+ requestId,
11694
+ path,
11695
+ }));
11696
+ }
11697
+ async function wsGetMany(paths) {
11698
+ return sendRequest((requestId) => ({
11699
+ type: 'getMany',
11700
+ requestId,
11701
+ paths,
11702
+ }));
11703
+ }
11569
11704
 
11570
11705
  /**
11571
11706
  * WebSocket Subscription Module
@@ -15745,7 +15880,7 @@ async function loadDependencies() {
15745
15880
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15746
15881
  import('react'),
15747
15882
  import('react-dom/client'),
15748
- import('./index-BhMsVVRC.esm.js')
15883
+ import('./index-DOYZMq5N.esm.js')
15749
15884
  ]);
15750
15885
  // Extract default export from ESM module namespace
15751
15886
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -21885,7 +22020,7 @@ async function registerMobileWalletAdapter(config) {
21885
22020
  if (typeof window === 'undefined')
21886
22021
  return;
21887
22022
  try {
21888
- const walletStandardMobile = await import('./index.browser-Cdrgfw30.esm.js');
22023
+ const walletStandardMobile = await import('./index.browser-D1uNEi4e.esm.js');
21889
22024
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21890
22025
  if (!registerMwa) {
21891
22026
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -22024,7 +22159,7 @@ class SolanaMobileWalletProvider {
22024
22159
  async ensureWallet() {
22025
22160
  if (this.wallet)
22026
22161
  return this.wallet;
22027
- const mod = await import('./index.browser-Cdrgfw30.esm.js');
22162
+ const mod = await import('./index.browser-D1uNEi4e.esm.js');
22028
22163
  const chain = mapChainToWalletStandard(this.cluster);
22029
22164
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
22030
22165
  appIdentity: this.appIdentity,
@@ -23216,5 +23351,5 @@ class PrivyExpoProvider {
23216
23351
  }
23217
23352
  }
23218
23353
 
23219
- export { getCachedData as $, subscribe as A, useAuth as B, deserializeTransaction as C, getIdToken as D, setPlatform as E, getPlatform as F, PrivyWalletProvider as G, DEFAULT_TEST_ADDRESS as H, isMobileWalletAvailable as I, registerMobileWalletAdapter as J, PrivyExpoProvider as K, InsufficientBalanceError as L, MockAuthProvider as M, ServerSessionManager as N, OffchainAuthProvider as O, PhantomWalletProvider as P, buildSetDocumentsTransaction as Q, ReactNativeSessionManager as R, SolanaMobileWalletProvider as S, clearCache as T, closeAllSubscriptions as U, convertRemainingAccounts as V, WebSessionManager as W, createSessionWithPrivy as X, createSessionWithSignature as Y, genAuthNonce as Z, genSolanaMessage as _, base58 as a, getMany as a0, reconnectWithNewAuth as a1, refreshSession as a2, signSessionCreateMessage as a3, bufferExports as b, getCurrentUser as c, onAuthLoadingChanged as d, getAuthLoading as e, logout as f, getDefaultExportFromCjs$1 as g, getConfig as h, init as i, getAuthProvider as j, get as k, login as l, setMany as m, setFile as n, onAuthStateChanged as o, getFiles as p, runQueryMany as q, runQuery as r, set as s, runExpression as t, runExpressionMany as u, signMessage as v, signTransaction as w, signAndSubmitTransaction as x, count as y, aggregate as z };
23220
- //# sourceMappingURL=index-D_H81ZZs.esm.js.map
23354
+ export { getCachedData as $, subscribe as A, useAuth as B, deserializeTransaction as C, getIdToken as D, setPlatform as E, getPlatform as F, PrivyWalletProvider as G, DEFAULT_TEST_ADDRESS as H, isMobileWalletAvailable as I, registerMobileWalletAdapter as J, PrivyExpoProvider as K, InsufficientBalanceError as L, MockAuthProvider as M, ServerSessionManager as N, OffchainAuthProvider as O, PhantomWalletProvider as P, buildSetDocumentsTransaction as Q, ReactNativeSessionManager as R, SolanaMobileWalletProvider as S, clearCache as T, closeAllSubscriptions as U, convertRemainingAccounts as V, WebSessionManager as W, createSessionWithPrivy as X, createSessionWithSignature as Y, genAuthNonce as Z, genSolanaMessage as _, base58 as a, getMany as a0, hasActiveConnection as a1, reconnectWithNewAuth as a2, refreshSession as a3, signSessionCreateMessage as a4, wsDelete as a5, wsGet as a6, wsGetMany as a7, wsQuery as a8, wsSet as a9, bufferExports as b, getCurrentUser as c, onAuthLoadingChanged as d, getAuthLoading as e, logout as f, getDefaultExportFromCjs$1 as g, getConfig as h, init as i, getAuthProvider as j, get as k, login as l, setMany as m, setFile as n, onAuthStateChanged as o, getFiles as p, runQueryMany as q, runQuery as r, set as s, runExpression as t, runExpressionMany as u, signMessage as v, signTransaction as w, signAndSubmitTransaction as x, count as y, aggregate as z };
23355
+ //# sourceMappingURL=index-CzVM_hix.esm.js.map