@pooflabs/web 0.0.52 → 0.0.53
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-Dd0iNy-b.esm.js → index-B0NsBBNE.esm.js} +2 -2
- package/dist/{index-Dd0iNy-b.esm.js.map → index-B0NsBBNE.esm.js.map} +1 -1
- package/dist/{index-BTXyzHFt.esm.js → index-Cdm_PDUQ.esm.js} +27 -13
- package/dist/index-Cdm_PDUQ.esm.js.map +1 -0
- package/dist/{index-BbI_0NeF.js → index-DQjARwrG.js} +2 -2
- package/dist/{index-BbI_0NeF.js.map → index-DQjARwrG.js.map} +1 -1
- package/dist/{index-DXHYU-4l.js → index-m8DmKiJ7.js} +27 -13
- package/dist/index-m8DmKiJ7.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/index-BTXyzHFt.esm.js.map +0 -1
- package/dist/index-DXHYU-4l.js.map +0 -1
|
@@ -9676,8 +9676,10 @@ async function get$2(path, opts = {}) {
|
|
|
9676
9676
|
if (!normalizedPath || normalizedPath.length === 0) {
|
|
9677
9677
|
return new Error("Invalid path provided.");
|
|
9678
9678
|
}
|
|
9679
|
-
// Create cache key combining path and
|
|
9680
|
-
const
|
|
9679
|
+
// Create cache key combining path, prompt, includeSubPaths, and shape
|
|
9680
|
+
const shapeKey = opts.shape ? JSON.stringify(opts.shape) : '';
|
|
9681
|
+
const includeSubPathsKey = opts.includeSubPaths ? ':subpaths' : '';
|
|
9682
|
+
const cacheKey = `${normalizedPath}:${opts.prompt || ''}${includeSubPathsKey}:${shapeKey}`;
|
|
9681
9683
|
const now = Date.now();
|
|
9682
9684
|
// Check for valid cache entry if not bypassing cache
|
|
9683
9685
|
if (!opts.bypassCache && getCache[cacheKey] && now < getCache[cacheKey].expiresAt) {
|
|
@@ -9698,15 +9700,20 @@ async function get$2(path, opts = {}) {
|
|
|
9698
9700
|
// Cache miss or bypass - proceed with API request
|
|
9699
9701
|
const pathIsDocument = normalizedPath.split("/").length % 2 === 0;
|
|
9700
9702
|
let response;
|
|
9703
|
+
// Build common query params
|
|
9704
|
+
const includeSubPathsParam = opts.includeSubPaths ? '&includeSubPaths=true' : '';
|
|
9705
|
+
const shapeParam = opts.shape ? `&shape=${encodeURIComponent(JSON.stringify(opts.shape))}` : '';
|
|
9701
9706
|
if (pathIsDocument) {
|
|
9702
9707
|
const itemId = encodeURIComponent(normalizedPath);
|
|
9703
|
-
|
|
9708
|
+
// For documents, query params go after the path
|
|
9709
|
+
const queryParams = [includeSubPathsParam, shapeParam].filter(p => p).join('');
|
|
9710
|
+
const apiPath = queryParams ? `items/${itemId}?${queryParams.substring(1)}` : `items/${itemId}`;
|
|
9704
9711
|
response = await makeApiRequest('GET', apiPath, null, opts._overrides);
|
|
9705
9712
|
}
|
|
9706
9713
|
else {
|
|
9707
9714
|
const path = encodeURIComponent(normalizedPath);
|
|
9708
9715
|
const promptQueryParam = (opts === null || opts === void 0 ? void 0 : opts.prompt) ? `&prompt=${btoa(opts.prompt)}` : "";
|
|
9709
|
-
const apiPath = `items?path=${path}${promptQueryParam}`;
|
|
9716
|
+
const apiPath = `items?path=${path}${promptQueryParam}${includeSubPathsParam}${shapeParam}`;
|
|
9710
9717
|
response = await makeApiRequest('GET', apiPath, null, opts._overrides);
|
|
9711
9718
|
}
|
|
9712
9719
|
// Cache the response (unless bypassing cache)
|
|
@@ -10122,9 +10129,10 @@ const WS_V2_PATH = '/ws/v2';
|
|
|
10122
10129
|
function generateSubscriptionId() {
|
|
10123
10130
|
return `sub_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
10124
10131
|
}
|
|
10125
|
-
function getCacheKey(path, prompt) {
|
|
10132
|
+
function getCacheKey(path, prompt, shape) {
|
|
10126
10133
|
const normalizedPath = path.startsWith('/') ? path.slice(1) : path;
|
|
10127
|
-
|
|
10134
|
+
const shapeKey = shape && Object.keys(shape).length > 0 ? JSON.stringify(shape) : '';
|
|
10135
|
+
return `${normalizedPath}:${prompt || 'default'}:${shapeKey}`;
|
|
10128
10136
|
}
|
|
10129
10137
|
function isTokenExpired(token) {
|
|
10130
10138
|
try {
|
|
@@ -10290,7 +10298,7 @@ function handleServerMessage(connection, message) {
|
|
|
10290
10298
|
const subscription = connection.subscriptions.get(message.subscriptionId);
|
|
10291
10299
|
if (subscription) {
|
|
10292
10300
|
// Update cache
|
|
10293
|
-
const cacheKey = getCacheKey(subscription.path, subscription.prompt);
|
|
10301
|
+
const cacheKey = getCacheKey(subscription.path, subscription.prompt, subscription.shape);
|
|
10294
10302
|
responseCache.set(cacheKey, { data: message.data, timestamp: Date.now() });
|
|
10295
10303
|
// Store last data
|
|
10296
10304
|
subscription.lastData = message.data;
|
|
@@ -10318,7 +10326,7 @@ function handleServerMessage(connection, message) {
|
|
|
10318
10326
|
const subscription = connection.subscriptions.get(message.subscriptionId);
|
|
10319
10327
|
if (subscription) {
|
|
10320
10328
|
// Update cache
|
|
10321
|
-
const cacheKey = getCacheKey(subscription.path, subscription.prompt);
|
|
10329
|
+
const cacheKey = getCacheKey(subscription.path, subscription.prompt, subscription.shape);
|
|
10322
10330
|
responseCache.set(cacheKey, { data: message.data, timestamp: Date.now() });
|
|
10323
10331
|
// Store last data
|
|
10324
10332
|
subscription.lastData = message.data;
|
|
@@ -10371,6 +10379,9 @@ function sendSubscribe(connection, subscription) {
|
|
|
10371
10379
|
path: subscription.path,
|
|
10372
10380
|
prompt: subscription.prompt ? btoa(subscription.prompt) : undefined,
|
|
10373
10381
|
includeSubPaths: subscription.includeSubPaths,
|
|
10382
|
+
shape: subscription.shape && Object.keys(subscription.shape).length > 0
|
|
10383
|
+
? subscription.shape
|
|
10384
|
+
: undefined,
|
|
10374
10385
|
};
|
|
10375
10386
|
try {
|
|
10376
10387
|
connection.ws.send(JSON.stringify(message));
|
|
@@ -10402,7 +10413,7 @@ function sendUnsubscribe(connection, subscriptionId) {
|
|
|
10402
10413
|
async function subscribeV2(path, subscriptionOptions) {
|
|
10403
10414
|
const config = await getConfig();
|
|
10404
10415
|
const normalizedPath = path.startsWith('/') ? path.slice(1) : path;
|
|
10405
|
-
const cacheKey = getCacheKey(normalizedPath, subscriptionOptions.prompt);
|
|
10416
|
+
const cacheKey = getCacheKey(normalizedPath, subscriptionOptions.prompt, subscriptionOptions.shape);
|
|
10406
10417
|
// Deliver cached data immediately if available
|
|
10407
10418
|
const cachedEntry = responseCache.get(cacheKey);
|
|
10408
10419
|
if (cachedEntry && Date.now() - cachedEntry.timestamp < CACHE_TTL && subscriptionOptions.onData) {
|
|
@@ -10413,10 +10424,12 @@ async function subscribeV2(path, subscriptionOptions) {
|
|
|
10413
10424
|
}
|
|
10414
10425
|
// Get or create connection for this appId
|
|
10415
10426
|
const connection = await getOrCreateConnection(config.appId, config.isServer);
|
|
10416
|
-
// Check if we already have a subscription for this path+prompt
|
|
10427
|
+
// Check if we already have a subscription for this path+prompt+shape
|
|
10428
|
+
const shapeKey = subscriptionOptions.shape ? JSON.stringify(subscriptionOptions.shape) : '';
|
|
10417
10429
|
let existingSubscription;
|
|
10418
10430
|
for (const sub of connection.subscriptions.values()) {
|
|
10419
|
-
|
|
10431
|
+
const subShapeKey = sub.shape ? JSON.stringify(sub.shape) : '';
|
|
10432
|
+
if (sub.path === normalizedPath && sub.prompt === subscriptionOptions.prompt && subShapeKey === shapeKey) {
|
|
10420
10433
|
existingSubscription = sub;
|
|
10421
10434
|
break;
|
|
10422
10435
|
}
|
|
@@ -10441,6 +10454,7 @@ async function subscribeV2(path, subscriptionOptions) {
|
|
|
10441
10454
|
subscriptionId,
|
|
10442
10455
|
path: normalizedPath,
|
|
10443
10456
|
prompt: subscriptionOptions.prompt,
|
|
10457
|
+
shape: subscriptionOptions.shape,
|
|
10444
10458
|
includeSubPaths: false,
|
|
10445
10459
|
callbacks: [subscriptionOptions],
|
|
10446
10460
|
lastData: undefined,
|
|
@@ -13067,7 +13081,7 @@ async function loadDependencies() {
|
|
|
13067
13081
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
13068
13082
|
import('react'),
|
|
13069
13083
|
import('react-dom/client'),
|
|
13070
|
-
import('./index-
|
|
13084
|
+
import('./index-B0NsBBNE.esm.js')
|
|
13071
13085
|
]);
|
|
13072
13086
|
// Extract default export from ESM module namespace
|
|
13073
13087
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -34176,4 +34190,4 @@ async function getIdToken() {
|
|
|
34176
34190
|
}
|
|
34177
34191
|
|
|
34178
34192
|
export { PrivyWalletProvider as A, buildSetDocumentsTransaction as B, clearCache as C, DEFAULT_TEST_ADDRESS as D, closeAllSubscriptions as E, convertRemainingAccounts as F, createSessionWithPrivy as G, createSessionWithSignature as H, genAuthNonce as I, genSolanaMessage as J, getCachedData as K, reconnectWithNewAuth as L, MockAuthProvider as M, refreshSession as N, OffchainAuthProvider as O, PhantomWalletProvider as P, signSessionCreateMessage as Q, ServerSessionManager as S, WebSessionManager as W, getCurrentUser as a, bufferExports as b, onAuthLoadingChanged as c, getAuthLoading as d, logout as e, getConfig as f, getDefaultExportFromCjs$1 as g, getAuthProvider as h, init as i, get$2 as j, setMany as k, login as l, setFile as m, getFiles as n, onAuthStateChanged as o, runQueryMany as p, runExpression as q, runQuery as r, set$1 as s, runExpressionMany as t, signMessage as u, signTransaction as v, signAndSubmitTransaction as w, subscribe as x, useAuth as y, getIdToken as z };
|
|
34179
|
-
//# sourceMappingURL=index-
|
|
34193
|
+
//# sourceMappingURL=index-Cdm_PDUQ.esm.js.map
|