@workflow/core 4.0.1-beta.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.
Files changed (143) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +3 -0
  3. package/dist/builtins.d.ts +4 -0
  4. package/dist/builtins.d.ts.map +1 -0
  5. package/dist/builtins.js +13 -0
  6. package/dist/builtins.js.map +1 -0
  7. package/dist/create-hook.d.ts +123 -0
  8. package/dist/create-hook.d.ts.map +1 -0
  9. package/dist/create-hook.js +32 -0
  10. package/dist/create-hook.js.map +1 -0
  11. package/dist/define-hook.d.ts +53 -0
  12. package/dist/define-hook.d.ts.map +1 -0
  13. package/dist/define-hook.js +59 -0
  14. package/dist/define-hook.js.map +1 -0
  15. package/dist/events-consumer.d.ts +35 -0
  16. package/dist/events-consumer.d.ts.map +1 -0
  17. package/dist/events-consumer.js +72 -0
  18. package/dist/events-consumer.js.map +1 -0
  19. package/dist/global.d.ts +29 -0
  20. package/dist/global.d.ts.map +1 -0
  21. package/dist/global.js +50 -0
  22. package/dist/global.js.map +1 -0
  23. package/dist/index.d.ts +18 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +18 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/logger.d.ts +31 -0
  28. package/dist/logger.d.ts.map +1 -0
  29. package/dist/logger.js +32 -0
  30. package/dist/logger.js.map +1 -0
  31. package/dist/observability.d.ts +24 -0
  32. package/dist/observability.d.ts.map +1 -0
  33. package/dist/observability.js +126 -0
  34. package/dist/observability.js.map +1 -0
  35. package/dist/parse-name.d.ts +25 -0
  36. package/dist/parse-name.d.ts.map +1 -0
  37. package/dist/parse-name.js +40 -0
  38. package/dist/parse-name.js.map +1 -0
  39. package/dist/private.d.ts +26 -0
  40. package/dist/private.d.ts.map +1 -0
  41. package/dist/private.js +17 -0
  42. package/dist/private.js.map +1 -0
  43. package/dist/runtime/resume-hook.d.ts +71 -0
  44. package/dist/runtime/resume-hook.d.ts.map +1 -0
  45. package/dist/runtime/resume-hook.js +180 -0
  46. package/dist/runtime/resume-hook.js.map +1 -0
  47. package/dist/runtime/start.d.ts +28 -0
  48. package/dist/runtime/start.d.ts.map +1 -0
  49. package/dist/runtime/start.js +57 -0
  50. package/dist/runtime/start.js.map +1 -0
  51. package/dist/runtime/world.d.ts +24 -0
  52. package/dist/runtime/world.d.ts.map +1 -0
  53. package/dist/runtime/world.js +84 -0
  54. package/dist/runtime/world.js.map +1 -0
  55. package/dist/runtime.d.ts +121 -0
  56. package/dist/runtime.d.ts.map +1 -0
  57. package/dist/runtime.js +554 -0
  58. package/dist/runtime.js.map +1 -0
  59. package/dist/schemas.d.ts +29 -0
  60. package/dist/schemas.d.ts.map +1 -0
  61. package/dist/schemas.js +15 -0
  62. package/dist/schemas.js.map +1 -0
  63. package/dist/serialization.d.ts +188 -0
  64. package/dist/serialization.d.ts.map +1 -0
  65. package/dist/serialization.js +725 -0
  66. package/dist/serialization.js.map +1 -0
  67. package/dist/step/context-storage.d.ts +8 -0
  68. package/dist/step/context-storage.d.ts.map +1 -0
  69. package/dist/step/context-storage.js +3 -0
  70. package/dist/step/context-storage.js.map +1 -0
  71. package/dist/step/get-step-metadata.d.ts +38 -0
  72. package/dist/step/get-step-metadata.d.ts.map +1 -0
  73. package/dist/step/get-step-metadata.js +14 -0
  74. package/dist/step/get-step-metadata.js.map +1 -0
  75. package/dist/step/get-workflow-metadata.d.ts +7 -0
  76. package/dist/step/get-workflow-metadata.d.ts.map +1 -0
  77. package/dist/step/get-workflow-metadata.js +12 -0
  78. package/dist/step/get-workflow-metadata.js.map +1 -0
  79. package/dist/step.d.ts +4 -0
  80. package/dist/step.d.ts.map +1 -0
  81. package/dist/step.js +92 -0
  82. package/dist/step.js.map +1 -0
  83. package/dist/symbols.d.ts +9 -0
  84. package/dist/symbols.d.ts.map +1 -0
  85. package/dist/symbols.js +9 -0
  86. package/dist/symbols.js.map +1 -0
  87. package/dist/telemetry/semantic-conventions.d.ts +175 -0
  88. package/dist/telemetry/semantic-conventions.d.ts.map +1 -0
  89. package/dist/telemetry/semantic-conventions.js +121 -0
  90. package/dist/telemetry/semantic-conventions.js.map +1 -0
  91. package/dist/telemetry.d.ts +24 -0
  92. package/dist/telemetry.d.ts.map +1 -0
  93. package/dist/telemetry.js +121 -0
  94. package/dist/telemetry.js.map +1 -0
  95. package/dist/types.d.ts +10 -0
  96. package/dist/types.d.ts.map +1 -0
  97. package/dist/types.js +39 -0
  98. package/dist/types.js.map +1 -0
  99. package/dist/util.d.ts +43 -0
  100. package/dist/util.d.ts.map +1 -0
  101. package/dist/util.js +76 -0
  102. package/dist/util.js.map +1 -0
  103. package/dist/vm/index.d.ts +17 -0
  104. package/dist/vm/index.d.ts.map +1 -0
  105. package/dist/vm/index.js +93 -0
  106. package/dist/vm/index.js.map +1 -0
  107. package/dist/vm/uuid.d.ts +10 -0
  108. package/dist/vm/uuid.d.ts.map +1 -0
  109. package/dist/vm/uuid.js +30 -0
  110. package/dist/vm/uuid.js.map +1 -0
  111. package/dist/workflow/create-hook.d.ts +7 -0
  112. package/dist/workflow/create-hook.d.ts.map +1 -0
  113. package/dist/workflow/create-hook.js +22 -0
  114. package/dist/workflow/create-hook.js.map +1 -0
  115. package/dist/workflow/define-hook.d.ts +10 -0
  116. package/dist/workflow/define-hook.d.ts.map +1 -0
  117. package/dist/workflow/define-hook.js +15 -0
  118. package/dist/workflow/define-hook.js.map +1 -0
  119. package/dist/workflow/get-workflow-metadata.d.ts +17 -0
  120. package/dist/workflow/get-workflow-metadata.d.ts.map +1 -0
  121. package/dist/workflow/get-workflow-metadata.js +11 -0
  122. package/dist/workflow/get-workflow-metadata.js.map +1 -0
  123. package/dist/workflow/hook.d.ts +4 -0
  124. package/dist/workflow/hook.d.ts.map +1 -0
  125. package/dist/workflow/hook.js +101 -0
  126. package/dist/workflow/hook.js.map +1 -0
  127. package/dist/workflow/index.d.ts +10 -0
  128. package/dist/workflow/index.d.ts.map +1 -0
  129. package/dist/workflow/index.js +14 -0
  130. package/dist/workflow/index.js.map +1 -0
  131. package/dist/workflow/writable-stream.d.ts +3 -0
  132. package/dist/workflow/writable-stream.d.ts.map +1 -0
  133. package/dist/workflow/writable-stream.js +12 -0
  134. package/dist/workflow/writable-stream.js.map +1 -0
  135. package/dist/workflow.d.ts +3 -0
  136. package/dist/workflow.d.ts.map +1 -0
  137. package/dist/workflow.js +454 -0
  138. package/dist/workflow.js.map +1 -0
  139. package/dist/writable-stream.d.ts +22 -0
  140. package/dist/writable-stream.d.ts.map +1 -0
  141. package/dist/writable-stream.js +16 -0
  142. package/dist/writable-stream.js.map +1 -0
  143. package/package.json +73 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Vercel, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @workflow/core
