@uipath/maestro-builder-sdk 6.18.10 → 6.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/api-index.md +185 -184
  2. package/dist/api-members.md +506 -473
  3. package/dist/check.js +358 -695
  4. package/dist/cli/commands/flow.js +3 -0
  5. package/dist/compile-cli.js +51 -0
  6. package/dist/core/actions.d.ts +132 -765
  7. package/dist/core/actions.js +1 -307
  8. package/dist/core/binding-identity.d.ts +22 -0
  9. package/dist/core/binding-identity.js +28 -0
  10. package/dist/core/context-index.d.ts +34 -0
  11. package/dist/core/context-index.js +38 -0
  12. package/dist/core/definitionless-node-types.d.ts +16 -0
  13. package/dist/core/definitionless-node-types.js +16 -0
  14. package/dist/core/error-port.d.ts +6 -0
  15. package/dist/core/error-port.js +9 -0
  16. package/dist/core/form-field-type.d.ts +33 -0
  17. package/dist/core/form-field-type.js +30 -0
  18. package/dist/core/hitl-routing.d.ts +8 -0
  19. package/dist/core/hitl-routing.js +17 -1
  20. package/dist/core/node-classes.d.ts +4 -63
  21. package/dist/core/node-classes.js +0 -112
  22. package/dist/core/nodes/family.d.ts +36 -0
  23. package/dist/core/nodes/family.js +1 -0
  24. package/dist/core/nodes/node-type.d.ts +136 -0
  25. package/dist/core/nodes/node-type.js +1 -0
  26. package/dist/core/nodes/registry.d.ts +57 -0
  27. package/dist/core/nodes/registry.js +122 -0
  28. package/dist/core/nodes/versioned.d.ts +50 -0
  29. package/dist/core/nodes/versioned.js +46 -0
  30. package/dist/core/process-resource-sort-order.d.ts +40 -0
  31. package/dist/core/process-resource-sort-order.js +44 -0
  32. package/dist/core/typed-raw-node.d.ts +13 -62
  33. package/dist/core/typed-raw-node.js +40 -154
  34. package/dist/core/wire-expr.d.ts +27 -0
  35. package/dist/core/wire-expr.js +34 -0
  36. package/dist/decompile-cli.js +11 -1
  37. package/dist/decompile.d.ts +8 -3
  38. package/dist/decompile.js +665 -354
  39. package/dist/flow-definitions.d.ts +10 -0
  40. package/dist/flow-definitions.js +35 -0
  41. package/dist/flow-expr-check.js +1 -1
  42. package/dist/flow-node-registry.d.ts +13 -0
  43. package/dist/flow-node-registry.js +19 -0
  44. package/dist/flow-node-type.d.ts +192 -0
  45. package/dist/flow-node-type.js +1 -0
  46. package/dist/flow-sdk.d.ts +40 -1
  47. package/dist/flow-sdk.js +29 -2
  48. package/dist/flow-step-tree.js +2 -1
  49. package/dist/index.d.ts +2 -1
  50. package/dist/index.js +1 -0
  51. package/dist/merge-cli.js +25 -8
  52. package/dist/merge-roundtrip.d.ts +81 -0
  53. package/dist/merge-roundtrip.js +404 -0
  54. package/dist/merge.d.ts +35 -6
  55. package/dist/merge.js +124 -24
  56. package/dist/node-placement.d.ts +93 -0
  57. package/dist/node-placement.js +163 -0
  58. package/dist/nodes/data-fabric/flow/check.d.ts +13 -0
  59. package/dist/nodes/data-fabric/flow/check.js +164 -0
  60. package/dist/nodes/data-fabric/flow/factories.d.ts +113 -0
  61. package/dist/nodes/data-fabric/flow/factories.js +134 -0
  62. package/dist/nodes/data-fabric/flow/family.d.ts +7 -0
  63. package/dist/nodes/data-fabric/flow/family.js +9 -0
  64. package/dist/nodes/data-fabric/flow/index.d.ts +8 -0
  65. package/dist/nodes/data-fabric/flow/index.js +8 -0
  66. package/dist/nodes/data-fabric/flow/raw.d.ts +32 -0
  67. package/dist/nodes/data-fabric/flow/raw.js +100 -0
  68. package/dist/nodes/data-fabric/flow/shared.d.ts +77 -0
  69. package/dist/nodes/data-fabric/flow/shared.js +174 -0
  70. package/dist/nodes/data-fabric/flow/spec.d.ts +238 -0
  71. package/dist/nodes/data-fabric/flow/spec.js +1 -0
  72. package/dist/nodes/data-fabric/flow/verbs.d.ts +29 -0
  73. package/dist/nodes/data-fabric/flow/verbs.js +239 -0
  74. package/dist/nodes/delay/flow/check.d.ts +16 -0
  75. package/dist/nodes/delay/flow/check.js +86 -0
  76. package/dist/nodes/delay/flow/factories.d.ts +28 -0
  77. package/dist/nodes/delay/flow/factories.js +38 -0
  78. package/dist/nodes/delay/flow/family.d.ts +3 -0
  79. package/dist/nodes/delay/flow/family.js +8 -0
  80. package/dist/nodes/delay/flow/index.d.ts +3 -0
  81. package/dist/nodes/delay/flow/index.js +3 -0
  82. package/dist/nodes/delay/flow/node-type.d.ts +13 -0
  83. package/dist/nodes/delay/flow/node-type.js +71 -0
  84. package/dist/nodes/delay/flow/spec.d.ts +43 -0
  85. package/dist/nodes/delay/flow/spec.js +16 -0
  86. package/dist/nodes/document/flow/factories.d.ts +27 -0
  87. package/dist/nodes/document/flow/factories.js +30 -0
  88. package/dist/nodes/document/flow/family.d.ts +3 -0
  89. package/dist/nodes/document/flow/family.js +7 -0
  90. package/dist/nodes/document/flow/index.d.ts +3 -0
  91. package/dist/nodes/document/flow/index.js +3 -0
  92. package/dist/nodes/document/flow/node-type.d.ts +14 -0
  93. package/dist/nodes/document/flow/node-type.js +150 -0
  94. package/dist/nodes/document/flow/spec.d.ts +65 -0
  95. package/dist/nodes/document/flow/spec.js +1 -0
  96. package/dist/nodes/mock/flow/factories.d.ts +51 -0
  97. package/dist/nodes/mock/flow/factories.js +47 -0
  98. package/dist/nodes/mock/flow/family.d.ts +3 -0
  99. package/dist/nodes/mock/flow/family.js +7 -0
  100. package/dist/nodes/mock/flow/index.d.ts +2 -0
  101. package/dist/nodes/mock/flow/index.js +2 -0
  102. package/dist/nodes/mock/flow/node-type.d.ts +11 -0
  103. package/dist/nodes/mock/flow/node-type.js +51 -0
  104. package/dist/nodes/script/flow/check.d.ts +19 -0
  105. package/dist/nodes/script/flow/check.js +49 -0
  106. package/dist/nodes/script/flow/factories.d.ts +14 -0
  107. package/dist/nodes/script/flow/factories.js +15 -0
  108. package/dist/nodes/script/flow/family.d.ts +3 -0
  109. package/dist/nodes/script/flow/family.js +8 -0
  110. package/dist/nodes/script/flow/index.d.ts +3 -0
  111. package/dist/nodes/script/flow/index.js +3 -0
  112. package/dist/nodes/script/flow/node-type.d.ts +7 -0
  113. package/dist/nodes/script/flow/node-type.js +125 -0
  114. package/dist/nodes/script/flow/spec.d.ts +52 -0
  115. package/dist/nodes/script/flow/spec.js +1 -0
  116. package/dist/nodes/transform/flow/check.d.ts +6 -0
  117. package/dist/nodes/transform/flow/check.js +229 -0
  118. package/dist/nodes/transform/flow/factories.d.ts +52 -0
  119. package/dist/nodes/transform/flow/factories.js +53 -0
  120. package/dist/nodes/transform/flow/family.d.ts +3 -0
  121. package/dist/nodes/transform/flow/family.js +8 -0
  122. package/dist/nodes/transform/flow/index.d.ts +3 -0
  123. package/dist/nodes/transform/flow/index.js +3 -0
  124. package/dist/nodes/transform/flow/node-type.d.ts +7 -0
  125. package/dist/nodes/transform/flow/node-type.js +245 -0
  126. package/dist/nodes/transform/flow/spec.d.ts +116 -0
  127. package/dist/nodes/transform/flow/spec.js +10 -0
  128. package/dist/raw-node-advice.d.ts +16 -0
  129. package/dist/raw-node-advice.js +36 -0
  130. package/dist/raw-node.d.ts +71 -0
  131. package/dist/raw-node.js +116 -0
  132. package/dist/registry/uip/pipeline-front-door.js +5 -3
  133. package/dist/serialize.js +246 -549
  134. package/package.json +2 -2
