@acmekit/workflows-sdk 2.13.36 → 2.13.38

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 (80) hide show
  1. package/dist/helper/type.d.ts +5 -15
  2. package/dist/helper/type.d.ts.map +1 -1
  3. package/dist/helper/workflow-export.d.ts +4 -1
  4. package/dist/helper/workflow-export.d.ts.map +1 -1
  5. package/dist/helper/workflow-export.js +42 -37
  6. package/dist/helper/workflow-export.js.map +1 -1
  7. package/dist/index.d.ts +0 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +0 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/tsconfig.tsbuildinfo +1 -1
  12. package/dist/utils/composer/create-step.d.ts +14 -21
  13. package/dist/utils/composer/create-step.d.ts.map +1 -1
  14. package/dist/utils/composer/create-step.js +16 -70
  15. package/dist/utils/composer/create-step.js.map +1 -1
  16. package/dist/utils/composer/create-workflow.d.ts +17 -13
  17. package/dist/utils/composer/create-workflow.d.ts.map +1 -1
  18. package/dist/utils/composer/create-workflow.js +12 -74
  19. package/dist/utils/composer/create-workflow.js.map +1 -1
  20. package/dist/utils/composer/helpers/create-step-handler.d.ts +1 -1
  21. package/dist/utils/composer/helpers/create-step-handler.d.ts.map +1 -1
  22. package/dist/utils/composer/helpers/create-step-handler.js +97 -52
  23. package/dist/utils/composer/helpers/create-step-handler.js.map +1 -1
  24. package/dist/utils/composer/helpers/workflow-response.d.ts +4 -27
  25. package/dist/utils/composer/helpers/workflow-response.d.ts.map +1 -1
  26. package/dist/utils/composer/helpers/workflow-response.js +1 -14
  27. package/dist/utils/composer/helpers/workflow-response.js.map +1 -1
  28. package/dist/utils/composer/index.d.ts +4 -4
  29. package/dist/utils/composer/index.d.ts.map +1 -1
  30. package/dist/utils/composer/index.js +7 -4
  31. package/dist/utils/composer/index.js.map +1 -1
  32. package/dist/utils/composer/metadata.d.ts +37 -0
  33. package/dist/utils/composer/metadata.d.ts.map +1 -0
  34. package/dist/utils/composer/metadata.js +134 -0
  35. package/dist/utils/composer/metadata.js.map +1 -0
  36. package/dist/utils/composer/query.d.ts +38 -0
  37. package/dist/utils/composer/query.d.ts.map +1 -0
  38. package/dist/utils/composer/query.js +55 -0
  39. package/dist/utils/composer/query.js.map +1 -0
  40. package/dist/utils/composer/signal.d.ts +42 -0
  41. package/dist/utils/composer/signal.d.ts.map +1 -0
  42. package/dist/utils/composer/signal.js +117 -0
  43. package/dist/utils/composer/signal.js.map +1 -0
  44. package/dist/utils/composer/type.d.ts +35 -8
  45. package/dist/utils/composer/type.d.ts.map +1 -1
  46. package/dist/utils/composer/type.js +12 -0
  47. package/dist/utils/composer/type.js.map +1 -1
  48. package/package.json +6 -6
  49. package/dist/testing/index.d.ts +0 -4
  50. package/dist/testing/index.d.ts.map +0 -1
  51. package/dist/testing/index.js +0 -20
  52. package/dist/testing/index.js.map +0 -1
  53. package/dist/testing/mock-step.d.ts +0 -26
  54. package/dist/testing/mock-step.d.ts.map +0 -1
  55. package/dist/testing/mock-step.js +0 -96
  56. package/dist/testing/mock-step.js.map +0 -1
  57. package/dist/testing/types.d.ts +0 -51
  58. package/dist/testing/types.d.ts.map +0 -1
  59. package/dist/testing/types.js +0 -3
  60. package/dist/testing/types.js.map +0 -1
  61. package/dist/testing/workflow-test-runner.d.ts +0 -35
  62. package/dist/testing/workflow-test-runner.d.ts.map +0 -1
  63. package/dist/testing/workflow-test-runner.js +0 -99
  64. package/dist/testing/workflow-test-runner.js.map +0 -1
  65. package/dist/utils/composer/for-each.d.ts +0 -25
  66. package/dist/utils/composer/for-each.d.ts.map +0 -1
  67. package/dist/utils/composer/for-each.js +0 -50
  68. package/dist/utils/composer/for-each.js.map +0 -1
  69. package/dist/utils/composer/pipe.d.ts +0 -24
  70. package/dist/utils/composer/pipe.d.ts.map +0 -1
  71. package/dist/utils/composer/pipe.js +0 -11
  72. package/dist/utils/composer/pipe.js.map +0 -1
  73. package/dist/utils/composer/race.d.ts +0 -19
  74. package/dist/utils/composer/race.d.ts.map +0 -1
  75. package/dist/utils/composer/race.js +0 -43
  76. package/dist/utils/composer/race.js.map +0 -1
  77. package/dist/utils/composer/retry.d.ts +0 -36
  78. package/dist/utils/composer/retry.d.ts.map +0 -1
  79. package/dist/utils/composer/retry.js +0 -27
  80. package/dist/utils/composer/retry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"create-workflow.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/create-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAGxB,MAAM,wBAAwB,CAAA;AAkB/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAGL,cAAc,EAGd,YAAY,EACb,MAAM,QAAQ,CAAA;AAEf,8EAA8E;AAC9E,KAAK,wBAAwB,CAAC,CAAC,IAC7B,CAAC,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,OAAO,CAAA;AAE7D,+FAA+F;AAC/F,KAAK,uBAAuB,CAAC,CAAC,IAC5B,CAAC,SAAS,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,GACxC,CAAC,SAAS,SAAS,GAAG,EAAE,GACtB,CAAC,GACD,SAAS,EAAE,GACb,SAAS,EAAE,CAAA;AAgBjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,wBAAgB,cAAc,CAC5B,KAAK,EACL,eAAe,GAAG,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,SAAS,GAAG,EAAE,CAAC;AAElE;;GAEG;AACH,YAAY,EAAE,MAAM,GAAG,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,uBAAuB,CAAC;AACnE;;;;GAIG;AACH,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,eAAe,GACxD,cAAc,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AAe,CAAC,EACzC,uBAAuB,CAAC,eAAe,CAAC,CACzC,CAAA;AAGD,wBAAgB,cAAc,CAC5B,KAAK,EACL,eAAe,GAAG,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,SAAS,GAAG,EAAE,CAAC,EAElE,YAAY,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,uBAAuB,EACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,eAAe,GACxD,cAAc,CACf,KAAK,EACL,wBAAwB,CAAC,eAAe,CAAC,EACzC,uBAAuB,CAAC,eAAe,CAAC,CACzC,CAAA"}
