@fnndsc/salsa 3.5.1 → 3.6.1

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 (76) hide show
  1. package/README.md +3 -3
  2. package/dist/connect/index.d.ts +11 -0
  3. package/dist/connect/index.js +11 -0
  4. package/dist/connect/index.js.map +1 -1
  5. package/dist/dag/feedJoins.js +8 -7
  6. package/dist/dag/feedJoins.js.map +1 -1
  7. package/dist/feeds/index.d.ts +15 -2
  8. package/dist/feeds/index.js.map +1 -1
  9. package/dist/files/index.d.ts +7 -0
  10. package/dist/files/index.js +12 -11
  11. package/dist/files/index.js.map +1 -1
  12. package/dist/files/regular_content.js +11 -3
  13. package/dist/files/regular_content.js.map +1 -1
  14. package/dist/groups/index.d.ts +59 -0
  15. package/dist/groups/index.js +89 -0
  16. package/dist/groups/index.js.map +1 -1
  17. package/dist/groups/membershipRevision.d.ts +19 -0
  18. package/dist/groups/membershipRevision.js +29 -0
  19. package/dist/groups/membershipRevision.js.map +1 -0
  20. package/dist/index.d.ts +3 -1
  21. package/dist/index.js +5 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/jobs/jobOps.d.ts +4 -9
  24. package/dist/jobs/jobOps.js +77 -39
  25. package/dist/jobs/jobOps.js.map +1 -1
  26. package/dist/pipelines/diagram.js +19 -9
  27. package/dist/pipelines/diagram.js.map +1 -1
  28. package/dist/pipelines/index.d.ts +28 -5
  29. package/dist/pipelines/index.js +118 -57
  30. package/dist/pipelines/index.js.map +1 -1
  31. package/dist/pipelines/invocation.d.ts +80 -0
  32. package/dist/pipelines/invocation.js +290 -0
  33. package/dist/pipelines/invocation.js.map +1 -0
  34. package/dist/pipelines/manifest.d.ts +88 -0
  35. package/dist/pipelines/manifest.js +216 -0
  36. package/dist/pipelines/manifest.js.map +1 -0
  37. package/dist/plugins/index.d.ts +29 -0
  38. package/dist/plugins/index.js +51 -10
  39. package/dist/plugins/index.js.map +1 -1
  40. package/dist/plugins/internal/plugin_executeNewFeed.d.ts +0 -14
  41. package/dist/plugins/internal/plugin_executeNewFeed.js +3 -3
  42. package/dist/plugins/internal/plugin_executeNewFeed.js.map +1 -1
  43. package/dist/plugins/plugin_register.js +5 -5
  44. package/dist/plugins/plugin_register.js.map +1 -1
  45. package/dist/plugins/store_import.js +1 -1
  46. package/dist/plugins/store_import.js.map +1 -1
  47. package/dist/retrieve/watch.d.ts +114 -0
  48. package/dist/retrieve/watch.js +358 -0
  49. package/dist/retrieve/watch.js.map +1 -0
  50. package/dist/store/index.d.ts +17 -4
  51. package/dist/store/index.js +9 -4
  52. package/dist/store/index.js.map +1 -1
  53. package/dist/users/index.d.ts +36 -0
  54. package/dist/users/index.js +50 -0
  55. package/dist/users/index.js.map +1 -0
  56. package/dist/vfs/dispatcher.d.ts +11 -0
  57. package/dist/vfs/dispatcher.js +37 -6
  58. package/dist/vfs/dispatcher.js.map +1 -1
  59. package/dist/vfs/index.d.ts +1 -0
  60. package/dist/vfs/index.js +3 -0
  61. package/dist/vfs/index.js.map +1 -1
  62. package/dist/vfs/provider.d.ts +13 -0
  63. package/dist/vfs/providers/etc.d.ts +2 -0
  64. package/dist/vfs/providers/etc.js +41 -2
  65. package/dist/vfs/providers/etc.js.map +1 -1
  66. package/dist/vfs/providers/native.js +41 -7
  67. package/dist/vfs/providers/native.js.map +1 -1
  68. package/dist/vfs/providers/pacs.d.ts +13 -1
  69. package/dist/vfs/providers/pacs.js +86 -107
  70. package/dist/vfs/providers/pacs.js.map +1 -1
  71. package/dist/vfs/providers/pacsHelpers.js +9 -5
  72. package/dist/vfs/providers/pacsHelpers.js.map +1 -1
  73. package/dist/vfs/providers/proc.d.ts +34 -1
  74. package/dist/vfs/providers/proc.js +314 -84
  75. package/dist/vfs/providers/proc.js.map +1 -1
  76. package/package.json +11 -8
