@galaxy-tool-util/schema 1.2.0 → 1.6.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.
Files changed (96) hide show
  1. package/dist/index.d.ts +32 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +31 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/schema/parsed-tool.d.ts +3 -0
  6. package/dist/schema/parsed-tool.d.ts.map +1 -1
  7. package/dist/user-tool-parse/index.d.ts +12 -0
  8. package/dist/user-tool-parse/index.d.ts.map +1 -0
  9. package/dist/user-tool-parse/index.js +12 -0
  10. package/dist/user-tool-parse/index.js.map +1 -0
  11. package/dist/user-tool-parse/inputs.d.ts +13 -0
  12. package/dist/user-tool-parse/inputs.d.ts.map +1 -0
  13. package/dist/user-tool-parse/inputs.js +565 -0
  14. package/dist/user-tool-parse/inputs.js.map +1 -0
  15. package/dist/user-tool-parse/outputs.d.ts +10 -0
  16. package/dist/user-tool-parse/outputs.d.ts.map +1 -0
  17. package/dist/user-tool-parse/outputs.js +231 -0
  18. package/dist/user-tool-parse/outputs.js.map +1 -0
  19. package/dist/user-tool-parse/parse.d.ts +12 -0
  20. package/dist/user-tool-parse/parse.d.ts.map +1 -0
  21. package/dist/user-tool-parse/parse.js +98 -0
  22. package/dist/user-tool-parse/parse.js.map +1 -0
  23. package/dist/user-tool-source/index.d.ts +3 -0
  24. package/dist/user-tool-source/index.d.ts.map +1 -0
  25. package/dist/user-tool-source/index.js +3 -0
  26. package/dist/user-tool-source/index.js.map +1 -0
  27. package/dist/user-tool-source/schema.generated.d.ts +7298 -0
  28. package/dist/user-tool-source/schema.generated.d.ts.map +1 -0
  29. package/dist/user-tool-source/schema.generated.js +8851 -0
  30. package/dist/user-tool-source/schema.generated.js.map +1 -0
  31. package/dist/user-tool-source/semantic.d.ts +14 -0
  32. package/dist/user-tool-source/semantic.d.ts.map +1 -0
  33. package/dist/user-tool-source/semantic.js +137 -0
  34. package/dist/user-tool-source/semantic.js.map +1 -0
  35. package/dist/user-tool-source/validate.d.ts +37 -0
  36. package/dist/user-tool-source/validate.d.ts.map +1 -0
  37. package/dist/user-tool-source/validate.js +54 -0
  38. package/dist/user-tool-source/validate.js.map +1 -0
  39. package/dist/workflow/draft-checks.d.ts +205 -0
  40. package/dist/workflow/draft-checks.d.ts.map +1 -0
  41. package/dist/workflow/draft-checks.js +1151 -0
  42. package/dist/workflow/draft-checks.js.map +1 -0
  43. package/dist/workflow/index.d.ts +4 -2
  44. package/dist/workflow/index.d.ts.map +1 -1
  45. package/dist/workflow/index.js +4 -2
  46. package/dist/workflow/index.js.map +1 -1
  47. package/dist/workflow/normalized/format2.d.ts +1 -0
  48. package/dist/workflow/normalized/format2.d.ts.map +1 -1
  49. package/dist/workflow/normalized/format2.js +15 -2
  50. package/dist/workflow/normalized/format2.js.map +1 -1
  51. package/dist/workflow/normalized/native.d.ts +1 -1
  52. package/dist/workflow/normalized/toNative.js +29 -4
  53. package/dist/workflow/normalized/toNative.js.map +1 -1
  54. package/dist/workflow/promote-draft.d.ts +53 -0
  55. package/dist/workflow/promote-draft.d.ts.map +1 -0
  56. package/dist/workflow/promote-draft.js +133 -0
  57. package/dist/workflow/promote-draft.js.map +1 -0
  58. package/dist/workflow/raw/gxformat2-draft.d.ts +688 -0
  59. package/dist/workflow/raw/gxformat2-draft.d.ts.map +1 -0
  60. package/dist/workflow/raw/gxformat2-draft.effect.d.ts +4607 -0
  61. package/dist/workflow/raw/gxformat2-draft.effect.d.ts.map +1 -0
  62. package/dist/workflow/raw/gxformat2-draft.effect.js +778 -0
  63. package/dist/workflow/raw/gxformat2-draft.effect.js.map +1 -0
  64. package/dist/workflow/raw/gxformat2-draft.js +20 -0
  65. package/dist/workflow/raw/gxformat2-draft.js.map +1 -0
  66. package/dist/workflow/raw/gxformat2.d.ts +237 -13
  67. package/dist/workflow/raw/gxformat2.d.ts.map +1 -1
  68. package/dist/workflow/raw/gxformat2.effect.d.ts +1375 -177
  69. package/dist/workflow/raw/gxformat2.effect.d.ts.map +1 -1
  70. package/dist/workflow/raw/gxformat2.effect.js +355 -108
  71. package/dist/workflow/raw/gxformat2.effect.js.map +1 -1
  72. package/dist/workflow/raw/gxformat2.js +18 -1
  73. package/dist/workflow/raw/gxformat2.js.map +1 -1
  74. package/dist/workflow/raw/index.d.ts +2 -0
  75. package/dist/workflow/raw/index.d.ts.map +1 -1
  76. package/dist/workflow/raw/index.js +1 -0
  77. package/dist/workflow/raw/index.js.map +1 -1
  78. package/dist/workflow/raw/native.d.ts +51 -2
  79. package/dist/workflow/raw/native.d.ts.map +1 -1
  80. package/dist/workflow/raw/native.effect.d.ts +82 -30
  81. package/dist/workflow/raw/native.effect.d.ts.map +1 -1
  82. package/dist/workflow/raw/native.effect.js +67 -18
  83. package/dist/workflow/raw/native.effect.js.map +1 -1
  84. package/dist/workflow/raw/native.js.map +1 -1
  85. package/dist/workflow/report-models.d.ts +102 -0
  86. package/dist/workflow/report-models.d.ts.map +1 -1
  87. package/dist/workflow/report-models.js +98 -0
  88. package/dist/workflow/report-models.js.map +1 -1
  89. package/dist/workflow/semantic-validators.d.ts +18 -0
  90. package/dist/workflow/semantic-validators.d.ts.map +1 -0
  91. package/dist/workflow/semantic-validators.js +137 -0
  92. package/dist/workflow/semantic-validators.js.map +1 -0
  93. package/dist/workflow/validators.d.ts.map +1 -1
  94. package/dist/workflow/validators.js +7 -2
  95. package/dist/workflow/validators.js.map +1 -1
  96. package/package.json +1 -1
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Pure logic for Galaxy draft workflows (`class: GalaxyWorkflowDraft`).
3
+ *
4
+ * Substrate for the `gxwf draft-validate`, `gxwf draft-next-step`, and
5
+ * `gxwf draft-extract` CLI commands. No I/O.
6
+ *
7
+ * The sentinel constants mirror `gxformat2/draft.py`. Drift is enforced by
8
+ * `make check-sync-draft-sentinel` against the JSON snapshot in
9
+ * `schema-sources/v19_09/draft_constants.json`.
10
+ */
11
+ export declare const TODO_SENTINEL_PATTERN: RegExp;
12
+ export declare const PLAN_FIELDS: readonly ["_plan_state", "_plan_context", "_plan_in", "_plan_out"];
13
+ export type PlanField = (typeof PLAN_FIELDS)[number];
14
+ export declare const DRAFT_CLASS = "GalaxyWorkflowDraft";
15
+ export declare function isTodoSentinel(value: unknown): value is string;
16
+ export declare function isDraftWorkflow(doc: unknown): boolean;
17
+ export type StepPath = string[];
18
+ export type TodoLocation = {
19
+ kind: "tool_id";
20
+ } | {
21
+ kind: "tool_version";
22
+ } | {
23
+ kind: "in_key";
24
+ key: string;
25
+ } | {
26
+ kind: "out_id";
27
+ id: string;
28
+ } | {
29
+ kind: "output_source";
30
+ output_label: string;
31
+ port: string;
32
+ };
33
+ export interface TodoHit {
34
+ path: StepPath;
35
+ location: TodoLocation;
36
+ sentinel: string;
37
+ }
38
+ export interface PlanHit {
39
+ path: StepPath;
40
+ field: PlanField;
41
+ value: string;
42
+ }
43
+ export interface DraftSurvey {
44
+ /** True iff `doc.class === "GalaxyWorkflowDraft"`. */
45
+ isDraft: boolean;
46
+ /** TODO sentinel hits in declaration order across the (sub)workflow tree. */
47
+ todos: TodoHit[];
48
+ /** `_plan_*` field hits on draft steps across the (sub)workflow tree. */
49
+ planFields: PlanHit[];
50
+ }
51
+ /**
52
+ * Walk a draft workflow once, returning every TODO sentinel and `_plan_*`
53
+ * field with its step path. Non-draft documents return `{ isDraft: false }`
54
+ * with empty arrays.
55
+ *
56
+ * Step paths are `[outerLabel, ..., innerStepLabel]`. Subworkflows recurse
57
+ * only when the inner `run:` block also carries `class: GalaxyWorkflowDraft`.
58
+ *
59
+ * Note: this survey is step-focused — it intentionally does NOT report
60
+ * top-level `_plan_*` fields on a draft workflow root. Those are flagged
61
+ * by `validateDraft` (a rules-focused walker); `detectDraft` exists to
62
+ * drive `nextDraftStep` / `extractConcreteSubset`, which only act on
63
+ * per-step state.
64
+ */
65
+ export declare function detectDraft(workflow: unknown): DraftSurvey;
66
+ export interface DraftValidationDiagnostic {
67
+ /** Step path; empty array for workflow-level diagnostics. */
68
+ path: StepPath;
69
+ message: string;
70
+ }
71
+ export interface DraftValidationResult {
72
+ ok: boolean;
73
+ structureErrors: DraftValidationDiagnostic[];
74
+ topologyErrors: DraftValidationDiagnostic[];
75
+ semanticErrors: DraftValidationDiagnostic[];
76
+ warnings: DraftValidationDiagnostic[];
77
+ survey: DraftSurvey;
78
+ }
79
+ /**
80
+ * Validate a draft Galaxy workflow. Collects all diagnostics — does not throw.
81
+ *
82
+ * structureErrors Effect Schema decode failures.
83
+ * topologyErrors Concrete-topology must hold even in drafts: workflow
84
+ * input labels, output labels, step labels, and step types
85
+ * cannot be TODO sentinels. Step/port edge refs must
86
+ * resolve to a declared step + declared port (TODO_*
87
+ * ports count if declared in the step's `out:`).
88
+ * semanticErrors TODO-shaped strings (start with `TODO`) that don't
89
+ * match the canonical sentinel form (e.g. `TODO-foo`,
90
+ * `TODOfoo`, `TODO_` trailing).
91
+ * warnings Bare `TODO` in port position; top-level `_plan_*`.
92
+ *
93
+ * The returned `survey` is the same shape detectDraft() returns and is
94
+ * usable by downstream nextDraftStep / extractConcreteSubset callers.
95
+ */
96
+ export declare function validateDraft(workflow: unknown): DraftValidationResult;
97
+ export type NextStepResult = {
98
+ draft: false;
99
+ } | {
100
+ draft: true;
101
+ step: StepPath;
102
+ work: string[];
103
+ };
104
+ /**
105
+ * Pick the next step a downstream agent should work on. Pure function;
106
+ * idempotent — same input → same output, byte-for-byte.
107
+ *
108
+ * Walks steps in topological order (steps with no draft-step source deps
109
+ * first), tie-breaking by alphabetical step label. The first step that
110
+ * carries any TODO sentinel or `_plan_*` field is returned with a
111
+ * prompt-shaped `work[]` array. Subworkflows (draft inner `run:`) are
112
+ * descended only after their outer step is itself fully concrete.
113
+ *
114
+ * Returns `{ draft: false }` when the workflow has no remaining work
115
+ * (this includes non-draft documents — there is nothing to do).
116
+ */
117
+ export declare function nextDraftStep(workflow: unknown): NextStepResult;
118
+ export type DropReason = {
119
+ kind: "step_has_todo";
120
+ locations: TodoLocation[];
121
+ } | {
122
+ kind: "step_has_plan_field";
123
+ fields: PlanField[];
124
+ } | {
125
+ kind: "cascade";
126
+ depends_on: StepPath[];
127
+ };
128
+ export interface DroppedStep {
129
+ path: StepPath;
130
+ reason: DropReason;
131
+ }
132
+ export interface DroppedOutput {
133
+ /**
134
+ * Step path of the workflow the output lives in. `[]` for the top-level
135
+ * document; `[outerStep, ...]` for inner subworkflow outputs.
136
+ */
137
+ path: StepPath;
138
+ label: string;
139
+ reason: DropReason;
140
+ }
141
+ export interface RewrittenStepInput {
142
+ path: StepPath;
143
+ in_key: string;
144
+ /** Dropped step/port refs removed from this input's `source:`. */
145
+ removed_refs: string[];
146
+ /** Surviving step/port refs after the rewrite. Empty when only a `default:` keeps the entry alive. */
147
+ surviving_refs: string[];
148
+ }
149
+ export interface ExtractResult {
150
+ /**
151
+ * Trimmed workflow dict. Still carries `class: GalaxyWorkflowDraft` —
152
+ * promoting to `GalaxyWorkflow` is the CLI command's call, not B's.
153
+ * `_plan_*` fields are preserved verbatim (including top-level fields and
154
+ * any survivor steps — though by construction survivor steps never have
155
+ * `_plan_*`, since carrying one is itself a drop trigger). Stripping lives
156
+ * in the `clean` module (E).
157
+ */
158
+ workflow: unknown;
159
+ /**
160
+ * Dropped steps across the (sub)workflow tree. Ordering within a single
161
+ * workflow level: by cascade round (round 0 = direct TODO/_plan_* drops;
162
+ * rounds 1+ = cascade drops), then by alphabetical step-path within a
163
+ * round. Across levels: a level's drops come first, then for each
164
+ * surviving subworkflow step (in source iteration order) its drops
165
+ * follow, recursively. Cascade rounds are local to a workflow level — not
166
+ * compared across nesting.
167
+ *
168
+ * `cascade.depends_on` paths point at the steps cited in the dead `in:`.
169
+ * In the common case these appear in `dropped_steps` themselves; in the
170
+ * subworkflow-port-loss case the cited path may be a *surviving* outer
171
+ * subworkflow step whose inner workflow lost the referenced port — look
172
+ * under that step's recursed inner drops for the underlying cause.
173
+ */
174
+ dropped_steps: DroppedStep[];
175
+ /**
176
+ * Workflow outputs dropped because their source step / port went away.
177
+ * Carries `path` to distinguish top-level outputs (`path: []`) from inner
178
+ * subworkflow outputs (`path: [outerStep, ...]`). Ordered alphabetically
179
+ * by label within a level; across levels, top-level first, then per
180
+ * surviving subworkflow step in iteration order.
181
+ */
182
+ dropped_outputs: DroppedOutput[];
183
+ /**
184
+ * Per-input rewrites where the source survived in part. Two cases:
185
+ * - Multi-source input lost some refs but kept others (rewritten to the
186
+ * surviving subset; string form if 1 left, list form if >1).
187
+ * - Single-source input lost its only ref but the input has a `default:`
188
+ * so the entry stays alive — `surviving_refs` is empty, the rewritten
189
+ * value retains the default and drops the `source:` key.
190
+ */
191
+ rewritten_step_inputs: RewrittenStepInput[];
192
+ }
193
+ /**
194
+ * Trim a draft workflow down to its concrete subset: drop any step that
195
+ * carries a TODO sentinel or `_plan_*` field, then cascade-drop steps whose
196
+ * `in:` becomes dead, then drop workflow outputs whose source went away.
197
+ * Multi-source inputs are rewritten in place to the surviving ref subset.
198
+ *
199
+ * Pure + idempotent. The result always carries `class: GalaxyWorkflowDraft`
200
+ * — promotion to concrete is a CLI-layer decision (E).
201
+ *
202
+ * Non-draft inputs pass through unchanged with empty drop / rewrite arrays.
203
+ */
204
+ export declare function extractConcreteSubset(workflow: unknown): ExtractResult;
205
+ //# sourceMappingURL=draft-checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-checks.d.ts","sourceRoot":"","sources":["../../src/workflow/draft-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,eAAO,MAAM,qBAAqB,QAA4B,CAAC;AAS/D,eAAO,MAAM,WAAW,oEAAqE,CAAC;AAC9F,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,eAAO,MAAM,WAAW,wBAAwB,CAAC;AAEjD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE9D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