@@ -15,73 +15,17 @@ const buildTransactionId = (step, stepContext) => {
15
15
  (stepContext.transactionId ?? (0, ulid_1.ulid)()) +
16
16
  (stepContext.attempt > 1 ? `-attempt-${stepContext.attempt}` : ""));
17
17
  };
18
- /**
19
- * This function creates a workflow with the provided name and a constructor function.
20
- * The constructor function builds the workflow from steps created by the {@link createStep} function.
21
- * The returned workflow is an exported workflow of type {@link ReturnWorkflow}, meaning it's not executed right away. To execute it,
22
- * invoke the exported workflow, then run its `run` method.
23
- *
24
- * @typeParam TData - The type of the input passed to the composer function.
25
- * @typeParam TComposerReturn - Inferred from the composer return type; used to derive result and hooks for workflow typing.
26
- *
27
- * @returns The created workflow. You can later execute the workflow by invoking it, then using its `run` method.
28
- *
29
- * @example
30
- * import {
31
- * createWorkflow,
32
- * WorkflowResponse
33
- * } from "@acmekit/framework/workflows-sdk"
34
- * import { AcmeKitRequest, AcmeKitResponse } from "@acmekit/framework/http"
35
- * import {
36
- * createProductStep,
37
- * getProductStep,
38
- * } from "./steps"
39
- *
40
- * interface WorkflowInput {
41
- * title: string
42
- * }
43
- *
44
- * const myWorkflow = createWorkflow(
45
- * "my-workflow",
46
- * (input: WorkflowInput) => {
47
- * // Everything here will be executed and resolved later
48
- * // during the execution. Including the data access.
49
- *
50
- * const product = createProductStep(input)
51
- * return new WorkflowResponse(getProductStep(product.id))
52
- * }
53
- * )
54
- *
55
- * export async function GET(
56
- * req: AcmeKitRequest,
57
- * res: AcmeKitResponse
58
- * ) {
59
- * const { result: product } = await myWorkflow(req.scope)
60
- * .run({
61
- * input: {
62
- * title: "Shirt"
63
- * }
64
- * })
65
- *
66
- * res.json({
67
- * product
68
- * })
69
- * }
70
- */
71
- function createWorkflow(
72
- /**
73
- * The name of the workflow or its configuration.
74
- */
75
- nameOrConfig,
76
- /**
77
- * The constructor function that is executed when the `run` method in {@link ReturnWorkflow} is used.
78
- * The function can't be an arrow function or an asynchronus function. It also can't directly manipulate data.
79
- * You'll have to use the {@link transform} function if you need to directly manipulate data.
80
- */
81
- composer) {
18
+ // Implementation signature
19
+ function createWorkflow(nameOrConfig, composer) {
82
20
  const fileSourcePath = (0, utils_1.getCallerFilePath)();
83
21
  const name = (0, utils_1.isString)(nameOrConfig) ? nameOrConfig : nameOrConfig.name;
84
22
  const options = (0, utils_1.isString)(nameOrConfig) ? {} : nameOrConfig;
23
+ const inputSchema = (0, utils_1.isString)(nameOrConfig)
24
+ ? undefined
25
+ : nameOrConfig.inputSchema;
26
+ const outputSchema = (0, utils_1.isString)(nameOrConfig)
27
+ ? undefined
28
+ : nameOrConfig.outputSchema;
85
29
  (0, utils_1.registerDevServerResource)({
86
30
  sourcePath: fileSourcePath,
87
31
  id: name,
@@ -137,7 +81,9 @@ composer) {
137
81
  const workflow = (0, helper_1.exportWorkflow)(name, returnedStep, {
138
82
  wrappedInput: true,
139
83
  sourcePath: fileSourcePath,
140
- });
84
+ inputSchema,
85
+ outputSchema,
86
+ }, context.queryRegistrations_);
141
87
  const mainFlow = (container) => {
142
88
  const workflow_ = workflow(container);
143
89
  const expandedFlow = workflow_;
@@ -146,6 +92,7 @@ composer) {
146
92
  };
147
93
  return expandedFlow;
148
94
  };
95
+ mainFlow.__queryRegistrations__ = context.queryRegistrations_ ?? [];
149
96
  mainFlow.hooks = {};
150
97
  for (const hook of context.hooks_.declared) {
151
98
  mainFlow.hooks[hook] = context.hooksCallback_[hook].bind(context);
@@ -190,15 +137,6 @@ composer) {
190
137
  context: executionContext,
191
138
  });
