@ferricstore/ferricstore 0.13.3 → 0.13.5
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/README.md +16 -7
- package/dist/index.cjs +81 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +81 -6
- package/dist/index.js.map +1 -1
- package/docs/api/classes/FerricStoreClient.html +8 -8
- package/docs/api/index.html +16 -7
- package/docs/api/interfaces/ClaimDueOptions.html +3 -1
- package/docs/api/interfaces/WorkerConfig.html +14 -12
- package/docs/api/variables/FERRICSTORE_SDK_VERSION.html +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -597,6 +597,7 @@ interface WorkerConfig {
|
|
|
597
597
|
/** Include Flow attributes in compact worker claims. Defaults to false. */
|
|
598
598
|
claimAttributes?: boolean;
|
|
599
599
|
valueMaxBytes?: number;
|
|
600
|
+
/** FLOW.CLAIM_DUE server block interval in integer milliseconds, from 0 through 4_294_967_295. */
|
|
600
601
|
blockMs?: number;
|
|
601
602
|
/** Maximum server block interval while signal is present, bounding safe shutdown latency. */
|
|
602
603
|
abortPollMs?: number;
|
|
@@ -909,7 +910,7 @@ interface ClaimDueOptions {
|
|
|
909
910
|
limit?: number;
|
|
910
911
|
priority?: number;
|
|
911
912
|
nowMs?: number;
|
|
912
|
-
blockMs?: number;
|
|
913
|
+
/** FLOW.CLAIM_DUE server block interval in integer milliseconds, from 0 through 4_294_967_295. */ blockMs?: number;
|
|
913
914
|
reclaimExpired?: boolean;
|
|
914
915
|
reclaimRatio?: number;
|
|
915
916
|
jobOnly?: boolean;
|
|
@@ -2678,7 +2679,7 @@ declare class WorkflowWorker {
|
|
|
2678
2679
|
}
|
|
2679
2680
|
|
|
2680
2681
|
/** TypeScript SDK package version. */
|
|
2681
|
-
declare const FERRICSTORE_SDK_VERSION = "0.13.
|
|
2682
|
+
declare const FERRICSTORE_SDK_VERSION = "0.13.5";
|
|
2682
2683
|
/** Oldest FerricStore server supported by this breaking beta contract. */
|
|
2683
2684
|
declare const FERRICSTORE_MINIMUM_SERVER_VERSION = "0.11.4";
|
|
2684
2685
|
/** Native framing and opcode ABI version; unchanged by FerricStore 0.11. */
|
package/dist/index.d.ts
CHANGED
|
@@ -597,6 +597,7 @@ interface WorkerConfig {
|
|
|
597
597
|
/** Include Flow attributes in compact worker claims. Defaults to false. */
|
|
598
598
|
claimAttributes?: boolean;
|
|
599
599
|
valueMaxBytes?: number;
|
|
600
|
+
/** FLOW.CLAIM_DUE server block interval in integer milliseconds, from 0 through 4_294_967_295. */
|
|
600
601
|
blockMs?: number;
|
|
601
602
|
/** Maximum server block interval while signal is present, bounding safe shutdown latency. */
|
|
602
603
|
abortPollMs?: number;
|
|
@@ -909,7 +910,7 @@ interface ClaimDueOptions {
|
|
|
909
910
|
limit?: number;
|
|
910
911
|
priority?: number;
|
|
911
912
|
nowMs?: number;
|
|
912
|
-
blockMs?: number;
|
|
913
|
+
/** FLOW.CLAIM_DUE server block interval in integer milliseconds, from 0 through 4_294_967_295. */ blockMs?: number;
|
|
913
914
|
reclaimExpired?: boolean;
|
|
914
915
|
reclaimRatio?: number;
|
|
915
916
|
jobOnly?: boolean;
|
|
@@ -2678,7 +2679,7 @@ declare class WorkflowWorker {
|
|
|
2678
2679
|
}
|
|
2679
2680
|
|
|
2680
2681
|
/** TypeScript SDK package version. */
|
|
2681
|
-
declare const FERRICSTORE_SDK_VERSION = "0.13.
|
|
2682
|
+
declare const FERRICSTORE_SDK_VERSION = "0.13.5";
|
|
2682
2683
|
/** Oldest FerricStore server supported by this breaking beta contract. */
|
|
2683
2684
|
declare const FERRICSTORE_MINIMUM_SERVER_VERSION = "0.11.4";
|
|
2684
2685
|
/** Native framing and opcode ABI version; unchanged by FerricStore 0.11. */
|
package/dist/index.js
CHANGED
|
@@ -3884,6 +3884,78 @@ function expandFlowClaimStates(args) {
|
|
|
3884
3884
|
return expanded;
|
|
3885
3885
|
}
|
|
3886
3886
|
|
|
3887
|
+
// src/flow-block-validation.ts
|
|
3888
|
+
var MAX_FLOW_BLOCK_MS = 4294967295;
|
|
3889
|
+
var FLOW_BLOCK_MS_ERROR = "blockMs must be a safe non-negative integer no greater than 4294967295";
|
|
3890
|
+
function validateFlowBlockMs(value) {
|
|
3891
|
+
if (value != null && (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0 || value > MAX_FLOW_BLOCK_MS)) {
|
|
3892
|
+
throw new TypeError(FLOW_BLOCK_MS_ERROR);
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
function validateRawFlowBlockMs(value) {
|
|
3896
|
+
let parsed;
|
|
3897
|
+
try {
|
|
3898
|
+
parsed = integerArg(value);
|
|
3899
|
+
} catch {
|
|
3900
|
+
throw new TypeError(FLOW_BLOCK_MS_ERROR);
|
|
3901
|
+
}
|
|
3902
|
+
validateFlowBlockMs(parsed);
|
|
3903
|
+
}
|
|
3904
|
+
function validateRawFlowClaimBlockOptions(args) {
|
|
3905
|
+
for (let index = 1; index < args.length; ) {
|
|
3906
|
+
const token = asText(args[index]).toUpperCase();
|
|
3907
|
+
switch (token) {
|
|
3908
|
+
case "BLOCK":
|
|
3909
|
+
case "BLOCK_MS":
|
|
3910
|
+
validateRawFlowBlockMs(args[index + 1]);
|
|
3911
|
+
index += 2;
|
|
3912
|
+
break;
|
|
3913
|
+
case "STATE":
|
|
3914
|
+
case "PARTITION":
|
|
3915
|
+
case "WORKER":
|
|
3916
|
+
case "LEASE_MS":
|
|
3917
|
+
case "LIMIT":
|
|
3918
|
+
case "PRIORITY":
|
|
3919
|
+
case "NOW":
|
|
3920
|
+
case "RECLAIM_RATIO":
|
|
3921
|
+
case "RETURN":
|
|
3922
|
+
case "MAXBYTES":
|
|
3923
|
+
case "VALUE":
|
|
3924
|
+
case "VALUE_MAX_BYTES":
|
|
3925
|
+
index += 2;
|
|
3926
|
+
break;
|
|
3927
|
+
case "STATES":
|
|
3928
|
+
case "PARTITIONS": {
|
|
3929
|
+
const count = Number(args[index + 1]);
|
|
3930
|
+
const valuesStart = index + 2;
|
|
3931
|
+
if (!Number.isSafeInteger(count) || count < 0 || count > args.length - valuesStart) {
|
|
3932
|
+
validateRawFlowClaimBlockFallback(args, valuesStart);
|
|
3933
|
+
return;
|
|
3934
|
+
}
|
|
3935
|
+
index = valuesStart + count;
|
|
3936
|
+
break;
|
|
3937
|
+
}
|
|
3938
|
+
case "RECLAIM_EXPIRED":
|
|
3939
|
+
case "INCLUDE_STATE":
|
|
3940
|
+
index += index + 1 < args.length && isBoolToken(args[index + 1]) ? 2 : 1;
|
|
3941
|
+
break;
|
|
3942
|
+
case "PAYLOAD":
|
|
3943
|
+
case "NOPAYLOAD":
|
|
3944
|
+
index += 1;
|
|
3945
|
+
break;
|
|
3946
|
+
default:
|
|
3947
|
+
validateRawFlowClaimBlockFallback(args, index);
|
|
3948
|
+
return;
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
function validateRawFlowClaimBlockFallback(args, start) {
|
|
3953
|
+
for (let index = start; index < args.length; index += 1) {
|
|
3954
|
+
const token = asText(args[index]).toUpperCase();
|
|
3955
|
+
if (token === "BLOCK" || token === "BLOCK_MS") validateRawFlowBlockMs(args[index + 1]);
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3887
3959
|
// src/protocol-flow.ts
|
|
3888
3960
|
function flowCreatePayload(args) {
|
|
3889
3961
|
if (args.length < 7) return void 0;
|
|
@@ -4011,6 +4083,7 @@ function flowCreateManyPayload(args, maxBodyBytes, allowCompact) {
|
|
|
4011
4083
|
}
|
|
4012
4084
|
function flowClaimDuePayload(args, maxBodyBytes, allowCompact) {
|
|
4013
4085
|
if (args.length < 1) return void 0;
|
|
4086
|
+
validateRawFlowClaimBlockOptions(args);
|
|
4014
4087
|
const options = parseFlowOptions(args, 1, args.length, {
|
|
4015
4088
|
allowed: /* @__PURE__ */ new Set([
|
|
4016
4089
|
"STATE",
|
|
@@ -4037,6 +4110,7 @@ function flowClaimDuePayload(args, maxBodyBytes, allowCompact) {
|
|
|
4037
4110
|
readValues: true
|
|
4038
4111
|
});
|
|
4039
4112
|
if (options == null) return void 0;
|
|
4113
|
+
validateFlowBlockMs(options.block_ms);
|
|
4040
4114
|
const returnMode = options.return == null ? "" : asText(options.return).toUpperCase();
|
|
4041
4115
|
if (!returnMode.startsWith("JOBS_COMPACT")) {
|
|
4042
4116
|
const fallback = Array.isArray(options.states) ? commandExec(["FLOW.CLAIM_DUE", ...expandFlowClaimStates(args)]) : commandExec(["FLOW.CLAIM_DUE", ...args]);
|
|
@@ -18551,6 +18625,7 @@ var FerricStoreClaimClient = class extends FerricStoreMutationClient {
|
|
|
18551
18625
|
}
|
|
18552
18626
|
claimDueRequest(type, options, reusableAfterAwait = false) {
|
|
18553
18627
|
const captured = snapshotClaimOptions(options, reusableAfterAwait);
|
|
18628
|
+
validateFlowBlockMs(captured.blockMs);
|
|
18554
18629
|
if (captured.state != null && captured.states != null) {
|
|
18555
18630
|
throw new Error("state and states are mutually exclusive");
|
|
18556
18631
|
}
|
|
@@ -19983,11 +20058,11 @@ function workerClaimBlockMs(options, useBlocking) {
|
|
|
19983
20058
|
if (!useBlocking || options.blockMs == null) {
|
|
19984
20059
|
return void 0;
|
|
19985
20060
|
}
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
const abortPollMs = positiveInteger5(options.abortPollMs, 1e3);
|
|
19990
|
-
return
|
|
20061
|
+
validateFlowBlockMs(options.blockMs);
|
|
20062
|
+
const blockMs = options.blockMs;
|
|
20063
|
+
if (options.signal == null) return blockMs;
|
|
20064
|
+
const abortPollMs = Math.min(positiveInteger5(options.abortPollMs, 1e3), MAX_FLOW_BLOCK_MS);
|
|
20065
|
+
return blockMs === 0 ? abortPollMs : Math.min(blockMs, abortPollMs);
|
|
19991
20066
|
}
|
|
19992
20067
|
function workerMaxIdleSleepMs(options, idleSleepMs = workerIdleSleepMs(options)) {
|
|
19993
20068
|
return Math.max(idleSleepMs, nonNegativeDuration(options.maxIdleSleepMs, 5e3));
|
|
@@ -21886,7 +21961,7 @@ function throwError(value) {
|
|
|
21886
21961
|
}
|
|
21887
21962
|
|
|
21888
21963
|
// src/version.ts
|
|
21889
|
-
var FERRICSTORE_SDK_VERSION = "0.13.
|
|
21964
|
+
var FERRICSTORE_SDK_VERSION = "0.13.5";
|
|
21890
21965
|
var FERRICSTORE_MINIMUM_SERVER_VERSION = "0.11.4";
|
|
21891
21966
|
var FERRICSTORE_NATIVE_PROTOCOL_VERSION = 1;
|
|
21892
21967
|
export {
|