@forgehive/forge-cli 0.2.8 → 0.2.9

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.
@@ -0,0 +1,34 @@
1
+ import { TaskInstanceType, BaseFunction, Boundaries, ExecutionRecord, ReplayConfig } from '@forgehive/task';
2
+ import { SchemaDescription } from '@forgehive/schema';
3
+ /**
4
+ * TaskAdapter wraps a TaskInstanceType to make it compatible with Runner
5
+ * by handling boundary type issues
6
+ */
7
+ export declare class TaskAdapter<F extends BaseFunction, B extends Boundaries> {
8
+ private task;
9
+ constructor(task: TaskInstanceType<F, B>);
10
+ get version(): string;
11
+ getDescription(): string | undefined;
12
+ describe(): SchemaDescription;
13
+ run(argv?: Parameters<F>[0]): Promise<ReturnType<F>>;
14
+ safeReplay(executionLog: ExecutionRecord<any, any, any>, config: ReplayConfig<any>): Promise<[ReturnType<F> | null, Error | null, ExecutionRecord<Parameters<F>[0], ReturnType<F>, B>]>;
15
+ getMode(): import("@forgehive/task").Mode;
16
+ setMode(mode: string): void;
17
+ validate(argv?: any): any;
18
+ isValid(argv?: any): boolean;
19
+ addListener(fn: any): void;
20
+ removeListener(): void;
21
+ emit(data: any): void;
22
+ asBoundary(): (args: Parameters<F>[0]) => Promise<ReturnType<F>>;
23
+ getBoundaries(): import("@forgehive/task").WrappedBoundaries<B>;
24
+ setBoundariesData(data: any): void;
25
+ getBondariesData(): Record<string, unknown>;
26
+ mockBoundary(name: any, mockFn: any): any;
27
+ resetMock(name: any): any;
28
+ resetMocks(): void;
29
+ safeRun(argv?: Parameters<F>[0]): Promise<[ReturnType<F> | null, Error | null, ExecutionRecord<Parameters<F>[0], ReturnType<F>, B>]>;
30
+ }
31
+ /**
32
+ * Helper function to adapt a task instance for Runner compatibility
33
+ */
34
+ export declare function adaptTask<F extends BaseFunction, B extends Boundaries>(task: TaskInstanceType<F, B>): TaskInstanceType;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskAdapter = void 0;
4
+ exports.adaptTask = adaptTask;
5
+ /**
6
+ * TaskAdapter wraps a TaskInstanceType to make it compatible with Runner
7
+ * by handling boundary type issues
8
+ */
9
+ class TaskAdapter {
10
+ constructor(task) {
11
+ this.task = task;
12
+ }
13
+ // Forward all required methods to the underlying task
14
+ get version() {
15
+ return this.task.version;
16
+ }
17
+ getDescription() {
18
+ return this.task.getDescription();
19
+ }
20
+ describe() {
21
+ return this.task.describe();
22
+ }
23
+ async run(argv) {
24
+ return this.task.run(argv);
25
+ }
26
+ // This is the problematic method with boundary type incompatibilities
27
+ // Our implementation uses type assertions to make it compatible
28
+ async safeReplay(executionLog, config) {
29
+ // Type assertion to bridge the boundary type gap
30
+ return this.task.safeReplay(executionLog, config);
31
+ }
32
+ // Forward other methods as needed
33
+ getMode() {
34
+ return this.task.getMode();
35
+ }
36
+ setMode(mode) {
37
+ return this.task.setMode(mode);
38
+ }
39
+ validate(argv) {
40
+ return this.task.validate(argv);
41
+ }
42
+ isValid(argv) {
43
+ return this.task.isValid(argv);
44
+ }
45
+ addListener(fn) {
46
+ return this.task.addListener(fn);
47
+ }
48
+ removeListener() {
49
+ return this.task.removeListener();
50
+ }
51
+ emit(data) {
52
+ return this.task.emit(data);
53
+ }
54
+ asBoundary() {
55
+ return this.task.asBoundary();
56
+ }
57
+ getBoundaries() {
58
+ return this.task.getBoundaries();
59
+ }
60
+ setBoundariesData(data) {
61
+ return this.task.setBoundariesData(data);
62
+ }
63
+ getBondariesData() {
64
+ return this.task.getBondariesData();
65
+ }
66
+ mockBoundary(name, mockFn) {
67
+ return this.task.mockBoundary(name, mockFn);
68
+ }
69
+ resetMock(name) {
70
+ return this.task.resetMock(name);
71
+ }
72
+ resetMocks() {
73
+ return this.task.resetMocks();
74
+ }
75
+ async safeRun(argv) {
76
+ return this.task.safeRun(argv);
77
+ }
78
+ }
79
+ exports.TaskAdapter = TaskAdapter;
80
+ /**
81
+ * Helper function to adapt a task instance for Runner compatibility
82
+ */
83
+ function adaptTask(task) {
84
+ return new TaskAdapter(task);
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgehive/forge-cli",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "TypeScript CLI application",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -25,10 +25,10 @@
25
25
  "esbuild": "^0.25.0",
26
26
  "handlebars": "^4.7.8",
27
27
  "minimist": "^1.2.8",
28
- "@forgehive/runner": "0.1.7",
28
+ "@forgehive/runner": "0.1.8",
29
+ "@forgehive/record-tape": "0.1.2",
29
30
  "@forgehive/schema": "0.1.4",
30
- "@forgehive/record-tape": "0.1.1",
31
- "@forgehive/task": "0.1.7"
31
+ "@forgehive/task": "0.1.8"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/jest": "^29.5.3",