@forgehive/task 0.1.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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +241 -0
  3. package/dist/index.d.ts +92 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +191 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/test/add-listener-with-boundaries.test.d.ts +2 -0
  8. package/dist/test/add-listener-with-boundaries.test.d.ts.map +1 -0
  9. package/dist/test/add-listener-with-boundaries.test.js +230 -0
  10. package/dist/test/add-listener-with-boundaries.test.js.map +1 -0
  11. package/dist/test/add-listener.test.d.ts +2 -0
  12. package/dist/test/add-listener.test.d.ts.map +1 -0
  13. package/dist/test/add-listener.test.js +92 -0
  14. package/dist/test/add-listener.test.js.map +1 -0
  15. package/dist/test/boundary-modes.test.d.ts +2 -0
  16. package/dist/test/boundary-modes.test.d.ts.map +1 -0
  17. package/dist/test/boundary-modes.test.js +184 -0
  18. package/dist/test/boundary-modes.test.js.map +1 -0
  19. package/dist/test/change-mode.test.d.ts +2 -0
  20. package/dist/test/change-mode.test.d.ts.map +1 -0
  21. package/dist/test/change-mode.test.js +39 -0
  22. package/dist/test/change-mode.test.js.map +1 -0
  23. package/dist/test/index.test.d.ts +2 -0
  24. package/dist/test/index.test.d.ts.map +1 -0
  25. package/dist/test/index.test.js +48 -0
  26. package/dist/test/index.test.js.map +1 -0
  27. package/dist/test/run-boundary.test.d.ts +2 -0
  28. package/dist/test/run-boundary.test.d.ts.map +1 -0
  29. package/dist/test/run-boundary.test.js +49 -0
  30. package/dist/test/run-boundary.test.js.map +1 -0
  31. package/dist/test/run-without-args.test.d.ts +2 -0
  32. package/dist/test/run-without-args.test.d.ts.map +1 -0
  33. package/dist/test/run-without-args.test.js +29 -0
  34. package/dist/test/run-without-args.test.js.map +1 -0
  35. package/dist/test/task-with-boundaries.test.d.ts +2 -0
  36. package/dist/test/task-with-boundaries.test.d.ts.map +1 -0
  37. package/dist/test/task-with-boundaries.test.js +102 -0
  38. package/dist/test/task-with-boundaries.test.js.map +1 -0
  39. package/dist/test/validation.test.d.ts +2 -0
  40. package/dist/test/validation.test.d.ts.map +1 -0
  41. package/dist/test/validation.test.js +166 -0
  42. package/dist/test/validation.test.js.map +1 -0
  43. package/dist/utils/boundary.d.ts +44 -0
  44. package/dist/utils/boundary.d.ts.map +1 -0
  45. package/dist/utils/boundary.js +145 -0
  46. package/dist/utils/boundary.js.map +1 -0
  47. package/jest.config.js +9 -0
  48. package/package.json +30 -0
  49. package/src/index.ts +344 -0
  50. package/src/test/add-listener-with-boundaries.test.ts +299 -0
  51. package/src/test/add-listener.test.ts +110 -0
  52. package/src/test/boundary-modes.test.ts +215 -0
  53. package/src/test/change-mode.test.ts +45 -0
  54. package/src/test/index.test.ts +62 -0
  55. package/src/test/run-boundary.test.ts +64 -0
  56. package/src/test/run-without-args.test.ts +33 -0
  57. package/src/test/task-with-boundaries.test.ts +137 -0
  58. package/src/test/validation.test.ts +194 -0
  59. package/src/utils/boundary.ts +178 -0
  60. package/tsconfig.json +24 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ForgeHive
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,241 @@
1
+ # @shadow/task
2
+
3
+ A powerful task management library for creating type-safe, boundary-separated tasks with validation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @shadow/task
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ The `@shadow/task` package provides a way to create strongly-typed tasks with:
14
+
15
+ - Input validation using schemas
16
+ - Boundary separation for better testability
17
+ - Execution modes (proxy, replay, etc.)
18
+ - Listener support for tracking task execution
19
+
20
+ ## Basic Usage
21
+
22
+ Here's a simple example of creating a task:
23
+
24
+ ```typescript
25
+ import { createTask, Schema } from '@shadow/task';
26
+
27
+ // Define a schema for task input validation
28
+ const schema = new Schema({
29
+ name: Schema.string(),
30
+ age: Schema.number().optional()
31
+ });
32
+
33
+ // Define boundaries (external dependencies)
34
+ const boundaries = {
35
+ saveToDatabase: async (data: any): Promise<void> => {
36
+ // Implementation...
37
+ },
38
+ sendEmail: async (to: string, subject: string): Promise<boolean> => {
39
+ // Implementation...
40
+ }
41
+ };
42
+
43
+ // Create the task with type inference
44
+ const registerUser = createTask(
45
+ schema,
46
+ boundaries,
47
+ async (argv, boundaries) => {
48
+ // argv is typed based on the schema (has name: string, age?: number)
49
+ console.log(`Registering user: ${argv.name}`);
50
+
51
+ // Call boundaries with type safety
52
+ await boundaries.saveToDatabase({ name: argv.name, age: argv.age });
53
+ const emailSent = await boundaries.sendEmail(
54
+ 'admin@example.com',
55
+ `New user registered: ${argv.name}`
56
+ );
57
+
58
+ return {
59
+ success: true,
60
+ emailSent,
61
+ user: { name: argv.name, age: argv.age }
62
+ };
63
+ }
64
+ );
65
+
66
+ // Execute the task
67
+ const result = await registerUser.run({ name: 'John Doe', age: 30 });
68
+ ```
69
+
70
+ ## Type Safety
71
+
72
+ The `createTask` function provides full type inference:
73
+
74
+ - Input arguments are typed based on the schema
75
+ - Boundaries are typed based on the provided boundaries object
76
+ - Return type is inferred from the task function
77
+
78
+ ## Advanced Usage
79
+
80
+ ### Adding Listeners
81
+
82
+ You can add listeners to track task execution:
83
+
84
+ ```typescript
85
+ registerUser.addListener((record) => {
86
+ console.log('Task executed:', record);
87
+ // record contains:
88
+ // - input: The input arguments
89
+ // - output: The task result (if successful)
90
+ // - error: Error message (if failed)
91
+ // - boundaries: Boundary execution data
92
+ });
93
+ ```
94
+
95
+ ### Execution Modes
96
+
97
+ Tasks support different execution modes:
98
+
99
+ - `proxy`: Normal execution (default)
100
+ - `proxy-pass`: Use recorded data if available, otherwise execute normally
101
+ - `proxy-catch`: Use recorded data if execution fails
102
+ - `replay`: Only use recorded data, fail if not available
103
+
104
+ ```typescript
105
+ // Change execution mode
106
+ registerUser.setMode('replay');
107
+ ```
108
+
109
+ ### Boundary Data
110
+
111
+ You can provide pre-recorded boundary data:
112
+
113
+ ```typescript
114
+ registerUser.setBoundariesData({
115
+ saveToDatabase: [
116
+ { input: [{ name: 'John', age: 30 }], output: undefined }
117
+ ],
118
+ sendEmail: [
119
+ { input: ['admin@example.com', 'New user registered: John'], output: true }
120
+ ]
121
+ });
122
+ ```
123
+
124
+ ## Real-World Example: CLI Task
125
+
126
+ Here's an example of a task used in a CLI application:
127
+
128
+ ```typescript
129
+ import { createTask } from '@shadow/task';
130
+ import { Schema } from '@shadow/schema';
131
+ import path from 'path';
132
+ import fs from 'fs/promises';
133
+
134
+ // Define the schema with optional dryRun flag
135
+ const schema = new Schema({
136
+ dryRun: Schema.boolean().optional()
137
+ });
138
+
139
+ // Define boundaries for file operations
140
+ const boundaries = {
141
+ saveFile: async (path: string, content: string): Promise<void> => {
142
+ await fs.writeFile(path, content);
143
+ }
144
+ };
145
+
146
+ // Create the init task
147
+ export const init = createTask(
148
+ schema,
149
+ boundaries,
150
+ async (argv, boundaries) => {
151
+ // Handle the dryRun flag
152
+ const isDryRun = Boolean(argv.dryRun);
153
+
154
+ const shadowPath = path.join(process.cwd(), 'shadow.json');
155
+ const config = {
156
+ project: { name: 'MyProject' },
157
+ // ... other config properties
158
+ };
159
+
160
+ const content = JSON.stringify(config, null, 2);
161
+
162
+ // Conditionally create the file based on dryRun
163
+ if (!isDryRun) {
164
+ await boundaries.saveFile(shadowPath, content);
165
+ console.log(`Created shadow.json at ${shadowPath}`);
166
+ } else {
167
+ console.log('Dry run, not creating shadow.json');
168
+ console.log(content);
169
+ }
170
+
171
+ return config;
172
+ }
173
+ );
174
+ ```
175
+
176
+ ## Testing Tasks
177
+
178
+ The boundary separation makes tasks easy to test:
179
+
180
+ ```typescript
181
+ import { init } from './tasks/init';
182
+
183
+ describe('Init task', () => {
184
+ it('should create a config file when dryRun is false', async () => {
185
+ // Mock the saveFile boundary
186
+ const saveFileMock = jest.fn();
187
+
188
+ // Override the boundaries
189
+ init.getBoundaries().saveFile = saveFileMock;
190
+
191
+ // Run the task
192
+ await init.run({ dryRun: false });
193
+
194
+ // Verify the boundary was called
195
+ expect(saveFileMock).toHaveBeenCalled();
196
+ });
197
+
198
+ it('should not create a file when dryRun is true', async () => {
199
+ // Mock the saveFile boundary
200
+ const saveFileMock = jest.fn();
201
+
202
+ // Override the boundaries
203
+ init.getBoundaries().saveFile = saveFileMock;
204
+
205
+ // Run the task
206
+ await init.run({ dryRun: true });
207
+
208
+ // Verify the boundary was not called
209
+ expect(saveFileMock).not.toHaveBeenCalled();
210
+ });
211
+ });
212
+ ```
213
+
214
+ ## API Reference
215
+
216
+ ### `createTask<S, B, R>(schema, boundaries, fn, config?)`
217
+
218
+ Creates a new task with type inference.
219
+
220
+ - `schema`: A Schema instance for input validation
221
+ - `boundaries`: An object containing boundary functions
222
+ - `fn`: The task function that receives validated input and boundaries
223
+ - `config`: Optional configuration (mode, boundariesData)
224
+
225
+ Returns a `TaskInstanceType` with methods for running and managing the task.
226
+
227
+ ### `TaskInstanceType` Methods
228
+
229
+ - `run(argv?)`: Executes the task with the given arguments
230
+ - `addListener(fn)`: Adds a listener for task execution
231
+ - `removeListener()`: Removes the current listener
232
+ - `getMode()` / `setMode(mode)`: Get/set the execution mode
233
+ - `getBoundaries()`: Get the wrapped boundary functions
234
+ - `setBoundariesData(data)`: Set pre-recorded boundary data
235
+ - `validate(argv?)`: Validate input without running the task
236
+ - `isValid(argv?)`: Check if input is valid
237
+ - `asBoundary()`: Convert the task to a boundary function
238
+
239
+ ## License
240
+
241
+ MIT
@@ -0,0 +1,92 @@
1
+ import { Schema, type SchemaType, type InferSchema } from '@shadow/schema';
2
+ import { type Mode, type Boundaries, type WrappedBoundaries } from './utils/boundary';
3
+ export interface Task {
4
+ id: string;
5
+ title: string;
6
+ completed: boolean;
7
+ }
8
+ export type BaseFunction = (...args: any[]) => any;
9
+ export type { BoundaryFunction, WrappedBoundaryFunction, Boundaries, WrappedBoundaries, Mode } from './utils/boundary';
10
+ export { Schema };
11
+ export interface TaskConfig<B extends Boundaries = Boundaries> {
12
+ schema?: Schema<Record<string, SchemaType>>;
13
+ mode?: Mode;
14
+ boundaries?: B;
15
+ boundariesData?: Record<string, unknown>;
16
+ }
17
+ /**
18
+ * Represents the record passed to task listeners
19
+ */
20
+ export interface TaskRecord<InputType = unknown, OutputType = unknown> {
21
+ /** The input arguments passed to the task */
22
+ input: InputType;
23
+ /** The output returned by the task (if successful) */
24
+ output?: OutputType;
25
+ /** The error message if the task failed */
26
+ error?: string;
27
+ /** Boundary execution data */
28
+ boundaries?: Record<string, unknown>;
29
+ }
30
+ export interface TaskInstanceType<Func extends BaseFunction = BaseFunction, B extends Boundaries = Boundaries> {
31
+ getMode: () => Mode;
32
+ setMode: (mode: Mode) => void;
33
+ setSchema: (base: Schema<Record<string, SchemaType>>) => void;
34
+ getSchema: () => Schema<Record<string, SchemaType>> | undefined;
35
+ validate: <T extends Record<string, unknown> = Parameters<Func>[0]>(argv?: T) => ReturnType<Schema<Record<string, SchemaType>>['safeParse']> | undefined;
36
+ isValid: <T extends Record<string, unknown> = Parameters<Func>[0]>(argv?: T) => boolean;
37
+ addListener: <I = Parameters<Func>[0], O = ReturnType<Func>>(fn: (record: TaskRecord<I, O>) => void) => void;
38
+ removeListener: () => void;
39
+ emit: (data: Partial<TaskRecord>) => void;
40
+ asBoundary: () => (args: Parameters<Func>[0]) => Promise<ReturnType<Func>>;
41
+ getBoundaries: () => WrappedBoundaries<B>;
42
+ setBoundariesData: (boundariesData: Record<string, unknown>) => void;
43
+ getBondariesData: () => Record<string, unknown>;
44
+ getBondariesRunLog: () => Record<string, unknown>;
45
+ startRunLog: () => void;
46
+ run: (argv?: Parameters<Func>[0]) => Promise<ReturnType<Func>>;
47
+ }
48
+ export type InferSchemaType<S> = S extends Schema<any> ? InferSchema<S> : Record<string, unknown>;
49
+ export type TaskFunction<S, B extends Boundaries> = (argv: InferSchemaType<S>, boundaries: WrappedBoundaries<B>) => Promise<any>;
50
+ export declare const Task: {
51
+ new <B extends Boundaries = Boundaries, Func extends BaseFunction = BaseFunction>(fn: Func, conf?: TaskConfig<B>): {
52
+ _fn: Func;
53
+ _mode: Mode;
54
+ _coolDown: number;
55
+ _boundariesDefinition: B;
56
+ _boundaries: WrappedBoundaries<B>;
57
+ _boundariesData: Record<string, unknown> | null;
58
+ _schema: Schema<Record<string, SchemaType>> | undefined;
59
+ _listener?: ((record: TaskRecord<Parameters<Func>[0], ReturnType<Func>>) => void) | undefined;
60
+ getMode(): Mode;
61
+ setMode(mode: Mode): void;
62
+ setSchema(schema: Schema<Record<string, SchemaType>>): void;
63
+ getSchema(): Schema<Record<string, SchemaType>> | undefined;
64
+ validate<T extends Record<string, unknown> = Parameters<Func>[0]>(argv?: T): ReturnType<Schema<Record<string, SchemaType>>["safeParse"]> | undefined;
65
+ isValid<T extends Record<string, unknown> = Parameters<Func>[0]>(argv?: T): boolean;
66
+ addListener<I = Parameters<Func>[0], O = ReturnType<Func>>(fn: (record: TaskRecord<I, O>) => void): void;
67
+ removeListener(): void;
68
+ emit(data: Partial<TaskRecord>): void;
69
+ getBoundaries(): WrappedBoundaries<B>;
70
+ setBoundariesData(boundariesData: Record<string, unknown>): void;
71
+ getBondariesData(): Record<string, unknown>;
72
+ _createBounderies({ definition, baseData, mode }: {
73
+ definition: B;
74
+ baseData: Record<string, unknown> | null;
75
+ mode?: Mode;
76
+ }): WrappedBoundaries<B>;
77
+ getBondariesRunLog(): Record<string, unknown>;
78
+ startRunLog(): void;
79
+ asBoundary(): (args: Parameters<Func>[0]) => Promise<ReturnType<Func>>;
80
+ run(argv?: Parameters<Func>[0]): Promise<ReturnType<Func>>;
81
+ };
82
+ };
83
+ /**
84
+ * Helper function to create a task with proper type inference
85
+ * @param schema The schema to validate input against
86
+ * @param boundaries The boundaries to use
87
+ * @param fn The task function
88
+ * @param config Additional task configuration
89
+ * @returns A new Task instance with proper type inference
90
+ */
91
+ export declare function createTask<S extends Schema<Record<string, SchemaType>>, B extends Boundaries, R>(schema: S, boundaries: B, fn: (argv: InferSchemaType<S>, boundaries: WrappedBoundaries<B>) => Promise<R>, config?: Omit<TaskConfig<B>, 'schema' | 'boundaries'>): TaskInstanceType<(argv: InferSchemaType<S>, boundaries: WrappedBoundaries<B>) => Promise<R>, B>;
92
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAkB,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAgC,MAAM,kBAAkB,CAAA;AAEnI,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,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,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9E,MAAM,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC,GACpD,gBAAgB,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CASjG"}
package/dist/index.js ADDED
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Task = exports.Schema = void 0;
4
+ exports.createTask = createTask;
5
+ const schema_1 = require("@shadow/schema");
6
+ Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return schema_1.Schema; } });
7
+ const boundary_1 = require("./utils/boundary");
8
+ const Task = class Task {
9
+ constructor(fn, conf = {
10
+ schema: undefined,
11
+ mode: 'proxy',
12
+ boundaries: undefined,
13
+ boundariesData: undefined
14
+ }) {
15
+ var _a, _b, _c;
16
+ this._fn = fn;
17
+ this._schema = undefined;
18
+ if (typeof conf.schema !== 'undefined') {
19
+ this._schema = conf.schema;
20
+ }
21
+ this._mode = (_a = conf.mode) !== null && _a !== void 0 ? _a : 'proxy';
22
+ this._boundariesDefinition = (_b = conf.boundaries) !== null && _b !== void 0 ? _b : {};
23
+ this._listener = undefined;
24
+ // Cool down time before killing the process on cli runner
25
+ this._coolDown = 1000;
26
+ // Review this assignment
27
+ this._boundariesData = (_c = conf.boundariesData) !== null && _c !== void 0 ? _c : null;
28
+ this._boundaries = this._createBounderies({
29
+ definition: this._boundariesDefinition,
30
+ baseData: this._boundariesData,
31
+ mode: this._mode
32
+ });
33
+ }
34
+ getMode() {
35
+ return this._mode;
36
+ }
37
+ setMode(mode) {
38
+ for (const name in this._boundaries) {
39
+ const boundary = this._boundaries[name];
40
+ boundary.setMode(mode);
41
+ }
42
+ this._mode = mode;
43
+ }
44
+ setSchema(schema) {
45
+ this._schema = schema;
46
+ }
47
+ getSchema() {
48
+ return this._schema;
49
+ }
50
+ validate(argv) {
51
+ if (typeof this._schema === 'undefined') {
52
+ return undefined;
53
+ }
54
+ const result = this._schema.safeParse(argv);
55
+ return result;
56
+ }
57
+ isValid(argv) {
58
+ var _a;
59
+ if (typeof this._schema === 'undefined') {
60
+ return true;
61
+ }
62
+ const result = this._schema.safeParse(argv);
63
+ return (_a = result.success) !== null && _a !== void 0 ? _a : false;
64
+ }
65
+ // Posible improvement to handle multiple listeners, but so far its not needed
66
+ addListener(fn) {
67
+ this._listener = fn;
68
+ }
69
+ removeListener() {
70
+ this._listener = undefined;
71
+ }
72
+ /*
73
+ The listener get the input/outout of the call
74
+ Plus all the boundary data
75
+ */
76
+ emit(data) {
77
+ if (typeof this._listener === 'undefined') {
78
+ return;
79
+ }
80
+ const event = Object.assign(Object.assign({}, data), { boundaries: this.getBondariesRunLog() });
81
+ this._listener(event);
82
+ }
83
+ getBoundaries() {
84
+ return this._boundaries;
85
+ }
86
+ setBoundariesData(boundariesData) {
87
+ for (const name in this._boundaries) {
88
+ const boundary = this._boundaries[name];
89
+ let tape;
90
+ if (typeof boundariesData !== 'undefined') {
91
+ tape = boundariesData[name];
92
+ }
93
+ if (typeof boundary !== 'undefined' && typeof tape !== 'undefined') {
94
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
+ boundary.setTape(tape);
96
+ }
97
+ }
98
+ }
99
+ getBondariesData() {
100
+ const boundaries = this._boundaries;
101
+ const boundariesData = {};
102
+ for (const name in boundaries) {
103
+ const boundary = boundaries[name];
104
+ boundariesData[name] = boundary.getTape();
105
+ }
106
+ return boundariesData;
107
+ }
108
+ _createBounderies({ definition, baseData, mode = 'proxy' }) {
109
+ const boundariesFns = {};
110
+ for (const name in definition) {
111
+ const boundary = (0, boundary_1.createBoundary)(definition[name]);
112
+ if (baseData !== null && typeof baseData[name] !== 'undefined') {
113
+ const tape = baseData[name];
114
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
+ boundary.setTape(tape);
116
+ }
117
+ boundary.setMode(mode);
118
+ boundariesFns[name] = boundary;
119
+ }
120
+ return boundariesFns;
121
+ }
122
+ getBondariesRunLog() {
123
+ const boundaries = this._boundaries;
124
+ const boundariesRunLog = {};
125
+ for (const name in boundaries) {
126
+ const boundary = boundaries[name];
127
+ boundariesRunLog[name] = boundary.getRunData();
128
+ }
129
+ return boundariesRunLog;
130
+ }
131
+ startRunLog() {
132
+ const boundaries = this._boundaries;
133
+ for (const name in boundaries) {
134
+ const boundary = boundaries[name];
135
+ boundary.startRun();
136
+ }
137
+ }
138
+ asBoundary() {
139
+ return async (args) => {
140
+ return await this.run(args);
141
+ };
142
+ }
143
+ async run(argv) {
144
+ // start run log
145
+ this.startRunLog();
146
+ const boundaries = this._boundaries;
147
+ const q = new Promise((resolve, reject) => {
148
+ const isValid = this.isValid(argv);
149
+ if (!isValid) {
150
+ this.emit({
151
+ input: argv,
152
+ error: 'Invalid input'
153
+ });
154
+ throw new Error('Invalid input');
155
+ }
156
+ (async () => {
157
+ // Use proper typing for the function call
158
+ const output = await this._fn(argv, boundaries);
159
+ return output;
160
+ })().then((output) => {
161
+ this.emit({
162
+ input: argv,
163
+ output
164
+ });
165
+ resolve(output);
166
+ }).catch((error) => {
167
+ this.emit({
168
+ input: argv,
169
+ error: error.message
170
+ });
171
+ reject(error);
172
+ });
173
+ });
174
+ const result = await q;
175
+ return result;
176
+ }
177
+ };
178
+ exports.Task = Task;
179
+ /**
180
+ * Helper function to create a task with proper type inference
181
+ * @param schema The schema to validate input against
182
+ * @param boundaries The boundaries to use
183
+ * @param fn The task function
184
+ * @param config Additional task configuration
185
+ * @returns A new Task instance with proper type inference
186
+ */
187
+ function createTask(schema, boundaries, fn, config) {
188
+ return new exports.Task(fn, Object.assign({ schema,
189
+ boundaries }, config));
190
+ }
191
+ //# sourceMapp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.d.ts","sourceRoot":"","sources":["../../src/test/add-listener-with-boundaries.test.ts"],"names":[],"mappings":""}