@qaick/executor 0.2.1 → 0.2.2
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
/**
|
|
1
|
+
import { type ExecutableInput } from '@qaick/contract';
|
|
2
|
+
/** Resolve declared inputs using the canonical Contract rule; preserve undeclared/nested data. */
|
|
3
3
|
export declare function resolveDeclaredInputs(declarations?: readonly ExecutableInput[], arguments_?: Record<string, unknown>): {
|
|
4
4
|
inputs: {
|
|
5
|
-
[
|
|
5
|
+
[x: string]: unknown;
|
|
6
6
|
};
|
|
7
7
|
issues: {
|
|
8
8
|
code: string;
|
package/dist/declared-inputs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { isDeclaredInputNoValue } from '@qaick/contract';
|
|
2
|
+
/** Resolve declared inputs using the canonical Contract rule; preserve undeclared/nested data. */
|
|
2
3
|
export function resolveDeclaredInputs(declarations = [], arguments_ = {}) {
|
|
3
|
-
const inputs =
|
|
4
|
+
const inputs = { ...arguments_ };
|
|
4
5
|
const issues = [];
|
|
5
6
|
if (!Array.isArray(declarations))
|
|
6
7
|
return { inputs, issues: [{ code: 'INVALID_INPUT', message: 'Declared inputs must be an array.' }] };
|
|
@@ -11,9 +12,9 @@ export function resolveDeclaredInputs(declarations = [], arguments_ = {}) {
|
|
|
11
12
|
continue;
|
|
12
13
|
}
|
|
13
14
|
seen.add(declaration.name);
|
|
14
|
-
const supplied = Object.hasOwn(arguments_, declaration.name)
|
|
15
|
-
const value = supplied ?
|
|
16
|
-
if (value
|
|
15
|
+
const supplied = Object.hasOwn(arguments_, declaration.name) ? arguments_[declaration.name] : undefined;
|
|
16
|
+
const value = isDeclaredInputNoValue(supplied) ? declaration.defaultValue : supplied;
|
|
17
|
+
if (isDeclaredInputNoValue(value)) {
|
|
17
18
|
delete inputs[declaration.name];
|
|
18
19
|
if (declaration.required)
|
|
19
20
|
issues.push({ code: 'MISSING_INPUT', message: `Required input ${declaration.name} is missing.` });
|
|
@@ -22,7 +23,7 @@ export function resolveDeclaredInputs(declarations = [], arguments_ = {}) {
|
|
|
22
23
|
const validType = declaration.type === 'number' ? typeof value === 'number' && Number.isFinite(value)
|
|
23
24
|
: declaration.type === 'json' ? typeof value === 'object' && value !== null
|
|
24
25
|
: typeof value === declaration.type;
|
|
25
|
-
if (!validType
|
|
26
|
+
if (!validType) {
|
|
26
27
|
issues.push({ code: 'INVALID_INPUT', message: `Input ${declaration.name}: expected ${declaration.type}${declaration.required ? ' (required)' : ''}.` });
|
|
27
28
|
continue;
|
|
28
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qaick/executor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Host-neutral QAick action execution primitives.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@qaick/contract": "0.3.
|
|
37
|
+
"@qaick/contract": "0.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^24.13.3",
|