@camunda8/cli 2.6.1 → 2.7.0-alpha.10
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 +80 -1
- package/dist/command-dispatch.d.ts +16 -0
- package/dist/command-dispatch.d.ts.map +1 -0
- package/dist/command-dispatch.js +129 -0
- package/dist/command-dispatch.js.map +1 -0
- package/dist/command-framework.d.ts +248 -0
- package/dist/command-framework.d.ts.map +1 -0
- package/dist/command-framework.js +229 -0
- package/dist/command-framework.js.map +1 -0
- package/dist/command-registry.d.ts +2089 -0
- package/dist/command-registry.d.ts.map +1 -0
- package/dist/command-registry.js +1482 -0
- package/dist/command-registry.js.map +1 -0
- package/dist/command-validation.d.ts +30 -4
- package/dist/command-validation.d.ts.map +1 -1
- package/dist/command-validation.js +90 -4
- package/dist/command-validation.js.map +1 -1
- package/dist/commands/completion.d.ts +25 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +590 -1223
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/deployments.d.ts +2 -0
- package/dist/commands/deployments.d.ts.map +1 -1
- package/dist/commands/deployments.js +13 -2
- package/dist/commands/deployments.js.map +1 -1
- package/dist/commands/forms.d.ts +2 -20
- package/dist/commands/forms.d.ts.map +1 -1
- package/dist/commands/forms.js +76 -79
- package/dist/commands/forms.js.map +1 -1
- package/dist/commands/help.d.ts +4 -88
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +574 -1941
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/identity-authorizations.d.ts +5 -24
- package/dist/commands/identity-authorizations.d.ts.map +1 -1
- package/dist/commands/identity-authorizations.js +113 -137
- package/dist/commands/identity-authorizations.js.map +1 -1
- package/dist/commands/identity-groups.d.ts +5 -26
- package/dist/commands/identity-groups.d.ts.map +1 -1
- package/dist/commands/identity-groups.js +91 -124
- package/dist/commands/identity-groups.js.map +1 -1
- package/dist/commands/identity-mapping-rules.d.ts +5 -30
- package/dist/commands/identity-mapping-rules.d.ts.map +1 -1
- package/dist/commands/identity-mapping-rules.js +106 -136
- package/dist/commands/identity-mapping-rules.js.map +1 -1
- package/dist/commands/identity-roles.d.ts +5 -26
- package/dist/commands/identity-roles.d.ts.map +1 -1
- package/dist/commands/identity-roles.js +91 -124
- package/dist/commands/identity-roles.js.map +1 -1
- package/dist/commands/identity-tenants.d.ts +5 -26
- package/dist/commands/identity-tenants.d.ts.map +1 -1
- package/dist/commands/identity-tenants.js +92 -126
- package/dist/commands/identity-tenants.js.map +1 -1
- package/dist/commands/identity-users.d.ts +5 -29
- package/dist/commands/identity-users.d.ts.map +1 -1
- package/dist/commands/identity-users.js +95 -129
- package/dist/commands/identity-users.js.map +1 -1
- package/dist/commands/identity.d.ts +6 -6
- package/dist/commands/identity.d.ts.map +1 -1
- package/dist/commands/identity.js +6 -7
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/incidents.d.ts +3 -16
- package/dist/commands/incidents.d.ts.map +1 -1
- package/dist/commands/incidents.js +71 -98
- package/dist/commands/incidents.js.map +1 -1
- package/dist/commands/jobs.d.ts +4 -26
- package/dist/commands/jobs.d.ts.map +1 -1
- package/dist/commands/jobs.js +143 -159
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/mcp-proxy.d.ts +1 -0
- package/dist/commands/mcp-proxy.d.ts.map +1 -1
- package/dist/commands/mcp-proxy.js +10 -2
- package/dist/commands/mcp-proxy.js.map +1 -1
- package/dist/commands/messages.d.ts +2 -12
- package/dist/commands/messages.d.ts.map +1 -1
- package/dist/commands/messages.js +87 -81
- package/dist/commands/messages.js.map +1 -1
- package/dist/commands/open.d.ts +4 -0
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +18 -0
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/plugins.d.ts +7 -9
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +32 -25
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/process-definitions.d.ts +2 -14
- package/dist/commands/process-definitions.d.ts.map +1 -1
- package/dist/commands/process-definitions.js +57 -80
- package/dist/commands/process-definitions.js.map +1 -1
- package/dist/commands/process-instances.d.ts +8 -37
- package/dist/commands/process-instances.d.ts.map +1 -1
- package/dist/commands/process-instances.js +242 -193
- package/dist/commands/process-instances.js.map +1 -1
- package/dist/commands/profiles.d.ts +4 -0
- package/dist/commands/profiles.d.ts.map +1 -1
- package/dist/commands/profiles.js +29 -0
- package/dist/commands/profiles.js.map +1 -1
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +10 -0
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/search.d.ts +7 -100
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +530 -694
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +30 -0
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/topology.d.ts +1 -3
- package/dist/commands/topology.d.ts.map +1 -1
- package/dist/commands/topology.js +11 -18
- package/dist/commands/topology.js.map +1 -1
- package/dist/commands/user-tasks.d.ts +2 -16
- package/dist/commands/user-tasks.d.ts.map +1 -1
- package/dist/commands/user-tasks.js +73 -101
- package/dist/commands/user-tasks.js.map +1 -1
- package/dist/commands/watch.d.ts +1 -0
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +15 -0
- package/dist/commands/watch.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/default-plugins/cluster/README.md +1 -1
- package/dist/default-plugins/cluster/c8ctl-plugin.js +281 -59
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -1023
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +7 -1
- package/dist/logger.js.map +1 -1
- package/dist/plugin-loader.d.ts +5 -0
- package/dist/plugin-loader.d.ts.map +1 -1
- package/dist/plugin-loader.js +1 -0
- package/dist/plugin-loader.js.map +1 -1
- package/dist/update-check.d.ts +67 -0
- package/dist/update-check.d.ts.map +1 -0
- package/dist/update-check.js +284 -0
- package/dist/update-check.js.map +1 -0
- package/package.json +3 -2
- /package/dist/templates/{tsconfig.json → tsconfig.json.template} +0 -0
package/dist/commands/search.js
CHANGED
|
@@ -1,136 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Search commands
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { DEFAULT_PAGE_SIZE, fetchAllPages } from "../client.js";
|
|
5
|
+
import { defineCommand, dryRun } from "../command-framework.js";
|
|
6
6
|
import { buildDateFilter, parseBetween } from "../date-filter.js";
|
|
7
|
-
import {
|
|
8
|
-
import { getLogger, sortTableData, } from "../logger.js";
|
|
9
|
-
/**
|
|
10
|
-
* CLI infrastructure flags — valid for every command, never passed to search APIs.
|
|
11
|
-
*/
|
|
12
|
-
const CLI_FLAGS = new Set(["profile", "help", "version"]);
|
|
13
|
-
/**
|
|
14
|
-
* Search behavior flags consumed by shared infrastructure (fetchAllPages / buildDateFilter / sort)
|
|
15
|
-
* for ALL search resources. A flag belongs here only if every search handler consumes it
|
|
16
|
-
* via shared code paths — never for flags consumed by a subset of handlers.
|
|
17
|
-
*
|
|
18
|
-
* If a flag is only relevant to some resources, put it in SEARCH_RESOURCE_FLAGS instead.
|
|
19
|
-
*/
|
|
20
|
-
const SHARED_SEARCH_FLAGS = new Set([
|
|
21
|
-
"sortBy",
|
|
22
|
-
"asc",
|
|
23
|
-
"desc",
|
|
24
|
-
"between",
|
|
25
|
-
"dateField",
|
|
26
|
-
]);
|
|
27
|
-
/**
|
|
28
|
-
* Union of CLI_FLAGS and SHARED_SEARCH_FLAGS — exported for use in detectUnknownSearchFlags.
|
|
29
|
-
* Do NOT add resource-specific flags here; add them to SEARCH_RESOURCE_FLAGS instead.
|
|
30
|
-
*/
|
|
31
|
-
export const GLOBAL_FLAGS = new Set([...CLI_FLAGS, ...SHARED_SEARCH_FLAGS]);
|
|
32
|
-
/**
|
|
33
|
-
* Valid search filter flags per resource (values keys that are consumed by the search handler).
|
|
34
|
-
* This map is used to detect when a user passes a flag that looks valid but is not recognized
|
|
35
|
-
* for the specific resource, causing silent filter drops.
|
|
36
|
-
*/
|
|
37
|
-
export const SEARCH_RESOURCE_FLAGS = {
|
|
38
|
-
"process-definition": new Set([
|
|
39
|
-
"bpmnProcessId",
|
|
40
|
-
"id",
|
|
41
|
-
"processDefinitionId",
|
|
42
|
-
"name",
|
|
43
|
-
"key",
|
|
44
|
-
"iid",
|
|
45
|
-
"iname",
|
|
46
|
-
]),
|
|
47
|
-
"process-instance": new Set([
|
|
48
|
-
"bpmnProcessId",
|
|
49
|
-
"id",
|
|
50
|
-
"processDefinitionId",
|
|
51
|
-
"processDefinitionKey",
|
|
52
|
-
"state",
|
|
53
|
-
"key",
|
|
54
|
-
"parentProcessInstanceKey",
|
|
55
|
-
"iid",
|
|
56
|
-
]),
|
|
57
|
-
"user-task": new Set([
|
|
58
|
-
"state",
|
|
59
|
-
"assignee",
|
|
60
|
-
"processInstanceKey",
|
|
61
|
-
"processDefinitionKey",
|
|
62
|
-
"elementId",
|
|
63
|
-
"iassignee",
|
|
64
|
-
]),
|
|
65
|
-
incident: new Set([
|
|
66
|
-
"state",
|
|
67
|
-
"processInstanceKey",
|
|
68
|
-
"processDefinitionKey",
|
|
69
|
-
"bpmnProcessId",
|
|
70
|
-
"id",
|
|
71
|
-
"processDefinitionId",
|
|
72
|
-
"errorType",
|
|
73
|
-
"errorMessage",
|
|
74
|
-
"ierrorMessage",
|
|
75
|
-
"iid",
|
|
76
|
-
]),
|
|
77
|
-
jobs: new Set([
|
|
78
|
-
"state",
|
|
79
|
-
"type",
|
|
80
|
-
"processInstanceKey",
|
|
81
|
-
"processDefinitionKey",
|
|
82
|
-
"itype",
|
|
83
|
-
]),
|
|
84
|
-
variable: new Set([
|
|
85
|
-
"name",
|
|
86
|
-
"value",
|
|
87
|
-
"processInstanceKey",
|
|
88
|
-
"scopeKey",
|
|
89
|
-
"fullValue",
|
|
90
|
-
"iname",
|
|
91
|
-
"ivalue",
|
|
92
|
-
"limit",
|
|
93
|
-
]),
|
|
94
|
-
user: new Set(["username", "name", "email", "limit"]),
|
|
95
|
-
role: new Set(["roleId", "name", "limit"]),
|
|
96
|
-
group: new Set(["groupId", "name", "limit"]),
|
|
97
|
-
tenant: new Set(["tenantId", "name", "limit"]),
|
|
98
|
-
authorization: new Set([
|
|
99
|
-
"ownerId",
|
|
100
|
-
"ownerType",
|
|
101
|
-
"resourceType",
|
|
102
|
-
"resourceId",
|
|
103
|
-
"limit",
|
|
104
|
-
]),
|
|
105
|
-
"mapping-rule": new Set([
|
|
106
|
-
"mappingRuleId",
|
|
107
|
-
"name",
|
|
108
|
-
"claimName",
|
|
109
|
-
"claimValue",
|
|
110
|
-
"limit",
|
|
111
|
-
]),
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Detect flags the user set that are not recognized for the given search resource.
|
|
115
|
-
* Returns the list of unknown flag names (without the --prefix).
|
|
116
|
-
*/
|
|
117
|
-
export function detectUnknownSearchFlags(values, normalizedResource) {
|
|
118
|
-
const validFlags = SEARCH_RESOURCE_FLAGS[normalizedResource] ||
|
|
119
|
-
SEARCH_RESOURCE_FLAGS[normalizedResource.replace(/s$/, "")];
|
|
120
|
-
if (!validFlags)
|
|
121
|
-
return [];
|
|
122
|
-
const unknown = [];
|
|
123
|
-
for (const [key, val] of Object.entries(values)) {
|
|
124
|
-
if (val === undefined || val === false)
|
|
125
|
-
continue; // not set by the user
|
|
126
|
-
if (GLOBAL_FLAGS.has(key))
|
|
127
|
-
continue;
|
|
128
|
-
if (validFlags.has(key))
|
|
129
|
-
continue;
|
|
130
|
-
unknown.push(key);
|
|
131
|
-
}
|
|
132
|
-
return unknown;
|
|
133
|
-
}
|
|
7
|
+
import { sortTableData } from "../logger.js";
|
|
134
8
|
/**
|
|
135
9
|
* Detect wildcard characters (* or ?) in a string value and return
|
|
136
10
|
* a $like filter object for the API. Returns the plain string for exact match.
|
|
@@ -270,661 +144,623 @@ export function logResultCount(logger, count, resourceName, hasFilters) {
|
|
|
270
144
|
/**
|
|
271
145
|
* Search process definitions
|
|
272
146
|
*/
|
|
273
|
-
export async
|
|
274
|
-
const logger =
|
|
275
|
-
const
|
|
276
|
-
const
|
|
277
|
-
const hasCiFilter = !!(
|
|
147
|
+
export const searchProcessDefinitionsCommand = defineCommand("search", "process-definition", async (ctx, flags, _args) => {
|
|
148
|
+
const { client, logger, tenantId, profile } = ctx;
|
|
149
|
+
const processDefinitionId = flags.id || flags.processDefinitionId || flags.bpmnProcessId;
|
|
150
|
+
const version = ctx.version;
|
|
151
|
+
const hasCiFilter = !!(flags.iid || flags.iname);
|
|
278
152
|
// Build search criteria description for user feedback
|
|
279
153
|
const criteria = [];
|
|
280
|
-
if (
|
|
281
|
-
criteria.push(formatCriterion("Process Definition ID",
|
|
154
|
+
if (processDefinitionId) {
|
|
155
|
+
criteria.push(formatCriterion("Process Definition ID", processDefinitionId));
|
|
156
|
+
}
|
|
157
|
+
if (flags.name) {
|
|
158
|
+
criteria.push(formatCriterion("name", flags.name));
|
|
159
|
+
}
|
|
160
|
+
if (version !== undefined) {
|
|
161
|
+
criteria.push(formatCriterion("version", version));
|
|
162
|
+
}
|
|
163
|
+
if (flags.key) {
|
|
164
|
+
criteria.push(formatCriterion("key", flags.key));
|
|
165
|
+
}
|
|
166
|
+
if (flags.iid) {
|
|
167
|
+
criteria.push(formatCriterion("Process Definition ID", flags.iid, true));
|
|
168
|
+
}
|
|
169
|
+
if (flags.iname) {
|
|
170
|
+
criteria.push(formatCriterion("name", flags.iname, true));
|
|
171
|
+
}
|
|
172
|
+
const filter = {
|
|
173
|
+
filter: {
|
|
174
|
+
tenantId,
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
if (processDefinitionId) {
|
|
178
|
+
filter.filter.processDefinitionId = toStringFilter(processDefinitionId);
|
|
179
|
+
}
|
|
180
|
+
if (flags.name) {
|
|
181
|
+
filter.filter.name = toStringFilter(flags.name);
|
|
182
|
+
}
|
|
183
|
+
if (version !== undefined) {
|
|
184
|
+
filter.filter.version = version;
|
|
185
|
+
}
|
|
186
|
+
if (flags.key) {
|
|
187
|
+
filter.filter.processDefinitionKey = flags.key;
|
|
188
|
+
}
|
|
189
|
+
const dr = dryRun({
|
|
190
|
+
command: "search process-definitions",
|
|
191
|
+
method: "POST",
|
|
192
|
+
endpoint: "/process-definitions/search",
|
|
193
|
+
profile,
|
|
194
|
+
body: filter,
|
|
195
|
+
});
|
|
196
|
+
if (dr)
|
|
197
|
+
return dr;
|
|
198
|
+
logSearchCriteria(logger, "Process Definitions", criteria);
|
|
199
|
+
const allItems = await fetchAllPages((f, opts) => client.searchProcessDefinitions(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
200
|
+
const result = { items: allItems };
|
|
201
|
+
if (result.items?.length) {
|
|
202
|
+
result.items = [...result.items].sort((left, right) => {
|
|
203
|
+
const versionDelta = (Number(right.version) || 0) - (Number(left.version) || 0);
|
|
204
|
+
if (versionDelta !== 0)
|
|
205
|
+
return versionDelta;
|
|
206
|
+
const leftKey = toBigIntSafe(left.processDefinitionKey ?? left.key);
|
|
207
|
+
const rightKey = toBigIntSafe(right.processDefinitionKey ?? right.key);
|
|
208
|
+
if (leftKey === rightKey)
|
|
209
|
+
return 0;
|
|
210
|
+
return rightKey > leftKey ? 1 : -1;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
// Client-side case-insensitive post-filtering
|
|
214
|
+
if (hasCiFilter && result.items) {
|
|
215
|
+
result.items = result.items.filter((pd) => {
|
|
216
|
+
if (flags.iid &&
|
|
217
|
+
!matchesCaseInsensitive(pd.processDefinitionId, flags.iid))
|
|
218
|
+
return false;
|
|
219
|
+
if (flags.iname && !matchesCaseInsensitive(pd.name, flags.iname))
|
|
220
|
+
return false;
|
|
221
|
+
return true;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (result.items && result.items.length > 0) {
|
|
225
|
+
let tableData = result.items.map((pd) => ({
|
|
226
|
+
Key: pd.processDefinitionKey || pd.key,
|
|
227
|
+
"Process ID": pd.processDefinitionId,
|
|
228
|
+
Name: pd.name || "-",
|
|
229
|
+
Version: pd.version,
|
|
230
|
+
"Tenant ID": pd.tenantId,
|
|
231
|
+
}));
|
|
232
|
+
tableData = sortTableData(tableData, ctx.sortBy, logger, ctx.sortOrder);
|
|
233
|
+
logger.table(tableData);
|
|
234
|
+
logResultCount(logger, result.items.length, "process definition(s)", criteria.length > 0);
|
|
282
235
|
}
|
|
283
|
-
|
|
284
|
-
|
|
236
|
+
else {
|
|
237
|
+
logNoResults(logger, "process definitions", criteria.length > 0);
|
|
285
238
|
}
|
|
286
|
-
|
|
287
|
-
|
|
239
|
+
});
|
|
240
|
+
/**
|
|
241
|
+
* Search process instances
|
|
242
|
+
*/
|
|
243
|
+
export const searchProcessInstancesCommand = defineCommand("search", "process-instance", async (ctx, flags, _args) => {
|
|
244
|
+
const { client, logger, tenantId, profile } = ctx;
|
|
245
|
+
const processDefinitionId = flags.id || flags.processDefinitionId || flags.bpmnProcessId;
|
|
246
|
+
const version = ctx.version;
|
|
247
|
+
const hasCiFilter = !!flags.iid;
|
|
248
|
+
// Build search criteria description for user feedback
|
|
249
|
+
const criteria = [];
|
|
250
|
+
if (processDefinitionId) {
|
|
251
|
+
criteria.push(formatCriterion("Process Definition ID", processDefinitionId));
|
|
288
252
|
}
|
|
289
|
-
if (
|
|
290
|
-
criteria.push(formatCriterion("
|
|
253
|
+
if (flags.processDefinitionKey) {
|
|
254
|
+
criteria.push(formatCriterion("Process Definition Key", flags.processDefinitionKey));
|
|
291
255
|
}
|
|
292
|
-
if (
|
|
293
|
-
criteria.push(formatCriterion("
|
|
256
|
+
if (flags.state) {
|
|
257
|
+
criteria.push(formatCriterion("state", flags.state));
|
|
294
258
|
}
|
|
295
|
-
if (
|
|
296
|
-
criteria.push(formatCriterion("
|
|
259
|
+
if (version !== undefined) {
|
|
260
|
+
criteria.push(formatCriterion("version", version));
|
|
297
261
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
filter: {
|
|
301
|
-
tenantId,
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
if (options.processDefinitionId) {
|
|
305
|
-
filter.filter.processDefinitionId = toStringFilter(options.processDefinitionId);
|
|
306
|
-
}
|
|
307
|
-
if (options.name) {
|
|
308
|
-
filter.filter.name = toStringFilter(options.name);
|
|
309
|
-
}
|
|
310
|
-
if (options.version !== undefined) {
|
|
311
|
-
filter.filter.version = options.version;
|
|
312
|
-
}
|
|
313
|
-
if (options.key) {
|
|
314
|
-
filter.filter.processDefinitionKey = options.key;
|
|
315
|
-
}
|
|
316
|
-
if (emitDryRun({
|
|
317
|
-
command: "search process-definitions",
|
|
318
|
-
method: "POST",
|
|
319
|
-
endpoint: "/process-definitions/search",
|
|
320
|
-
profile: options.profile,
|
|
321
|
-
body: filter,
|
|
322
|
-
}))
|
|
323
|
-
return;
|
|
324
|
-
logSearchCriteria(logger, "Process Definitions", criteria);
|
|
325
|
-
const allItems = await fetchAllPages((f, opts) => client.searchProcessDefinitions(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
326
|
-
const result = { items: allItems };
|
|
327
|
-
if (result.items?.length) {
|
|
328
|
-
result.items = [...result.items].sort((left, right) => {
|
|
329
|
-
const versionDelta = (Number(right.version) || 0) - (Number(left.version) || 0);
|
|
330
|
-
if (versionDelta !== 0)
|
|
331
|
-
return versionDelta;
|
|
332
|
-
const leftKey = toBigIntSafe(left.processDefinitionKey ?? left.key);
|
|
333
|
-
const rightKey = toBigIntSafe(right.processDefinitionKey ?? right.key);
|
|
334
|
-
if (leftKey === rightKey)
|
|
335
|
-
return 0;
|
|
336
|
-
return rightKey > leftKey ? 1 : -1;
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
// Client-side case-insensitive post-filtering
|
|
340
|
-
if (hasCiFilter && result.items) {
|
|
341
|
-
result.items = result.items.filter((pd) => {
|
|
342
|
-
if (options.iProcessDefinitionId &&
|
|
343
|
-
!matchesCaseInsensitive(pd.processDefinitionId, options.iProcessDefinitionId))
|
|
344
|
-
return false;
|
|
345
|
-
if (options.iName && !matchesCaseInsensitive(pd.name, options.iName))
|
|
346
|
-
return false;
|
|
347
|
-
return true;
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
if (result.items && result.items.length > 0) {
|
|
351
|
-
let tableData = result.items.map((pd) => ({
|
|
352
|
-
Key: pd.processDefinitionKey || pd.key,
|
|
353
|
-
"Process ID": pd.processDefinitionId,
|
|
354
|
-
Name: pd.name || "-",
|
|
355
|
-
Version: pd.version,
|
|
356
|
-
"Tenant ID": pd.tenantId,
|
|
357
|
-
}));
|
|
358
|
-
tableData = sortTableData(tableData, options.sortBy, logger, options.sortOrder);
|
|
359
|
-
logger.table(tableData);
|
|
360
|
-
logResultCount(logger, result.items.length, "process definition(s)", criteria.length > 0);
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
logNoResults(logger, "process definitions", criteria.length > 0, options._unknownFlags);
|
|
364
|
-
}
|
|
365
|
-
return result;
|
|
262
|
+
if (flags.key) {
|
|
263
|
+
criteria.push(formatCriterion("key", flags.key));
|
|
366
264
|
}
|
|
367
|
-
|
|
368
|
-
|
|
265
|
+
if (flags.parentProcessInstanceKey) {
|
|
266
|
+
criteria.push(formatCriterion("Parent Process Instance Key", flags.parentProcessInstanceKey));
|
|
369
267
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
* Search process instances
|
|
373
|
-
*/
|
|
374
|
-
export async function searchProcessInstances(options) {
|
|
375
|
-
const logger = getLogger();
|
|
376
|
-
const client = createClient(options.profile);
|
|
377
|
-
const tenantId = resolveTenantId(options.profile);
|
|
378
|
-
const hasCiFilter = !!options.iProcessDefinitionId;
|
|
379
|
-
// Build search criteria description for user feedback
|
|
380
|
-
const criteria = [];
|
|
381
|
-
if (options.processDefinitionId) {
|
|
382
|
-
criteria.push(formatCriterion("Process Definition ID", options.processDefinitionId));
|
|
268
|
+
if (flags.iid) {
|
|
269
|
+
criteria.push(formatCriterion("Process Definition ID", flags.iid, true));
|
|
383
270
|
}
|
|
384
|
-
if (
|
|
385
|
-
|
|
271
|
+
if (ctx.between) {
|
|
272
|
+
const field = ctx.dateField ?? "startDate";
|
|
273
|
+
criteria.push(`'${field}' between "${ctx.between}"`);
|
|
386
274
|
}
|
|
387
|
-
|
|
388
|
-
|
|
275
|
+
const filter = {
|
|
276
|
+
filter: {
|
|
277
|
+
tenantId,
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
if (processDefinitionId) {
|
|
281
|
+
filter.filter.processDefinitionId = toStringFilter(processDefinitionId);
|
|
389
282
|
}
|
|
390
|
-
if (
|
|
391
|
-
|
|
283
|
+
if (flags.processDefinitionKey) {
|
|
284
|
+
filter.filter.processDefinitionKey = flags.processDefinitionKey;
|
|
392
285
|
}
|
|
393
|
-
if (
|
|
394
|
-
|
|
286
|
+
if (version !== undefined) {
|
|
287
|
+
filter.filter.processDefinitionVersion = version;
|
|
395
288
|
}
|
|
396
|
-
if (
|
|
397
|
-
|
|
289
|
+
if (flags.state) {
|
|
290
|
+
filter.filter.state = flags.state;
|
|
398
291
|
}
|
|
399
|
-
if (
|
|
400
|
-
|
|
292
|
+
if (flags.key) {
|
|
293
|
+
filter.filter.processInstanceKey = flags.key;
|
|
401
294
|
}
|
|
402
|
-
if (
|
|
403
|
-
|
|
404
|
-
criteria.push(`'${field}' between "${options.between}"`);
|
|
295
|
+
if (flags.parentProcessInstanceKey) {
|
|
296
|
+
filter.filter.parentProcessInstanceKey = flags.parentProcessInstanceKey;
|
|
405
297
|
}
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
};
|
|
412
|
-
if (options.processDefinitionId) {
|
|
413
|
-
filter.filter.processDefinitionId = toStringFilter(options.processDefinitionId);
|
|
414
|
-
}
|
|
415
|
-
if (options.processDefinitionKey) {
|
|
416
|
-
filter.filter.processDefinitionKey = options.processDefinitionKey;
|
|
417
|
-
}
|
|
418
|
-
if (options.version !== undefined) {
|
|
419
|
-
filter.filter.processDefinitionVersion = options.version;
|
|
420
|
-
}
|
|
421
|
-
if (options.state) {
|
|
422
|
-
filter.filter.state = options.state;
|
|
423
|
-
}
|
|
424
|
-
if (options.key) {
|
|
425
|
-
filter.filter.processInstanceKey = options.key;
|
|
426
|
-
}
|
|
427
|
-
if (options.parentProcessInstanceKey) {
|
|
428
|
-
filter.filter.parentProcessInstanceKey = options.parentProcessInstanceKey;
|
|
429
|
-
}
|
|
430
|
-
if (options.between) {
|
|
431
|
-
const parsed = parseBetween(options.between);
|
|
432
|
-
if (parsed) {
|
|
433
|
-
const field = options.dateField ?? "startDate";
|
|
434
|
-
filter.filter[field] = buildDateFilter(parsed.from, parsed.to);
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
438
|
-
process.exit(1);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
if (emitDryRun({
|
|
442
|
-
command: "search process-instances",
|
|
443
|
-
method: "POST",
|
|
444
|
-
endpoint: "/process-instances/search",
|
|
445
|
-
profile: options.profile,
|
|
446
|
-
body: filter,
|
|
447
|
-
}))
|
|
448
|
-
return;
|
|
449
|
-
logSearchCriteria(logger, "Process Instances", criteria);
|
|
450
|
-
const allItems = await fetchAllPages((f, opts) => client.searchProcessInstances(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
451
|
-
const result = { items: allItems };
|
|
452
|
-
if (hasCiFilter && result.items) {
|
|
453
|
-
result.items = result.items.filter((pi) => {
|
|
454
|
-
if (options.iProcessDefinitionId &&
|
|
455
|
-
!matchesCaseInsensitive(pi.processDefinitionId, options.iProcessDefinitionId))
|
|
456
|
-
return false;
|
|
457
|
-
return true;
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
if (result.items && result.items.length > 0) {
|
|
461
|
-
let tableData = result.items.map((pi) => ({
|
|
462
|
-
Key: pi.processInstanceKey || pi.key,
|
|
463
|
-
"Process ID": pi.processDefinitionId,
|
|
464
|
-
State: pi.state,
|
|
465
|
-
Version: pi.processDefinitionVersion || pi.version,
|
|
466
|
-
"Start Date": pi.startDate || "-",
|
|
467
|
-
"Tenant ID": pi.tenantId,
|
|
468
|
-
}));
|
|
469
|
-
tableData = sortTableData(tableData, options.sortBy, logger, options.sortOrder);
|
|
470
|
-
logger.table(tableData);
|
|
471
|
-
logResultCount(logger, result.items.length, "process instance(s)", criteria.length > 0);
|
|
298
|
+
if (ctx.between) {
|
|
299
|
+
const parsed = parseBetween(ctx.between);
|
|
300
|
+
if (parsed) {
|
|
301
|
+
const field = ctx.dateField ?? "startDate";
|
|
302
|
+
filter.filter[field] = buildDateFilter(parsed.from, parsed.to);
|
|
472
303
|
}
|
|
473
304
|
else {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
305
|
+
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const dr = dryRun({
|
|
310
|
+
command: "search process-instances",
|
|
311
|
+
method: "POST",
|
|
312
|
+
endpoint: "/process-instances/search",
|
|
313
|
+
profile,
|
|
314
|
+
body: filter,
|
|
315
|
+
});
|
|
316
|
+
if (dr)
|
|
317
|
+
return dr;
|
|
318
|
+
logSearchCriteria(logger, "Process Instances", criteria);
|
|
319
|
+
const allItems = await fetchAllPages((f, opts) => client.searchProcessInstances(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
320
|
+
const result = { items: allItems };
|
|
321
|
+
if (hasCiFilter && result.items) {
|
|
322
|
+
result.items = result.items.filter((pi) => {
|
|
323
|
+
if (flags.iid &&
|
|
324
|
+
!matchesCaseInsensitive(pi.processDefinitionId, flags.iid))
|
|
325
|
+
return false;
|
|
326
|
+
return true;
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
if (result.items && result.items.length > 0) {
|
|
330
|
+
let tableData = result.items.map((pi) => ({
|
|
331
|
+
Key: pi.processInstanceKey || pi.key,
|
|
332
|
+
"Process ID": pi.processDefinitionId,
|
|
333
|
+
State: pi.state,
|
|
334
|
+
Version: pi.processDefinitionVersion || pi.version,
|
|
335
|
+
"Start Date": pi.startDate || "-",
|
|
336
|
+
"Tenant ID": pi.tenantId,
|
|
337
|
+
}));
|
|
338
|
+
tableData = sortTableData(tableData, ctx.sortBy, logger, ctx.sortOrder);
|
|
339
|
+
logger.table(tableData);
|
|
340
|
+
logResultCount(logger, result.items.length, "process instance(s)", criteria.length > 0);
|
|
477
341
|
}
|
|
478
|
-
|
|
479
|
-
|
|
342
|
+
else {
|
|
343
|
+
logNoResults(logger, "process instances", criteria.length > 0);
|
|
480
344
|
}
|
|
481
|
-
}
|
|
345
|
+
});
|
|
482
346
|
/**
|
|
483
347
|
* Search user tasks
|
|
484
348
|
*/
|
|
485
|
-
export async
|
|
486
|
-
const logger =
|
|
487
|
-
const
|
|
488
|
-
const tenantId = resolveTenantId(options.profile);
|
|
489
|
-
const hasCiFilter = !!options.iAssignee;
|
|
349
|
+
export const searchUserTasksCommand = defineCommand("search", "user-task", async (ctx, flags, _args) => {
|
|
350
|
+
const { client, logger, tenantId, profile } = ctx;
|
|
351
|
+
const hasCiFilter = !!flags.iassignee;
|
|
490
352
|
// Build search criteria description for user feedback
|
|
491
353
|
const criteria = [];
|
|
492
|
-
if (
|
|
493
|
-
criteria.push(formatCriterion("state",
|
|
354
|
+
if (flags.state) {
|
|
355
|
+
criteria.push(formatCriterion("state", flags.state));
|
|
494
356
|
}
|
|
495
|
-
if (
|
|
496
|
-
criteria.push(formatCriterion("assignee",
|
|
357
|
+
if (flags.assignee) {
|
|
358
|
+
criteria.push(formatCriterion("assignee", flags.assignee));
|
|
497
359
|
}
|
|
498
|
-
if (
|
|
499
|
-
criteria.push(formatCriterion("Process Instance Key",
|
|
360
|
+
if (flags.processInstanceKey) {
|
|
361
|
+
criteria.push(formatCriterion("Process Instance Key", flags.processInstanceKey));
|
|
500
362
|
}
|
|
501
|
-
if (
|
|
502
|
-
criteria.push(formatCriterion("Process Definition Key",
|
|
363
|
+
if (flags.processDefinitionKey) {
|
|
364
|
+
criteria.push(formatCriterion("Process Definition Key", flags.processDefinitionKey));
|
|
503
365
|
}
|
|
504
|
-
if (
|
|
505
|
-
criteria.push(formatCriterion("Element ID",
|
|
366
|
+
if (flags.elementId) {
|
|
367
|
+
criteria.push(formatCriterion("Element ID", flags.elementId));
|
|
506
368
|
}
|
|
507
|
-
if (
|
|
508
|
-
criteria.push(formatCriterion("assignee",
|
|
369
|
+
if (flags.iassignee) {
|
|
370
|
+
criteria.push(formatCriterion("assignee", flags.iassignee, true));
|
|
509
371
|
}
|
|
510
|
-
if (
|
|
511
|
-
const field =
|
|
512
|
-
criteria.push(`'${field}' between "${
|
|
372
|
+
if (ctx.between) {
|
|
373
|
+
const field = ctx.dateField ?? "creationDate";
|
|
374
|
+
criteria.push(`'${field}' between "${ctx.between}"`);
|
|
513
375
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
filter.filter[field] = buildDateFilter(parsed.from, parsed.to);
|
|
540
|
-
}
|
|
541
|
-
else {
|
|
542
|
-
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
543
|
-
process.exit(1);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
if (emitDryRun({
|
|
547
|
-
command: "search user-tasks",
|
|
548
|
-
method: "POST",
|
|
549
|
-
endpoint: "/user-tasks/search",
|
|
550
|
-
profile: options.profile,
|
|
551
|
-
body: filter,
|
|
552
|
-
}))
|
|
553
|
-
return;
|
|
554
|
-
logSearchCriteria(logger, "User Tasks", criteria);
|
|
555
|
-
const allItems = await fetchAllPages((f, opts) => client.searchUserTasks(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
556
|
-
const result = { items: allItems };
|
|
557
|
-
if (hasCiFilter && result.items) {
|
|
558
|
-
result.items = result.items.filter((task) => {
|
|
559
|
-
if (options.iAssignee &&
|
|
560
|
-
!matchesCaseInsensitive(task.assignee, options.iAssignee))
|
|
561
|
-
return false;
|
|
562
|
-
return true;
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
if (result.items && result.items.length > 0) {
|
|
566
|
-
let tableData = result.items.map((task) => ({
|
|
567
|
-
Key: task.userTaskKey || task.key,
|
|
568
|
-
Name: task.name || task.elementId,
|
|
569
|
-
State: task.state,
|
|
570
|
-
Assignee: task.assignee || "(unassigned)",
|
|
571
|
-
Created: task.creationDate || "-",
|
|
572
|
-
"Process Instance": task.processInstanceKey,
|
|
573
|
-
"Tenant ID": task.tenantId,
|
|
574
|
-
}));
|
|
575
|
-
tableData = sortTableData(tableData, options.sortBy, logger, options.sortOrder);
|
|
576
|
-
logger.table(tableData);
|
|
577
|
-
logResultCount(logger, result.items.length, "user task(s)", criteria.length > 0);
|
|
376
|
+
const filter = {
|
|
377
|
+
filter: {
|
|
378
|
+
tenantId,
|
|
379
|
+
},
|
|
380
|
+
};
|
|
381
|
+
if (flags.state) {
|
|
382
|
+
filter.filter.state = flags.state;
|
|
383
|
+
}
|
|
384
|
+
if (flags.assignee) {
|
|
385
|
+
filter.filter.assignee = toStringFilter(flags.assignee);
|
|
386
|
+
}
|
|
387
|
+
if (flags.processInstanceKey) {
|
|
388
|
+
filter.filter.processInstanceKey = flags.processInstanceKey;
|
|
389
|
+
}
|
|
390
|
+
if (flags.processDefinitionKey) {
|
|
391
|
+
filter.filter.processDefinitionKey = flags.processDefinitionKey;
|
|
392
|
+
}
|
|
393
|
+
if (flags.elementId) {
|
|
394
|
+
filter.filter.elementId = flags.elementId;
|
|
395
|
+
}
|
|
396
|
+
if (ctx.between) {
|
|
397
|
+
const parsed = parseBetween(ctx.between);
|
|
398
|
+
if (parsed) {
|
|
399
|
+
const field = ctx.dateField ?? "creationDate";
|
|
400
|
+
filter.filter[field] = buildDateFilter(parsed.from, parsed.to);
|
|
578
401
|
}
|
|
579
402
|
else {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
403
|
+
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
404
|
+
process.exit(1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const dr = dryRun({
|
|
408
|
+
command: "search user-tasks",
|
|
409
|
+
method: "POST",
|
|
410
|
+
endpoint: "/user-tasks/search",
|
|
411
|
+
profile,
|
|
412
|
+
body: filter,
|
|
413
|
+
});
|
|
414
|
+
if (dr)
|
|
415
|
+
return dr;
|
|
416
|
+
logSearchCriteria(logger, "User Tasks", criteria);
|
|
417
|
+
const allItems = await fetchAllPages((f, opts) => client.searchUserTasks(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
418
|
+
const result = { items: allItems };
|
|
419
|
+
if (hasCiFilter && result.items) {
|
|
420
|
+
result.items = result.items.filter((task) => {
|
|
421
|
+
if (flags.iassignee &&
|
|
422
|
+
!matchesCaseInsensitive(task.assignee, flags.iassignee))
|
|
423
|
+
return false;
|
|
424
|
+
return true;
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
if (result.items && result.items.length > 0) {
|
|
428
|
+
let tableData = result.items.map((task) => ({
|
|
429
|
+
Key: task.userTaskKey || task.key,
|
|
430
|
+
Name: task.name || task.elementId,
|
|
431
|
+
State: task.state,
|
|
432
|
+
Assignee: task.assignee || "(unassigned)",
|
|
433
|
+
Created: task.creationDate || "-",
|
|
434
|
+
"Process Instance": task.processInstanceKey,
|
|
435
|
+
"Tenant ID": task.tenantId,
|
|
436
|
+
}));
|
|
437
|
+
tableData = sortTableData(tableData, ctx.sortBy, logger, ctx.sortOrder);
|
|
438
|
+
logger.table(tableData);
|
|
439
|
+
logResultCount(logger, result.items.length, "user task(s)", criteria.length > 0);
|
|
583
440
|
}
|
|
584
|
-
|
|
585
|
-
|
|
441
|
+
else {
|
|
442
|
+
logNoResults(logger, "user tasks", criteria.length > 0);
|
|
586
443
|
}
|
|
587
|
-
}
|
|
444
|
+
});
|
|
588
445
|
/**
|
|
589
446
|
* Search incidents
|
|
590
447
|
*/
|
|
591
|
-
export async
|
|
592
|
-
const logger =
|
|
593
|
-
const
|
|
594
|
-
const tenantId = resolveTenantId(options.profile);
|
|
448
|
+
export const searchIncidentsCommand = defineCommand("search", "incident", async (ctx, flags, _args) => {
|
|
449
|
+
const { client, logger, tenantId, profile } = ctx;
|
|
450
|
+
const processDefinitionId = flags.id || flags.processDefinitionId || flags.bpmnProcessId;
|
|
595
451
|
// The incident API does not support a $like filter for errorMessage; fall back to client-side filtering for wildcard patterns
|
|
596
|
-
const errorMessageHasWildcard = !!(
|
|
597
|
-
const hasCiFilter = !!(
|
|
598
|
-
|
|
452
|
+
const errorMessageHasWildcard = !!(flags.errorMessage && hasUnescapedWildcard(flags.errorMessage));
|
|
453
|
+
const hasCiFilter = !!(flags.ierrorMessage ||
|
|
454
|
+
flags.iid ||
|
|
599
455
|
errorMessageHasWildcard);
|
|
600
456
|
// Build search criteria description for user feedback
|
|
601
457
|
const criteria = [];
|
|
602
|
-
if (
|
|
603
|
-
criteria.push(formatCriterion("state",
|
|
458
|
+
if (flags.state) {
|
|
459
|
+
criteria.push(formatCriterion("state", flags.state));
|
|
604
460
|
}
|
|
605
|
-
if (
|
|
606
|
-
criteria.push(formatCriterion("Process Instance Key",
|
|
461
|
+
if (flags.processInstanceKey) {
|
|
462
|
+
criteria.push(formatCriterion("Process Instance Key", flags.processInstanceKey));
|
|
607
463
|
}
|
|
608
|
-
if (
|
|
609
|
-
criteria.push(formatCriterion("Process Definition Key",
|
|
464
|
+
if (flags.processDefinitionKey) {
|
|
465
|
+
criteria.push(formatCriterion("Process Definition Key", flags.processDefinitionKey));
|
|
610
466
|
}
|
|
611
|
-
if (
|
|
612
|
-
criteria.push(formatCriterion("Error Type",
|
|
467
|
+
if (flags.errorType) {
|
|
468
|
+
criteria.push(formatCriterion("Error Type", flags.errorType));
|
|
613
469
|
}
|
|
614
|
-
if (
|
|
615
|
-
criteria.push(formatCriterion("Error Message",
|
|
470
|
+
if (flags.errorMessage) {
|
|
471
|
+
criteria.push(formatCriterion("Error Message", flags.errorMessage));
|
|
616
472
|
}
|
|
617
|
-
if (
|
|
618
|
-
criteria.push(formatCriterion("Process Definition ID",
|
|
473
|
+
if (processDefinitionId) {
|
|
474
|
+
criteria.push(formatCriterion("Process Definition ID", processDefinitionId));
|
|
619
475
|
}
|
|
620
|
-
if (
|
|
621
|
-
criteria.push(formatCriterion("Error Message",
|
|
476
|
+
if (flags.ierrorMessage) {
|
|
477
|
+
criteria.push(formatCriterion("Error Message", flags.ierrorMessage, true));
|
|
622
478
|
}
|
|
623
|
-
if (
|
|
624
|
-
criteria.push(formatCriterion("Process Definition ID",
|
|
479
|
+
if (flags.iid) {
|
|
480
|
+
criteria.push(formatCriterion("Process Definition ID", flags.iid, true));
|
|
625
481
|
}
|
|
626
|
-
if (
|
|
627
|
-
criteria.push(`'creationTime' between "${
|
|
482
|
+
if (ctx.between) {
|
|
483
|
+
criteria.push(`'creationTime' between "${ctx.between}"`);
|
|
628
484
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
filter.filter.creationTime = buildDateFilter(parsed.from, parsed.to);
|
|
657
|
-
}
|
|
658
|
-
else {
|
|
659
|
-
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
660
|
-
process.exit(1);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
if (emitDryRun({
|
|
664
|
-
command: "search incidents",
|
|
665
|
-
method: "POST",
|
|
666
|
-
endpoint: "/incidents/search",
|
|
667
|
-
profile: options.profile,
|
|
668
|
-
body: filter,
|
|
669
|
-
}))
|
|
670
|
-
return;
|
|
671
|
-
logSearchCriteria(logger, "Incidents", criteria);
|
|
672
|
-
const allItems = await fetchAllPages((f, opts) => client.searchIncidents(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
673
|
-
const result = { items: allItems };
|
|
674
|
-
if (hasCiFilter && result.items) {
|
|
675
|
-
result.items = result.items.filter((incident) => {
|
|
676
|
-
if (options.iErrorMessage &&
|
|
677
|
-
!matchesCaseInsensitive(incident.errorMessage, options.iErrorMessage))
|
|
678
|
-
return false;
|
|
679
|
-
if (options.iProcessDefinitionId &&
|
|
680
|
-
!matchesCaseInsensitive(incident.processDefinitionId, options.iProcessDefinitionId))
|
|
681
|
-
return false;
|
|
682
|
-
if (errorMessageHasWildcard &&
|
|
683
|
-
options.errorMessage &&
|
|
684
|
-
!matchesCaseSensitive(incident.errorMessage, options.errorMessage))
|
|
685
|
-
return false;
|
|
686
|
-
return true;
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
if (result.items && result.items.length > 0) {
|
|
690
|
-
let tableData = result.items.map((incident) => ({
|
|
691
|
-
Key: incident.incidentKey || incident.key,
|
|
692
|
-
Type: incident.errorType,
|
|
693
|
-
Message: typeof incident.errorMessage === "string"
|
|
694
|
-
? incident.errorMessage.substring(0, 50)
|
|
695
|
-
: "",
|
|
696
|
-
State: incident.state,
|
|
697
|
-
Created: incident.creationTime || "-",
|
|
698
|
-
"Process Instance": incident.processInstanceKey,
|
|
699
|
-
"Tenant ID": incident.tenantId,
|
|
700
|
-
}));
|
|
701
|
-
tableData = sortTableData(tableData, options.sortBy, logger, options.sortOrder);
|
|
702
|
-
logger.table(tableData);
|
|
703
|
-
logResultCount(logger, result.items.length, "incident(s)", criteria.length > 0);
|
|
485
|
+
const filter = {
|
|
486
|
+
filter: {
|
|
487
|
+
tenantId,
|
|
488
|
+
},
|
|
489
|
+
};
|
|
490
|
+
if (flags.state) {
|
|
491
|
+
filter.filter.state = flags.state;
|
|
492
|
+
}
|
|
493
|
+
if (flags.processInstanceKey) {
|
|
494
|
+
filter.filter.processInstanceKey = flags.processInstanceKey;
|
|
495
|
+
}
|
|
496
|
+
if (flags.processDefinitionKey) {
|
|
497
|
+
filter.filter.processDefinitionKey = flags.processDefinitionKey;
|
|
498
|
+
}
|
|
499
|
+
if (flags.errorType) {
|
|
500
|
+
filter.filter.errorType = flags.errorType;
|
|
501
|
+
}
|
|
502
|
+
if (flags.errorMessage && !errorMessageHasWildcard) {
|
|
503
|
+
filter.filter.errorMessage = flags.errorMessage;
|
|
504
|
+
}
|
|
505
|
+
if (processDefinitionId) {
|
|
506
|
+
filter.filter.processDefinitionId = toStringFilter(processDefinitionId);
|
|
507
|
+
}
|
|
508
|
+
if (ctx.between) {
|
|
509
|
+
const parsed = parseBetween(ctx.between);
|
|
510
|
+
if (parsed) {
|
|
511
|
+
filter.filter.creationTime = buildDateFilter(parsed.from, parsed.to);
|
|
704
512
|
}
|
|
705
513
|
else {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
514
|
+
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
515
|
+
process.exit(1);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
const dr = dryRun({
|
|
519
|
+
command: "search incidents",
|
|
520
|
+
method: "POST",
|
|
521
|
+
endpoint: "/incidents/search",
|
|
522
|
+
profile,
|
|
523
|
+
body: filter,
|
|
524
|
+
});
|
|
525
|
+
if (dr)
|
|
526
|
+
return dr;
|
|
527
|
+
logSearchCriteria(logger, "Incidents", criteria);
|
|
528
|
+
const allItems = await fetchAllPages((f, opts) => client.searchIncidents(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
529
|
+
const result = { items: allItems };
|
|
530
|
+
if (hasCiFilter && result.items) {
|
|
531
|
+
result.items = result.items.filter((incident) => {
|
|
532
|
+
if (flags.ierrorMessage &&
|
|
533
|
+
!matchesCaseInsensitive(incident.errorMessage, flags.ierrorMessage))
|
|
534
|
+
return false;
|
|
535
|
+
if (flags.iid &&
|
|
536
|
+
!matchesCaseInsensitive(incident.processDefinitionId, flags.iid))
|
|
537
|
+
return false;
|
|
538
|
+
if (errorMessageHasWildcard &&
|
|
539
|
+
flags.errorMessage &&
|
|
540
|
+
!matchesCaseSensitive(incident.errorMessage, flags.errorMessage))
|
|
541
|
+
return false;
|
|
542
|
+
return true;
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
if (result.items && result.items.length > 0) {
|
|
546
|
+
let tableData = result.items.map((incident) => ({
|
|
547
|
+
Key: incident.incidentKey || incident.key,
|
|
548
|
+
Type: incident.errorType,
|
|
549
|
+
Message: typeof incident.errorMessage === "string"
|
|
550
|
+
? incident.errorMessage.substring(0, 50)
|
|
551
|
+
: "",
|
|
552
|
+
State: incident.state,
|
|
553
|
+
Created: incident.creationTime || "-",
|
|
554
|
+
"Process Instance": incident.processInstanceKey,
|
|
555
|
+
"Tenant ID": incident.tenantId,
|
|
556
|
+
}));
|
|
557
|
+
tableData = sortTableData(tableData, ctx.sortBy, logger, ctx.sortOrder);
|
|
558
|
+
logger.table(tableData);
|
|
559
|
+
logResultCount(logger, result.items.length, "incident(s)", criteria.length > 0);
|
|
709
560
|
}
|
|
710
|
-
|
|
711
|
-
|
|
561
|
+
else {
|
|
562
|
+
logNoResults(logger, "incidents", criteria.length > 0);
|
|
712
563
|
}
|
|
713
|
-
}
|
|
564
|
+
});
|
|
714
565
|
/**
|
|
715
566
|
* Search jobs
|
|
716
567
|
*/
|
|
717
|
-
export async
|
|
718
|
-
const logger =
|
|
719
|
-
const
|
|
720
|
-
const tenantId = resolveTenantId(options.profile);
|
|
721
|
-
const hasCiFilter = !!options.iType;
|
|
568
|
+
export const searchJobsCommand = defineCommand("search", "jobs", async (ctx, flags, _args) => {
|
|
569
|
+
const { client, logger, tenantId, profile } = ctx;
|
|
570
|
+
const hasCiFilter = !!flags.itype;
|
|
722
571
|
// Build search criteria description for user feedback
|
|
723
572
|
const criteria = [];
|
|
724
|
-
if (
|
|
725
|
-
criteria.push(formatCriterion("state",
|
|
573
|
+
if (flags.state) {
|
|
574
|
+
criteria.push(formatCriterion("state", flags.state));
|
|
726
575
|
}
|
|
727
|
-
if (
|
|
728
|
-
criteria.push(formatCriterion("type",
|
|
576
|
+
if (flags.type) {
|
|
577
|
+
criteria.push(formatCriterion("type", flags.type));
|
|
729
578
|
}
|
|
730
|
-
if (
|
|
731
|
-
criteria.push(formatCriterion("Process Instance Key",
|
|
579
|
+
if (flags.processInstanceKey) {
|
|
580
|
+
criteria.push(formatCriterion("Process Instance Key", flags.processInstanceKey));
|
|
732
581
|
}
|
|
733
|
-
if (
|
|
734
|
-
criteria.push(formatCriterion("Process Definition Key",
|
|
582
|
+
if (flags.processDefinitionKey) {
|
|
583
|
+
criteria.push(formatCriterion("Process Definition Key", flags.processDefinitionKey));
|
|
735
584
|
}
|
|
736
|
-
if (
|
|
737
|
-
criteria.push(formatCriterion("type",
|
|
585
|
+
if (flags.itype) {
|
|
586
|
+
criteria.push(formatCriterion("type", flags.itype, true));
|
|
738
587
|
}
|
|
739
|
-
if (
|
|
740
|
-
const field =
|
|
741
|
-
criteria.push(`'${field}' between "${
|
|
588
|
+
if (ctx.between) {
|
|
589
|
+
const field = ctx.dateField ?? "creationTime";
|
|
590
|
+
criteria.push(`'${field}' between "${ctx.between}"`);
|
|
742
591
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
filter.filter[field] = buildDateFilter(parsed.from, parsed.to);
|
|
766
|
-
}
|
|
767
|
-
else {
|
|
768
|
-
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
769
|
-
process.exit(1);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
if (emitDryRun({
|
|
773
|
-
command: "search jobs",
|
|
774
|
-
method: "POST",
|
|
775
|
-
endpoint: "/jobs/search",
|
|
776
|
-
profile: options.profile,
|
|
777
|
-
body: filter,
|
|
778
|
-
}))
|
|
779
|
-
return;
|
|
780
|
-
logSearchCriteria(logger, "Jobs", criteria);
|
|
781
|
-
const allItems = await fetchAllPages((f, opts) => client.searchJobs(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
782
|
-
const result = { items: allItems };
|
|
783
|
-
if (hasCiFilter && result.items) {
|
|
784
|
-
result.items = result.items.filter((job) => {
|
|
785
|
-
if (options.iType && !matchesCaseInsensitive(job.type, options.iType))
|
|
786
|
-
return false;
|
|
787
|
-
return true;
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
if (result.items && result.items.length > 0) {
|
|
791
|
-
let tableData = result.items.map((job) => ({
|
|
792
|
-
Key: job.jobKey || job.key,
|
|
793
|
-
Type: job.type,
|
|
794
|
-
State: job.state,
|
|
795
|
-
Retries: job.retries,
|
|
796
|
-
Created: job.creationTime || "-",
|
|
797
|
-
"Process Instance": job.processInstanceKey,
|
|
798
|
-
"Tenant ID": job.tenantId,
|
|
799
|
-
}));
|
|
800
|
-
tableData = sortTableData(tableData, options.sortBy, logger, options.sortOrder);
|
|
801
|
-
logger.table(tableData);
|
|
802
|
-
logResultCount(logger, result.items.length, "job(s)", criteria.length > 0);
|
|
592
|
+
const filter = {
|
|
593
|
+
filter: {
|
|
594
|
+
tenantId,
|
|
595
|
+
},
|
|
596
|
+
};
|
|
597
|
+
if (flags.state) {
|
|
598
|
+
filter.filter.state = flags.state;
|
|
599
|
+
}
|
|
600
|
+
if (flags.type) {
|
|
601
|
+
filter.filter.type = toStringFilter(flags.type);
|
|
602
|
+
}
|
|
603
|
+
if (flags.processInstanceKey) {
|
|
604
|
+
filter.filter.processInstanceKey = flags.processInstanceKey;
|
|
605
|
+
}
|
|
606
|
+
if (flags.processDefinitionKey) {
|
|
607
|
+
filter.filter.processDefinitionKey = flags.processDefinitionKey;
|
|
608
|
+
}
|
|
609
|
+
if (ctx.between) {
|
|
610
|
+
const parsed = parseBetween(ctx.between);
|
|
611
|
+
if (parsed) {
|
|
612
|
+
const field = ctx.dateField ?? "creationTime";
|
|
613
|
+
filter.filter[field] = buildDateFilter(parsed.from, parsed.to);
|
|
803
614
|
}
|
|
804
615
|
else {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
616
|
+
logger.error("Invalid --between value. Expected format: <from>..<to> (e.g. 2024-01-01..2024-12-31, ISO 8601 datetimes, or open-ended: ..2024-12-31 or 2024-01-01..)");
|
|
617
|
+
process.exit(1);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
const dr = dryRun({
|
|
621
|
+
command: "search jobs",
|
|
622
|
+
method: "POST",
|
|
623
|
+
endpoint: "/jobs/search",
|
|
624
|
+
profile,
|
|
625
|
+
body: filter,
|
|
626
|
+
});
|
|
627
|
+
if (dr)
|
|
628
|
+
return dr;
|
|
629
|
+
logSearchCriteria(logger, "Jobs", criteria);
|
|
630
|
+
const allItems = await fetchAllPages((f, opts) => client.searchJobs(f, opts), filter, ...(hasCiFilter ? [CI_PAGE_SIZE] : []));
|
|
631
|
+
const result = { items: allItems };
|
|
632
|
+
if (hasCiFilter && result.items) {
|
|
633
|
+
result.items = result.items.filter((job) => {
|
|
634
|
+
if (flags.itype && !matchesCaseInsensitive(job.type, flags.itype))
|
|
635
|
+
return false;
|
|
636
|
+
return true;
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
if (result.items && result.items.length > 0) {
|
|
640
|
+
let tableData = result.items.map((job) => ({
|
|
641
|
+
Key: job.jobKey || job.key,
|
|
642
|
+
Type: job.type,
|
|
643
|
+
State: job.state,
|
|
644
|
+
Retries: job.retries,
|
|
645
|
+
Created: job.creationTime || "-",
|
|
646
|
+
"Process Instance": job.processInstanceKey,
|
|
647
|
+
"Tenant ID": job.tenantId,
|
|
648
|
+
}));
|
|
649
|
+
tableData = sortTableData(tableData, ctx.sortBy, logger, ctx.sortOrder);
|
|
650
|
+
logger.table(tableData);
|
|
651
|
+
logResultCount(logger, result.items.length, "job(s)", criteria.length > 0);
|
|
808
652
|
}
|
|
809
|
-
|
|
810
|
-
|
|
653
|
+
else {
|
|
654
|
+
logNoResults(logger, "jobs", criteria.length > 0);
|
|
811
655
|
}
|
|
812
|
-
}
|
|
656
|
+
});
|
|
813
657
|
/**
|
|
814
658
|
* Search variables
|
|
815
659
|
*/
|
|
816
|
-
export async
|
|
817
|
-
const logger =
|
|
818
|
-
const
|
|
819
|
-
const tenantId = resolveTenantId(options.profile);
|
|
820
|
-
const hasCiFilter = !!(options.iName || options.iValue);
|
|
660
|
+
export const searchVariablesCommand = defineCommand("search", "variable", async (ctx, flags, _args) => {
|
|
661
|
+
const { client, logger, tenantId, profile } = ctx;
|
|
662
|
+
const hasCiFilter = !!(flags.iname || flags.ivalue);
|
|
821
663
|
// Build search criteria description for user feedback
|
|
822
664
|
const criteria = [];
|
|
823
|
-
if (
|
|
824
|
-
criteria.push(formatCriterion("name",
|
|
665
|
+
if (flags.name) {
|
|
666
|
+
criteria.push(formatCriterion("name", flags.name));
|
|
825
667
|
}
|
|
826
|
-
if (
|
|
827
|
-
criteria.push(formatCriterion("value",
|
|
668
|
+
if (flags.value) {
|
|
669
|
+
criteria.push(formatCriterion("value", flags.value));
|
|
828
670
|
}
|
|
829
|
-
if (
|
|
830
|
-
criteria.push(formatCriterion("Process Instance Key",
|
|
671
|
+
if (flags.processInstanceKey) {
|
|
672
|
+
criteria.push(formatCriterion("Process Instance Key", flags.processInstanceKey));
|
|
831
673
|
}
|
|
832
|
-
if (
|
|
833
|
-
criteria.push(formatCriterion("Scope Key",
|
|
674
|
+
if (flags.scopeKey) {
|
|
675
|
+
criteria.push(formatCriterion("Scope Key", flags.scopeKey));
|
|
834
676
|
}
|
|
835
|
-
if (
|
|
836
|
-
criteria.push(formatCriterion("name",
|
|
677
|
+
if (flags.iname) {
|
|
678
|
+
criteria.push(formatCriterion("name", flags.iname, true));
|
|
837
679
|
}
|
|
838
|
-
if (
|
|
839
|
-
criteria.push(formatCriterion("value",
|
|
680
|
+
if (flags.ivalue) {
|
|
681
|
+
criteria.push(formatCriterion("value", flags.ivalue, true));
|
|
840
682
|
}
|
|
841
|
-
if (
|
|
683
|
+
if (flags.fullValue) {
|
|
842
684
|
criteria.push(formatCriterion("fullValue", true));
|
|
843
685
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
rawValue = parsed;
|
|
890
|
-
}
|
|
891
|
-
catch {
|
|
892
|
-
/* keep original value */
|
|
893
|
-
}
|
|
894
|
-
if (!matchesCaseInsensitive(rawValue, options.iValue))
|
|
895
|
-
return false;
|
|
686
|
+
const filter = {
|
|
687
|
+
filter: {
|
|
688
|
+
tenantId,
|
|
689
|
+
},
|
|
690
|
+
};
|
|
691
|
+
if (flags.name) {
|
|
692
|
+
filter.filter.name = toStringFilter(flags.name);
|
|
693
|
+
}
|
|
694
|
+
if (flags.value) {
|
|
695
|
+
filter.filter.value = toStringFilter(flags.value);
|
|
696
|
+
}
|
|
697
|
+
if (flags.processInstanceKey) {
|
|
698
|
+
filter.filter.processInstanceKey = flags.processInstanceKey;
|
|
699
|
+
}
|
|
700
|
+
if (flags.scopeKey) {
|
|
701
|
+
filter.filter.scopeKey = flags.scopeKey;
|
|
702
|
+
}
|
|
703
|
+
// By default, truncate values unless --fullValue is specified
|
|
704
|
+
const truncateValues = !flags.fullValue;
|
|
705
|
+
const dr = dryRun({
|
|
706
|
+
command: "search variables",
|
|
707
|
+
method: "POST",
|
|
708
|
+
endpoint: "/variables/search",
|
|
709
|
+
profile,
|
|
710
|
+
body: { ...filter, truncateValues },
|
|
711
|
+
});
|
|
712
|
+
if (dr)
|
|
713
|
+
return dr;
|
|
714
|
+
logSearchCriteria(logger, "Variables", criteria);
|
|
715
|
+
const allItems = await fetchAllPages((f, opts) => client.searchVariables({ ...f, truncateValues }, opts), filter, hasCiFilter ? CI_PAGE_SIZE : DEFAULT_PAGE_SIZE, ctx.limit);
|
|
716
|
+
const result = { items: allItems };
|
|
717
|
+
if (hasCiFilter && result.items) {
|
|
718
|
+
result.items = result.items.filter((variable) => {
|
|
719
|
+
if (flags.iname && !matchesCaseInsensitive(variable.name, flags.iname))
|
|
720
|
+
return false;
|
|
721
|
+
if (flags.ivalue) {
|
|
722
|
+
// Variable values come JSON-encoded from the API (e.g., '"PendingReview"').
|
|
723
|
+
// Unwrap the JSON string for comparison so users can match the actual value.
|
|
724
|
+
let rawValue = typeof variable.value === "string"
|
|
725
|
+
? variable.value
|
|
726
|
+
: String(variable.value ?? "");
|
|
727
|
+
try {
|
|
728
|
+
const parsed = JSON.parse(rawValue);
|
|
729
|
+
if (typeof parsed === "string")
|
|
730
|
+
rawValue = parsed;
|
|
896
731
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}
|
|
900
|
-
if (result.items && result.items.length > 0) {
|
|
901
|
-
let tableData = result.items.map((variable) => {
|
|
902
|
-
const row = {
|
|
903
|
-
Name: variable.name,
|
|
904
|
-
Value: variable.value || "",
|
|
905
|
-
"Process Instance": variable.processInstanceKey,
|
|
906
|
-
"Scope Key": variable.scopeKey,
|
|
907
|
-
"Tenant ID": variable.tenantId,
|
|
908
|
-
};
|
|
909
|
-
if (variable.isTruncated) {
|
|
910
|
-
row.Truncated = "✓";
|
|
732
|
+
catch {
|
|
733
|
+
/* keep original value */
|
|
911
734
|
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
tableData = sortTableData(tableData, options.sortBy, logger, options.sortOrder);
|
|
915
|
-
logger.table(tableData);
|
|
916
|
-
logResultCount(logger, result.items.length, "variable(s)", criteria.length > 0);
|
|
917
|
-
if (!options.fullValue && result.items.some((v) => v.isTruncated)) {
|
|
918
|
-
logger.info("Some values are truncated. Use --fullValue to see full values.");
|
|
735
|
+
if (!matchesCaseInsensitive(rawValue, flags.ivalue))
|
|
736
|
+
return false;
|
|
919
737
|
}
|
|
738
|
+
return true;
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
if (result.items && result.items.length > 0) {
|
|
742
|
+
let tableData = result.items.map((variable) => {
|
|
743
|
+
const row = {
|
|
744
|
+
Name: variable.name,
|
|
745
|
+
Value: variable.value || "",
|
|
746
|
+
"Process Instance": variable.processInstanceKey,
|
|
747
|
+
"Scope Key": variable.scopeKey,
|
|
748
|
+
"Tenant ID": variable.tenantId,
|
|
749
|
+
};
|
|
750
|
+
if (variable.isTruncated) {
|
|
751
|
+
row.Truncated = "✓";
|
|
752
|
+
}
|
|
753
|
+
return row;
|
|
754
|
+
});
|
|
755
|
+
tableData = sortTableData(tableData, ctx.sortBy, logger, ctx.sortOrder);
|
|
756
|
+
logger.table(tableData);
|
|
757
|
+
logResultCount(logger, result.items.length, "variable(s)", criteria.length > 0);
|
|
758
|
+
if (!flags.fullValue && result.items.some((v) => v.isTruncated)) {
|
|
759
|
+
logger.info("Some values are truncated. Use --fullValue to see full values.");
|
|
920
760
|
}
|
|
921
|
-
else {
|
|
922
|
-
logNoResults(logger, "variables", criteria.length > 0, options._unknownFlags);
|
|
923
|
-
}
|
|
924
|
-
return result;
|
|
925
761
|
}
|
|
926
|
-
|
|
927
|
-
|
|
762
|
+
else {
|
|
763
|
+
logNoResults(logger, "variables", criteria.length > 0);
|
|
928
764
|
}
|
|
929
|
-
}
|
|
765
|
+
});
|
|
930
766
|
//# sourceMappingURL=search.js.map
|