@forgehive/runner 0.2.6 → 0.3.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.
|
@@ -18,16 +18,13 @@ describe('Runner describe', () => {
|
|
|
18
18
|
task.setDescription('A test task that processes numbers');
|
|
19
19
|
runner.load('testTask', task);
|
|
20
20
|
const result = runner.describe();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
21
|
+
// schema is now serialized as JSON Schema (draft 2020-12)
|
|
22
|
+
expect(result.testTask.name).toBe('testTask');
|
|
23
|
+
expect(result.testTask.description).toBe('A test task that processes numbers');
|
|
24
|
+
expect(result.testTask.schema).toMatchObject({
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: { value: { type: 'number' } },
|
|
27
|
+
required: ['value']
|
|
31
28
|
});
|
|
32
29
|
});
|
|
33
30
|
it('should handle tasks without description or schema', () => {
|
|
@@ -42,12 +39,12 @@ describe('Runner describe', () => {
|
|
|
42
39
|
});
|
|
43
40
|
runner.load('simpleTask', task);
|
|
44
41
|
const result = runner.describe();
|
|
45
|
-
expect(result).
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
42
|
+
expect(result.simpleTask.name).toBe('simpleTask');
|
|
43
|
+
expect(result.simpleTask.description).toBeUndefined();
|
|
44
|
+
// empty schema -> JSON Schema object with no properties
|
|
45
|
+
expect(result.simpleTask.schema).toMatchObject({
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {}
|
|
51
48
|
});
|
|
52
49
|
});
|
|
53
50
|
it('should handle multiple tasks with task: prefix', () => {
|
|
@@ -75,28 +72,29 @@ describe('Runner describe', () => {
|
|
|
75
72
|
runner.load('task:run', runTask);
|
|
76
73
|
runner.load('task:create', createTaskInstance);
|
|
77
74
|
const result = runner.describe();
|
|
78
|
-
expect(result).
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
type: '
|
|
75
|
+
expect(result['task:run'].name).toBe('task:run');
|
|
76
|
+
expect(result['task:run'].description).toBe('Executes the task');
|
|
77
|
+
expect(result['task:run'].schema).toMatchObject({
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
descriptorName: { type: 'string' },
|
|
81
|
+
args: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
additionalProperties: {
|
|
84
|
+
anyOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }]
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
88
|
+
required: ['descriptorName', 'args']
|
|
89
|
+
});
|
|
90
|
+
expect(result['task:create'].name).toBe('task:create');
|
|
91
|
+
expect(result['task:create'].description).toBe('Creates a new task');
|
|
92
|
+
expect(result['task:create'].schema).toMatchObject({
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: {
|
|
95
|
+
descriptorName: { type: 'string' }
|
|
96
|
+
},
|
|
97
|
+
required: ['descriptorName']
|
|
100
98
|
});
|
|
101
99
|
});
|
|
102
100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.test.js","sourceRoot":"","sources":["../../src/test/describe.test.ts"],"names":[],"mappings":";;AAAA,oCAAiC;AACjC,0CAAoD;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,MAAM,GAAG,IAAI,cAAM,EAAE,CAAA;QAC3B,MAAM,MAAM,GAAG,IAAI,aAAM,CAAC;YACxB,KAAK,E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QAAQ,EAAE;gBAClC,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,oBAAoB,EAAE;wBACpB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;qBACrE;iBACF;aACF;YACD,QAAQ,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC;SACrC,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACtD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;QACpE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC;YACjD,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aACnC;YACD,QAAQ,EAAE,CAAC,gBAAgB,CAAC;SAC7B,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgehive/runner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@forgehive/schema": "^0.
|
|
12
|
-
"@forgehive/task": "^0.
|
|
11
|
+
"@forgehive/schema": "^0.2.0",
|
|
12
|
+
"@forgehive/task": "^0.3.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@forgehive/
|
|
17
|
-
"@forgehive/
|
|
16
|
+
"@forgehive/schema": "0.2.0",
|
|
17
|
+
"@forgehive/task": "0.3.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/jest": "^29.5.12",
|
|
@@ -21,16 +21,13 @@ describe('Runner describe', () => {
|
|
|
21
21
|
runner.load('testTask', task)
|
|
22
22
|
const result = runner.describe()
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
24
|
+
// schema is now serialized as JSON Schema (draft 2020-12)
|
|
25
|
+
expect(result.testTask.name).toBe('testTask')
|
|
26
|
+
expect(result.testTask.description).toBe('A test task that processes numbers')
|
|
27
|
+
expect(result.testTask.schema).toMatchObject({
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: { value: { type: 'number' } },
|
|
30
|
+
required: ['value']
|
|
34
31
|
})
|
|
35
32
|
})
|
|
36
33
|
|
|
@@ -49,12 +46,12 @@ describe('Runner describe', () => {
|
|
|
49
46
|
runner.load('simpleTask', task)
|
|
50
47
|
const result = runner.describe()
|
|
51
48
|
|
|
52
|
-
expect(result).
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
49
|
+
expect(result.simpleTask.name).toBe('simpleTask')
|
|
50
|
+
expect(result.simpleTask.description).toBeUndefined()
|
|
51
|
+
// empty schema -> JSON Schema object with no properties
|
|
52
|
+
expect(result.simpleTask.schema).toMatchObject({
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {}
|
|
58
55
|
})
|
|
59
56
|
})
|
|
60
57
|
|
|
@@ -91,28 +88,30 @@ describe('Runner describe', () => {
|
|
|
91
88
|
|
|
92
89
|
const result = runner.describe()
|
|
93
90
|
|
|
94
|
-
expect(result).
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
type: '
|
|
91
|
+
expect(result['task:run'].name).toBe('task:run')
|
|
92
|
+
expect(result['task:run'].description).toBe('Executes the task')
|
|
93
|
+
expect(result['task:run'].schema).toMatchObject({
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
descriptorName: { type: 'string' },
|
|
97
|
+
args: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
additionalProperties: {
|
|
100
|
+
anyOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }]
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
104
|
+
required: ['descriptorName', 'args']
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
expect(result['task:create'].name).toBe('task:create')
|
|
108
|
+
expect(result['task:create'].description).toBe('Creates a new task')
|
|
109
|
+
expect(result['task:create'].schema).toMatchObject({
|
|
110
|
+
type: 'object',
|
|
111
|
+
properties: {
|
|
112
|
+
descriptorName: { type: 'string' }
|
|
113
|
+
},
|
|
114
|
+
required: ['descriptorName']
|
|
116
115
|
})
|
|
117
116
|
})
|
|
118
117
|
})
|