@uipath/maestro-builder-sdk 6.121.1 → 6.122.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-index.md +97 -97
- package/dist/api-members.md +444 -442
- package/dist/bpmn/bpmn-sdk.d.ts +12 -10
- package/dist/bpmn/bpmn-sdk.js +17 -12
- package/dist/bpmn/connector-lift-verify.js +49 -1
- package/dist/bpmn/data-service.d.ts +75 -31
- package/dist/bpmn/data-service.js +187 -33
- package/dist/bpmn/decompile.js +10 -3
- package/dist/bpmn/serialize.js +18 -8
- package/dist/bpmn-api.md +2 -1
- package/dist/case/case-sdk.d.ts +9 -7
- package/dist/case/case-sdk.js +4 -3
- package/dist/case/check.js +6 -5
- package/dist/case/http-request.js +10 -20
- package/dist/case/reference-mode.d.ts +3 -2
- package/dist/case/serialize.js +13 -2
- package/dist/case/task-output-ref.d.ts +5 -0
- package/dist/case/task-output-ref.js +8 -0
- package/dist/cli/commands/registry.js +3 -1
- package/dist/core/connector-configuration.d.ts +3 -1
- package/dist/core/connector-configuration.js +5 -1
- package/dist/core/connector-v2-metadata.d.ts +5 -1
- package/dist/core/connector-v2-metadata.js +7 -2
- package/dist/core/resource-picker.d.ts +23 -0
- package/dist/core/resource-picker.js +56 -0
- package/dist/core/resource-resolution.d.ts +13 -3
- package/dist/core/resource-resolution.js +19 -4
- package/dist/registry/prepare/resources.d.ts +1 -1
- package/dist/registry/prepare/resources.js +17 -9
- package/dist/registry/prepare-cli.d.ts +2 -0
- package/dist/registry/prepare-cli.js +15 -5
- package/package.json +4 -3
|
@@ -38,6 +38,11 @@ export declare function taskOutputRefs(text: string): Array<TaskOutputRef & {
|
|
|
38
38
|
whole: string;
|
|
39
39
|
index: number;
|
|
40
40
|
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Whether `text` is exactly one marker, optionally followed by property reads
|
|
43
|
+
* (`.field.sub`), with no `=` prefix: a reference once lowered.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isWholeTaskOutputMarker(text: string): boolean;
|
|
41
46
|
/**
|
|
42
47
|
* Replace every marker in `text` with what `lower` returns for it. In a `=js:`
|
|
43
48
|
* expression, a marker followed by a property read gets the optional chain
|
|
@@ -49,6 +49,14 @@ export function taskOutputRefs(text) {
|
|
|
49
49
|
return { stage: arg(1), task: arg(5), output: arg(9), whole: m[0], index: m.index ?? 0 };
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether `text` is exactly one marker, optionally followed by property reads
|
|
54
|
+
* (`.field.sub`), with no `=` prefix: a reference once lowered.
|
|
55
|
+
*/
|
|
56
|
+
export function isWholeTaskOutputMarker(text) {
|
|
57
|
+
const refs = taskOutputRefs(text);
|
|
58
|
+
return refs.length === 1 && refs[0].index === 0 && /^(?:\.[A-Za-z_$][\w$]*)*$/.test(text.slice(refs[0].whole.length));
|
|
59
|
+
}
|
|
52
60
|
/**
|
|
53
61
|
* Replace every marker in `text` with what `lower` returns for it. In a `=js:`
|
|
54
62
|
* expression, a marker followed by a property read gets the optional chain
|
|
@@ -167,6 +167,7 @@ export function registerRegistryCommands(program) {
|
|
|
167
167
|
.option('--kind <kind>', 'a solution resource kind to resolve and record, with --name, e.g. Asset or Queue')
|
|
168
168
|
.option('--name <name>', 'with --kind: the resource name')
|
|
169
169
|
.option('--folder-path <path>', "with --entity or --kind: the Orchestrator folder path the resource lives in, e.g. Shared")
|
|
170
|
+
.option('--folder-key <key>', "with --entity or --kind: the key of the Orchestrator folder the resource lives in, instead of --folder-path")
|
|
170
171
|
.option('--resource-source <source>', 'with --entity or --kind: auto (default), local (this solution) or remote (the tenant)')
|
|
171
172
|
.option('--resources <file>', 'resource ledger to update (default: ./.flow-sdk/resources.json)')
|
|
172
173
|
.option('--refresh-resources', 're-resolve every resource already recorded (a named one is always resolved afresh)')
|
|
@@ -180,7 +181,7 @@ export function registerRegistryCommands(program) {
|
|
|
180
181
|
// Resource-only: nothing to pair with --action.
|
|
181
182
|
if (!resourceMode || options.action !== undefined) {
|
|
182
183
|
refuse('flow-sdk registry prepare: give a <connector-key> with --action, or --entity <name>, or --kind <kind> --name <name> '
|
|
183
|
-
+ '(usage: registry prepare <connector-key> --action <name> | registry prepare --entity <name> [--folder-path <path>] '
|
|
184
|
+
+ '(usage: registry prepare <connector-key> --action <name> | registry prepare --entity <name> [--folder-path <path> | --folder-key <key>] '
|
|
184
185
|
+ '| registry prepare --kind <kind> --name <name> [--folder-path <path>])');
|
|
185
186
|
return;
|
|
186
187
|
}
|
|
@@ -199,6 +200,7 @@ export function registerRegistryCommands(program) {
|
|
|
199
200
|
addValue(argv, '--kind', options.kind);
|
|
200
201
|
addValue(argv, '--name', options.name);
|
|
201
202
|
addValue(argv, '--folder-path', options.folderPath);
|
|
203
|
+
addValue(argv, '--folder-key', options.folderKey);
|
|
202
204
|
addValue(argv, '--resource-source', options.resourceSource);
|
|
203
205
|
addValue(argv, '--resources', options.resources);
|
|
204
206
|
if (options.refreshResources)
|
|
@@ -158,9 +158,11 @@ export declare function wireActivityTypeMatches(libraryActivityType: unknown, wi
|
|
|
158
158
|
* @param inputValues - The authored inputs to replay, keyed by the library's names.
|
|
159
159
|
* @param seed - Seed for the saved filter tree ids.
|
|
160
160
|
* @param executionType - An External Agent / Workflow object's run mode, or `null`.
|
|
161
|
+
* @param resourceSelections - Each solution-resource picker field's resource key
|
|
162
|
+
* (`core/resource-picker.ts`), saved last as `savedResourceSelections`; omitted when none.
|
|
161
163
|
* @returns The essential configuration, with only Studio Web's essential keys.
|
|
162
164
|
*/
|
|
163
|
-
export declare function buildEssentialConfiguration(entry: any, version: string, inputValues?: Record<string, unknown>, seed?: string, executionType?: string | null): Record<string, unknown>;
|
|
165
|
+
export declare function buildEssentialConfiguration(entry: any, version: string, inputValues?: Record<string, unknown>, seed?: string, executionType?: string | null, resourceSelections?: Record<string, string>): Record<string, unknown>;
|
|
164
166
|
/** The operation identity a connector node's configuration envelope records. */
|
|
165
167
|
export interface ConfigurationIdentity {
|
|
166
168
|
/** `instanceParameters.objectName`: the object the operation addresses. */
|
|
@@ -88,6 +88,7 @@ const ESSENTIAL_KEYS = new Set([
|
|
|
88
88
|
'packageVersion',
|
|
89
89
|
'path',
|
|
90
90
|
'unifiedTypesCompatible',
|
|
91
|
+
'savedResourceSelections',
|
|
91
92
|
]);
|
|
92
93
|
/**
|
|
93
94
|
* An input's value by the library's name for it: the flat key (`project`,
|
|
@@ -349,9 +350,11 @@ export function wireActivityTypeMatches(libraryActivityType, wire) {
|
|
|
349
350
|
* @param inputValues - The authored inputs to replay, keyed by the library's names.
|
|
350
351
|
* @param seed - Seed for the saved filter tree ids.
|
|
351
352
|
* @param executionType - An External Agent / Workflow object's run mode, or `null`.
|
|
353
|
+
* @param resourceSelections - Each solution-resource picker field's resource key
|
|
354
|
+
* (`core/resource-picker.ts`), saved last as `savedResourceSelections`; omitted when none.
|
|
352
355
|
* @returns The essential configuration, with only Studio Web's essential keys.
|
|
353
356
|
*/
|
|
354
|
-
export function buildEssentialConfiguration(entry, version, inputValues, seed = 'node', executionType = null) {
|
|
357
|
+
export function buildEssentialConfiguration(entry, version, inputValues, seed = 'node', executionType = null, resourceSelections) {
|
|
355
358
|
const op = entry.operation ?? {};
|
|
356
359
|
const conn = entry.connector ?? {};
|
|
357
360
|
const v1ActivityType = wireActivityType(op.activityType);
|
|
@@ -391,6 +394,7 @@ export function buildEssentialConfiguration(entry, version, inputValues, seed =
|
|
|
391
394
|
subType: op.subType,
|
|
392
395
|
},
|
|
393
396
|
...(op.pathTemplate || op.path ? { path: op.pathTemplate || op.path } : {}),
|
|
397
|
+
...(resourceSelections && Object.keys(resourceSelections).length > 0 ? { savedResourceSelections: resourceSelections } : {}),
|
|
394
398
|
};
|
|
395
399
|
return envelope(composed).essentialConfiguration;
|
|
396
400
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import type { Library, ResolvedConnector } from './library.js';
|
|
17
17
|
import type { buildConnectorInputs } from './connector-inputs.js';
|
|
18
18
|
import { type ReadEventFilter } from './event-filters.js';
|
|
19
|
+
import { type ResourcePickerSelection } from './resource-picker.js';
|
|
19
20
|
/**
|
|
20
21
|
* What the activity metadata reads of a resolved operation. A library entry
|
|
21
22
|
* (`Library.resolve`) is one; an operation the SDK describes itself, such as a
|
|
@@ -43,8 +44,11 @@ export interface ConnectorEventPair {
|
|
|
43
44
|
* `packageVersion: "1.0.0"` (#1420).
|
|
44
45
|
*
|
|
45
46
|
* @param seed - The element id, which seeds the ids inside the configuration.
|
|
47
|
+
* @param pickers - The operation's solution-resource picker selections
|
|
48
|
+
* (`core/resource-picker.ts`): saved in the configuration, and a `bindings` entry
|
|
49
|
+
* each, which `bpmn refresh` reads. The pickers' bindings themselves are the caller's.
|
|
46
50
|
*/
|
|
47
|
-
export declare function connectorActivityMetadata(rc: ConnectorMetadataSource, op: any, slots: ConnectorMetadataSlots, seed: string, executionType?: ConnectorExecutionType, event?: ConnectorEventPair): Record<string, unknown>;
|
|
51
|
+
export declare function connectorActivityMetadata(rc: ConnectorMetadataSource, op: any, slots: ConnectorMetadataSlots, seed: string, executionType?: ConnectorExecutionType, event?: ConnectorEventPair, pickers?: readonly ResourcePickerSelection[]): Record<string, unknown>;
|
|
48
52
|
/**
|
|
49
53
|
* The designer's filter tree for a connector event's filter conditions, or `null`
|
|
50
54
|
* for none: the `essentialConfiguration.filter` the event metadata carries.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { replayInputsOf } from './connector-inputs.js';
|
|
2
2
|
import { buildEssentialConfiguration } from './connector-configuration.js';
|
|
3
3
|
import { eventFilterTreeLeaf } from './event-filters.js';
|
|
4
|
+
import { pickerMetadataBindings, savedResourceSelections } from './resource-picker.js';
|
|
4
5
|
/**
|
|
5
6
|
* The `metadata` of a connector activity: the FUNCTIONAL essentialConfiguration +
|
|
6
7
|
* activityTypeId, and the multipart wire of a multipart operation.
|
|
@@ -13,13 +14,16 @@ import { eventFilterTreeLeaf } from './event-filters.js';
|
|
|
13
14
|
* `packageVersion: "1.0.0"` (#1420).
|
|
14
15
|
*
|
|
15
16
|
* @param seed - The element id, which seeds the ids inside the configuration.
|
|
17
|
+
* @param pickers - The operation's solution-resource picker selections
|
|
18
|
+
* (`core/resource-picker.ts`): saved in the configuration, and a `bindings` entry
|
|
19
|
+
* each, which `bpmn refresh` reads. The pickers' bindings themselves are the caller's.
|
|
16
20
|
*/
|
|
17
|
-
export function connectorActivityMetadata(rc, op, slots, seed, executionType, event) {
|
|
21
|
+
export function connectorActivityMetadata(rc, op, slots, seed, executionType, event, pickers = []) {
|
|
18
22
|
// The part DECLARATIONS only: a file part's value rides on its `file` input.
|
|
19
23
|
const multipartParameters = (slots.multipartParameters ?? []).map(({ name, dataType }) => ({ name, dataType }));
|
|
20
24
|
// The configuration replays the authored values (a schema action's parent
|
|
21
25
|
// fields, a CEQL filter's tree), keyed by the library's own names, as Flow's.
|
|
22
|
-
const essential = buildEssentialConfiguration(rc.entry, rc.version, replayInputsOf(slots), seed, executionType ?? null);
|
|
26
|
+
const essential = buildEssentialConfiguration(rc.entry, rc.version, replayInputsOf(slots), seed, executionType ?? null, savedResourceSelections(pickers));
|
|
23
27
|
const configuration = `=jsonString:${JSON.stringify({ essentialConfiguration: essential })}`;
|
|
24
28
|
const instanceParameters = essential.instanceParameters;
|
|
25
29
|
const objectName = String(op.objectName ?? rc.nodeType.split('.').pop());
|
|
@@ -53,6 +57,7 @@ export function connectorActivityMetadata(rc, op, slots, seed, executionType, ev
|
|
|
53
57
|
objectName,
|
|
54
58
|
objectDisplayName: op.objectDisplayName ?? rc.entry.display?.operationLabel ?? '',
|
|
55
59
|
},
|
|
60
|
+
...(pickers.length > 0 ? { bindings: pickerMetadataBindings(pickers) } : {}),
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** One picker field's selection: the resource it holds, and where the field sits. */
|
|
2
|
+
export interface ResourcePickerSelection {
|
|
3
|
+
/** The id of the element the picker is on, which seeds its `activityIdRef`. */
|
|
4
|
+
elementId: string;
|
|
5
|
+
/** The picker field, e.g. `folderEntityName`. */
|
|
6
|
+
field: string;
|
|
7
|
+
/** The request bucket the field and its companion sit in, as the metadata names it. */
|
|
8
|
+
bucket: 'queryParameters' | 'pathParameters' | 'bodyParameters';
|
|
9
|
+
/** The resource's name, e.g. `SkillPickerEvalEntity`. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** The key of the Orchestrator folder the resource lives in. */
|
|
12
|
+
folderKey: string;
|
|
13
|
+
/** The solution resource key. */
|
|
14
|
+
resourceKey: string;
|
|
15
|
+
}
|
|
16
|
+
/** The binding `resource` an entity picker writes, lower case as the V2 panel writes it. */
|
|
17
|
+
export declare const PICKER_ENTITY_RESOURCE = "entity";
|
|
18
|
+
/** The hidden parameter that carries a picker's folder: `folderEntityName` → `folderEntityName_folderKey`. */
|
|
19
|
+
export declare function pickerFolderField(field: string): string;
|
|
20
|
+
/** `essentialConfiguration.savedResourceSelections`: each picker field's resource key. */
|
|
21
|
+
export declare function savedResourceSelections(selections: readonly ResourcePickerSelection[]): Record<string, string>;
|
|
22
|
+
/** The `metadata.bindings` entries of a node's pickers, one per field. */
|
|
23
|
+
export declare function pickerMetadataBindings(selections: readonly ResourcePickerSelection[]): Record<string, unknown>[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/resource-picker — a connector field that Studio Web's V2 panel fills with a
|
|
3
|
+
* solution-resource picker, as the panel saves it (#849).
|
|
4
|
+
*
|
|
5
|
+
* A picker field (`design.component: "Resources"`, `solutionResourceKind` in the
|
|
6
|
+
* operation's `describe`) holds a resource the solution references. The first kind is
|
|
7
|
+
* a folder-scoped Data Fabric entity, on the connector's `_V3` operations'
|
|
8
|
+
* `folderEntityName`. The panel saves four things for one:
|
|
9
|
+
*
|
|
10
|
+
* - the field and its hidden `<field>_folderKey` companion, as `=bindings.<id>`
|
|
11
|
+
* references to the two bindings below;
|
|
12
|
+
* - two root bindings, `resource="entity"`, keyed by the entity's resource key:
|
|
13
|
+
* `Entity` (`propertyAttribute="name"`, default the name) and `Entity folder`
|
|
14
|
+
* (`folderKey`, default the folder key);
|
|
15
|
+
* - `essentialConfiguration.savedResourceSelections: { <field>: <resource key> }`;
|
|
16
|
+
* - a `bindings` entry in the node's `metadata`, which names the field paths, so
|
|
17
|
+
* `bpmn refresh` writes the entity into `bindings_v2.json` with `Scope: Folder`.
|
|
18
|
+
*
|
|
19
|
+
* Measured with `uip maestro bpmn registry get Intsvc.ActivityExecution --object-name
|
|
20
|
+
* CreateEntityRecord_V3 --input-details … --solution-folder …` (uip 1.207, alpha,
|
|
21
|
+
* 2026-11-13), the design-time client Studio Web runs; the captures are in
|
|
22
|
+
* `tests/fixtures/bpmn/dataservice-folder-v2/`. The panel's `activityIdRef` is a
|
|
23
|
+
* fresh uuid on every save; here it is derived from the element id, so a recompile is
|
|
24
|
+
* byte-identical.
|
|
25
|
+
*/
|
|
26
|
+
import { stableId } from './stable-id.js';
|
|
27
|
+
/** The binding `resource` an entity picker writes, lower case as the V2 panel writes it. */
|
|
28
|
+
export const PICKER_ENTITY_RESOURCE = 'entity';
|
|
29
|
+
/** The hidden parameter that carries a picker's folder: `folderEntityName` → `folderEntityName_folderKey`. */
|
|
30
|
+
export function pickerFolderField(field) {
|
|
31
|
+
return `${field}_folderKey`;
|
|
32
|
+
}
|
|
33
|
+
/** `essentialConfiguration.savedResourceSelections`: each picker field's resource key. */
|
|
34
|
+
export function savedResourceSelections(selections) {
|
|
35
|
+
return Object.fromEntries(selections.map((s) => [s.field, s.resourceKey]));
|
|
36
|
+
}
|
|
37
|
+
/** The `metadata.bindings` entries of a node's pickers, one per field. */
|
|
38
|
+
export function pickerMetadataBindings(selections) {
|
|
39
|
+
return selections.map((s) => ({
|
|
40
|
+
resource: PICKER_ENTITY_RESOURCE,
|
|
41
|
+
key: s.resourceKey,
|
|
42
|
+
activityIdRef: stableId(`${s.elementId}:picker:${s.field}`),
|
|
43
|
+
activityDisplayName: 'connector-activity',
|
|
44
|
+
value: {
|
|
45
|
+
name: { defaultValue: s.name, isExpression: false, displayName: 'Entity' },
|
|
46
|
+
folderKey: { defaultValue: s.folderKey, isExpression: false },
|
|
47
|
+
},
|
|
48
|
+
metadata: {
|
|
49
|
+
ActivityName: 'connector-activity',
|
|
50
|
+
BindingsVersion: '2.2',
|
|
51
|
+
NameFieldPath: `${s.bucket}.${s.field}`,
|
|
52
|
+
Scope: 'Folder',
|
|
53
|
+
FolderFieldPath: `${s.bucket}.${pickerFolderField(s.field)}`,
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
@@ -3,10 +3,12 @@ import type { EntityFieldSchema } from './entity-schema.js';
|
|
|
3
3
|
export declare const ENTITY_KIND = "Entity";
|
|
4
4
|
/**
|
|
5
5
|
* A solution resource by kind and name, and — for one in an Orchestrator
|
|
6
|
-
* folder — that folder's PATH (`Shared`, `Finance/Prod`),
|
|
6
|
+
* folder — that folder's PATH (`Shared`, `Finance/Prod`) or, for a source that
|
|
7
|
+
* already holds it, the folder's KEY.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
* the resource when exactly one matches.
|
|
9
|
+
* Both are optional, and at most one is given: without either `prepare`
|
|
10
|
+
* searches every folder and records the resource when exactly one matches.
|
|
11
|
+
* Writing one pins the answer.
|
|
10
12
|
*/
|
|
11
13
|
export interface ResourceRef {
|
|
12
14
|
/** The catalogue kind, e.g. `'Entity'`, `'Asset'`, `'Queue'` (case-insensitive: `asset` is `Asset`). */
|
|
@@ -15,6 +17,13 @@ export interface ResourceRef {
|
|
|
15
17
|
name: string;
|
|
16
18
|
/** The Orchestrator folder path the resource lives in, e.g. `'Shared'` or `'Finance/Prod'`. */
|
|
17
19
|
folder?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The key of the Orchestrator folder the resource lives in (a GUID), for a
|
|
22
|
+
* source that names the folder by key: BPMN's `.dataService({ entity: { name,
|
|
23
|
+
* folderKey } })`. A name is unique within a folder, so the pair names one
|
|
24
|
+
* resource, and `prepare --folder-key` records its key.
|
|
25
|
+
*/
|
|
26
|
+
folderKey?: string;
|
|
18
27
|
}
|
|
19
28
|
/**
|
|
20
29
|
* A Data Fabric entity by name and folder path: a {@link ResourceRef} of kind
|
|
@@ -118,6 +127,7 @@ export declare function canonicalKind(kind: string): string;
|
|
|
118
127
|
* resourceLedgerKey({ kind: 'Entity', name: 'Orders', folder: 'Finance/Prod' }) // '["Entity","Orders","Finance/Prod"]'
|
|
119
128
|
* resourceLedgerKey({ kind: 'asset', name: 'ApiKey' }) // '["Asset","ApiKey",null]'
|
|
120
129
|
* resourceLedgerKey({ kind: 'StorageBucket', name: 'Inbox' }) // '["storagebucket","Inbox",null]'
|
|
130
|
+
* resourceLedgerKey({ kind: 'Entity', name: 'Orders', folderKey: 'c4359cde-…' }) // '["Entity","Orders",null,"c4359cde-…"]'
|
|
121
131
|
*/
|
|
122
132
|
export declare function resourceLedgerKey(ref: ResourceRef): string;
|
|
123
133
|
/** An {@link EntityRef} as the {@link ResourceRef} it is. */
|
|
@@ -44,10 +44,16 @@ export function canonicalKind(kind) {
|
|
|
44
44
|
* resourceLedgerKey({ kind: 'Entity', name: 'Orders', folder: 'Finance/Prod' }) // '["Entity","Orders","Finance/Prod"]'
|
|
45
45
|
* resourceLedgerKey({ kind: 'asset', name: 'ApiKey' }) // '["Asset","ApiKey",null]'
|
|
46
46
|
* resourceLedgerKey({ kind: 'StorageBucket', name: 'Inbox' }) // '["storagebucket","Inbox",null]'
|
|
47
|
+
* resourceLedgerKey({ kind: 'Entity', name: 'Orders', folderKey: 'c4359cde-…' }) // '["Entity","Orders",null,"c4359cde-…"]'
|
|
47
48
|
*/
|
|
48
49
|
export function resourceLedgerKey(ref) {
|
|
49
50
|
const known = KNOWN_KINDS.get(ref.kind.toLowerCase());
|
|
50
|
-
|
|
51
|
+
const kind = known ?? ref.kind.toLowerCase();
|
|
52
|
+
// A folder named by key keys its own row, a fourth element, so no key a
|
|
53
|
+
// folder-path or folderless reference already recorded changes.
|
|
54
|
+
if (ref.folderKey !== undefined)
|
|
55
|
+
return JSON.stringify([kind, ref.name, null, ref.folderKey]);
|
|
56
|
+
return JSON.stringify([kind, ref.name, ref.folder ?? null]);
|
|
51
57
|
}
|
|
52
58
|
/** An {@link EntityRef} as the {@link ResourceRef} it is. */
|
|
53
59
|
export function entityResource(ref) {
|
|
@@ -101,6 +107,7 @@ export function resourcePrepareCommand(ref) {
|
|
|
101
107
|
cliSpelling(), 'registry', 'prepare',
|
|
102
108
|
...(kind === ENTITY_KIND ? ['--entity', commandArg(ref.name, 'name')] : ['--kind', commandArg(kind, 'kind'), '--name', commandArg(ref.name, 'name')]),
|
|
103
109
|
...(ref.folder !== undefined ? ['--folder-path', commandArg(ref.folder, 'folder path')] : []),
|
|
110
|
+
...(ref.folderKey !== undefined ? ['--folder-key', commandArg(ref.folderKey, 'folder key')] : []),
|
|
104
111
|
].join(' ');
|
|
105
112
|
}
|
|
106
113
|
/** {@link resourcePrepareCommand} for an entity: `registry prepare --entity <name> [--folder-path <path>]`. */
|
|
@@ -166,9 +173,17 @@ export function resourcePlural(kind) {
|
|
|
166
173
|
return `${n}es`;
|
|
167
174
|
return `${n}s`;
|
|
168
175
|
}
|
|
176
|
+
/** ` in folder "Finance/Prod"`, ` in the folder with key "…"`, or nothing: where a reference says its resource lives. */
|
|
177
|
+
function whereText(ref) {
|
|
178
|
+
if (ref.folder !== undefined)
|
|
179
|
+
return ` in folder ${JSON.stringify(ref.folder)}`;
|
|
180
|
+
if (ref.folderKey !== undefined)
|
|
181
|
+
return ` in the folder with key ${JSON.stringify(ref.folderKey)}`;
|
|
182
|
+
return '';
|
|
183
|
+
}
|
|
169
184
|
/** `entity "Orders" in folder "Finance/Prod" is not resolved.` — the shared opening of the diagnostic and the compile refusal. */
|
|
170
185
|
export function resourceUnresolvedMessage(ref) {
|
|
171
|
-
return `${resourceNoun(ref.kind)} ${JSON.stringify(ref.name)}${
|
|
186
|
+
return `${resourceNoun(ref.kind)} ${JSON.stringify(ref.name)}${whereText(ref)} is not resolved.`;
|
|
172
187
|
}
|
|
173
188
|
/**
|
|
174
189
|
* The recorded row for a reference, for `compile` to write from.
|
|
@@ -185,11 +200,11 @@ export function resolveRecordedResource(ref, resolutions, now = Date.now()) {
|
|
|
185
200
|
const old = recordedRow(resolutions, ref);
|
|
186
201
|
const why = old === undefined
|
|
187
202
|
? `${resourceUnresolvedMessage(ref)} Compile does not make network calls, so its keys have to be recorded first:`
|
|
188
|
-
: `${resourceNoun(ref.kind)} ${JSON.stringify(ref.name)}${
|
|
203
|
+
: `${resourceNoun(ref.kind)} ${JSON.stringify(ref.name)}${whereText(ref)} was recorded `
|
|
189
204
|
+ (old.resolvedAt !== undefined ? `at ${old.resolvedAt}, more than 24 hours ago` : 'with no resolvedAt')
|
|
190
205
|
+ ', so its keys may be out of date. Record it again:';
|
|
191
206
|
throw new CompileRefusal('RESOURCE_UNRESOLVED', `${why}\n ${resourcePrepareCommand(ref)}`
|
|
192
|
-
+ (ref.folder === undefined && old === undefined
|
|
207
|
+
+ (ref.folder === undefined && ref.folderKey === undefined && old === undefined
|
|
193
208
|
? `\n No folder given: prepare will search every folder and record the ${resourceNoun(ref.kind)} if exactly one matches; add folder: '<path>' to pin it.`
|
|
194
209
|
: ''));
|
|
195
210
|
}
|
|
@@ -42,7 +42,7 @@ export declare function cliResourceLedger(argv: readonly string[], fallback: str
|
|
|
42
42
|
export declare function readCliResources(argv: readonly string[], fallback: string | undefined): ResourceResolutions | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* Record `row` under the reference the author wrote, and — when they gave no
|
|
45
|
-
* folder and it resolved into one — under the folder it was found in too, so
|
|
45
|
+
* folder, by path or by key, and it resolved into one — under the folder it was found in too, so
|
|
46
46
|
* adding `folder:` to the source later needs no second `prepare`. That second
|
|
47
47
|
* row is marked `aliasOf` the first, and the copy a previous run made for the
|
|
48
48
|
* same reference is dropped, so a resource that moved folders leaves no row
|
|
@@ -119,7 +119,7 @@ export function readCliResources(argv, fallback) {
|
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* Record `row` under the reference the author wrote, and — when they gave no
|
|
122
|
-
* folder and it resolved into one — under the folder it was found in too, so
|
|
122
|
+
* folder, by path or by key, and it resolved into one — under the folder it was found in too, so
|
|
123
123
|
* adding `folder:` to the source later needs no second `prepare`. That second
|
|
124
124
|
* row is marked `aliasOf` the first, and the copy a previous run made for the
|
|
125
125
|
* same reference is dropped, so a resource that moved folders leaves no row
|
|
@@ -135,7 +135,7 @@ export function recordResource(path, ref, row, now = new Date()) {
|
|
|
135
135
|
delete resolved.aliasOf;
|
|
136
136
|
dropAliases(rows, authoredKey);
|
|
137
137
|
rows[authoredKey] = resolved;
|
|
138
|
-
if (ref.folder === undefined && row.folderPath !== null) {
|
|
138
|
+
if (ref.folder === undefined && ref.folderKey === undefined && row.folderPath !== null) {
|
|
139
139
|
const aliasKey = resourceLedgerKey({ kind: row.kind, name: row.name, folder: row.folderPath });
|
|
140
140
|
const existing = Object.hasOwn(rows, aliasKey) ? rows[aliasKey] : undefined;
|
|
141
141
|
if (existing === undefined || existing.aliasOf !== undefined)
|
|
@@ -394,7 +394,13 @@ async function findResource(client, request) {
|
|
|
394
394
|
const pool = [];
|
|
395
395
|
const listings = request.listings;
|
|
396
396
|
const exactName = (c) => c.name === request.name;
|
|
397
|
-
|
|
397
|
+
// The folder the reference pins, by path or by key; `undefined` when it pins none.
|
|
398
|
+
const pinned = request.folder !== undefined
|
|
399
|
+
? `folder ${JSON.stringify(request.folder)}`
|
|
400
|
+
: request.folderKey !== undefined ? `the folder with key ${JSON.stringify(request.folderKey)}` : undefined;
|
|
401
|
+
const inFolder = (c) => request.folder !== undefined
|
|
402
|
+
? c.folderPath !== null && folderPathKey(c.folderPath) === folderPathKey(request.folder)
|
|
403
|
+
: request.folderKey !== undefined && c.folderKey !== null && c.folderKey.toLowerCase() === request.folderKey.toLowerCase();
|
|
398
404
|
const summary = (rows, matching) => rows.length === 0 ? `no ${resourcePlural(kind)}` : `${rows.length} result(s), ${matching} named exactly ${JSON.stringify(request.name)}`;
|
|
399
405
|
// 1. The catalogue: the tenant's folder-scoped resources, and inside a
|
|
400
406
|
// solution the solution's own. Remote is read even for `local`, to tell a
|
|
@@ -418,7 +424,7 @@ async function findResource(client, request) {
|
|
|
418
424
|
"Run prepare from inside the solution, or leave --resource-source out.", "RESOURCE_LISTING_FAILED");
|
|
419
425
|
}
|
|
420
426
|
const exact = [...(mode === "local" ? [] : remote), ...local].filter(exactName);
|
|
421
|
-
const settled =
|
|
427
|
+
const settled = pinned !== undefined && exact.filter(inFolder).length === 1;
|
|
422
428
|
// 2. For an entity, the tenant-level list: an entity the catalogue cannot
|
|
423
429
|
// hold. Not needed once the requested folder has its one match, nor for a
|
|
424
430
|
// solution-only search; a row with no `FolderId` is not known to be
|
|
@@ -444,16 +450,16 @@ async function findResource(client, request) {
|
|
|
444
450
|
pool.push(...tenantRows);
|
|
445
451
|
}
|
|
446
452
|
const all = [...exact, ...tenantExact];
|
|
447
|
-
if (
|
|
453
|
+
if (pinned !== undefined) {
|
|
448
454
|
const matches = exact.filter(inFolder);
|
|
449
455
|
if (matches.length === 1)
|
|
450
456
|
return resolved(matches[0]);
|
|
451
457
|
if (matches.length > 1) {
|
|
452
|
-
throw new Refusal(`${matches.length} ${resourcePlural(kind)} named ${JSON.stringify(request.name)} are in
|
|
458
|
+
throw new Refusal(`${matches.length} ${resourcePlural(kind)} named ${JSON.stringify(request.name)} are in ${pinned}; refusing to pick one:\n` +
|
|
453
459
|
matches.map(candidateLine).join("\n") + `\n${searchedBlock(searched)}`, "RESOURCE_AMBIGUOUS");
|
|
454
460
|
}
|
|
455
461
|
if (all.length > 0) {
|
|
456
|
-
throw new Refusal(`no ${resourceNoun(kind)} named ${JSON.stringify(request.name)} in
|
|
462
|
+
throw new Refusal(`no ${resourceNoun(kind)} named ${JSON.stringify(request.name)} in ${pinned}. It exists in:\n` +
|
|
457
463
|
all.map(candidateLine).join("\n") +
|
|
458
464
|
`\n${searchedBlock(searched)}\n` +
|
|
459
465
|
"Change the source to the spelling of the one meant and run its prepare.", "RESOURCE_NOT_IN_FOLDER");
|
|
@@ -490,7 +496,7 @@ async function findResource(client, request) {
|
|
|
490
496
|
const unique = [...new Map(pool.map((c) => [`${c.name}\u0000${where(c)}`, c])).values()];
|
|
491
497
|
const near = nearMisses(request.name, unique);
|
|
492
498
|
throw new Refusal(`no ${resourceNoun(kind)} named ${JSON.stringify(request.name)}` +
|
|
493
|
-
(
|
|
499
|
+
(pinned !== undefined ? ` in ${pinned}` : "") +
|
|
494
500
|
" (a match is exact, case included).\n" +
|
|
495
501
|
`${searchedBlock(searched)}\n` +
|
|
496
502
|
(near.length > 0 ? `Near misses:\n${near.map(candidateLine).join("\n")}\n` : "") +
|
|
@@ -522,7 +528,9 @@ export function recordedLines(row, ledger) {
|
|
|
522
528
|
*/
|
|
523
529
|
export function recordedRefs(resolutions) {
|
|
524
530
|
return Object.keys(resolutions).filter((key) => resolutions[key].aliasOf === undefined).map((key) => {
|
|
525
|
-
const [kind, name, folder] = JSON.parse(key);
|
|
531
|
+
const [kind, name, folder, folderKey] = JSON.parse(key);
|
|
532
|
+
if (folderKey !== undefined)
|
|
533
|
+
return { kind, name, folderKey };
|
|
526
534
|
return folder === null ? { kind, name } : { kind, name, folder };
|
|
527
535
|
});
|
|
528
536
|
}
|
|
@@ -36,6 +36,8 @@ export interface PrepareConnectorOptions {
|
|
|
36
36
|
name?: string;
|
|
37
37
|
/** `--folder-path`: the resource's Orchestrator folder path. */
|
|
38
38
|
folder?: string;
|
|
39
|
+
/** `--folder-key`: the resource's Orchestrator folder key, for a source that names the folder by key. */
|
|
40
|
+
folderKey?: string;
|
|
39
41
|
/** `--resource-source`: which listings to consult. Default `auto`. */
|
|
40
42
|
resourceSource?: ResourceSource;
|
|
41
43
|
/** `--resources`: the resource ledger. Default `.flow-sdk/resources.json`. */
|
|
@@ -22,7 +22,7 @@ import { defaultUipClient } from "./uip/client.js";
|
|
|
22
22
|
const DEFAULT_CONNECTOR_IMPORT = PACKAGE_NAME;
|
|
23
23
|
const USAGE = [
|
|
24
24
|
"Usage: flow-sdk registry prepare --entity <name> | --kind <kind> --name <name>",
|
|
25
|
-
" [--folder-path <path>] [--resource-source auto|local|remote]",
|
|
25
|
+
" [--folder-path <path> | --folder-key <key>] [--resource-source auto|local|remote]",
|
|
26
26
|
" [--resources <file>] [--refresh-resources]",
|
|
27
27
|
" flow-sdk registry prepare <connector-key> --action <name> [--entity <name> [--folder-path <path>]]",
|
|
28
28
|
" [--connection-id <id>]",
|
|
@@ -162,6 +162,7 @@ export function parseArgs(argv) {
|
|
|
162
162
|
"--kind",
|
|
163
163
|
"--name",
|
|
164
164
|
"--folder-path",
|
|
165
|
+
"--folder-key",
|
|
165
166
|
"--resource-source",
|
|
166
167
|
"--resources",
|
|
167
168
|
]) {
|
|
@@ -196,8 +197,14 @@ export function parseArgs(argv) {
|
|
|
196
197
|
console.error(`argument ${argv.includes("--kind") ? "--kind" : "--name"}: needs ${argv.includes("--kind") ? "--name" : "--kind"}`);
|
|
197
198
|
return null;
|
|
198
199
|
}
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
for (const flag of ["--folder-path", "--folder-key"]) {
|
|
201
|
+
if (argv.includes(flag) && !named) {
|
|
202
|
+
console.error(`argument ${flag}: only with --entity or --kind/--name`);
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (argv.includes("--folder-path") && argv.includes("--folder-key")) {
|
|
207
|
+
console.error("argument --folder-key: not allowed with --folder-path (name the folder one way)");
|
|
201
208
|
return null;
|
|
202
209
|
}
|
|
203
210
|
const resourceSource = value(argv, "--resource-source");
|
|
@@ -221,6 +228,7 @@ export function parseArgs(argv) {
|
|
|
221
228
|
kind: value(argv, "--kind"),
|
|
222
229
|
name: value(argv, "--name"),
|
|
223
230
|
folder: value(argv, "--folder-path"),
|
|
231
|
+
folderKey: value(argv, "--folder-key"),
|
|
224
232
|
resourceSource: resourceSource,
|
|
225
233
|
resources: value(argv, "--resources"),
|
|
226
234
|
refreshResources: argv.includes("--refresh-resources"),
|
|
@@ -286,7 +294,9 @@ export async function run(argv) {
|
|
|
286
294
|
}
|
|
287
295
|
/** The one reference `--entity` or `--kind`/`--name` names, or `undefined`. */
|
|
288
296
|
function requestedRef(options) {
|
|
289
|
-
const folder = options.folder !== undefined
|
|
297
|
+
const folder = options.folder !== undefined
|
|
298
|
+
? { folder: options.folder }
|
|
299
|
+
: options.folderKey !== undefined ? { folderKey: options.folderKey } : {};
|
|
290
300
|
if (options.entity !== undefined)
|
|
291
301
|
return { kind: ENTITY_KIND, name: options.entity, ...folder };
|
|
292
302
|
if (options.kind !== undefined && options.name !== undefined)
|
|
@@ -379,7 +389,7 @@ export async function prepareResources(options, ports) {
|
|
|
379
389
|
}
|
|
380
390
|
if (refused.length > 0) {
|
|
381
391
|
throw new Refusal(`${refused.length} of ${refs.length} recorded reference(s) no longer resolve; their rows are removed, so check reports them:\n`
|
|
382
|
-
+ refused.map(({ ref, error }) => `- ${ref.kind} ${JSON.stringify(ref.name)}${ref.folder !== undefined ? ` in ${JSON.stringify(ref.folder)}` : ""} [${error.code}]: ${error.message}`).join("\n"), "RESOURCE_REFRESH_FAILED");
|
|
392
|
+
+ refused.map(({ ref, error }) => `- ${ref.kind} ${JSON.stringify(ref.name)}${ref.folder !== undefined ? ` in ${JSON.stringify(ref.folder)}` : ref.folderKey !== undefined ? ` in folder key ${JSON.stringify(ref.folderKey)}` : ""} [${error.code}]: ${error.message}`).join("\n"), "RESOURCE_REFRESH_FAILED");
|
|
383
393
|
}
|
|
384
394
|
return recorded;
|
|
385
395
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.122.1",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
"flow-script-metadata",
|
|
88
88
|
"flow-pipeline-strict",
|
|
89
89
|
"flow-build",
|
|
90
|
-
"case-check-baseline"
|
|
90
|
+
"case-check-baseline",
|
|
91
|
+
"prepare-folder-key"
|
|
91
92
|
],
|
|
92
93
|
"files": [
|
|
93
94
|
"dist",
|
|
@@ -125,5 +126,5 @@
|
|
|
125
126
|
"@types/node": "^22.7.0",
|
|
126
127
|
"esbuild": "^0.28.1"
|
|
127
128
|
},
|
|
128
|
-
"gitref": "
|
|
129
|
+
"gitref": "f1a04d082c7c66dcbeb02f765d70d4ce08336845"
|
|
129
130
|
}
|