@bounded-sh/core 0.0.116 → 0.0.117-sync.0
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/operations.d.ts +6 -5
- package/dist/{index-CjiaT9AT.js → index-BcJOeks0.js} +48 -41
- package/dist/index-BcJOeks0.js.map +1 -0
- package/dist/{index-Db4lrwO6.mjs → index-l5JPD7_a.mjs} +48 -41
- package/dist/index-l5JPD7_a.mjs.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{realtime-store-IPPwUhJc.js → realtime-store-5vXHb5Br.js} +2 -2
- package/dist/{realtime-store-IPPwUhJc.js.map → realtime-store-5vXHb5Br.js.map} +1 -1
- package/dist/{realtime-store-CNs5zURZ.mjs → realtime-store-CofPUMMC.mjs} +2 -2
- package/dist/{realtime-store-CNs5zURZ.mjs.map → realtime-store-CofPUMMC.mjs.map} +1 -1
- package/dist/{solana-message-CXuLc7NX.js → solana-message-CaPunjVI.js} +2 -2
- package/dist/{solana-message-CXuLc7NX.js.map → solana-message-CaPunjVI.js.map} +1 -1
- package/dist/{solana-message-BO6Dtgbv.mjs → solana-message-DXWlEuK5.mjs} +2 -2
- package/dist/{solana-message-BO6Dtgbv.mjs.map → solana-message-DXWlEuK5.mjs.map} +1 -1
- package/dist/{solana-operations-CghJe0_7.js → solana-operations-BPOTddBI.js} +3 -3
- package/dist/{solana-operations-CghJe0_7.js.map → solana-operations-BPOTddBI.js.map} +1 -1
- package/dist/{solana-operations-DDt4CzRR.mjs → solana-operations-CuWKt_pG.mjs} +3 -3
- package/dist/{solana-operations-DDt4CzRR.mjs.map → solana-operations-CuWKt_pG.mjs.map} +1 -1
- package/dist/{solana-v1-operations-BY2DTfbR.js → solana-v1-operations-DTXPM_aZ.js} +3 -3
- package/dist/{solana-v1-operations-BY2DTfbR.js.map → solana-v1-operations-DTXPM_aZ.js.map} +1 -1
- package/dist/{solana-v1-operations-TH-HUzbT.mjs → solana-v1-operations-MbUM3wgC.mjs} +3 -3
- package/dist/{solana-v1-operations-TH-HUzbT.mjs.map → solana-v1-operations-MbUM3wgC.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CjiaT9AT.js.map +0 -1
- package/dist/index-Db4lrwO6.mjs.map +0 -1
|
@@ -283,12 +283,12 @@ export declare function runExpressionMany(many: {
|
|
|
283
283
|
_overrides?: RequestOverrides;
|
|
284
284
|
}[]): Promise<RunExpressionResult[]>;
|
|
285
285
|
/**
|
|
286
|
-
* Best-effort
|
|
286
|
+
* Best-effort chain synchronization. A confirmed transaction must NEVER be lost to a
|
|
287
287
|
* synchronization failure, so this reports its outcome in `mirrorSync` and
|
|
288
|
-
* never rejects.
|
|
289
|
-
*
|
|
288
|
+
* never rejects. The signature lets the server index the exact transaction,
|
|
289
|
+
* including hook-mutated documents beyond the requested destination paths.
|
|
290
290
|
*/
|
|
291
|
-
export declare function attemptMirrorSync(paths: string[], options?: SetOptions,
|
|
291
|
+
export declare function attemptMirrorSync(paths: string[], options?: SetOptions, transactionSignature?: string): Promise<MirrorSync>;
|
|
292
292
|
/**
|
|
293
293
|
* Write a document at `path`. Sugar for a one-element {@link setMany}.
|
|
294
294
|
*
|
|
@@ -395,4 +395,5 @@ export declare function setFile(path: string, file: File | null, options?: {
|
|
|
395
395
|
export declare function signMessage(message: string): Promise<string>;
|
|
396
396
|
export declare function signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
397
397
|
export declare function signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise<string>;
|
|
398
|
-
|
|
398
|
+
/** Refresh concrete paths, or index a confirmed transaction and read its requested paths. */
|
|
399
|
+
export declare function syncItems(paths: string[], options?: SetOptions, transactionSignature?: string): Promise<any>;
|
|
@@ -4307,7 +4307,7 @@ class ServerSessionManager {
|
|
|
4307
4307
|
const sessionConfig = (_a = this.sessionConfig) !== null && _a !== void 0 ? _a : undefined;
|
|
4308
4308
|
/* fetch nonce from auth API (bound to the snapshotted app+issuer) */
|
|
4309
4309
|
const nonce = await genAuthNonce(sessionConfig);
|
|
4310
|
-
const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-
|
|
4310
|
+
const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-CaPunjVI.js'); });
|
|
4311
4311
|
const message = await genSolanaMessage(address, nonce, sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.appId);
|
|
4312
4312
|
/* sign the message */
|
|
4313
4313
|
const sigBytes = nacl.sign.detached(new TextEncoder().encode(message), kp.secretKey);
|
|
@@ -5053,6 +5053,7 @@ class BoundedDeclineError extends Error {
|
|
|
5053
5053
|
|
|
5054
5054
|
const apiClient = axios.create();
|
|
5055
5055
|
const TRANSIENT_GET_STATUSES = new Set([500, 502, 503, 504]);
|
|
5056
|
+
const TRANSIENT_SYNC_STATUSES = new Set([502, 503, 504]);
|
|
5056
5057
|
const RATE_LIMIT_RETRY_BASE_DELAY_MS = 100;
|
|
5057
5058
|
/** The window event emitted when the API responds with HTTP 429. */
|
|
5058
5059
|
const RATE_LIMIT_EVENT_NAME = 'bounded:ratelimit';
|
|
@@ -5101,7 +5102,7 @@ function getRateLimitAttempt(error) {
|
|
|
5101
5102
|
axiosRetry(apiClient, {
|
|
5102
5103
|
retries: 2,
|
|
5103
5104
|
retryCondition: (error) => {
|
|
5104
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
5105
5106
|
// A caller cancellation is final. In particular, never turn a route
|
|
5106
5107
|
// unmount into a fresh GET after its AbortSignal has fired.
|
|
5107
5108
|
const canceled = axios.isCancel(error)
|
|
@@ -5117,15 +5118,27 @@ axiosRetry(apiClient, {
|
|
|
5117
5118
|
// safe for every method, including POST requests to the queries API.
|
|
5118
5119
|
if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 429)
|
|
5119
5120
|
return true;
|
|
5120
|
-
//
|
|
5121
|
-
//
|
|
5122
|
-
//
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
if (
|
|
5121
|
+
// Sync only indexes existing chain state, so repeating it cannot submit
|
|
5122
|
+
// a second transaction. Keep its retries in this same bounded transport
|
|
5123
|
+
// loop instead of multiplying them with another SDK retry loop.
|
|
5124
|
+
const method = (_f = (_e = error.config) === null || _e === void 0 ? void 0 : _e.method) === null || _f === void 0 ? void 0 : _f.toLowerCase();
|
|
5125
|
+
let isSync = false;
|
|
5126
|
+
if (method === 'put') {
|
|
5127
|
+
try {
|
|
5128
|
+
isSync = new URL(String((_g = error.config) === null || _g === void 0 ? void 0 : _g.url)).pathname === '/items/sync';
|
|
5129
|
+
}
|
|
5130
|
+
catch ( /* An unrecognized URL is never safe to retry. */_m) { /* An unrecognized URL is never safe to retry. */ }
|
|
5131
|
+
}
|
|
5132
|
+
if (isSync) {
|
|
5133
|
+
return axiosRetry.isNetworkError(error)
|
|
5134
|
+
|| TRANSIENT_SYNC_STATUSES.has((_j = (_h = error.response) === null || _h === void 0 ? void 0 : _h.status) !== null && _j !== void 0 ? _j : 0);
|
|
5135
|
+
}
|
|
5136
|
+
// Ordinary writes are never retried: a lost response may follow commit.
|
|
5137
|
+
// GET network and selected gateway/runtime failures are safe to repeat.
|
|
5138
|
+
if (method !== 'get')
|
|
5126
5139
|
return false;
|
|
5127
5140
|
return axiosRetry.isNetworkError(error)
|
|
5128
|
-
|| TRANSIENT_GET_STATUSES.has((
|
|
5141
|
+
|| TRANSIENT_GET_STATUSES.has((_l = (_k = error.response) === null || _k === void 0 ? void 0 : _k.status) !== null && _l !== void 0 ? _l : 0);
|
|
5129
5142
|
},
|
|
5130
5143
|
retryDelay: (retryCount, error) => {
|
|
5131
5144
|
var _a;
|
|
@@ -7666,7 +7679,7 @@ async function doReconnectWithNewAuth() {
|
|
|
7666
7679
|
console.warn('[WS v2] Failed to clear HTTP read cache on auth change:', error);
|
|
7667
7680
|
}
|
|
7668
7681
|
try {
|
|
7669
|
-
const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-
|
|
7682
|
+
const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-5vXHb5Br.js'); });
|
|
7670
7683
|
await reconnectRealtimeStoreWithNewAuth();
|
|
7671
7684
|
}
|
|
7672
7685
|
catch (error) {
|
|
@@ -8852,12 +8865,6 @@ async function runExpressionMany(many) {
|
|
|
8852
8865
|
}
|
|
8853
8866
|
}
|
|
8854
8867
|
/* ===================== WRITE RECEIPT HELPERS (W4) ======================== */
|
|
8855
|
-
/**
|
|
8856
|
-
* Settle delay before the best-effort mirror read on an on-chain write. It is
|
|
8857
|
-
* an optimization, not a correctness guarantee: the receipt is captured first
|
|
8858
|
-
* and returned regardless of what the mirror read reports.
|
|
8859
|
-
*/
|
|
8860
|
-
const MIRROR_SYNC_SETTLE_MS = 1500;
|
|
8861
8868
|
const SOLANA_CHAIN_TAGS = new Set(['solana_devnet', 'solana_mainnet']);
|
|
8862
8869
|
/**
|
|
8863
8870
|
* Read the execution-lane tag the WORKER reported. The SDK never infers it: a
|
|
@@ -8932,16 +8939,14 @@ function validatePathKeyedDocuments(paths, source) {
|
|
|
8932
8939
|
return { observed: true, documents };
|
|
8933
8940
|
}
|
|
8934
8941
|
/**
|
|
8935
|
-
* Best-effort
|
|
8942
|
+
* Best-effort chain synchronization. A confirmed transaction must NEVER be lost to a
|
|
8936
8943
|
* synchronization failure, so this reports its outcome in `mirrorSync` and
|
|
8937
|
-
* never rejects.
|
|
8938
|
-
*
|
|
8944
|
+
* never rejects. The signature lets the server index the exact transaction,
|
|
8945
|
+
* including hook-mutated documents beyond the requested destination paths.
|
|
8939
8946
|
*/
|
|
8940
|
-
async function attemptMirrorSync(paths, options,
|
|
8947
|
+
async function attemptMirrorSync(paths, options, transactionSignature) {
|
|
8941
8948
|
try {
|
|
8942
|
-
|
|
8943
|
-
await new Promise(resolve => setTimeout(resolve, settleMs));
|
|
8944
|
-
const synced = await syncItems(paths, options);
|
|
8949
|
+
const synced = await syncItems(paths, options, transactionSignature);
|
|
8945
8950
|
// The sync endpoint answers `{ data: <path-keyed map>, status }`; a document
|
|
8946
8951
|
// path always contains a `/`, so a top-level `data` key is never one.
|
|
8947
8952
|
const map = (synced && typeof synced === 'object' && !Array.isArray(synced) && 'data' in synced)
|
|
@@ -9166,7 +9171,7 @@ async function setMany(many, options) {
|
|
|
9166
9171
|
if (typeof curTx.serializedTransaction !== 'string' || typeof curTx.poofnetIntentId !== 'string') {
|
|
9167
9172
|
throw new Error('Unsupported 202 transaction shape: a poofnet write needs serializedTransaction and poofnetIntentId');
|
|
9168
9173
|
}
|
|
9169
|
-
const { signPoofnetTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-
|
|
9174
|
+
const { signPoofnetTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-BPOTddBI.js'); });
|
|
9170
9175
|
const signedTransaction = await signPoofnetTransaction(curTx.serializedTransaction, authProvider, options, buildExpectedWriteIntent(documents));
|
|
9171
9176
|
// Signing-only, exactly as on a real chain: signed and NOT committed.
|
|
9172
9177
|
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
@@ -9204,7 +9209,7 @@ async function setMany(many, options) {
|
|
|
9204
9209
|
'Nothing was signed or submitted.');
|
|
9205
9210
|
}
|
|
9206
9211
|
const solanaChain = workerChain;
|
|
9207
|
-
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-
|
|
9212
|
+
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-BPOTddBI.js'); });
|
|
9208
9213
|
// OA-0001: derive the expected intent from OUR OWN request (the one
|
|
9209
9214
|
// ground truth a tampered builder response cannot change) so the
|
|
9210
9215
|
// validator can reject any transaction whose operation semantics
|
|
@@ -9245,7 +9250,7 @@ async function setMany(many, options) {
|
|
|
9245
9250
|
// best-effort enrichment reported in `mirrorSync`, never a rejection.
|
|
9246
9251
|
const mirrorSync = grantLane
|
|
9247
9252
|
? { observed: false, reason: 'not attempted: a venue grant authorizes only the write' }
|
|
9248
|
-
: await attemptMirrorSync(requestedPaths, options);
|
|
9253
|
+
: await attemptMirrorSync(requestedPaths, Object.assign(Object.assign({}, options), { _overrides: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options._overrides), { _config: config }) }), solanaOutcome.transactionSignature);
|
|
9249
9254
|
return {
|
|
9250
9255
|
status: 'confirmed', appId, requestedDocuments, chain: solanaChain,
|
|
9251
9256
|
transactionId: solanaOutcome.transactionSignature,
|
|
@@ -9517,14 +9522,18 @@ async function signAndSubmitTransaction(transaction, feePayer) {
|
|
|
9517
9522
|
}
|
|
9518
9523
|
return config.authProvider.signAndSubmitTransaction(transaction, feePayer);
|
|
9519
9524
|
}
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9525
|
+
/** Refresh concrete paths, or index a confirmed transaction and read its requested paths. */
|
|
9526
|
+
async function syncItems(paths, options, transactionSignature) {
|
|
9527
|
+
var _a, _b;
|
|
9528
|
+
const response = await makeApiRequest('PUT', 'items/sync', Object.assign({ paths }, (transactionSignature !== undefined ? { transactionSignature } : {})), options === null || options === void 0 ? void 0 : options._overrides);
|
|
9529
|
+
if (transactionSignature !== undefined && (response.status !== 200
|
|
9530
|
+
|| ((_a = response.data) === null || _a === void 0 ? void 0 : _a.synchronized) !== true
|
|
9531
|
+
|| ((_b = response.data) === null || _b === void 0 ? void 0 : _b.transactionSignature) !== transactionSignature)) {
|
|
9532
|
+
// An older server's local-read stub can return 200 with stale documents.
|
|
9533
|
+
// Only the matching server acknowledgment proves this transaction was indexed.
|
|
9534
|
+
throw new Error('the synchronization response did not acknowledge the confirmed transaction');
|
|
9527
9535
|
}
|
|
9536
|
+
return response.data;
|
|
9528
9537
|
}
|
|
9529
9538
|
|
|
9530
9539
|
var operations = /*#__PURE__*/Object.freeze({
|
|
@@ -9557,8 +9566,6 @@ var operations = /*#__PURE__*/Object.freeze({
|
|
|
9557
9566
|
const DEFAULT_TIMEOUT_MS = 60000;
|
|
9558
9567
|
const DEFAULT_MAX_ATTEMPTS$1 = 20;
|
|
9559
9568
|
const DEFAULT_POLL_INTERVAL_MS = 3000;
|
|
9560
|
-
/** Mirror read after a late confirmation. No settle delay: the tx already landed. */
|
|
9561
|
-
const RECONCILE_MIRROR_SETTLE_MS = 0;
|
|
9562
9569
|
function errorText(error) {
|
|
9563
9570
|
const message = error === null || error === void 0 ? void 0 : error.message;
|
|
9564
9571
|
return typeof message === 'string' && message.length > 0 ? message : String(error);
|
|
@@ -9607,12 +9614,12 @@ function assertReceiptMatchesContext(receipt, config) {
|
|
|
9607
9614
|
function stillSubmitted(receipt, reason) {
|
|
9608
9615
|
return Object.assign(Object.assign({}, receipt), { confirmation: Object.assign(Object.assign({}, receipt.confirmation), { reason }) });
|
|
9609
9616
|
}
|
|
9610
|
-
async function mirrorFor(receipt, options) {
|
|
9617
|
+
async function mirrorFor(receipt, config, options) {
|
|
9611
9618
|
const paths = receipt.requestedDocuments.map(entry => entry.path);
|
|
9612
9619
|
if (paths.length === 0)
|
|
9613
9620
|
return { observed: false, reason: 'the receipt carried no requested paths' };
|
|
9614
|
-
const setOptions = (options === null || options === void 0 ? void 0 : options._overrides)
|
|
9615
|
-
return attemptMirrorSync(paths, setOptions,
|
|
9621
|
+
const setOptions = { _overrides: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options._overrides), { _config: config }) };
|
|
9622
|
+
return attemptMirrorSync(paths, setOptions, receipt.transactionId);
|
|
9616
9623
|
}
|
|
9617
9624
|
async function resolveSolanaRpc(config, options) {
|
|
9618
9625
|
var _a, _b;
|
|
@@ -9694,7 +9701,7 @@ async function reconcileSolana(receipt, config, options) {
|
|
|
9694
9701
|
signedTransaction: receipt.signedTransaction,
|
|
9695
9702
|
fence: receipt.fence,
|
|
9696
9703
|
confirmationContextSlot: typeof statusValue.slot === 'number' ? statusValue.slot : (contextSlot !== null && contextSlot !== void 0 ? contextSlot : 0),
|
|
9697
|
-
mirrorSync: await mirrorFor(receipt, options),
|
|
9704
|
+
mirrorSync: await mirrorFor(receipt, config, options),
|
|
9698
9705
|
};
|
|
9699
9706
|
return confirmed;
|
|
9700
9707
|
}
|
|
@@ -11048,7 +11055,7 @@ function toMillis(seconds) {
|
|
|
11048
11055
|
|
|
11049
11056
|
/** SIWS message creation is async already, so its onchain module can be lazy. */
|
|
11050
11057
|
async function genSolanaMessage(address, nonce) {
|
|
11051
|
-
const implementation = await Promise.resolve().then(function () { return require('./solana-message-
|
|
11058
|
+
const implementation = await Promise.resolve().then(function () { return require('./solana-message-CaPunjVI.js'); });
|
|
11052
11059
|
return implementation.genSolanaMessage(address, nonce);
|
|
11053
11060
|
}
|
|
11054
11061
|
|
|
@@ -11701,4 +11708,4 @@ exports.toSeconds = toSeconds;
|
|
|
11701
11708
|
exports.waitForSetResult = waitForSetResult;
|
|
11702
11709
|
exports.withEffects = withEffects;
|
|
11703
11710
|
exports.writeNotAppliedPhase = writeNotAppliedPhase;
|
|
11704
|
-
//# sourceMappingURL=index-
|
|
11711
|
+
//# sourceMappingURL=index-BcJOeks0.js.map
|