192
139
  }
193
- // Attach sub-workflow error context for visibility (4.3.1)
194
- if (transaction.errors?.length) {
195
- for (const err of transaction.errors) {
196
- if (err?.error) {
197
- err.error.parentStep = step.__step__;
198
- err.error.subWorkflowId = name;
199
- }
200
- }
201
- }
202
140
  return new step_response_1.StepResponse(transaction.result, isAsync ? stepContext.transactionId : transaction);
203
141
  }, async (transaction, stepContext) => {
204
142
  // The step itself has failed, there is nothing to revert
@@ -1 +1 @@
1
- {"version":3,"file":"create-workflow.js","sourceRoot":"","sources":["../../../src/utils/composer/create-workflow.ts"],"names":[],"mappings":";;AAgHA,wCA+NC;AA/UD,0DAI+B;AAM/B,0CAMuB;AACvB,+BAA2B;AAC3B,yCAA6D;AAC7D,+CAA0C;AAC1C,2CAAyC;AACzC,2DAAsD;AAuBtD,MAAM,CAAC,0BAAkB,CAAC,oCAAoC,CAAC,GAAG,IAAI,CAAA;AAEtE,MAAM,kBAAkB,GAAG,CACzB,IAA0B,EAC1B,WAAiC,EACjC,EAAE;IACF,OAAO,CACL,IAAI,CAAC,QAAQ;QACb,GAAG;QACH,CAAC,WAAW,CAAC,aAAa,IAAI,IAAA,WAAI,GAAE,CAAC;QACrC,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACnE,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,SAAgB,cAAc;AAI5B;;GAEG;AACH,YAAmE;AACnE;;;;GAIG;AACH,QAAyD;IAMzD,MAAM,cAAc,GAAG,IAAA,yBAAiB,GAAY,CAAA;IACpD,MAAM,IAAI,GAAG,IAAA,gBAAQ,EAAC,YAAY,CAAC,CAAC,CAAC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C;gBACN,MAAM,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;oBAC/B,WAAW,EAAE,CAAE,WAAmC,IAAI,EAAE,CAAC;wBACvD,EAAE,WAAW;oBACf,aAAa,EAAE,gBAAgB,CAAC,aAAa;oBAC7C,SAAS;oBACT,OAAO,EAAE,gBAAgB;iBAC1B,CAAC,CAAA;YACJ,CAAC;YAED,OAAM;QACR,CAAC,CACF,CAAC,KAAK,CAEN,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;IAED,OAAO,QAIN,CAAA;AACH,CAAC"}
@@ -4,7 +4,7 @@ import { CreateWorkflowComposerContext, WorkflowData } from "../type";
4
4
  import { StepResponse } from "./step-response";
5
5
  export declare function createStepHandler<TInvokeInput, TStepInput extends {
6
6
  [K in keyof TInvokeInput]: WorkflowData<TInvokeInput[K]>;
7
- }, TInvokeResultOutput, TInvokeResultCompensateInput>(this: CreateWorkflowComposerContext, { stepName, input, invokeFn, compensateFn, }: ApplyStepOptions<TStepInput, TInvokeInput, TInvokeResultOutput, TInvokeResultCompensateInput>): {
7
+ }, TInvokeResultOutput, TInvokeResultCompensateInput>(this: CreateWorkflowComposerContext, { stepName, input, invokeFn, compensateFn, inputSchema, outputSchema, }: ApplyStepOptions<TStepInput, TInvokeInput, TInvokeResultOutput, TInvokeResultCompensateInput>): {
8
8
  invoke: (stepArguments: WorkflowStepHandlerArguments) => Promise<{
9
9
  __type: string;
10
10
  output: StepResponse<any, any> | {
@@ -1 +1 @@
1
- {"version":3,"file":"create-step-handler.d.ts","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/create-step-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EACL,6BAA6B,EAE7B,YAAY,EACb,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA8C9C,wBAAgB,iBAAiB,CAC/B,YAAY,EACZ,UAAU,SAAS;KAChB,CAAC,IAAI,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CACzD,EACD,mBAAmB,EACnB,4BAA4B,EAE5B,IAAI,EAAE,6BAA6B,EACnC,EACE,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,YAAY,GACb,EAAE,gBAAgB,CACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,4BAA4B,CAC7B;4BAG+B,4BAA4B;;;;;;;;iCAqChC,4BAA4B;;;EAiCzD"}
1
+ {"version":3,"file":"create-step-handler.d.ts","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/create-step-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAG7B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EACL,6BAA6B,EAE7B,YAAY,EAEb,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAgD9C,wBAAgB,iBAAiB,CAC/B,YAAY,EACZ,UAAU,SAAS;KAChB,CAAC,IAAI,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CACzD,EACD,mBAAmB,EACnB,4BAA4B,EAE5B,IAAI,EAAE,6BAA6B,EACnC,EACE,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,YAAY,GACb,EAAE,gBAAgB,CACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,4BAA4B,CAC7B;4BAG+B,4BAA4B;;;;;;;;iCA6EhC,4BAA4B;;;EAwCzD"}
@@ -1,23 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createStepHandler = createStepHandler;
4
+ const orchestration_1 = require("@acmekit/orchestration");
4
5
  const utils_1 = require("@acmekit/utils");
6
+ const type_1 = require("../type");
5
7
  const resolve_value_1 = require("./resolve-value");
6
- function buildStepContext({ action, stepArguments, }) {
7
- const metadata = stepArguments.metadata;
8
- const idempotencyKey = metadata.idempotency_key;
8
+ const step_response_1 = require("./step-response");
9
+ function buildStepContext({ action, stepArguments, workflowMetadata, }) {
10
+ const transactionMetadata = stepArguments.metadata;
11
+ const idempotencyKey = transactionMetadata.idempotency_key;
9
12
  stepArguments.context.idempotencyKey = idempotencyKey;
10
13
  const flow = stepArguments.transaction.getFlow();
11
14
  const flowMetadata = flow?.metadata;
12
15
  const stepDefinition = stepArguments.step.definition;
13
16
  const executionContext = {
14
- workflowId: metadata.model_id,
15
- stepName: metadata.action,
17
+ workflowId: transactionMetadata.model_id,
18
+ stepName: transactionMetadata.action,
16
19
  action,
17
20
  idempotencyKey,
18
- attempt: metadata.attempt,
21
+ attempt: transactionMetadata.attempt,
19
22
  container: stepArguments.container,
20
- metadata,
23
+ metadata: workflowMetadata,
24
+ " transactionMetadata": transactionMetadata,
21
25
  eventGroupId: flowMetadata?.eventGroupId ?? stepArguments.context.eventGroupId,
22
26
  parentStepIdempotencyKey: flowMetadata?.parentStepIdempotencyKey,
23
27
  preventReleaseEvents: flowMetadata?.preventReleaseEvents ?? false,
@@ -25,69 +29,110 @@ function buildStepContext({ action, stepArguments, }) {
25
29
  runId: flow.runId,
26
30
  context: stepArguments.context,
27
31
  " stepDefinition": stepDefinition,
28
- stepMetadata: stepDefinition.metadata,
29
32
  " getStepResult"(stepId, action = "invoke") {
30
33
  return stepArguments[action][stepId]?.output?.output;
31
34
  },
32
35
  };
33
36
  return executionContext;
34
37
  }
35
- function createStepHandler({ stepName, input, invokeFn, compensateFn, }) {
38
+ function createStepHandler({ stepName, input, invokeFn, compensateFn, inputSchema, outputSchema, }) {
36
39
  const handler = {
37
40
  invoke: async (stepArguments) => {
38
- const executionContext = buildStepContext({
39
- action: "invoke",
40
- stepArguments,
41
- });
42
- let argInput = {};
43
- if (input) {
44
- argInput = (0, resolve_value_1.resolveValue)(input, stepArguments);
45
- if (argInput instanceof Promise) {
46
- argInput = await argInput;
41
+ const flow = stepArguments.transaction.getFlow();
42
+ const workflowMetadata = new orchestration_1.WorkflowMetadata(flow);
43
+ return (0, orchestration_1.runWithMetadata)(workflowMetadata, async () => {
44
+ const executionContext = buildStepContext({
45
+ action: "invoke",
46
+ stepArguments,
47
+ workflowMetadata,
48
+ });
49
+ let argInput = {};
50
+ if (input) {
51
+ argInput = (0, resolve_value_1.resolveValue)(input, stepArguments);
52
+ if (argInput instanceof Promise) {
53
+ argInput = await argInput;
54
+ }
47
55
  }
48
- }
49
- const stepResponse = await invokeFn.apply(this, [
50
- argInput,
51
- executionContext,
52
- ]);
53
- if (!stepResponse || typeof stepResponse !== "object") {
56
+ if (inputSchema) {
57
+ try {
58
+ argInput = (0, type_1.runSchema)(inputSchema, argInput);
59
+ }
60
+ catch (e) {
61
+ const err = e instanceof Error ? e : new Error(String(e));
62
+ err.message = `Step "${stepName}" input validation failed: ${err.message}`;
63
+ throw err;
64
+ }
65
+ }
66
+ let stepResponse = await invokeFn.apply(this, [
67
+ argInput,
68
+ executionContext,
69
+ ]);
70
+ if (outputSchema && stepResponse) {
71
+ const isStepResp = stepResponse &&
72
+ typeof stepResponse === "object" &&
73
+ stepResponse.__type ===
74
+ utils_1.OrchestrationUtils.SymbolWorkflowStepResponse;
75
+ const raw = isStepResp ? stepResponse.output : stepResponse;
76
+ try {
77
+ const parsed = (0, type_1.runSchema)(outputSchema, raw);
78
+ if (isStepResp) {
79
+ stepResponse = new step_response_1.StepResponse(parsed, stepResponse.compensateInput);
80
+ }
81
+ else {
82
+ stepResponse = parsed;
83
+ }
84
+ }
85
+ catch (e) {
86
+ const err = e instanceof Error ? e : new Error(String(e));
87
+ err.message = `Step "${stepName}" output validation failed: ${err.message}`;
88
+ throw err;
89
+ }
90
+ }
91
+ if (!stepResponse || typeof stepResponse !== "object") {
92
+ return {
93
+ __type: utils_1.OrchestrationUtils.SymbolWorkflowWorkflowData,
94
+ output: stepResponse,
95
+ };
96
+ }
97
+ const stepResponseJSON = stepResponse.__type === utils_1.OrchestrationUtils.SymbolWorkflowStepResponse
98
+ ? stepResponse.toJSON()
99
+ : stepResponse;
54
100
  return {
55
101
  __type: utils_1.OrchestrationUtils.SymbolWorkflowWorkflowData,
56
- output: stepResponse,
102
+ output: stepResponseJSON,
57
103
  };
58
- }
59
- const stepResponseJSON = stepResponse.__type === utils_1.OrchestrationUtils.SymbolWorkflowStepResponse
60
- ? stepResponse.toJSON()
61
- : stepResponse;
62
- return {
63
- __type: utils_1.OrchestrationUtils.SymbolWorkflowWorkflowData,
64
- output: stepResponseJSON,
65
- };
104
+ });
66
105
  },
67
106
  compensate: compensateFn
68
107
  ? async (stepArguments) => {
69
- const executionContext = buildStepContext({
70
- action: "compensate",
71
- stepArguments,
72
- });
73
- const stepOutput = stepArguments.invoke[stepName]?.output;
74
- if (!stepOutput) {
108
+ const flow = stepArguments.transaction.getFlow();
109
+ const workflowMetadata = new orchestration_1.WorkflowMetadata(flow);
110
+ return (0, orchestration_1.runWithMetadata)(workflowMetadata, async () => {
111
+ const executionContext = buildStepContext({
112
+ action: "compensate",
113
+ stepArguments,
114
+ workflowMetadata,
115
+ });
116
+ const stepOutput = stepArguments.invoke[stepName]?.output;
117
+ if (!stepOutput) {
118
+ const output = await compensateFn.apply(this, [
119
+ stepOutput,
120
+ executionContext,
121
+ ]);
122
+ return { output };
123
+ }
124
+ const invokeResult = stepOutput.__type ===
125
+ utils_1.OrchestrationUtils.SymbolWorkflowStepResponse
126
+ ? stepOutput.compensateInput
127
+ : stepOutput;
75
128
  const output = await compensateFn.apply(this, [
76
- stepOutput,
129
+ invokeResult,
77
130
  executionContext,
78
131
  ]);
79
- return { output };
80
- }
81
- const invokeResult = stepOutput.__type === utils_1.OrchestrationUtils.SymbolWorkflowStepResponse
82
- ? stepOutput.compensateInput
83
- : stepOutput;
84
- const output = await compensateFn.apply(this, [
85
- invokeResult,
86
- executionContext,
87
- ]);
88
- return {
89
- output,
90
- };
132
+ return {
133
+ output,
134
+ };
135
+ });
91
136
  }
92
137
  : undefined,
93
138
  };
@@ -1 +1 @@
1
- {"version":3,"file":"create-step-handler.js","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/create-step-handler.ts"],"names":[],"mappings":";;AAuDA,8CA4FC;AAlJD,0CAAmD;AAOnD,mDAA8C;AAG9C,SAAS,gBAAgB,CAAC,EACxB,MAAM,EACN,aAAa,GAId;IACC,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAA;IACvC,MAAM,cAAc,GAAG,QAAQ,CAAC,eAAe,CAAA;IAE/C,aAAa,CAAC,OAAQ,CAAC,cAAc,GAAG,cAAc,CAAA;IAEtD,MAAM,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;IAChD,MAAM,YAAY,GAAG,IAAI,EAAE,QAAQ,CAAA;IACnC,MAAM,cAAc,GAAG,aAAa,CAAC,IAAI,CAAC,UAAU,CAAA;IAEpD,MAAM,gBAAgB,GAAyB;QAC7C,UAAU,EAAE,QAAQ,CAAC,QAAQ;QAC7B,QAAQ,EAAE,QAAQ,CAAC,MAAM;QACzB,MAAM;QACN,cAAc;QACd,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,aAAa,CAAC,SAAS;QAClC,QAAQ;QACR,YAAY,EACV,YAAY,EAAE,YAAY,IAAI,aAAa,CAAC,OAAQ,CAAC,YAAY;QACnE,wBAAwB,EAAE,YAAY,EAAE,wBAAkC;QAC1E,oBAAoB,EAAE,YAAY,EAAE,oBAAoB,IAAI,KAAK;QACjE,aAAa,EAAE,aAAa,CAAC,OAAQ,CAAC,aAAa;QACnD,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE,aAAa,CAAC,OAAQ;QAC/B,iBAAiB,EAAE,cAAc;QACjC,YAAY,EAAE,cAAc,C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AC;QACD,UAAU,EAAE,YAAY;YACtB,CAAC,CAAC,KAAK,EAAE,aAA2C,EAAE,EAAE;gBACpD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;oBACxC,MAAM,EAAE,YAAY;oBACpB,aAAa;iBACd,CAAC,CAAA;gBAEF,MAAM,UAAU,GAAI,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAS,EAAE,MAAM,CAAA;gBAElE,IAAI,CAAC,UAAU,EAAE,CAAC;oBAChB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE;wBAC5C,UAAU;wBACV,gBAAgB;qBACjB,CAAC,CAAA;oBACF,OAAO,EAAE,MAAM,EAAE,CAAA;gBACnB,CAAC;gBAED,MAAM,YAAY,GAChB,UAAU,CAAC,MAAM,KAAK,0BAAkB,CAAC,0BAA0B;oBACjE,CAAC,CAAC,UAAU,CAAC,eAAe;oBAC5B,CAAC,CAAC,UAAU,CAAA;gBAEhB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE;oBAC5C,YAAY;oBACZ,gBAAgB;iBACjB,CAAC,CAAA;gBACF,OAAO;oBACL,MAAM;iBACP,CAAA;YACH,CAAC;YACH,CAAC,CAAC,SAAS;KACd,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
1
+ {"version":3,"file":"create-step-handler.js","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/create-step-handler.ts"],"names":[],"mappings":";;AA8DA,8CA6IC;AA3MD,0DAI+B;AAC/B,0CAAmD;AAEnD,kCAKgB;AAChB,mDAA8C;AAC9C,mDAA8C;AAE9C,SAAS,gBAAgB,CAAC,EACxB,MAAM,EACN,aAAa,EACb,gBAAgB,GAKjB;IACC,MAAM,mBAAmB,GAAG,aAAa,CAAC,QAAQ,CAAA;IAClD,MAAM,cAAc,GAAG,mBAAmB,CAAC,eAAe,CAAA;IAE1D,aAAa,CAAC,OAAQ,CAAC,cAAc,GAAG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AA;gBAChD,MAAM,gBAAgB,GAAG,IAAI,gCAAgB,CAAC,IAAI,CAAC,CAAA;gBAEnD,OAAO,IAAA,+BAAe,EAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;oBAClD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;wBACxC,MAAM,EAAE,YAAY;wBACpB,aAAa;wBACb,gBAAgB;qBACjB,CAAC,CAAA;oBAEF,MAAM,UAAU,GAAI,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAS,EAAE,MAAM,CAAA;oBAElE,IAAI,CAAC,UAAU,EAAE,CAAC;wBAChB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE;4BAC5C,UAAU;4BACV,gBAAgB;yBACjB,CAAC,CAAA;wBACF,OAAO,EAAE,MAAM,EAAE,CAAA;oBACnB,CAAC;oBAED,MAAM,YAAY,GAChB,UAAU,CAAC,MAAM;wBACjB,0BAAkB,CAAC,0BAA0B;wBAC3C,CAAC,CAAC,UAAU,CAAC,eAAe;wBAC5B,CAAC,CAAC,UAAU,CAAA;oBAEhB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE;wBAC5C,YAAY;wBACZ,gBAAgB;qBACjB,CAAC,CAAA;oBACF,OAAO;wBACL,MAAM;qBACP,CAAA;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC;YACH,CAAC,CAAC,SAAS;KACd,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -1,43 +1,20 @@
1
1
  import { OrchestrationUtils } from "@acmekit/utils";
2
2
  import { WorkflowData, WorkflowDataProperties } from "../type";
3
3
  /**
4
- * Workflow response class encapsulates the return value of a workflow.
5
- *
6
- * Supports optional named output ports for selective output consumption.
7
- *
8
- * @example
9
- * ```ts
10
- * return new WorkflowResponse(primaryResult, {
11
- * hooks: [myHook],
12
- * outputs: {
13
- * created: createdEntities,
14
- * warnings: validationWarnings,
15
- * },
16
- * })
17
- * ```
4
+ * Workflow response class encapsulates the return value of a workflow
18
5
  */
19
- export declare class WorkflowResponse<TResult, const THooks extends readonly unknown[] = [], TOutputs extends Record<string, unknown> = {}> {
6
+ export declare class WorkflowResponse<TResult, const THooks extends readonly unknown[] = []> {
20
7
  $result: WorkflowData<TResult> | {
21
8
  [K in keyof TResult]: WorkflowData<TResult[K]> | WorkflowDataProperties<TResult[K]> | TResult[K];
22
9
  };
23
10
  options?: {
24
- hooks?: THooks;
25
- /**
26
- * Named output ports. Allows consumers to selectively access
27
- * partial outputs from a workflow execution.
28
- */
29
- outputs?: { [K in keyof TOutputs]: WorkflowData<TOutputs[K]> | TOutputs[K]; };
11
+ hooks: THooks;
30
12
  } | undefined;
31
13
  __type: typeof OrchestrationUtils.SymbolAcmeKitWorkflowResponse;
32
14
  constructor($result: WorkflowData<TResult> | {
33
15
  [K in keyof TResult]: WorkflowData<TResult[K]> | WorkflowDataProperties<TResult[K]> | TResult[K];
34
16
  }, options?: {
35
- hooks?: THooks;
36
- /**
37
- * Named output ports. Allows consumers to selectively access
38
- * partial outputs from a workflow execution.
39
- */
40
- outputs?: { [K in keyof TOutputs]: WorkflowData<TOutputs[K]> | TOutputs[K]; };
17
+ hooks: THooks;
41
18
  } | undefined);
42
19
  }
43
20
  //# sourceMappingURL=workflow-response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-response.d.ts","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/workflow-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAgB,CAC3B,OAAO,EACP,KAAK,CAAC,MAAM,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,EAC5C,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE;IAMpC,OAAO,EACV,YAAY,CAAC,OAAO,CAAC,GACrB;SACG,CAAC,IAAI,MAAM,OAAO,GACf,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC;KACf;IACE,OAAO,CAAC,EAAE;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd;;;WAGG;QACH,OAAO,CAAC,EAAE,GACP,CAAC,IAAI,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAC/D,CAAA;KACF;IArBH,MAAM,EAAE,OAAO,kBAAkB,CAAC,6BAA6B,CACb;gBAGzC,OAAO,EACV,YAAY,CAAC,OAAO,CAAC,GACrB;SACG,CAAC,IAAI,MAAM,OAAO,GACf,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC;KACf,EACE,OAAO,CAAC,EAAE;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd;;;WAGG;QACH,OAAO,CAAC,EAAE,GACP,CAAC,IAAI,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAC/D,CAAA;KACF,YAAA;CAEJ"}
1
+ {"version":3,"file":"workflow-response.d.ts","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/workflow-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAE9D;;GAEG;AACH,qBAAa,gBAAgB,CAC3B,OAAO,EACP,KAAK,CAAC,MAAM,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE;IAMnC,OAAO,EACV,YAAY,CAAC,OAAO,CAAC,GACrB;SACG,CAAC,IAAI,MAAM,OAAO,GACf,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC;KACf;IACE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAZpC,MAAM,EAAE,OAAO,kBAAkB,CAAC,6BAA6B,CACb;gBAGzC,OAAO,EACV,YAAY,CAAC,OAAO,CAAC,GACrB;SACG,CAAC,IAAI,MAAM,OAAO,GACf,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC;KACf,EACE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,YAAA;CAErC"}
@@ -3,20 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WorkflowResponse = void 0;
4
4
  const utils_1 = require("@acmekit/utils");
5
5
  /**
6
- * Workflow response class encapsulates the return value of a workflow.
7
- *
8
- * Supports optional named output ports for selective output consumption.
9
- *
10
- * @example
11
- * ```ts
12
- * return new WorkflowResponse(primaryResult, {
13
- * hooks: [myHook],
14
- * outputs: {
15
- * created: createdEntities,
16
- * warnings: validationWarnings,
17
- * },
18
- * })
19
- * ```
6
+ * Workflow response class encapsulates the return value of a workflow
20
7
  */
21
8
  class WorkflowResponse {
22
9
  constructor($result, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-response.js","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/workflow-response.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAGnD;;;;;;;;;;;;;;;GAeG;AACH,MAAa,gBAAgB;IAQ3B,YACS,OAOF,EACE,OASN;QAjBM,YAAO,GAAP,OAAO,CAOT;QACE,YAAO,GAAP,OAAO,CASb;QArBH,WAAM,GACJ,0BAAkB,CAAC,6BAA6B,CAAA;IAqB/C,CAAC;CACL;AA5BD,4CA4BC"}
1
+ {"version":3,"file":"workflow-response.js","sourceRoot":"","sources":["../../../../src/utils/composer/helpers/workflow-response.ts"],"names":[],"mappings":";;;AAAA,0CAAmD;AAGnD;;GAEG;AACH,MAAa,gBAAgB;IAO3B,YACS,OAOF,EACE,OAA2B;QAR3B,YAAO,GAAP,OAAO,CAOT;QACE,YAAO,GAAP,OAAO,CAAoB;QAZpC,WAAM,GACJ,0BAAkB,CAAC,6BAA6B,CAAA;IAY/C,CAAC;CACL;AAlBD,4CAkBC"}
@@ -4,12 +4,12 @@ export * from "./helpers/resolve-value";
4
4
  export * from "./helpers/step-response";
5
5
  export * from "./helpers/workflow-response";
6
6
  export * from "./create-hook";
7
- export * from "./for-each";
8
7
  export * from "./parallelize";
9
- export * from "./pipe";
10
- export * from "./race";
11
- export * from "./retry";
8
+ export * from "./query";
9
+ export * from "./signal";
12
10
  export * from "./transform";
13
11
  export * from "./type";
14
12
  export * from "./when";
13
+ export { metadata } from "./metadata";
14
+ export { WorkflowMetadata } from "@acmekit/orchestration";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
@@ -14,18 +14,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.WorkflowMetadata = exports.metadata = void 0;
17
18
  __exportStar(require("./create-step"), exports);
18
19
  __exportStar(require("./create-workflow"), exports);
19
20
  __exportStar(require("./helpers/resolve-value"), exports);
20
21
  __exportStar(require("./helpers/step-response"), exports);
21
22
  __exportStar(require("./helpers/workflow-response"), exports);
22
23
  __exportStar(require("./create-hook"), exports);
23
- __exportStar(require("./for-each"), exports);
24
24
  __exportStar(require("./parallelize"), exports);
25
- __exportStar(require("./pipe"), exports);
26
- __exportStar(require("./race"), exports);
27
- __exportStar(require("./retry"), exports);
25
+ __exportStar(require("./query"), exports);
26
+ __exportStar(require("./signal"), exports);
28
27
  __exportStar(require("./transform"), exports);
29
28
  __exportStar(require("./type"), exports);
30
29
  __exportStar(require("./when"), exports);
30
+ var metadata_1 = require("./metadata");
31
+ Object.defineProperty(exports, "metadata", { enumerable: true, get: function () { return metadata_1.metadata; } });
32
+ var orchestration_1 = require("@acmekit/orchestration");
33
+ Object.defineProperty(exports, "WorkflowMetadata", { enumerable: true, get: function () { return orchestration_1.WorkflowMetadata; } });
31
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/composer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,oDAAiC;AACjC,0DAAuC;AACvC,0DAAuC;AACvC,8DAA2C;AAC3C,gDAA6B;AAC7B,6CAA0B;AAC1B,gDAA6B;AAC7B,yCAAsB;AACtB,yCAAsB;AACtB,0CAAuB;AACvB,8CAA2B;AAC3B,yCAAsB;AACtB,yCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/composer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,oDAAiC;AACjC,0DAAuC;AACvC,0DAAuC;AACvC,8DAA2C;AAC3C,gDAA6B;AAC7B,gDAA6B;AAC7B,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,yCAAsB;AACtB,yCAAsB;AACtB,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,wDAAyD;AAAhD,iHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,37 @@
1
+ import { WorkflowMetadata } from "@acmekit/orchestration";
2
+ /**
3
+ * Unified metadata accessor. Works in all contexts:
4
+ *
5
+ * 1. **Inside step functions / query handlers / transform callbacks** —
6
+ * Reads and writes go directly to the workflow's `flow.customMetadata`
7
+ * via `AsyncLocalStorage`.
8
+ *
9
+ * 2. **Inside the workflow definition body** (same level as `transform()`,
10
+ * `when()`) — Each write creates a lightweight internal step that
11
+ * executes at runtime. `metadata.get()` creates a transform that
12
+ * returns a `WorkflowData` proxy.
13
+ *
14
+ * 3. **Outside any context** — Safe no-op. Reads return `undefined`,
15
+ * writes are silent.
16
+ *
17
+ * @example
18
+ * import { createStep, createWorkflow, metadata, StepResponse } from "@acmekit/framework/workflows-sdk"
19
+ *
20
+ * const step1 = createStep("step1", async () => {
21
+ * metadata.set("stage", "processing") // direct write
22
+ * return new StepResponse("ok")
23
+ * })
24
+ *
25
+ * const step2 = createStep("step2", async () => {
26
+ * return new StepResponse({ stage: metadata.get("stage") })
27
+ * })
28
+ *
29
+ * createWorkflow("my-wf", (input) => {
30
+ * step1()
31
+ * metadata.set("source", "workflow") // creates internal step
32
+ * const source = metadata.get("source") // creates transform → WorkflowData
33
+ * return step2()
34
+ * })
35
+ */
36
+ export declare const metadata: WorkflowMetadata;
37
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/utils/composer/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEjB,MAAM,wBAAwB,CAAA;AA+G/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,QAAQ,EAAE,gBAcrB,CAAA"}