2
+
3
+ Core runtime package for [Workflow DevKit](https://useworkflow.dev).
@@ -0,0 +1,4 @@
1
+ export declare function __builtin_response_array_buffer(res: Response): Promise<ArrayBuffer>;
2
+ export declare function __builtin_response_json(res: Response): Promise<unknown>;
3
+ export declare function __builtin_response_text(res: Response): Promise<string>;
4
+ //# sourceMappingURL=builtins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,QAAQ,wBAGlE;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,oBAG1D;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,mBAG1D"}
@@ -0,0 +1,13 @@
1
+ export async function __builtin_response_array_buffer(res) {
2
+ 'use step';
3
+ return res.arrayBuffer();
4
+ }
5
+ export async function __builtin_response_json(res) {
6
+ 'use step';
7
+ return res.json();
8
+ }
9
+ export async function __builtin_response_text(res) {
10
+ 'use step';
11
+ return res.text();
12
+ }
13
+ //# sourceMappingURL=builtins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.js","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,GAAa;IACjE,UAAU,CAAC;IACX,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,GAAa;IACzD,UAAU,CAAC;IACX,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,GAAa;IACzD,UAAU,CAAC;IACX,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,123 @@
1
+ import type { Serializable } from './schemas.js';
2
+ /**
3
+ * An object that can be awaited to receive a value.
4
+ */
5
+ interface Thenable<T> {
6
+ then: Promise<T>['then'];
7
+ }
8
+ /**
9
+ * A `Request` that can be responded to within a workflow
10
+ * step function by calling the `respondWith()` method.
11
+ */
12
+ export interface RequestWithResponse extends Request {
13
+ respondWith: (response: Response) => Promise<void>;
14
+ }
15
+ /**
16
+ * A hook that can be awaited and/or iterated over to receive
17
+ * a value within a workflow from an external system.
18
+ */
19
+ export interface Hook<T = any> extends AsyncIterable<T>, Thenable<T> {
20
+ /**
21
+ * The token used to identify this hook.
22
+ */
23
+ token: string;
24
+ }
25
+ /**
26
+ * A webhook that can be used to suspend and resume the workflow run
27
+ * upon receiving an HTTP request to the specified URL.
28
+ *
29
+ * @see {@link createWebhook}
30
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Request
31
+ */
32
+ export interface Webhook<T extends Request> extends Hook<T> {
33
+ /**
34
+ * The URL that external systems can call to send data to the workflow.
35
+ */
36
+ url: string;
37
+ }
38
+ export interface HookOptions {
39
+ /**
40
+ * Unique token that is used to associate with the hook.
41
+ *
42
+ * When specifying an explicit token, the token should be constructed
43
+ * with information that the dispatching side can reliably reconstruct
44
+ * the token with the information it has available.
45
+ *
46
+ * If not provided, a randomly generated token will be assigned.
47
+ *
48
+ * @example
49
+ *
50
+ * ```ts
51
+ * // Explicit token for a Slack bot (one workflow run per channel)
52
+ * const hook = createHook<SlackMessage>({
53
+ * token: `slack_webhook:${channelId}`,
54
+ * });
55
+ * ```
56
+ */
57
+ token?: string;
58
+ /**
59
+ * Additional user-defined data to include with the hook payload.
60
+ *
61
+ * @example
62
+ *
63
+ * ```ts
64
+ * const hook = createHook<{ name: string }>({
65
+ * metadata: {
66
+ * type: "cat",
67
+ * color: "orange",
68
+ * },
69
+ * });
70
+ * ```
71
+ */
72
+ metadata?: Serializable;
73
+ }
74
+ export interface WebhookOptions extends HookOptions {
75
+ /**
76
+ * If set to a `Response` object, the webhook will automatically
77
+ * respond with the specified response.
78
+ *
79
+ * If set to `"manual"`, each individual request will need to
80
+ * be responded to manually from within the workflow by calling the
81
+ * `respondWith()` method.
82
+ *
83
+ * If not set then the webhook will automatically respond with
84
+ * a `202 Accepted` response.
85
+ */
86
+ respondWith?: Response | 'manual';
87
+ }
88
+ /**
89
+ * Creates a {@link Hook} that can be used to suspend and resume the workflow run with a payload.
90
+ *
91
+ * Hooks allow external systems to send arbitrary serializable data into a workflow.
92
+ *
93
+ * @param options - Configuration options for the hook.
94
+ * @returns A `Hook` that can be awaited to receive one or more payloads.
95
+ *
96
+ * @example
97
+ *
98
+ * ```ts
99
+ * export async function workflowWithHook() {
100
+ * "use workflow";
101
+ *
102
+ * const hook = createHook<{ message: string }>();
103
+ * console.log('Hook token:', hook.token);
104
+ *
105
+ * const payload = await hook;
106
+ * console.log('Received:', payload.message);
107
+ * }
108
+ * ```
109
+ */
110
+ export declare function createHook<T = any>(options?: HookOptions): Hook<T>;
111
+ /**
112
+ * Creates a {@link Webhook} that can be used to suspend and resume the workflow
113
+ * run upon receiving an HTTP request to the specified URL.
114
+ *
115
+ * Webhooks will result in a {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | Request} object
116
+ * that can be interacted with in workflow functions.
117
+ */
118
+ export declare function createWebhook(options: WebhookOptions & {
119
+ respondWith: 'manual';
120
+ }): Webhook<RequestWithResponse>;
121
+ export declare function createWebhook(options?: WebhookOptions): Webhook<Request>;
122
+ export {};
123
+ //# sourceMappingURL=create-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-hook.d.ts","sourceRoot":"","sources":["../src/create-hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;GAEG;AACH,UAAU,QAAQ,CAAC,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,OAAO;IAClD,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED;;;GAGG;AACH,MAAM,WAAW,IAAI,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;IAClE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,IAAI,CAAC,CAAC,CAAC;IACzD;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,wBAAgB,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,CAIlE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,cAAc,GAAG;IAAE,WAAW,EAAE,QAAQ,CAAA;CAAE,GAClD,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAChC,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Creates a {@link Hook} that can be used to suspend and resume the workflow run with a payload.
3
+ *
4
+ * Hooks allow external systems to send arbitrary serializable data into a workflow.
5
+ *
6
+ * @param options - Configuration options for the hook.
7
+ * @returns A `Hook` that can be awaited to receive one or more payloads.
8
+ *
9
+ * @example
10
+ *
11
+ * ```ts
12
+ * export async function workflowWithHook() {
13
+ * "use workflow";
14
+ *
15
+ * const hook = createHook<{ message: string }>();
16
+ * console.log('Hook token:', hook.token);
17
+ *
18
+ * const payload = await hook;
19
+ * console.log('Received:', payload.message);
20
+ * }
21
+ * ```
22
+ */
23
+ // @ts-expect-error `options` is here for types/docs
24
+ export function createHook(options) {
25
+ throw new Error('`createHook()` can only be called inside a workflow function');
26
+ }
27
+ export function createWebhook(
28
+ // @ts-expect-error `options` is here for types/docs
29
+ options) {
30
+ throw new Error('`createWebhook()` can only be called inside a workflow function');
31
+ }
32
+ //# sourceMappingURL=create-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-hook.js","sourceRoot":"","sources":["../src/create-hook.ts"],"names":[],"mappings":"AA+FA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,oDAAoD;AACpD,MAAM,UAAU,UAAU,CAAU,OAAqB;IACvD,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;AACJ,CAAC;AAaD,MAAM,UAAU,aAAa;AAC3B,oDAAoD;AACpD,OAAwB;IAExB,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { Hook as HookEntity } from '@workflow/world';
2
+ import type { Hook, HookOptions } from './create-hook.js';
3
+ /**
4
+ * Defines a typed hook for type-safe hook creation and resumption.
5
+ *
6
+ * This helper provides type safety by allowing you to define the payload type once
7
+ * and reuse it when creating hooks and resuming them.
8
+ *
9
+ * @returns An object with `create` and `resume` functions pre-typed with the payload type
10
+ *
11
+ * @example
12
+ *
13
+ * ```ts
14
+ * // Define a hook with a specific payload type
15
+ * const approvalHook = defineHook<{ approved: boolean; comment: string }>();
16
+ *
17
+ * // In a workflow
18
+ * export async function workflowWithApproval() {
19
+ * "use workflow";
20
+ *
21
+ * const hook = approvalHook.create();
22
+ * const result = await hook; // Fully typed as { approved: boolean; comment: string }
23
+ * }
24
+ *
25
+ * // In an API route
26
+ * export async function POST(request: Request) {
27
+ * const { token, approved, comment } = await request.json();
28
+ * await approvalHook.resume(token, { approved, comment });
29
+ * return Response.json({ success: true });
30
+ * }
31
+ * ```
32
+ */
33
+ export declare function defineHook<T>(): {
34
+ /**
35
+ * Creates a new hook with the defined payload type.
36
+ *
37
+ * Note: This method is not available in runtime bundles. Use it from workflow contexts only.
38
+ *
39
+ * @param _options - Optional hook configuration
40
+ * @returns A Hook that resolves to the defined payload type
41
+ */
42
+ create(options?: HookOptions): Hook<T>;
43
+ /**
44
+ * Resumes a hook by sending a payload with the defined type.
45
+ * This is a type-safe wrapper around the `resumeHook` runtime function.
46
+ *
47
+ * @param token - The unique token identifying the hook
48
+ * @param payload - The payload to send (must match the defined type)
49
+ * @returns Promise resolving to the hook entity, or null if the hook doesn't exist
50
+ */
51
+ resume(token: string, payload: T): Promise<HookEntity | null>;
52
+ };
53
+ //# sourceMappingURL=define-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-hook.d.ts","sourceRoot":"","sources":["../src/define-hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CAAC,CAAC;IAExB;;;;;;;OAOG;qBAEc,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC;IAMtC;;;;;;;OAOG;kBACW,MAAM,WAAW,CAAC,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;EAIhE"}
@@ -0,0 +1,59 @@
1
+ import { resumeHook } from './runtime/resume-hook.js';
2
+ /**
3
+ * Defines a typed hook for type-safe hook creation and resumption.
4
+ *
5
+ * This helper provides type safety by allowing you to define the payload type once
6
+ * and reuse it when creating hooks and resuming them.
7
+ *
8
+ * @returns An object with `create` and `resume` functions pre-typed with the payload type
9
+ *
10
+ * @example
11
+ *
12
+ * ```ts
13
+ * // Define a hook with a specific payload type
14
+ * const approvalHook = defineHook<{ approved: boolean; comment: string }>();
15
+ *
16
+ * // In a workflow
17
+ * export async function workflowWithApproval() {
18
+ * "use workflow";
19
+ *
20
+ * const hook = approvalHook.create();
21
+ * const result = await hook; // Fully typed as { approved: boolean; comment: string }
22
+ * }
23
+ *
24
+ * // In an API route
25
+ * export async function POST(request: Request) {
26
+ * const { token, approved, comment } = await request.json();
27
+ * await approvalHook.resume(token, { approved, comment });
28
+ * return Response.json({ success: true });
29
+ * }
30
+ * ```
31
+ */
32
+ export function defineHook() {
33
+ return {
34
+ /**
35
+ * Creates a new hook with the defined payload type.
36
+ *
37
+ * Note: This method is not available in runtime bundles. Use it from workflow contexts only.
38
+ *
39
+ * @param _options - Optional hook configuration
40
+ * @returns A Hook that resolves to the defined payload type
41
+ */
42
+ // @ts-expect-error `options` is here for types/docs
43
+ create(options) {
44
+ throw new Error('`defineHook().create()` can only be called inside a workflow function.');
45
+ },
46
+ /**
47
+ * Resumes a hook by sending a payload with the defined type.
48
+ * This is a type-safe wrapper around the `resumeHook` runtime function.
49
+ *
50
+ * @param token - The unique token identifying the hook
51
+ * @param payload - The payload to send (must match the defined type)
52
+ * @returns Promise resolving to the hook entity, or null if the hook doesn't exist
53
+ */
54
+ resume(token, payload) {
55
+ return resumeHook(token, payload);
56
+ },
57
+ };
58
+ }
59
+ //# sourceMappingURL=define-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-hook.js","sourceRoot":"","sources":["../src/define-hook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO;QACL;;;;;;;WAOG;QACH,oDAAoD;QACpD,MAAM,CAAC,OAAqB;YAC1B,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;QACJ,CAAC;QAED;;;;;;;WAOG;QACH,MAAM,CAAC,KAAa,EAAE,OAAU;YAC9B,OAAO,UAAU,CAAI,KAAK,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { Event } from '@workflow/world';
2
+ export declare enum EventConsumerResult {
3
+ /**
4
+ * Callback consumed the event, but should not be removed from the callbacks list
5
+ */
6
+ Consumed = 0,
7
+ /**
8
+ * Callback did not consume the event, so it should be passed to the next callback
9
+ */
10
+ NotConsumed = 1,
11
+ /**
12
+ * Callback consumed the event, and should be removed from the callbacks list
13
+ */
14
+ Finished = 2
15
+ }
16
+ type EventConsumerCallback = (event: Event | null) => EventConsumerResult;
17
+ export declare class EventsConsumer {
18
+ eventIndex: number;
19
+ readonly events: Event[];
20
+ readonly callbacks: EventConsumerCallback[];
21
+ constructor(events: Event[]);
22
+ /**
23
+ * Registers a callback function to be called after an event has been consumed
24
+ * by a different callback. The callback can return:
25
+ * - `EventConsumerResult.Consumed` the event is considered consumed and will not be passed to any other callback, but the callback will remain in the callbacks list
26
+ * - `EventConsumerResult.NotConsumed` the event is passed to the next callback
27
+ * - `EventConsumerResult.Finished` the event is considered consumed and the callback is removed from the callbacks list
28
+ *
29
+ * @param fn - The callback function to register.
30
+ */
31
+ subscribe(fn: EventConsumerCallback): void;
32
+ private consume;
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=events-consumer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-consumer.d.ts","sourceRoot":"","sources":["../src/events-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,oBAAY,mBAAmB;IAC7B;;OAEG;IACH,QAAQ,IAAA;IACR;;OAEG;IACH,WAAW,IAAA;IACX;;OAEG;IACH,QAAQ,IAAA;CACT;AAED,KAAK,qBAAqB,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,mBAAmB,CAAC;AAE1E,qBAAa,cAAc;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAM;IAC9B,QAAQ,CAAC,SAAS,EAAE,qBAAqB,EAAE,CAAM;gBAErC,MAAM,EAAE,KAAK,EAAE;IAO3B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,EAAE,qBAAqB;IAKnC,OAAO,CAAC,OAAO,CAkCb;CACH"}
@@ -0,0 +1,72 @@
1
+ import { eventsLogger } from './logger.js';
2
+ export var EventConsumerResult;
3
+ (function (EventConsumerResult) {
4
+ /**
5
+ * Callback consumed the event, but should not be removed from the callbacks list
6
+ */
7
+ EventConsumerResult[EventConsumerResult["Consumed"] = 0] = "Consumed";
8
+ /**
9
+ * Callback did not consume the event, so it should be passed to the next callback
10
+ */
11
+ EventConsumerResult[EventConsumerResult["NotConsumed"] = 1] = "NotConsumed";
12
+ /**
13
+ * Callback consumed the event, and should be removed from the callbacks list
14
+ */
15
+ EventConsumerResult[EventConsumerResult["Finished"] = 2] = "Finished";
16
+ })(EventConsumerResult || (EventConsumerResult = {}));
17
+ export class EventsConsumer {
18
+ eventIndex;
19
+ events = [];
20
+ callbacks = [];
21
+ constructor(events) {
22
+ this.events = events;
23
+ this.eventIndex = 0;
24
+ eventsLogger.debug('EventsConsumer initialized', { events });
25
+ }
26
+ /**
27
+ * Registers a callback function to be called after an event has been consumed
28
+ * by a different callback. The callback can return:
29
+ * - `EventConsumerResult.Consumed` the event is considered consumed and will not be passed to any other callback, but the callback will remain in the callbacks list
30
+ * - `EventConsumerResult.NotConsumed` the event is passed to the next callback
31
+ * - `EventConsumerResult.Finished` the event is considered consumed and the callback is removed from the callbacks list
32
+ *
33
+ * @param fn - The callback function to register.
34
+ */
35
+ subscribe(fn) {
36
+ this.callbacks.push(fn);
37
+ process.nextTick(this.consume);
38
+ }
39
+ consume = () => {
40
+ const currentEvent = this.events[this.eventIndex] ?? null;
41
+ for (let i = 0; i < this.callbacks.length; i++) {
42
+ const callback = this.callbacks[i];
43
+ let handled = EventConsumerResult.NotConsumed;
44
+ try {
45
+ handled = callback(currentEvent);
46
+ }
47
+ catch (error) {
48
+ eventsLogger.error('EventConsumer callback threw an error', { error });
49
+ // Hopefully shouldn't happen, but we don't want to block the workflow
50
+ console.error('EventConsumer callback threw an error', error);
51
+ }
52
+ eventsLogger.debug('EventConsumer callback result', {
53
+ handled: EventConsumerResult[handled],
54
+ eventIndex: this.eventIndex,
55
+ eventId: currentEvent?.eventId,
56
+ });
57
+ if (handled === EventConsumerResult.Consumed ||
58
+ handled === EventConsumerResult.Finished) {
59
+ // consumer handled this event, so increase the event index
60
+ this.eventIndex++;
61
+ // remove the callback if it has finished
62
+ if (handled === EventConsumerResult.Finished) {
63
+ this.callbacks.splice(i, 1);
64
+ }
65
+ // continue to the next event
66
+ process.nextTick(this.consume);
67
+ return;
68
+ }
69
+ }
70
+ };
71
+ }
72
+ //# sourceMappingURL=events-consumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-consumer.js","sourceRoot":"","sources":["../src/events-consumer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,qEAAQ,CAAA;IACR;;OAEG;IACH,2EAAW,CAAA;IACX;;OAEG;IACH,qEAAQ,CAAA;AACV,CAAC,EAbW,mBAAmB,KAAnB,mBAAmB,QAa9B;AAID,MAAM,OAAO,cAAc;IACzB,UAAU,CAAS;IACV,MAAM,GAAY,EAAE,CAAC;IACrB,SAAS,GAA4B,EAAE,CAAC;IAEjD,YAAY,MAAe;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,YAAY,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAyB;QACjC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAEO,OAAO,GAAG,GAAG,EAAE;QACrB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;QAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACnC,IAAI,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC;YAC9C,IAAI,CAAC;gBACH,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,YAAY,CAAC,KAAK,CAAC,uCAAuC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;gBACvE,sEAAsE;gBACtE,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;YAChE,CAAC;YACD,YAAY,CAAC,KAAK,CAAC,+BAA+B,EAAE;gBAClD,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC;gBACrC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,YAAY,EAAE,OAAO;aAC/B,CAAC,CAAC;YACH,IACE,OAAO,KAAK,mBAAmB,CAAC,QAAQ;gBACxC,OAAO,KAAK,mBAAmB,CAAC,QAAQ,EACxC,CAAC;gBACD,2DAA2D;gBAC3D,IAAI,CAAC,UAAU,EAAE,CAAC;gBAElB,yCAAyC;gBACzC,IAAI,OAAO,KAAK,mBAAmB,CAAC,QAAQ,EAAE,CAAC;oBAC7C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9B,CAAC;gBAED,6BAA6B;gBAC7B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC/B,OAAO;YACT,CAAC;QACH,CAAC;IACH,CAAC,CAAC;CACH"}
@@ -0,0 +1,29 @@
1
+ import type { Serializable } from './schemas.js';
2
+ export interface StepInvocationQueueItem {
3
+ type: 'step';
4
+ correlationId: string;
5
+ stepName: string;
6
+ args: Serializable[];
7
+ }
8
+ export interface HookInvocationQueueItem {
9
+ type: 'hook';
10
+ correlationId: string;
11
+ token: string;
12
+ metadata?: Serializable;
13
+ }
14
+ export type QueueItem = StepInvocationQueueItem | HookInvocationQueueItem;
15
+ /**
16
+ * An error that is thrown when one or more operations (steps/hooks/etc.) are called but do
17
+ * not yet have corresponding entries in the event log. The workflow
18
+ * dispatcher will catch this error and push the operations
19
+ * onto the queue.
20
+ */
21
+ export declare class WorkflowSuspension extends Error {
22
+ steps: QueueItem[];
23
+ globalThis: typeof globalThis;
24
+ stepCount: number;
25
+ hookCount: number;
26
+ constructor(steps: QueueItem[], global: typeof globalThis);
27
+ }
28
+ export declare function ENOTSUP(): never;
29
+ //# sourceMappingURL=global.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,MAAM,SAAS,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAE1E;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;gBAEN,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,UAAU;CAoC1D;AAED,wBAAgB,OAAO,IAAI,KAAK,CAE/B"}
package/dist/global.js ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * An error that is thrown when one or more operations (steps/hooks/etc.) are called but do
3
+ * not yet have corresponding entries in the event log. The workflow
4
+ * dispatcher will catch this error and push the operations
5
+ * onto the queue.
6
+ */
7
+ export class WorkflowSuspension extends Error {
8
+ steps;
9
+ globalThis;
10
+ stepCount;
11
+ hookCount;
12
+ constructor(steps, global) {
13
+ const stepCount = steps.filter((s) => s.type === 'step').length;
14
+ const hookCount = steps.filter((s) => s.type === 'hook').length;
15
+ // Build description parts
16
+ const parts = [];
17
+ if (stepCount > 0) {
18
+ parts.push(`${stepCount} ${stepCount === 1 ? 'step' : 'steps'}`);
19
+ }
20
+ if (hookCount > 0) {
21
+ parts.push(`${hookCount} ${hookCount === 1 ? 'hook' : 'hooks'}`);
22
+ }
23
+ // Determine verb (has/have) and action (run/created/received)
24
+ const totalCount = stepCount + hookCount;
25
+ const hasOrHave = totalCount === 1 ? 'has' : 'have';
26
+ let action;
27
+ if (stepCount > 0) {
28
+ action = 'run';
29
+ }
30
+ else if (hookCount > 0) {
31
+ action = 'created';
32
+ }
33
+ else {
34
+ action = 'received';
35
+ }
36
+ const description = parts.length > 0
37
+ ? `${parts.join(' and ')} ${hasOrHave} not been ${action} yet`
38
+ : '0 steps have not been run yet'; // Default case for empty array
39
+ super(description);
40
+ this.name = 'WorkflowSuspension';
41
+ this.steps = steps;
42
+ this.globalThis = global;
43
+ this.stepCount = stepCount;
44
+ this.hookCount = hookCount;
45
+ }
46
+ }
47
+ export function ENOTSUP() {
48
+ throw new Error('Not supported in workflow functions');
49
+ }
50
+ //# sourceMappingURL=global.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global.js","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,KAAK,CAAc;IACnB,UAAU,CAAoB;IAC9B,SAAS,CAAS;IAClB,SAAS,CAAS;IAElB,YAAY,KAAkB,EAAE,MAAyB;QACvD,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;QAChE,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;QAEhE,0BAA0B;QAC1B,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,IAAI,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,8DAA8D;QAC9D,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACpD,IAAI,MAAc,CAAC;QACnB,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,GAAG,KAAK,CAAC;QACjB,CAAC;aAAM,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,GAAG,SAAS,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,UAAU,CAAC;QACtB,CAAC;QAED,MAAM,WAAW,GACf,KAAK,CAAC,MAAM,GAAG,CAAC;YACd,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,aAAa,MAAM,MAAM;YAC9D,CAAC,CAAC,+BAA+B,CAAC,CAAC,+BAA+B;QACtE,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Just the core utilities that are meant to be imported by user
3
+ * steps/workflows. This allows the bundler to tree-shake and limit what goes
4
+ * into the final user bundles. Logic for running/handling steps/workflows
5
+ * should live in runtime. Eventually these might be separate packages
6
+ * `workflow` and `workflow/runtime`?
7
+ *
8
+ * Everything here will get re-exported under the 'workflow' top level package.
9
+ * This should be a minimal set of APIs so **do not anything here** unless it's
10
+ * needed for userland workflow code.
11
+ */
12
+ export { FatalError, RetryableError, type RetryableErrorOptions, } from '@workflow/errors';
13
+ export { createHook, createWebhook, type Hook, type HookOptions, type RequestWithResponse, type Webhook, type WebhookOptions, } from './create-hook.js';
14
+ export { defineHook } from './define-hook.js';
15
+ export { getStepMetadata, type StepMetadata, } from './step/get-step-metadata.js';
16
+ export { getWorkflowMetadata, type WorkflowMetadata, } from './step/get-workflow-metadata.js';
17
+ export { getWritable } from './writable-stream.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,UAAU,EACV,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,UAAU,EACV,aAAa,EACb,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,EACnB,KAAK,gBAAgB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Just the core utilities that are meant to be imported by user
3
+ * steps/workflows. This allows the bundler to tree-shake and limit what goes
4
+ * into the final user bundles. Logic for running/handling steps/workflows
5
+ * should live in runtime. Eventually these might be separate packages
6
+ * `workflow` and `workflow/runtime`?
7
+ *
8
+ * Everything here will get re-exported under the 'workflow' top level package.
9
+ * This should be a minimal set of APIs so **do not anything here** unless it's
10
+ * needed for userland workflow code.
11
+ */
12
+ export { FatalError, RetryableError, } from '@workflow/errors';
13
+ export { createHook, createWebhook, } from './create-hook.js';
14
+ export { defineHook } from './define-hook.js';
15
+ export { getStepMetadata, } from './step/get-step-metadata.js';
16
+ export { getWorkflowMetadata, } from './step/get-workflow-metadata.js';
17
+ export { getWritable } from './writable-stream.js';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,UAAU,EACV,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,UAAU,EACV,aAAa,GAMd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,eAAe,GAEhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,GAEpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,31 @@
1
+ export declare const stepLogger: {
2
+ debug: (message: string, metadata?: Record<string, any>) => void;
3
+ info: (message: string, metadata?: Record<string, any>) => void;
4
+ warn: (message: string, metadata?: Record<string, any>) => void;
5
+ error: (message: string, metadata?: Record<string, any>) => void;
6
+ };
7
+ export declare const runtimeLogger: {
8
+ debug: (message: string, metadata?: Record<string, any>) => void;
9
+ info: (message: string, metadata?: Record<string, any>) => void;
10
+ warn: (message: string, metadata?: Record<string, any>) => void;
11
+ error: (message: string, metadata?: Record<string, any>) => void;
12
+ };
13
+ export declare const webhookLogger: {
14
+ debug: (message: string, metadata?: Record<string, any>) => void;
15
+ info: (message: string, metadata?: Record<string, any>) => void;
16
+ warn: (message: string, metadata?: Record<string, any>) => void;
17
+ error: (message: string, metadata?: Record<string, any>) => void;
18
+ };
19
+ export declare const eventsLogger: {
20
+ debug: (message: string, metadata?: Record<string, any>) => void;
21
+ info: (message: string, metadata?: Record<string, any>) => void;
22
+ warn: (message: string, metadata?: Record<string, any>) => void;
23
+ error: (message: string, metadata?: Record<string, any>) => void;
24
+ };
25
+ export declare const adapterLogger: {
26
+ debug: (message: string, metadata?: Record<string, any>) => void;
27
+ info: (message: string, metadata?: Record<string, any>) => void;
28
+ warn: (message: string, metadata?: Record<string, any>) => void;
29
+ error: (message: string, metadata?: Record<string, any>) => void;
30
+ };
31
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,UAAU;qBAvBF,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;qBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAuBb,CAAC;AAC/C,eAAO,MAAM,aAAa;qBAxBL,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;qBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAwBP,CAAC;AACrD,eAAO,MAAM,aAAa;qBAzBL,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;qBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAyBP,CAAC;AACrD,eAAO,MAAM,YAAY;qBA1BJ,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;qBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CA0BT,CAAC;AACnD,eAAO,MAAM,aAAa;qBA3BL,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;qBAAtC,MAAM,aAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CA2BP,CAAC"}