@uipath/maestro-builder-sdk 6.122.7 → 6.122.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-index.md +78 -77
- package/dist/api-members.md +357 -354
- package/dist/bpmn/bpmn-sdk.d.ts +48 -4
- package/dist/bpmn/bpmn-sdk.js +43 -5
- package/dist/bpmn/decompile.js +96 -2
- package/dist/bpmn/serialize.js +37 -2
- package/dist/bpmn/task-elements.d.ts +2 -0
- package/dist/bpmn/task-elements.js +4 -0
- package/dist/bpmn/typed-node.d.ts +2 -0
- package/dist/bpmn/typed-node.js +2 -1
- package/dist/bpmn-api.md +23 -7
- package/dist/check-cli.js +13 -3
- package/dist/check.d.ts +9 -0
- package/dist/check.js +18 -0
- package/dist/core/current-manifest-handles.d.ts +57 -0
- package/dist/core/current-manifest-handles.js +215 -0
- package/dist/core/node-catalog.d.ts +12 -0
- package/dist/core/node-catalog.js +35 -0
- package/dist/core/refusals.d.ts +2 -0
- package/dist/core/refusals.js +4 -0
- package/dist/node-catalog-files.d.ts +35 -1
- package/dist/node-catalog-files.js +77 -23
- package/package.json +2 -2
package/dist/bpmn-api.md
CHANGED
|
@@ -160,6 +160,8 @@ What every boundary handler on an ActivityBuilder accepts — `.onError()`, `.on
|
|
|
160
160
|
|
|
161
161
|
Options for `.startEvent()`.
|
|
162
162
|
|
|
163
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
164
|
+
|
|
163
165
|
- `StartOpts.name?: string` — Display name the designer shows on the event.
|
|
164
166
|
- `StartOpts.message?: MessageLike` — Start when this message arrives — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see…
|
|
165
167
|
- `StartOpts.error?: ErrorLike` — Catch an error — an INTERRUPTING error start event (`bpmn:errorEventDefinition`), declaring/reusing a definitions-level…
|
|
@@ -173,6 +175,8 @@ Options for `.startEvent()`.
|
|
|
173
175
|
|
|
174
176
|
Options for `.endEvent()`.
|
|
175
177
|
|
|
178
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
179
|
+
|
|
176
180
|
- `EndOpts.name?: string` — Display name the designer shows on the event.
|
|
177
181
|
- `EndOpts.terminate?: boolean` — End as a TERMINATE event — abort the whole process instance, not just this path.
|
|
178
182
|
- `EndOpts.message?: MessageLike` — End by throwing this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see…
|
|
@@ -399,6 +403,7 @@ Extends `ActivityOpts` — its fields and methods apply here too.
|
|
|
399
403
|
- `ActivityNodeOpts.inputs?: Record<string, unknown>` — The payload, shaped by the type's `inputPattern`.
|
|
400
404
|
- `ActivityNodeOpts.inputRows?: TypedInputRow[]` — The payload rows spelled out, replacing `inputs` — see TypedInputRow.
|
|
401
405
|
- `ActivityNodeOpts.spec?: RegistryTypeSpec` — The type's emission spec, supplied inline — the escape hatch for a registry type the committed snapshot does not carry…
|
|
406
|
+
- `ActivityNodeOpts.element?: PlainTaskElement` — The task element to write instead of the registry's, spelled as the XML is (`bpmn:serviceTask`).
|
|
402
407
|
- `ActivityNodeOpts.outputVar?: string` — Variable the type's own output lands in.
|
|
403
408
|
- `ActivityNodeOpts.outputs?: Record<string, string>` — Extra output rows: variable id → `=`-expression against the node's result.
|
|
404
409
|
- `ActivityNodeOpts.outputRows?: TypedOutputRow[]` — The output rows spelled out, replacing `outputVar` and `outputs`.
|
|
@@ -471,10 +476,19 @@ Options for `.var()` / `.input()` / `.output()`.
|
|
|
471
476
|
- `VarOpts.internal?: boolean` — The product's `internal="true"` flag: the platform owns this declaration, not the author — `internalCustomInstanceId`…
|
|
472
477
|
- `VarOpts.subType?: string` — A refinement of `type` the designer carries, e.g. `subType="object"` on a `jsonSchema` variable that holds an object…
|
|
473
478
|
|
|
479
|
+
### `VariableUpdatesOpts`
|
|
480
|
+
|
|
481
|
+
Variable updates on a node: the product's trailing `uipath:mapping` (`BPMN.Variables`, every row `custom="true"`) that…
|
|
482
|
+
|
|
483
|
+
- `VariableUpdatesOpts.updates?: Record<string, string>` — variable id -> the `=`-expression assigned to it after the node runs.
|
|
484
|
+
- `VariableUpdatesOpts.updateRows?: TypedOutputRow[]` — The update rows spelled out, in document order: what an import writes, so each row's own `type` and attributes survive.
|
|
485
|
+
|
|
474
486
|
### `ActivityOpts`
|
|
475
487
|
|
|
476
488
|
What every ACTIVITY accepts, on top of its own options — a script task, a variable task, a connector task, a…
|
|
477
489
|
|
|
490
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
491
|
+
|
|
478
492
|
- `ActivityOpts.tags?: Record<string, string>` — `uipath:tags` on the activity — key/value pairs the designer carries alongside the node, as a SIBLING of its payload.
|
|
479
493
|
- `ActivityOpts.retry?: RetrySpec` — Retry the activity when it fails — see RetrySpec.
|
|
480
494
|
- `ActivityOpts.loop?: LoopSpec` — Run it once per item of a collection — see LoopSpec.
|
|
@@ -611,7 +625,7 @@ The built in-memory process graph `.build()` returns — the IR `serialize()` wa
|
|
|
611
625
|
|
|
612
626
|
One node in the built graph — a discriminated union with one arm per BPMN element kind, which the serializer walks into…
|
|
613
627
|
|
|
614
|
-
- `type BpmnNode` —
|
|
628
|
+
- `type BpmnNode` — 2799 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
|
|
615
629
|
|
|
616
630
|
### `BpmnFlow`
|
|
617
631
|
|
|
@@ -878,6 +892,8 @@ The five gateway element kinds a BpmnNode can be.
|
|
|
878
892
|
|
|
879
893
|
The fields every activity arm of BpmnNode carries — the built form of ActivityOpts.
|
|
880
894
|
|
|
895
|
+
Extends `VariableUpdatesOpts` — its fields and methods apply here too.
|
|
896
|
+
|
|
881
897
|
- `ActivityNodeFields.tags?: Record<string, string>` — `uipath:tags` on the node — see ActivityOpts.tags.
|
|
882
898
|
- `ActivityNodeFields.retry?: RetrySpec` — Retry policy (`uipath:retry`).
|
|
883
899
|
- `ActivityNodeFields.loop?: LoopSpec` — Multi-instance loop (`bpmn:multiInstanceLoopCharacteristics` + `uipath:loopCharacteristics`).
|
|
@@ -952,6 +968,12 @@ One extension type's emission spec.
|
|
|
952
968
|
- `RegistryTypeSpec.bindingPattern: string`
|
|
953
969
|
- `RegistryTypeSpec.placements?: Record<string, { element: string | null; eventDefinition: string | null }>` — The registry's `Placements`: where the canvas offers the type, by placement name (`Activity`, `StartEvent`,…
|
|
954
970
|
|
|
971
|
+
### `PlainTaskElement`
|
|
972
|
+
|
|
973
|
+
The BPMN activity elements the builder can write with NO `uipath:*` payload.
|
|
974
|
+
|
|
975
|
+
- `type PlainTaskElement` — 181 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
|
|
976
|
+
|
|
955
977
|
### `EventFilter`
|
|
956
978
|
|
|
957
979
|
One filter condition on the event payload.
|
|
@@ -960,12 +982,6 @@ Also takes every field of `({ contains: string; } | { startsWith: string; } | {
|
|
|
960
982
|
|
|
961
983
|
- `EventFilter.field: string`
|
|
962
984
|
|
|
963
|
-
### `PlainTaskElement`
|
|
964
|
-
|
|
965
|
-
The BPMN activity elements the builder can write with NO `uipath:*` payload.
|
|
966
|
-
|
|
967
|
-
- `type PlainTaskElement` — 181 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
|
|
968
|
-
|
|
969
985
|
### `VarDirection`
|
|
970
986
|
|
|
971
987
|
How a variable is exposed: `'input'` (read-only entry input), `'output'` (a return value), or `'inputOutput'` (a mutable…
|
package/dist/check-cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import { readCliResources } from './registry/prepare/resources.js';
|
|
|
22
22
|
import { resolveFlowFile, loadBuiltFlow } from './load.js';
|
|
23
23
|
import { check, checkCompiled, scopeToEdit } from './check.js';
|
|
24
24
|
import { flowCheckOpts } from './cli-library.js';
|
|
25
|
-
import { readNodeCatalog } from './node-catalog-files.js';
|
|
25
|
+
import { currentNodeCatalog, NODE_CACHE_SCOPE_ENV, readNodeCatalog } from './node-catalog-files.js';
|
|
26
26
|
import { withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
27
27
|
import { Bindings } from './bindings.js';
|
|
28
28
|
import { flagValue, flagValues, runWhenInvokedDirectly } from './cli-run.js';
|
|
@@ -57,8 +57,18 @@ function checkOpts(argv, library, solution) {
|
|
|
57
57
|
// as still owed — telling the author to re-run a `prepare` they already ran.
|
|
58
58
|
// The resource ledger `prepare` writes, the default found as bindings.json is.
|
|
59
59
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
60
|
-
// The node registry cache a manifest-less `rawNode` resolves from (#1981), read on first use
|
|
61
|
-
|
|
60
|
+
// The node registry cache a manifest-less `rawNode` resolves from (#1981), read on first use;
|
|
61
|
+
// and, only when `uip` names the tenant the cache belongs to, the current manifests
|
|
62
|
+
// HANDLE_NOT_IN_CURRENT_MANIFEST checks edges against.
|
|
63
|
+
const current = currentNodeCatalog(process.env[NODE_CACHE_SCOPE_ENV]);
|
|
64
|
+
// Say when the tenant handle check did not run, so a clean result is not read as a pass on it.
|
|
65
|
+
if ('skipped' in current)
|
|
66
|
+
console.error(`check: HANDLE_NOT_IN_CURRENT_MANIFEST did not run: ${current.skipped}.`);
|
|
67
|
+
const tenantCatalog = 'catalog' in current ? current.catalog : undefined;
|
|
68
|
+
return {
|
|
69
|
+
...flowCheckOpts(library, bindings), ...(resources ? { resources } : {}), nodeCatalog: readNodeCatalog(),
|
|
70
|
+
...(tenantCatalog ? { currentNodeCatalog: tenantCatalog } : {}), ...(solution ? { solution } : {}), scriptTypes: true,
|
|
71
|
+
};
|
|
62
72
|
}
|
|
63
73
|
export async function run(argv) {
|
|
64
74
|
const arg = argv.find((a, i) => !a.startsWith('--') && !VALUE_FLAGS.has(argv[i - 1])) ?? argv[0];
|
package/dist/check.d.ts
CHANGED
|
@@ -94,6 +94,15 @@ export interface CheckOpts extends ConnectorCheckOpts, EventCheckOpts {
|
|
|
94
94
|
* a step is `RAW_NODE_MANIFEST_NOT_CACHED`, as `compile` would say.
|
|
95
95
|
*/
|
|
96
96
|
nodeCatalog?: NodeCatalog;
|
|
97
|
+
/**
|
|
98
|
+
* The node catalog verified to be the current tenant's manifests, which
|
|
99
|
+
* HANDLE_NOT_IN_CURRENT_MANIFEST judges edges against. Separate from
|
|
100
|
+
* `nodeCatalog`: a cache from another tenant still resolves a `rawNode`'s
|
|
101
|
+
* manifest, but must not reject a valid edge. The CLI passes one only when
|
|
102
|
+
* `uip` names the logged-in tenant and the cache provably belongs to it
|
|
103
|
+
* (`readCurrentNodeCatalog`). Without one the rule is silent.
|
|
104
|
+
*/
|
|
105
|
+
currentNodeCatalog?: NodeCatalog;
|
|
97
106
|
/** `false` skips the serializer pass, for a caller that compiles the flow itself (`merge`). */
|
|
98
107
|
serializer?: false;
|
|
99
108
|
/**
|
package/dist/check.js
CHANGED
|
@@ -33,6 +33,7 @@ import { refusalClass } from './core/refusals.js';
|
|
|
33
33
|
import { classifyDrafts, placeDiagnostics } from './edit-scope.js';
|
|
34
34
|
import { preExistingFindings, scopeFindings } from './core/baseline-scope.js';
|
|
35
35
|
import { lookupConnectionIndex } from './core/lookup-connection.js';
|
|
36
|
+
import { staleHandles } from './core/current-manifest-handles.js';
|
|
36
37
|
export function check(built, opts = {}) {
|
|
37
38
|
return checkCompiled(built, opts).diagnostics;
|
|
38
39
|
}
|
|
@@ -65,6 +66,7 @@ export function checkCompiled(built, opts = {}) {
|
|
|
65
66
|
diags.push(...serialized.diagnostics);
|
|
66
67
|
if (serialized.flow !== undefined)
|
|
67
68
|
diags.push(...mergeNeverCompletes(serialized.flow, serialized.scopes ?? []));
|
|
69
|
+
diags.push(...staleHandleDiagnostics(serialized.flow, opts.currentNodeCatalog));
|
|
68
70
|
const placed = serialized.flow !== undefined ? placeDiagnostics(diags, serialized.flow) : undefined;
|
|
69
71
|
const diagnostics = diags.map((d, i) => {
|
|
70
72
|
const nodeId = d.nodeId ?? (placed?.[i].nodeId || undefined);
|
|
@@ -73,6 +75,22 @@ export function checkCompiled(built, opts = {}) {
|
|
|
73
75
|
});
|
|
74
76
|
return { diagnostics, flow: serialized.flow, ...(serialized.stoppedAt ? { stoppedAt: serialized.stoppedAt } : {}) };
|
|
75
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* HANDLE_NOT_IN_CURRENT_MANIFEST: an edge of the compiled flow on a handle the
|
|
80
|
+
* current tenant's manifest for its node does not declare
|
|
81
|
+
* (`core/current-manifest-handles.ts`). Silent without a verified catalog.
|
|
82
|
+
*/
|
|
83
|
+
function staleHandleDiagnostics(compiled, catalog) {
|
|
84
|
+
return staleHandles(compiled, catalog).map((s) => ({
|
|
85
|
+
level: 'error', code: 'HANDLE_NOT_IN_CURRENT_MANIFEST', nodeId: s.nodeId,
|
|
86
|
+
message: `Edge "${s.edgeId}"${s.subflow !== undefined ? ` in subflow "${s.subflow}"` : ''} uses ${s.side} handle "${s.port}" on node "${s.nodeId}", `
|
|
87
|
+
+ `but the tenant's current manifest for ${s.nodeType}@${s.version} (${catalog?.source ?? 'the node registry cache'}) does not declare it. `
|
|
88
|
+
+ `The SDK's bundled definition still has it, so the .flow is consistent with itself, but Studio Web renders the node from the tenant's manifest `
|
|
89
|
+
+ `and draws this edge as missing; \`uip maestro flow validate\` fails it. Declared ${s.side} handles: ${s.available}.`,
|
|
90
|
+
suggestion: `Remove what wires the "${s.port}" handle, or author against a version the tenant serves with it `
|
|
91
|
+
+ `(\`uip maestro flow registry get ${s.nodeType}\`). If the cache is old, refresh it with \`uip maestro flow registry pull --force\`.`,
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
76
94
|
/**
|
|
77
95
|
* The canvas's script type complaints on the script bodies of one flow level (the code
|
|
78
96
|
* sites its node types declare), one warning each (`script-type-check.ts`).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edges on a handle the current tenant's manifest does not declare
|
|
3
|
+
* (`HANDLE_NOT_IN_CURRENT_MANIFEST`). A `.flow` embeds each node's definition
|
|
4
|
+
* when it is compiled, but Studio Web renders the node from the tenant's
|
|
5
|
+
* manifest, which can declare different handles at the same version; an edge
|
|
6
|
+
* on a handle it lacks is drawn as missing. `uip maestro flow validate` runs
|
|
7
|
+
* the same rule (`validateEdgeHandlesAgainstCurrentManifests`), so this
|
|
8
|
+
* matches it:
|
|
9
|
+
*
|
|
10
|
+
* - Only nodes whose `typeVersion` the catalog holds are checked, comparing
|
|
11
|
+
* versions with trailing `.0`s dropped (`1.0.0` is `1.0`).
|
|
12
|
+
* - A side is enforced only when the manifest declares a handle on it.
|
|
13
|
+
* - `repeat` handles expand over the node's inputs; one that cannot expand
|
|
14
|
+
* matches as a pattern.
|
|
15
|
+
* - `supportsErrorHandling: true` adds the implicit `error` source port.
|
|
16
|
+
* - `handleCustomization` replaces source handles group by group, by position.
|
|
17
|
+
*
|
|
18
|
+
* Pure (FB015): the catalog is passed in, and without one nothing is checked.
|
|
19
|
+
*/
|
|
20
|
+
import type { NodeCatalog } from './node-catalog.js';
|
|
21
|
+
/** One edge on a handle the current manifest does not declare. */
|
|
22
|
+
export interface StaleHandle {
|
|
23
|
+
edgeId: string;
|
|
24
|
+
/** The node whose manifest lacks the handle (the edge's source or target node). */
|
|
25
|
+
nodeId: string;
|
|
26
|
+
nodeType: string;
|
|
27
|
+
version: string;
|
|
28
|
+
side: 'source' | 'target';
|
|
29
|
+
port: string;
|
|
30
|
+
/** The handles the manifest does declare on that side, as `a, b, case-{item.id}`. */
|
|
31
|
+
available: string;
|
|
32
|
+
/** Which subflow the edge is in; absent for the root graph. */
|
|
33
|
+
subflow?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Every edge of `flow` (root graph and each subflow) on a handle the catalog's
|
|
37
|
+
* manifest for its node does not declare. Empty without a catalog.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* staleHandles(compiled, catalog)
|
|
41
|
+
* // → [{ edgeId: 'ask-memory', nodeId: 'ask', nodeType: 'uipath.agent.autonomous', version: '1.4',
|
|
42
|
+
* // side: 'source', port: 'memory', available: 'success, error, tool, context, escalation' }]
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function staleHandles(flow: unknown, catalog: NodeCatalog | undefined): StaleHandle[];
|
|
46
|
+
/** `1.0.0` → `1.0`, `1.4` → `1.4`: trailing `.0`s past the minor dropped, as validate compares versions. */
|
|
47
|
+
export declare function normalizeNodeVersion(version: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* `port` against a templated id: each `{…}` stands for one or more characters
|
|
50
|
+
* other than a line break, and the rest matches literally.
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* portMatchesTemplate('case-q1', 'case-{item.id}'); // → true
|
|
54
|
+
* portMatchesTemplate('case-', 'case-{item.id}'); // → false
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function portMatchesTemplate(port: string, template: string): boolean;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { isRecord } from './node-envelope.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every edge of `flow` (root graph and each subflow) on a handle the catalog's
|
|
4
|
+
* manifest for its node does not declare. Empty without a catalog.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* staleHandles(compiled, catalog)
|
|
8
|
+
* // → [{ edgeId: 'ask-memory', nodeId: 'ask', nodeType: 'uipath.agent.autonomous', version: '1.4',
|
|
9
|
+
* // side: 'source', port: 'memory', available: 'success, error, tool, context, escalation' }]
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export function staleHandles(flow, catalog) {
|
|
13
|
+
if (catalog === undefined || !isRecord(flow))
|
|
14
|
+
return [];
|
|
15
|
+
const out = [];
|
|
16
|
+
const graphs = [[undefined, asGraph(flow)]];
|
|
17
|
+
if (isRecord(flow.subflows)) {
|
|
18
|
+
for (const [id, sub] of Object.entries(flow.subflows))
|
|
19
|
+
graphs.push([id, asGraph(sub)]);
|
|
20
|
+
}
|
|
21
|
+
for (const [subflow, graph] of graphs)
|
|
22
|
+
out.push(...graphStaleHandles(graph, catalog, subflow));
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function asGraph(v) {
|
|
26
|
+
const g = isRecord(v) ? v : {};
|
|
27
|
+
return { nodes: Array.isArray(g.nodes) ? g.nodes : [], edges: Array.isArray(g.edges) ? g.edges : [] };
|
|
28
|
+
}
|
|
29
|
+
function graphStaleHandles(graph, catalog, subflow) {
|
|
30
|
+
const nodes = new Map();
|
|
31
|
+
for (const node of graph.nodes) {
|
|
32
|
+
if (!isRecord(node) || typeof node.id !== 'string' || typeof node.type !== 'string')
|
|
33
|
+
continue;
|
|
34
|
+
const version = typeof node.typeVersion === 'string' ? node.typeVersion : '1.0.0';
|
|
35
|
+
const manifest = currentManifest(catalog, node.type, version);
|
|
36
|
+
if (manifest === undefined)
|
|
37
|
+
continue;
|
|
38
|
+
nodes.set(node.id, { type: node.type, version, handles: manifestHandles(manifest, node) });
|
|
39
|
+
}
|
|
40
|
+
const out = [];
|
|
41
|
+
for (const edge of graph.edges) {
|
|
42
|
+
if (!isRecord(edge) || typeof edge.id !== 'string')
|
|
43
|
+
continue;
|
|
44
|
+
for (const side of ['source', 'target']) {
|
|
45
|
+
const nodeId = edge[`${side}NodeId`];
|
|
46
|
+
const port = edge[`${side}Port`];
|
|
47
|
+
if (typeof nodeId !== 'string' || typeof port !== 'string')
|
|
48
|
+
continue;
|
|
49
|
+
const node = nodes.get(nodeId);
|
|
50
|
+
if (node === undefined || !enforced(node.handles, side) || declares(node.handles, side, port))
|
|
51
|
+
continue;
|
|
52
|
+
out.push({
|
|
53
|
+
edgeId: edge.id, nodeId, nodeType: node.type, version: node.version, side, port,
|
|
54
|
+
available: availableHandles(node.handles, side),
|
|
55
|
+
...(subflow !== undefined ? { subflow } : {}),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/** `1.0.0` → `1.0`, `1.4` → `1.4`: trailing `.0`s past the minor dropped, as validate compares versions. */
|
|
62
|
+
export function normalizeNodeVersion(version) {
|
|
63
|
+
const parts = version.split('.');
|
|
64
|
+
if (!parts.every((p) => /^\d+$/.test(p)))
|
|
65
|
+
return version;
|
|
66
|
+
while (parts.length > 2 && parts[parts.length - 1] === '0')
|
|
67
|
+
parts.pop();
|
|
68
|
+
return parts.join('.');
|
|
69
|
+
}
|
|
70
|
+
/** The catalog's manifest for `nodeType` at `version`, matching versions as {@link normalizeNodeVersion} does. */
|
|
71
|
+
function currentManifest(catalog, nodeType, version) {
|
|
72
|
+
const want = normalizeNodeVersion(version);
|
|
73
|
+
const held = catalog.versions(nodeType).find((v) => normalizeNodeVersion(v) === want);
|
|
74
|
+
const manifest = held !== undefined ? catalog.definition(nodeType, held) : undefined;
|
|
75
|
+
return isRecord(manifest) ? manifest : undefined;
|
|
76
|
+
}
|
|
77
|
+
function manifestHandles(manifest, node) {
|
|
78
|
+
const h = { source: new Map(), target: new Map(), sourceTemplates: [], targetTemplates: [], sourceDeclared: false };
|
|
79
|
+
const groups = Array.isArray(manifest.handleConfiguration) ? manifest.handleConfiguration : [];
|
|
80
|
+
for (const group of groups) {
|
|
81
|
+
if (!isRecord(group) || !Array.isArray(group.handles))
|
|
82
|
+
continue;
|
|
83
|
+
const position = typeof group.position === 'string' ? group.position : undefined;
|
|
84
|
+
for (const handle of group.handles) {
|
|
85
|
+
if (!isRecord(handle) || typeof handle.id !== 'string')
|
|
86
|
+
continue;
|
|
87
|
+
if (handle.type !== 'source' && handle.type !== 'target')
|
|
88
|
+
continue;
|
|
89
|
+
for (const id of expandHandleIds(handle.id, handle.repeat, node)) {
|
|
90
|
+
if (id.includes('{'))
|
|
91
|
+
(handle.type === 'source' ? h.sourceTemplates : h.targetTemplates).push({ id, position });
|
|
92
|
+
else
|
|
93
|
+
(handle.type === 'source' ? h.source : h.target).set(id, position);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// As validate counts it: a handle from a positioned group, or any template.
|
|
98
|
+
h.sourceDeclared = [...h.source.values()].some((p) => p !== undefined) || h.sourceTemplates.length > 0;
|
|
99
|
+
if (manifest.supportsErrorHandling === true && !h.source.has('error'))
|
|
100
|
+
h.source.set('error', undefined);
|
|
101
|
+
if (h.sourceDeclared)
|
|
102
|
+
applyHandleCustomization(h, node);
|
|
103
|
+
return h;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* `id` once per item of the array at `repeat` (a path from the node, such as
|
|
107
|
+
* `inputs.cases`), each `{item.<key>}` replaced by the item's value. The bare
|
|
108
|
+
* template when `repeat` does not name an array (an expression): it then
|
|
109
|
+
* matches as a pattern ({@link portMatchesTemplate}).
|
|
110
|
+
*/
|
|
111
|
+
function expandHandleIds(id, repeat, node) {
|
|
112
|
+
if (typeof repeat !== 'string' || repeat === '')
|
|
113
|
+
return [id];
|
|
114
|
+
let items = node;
|
|
115
|
+
for (const seg of repeat.split('.'))
|
|
116
|
+
items = isRecord(items) ? items[seg] : undefined;
|
|
117
|
+
if (!Array.isArray(items))
|
|
118
|
+
return [id];
|
|
119
|
+
return items.filter(isRecord).map((item) => id.replace(/\{item\.(\w+)\}/g, (_m, key) => String(item[key] ?? '')));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The node's `handleCustomization` (`{ groups: [{ position, handles }] }`)
|
|
123
|
+
* replaces the manifest's source handles in each group it names by position;
|
|
124
|
+
* groups at other positions, and ports with no position (`error`), stay. A
|
|
125
|
+
* customization with no source handle replaces nothing.
|
|
126
|
+
*/
|
|
127
|
+
function applyHandleCustomization(h, node) {
|
|
128
|
+
const custom = node.handleCustomization;
|
|
129
|
+
if (!isRecord(custom) || !Array.isArray(custom.groups))
|
|
130
|
+
return;
|
|
131
|
+
const positions = new Set();
|
|
132
|
+
const ids = [];
|
|
133
|
+
for (const group of custom.groups) {
|
|
134
|
+
if (!isRecord(group))
|
|
135
|
+
continue;
|
|
136
|
+
if (typeof group.position === 'string')
|
|
137
|
+
positions.add(group.position);
|
|
138
|
+
for (const handle of Array.isArray(group.handles) ? group.handles : []) {
|
|
139
|
+
if (isRecord(handle) && handle.type === 'source' && typeof handle.id === 'string')
|
|
140
|
+
ids.push(handle.id);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (ids.length === 0)
|
|
144
|
+
return;
|
|
145
|
+
const replaced = (position) => position !== undefined && positions.has(position);
|
|
146
|
+
for (const [id, position] of [...h.source])
|
|
147
|
+
if (replaced(position))
|
|
148
|
+
h.source.delete(id);
|
|
149
|
+
h.sourceTemplates = h.sourceTemplates.filter((t) => !replaced(t.position));
|
|
150
|
+
for (const id of ids)
|
|
151
|
+
h.source.set(id, undefined);
|
|
152
|
+
}
|
|
153
|
+
function enforced(h, side) {
|
|
154
|
+
return side === 'source' ? h.sourceDeclared : h.target.size + h.targetTemplates.length > 0;
|
|
155
|
+
}
|
|
156
|
+
function declares(h, side, port) {
|
|
157
|
+
if ((side === 'source' ? h.source : h.target).has(port))
|
|
158
|
+
return true;
|
|
159
|
+
return (side === 'source' ? h.sourceTemplates : h.targetTemplates).some((t) => portMatchesTemplate(port, t.id));
|
|
160
|
+
}
|
|
161
|
+
function availableHandles(h, side) {
|
|
162
|
+
const ids = [...(side === 'source' ? h.source : h.target).keys(), ...(side === 'source' ? h.sourceTemplates : h.targetTemplates).map((t) => t.id)];
|
|
163
|
+
return ids.length > 0 ? ids.join(', ') : '(none)';
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* `port` against a templated id: each `{…}` stands for one or more characters
|
|
167
|
+
* other than a line break, and the rest matches literally.
|
|
168
|
+
*
|
|
169
|
+
* ```ts
|
|
170
|
+
* portMatchesTemplate('case-q1', 'case-{item.id}'); // → true
|
|
171
|
+
* portMatchesTemplate('case-', 'case-{item.id}'); // → false
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export function portMatchesTemplate(port, template) {
|
|
175
|
+
if (!template.includes('{'))
|
|
176
|
+
return port === template;
|
|
177
|
+
const parts = templateLiterals(template);
|
|
178
|
+
const first = parts[0];
|
|
179
|
+
const last = parts[parts.length - 1];
|
|
180
|
+
if (parts.length === 1)
|
|
181
|
+
return port === first;
|
|
182
|
+
if (!port.startsWith(first) || !port.endsWith(last))
|
|
183
|
+
return false;
|
|
184
|
+
// Each literal at its leftmost fit leaves the most room for the rest, so one
|
|
185
|
+
// forward pass decides the match (linear in the port; no regex backtracking).
|
|
186
|
+
const lastStart = port.length - last.length;
|
|
187
|
+
let gapStart = first.length;
|
|
188
|
+
for (const lit of parts.slice(1, -1)) {
|
|
189
|
+
const at = port.indexOf(lit, gapStart + 1);
|
|
190
|
+
if (at === -1 || hasLineBreak(port, gapStart, at))
|
|
191
|
+
return false;
|
|
192
|
+
gapStart = at + lit.length;
|
|
193
|
+
}
|
|
194
|
+
return gapStart < lastStart && !hasLineBreak(port, gapStart, lastStart);
|
|
195
|
+
}
|
|
196
|
+
/** The literal segments between a template's `{…}` placeholders; an unclosed `{` is literal. */
|
|
197
|
+
function templateLiterals(template) {
|
|
198
|
+
const parts = [];
|
|
199
|
+
let start = 0;
|
|
200
|
+
for (let open = template.indexOf('{'); open !== -1; open = template.indexOf('{', start)) {
|
|
201
|
+
const close = template.indexOf('}', open + 1);
|
|
202
|
+
if (close === -1)
|
|
203
|
+
break;
|
|
204
|
+
parts.push(template.slice(start, open));
|
|
205
|
+
start = close + 1;
|
|
206
|
+
}
|
|
207
|
+
parts.push(template.slice(start));
|
|
208
|
+
return parts;
|
|
209
|
+
}
|
|
210
|
+
function hasLineBreak(s, from, to) {
|
|
211
|
+
for (let i = from; i < to; i++)
|
|
212
|
+
if ('\n\r\u2028\u2029'.includes(s[i]))
|
|
213
|
+
return true;
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
@@ -17,6 +17,18 @@ export interface NodeCatalog {
|
|
|
17
17
|
/** Where the catalog was read from, for messages (`~/.uipath/nodes/index.json`). */
|
|
18
18
|
readonly source?: string;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A catalog over `nodes`, the manifests `registry pull` caches: one array, each
|
|
22
|
+
* as `registry get` prints it. `nodes` may be a function, called on the first
|
|
23
|
+
* lookup, so a caller that never looks a node up never reads the cache. A few
|
|
24
|
+
* connector types are listed twice at one version; the first one listed wins.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* const catalog = nodeCatalogOf([{ nodeType: 'core.logic.decision', version: '1.4', handleConfiguration: [] }]);
|
|
28
|
+
* catalog.versions('core.logic.decision'); // → ['1.4']
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function nodeCatalogOf(nodes: readonly unknown[] | (() => readonly unknown[]), source?: string): NodeCatalog;
|
|
20
32
|
/** What a `rawNode` with no `manifest` resolves to: the manifest, or why there is none. */
|
|
21
33
|
export type CatalogLookup = {
|
|
22
34
|
manifest: unknown;
|
|
@@ -8,6 +8,41 @@
|
|
|
8
8
|
* `node:` builtin (FB015), so the CLI loads it (`node-catalog-files.ts`) and
|
|
9
9
|
* passes it in as `SerializeOpts.nodeCatalog` / `CheckOpts.nodeCatalog`.
|
|
10
10
|
*/
|
|
11
|
+
import { isRecord } from './node-envelope.js';
|
|
12
|
+
/**
|
|
13
|
+
* A catalog over `nodes`, the manifests `registry pull` caches: one array, each
|
|
14
|
+
* as `registry get` prints it. `nodes` may be a function, called on the first
|
|
15
|
+
* lookup, so a caller that never looks a node up never reads the cache. A few
|
|
16
|
+
* connector types are listed twice at one version; the first one listed wins.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const catalog = nodeCatalogOf([{ nodeType: 'core.logic.decision', version: '1.4', handleConfiguration: [] }]);
|
|
20
|
+
* catalog.versions('core.logic.decision'); // → ['1.4']
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function nodeCatalogOf(nodes, source) {
|
|
24
|
+
let byType;
|
|
25
|
+
const index = () => {
|
|
26
|
+
if (byType !== undefined)
|
|
27
|
+
return byType;
|
|
28
|
+
byType = new Map();
|
|
29
|
+
for (const node of typeof nodes === 'function' ? nodes() : nodes) {
|
|
30
|
+
if (!isRecord(node) || typeof node.nodeType !== 'string' || typeof node.version !== 'string')
|
|
31
|
+
continue;
|
|
32
|
+
let versions = byType.get(node.nodeType);
|
|
33
|
+
if (versions === undefined)
|
|
34
|
+
byType.set(node.nodeType, versions = new Map());
|
|
35
|
+
if (!versions.has(node.version))
|
|
36
|
+
versions.set(node.version, node);
|
|
37
|
+
}
|
|
38
|
+
return byType;
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
...(source !== undefined ? { source } : {}),
|
|
42
|
+
definition: (nodeType, version) => index().get(nodeType)?.get(version),
|
|
43
|
+
versions: (nodeType) => [...(index().get(nodeType)?.keys() ?? [])],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
11
46
|
/**
|
|
12
47
|
* Look `nodeType@version` up in `catalog`, wording the miss so the author
|
|
13
48
|
* knows the command that fills the cache (`uip maestro flow registry pull`)
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export declare const REFUSALS: {
|
|
|
66
66
|
readonly BINDING_UNDECLARED: "draft";
|
|
67
67
|
readonly BOUNDARY_NOT_ACTIVITY: "lint";
|
|
68
68
|
readonly BOUNDARY_UNATTACHED: "lowering";
|
|
69
|
+
readonly BPMN_ACTIVITY_ELEMENT_INVALID: "lowering";
|
|
69
70
|
readonly BPMN_ACTIVITY_SCRIPT_TASK_TYPE: "lowering";
|
|
70
71
|
readonly BPMN_BINDING_READ_BEFORE_DECLARED: "lowering";
|
|
71
72
|
readonly BPMN_BINDING_RESOURCE_KEY_CONFLICT: "lowering";
|
|
@@ -417,6 +418,7 @@ export declare const REFUSALS: {
|
|
|
417
418
|
readonly GUARDRAIL_NO_SCOPE: "lint";
|
|
418
419
|
readonly GUARDRAIL_NO_VALIDATOR: "lint";
|
|
419
420
|
readonly GUARDRAIL_TYPE_UNKNOWN: "lint";
|
|
421
|
+
readonly HANDLE_NOT_IN_CURRENT_MANIFEST: "lint";
|
|
420
422
|
readonly HITL_APP_INCOMPLETE: "lowering";
|
|
421
423
|
readonly HITL_APP_INPUT_REQUIRED: "lint";
|
|
422
424
|
readonly HITL_APP_INPUT_UNKNOWN: "lint";
|
package/dist/core/refusals.js
CHANGED
|
@@ -115,6 +115,7 @@ export const REFUSALS = {
|
|
|
115
115
|
BINDING_UNDECLARED: 'draft',
|
|
116
116
|
BOUNDARY_NOT_ACTIVITY: 'lint',
|
|
117
117
|
BOUNDARY_UNATTACHED: 'lowering',
|
|
118
|
+
BPMN_ACTIVITY_ELEMENT_INVALID: 'lowering',
|
|
118
119
|
BPMN_ACTIVITY_SCRIPT_TASK_TYPE: 'lowering',
|
|
119
120
|
BPMN_BINDING_READ_BEFORE_DECLARED: 'lowering',
|
|
120
121
|
BPMN_BINDING_RESOURCE_KEY_CONFLICT: 'lowering',
|
|
@@ -493,6 +494,9 @@ export const REFUSALS = {
|
|
|
493
494
|
GUARDRAIL_NO_SCOPE: 'lint',
|
|
494
495
|
GUARDRAIL_NO_VALIDATOR: 'lint',
|
|
495
496
|
GUARDRAIL_TYPE_UNKNOWN: 'lint',
|
|
497
|
+
// An edge on a handle the tenant's current manifest drops (core/current-manifest-handles.ts):
|
|
498
|
+
// compile writes the edge the source asks for; only check, given the node catalog, sees the tenant disagree.
|
|
499
|
+
HANDLE_NOT_IN_CURRENT_MANIFEST: 'lint',
|
|
496
500
|
HITL_APP_INCOMPLETE: 'lowering',
|
|
497
501
|
HITL_APP_INPUT_REQUIRED: 'lint',
|
|
498
502
|
HITL_APP_INPUT_UNKNOWN: 'lint',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type NodeCatalog } from './core/node-catalog.js';
|
|
2
2
|
/** The cache `uip maestro flow registry pull` writes. */
|
|
3
3
|
export declare function defaultNodeCatalogFile(): string;
|
|
4
4
|
/**
|
|
@@ -7,3 +7,37 @@ export declare function defaultNodeCatalogFile(): string;
|
|
|
7
7
|
* reports the miss and names `registry pull`.
|
|
8
8
|
*/
|
|
9
9
|
export declare function readNodeCatalog(file?: string): NodeCatalog;
|
|
10
|
+
/**
|
|
11
|
+
* The environment variable `uip maestro flow check` sets to the node-cache
|
|
12
|
+
* scope of the tenant it is logged in to (`<base URL>|<org id>|<tenant id>`,
|
|
13
|
+
* lower-cased, as `index.meta.json` records it).
|
|
14
|
+
*/
|
|
15
|
+
export declare const NODE_CACHE_SCOPE_ENV = "FLOW_SDK_NODE_CACHE_SCOPE";
|
|
16
|
+
/** How long a node cache counts as current: the TTL `uip maestro flow registry get/search` use. */
|
|
17
|
+
export declare const CURRENT_NODE_CACHE_TTL_MS: number;
|
|
18
|
+
/**
|
|
19
|
+
* The node catalog in `file` when it provably holds the current tenant's
|
|
20
|
+
* manifests, or why not. It has to:
|
|
21
|
+
*
|
|
22
|
+
* - be named: `scope` is the logged-in tenant's scope, which only `uip` knows;
|
|
23
|
+
* - be that tenant's: the sibling `index.meta.json` records the same scope,
|
|
24
|
+
* so a cache pulled on another tenant or environment is never "current";
|
|
25
|
+
* - be complete: the metadata's `hash` is the sha256 of `index.json`, so an
|
|
26
|
+
* index another login replaced after the metadata was read does not pass;
|
|
27
|
+
* - be fresh: pulled within {@link CURRENT_NODE_CACHE_TTL_MS}, so an old
|
|
28
|
+
* snapshot cannot reject a handle the tenant serves today. Nothing here
|
|
29
|
+
* refetches; the next `registry pull` makes it current again.
|
|
30
|
+
*
|
|
31
|
+
* `HANDLE_NOT_IN_CURRENT_MANIFEST` runs only on such a catalog. A `rawNode`
|
|
32
|
+
* still resolves from {@link readNodeCatalog}, which needs no tenant.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* currentNodeCatalog(undefined); // { skipped: 'uip named no logged-in tenant …' }
|
|
36
|
+
*/
|
|
37
|
+
export declare function currentNodeCatalog(scope: string | undefined, file?: string, now?: number): {
|
|
38
|
+
catalog: NodeCatalog;
|
|
39
|
+
} | {
|
|
40
|
+
skipped: string;
|
|
41
|
+
};
|
|
42
|
+
/** {@link currentNodeCatalog}'s catalog, or `undefined` when it was skipped. */
|
|
43
|
+
export declare function readCurrentNodeCatalog(scope: string | undefined, file?: string, now?: number): NodeCatalog | undefined;
|