@uipath/maestro-builder-sdk 6.123.0 → 6.124.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/README.md +2 -1
- package/dist/case/connector-saved-context.d.ts +12 -0
- package/dist/case/connector-saved-context.js +31 -2
- package/dist/case/connector-saved-rows.js +11 -6
- package/dist/case/decompile.js +8 -0
- package/dist/case/subscription.d.ts +6 -1
- package/dist/case/subscription.js +13 -3
- package/dist/cli/commands/registry.js +2 -0
- package/dist/registry/search-cli.d.ts +15 -0
- package/dist/registry/search-cli.js +110 -7
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -224,7 +224,8 @@ result itself (`registry search`, `registry path`, `bpmn check --graph`) prints
|
|
|
224
224
|
only as that object under `--json`, never a second copy on stderr. `package.json` lists the optional
|
|
225
225
|
surface a caller may probe for in `cliCapabilities` (`json-result`; `fetch-definitions` when a
|
|
226
226
|
connector definition no library carries is fetched through `uip`, so no library has to be pulled;
|
|
227
|
-
`flow-build` when the SDK has `flow build`
|
|
227
|
+
`flow-build` when the SDK has `flow build`; `search-activity-type-id` when `registry search` takes
|
|
228
|
+
`--activity-type-id`).
|
|
228
229
|
`flow-sdk capabilities` prints that list with the installed version (`--json` for one
|
|
229
230
|
object), and `flowSdk.minVersion` in a project's `package.json` makes the `flow`, `case`
|
|
230
231
|
and `bpmn` verbs refuse an older SDK (`website/reference/CLI-LOOP.md`).
|
|
@@ -28,7 +28,19 @@ export interface RebuiltConnectorElement {
|
|
|
28
28
|
metadata?: Record<string, unknown>;
|
|
29
29
|
containers?: Record<string, unknown>;
|
|
30
30
|
responseSchema?: unknown;
|
|
31
|
+
/** An event's parameter names the library puts in the event bucket (the rest are query or path). */
|
|
32
|
+
eventParameters?: ReadonlySet<string>;
|
|
31
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* An event subscription's input values with its `where` read as the source
|
|
36
|
+
* holds it: `body.queryParams` and `body.parameters` merged into one `where`.
|
|
37
|
+
* Which slot a parameter sits in is the connector's bucket split, which the
|
|
38
|
+
* source cannot write: a Data Fabric trigger Studio Web saved with
|
|
39
|
+
* `queryParams: { entityScope, tenantEntityName }` holds the same values as
|
|
40
|
+
* the `parameters: { entityScope, tenantEntityName }` compile writes (#1645).
|
|
41
|
+
* A body that names one parameter in both slots is left as it is.
|
|
42
|
+
*/
|
|
43
|
+
export declare function subscriptionValues(values: Record<string, unknown>): Record<string, unknown>;
|
|
32
44
|
/**
|
|
33
45
|
* Which kind of connector element a bag belongs to, which decides how its
|
|
34
46
|
* inputs compare: an activity's field by field across its containers
|
|
@@ -81,6 +81,34 @@ function isEmptyInput(value) {
|
|
|
81
81
|
|| (Array.isArray(value) && value.length === 0) || (isObject(value) && Object.keys(value).length === 0);
|
|
82
82
|
}
|
|
83
83
|
const EVENT_SERVICE_TYPES = new Set(['Intsvc.EventTrigger', 'Intsvc.WaitForEvent']);
|
|
84
|
+
/**
|
|
85
|
+
* An event subscription's input values with its `where` read as the source
|
|
86
|
+
* holds it: `body.queryParams` and `body.parameters` merged into one `where`.
|
|
87
|
+
* Which slot a parameter sits in is the connector's bucket split, which the
|
|
88
|
+
* source cannot write: a Data Fabric trigger Studio Web saved with
|
|
89
|
+
* `queryParams: { entityScope, tenantEntityName }` holds the same values as
|
|
90
|
+
* the `parameters: { entityScope, tenantEntityName }` compile writes (#1645).
|
|
91
|
+
* A body that names one parameter in both slots is left as it is.
|
|
92
|
+
*/
|
|
93
|
+
export function subscriptionValues(values) {
|
|
94
|
+
const body = values.body;
|
|
95
|
+
if (!isObject(body) || (body.queryParams === undefined && body.parameters === undefined))
|
|
96
|
+
return values;
|
|
97
|
+
const slots = [body.queryParams, body.parameters].filter((slot) => slot !== undefined);
|
|
98
|
+
if (!slots.every(isObject))
|
|
99
|
+
return values;
|
|
100
|
+
const where = {};
|
|
101
|
+
for (const slot of slots)
|
|
102
|
+
for (const [name, value] of Object.entries(slot)) {
|
|
103
|
+
if (name in where)
|
|
104
|
+
return values;
|
|
105
|
+
where[name] = value;
|
|
106
|
+
}
|
|
107
|
+
const rest = { ...body };
|
|
108
|
+
delete rest.queryParams;
|
|
109
|
+
delete rest.parameters;
|
|
110
|
+
return { ...values, body: { ...rest, where } };
|
|
111
|
+
}
|
|
84
112
|
/**
|
|
85
113
|
* Which kind of connector element a bag belongs to, which decides how its
|
|
86
114
|
* inputs compare: an activity's field by field across its containers
|
|
@@ -171,9 +199,10 @@ export function onlyLibraryValuesDiffer(built, saved, opaque = NO_DATA) {
|
|
|
171
199
|
/** Whether two input value maps hold the same values, an input on one side only reading as empty. */
|
|
172
200
|
function sameInputs(a, b, kind) {
|
|
173
201
|
const [now, then] = kind === ConnectorKind.Activity ? [activityFieldValues(a), activityFieldValues(b)] : [undefined, undefined];
|
|
202
|
+
const [x, y] = kind === ConnectorKind.Event ? [subscriptionValues(a), subscriptionValues(b)] : [a, b];
|
|
174
203
|
const pairs = now && then
|
|
175
204
|
? [...new Set([...now.keys(), ...then.keys()])].map((key) => [now.get(key), then.get(key)])
|
|
176
|
-
: [...new Set([...Object.keys(
|
|
205
|
+
: [...new Set([...Object.keys(x), ...Object.keys(y)])].map((key) => [x[key], y[key]]);
|
|
177
206
|
return pairs.every(([x, y]) => (isEmptyInput(x) && isEmptyInput(y)) || stable(x) === stable(y));
|
|
178
207
|
}
|
|
179
208
|
/**
|
|
@@ -308,7 +337,7 @@ export function savedConnectorContext(owner, bag, rebuild) {
|
|
|
308
337
|
const inputs = inputValues(bag);
|
|
309
338
|
// A subscription body saved with no match expression compares as compile writes it.
|
|
310
339
|
if (EVENT_SERVICE_TYPES.has(bag.serviceType) && inputs.body !== undefined)
|
|
311
|
-
inputs.body = withScopeExpression(inputs.body, owner);
|
|
340
|
+
inputs.body = withScopeExpression(inputs.body, owner, rebuilt?.eventParameters);
|
|
312
341
|
else if (rebuilt?.containers)
|
|
313
342
|
Object.assign(inputs, structuredClone(rebuilt.containers));
|
|
314
343
|
return { owner, context: structuredClone(context), inputs };
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
* the same operation. An extract the author edits (another source or
|
|
61
61
|
* variable) gets compile's row.
|
|
62
62
|
*/
|
|
63
|
-
import { activityFieldValues, comparesContextRow, ConnectorKind, connectorKind, onlyLibraryValuesDiffer } from './connector-saved-context.js';
|
|
63
|
+
import { activityFieldValues, comparesContextRow, ConnectorKind, connectorKind, onlyLibraryValuesDiffer, subscriptionValues } from './connector-saved-context.js';
|
|
64
64
|
import { caseSubscriptionOwners, withScopeExpression } from './subscription.js';
|
|
65
65
|
/** Two input values that hold the same thing: both empty, or equal with key order not counting. */
|
|
66
66
|
function sameInput(a, b) {
|
|
@@ -252,7 +252,7 @@ function savedInputs(bag, activity, elementIds, owner, rebuilt) {
|
|
|
252
252
|
// A subscription body saved with no match expression is carried as compile
|
|
253
253
|
// writes it (`withScopeExpression`): the engine needs the expression.
|
|
254
254
|
const carried = structuredClone(rows).map((row) => (!activity && row.name === 'body' && row.body !== undefined
|
|
255
|
-
? { ...row, body: withScopeExpression(row.body, owner) } : row));
|
|
255
|
+
? { ...row, body: withScopeExpression(row.body, owner, rebuilt?.eventParameters) } : row));
|
|
256
256
|
return { rows: carried, ...(bag.inputs === undefined ? { absent: true } : {}) };
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
@@ -468,10 +468,15 @@ function inputsBack(built, set, kind) {
|
|
|
468
468
|
return structuredClone(set.rows);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
const
|
|
471
|
+
// An event's `where` is compared as the source holds it, whatever slot
|
|
472
|
+
// (`queryParams`, `parameters`) each parameter was saved in (`subscriptionValues`).
|
|
473
|
+
const values = (rows) => {
|
|
474
|
+
const named = Object.fromEntries(rows.map((row) => [String(row.name), inputValue(row)]));
|
|
475
|
+
return kind === ConnectorKind.Event ? subscriptionValues(named) : named;
|
|
476
|
+
};
|
|
477
|
+
const [builtValues, savedValues] = [values(built), values(set.rows)];
|
|
478
|
+
for (const name of new Set([...Object.keys(builtValues), ...Object.keys(savedValues)])) {
|
|
479
|
+
const [a, b] = [builtValues[name], savedValues[name]];
|
|
475
480
|
if (isEmpty(a) && isEmpty(b))
|
|
476
481
|
continue;
|
|
477
482
|
if (stable(a) !== stable(b))
|
package/dist/case/decompile.js
CHANGED
|
@@ -12,6 +12,7 @@ import { caseConnectorOwners, savedConnectorContext } from './connector-saved-co
|
|
|
12
12
|
import { connectorActivityMetadata, connectorEventMetadata } from '../core/connector-v2-metadata.js';
|
|
13
13
|
import { buildConnectorInputs, nestConnectorBody } from '../core/connector-inputs.js';
|
|
14
14
|
import { responseJsonSchema } from '../core/connector-response-schema.js';
|
|
15
|
+
import { splitEventParameters } from '../core/event-subscription.js';
|
|
15
16
|
import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
|
|
16
17
|
import { elementConfigV2Owners } from './intsvc-activity-config.js';
|
|
17
18
|
import { caseConnectorRowOwners, savedConnectorRows } from './connector-saved-rows.js';
|
|
@@ -325,6 +326,9 @@ function subscriptionBody(bag, owner) {
|
|
|
325
326
|
* A plan with no `parameters` reads back: it is what the SDK wrote before it
|
|
326
327
|
* split the `where` (all of it in `queryParams`), and recompiling moves a
|
|
327
328
|
* query- or path-bucket parameter to `parameters`, where the engine reads it.
|
|
329
|
+
* A Studio Web save in that shape keeps its split while the element is
|
|
330
|
+
* unedited: its rows and context come back as saved (`subscriptionValues` in
|
|
331
|
+
* connector-saved-context.ts reads the two slots as one `where`).
|
|
328
332
|
*/
|
|
329
333
|
function checkSubscriptionSlots(body, rc, owner) {
|
|
330
334
|
if (body.slots?.parameters === undefined)
|
|
@@ -3030,9 +3034,13 @@ function rebuiltConnectorElement(library, owner, bag, seed) {
|
|
|
3030
3034
|
version: configuration?.essentialConfiguration?.packageVersion,
|
|
3031
3035
|
});
|
|
3032
3036
|
const rc = library.resolveEvent(kind, identity.key, identity.event, identity.version, identity.object);
|
|
3037
|
+
// The saved `where`, whatever slot each parameter sits in, split by the library's buckets.
|
|
3038
|
+
const body = (Array.isArray(bag.inputs) ? bag.inputs : []).find((row) => row?.name === 'body')?.body;
|
|
3039
|
+
const where = { ...(body?.queryParams ?? {}), ...(body?.parameters ?? {}) };
|
|
3033
3040
|
return {
|
|
3034
3041
|
metadata: connectorEventMetadata(rc, rc.entry.operation ?? {}, configuration?.essentialConfiguration?.filter ?? null),
|
|
3035
3042
|
responseSchema: responseSchema(rc),
|
|
3043
|
+
eventParameters: new Set(Object.keys(splitEventParameters(rc, where).eventParameters)),
|
|
3036
3044
|
};
|
|
3037
3045
|
}
|
|
3038
3046
|
const identity = library.identifyAction({
|
|
@@ -126,11 +126,16 @@ export declare function caseSubscriptionBody(rc: ResolvedConnector, where: Recor
|
|
|
126
126
|
* way, so the added expression is not read as an edit that drops the element's
|
|
127
127
|
* saved context and rows.
|
|
128
128
|
*
|
|
129
|
+
* `eventParameters`, when decompile knows them from the library, are the
|
|
130
|
+
* names the connector puts in the event bucket; only those give a clause. A
|
|
131
|
+
* Data Fabric trigger saved with its query-bucket `entityScope` in
|
|
132
|
+
* `queryParams` gets no expression, as compile writes none for it.
|
|
133
|
+
*
|
|
129
134
|
* @example
|
|
130
135
|
* // { queryParams: { entityScope: 'tenant' } }
|
|
131
136
|
* // -> { filters: { expression: "(entityScope == 'tenant')" }, queryParams: { entityScope: 'tenant' } }
|
|
132
137
|
*/
|
|
133
|
-
export declare function withScopeExpression(body: unknown, owner: string): unknown;
|
|
138
|
+
export declare function withScopeExpression(body: unknown, owner: string, eventParameters?: ReadonlySet<string>): unknown;
|
|
134
139
|
/** One subscription in a Case plan: the bag that carries it, keyed by its owner. */
|
|
135
140
|
export interface CaseSubscriptionOwner {
|
|
136
141
|
/** `trigger:<node id>`, `task:<stage id>:<task id>` or `rule:<stage id>:<rule id>`. */
|
|
@@ -203,17 +203,27 @@ export function caseSubscriptionBody(rc, where, conditions, elementId, spelling
|
|
|
203
203
|
* way, so the added expression is not read as an edit that drops the element's
|
|
204
204
|
* saved context and rows.
|
|
205
205
|
*
|
|
206
|
+
* `eventParameters`, when decompile knows them from the library, are the
|
|
207
|
+
* names the connector puts in the event bucket; only those give a clause. A
|
|
208
|
+
* Data Fabric trigger saved with its query-bucket `entityScope` in
|
|
209
|
+
* `queryParams` gets no expression, as compile writes none for it.
|
|
210
|
+
*
|
|
206
211
|
* @example
|
|
207
212
|
* // { queryParams: { entityScope: 'tenant' } }
|
|
208
213
|
* // -> { filters: { expression: "(entityScope == 'tenant')" }, queryParams: { entityScope: 'tenant' } }
|
|
209
214
|
*/
|
|
210
|
-
export function withScopeExpression(body, owner) {
|
|
215
|
+
export function withScopeExpression(body, owner, eventParameters) {
|
|
211
216
|
if (!body || typeof body !== 'object' || Array.isArray(body))
|
|
212
217
|
return body;
|
|
213
218
|
const saved = body;
|
|
214
|
-
const
|
|
215
|
-
if (saved.filters !== undefined || !
|
|
219
|
+
const savedParams = saved.queryParams;
|
|
220
|
+
if (saved.filters !== undefined || !savedParams || typeof savedParams !== 'object' || Array.isArray(savedParams))
|
|
216
221
|
return body;
|
|
222
|
+
// Only the event-bucket parameters fold into the expression: a query- or
|
|
223
|
+
// path-bucket one is no scope clause compile writes (`caseSubscriptionBody`).
|
|
224
|
+
const params = eventParameters
|
|
225
|
+
? Object.fromEntries(Object.entries(savedParams).filter(([name]) => eventParameters.has(name)))
|
|
226
|
+
: savedParams;
|
|
217
227
|
let expression;
|
|
218
228
|
try {
|
|
219
229
|
expression = eventMatchExpression(eventScopeClauses(params, owner).map((c) => `(${c})`), []);
|
|
@@ -260,12 +260,14 @@ export function registerRegistryCommands(program) {
|
|
|
260
260
|
.option('--library <dir>', 'extracted library-json directory (default: the cached one)')
|
|
261
261
|
.option('--library-md <dir>', 'markdown tree (defaults to a library-md sibling)')
|
|
262
262
|
.option('--connector <key>', 'restrict to one connector key')
|
|
263
|
+
.option('--activity-type-id <id>', 'only the operation with this activity type id (the id an SDD or a saved plan names it by); needs a pulled library')
|
|
263
264
|
.option('--limit <n>', 'maximum results to print')
|
|
264
265
|
.action(async (query, options) => {
|
|
265
266
|
const argv = [...query];
|
|
266
267
|
addValue(argv, '--library', options.library);
|
|
267
268
|
addValue(argv, '--library-md', options.libraryMd);
|
|
268
269
|
addValue(argv, '--connector', options.connector);
|
|
270
|
+
addValue(argv, '--activity-type-id', options.activityTypeId);
|
|
269
271
|
addValue(argv, '--limit', options.limit);
|
|
270
272
|
await invoke('registry search', () => import('../../registry/search-cli.js'), argv);
|
|
271
273
|
});
|
|
@@ -26,6 +26,8 @@ export interface RegistryOperation {
|
|
|
26
26
|
definitionPath: string;
|
|
27
27
|
/** Markdown page describing the operation's fields, when one was found. */
|
|
28
28
|
markdownPath?: string;
|
|
29
|
+
/** The operation's `uiPathActivityTypeId`, on a search by `--activity-type-id`. */
|
|
30
|
+
activityTypeId?: string;
|
|
29
31
|
}
|
|
30
32
|
export interface RegistrySearchOptions {
|
|
31
33
|
libraryPath: string;
|
|
@@ -33,6 +35,13 @@ export interface RegistrySearchOptions {
|
|
|
33
35
|
query?: string;
|
|
34
36
|
connector?: string;
|
|
35
37
|
limit?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Keep only the operations whose definition carries this `uiPathActivityTypeId`,
|
|
40
|
+
* the id an SDD or a saved plan names an operation by. The index rows do not
|
|
41
|
+
* carry it, so each candidate's `.v1def.json` is read: pass `connector` too
|
|
42
|
+
* and only that connector's definitions are.
|
|
43
|
+
*/
|
|
44
|
+
activityTypeId?: string;
|
|
36
45
|
}
|
|
37
46
|
export interface RegistrySearchResult {
|
|
38
47
|
total: number;
|
|
@@ -49,6 +58,12 @@ export interface RegistrySearchResult {
|
|
|
49
58
|
* tenant's whole catalog, however few rows it has.
|
|
50
59
|
*/
|
|
51
60
|
warning?: string;
|
|
61
|
+
/**
|
|
62
|
+
* On a search by `--activity-type-id`: how many of the rows it had to check
|
|
63
|
+
* have no definition file in the library, so their id is unknown. Above 0 the
|
|
64
|
+
* answer is incomplete, and no match is not evidence the operation is absent.
|
|
65
|
+
*/
|
|
66
|
+
unreadDefinitions?: number;
|
|
52
67
|
}
|
|
53
68
|
export declare const DEFAULT_SEARCH_LIMIT = 20;
|
|
54
69
|
/**
|
|
@@ -2,7 +2,7 @@ import { printResult, reportResult } from '../cli-result.js';
|
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
3
|
import { PULL_COMMAND } from "../core/cli-spelling.js";
|
|
4
4
|
import { resolveLibraryDir } from "../core/library-cache.js";
|
|
5
|
-
import { defaultReadText } from "../core/read-text.js";
|
|
5
|
+
import { defaultReadText, libraryPath } from "../core/read-text.js";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import { catalogConnectorKey } from "./library-build/canonical.js";
|
|
8
8
|
import { fetchDefinitionsEnabled, uipUnavailableReason } from "./fetch/fetch-definitions.js";
|
|
@@ -10,7 +10,39 @@ import { defaultUipClient } from "./uip/client.js";
|
|
|
10
10
|
import { registrySearchConnectors } from "./uip/commands.js";
|
|
11
11
|
import { failureReason, getCI, isSuccess, parseEnvelope, tail } from "./uip/envelope.js";
|
|
12
12
|
export const DEFAULT_SEARCH_LIMIT = 20;
|
|
13
|
-
const USAGE = "Usage: flow-sdk registry search [query] [--library <dir>] [--library-md <dir>] [--connector <key>] [--limit <n>]";
|
|
13
|
+
const USAGE = "Usage: flow-sdk registry search [query] [--library <dir>] [--library-md <dir>] [--connector <key>] [--activity-type-id <id>] [--limit <n>]";
|
|
14
|
+
const ACTIVITY_TYPE_ID = /^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i;
|
|
15
|
+
const ACTIVITY_TYPE_ID_IN_DEFINITION = /"uiPathActivityTypeId"\s*:\s*"([^"]+)"/g;
|
|
16
|
+
/** The definition file beside an index row's entry file. */
|
|
17
|
+
function definitionRelative(entryPath) {
|
|
18
|
+
return entryPath.replace(/\.json$/, ".v1def.json");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Whether the definition at `path` is the operation `activityTypeId` names, or
|
|
22
|
+
* `undefined` when the library has no file there. A definition repeats its id
|
|
23
|
+
* in each place the canvas reads it from, so any occurrence counts.
|
|
24
|
+
*
|
|
25
|
+
* A reader that throws is not caught: a definition that could not be read
|
|
26
|
+
* might be the one asked for, so the search fails rather than answering
|
|
27
|
+
* "no such operation" from the rows it could read.
|
|
28
|
+
*/
|
|
29
|
+
function definitionHasActivityTypeId(path, activityTypeId) {
|
|
30
|
+
let content;
|
|
31
|
+
try {
|
|
32
|
+
content = defaultReadText()(path);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new Error(`Could not read ${path}, so the search by activity type id is not complete: ` +
|
|
36
|
+
`${error instanceof Error ? error.message : String(error)}`);
|
|
37
|
+
}
|
|
38
|
+
if (content === undefined)
|
|
39
|
+
return undefined;
|
|
40
|
+
for (const found of content.matchAll(ACTIVITY_TYPE_ID_IN_DEFINITION)) {
|
|
41
|
+
if (found[1]?.toLowerCase() === activityTypeId)
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
14
46
|
function text(value) {
|
|
15
47
|
return typeof value === "string" ? value : "";
|
|
16
48
|
}
|
|
@@ -77,7 +109,8 @@ export async function searchRegistryOperations(options) {
|
|
|
77
109
|
}
|
|
78
110
|
const tokens = queryTokens(options.query);
|
|
79
111
|
const connector = options.connector?.trim().toLowerCase();
|
|
80
|
-
const
|
|
112
|
+
const activityTypeId = options.activityTypeId?.trim().toLowerCase() || undefined;
|
|
113
|
+
const named = parsed.entries.filter((entry) => {
|
|
81
114
|
const key = text(entry.connectorKey).toLowerCase();
|
|
82
115
|
if (connector && key !== connector)
|
|
83
116
|
return false;
|
|
@@ -99,8 +132,23 @@ export async function searchRegistryOperations(options) {
|
|
|
99
132
|
.toLowerCase();
|
|
100
133
|
return tokens.every((token) => haystack.includes(token));
|
|
101
134
|
});
|
|
135
|
+
// After the cheap filters, so `--connector` bounds how many definitions are read.
|
|
136
|
+
const unread = [];
|
|
137
|
+
const matches = activityTypeId === undefined
|
|
138
|
+
? named
|
|
139
|
+
: named.filter((entry) => {
|
|
140
|
+
// `/`-joined, as the library reads its own files: a host reader serves index paths, not the platform's.
|
|
141
|
+
const path = libraryPath(options.libraryPath, definitionRelative(text(entry.path)));
|
|
142
|
+
const has = definitionHasActivityTypeId(path, activityTypeId);
|
|
143
|
+
if (has === undefined)
|
|
144
|
+
unread.push(path);
|
|
145
|
+
return has === true;
|
|
146
|
+
});
|
|
102
147
|
const markdownRoot = await resolveMarkdownRoot(options.libraryPath, options.markdownPath);
|
|
103
|
-
|
|
148
|
+
// An id names one operation, and every row it returns is needed to bind it:
|
|
149
|
+
// a generic operation is one row per object. So only an asked-for limit cuts
|
|
150
|
+
// an id search, where a word search stops at the default.
|
|
151
|
+
const limit = options.limit ?? (activityTypeId === undefined ? DEFAULT_SEARCH_LIMIT : matches.length);
|
|
104
152
|
const operations = matches.slice(0, limit).map((entry) => {
|
|
105
153
|
const relative = text(entry.path);
|
|
106
154
|
const operation = {
|
|
@@ -111,14 +159,54 @@ export async function searchRegistryOperations(options) {
|
|
|
111
159
|
activityType: text(entry.activityType),
|
|
112
160
|
objectName: text(entry.objectName),
|
|
113
161
|
operationName: text(entry.operationName),
|
|
114
|
-
definitionPath: join(options.libraryPath, relative
|
|
162
|
+
definitionPath: join(options.libraryPath, definitionRelative(relative)),
|
|
163
|
+
...(activityTypeId !== undefined ? { activityTypeId } : {}),
|
|
115
164
|
};
|
|
116
165
|
if (markdownRoot) {
|
|
117
166
|
operation.markdownPath = join(markdownRoot, relative.replace(/\.json$/, ".md"));
|
|
118
167
|
}
|
|
119
168
|
return operation;
|
|
120
169
|
});
|
|
121
|
-
|
|
170
|
+
// An id is exact, so with nothing else narrowing the search a miss means the
|
|
171
|
+
// library has no such operation, and a library older than the operation is
|
|
172
|
+
// the one cause a caller can fix. With a query or a connector, the miss may
|
|
173
|
+
// be theirs: only the rows they kept were read.
|
|
174
|
+
const narrowed = [
|
|
175
|
+
...(connector ? [`on the connector ${connector}`] : []),
|
|
176
|
+
...(tokens.length > 0 ? [`matching "${tokens.join(" ")}"`] : []),
|
|
177
|
+
].join(" and ");
|
|
178
|
+
const missed = activityTypeId !== undefined && matches.length === 0;
|
|
179
|
+
const byIdAlone = "Search by the id alone before treating the operation as absent.";
|
|
180
|
+
// Said whether or not something matched: a row whose id is unknown may be
|
|
181
|
+
// one more object of the operation, or the operation itself.
|
|
182
|
+
const incomplete = unread.length === 0
|
|
183
|
+
? undefined
|
|
184
|
+
: `The search is incomplete: ${unread.length} of the ${named.length} operation(s) it checked have no definition file in this library ` +
|
|
185
|
+
`(the first is ${unread[0]}), so their activity type id is unknown. ` +
|
|
186
|
+
(matches.length === 0 ? "No match here is not evidence that the operation is absent. " : "") +
|
|
187
|
+
`Run \`${PULL_COMMAND} --force\` and search again.`;
|
|
188
|
+
// A narrowed miss is said beside an incomplete search: each has its own next
|
|
189
|
+
// step, and the id alone is the one that finds the operation on another
|
|
190
|
+
// connector. A miss over the whole library adds nothing to an incomplete
|
|
191
|
+
// search, since both say to pull again.
|
|
192
|
+
let miss;
|
|
193
|
+
if (missed && narrowed !== "" && incomplete !== undefined) {
|
|
194
|
+
miss = `This search also read only the operations ${narrowed}. ${byIdAlone}`;
|
|
195
|
+
}
|
|
196
|
+
else if (missed && narrowed !== "") {
|
|
197
|
+
miss = `No operation ${narrowed} carries the activity type id ${activityTypeId}. ${byIdAlone}`;
|
|
198
|
+
}
|
|
199
|
+
else if (missed && incomplete === undefined) {
|
|
200
|
+
miss = `No operation in this library carries the activity type id ${activityTypeId}. ` +
|
|
201
|
+
`Run \`${PULL_COMMAND} --force\` once and search again before treating the operation as absent.`;
|
|
202
|
+
}
|
|
203
|
+
const warning = [incomplete, miss].filter((part) => part !== undefined).join(" ") || undefined;
|
|
204
|
+
return {
|
|
205
|
+
total: matches.length,
|
|
206
|
+
operations,
|
|
207
|
+
...(warning !== undefined ? { warning } : {}),
|
|
208
|
+
...(unread.length > 0 ? { unreadDefinitions: unread.length } : {}),
|
|
209
|
+
};
|
|
122
210
|
}
|
|
123
211
|
/**
|
|
124
212
|
* The search over the tenant's live catalog, for when no library was pulled
|
|
@@ -234,6 +322,20 @@ export async function run(argv) {
|
|
|
234
322
|
console.error(USAGE);
|
|
235
323
|
return 2;
|
|
236
324
|
}
|
|
325
|
+
const activityTypeId = value(argv, "--activity-type-id");
|
|
326
|
+
if (argv.includes("--activity-type-id") && (activityTypeId === undefined || !ACTIVITY_TYPE_ID.test(activityTypeId.trim()))) {
|
|
327
|
+
// A missing or mistyped id that searched anyway would answer with every
|
|
328
|
+
// operation, or with "no such operation".
|
|
329
|
+
console.error(`--activity-type-id expects a UUID, received ${activityTypeId === undefined ? "nothing" : `'${activityTypeId}'`}.`);
|
|
330
|
+
return 2;
|
|
331
|
+
}
|
|
332
|
+
if (activityTypeId !== undefined && tenant) {
|
|
333
|
+
// The catalog rows uip lists carry no activity type id, so an empty answer
|
|
334
|
+
// here would read as "the tenant has no such operation".
|
|
335
|
+
console.error("--activity-type-id needs a pulled connector library: the tenant's catalog, which is " +
|
|
336
|
+
`searched when none is cached, does not list activity type ids. Run \`${PULL_COMMAND}\`, then search again.`);
|
|
337
|
+
return 2;
|
|
338
|
+
}
|
|
237
339
|
const rawLimit = value(argv, "--limit");
|
|
238
340
|
const limit = rawLimit === undefined ? undefined : Number(rawLimit);
|
|
239
341
|
if (limit !== undefined && (!Number.isInteger(limit) || limit <= 0)) {
|
|
@@ -242,7 +344,7 @@ export async function run(argv) {
|
|
|
242
344
|
}
|
|
243
345
|
// The query is the one positional: every other token is a flag or its value.
|
|
244
346
|
const flagged = new Set();
|
|
245
|
-
for (const name of ["--library", "--library-md", "--connector", "--limit"]) {
|
|
347
|
+
for (const name of ["--library", "--library-md", "--connector", "--limit", "--activity-type-id"]) {
|
|
246
348
|
const index = argv.indexOf(name);
|
|
247
349
|
if (index >= 0) {
|
|
248
350
|
flagged.add(String(index));
|
|
@@ -263,6 +365,7 @@ export async function run(argv) {
|
|
|
263
365
|
query: query || undefined,
|
|
264
366
|
connector: value(argv, "--connector"),
|
|
265
367
|
limit,
|
|
368
|
+
activityTypeId,
|
|
266
369
|
});
|
|
267
370
|
// Said where a person reads it, not only in the JSON: an incomplete catalog
|
|
268
371
|
// answering "no match" would read as the connector not existing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.124.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",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"flow-pipeline-strict",
|
|
89
89
|
"flow-build",
|
|
90
90
|
"case-check-baseline",
|
|
91
|
-
"prepare-folder-key"
|
|
91
|
+
"prepare-folder-key",
|
|
92
|
+
"search-activity-type-id"
|
|
92
93
|
],
|
|
93
94
|
"files": [
|
|
94
95
|
"dist",
|
|
@@ -126,5 +127,5 @@
|
|
|
126
127
|
"@types/node": "^22.7.0",
|
|
127
128
|
"esbuild": "^0.28.1"
|
|
128
129
|
},
|
|
129
|
-
"gitref": "
|
|
130
|
+
"gitref": "b369805f68a4f9c8dc72651bf7c53bb2a466d373"
|
|
130
131
|
}
|