@galaxy-tool-util/schema 0.1.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 (226) hide show
  1. package/README.md +13 -0
  2. package/dist/index.d.ts +69 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +69 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/schema/bundle-types.d.ts +249 -0
  7. package/dist/schema/bundle-types.d.ts.map +1 -0
  8. package/dist/schema/bundle-types.js +74 -0
  9. package/dist/schema/bundle-types.js.map +1 -0
  10. package/dist/schema/index.d.ts +6 -0
  11. package/dist/schema/index.d.ts.map +1 -0
  12. package/dist/schema/index.js +6 -0
  13. package/dist/schema/index.js.map +1 -0
  14. package/dist/schema/model-factory.d.ts +14 -0
  15. package/dist/schema/model-factory.d.ts.map +1 -0
  16. package/dist/schema/model-factory.js +96 -0
  17. package/dist/schema/model-factory.js.map +1 -0
  18. package/dist/schema/parameters/base.d.ts +62 -0
  19. package/dist/schema/parameters/base.d.ts.map +1 -0
  20. package/dist/schema/parameters/base.js +51 -0
  21. package/dist/schema/parameters/base.js.map +1 -0
  22. package/dist/schema/parameters/gx-baseurl.d.ts +2 -0
  23. package/dist/schema/parameters/gx-baseurl.d.ts.map +1 -0
  24. package/dist/schema/parameters/gx-baseurl.js +16 -0
  25. package/dist/schema/parameters/gx-baseurl.js.map +1 -0
  26. package/dist/schema/parameters/gx-boolean.d.ts +2 -0
  27. package/dist/schema/parameters/gx-boolean.d.ts.map +1 -0
  28. package/dist/schema/parameters/gx-boolean.js +29 -0
  29. package/dist/schema/parameters/gx-boolean.js.map +1 -0
  30. package/dist/schema/parameters/gx-color.d.ts +2 -0
  31. package/dist/schema/parameters/gx-color.d.ts.map +1 -0
  32. package/dist/schema/parameters/gx-color.js +26 -0
  33. package/dist/schema/parameters/gx-color.js.map +1 -0
  34. package/dist/schema/parameters/gx-conditional.d.ts +2 -0
  35. package/dist/schema/parameters/gx-conditional.d.ts.map +1 -0
  36. package/dist/schema/parameters/gx-conditional.js +56 -0
  37. package/dist/schema/parameters/gx-conditional.js.map +1 -0
  38. package/dist/schema/parameters/gx-data-collection.d.ts +2 -0
  39. package/dist/schema/parameters/gx-data-collection.d.ts.map +1 -0
  40. package/dist/schema/parameters/gx-data-collection.js +146 -0
  41. package/dist/schema/parameters/gx-data-collection.js.map +1 -0
  42. package/dist/schema/parameters/gx-data-column.d.ts +2 -0
  43. package/dist/schema/parameters/gx-data-column.d.ts.map +1 -0
  44. package/dist/schema/parameters/gx-data-column.js +49 -0
  45. package/dist/schema/parameters/gx-data-column.js.map +1 -0
  46. package/dist/schema/parameters/gx-data.d.ts +2 -0
  47. package/dist/schema/parameters/gx-data.d.ts.map +1 -0
  48. package/dist/schema/parameters/gx-data.js +107 -0
  49. package/dist/schema/parameters/gx-data.js.map +1 -0
  50. package/dist/schema/parameters/gx-directory-uri.d.ts +2 -0
  51. package/dist/schema/parameters/gx-directory-uri.d.ts.map +1 -0
  52. package/dist/schema/parameters/gx-directory-uri.js +19 -0
  53. package/dist/schema/parameters/gx-directory-uri.js.map +1 -0
  54. package/dist/schema/parameters/gx-drill-down.d.ts +2 -0
  55. package/dist/schema/parameters/gx-drill-down.d.ts.map +1 -0
  56. package/dist/schema/parameters/gx-drill-down.js +40 -0
  57. package/dist/schema/parameters/gx-drill-down.js.map +1 -0
  58. package/dist/schema/parameters/gx-float.d.ts +2 -0
  59. package/dist/schema/parameters/gx-float.d.ts.map +1 -0
  60. package/dist/schema/parameters/gx-float.js +46 -0
  61. package/dist/schema/parameters/gx-float.js.map +1 -0
  62. package/dist/schema/parameters/gx-genomebuild.d.ts +2 -0
  63. package/dist/schema/parameters/gx-genomebuild.d.ts.map +1 -0
  64. package/dist/schema/parameters/gx-genomebuild.js +23 -0
  65. package/dist/schema/parameters/gx-genomebuild.js.map +1 -0
  66. package/dist/schema/parameters/gx-group-tag.d.ts +2 -0
  67. package/dist/schema/parameters/gx-group-tag.d.ts.map +1 -0
  68. package/dist/schema/parameters/gx-group-tag.js +23 -0
  69. package/dist/schema/parameters/gx-group-tag.js.map +1 -0
  70. package/dist/schema/parameters/gx-hidden.d.ts +2 -0
  71. package/dist/schema/parameters/gx-hidden.d.ts.map +1 -0
  72. package/dist/schema/parameters/gx-hidden.js +33 -0
  73. package/dist/schema/parameters/gx-hidden.js.map +1 -0
  74. package/dist/schema/parameters/gx-integer.d.ts +2 -0
  75. package/dist/schema/parameters/gx-integer.d.ts.map +1 -0
  76. package/dist/schema/parameters/gx-integer.js +47 -0
  77. package/dist/schema/parameters/gx-integer.js.map +1 -0
  78. package/dist/schema/parameters/gx-repeat.d.ts +2 -0
  79. package/dist/schema/parameters/gx-repeat.d.ts.map +1 -0
  80. package/dist/schema/parameters/gx-repeat.js +30 -0
  81. package/dist/schema/parameters/gx-repeat.js.map +1 -0
  82. package/dist/schema/parameters/gx-rules.d.ts +2 -0
  83. package/dist/schema/parameters/gx-rules.d.ts.map +1 -0
  84. package/dist/schema/parameters/gx-rules.js +91 -0
  85. package/dist/schema/parameters/gx-rules.js.map +1 -0
  86. package/dist/schema/parameters/gx-section.d.ts +2 -0
  87. package/dist/schema/parameters/gx-section.d.ts.map +1 -0
  88. package/dist/schema/parameters/gx-section.js +17 -0
  89. package/dist/schema/parameters/gx-section.js.map +1 -0
  90. package/dist/schema/parameters/gx-select.d.ts +2 -0
  91. package/dist/schema/parameters/gx-select.d.ts.map +1 -0
  92. package/dist/schema/parameters/gx-select.js +63 -0
  93. package/dist/schema/parameters/gx-select.js.map +1 -0
  94. package/dist/schema/parameters/gx-text.d.ts +2 -0
  95. package/dist/schema/parameters/gx-text.d.ts.map +1 -0
  96. package/dist/schema/parameters/gx-text.js +22 -0
  97. package/dist/schema/parameters/gx-text.js.map +1 -0
  98. package/dist/schema/parameters/index.d.ts +21 -0
  99. package/dist/schema/parameters/index.d.ts.map +1 -0
  100. package/dist/schema/parameters/index.js +24 -0
  101. package/dist/schema/parameters/index.js.map +1 -0
  102. package/dist/schema/parameters/registry.d.ts +6 -0
  103. package/dist/schema/parameters/registry.d.ts.map +1 -0
  104. package/dist/schema/parameters/registry.js +18 -0
  105. package/dist/schema/parameters/registry.js.map +1 -0
  106. package/dist/schema/state-representations.d.ts +14 -0
  107. package/dist/schema/state-representations.d.ts.map +1 -0
  108. package/dist/schema/state-representations.js +61 -0
  109. package/dist/schema/state-representations.js.map +1 -0
  110. package/dist/schema/validators/empty-field.d.ts +2 -0
  111. package/dist/schema/validators/empty-field.d.ts.map +1 -0
  112. package/dist/schema/validators/empty-field.js +12 -0
  113. package/dist/schema/validators/empty-field.js.map +1 -0
  114. package/dist/schema/validators/expression.d.ts +2 -0
  115. package/dist/schema/validators/expression.d.ts.map +1 -0
  116. package/dist/schema/validators/expression.js +42 -0
  117. package/dist/schema/validators/expression.js.map +1 -0
  118. package/dist/schema/validators/in-range.d.ts +2 -0
  119. package/dist/schema/validators/in-range.d.ts.map +1 -0
  120. package/dist/schema/validators/in-range.js +36 -0
  121. package/dist/schema/validators/in-range.js.map +1 -0
  122. package/dist/schema/validators/index.d.ts +8 -0
  123. package/dist/schema/validators/index.d.ts.map +1 -0
  124. package/dist/schema/validators/index.js +10 -0
  125. package/dist/schema/validators/index.js.map +1 -0
  126. package/dist/schema/validators/length.d.ts +2 -0
  127. package/dist/schema/validators/length.d.ts.map +1 -0
  128. package/dist/schema/validators/length.js +29 -0
  129. package/dist/schema/validators/length.js.map +1 -0
  130. package/dist/schema/validators/no-options.d.ts +2 -0
  131. package/dist/schema/validators/no-options.d.ts.map +1 -0
  132. package/dist/schema/validators/no-options.js +10 -0
  133. package/dist/schema/validators/no-options.js.map +1 -0
  134. package/dist/schema/validators/regex.d.ts +27 -0
  135. package/dist/schema/validators/regex.d.ts.map +1 -0
  136. package/dist/schema/validators/regex.js +100 -0
  137. package/dist/schema/validators/regex.js.map +1 -0
  138. package/dist/schema/validators/registry.d.ts +19 -0
  139. package/dist/schema/validators/registry.d.ts.map +1 -0
  140. package/dist/schema/validators/registry.js +29 -0
  141. package/dist/schema/validators/registry.js.map +1 -0
  142. package/dist/workflow/clean.d.ts +13 -0
  143. package/dist/workflow/clean.d.ts.map +1 -0
  144. package/dist/workflow/clean.js +131 -0
  145. package/dist/workflow/clean.js.map +1 -0
  146. package/dist/workflow/detect-format.d.ts +5 -0
  147. package/dist/workflow/detect-format.d.ts.map +1 -0
  148. package/dist/workflow/detect-format.js +11 -0
  149. package/dist/workflow/detect-format.js.map +1 -0
  150. package/dist/workflow/index.d.ts +9 -0
  151. package/dist/workflow/index.d.ts.map +1 -0
  152. package/dist/workflow/index.js +11 -0
  153. package/dist/workflow/index.js.map +1 -0
  154. package/dist/workflow/legacy-encoding.d.ts +40 -0
  155. package/dist/workflow/legacy-encoding.d.ts.map +1 -0
  156. package/dist/workflow/legacy-encoding.js +81 -0
  157. package/dist/workflow/legacy-encoding.js.map +1 -0
  158. package/dist/workflow/lint.d.ts +49 -0
  159. package/dist/workflow/lint.d.ts.map +1 -0
  160. package/dist/workflow/lint.js +402 -0
  161. package/dist/workflow/lint.js.map +1 -0
  162. package/dist/workflow/normalized/comments.d.ts +21 -0
  163. package/dist/workflow/normalized/comments.d.ts.map +1 -0
  164. package/dist/workflow/normalized/comments.js +80 -0
  165. package/dist/workflow/normalized/comments.js.map +1 -0
  166. package/dist/workflow/normalized/ensure.d.ts +21 -0
  167. package/dist/workflow/normalized/ensure.d.ts.map +1 -0
  168. package/dist/workflow/normalized/ensure.js +43 -0
  169. package/dist/workflow/normalized/ensure.js.map +1 -0
  170. package/dist/workflow/normalized/expanded.d.ts +62 -0
  171. package/dist/workflow/normalized/expanded.d.ts.map +1 -0
  172. package/dist/workflow/normalized/expanded.js +173 -0
  173. package/dist/workflow/normalized/expanded.js.map +1 -0
  174. package/dist/workflow/normalized/format2.d.ts +149 -0
  175. package/dist/workflow/normalized/format2.d.ts.map +1 -0
  176. package/dist/workflow/normalized/format2.js +416 -0
  177. package/dist/workflow/normalized/format2.js.map +1 -0
  178. package/dist/workflow/normalized/index.d.ts +9 -0
  179. package/dist/workflow/normalized/index.d.ts.map +1 -0
  180. package/dist/workflow/normalized/index.js +9 -0
  181. package/dist/workflow/normalized/index.js.map +1 -0
  182. package/dist/workflow/normalized/labels.d.ts +27 -0
  183. package/dist/workflow/normalized/labels.d.ts.map +1 -0
  184. package/dist/workflow/normalized/labels.js +59 -0
  185. package/dist/workflow/normalized/labels.js.map +1 -0
  186. package/dist/workflow/normalized/native.d.ts +97 -0
  187. package/dist/workflow/normalized/native.d.ts.map +1 -0
  188. package/dist/workflow/normalized/native.js +189 -0
  189. package/dist/workflow/normalized/native.js.map +1 -0
  190. package/dist/workflow/normalized/toFormat2.d.ts +11 -0
  191. package/dist/workflow/normalized/toFormat2.d.ts.map +1 -0
  192. package/dist/workflow/normalized/toFormat2.js +416 -0
  193. package/dist/workflow/normalized/toFormat2.js.map +1 -0
  194. package/dist/workflow/normalized/toNative.d.ts +11 -0
  195. package/dist/workflow/normalized/toNative.d.ts.map +1 -0
  196. package/dist/workflow/normalized/toNative.js +576 -0
  197. package/dist/workflow/normalized/toNative.js.map +1 -0
  198. package/dist/workflow/raw/gxformat2.d.ts +402 -0
  199. package/dist/workflow/raw/gxformat2.d.ts.map +1 -0
  200. package/dist/workflow/raw/gxformat2.effect.d.ts +1140 -0
  201. package/dist/workflow/raw/gxformat2.effect.d.ts.map +1 -0
  202. package/dist/workflow/raw/gxformat2.effect.js +453 -0
  203. package/dist/workflow/raw/gxformat2.effect.js.map +1 -0
  204. package/dist/workflow/raw/gxformat2.js +3 -0
  205. package/dist/workflow/raw/gxformat2.js.map +1 -0
  206. package/dist/workflow/raw/index.d.ts +5 -0
  207. package/dist/workflow/raw/index.d.ts.map +1 -0
  208. package/dist/workflow/raw/index.js +4 -0
  209. package/dist/workflow/raw/index.js.map +1 -0
  210. package/dist/workflow/raw/native.d.ts +439 -0
  211. package/dist/workflow/raw/native.d.ts.map +1 -0
  212. package/dist/workflow/raw/native.effect.d.ts +947 -0
  213. package/dist/workflow/raw/native.effect.d.ts.map +1 -0
  214. package/dist/workflow/raw/native.effect.js +474 -0
  215. package/dist/workflow/raw/native.effect.js.map +1 -0
  216. package/dist/workflow/raw/native.js +20 -0
  217. package/dist/workflow/raw/native.js.map +1 -0
  218. package/dist/workflow/replacement-scan.d.ts +21 -0
  219. package/dist/workflow/replacement-scan.d.ts.map +1 -0
  220. package/dist/workflow/replacement-scan.js +92 -0
  221. package/dist/workflow/replacement-scan.js.map +1 -0
  222. package/dist/workflow/state-merge.d.ts +49 -0
  223. package/dist/workflow/state-merge.d.ts.map +1 -0
  224. package/dist/workflow/state-merge.js +248 -0
  225. package/dist/workflow/state-merge.js.map +1 -0
  226. package/package.json +45 -0
