@uipath/maestro-builder-sdk 6.16.5 → 6.16.7

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 (52) hide show
  1. package/dist/api-index.md +78 -78
  2. package/dist/api-members.md +333 -333
  3. package/dist/bpmn/bpmn-expr-check.d.ts +1 -1
  4. package/dist/bpmn/bpmn-expr-check.js +1 -1
  5. package/dist/bpmn/bpmn-sdk.d.ts +1 -52
  6. package/dist/bpmn/bpmn-sdk.js +3 -66
  7. package/dist/bpmn/check-cli.js +2 -2
  8. package/dist/bpmn/check.d.ts +1 -1
  9. package/dist/bpmn/check.js +1 -18
  10. package/dist/bpmn/compile-cli.js +3 -7
  11. package/dist/bpmn/connector.d.ts +1 -1
  12. package/dist/bpmn/connector.js +2 -3
  13. package/dist/bpmn/declared-vars.d.ts +60 -0
  14. package/dist/bpmn/declared-vars.js +66 -0
  15. package/dist/bpmn/decompile-cli.js +4 -8
  16. package/dist/bpmn/merge-cli.js +3 -7
  17. package/dist/bpmn/serialize.js +1 -2
  18. package/dist/bpmn/tidy-cli.js +2 -6
  19. package/dist/case/compile-cli.js +3 -7
  20. package/dist/case/decompile-cli.js +5 -9
  21. package/dist/case/merge-cli.js +2 -6
  22. package/dist/case/serialize.js +1 -1
  23. package/dist/check.js +3 -15
  24. package/dist/cli-library.d.ts +1 -1
  25. package/dist/cli-library.js +1 -1
  26. package/dist/cli-run.d.ts +2 -0
  27. package/dist/cli-run.js +5 -0
  28. package/dist/compile-cli.js +3 -7
  29. package/dist/config.d.ts +0 -8
  30. package/dist/config.js +1 -10
  31. package/dist/core/cli-library.d.ts +0 -2
  32. package/dist/core/cli-library.js +2 -6
  33. package/dist/core/connector-inputs.d.ts +8 -0
  34. package/dist/core/connector-inputs.js +11 -16
  35. package/dist/core/edit-distance.d.ts +10 -0
  36. package/dist/core/edit-distance.js +20 -0
  37. package/dist/core/library.js +1 -12
  38. package/dist/core/step-ports.d.ts +0 -20
  39. package/dist/core/step-ports.js +0 -50
  40. package/dist/decompile-cli.js +3 -7
  41. package/dist/emit.js +1 -1
  42. package/dist/flow-step-tree.d.ts +25 -0
  43. package/dist/flow-step-tree.js +50 -0
  44. package/dist/merge-cli.js +3 -7
  45. package/dist/registry/path-cli.js +1 -1
  46. package/dist/registry/prepare/actions.js +1 -12
  47. package/dist/registry/pull-cli.js +1 -1
  48. package/dist/registry/search-cli.js +1 -1
  49. package/dist/serialize.js +4 -3
  50. package/package.json +2 -2
  51. /package/dist/{registry/cache.d.ts → core/library-cache.d.ts} +0 -0
  52. /package/dist/{registry/cache.js → core/library-cache.js} +0 -0
@@ -22,7 +22,7 @@
22
22
  * Variables are SCOPED: a sub-process sees the enclosing variables plus its own.
23
23
  */
24
24
  import { type ExprDiagnostic } from '../core/expr-check.js';
25
- import { type BuiltBpmn } from './bpmn-sdk.js';
25
+ import type { BuiltBpmn } from './bpmn-sdk.js';
26
26
  /** A diagnostic plus the element it was found in. */
