@dudousxd/nestjs-durable 0.44.0 → 0.45.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/index.cjs +19 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -5
- package/dist/index.d.ts +30 -5
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -213,6 +213,7 @@ function Workflow(options) {
|
|
|
213
213
|
deadLetterWorkflow: options.deadLetterWorkflow,
|
|
214
214
|
tags: options.tags,
|
|
215
215
|
singleton: options.singleton,
|
|
216
|
+
concurrency: options.concurrency,
|
|
216
217
|
executionTimeout: options.executionTimeout,
|
|
217
218
|
inputSchema: options.inputSchema,
|
|
218
219
|
validateInput: options.validateInput,
|
|
@@ -1290,6 +1291,7 @@ var MAX_BATCHES_PER_POLICY = 100;
|
|
|
1290
1291
|
function validateRetention(retention) {
|
|
1291
1292
|
const seen = /* @__PURE__ */ new Set();
|
|
1292
1293
|
for (const policy of retention.policies) {
|
|
1294
|
+
const scopeKey = policy.scope ? stableKey(policy.scope) : "";
|
|
1293
1295
|
if (policy.statuses.length === 0) {
|
|
1294
1296
|
throw new Error("durable retention: each policy must list at least one status");
|
|
1295
1297
|
}
|
|
@@ -1301,14 +1303,24 @@ function validateRetention(retention) {
|
|
|
1301
1303
|
if (!import_nestjs_durable_core8.TERMINAL_RUN_STATUSES.includes(status)) {
|
|
1302
1304
|
throw new Error(`durable retention: status "${status}" is not terminal; only ${import_nestjs_durable_core8.TERMINAL_RUN_STATUSES.join(", ")} can be pruned`);
|
|
1303
1305
|
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
+
const key = `${scopeKey}|${status}`;
|
|
1307
|
+
if (seen.has(key)) {
|
|
1308
|
+
throw new Error(`durable retention: status "${status}" appears in more than one policy with the same scope; status sets must be disjoint per scope`);
|
|
1306
1309
|
}
|
|
1307
|
-
seen.add(
|
|
1310
|
+
seen.add(key);
|
|
1308
1311
|
}
|
|
1309
1312
|
}
|
|
1310
1313
|
}
|
|
1311
1314
|
__name(validateRetention, "validateRetention");
|
|
1315
|
+
function stableKey(value) {
|
|
1316
|
+
if (Array.isArray(value)) return `[${value.map(stableKey).join(",")}]`;
|
|
1317
|
+
if (value && typeof value === "object") {
|
|
1318
|
+
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a.localeCompare(b));
|
|
1319
|
+
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableKey(v)}`).join(",")}}`;
|
|
1320
|
+
}
|
|
1321
|
+
return JSON.stringify(value);
|
|
1322
|
+
}
|
|
1323
|
+
__name(stableKey, "stableKey");
|
|
1312
1324
|
var RetentionPoller = class {
|
|
1313
1325
|
static {
|
|
1314
1326
|
__name(this, "RetentionPoller");
|
|
@@ -1829,6 +1841,9 @@ var TimerPoller = class {
|
|
|
1829
1841
|
if (schedules && schedules.length > 0) {
|
|
1830
1842
|
await this.sweep("schedules", () => (0, import_nestjs_durable_core10.runSchedules)(this.engine, schedules, Date.now()));
|
|
1831
1843
|
}
|
|
1844
|
+
if (this.options.persistedSchedules) {
|
|
1845
|
+
await this.sweep("persistedSchedules", () => this.engine.schedules.tick());
|
|
1846
|
+
}
|
|
1832
1847
|
} finally {
|
|
1833
1848
|
this.polling = false;
|
|
1834
1849
|
}
|
|
@@ -2005,6 +2020,7 @@ var WorkflowRegistrar = class {
|
|
|
2005
2020
|
origin,
|
|
2006
2021
|
tags: meta.tags,
|
|
2007
2022
|
singleton: meta.singleton,
|
|
2023
|
+
concurrency: meta.concurrency,
|
|
2008
2024
|
executionTimeout: meta.executionTimeout,
|
|
2009
2025
|
requires: meta.requires,
|
|
2010
2026
|
validateInput,
|