@@ -0,0 +1,100 @@
1
+ import * as S from "effect/Schema";
2
+ import { registerValidatorType } from "./registry.js";
3
+ /**
4
+ * Convert Python inline flags (?aiLmsux) at the start of a pattern to JS RegExp flags.
5
+ * Unsupported flags (a, L, u, x) are silently dropped.
6
+ * Also handles ^(?flags) where the anchor precedes the flag group.
7
+ */
8
+ export function pythonToJsRegex(expression) {
9
+ const m = expression.match(/^(\^?)\(\?([aiLmsux]+)\)/);
10
+ if (!m)
11
+ return { pattern: expression, flags: "" };
12
+ const anchor = m[1]; // "" or "^"
13
+ const flagChars = m[2];
14
+ let flags = "";
15
+ if (flagChars.includes("i"))
16
+ flags += "i";
17
+ if (flagChars.includes("m"))
18
+ flags += "m";
19
+ if (flagChars.includes("s"))
20
+ flags += "s";
21
+ return { pattern: anchor + expression.slice(m[0].length), flags };
22
+ }
23
+ /**
24
+ * Strip Python identity escapes that are invalid under ECMA-262 unicode mode.
25
+ * Python allows \X for any character X (it's an identity escape), but JS /u mode
26
+ * only allows escaping syntax characters. We strip backslashes before non-syntax chars.
27
+ *
28
+ * ECMA-262 syntax characters (safe to escape): ^ $ \ . * + ? ( ) [ ] { } |
29
+ */
30
+ export function stripPythonIdentityEscapes(pattern) {
31
+ // Match \\ (escaped backslash) first to skip it, then \X where X is not
32
+ // an ECMA-262 syntax char or standard escape letter.
33
+ // Standard escape letters: d, D, w, W, s, S, b, B, n, r, t, f, v, 0, c, x, u, p, P, k
34
+ return pattern.replace(/\\\\|\\([^\\^$.*+?()[\]{}|dDwWsSnrtfv0cxupPkbB])/g, (match, captured) => captured !== undefined ? captured : match);
35
+ }
36
+ /**
37
+ * Convert []] (legacy PCRE/Python idiom for literal ]) to [\]] for ECMA-262 /u compat.
38
+ */
39
+ export function fixBracketCharClass(pattern) {
40
+ return pattern.replace(/\[\]\]/g, "[\\]]");
41
+ }
42
+ /**
43
+ * Make a pattern safe for JSON Schema's `pattern` keyword (ECMA-262, validated in /u mode by AJV).
44
+ * Returns null if the pattern can't be made safe.
45
+ */
46
+ export function jsonSchemaSafePattern(pattern) {
47
+ let safe = stripPythonIdentityEscapes(pattern);
48
+ safe = fixBracketCharClass(safe);
49
+ // Pre-flight: verify the result compiles under /u mode (AJV's validation mode)
50
+ try {
51
+ new RegExp(safe, "u");
52
+ return safe;
53
+ }
54
+ catch {
55
+ return null;
56
+ }
57
+ }
58
+ function safeRegExp(expression) {
59
+ const { pattern, flags } = pythonToJsRegex(expression);
60
+ try {
61
+ return new RegExp(pattern, flags);
62
+ }
63
+ catch {
64
+ return null;
65
+ }
66
+ }
67
+ function applyRegex(schema, validator) {
68
+ const v = validator;
69
+ // Galaxy treats "" as "not set" — regex validators only apply to non-empty values.
70
+ if (v.negate) {
71
+ const re = safeRegExp(v.expression);
72
+ if (!re)
73
+ return schema;
74
+ return schema.pipe(S.filter((value) => value === "" || !re.test(value), { jsonSchema: {} }));
75
+ }
76
+ const { pattern, flags } = pythonToJsRegex(v.expression);
77
+ let anchored = pattern;
78
+ if (!anchored.startsWith("^"))
79
+ anchored = "^" + anchored;
80
+ try {
81
+ const re = new RegExp(anchored, flags);
82
+ // JSON Schema `pattern` doesn't support regex flags (s, i, m).
83
+ // When flags are present, skip the pattern annotation.
84
+ // Otherwise, make the pattern /u-safe for AJV and wrap with empty-string exemption.
85
+ let jsonAnnotation;
86
+ if (flags) {
87
+ jsonAnnotation = { jsonSchema: {} };
88
+ }
89
+ else {
90
+ const safe = jsonSchemaSafePattern(anchored);
91
+ jsonAnnotation = safe ? { jsonSchema: { pattern: `(^$|${safe})` } } : { jsonSchema: {} };
92
+ }
93
+ return schema.pipe(S.filter((value) => value === "" || re.test(value), jsonAnnotation));
94
+ }
95
+ catch {
96
+ return schema;
97
+ }
98
+ }
99
+ registerValidatorType("regex", applyRegex);
100
+ //# sourceMappingURL=regex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.js","sourceRoot":"","sources":["../../../src/schema/validators/regex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACvD,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAClD,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY;IACjC,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,KAAK,IAAI,GAAG,CAAC;IAC1C,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,KAAK,IAAI,GAAG,CAAC;IAC1C,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,KAAK,IAAI,GAAG,CAAC;IAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAA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AAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED,qBAAqB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type * as S from "effect/Schema";
2
+ /**
3
+ * A function that applies a validator's constraint to an existing schema.
4
+ * Returns a new schema with the filter applied.
5
+ */
6
+ export type ValidatorApplier = (schema: S.Schema.Any, validator: any) => S.Schema.Any;
7
+ export declare function registerValidatorType(type: string, applier: ValidatorApplier): void;
8
+ export declare function getValidatorApplier(type: string): ValidatorApplier | undefined;
9
+ export declare function isValidatorTypeRegistered(type: string): boolean;
10
+ export declare function registeredValidatorTypes(): Set<string>;
11
+ /**
12
+ * Apply a list of validators to a schema, folding left.
13
+ * Unknown validator types are silently skipped (skip logic should have
14
+ * already filtered tools with unregistered validators).
15
+ */
16
+ export declare function applyValidators(schema: S.Schema.Any, validators: {
17
+ type: string;
18
+ }[]): S.Schema.Any;
19
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/schema/validators/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AAItF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAEnF;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE9E;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,wBAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,EACpB,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,CASd"}
@@ -0,0 +1,29 @@
1
+ const registry = new Map();
2
+ export function registerValidatorType(type, applier) {
3
+ registry.set(type, applier);
4
+ }
5
+ export function getValidatorApplier(type) {
6
+ return registry.get(type);
7
+ }
8
+ export function isValidatorTypeRegistered(type) {
9
+ return registry.has(type);
10
+ }
11
+ export function registeredValidatorTypes() {
12
+ return new Set(registry.keys());
13
+ }
14
+ /**
15
+ * Apply a list of validators to a schema, folding left.
16
+ * Unknown validator types are silently skipped (skip logic should have
17
+ * already filtered tools with unregistered validators).
18
+ */
19
+ export function applyValidators(schema, validators) {
20
+ let result = schema;
21
+ for (const v of validators) {
22
+ const applier = registry.get(v.type);
23
+ if (applier) {
24
+ result = applier(result, v);
25
+ }
26
+ }
27
+ return result;
28
+ }
29
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/schema/validators/registry.ts"],"names":[],"mappings":"AAQA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;AAErD,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,OAAyB;IAC3E,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAoB,EACpB,UAA8B;IAE9B,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Workflow tool_state cleaning — strip stale keys and decode legacy encoding.
3
+ *
4
+ * Port of Galaxy's workflow_state clean operation. Removes bookkeeping keys
5
+ * (__page__, __rerun_remap_job_id__), runtime leak keys (chromInfo, __input_ext),
6
+ * and decodes JSON-encoded tool_state strings into proper dicts.
7
+ */
8
+ /**
9
+ * Clean a workflow — strip stale keys and decode legacy tool_state encoding.
10
+ * Mutates and returns the workflow dict. Format2 workflows pass through unchanged.
11
+ */
12
+ export declare function cleanWorkflow(workflowDict: Record<string, unknown>): Record<string, unknown>;
13
+ //# sourceMappingURL=clean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/workflow/clean.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0HH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM5F"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Workflow tool_state cleaning — strip stale keys and decode legacy encoding.
3
+ *
4
+ * Port of Galaxy's workflow_state clean operation. Removes bookkeeping keys
5
+ * (__page__, __rerun_remap_job_id__), runtime leak keys (chromInfo, __input_ext),
6
+ * and decodes JSON-encoded tool_state strings into proper dicts.
7
+ */
8
+ /** Keys injected by Galaxy's tool form machinery — never meaningful in saved workflows. */
9
+ const BOOKKEEPING_KEYS = new Set(["__page__", "__rerun_remap_job_id__"]);
10
+ /** Keys leaked from runtime context into saved state. */
11
+ const RUNTIME_LEAK_KEYS = new Set(["chromInfo", "__input_ext"]);
12
+ /** Internal indexing keys within conditionals and repeats. */
13
+ const INTERNAL_KEYS = new Set(["__current_case__", "__index__"]);
14
+ const STALE_KEYS = new Set([...BOOKKEEPING_KEYS, ...RUNTIME_LEAK_KEYS, ...INTERNAL_KEYS]);
15
+ /**
16
+ * Decode a legacy JSON-encoded tool_state value. If the value is a string
17
+ * that parses to a compound type (object/array), return the parsed value and
18
+ * recurse. Primitive JSON strings (numbers, booleans, "null", quoted strings)
19
+ * are left as their original string form.
20
+ */
21
+ function decodeLegacyValue(value) {
22
+ if (typeof value !== "string")
23
+ return value;
24
+ try {
25
+ const parsed = JSON.parse(value);
26
+ if (parsed !== null && typeof parsed === "object") {
27
+ // Compound type — recurse into it
28
+ if (Array.isArray(parsed)) {
29
+ return parsed.map(decodeLegacyValue);
30
+ }
31
+ return decodeLegacyDict(parsed);
32
+ }
33
+ // Primitive — keep original string
34
+ return value;
35
+ }
36
+ catch {
37
+ return value;
38
+ }
39
+ }
40
+ /** Recursively decode all values in a dict that are legacy JSON strings. */
41
+ function decodeLegacyDict(dict) {
42
+ const result = {};
43
+ for (const [key, value] of Object.entries(dict)) {
44
+ result[key] = decodeLegacyValue(value);
45
+ }
46
+ return result;
47
+ }
48
+ /**
49
+ * Parse and decode a tool_state. Handles both:
50
+ * - String tool_state (JSON-encoded, possibly with nested legacy encoding)
51
+ * - Dict tool_state (already parsed, values are proper types)
52
+ */
53
+ function parseToolState(toolState) {
54
+ if (typeof toolState === "string") {
55
+ try {
56
+ const parsed = JSON.parse(toolState);
57
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
58
+ return decodeLegacyDict(parsed);
59
+ }
60
+ }
61
+ catch {
62
+ /* not valid JSON */
63
+ }
64
+ return null;
65
+ }
66
+ if (toolState !== null && typeof toolState === "object" && !Array.isArray(toolState)) {
67
+ return toolState;
68
+ }
69
+ return null;
70
+ }
71
+ /** Recursively remove stale keys from a tool_state dict. */
72
+ function stripStaleKeys(state) {
73
+ const result = {};
74
+ for (const [key, value] of Object.entries(state)) {
75
+ if (STALE_KEYS.has(key))
76
+ continue;
77
+ result[key] = stripStaleValue(value);
78
+ }
79
+ return result;
80
+ }
81
+ /** Recurse into nested values (conditional dicts, repeat arrays). */
82
+ function stripStaleValue(value) {
83
+ if (Array.isArray(value)) {
84
+ return value.map(stripStaleValue);
85
+ }
86
+ if (value !== null && typeof value === "object") {
87
+ return stripStaleKeys(value);
88
+ }
89
+ return value;
90
+ }
91
+ /** Clean a single native step's tool_state in place. */
92
+ function cleanNativeStep(stepDef) {
93
+ const toolId = stepDef.tool_id;
94
+ if (!toolId)
95
+ return;
96
+ const rawState = stepDef.tool_state;
97
+ if (rawState === undefined || rawState === null)
98
+ return;
99
+ const parsed = parseToolState(rawState);
100
+ if (!parsed)
101
+ return;
102
+ stepDef.tool_state = stripStaleKeys(parsed);
103
+ }
104
+ /** Recursively clean all steps in a native workflow dict. */
105
+ function cleanNativeSteps(workflowDict) {
106
+ const steps = workflowDict.steps;
107
+ if (!steps)
108
+ return;
109
+ for (const stepDef of Object.values(steps)) {
110
+ // Subworkflow steps don't have meaningful tool_state — recurse into the
111
+ // embedded subworkflow's steps instead.
112
+ if (stepDef.type === "subworkflow" && stepDef.subworkflow) {
113
+ cleanNativeSteps(stepDef.subworkflow);
114
+ continue;
115
+ }
116
+ cleanNativeStep(stepDef);
117
+ }
118
+ }
119
+ import { detectFormat } from "./detect-format.js";
120
+ /**
121
+ * Clean a workflow — strip stale keys and decode legacy tool_state encoding.
122
+ * Mutates and returns the workflow dict. Format2 workflows pass through unchanged.
123
+ */
124
+ export function cleanWorkflow(workflowDict) {
125
+ if (detectFormat(workflowDict) === "format2") {
126
+ return workflowDict;
127
+ }
128
+ cleanNativeSteps(workflowDict);
129
+ return workflowDict;
130
+ }
131
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/workflow/clean.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,2FAA2F;AAC3F,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAEzE,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;;;;;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,KAAK,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAClD,kCAAkC;YAClC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,OAAO,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,gBAAgB,CAAC,MAAiC,CAAC,CAAC;QAC7D,CAAC;QACD,mCAAmC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,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e,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,YAAqC;IACjE,IAAI,YAAY,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Workflow format — native (.ga) or format2 (.gxwf.yml). */
2
+ export type WorkflowFormat = "native" | "format2";
3
+ /** Detect whether a workflow dict is native or format2. */
4
+ export declare function detectFormat(data: Record<string, unknown>): WorkflowFormat;
5
+ //# sourceMappingURL=detect-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-format.d.ts","sourceRoot":"","sources":["../../src/workflow/detect-format.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElD,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAK1E"}
@@ -0,0 +1,11 @@
1
+ /** Detect whether a workflow dict is native or format2. */
2
+ export function detectFormat(data) {
3
+ if ("a_galaxy_workflow" in data)
4
+ return "native";
5
+ if (data.class === "GalaxyWorkflow")
6
+ return "format2";
7
+ if ("format-version" in data)
8
+ return "native";
9
+ return "format2";
10
+ }
11
+ //# sourceMappingURL=detect-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect-format.js","sourceRoot":"","sources":["../../src/workflow/detect-format.ts"],"names":[],"mappings":"AAGA,2DAA2D;AAC3D,MAAM,UAAU,YAAY,CAAC,IAA6B;IACxD,IAAI,mBAAmB,IAAI,IAAI;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,IAAI,CAAC,KAAK,KAAK,gBAAgB;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,gBAAgB,IAAI,IAAI;QAAE,OAAO,QAAQ,CAAC;IAC9C,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { type GalaxyWorkflow, GalaxyWorkflowSchema, type NativeGalaxyWorkflow, NativeGalaxyWorkflowSchema, } from "./raw/index.js";
2
+ 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, toNative, 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 { injectConnectionsIntoState, stripConnectedValues, flatStatePath, keysStartingWith, repeatInputsToArray, selectWhichWhen, } from "./state-merge.js";
4
+ export { scanForReplacements, type ReplacementClassification } from "./replacement-scan.js";
5
+ export { scanToolState, type LegacyEncodingClassification, type LegacyEncodingHit, type LegacyEncodingScanResult, } from "./legacy-encoding.js";
6
+ export { cleanWorkflow } from "./clean.js";
7
+ export { detectFormat, type WorkflowFormat } from "./detect-format.js";
8
+ export { LintContext, lintNative, lintFormat2, lintWorkflow, lintBestPracticesFormat2, lintBestPracticesNative, type LintResult, } from "./lint.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,QAAQ,EACR,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,0BAA0B,EAC1B,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,EACL,aAAa,EACb,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,11 @@
1
+ // Raw (generated) workflow schema types
2
+ export { GalaxyWorkflowSchema, NativeGalaxyWorkflowSchema, } from "./raw/index.js";
3
+ // Normalized workflow types + normalizers
4
+ export { normalizedFormat2, NormalizedFormat2WorkflowSchema, NormalizedFormat2StepSchema, NormalizedFormat2InputSchema, NormalizedFormat2OutputSchema, NormalizedFormat2StepInputSchema, NormalizedFormat2StepOutputSchema, normalizedNative, NormalizedNativeWorkflowSchema, NormalizedNativeStepSchema, ToolReferenceSchema, toFormat2, toNative, ensureFormat2, ensureNative, expandedFormat2, expandedNative, isTrsUrl, MAX_EXPANSION_DEPTH, flattenCommentData, unflattenCommentData, resolveSourceReference, UNLABELED_INPUT_PREFIX, UNLABELED_STEP_PREFIX, } from "./normalized/index.js";
5
+ export { injectConnectionsIntoState, stripConnectedValues, flatStatePath, keysStartingWith, repeatInputsToArray, selectWhichWhen, } from "./state-merge.js";
6
+ export { scanForReplacements } from "./replacement-scan.js";
7
+ export { scanToolState, } from "./legacy-encoding.js";
8
+ export { cleanWorkflow } from "./clean.js";
9
+ export { detectFormat } from "./detect-format.js";
10
+ export { LintContext, lintNative, lintFormat2, lintWorkflow, lintBestPracticesFormat2, lintBestPracticesNative, } from "./lint.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,EACT,QAAQ,EACR,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,0BAA0B,EAC1B,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAkC,MAAM,uBAAuB,CAAC;AAE5F,OAAO,EACL,aAAa,GAId,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAuB,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Classified detection of legacy parameter encoding in native workflow tool state.
3
+ *
4
+ * Port of Galaxy's `galaxy.tool_util.workflow_state.legacy_encoding`.
5
+ *
6
+ * Galaxy has two native tool_state serialization formats:
7
+ *
8
+ * - **Modern encoding** (nested=True): used in .ga files / IWC.
9
+ * After json.loads, all values at all depths are already correct types.
10
+ *
11
+ * - **Legacy parameter encoding** (nested=False): used in the workflow
12
+ * editor API and some old framework test workflows. Root values are
13
+ * individually JSON-stringified, so containers are still JSON strings
14
+ * and typed scalars are stringified (int 2 → "2").
15
+ *
16
+ * Detection signals:
17
+ * 1. Container params (conditional, section, repeat): a string value
18
+ * is definitive legacy encoding; a dict/list is definitive modern.
19
+ * 2. Select params with static options: a quoted value that doesn't
20
+ * match any option but unquoted does → definitive legacy encoding.
21
+ */
22
+ import type { ToolParameterModel } from "../schema/bundle-types.js";
23
+ export type LegacyEncodingClassification = "yes" | "maybe_assumed_no" | "no";
24
+ export interface LegacyEncodingHit {
25
+ parameterName: string;
26
+ parameterType: string;
27
+ detail: string;
28
+ }
29
+ export interface LegacyEncodingScanResult {
30
+ classification: LegacyEncodingClassification;
31
+ hits: LegacyEncodingHit[];
32
+ signalsChecked: number;
33
+ }
34
+ /**
35
+ * Scan decoded native tool_state for legacy parameter encoding.
36
+ *
37
+ * Checks root-level container params and select params with static options.
38
+ */
39
+ export declare function scanToolState(toolInputs: ToolParameterModel[], toolState: Record<string, unknown>): LegacyEncodingScanResult;
40
+ //# sourceMappingURL=legacy-encoding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-encoding.d.ts","sourceRoot":"","sources":["../../src/workflow/legacy-encoding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,2BAA2B,CAAC;AAE1F,MAAM,MAAM,4BAA4B,GAAG,KAAK,GAAG,kBAAkB,GAAG,IAAI,CAAC;AAE7E,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,4BAA4B,CAAC;IAC7C,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAWD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,kBAAkB,EAAE,EAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,wBAAwB,CA+C1B"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Classified detection of legacy parameter encoding in native workflow tool state.
3
+ *
4
+ * Port of Galaxy's `galaxy.tool_util.workflow_state.legacy_encoding`.
5
+ *
6
+ * Galaxy has two native tool_state serialization formats:
7
+ *
8
+ * - **Modern encoding** (nested=True): used in .ga files / IWC.
9
+ * After json.loads, all values at all depths are already correct types.
10
+ *
11
+ * - **Legacy parameter encoding** (nested=False): used in the workflow
12
+ * editor API and some old framework test workflows. Root values are
13
+ * individually JSON-stringified, so containers are still JSON strings
14
+ * and typed scalars are stringified (int 2 → "2").
15
+ *
16
+ * Detection signals:
17
+ * 1. Container params (conditional, section, repeat): a string value
18
+ * is definitive legacy encoding; a dict/list is definitive modern.
19
+ * 2. Select params with static options: a quoted value that doesn't
20
+ * match any option but unquoted does → definitive legacy encoding.
21
+ */
22
+ const CONTAINER_TYPES = new Set(["gx_conditional", "gx_section", "gx_repeat"]);
23
+ function stripQuotes(value) {
24
+ if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) {
25
+ return value.slice(1, -1);
26
+ }
27
+ return value;
28
+ }
29
+ /**
30
+ * Scan decoded native tool_state for legacy parameter encoding.
31
+ *
32
+ * Checks root-level container params and select params with static options.
33
+ */
34
+ export function scanToolState(toolInputs, toolState) {
35
+ const hits = [];
36
+ let signalsChecked = 0;
37
+ for (const toolInput of toolInputs) {
38
+ const parameterType = toolInput.parameter_type;
39
+ const name = toolInput.name;
40
+ const value = toolState[name];
41
+ if (value === undefined || value === null) {
42
+ continue;
43
+ }
44
+ if (CONTAINER_TYPES.has(parameterType)) {
45
+ signalsChecked++;
46
+ if (typeof value === "string") {
47
+ hits.push({
48
+ parameterName: name,
49
+ parameterType,
50
+ detail: "container value is a string",
51
+ });
52
+ }
53
+ }
54
+ else if (parameterType === "gx_select" && typeof value === "string") {
55
+ const select = toolInput;
56
+ if (select.options) {
57
+ const optionValues = new Set(select.options.map((o) => o.value));
58
+ signalsChecked++;
59
+ if (!optionValues.has(value) && optionValues.has(stripQuotes(value))) {
60
+ hits.push({
61
+ parameterName: name,
62
+ parameterType,
63
+ detail: `quoted value ${JSON.stringify(value)} doesn't match options, unquoted does`,
64
+ });
65
+ }
66
+ }
67
+ }
68
+ }
69
+ let classification;
70
+ if (hits.length > 0) {
71
+ classification = "yes";
72
+ }
73
+ else if (signalsChecked === 0) {
74
+ classification = "maybe_assumed_no";
75
+ }
76
+ else {
77
+ classification = "no";
78
+ }
79
+ return { classification, hits, signalsChecked };
80
+ }
81
+ //# sourceMappingURL=legacy-encoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-encoding.js","sourceRoot":"","sources":["../../src/workflow/legacy-encoding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAkBH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAE/E,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAgC,EAChC,SAAkC;IAElC,MAAM,IAAI,GAAwB,EAAE,CAAC;IACrC,IAAI,cAAc,GAAG,CAAC,CAAC;IAEvB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,SAAS,CAAC,cAAc,CAAC;QAC/C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QAC5B,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;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AAE,IAAI,EAAE,cAAc,EAAE,CAAC;AAClD,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Workflow linting — structural checks and best-practice warnings.
3
+ *
4
+ * Port of gxformat2's lint.py + linting.py. Checks workflow structure,
5
+ * output labels, step errors, tool references, output source resolution,
6
+ * input default types, and report markdown.
7
+ */
8
+ export declare class LintContext {
9
+ errors: string[];
10
+ warnings: string[];
11
+ private _prefix;
12
+ constructor(prefix?: string);
13
+ error(message: string): void;
14
+ warn(message: string): void;
15
+ child(prefix: string): LintContext;
16
+ }
17
+ export interface LintResult {
18
+ errors: string[];
19
+ warnings: string[];
20
+ error_count: number;
21
+ warn_count: number;
22
+ }
23
+ /**
24
+ * Lint a native Galaxy workflow (.ga format).
25
+ * Returns structured lint results with errors and warnings.
26
+ */
27
+ export declare function lintNative(workflowDict: Record<string, unknown>): LintResult;
28
+ /**
29
+ * Lint a Format2 Galaxy workflow (.gxwf.yml format).
30
+ * Returns structured lint results with errors and warnings.
31
+ */
32
+ export declare function lintFormat2(workflowDict: Record<string, unknown>): LintResult;
33
+ /**
34
+ * Lint a workflow, auto-detecting format.
35
+ * Returns structured lint results with errors and warnings.
36
+ */
37
+ export declare function lintWorkflow(workflowDict: Record<string, unknown>): LintResult;
38
+ /**
39
+ * Lint best practices for a Format2 Galaxy workflow.
40
+ * Returns structured lint results with warnings about missing annotations,
41
+ * creators, licenses, step labels, and disconnected inputs.
42
+ */
43
+ export declare function lintBestPracticesFormat2(workflowDict: Record<string, unknown>): LintResult;
44
+ /**
45
+ * Lint best practices for a native Galaxy workflow.
46
+ * Runs shared format2 best practices plus native-specific checks.
47
+ */
48
+ export declare function lintBestPracticesNative(workflowDict: Record<string, unknown>): LintResult;
49
+ //# sourceMappingURL=lint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/workflow/lint.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,qBAAa,WAAW;IACtB,MAAM,EAAE,MAAM,EAAE,CAAM;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAM;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,SAAK;IAIvB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;CASnC;AAMD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAkND;;;GAGG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAU5E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAU7E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAG9E;AA6HD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAY1F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAyBzF"}