@tinycloud/operations 0.6.1-beta.5 → 0.6.1-beta.7
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/cli-runtime.cjs +16 -10
- package/dist/cli-runtime.cjs.map +1 -1
- package/dist/cli-runtime.js +16 -10
- package/dist/cli-runtime.js.map +1 -1
- package/dist/delegation-binding.cjs.map +1 -1
- package/dist/delegation-binding.js.map +1 -1
- package/dist/index.cjs +16 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -10
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -272,6 +272,18 @@ function storageFullOperationError(error) {
|
|
|
272
272
|
{ retryable: false, ...account === void 0 ? {} : { details: { account } } }
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
|
+
function nodeRetryOperationError(error) {
|
|
276
|
+
const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
277
|
+
if (code === "OUTCOME_UNKNOWN") {
|
|
278
|
+
return operationError(
|
|
279
|
+
"NODE_ERROR",
|
|
280
|
+
"The TinyCloud node may have applied the write; read the data back before retrying.",
|
|
281
|
+
{ retryable: false }
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
if (code !== "NODE_BUSY" && code !== "REQUEST_TIMEOUT") return void 0;
|
|
285
|
+
return operationError("NODE_ERROR", "The TinyCloud node was busy and applied nothing; try again shortly.", { retryable: true });
|
|
286
|
+
}
|
|
275
287
|
function isOperationErrorCode(value) {
|
|
276
288
|
return typeof value === "string" && OPERATION_ERROR_CODES.includes(value);
|
|
277
289
|
}
|
|
@@ -6547,6 +6559,8 @@ function appsFailure(error) {
|
|
|
6547
6559
|
if (auth?.status === "error") return auth.error;
|
|
6548
6560
|
const storage = storageFullOperationError(error);
|
|
6549
6561
|
if (storage) return storage;
|
|
6562
|
+
const nodeRetry = nodeRetryOperationError(error);
|
|
6563
|
+
if (nodeRetry) return nodeRetry;
|
|
6550
6564
|
const code = typeof error === "object" && error !== null ? error.code : void 0;
|
|
6551
6565
|
if (code === "SPACE_NOT_HOSTED") return operationError("NODE_ERROR", "Your TinyCloud default space is not set up. Try again in a minute; if it still fails, ask for help setting up the space.", { details: { reason: "space_not_hosted" } });
|
|
6552
6566
|
if (isOperationErrorCode(code)) return operationError(code, "The node could not complete this personal-record operation.");
|
|
@@ -8020,16 +8034,8 @@ function kvFailure(error, action) {
|
|
|
8020
8034
|
if (error.code === "KV_PRECONDITION_FAILED") {
|
|
8021
8035
|
return { status: "error", error: operationError("KV_PRECONDITION_FAILED", "The TinyCloud KV object changed or already exists.") };
|
|
8022
8036
|
}
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
status: "error",
|
|
8026
|
-
error: operationError(
|
|
8027
|
-
"KV_CONFLICT",
|
|
8028
|
-
"A database serialization conflict prevented the conditional KV mutation; re-read the key state, which may still be absent, before deciding whether to retry.",
|
|
8029
|
-
{ retryable: true }
|
|
8030
|
-
)
|
|
8031
|
-
};
|
|
8032
|
-
}
|
|
8037
|
+
const nodeRetry = nodeRetryOperationError(error);
|
|
8038
|
+
if (nodeRetry) return { status: "error", error: nodeRetry };
|
|
8033
8039
|
if (error.code === "KV_RESPONSE_TOO_LARGE") {
|
|
8034
8040
|
return { status: "error", error: operationError("KV_RESPONSE_TOO_LARGE", `The TinyCloud KV value exceeds ${MAX_KV_VALUE_BYTES} bytes.`) };
|
|
8035
8041
|
}
|