27
27
  export interface BpmnLocatedDiagnostic extends ExprDiagnostic {
28
28
  where: string;
@@ -22,7 +22,7 @@
22
22
  * Variables are SCOPED: a sub-process sees the enclosing variables plus its own.
23
23
  */
24
24
  import { checkExpression } from '../core/expr-check.js';
25
- import { nodeDeclaredVars } from './bpmn-sdk.js';
25
+ import { nodeDeclaredVars } from './declared-vars.js';
26
26
  const NOUN = 'variable';
27
27
  const NAMESPACE = 'vars';
28
28
  const BINDING_NOUN = 'binding';
@@ -27,6 +27,7 @@ import { type DataServiceOperation } from './data-service.js';
27
27
  export type { DataServiceOperation } from './data-service.js';
28
28
  export { BpmnBuildError } from './bpmn-expr-check.js';
29
29
  export type { BpmnLocatedDiagnostic } from './bpmn-expr-check.js';
30
+ export { connectorOutputVars, nodeDeclaredVars, typedNodeDeclaredVars } from './declared-vars.js';
30
31
  /** ISO-8601 timer specification (one of duration / date / cycle). */
31
32
  export interface TimerSpec {
32
33
  /** Fire after this ISO-8601 duration, e.g. `'PT30S'`. */
@@ -3135,58 +3136,6 @@ export type BpmnConnectorOpts = ConnectorOpts & ActivityOpts & {
3135
3136
  */
3136
3137
  outputVar?: string;
3137
3138
  };
3138
- /**
3139
- * The variables a connector task's output rows land in.
3140
- *
3141
- * Per-node by default, because a `uipath:output`'s `var` IS the variable
3142
- * declaration as far as the platform is concerned (its canvas model maps every
3143
- * node output to a variable keyed by `var`). A shared name would therefore mean
3144
- * two connectors writing one variable, with the second silently clobbering the
3145
- * first — and it is the reason both the serializer and the expression check need
3146
- * the same answer, hence one function.
3147
- *
3148
- * @param n - The connector node.
3149
- * @returns The response and error variable names.
3150
- *
3151
- * @internal
3152
- */
3153
- export declare function connectorOutputVars(n: Extract<BpmnNode, {
3154
- kind: 'connector';
3155
- }>): {
3156
- response: string;
3157
- error: string;
3158
- };
3159
- /**
3160
- * The variables a typed node writes — the ONE definition of that set.
3161
- *
3162
- * It had grown three: this one (what an expression may read), `implicitNodeVars` in
3163
- * serialize (what gets declared in `uipath:variables`), and `derivedVariableIds` in
3164
- * decompile (what a decompiled file must NOT re-declare). All three must agree, and
3165
- * adding `outputRows` proved they do not stay agreed on their own: two were updated,
3166
- * this one was missed, and a human task's mapped output stopped being visible to the
3167
- * expression checker — `vars.decision` reported undeclared for a variable the node
3168
- * plainly writes. So serialize now calls this instead of repeating it, and only
3169
- * decompile's copy is separate, which its own comment already flags as load-bearing.
3170
- *
3171
- * @param n - The typed node.
3172
- * @returns The variable ids its output rows write.
3173
- * @internal
3174
- */
3175
- export declare function typedNodeDeclaredVars(n: Extract<BpmnNode, {
3176
- kind: 'typed';
3177
- }>): string[];
3178
- /**
3179
- * Every variable name a node DECLARES by writing to it — the platform counts a
3180
- * node's output `var` as a declaration, so a downstream `=vars.<name>` resolves
3181
- * against it without any `uipath:variables` entry. The expression check mirrors
3182
- * that, or it would reject reads the platform accepts.
3183
- *
3184
- * @param n - The node to inspect.
3185
- * @returns The variable names it declares, if any.
3186
- *
3187
- * @internal
3188
- */
3189
- export declare function nodeDeclaredVars(n: BpmnNode): string[];
3190
3139
  /** A sub-process body: the same graph methods, plus an internal node builder. */
3191
3140
  export declare class SubProcessBuilder extends ScopeBuilder {
3192
3141
  /**
@@ -2,9 +2,11 @@ import { connector as makeConnector } from '../core/actions.js';
2
2
  import { checkBpmnExpressions, BpmnBuildError } from './bpmn-expr-check.js';
3
3
  import { BPMN_SCHEMA_VERSIONS } from './format-profile.js';
4
4
  import { schemaVersionRefusal } from '../schema-version.js';
5
- import { bindingRequiredFields, REGISTRY_GAPS, registryType, typedNodeOutputVar } from './typed-node.js';
5
+ import { bindingRequiredFields, REGISTRY_GAPS, registryType } from './typed-node.js';
6
6
  import { DATA_SERVICE_ACTIVITY_TYPE, DATA_SERVICE_CONNECTOR_KEY, dataServiceWire } from './data-service.js';
7
7
  export { BpmnBuildError } from './bpmn-expr-check.js';
8
+ // @internal helpers kept on the published /bpmn subpath; SDK code imports declared-vars.js.
9
+ export { connectorOutputVars, nodeDeclaredVars, typedNodeDeclaredVars } from './declared-vars.js';
8
10
  function normTimer(t) {
9
11
  return typeof t === 'string' ? { duration: t } : t;
10
12
  }
@@ -2264,47 +2266,6 @@ class ScopeBuilder {
2264
2266
  return this;
2265
2267
  }
2266
2268
  }
2267
- /**
2268
- * The variables a connector task's output rows land in.
2269
- *
2270
- * Per-node by default, because a `uipath:output`'s `var` IS the variable
2271
- * declaration as far as the platform is concerned (its canvas model maps every
2272
- * node output to a variable keyed by `var`). A shared name would therefore mean
2273
- * two connectors writing one variable, with the second silently clobbering the
2274
- * first — and it is the reason both the serializer and the expression check need
2275
- * the same answer, hence one function.
2276
- *
2277
- * @param n - The connector node.
2278
- * @returns The response and error variable names.
2279
- *
2280
- * @internal
2281
- */
2282
- export function connectorOutputVars(n) {
2283
- return { response: n.outputVar ?? `${n.id}_response`, error: `${n.id}_Error` };
2284
- }
2285
- /**
2286
- * The variables a typed node writes — the ONE definition of that set.
2287
- *
2288
- * It had grown three: this one (what an expression may read), `implicitNodeVars` in
2289
- * serialize (what gets declared in `uipath:variables`), and `derivedVariableIds` in
2290
- * decompile (what a decompiled file must NOT re-declare). All three must agree, and
2291
- * adding `outputRows` proved they do not stay agreed on their own: two were updated,
2292
- * this one was missed, and a human task's mapped output stopped being visible to the
2293
- * expression checker — `vars.decision` reported undeclared for a variable the node
2294
- * plainly writes. So serialize now calls this instead of repeating it, and only
2295
- * decompile's copy is separate, which its own comment already flags as load-bearing.
2296
- *
2297
- * @param n - The typed node.
2298
- * @returns The variable ids its output rows write.
2299
- * @internal
2300
- */
2301
- export function typedNodeDeclaredVars(n) {
2302
- // Spelled-out rows REPLACE the derived pair, so they are the whole answer.
2303
- if (n.outputRows)
2304
- return n.outputRows.map((r) => r.var).filter((v) => v !== undefined);
2305
- const v = typedNodeOutputVar(n.id, n.type, n.outputVar, n.spec);
2306
- return [...(v ? [v] : []), ...Object.keys(n.outputs ?? {})];
2307
- }
2308
2269
  /**
2309
2270
  * Fill in `activity` on a connector task from the `operation` beside it.
2310
2271
  *
@@ -2348,30 +2309,6 @@ function defaultActivityIdentityRows(type, context, rows) {
2348
2309
  return rows;
2349
2310
  return [...rows, { name: 'activity', type: 'string', value: operation }];
2350
2311
  }
2351
- /**
2352
- * Every variable name a node DECLARES by writing to it — the platform counts a
2353
- * node's output `var` as a declaration, so a downstream `=vars.<name>` resolves
2354
- * against it without any `uipath:variables` entry. The expression check mirrors
2355
- * that, or it would reject reads the platform accepts.
2356
- *
2357
- * @param n - The node to inspect.
2358
- * @returns The variable names it declares, if any.
2359
- *
2360
- * @internal
2361
- */
2362
- export function nodeDeclaredVars(n) {
2363
- if (n.kind === 'connector') {
2364
- const { response, error } = connectorOutputVars(n);
2365
- return [response, error];
2366
- }
2367
- if (n.kind === 'typed')
2368
- return typedNodeDeclaredVars(n);
2369
- if (n.kind === 'scriptTask')
2370
- return Object.keys(n.outputs);
2371
- if (n.kind === 'task')
2372
- return Object.keys(n.set);
2373
- return [];
2374
- }
2375
2312
  /** A sub-process body: the same graph methods, plus an internal node builder. */
2376
2313
  export class SubProcessBuilder extends ScopeBuilder {
2377
2314
  /**
@@ -16,8 +16,8 @@ import { resolveBpmnFile, loadBuiltBpmn } from './load.js';
16
16
  import { check } from './check.js';
17
17
  import { graphModel, renderGraph } from './graph.js';
18
18
  import { Bindings } from '../core/bindings.js';
19
- import { connectorCheckOpts, flagValue, openCliLibrary } from '../core/cli-library.js';
20
- import { runWhenInvokedDirectly } from '../cli-run.js';
19
+ import { connectorCheckOpts, openCliLibrary } from '../core/cli-library.js';
20
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
21
21
  import { ensureTypeScriptRuntime } from '../node-runtime.js';
22
22
  /** Flags that take a value — their argument is never the source positional. */
23
23
  const VALUE_FLAGS = new Set(['--library', '--connectors-local', '--bindings']);
@@ -15,7 +15,7 @@
15
15
  * implicit join — the diagnostic is a `warning`, and its comment says which
16
16
  * platform rule it corresponds to and how the two differ.
17
17
  */
18
- import { type BuiltBpmn } from './bpmn-sdk.js';
18
+ import type { BuiltBpmn } from './bpmn-sdk.js';
19
19
  import { type ConnectorCheckOpts } from '../core/connector-checks.js';
20
20
  import { type EventCheckOpts } from '../core/event-checks.js';
21
21
  export interface Diagnostic {
@@ -1,21 +1,4 @@
1
- /**
2
- * bpmn/check — fast static validation of a BuiltBpmn before serialization.
3
- *
4
- * Surfaces the common Maestro canvas-rule failures early (dangling flow refs,
5
- * duplicate ids, a gateway branch with no condition, a superfluous gateway, an
6
- * implicit join, a missing start event, a boundary event attached to nothing, an
7
- * empty timer) so authoring gets instant feedback. The authoritative gate is
8
- * still `uip maestro bpmn validate` (`validateBpmnCanvas`) on the emitted
9
- * `.bpmn`.
10
- *
11
- * **An `error` here must mirror a real platform rule.** Being stricter than
12
- * `validate` is worse than being looser: it refuses processes that deploy and run
13
- * correctly, and the author has no way to appeal. Where this file is deliberately
14
- * stricter than the platform — an unconditioned inclusive-gateway branch, an
15
- * implicit join — the diagnostic is a `warning`, and its comment says which
16
- * platform rule it corresponds to and how the two differ.
17
- */
18
- import { nodeDeclaredVars } from './bpmn-sdk.js';
1
+ import { nodeDeclaredVars } from './declared-vars.js';
19
2
  import { allNodes, folderCompanionKeys, implicitNodeVars, processId } from './serialize.js';
20
3
  import { KNOWN_METHOD_SET } from './known-methods.js';
21
4
  import { EQUALS_EXPR_DIALECT, checkConnectorContract, checkConnectorLookups, checkConnectorSchema, checkBindingLabels, } from '../core/connector-checks.js';
@@ -23,13 +23,9 @@ import { serialize } from './serialize.js';
23
23
  import { check } from './check.js';
24
24
  import { Bindings } from '../core/bindings.js';
25
25
  import { connectorCheckOpts, openCliLibrary } from '../core/cli-library.js';
26
- import { runWhenInvokedDirectly } from '../cli-run.js';
26
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
27
27
  import { ensureTypeScriptRuntime } from '../node-runtime.js';
28
28
  import { defaultBindingsFile } from '../workdir.js';
29
- function opt(argv, name) {
30
- const i = argv.indexOf(name);
31
- return i >= 0 ? argv[i + 1] : undefined;
32
- }
33
29
  export async function run(argv) {
34
30
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
35
31
  console.error('usage: compile <bpmn.ts | BaseName> [-o out.bpmn] [--library <dir>] [--connectors-local <dir>] [--bindings <file>]');
@@ -50,7 +46,7 @@ export async function run(argv) {
50
46
  // without it, so a prepare resolved an operation against the live connection,
51
47
  // wrote the overlay, and compile ignored it.
52
48
  const library = openCliLibrary(argv);
53
- const bindFile = opt(argv, '--bindings') ?? defaultBindingsFile();
49
+ const bindFile = flagValue(argv, '--bindings') ?? defaultBindingsFile();
54
50
  const bindings = new Bindings(bindFile);
55
51
  // The same facts `check-cli` runs on, from the instance about to serialize:
56
52
  // the inner loop and the emit rung must not disagree about a field or a
@@ -64,7 +60,7 @@ export async function run(argv) {
64
60
  }
65
61
  const xml = await serialize(built, { library, bindings });
66
62
  const base = basename(file).replace(/\.bpmn\.ts$|\.ts$/, '');
67
- const out = opt(argv, '-o') ?? `${base}.bpmn`;
63
+ const out = flagValue(argv, '-o') ?? `${base}.bpmn`;
68
64
  writeFileSync(out, xml);
69
65
  console.log(`compile: wrote ${out} (${built.nodes.length} element(s))`);
70
66
  reportResult({ path: resolve(out), elements: built.nodes.length });
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import type BpmnModdle from 'bpmn-moddle';
22
22
  import type { ModdleElement } from 'bpmn-moddle';
23
- import { type BpmnNode } from './bpmn-sdk.js';
23
+ import type { BpmnNode } from './bpmn-sdk.js';
24
24
  import type { Library } from '../core/library.js';
25
25
  import type { Bindings } from '../core/bindings.js';
26
26
  type El = ModdleElement;
@@ -1,7 +1,6 @@
1
- import { connectorOutputVars } from './bpmn-sdk.js';
2
- import { transportHttpMethod } from '../config.js';
1
+ import { connectorOutputVars } from './declared-vars.js';
3
2
  import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
4
- import { buildConnectorInputs, nestConnectorBody } from '../core/connector-inputs.js';
3
+ import { buildConnectorInputs, nestConnectorBody, transportHttpMethod } from '../core/connector-inputs.js';
5
4
  export function createConnectorTask(ctx, n) {
6
5
  const { m } = ctx;
7
6
  if (!ctx.library)
@@ -0,0 +1,60 @@
1
+ /**
2
+ * bpmn/declared-vars — which variables a BPMN node declares by writing to them.
3
+ *
4
+ * The builder, the expression check and the serializer all need the one answer.
5
+ * It lives outside `bpmn-sdk.ts` so the checker does not import the builder back
6
+ * (the runtime import cycle FB003 reported).
7
+ */
8
+ import type { BpmnNode } from './bpmn-sdk.js';
9
+ /**
10
+ * The variables a connector task's output rows land in.
11
+ *
12
+ * Per-node by default, because a `uipath:output`'s `var` IS the variable
13
+ * declaration as far as the platform is concerned (its canvas model maps every
14
+ * node output to a variable keyed by `var`). A shared name would therefore mean
15
+ * two connectors writing one variable, with the second silently clobbering the
16
+ * first — and it is the reason both the serializer and the expression check need
17
+ * the same answer, hence one function.
18
+ *
19
+ * @param n - The connector node.
20
+ * @returns The response and error variable names.
21
+ *
22
+ * @internal
23
+ */
24
+ export declare function connectorOutputVars(n: Extract<BpmnNode, {
25
+ kind: 'connector';
26
+ }>): {
27
+ response: string;
28
+ error: string;
29
+ };
30
+ /**
31
+ * The variables a typed node writes — the ONE definition of that set.
32
+ *
33
+ * It had grown three: this one (what an expression may read), `implicitNodeVars` in
34
+ * serialize (what gets declared in `uipath:variables`), and `derivedVariableIds` in
35
+ * decompile (what a decompiled file must NOT re-declare). All three must agree, and
36
+ * adding `outputRows` proved they do not stay agreed on their own: two were updated,
37
+ * this one was missed, and a human task's mapped output stopped being visible to the
38
+ * expression checker — `vars.decision` reported undeclared for a variable the node
39
+ * plainly writes. So serialize now calls this instead of repeating it, and only
40
+ * decompile's copy is separate, which its own comment already flags as load-bearing.
41
+ *
42
+ * @param n - The typed node.
43
+ * @returns The variable ids its output rows write.
44
+ * @internal
45
+ */
46
+ export declare function typedNodeDeclaredVars(n: Extract<BpmnNode, {
47
+ kind: 'typed';
48
+ }>): string[];
49
+ /**
50
+ * Every variable name a node DECLARES by writing to it — the platform counts a
51
+ * node's output `var` as a declaration, so a downstream `=vars.<name>` resolves
52
+ * against it without any `uipath:variables` entry. The expression check mirrors
53
+ * that, or it would reject reads the platform accepts.
54
+ *
55
+ * @param n - The node to inspect.
56
+ * @returns The variable names it declares, if any.
57
+ *
58
+ * @internal
59
+ */
60
+ export declare function nodeDeclaredVars(n: BpmnNode): string[];
@@ -0,0 +1,66 @@
1
+ import { typedNodeOutputVar } from './typed-node.js';
2
+ /**
3
+ * The variables a connector task's output rows land in.
4
+ *
5
+ * Per-node by default, because a `uipath:output`'s `var` IS the variable
6
+ * declaration as far as the platform is concerned (its canvas model maps every
7
+ * node output to a variable keyed by `var`). A shared name would therefore mean
8
+ * two connectors writing one variable, with the second silently clobbering the
9
+ * first — and it is the reason both the serializer and the expression check need
10
+ * the same answer, hence one function.
11
+ *
12
+ * @param n - The connector node.
13
+ * @returns The response and error variable names.
14
+ *
15
+ * @internal
16
+ */
17
+ export function connectorOutputVars(n) {
18
+ return { response: n.outputVar ?? `${n.id}_response`, error: `${n.id}_Error` };
19
+ }
20
+ /**
21
+ * The variables a typed node writes — the ONE definition of that set.
22
+ *
23
+ * It had grown three: this one (what an expression may read), `implicitNodeVars` in
24
+ * serialize (what gets declared in `uipath:variables`), and `derivedVariableIds` in
25
+ * decompile (what a decompiled file must NOT re-declare). All three must agree, and
26
+ * adding `outputRows` proved they do not stay agreed on their own: two were updated,
27
+ * this one was missed, and a human task's mapped output stopped being visible to the
28
+ * expression checker — `vars.decision` reported undeclared for a variable the node
29
+ * plainly writes. So serialize now calls this instead of repeating it, and only
30
+ * decompile's copy is separate, which its own comment already flags as load-bearing.
31
+ *
32
+ * @param n - The typed node.
33
+ * @returns The variable ids its output rows write.
34
+ * @internal
35
+ */
36
+ export function typedNodeDeclaredVars(n) {
37
+ // Spelled-out rows REPLACE the derived pair, so they are the whole answer.
38
+ if (n.outputRows)
39
+ return n.outputRows.map((r) => r.var).filter((v) => v !== undefined);
40
+ const v = typedNodeOutputVar(n.id, n.type, n.outputVar, n.spec);
41
+ return [...(v ? [v] : []), ...Object.keys(n.outputs ?? {})];
42
+ }
43
+ /**
44
+ * Every variable name a node DECLARES by writing to it — the platform counts a
45
+ * node's output `var` as a declaration, so a downstream `=vars.<name>` resolves
46
+ * against it without any `uipath:variables` entry. The expression check mirrors
47
+ * that, or it would reject reads the platform accepts.
48
+ *
49
+ * @param n - The node to inspect.
50
+ * @returns The variable names it declares, if any.
51
+ *
52
+ * @internal
53
+ */
54
+ export function nodeDeclaredVars(n) {
55
+ if (n.kind === 'connector') {
56
+ const { response, error } = connectorOutputVars(n);
57
+ return [response, error];
58
+ }
59
+ if (n.kind === 'typed')
60
+ return typedNodeDeclaredVars(n);
61
+ if (n.kind === 'scriptTask')
62
+ return Object.keys(n.outputs);
63
+ if (n.kind === 'task')
64
+ return Object.keys(n.set);
65
+ return [];
66
+ }
@@ -26,15 +26,11 @@ import { typeStripDecision } from '../node-runtime.js';
26
26
  import { readFileSync } from 'node:fs';
27
27
  import { basename, resolve } from 'node:path';
28
28
  import { defaultSourceOut, writeSource } from '../workdir.js';
29
- import { runWhenInvokedDirectly } from '../cli-run.js';
29
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
30
30
  import { decompile } from './decompile.js';
31
31
  import { sameGraph } from './lift-verify.js';
32
32
  import { BPMN_IMPORT } from '../package-name.js';
33
33
  import { fileURLToPath } from 'node:url';
34
- function opt(argv, name) {
35
- const i = argv.indexOf(name);
36
- return i >= 0 ? argv[i + 1] : undefined;
37
- }
38
34
  /**
39
35
  * `run(argv)` is the tool contract the family-first `flow-sdk` CLI loads. It must
40
36
  * NOT read `process.argv`: under the unified CLI that still holds
@@ -45,7 +41,7 @@ export async function run(argv) {
45
41
  console.error('usage: decompile <Name.bpmn> [-o Name.bpmn.ts] [--import <specifier>] [--style explicit|nested] [--keep-flow-ids] [--keep-unused-bindings]');
46
42
  return 2;
47
43
  }
48
- const style = opt(argv, '--style') ?? 'explicit';
44
+ const style = flagValue(argv, '--style') ?? 'explicit';
49
45
  if (style !== 'explicit' && style !== 'nested') {
50
46
  console.error(`decompile: --style must be explicit or nested, not "${style}"`);
51
47
  return 2;
@@ -76,7 +72,7 @@ export async function run(argv) {
76
72
  return 2;
77
73
  }
78
74
  const xml = readFileSync(input, 'utf8');
79
- const importSpecifier = opt(argv, '--import') ?? BPMN_IMPORT;
75
+ const importSpecifier = flagValue(argv, '--import') ?? BPMN_IMPORT;
80
76
  let pruned = [];
81
77
  const base0 = { importSpecifier, keepUnusedBindings, onPrune: (ids) => (pruned = ids) };
82
78
  let source = await decompile(xml, base0);
@@ -103,7 +99,7 @@ export async function run(argv) {
103
99
  }
104
100
  }
105
101
  const base = basename(input).replace(/\.bpmn$/, '');
106
- const out = opt(argv, '-o') ?? defaultSourceOut(`${base}.bpmn.ts`);
102
+ const out = flagValue(argv, '-o') ?? defaultSourceOut(`${base}.bpmn.ts`);
107
103
  writeSource(out, source);
108
104
  console.log(`decompile: wrote ${out}`);
109
105
  if (pruned.length) {
@@ -14,11 +14,7 @@ import { reportResult } from '../cli-result.js';
14
14
  import { readFileSync, writeFileSync } from 'node:fs';
15
15
  import { basename, resolve } from 'node:path';
16
16
  import { mergeBpmn } from './merge.js';
17
- import { runWhenInvokedDirectly } from '../cli-run.js';
18
- function opt(argv, name) {
19
- const i = argv.indexOf(name);
20
- return i >= 0 ? argv[i + 1] : undefined;
21
- }
17
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
22
18
  export function run(argv) {
23
19
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
24
20
  console.error('usage: bpmn-merge <original.bpmn> <edited.bpmn> [-o merged.bpmn] [--baseline <baseline.bpmn>]');
@@ -31,11 +27,11 @@ export function run(argv) {
31
27
  console.error('bpmn-merge: need <original.bpmn> and <edited.bpmn>');
32
28
  return 2;
33
29
  }
34
- const baselinePath = opt(argv, '--baseline');
30
+ const baselinePath = flagValue(argv, '--baseline');
35
31
  const result = mergeBpmn(readFileSync(originalPath, 'utf8'), readFileSync(editedPath, 'utf8'), {
36
32
  ...(baselinePath ? { baseline: readFileSync(baselinePath, 'utf8') } : {}),
37
33
  });
38
- const out = opt(argv, '-o') ?? 'merged.bpmn';
34
+ const out = flagValue(argv, '-o') ?? 'merged.bpmn';
39
35
  writeFileSync(out, result.xml);
40
36
  reportResult({ path: resolve(out), preserved: result.preserved.length, authored: result.authored.length, removed: result.removed.length });
41
37
  // Say what was kept and what was rewritten: on a surgical edit the preserved count
@@ -15,11 +15,10 @@
15
15
  */
16
16
  import BpmnModdle from 'bpmn-moddle';
17
17
  import { createRequire } from 'node:module';
18
- import { connectorOutputVars, } from './bpmn-sdk.js';
19
18
  import { createConnectorTask } from './connector.js';
20
19
  import { createConnectorEvent, createExternalTask, intsvcOutputVar } from './intsvc.js';
21
20
  import { createExtensionPayload, createTypedNode, rowDeclaration, typedNodeOutputVar, verbatimOutputRows } from './typed-node.js';
22
- import { typedNodeDeclaredVars } from './bpmn-sdk.js';
21
+ import { connectorOutputVars, typedNodeDeclaredVars } from './declared-vars.js';
23
22
  const require = createRequire(import.meta.url);
24
23
  const uipathDescriptor = require('./uipath-moddle.v1.json');
25
24
  const NS = {
@@ -15,11 +15,7 @@ import { reportResult } from '../cli-result.js';
15
15
  import { readFileSync, writeFileSync } from 'node:fs';
16
16
  import { layoutProcess } from 'bpmn-auto-layout';
17
17
  import { finalizeBpmnXml } from './serialize.js';
18
- import { runWhenInvokedDirectly } from '../cli-run.js';
19
- function opt(argv, name) {
20
- const i = argv.indexOf(name);
21
- return i >= 0 ? argv[i + 1] : undefined;
22
- }
18
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
23
19
  export async function run(argv) {
24
20
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
25
21
  console.error('usage: tidy <file.bpmn> [-o out.bpmn]');
@@ -32,7 +28,7 @@ export async function run(argv) {
32
28
  return 2;
33
29
  }
34
30
  const laidOut = finalizeBpmnXml(await layoutProcess(readFileSync(input, 'utf8')));
35
- const out = opt(argv, '-o') ?? input;
31
+ const out = flagValue(argv, '-o') ?? input;
36
32
  writeFileSync(out, laidOut.endsWith('\n') ? laidOut : laidOut + '\n');
37
33
  const shapes = (laidOut.match(/BPMNShape/g) ?? []).length;
38
34
  console.log(`tidy: laid out ${out} (${shapes} shape(s))`);
@@ -20,13 +20,9 @@ import { entryPointIO } from './entry-points.js';
20
20
  import { Bindings } from '../core/bindings.js';
21
21
  import { openCliLibrary } from '../core/cli-library.js';
22
22
  import { defaultBindingsFile } from '../workdir.js';
23
- import { runWhenInvokedDirectly } from '../cli-run.js';
23
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
24
24
  import { ensureTypeScriptRuntime } from '../node-runtime.js';
25
25
  import { CASE_FORMAT_PROFILE } from './format-profile.js';
26
- function opt(argv, name) {
27
- const i = argv.indexOf(name);
28
- return i >= 0 ? argv[i + 1] : undefined;
29
- }
30
26
  export async function run(argv) {
31
27
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
32
28
  console.error('usage: compile <case.ts | BaseName> [-o caseplan.json]');
@@ -57,10 +53,10 @@ export async function run(argv) {
57
53
  // also auto-detects the `connectors-local/` overlay `registry prepare` writes,
58
54
  // which is what the three copies of these lines used to each decide for itself.
59
55
  const library = openCliLibrary(argv);
60
- const bindFile = opt(argv, '--bindings') ?? defaultBindingsFile();
56
+ const bindFile = flagValue(argv, '--bindings') ?? defaultBindingsFile();
61
57
  const bindings = new Bindings(bindFile);
62
58
  const caseplan = serialize(built, { library, bindings });
63
- const out = opt(argv, '-o') ?? 'caseplan.json';
59
+ const out = flagValue(argv, '-o') ?? 'caseplan.json';
64
60
  writeFileSync(out, JSON.stringify(caseplan, null, 2) + '\n');
65
61
  const stages = caseplan.nodes.filter((n) => String(n.type).endsWith('Stage')).length;
66
62
  const triggers = syncEntryPoints(caseplan, out);
@@ -17,17 +17,13 @@
17
17
  */
18
18
  import { reportResult } from '../cli-result.js';
19
19
  import { mkdirSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
20
- import { resolveLibraryDir } from '../registry/cache.js';
20
+ import { resolveLibraryDir } from '../core/library-cache.js';
21
21
  import { basename, join, resolve } from 'node:path';
22
22
  import { defaultSourceOut, workDirBeside, writeSource } from '../workdir.js';
23
- import { runWhenInvokedDirectly } from '../cli-run.js';
23
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
24
24
  import { Library } from '../core/library.js';
25
25
  import { decompileWithDiagnostics } from './decompile.js';
26
26
  import { CASE_IMPORT } from '../package-name.js';
27
- function opt(argv, name) {
28
- const i = argv.indexOf(name);
29
- return i >= 0 ? argv[i + 1] : undefined;
30
- }
31
27
  /** Derive a PascalCase base name from the case name for the default output file. */
32
28
  function baseName(plan) {
33
29
  const src = plan.name ?? plan.id ?? 'Case';
@@ -56,16 +52,16 @@ export function run(argv) {
56
52
  return 2;
57
53
  }
58
54
  const plan = JSON.parse(readFileSync(pos, 'utf8'));
59
- const libraryDir = resolveLibraryDir(opt(argv, '--library'));
55
+ const libraryDir = resolveLibraryDir(flagValue(argv, '--library'));
60
56
  const library = libraryDir && existsSync(`${libraryDir}/index.json`) ? new Library(libraryDir) : undefined;
61
- const importSpecifier = opt(argv, '--import') ?? CASE_IMPORT;
57
+ const importSpecifier = flagValue(argv, '--import') ?? CASE_IMPORT;
62
58
  const bestEffort = argv.includes('--best-effort');
63
59
  const result = decompileWithDiagnostics(plan, {
64
60
  importSpecifier,
65
61
  library,
66
62
  bestEffort,
67
63
  });
68
- const out = opt(argv, '-o') ?? defaultSourceOut(`${baseName(plan)}.case.ts`);
64
+ const out = flagValue(argv, '-o') ?? defaultSourceOut(`${baseName(plan)}.case.ts`);
69
65
  writeSource(out, result.source);
70
66
  console.log(`decompile: wrote ${basename(out)}`);
71
67
  reportResult({ path: resolve(out), diagnostics: result.diagnostics.map((d) => ({ code: d.code, location: d.location, message: d.message })) });
@@ -13,11 +13,7 @@ import { reportResult } from '../cli-result.js';
13
13
  import { readFileSync, writeFileSync } from 'node:fs';
14
14
  import { basename, resolve } from 'node:path';
15
15
  import { mergeCase } from './merge.js';
16
- import { runWhenInvokedDirectly } from '../cli-run.js';
17
- function opt(argv, name) {
18
- const i = argv.indexOf(name);
19
- return i >= 0 ? argv[i + 1] : undefined;
20
- }
16
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
21
17
  export function run(argv) {
22
18
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
23
19
  console.error('usage: case-merge <original.json> <edited.json> [-o merged.json]');
@@ -35,7 +31,7 @@ export function run(argv) {
35
31
  const merged = mergeCase(original, edited, {
36
32
  warn: (message) => console.error(`case-merge: warning: ${message}`),
37
33
  });
38
- const out = opt(argv, '-o') ?? 'merged.caseplan.json';
34
+ const out = flagValue(argv, '-o') ?? 'merged.caseplan.json';
39
35
  writeFileSync(out, JSON.stringify(merged, null, 2) + '\n');
40
36
  const stages = (merged.nodes ?? [])
41
37
  .filter((node) => String(node.type ?? '').endsWith('Stage')).length;
@@ -9,7 +9,7 @@
9
9
  * name) are resolved here to the generated ids.
10
10
  */
11
11
  import { IdGen } from './ids.js';
12
- import { transportHttpMethod } from '../config.js';
12
+ import { transportHttpMethod } from '../core/connector-inputs.js';
13
13
  import { refuseLookupToken } from '../core/lookups.js';
14
14
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
15
15
  import { resolveSchemaVersion } from '../schema-version.js';