@bounded-sh/core 0.0.116 → 0.0.117
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/mirror-sync.d.ts +11 -0
- package/dist/client/operations.d.ts +4 -8
- package/dist/{index-Db4lrwO6.mjs → index-C6ZW5Gt2.mjs} +38 -98
- package/dist/index-C6ZW5Gt2.mjs.map +1 -0
- package/dist/{index-CjiaT9AT.js → index-DQ0FXeI8.js} +38 -97
- package/dist/index-DQ0FXeI8.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/mirror-sync-ChzMq7bH.js +89 -0
- package/dist/mirror-sync-ChzMq7bH.js.map +1 -0
- package/dist/mirror-sync-kt9PzQen.mjs +86 -0
- package/dist/mirror-sync-kt9PzQen.mjs.map +1 -0
- package/dist/{realtime-store-IPPwUhJc.js → realtime-store-CURbZ68v.js} +2 -2
- package/dist/{realtime-store-IPPwUhJc.js.map → realtime-store-CURbZ68v.js.map} +1 -1
- package/dist/{realtime-store-CNs5zURZ.mjs → realtime-store-FUjGL_Z8.mjs} +2 -2
- package/dist/{realtime-store-CNs5zURZ.mjs.map → realtime-store-FUjGL_Z8.mjs.map} +1 -1
- package/dist/{solana-message-BO6Dtgbv.mjs → solana-message-CEjXjnaG.mjs} +2 -2
- package/dist/{solana-message-BO6Dtgbv.mjs.map → solana-message-CEjXjnaG.mjs.map} +1 -1
- package/dist/{solana-message-CXuLc7NX.js → solana-message-F1e5wPKF.js} +2 -2
- package/dist/{solana-message-CXuLc7NX.js.map → solana-message-F1e5wPKF.js.map} +1 -1
- package/dist/{solana-operations-DDt4CzRR.mjs → solana-operations-5WjFwhnt.mjs} +3 -3
- package/dist/{solana-operations-DDt4CzRR.mjs.map → solana-operations-5WjFwhnt.mjs.map} +1 -1
- package/dist/{solana-operations-CghJe0_7.js → solana-operations-CI0sREvl.js} +3 -3
- package/dist/{solana-operations-CghJe0_7.js.map → solana-operations-CI0sREvl.js.map} +1 -1
- package/dist/{solana-v1-operations-TH-HUzbT.mjs → solana-v1-operations-DB9pih7o.mjs} +3 -3
- package/dist/{solana-v1-operations-TH-HUzbT.mjs.map → solana-v1-operations-DB9pih7o.mjs.map} +1 -1
- package/dist/{solana-v1-operations-BY2DTfbR.js → solana-v1-operations-oot2R63I.js} +3 -3
- package/dist/{solana-v1-operations-BY2DTfbR.js.map → solana-v1-operations-oot2R63I.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CjiaT9AT.js.map +0 -1
- package/dist/index-Db4lrwO6.mjs.map +0 -1
|
@@ -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-F1e5wPKF.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-CURbZ68v.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
|
|
@@ -8888,66 +8895,11 @@ function buildRequestedDocuments(documents) {
|
|
|
8888
8895
|
});
|
|
8889
8896
|
});
|
|
8890
8897
|
}
|
|
8891
|
-
/**
|
|
8892
|
-
function
|
|
8893
|
-
if (Object.prototype.hasOwnProperty.call(source, path))
|
|
8894
|
-
return source[path];
|
|
8895
|
-
const withSlash = path.startsWith('/') ? path : `/${path}`;
|
|
8896
|
-
if (Object.prototype.hasOwnProperty.call(source, withSlash))
|
|
8897
|
-
return source[withSlash];
|
|
8898
|
-
const withoutSlash = path.startsWith('/') ? path.slice(1) : path;
|
|
8899
|
-
if (Object.prototype.hasOwnProperty.call(source, withoutSlash))
|
|
8900
|
-
return source[withoutSlash];
|
|
8901
|
-
return undefined;
|
|
8902
|
-
}
|
|
8903
|
-
/**
|
|
8904
|
-
* `observed: true` only when EVERY requested concrete path was read back as a
|
|
8905
|
-
* real document. The sync endpoint answers `null` for a document that is
|
|
8906
|
-
* absent, lagging, or read-denied, and a deleted path reads back as `null` too
|
|
8907
|
-
* — none of those are evidence of synchronization.
|
|
8908
|
-
*/
|
|
8909
|
-
function validatePathKeyedDocuments(paths, source) {
|
|
8910
|
-
if (!source || typeof source !== 'object' || Array.isArray(source)) {
|
|
8911
|
-
return { observed: false, reason: 'the synchronization response was not a path-keyed document map' };
|
|
8912
|
-
}
|
|
8913
|
-
const map = source;
|
|
8914
|
-
const documents = [];
|
|
8915
|
-
const unobserved = [];
|
|
8916
|
-
for (const path of paths) {
|
|
8917
|
-
const document = pickPathDocument(map, path);
|
|
8918
|
-
if (document == null || typeof document !== 'object' || Array.isArray(document)) {
|
|
8919
|
-
unobserved.push(path);
|
|
8920
|
-
documents.push({ path, document: null });
|
|
8921
|
-
continue;
|
|
8922
|
-
}
|
|
8923
|
-
documents.push({ path, document: document });
|
|
8924
|
-
}
|
|
8925
|
-
if (unobserved.length > 0) {
|
|
8926
|
-
return {
|
|
8927
|
-
observed: false,
|
|
8928
|
-
reason: `no readable document was returned for ${unobserved.join(', ')} ` +
|
|
8929
|
-
'(absent, deleted, lagging, read-denied, or a passthrough write)',
|
|
8930
|
-
};
|
|
8931
|
-
}
|
|
8932
|
-
return { observed: true, documents };
|
|
8933
|
-
}
|
|
8934
|
-
/**
|
|
8935
|
-
* Best-effort mirror read. A confirmed transaction must NEVER be lost to a
|
|
8936
|
-
* synchronization failure, so this reports its outcome in `mirrorSync` and
|
|
8937
|
-
* never rejects. It reads the CONCRETE destination paths, so a collection
|
|
8938
|
-
* insert with a generated id syncs the path that actually exists.
|
|
8939
|
-
*/
|
|
8940
|
-
async function attemptMirrorSync(paths, options, settleMs = MIRROR_SYNC_SETTLE_MS) {
|
|
8898
|
+
/** Best-effort readback, including a failure to load its lazy implementation. */
|
|
8899
|
+
async function attemptMirrorSync(paths, options, transactionSignature) {
|
|
8941
8900
|
try {
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
const synced = await syncItems(paths, options);
|
|
8945
|
-
// The sync endpoint answers `{ data: <path-keyed map>, status }`; a document
|
|
8946
|
-
// path always contains a `/`, so a top-level `data` key is never one.
|
|
8947
|
-
const map = (synced && typeof synced === 'object' && !Array.isArray(synced) && 'data' in synced)
|
|
8948
|
-
? synced.data
|
|
8949
|
-
: synced;
|
|
8950
|
-
return validatePathKeyedDocuments(paths, map);
|
|
8901
|
+
const mirror = await Promise.resolve().then(function () { return require('./mirror-sync-ChzMq7bH.js'); });
|
|
8902
|
+
return await mirror.attemptMirrorSync(paths, options, transactionSignature);
|
|
8951
8903
|
}
|
|
8952
8904
|
catch (error) {
|
|
8953
8905
|
const message = typeof (error === null || error === void 0 ? void 0 : error.message) === 'string' ? error.message : String(error);
|
|
@@ -9166,7 +9118,7 @@ async function setMany(many, options) {
|
|
|
9166
9118
|
if (typeof curTx.serializedTransaction !== 'string' || typeof curTx.poofnetIntentId !== 'string') {
|
|
9167
9119
|
throw new Error('Unsupported 202 transaction shape: a poofnet write needs serializedTransaction and poofnetIntentId');
|
|
9168
9120
|
}
|
|
9169
|
-
const { signPoofnetTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-
|
|
9121
|
+
const { signPoofnetTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-CI0sREvl.js'); });
|
|
9170
9122
|
const signedTransaction = await signPoofnetTransaction(curTx.serializedTransaction, authProvider, options, buildExpectedWriteIntent(documents));
|
|
9171
9123
|
// Signing-only, exactly as on a real chain: signed and NOT committed.
|
|
9172
9124
|
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
@@ -9204,7 +9156,7 @@ async function setMany(many, options) {
|
|
|
9204
9156
|
'Nothing was signed or submitted.');
|
|
9205
9157
|
}
|
|
9206
9158
|
const solanaChain = workerChain;
|
|
9207
|
-
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-
|
|
9159
|
+
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-CI0sREvl.js'); });
|
|
9208
9160
|
// OA-0001: derive the expected intent from OUR OWN request (the one
|
|
9209
9161
|
// ground truth a tampered builder response cannot change) so the
|
|
9210
9162
|
// validator can reject any transaction whose operation semantics
|
|
@@ -9245,7 +9197,7 @@ async function setMany(many, options) {
|
|
|
9245
9197
|
// best-effort enrichment reported in `mirrorSync`, never a rejection.
|
|
9246
9198
|
const mirrorSync = grantLane
|
|
9247
9199
|
? { observed: false, reason: 'not attempted: a venue grant authorizes only the write' }
|
|
9248
|
-
: await attemptMirrorSync(requestedPaths, options);
|
|
9200
|
+
: 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
9201
|
return {
|
|
9250
9202
|
status: 'confirmed', appId, requestedDocuments, chain: solanaChain,
|
|
9251
9203
|
transactionId: solanaOutcome.transactionSignature,
|
|
@@ -9517,15 +9469,6 @@ async function signAndSubmitTransaction(transaction, feePayer) {
|
|
|
9517
9469
|
}
|
|
9518
9470
|
return config.authProvider.signAndSubmitTransaction(transaction, feePayer);
|
|
9519
9471
|
}
|
|
9520
|
-
async function syncItems(paths, options) {
|
|
9521
|
-
try {
|
|
9522
|
-
const response = await makeApiRequest('PUT', 'items/sync', { paths }, options === null || options === void 0 ? void 0 : options._overrides);
|
|
9523
|
-
return response.data;
|
|
9524
|
-
}
|
|
9525
|
-
catch (error) {
|
|
9526
|
-
throw error;
|
|
9527
|
-
}
|
|
9528
|
-
}
|
|
9529
9472
|
|
|
9530
9473
|
var operations = /*#__PURE__*/Object.freeze({
|
|
9531
9474
|
__proto__: null,
|
|
@@ -9550,15 +9493,12 @@ var operations = /*#__PURE__*/Object.freeze({
|
|
|
9550
9493
|
setMany: setMany,
|
|
9551
9494
|
signAndSubmitTransaction: signAndSubmitTransaction,
|
|
9552
9495
|
signMessage: signMessage,
|
|
9553
|
-
signTransaction: signTransaction
|
|
9554
|
-
syncItems: syncItems
|
|
9496
|
+
signTransaction: signTransaction
|
|
9555
9497
|
});
|
|
9556
9498
|
|
|
9557
9499
|
const DEFAULT_TIMEOUT_MS = 60000;
|
|
9558
9500
|
const DEFAULT_MAX_ATTEMPTS$1 = 20;
|
|
9559
9501
|
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
9502
|
function errorText(error) {
|
|
9563
9503
|
const message = error === null || error === void 0 ? void 0 : error.message;
|
|
9564
9504
|
return typeof message === 'string' && message.length > 0 ? message : String(error);
|
|
@@ -9607,12 +9547,12 @@ function assertReceiptMatchesContext(receipt, config) {
|
|
|
9607
9547
|
function stillSubmitted(receipt, reason) {
|
|
9608
9548
|
return Object.assign(Object.assign({}, receipt), { confirmation: Object.assign(Object.assign({}, receipt.confirmation), { reason }) });
|
|
9609
9549
|
}
|
|
9610
|
-
async function mirrorFor(receipt, options) {
|
|
9550
|
+
async function mirrorFor(receipt, config, options) {
|
|
9611
9551
|
const paths = receipt.requestedDocuments.map(entry => entry.path);
|
|
9612
9552
|
if (paths.length === 0)
|
|
9613
9553
|
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,
|
|
9554
|
+
const setOptions = { _overrides: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options._overrides), { _config: config }) };
|
|
9555
|
+
return attemptMirrorSync(paths, setOptions, receipt.transactionId);
|
|
9616
9556
|
}
|
|
9617
9557
|
async function resolveSolanaRpc(config, options) {
|
|
9618
9558
|
var _a, _b;
|
|
@@ -9694,7 +9634,7 @@ async function reconcileSolana(receipt, config, options) {
|
|
|
9694
9634
|
signedTransaction: receipt.signedTransaction,
|
|
9695
9635
|
fence: receipt.fence,
|
|
9696
9636
|
confirmationContextSlot: typeof statusValue.slot === 'number' ? statusValue.slot : (contextSlot !== null && contextSlot !== void 0 ? contextSlot : 0),
|
|
9697
|
-
mirrorSync: await mirrorFor(receipt, options),
|
|
9637
|
+
mirrorSync: await mirrorFor(receipt, config, options),
|
|
9698
9638
|
};
|
|
9699
9639
|
return confirmed;
|
|
9700
9640
|
}
|
|
@@ -11048,7 +10988,7 @@ function toMillis(seconds) {
|
|
|
11048
10988
|
|
|
11049
10989
|
/** SIWS message creation is async already, so its onchain module can be lazy. */
|
|
11050
10990
|
async function genSolanaMessage(address, nonce) {
|
|
11051
|
-
const implementation = await Promise.resolve().then(function () { return require('./solana-message-
|
|
10991
|
+
const implementation = await Promise.resolve().then(function () { return require('./solana-message-F1e5wPKF.js'); });
|
|
11052
10992
|
return implementation.genSolanaMessage(address, nonce);
|
|
11053
10993
|
}
|
|
11054
10994
|
|
|
@@ -11666,6 +11606,7 @@ exports.isAuthExpiredError = isAuthExpiredError;
|
|
|
11666
11606
|
exports.isEffectResult = isEffectResult;
|
|
11667
11607
|
exports.isWriteNotApplied = isWriteNotApplied;
|
|
11668
11608
|
exports.live = live;
|
|
11609
|
+
exports.makeApiRequest = makeApiRequest;
|
|
11669
11610
|
exports.markWriteNotApplied = markWriteNotApplied;
|
|
11670
11611
|
exports.normalizeEvmAddress = normalizeEvmAddress;
|
|
11671
11612
|
exports.now = now;
|
|
@@ -11701,4 +11642,4 @@ exports.toSeconds = toSeconds;
|
|
|
11701
11642
|
exports.waitForSetResult = waitForSetResult;
|
|
11702
11643
|
exports.withEffects = withEffects;
|
|
11703
11644
|
exports.writeNotAppliedPhase = writeNotAppliedPhase;
|
|
11704
|
-
//# sourceMappingURL=index-
|
|
11645
|
+
//# sourceMappingURL=index-DQ0FXeI8.js.map
|