@lunora/workflow 1.0.0-alpha.2 → 1.0.0-alpha.20

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.
Files changed (28) hide show
  1. package/LICENSE.md +6 -0
  2. package/dist/do/index.d.mts +16 -16
  3. package/dist/do/index.d.ts +16 -16
  4. package/dist/do/index.mjs +1 -32
  5. package/dist/index.d.mts +127 -132
  6. package/dist/index.d.ts +127 -132
  7. package/dist/index.mjs +1 -8
  8. package/dist/packem_shared/MAX_BRANCHES-L0FzeGTH.mjs +1 -0
  9. package/dist/packem_shared/NonRetryableError-CXD-mZe4.mjs +1 -0
  10. package/dist/packem_shared/WorkflowsRestError--PIoe9uw.mjs +1 -0
  11. package/dist/packem_shared/branch-marker-B2lebQA6.mjs +1 -0
  12. package/dist/packem_shared/createRunStep-CzGKC1eZ.mjs +1 -0
  13. package/dist/packem_shared/createWorkflowContext-Dw8a1U68.mjs +1 -0
  14. package/dist/packem_shared/createWorkflowRunContext-BNh1APpj.mjs +1 -0
  15. package/dist/packem_shared/createWorkflows-3djec-oS.mjs +1 -0
  16. package/dist/packem_shared/defineStep-rJ0XPdAx.mjs +1 -0
  17. package/dist/packem_shared/defineWorkflow-fBuCDkGT.mjs +1 -0
  18. package/dist/packem_shared/{types.d-CQO_koGe.d.mts → types.d-DZlXmeGi.d.mts} +161 -80
  19. package/dist/packem_shared/{types.d-CQO_koGe.d.ts → types.d-DZlXmeGi.d.ts} +161 -80
  20. package/package.json +4 -3
  21. package/dist/packem_shared/NonRetryableError-Dn2dTyBS.mjs +0 -27
  22. package/dist/packem_shared/WorkflowsRestError-b06i7K5j.mjs +0 -118
  23. package/dist/packem_shared/createRunStep-8jOXxP2o.mjs +0 -54
  24. package/dist/packem_shared/createWorkflowContext-D6thzmlF.mjs +0 -14
  25. package/dist/packem_shared/createWorkflowLogger-DR8P4ZoY.mjs +0 -76
  26. package/dist/packem_shared/createWorkflows-BoSYVIXg.mjs +0 -23
  27. package/dist/packem_shared/defineStep-DJQtLw7g.mjs +0 -28
  28. package/dist/packem_shared/defineWorkflow-DbUC-oCN.mjs +0 -15
@@ -1,23 +0,0 @@
1
- const handleFor = (binding) => {
2
- return {
3
- create: async (options) => binding.create(options),
4
- createBatch: async (batch) => binding.createBatch(batch),
5
- get: async (id) => binding.get(id)
6
- };
7
- };
8
- const createWorkflows = (options) => {
9
- const bindings = options.bindings ?? {};
10
- return {
11
- get: (name) => {
12
- const binding = bindings[name];
13
- if (binding === void 0) {
14
- const known = Object.keys(bindings);
15
- const suffix = known.length === 0 ? "no workflows are declared" : `known workflows: ${known.join(", ")}`;
16
- throw new Error(`@lunora/workflow: no workflow named "${name}" (${suffix})`);
17
- }
18
- return handleFor(binding);
19
- }
20
- };
21
- };
22
-
23
- export { createWorkflows as default };
@@ -1,28 +0,0 @@
1
- const defineStep = (name, config) => {
2
- if (typeof name !== "string" || name.length === 0) {
3
- throw new TypeError("defineStep: `name` must be a non-empty string (the durable step label)");
4
- }
5
- const declaredArgs = config.args;
6
- if (typeof declaredArgs !== "object" || declaredArgs === null) {
7
- throw new TypeError("defineStep: `args` must be a validator map (e.g. `{ id: v.string() }`)");
8
- }
9
- if (typeof config.handler !== "function") {
10
- throw new TypeError("defineStep: `handler` must be a function (the step body)");
11
- }
12
- if (config.rollback !== void 0 && typeof config.rollback !== "function") {
13
- throw new TypeError("defineStep: `rollback` must be a function when provided");
14
- }
15
- return {
16
- args: config.args,
17
- config: config.config,
18
- handler: config.handler,
19
- isLunoraStep: true,
20
- name,
21
- returns: config.returns,
22
- rollback: config.rollback,
23
- rollbackConfig: config.rollbackConfig
24
- };
25
- };
26
- const isStepDefinition = (value) => typeof value === "object" && value !== null && value.isLunoraStep === true;
27
-
28
- export { defineStep, isStepDefinition };
@@ -1,15 +0,0 @@
1
- const workflowClassName = (exportName) => `${exportName.charAt(0).toUpperCase()}${exportName.slice(1)}Workflow`;
2
- const workflowBindingName = (exportName) => `WORKFLOW_${exportName.replaceAll(/(?<=[a-z0-9])(?=[A-Z])/g, "_").toUpperCase()}`;
3
- const workflowDefaultName = (exportName) => exportName.replaceAll(/(?<=[a-z0-9])(?=[A-Z])/g, "-").toLowerCase();
4
- const defineWorkflow = (config) => {
5
- if (typeof config.handler !== "function") {
6
- throw new TypeError("defineWorkflow: `handler` must be a function (the workflow body)");
7
- }
8
- if (config.name !== void 0 && (typeof config.name !== "string" || config.name.length === 0)) {
9
- throw new TypeError("defineWorkflow: `name` must be a non-empty string when provided");
10
- }
11
- return { ...config, isLunoraWorkflow: true };
12
- };
13
- const isWorkflowDefinition = (value) => typeof value === "object" && value !== null && value.isLunoraWorkflow === true;
14
-
15
- export { defineWorkflow, isWorkflowDefinition, workflowBindingName, workflowClassName, workflowDefaultName };