@dudousxd/nestjs-durable 0.50.0 → 0.51.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 +18 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +20 -34
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/durable-workflows/SKILL.md +5 -2
package/dist/index.cjs
CHANGED
|
@@ -85,7 +85,11 @@ __export(index_exports, {
|
|
|
85
85
|
isOperatorRole: () => isOperatorRole,
|
|
86
86
|
isStepInterceptor: () => isStepInterceptor,
|
|
87
87
|
onErrorCodesOf: () => onErrorCodesOf,
|
|
88
|
+
prevCronFireMs: () => import_nestjs_durable_core18.prevCronFireMs,
|
|
88
89
|
readSearchAttributes: () => import_nestjs_durable_core18.readSearchAttributes,
|
|
90
|
+
runSchedules: () => import_nestjs_durable_core18.runSchedules,
|
|
91
|
+
scheduleRunIdAt: () => import_nestjs_durable_core18.scheduleRunIdAt,
|
|
92
|
+
scheduledRunId: () => import_nestjs_durable_core18.scheduledRunId,
|
|
89
93
|
thinWorkerProviders: () => thinWorkerProviders,
|
|
90
94
|
unavailableRunGateway: () => unavailableRunGateway
|
|
91
95
|
});
|
|
@@ -489,28 +493,14 @@ function schemaParser(schema, kind, label) {
|
|
|
489
493
|
if (isStandardSchema(schema)) {
|
|
490
494
|
return async (value) => {
|
|
491
495
|
const result = await schema["~standard"].validate(value);
|
|
492
|
-
if (result.issues)
|
|
493
|
-
const issues = result.issues.map((i) => ({
|
|
494
|
-
message: i.message,
|
|
495
|
-
...i.path ? {
|
|
496
|
-
path: i.path.map((p) => String(typeof p === "object" ? p.key : p))
|
|
497
|
-
} : {}
|
|
498
|
-
}));
|
|
499
|
-
throw new import_nestjs_durable_core4.FatalError(`invalid ${label}: ${formatIssues(issues)}`, code, issues);
|
|
500
|
-
}
|
|
496
|
+
if (result.issues) throw new import_nestjs_durable_core4.SchemaValidationError(label, result.issues, code);
|
|
501
497
|
return result.value;
|
|
502
498
|
};
|
|
503
499
|
}
|
|
504
500
|
if (isZodLike(schema)) {
|
|
505
501
|
return async (value) => {
|
|
506
502
|
const result = schema.safeParse(value);
|
|
507
|
-
if (!result.success)
|
|
508
|
-
const issues = result.error.issues.map((i) => ({
|
|
509
|
-
message: i.message,
|
|
510
|
-
path: i.path.map(String)
|
|
511
|
-
}));
|
|
512
|
-
throw new import_nestjs_durable_core4.FatalError(`invalid ${label}: ${formatIssues(issues)}`, code, issues);
|
|
513
|
-
}
|
|
503
|
+
if (!result.success) throw new import_nestjs_durable_core4.SchemaValidationError(label, result.error.issues, code);
|
|
514
504
|
return result.data;
|
|
515
505
|
};
|
|
516
506
|
}
|
|
@@ -530,12 +520,11 @@ function classValidatorParser(cls, code, label) {
|
|
|
530
520
|
}
|
|
531
521
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
532
522
|
const got = value === null ? "null" : Array.isArray(value) ? "an array" : typeof value;
|
|
533
|
-
|
|
534
|
-
throw new import_nestjs_durable_core4.FatalError(`invalid ${label}: ${message}`, code, [
|
|
523
|
+
throw new import_nestjs_durable_core4.SchemaValidationError(label, [
|
|
535
524
|
{
|
|
536
|
-
message
|
|
525
|
+
message: `expected an object, got ${got}`
|
|
537
526
|
}
|
|
538
|
-
]);
|
|
527
|
+
], code);
|
|
539
528
|
}
|
|
540
529
|
const instance = ct.plainToInstance(cls, value);
|
|
541
530
|
const errors = await cv.validate(instance, {
|
|
@@ -550,8 +539,8 @@ function classValidatorParser(cls, code, label) {
|
|
|
550
539
|
String(e.property)
|
|
551
540
|
]
|
|
552
541
|
}));
|
|
553
|
-
const
|
|
554
|
-
throw new import_nestjs_durable_core4.
|
|
542
|
+
const summary = issues.map((i) => i.message).join("; ");
|
|
543
|
+
throw new import_nestjs_durable_core4.SchemaValidationError(label, issues, code, summary);
|
|
555
544
|
}
|
|
556
545
|
return instance;
|
|
557
546
|
};
|
|
@@ -565,10 +554,6 @@ function isZodLike(schema) {
|
|
|
565
554
|
return typeof schema === "object" && schema !== null && typeof schema.safeParse === "function";
|
|
566
555
|
}
|
|
567
556
|
__name(isZodLike, "isZodLike");
|
|
568
|
-
function formatIssues(issues) {
|
|
569
|
-
return issues.map((i) => i.path && i.path.length > 0 ? `${i.path.join(".")}: ${i.message}` : i.message).join("; ");
|
|
570
|
-
}
|
|
571
|
-
__name(formatIssues, "formatIssues");
|
|
572
557
|
|
|
573
558
|
// src/discovery-helpers.ts
|
|
574
559
|
function scanWorkflows(discovery, register) {
|
|
@@ -648,8 +633,8 @@ function workflowIo(meta) {
|
|
|
648
633
|
const validateInput = meta.validateInput;
|
|
649
634
|
return {
|
|
650
635
|
validateAtStart: parseInput || validateInput ? async (input) => {
|
|
651
|
-
|
|
652
|
-
await validateInput?.(
|
|
636
|
+
const parsed = parseInput ? await parseInput(input) : input;
|
|
637
|
+
await validateInput?.(parsed);
|
|
653
638
|
} : void 0,
|
|
654
639
|
wrap: /* @__PURE__ */ __name((body) => !parseInput && !parseOutput ? body : async (ctx, input) => {
|
|
655
640
|
const output = await body(ctx, parseInput ? await parseInput(input) : input);
|
|
@@ -2210,6 +2195,7 @@ var TimerPoller = class {
|
|
|
2210
2195
|
this.options = options;
|
|
2211
2196
|
}
|
|
2212
2197
|
async onApplicationBootstrap() {
|
|
2198
|
+
for (const s of this.options.schedules ?? []) (0, import_nestjs_durable_core13.workflowName)(s.workflow);
|
|
2213
2199
|
if (!isDrivingOperator(this.options)) return;
|
|
2214
2200
|
this.unsubscribeEnqueued = this.engine.onEnqueued((runId) => {
|
|
2215
2201
|
void this.engine.runOne(runId).catch((error) => {
|
|
@@ -3119,7 +3105,11 @@ var import_nestjs_durable_core18 = require("@dudousxd/nestjs-durable-core");
|
|
|
3119
3105
|
isOperatorRole,
|
|
3120
3106
|
isStepInterceptor,
|
|
3121
3107
|
onErrorCodesOf,
|
|
3108
|
+
prevCronFireMs,
|
|
3122
3109
|
readSearchAttributes,
|
|
3110
|
+
runSchedules,
|
|
3111
|
+
scheduleRunIdAt,
|
|
3112
|
+
scheduledRunId,
|
|
3123
3113
|
thinWorkerProviders,
|
|
3124
3114
|
unavailableRunGateway
|
|
3125
3115
|
});
|