@@ -0,0 +1,245 @@
1
+ /**
2
+ * The four Transform node types: the generic chaining `core.action.transform`
3
+ * and its single-purpose `.filter`, `.map` and `.group-by` variants, each bundled
4
+ * at 1.0.0 and 1.1. They share the `transform` kind; `inputs.variant` picks one
5
+ * (`matches`). Moved from serialize.ts / check.ts / decompile.ts in Phase 4 of
6
+ * docs/NODE_TYPE_ARCHITECTURE_DESIGN.md; serialized output, printed source,
7
+ * codes and messages unchanged.
8
+ */
9
+ import { Expr } from '../../../core/expr.js';
10
+ import { wireExprBody } from '../../../core/wire-expr.js';
11
+ import { jsonClone } from '../../../core/json-file.js';
12
+ import { VARIANT_OPERATION } from './spec.js';
13
+ import { checkTransform } from './check.js';
14
+ /**
15
+ * Emit a transform's `inputs` in the canonical shape the node's runtime reads:
16
+ * `collection` as a BARE variable path (not `=js:`-prefixed — it is a path
17
+ * field, and the runtime turns the string into a lookup), and `operations` as
18
+ * the array of `{ id, type, config }` descriptors the designer writes.
19
+ *
20
+ * Ids are synthesized here rather than asked of the author, the same way switch
21
+ * case ids are: they identify a row in the designer's editor and carry no
22
+ * meaning for the author. Defaults are made explicit for the same reason the
23
+ * HTTP case spells out `method`/`contentType` — the emitted file should say
24
+ * what it does rather than rely on the runtime's fallbacks.
25
+ */
26
+ function transformInputs(inputs, ctx) {
27
+ const operations = (inputs.operations ?? []).map((op, i) => {
28
+ const id = `op${i + 1}`;
29
+ if (op.type === 'filter') {
30
+ return {
31
+ id,
32
+ type: 'filter',
33
+ config: {
34
+ operation: op.operation ?? 'and',
35
+ filters: (op.filters ?? []).map((f, j) => ({
36
+ id: `f${j + 1}`,
37
+ field: f.field,
38
+ condition: f.condition,
39
+ // Value-free conditions (is_null, is_empty, …) legitimately omit it.
40
+ ...(f.value !== undefined ? { value: f.value } : {}),
41
+ })),
42
+ },
43
+ };
44
+ }
45
+ if (op.type === 'map') {
46
+ return {
47
+ id,
48
+ type: 'map',
49
+ config: {
50
+ keepOriginalFields: op.keepOriginalFields ?? false,
51
+ mappings: (op.mappings ?? []).map((m, j) => ({
52
+ id: `m${j + 1}`,
53
+ field: m.field,
54
+ transformation: m.transformation ?? 'copy',
55
+ // '' is the runtime's "keep the original name" sentinel.
56
+ renameTo: m.renameTo ?? '',
57
+ })),
58
+ },
59
+ };
60
+ }
61
+ return {
62
+ id,
63
+ type: 'groupBy',
64
+ config: {
65
+ groupByField: op.groupByField,
66
+ aggregations: (op.aggregations ?? []).map((a, j) => ({
67
+ id: `a${j + 1}`,
68
+ // `count` needs no field; the runtime expects the key present anyway.
69
+ field: a.field ?? '',
70
+ operation: a.operation,
71
+ alias: a.alias,
72
+ })),
73
+ },
74
+ };
75
+ });
76
+ return { collection: ctx.renameRefs(collectionPath(inputs.collection)), operations };
77
+ }
78
+ /**
79
+ * The `collection` string. A bare reference (`v('x')` / `out('s','p')`) is
80
+ * already the path the runtime wants, so it is emitted verbatim. Anything else
81
+ * cannot be expressed as a path — `check` rejects it (TRANSFORM_COLLECTION_*)
82
+ * before serialization, so reaching here with one means `compile` was called
83
+ * without a check; emit the raw text so the failure stays visible downstream
84
+ * rather than becoming a silently empty collection.
85
+ */
86
+ function collectionPath(collection) {
87
+ if (collection instanceof Expr)
88
+ return collection.literal ? JSON.stringify(collection.value) : collection.js;
89
+ return String(collection);
90
+ }
91
+ /**
92
+ * A transform node publishes a COLLECTION — always.
93
+ *
94
+ * All four transform definitions declare `output: {type: 'object', description:
95
+ * 'The transformed data result'}`, which makes the designer type
96
+ * `out('<step>')` as `Record<string, any>` and reject mapping it into an
97
+ * `array` flow output — the same defect as the script node's, one node type
98
+ * over, and it hits five of the shipped examples.
99
+ *
100
+ * Unlike a script this needs no inference and no author declaration, because it
101
+ * is not a property of the particular node: `filter` and `map` are array→array,
102
+ * and `group-by` is too — the engine's own implementation says so in as many
103
+ * words (`transform-operations.ts`: "Always return an array", returning
104
+ * `Array.from(groups.entries()).map(…)` rather than an object keyed by group).
105
+ * So the type is knowable from the node TYPE alone, and is simply written down.
106
+ */
107
+ function transformOutputs(base) {
108
+ // An unrecognized `variant` resolves to no definition at all, so there are no
109
+ // outputs to refine — and `jsonClone(undefined)` throws ("undefined" is not valid
110
+ // JSON) rather than passing the node through.
111
+ if (!base || typeof base !== 'object')
112
+ return base;
113
+ const out = jsonClone(base);
114
+ if (out.output)
115
+ out.output.type = 'array';
116
+ return out;
117
+ }
118
+ // ─── The lift ──────────────────────────────────────────────────────────────────
119
+ /**
120
+ * A Transform node back as its spec: `collection` as the bare path the
121
+ * serializer writes (an Expr; absent when the node has none), and each operation
122
+ * from its `{ id, type, config }` descriptor. Values stay as the file has them —
123
+ * the printer decides what to write, exactly as the decompiler always did.
124
+ */
125
+ function liftTransform(node, variant, ctx) {
126
+ const inputs = node.inputs ?? {};
127
+ const raw = ctx.sourceText(inputs.collection);
128
+ const ops = Array.isArray(inputs.operations) ? inputs.operations : [];
129
+ const operations = ops.map((op) => {
130
+ const cfg = op?.config ?? {};
131
+ if (op?.type === 'filter') {
132
+ return { type: 'filter', operation: cfg.operation, filters: (cfg.filters ?? []).map((f) => ({ field: f.field, condition: f.condition, ...(f.value !== undefined ? { value: f.value } : {}) })) };
133
+ }
134
+ if (op?.type === 'map') {
135
+ return { type: 'map', keepOriginalFields: cfg.keepOriginalFields, mappings: (cfg.mappings ?? []).map((m) => ({ field: m.field, transformation: m.transformation, renameTo: m.renameTo })) };
136
+ }
137
+ // Anything else prints as a groupBy, as the decompiler always read it.
138
+ return { type: 'groupBy', groupByField: cfg.groupByField, aggregations: (cfg.aggregations ?? []).map((a) => ({ operation: a.operation, alias: a.alias, field: a.field })) };
139
+ });
140
+ return {
141
+ kind: 'transform',
142
+ inputs: {
143
+ collection: (raw !== undefined ? new Expr(wireExprBody(raw)) : undefined),
144
+ ...(variant ? { variant } : {}),
145
+ operations: operations,
146
+ },
147
+ };
148
+ }
149
+ /** `{ k: v, … }` from entries (the decompiler's `objLit`): `''` when there are none. */
150
+ function obj(entries, ctx) {
151
+ return entries.length === 0 ? '' : `{ ${entries.map(([k, v]) => `${ctx.key(k)}: ${v}`).join(', ')} }`;
152
+ }
153
+ /** The spec as `transform({ collection, variant?, operations })`, as the decompiler wrote it. */
154
+ function printTransform({ inputs }, ctx) {
155
+ const s = (v) => ctx.string(v);
156
+ const opSrcs = (inputs.operations ?? []).map((op) => {
157
+ if (op.type === 'filter') {
158
+ const filters = (op.filters ?? []).map((f) => obj([
159
+ ['field', s(f.field)],
160
+ ['condition', s(f.condition)],
161
+ ...(f.value !== undefined ? [['value', s(f.value)]] : []),
162
+ ], ctx));
163
+ return obj([
164
+ ['type', s('filter')],
165
+ ...(op.operation !== undefined ? [['operation', s(op.operation)]] : []),
166
+ ['filters', `[${filters.join(', ')}]`],
167
+ ], ctx);
168
+ }
169
+ if (op.type === 'map') {
170
+ const mappings = (op.mappings ?? []).map((m) => obj([
171
+ ['field', s(m.field)],
172
+ ...(m.transformation && m.transformation !== 'copy' ? [['transformation', s(m.transformation)]] : []),
173
+ ...(m.renameTo ? [['renameTo', s(m.renameTo)]] : []),
174
+ ], ctx));
175
+ return obj([
176
+ ['type', s('map')],
177
+ ...(op.keepOriginalFields ? [['keepOriginalFields', op.keepOriginalFields ? 'true' : 'false']] : []),
178
+ ['mappings', `[${mappings.join(', ')}]`],
179
+ ], ctx);
180
+ }
181
+ const aggs = (op.aggregations ?? []).map((a) => obj([
182
+ ['operation', s(a.operation)],
183
+ ['alias', s(a.alias)],
184
+ ...(a.field ? [['field', s(a.field)]] : []),
185
+ ], ctx));
186
+ return obj([
187
+ ['type', s('groupBy')],
188
+ ['groupByField', s(op.groupByField)],
189
+ ['aggregations', `[${aggs.join(', ')}]`],
190
+ ], ctx);
191
+ });
192
+ const collection = inputs.collection !== undefined ? ctx.value(inputs.collection) : `${ctx.helper('lit')}([])`;
193
+ return {
194
+ factory: 'transform',
195
+ options: [
196
+ ['collection', collection],
197
+ ['variant', inputs.variant ? s(inputs.variant) : undefined],
198
+ ['operations', `[${opSrcs.join(', ')}]`],
199
+ ],
200
+ };
201
+ }
202
+ // ─── The four node types ───────────────────────────────────────────────────────
203
+ const VARIANTS = Object.keys(VARIANT_OPERATION);
204
+ function transformAt(typeName, variant, version, factory) {
205
+ return {
206
+ kind: 'transform', typeName, version, factory: 'transform', definition: 'bundled',
207
+ rawNode: { factory },
208
+ serialize: ({ inputs }, ctx) => {
209
+ // Only the generic type matches an UNKNOWN variant, so check reports it
210
+ // (TRANSFORM_VARIANT_UNKNOWN). A compile that skipped check refuses here
211
+ // rather than emit the generic node, which would run and be the wrong node.
212
+ if (variant === undefined && inputs?.variant !== undefined && inputs.variant !== null) {
213
+ throw new Error(`transform step "${ctx.step}": variant ${JSON.stringify(inputs.variant)} is not a Transform node type `
214
+ + `(${VARIANTS.join(', ')}), so there is no node to emit. Fix the variant, or omit it for the generic Transform.`);
215
+ }
216
+ const base = ctx.definition(typeName, version)?.outputDefinition;
217
+ const typed = transformOutputs(base);
218
+ return { inputs: transformInputs(inputs, ctx), ...(typed !== base ? { outputs: typed } : {}) };
219
+ },
220
+ deserialize: (node, ctx) => liftTransform(node, variant, ctx),
221
+ print: printTransform,
222
+ check: ({ inputs }, ctx) => checkTransform(inputs, ctx),
223
+ // The only expression a transform carries is its collection; everything else
224
+ // is a literal or a field name (see checkTransform).
225
+ expressions: ({ inputs }) => [{ value: inputs.collection }],
226
+ output: () => ({ kind: 'opaque' }),
227
+ };
228
+ }
229
+ function transformType(typeName, variant, factory) {
230
+ return {
231
+ kind: 'transform', typeName, factory: 'transform', defaultVersion: '1.0.0',
232
+ versions: { '1.0.0': transformAt(typeName, variant, '1.0.0', factory), '1.1': transformAt(typeName, variant, '1.1', factory) },
233
+ // The generic type is the one for any spec without a KNOWN variant — an unknown
234
+ // one included, so check still reports it (see serialize above).
235
+ matches: ({ inputs }) => (variant === undefined
236
+ ? !VARIANTS.includes(inputs?.variant)
237
+ : inputs?.variant === variant),
238
+ };
239
+ }
240
+ export const transformNodeTypes = [
241
+ transformType('core.action.transform', undefined, 'transform()'),
242
+ transformType('core.action.transform.filter', 'filter', "transform({ variant: 'filter' })"),
243
+ transformType('core.action.transform.map', 'map', "transform({ variant: 'map' })"),
244
+ transformType('core.action.transform.group-by', 'group-by', "transform({ variant: 'group-by' })"),
245
+ ];
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The Transform family's authoring types (`core.action.transform` and its
3
+ * `.filter`, `.map`, `.group-by` variants), and its kind's entry in
4
+ * `FlowActionSpecs`. Moved from core/actions.ts in Phase 4 of
5
+ * docs/NODE_TYPE_ARCHITECTURE_DESIGN.md.
6
+ */
7
+ import type { Expr } from '../../../core/expr.js';
8
+ /** How a filter combines its rules: every rule must match, or any one. */
9
+ export type FilterMatch = 'and' | 'or';
10
+ /** Comparison a filter rule applies to a field. */
11
+ export type FilterCondition = 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_equal' | 'less_equal' | 'contains' | 'not_contains' | 'starts_with' | 'not_starts_with' | 'ends_with' | 'not_ends_with' | 'matches_regex' | 'in' | 'not_in' | 'is_null' | 'is_not_null' | 'is_empty' | 'is_not_empty';
12
+ export interface FilterRule {
13
+ /** Field on each item. Dot-paths reach nested fields (`'order.amount'`). */
14
+ field: string;
15
+ condition: FilterCondition;
16
+ /**
17
+ * What to compare against — a LITERAL only. The transform runtime reads this
18
+ * value as-is and evaluates nothing, so an expression here would compare every
19
+ * item against that text and match nothing. Hence `Expr` is not accepted: for
20
+ * a dynamic threshold, filter in a `script` step instead.
21
+ * Omit for the value-free conditions (`is_null`, `is_empty`, …).
22
+ */
23
+ value?: string | number | boolean | null;
24
+ }
25
+ /** What a map does to a field's value. Only `copy` is meaningful for non-text. */
26
+ export type Transformation = 'copy' | 'uppercase' | 'lowercase' | 'trim';
27
+ export interface FieldMapping {
28
+ /** Field to carry into the output. Must exist on the item, or it is skipped. */
29
+ field: string;
30
+ /** Defaults to `'copy'` (the value unchanged). */
31
+ transformation?: Transformation;
32
+ /** Output field name. Omit to keep `field`'s own name. */
33
+ renameTo?: string;
34
+ }
35
+ export type AggregationOperation = 'count' | 'sum' | 'average' | 'min' | 'max' | 'first' | 'last' | 'collect';
36
+ export interface Aggregation {
37
+ operation: AggregationOperation;
38
+ /** Output field name for the aggregate. Required. */
39
+ alias: string;
40
+ /** Field to aggregate. Required for every operation except `count`. */
41
+ field?: string;
42
+ }
43
+ /**
44
+ * One link in the chain. Operations run in the order given, and each one's
45
+ * result is the next one's input — so a `map` that drops a field puts it out of
46
+ * reach of a later `filter`.
47
+ */
48
+ export type TransformOperation = {
49
+ type: 'filter';
50
+ filters: FilterRule[];
51
+ operation?: FilterMatch;
52
+ } | {
53
+ type: 'map';
54
+ mappings: FieldMapping[];
55
+ keepOriginalFields?: boolean;
56
+ } | {
57
+ type: 'groupBy';
58
+ groupByField: string;
59
+ aggregations?: Aggregation[];
60
+ };
61
+ /**
62
+ * Which Transform node type to emit.
63
+ *
64
+ * @remarks
65
+ * The platform ships four: the generic `core.action.transform`, which chains N
66
+ * operations, plus three single-purpose variants that each run exactly one.
67
+ * They share ONE runtime — flow-v1 routes all four node types through the same
68
+ * script generators and dispatches on the OPERATION's `type`, never the node's
69
+ * (`bpmn-to-xml.ts`'s `DATA_TRANSFORM_NODE_TYPES` / `generateDataTransformScript`).
70
+ * So a variant is the generic constrained to one operation, wearing a
71
+ * self-describing node type and its own editor in the designer.
72
+ *
73
+ * Note the spelling: the node type is `core.action.transform.group-by`
74
+ * (hyphen), while the operation it carries is `type: 'groupBy'` (camelCase) —
75
+ * that mismatch is the platform's, not ours.
76
+ */
77
+ export type TransformVariant = 'map' | 'filter' | 'group-by';
78
+ /**
79
+ * The operation `type` each variant node must carry — one of, and only.
80
+ *
81
+ * @internal Serializer plumbing; an author states the variant, not the mapping.
82
+ */
83
+ export declare const VARIANT_OPERATION: Record<TransformVariant, TransformOperation['type']>;
84
+ export interface TransformInputs {
85
+ /**
86
+ * The array to transform, as a REFERENCE: `v('catalog')` or
87
+ * `out('fetchOrders', 'body.items')`.
88
+ *
89
+ * This is a variable PATH, not a value field — the runtime turns the string
90
+ * into a lookup. An inline array or a computed `js` expression therefore
91
+ * resolves to nothing, which is why the type is `Expr` and `check` rejects
92
+ * anything that is not a bare `$vars.…` path. Keep static data in a
93
+ * `.var(name, types.array, [...])` default and point here.
94
+ */
95
+ collection: Expr;
96
+ /**
97
+ * Emit a single-purpose variant node instead of the generic Transform.
98
+ * Omit it for the generic (the default).
99
+ *
100
+ * With a variant, `operations` must hold exactly ONE operation of the
101
+ * matching type — `'filter'` → `type: 'filter'`, `'map'` → `type: 'map'`,
102
+ * `'group-by'` → `type: 'groupBy'`. `check` rejects anything else, naming
103
+ * both the variant and the operation it found.
104
+ */
105
+ variant?: TransformVariant;
106
+ /** At least one operation — an empty chain is a no-op node. */
107
+ operations: TransformOperation[];
108
+ }
109
+ declare module '../../../core/actions.js' {
110
+ interface FlowActionSpecs {
111
+ /** The spec {@link transform} builds. */
112
+ transform: {
113
+ inputs: TransformInputs;
114
+ };
115
+ }
116
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The operation `type` each variant node must carry — one of, and only.
3
+ *
4
+ * @internal Serializer plumbing; an author states the variant, not the mapping.
5
+ */
6
+ export const VARIANT_OPERATION = {
7
+ map: 'map',
8
+ filter: 'filter',
9
+ 'group-by': 'groupBy',
10
+ };
@@ -0,0 +1,16 @@
1
+ import type { FlowNodeType } from './flow-node-type.js';
2
+ /**
3
+ * The registered node type a raw node of `nodeType@version` is, at that version
4
+ * when it is registered and at the default otherwise (a raw node is often how an
5
+ * author reaches an unregistered version); undefined for an unregistered type.
6
+ */
7
+ export declare function registeredRawType(nodeType: unknown, version: string): {
8
+ impl: FlowNodeType<unknown>;
9
+ } | undefined;
10
+ /** An input a registered node type never reads, as RAW_NODE_UNKNOWN_INPUT reports it; undefined otherwise. */
11
+ export declare function rawNodeInputProblem(nodeType: unknown, version: string, inputs: unknown): {
12
+ severity: 'error' | 'warning';
13
+ message: string;
14
+ } | undefined;
15
+ /** RAW_NODE_TYPED_FAMILY for a raw node of a type with a typed factory — registered, or not yet ported. */
16
+ export declare function rawNodeTypedFamilyWarning(nodeType: string): string | undefined;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * What `rawNode` and the serializer ask about a raw node: whether its type is
3
+ * registered, an input that type never reads, and the typed factory to prefer.
4
+ * Internal — kept apart from raw-node.ts so the package entry, which re-exports
5
+ * that module, exports only `rawNode` itself.
6
+ */
7
+ import { typedFactoryWarning, typedFamilyRawNodeWarning as tableWarning } from './core/typed-raw-node.js';
8
+ import { hasBundledDefinition } from './flow-definitions.js';
9
+ import { FLOW_NODE_TYPES } from './flow-node-registry.js';
10
+ /**
11
+ * The registered node type a raw node of `nodeType@version` is, at that version
12
+ * when it is registered and at the default otherwise (a raw node is often how an
13
+ * author reaches an unregistered version); undefined for an unregistered type.
14
+ */
15
+ export function registeredRawType(nodeType, version) {
16
+ const entry = typeof nodeType === 'string' ? FLOW_NODE_TYPES.byTypeName(nodeType) : undefined;
17
+ if (!entry)
18
+ return undefined;
19
+ const registered = Object.hasOwn(entry.type.versions, version);
20
+ const impl = (registered ? entry.type.versions[version] : entry.type.versions[entry.type.defaultVersion]);
21
+ return { impl };
22
+ }
23
+ /** An input a registered node type never reads, as RAW_NODE_UNKNOWN_INPUT reports it; undefined otherwise. */
24
+ export function rawNodeInputProblem(nodeType, version, inputs) {
25
+ const found = registeredRawType(nodeType, version);
26
+ // `bundled` is the bundle's answer, not the registry's: a version the SDK ships
27
+ // but no node type lists yet still has a known key set (and an error).
28
+ return found?.impl.rawNode?.inputProblem?.(inputs, version, hasBundledDefinition(nodeType, version));
29
+ }
30
+ /** RAW_NODE_TYPED_FAMILY for a raw node of a type with a typed factory — registered, or not yet ported. */
31
+ export function rawNodeTypedFamilyWarning(nodeType) {
32
+ const advice = registeredRawType(nodeType, '')?.impl.rawNode;
33
+ if (advice)
34
+ return typedFactoryWarning(nodeType, advice.factory, advice.hint);
35
+ return tableWarning(nodeType);
36
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * `rawNode` — place a node this SDK has no factory for, carrying its definition
3
+ * verbatim. Moved from core/node-classes.ts in Phase 3 of
4
+ * docs/NODE_TYPE_ARCHITECTURE_DESIGN.md so its diagnostics can ask the node-type
5
+ * registry what a registered type says about a raw node of it; the package entry
6
+ * re-exports it, so authors import it exactly as before.
7
+ */
8
+ import { FlowAction } from './core/node-classes.js';
9
+ /**
10
+ * Place a node this SDK has no factory for, carrying its definition verbatim
11
+ * (`uipath.exotic.thing@2.1` and the manifest the platform served for it).
12
+ *
13
+ * @remarks
14
+ * This is the escape hatch the coverage plan requires: an unknown registry
15
+ * definition is expressible without bypassing serializer invariants. The
16
+ * serializer still owns the node's id, label, `typeVersion` and edge wiring; you
17
+ * supply which definition and which inputs, exactly as a hand-written
18
+ * {@link FlowAction} subclass would.
19
+ *
20
+ * It is also what `decompile` emits for a node type it cannot name, so a
21
+ * round trip preserves the node's TYPE and VERSION instead of degrading it to a
22
+ * placeholder:
23
+ *
24
+ * ```ts
25
+ * .step('exotic', rawNode({
26
+ * nodeType: 'uipath.exotic.thing',
27
+ * version: '2.1',
28
+ * manifest: exoticManifest, // exactly what `registry get` returned
29
+ * inputs: { where: input('scope') },
30
+ * }))
31
+ * ```
32
+ *
33
+ * `manifest` must be a real definition — an exact copy of what the registry or
34
+ * Workbench serves for that `nodeType@version`. It is not permission to invent
35
+ * one: the platform resolves the node against its own catalog at run time, so a
36
+ * hand-written manifest validates locally and fails on the tenant.
37
+ *
38
+ * Prefer a typed factory when one exists — it carries the family's checks, its
39
+ * defaults, and its output contract, none of which a raw node can know.
40
+ *
41
+ * **Never for a connector.** A `uipath.connector.*` node type is refused by
42
+ * `check` and `compile`: a raw node carries the author's inputs verbatim, so the
43
+ * emitted node has no `inputs.detail` and no connection binding — `validate`
44
+ * only warns ("Connector is not configured") and the run can never reach
45
+ * Integration Service. Use {@link connector}, and `registry prepare` when
46
+ * compile reports an input the static library does not carry; use
47
+ * {@link onEvent} for a connector event trigger.
48
+ *
49
+ * **Prefer the typed factory** for a node type that has one: `check` warns
50
+ * (`RAW_NODE_TYPED_FAMILY`), because `validate` cannot see an input the
51
+ * registry definition does not declare. For a `core.datafabric.*` type, a key
52
+ * the product never reads (an invented `_sortOptions` in place of `_sort`) is
53
+ * an error at a version the SDK bundles (`RAW_NODE_UNKNOWN_INPUT`); the
54
+ * canvas's snapshots, such as the `_entityFields` a related-path filter
55
+ * needs, stay legal.
56
+ *
57
+ * @param spec - The definition to compile against, plus the node's inputs.
58
+ * @returns A node to pass to `.step(...)`.
59
+ */
60
+ export declare function rawNode(spec: {
61
+ /** The definition's `nodeType`, verbatim. */
62
+ nodeType: string;
63
+ /** The exact definition version; also becomes the node's `typeVersion`. */
64
+ version: string;
65
+ /** The complete node manifest, exactly as the platform serves it. */
66
+ manifest: unknown;
67
+ /** The node's `inputs`. `Expr` values render through the usual pipeline. */
68
+ inputs?: Record<string, unknown>;
69
+ /** Overrides for the node's `outputs`; rarely needed. */
70
+ outputs?: Record<string, unknown>;
71
+ }): FlowAction;
@@ -0,0 +1,116 @@
1
+ /**
2
+ * `rawNode` — place a node this SDK has no factory for, carrying its definition
3
+ * verbatim. Moved from core/node-classes.ts in Phase 3 of
4
+ * docs/NODE_TYPE_ARCHITECTURE_DESIGN.md so its diagnostics can ask the node-type
5
+ * registry what a registered type says about a raw node of it; the package entry
6
+ * re-exports it, so authors import it exactly as before.
7
+ */
8
+ import { FlowAction, } from './core/node-classes.js';
9
+ import { connectorRawNodeRefusal } from './core/connector-raw-node.js';
10
+ import { rawNodeInputProblem, rawNodeTypedFamilyWarning } from './raw-node-advice.js';
11
+ /**
12
+ * Place a node this SDK has no factory for, carrying its definition verbatim
13
+ * (`uipath.exotic.thing@2.1` and the manifest the platform served for it).
14
+ *
15
+ * @remarks
16
+ * This is the escape hatch the coverage plan requires: an unknown registry
17
+ * definition is expressible without bypassing serializer invariants. The
18
+ * serializer still owns the node's id, label, `typeVersion` and edge wiring; you
19
+ * supply which definition and which inputs, exactly as a hand-written
20
+ * {@link FlowAction} subclass would.
21
+ *
22
+ * It is also what `decompile` emits for a node type it cannot name, so a
23
+ * round trip preserves the node's TYPE and VERSION instead of degrading it to a
24
+ * placeholder:
25
+ *
26
+ * ```ts
27
+ * .step('exotic', rawNode({
28
+ * nodeType: 'uipath.exotic.thing',
29
+ * version: '2.1',
30
+ * manifest: exoticManifest, // exactly what `registry get` returned
31
+ * inputs: { where: input('scope') },
32
+ * }))
33
+ * ```
34
+ *
35
+ * `manifest` must be a real definition — an exact copy of what the registry or
36
+ * Workbench serves for that `nodeType@version`. It is not permission to invent
37
+ * one: the platform resolves the node against its own catalog at run time, so a
38
+ * hand-written manifest validates locally and fails on the tenant.
39
+ *
40
+ * Prefer a typed factory when one exists — it carries the family's checks, its
41
+ * defaults, and its output contract, none of which a raw node can know.
42
+ *
43
+ * **Never for a connector.** A `uipath.connector.*` node type is refused by
44
+ * `check` and `compile`: a raw node carries the author's inputs verbatim, so the
45
+ * emitted node has no `inputs.detail` and no connection binding — `validate`
46
+ * only warns ("Connector is not configured") and the run can never reach
47
+ * Integration Service. Use {@link connector}, and `registry prepare` when
48
+ * compile reports an input the static library does not carry; use
49
+ * {@link onEvent} for a connector event trigger.
50
+ *
51
+ * **Prefer the typed factory** for a node type that has one: `check` warns
52
+ * (`RAW_NODE_TYPED_FAMILY`), because `validate` cannot see an input the
53
+ * registry definition does not declare. For a `core.datafabric.*` type, a key
54
+ * the product never reads (an invented `_sortOptions` in place of `_sort`) is
55
+ * an error at a version the SDK bundles (`RAW_NODE_UNKNOWN_INPUT`); the
56
+ * canvas's snapshots, such as the `_entityFields` a related-path filter
57
+ * needs, stay legal.
58
+ *
59
+ * @param spec - The definition to compile against, plus the node's inputs.
60
+ * @returns A node to pass to `.step(...)`.
61
+ */
62
+ export function rawNode(spec) {
63
+ return new RawNode(spec);
64
+ }
65
+ /** The {@link rawNode} implementation — a snapshot-backed contribution. */
66
+ class RawNode extends FlowAction {
67
+ spec;
68
+ constructor(spec) {
69
+ super();
70
+ this.spec = spec;
71
+ }
72
+ /**
73
+ * `check` surfaces the connector refusal as an error, a typed family as a
74
+ * warning, and an input a registered node type never reads as an error at a
75
+ * bundled version (a warning at any other); `compile` throws the errors
76
+ * (see {@link contribute}).
77
+ */
78
+ diagnostics() {
79
+ const refusal = connectorRawNodeRefusal(this.spec.nodeType);
80
+ if (refusal)
81
+ return [{ code: 'RAW_NODE_CONNECTOR', severity: 'error', message: refusal }];
82
+ const out = [];
83
+ const unknown = rawNodeInputProblem(this.spec.nodeType, this.spec.version, this.spec.inputs);
84
+ if (unknown)
85
+ out.push({ code: 'RAW_NODE_UNKNOWN_INPUT', ...unknown });
86
+ const typed = rawNodeTypedFamilyWarning(this.spec.nodeType);
87
+ if (typed)
88
+ out.push({ code: 'RAW_NODE_TYPED_FAMILY', severity: 'warning', message: typed });
89
+ return out;
90
+ }
91
+ contribute(context) {
92
+ // compile does not run diagnostics(); refuse here too so the escape hatch
93
+ // cannot emit an unconfigured connector node. (An input a registered node
94
+ // type never reads is refused by the serializer, for every contribution.)
95
+ const refusal = connectorRawNodeRefusal(this.spec.nodeType);
96
+ if (refusal)
97
+ throw new Error(refusal);
98
+ const version = context.requestedVersion ?? this.spec.version;
99
+ if (context.requestedVersion !== undefined && context.requestedVersion !== this.spec.version) {
100
+ // Versions are exact everywhere in this SDK: a contributor may not
101
+ // substitute its own for an explicit request (design §2.6).
102
+ throw new Error(`rawNode("${this.spec.nodeType}") carries version ${this.spec.version}, but the step requests `
103
+ + `${context.requestedVersion}. Pass the manifest for the requested version, or drop { version }.`);
104
+ }
105
+ return {
106
+ definition: {
107
+ source: 'snapshot',
108
+ nodeType: this.spec.nodeType,
109
+ version,
110
+ manifest: this.spec.manifest,
111
+ },
112
+ ...(this.spec.inputs !== undefined ? { inputs: this.spec.inputs } : {}),
113
+ ...(this.spec.outputs !== undefined ? { outputs: this.spec.outputs } : {}),
114
+ };
115
+ }
116
+ }
@@ -20,7 +20,9 @@
20
20
  * folder and every folder above it, then `PATH`.
21
21
  *
22
22
  * The block brings its own imports, `existsSync` among them, and defines
23
- * `run(verb, args)`; the pipeline body uses both. Nothing in it names a path on
23
+ * `frontDoor` (`{ via: 'uip' | 'sdk', file, prefix }`) and `run(verb, args)`;
24
+ * the pipeline body uses them. `via` says which door won, because on Windows
25
+ * `file` is node.exe or a full path, never the bare name. Nothing in it names a path on
24
26
  * the machine that generated it, so a pipeline stays relocatable.
25
27
  *
26
28
  * Example, for `kind = 'flow'` on a machine whose `uip` has the commands:
@@ -61,7 +63,7 @@ function uipFrontDoor() {
61
63
  return undefined; // a uip shim that cannot be read: use the SDK instead
62
64
  }
63
65
  const probe = spawnSync(uip.file, [...uip.args, 'maestro', KIND, 'compile', '--help'], { stdio: 'ignore' });
64
- return !probe.error && probe.status === 0 ? { file: uip.file, prefix: [...uip.args, 'maestro', KIND] } : undefined;
66
+ return !probe.error && probe.status === 0 ? { via: 'uip', file: uip.file, prefix: [...uip.args, 'maestro', KIND] } : undefined;
65
67
  }
66
68
 
67
69
  // 2. The SDK's flow-sdk bin, where \`npx --no-install flow-sdk\` looked for it.
@@ -78,7 +80,7 @@ function sdkFrontDoor() {
78
80
  const local = bins.map((bin) => join(bin, 'flow-sdk')).find((p) => existsSync(p));
79
81
  sdk = { file: local ?? 'flow-sdk', args: [] };
80
82
  }
81
- return { file: sdk.file, prefix: [...sdk.args, KIND] };
83
+ return { via: 'sdk', file: sdk.file, prefix: [...sdk.args, KIND] };
82
84
  }
83
85
 
84
86
  const frontDoor = uipFrontDoor() ?? sdkFrontDoor();