@galaxy-tool-util/schema 0.2.0 → 1.0.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.
- package/dist/index.d.ts +86 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +60 -2
- package/dist/index.js.map +1 -1
- package/dist/schema/parameter-defaults.d.ts +36 -0
- package/dist/schema/parameter-defaults.d.ts.map +1 -0
- package/dist/schema/parameter-defaults.js +128 -0
- package/dist/schema/parameter-defaults.js.map +1 -0
- package/dist/schema/parsed-tool.d.ts +47 -0
- package/dist/schema/parsed-tool.d.ts.map +1 -0
- package/dist/schema/parsed-tool.js +49 -0
- package/dist/schema/parsed-tool.js.map +1 -0
- package/dist/schema/type-guards.d.ts +14 -0
- package/dist/schema/type-guards.d.ts.map +1 -0
- package/dist/schema/type-guards.js +25 -0
- package/dist/schema/type-guards.js.map +1 -0
- package/dist/test-format/cross-check/check.d.ts +18 -0
- package/dist/test-format/cross-check/check.d.ts.map +1 -0
- package/dist/test-format/cross-check/check.js +89 -0
- package/dist/test-format/cross-check/check.js.map +1 -0
- package/dist/test-format/cross-check/extract-format2.d.ts +13 -0
- package/dist/test-format/cross-check/extract-format2.d.ts.map +1 -0
- package/dist/test-format/cross-check/extract-format2.js +98 -0
- package/dist/test-format/cross-check/extract-format2.js.map +1 -0
- package/dist/test-format/cross-check/extract-native.d.ts +4 -0
- package/dist/test-format/cross-check/extract-native.d.ts.map +1 -0
- package/dist/test-format/cross-check/extract-native.js +89 -0
- package/dist/test-format/cross-check/extract-native.js.map +1 -0
- package/dist/test-format/cross-check/extract.d.ts +9 -0
- package/dist/test-format/cross-check/extract.d.ts.map +1 -0
- package/dist/test-format/cross-check/extract.js +16 -0
- package/dist/test-format/cross-check/extract.js.map +1 -0
- package/dist/test-format/cross-check/index.d.ts +7 -0
- package/dist/test-format/cross-check/index.d.ts.map +1 -0
- package/dist/test-format/cross-check/index.js +6 -0
- package/dist/test-format/cross-check/index.js.map +1 -0
- package/dist/test-format/cross-check/type-compat.d.ts +23 -0
- package/dist/test-format/cross-check/type-compat.d.ts.map +1 -0
- package/dist/test-format/cross-check/type-compat.js +48 -0
- package/dist/test-format/cross-check/type-compat.js.map +1 -0
- package/dist/test-format/cross-check/types.d.ts +23 -0
- package/dist/test-format/cross-check/types.d.ts.map +1 -0
- package/dist/test-format/cross-check/types.js +10 -0
- package/dist/test-format/cross-check/types.js.map +1 -0
- package/dist/test-format/index.d.ts +3 -0
- package/dist/test-format/index.d.ts.map +1 -0
- package/dist/test-format/index.js +3 -0
- package/dist/test-format/index.js.map +1 -0
- package/dist/test-format/tests.schema.generated.d.ts +5610 -0
- package/dist/test-format/tests.schema.generated.d.ts.map +1 -0
- package/dist/test-format/tests.schema.generated.js +6899 -0
- package/dist/test-format/tests.schema.generated.js.map +1 -0
- package/dist/test-format/validate.d.ts +20 -0
- package/dist/test-format/validate.d.ts.map +1 -0
- package/dist/test-format/validate.js +41 -0
- package/dist/test-format/validate.js.map +1 -0
- package/dist/tool-state-validator.d.ts +30 -0
- package/dist/tool-state-validator.d.ts.map +1 -0
- package/dist/tool-state-validator.js +59 -0
- package/dist/tool-state-validator.js.map +1 -0
- package/dist/workflow/clean.d.ts +29 -3
- package/dist/workflow/clean.d.ts.map +1 -1
- package/dist/workflow/clean.js +199 -28
- package/dist/workflow/clean.js.map +1 -1
- package/dist/workflow/fill-defaults.d.ts +39 -0
- package/dist/workflow/fill-defaults.d.ts.map +1 -0
- package/dist/workflow/fill-defaults.js +53 -0
- package/dist/workflow/fill-defaults.js.map +1 -0
- package/dist/workflow/index.d.ts +17 -5
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +17 -3
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/lint-profiles.d.ts +27 -0
- package/dist/workflow/lint-profiles.d.ts.map +1 -0
- package/dist/workflow/lint-profiles.js +49 -0
- package/dist/workflow/lint-profiles.js.map +1 -0
- package/dist/workflow/lint-rules.d.ts +15 -0
- package/dist/workflow/lint-rules.d.ts.map +1 -0
- package/dist/workflow/lint-rules.js +15 -0
- package/dist/workflow/lint-rules.js.map +1 -0
- package/dist/workflow/lint.d.ts +4 -18
- package/dist/workflow/lint.d.ts.map +1 -1
- package/dist/workflow/lint.js +9 -30
- package/dist/workflow/lint.js.map +1 -1
- package/dist/workflow/lint_profiles.yml +41 -0
- package/dist/workflow/linting.d.ts +54 -0
- package/dist/workflow/linting.d.ts.map +1 -0
- package/dist/workflow/linting.js +71 -0
- package/dist/workflow/linting.js.map +1 -0
- package/dist/workflow/mermaid.d.ts +11 -0
- package/dist/workflow/mermaid.d.ts.map +1 -0
- package/dist/workflow/mermaid.js +158 -0
- package/dist/workflow/mermaid.js.map +1 -0
- package/dist/workflow/minimal-tool-state.d.ts +15 -0
- package/dist/workflow/minimal-tool-state.d.ts.map +1 -0
- package/dist/workflow/minimal-tool-state.js +16 -0
- package/dist/workflow/minimal-tool-state.js.map +1 -0
- package/dist/workflow/param-navigation.d.ts +26 -0
- package/dist/workflow/param-navigation.d.ts.map +1 -0
- package/dist/workflow/param-navigation.js +60 -0
- package/dist/workflow/param-navigation.js.map +1 -0
- package/dist/workflow/raw/gxformat2.effect.d.ts +341 -117
- package/dist/workflow/raw/gxformat2.effect.d.ts.map +1 -1
- package/dist/workflow/raw/gxformat2.effect.js +107 -109
- package/dist/workflow/raw/gxformat2.effect.js.map +1 -1
- package/dist/workflow/raw/native.d.ts +2 -2
- package/dist/workflow/raw/native.d.ts.map +1 -1
- package/dist/workflow/raw/native.effect.d.ts +150 -3
- package/dist/workflow/raw/native.effect.d.ts.map +1 -1
- package/dist/workflow/raw/native.effect.js +3 -5
- package/dist/workflow/raw/native.effect.js.map +1 -1
- package/dist/workflow/report-models.d.ts +412 -0
- package/dist/workflow/report-models.d.ts.map +1 -0
- package/dist/workflow/report-models.js +342 -0
- package/dist/workflow/report-models.js.map +1 -0
- package/dist/workflow/roundtrip.d.ts +31 -8
- package/dist/workflow/roundtrip.d.ts.map +1 -1
- package/dist/workflow/roundtrip.js +107 -26
- package/dist/workflow/roundtrip.js.map +1 -1
- package/dist/workflow/schema-rules.d.ts +38 -0
- package/dist/workflow/schema-rules.d.ts.map +1 -0
- package/dist/workflow/schema-rules.js +28 -0
- package/dist/workflow/schema-rules.js.map +1 -0
- package/dist/workflow/schema_rules.yml +69 -0
- package/dist/workflow/serialize.d.ts +30 -0
- package/dist/workflow/serialize.d.ts.map +1 -0
- package/dist/workflow/serialize.js +37 -0
- package/dist/workflow/serialize.js.map +1 -0
- package/dist/workflow/state-merge.d.ts +15 -32
- package/dist/workflow/state-merge.d.ts.map +1 -1
- package/dist/workflow/state-merge.js +30 -207
- package/dist/workflow/state-merge.js.map +1 -1
- package/dist/workflow/stateful-validate.d.ts +21 -0
- package/dist/workflow/stateful-validate.d.ts.map +1 -1
- package/dist/workflow/stateful-validate.js +27 -0
- package/dist/workflow/stateful-validate.js.map +1 -1
- package/dist/workflow/step-skeleton.d.ts +29 -0
- package/dist/workflow/step-skeleton.d.ts.map +1 -0
- package/dist/workflow/step-skeleton.js +55 -0
- package/dist/workflow/step-skeleton.js.map +1 -0
- package/dist/workflow/strict-checks.d.ts +22 -0
- package/dist/workflow/strict-checks.d.ts.map +1 -0
- package/dist/workflow/strict-checks.js +95 -0
- package/dist/workflow/strict-checks.js.map +1 -0
- package/dist/workflow/tool-state-io.d.ts +14 -0
- package/dist/workflow/tool-state-io.d.ts.map +1 -0
- package/dist/workflow/tool-state-io.js +33 -0
- package/dist/workflow/tool-state-io.js.map +1 -0
- package/dist/workflow/validators.d.ts +34 -0
- package/dist/workflow/validators.d.ts.map +1 -0
- package/dist/workflow/validators.js +83 -0
- package/dist/workflow/validators.js.map +1 -0
- package/dist/workflow/walk-helpers.d.ts +29 -0
- package/dist/workflow/walk-helpers.d.ts.map +1 -0
- package/dist/workflow/walk-helpers.js +89 -0
- package/dist/workflow/walk-helpers.js.map +1 -0
- package/dist/workflow/walker.d.ts +12 -0
- package/dist/workflow/walker.d.ts.map +1 -1
- package/dist/workflow/walker.js +27 -8
- package/dist/workflow/walker.js.map +1 -1
- package/package.json +6 -7
package/dist/workflow/clean.js
CHANGED
|
@@ -5,20 +5,39 @@
|
|
|
5
5
|
* (__page__, __rerun_remap_job_id__), runtime leak keys (chromInfo, __input_ext),
|
|
6
6
|
* and decodes JSON-encoded tool_state strings into proper dicts.
|
|
7
7
|
*
|
|
8
|
+
* Also strips Galaxy-injected structural properties (`uuid`, `errors`) from both
|
|
9
|
+
* native and format2 workflow and step dicts.
|
|
10
|
+
*
|
|
8
11
|
* Also provides a tool-definition-aware strip (`stripStaleKeysToolAware`)
|
|
9
12
|
* that mirrors Galaxy's `clean._strip_recursive`: uses the declared
|
|
10
13
|
* parameter tree to drop any undeclared key (runtime leaks, stale-branch
|
|
11
14
|
* params, tool-upgrade residue) honoring conditional branch selection,
|
|
12
15
|
* repeat expansion, and section nesting.
|
|
13
16
|
*/
|
|
14
|
-
import {
|
|
17
|
+
import { cleanDisplayLabel } from "./report-models.js";
|
|
18
|
+
import { detectFormat } from "./detect-format.js";
|
|
19
|
+
import { walkNativeState, walkFormat2State, SKIP_VALUE } from "./walker.js";
|
|
15
20
|
/** Keys injected by Galaxy's tool form machinery — never meaningful in saved workflows. */
|
|
16
21
|
const BOOKKEEPING_KEYS = new Set(["__page__", "__rerun_remap_job_id__"]);
|
|
22
|
+
/** Canonical position keys — only left/top are kept; browser-computed extras are stripped. */
|
|
23
|
+
const POSITION_CANONICAL_KEYS = new Set(["left", "top"]);
|
|
17
24
|
/** Keys leaked from runtime context into saved state. */
|
|
18
25
|
const RUNTIME_LEAK_KEYS = new Set(["chromInfo", "__input_ext"]);
|
|
19
26
|
/** Internal indexing keys within conditionals and repeats. */
|
|
20
27
|
const INTERNAL_KEYS = new Set(["__current_case__", "__index__"]);
|
|
21
28
|
const STALE_KEYS = new Set([...BOOKKEEPING_KEYS, ...RUNTIME_LEAK_KEYS, ...INTERNAL_KEYS]);
|
|
29
|
+
/**
|
|
30
|
+
* Galaxy-injected structural properties — present on workflow and step dicts
|
|
31
|
+
* in both native and format2 exports, but not meaningful in saved/shared
|
|
32
|
+
* workflows. Stripped from workflow-level and step-level dicts.
|
|
33
|
+
*
|
|
34
|
+
* `position` is intentionally excluded — it is a legitimate workflow property
|
|
35
|
+
* that VS Code and other tools may use.
|
|
36
|
+
*
|
|
37
|
+
* `errors` is always stripped. `uuid` is stripped by default but can be
|
|
38
|
+
* suppressed with `CleanWorkflowOptions.skipUuid`.
|
|
39
|
+
*/
|
|
40
|
+
const ALWAYS_STRIP_STEP_KEYS = new Set(["errors"]);
|
|
22
41
|
/**
|
|
23
42
|
* Decode a legacy JSON-encoded tool_state value. If the value is a string
|
|
24
43
|
* that parses to a compound type (object/array), return the parsed value and
|
|
@@ -75,12 +94,14 @@ function parseToolState(toolState) {
|
|
|
75
94
|
}
|
|
76
95
|
return null;
|
|
77
96
|
}
|
|
78
|
-
/** Recursively remove stale keys from a tool_state dict. */
|
|
79
|
-
function stripStaleKeys(state) {
|
|
97
|
+
/** Recursively remove stale keys from a tool_state dict, tracking removed top-level keys. */
|
|
98
|
+
function stripStaleKeys(state, removedKeys) {
|
|
80
99
|
const result = {};
|
|
81
100
|
for (const [key, value] of Object.entries(state)) {
|
|
82
|
-
if (STALE_KEYS.has(key))
|
|
101
|
+
if (STALE_KEYS.has(key)) {
|
|
102
|
+
removedKeys?.push(key);
|
|
83
103
|
continue;
|
|
104
|
+
}
|
|
84
105
|
result[key] = stripStaleValue(value);
|
|
85
106
|
}
|
|
86
107
|
return result;
|
|
@@ -95,35 +116,114 @@ function stripStaleValue(value) {
|
|
|
95
116
|
}
|
|
96
117
|
return value;
|
|
97
118
|
}
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Strip Galaxy-injected structural properties from a step dict in-place.
|
|
121
|
+
* Always removes `errors`; removes `uuid` unless `skipUuid` is true.
|
|
122
|
+
* Returns the list of keys actually removed.
|
|
123
|
+
*/
|
|
124
|
+
function stripStructuralStep(stepDict, skipUuid) {
|
|
125
|
+
const removed = [];
|
|
126
|
+
for (const key of ALWAYS_STRIP_STEP_KEYS) {
|
|
127
|
+
if (key in stepDict) {
|
|
128
|
+
delete stepDict[key];
|
|
129
|
+
removed.push(key);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (!skipUuid && "uuid" in stepDict) {
|
|
133
|
+
delete stepDict.uuid;
|
|
134
|
+
removed.push("uuid");
|
|
135
|
+
}
|
|
136
|
+
return removed;
|
|
137
|
+
}
|
|
138
|
+
/** Clean a single native step's tool_state in place, returning step result info. */
|
|
139
|
+
async function cleanNativeStep(stepDef, stepLabel, opts) {
|
|
140
|
+
const toolId = stepDef.tool_id ?? null;
|
|
141
|
+
const toolVersion = stepDef.tool_version ?? null;
|
|
142
|
+
// Strip structural properties from the step dict itself (uuid, errors)
|
|
143
|
+
const removedKeys = stripStructuralStep(stepDef, opts.skipUuid ?? false);
|
|
144
|
+
if (!toolId) {
|
|
145
|
+
return {
|
|
146
|
+
step: stepLabel,
|
|
147
|
+
tool_id: null,
|
|
148
|
+
version: null,
|
|
149
|
+
removed_keys: removedKeys,
|
|
150
|
+
skipped: true,
|
|
151
|
+
skip_reason: "no tool_id",
|
|
152
|
+
display_label: cleanDisplayLabel(null, null),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
103
155
|
const rawState = stepDef.tool_state;
|
|
104
|
-
if (rawState === undefined || rawState === null)
|
|
105
|
-
return
|
|
156
|
+
if (rawState === undefined || rawState === null) {
|
|
157
|
+
return {
|
|
158
|
+
step: stepLabel,
|
|
159
|
+
tool_id: toolId,
|
|
160
|
+
version: toolVersion,
|
|
161
|
+
removed_keys: removedKeys,
|
|
162
|
+
skipped: true,
|
|
163
|
+
skip_reason: "no tool_state",
|
|
164
|
+
display_label: cleanDisplayLabel(toolId, toolVersion),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
106
167
|
const parsed = parseToolState(rawState);
|
|
107
|
-
if (!parsed)
|
|
108
|
-
return
|
|
109
|
-
|
|
168
|
+
if (!parsed) {
|
|
169
|
+
return {
|
|
170
|
+
step: stepLabel,
|
|
171
|
+
tool_id: toolId,
|
|
172
|
+
version: toolVersion,
|
|
173
|
+
removed_keys: removedKeys,
|
|
174
|
+
skipped: true,
|
|
175
|
+
skip_reason: "unparseable tool_state",
|
|
176
|
+
display_label: cleanDisplayLabel(toolId, toolVersion),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
let cleaned = stripStaleKeys(parsed, removedKeys);
|
|
180
|
+
// Tool-aware strip: drop keys not in the tool's parameter tree
|
|
181
|
+
if (opts.toolInputsResolver) {
|
|
182
|
+
const inputs = opts.toolInputsResolver(toolId, toolVersion);
|
|
183
|
+
if (inputs) {
|
|
184
|
+
const inputConnections = (stepDef.input_connections ?? {});
|
|
185
|
+
cleaned = stripStaleKeysToolAware(cleaned, inputs, inputConnections);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
stepDef.tool_state = cleaned;
|
|
189
|
+
return {
|
|
190
|
+
step: stepLabel,
|
|
191
|
+
tool_id: toolId,
|
|
192
|
+
version: toolVersion,
|
|
193
|
+
removed_keys: removedKeys,
|
|
194
|
+
skipped: false,
|
|
195
|
+
skip_reason: "",
|
|
196
|
+
display_label: cleanDisplayLabel(toolId, toolVersion),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/** Normalize a step's position dict to only canonical keys (left, top). */
|
|
200
|
+
function normalizeStepPosition(stepDef) {
|
|
201
|
+
const pos = stepDef.position;
|
|
202
|
+
if (pos !== null && typeof pos === "object" && !Array.isArray(pos)) {
|
|
203
|
+
for (const key of Object.keys(pos)) {
|
|
204
|
+
if (!POSITION_CANONICAL_KEYS.has(key)) {
|
|
205
|
+
delete pos[key];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
110
209
|
}
|
|
111
210
|
/** Recursively clean all steps in a native workflow dict. */
|
|
112
|
-
function cleanNativeSteps(workflowDict) {
|
|
211
|
+
async function cleanNativeSteps(workflowDict, opts, prefix = "") {
|
|
113
212
|
const steps = workflowDict.steps;
|
|
114
213
|
if (!steps)
|
|
115
|
-
return;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
214
|
+
return [];
|
|
215
|
+
const results = [];
|
|
216
|
+
for (const [key, stepDef] of Object.entries(steps)) {
|
|
217
|
+
const stepLabel = prefix ? `${prefix}${key}` : key;
|
|
218
|
+
normalizeStepPosition(stepDef);
|
|
119
219
|
if (stepDef.type === "subworkflow" && stepDef.subworkflow) {
|
|
120
|
-
cleanNativeSteps(stepDef.subworkflow);
|
|
220
|
+
results.push(...(await cleanNativeSteps(stepDef.subworkflow, opts, `${stepLabel}.`)));
|
|
121
221
|
continue;
|
|
122
222
|
}
|
|
123
|
-
cleanNativeStep(stepDef);
|
|
223
|
+
results.push(await cleanNativeStep(stepDef, stepLabel, opts));
|
|
124
224
|
}
|
|
225
|
+
return results;
|
|
125
226
|
}
|
|
126
|
-
import { detectFormat } from "./detect-format.js";
|
|
127
227
|
/**
|
|
128
228
|
* Strip all keys from a native step's `tool_state` that are not declared in
|
|
129
229
|
* the tool's parameter tree. Mirrors Galaxy's `clean._strip_recursive`.
|
|
@@ -147,14 +247,85 @@ export function stripStaleKeysToolAware(state, toolInputs, inputConnections = {}
|
|
|
147
247
|
return walkNativeState(inputConnections, toolInputs, state, (_input, value) => value === undefined ? SKIP_VALUE : value);
|
|
148
248
|
}
|
|
149
249
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
250
|
+
* Strip all keys from a format2 step's `state` that are not declared in
|
|
251
|
+
* the tool's parameter tree. Format2 analogue of `stripStaleKeysToolAware`.
|
|
252
|
+
*/
|
|
253
|
+
function stripStaleKeysToolAwareFormat2(state, toolInputs) {
|
|
254
|
+
return walkFormat2State(toolInputs, state, (_input, value) => value === undefined ? SKIP_VALUE : value);
|
|
255
|
+
}
|
|
256
|
+
/** Clean a single format2 step dict in place, returning step result info. */
|
|
257
|
+
async function cleanFormat2Step(stepDef, stepLabel, opts) {
|
|
258
|
+
const toolId = stepDef.tool_id ?? null;
|
|
259
|
+
const toolVersion = stepDef.tool_version ?? null;
|
|
260
|
+
const removedKeys = stripStructuralStep(stepDef, opts.skipUuid ?? false);
|
|
261
|
+
// Tool-aware strip on `state` field
|
|
262
|
+
if (opts.toolInputsResolver && toolId) {
|
|
263
|
+
const inputs = opts.toolInputsResolver(toolId, toolVersion);
|
|
264
|
+
if (inputs) {
|
|
265
|
+
if (stepDef.state && typeof stepDef.state === "object" && !Array.isArray(stepDef.state)) {
|
|
266
|
+
stepDef.state = stripStaleKeysToolAwareFormat2(stepDef.state, inputs);
|
|
267
|
+
}
|
|
268
|
+
if (stepDef.tool_state &&
|
|
269
|
+
typeof stepDef.tool_state === "object" &&
|
|
270
|
+
!Array.isArray(stepDef.tool_state)) {
|
|
271
|
+
stepDef.tool_state = stripStaleKeysToolAwareFormat2(stepDef.tool_state, inputs);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
step: stepLabel,
|
|
277
|
+
tool_id: toolId,
|
|
278
|
+
version: toolVersion,
|
|
279
|
+
removed_keys: removedKeys,
|
|
280
|
+
skipped: false,
|
|
281
|
+
skip_reason: "",
|
|
282
|
+
display_label: cleanDisplayLabel(toolId, toolVersion),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
/** Clean all steps in a format2 workflow dict. Steps may be a list or a dict. */
|
|
286
|
+
async function cleanFormat2Steps(workflowDict, opts) {
|
|
287
|
+
const rawSteps = workflowDict.steps;
|
|
288
|
+
if (!rawSteps)
|
|
289
|
+
return [];
|
|
290
|
+
const results = [];
|
|
291
|
+
if (Array.isArray(rawSteps)) {
|
|
292
|
+
for (let i = 0; i < rawSteps.length; i++) {
|
|
293
|
+
const stepDef = rawSteps[i];
|
|
294
|
+
const label = stepDef.label ?? stepDef.id ?? String(i);
|
|
295
|
+
results.push(await cleanFormat2Step(stepDef, label, opts));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else if (rawSteps !== null && typeof rawSteps === "object") {
|
|
299
|
+
for (const [key, stepDef] of Object.entries(rawSteps)) {
|
|
300
|
+
const step = stepDef;
|
|
301
|
+
const label = step.label ?? step.id ?? key;
|
|
302
|
+
results.push(await cleanFormat2Step(step, label, opts));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return results;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Clean a workflow — strip structural properties (`uuid`, `errors`), stale
|
|
309
|
+
* tool_state bookkeeping keys, and decode legacy tool_state encoding.
|
|
310
|
+
*
|
|
311
|
+
* Mutates the workflow dict in place. Handles both native and format2 formats.
|
|
312
|
+
* Returns both the mutated workflow and per-step clean results.
|
|
313
|
+
*
|
|
314
|
+
* When `opts.toolInputsResolver` is provided, also performs tool-aware stale
|
|
315
|
+
* key removal: drops any `tool_state` / `state` keys not declared in the
|
|
316
|
+
* tool's parameter tree (native via `stripStaleKeysToolAware`, format2 via
|
|
317
|
+
* `walkFormat2State`). Steps whose tool is not found in the resolver are
|
|
318
|
+
* left unchanged.
|
|
152
319
|
*/
|
|
153
|
-
export function cleanWorkflow(workflowDict) {
|
|
320
|
+
export async function cleanWorkflow(workflowDict, opts = {}) {
|
|
321
|
+
// Strip workflow-level uuid from both formats
|
|
322
|
+
if (!opts.skipUuid)
|
|
323
|
+
delete workflowDict.uuid;
|
|
154
324
|
if (detectFormat(workflowDict) === "format2") {
|
|
155
|
-
|
|
325
|
+
const results = await cleanFormat2Steps(workflowDict, opts);
|
|
326
|
+
return { workflow: workflowDict, results };
|
|
156
327
|
}
|
|
157
|
-
cleanNativeSteps(workflowDict);
|
|
158
|
-
return workflowDict;
|
|
328
|
+
const results = await cleanNativeSteps(workflowDict, opts);
|
|
329
|
+
return { workflow: workflowDict, results };
|
|
159
330
|
}
|
|
160
331
|
//# sourceMappingURL=clean.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/workflow/clean.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/workflow/clean.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG5E,2FAA2F;AAC3F,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAEzE,8FAA8F;AAC9F,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAEzD,yDAAyD;AACzD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAEhE,8DAA8D;AAC9D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC;AAEjE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,gBAAgB,EAAE,GAAG,iBAAiB,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC;AAE1F;;;;;;;;;;GAUG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC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GAAG,CAAC;YAC3F,OAAO,CAAC,IAAI,CAAC,MAAM,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAgBD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,YAAqC,EACrC,OAA6B,EAAE;IAE/B,8CAA8C;IAC9C,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO,YAAY,CAAC,IAAI,CAAC;IAE7C,IAAI,YAAY,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC5D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC3D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expand defaults into a tool state dict.
|
|
3
|
+
*
|
|
4
|
+
* Port of `galaxy.tool_util.parameters.convert.fill_static_defaults` (partial=True).
|
|
5
|
+
* Pure, idempotent. Reads currentState so conditional branches honor the user's
|
|
6
|
+
* active `test_value`, repeats preserve existing instances, and sections recurse
|
|
7
|
+
* into present subdicts. Does not validate. Does not pre-fill data /
|
|
8
|
+
* data_collection (non-optional) / data_column / baseurl / color / directory_uri /
|
|
9
|
+
* group_tag / rules inputs — the user must wire those explicitly.
|
|
10
|
+
*
|
|
11
|
+
* Designed for user-invoked "expand defaults" actions and scripting use cases
|
|
12
|
+
* where an explicit dump of defaults is wanted. Not used by the step-skeleton
|
|
13
|
+
* generator (which builds minimal state via `buildMinimalToolState`).
|
|
14
|
+
*
|
|
15
|
+
* Divergence from Python: when a conditional's `test_value` matches no `when`
|
|
16
|
+
* and no branch is flagged `is_default_when`, Python raises. Here, we stay
|
|
17
|
+
* lenient via the existing walker semantics — the test parameter still gets
|
|
18
|
+
* its default filled, but no branch defaults are emitted. This avoids crashing
|
|
19
|
+
* on corrupt/partially-authored workflows, which matters for a user-invoked
|
|
20
|
+
* UI action.
|
|
21
|
+
*/
|
|
22
|
+
import type { ToolParameterModel } from "../schema/bundle-types.js";
|
|
23
|
+
/**
|
|
24
|
+
* Return a new tool state dict with defaults filled in for any parameter
|
|
25
|
+
* absent from `currentState`. Does not validate.
|
|
26
|
+
*
|
|
27
|
+
* Idempotent: `expandToolStateDefaults(t, expandToolStateDefaults(t, s))`
|
|
28
|
+
* deep-equals `expandToolStateDefaults(t, s)`.
|
|
29
|
+
*
|
|
30
|
+
* Honors the user's active conditional `test_value` (only the chosen branch's
|
|
31
|
+
* defaults are filled). Existing repeat instances are preserved and recursed
|
|
32
|
+
* into; empty repeats are padded to `repeat.min`. Sections present in state
|
|
33
|
+
* are recursed; absent sections are created as `{}` and filled.
|
|
34
|
+
*
|
|
35
|
+
* Unknown keys (including bookkeeping like `__current_case__`) are preserved
|
|
36
|
+
* in the output.
|
|
37
|
+
*/
|
|
38
|
+
export declare function expandToolStateDefaults(toolInputs: ToolParameterModel[], currentState: Record<string, unknown>): Record<string, unknown>;
|
|
39
|
+
//# sourceMappingURL=fill-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill-defaults.d.ts","sourceRoot":"","sources":["../../src/workflow/fill-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAQpE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,kBAAkB,EAAE,EAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expand defaults into a tool state dict.
|
|
3
|
+
*
|
|
4
|
+
* Port of `galaxy.tool_util.parameters.convert.fill_static_defaults` (partial=True).
|
|
5
|
+
* Pure, idempotent. Reads currentState so conditional branches honor the user's
|
|
6
|
+
* active `test_value`, repeats preserve existing instances, and sections recurse
|
|
7
|
+
* into present subdicts. Does not validate. Does not pre-fill data /
|
|
8
|
+
* data_collection (non-optional) / data_column / baseurl / color / directory_uri /
|
|
9
|
+
* group_tag / rules inputs — the user must wire those explicitly.
|
|
10
|
+
*
|
|
11
|
+
* Designed for user-invoked "expand defaults" actions and scripting use cases
|
|
12
|
+
* where an explicit dump of defaults is wanted. Not used by the step-skeleton
|
|
13
|
+
* generator (which builds minimal state via `buildMinimalToolState`).
|
|
14
|
+
*
|
|
15
|
+
* Divergence from Python: when a conditional's `test_value` matches no `when`
|
|
16
|
+
* and no branch is flagged `is_default_when`, Python raises. Here, we stay
|
|
17
|
+
* lenient via the existing walker semantics — the test parameter still gets
|
|
18
|
+
* its default filled, but no branch defaults are emitted. This avoids crashing
|
|
19
|
+
* on corrupt/partially-authored workflows, which matters for a user-invoked
|
|
20
|
+
* UI action.
|
|
21
|
+
*/
|
|
22
|
+
import { NO_DEFAULT, coerceTextNullIfNeeded, scalarParameterDefault, } from "../schema/parameter-defaults.js";
|
|
23
|
+
import { SKIP_VALUE, walkNativeState } from "./walker.js";
|
|
24
|
+
/**
|
|
25
|
+
* Return a new tool state dict with defaults filled in for any parameter
|
|
26
|
+
* absent from `currentState`. Does not validate.
|
|
27
|
+
*
|
|
28
|
+
* Idempotent: `expandToolStateDefaults(t, expandToolStateDefaults(t, s))`
|
|
29
|
+
* deep-equals `expandToolStateDefaults(t, s)`.
|
|
30
|
+
*
|
|
31
|
+
* Honors the user's active conditional `test_value` (only the chosen branch's
|
|
32
|
+
* defaults are filled). Existing repeat instances are preserved and recursed
|
|
33
|
+
* into; empty repeats are padded to `repeat.min`. Sections present in state
|
|
34
|
+
* are recursed; absent sections are created as `{}` and filled.
|
|
35
|
+
*
|
|
36
|
+
* Unknown keys (including bookkeeping like `__current_case__`) are preserved
|
|
37
|
+
* in the output.
|
|
38
|
+
*/
|
|
39
|
+
export function expandToolStateDefaults(toolInputs, currentState) {
|
|
40
|
+
return walkNativeState({}, toolInputs, currentState, (param, value) => {
|
|
41
|
+
if (value === undefined) {
|
|
42
|
+
const def = scalarParameterDefault(param);
|
|
43
|
+
if (def === NO_DEFAULT)
|
|
44
|
+
return SKIP_VALUE;
|
|
45
|
+
return def;
|
|
46
|
+
}
|
|
47
|
+
const coerced = coerceTextNullIfNeeded(param, value);
|
|
48
|
+
if (coerced !== NO_DEFAULT)
|
|
49
|
+
return coerced;
|
|
50
|
+
return value;
|
|
51
|
+
}, { preserveUnknownKeys: true, repeatMinPad: true });
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=fill-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill-defaults.js","sourceRoot":"","sources":["../../src/workflow/fill-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAgC,EAChC,YAAqC;IAErC,OAAO,eAAe,CACpB,EAAE,EACF,UAAU,EACV,YAAY,EACZ,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACf,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,GAAG,KAAK,UAAU;gBAAE,OAAO,UAAU,CAAC;YAC1C,OAAO,GAAG,CAAC;QACb,CAAC;QACD,MAAM,OAAO,GAAG,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,OAAO,KAAK,UAAU;YAAE,OAAO,OAAO,CAAC;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC,EACD,EAAE,mBAAmB,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAClD,CAAC;AACJ,CAAC"}
|
package/dist/workflow/index.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
export { serializeWorkflow, resolveFormat, type SerializeWorkflowOptions } from "./serialize.js";
|
|
1
2
|
export { type GalaxyWorkflow, GalaxyWorkflowSchema, type NativeGalaxyWorkflow, NativeGalaxyWorkflowSchema, } from "./raw/index.js";
|
|
2
3
|
export { normalizedFormat2, NormalizedFormat2WorkflowSchema, NormalizedFormat2StepSchema, NormalizedFormat2InputSchema, NormalizedFormat2OutputSchema, NormalizedFormat2StepInputSchema, NormalizedFormat2StepOutputSchema, type NormalizedFormat2Workflow, type NormalizedFormat2Step, type NormalizedFormat2Input, type NormalizedFormat2Output, type NormalizedFormat2StepInput, type NormalizedFormat2StepOutput, normalizedNative, NormalizedNativeWorkflowSchema, NormalizedNativeStepSchema, ToolReferenceSchema, type NormalizedNativeWorkflow, type NormalizedNativeStep, type ToolReference, toFormat2, type ToFormat2Options, type Format2StateOverride, toNative, type ToNativeOptions, toFormat2Stateful, toNativeStateful, type StepConversionStatus, type StepConversionFailureClass, type StatefulExportResult, type StatefulNativeResult, type ToolInputsResolver, ensureFormat2, ensureNative, expandedFormat2, expandedNative, isTrsUrl, MAX_EXPANSION_DEPTH, type ExpandedFormat2Workflow, type ExpandedFormat2Step, type ExpandedNativeWorkflow, type ExpandedNativeStep, type RefResolver, type ExpansionOptions, flattenCommentData, unflattenCommentData, resolveSourceReference, UNLABELED_INPUT_PREFIX, UNLABELED_STEP_PREFIX, } from "./normalized/index.js";
|
|
3
|
-
export {
|
|
4
|
+
export { flatStatePath, keysStartingWith, repeatInputsToArray, selectWhichWhen, } from "./walk-helpers.js";
|
|
5
|
+
export { injectConnectionsIntoState, stripConnectedValues } from "./state-merge.js";
|
|
6
|
+
export { expandToolStateDefaults } from "./fill-defaults.js";
|
|
7
|
+
export { buildMinimalToolState } from "./minimal-tool-state.js";
|
|
8
|
+
export { buildNativeStep, buildFormat2Step, buildStep, type StepSkeletonInputs, } from "./step-skeleton.js";
|
|
4
9
|
export { scanForReplacements, type ReplacementClassification } from "./replacement-scan.js";
|
|
5
10
|
export { scanToolState, type LegacyEncodingClassification, type LegacyEncodingHit, type LegacyEncodingScanResult, } from "./legacy-encoding.js";
|
|
6
11
|
export { walkNativeState, walkFormat2State, SKIP_VALUE, UnknownKeyError, type LeafCallback, type WalkNativeOptions, } from "./walker.js";
|
|
7
12
|
export { convertScalarValue, reverseScalarValue, convertStateToFormat2, encodeStateToNative, type Format2ConvertedState, } from "./stateful-convert.js";
|
|
8
13
|
export { precheckNativeWorkflow, precheckNativeStep, type PrecheckResult, type StepPrecheckResult, } from "./precheck.js";
|
|
9
|
-
export { ConversionValidationFailure, validateNativeStepState, validateFormat2StepState, type ValidationPhase, } from "./stateful-validate.js";
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
14
|
+
export { ConversionValidationFailure, validateNativeStepState, validateFormat2StepState, validateFormat2StepStateStrict, type ToolStateDiagnostic, type ValidationPhase, } from "./stateful-validate.js";
|
|
15
|
+
export { findParamAtPath, type ParamNavigationResult } from "./param-navigation.js";
|
|
16
|
+
export { roundtripValidate, type RoundtripResult, type RoundtripStrictOptions, type StepRoundtripResult, type BenignArtifactKind, type RoundtripFailureClass, } from "./roundtrip.js";
|
|
17
|
+
export { cleanWorkflow, type CleanWorkflowOptions, type CleanWorkflowResult } from "./clean.js";
|
|
18
|
+
export { workflowToMermaid, type MermaidOptions } from "./mermaid.js";
|
|
12
19
|
export { detectFormat, type WorkflowFormat } from "./detect-format.js";
|
|
13
|
-
export {
|
|
20
|
+
export { withClass, validateFormat2, validateFormat2Strict, validateNative, validateNativeStrict, validatorForFixture, } from "./validators.js";
|
|
21
|
+
export { validateEncodingNative, validateEncodingFormat2, checkStrictEncoding, checkStrictStructure, } from "./strict-checks.js";
|
|
22
|
+
export { LintContext, LintMessage, Linter, LEVEL_ERROR, LEVEL_WARN, lintNative, lintFormat2, lintWorkflow, lintBestPracticesFormat2, lintBestPracticesNative, type LintLevel, type LintResult, type LinterRef, type EmitOptions, } from "./lint.js";
|
|
23
|
+
export { NativeStepKeyNotInteger } from "./lint-rules.js";
|
|
24
|
+
export { parseLintProfiles, lintProfilesById, rulesForProfile, iwcRuleIds, LINT_PROFILES_FILENAME, IWC_PROFILE_NAMES, type LintProfile, } from "./lint-profiles.js";
|
|
25
|
+
export { type StepStatus, SKIP_STATUSES, type ValidationStepResult, type CleanStepResult, type ResolvedOutputType, type ConnectionResult, type ConnectionStepResult, type ConnectionValidationReport, type WorkflowEntry, type WorkflowIndex, type SingleValidationReport, type SingleLintReport, type SingleCleanReport, type DiffType, type DiffSeverity, type BenignArtifact, type StepDiff, type SkipWorkflowReason, type FailureClass, type StepResult, type RoundTripResult, type StepIdMappingResult, type RoundTripValidationResult, type SingleRoundTripReport, type SingleExportReport, type StepEncodeStatus, type ToNativeResult, type WorkflowSourceFormat, type ExportResult, type ConvertResult, type WorkflowValidationResult, type LintWorkflowResult, type WorkflowCleanResult, type CategoryGroup, type TreeValidationReport, type LintTreeReport, type TreeCleanReport, type WorkflowExportResult, type ExportTreeReport, type WorkflowToNativeResult, type ToNativeTreeReport, type ToolFailureMode, type RoundTripTreeReport, validationSummary, validationFailures, cleanDisplayLabel, categoryOf, groupByCategory, buildSingleValidationReport, buildSingleLintReport, buildSingleCleanReport, buildWorkflowValidationResult, buildLintWorkflowResult, buildWorkflowCleanResult, buildTreeValidationReport, buildLintTreeReport, buildTreeCleanReport, buildWorkflowExportResult, buildExportTreeReport, buildWorkflowToNativeResult, buildToNativeTreeReport, buildRoundTripTreeReport, } from "./report-models.js";
|
|
14
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,+BAA+B,EAC/B,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,iCAAiC,EACjC,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,gBAAgB,EAChB,8BAA8B,EAC9B,0BAA0B,EAC1B,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,QAAQ,EACR,KAAK,eAAe,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,
|
|
1
|
+
{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qBAAqB,EAE1B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,aAAa,EAElB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
package/dist/workflow/index.js
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
|
+
// Format-aware serialization helpers
|
|
2
|
+
export { serializeWorkflow, resolveFormat } from "./serialize.js";
|
|
1
3
|
// Raw (generated) workflow schema types
|
|
2
4
|
export { GalaxyWorkflowSchema, NativeGalaxyWorkflowSchema, } from "./raw/index.js";
|
|
3
5
|
// Normalized workflow types + normalizers
|
|
4
6
|
export { normalizedFormat2, NormalizedFormat2WorkflowSchema, NormalizedFormat2StepSchema, NormalizedFormat2InputSchema, NormalizedFormat2OutputSchema, NormalizedFormat2StepInputSchema, NormalizedFormat2StepOutputSchema, normalizedNative, NormalizedNativeWorkflowSchema, NormalizedNativeStepSchema, ToolReferenceSchema, toFormat2, toNative, toFormat2Stateful, toNativeStateful, ensureFormat2, ensureNative, expandedFormat2, expandedNative, isTrsUrl, MAX_EXPANSION_DEPTH, flattenCommentData, unflattenCommentData, resolveSourceReference, UNLABELED_INPUT_PREFIX, UNLABELED_STEP_PREFIX, } from "./normalized/index.js";
|
|
5
|
-
export {
|
|
7
|
+
export { flatStatePath, keysStartingWith, repeatInputsToArray, selectWhichWhen, } from "./walk-helpers.js";
|
|
8
|
+
export { injectConnectionsIntoState, stripConnectedValues } from "./state-merge.js";
|
|
9
|
+
export { expandToolStateDefaults } from "./fill-defaults.js";
|
|
10
|
+
export { buildMinimalToolState } from "./minimal-tool-state.js";
|
|
11
|
+
export { buildNativeStep, buildFormat2Step, buildStep, } from "./step-skeleton.js";
|
|
6
12
|
export { scanForReplacements } from "./replacement-scan.js";
|
|
7
13
|
export { scanToolState, } from "./legacy-encoding.js";
|
|
8
14
|
export { walkNativeState, walkFormat2State, SKIP_VALUE, UnknownKeyError, } from "./walker.js";
|
|
9
15
|
export { convertScalarValue, reverseScalarValue, convertStateToFormat2, encodeStateToNative, } from "./stateful-convert.js";
|
|
10
16
|
export { precheckNativeWorkflow, precheckNativeStep, } from "./precheck.js";
|
|
11
|
-
export { ConversionValidationFailure, validateNativeStepState, validateFormat2StepState, } from "./stateful-validate.js";
|
|
17
|
+
export { ConversionValidationFailure, validateNativeStepState, validateFormat2StepState, validateFormat2StepStateStrict, } from "./stateful-validate.js";
|
|
18
|
+
export { findParamAtPath } from "./param-navigation.js";
|
|
12
19
|
export { roundtripValidate, } from "./roundtrip.js";
|
|
13
20
|
export { cleanWorkflow } from "./clean.js";
|
|
21
|
+
export { workflowToMermaid } from "./mermaid.js";
|
|
14
22
|
export { detectFormat } from "./detect-format.js";
|
|
15
|
-
export {
|
|
23
|
+
export { withClass, validateFormat2, validateFormat2Strict, validateNative, validateNativeStrict, validatorForFixture, } from "./validators.js";
|
|
24
|
+
export { validateEncodingNative, validateEncodingFormat2, checkStrictEncoding, checkStrictStructure, } from "./strict-checks.js";
|
|
25
|
+
export { LintContext, LintMessage, Linter, LEVEL_ERROR, LEVEL_WARN, lintNative, lintFormat2, lintWorkflow, lintBestPracticesFormat2, lintBestPracticesNative, } from "./lint.js";
|
|
26
|
+
export { NativeStepKeyNotInteger } from "./lint-rules.js";
|
|
27
|
+
export { parseLintProfiles, lintProfilesById, rulesForProfile, iwcRuleIds, LINT_PROFILES_FILENAME, IWC_PROFILE_NAMES, } from "./lint-profiles.js";
|
|
28
|
+
// Structured report models (mirrors Python _report_models.py)
|
|
29
|
+
export { SKIP_STATUSES, validationSummary, validationFailures, cleanDisplayLabel, categoryOf, groupByCategory, buildSingleValidationReport, buildSingleLintReport, buildSingleCleanReport, buildWorkflowValidationResult, buildLintWorkflowResult, buildWorkflowCleanResult, buildTreeValidationReport, buildLintTreeReport, buildTreeCleanReport, buildWorkflowExportResult, buildExportTreeReport, buildWorkflowToNativeResult, buildToNativeTreeReport, buildRoundTripTreeReport, } from "./report-models.js";
|
|
16
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAEL,oBAAoB,EAEpB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,0CAA0C;AAC1C,OAAO,EACL,iBAAiB,EACjB,+BAA+B,EAC/B,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,iCAAiC,EAOjC,gBAAgB,EAChB,8BAA8B,EAC9B,0BAA0B,EAC1B,mBAAmB,EAInB,SAAS,EAGT,QAAQ,EAER,iBAAiB,EACjB,gBAAgB,EAMhB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,cAAc,EACd,QAAQ,EACR,mBAAmB,EAOnB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflow/index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EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint profile catalog types and parser.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors gxformat2/lint_profiles.py. Profiles group lint-rule IDs into
|
|
5
|
+
* named sets (`structural`, `best-practices`, `release`). Unknown IDs are
|
|
6
|
+
* tolerated — audit tooling compares against registered `Linter` subclasses
|
|
7
|
+
* to flag unimplemented entries as INFO.
|
|
8
|
+
*
|
|
9
|
+
* The YAML file lives alongside this module at `./lint_profiles.yml`. This
|
|
10
|
+
* module stays fs-free so src/ remains browser-compatible — callers read
|
|
11
|
+
* the file themselves and hand the string to `parseLintProfiles`.
|
|
12
|
+
*/
|
|
13
|
+
/** Relative path (from this module) to the profile catalog YAML. */
|
|
14
|
+
export declare const LINT_PROFILES_FILENAME = "lint_profiles.yml";
|
|
15
|
+
/** Canonical profile names whose union defines the IWC rule set. */
|
|
16
|
+
export declare const IWC_PROFILE_NAMES: readonly ["structural", "best-practices", "release"];
|
|
17
|
+
export interface LintProfile {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
rules: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function parseLintProfiles(yamlContent: string): LintProfile[];
|
|
23
|
+
export declare function lintProfilesById(profiles: LintProfile[]): Map<string, LintProfile>;
|
|
24
|
+
export declare function rulesForProfile(profiles: LintProfile[], id: string): string[];
|
|
25
|
+
/** Union of rule ids across structural / best-practices / release profiles. */
|
|
26
|
+
export declare function iwcRuleIds(profiles: LintProfile[]): Set<string>;
|
|
27
|
+
//# sourceMappingURL=lint-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-profiles.d.ts","sourceRoot":"","sources":["../../src/workflow/lint-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,sDAAuD,CAAC;AAEtF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAOD,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,EAAE,CAOpE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAElF;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAM7E;AAED,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAU/D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint profile catalog types and parser.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors gxformat2/lint_profiles.py. Profiles group lint-rule IDs into
|
|
5
|
+
* named sets (`structural`, `best-practices`, `release`). Unknown IDs are
|
|
6
|
+
* tolerated — audit tooling compares against registered `Linter` subclasses
|
|
7
|
+
* to flag unimplemented entries as INFO.
|
|
8
|
+
*
|
|
9
|
+
* The YAML file lives alongside this module at `./lint_profiles.yml`. This
|
|
10
|
+
* module stays fs-free so src/ remains browser-compatible — callers read
|
|
11
|
+
* the file themselves and hand the string to `parseLintProfiles`.
|
|
12
|
+
*/
|
|
13
|
+
import * as yaml from "yaml";
|
|
14
|
+
/** Relative path (from this module) to the profile catalog YAML. */
|
|
15
|
+
export const LINT_PROFILES_FILENAME = "lint_profiles.yml";
|
|
16
|
+
/** Canonical profile names whose union defines the IWC rule set. */
|
|
17
|
+
export const IWC_PROFILE_NAMES = ["structural", "best-practices", "release"];
|
|
18
|
+
export function parseLintProfiles(yamlContent) {
|
|
19
|
+
const raw = (yaml.parse(yamlContent) ?? {});
|
|
20
|
+
return Object.entries(raw).map(([id, body]) => ({
|
|
21
|
+
id,
|
|
22
|
+
description: body.description ?? "",
|
|
23
|
+
rules: body.rules ?? [],
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
export function lintProfilesById(profiles) {
|
|
27
|
+
return new Map(profiles.map((p) => [p.id, p]));
|
|
28
|
+
}
|
|
29
|
+
export function rulesForProfile(profiles, id) {
|
|
30
|
+
const profile = lintProfilesById(profiles).get(id);
|
|
31
|
+
if (!profile) {
|
|
32
|
+
throw new Error(`Unknown lint profile: ${id}`);
|
|
33
|
+
}
|
|
34
|
+
return profile.rules;
|
|
35
|
+
}
|
|
36
|
+
/** Union of rule ids across structural / best-practices / release profiles. */
|
|
37
|
+
export function iwcRuleIds(profiles) {
|
|
38
|
+
const byId = lintProfilesById(profiles);
|
|
39
|
+
const ids = new Set();
|
|
40
|
+
for (const name of IWC_PROFILE_NAMES) {
|
|
41
|
+
const profile = byId.get(name);
|
|
42
|
+
if (profile) {
|
|
43
|
+
for (const ruleId of profile.rules)
|
|
44
|
+
ids.add(ruleId);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return ids;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=lint-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-profiles.js","sourceRoot":"","sources":["../../src/workflow/lint-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,oEAAoE;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,gBAAgB,EAAE,SAAS,CAAU,CAAC;AAatF,MAAM,UAAU,iBAAiB,CAA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C,GAAG,CAAC,MAAM,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint rule classes.
|
|
3
|
+
*
|
|
4
|
+
* Each `Linter` subclass carries metadata only (severity, applies_to,
|
|
5
|
+
* profile). Emission happens in `lint.ts` via `LintContext.warn`/`error`
|
|
6
|
+
* with `linter=<Subclass>`.
|
|
7
|
+
*/
|
|
8
|
+
import { Linter } from "./linting.js";
|
|
9
|
+
/** Native workflow step keys must be string representations of integers. */
|
|
10
|
+
export declare class NativeStepKeyNotInteger extends Linter {
|
|
11
|
+
static severity: "error";
|
|
12
|
+
static applies_to: readonly ["native"];
|
|
13
|
+
static profile: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=lint-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-rules.d.ts","sourceRoot":"","sources":["../../src/workflow/lint-rules.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,4EAA4E;AAC5E,qBAAa,uBAAwB,SAAQ,MAAM;IACjD,MAAM,CAAC,QAAQ,EAAG,OAAO,CAAU;IACnC,MAAM,CAAC,UAAU,sBAAuB;IACxC,MAAM,CAAC,OAAO,SAAgB;CAC/B"}
|