@galaxy-tool-util/schema 0.1.0 → 0.4.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/LICENSE +21 -0
- package/dist/index.d.ts +87 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -1
- package/dist/index.js.map +1 -1
- 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 +23 -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 +56 -3
- package/dist/workflow/clean.d.ts.map +1 -1
- package/dist/workflow/clean.js +227 -27
- package/dist/workflow/clean.js.map +1 -1
- package/dist/workflow/coercions.d.ts +22 -0
- package/dist/workflow/coercions.d.ts.map +1 -0
- package/dist/workflow/coercions.js +67 -0
- package/dist/workflow/coercions.js.map +1 -0
- package/dist/workflow/index.d.ts +17 -4
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +18 -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/normalized/index.d.ts +5 -2
- package/dist/workflow/normalized/index.d.ts.map +1 -1
- package/dist/workflow/normalized/index.js +2 -0
- package/dist/workflow/normalized/index.js.map +1 -1
- package/dist/workflow/normalized/stateful-runner.d.ts +82 -0
- package/dist/workflow/normalized/stateful-runner.d.ts.map +1 -0
- package/dist/workflow/normalized/stateful-runner.js +122 -0
- package/dist/workflow/normalized/stateful-runner.js.map +1 -0
- package/dist/workflow/normalized/toFormat2.d.ts +19 -1
- package/dist/workflow/normalized/toFormat2.d.ts.map +1 -1
- package/dist/workflow/normalized/toFormat2.js +47 -16
- package/dist/workflow/normalized/toFormat2.js.map +1 -1
- package/dist/workflow/normalized/toFormat2Stateful.d.ts +30 -0
- package/dist/workflow/normalized/toFormat2Stateful.d.ts.map +1 -0
- package/dist/workflow/normalized/toFormat2Stateful.js +58 -0
- package/dist/workflow/normalized/toFormat2Stateful.js.map +1 -0
- package/dist/workflow/normalized/toNative.d.ts +10 -1
- package/dist/workflow/normalized/toNative.d.ts.map +1 -1
- package/dist/workflow/normalized/toNative.js +24 -8
- package/dist/workflow/normalized/toNative.js.map +1 -1
- package/dist/workflow/normalized/toNativeStateful.d.ts +31 -0
- package/dist/workflow/normalized/toNativeStateful.d.ts.map +1 -0
- package/dist/workflow/normalized/toNativeStateful.js +55 -0
- package/dist/workflow/normalized/toNativeStateful.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/precheck.d.ts +54 -0
- package/dist/workflow/precheck.d.ts.map +1 -0
- package/dist/workflow/precheck.js +91 -0
- package/dist/workflow/precheck.js.map +1 -0
- package/dist/workflow/raw/gxformat2.effect.d.ts +97 -97
- package/dist/workflow/raw/gxformat2.effect.d.ts.map +1 -1
- package/dist/workflow/raw/gxformat2.effect.js +98 -88
- 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 +33 -33
- package/dist/workflow/raw/native.effect.d.ts.map +1 -1
- package/dist/workflow/raw/native.effect.js +42 -32
- 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 +77 -0
- package/dist/workflow/roundtrip.d.ts.map +1 -0
- package/dist/workflow/roundtrip.js +597 -0
- package/dist/workflow/roundtrip.js.map +1 -0
- package/dist/workflow/runtime-markers.d.ts +20 -0
- package/dist/workflow/runtime-markers.d.ts.map +1 -0
- package/dist/workflow/runtime-markers.js +26 -0
- package/dist/workflow/runtime-markers.js.map +1 -0
- 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/stale-keys.d.ts +16 -0
- package/dist/workflow/stale-keys.d.ts.map +1 -0
- package/dist/workflow/stale-keys.js +43 -0
- package/dist/workflow/stale-keys.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 +31 -225
- package/dist/workflow/state-merge.js.map +1 -1
- package/dist/workflow/stateful-convert.d.ts +47 -0
- package/dist/workflow/stateful-convert.d.ts.map +1 -0
- package/dist/workflow/stateful-convert.js +151 -0
- package/dist/workflow/stateful-convert.js.map +1 -0
- package/dist/workflow/stateful-validate.d.ts +67 -0
- package/dist/workflow/stateful-validate.d.ts.map +1 -0
- package/dist/workflow/stateful-validate.js +123 -0
- package/dist/workflow/stateful-validate.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 +55 -0
- package/dist/workflow/walker.d.ts.map +1 -0
- package/dist/workflow/walker.js +199 -0
- package/dist/workflow/walker.js.map +1 -0
- package/package.json +21 -16
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime value markers used inside workflow tool_state.
|
|
3
|
+
*
|
|
4
|
+
* Galaxy has two in-band markers indicating a parameter value is not a
|
|
5
|
+
* literal but will be supplied at invocation time:
|
|
6
|
+
* - `ConnectedValue`: value comes from an upstream step output
|
|
7
|
+
* - `RuntimeValue`: value is supplied by the user at workflow runtime
|
|
8
|
+
*
|
|
9
|
+
* Both are encoded as `{ __class__: "ConnectedValue" | "RuntimeValue" }`
|
|
10
|
+
* inside native tool_state dicts. Matches Galaxy Python terminology.
|
|
11
|
+
*/
|
|
12
|
+
export const CONNECTED_VALUE = { __class__: "ConnectedValue" };
|
|
13
|
+
export const RUNTIME_VALUE = { __class__: "RuntimeValue" };
|
|
14
|
+
export function isConnectedValue(value) {
|
|
15
|
+
return (value != null &&
|
|
16
|
+
typeof value === "object" &&
|
|
17
|
+
!Array.isArray(value) &&
|
|
18
|
+
value.__class__ === "ConnectedValue");
|
|
19
|
+
}
|
|
20
|
+
export function isRuntimeValue(value) {
|
|
21
|
+
return (value != null &&
|
|
22
|
+
typeof value === "object" &&
|
|
23
|
+
!Array.isArray(value) &&
|
|
24
|
+
value.__class__ === "RuntimeValue");
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=runtime-markers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-markers.js","sourceRoot":"","sources":["../../src/workflow/runtime-markers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAW,CAAC;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,SAAS,EAAE,cAAc,EAAW,CAAC;AAEpE,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,CACL,KAAK,IAAI,IAAI;QACb,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAiC,CAAC,SAAS,KAAK,gBAAgB,CAClE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,CACL,KAAK,IAAI,IAAI;QACb,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAiC,CAAC,SAAS,KAAK,cAAc,CAChE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema-rule catalog types and parser.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors gxformat2/schema_rules.py. Schema rules describe checks already
|
|
5
|
+
* enforced by the Effect decode layer. Each rule ships with positive and
|
|
6
|
+
* negative fixtures; the catalog contract is tested end-to-end by running
|
|
7
|
+
* fixtures through validators — not by inspecting ParseError shapes.
|
|
8
|
+
*
|
|
9
|
+
* The YAML file lives alongside this module at `./schema_rules.yml`. This
|
|
10
|
+
* module stays fs-free to keep src/ browser-compatible — callers read the
|
|
11
|
+
* file themselves (see test/schema-rules-catalog.test.ts) and hand the
|
|
12
|
+
* string to `parseSchemaRules`.
|
|
13
|
+
*/
|
|
14
|
+
/** Relative path (from this module) to the catalog YAML. */
|
|
15
|
+
export declare const SCHEMA_RULES_FILENAME = "schema_rules.yml";
|
|
16
|
+
export type Severity = "error" | "warning";
|
|
17
|
+
export type AppliesTo = "format2" | "native";
|
|
18
|
+
/**
|
|
19
|
+
* Validator flavors that reject the negative fixture.
|
|
20
|
+
* - `both`: both lax and strict reject (e.g. missing required field)
|
|
21
|
+
* - `strict`: only strict rejects (e.g. unknown extra field)
|
|
22
|
+
* - `lax`: only lax rejects — unusual, reserved for completeness
|
|
23
|
+
*/
|
|
24
|
+
export type Scope = "both" | "strict" | "lax";
|
|
25
|
+
export interface SchemaRuleTests {
|
|
26
|
+
positive: string[];
|
|
27
|
+
negative: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface SchemaRule {
|
|
30
|
+
id: string;
|
|
31
|
+
severity: Severity;
|
|
32
|
+
applies_to: AppliesTo[];
|
|
33
|
+
scope: Scope;
|
|
34
|
+
description: string;
|
|
35
|
+
tests: SchemaRuleTests;
|
|
36
|
+
}
|
|
37
|
+
export declare function parseSchemaRules(yamlContent: string): SchemaRule[];
|
|
38
|
+
//# sourceMappingURL=schema-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-rules.d.ts","sourceRoot":"","sources":["../../src/workflow/schema-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAC3C,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC7C;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,eAAe,CAAC;CACxB;AAUD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,EAAE,CAUlE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema-rule catalog types and parser.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors gxformat2/schema_rules.py. Schema rules describe checks already
|
|
5
|
+
* enforced by the Effect decode layer. Each rule ships with positive and
|
|
6
|
+
* negative fixtures; the catalog contract is tested end-to-end by running
|
|
7
|
+
* fixtures through validators — not by inspecting ParseError shapes.
|
|
8
|
+
*
|
|
9
|
+
* The YAML file lives alongside this module at `./schema_rules.yml`. This
|
|
10
|
+
* module stays fs-free to keep src/ browser-compatible — callers read the
|
|
11
|
+
* file themselves (see test/schema-rules-catalog.test.ts) and hand the
|
|
12
|
+
* string to `parseSchemaRules`.
|
|
13
|
+
*/
|
|
14
|
+
import * as yaml from "yaml";
|
|
15
|
+
/** Relative path (from this module) to the catalog YAML. */
|
|
16
|
+
export const SCHEMA_RULES_FILENAME = "schema_rules.yml";
|
|
17
|
+
export function parseSchemaRules(yamlContent) {
|
|
18
|
+
const raw = yaml.parse(yamlContent);
|
|
19
|
+
return Object.entries(raw).map(([id, body]) => ({
|
|
20
|
+
id,
|
|
21
|
+
severity: body.severity,
|
|
22
|
+
applies_to: body.applies_to,
|
|
23
|
+
scope: body.scope,
|
|
24
|
+
description: body.description ?? "",
|
|
25
|
+
tests: body.tests,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=schema-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-rules.js","sourceRoot":"","sources":["../../src/workflow/schema-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,4DAA4D;AAC5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAkCxD,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAkC,CAAC;IACrE,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9C,EAAE;QACF,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;QACnC,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Schema rule catalog.
|
|
2
|
+
#
|
|
3
|
+
# Each entry keys a schema-decode-enforced rule. Positive fixtures must pass
|
|
4
|
+
# both lax and strict validation; negative fixtures must fail per `scope`.
|
|
5
|
+
# Catalog contract is verified end-to-end by tests/test_schema_rules_catalog.py;
|
|
6
|
+
# no pydantic error shapes are introspected.
|
|
7
|
+
|
|
8
|
+
Format2MissingSteps:
|
|
9
|
+
severity: error
|
|
10
|
+
applies_to: [format2]
|
|
11
|
+
scope: both
|
|
12
|
+
description: "Format2 workflow missing required `steps` field."
|
|
13
|
+
tests:
|
|
14
|
+
positive: [synthetic-basic.gxwf.yml]
|
|
15
|
+
negative: [synthetic-missing-steps.gxwf.yml]
|
|
16
|
+
|
|
17
|
+
NativeMissingMarker:
|
|
18
|
+
severity: error
|
|
19
|
+
applies_to: [native]
|
|
20
|
+
scope: both
|
|
21
|
+
description: "Native workflow missing required `a_galaxy_workflow` marker."
|
|
22
|
+
tests:
|
|
23
|
+
positive: [real-unicycler-assembly.ga]
|
|
24
|
+
negative: [synthetic-missing-marker.ga]
|
|
25
|
+
|
|
26
|
+
NativeMarkerNotTrue:
|
|
27
|
+
severity: error
|
|
28
|
+
applies_to: [native]
|
|
29
|
+
scope: both
|
|
30
|
+
description: "`a_galaxy_workflow` must be literal string \"true\"."
|
|
31
|
+
tests:
|
|
32
|
+
positive: [real-unicycler-assembly.ga]
|
|
33
|
+
negative: [synthetic-lint-bad-marker.ga]
|
|
34
|
+
|
|
35
|
+
NativeMissingFormatVersion:
|
|
36
|
+
severity: error
|
|
37
|
+
applies_to: [native]
|
|
38
|
+
scope: both
|
|
39
|
+
description: "Native workflow missing required `format-version` field."
|
|
40
|
+
tests:
|
|
41
|
+
positive: [real-unicycler-assembly.ga]
|
|
42
|
+
negative: [real-hacked-basic-missing-format-version.ga]
|
|
43
|
+
|
|
44
|
+
NativeFormatVersionNotSupported:
|
|
45
|
+
severity: error
|
|
46
|
+
applies_to: [native]
|
|
47
|
+
scope: both
|
|
48
|
+
description: "`format-version` must be literal string \"0.1\"."
|
|
49
|
+
tests:
|
|
50
|
+
positive: [real-unicycler-assembly.ga]
|
|
51
|
+
negative: [synthetic-lint-bad-format-version.ga]
|
|
52
|
+
|
|
53
|
+
ReportMarkdownNotString:
|
|
54
|
+
severity: error
|
|
55
|
+
applies_to: [format2, native]
|
|
56
|
+
scope: both
|
|
57
|
+
description: "Workflow `report.markdown` must be a string."
|
|
58
|
+
tests:
|
|
59
|
+
positive: [synthetic-basic.gxwf.yml, real-unicycler-assembly.ga]
|
|
60
|
+
negative: [synthetic-lint-report-bad-type.gxwf.yml, synthetic-lint-report-bad-type.ga]
|
|
61
|
+
|
|
62
|
+
SchemaStrictExtraField:
|
|
63
|
+
severity: warning
|
|
64
|
+
applies_to: [format2, native]
|
|
65
|
+
scope: strict
|
|
66
|
+
description: "Unknown field present on a closed record under strict validation."
|
|
67
|
+
tests:
|
|
68
|
+
positive: [synthetic-basic.gxwf.yml, real-unicycler-assembly.ga]
|
|
69
|
+
negative: [synthetic-extra-field.gxwf.yml, synthetic-extra-field.ga]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format-aware workflow serialization + format resolution.
|
|
3
|
+
*
|
|
4
|
+
* Shared between the CLI (`@galaxy-tool-util/cli`) and the web server
|
|
5
|
+
* (`@galaxy-tool-util/gxwf-web`) so both produce byte-compatible output.
|
|
6
|
+
*/
|
|
7
|
+
import { type WorkflowFormat } from "./detect-format.js";
|
|
8
|
+
export interface SerializeWorkflowOptions {
|
|
9
|
+
/** Force JSON output regardless of format. */
|
|
10
|
+
json?: boolean;
|
|
11
|
+
/** Force YAML output regardless of format. */
|
|
12
|
+
yaml?: boolean;
|
|
13
|
+
/** JSON indent level (ignored for YAML). Default: 2. */
|
|
14
|
+
indent?: number;
|
|
15
|
+
/** Append a trailing newline (both JSON and YAML). Default: true. */
|
|
16
|
+
trailingNewline?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Serialize a workflow dict as JSON or YAML based on `format` (or explicit
|
|
20
|
+
* `json` / `yaml` overrides).
|
|
21
|
+
*
|
|
22
|
+
* YAML uses `lineWidth: 0` to disable line-wrapping so diffs stay stable.
|
|
23
|
+
*/
|
|
24
|
+
export declare function serializeWorkflow(data: Record<string, unknown>, format: WorkflowFormat, opts?: SerializeWorkflowOptions): string;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve workflow format from an optional explicit choice, falling back to
|
|
27
|
+
* `detectFormat` on the dict.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveFormat(data: Record<string, unknown>, formatOpt?: string): WorkflowFormat;
|
|
30
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/workflow/serialize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvE,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8CAA8C;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE,wBAA6B,GAClC,MAAM,CAWR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAG/F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format-aware workflow serialization + format resolution.
|
|
3
|
+
*
|
|
4
|
+
* Shared between the CLI (`@galaxy-tool-util/cli`) and the web server
|
|
5
|
+
* (`@galaxy-tool-util/gxwf-web`) so both produce byte-compatible output.
|
|
6
|
+
*/
|
|
7
|
+
import { stringify as stringifyYaml } from "yaml";
|
|
8
|
+
import { detectFormat } from "./detect-format.js";
|
|
9
|
+
/**
|
|
10
|
+
* Serialize a workflow dict as JSON or YAML based on `format` (or explicit
|
|
11
|
+
* `json` / `yaml` overrides).
|
|
12
|
+
*
|
|
13
|
+
* YAML uses `lineWidth: 0` to disable line-wrapping so diffs stay stable.
|
|
14
|
+
*/
|
|
15
|
+
export function serializeWorkflow(data, format, opts = {}) {
|
|
16
|
+
const useYaml = opts.yaml || (!opts.json && format === "format2");
|
|
17
|
+
const newline = opts.trailingNewline ?? true;
|
|
18
|
+
if (useYaml) {
|
|
19
|
+
const out = stringifyYaml(data, { lineWidth: 0 });
|
|
20
|
+
// `yaml` already ends with a newline; don't double-append.
|
|
21
|
+
if (newline)
|
|
22
|
+
return out.endsWith("\n") ? out : out + "\n";
|
|
23
|
+
return out.endsWith("\n") ? out.slice(0, -1) : out;
|
|
24
|
+
}
|
|
25
|
+
const indent = opts.indent ?? 2;
|
|
26
|
+
return JSON.stringify(data, null, indent) + (newline ? "\n" : "");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve workflow format from an optional explicit choice, falling back to
|
|
30
|
+
* `detectFormat` on the dict.
|
|
31
|
+
*/
|
|
32
|
+
export function resolveFormat(data, formatOpt) {
|
|
33
|
+
if (formatOpt === "native" || formatOpt === "format2")
|
|
34
|
+
return formatOpt;
|
|
35
|
+
return detectFormat(data);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/workflow/serialize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,YAAY,EAAuB,MAAM,oBAAoB,CAAC;AAavE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAA6B,EAC7B,MAAsB,EACtB,OAAiC,EAAE;IAEnC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC;IAC7C,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;QAClD,2DAA2D;QAC3D,IAAI,OAAO;YAAE,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC;QAC1D,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACrD,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAA6B,EAAE,SAAkB;IAC7E,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stale/bookkeeping key set for workflow tool_state.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors Python's `galaxy.tool_util.workflow_state.stale_keys` set — keys
|
|
5
|
+
* that Galaxy injects into tool_state for runtime bookkeeping and that are
|
|
6
|
+
* not real parameter values. The state walker allows them through unknown-
|
|
7
|
+
* key detection, and the roundtrip differ ignores them when diffing.
|
|
8
|
+
*
|
|
9
|
+
* Future work: classify into BOOKKEEPING / RUNTIME_LEAK / STALE_ROOT /
|
|
10
|
+
* STALE_BRANCH / UNKNOWN to mirror Python's `stale_keys.py` and drive an
|
|
11
|
+
* `--allow` / `--deny` policy for stateful export.
|
|
12
|
+
*/
|
|
13
|
+
/** Keys injected by Galaxy's runtime/UI; safe to ignore during conversion. */
|
|
14
|
+
export declare const STALE_KEYS: ReadonlySet<string>;
|
|
15
|
+
export declare function isRuntimeLeakKey(key: string): boolean;
|
|
16
|
+
//# sourceMappingURL=stale-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-keys.d.ts","sourceRoot":"","sources":["../../src/workflow/stale-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CAQzC,CAAC;AAoBH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stale/bookkeeping key set for workflow tool_state.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors Python's `galaxy.tool_util.workflow_state.stale_keys` set — keys
|
|
5
|
+
* that Galaxy injects into tool_state for runtime bookkeeping and that are
|
|
6
|
+
* not real parameter values. The state walker allows them through unknown-
|
|
7
|
+
* key detection, and the roundtrip differ ignores them when diffing.
|
|
8
|
+
*
|
|
9
|
+
* Future work: classify into BOOKKEEPING / RUNTIME_LEAK / STALE_ROOT /
|
|
10
|
+
* STALE_BRANCH / UNKNOWN to mirror Python's `stale_keys.py` and drive an
|
|
11
|
+
* `--allow` / `--deny` policy for stateful export.
|
|
12
|
+
*/
|
|
13
|
+
/** Keys injected by Galaxy's runtime/UI; safe to ignore during conversion. */
|
|
14
|
+
export const STALE_KEYS = new Set([
|
|
15
|
+
"__current_case__",
|
|
16
|
+
"__input_ext",
|
|
17
|
+
"__page__",
|
|
18
|
+
"__rerun_remap_job_id__",
|
|
19
|
+
"__index__",
|
|
20
|
+
"__job_resource",
|
|
21
|
+
"chromInfo",
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* Runtime-leak key detection.
|
|
25
|
+
*
|
|
26
|
+
* These keys leak from job execution into persisted `tool_state` and are not
|
|
27
|
+
* real parameter values. Galaxy classifies them as `RUNTIME_LEAK` in
|
|
28
|
+
* `stale_keys.py`; its `for_export` policy preserves them through format2
|
|
29
|
+
* export while `for_validate` flags them. Our walker silently drops them
|
|
30
|
+
* during stateful conversion (neither side of the roundtrip keeps them), so
|
|
31
|
+
* the roundtrip differ treats drops/appearances as benign.
|
|
32
|
+
*
|
|
33
|
+
* - Exact match: `__workflow_invocation_uuid__`
|
|
34
|
+
* - Suffix match: `|__identifier__` (e.g. `input|__identifier__`,
|
|
35
|
+
* `dadaF|__identifier__` — collection element identifier, attached to
|
|
36
|
+
* whichever param received the collection)
|
|
37
|
+
*/
|
|
38
|
+
const RUNTIME_LEAK_EXACT = new Set(["__workflow_invocation_uuid__"]);
|
|
39
|
+
const RUNTIME_LEAK_SUFFIX = "|__identifier__";
|
|
40
|
+
export function isRuntimeLeakKey(key) {
|
|
41
|
+
return RUNTIME_LEAK_EXACT.has(key) || key.endsWith(RUNTIME_LEAK_SUFFIX);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=stale-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-keys.js","sourceRoot":"","sources":["../../src/workflow/stale-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC;IACrD,kBAAkB;IAClB,aAAa;IACb,UAAU;IACV,wBAAwB;IACxB,WAAW;IACX,gBAAgB;IAChB,WAAW;CACZ,CAAC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAC1F,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAE9C,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,OAAO,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -1,40 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* ConnectedValue injection and stripping for workflow state dicts.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Thin wrappers around walkNativeState that inject or strip
|
|
5
|
+
* ConnectedValue markers. Mutate state in-place for caller compat.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* and format2 validation paths.
|
|
7
|
+
* Port of Python galaxy.tool_util.workflow_state._state_merge.
|
|
8
|
+
* Tree-walking helpers live in walk-helpers.ts; re-exported here
|
|
9
|
+
* for backward compatibility.
|
|
11
10
|
*/
|
|
12
|
-
import type { ToolParameterModel
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
/** Filter a flat key→value map to keys starting with a given prefix. */
|
|
16
|
-
export declare function keysStartingWith<T>(map: Record<string, T>, prefix: string): Record<string, T>;
|
|
17
|
-
/**
|
|
18
|
-
* Split flat connection keys for a repeat into per-instance arrays.
|
|
19
|
-
*
|
|
20
|
-
* Connection keys use the pattern `repeatName_N|paramName`.
|
|
21
|
-
* Returns an array of per-instance connection dicts.
|
|
22
|
-
*/
|
|
23
|
-
export declare function repeatInputsToArray<T>(statePath: string, inputs: Record<string, T>): Record<string, T>[];
|
|
24
|
-
/**
|
|
25
|
-
* Select the matching ConditionalWhen for a conditional state dict.
|
|
26
|
-
*
|
|
27
|
-
* Matches the test parameter's value in state against each when's
|
|
28
|
-
* discriminator. Falls back to the default when if no match found.
|
|
29
|
-
* Returns null if no match at all (graceful degradation).
|
|
30
|
-
*/
|
|
31
|
-
export declare function selectWhichWhen(conditional: ConditionalParameterModel, state: Record<string, unknown>): ConditionalWhen | null;
|
|
11
|
+
import type { ToolParameterModel } from "../schema/bundle-types.js";
|
|
12
|
+
import { flatStatePath, keysStartingWith, repeatInputsToArray, selectWhichWhen } from "./walk-helpers.js";
|
|
13
|
+
export { flatStatePath, keysStartingWith, repeatInputsToArray, selectWhichWhen };
|
|
32
14
|
/**
|
|
33
15
|
* Inject ConnectedValue markers into a state dict for all connections.
|
|
34
16
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
17
|
+
* Uses walkNativeState with a leaf callback that replaces connected
|
|
18
|
+
* leaves with ConnectedValue markers, then reassigns the input state
|
|
19
|
+
* in-place to preserve the mutation contract callers expect.
|
|
38
20
|
*
|
|
39
21
|
* @returns remaining unmatched connection paths (empty if all consumed)
|
|
40
22
|
*/
|
|
@@ -42,8 +24,9 @@ export declare function injectConnectionsIntoState(toolInputs: ToolParameterMode
|
|
|
42
24
|
/**
|
|
43
25
|
* Strip ConnectedValue markers from a state dict using the parameter tree.
|
|
44
26
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
27
|
+
* Uses walkNativeState with a leaf callback that omits ConnectedValue
|
|
28
|
+
* entries via SKIP_VALUE, then reassigns the input state in-place to
|
|
29
|
+
* preserve the mutation contract callers expect.
|
|
47
30
|
*/
|
|
48
31
|
export declare function stripConnectedValues(toolInputs: ToolParameterModel[], state: Record<string, unknown>): void;
|
|
49
32
|
//# sourceMappingURL=state-merge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-merge.d.ts","sourceRoot":"","sources":["../../src/workflow/state-merge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"state-merge.d.ts","sourceRoot":"","sources":["../../src/workflow/state-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,CAAC;AAIjF;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,kBAAkB,EAAE,EAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB;AAID;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,kBAAkB,EAAE,EAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,IAAI,CAWN"}
|