@tinycloud/sdk-services 3.3.0-beta.11 → 3.3.0-beta.25
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/{BaseService-Cc6Ueicm.d.cts → BaseService-BhfKzKke.d.cts} +5 -1
- package/dist/{BaseService-DOdXd7sr.d.ts → BaseService-x4AFZiEa.d.ts} +5 -1
- package/dist/encryption/index.cjs +18 -5
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +2 -2
- package/dist/encryption/index.d.ts +2 -2
- package/dist/encryption/index.js +18 -5
- package/dist/encryption/index.js.map +1 -1
- package/dist/index.cjs +659 -650
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -9
- package/dist/index.d.ts +16 -9
- package/dist/index.js +659 -650
- package/dist/index.js.map +1 -1
- package/dist/internal/decrypt-transport-response-error.d.cts +1 -1
- package/dist/internal/decrypt-transport-response-error.d.ts +1 -1
- package/dist/kv/index.cjs +72 -80
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.d.cts +4 -5
- package/dist/kv/index.d.ts +4 -5
- package/dist/kv/index.js +72 -80
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/replication/index.cjs +6 -5
- package/dist/kv/replication/index.cjs.map +1 -1
- package/dist/kv/replication/index.d.cts +3 -3
- package/dist/kv/replication/index.d.ts +3 -3
- package/dist/kv/replication/index.js +6 -5
- package/dist/kv/replication/index.js.map +1 -1
- package/dist/{scope-B-m6cKH-.d.ts → scope-9U4gVNFN.d.ts} +3 -1
- package/dist/{scope-B7oeKdLM.d.cts → scope-BzdcrOZG.d.cts} +3 -1
- package/dist/sql/index.cjs +30 -16
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +2 -2
- package/dist/sql/index.d.ts +2 -2
- package/dist/sql/index.js +30 -16
- package/dist/sql/index.js.map +1 -1
- package/dist/{types-BjH0ZtGy.d.cts → types-eVS1Whuf.d.cts} +24 -4
- package/dist/{types-BjH0ZtGy.d.ts → types-eVS1Whuf.d.ts} +24 -4
- package/package.json +1 -1
package/dist/kv/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BaseService } from '../BaseService-
|
|
2
|
-
import { R as Result, I as IService } from '../types-
|
|
3
|
-
import { aD as KVGetOptions, aI as KVResponse, aw as KVBatchReadResponse, aH as KVPutOptions, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aF as KVListOptions, aG as KVListResponse, az as KVChangesOptions, aA as KVChangesResponse, aC as KVDeleteOptions, aE as KVHeadOptions, aB as KVCreateSignedReadUrlOptions, aL as KVSignedReadUrlResponse, aK as KVServiceConfig, c as KVReadThrough } from '../scope-
|
|
4
|
-
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, ax as KVChange, ay as KVChangesAuthority, b as KVListPage, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aJ as KVResponseHeaders, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, z as ReplicaAuthorityState, H as ReplicaCoverage, N as ReplicaDevice, X as ReplicaGatedHandle, _ as ReplicaGrantInfo, a0 as ReplicaInspectedStatus, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from '../scope-
|
|
1
|
+
import { B as BaseService } from '../BaseService-BhfKzKke.cjs';
|
|
2
|
+
import { R as Result, I as IService } from '../types-eVS1Whuf.cjs';
|
|
3
|
+
import { aD as KVGetOptions, aI as KVResponse, aw as KVBatchReadResponse, aH as KVPutOptions, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aF as KVListOptions, aG as KVListResponse, az as KVChangesOptions, aA as KVChangesResponse, aC as KVDeleteOptions, aE as KVHeadOptions, aB as KVCreateSignedReadUrlOptions, aL as KVSignedReadUrlResponse, aK as KVServiceConfig, c as KVReadThrough } from '../scope-BzdcrOZG.cjs';
|
|
4
|
+
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, ax as KVChange, ay as KVChangesAuthority, b as KVListPage, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aJ as KVResponseHeaders, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, z as ReplicaAuthorityState, H as ReplicaCoverage, N as ReplicaDevice, X as ReplicaGatedHandle, _ as ReplicaGrantInfo, a0 as ReplicaInspectedStatus, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from '../scope-BzdcrOZG.cjs';
|
|
5
5
|
export { kvPrefixCovers } from './replication/prefix.cjs';
|
|
6
6
|
import './replication/contractConstants.cjs';
|
|
7
7
|
import './replication/grantPolicyConstants.cjs';
|
|
@@ -588,7 +588,6 @@ declare class KVService extends BaseService implements IKVService {
|
|
|
588
588
|
* Get the host URL.
|
|
589
589
|
*/
|
|
590
590
|
private get host();
|
|
591
|
-
private withJsonContentType;
|
|
592
591
|
/**
|
|
593
592
|
* Execute an invoke operation.
|
|
594
593
|
*
|
package/dist/kv/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as BaseService } from '../BaseService-
|
|
2
|
-
import { R as Result, I as IService } from '../types-
|
|
3
|
-
import { aD as KVGetOptions, aI as KVResponse, aw as KVBatchReadResponse, aH as KVPutOptions, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aF as KVListOptions, aG as KVListResponse, az as KVChangesOptions, aA as KVChangesResponse, aC as KVDeleteOptions, aE as KVHeadOptions, aB as KVCreateSignedReadUrlOptions, aL as KVSignedReadUrlResponse, aK as KVServiceConfig, c as KVReadThrough } from '../scope-
|
|
4
|
-
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, ax as KVChange, ay as KVChangesAuthority, b as KVListPage, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aJ as KVResponseHeaders, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, z as ReplicaAuthorityState, H as ReplicaCoverage, N as ReplicaDevice, X as ReplicaGatedHandle, _ as ReplicaGrantInfo, a0 as ReplicaInspectedStatus, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from '../scope-
|
|
1
|
+
import { B as BaseService } from '../BaseService-x4AFZiEa.js';
|
|
2
|
+
import { R as Result, I as IService } from '../types-eVS1Whuf.js';
|
|
3
|
+
import { aD as KVGetOptions, aI as KVResponse, aw as KVBatchReadResponse, aH as KVPutOptions, at as KVBatchPutItem, au as KVBatchPutOptions, av as KVBatchPutResponse, aF as KVListOptions, aG as KVListResponse, az as KVChangesOptions, aA as KVChangesResponse, aC as KVDeleteOptions, aE as KVHeadOptions, aB as KVCreateSignedReadUrlOptions, aL as KVSignedReadUrlResponse, aK as KVServiceConfig, c as KVReadThrough } from '../scope-9U4gVNFN.js';
|
|
4
|
+
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, aq as DEFAULT_SIGNED_READ_URL_EXPIRY_MS, ar as KVAction, as as KVActionType, ax as KVChange, ay as KVChangesAuthority, b as KVListPage, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, a as KVReplicationController, K as KVReplicationDeps, aJ as KVResponseHeaders, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, P as PendingWriteStore, m as PinnedKey, w as PurgeTarget, z as ReplicaAuthorityState, H as ReplicaCoverage, N as ReplicaDevice, X as ReplicaGatedHandle, _ as ReplicaGrantInfo, a0 as ReplicaInspectedStatus, ac as ReplicaState, ad as ReplicaStatusEntry, ae as ReplicationAuthority, af as ReplicationControl, ag as ReplicationEvent, R as ReplicationIdentity, ah as ReplicationOptions, ai as ReplicationPurgeReport, aj as ReplicationReason, ak as ReplicationScheduler, al as ResolvedReplicationOptions, an as canonicalReplicationIdentity, ao as replicationIdentityKey, ap as requiresSecretsOptIn } from '../scope-9U4gVNFN.js';
|
|
5
5
|
export { kvPrefixCovers } from './replication/prefix.js';
|
|
6
6
|
import './replication/contractConstants.js';
|
|
7
7
|
import './replication/grantPolicyConstants.js';
|
|
@@ -588,7 +588,6 @@ declare class KVService extends BaseService implements IKVService {
|
|
|
588
588
|
* Get the host URL.
|
|
589
589
|
*/
|
|
590
590
|
private get host();
|
|
591
|
-
private withJsonContentType;
|
|
592
591
|
/**
|
|
593
592
|
* Execute an invoke operation.
|
|
594
593
|
*
|
package/dist/kv/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var ErrorCodes = {
|
|
|
16
16
|
PERMISSION_DENIED: "PERMISSION_DENIED",
|
|
17
17
|
// Node retry signals (tinycloud-node #347). `meta.retryable` says whether a
|
|
18
18
|
// retry is safe; `meta.retryAfterMs` carries the node's Retry-After.
|
|
19
|
-
/** HTTP 503 `sql_busy:<stage>` / `unavailable_retryable`: nothing was applied; retry after `meta.retryAfterMs`. */
|
|
19
|
+
/** HTTP 503 `sql_busy:<stage>` / `unavailable_retryable`/`read_audit_busy`: nothing was applied; retry after `meta.retryAfterMs`. */
|
|
20
20
|
NODE_BUSY: "NODE_BUSY",
|
|
21
21
|
/** HTTP 503 `request_timeout`: the node's deadline passed before any write began; nothing was applied. */
|
|
22
22
|
REQUEST_TIMEOUT: "REQUEST_TIMEOUT",
|
|
@@ -57,11 +57,12 @@ var ErrorCodes = {
|
|
|
57
57
|
DUCKDB_READONLY_VIOLATION: "DUCKDB_READONLY_VIOLATION"
|
|
58
58
|
};
|
|
59
59
|
var defaultRetryPolicy = {
|
|
60
|
-
maxAttempts:
|
|
60
|
+
maxAttempts: 4,
|
|
61
61
|
backoff: "exponential",
|
|
62
|
-
baseDelayMs:
|
|
63
|
-
maxDelayMs:
|
|
64
|
-
retryableErrors: [ErrorCodes.
|
|
62
|
+
baseDelayMs: 250,
|
|
63
|
+
maxDelayMs: 4e3,
|
|
64
|
+
retryableErrors: [ErrorCodes.NODE_BUSY, ErrorCodes.REQUEST_TIMEOUT],
|
|
65
|
+
maxTotalMs: 12e3
|
|
65
66
|
};
|
|
66
67
|
var TelemetryEvents = {
|
|
67
68
|
SPAN: "telemetry.span",
|
|
@@ -208,7 +209,7 @@ function nodeRetryError(service, message, response, errorText) {
|
|
|
208
209
|
const body = errorText.trim();
|
|
209
210
|
const [, token, stage] = /^([a-z_]+)(?::\s*([a-z_]+):)?/.exec(body) ?? [];
|
|
210
211
|
let code;
|
|
211
|
-
if (response.status === 503 && (token === "sql_busy" || token === "unavailable_retryable")) {
|
|
212
|
+
if (response.status === 503 && (token === "sql_busy" || token === "unavailable_retryable" || token === "read_audit_busy")) {
|
|
212
213
|
code = ErrorCodes.NODE_BUSY;
|
|
213
214
|
} else if (response.status === 503 && token === "request_timeout") {
|
|
214
215
|
code = ErrorCodes.REQUEST_TIMEOUT;
|
|
@@ -639,6 +640,18 @@ var BaseService = class {
|
|
|
639
640
|
}
|
|
640
641
|
return controller.signal;
|
|
641
642
|
}
|
|
643
|
+
/** POST a signed invocation with retry; `mint` re-signs per attempt, `init.headers` add to the signed ones. */
|
|
644
|
+
invokeWithRetry(url, mint, { headers: extra, ...init } = {}) {
|
|
645
|
+
const build = () => {
|
|
646
|
+
const signed = mint();
|
|
647
|
+
return {
|
|
648
|
+
method: "POST",
|
|
649
|
+
...init,
|
|
650
|
+
headers: Array.isArray(signed) ? [...signed, ...Object.entries(extra ?? {})] : { ...signed, ...extra }
|
|
651
|
+
};
|
|
652
|
+
};
|
|
653
|
+
return this.context.invokeWithRetry ? this.context.invokeWithRetry(url, build) : this.context.fetch(url, build());
|
|
654
|
+
}
|
|
642
655
|
/**
|
|
643
656
|
* Create the abort signal for one request, bounded by the request timeout.
|
|
644
657
|
*
|
|
@@ -1006,15 +1019,6 @@ var KVService = class extends BaseService {
|
|
|
1006
1019
|
get host() {
|
|
1007
1020
|
return this.context.hosts[0];
|
|
1008
1021
|
}
|
|
1009
|
-
withJsonContentType(headers) {
|
|
1010
|
-
if (Array.isArray(headers)) {
|
|
1011
|
-
return [...headers, ["content-type", "application/json"]];
|
|
1012
|
-
}
|
|
1013
|
-
return {
|
|
1014
|
-
...headers,
|
|
1015
|
-
"content-type": "application/json"
|
|
1016
|
-
};
|
|
1017
|
-
}
|
|
1018
1022
|
/**
|
|
1019
1023
|
* Execute an invoke operation.
|
|
1020
1024
|
*
|
|
@@ -1025,20 +1029,11 @@ var KVService = class extends BaseService {
|
|
|
1025
1029
|
* @returns Fetch response
|
|
1026
1030
|
*/
|
|
1027
1031
|
async invokeOperation(path, action, body, signal, extraHeaders) {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
session,
|
|
1031
|
-
|
|
1032
|
-
path,
|
|
1033
|
-
action
|
|
1032
|
+
return this.invokeWithRetry(
|
|
1033
|
+
`${this.host}/invoke`,
|
|
1034
|
+
() => this.context.invoke(this.context.session, "kv", path, action),
|
|
1035
|
+
{ headers: extraHeaders, body, signal }
|
|
1034
1036
|
);
|
|
1035
|
-
const requestHeaders = Array.isArray(headers) ? [...headers, ...Object.entries(extraHeaders ?? {})] : { ...headers, ...extraHeaders };
|
|
1036
|
-
return this.context.fetch(`${this.host}/invoke`, {
|
|
1037
|
-
method: "POST",
|
|
1038
|
-
headers: requestHeaders,
|
|
1039
|
-
body,
|
|
1040
|
-
signal
|
|
1041
|
-
});
|
|
1042
1037
|
}
|
|
1043
1038
|
/**
|
|
1044
1039
|
* Serialize a single put value into a fetch body.
|
|
@@ -1244,28 +1239,28 @@ var KVService = class extends BaseService {
|
|
|
1244
1239
|
}
|
|
1245
1240
|
const request = this.createRequestSignal(options?.signal, options?.timeout);
|
|
1246
1241
|
try {
|
|
1247
|
-
const session = this.context.session;
|
|
1248
|
-
const invocationHeaders = this.context.invokeAny(
|
|
1249
|
-
session,
|
|
1250
|
-
paths.map((path) => ({
|
|
1251
|
-
spaceId: session.spaceId,
|
|
1252
|
-
service: "kv",
|
|
1253
|
-
path,
|
|
1254
|
-
action
|
|
1255
|
-
}))
|
|
1256
|
-
);
|
|
1257
1242
|
const limitHeaders = {};
|
|
1258
1243
|
if (getOptions?.maxResponseBytes !== void 0) {
|
|
1259
1244
|
limitHeaders["x-tinycloud-max-response-bytes"] = String(
|
|
1260
1245
|
getOptions.maxResponseBytes
|
|
1261
1246
|
);
|
|
1262
1247
|
}
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1248
|
+
const response = await this.invokeWithRetry(
|
|
1249
|
+
`${this.host}/invoke`,
|
|
1250
|
+
() => {
|
|
1251
|
+
const session = this.context.session;
|
|
1252
|
+
return this.context.invokeAny(
|
|
1253
|
+
session,
|
|
1254
|
+
paths.map((path) => ({
|
|
1255
|
+
spaceId: session.spaceId,
|
|
1256
|
+
service: "kv",
|
|
1257
|
+
path,
|
|
1258
|
+
action
|
|
1259
|
+
}))
|
|
1260
|
+
);
|
|
1261
|
+
},
|
|
1262
|
+
{ headers: limitHeaders, signal: request.signal }
|
|
1263
|
+
);
|
|
1269
1264
|
if (!response.ok) {
|
|
1270
1265
|
const errorText = response.status === 401 || response.status === 403 ? await this.readAuthorizationText(response) : await response.text();
|
|
1271
1266
|
if (response.status === 401 || response.status === 403) {
|
|
@@ -1311,10 +1306,10 @@ var KVService = class extends BaseService {
|
|
|
1311
1306
|
result: err(serviceError(item.error.code, item.error.message, "kv"))
|
|
1312
1307
|
};
|
|
1313
1308
|
}
|
|
1314
|
-
const
|
|
1309
|
+
const headers = item.headers;
|
|
1315
1310
|
const data = action === KVAction.HEAD ? void 0 : this.parseBatchValue(
|
|
1316
1311
|
item.dataBase64,
|
|
1317
|
-
|
|
1312
|
+
headers,
|
|
1318
1313
|
getOptions?.raw,
|
|
1319
1314
|
getOptions?.binary
|
|
1320
1315
|
);
|
|
@@ -1322,7 +1317,7 @@ var KVService = class extends BaseService {
|
|
|
1322
1317
|
key: keys[index],
|
|
1323
1318
|
result: ok({
|
|
1324
1319
|
data,
|
|
1325
|
-
headers: this.createBatchResponseHeaders(
|
|
1320
|
+
headers: this.createBatchResponseHeaders(headers)
|
|
1326
1321
|
})
|
|
1327
1322
|
};
|
|
1328
1323
|
});
|
|
@@ -1557,7 +1552,7 @@ var KVService = class extends BaseService {
|
|
|
1557
1552
|
));
|
|
1558
1553
|
}
|
|
1559
1554
|
const data = await this.parseResponse(response, options?.raw, options?.binary);
|
|
1560
|
-
return ok({ data, headers: this.createResponseHeaders(response.headers) });
|
|
1555
|
+
return ok({ data, headers: this.createResponseHeaders(response.headers), ...response.retry && { retry: response.retry } });
|
|
1561
1556
|
}
|
|
1562
1557
|
async batchGet(keys, options) {
|
|
1563
1558
|
return this.withTelemetry(
|
|
@@ -1647,7 +1642,8 @@ var KVService = class extends BaseService {
|
|
|
1647
1642
|
}
|
|
1648
1643
|
return ok({
|
|
1649
1644
|
data: void 0,
|
|
1650
|
-
headers: this.createResponseHeaders(response.headers)
|
|
1645
|
+
headers: this.createResponseHeaders(response.headers),
|
|
1646
|
+
...response.retry && { retry: response.retry }
|
|
1651
1647
|
});
|
|
1652
1648
|
}
|
|
1653
1649
|
/**
|
|
@@ -1720,25 +1716,23 @@ var KVService = class extends BaseService {
|
|
|
1720
1716
|
entries?.[index]?.body ?? this.serializeBatchPutValue(items[index])
|
|
1721
1717
|
);
|
|
1722
1718
|
}
|
|
1723
|
-
const
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1719
|
+
const response = await this.invokeWithRetry(
|
|
1720
|
+
`${this.host}/invoke`,
|
|
1721
|
+
() => {
|
|
1722
|
+
const headers = this.context.invokeAny(
|
|
1723
|
+
session,
|
|
1724
|
+
paths.map((path) => ({
|
|
1725
|
+
spaceId: session.spaceId,
|
|
1726
|
+
service: "kv",
|
|
1727
|
+
path,
|
|
1728
|
+
action: KVAction.PUT
|
|
1729
|
+
}))
|
|
1730
|
+
);
|
|
1731
|
+
requestMayHaveDispatched = true;
|
|
1732
|
+
return headers;
|
|
1733
|
+
},
|
|
1734
|
+
{ body, signal }
|
|
1731
1735
|
);
|
|
1732
|
-
const url = `${this.host}/invoke`;
|
|
1733
|
-
const init = {
|
|
1734
|
-
method: "POST",
|
|
1735
|
-
headers,
|
|
1736
|
-
body,
|
|
1737
|
-
signal
|
|
1738
|
-
};
|
|
1739
|
-
const fetchFn = this.context.fetch;
|
|
1740
|
-
requestMayHaveDispatched = true;
|
|
1741
|
-
const response = await fetchFn(url, init);
|
|
1742
1736
|
if (!response.ok) {
|
|
1743
1737
|
let errorText;
|
|
1744
1738
|
try {
|
|
@@ -2208,7 +2202,8 @@ var KVService = class extends BaseService {
|
|
|
2208
2202
|
}
|
|
2209
2203
|
return ok({
|
|
2210
2204
|
data: void 0,
|
|
2211
|
-
headers: this.createResponseHeaders(response.headers)
|
|
2205
|
+
headers: this.createResponseHeaders(response.headers),
|
|
2206
|
+
...response.retry && { retry: response.retry }
|
|
2212
2207
|
});
|
|
2213
2208
|
}
|
|
2214
2209
|
/**
|
|
@@ -2282,12 +2277,6 @@ var KVService = class extends BaseService {
|
|
|
2282
2277
|
}
|
|
2283
2278
|
const path = this.getFullPath(key, options?.prefix);
|
|
2284
2279
|
const session = this.context.session;
|
|
2285
|
-
const headers = this.context.invoke(
|
|
2286
|
-
session,
|
|
2287
|
-
"kv",
|
|
2288
|
-
path,
|
|
2289
|
-
KVAction.GET
|
|
2290
|
-
);
|
|
2291
2280
|
const body = {
|
|
2292
2281
|
space: session.spaceId,
|
|
2293
2282
|
path,
|
|
@@ -2301,12 +2290,15 @@ var KVService = class extends BaseService {
|
|
|
2301
2290
|
}
|
|
2302
2291
|
const request = this.createRequestSignal(options?.signal, options?.timeout);
|
|
2303
2292
|
try {
|
|
2304
|
-
const response = await this.
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2293
|
+
const response = await this.invokeWithRetry(
|
|
2294
|
+
`${this.host}/signed/kv`,
|
|
2295
|
+
() => this.context.invoke(session, "kv", path, KVAction.GET),
|
|
2296
|
+
{
|
|
2297
|
+
headers: { "content-type": "application/json" },
|
|
2298
|
+
body: JSON.stringify(body),
|
|
2299
|
+
signal: request.signal
|
|
2300
|
+
}
|
|
2301
|
+
);
|
|
2310
2302
|
if (!response.ok) {
|
|
2311
2303
|
return await this.createSignedReadUrlError(response, key, path);
|
|
2312
2304
|
}
|