@@ -11,18 +11,44 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
11
  return (mod && mod.__esModule) ? mod : { "default": mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.pipelineDiagram_get = void 0;
14
+ exports.pipelineInvocation_prepare = exports.pipelineManifest_get = exports.pipelineDiagram_get = void 0;
15
15
  exports.pipelines_list = pipelines_list;
16
16
  exports.pipelines_listAll = pipelines_listAll;
17
17
  exports.pipelineFields_get = pipelineFields_get;
18
18
  exports.pipelines_getAll = pipelines_getAll;
19
+ exports.pipelineManifestBySlug_get = pipelineManifestBySlug_get;
19
20
  exports.pipeline_run = pipeline_run;
20
21
  exports.pipeline_sourceGet = pipeline_sourceGet;
21
22
  exports.pipeline_getContent = pipeline_getContent;
22
23
  const cumin_1 = require("@fnndsc/cumin");
23
24
  var diagram_js_1 = require("./diagram.js");
24
25
  Object.defineProperty(exports, "pipelineDiagram_get", { enumerable: true, get: function () { return diagram_js_1.pipelineDiagram_get; } });
26
+ var manifest_js_1 = require("./manifest.js");
27
+ Object.defineProperty(exports, "pipelineManifest_get", { enumerable: true, get: function () { return manifest_js_1.pipelineManifest_get; } });
28
+ var invocation_js_1 = require("./invocation.js");
29
+ Object.defineProperty(exports, "pipelineInvocation_prepare", { enumerable: true, get: function () { return invocation_js_1.pipelineInvocation_prepare; } });
25
30
  const axios_1 = __importDefault(require("axios"));
31
+ const manifest_js_2 = require("./manifest.js");
32
+ const invocation_js_2 = require("./invocation.js");
33
+ const PIPELINE_SLUG_TTL_MS = 5 * 60 * 1000;
34
+ const pipelineSlugCaches = new WeakMap();
35
+ function pipelineSlugCache_get(client) {
36
+ let cache = pipelineSlugCaches.get(client);
37
+ if (cache === undefined) {
38
+ cache = new Map();
39
+ pipelineSlugCaches.set(client, cache);
40
+ }
41
+ return cache;
42
+ }
43
+ function pipelineSlug_create(pipeline, sourceFilename) {
44
+ const sourceBase = sourceFilename
45
+ ?.split('/').pop()?.replace(/\.(ya?ml)$/i, '');
46
+ const generatedBase = pipeline.name
47
+ .replace(/[^a-zA-Z0-9]/g, '_')
48
+ .replace(/_+/g, '_')
49
+ .replace(/^_|_$/g, '');
50
+ return `${sourceBase ?? generatedBase}_id${pipeline.id}`;
51
+ }
26
52
  /**
27
53
  * Lists registered pipelines, optionally filtered by name substring.
28
54
  * Returns FilteredResourceData for table rendering compatibility.
@@ -69,75 +95,111 @@ async function pipelines_getAll() {
69
95
  cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS');
70
96
  return (0, cumin_1.Err)();
71
97
  }
72
- const [pipelinesResult, sourceFilesResponse] = await Promise.all([
98
+ const [pipelinesResult, sourceFilesPage] = await Promise.all([
73
99
  (0, cumin_1.pipelines_list)(),
74
- client.getPipelineSourceFiles({ limit: 1000 }).catch(() => null),
100
+ (0, cumin_1.pipelineSourceFilesPage_get)(client, { limit: 1000 })
101
+ .catch(() => null),
75
102
  ]);
76
103
  if (!pipelinesResult.ok)
77
104
  return (0, cumin_1.Err)();
78
- const idToSlug = new Map();
79
- if (sourceFilesResponse) {
80
- for (const item of sourceFilesResponse.getItems()) {
81
- const { fname, pipeline_id } = item.data;
105
+ const idToSourceFilename = new Map();
106
+ if (sourceFilesPage) {
107
+ for (const row of sourceFilesPage.data) {
108
+ const { fname, pipeline_id } = row;
82
109
  if (pipeline_id && fname) {
83
- const base = fname.split('/').pop() ?? '';
84
- const slug = base.replace(/\.(ya?ml)$/i, '');
85
- idToSlug.set(pipeline_id, slug);
110
+ idToSourceFilename.set(pipeline_id, fname);
86
111
  }
87
112
  }
88
113
  }
89
- const records = pipelinesResult.value.map((pipeline) => {
90
- const sourceSlug = idToSlug.get(pipeline.id);
91
- const generatedSlug = pipeline.name
92
- .replace(/[^a-zA-Z0-9]/g, '_')
93
- .replace(/_+/g, '_')
94
- .replace(/^_|_$/g, '');
95
- const base = sourceSlug ?? generatedSlug;
96
- return {
97
- ...pipeline,
98
- slug: `${base}_id${pipeline.id}`,
99
- };
100
- });
114
+ const records = pipelinesResult.value.map((pipeline) => ({
115
+ ...pipeline,
116
+ slug: pipelineSlug_create(pipeline, idToSourceFilename.get(pipeline.id)),
117
+ }));
101
118
  return (0, cumin_1.Ok)(records);
102
119
  }
103
120
  /**
104
- * Runs a pipeline by name or ID, attaching it to a previous plugin instance.
121
+ * Project one exact Pipeline executable slug without listing every Pipeline.
105
122
  *
106
- * @param nameOrId - Pipeline name or numeric ID string.
107
- * @param previousPluginInstId - The plugin instance to attach the pipeline root to.
108
- * @param computeOverride - Optional compute resource name applied to all nodes.
109
- * @returns Result containing workflow ID and created plugin instance IDs.
123
+ * The stable `_id<N>` suffix identifies the candidate Pipeline. The targeted
124
+ * source-file lookup then verifies the complete slug before it is accepted.
125
+ *
126
+ * @param slug - Exact Pipeline basename exposed in `/bin`.
127
+ * @returns The registered invocation manifest for the exact Pipeline slug.
110
128
  */
111
- async function pipeline_run(nameOrId, previousPluginInstId, computeOverride) {
112
- const pipelineResult = await (0, cumin_1.pipeline_resolve)(nameOrId);
113
- if (!pipelineResult.ok)
129
+ async function pipelineManifestBySlug_get(slug) {
130
+ const match = slug.match(/_id(\d+)$/);
131
+ if (match === null)
114
132
  return (0, cumin_1.Err)();
115
- const pipeline = pipelineResult.value;
116
- const options = { previousPluginInstId };
117
- if (computeOverride) {
118
- const client = await cumin_1.chrisConnection.client_get();
119
- if (!client) {
120
- cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS');
133
+ const pipelineID = Number(match[1]);
134
+ const client = await cumin_1.chrisConnection.client_get();
135
+ if (!client) {
136
+ cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS');
137
+ return (0, cumin_1.Err)();
138
+ }
139
+ const cache = pipelineSlugCache_get(client);
140
+ const cached = cache.get(slug);
141
+ if (cached !== undefined && cached.expiresAt > Date.now()) {
142
+ return (0, manifest_js_2.pipelineManifestForPipeline_get)(cached.record, cached.resource, { detail: 'registered' });
143
+ }
144
+ if (cached !== undefined)
145
+ cache.delete(slug);
146
+ try {
147
+ const [pipelineHandle, sourcePage] = await Promise.all([
148
+ (0, cumin_1.pipeline_get)(client, pipelineID),
149
+ (0, cumin_1.pipelineSourceFilesPage_get)(client, { pipeline_id: pipelineID, limit: 1000 }),
150
+ ]);
151
+ if (pipelineHandle === null || pipelineHandle.data === null)
121
152
  return (0, cumin_1.Err)();
122
- }
123
- try {
124
- const pipelineObj = await client.getPipeline(pipeline.id);
125
- if (pipelineObj) {
126
- const pipingsResponse = await pipelineObj.getPluginPipings({ limit: 1000 });
127
- const pipings = pipingsResponse.getItems();
128
- options.nodeOverrides = pipings.map((p) => ({
129
- piping_id: p.data.id,
130
- compute_resource_name: computeOverride,
131
- }));
132
- }
133
- }
134
- catch (error) {
135
- const msg = error instanceof Error ? error.message : String(error);
136
- cumin_1.errorStack.stack_push('error', `pipeline_run: compute override failed: ${msg}`);
153
+ const pipeline = pipelineHandle.data;
154
+ const sourceRows = sourcePage.data;
155
+ const source = sourceRows.find((row) => row.pipeline_id === pipelineID)
156
+ ?? sourceRows.find((row) => row.pipeline_name === pipeline.name)
157
+ ?? (sourceRows.length === 1 ? sourceRows[0] : undefined);
158
+ const exactSlug = pipelineSlug_create(pipeline, source?.fname);
159
+ if (exactSlug !== slug)
137
160
  return (0, cumin_1.Err)();
138
- }
161
+ const record = { ...pipeline, slug: exactSlug };
162
+ cache.set(slug, {
163
+ record,
164
+ resource: pipelineHandle,
165
+ expiresAt: Date.now() + PIPELINE_SLUG_TTL_MS,
166
+ });
167
+ return (0, manifest_js_2.pipelineManifestForPipeline_get)(record, pipelineHandle, { detail: 'registered' });
139
168
  }
140
- return (0, cumin_1.pipeline_createWorkflow)(pipeline.id, options);
169
+ catch (error) {
170
+ const message = error instanceof Error ? error.message : String(error);
171
+ cumin_1.errorStack.stack_push('error', `pipelineManifestBySlug_get: ${message}`);
172
+ return (0, cumin_1.Err)();
173
+ }
174
+ }
175
+ /**
176
+ * Run a pipeline by name or ID, attaching it to a previous plugin instance.
177
+ *
178
+ * @param nameOrId - Pipeline name or numeric ID string.
179
+ * @param previousPluginInstId - Plugin instance to which pipeline roots attach.
180
+ * @param invocationOptions - Runtime overlays, or the legacy global compute string.
181
+ * @returns Result containing Workflow ID and created plugin instance IDs.
182
+ */
183
+ async function pipeline_run(nameOrId, previousPluginInstId, invocationOptions = {}) {
184
+ const normalized = typeof invocationOptions === 'string'
185
+ ? { globalCompute: invocationOptions }
186
+ : invocationOptions;
187
+ const manifestResult = await (0, manifest_js_2.pipelineManifest_get)(nameOrId);
188
+ if (!manifestResult.ok)
189
+ return (0, cumin_1.Err)();
190
+ const prepared = (0, invocation_js_2.pipelineInvocation_prepare)({
191
+ manifest: manifestResult.value,
192
+ globalCompute: normalized.globalCompute,
193
+ parameterFile: normalized.parameterFile,
194
+ cliBindings: normalized.cliBindings,
195
+ });
196
+ if (!prepared.ok)
197
+ return (0, cumin_1.Err)();
198
+ const options = {
199
+ previousPluginInstId,
200
+ nodeOverrides: prepared.value.nodeOverrides,
201
+ };
202
+ return (0, cumin_1.pipeline_createWorkflow)(prepared.value.pipelineID, options);
141
203
  }
142
204
  /**
143
205
  * Fetches the YAML source of a registered pipeline by searching /PIPELINES/ for
@@ -157,13 +219,12 @@ async function pipeline_sourceGet(nameOrId) {
157
219
  return (0, cumin_1.Err)();
158
220
  }
159
221
  try {
160
- const sourceFiles = await client.getPipelineSourceFiles({ pipeline_id: pipeline.id, limit: 1 });
161
- const items = sourceFiles.getItems();
162
- if (items.length === 0) {
222
+ const sourcePage = await (0, cumin_1.pipelineSourceFilesPage_get)(client, { pipeline_id: pipeline.id, limit: 1 });
223
+ if (sourcePage.data.length === 0) {
163
224
  cumin_1.errorStack.stack_push('error', `No source file registered for pipeline '${pipeline.name}' (id=${pipeline.id})`);
164
225
  return (0, cumin_1.Err)();
165
226
  }
166
- return (0, cumin_1.pipelineFile_getTextByPath)('/' + items[0].data.fname);
227
+ return (0, cumin_1.pipelineFile_getTextByPath)('/' + sourcePage.data[0].fname);
167
228
  }
168
229
  catch (error) {
169
230
  const msg = error instanceof Error ? error.message : String(error);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pipelines/index.ts"],"names":[],"mapp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CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,GAAG,GAAW,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3E,kBAAU,CAAC,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,EAAE,CAAC,CAAC;QAC9D,OAAO,IAAA,WAAG,GAAE,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @file Pure preparation of one registered Pipeline Workflow invocation.
3
+ *
4
+ * This module validates sparse or complete YAML overlays, applies global/file/CLI
5
+ * precedence, and produces the complete `nodes_info` payload CUBE expects. It
6
+ * assumes the manifest has already been fetched from the authenticated CUBE.
7
+ *
8
+ * @module
9
+ */
10
+ import { Result } from '@fnndsc/cumin';
11
+ import type { PipelineManifest } from './manifest.js';
12
+ /** Hosted plugin parameter schema used to validate one runtime binding. */
13
+ export interface PipelineParameterDefinition {
14
+ /** Hosted parameter name. */
15
+ name: string;
16
+ /** CUBE parameter type. */
17
+ type: string;
18
+ /** Whether the hosted plugin permits omission. */
19
+ optional: boolean;
20
+ /** Plugin-declared default. */
21
+ default?: unknown;
22
+ /** Plugin-declared help text. */
23
+ help?: string;
24
+ }
25
+ /** Surface-neutral binding of one value to one pipeline node field. */
26
+ export interface PipelineInvocationBinding {
27
+ /** Unique node title or exact `@<piping-id>` selector. */
28
+ node: string;
29
+ /** Hosted parameter name or reserved execution-control name. */
30
+ field: string;
31
+ /** Typed runtime value. */
32
+ value: unknown;
33
+ }
34
+ /** Complete CUBE `nodes_info` entry for one plugin piping. */
35
+ export interface PreparedWorkflowNode {
36
+ /** CUBE plugin piping ID. */
37
+ piping_id: number;
38
+ /** Authored node title. */
39
+ title: string;
40
+ /** Effective compute placement. */
41
+ compute_resource_name: string;
42
+ /** Effective CPU limit. */
43
+ cpu_limit?: unknown;
44
+ /** Effective memory limit. */
45
+ memory_limit?: unknown;
46
+ /** Effective GPU limit. */
47
+ gpu_limit?: unknown;
48
+ /** Effective worker count. */
49
+ number_of_workers?: unknown;
50
+ /** Complete registered parameter values plus runtime overrides. */
51
+ plugin_parameter_defaults: Array<{
52
+ name: string;
53
+ default: unknown;
54
+ }>;
55
+ }
56
+ /** Fully resolved Pipeline Workflow creation input. */
57
+ export interface PreparedPipelineInvocation {
58
+ /** Registered Pipeline ID. */
59
+ pipelineID: number;
60
+ /** Complete merged Workflow node override set. */
61
+ nodeOverrides: PreparedWorkflowNode[];
62
+ }
63
+ /** Inputs accepted by pure pipeline invocation preparation. */
64
+ export interface PipelineInvocationPrepareOptions {
65
+ /** Selected registered Pipeline manifest. */
66
+ manifest: PipelineManifest;
67
+ /** Baseline compute placement for every piping. */
68
+ globalCompute?: string;
69
+ /** Parsed CFS YAML overlay. */
70
+ parameterFile?: unknown;
71
+ /** Explicit node-qualified command or GUI bindings. */
72
+ cliBindings?: PipelineInvocationBinding[];
73
+ }
74
+ /**
75
+ * Build the complete `nodes_info` override set for one Workflow invocation.
76
+ *
77
+ * @param options - Registered manifest and optional global, file, and CLI overlays.
78
+ * @returns Prepared invocation, or an error after strict validation fails.
79
+ */
80
+ export declare function pipelineInvocation_prepare(options: PipelineInvocationPrepareOptions): Result<PreparedPipelineInvocation>;
@@ -0,0 +1,290 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pipelineInvocation_prepare = pipelineInvocation_prepare;
4
+ /**
5
+ * @file Pure preparation of one registered Pipeline Workflow invocation.
6
+ *
7
+ * This module validates sparse or complete YAML overlays, applies global/file/CLI
8
+ * precedence, and produces the complete `nodes_info` payload CUBE expects. It
9
+ * assumes the manifest has already been fetched from the authenticated CUBE.
10
+ *
11
+ * @module
12
+ */
13
+ const cumin_1 = require("@fnndsc/cumin");
14
+ const EXECUTION_FIELDS = new Set([
15
+ 'compute_resource_name',
16
+ 'cpu_limit',
17
+ 'memory_limit',
18
+ 'gpu_limit',
19
+ 'number_of_workers',
20
+ ]);
21
+ const DOCUMENT_FIELDS = new Set(['name', 'pipeline_id', 'plugin_tree']);
22
+ const PLUGIN_TREE_FIELDS = new Set(['root_index', 'tree']);
23
+ const NODE_FIELDS = new Set([
24
+ 'piping_id', 'title', 'plugin_name', 'plugin_version',
25
+ 'compute_resource_name', 'cpu_limit', 'memory_limit', 'gpu_limit', 'number_of_workers',
26
+ 'plugin_parameter_defaults', 'child_indices',
27
+ ]);
28
+ const PARAMETER_FIELDS = new Set(['name', 'default']);
29
+ function record_is(value) {
30
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
31
+ }
32
+ function fields_validate(record, allowed, location) {
33
+ const unknown = Object.keys(record).find((field) => !allowed.has(field));
34
+ if (unknown === undefined)
35
+ return true;
36
+ cumin_1.errorStack.stack_push('error', `Unknown ${location} field '${unknown}'.`);
37
+ return false;
38
+ }
39
+ function node_resolve(nodes, selector) {
40
+ if (selector.startsWith('@') && /^@\d+$/.test(selector)) {
41
+ const pipingID = Number(selector.slice(1));
42
+ return nodes.find((node) => node.pipingID === pipingID) ?? null;
43
+ }
44
+ const matches = nodes.filter((node) => node.title === selector);
45
+ return matches.length === 1 ? matches[0] : null;
46
+ }
47
+ function executionField_set(node, field, value) {
48
+ if (field === 'compute_resource_name')
49
+ node.compute_resource_name = String(value);
50
+ else if (field === 'cpu_limit')
51
+ node.cpu_limit = value;
52
+ else if (field === 'memory_limit')
53
+ node.memory_limit = value;
54
+ else if (field === 'gpu_limit')
55
+ node.gpu_limit = value;
56
+ else if (field === 'number_of_workers')
57
+ node.number_of_workers = value;
58
+ }
59
+ function executionValue_isValid(field, value) {
60
+ if (field === 'compute_resource_name')
61
+ return typeof value === 'string' && value.trim().length > 0;
62
+ if (field === 'gpu_limit' || field === 'number_of_workers') {
63
+ return typeof value === 'number' && Number.isInteger(value) && value >= 0;
64
+ }
65
+ return (typeof value === 'number' && Number.isFinite(value) && value >= 0) ||
66
+ (typeof value === 'string' && value.trim().length > 0);
67
+ }
68
+ function parameter_set(node, name, value) {
69
+ const current = node.plugin_parameter_defaults
70
+ .find((parameter) => parameter.name === name);
71
+ if (current)
72
+ current.default = value;
73
+ else
74
+ node.plugin_parameter_defaults.push({ name, default: value });
75
+ }
76
+ function parameter_known(node, name) {
77
+ if (node.parameterDefinitions !== undefined) {
78
+ return node.parameterDefinitions.some((parameter) => parameter.name === name);
79
+ }
80
+ return node.parameterDefaults.some((parameter) => parameter.name === name);
81
+ }
82
+ function parameter_valueValid(node, name, value) {
83
+ const definition = node.parameterDefinitions
84
+ ?.find((parameter) => parameter.name === name);
85
+ if (!definition || value === null || value === undefined)
86
+ return true;
87
+ const type = definition.type.toLowerCase();
88
+ if (type === 'integer' || type === 'int')
89
+ return typeof value === 'number' && Number.isInteger(value);
90
+ if (type === 'float' || type === 'number')
91
+ return typeof value === 'number' && Number.isFinite(value);
92
+ if (type === 'boolean' || type === 'bool')
93
+ return typeof value === 'boolean';
94
+ if (type === 'str' || type === 'string' || type === 'path' || type === 'unextpath') {
95
+ return typeof value === 'string';
96
+ }
97
+ return false;
98
+ }
99
+ /**
100
+ * Build the complete `nodes_info` override set for one Workflow invocation.
101
+ *
102
+ * @param options - Registered manifest and optional global, file, and CLI overlays.
103
+ * @returns Prepared invocation, or an error after strict validation fails.
104
+ */
105
+ function pipelineInvocation_prepare(options) {
106
+ const manifest = options.manifest;
107
+ const nodes = manifest.nodes;
108
+ const preparedByID = new Map();
109
+ for (const node of nodes) {
110
+ preparedByID.set(node.pipingID, {
111
+ piping_id: node.pipingID,
112
+ title: node.title,
113
+ compute_resource_name: options.globalCompute ?? node.computeResourceName,
114
+ cpu_limit: node.cpuLimit,
115
+ memory_limit: node.memoryLimit,
116
+ gpu_limit: node.gpuLimit,
117
+ number_of_workers: node.numberOfWorkers,
118
+ plugin_parameter_defaults: node.parameterDefaults.map((parameter) => ({
119
+ name: parameter.name,
120
+ default: parameter.value,
121
+ })),
122
+ });
123
+ }
124
+ if (options.parameterFile !== undefined) {
125
+ if (!record_is(options.parameterFile)) {
126
+ cumin_1.errorStack.stack_push('error', 'Parameter file must contain a YAML mapping.');
127
+ return (0, cumin_1.Err)();
128
+ }
129
+ const document = options.parameterFile;
130
+ if (!fields_validate(document, DOCUMENT_FIELDS, 'parameter-file'))
131
+ return (0, cumin_1.Err)();
132
+ if (document.name !== undefined && document.name !== manifest.name) {
133
+ cumin_1.errorStack.stack_push('error', `Parameter file names pipeline '${String(document.name)}', not '${manifest.name}'.`);
134
+ return (0, cumin_1.Err)();
135
+ }
136
+ if (document.pipeline_id !== undefined && document.pipeline_id !== manifest.pipelineID) {
137
+ cumin_1.errorStack.stack_push('error', `Parameter file pipeline_id ${String(document.pipeline_id)} does not match ${manifest.pipelineID}.`);
138
+ return (0, cumin_1.Err)();
139
+ }
140
+ const pluginTree = document.plugin_tree;
141
+ if (record_is(pluginTree) && !fields_validate(pluginTree, PLUGIN_TREE_FIELDS, 'plugin_tree'))
142
+ return (0, cumin_1.Err)();
143
+ if (record_is(pluginTree) && pluginTree.root_index !== undefined) {
144
+ const expectedRootIndex = manifest.nodes.findIndex((node) => node.pipingID === manifest.rootIDs[0]);
145
+ if (pluginTree.root_index !== expectedRootIndex) {
146
+ cumin_1.errorStack.stack_push('error', 'Parameter-file root_index does not match the registered pipeline.');
147
+ return (0, cumin_1.Err)();
148
+ }
149
+ }
150
+ const tree = record_is(pluginTree) ? pluginTree.tree : undefined;
151
+ if (!Array.isArray(tree)) {
152
+ cumin_1.errorStack.stack_push('error', 'Parameter file must contain plugin_tree.tree.');
153
+ return (0, cumin_1.Err)();
154
+ }
155
+ const fileBindingsSeen = new Set();
156
+ for (const rawNode of tree) {
157
+ if (!record_is(rawNode)) {
158
+ cumin_1.errorStack.stack_push('error', 'Each parameter-file node must be a mapping.');
159
+ return (0, cumin_1.Err)();
160
+ }
161
+ if (!fields_validate(rawNode, NODE_FIELDS, 'pipeline node'))
162
+ return (0, cumin_1.Err)();
163
+ const selector = rawNode.piping_id !== undefined
164
+ ? `@${String(rawNode.piping_id)}`
165
+ : String(rawNode.title ?? '');
166
+ const source = node_resolve(nodes, selector);
167
+ if (!source) {
168
+ cumin_1.errorStack.stack_push('error', `Unknown or ambiguous pipeline node '${selector}'.`);
169
+ return (0, cumin_1.Err)();
170
+ }
171
+ if (rawNode.title !== undefined && rawNode.title !== source.title) {
172
+ cumin_1.errorStack.stack_push('error', `Node title assertion does not match piping ${source.pipingID}.`);
173
+ return (0, cumin_1.Err)();
174
+ }
175
+ if (rawNode.plugin_name !== undefined && rawNode.plugin_name !== source.pluginName) {
176
+ cumin_1.errorStack.stack_push('error', `Plugin assertion does not match node '${source.title}'.`);
177
+ return (0, cumin_1.Err)();
178
+ }
179
+ if (rawNode.plugin_version !== undefined && rawNode.plugin_version !== source.pluginVersion) {
180
+ cumin_1.errorStack.stack_push('error', `Plugin version assertion does not match node '${source.title}'.`);
181
+ return (0, cumin_1.Err)();
182
+ }
183
+ if (rawNode.child_indices !== undefined) {
184
+ if (!Array.isArray(rawNode.child_indices))
185
+ return (0, cumin_1.Err)();
186
+ const expectedChildren = manifest.nodes
187
+ .map((candidate, index) => [candidate, index])
188
+ .filter(([candidate]) => candidate.parentID === source.pipingID)
189
+ .map(([, index]) => index);
190
+ const supplied = rawNode.child_indices;
191
+ if (supplied.length !== expectedChildren.length || supplied.some((value, index) => value !== expectedChildren[index])) {
192
+ cumin_1.errorStack.stack_push('error', `child_indices assertion does not match node '${source.title}'.`);
193
+ return (0, cumin_1.Err)();
194
+ }
195
+ }
196
+ const prepared = preparedByID.get(source.pipingID);
197
+ for (const field of EXECUTION_FIELDS) {
198
+ if (rawNode[field] !== undefined) {
199
+ if (!executionValue_isValid(field, rawNode[field])) {
200
+ cumin_1.errorStack.stack_push('error', `Invalid ${field} value on node '${source.title}'.`);
201
+ return (0, cumin_1.Err)();
202
+ }
203
+ const bindingKey = `${source.pipingID}.${field}`;
204
+ if (fileBindingsSeen.has(bindingKey)) {
205
+ cumin_1.errorStack.stack_push('error', `Duplicate parameter-file binding '${source.title}.${field}'.`);
206
+ return (0, cumin_1.Err)();
207
+ }
208
+ fileBindingsSeen.add(bindingKey);
209
+ executionField_set(prepared, field, rawNode[field]);
210
+ }
211
+ }
212
+ const defaults = rawNode.plugin_parameter_defaults;
213
+ if (defaults !== undefined) {
214
+ if (!Array.isArray(defaults))
215
+ return (0, cumin_1.Err)();
216
+ for (const rawParameter of defaults) {
217
+ if (!record_is(rawParameter) || typeof rawParameter.name !== 'string')
218
+ return (0, cumin_1.Err)();
219
+ if (!fields_validate(rawParameter, PARAMETER_FIELDS, 'parameter'))
220
+ return (0, cumin_1.Err)();
221
+ if (rawParameter.name === 'plugininstances') {
222
+ const registered = source.parameterDefaults.find((parameter) => parameter.name === 'plugininstances');
223
+ if (!registered || rawParameter.default !== registered.value) {
224
+ cumin_1.errorStack.stack_push('error', 'plugininstances encodes pipeline topology and cannot be overridden.');
225
+ return (0, cumin_1.Err)();
226
+ }
227
+ continue;
228
+ }
229
+ if (!parameter_known(source, rawParameter.name)) {
230
+ cumin_1.errorStack.stack_push('error', `Unknown parameter '${rawParameter.name}' on node '${source.title}'.`);
231
+ return (0, cumin_1.Err)();
232
+ }
233
+ if (!parameter_valueValid(source, rawParameter.name, rawParameter.default)) {
234
+ cumin_1.errorStack.stack_push('error', `Invalid ${rawParameter.name} value on node '${source.title}'.`);
235
+ return (0, cumin_1.Err)();
236
+ }
237
+ const bindingKey = `${source.pipingID}.${rawParameter.name}`;
238
+ if (fileBindingsSeen.has(bindingKey)) {
239
+ cumin_1.errorStack.stack_push('error', `Duplicate parameter-file binding '${source.title}.${rawParameter.name}'.`);
240
+ return (0, cumin_1.Err)();
241
+ }
242
+ fileBindingsSeen.add(bindingKey);
243
+ parameter_set(prepared, rawParameter.name, rawParameter.default);
244
+ }
245
+ }
246
+ }
247
+ }
248
+ for (const binding of options.cliBindings ?? []) {
249
+ const source = node_resolve(nodes, binding.node);
250
+ if (!source) {
251
+ cumin_1.errorStack.stack_push('error', `Unknown or ambiguous pipeline node '${binding.node}'.`);
252
+ return (0, cumin_1.Err)();
253
+ }
254
+ const prepared = preparedByID.get(source.pipingID);
255
+ if (EXECUTION_FIELDS.has(binding.field)) {
256
+ if (!executionValue_isValid(binding.field, binding.value)) {
257
+ cumin_1.errorStack.stack_push('error', `Invalid ${binding.field} value on node '${source.title}'.`);
258
+ return (0, cumin_1.Err)();
259
+ }
260
+ executionField_set(prepared, binding.field, binding.value);
261
+ }
262
+ else {
263
+ if (binding.field === 'plugininstances') {
264
+ cumin_1.errorStack.stack_push('error', 'plugininstances encodes pipeline topology and cannot be overridden.');
265
+ return (0, cumin_1.Err)();
266
+ }
267
+ if (!parameter_known(source, binding.field)) {
268
+ cumin_1.errorStack.stack_push('error', `Unknown parameter '${binding.field}' on node '${source.title}'.`);
269
+ return (0, cumin_1.Err)();
270
+ }
271
+ if (!parameter_valueValid(source, binding.field, binding.value)) {
272
+ cumin_1.errorStack.stack_push('error', `Invalid ${binding.field} value on node '${source.title}'.`);
273
+ return (0, cumin_1.Err)();
274
+ }
275
+ parameter_set(prepared, binding.field, binding.value);
276
+ }
277
+ }
278
+ let computeInvalid = false;
279
+ for (const source of nodes) {
280
+ const effective = preparedByID.get(source.pipingID).compute_resource_name;
281
+ if (source.computeResources !== undefined && !source.computeResources.includes(effective)) {
282
+ cumin_1.errorStack.stack_push('error', `Node '${source.title}' (${source.pluginName} v${source.pluginVersion}) is not registered on compute '${effective}'.`);
283
+ computeInvalid = true;
284
+ }
285
+ }
286
+ if (computeInvalid)
287
+ return (0, cumin_1.Err)();
288
+ return (0, cumin_1.Ok)({ pipelineID: manifest.pipelineID, nodeOverrides: [...preparedByID.values()] });
289
+ }
290
+ //# sourceMappingURL=invocation.js.map