@bounded-sh/core 0.0.64 → 0.0.66
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/client/decline.d.ts +2 -0
- package/dist/client/functions.d.ts +8 -0
- package/dist/client/live-effects.d.ts +4 -2
- package/dist/client/operations.d.ts +90 -5
- package/dist/client/reconcile.d.ts +51 -0
- package/dist/client/solana-operations.d.ts +13 -3
- package/dist/{index-BIdD2yUB.js → index-DNZifL5j.js} +4015 -3326
- package/dist/index-DNZifL5j.js.map +1 -0
- package/dist/{index-BQ6e4MeP.mjs → index-TyXiW4Uf.mjs} +4014 -3325
- package/dist/index-TyXiW4Uf.mjs.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{realtime-store-Bz4Ob6K6.js → realtime-store-CINyAkPw.js} +2 -3
- package/dist/{realtime-store-Bz4Ob6K6.js.map → realtime-store-CINyAkPw.js.map} +1 -1
- package/dist/{realtime-store-DKngqviG.mjs → realtime-store-CpbnXM7q.mjs} +2 -3
- package/dist/{realtime-store-DKngqviG.mjs.map → realtime-store-CpbnXM7q.mjs.map} +1 -1
- package/dist/{solana-message-B0NoE4nC.js → solana-message-Bycv-L5n.js} +10 -8
- package/dist/solana-message-Bycv-L5n.js.map +1 -0
- package/dist/{solana-message-QUfJi1Qm.mjs → solana-message-DXXwC95Z.mjs} +10 -8
- package/dist/solana-message-DXXwC95Z.mjs.map +1 -0
- package/dist/{solana-operations-B2Oy9T7D.mjs → solana-operations-ChHG25O0.mjs} +161 -88
- package/dist/solana-operations-ChHG25O0.mjs.map +1 -0
- package/dist/{solana-operations-ngqIkN9W.js → solana-operations-Dm_4VnlB.js} +162 -88
- package/dist/solana-operations-Dm_4VnlB.js.map +1 -0
- package/dist/types.d.ts +370 -4
- package/dist/utils/auth-api.d.ts +15 -2
- package/dist/utils/core-platform.d.ts +7 -0
- package/dist/utils/rn-session-manager.d.ts +57 -7
- package/dist/utils/server-session-manager.d.ts +6 -1
- package/dist/utils/sol/sol-accessors.d.ts +0 -27
- package/dist/utils/sol/solana-message.d.ts +1 -1
- package/package.json +2 -2
- package/dist/index-BIdD2yUB.js.map +0 -1
- package/dist/index-BQ6e4MeP.mjs.map +0 -1
- package/dist/sol-utils-Cwxyl2h6.js +0 -232
- package/dist/sol-utils-Cwxyl2h6.js.map +0 -1
- package/dist/sol-utils-DVjPeoMy.mjs +0 -229
- package/dist/sol-utils-DVjPeoMy.mjs.map +0 -1
- package/dist/solana-message-B0NoE4nC.js.map +0 -1
- package/dist/solana-message-QUfJi1Qm.mjs.map +0 -1
- package/dist/solana-operations-B2Oy9T7D.mjs.map +0 -1
- package/dist/solana-operations-ngqIkN9W.js.map +0 -1
- package/dist/utils/sol/openTv7fbpYSseNHYmCZFZ1CZgj4r8D9fKNgEz1qo6FDevnet-program.d.ts +0 -2906
- package/dist/utils/sol/openTv7fbpYSseNHYmCZFZ1CZgj4r8D9fKNgEz1qo6FMainnet-program.d.ts +0 -2906
- package/dist/utils/sol/sol-utils.d.ts +0 -34
package/dist/client/decline.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export type DeclineReason = 'rule' | 'invariant';
|
|
|
7
7
|
export interface DeclineBoundary {
|
|
8
8
|
type: string;
|
|
9
9
|
field?: string;
|
|
10
|
+
/** Stable reason when one boundary type has multiple rejection modes. */
|
|
11
|
+
cause?: 'cap_exceeded' | 'append_only_update' | 'append_only_delete';
|
|
10
12
|
cap?: number;
|
|
11
13
|
windowSeconds?: number;
|
|
12
14
|
current?: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ClientConfig } from './config';
|
|
1
2
|
export type InvokeOptions = {
|
|
2
3
|
/** Per-call timeout (ms) for the HTTP request to the dispatcher. */
|
|
3
4
|
timeoutMs?: number;
|
|
@@ -10,6 +11,13 @@ export type InvokeOptions = {
|
|
|
10
11
|
*/
|
|
11
12
|
_overrides?: {
|
|
12
13
|
_getAuthHeaders?: () => Promise<Record<string, string>>;
|
|
14
|
+
/**
|
|
15
|
+
* @internal Fully-resolved config snapshot for a server `WalletClient`. When
|
|
16
|
+
* present, the invoke targets THIS config's dispatcher (functionsUrl) + appId
|
|
17
|
+
* instead of the mutable process-global `init()` config - so a later global
|
|
18
|
+
* init() can never retarget the wallet client's function calls (CTA-05).
|
|
19
|
+
*/
|
|
20
|
+
_config?: ClientConfig;
|
|
13
21
|
};
|
|
14
22
|
};
|
|
15
23
|
export declare class FunctionInvokeError extends Error {
|
|
@@ -83,11 +83,13 @@ export interface LiveIntent {
|
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* The tick may return the bare next state, OR `{ state, effects }` to also emit
|
|
86
|
-
* effects this tick. Use {@link withEffects} to build the wrapper
|
|
86
|
+
* effects this tick. Use {@link withEffects} to build the wrapper: `effects` is
|
|
87
|
+
* required, because it is the marker the runtime recognizes the wrapper by (a bare
|
|
88
|
+
* state that merely has a `state` field must never be unwrapped).
|
|
87
89
|
*/
|
|
88
90
|
export type LiveTickResult<S> = S | {
|
|
89
91
|
state: S;
|
|
90
|
-
effects
|
|
92
|
+
effects: Effect[];
|
|
91
93
|
};
|
|
92
94
|
/** A Bounded live module (game/realtime-room logic) that can emit effects. */
|
|
93
95
|
export interface LiveModule<S = unknown> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthProvider } from '../types';
|
|
1
|
+
import type { AuthProvider, MirrorSync, SetResult, SolanaWriteRpc } from '../types';
|
|
2
2
|
import { type ClientConfig } from './config';
|
|
3
3
|
import type { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
4
4
|
import { type EvmTransactionPolicy } from '../utils/evm/evm-transaction-validation';
|
|
@@ -27,6 +27,12 @@ export type RequestOverrides = {
|
|
|
27
27
|
* shared read cache. Threaded internally by the scoped read-only client.
|
|
28
28
|
*/
|
|
29
29
|
_readOnly?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @internal Solana RPC seam for the write + reconciliation lanes. Supplied by
|
|
32
|
+
* tests so send-loss, confirmation-timeout and expiry paths are exercised
|
|
33
|
+
* deterministically; production builds a `Connection` from `config.rpcUrl`.
|
|
34
|
+
*/
|
|
35
|
+
_solanaRpc?: SolanaWriteRpc;
|
|
30
36
|
};
|
|
31
37
|
export type SetOptions = {
|
|
32
38
|
shouldSubmitTx?: boolean;
|
|
@@ -257,18 +263,42 @@ export declare function runExpressionMany(many: {
|
|
|
257
263
|
returnType?: 'Bool' | 'String' | 'Int' | 'UInt';
|
|
258
264
|
_overrides?: RequestOverrides;
|
|
259
265
|
}[]): Promise<RunExpressionResult[]>;
|
|
266
|
+
/**
|
|
267
|
+
* Best-effort mirror read. A confirmed transaction must NEVER be lost to a
|
|
268
|
+
* synchronization failure, so this reports its outcome in `mirrorSync` and
|
|
269
|
+
* never rejects. It reads the CONCRETE destination paths, so a collection
|
|
270
|
+
* insert with a generated id syncs the path that actually exists.
|
|
271
|
+
*/
|
|
272
|
+
export declare function attemptMirrorSync(paths: string[], options?: SetOptions, settleMs?: number): Promise<MirrorSync>;
|
|
260
273
|
/**
|
|
261
274
|
* Write a document at `path`. Sugar for a one-element {@link setMany}.
|
|
262
275
|
*
|
|
263
276
|
* **Delete:** pass `null` as the document to delete it — `set(path, null)` is
|
|
264
277
|
* the delete (there is no separate `del`/`remove`). It is routed through the
|
|
265
|
-
* collection's policy `delete` rule and broadcasts a delete to subscribers
|
|
278
|
+
* collection's policy `delete` rule and broadcasts a delete to subscribers, and
|
|
279
|
+
* the deleted entry surfaces as a `null` document under its path.
|
|
280
|
+
*
|
|
281
|
+
* Resolves to a discriminated {@link SetResult}; discriminate on `status`.
|
|
282
|
+
*/
|
|
283
|
+
export declare function set(path: string, document: any, options?: SetOptions): Promise<SetResult>;
|
|
284
|
+
/**
|
|
285
|
+
* Atomically write (or delete, with a `null` document) a batch of documents.
|
|
286
|
+
*
|
|
287
|
+
* Resolves to a discriminated {@link SetResult}:
|
|
288
|
+
* - `committed` — the worker applied the batch directly.
|
|
289
|
+
* - `confirmed` — a client-signed chain transaction landed successfully.
|
|
290
|
+
* - `submitted` — broadcast happened but the outcome is unknown. NEVER
|
|
291
|
+
* resubmit; call `reconcileSetResult`/`waitForSetResult` on the receipt.
|
|
292
|
+
* - `expired_not_landed` — Solana only, and the one retry-safe terminal state.
|
|
293
|
+
* - `signed` — `shouldSubmitTx: false`; signed and deliberately not sent.
|
|
294
|
+
*
|
|
295
|
+
* `requestedDocuments` is always the caller's own echo; authoritative server
|
|
296
|
+
* state appears only under `observation`/`mirrorSync` once actually observed.
|
|
266
297
|
*/
|
|
267
|
-
export declare function set(path: string, document: any, options?: SetOptions): Promise<any>;
|
|
268
298
|
export declare function setMany(many: {
|
|
269
299
|
path: string;
|
|
270
300
|
document: any;
|
|
271
|
-
}[], options?: SetOptions): Promise<
|
|
301
|
+
}[], options?: SetOptions): Promise<SetResult>;
|
|
272
302
|
export declare function clearCache(path?: string, opts?: {
|
|
273
303
|
prompt?: string;
|
|
274
304
|
}): void;
|
|
@@ -284,10 +314,65 @@ export declare function clearReadCacheForAuthChange(): void;
|
|
|
284
314
|
export declare function getFiles(path: string, options?: {
|
|
285
315
|
_overrides?: RequestOverrides;
|
|
286
316
|
}): Promise<any>;
|
|
317
|
+
/**
|
|
318
|
+
* The result of a `setFile` UPLOAD.
|
|
319
|
+
*
|
|
320
|
+
* The two uncertain states are deliberately different words, because they have
|
|
321
|
+
* opposite consequences:
|
|
322
|
+
* - `visibility: 'unknown'` — the object DEFINITELY committed; only the
|
|
323
|
+
* anonymous-read evaluation failed. Never re-upload it.
|
|
324
|
+
* - `status: 'unknown'` — the PUT's transport outcome is ambiguous, so the
|
|
325
|
+
* object may or may not exist. It carries the concrete path retained from
|
|
326
|
+
* `/storage/url` and is explicitly NOT retry-safe: the one-time upload nonce
|
|
327
|
+
* is consumed before staging, and re-calling `setFile` on a COLLECTION path
|
|
328
|
+
* would mint a second path and orphan the first object while still billing
|
|
329
|
+
* for it. Resolve it out of band rather than by re-uploading.
|
|
330
|
+
*/
|
|
331
|
+
export type FileUploadResult = {
|
|
332
|
+
status: 'uploaded';
|
|
333
|
+
/** The worker's concrete path (a collection upload's id is generated server-side). */
|
|
334
|
+
path: string;
|
|
335
|
+
/**
|
|
336
|
+
* Durable public URL, or `null` when the collection's read rule does not
|
|
337
|
+
* admit anonymous readers. A non-null URL stays valid only while that read
|
|
338
|
+
* rule keeps admitting anonymous readers — the URL is re-evaluated on every
|
|
339
|
+
* GET, so tightening the rule revokes it.
|
|
340
|
+
*/
|
|
341
|
+
url: string | null;
|
|
342
|
+
visibility: 'public' | 'private' | 'unknown';
|
|
343
|
+
} | {
|
|
344
|
+
status: 'unknown';
|
|
345
|
+
path: string;
|
|
346
|
+
reason: string;
|
|
347
|
+
retrySafe: false;
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* The result of a `setFile` DELETION — a distinct shape, because a delete has
|
|
351
|
+
* no URL and no visibility. The worker answers 404 when no file exists at the
|
|
352
|
+
* path and the shared request layer normalizes that into a non-throwing
|
|
353
|
+
* response, so an unconditional `deleted: true` would report a deletion that
|
|
354
|
+
* never happened.
|
|
355
|
+
*/
|
|
356
|
+
export type FileDeleteResult = {
|
|
357
|
+
path: string;
|
|
358
|
+
deleted: true;
|
|
359
|
+
} | {
|
|
360
|
+
path: string;
|
|
361
|
+
deleted: false;
|
|
362
|
+
alreadyAbsent: true;
|
|
363
|
+
};
|
|
364
|
+
export declare function setFile(path: string, file: File, options?: {
|
|
365
|
+
_overrides?: RequestOverrides;
|
|
366
|
+
metadata?: Record<string, any>;
|
|
367
|
+
}): Promise<FileUploadResult>;
|
|
368
|
+
export declare function setFile(path: string, file: null, options?: {
|
|
369
|
+
_overrides?: RequestOverrides;
|
|
370
|
+
metadata?: Record<string, any>;
|
|
371
|
+
}): Promise<FileDeleteResult>;
|
|
287
372
|
export declare function setFile(path: string, file: File | null, options?: {
|
|
288
373
|
_overrides?: RequestOverrides;
|
|
289
374
|
metadata?: Record<string, any>;
|
|
290
|
-
}): Promise<
|
|
375
|
+
}): Promise<FileUploadResult | FileDeleteResult>;
|
|
291
376
|
export declare function signMessage(message: string): Promise<string>;
|
|
292
377
|
export declare function signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
293
378
|
export declare function signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise<string>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { RequestOverrides } from './operations';
|
|
2
|
+
import type { SetResult } from '../types';
|
|
3
|
+
export type ReconcileSetResultOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* The same per-request overrides `set` accepts. Supply `_config`/`authProvider`
|
|
6
|
+
* so a receipt minted by a server `WalletClient` reconciles through THAT
|
|
7
|
+
* client's app binding and provider rather than the process-global one.
|
|
8
|
+
*/
|
|
9
|
+
_overrides?: RequestOverrides;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a server-keypair EVM receipt may rebroadcast its byte-identical
|
|
12
|
+
* fenced transaction while the nonce is unused. Defaults to `true`. It is
|
|
13
|
+
* always refused for an injected-wallet receipt, whose signed bytes live
|
|
14
|
+
* inside the wallet.
|
|
15
|
+
*/
|
|
16
|
+
allowRebroadcast?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type WaitForSetResultOptions = ReconcileSetResultOptions & {
|
|
19
|
+
/** Total wall-clock bound. Default 60s. */
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
/** Maximum reconciliation attempts. Default 20. */
|
|
22
|
+
maxAttempts?: number;
|
|
23
|
+
/** Delay between attempts. Default 3s. */
|
|
24
|
+
pollIntervalMs?: number;
|
|
25
|
+
/** Minimum spacing between permitted rebroadcasts. Default 15s. */
|
|
26
|
+
minRebroadcastIntervalMs?: number;
|
|
27
|
+
/** Cancels the wait. The latest `submitted` receipt is returned, never discarded. */
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Poll the SAME signature/hash a `submitted` receipt carries and return the
|
|
32
|
+
* resulting `SetResult`.
|
|
33
|
+
*
|
|
34
|
+
* - Terminal receipts (`committed`, `confirmed`, `expired_not_landed`,
|
|
35
|
+
* `signed`) are returned unchanged; nothing was left open.
|
|
36
|
+
* - An irreconcilable injected-wallet receipt (`transactionId: null`) is
|
|
37
|
+
* rejected immediately: no identifier exists to poll.
|
|
38
|
+
* - A transaction that landed and FAILED throws, exactly as it would have on
|
|
39
|
+
* the original write.
|
|
40
|
+
*/
|
|
41
|
+
export declare function reconcileSetResult(receipt: SetResult, options?: ReconcileSetResultOptions): Promise<SetResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Reconcile repeatedly until the receipt leaves `submitted` or the bound is hit.
|
|
44
|
+
*
|
|
45
|
+
* The bound is mandatory, because some states are permanently non-terminal by
|
|
46
|
+
* design: an unidentified nonce consumer or a permanently underpriced EVM
|
|
47
|
+
* transaction never resolves. On exhaustion (or abort) this returns the LATEST
|
|
48
|
+
* `submitted` receipt with its identifier intact rather than hanging or
|
|
49
|
+
* throwing the identifier away.
|
|
50
|
+
*/
|
|
51
|
+
export declare function waitForSetResult(receipt: SetResult, options?: WaitForSetResultOptions): Promise<SetResult>;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
import type { AuthProvider, SolanaTransactionResult } from '../types';
|
|
2
3
|
import type { SetOptions } from './operations';
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Derive the transaction signature from the SIGNED bytes, before broadcasting.
|
|
6
|
+
*
|
|
7
|
+
* Without this the signature is only learned when `sendRawTransaction` resolves,
|
|
8
|
+
* so an RPC that accepted the bytes but whose response was lost throws with
|
|
9
|
+
* nothing recorded — and a retry builds a DIFFERENT transaction that can land
|
|
10
|
+
* beside the first.
|
|
11
|
+
*/
|
|
12
|
+
export declare function deriveTransactionSignature(signedTransaction: VersionedTransaction): string;
|
|
13
|
+
export declare function isDefinitiveSolanaSendFailure(error: unknown): boolean;
|
|
4
14
|
export declare function handlePreBuiltTransaction(tx: {
|
|
5
15
|
serializedTransaction: string;
|
|
6
16
|
blockhash: string;
|
|
7
17
|
lastValidBlockHeight: number;
|
|
8
18
|
network: string;
|
|
9
|
-
}, authProvider: AuthProvider, options: SetOptions | undefined, expectedWritePaths: string[]): Promise<
|
|
19
|
+
}, authProvider: AuthProvider, options: SetOptions | undefined, expectedWritePaths: string[]): Promise<SolanaTransactionResult>;
|