@thinkingai/ae-cli 6.0.39 → 6.0.41
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 +0 -2
- package/README.zh.md +0 -2
- package/dist/{auth-NN55553T.js → auth-GBMV6TEJ.js} +2 -2
- package/dist/{auth-GDV3H5I4.js → auth-NDSXE54J.js} +4 -4
- package/dist/{capability-TPORIKRQ.js → capability-CETVHGXF.js} +25 -15
- package/dist/{capability-VQNC5CF7.js → capability-ZSQBMNOE.js} +25 -15
- package/dist/{chunk-GJJA4CQZ.js → chunk-3FY3RJ26.js} +0 -4
- package/dist/chunk-4E3DB4MM.js +556 -0
- package/dist/{chunk-GS2P7LFD.js → chunk-5XUSIK27.js} +2 -2
- package/dist/{chunk-VTXHDCBW.js → chunk-AFXA7BRK.js} +2 -2
- package/dist/{chunk-7KQWSBSL.js → chunk-FNZA5RZA.js} +8 -8
- package/dist/{chunk-TS6BUGUY.js → chunk-J2N4PB56.js} +8 -8
- package/dist/{chunk-RBNKI5ZW.js → chunk-JUW4AJXN.js} +2 -2
- package/dist/{chunk-Z3OXWCIA.js → chunk-S5NTSDBS.js} +2 -2
- package/dist/{chunk-VKD5WQKN.js → chunk-VLWOLBGZ.js} +142 -24
- package/dist/chunk-WANVG6SY.js +556 -0
- package/dist/{chunk-YTG6Q75E.js → chunk-WZRX4KOH.js} +25 -3
- package/dist/{chunk-YV52FB5G.js → chunk-ZQKDZXDO.js} +1 -1
- package/dist/{cli-token-GL5MS5FK.js → cli-token-4UPER74P.js} +3 -3
- package/dist/{chunk-6A2FUCIS.js → client-L2YDMHQ6.js} +5 -6
- package/dist/{config-4VZNLBKF.js → config-OL2LWGBV.js} +4 -33
- package/dist/index.js +31 -44
- package/dist/{memory-RWJW4XFO.js → memory-MUP7PPL7.js} +4 -4
- package/dist/{memory-VO2ZJCRT.js → memory-U4O5PMXH.js} +4 -4
- package/dist/{metadata-YGTHR2XJ.js → metadata-UKZDNLLQ.js} +21 -11
- package/dist/{metadata-ZRN2GHPN.js → metadata-XXMJFN2M.js} +21 -11
- package/dist/{model-CLUIK3K5.js → model-JTUEO5M4.js} +2 -2
- package/dist/{sync-3REDHGY6.js → sync-MOSFNBVR.js} +5 -5
- package/dist/{te-agent-XNPELAKX.js → te-agent-IFKZDHZI.js} +25 -18
- package/dist/{te-analysis-GJI5FZUL.js → te-analysis-3QLLS35K.js} +1231 -456
- package/dist/{te-analysis-N2BRDJZ5.js → te-analysis-YSK2DBVL.js} +1231 -456
- package/dist/{te-community-SQXKE5OO.js → te-community-HNKVTERD.js} +207 -12
- package/dist/{te-community-TYSNU3NQ.js → te-community-IWE5B7W6.js} +208 -12
- package/dist/{te-dataops-OWIADNSM.js → te-dataops-KQPYNAE3.js} +262 -145
- package/dist/{te-dataops-5TM7WZDI.js → te-dataops-KXCEB4CS.js} +262 -145
- package/dist/{te-engage-F7V55KVW.js → te-engage-6RNGK5GH.js} +961 -42
- package/dist/{te-engage-FMYAYCNV.js → te-engage-IRMHTSQK.js} +961 -42
- package/dist/{te-kb-VRMEY3D4.js → te-kb-OIH3T6CS.js} +4 -4
- package/dist/{te-system-XGS5EQIQ.js → te-system-AZ3URMUO.js} +515 -11
- package/dist/{te-team-BZRDV2CM.js → te-team-GZPU6UWA.js} +5 -5
- package/dist/{update-HEDXGOJH.js → update-TOBFXF2V.js} +4 -4
- package/package.json +6 -6
- package/skills/ae-agent/SKILL.md +3 -3
- package/skills/ae-agent/references/list-skill-references.md +4 -4
- package/skills/ae-agent/references/read-skill-reference.md +10 -7
- package/skills/ae-agent/references/upload-skill-reference.md +11 -9
- package/skills/ae-analysis/SKILL.md +15 -12
- package/skills/ae-analysis/metadata_resolution.md +150 -0
- package/skills/ae-analysis/references/adhoc_export.md +17 -2
- package/skills/ae-analysis/references/adhoc_run.md +12 -8
- package/skills/ae-analysis/references/ai_models.md +31 -5
- package/skills/ae-analysis/references/analysis_data_retrieval.md +104 -16
- package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -4
- package/skills/ae-analysis/references/analysis_gateway_assets.md +12 -10
- package/skills/ae-analysis/references/artifact_download.md +4 -3
- package/skills/ae-analysis/references/asset_abnormal_list.md +5 -3
- package/skills/ae-analysis/references/asset_authentication_list.md +5 -3
- package/skills/ae-analysis/references/asset_search.md +5 -3
- package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
- package/skills/ae-analysis/references/bi_panel_page_data_run.md +4 -4
- package/skills/ae-analysis/references/catalog_export.md +28 -0
- package/skills/ae-analysis/references/catalog_list.md +44 -0
- package/skills/ae-analysis/references/command_index.md +72 -63
- package/skills/ae-analysis/references/dashboard_report_data_run.md +11 -4
- package/skills/ae-analysis/references/datatable_version_list.md +5 -3
- package/skills/ae-analysis/references/drilldown_entities_run.md +4 -4
- package/skills/ae-analysis/references/drilldown_events_run.md +2 -2
- package/skills/ae-analysis/references/drilldown_user_events_export.md +1 -1
- package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -2
- package/skills/ae-analysis/references/entity_detail_run.md +4 -4
- package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
- package/skills/ae-analysis/references/event_detail_run.md +4 -4
- package/skills/ae-analysis/references/event_export.md +21 -0
- package/skills/ae-analysis/references/event_list.md +7 -6
- package/skills/ae-analysis/references/exchange_rule_list.md +5 -3
- package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +4 -2
- package/skills/ae-analysis/references/history_tag_data_drilldown_run.md +2 -2
- package/skills/ae-analysis/references/history_tag_data_run.md +2 -2
- package/skills/ae-analysis/references/metric_export.md +21 -0
- package/skills/ae-analysis/references/metric_list.md +8 -7
- package/skills/ae-analysis/references/property_export.md +21 -0
- package/skills/ae-analysis/references/property_list.md +9 -8
- package/skills/ae-analysis/references/query_context_get.md +20 -0
- package/skills/ae-analysis/references/query_create_result_cluster.md +1 -1
- package/skills/ae-analysis/references/report_change_log_list.md +1 -1
- package/skills/ae-analysis/references/report_create.md +3 -3
- package/skills/ae-analysis/references/report_data_run.md +8 -8
- package/skills/ae-analysis/references/report_update.md +3 -3
- package/skills/ae-analysis/references/report_version_rollback.md +1 -1
- package/skills/ae-analysis/references/rule_list.md +6 -4
- package/skills/ae-analysis/references/run_inspect.md +8 -5
- package/skills/ae-analysis/references/run_wait.md +37 -0
- package/skills/ae-analysis/references/user_cluster_export.md +13 -0
- package/skills/ae-analysis/references/user_cluster_list.md +6 -2
- package/skills/ae-analysis/references/user_cluster_member_export.md +5 -3
- package/skills/ae-analysis/references/user_cluster_member_list.md +4 -4
- package/skills/ae-analysis/references/user_tag_export.md +13 -0
- package/skills/ae-analysis/references/user_tag_list.md +6 -2
- package/skills/ae-analysis/references/user_tag_member_export.md +5 -3
- package/skills/ae-analysis/references/user_tag_member_list.md +4 -4
- package/skills/ae-analysis/references/virtual_property_create.md +2 -2
- package/skills/ae-community/SKILL.md +2 -2
- package/skills/ae-dataops/SKILL.md +4 -3
- package/skills/ae-dataops/references/dataops-flow-create.md +47 -3
- package/skills/ae-engage/SKILL.md +57 -7
- package/skills/ae-engage/references/activity-data-detail.md +61 -0
- package/skills/ae-engage/references/build-task-save-guide.md +37 -1
- package/skills/ae-engage/references/cancel-query-run.md +31 -0
- package/skills/ae-engage/references/common-metric.md +45 -0
- package/skills/ae-engage/references/config-item-analysis-report.md +14 -1
- package/skills/ae-engage/references/config-item-strategy-comparison.md +11 -1
- package/skills/ae-engage/references/config-item-trigger-report.md +15 -1
- package/skills/ae-engage/references/flow-metric-detail-report.md +134 -0
- package/skills/ae-engage/references/flow-metric-update.md +77 -0
- package/skills/ae-engage/references/flow-metric-user.md +118 -0
- package/skills/ae-engage/references/flow-node-metric-user.md +122 -0
- package/skills/ae-engage/references/flow-node-user.md +122 -0
- package/skills/ae-engage/references/preset-event.md +2 -0
- package/skills/ae-engage/references/push-record-query.md +32 -1
- package/skills/ae-engage/references/save-flow.md +14 -0
- package/skills/ae-engage/references/save-task.md +44 -0
- package/skills/ae-engage/references/scene-strategy-audience.md +12 -7
- package/skills/ae-engage/references/task-data-detail.md +9 -2
- package/skills/ae-engage/references/task-metric-detail.md +9 -2
- package/skills/ae-engage/references/task-submit-approval.md +3 -0
- package/skills/ae-metadata/SKILL.md +2 -1
- package/skills/ae-metadata/references/metadata_data_table_download.md +10 -2
- package/skills/ae-metadata/references/metadata_data_table_list.md +5 -2
- package/skills/ae-system/SKILL.md +66 -3
- package/dist/chunk-DT6Y3TD7.js +0 -232
- package/dist/chunk-MVDZ7DBQ.js +0 -231
- package/dist/chunk-NBPKWKRA.js +0 -51
- package/dist/client-DAIPF7XN.js +0 -23
- package/dist/raw-52B4UKO4.js +0 -71
- package/dist/te-meta-53BVXPFI.js +0 -95
- package/dist/te-meta-TOCBPBXI.js +0 -95
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapabilityCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J2N4PB56.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
CapabilityGatewayError,
|
|
6
|
+
buildCapabilityGatewayUrl,
|
|
7
|
+
fetchCapabilityGateway,
|
|
8
|
+
requestCapabilityGateway,
|
|
9
|
+
requestCapabilityGatewayWithEnvelope
|
|
10
|
+
} from "./chunk-5XUSIK27.js";
|
|
11
|
+
import {
|
|
12
|
+
printError,
|
|
13
|
+
withOutputMetadata
|
|
14
|
+
} from "./chunk-WZRX4KOH.js";
|
|
7
15
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
16
|
+
registerCapabilityGatewayRoute,
|
|
17
|
+
resolveGatewayDomain
|
|
18
|
+
} from "./chunk-PTE56QPL.js";
|
|
19
|
+
import "./chunk-S5NTSDBS.js";
|
|
20
|
+
import "./chunk-ZQKDZXDO.js";
|
|
21
|
+
import "./chunk-3FY3RJ26.js";
|
|
14
22
|
import {
|
|
15
23
|
CliValidationError
|
|
16
24
|
} from "./chunk-AXDXJTPC.js";
|
|
@@ -42,6 +50,9 @@ function createEngageActivityCapabilityCommand(config) {
|
|
|
42
50
|
function createEngageWorkbenchCapabilityCommand(config) {
|
|
43
51
|
return createEngageCapabilityCommand("engage-workbench", config);
|
|
44
52
|
}
|
|
53
|
+
function createEngageQueryCapabilityCommand(config) {
|
|
54
|
+
return createEngageCapabilityCommand("engage-query", config);
|
|
55
|
+
}
|
|
45
56
|
|
|
46
57
|
// src/commands/te-engage/engage-flow/flow/update-remark.ts
|
|
47
58
|
var flowUpdateRemark = createEngageFlowCapabilityCommand({
|
|
@@ -78,6 +89,9 @@ function readOptionalString(ctx, name) {
|
|
|
78
89
|
function readOptionalNumber(ctx, name) {
|
|
79
90
|
return hasFlag(ctx, name) ? ctx.num(name) : void 0;
|
|
80
91
|
}
|
|
92
|
+
function readOptionalBoolean(ctx, name) {
|
|
93
|
+
return hasFlag(ctx, name) ? ctx.bool(name) : void 0;
|
|
94
|
+
}
|
|
81
95
|
function readOptionalJsonArray(ctx, name) {
|
|
82
96
|
const value = ctx.json(name);
|
|
83
97
|
if (value === void 0) return void 0;
|
|
@@ -209,6 +223,375 @@ var flowModifyBaseInfo = createEngageFlowCapabilityCommand({
|
|
|
209
223
|
})
|
|
210
224
|
});
|
|
211
225
|
|
|
226
|
+
// src/commands/te-engage/semantic-qp-validation.ts
|
|
227
|
+
var OPERATORS = /* @__PURE__ */ new Set([
|
|
228
|
+
"eq",
|
|
229
|
+
"neq",
|
|
230
|
+
"lt",
|
|
231
|
+
"lte",
|
|
232
|
+
"gt",
|
|
233
|
+
"gte",
|
|
234
|
+
"exists",
|
|
235
|
+
"not_exists",
|
|
236
|
+
"between",
|
|
237
|
+
"contains",
|
|
238
|
+
"not_contains",
|
|
239
|
+
"is_true",
|
|
240
|
+
"is_false",
|
|
241
|
+
"regex",
|
|
242
|
+
"not_regex",
|
|
243
|
+
"relative_current_time",
|
|
244
|
+
"relative_event_time",
|
|
245
|
+
"array_contains",
|
|
246
|
+
"in_cluster",
|
|
247
|
+
"not_in_cluster"
|
|
248
|
+
]);
|
|
249
|
+
var AUDIENCE_AGGREGATIONS = /* @__PURE__ */ new Set([
|
|
250
|
+
"count",
|
|
251
|
+
"active_days",
|
|
252
|
+
"sum",
|
|
253
|
+
"avg",
|
|
254
|
+
"max",
|
|
255
|
+
"min",
|
|
256
|
+
"distinct_count"
|
|
257
|
+
]);
|
|
258
|
+
var METRIC_AGGREGATIONS = /* @__PURE__ */ new Set([
|
|
259
|
+
"total_count",
|
|
260
|
+
"user_count",
|
|
261
|
+
"per_user_count",
|
|
262
|
+
"sum",
|
|
263
|
+
"avg",
|
|
264
|
+
"avg_per_user",
|
|
265
|
+
"max",
|
|
266
|
+
"min",
|
|
267
|
+
"distinct_count",
|
|
268
|
+
"median",
|
|
269
|
+
"percentile",
|
|
270
|
+
"variance",
|
|
271
|
+
"stddev"
|
|
272
|
+
]);
|
|
273
|
+
var TASK_TRIGGER_PERIOD_SYMBOLS = /* @__PURE__ */ new Set(["TS01", "TS02", "TS03", "TS04"]);
|
|
274
|
+
function validateSemanticAudienceDefinition(value, path) {
|
|
275
|
+
const definition = object(value, path);
|
|
276
|
+
rejectUnknown(definition, ["type", "conditions", "include_filter", "exclude_filter"], path);
|
|
277
|
+
exactString(definition.type, "condition", `${path}.type`);
|
|
278
|
+
validateGroup(definition.conditions, `${path}.conditions`);
|
|
279
|
+
optional(definition.include_filter, (item) => validateGroup(item, `${path}.include_filter`));
|
|
280
|
+
optional(definition.exclude_filter, (item) => validateGroup(item, `${path}.exclude_filter`));
|
|
281
|
+
}
|
|
282
|
+
function validateSemanticEventDefinition(value, path) {
|
|
283
|
+
const event = object(value, path);
|
|
284
|
+
rejectUnknown(event, [
|
|
285
|
+
"type",
|
|
286
|
+
"event",
|
|
287
|
+
"operator",
|
|
288
|
+
"value",
|
|
289
|
+
"aggregation",
|
|
290
|
+
"property",
|
|
291
|
+
"time_range",
|
|
292
|
+
"filters"
|
|
293
|
+
], path);
|
|
294
|
+
exactString(event.type, "event", `${path}.type`);
|
|
295
|
+
nonBlankString(event.event, `${path}.event`);
|
|
296
|
+
optionalEnum(event.operator, OPERATORS, `${path}.operator`);
|
|
297
|
+
optionalNumber(event.value, `${path}.value`);
|
|
298
|
+
optionalEnum(event.aggregation, AUDIENCE_AGGREGATIONS, `${path}.aggregation`);
|
|
299
|
+
optionalString(event.property, `${path}.property`);
|
|
300
|
+
optional(event.time_range, (item) => validateTimeRange(item, `${path}.time_range`));
|
|
301
|
+
optional(event.filters, (item) => validateFilterGroup(item, `${path}.filters`));
|
|
302
|
+
}
|
|
303
|
+
function validateSemanticMetricDefinition(value, path) {
|
|
304
|
+
const metric = object(value, path);
|
|
305
|
+
if (metric.type === "event") {
|
|
306
|
+
validateMetricEvent(metric, path, false);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (metric.type === "formula") {
|
|
310
|
+
rejectUnknown(metric, ["type", "expression", "dependencies", "format"], path);
|
|
311
|
+
nonBlankString(metric.expression, `${path}.expression`);
|
|
312
|
+
optionalString(metric.format, `${path}.format`);
|
|
313
|
+
array(metric.dependencies, `${path}.dependencies`, 1).forEach((dependency, index) => validateMetricEvent(
|
|
314
|
+
object(dependency, `${path}.dependencies[${index}]`),
|
|
315
|
+
`${path}.dependencies[${index}]`,
|
|
316
|
+
true
|
|
317
|
+
));
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
invalid(`${path}.type must be event or formula.`);
|
|
321
|
+
}
|
|
322
|
+
function validateEmbeddedSemanticDefinitions(value, path) {
|
|
323
|
+
walk(value, path);
|
|
324
|
+
}
|
|
325
|
+
function validateTaskTriggerPeriodDefinition(value, path) {
|
|
326
|
+
const request = object(value, path);
|
|
327
|
+
if (!isObject(request.triggerConfig)) return;
|
|
328
|
+
const triggerConfig = request.triggerConfig;
|
|
329
|
+
if (triggerConfig.triggerDefinition === void 0 || triggerConfig.triggerDefinition === null) return;
|
|
330
|
+
const definition = object(triggerConfig.triggerDefinition, `${path}.triggerConfig.triggerDefinition`);
|
|
331
|
+
const rules = array(definition.rules, `${path}.triggerConfig.triggerDefinition.rules`, 1);
|
|
332
|
+
const primaryRule = object(rules[0], `${path}.triggerConfig.triggerDefinition.rules[0]`);
|
|
333
|
+
const symbolPath = `${path}.triggerConfig.triggerDefinition.rules[0].periodTimeSymbol`;
|
|
334
|
+
required(primaryRule.periodTimeSymbol, symbolPath);
|
|
335
|
+
enumValue(primaryRule.periodTimeSymbol, TASK_TRIGGER_PERIOD_SYMBOLS, symbolPath);
|
|
336
|
+
}
|
|
337
|
+
function walk(value, path) {
|
|
338
|
+
if (Array.isArray(value)) {
|
|
339
|
+
value.forEach((item, index) => walk(item, `${path}[${index}]`));
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (!isObject(value)) return;
|
|
343
|
+
for (const [key, item] of Object.entries(value)) {
|
|
344
|
+
const itemPath = `${path}.${key}`;
|
|
345
|
+
if (item === void 0 || item === null) continue;
|
|
346
|
+
if (["definitionRequest", "targetDefinitionRequest", "topicDefinitionRequest"].includes(key)) {
|
|
347
|
+
validateSemanticAudienceDefinition(item, itemPath);
|
|
348
|
+
} else if (key === "eventDefinition") {
|
|
349
|
+
validateSemanticEventDefinition(item, itemPath);
|
|
350
|
+
} else if (key === "triggerDefinition") {
|
|
351
|
+
validateTriggerDefinition(item, itemPath);
|
|
352
|
+
} else if (key === "config" && typeof item === "string") {
|
|
353
|
+
walkJsonString(item, itemPath);
|
|
354
|
+
} else {
|
|
355
|
+
walk(item, itemPath);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function validateTriggerDefinition(value, path) {
|
|
360
|
+
const definition = object(value, path);
|
|
361
|
+
rejectUnknown(definition, ["rules"], path);
|
|
362
|
+
array(definition.rules, `${path}.rules`, 1).forEach((ruleValue, ruleIndex) => {
|
|
363
|
+
const rulePath = `${path}.rules[${ruleIndex}]`;
|
|
364
|
+
const rule = object(ruleValue, rulePath);
|
|
365
|
+
array(rule.events, `${rulePath}.events`, 1).forEach((event, eventIndex) => {
|
|
366
|
+
const eventPath = `${rulePath}.events[${eventIndex}]`;
|
|
367
|
+
const candidate = object(event, eventPath);
|
|
368
|
+
if ("eventDefinition" in candidate) {
|
|
369
|
+
validateSemanticEventDefinition(candidate.eventDefinition, `${eventPath}.eventDefinition`);
|
|
370
|
+
} else {
|
|
371
|
+
validateSemanticEventDefinition(candidate, eventPath);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
optional(rule.blackList, (items) => array(items, `${rulePath}.blackList`).forEach((event, index) => validateSemanticEventDefinition(
|
|
375
|
+
event,
|
|
376
|
+
`${rulePath}.blackList[${index}]`
|
|
377
|
+
)));
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function validateGroup(value, path) {
|
|
381
|
+
const group = object(value, path);
|
|
382
|
+
rejectUnknown(group, ["relation", "items"], path);
|
|
383
|
+
enumValue(group.relation, /* @__PURE__ */ new Set(["and", "or"]), `${path}.relation`);
|
|
384
|
+
array(group.items, `${path}.items`, 1).forEach((item, index) => validateCondition(item, `${path}.items[${index}]`));
|
|
385
|
+
}
|
|
386
|
+
function validateCondition(value, path) {
|
|
387
|
+
const condition = object(value, path);
|
|
388
|
+
switch (condition.type) {
|
|
389
|
+
case "event":
|
|
390
|
+
validateSemanticEventDefinition(condition, path);
|
|
391
|
+
required(condition.time_range, `${path}.time_range`);
|
|
392
|
+
return;
|
|
393
|
+
case "user":
|
|
394
|
+
case "tag":
|
|
395
|
+
case "cluster":
|
|
396
|
+
validatePropertyCondition(condition, path);
|
|
397
|
+
return;
|
|
398
|
+
case "compound":
|
|
399
|
+
rejectUnknown(condition, ["type", "group"], path);
|
|
400
|
+
validateGroup(condition.group, `${path}.group`);
|
|
401
|
+
return;
|
|
402
|
+
case "behavior_sequence":
|
|
403
|
+
validateBehaviorSequence(condition, path);
|
|
404
|
+
return;
|
|
405
|
+
default:
|
|
406
|
+
invalid(`${path}.type is unsupported.`);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function validatePropertyCondition(condition, path) {
|
|
410
|
+
const extended = condition.type === "tag" || condition.type === "cluster";
|
|
411
|
+
rejectUnknown(condition, [
|
|
412
|
+
"type",
|
|
413
|
+
"field",
|
|
414
|
+
"operator",
|
|
415
|
+
"values",
|
|
416
|
+
"time_relative",
|
|
417
|
+
"time_unit",
|
|
418
|
+
...extended ? ["cluster_date_policy", "specified_cluster_date"] : []
|
|
419
|
+
], path);
|
|
420
|
+
validateField(condition.field, `${path}.field`);
|
|
421
|
+
if (condition.type === "user") enumValue(condition.operator, OPERATORS, `${path}.operator`);
|
|
422
|
+
else optionalEnum(condition.operator, OPERATORS, `${path}.operator`);
|
|
423
|
+
optional(condition.values, (item) => array(item, `${path}.values`));
|
|
424
|
+
optionalString(condition.time_relative, `${path}.time_relative`);
|
|
425
|
+
optionalString(condition.time_unit, `${path}.time_unit`);
|
|
426
|
+
optionalString(condition.cluster_date_policy, `${path}.cluster_date_policy`);
|
|
427
|
+
optionalString(condition.specified_cluster_date, `${path}.specified_cluster_date`);
|
|
428
|
+
}
|
|
429
|
+
function validateBehaviorSequence(condition, path) {
|
|
430
|
+
rejectUnknown(condition, ["type", "completed", "steps", "time_range", "window"], path);
|
|
431
|
+
if (typeof condition.completed !== "boolean") invalid(`${path}.completed must be a boolean.`);
|
|
432
|
+
array(condition.steps, `${path}.steps`, 1).forEach((stepValue, index) => {
|
|
433
|
+
const stepPath = `${path}.steps[${index}]`;
|
|
434
|
+
const step = object(stepValue, stepPath);
|
|
435
|
+
rejectUnknown(step, ["event", "completed", "filters", "relative_to_first", "window"], stepPath);
|
|
436
|
+
nonBlankString(step.event, `${stepPath}.event`);
|
|
437
|
+
optionalBoolean(step.completed, `${stepPath}.completed`);
|
|
438
|
+
optionalBoolean(step.relative_to_first, `${stepPath}.relative_to_first`);
|
|
439
|
+
if (index === 1 && step.relative_to_first === true) {
|
|
440
|
+
invalid(`${stepPath}.relative_to_first must be false or omitted for the second step.`);
|
|
441
|
+
}
|
|
442
|
+
optional(step.filters, (item) => validateFilterGroup(item, `${stepPath}.filters`));
|
|
443
|
+
optional(step.window, (item) => validateWindow(item, `${stepPath}.window`));
|
|
444
|
+
});
|
|
445
|
+
required(condition.time_range, `${path}.time_range`);
|
|
446
|
+
validateTimeRange(condition.time_range, `${path}.time_range`);
|
|
447
|
+
optional(condition.window, (item) => validateWindow(item, `${path}.window`));
|
|
448
|
+
}
|
|
449
|
+
function validateFilterGroup(value, path) {
|
|
450
|
+
const group = object(value, path);
|
|
451
|
+
rejectUnknown(group, ["relation", "items"], path);
|
|
452
|
+
optionalEnum(group.relation, /* @__PURE__ */ new Set(["and", "or"]), `${path}.relation`);
|
|
453
|
+
array(group.items, `${path}.items`, 1).forEach((filterValue, index) => {
|
|
454
|
+
const filterPath = `${path}.items[${index}]`;
|
|
455
|
+
const filter = object(filterValue, filterPath);
|
|
456
|
+
rejectUnknown(filter, ["field", "operator", "values"], filterPath);
|
|
457
|
+
validateField(filter.field, `${filterPath}.field`);
|
|
458
|
+
enumValue(filter.operator, OPERATORS, `${filterPath}.operator`);
|
|
459
|
+
optional(filter.values, (item) => array(item, `${filterPath}.values`));
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
function validateField(value, path) {
|
|
463
|
+
if (typeof value === "string") {
|
|
464
|
+
nonBlankString(value, path);
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
const field = object(value, path);
|
|
468
|
+
rejectUnknown(field, ["name", "type"], path);
|
|
469
|
+
nonBlankString(field.name, `${path}.name`);
|
|
470
|
+
optionalEnum(field.type, /* @__PURE__ */ new Set([
|
|
471
|
+
"event_property",
|
|
472
|
+
"user_property",
|
|
473
|
+
"tag",
|
|
474
|
+
"cluster"
|
|
475
|
+
]), `${path}.type`);
|
|
476
|
+
}
|
|
477
|
+
function validateTimeRange(value, path) {
|
|
478
|
+
const range = object(value, path);
|
|
479
|
+
rejectUnknown(range, ["mode", "unit", "value", "start_time", "end_time"], path);
|
|
480
|
+
if (range.mode === "custom") {
|
|
481
|
+
nonBlankString(range.start_time, `${path}.start_time`);
|
|
482
|
+
nonBlankString(range.end_time, `${path}.end_time`);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
enumValue(range.mode, /* @__PURE__ */ new Set(["recent", "previous"]), `${path}.mode`);
|
|
486
|
+
optional(range.unit, (unit) => exactString(unit, "day", `${path}.unit`));
|
|
487
|
+
positiveInteger(range.value, `${path}.value`);
|
|
488
|
+
}
|
|
489
|
+
function validateWindow(value, path) {
|
|
490
|
+
const window = object(value, path);
|
|
491
|
+
rejectUnknown(window, ["value", "unit"], path);
|
|
492
|
+
positiveInteger(window.value, `${path}.value`);
|
|
493
|
+
nonBlankString(window.unit, `${path}.unit`);
|
|
494
|
+
}
|
|
495
|
+
function validateMetricEvent(metric, path, dependency) {
|
|
496
|
+
rejectUnknown(metric, [
|
|
497
|
+
"type",
|
|
498
|
+
...dependency ? ["key"] : [],
|
|
499
|
+
"event",
|
|
500
|
+
"aggregation",
|
|
501
|
+
"property",
|
|
502
|
+
"percentile",
|
|
503
|
+
"filters",
|
|
504
|
+
"display_name"
|
|
505
|
+
], path);
|
|
506
|
+
exactString(metric.type, "event", `${path}.type`);
|
|
507
|
+
if (dependency) nonBlankString(metric.key, `${path}.key`);
|
|
508
|
+
nonBlankString(metric.event, `${path}.event`);
|
|
509
|
+
enumValue(metric.aggregation, METRIC_AGGREGATIONS, `${path}.aggregation`);
|
|
510
|
+
if (!["total_count", "user_count", "per_user_count"].includes(String(metric.aggregation))) {
|
|
511
|
+
nonBlankString(metric.property, `${path}.property`);
|
|
512
|
+
}
|
|
513
|
+
optionalString(metric.property, `${path}.property`);
|
|
514
|
+
if (metric.aggregation === "percentile") {
|
|
515
|
+
optionalNumber(metric.percentile, `${path}.percentile`);
|
|
516
|
+
if (typeof metric.percentile !== "number" || metric.percentile <= 0 || metric.percentile > 100) {
|
|
517
|
+
invalid(`${path}.percentile must be greater than 0 and at most 100.`);
|
|
518
|
+
}
|
|
519
|
+
} else if (metric.percentile !== void 0 && metric.percentile !== null) {
|
|
520
|
+
invalid(`${path}.percentile is only valid for percentile aggregation.`);
|
|
521
|
+
}
|
|
522
|
+
optionalString(metric.display_name, `${path}.display_name`);
|
|
523
|
+
optional(metric.filters, (item) => validateFilterGroup(item, `${path}.filters`));
|
|
524
|
+
}
|
|
525
|
+
function walkJsonString(value, path) {
|
|
526
|
+
try {
|
|
527
|
+
walk(JSON.parse(value), path);
|
|
528
|
+
} catch (error) {
|
|
529
|
+
if (error instanceof SyntaxError) invalid(`${path} must contain valid JSON.`);
|
|
530
|
+
throw error;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function object(value, path) {
|
|
534
|
+
if (!isObject(value)) invalid(`${path} must be a JSON object.`);
|
|
535
|
+
return value;
|
|
536
|
+
}
|
|
537
|
+
function isObject(value) {
|
|
538
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
539
|
+
}
|
|
540
|
+
function array(value, path, minLength = 0) {
|
|
541
|
+
if (!Array.isArray(value) || value.length < minLength) {
|
|
542
|
+
invalid(`${path} must be an array with at least ${minLength} item(s).`);
|
|
543
|
+
}
|
|
544
|
+
return value;
|
|
545
|
+
}
|
|
546
|
+
function rejectUnknown(value, allowed, path) {
|
|
547
|
+
const supported = new Set(allowed);
|
|
548
|
+
const unknown = Object.keys(value).find((key) => !supported.has(key));
|
|
549
|
+
if (unknown) invalid(`Unsupported field ${path}.${unknown}.`);
|
|
550
|
+
}
|
|
551
|
+
function optional(value, validate) {
|
|
552
|
+
if (value !== void 0 && value !== null) validate(value);
|
|
553
|
+
}
|
|
554
|
+
function required(value, path) {
|
|
555
|
+
if (value === void 0 || value === null) invalid(`${path} is required.`);
|
|
556
|
+
}
|
|
557
|
+
function nonBlankString(value, path) {
|
|
558
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
559
|
+
invalid(`${path} must be a non-blank string.`);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
function optionalString(value, path) {
|
|
563
|
+
optional(value, (item) => nonBlankString(item, path));
|
|
564
|
+
}
|
|
565
|
+
function exactString(value, expected, path) {
|
|
566
|
+
if (value !== expected) invalid(`${path} must be ${expected}.`);
|
|
567
|
+
}
|
|
568
|
+
function enumValue(value, allowed, path) {
|
|
569
|
+
if (typeof value !== "string" || !allowed.has(value)) {
|
|
570
|
+
invalid(`${path} must be one of: ${[...allowed].join(", ")}.`);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function optionalEnum(value, allowed, path) {
|
|
574
|
+
optional(value, (item) => enumValue(item, allowed, path));
|
|
575
|
+
}
|
|
576
|
+
function optionalNumber(value, path) {
|
|
577
|
+
optional(value, (item) => {
|
|
578
|
+
if (typeof item !== "number" || !Number.isFinite(item)) invalid(`${path} must be a number.`);
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function positiveInteger(value, path) {
|
|
582
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
583
|
+
invalid(`${path} must be a positive integer.`);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function optionalBoolean(value, path) {
|
|
587
|
+
optional(value, (item) => {
|
|
588
|
+
if (typeof item !== "boolean") invalid(`${path} must be a boolean.`);
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
function invalid(message) {
|
|
592
|
+
throw new CliValidationError(message);
|
|
593
|
+
}
|
|
594
|
+
|
|
212
595
|
// src/commands/te-engage/engage-flow/flow/save.ts
|
|
213
596
|
var allowedOperations = ["build", "preview", "commit"];
|
|
214
597
|
function readRequest(ctx) {
|
|
@@ -223,6 +606,7 @@ function readRequest(ctx) {
|
|
|
223
606
|
if ("sourceFlowUuid" in req) {
|
|
224
607
|
throw new Error("Flag --req.sourceFlowUuid is unsupported; get the source flow and build nodes/edges instead");
|
|
225
608
|
}
|
|
609
|
+
validateEmbeddedSemanticDefinitions(req, "--req");
|
|
226
610
|
return req;
|
|
227
611
|
}
|
|
228
612
|
var flowSave = createEngageFlowCapabilityCommand({
|
|
@@ -246,6 +630,30 @@ var flowSave = createEngageFlowCapabilityCommand({
|
|
|
246
630
|
buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequest(ctx) })
|
|
247
631
|
});
|
|
248
632
|
|
|
633
|
+
// src/commands/te-engage/engage-flow/metric/update.ts
|
|
634
|
+
var flowMetricUpdate = createEngageFlowCapabilityCommand({
|
|
635
|
+
resource: "metric",
|
|
636
|
+
command: "update",
|
|
637
|
+
capabilityId: "engage-flow.metric.update",
|
|
638
|
+
description: "Update metric settings for a flow canvas.",
|
|
639
|
+
flags: [
|
|
640
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
641
|
+
{ name: "flow-id", type: "string", required: true, desc: "Logical flow ID." },
|
|
642
|
+
{
|
|
643
|
+
name: "metric-map",
|
|
644
|
+
type: "json",
|
|
645
|
+
required: true,
|
|
646
|
+
desc: "Metric configuration map keyed by metric group."
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
risk: "write",
|
|
650
|
+
buildInput: (ctx) => ({
|
|
651
|
+
project_id: ctx.num("project-id"),
|
|
652
|
+
flow_id: ctx.str("flow-id"),
|
|
653
|
+
metric_map: ctx.json("metric-map")
|
|
654
|
+
})
|
|
655
|
+
});
|
|
656
|
+
|
|
249
657
|
// src/commands/te-engage/engage-flow/node-config/schema.ts
|
|
250
658
|
var nodeConfigSchema = createEngageFlowCapabilityCommand({
|
|
251
659
|
resource: "node-config",
|
|
@@ -281,6 +689,208 @@ var nodeConfigValidate = createEngageFlowCapabilityCommand({
|
|
|
281
689
|
})
|
|
282
690
|
});
|
|
283
691
|
|
|
692
|
+
// src/commands/te-engage/engage-flow/report/shared.ts
|
|
693
|
+
var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
694
|
+
var flowReportCommonFlags = [
|
|
695
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
696
|
+
{ name: "flow-id", type: "string", required: false, desc: "Logical flow ID." },
|
|
697
|
+
{ name: "flow-uuid", type: "string", required: false, desc: "Flow version UUID." },
|
|
698
|
+
{ name: "request-id", type: "string", required: false, desc: "Query correlation ID. Generated when omitted." },
|
|
699
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Push language code." },
|
|
700
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset." }
|
|
701
|
+
];
|
|
702
|
+
var flowMetricDetailFlags = [
|
|
703
|
+
...flowReportCommonFlags,
|
|
704
|
+
{ name: "node-uuid", type: "string", required: true, desc: "Flow node UUID." },
|
|
705
|
+
{ name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
|
|
706
|
+
{ name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
|
|
707
|
+
{ name: "branch-id", type: "string", required: false, desc: "Optional branch ID." },
|
|
708
|
+
{ name: "indicator-name", type: "string", required: false, desc: "Optional indicator name." },
|
|
709
|
+
{ name: "indicators-uuid", type: "string", required: false, desc: "Optional AB metric indicator UUID." },
|
|
710
|
+
{ name: "data-dim-type", type: "string", required: false, desc: "Data dimension type, usually uv or pv." },
|
|
711
|
+
{ name: "report-mode", type: "string", required: false, desc: "Metric report mode: node or ab. Defaults to node." }
|
|
712
|
+
];
|
|
713
|
+
var flowUserDetailFlags = [
|
|
714
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
715
|
+
{ name: "flow-id", type: "string", required: false, desc: "Logical flow ID." },
|
|
716
|
+
{ name: "flow-uuid", type: "string", required: false, desc: "Flow version UUID." },
|
|
717
|
+
{ name: "request-id", type: "string", required: false, desc: "Query correlation ID. Generated when omitted." },
|
|
718
|
+
{ name: "cluster-def", type: "string", required: false, desc: "Legacy cluster definition JSON. Prefer the report metric fields below." },
|
|
719
|
+
{ name: "indicator-name", type: "string", required: false, desc: "Metric key returned by the corresponding flow report." },
|
|
720
|
+
{ name: "data-view-type", type: "string", required: false, desc: "Data view type. Defaults to 2 (date view)." },
|
|
721
|
+
{ name: "is-summary", type: "boolean", required: false, desc: "Whether to query a summary segment. Defaults to false." },
|
|
722
|
+
{ name: "start-time", type: "string", required: false, desc: "Segment start date in yyyy-MM-dd format." },
|
|
723
|
+
{ name: "end-time", type: "string", required: false, desc: "Segment end date in yyyy-MM-dd format." },
|
|
724
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Optional push language code from the report context." },
|
|
725
|
+
{ name: "user-time-zone", type: "string", required: false, desc: "Optional user timezone." },
|
|
726
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Optional report display timezone." },
|
|
727
|
+
{ name: "node-uuid", type: "string", required: false, desc: "Flow node UUID." },
|
|
728
|
+
{ name: "branch-id", type: "string", required: false, desc: "Optional branch ID." }
|
|
729
|
+
];
|
|
730
|
+
var flowNodeUserDetailFlags = flowUserDetailFlags.map((flag) => flag.name === "node-uuid" ? { ...flag, required: true } : flag);
|
|
731
|
+
var inlineLimitFlag = {
|
|
732
|
+
name: "limit",
|
|
733
|
+
type: "number",
|
|
734
|
+
required: false,
|
|
735
|
+
desc: "Maximum number of rows returned inline. Defaults to backend value."
|
|
736
|
+
};
|
|
737
|
+
var timeoutSecondsFlag = {
|
|
738
|
+
name: "timeout-seconds",
|
|
739
|
+
type: "number",
|
|
740
|
+
required: false,
|
|
741
|
+
desc: "Query or export timeout in seconds. Defaults to backend policy."
|
|
742
|
+
};
|
|
743
|
+
var exportFormatFlags = [
|
|
744
|
+
{
|
|
745
|
+
name: "artifact-format",
|
|
746
|
+
type: "string",
|
|
747
|
+
required: false,
|
|
748
|
+
desc: "Export artifact format. Flow report and user detail exports support csv or jsonl. Defaults to jsonl."
|
|
749
|
+
}
|
|
750
|
+
];
|
|
751
|
+
function validateFlowReportInput(ctx) {
|
|
752
|
+
if (!ctx.str("flow-id") && !ctx.str("flow-uuid")) {
|
|
753
|
+
printError("validation", "At least one of --flow-id or --flow-uuid is required");
|
|
754
|
+
process.exit(1);
|
|
755
|
+
}
|
|
756
|
+
validateDate(ctx.str("start-time"), "--start-time");
|
|
757
|
+
validateDate(ctx.str("end-time"), "--end-time");
|
|
758
|
+
}
|
|
759
|
+
function validateFlowUserDetailInput(ctx) {
|
|
760
|
+
if (!ctx.str("flow-id") && !ctx.str("flow-uuid")) {
|
|
761
|
+
printError("validation", "At least one of --flow-id or --flow-uuid is required");
|
|
762
|
+
process.exit(1);
|
|
763
|
+
}
|
|
764
|
+
if (!ctx.str("cluster-def") && (!ctx.str("indicator-name") || !ctx.str("start-time") || !ctx.str("end-time"))) {
|
|
765
|
+
printError("validation", "Pass either --cluster-def or --indicator-name with --start-time and --end-time");
|
|
766
|
+
process.exit(1);
|
|
767
|
+
}
|
|
768
|
+
validateDate(ctx.str("start-time"), "--start-time");
|
|
769
|
+
validateDate(ctx.str("end-time"), "--end-time");
|
|
770
|
+
}
|
|
771
|
+
function buildFlowReportInput(ctx) {
|
|
772
|
+
return {
|
|
773
|
+
project_id: ctx.num("project-id"),
|
|
774
|
+
flow_id: ctx.str("flow-id") || void 0,
|
|
775
|
+
flow_uuid: ctx.str("flow-uuid") || void 0,
|
|
776
|
+
request_id: ctx.str("request-id") || void 0,
|
|
777
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
778
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
779
|
+
node_uuid: ctx.str("node-uuid") || void 0,
|
|
780
|
+
branch_id: ctx.str("branch-id") || void 0,
|
|
781
|
+
indicator_name: ctx.str("indicator-name") || void 0,
|
|
782
|
+
indicators_uuid: ctx.str("indicators-uuid") || void 0,
|
|
783
|
+
data_dim_type: ctx.str("data-dim-type") || void 0,
|
|
784
|
+
start_time: ctx.str("start-time") || void 0,
|
|
785
|
+
end_time: ctx.str("end-time") || void 0,
|
|
786
|
+
report_mode: ctx.str("report-mode") || void 0,
|
|
787
|
+
cluster_def: ctx.str("cluster-def") || void 0,
|
|
788
|
+
limit: ctx.optionalNum("limit"),
|
|
789
|
+
format: ctx.str("artifact-format") || void 0,
|
|
790
|
+
timeout_seconds: ctx.optionalNum("timeout-seconds")
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
function buildFlowUserDetailInput(ctx) {
|
|
794
|
+
return {
|
|
795
|
+
project_id: ctx.num("project-id"),
|
|
796
|
+
flow_id: ctx.str("flow-id") || void 0,
|
|
797
|
+
flow_uuid: ctx.str("flow-uuid") || void 0,
|
|
798
|
+
request_id: ctx.str("request-id") || void 0,
|
|
799
|
+
node_uuid: ctx.str("node-uuid") || void 0,
|
|
800
|
+
branch_id: ctx.str("branch-id") || void 0,
|
|
801
|
+
cluster_def: ctx.str("cluster-def") || void 0,
|
|
802
|
+
indicator_name: ctx.str("indicator-name") || void 0,
|
|
803
|
+
data_view_type: ctx.str("data-view-type") || void 0,
|
|
804
|
+
is_summary: readOptionalBoolean(ctx, "is-summary"),
|
|
805
|
+
start_time: ctx.str("start-time") || void 0,
|
|
806
|
+
end_time: ctx.str("end-time") || void 0,
|
|
807
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
808
|
+
user_time_zone: ctx.str("user-time-zone") || void 0,
|
|
809
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
810
|
+
limit: ctx.optionalNum("limit"),
|
|
811
|
+
format: ctx.str("artifact-format") || void 0,
|
|
812
|
+
timeout_seconds: ctx.optionalNum("timeout-seconds")
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
function validateDate(value, flag) {
|
|
816
|
+
if (value && !ISO_DATE.test(value)) {
|
|
817
|
+
printError("validation", `${flag} must be in yyyy-MM-dd format`);
|
|
818
|
+
process.exit(1);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// src/commands/te-engage/engage-flow/metric-user/export.ts
|
|
823
|
+
var metricUserExport = createEngageFlowCapabilityCommand({
|
|
824
|
+
resource: "metric-user",
|
|
825
|
+
command: "export",
|
|
826
|
+
capabilityId: "engage-flow.metric-user.export",
|
|
827
|
+
description: "Export users behind a flow metric segment.",
|
|
828
|
+
flags: [...flowUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
829
|
+
risk: "read",
|
|
830
|
+
validate: validateFlowUserDetailInput,
|
|
831
|
+
buildInput: buildFlowUserDetailInput
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
// src/commands/te-engage/engage-flow/metric-user/run.ts
|
|
835
|
+
var metricUserRun = createEngageFlowCapabilityCommand({
|
|
836
|
+
resource: "metric-user",
|
|
837
|
+
command: "run",
|
|
838
|
+
capabilityId: "engage-flow.metric-user.run",
|
|
839
|
+
description: "Query users behind a flow metric segment inline.",
|
|
840
|
+
flags: [...flowUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
841
|
+
risk: "read",
|
|
842
|
+
validate: validateFlowUserDetailInput,
|
|
843
|
+
buildInput: buildFlowUserDetailInput
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
// src/commands/te-engage/engage-flow/node-metric-user/export.ts
|
|
847
|
+
var nodeMetricUserExport = createEngageFlowCapabilityCommand({
|
|
848
|
+
resource: "node-metric-user",
|
|
849
|
+
command: "export",
|
|
850
|
+
capabilityId: "engage-flow.node-metric-user.export",
|
|
851
|
+
description: "Export users behind a flow node metric segment.",
|
|
852
|
+
flags: [...flowNodeUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
853
|
+
risk: "read",
|
|
854
|
+
validate: validateFlowUserDetailInput,
|
|
855
|
+
buildInput: buildFlowUserDetailInput
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
// src/commands/te-engage/engage-flow/node-metric-user/run.ts
|
|
859
|
+
var nodeMetricUserRun = createEngageFlowCapabilityCommand({
|
|
860
|
+
resource: "node-metric-user",
|
|
861
|
+
command: "run",
|
|
862
|
+
capabilityId: "engage-flow.node-metric-user.run",
|
|
863
|
+
description: "Query users behind a flow node metric segment inline.",
|
|
864
|
+
flags: [...flowNodeUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
865
|
+
risk: "read",
|
|
866
|
+
validate: validateFlowUserDetailInput,
|
|
867
|
+
buildInput: buildFlowUserDetailInput
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
// src/commands/te-engage/engage-flow/node-user/export.ts
|
|
871
|
+
var nodeUserExport = createEngageFlowCapabilityCommand({
|
|
872
|
+
resource: "node-user",
|
|
873
|
+
command: "export",
|
|
874
|
+
capabilityId: "engage-flow.node-user.export",
|
|
875
|
+
description: "Export users behind a flow node segment.",
|
|
876
|
+
flags: [...flowNodeUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
877
|
+
risk: "read",
|
|
878
|
+
validate: validateFlowUserDetailInput,
|
|
879
|
+
buildInput: buildFlowUserDetailInput
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
// src/commands/te-engage/engage-flow/node-user/run.ts
|
|
883
|
+
var nodeUserRun = createEngageFlowCapabilityCommand({
|
|
884
|
+
resource: "node-user",
|
|
885
|
+
command: "run",
|
|
886
|
+
capabilityId: "engage-flow.node-user.run",
|
|
887
|
+
description: "Query users behind a flow node segment inline.",
|
|
888
|
+
flags: [...flowNodeUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
889
|
+
risk: "read",
|
|
890
|
+
validate: validateFlowUserDetailInput,
|
|
891
|
+
buildInput: buildFlowUserDetailInput
|
|
892
|
+
});
|
|
893
|
+
|
|
284
894
|
// src/commands/te-engage/engage-flow/operation-log/query.ts
|
|
285
895
|
var operationLogQuery = createEngageFlowCapabilityCommand({
|
|
286
896
|
resource: "operation-log",
|
|
@@ -295,6 +905,30 @@ var operationLogQuery = createEngageFlowCapabilityCommand({
|
|
|
295
905
|
buildInput: (ctx) => ({ project_id: ctx.num("project-id"), flow_id: ctx.str("flow-id") })
|
|
296
906
|
});
|
|
297
907
|
|
|
908
|
+
// src/commands/te-engage/engage-flow/report/metric-detail-export.ts
|
|
909
|
+
var flowReportMetricDetailExport = createEngageFlowCapabilityCommand({
|
|
910
|
+
resource: "report metric-detail",
|
|
911
|
+
command: "export",
|
|
912
|
+
capabilityId: "engage-flow.report.metric-detail.export",
|
|
913
|
+
description: "Export a flow node metric detail report artifact.",
|
|
914
|
+
flags: [...flowMetricDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
|
|
915
|
+
risk: "read",
|
|
916
|
+
validate: validateFlowReportInput,
|
|
917
|
+
buildInput: buildFlowReportInput
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
// src/commands/te-engage/engage-flow/report/metric-detail-run.ts
|
|
921
|
+
var flowReportMetricDetailRun = createEngageFlowCapabilityCommand({
|
|
922
|
+
resource: "report metric-detail",
|
|
923
|
+
command: "run",
|
|
924
|
+
capabilityId: "engage-flow.report.metric-detail.run",
|
|
925
|
+
description: "Query a flow node metric detail report inline.",
|
|
926
|
+
flags: [...flowMetricDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
|
|
927
|
+
risk: "read",
|
|
928
|
+
validate: validateFlowReportInput,
|
|
929
|
+
buildInput: buildFlowReportInput
|
|
930
|
+
});
|
|
931
|
+
|
|
298
932
|
// src/commands/te-engage/engage-flow/version/list.ts
|
|
299
933
|
var versionList = createEngageFlowCapabilityCommand({
|
|
300
934
|
resource: "version",
|
|
@@ -316,9 +950,18 @@ var commands = [
|
|
|
316
950
|
flowSave,
|
|
317
951
|
nodeConfigSchema,
|
|
318
952
|
nodeConfigValidate,
|
|
953
|
+
flowMetricUpdate,
|
|
319
954
|
flowModifyBaseInfo,
|
|
320
955
|
flowManage,
|
|
321
956
|
flowDelete,
|
|
957
|
+
flowReportMetricDetailRun,
|
|
958
|
+
flowReportMetricDetailExport,
|
|
959
|
+
metricUserRun,
|
|
960
|
+
metricUserExport,
|
|
961
|
+
nodeUserRun,
|
|
962
|
+
nodeUserExport,
|
|
963
|
+
nodeMetricUserRun,
|
|
964
|
+
nodeMetricUserExport,
|
|
322
965
|
operationLogQuery,
|
|
323
966
|
// testRun,
|
|
324
967
|
versionList,
|
|
@@ -1042,6 +1685,12 @@ var presetEventUpdate = createEngageSettingCapabilityCommand({
|
|
|
1042
1685
|
{ name: "recharge-event-definition", type: "json", required: false, desc: "Semantic recharge event definition." }
|
|
1043
1686
|
],
|
|
1044
1687
|
risk: "write",
|
|
1688
|
+
validate: (ctx) => {
|
|
1689
|
+
for (const name of ["add-event-definition", "active-event-definition", "recharge-event-definition"]) {
|
|
1690
|
+
const definition = ctx.json(name);
|
|
1691
|
+
if (definition !== void 0) validateSemanticEventDefinition(definition, `--${name}`);
|
|
1692
|
+
}
|
|
1693
|
+
},
|
|
1045
1694
|
buildInput: (ctx) => ({
|
|
1046
1695
|
project_id: ctx.num("project-id"),
|
|
1047
1696
|
add_event_definition: ctx.json("add-event-definition") || void 0,
|
|
@@ -1085,23 +1734,7 @@ var commonMetricGet = createEngageSettingCapabilityCommand({
|
|
|
1085
1734
|
// src/commands/te-engage/engage-setting/common-metric/metric-qp-validation.ts
|
|
1086
1735
|
var VALID_WINDOW_TIME_UNITS = /* @__PURE__ */ new Set(["minute", "hour", "day"]);
|
|
1087
1736
|
function validateMetricDefinitionFlag(definition) {
|
|
1088
|
-
|
|
1089
|
-
printError(
|
|
1090
|
-
"validation",
|
|
1091
|
-
"--metric-definition must be a JSON object.",
|
|
1092
|
-
"Pass a semantic event or formula metric definition."
|
|
1093
|
-
);
|
|
1094
|
-
process.exit(1);
|
|
1095
|
-
}
|
|
1096
|
-
const type = definition.type;
|
|
1097
|
-
if (type !== "event" && type !== "formula") {
|
|
1098
|
-
printError(
|
|
1099
|
-
"validation",
|
|
1100
|
-
"--metric-definition.type must be event or formula.",
|
|
1101
|
-
"Do not pass legacy type=0/1 metric_qp."
|
|
1102
|
-
);
|
|
1103
|
-
process.exit(1);
|
|
1104
|
-
}
|
|
1737
|
+
validateSemanticMetricDefinition(definition, "--metric-definition");
|
|
1105
1738
|
}
|
|
1106
1739
|
function validateMetricWindowTimeUnitFlag(unit) {
|
|
1107
1740
|
if (VALID_WINDOW_TIME_UNITS.has(unit)) {
|
|
@@ -1587,6 +2220,16 @@ var presetMetricSet = createEngageSceneCapabilityCommand({
|
|
|
1587
2220
|
{ name: "attend-event-definition", type: "json", required: false, desc: "Semantic attend event definition." }
|
|
1588
2221
|
],
|
|
1589
2222
|
risk: "write",
|
|
2223
|
+
validate: (ctx) => {
|
|
2224
|
+
for (const name of [
|
|
2225
|
+
"impression-event-definition",
|
|
2226
|
+
"click-event-definition",
|
|
2227
|
+
"attend-event-definition"
|
|
2228
|
+
]) {
|
|
2229
|
+
const definition = ctx.json(name);
|
|
2230
|
+
if (definition !== void 0) validateSemanticEventDefinition(definition, `--${name}`);
|
|
2231
|
+
}
|
|
2232
|
+
},
|
|
1590
2233
|
buildInput: (ctx) => ({
|
|
1591
2234
|
project_id: ctx.num("project-id"),
|
|
1592
2235
|
config_id: ctx.str("config-id"),
|
|
@@ -1865,9 +2508,13 @@ var strategyCreate = createEngageSceneCapabilityCommand({
|
|
|
1865
2508
|
}
|
|
1866
2509
|
],
|
|
1867
2510
|
risk: "write",
|
|
2511
|
+
validate: (ctx) => {
|
|
2512
|
+
const payload = readRequiredJsonObject(ctx, "payload");
|
|
2513
|
+
validateEmbeddedSemanticDefinitions(payload, "--payload");
|
|
2514
|
+
},
|
|
1868
2515
|
buildInput: (ctx) => ({
|
|
1869
2516
|
project_id: ctx.num("project-id"),
|
|
1870
|
-
payload: ctx
|
|
2517
|
+
payload: readRequiredJsonObject(ctx, "payload")
|
|
1871
2518
|
})
|
|
1872
2519
|
});
|
|
1873
2520
|
|
|
@@ -1964,9 +2611,13 @@ var strategyUpdate = createEngageSceneCapabilityCommand({
|
|
|
1964
2611
|
}
|
|
1965
2612
|
],
|
|
1966
2613
|
risk: "write",
|
|
2614
|
+
validate: (ctx) => {
|
|
2615
|
+
const payload = readRequiredJsonObject(ctx, "payload");
|
|
2616
|
+
validateEmbeddedSemanticDefinitions(payload, "--payload");
|
|
2617
|
+
},
|
|
1967
2618
|
buildInput: (ctx) => ({
|
|
1968
2619
|
project_id: ctx.num("project-id"),
|
|
1969
|
-
payload: ctx
|
|
2620
|
+
payload: readRequiredJsonObject(ctx, "payload")
|
|
1970
2621
|
})
|
|
1971
2622
|
});
|
|
1972
2623
|
|
|
@@ -2022,7 +2673,10 @@ var strategyPredict = createEngageSceneCapabilityCommand({
|
|
|
2022
2673
|
],
|
|
2023
2674
|
risk: "read",
|
|
2024
2675
|
validate: (ctx) => {
|
|
2025
|
-
|
|
2676
|
+
validateSemanticAudienceDefinition(
|
|
2677
|
+
readRequiredJsonObject(ctx, "definition-request"),
|
|
2678
|
+
"--definition-request"
|
|
2679
|
+
);
|
|
2026
2680
|
},
|
|
2027
2681
|
buildInput: (ctx) => ({
|
|
2028
2682
|
project_id: ctx.num("project-id"),
|
|
@@ -2513,6 +3167,7 @@ var TOPIC_TASK_EXCLUSION_FIELDS = /* @__PURE__ */ new Set([
|
|
|
2513
3167
|
]);
|
|
2514
3168
|
function validateStandaloneActivityPayload(value) {
|
|
2515
3169
|
const payload = requireObject(value);
|
|
3170
|
+
validateEmbeddedSemanticDefinitions(payload, "payload");
|
|
2516
3171
|
validateTriggerType(payload.triggerType, "triggerType");
|
|
2517
3172
|
validateScheduleFields(payload);
|
|
2518
3173
|
validateExperiment(payload.expConfig, "expConfig");
|
|
@@ -2536,6 +3191,7 @@ function validateStandaloneActivityPayload(value) {
|
|
|
2536
3191
|
}
|
|
2537
3192
|
function validateActivityTopicPayload(value) {
|
|
2538
3193
|
const payload = requireObject(value);
|
|
3194
|
+
validateEmbeddedSemanticDefinitions(payload, "payload");
|
|
2539
3195
|
validateTriggerType(payload.triggerType, "triggerType");
|
|
2540
3196
|
validateScheduleFields(payload);
|
|
2541
3197
|
validateExperiment(payload.expConfig, "expConfig");
|
|
@@ -2610,7 +3266,7 @@ function validateScheduleFields(payload) {
|
|
|
2610
3266
|
}
|
|
2611
3267
|
function validateExperiment(value, field) {
|
|
2612
3268
|
if (value === void 0 || value === null) return;
|
|
2613
|
-
if (!
|
|
3269
|
+
if (!isObject2(value)) {
|
|
2614
3270
|
fail(
|
|
2615
3271
|
`${field} must be omitted or set to {"enableExp":false}.`,
|
|
2616
3272
|
"ACTIVITY_EXPERIMENT_UNSUPPORTED",
|
|
@@ -2641,7 +3297,7 @@ function validateSingleContentGroup(value, field) {
|
|
|
2641
3297
|
}
|
|
2642
3298
|
}
|
|
2643
3299
|
function requireObject(value, field = "payload") {
|
|
2644
|
-
if (!
|
|
3300
|
+
if (!isObject2(value)) {
|
|
2645
3301
|
fail(
|
|
2646
3302
|
`${field} must be a JSON object.`,
|
|
2647
3303
|
"ACTIVITY_PAYLOAD_INVALID",
|
|
@@ -2653,7 +3309,7 @@ function requireObject(value, field = "payload") {
|
|
|
2653
3309
|
}
|
|
2654
3310
|
function containsAnyKey(value, keys) {
|
|
2655
3311
|
if (Array.isArray(value)) return value.some((item) => containsAnyKey(item, keys));
|
|
2656
|
-
if (!
|
|
3312
|
+
if (!isObject2(value)) return false;
|
|
2657
3313
|
return Object.entries(value).some(
|
|
2658
3314
|
([key, item]) => keys.has(key) && hasValue(item) || containsAnyKey(item, keys)
|
|
2659
3315
|
);
|
|
@@ -2662,10 +3318,10 @@ function hasValue(value) {
|
|
|
2662
3318
|
if (value === void 0 || value === null) return false;
|
|
2663
3319
|
if (typeof value === "string") return value.trim().length > 0;
|
|
2664
3320
|
if (Array.isArray(value)) return value.length > 0;
|
|
2665
|
-
if (
|
|
3321
|
+
if (isObject2(value)) return Object.keys(value).length > 0;
|
|
2666
3322
|
return true;
|
|
2667
3323
|
}
|
|
2668
|
-
function
|
|
3324
|
+
function isObject2(value) {
|
|
2669
3325
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2670
3326
|
}
|
|
2671
3327
|
function fail(message, code, field, hint) {
|
|
@@ -3074,6 +3730,121 @@ var channelRefStats = createEngageTaskCapabilityCommand({
|
|
|
3074
3730
|
})
|
|
3075
3731
|
});
|
|
3076
3732
|
|
|
3733
|
+
// src/commands/te-engage/engage-task/task-data-shared.ts
|
|
3734
|
+
var ISO_DATE2 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3735
|
+
var taskMetricDetailFlags = [
|
|
3736
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
3737
|
+
{ name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
|
|
3738
|
+
{ name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
|
|
3739
|
+
{ name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
|
|
3740
|
+
{ name: "metric-id-list", type: "json", required: false, desc: "Optional metric setting ID JSON array." },
|
|
3741
|
+
{ name: "group-type", type: "number", required: false, desc: "Optional metric grouping mode: 1, 2, 3, or 4." },
|
|
3742
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Optional push content language code." },
|
|
3743
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset, such as 8.0 or -5.0." },
|
|
3744
|
+
{ name: "request-id", type: "string", required: false, desc: "Caller-provided report request ID." }
|
|
3745
|
+
];
|
|
3746
|
+
var taskDataDetailFlags = [
|
|
3747
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
3748
|
+
{ name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
|
|
3749
|
+
{ name: "detail-type", type: "string", required: true, desc: "Detail mode: time, instance, or instance_daily." },
|
|
3750
|
+
{ name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
|
|
3751
|
+
{ name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
|
|
3752
|
+
{ name: "task-instance-id", type: "string", required: false, desc: "Task instance ID. Required when detail-type is instance_daily." },
|
|
3753
|
+
{ name: "data-dim-type", type: "string", required: false, desc: "Data dimension type: uv or pv." },
|
|
3754
|
+
{ name: "retention-type", type: "string", required: false, desc: "Optional retention mode: retention or lost." },
|
|
3755
|
+
{ name: "data-view-type", type: "number", required: false, desc: "Triggered-task detail view type: 2 or 3." },
|
|
3756
|
+
{ name: "push-language-code", type: "string", required: false, desc: "Optional push content language code." },
|
|
3757
|
+
{ name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset, such as 8.0 or -5.0." },
|
|
3758
|
+
{ name: "request-id", type: "string", required: false, desc: "Caller-provided report request ID." }
|
|
3759
|
+
];
|
|
3760
|
+
function validateTaskMetricDetailInput(ctx) {
|
|
3761
|
+
validateDateRange(ctx);
|
|
3762
|
+
const metricIdList = ctx.json("metric-id-list");
|
|
3763
|
+
if (metricIdList != null && !Array.isArray(metricIdList)) {
|
|
3764
|
+
printError("validation", "--metric-id-list must be a JSON array");
|
|
3765
|
+
process.exit(1);
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
function validateTaskDataDetailInput(ctx) {
|
|
3769
|
+
validateDateRange(ctx);
|
|
3770
|
+
const detailType = ctx.str("detail-type");
|
|
3771
|
+
if (!["time", "instance", "instance_daily"].includes(detailType)) {
|
|
3772
|
+
printError("validation", "--detail-type must be time, instance, or instance_daily");
|
|
3773
|
+
process.exit(1);
|
|
3774
|
+
}
|
|
3775
|
+
if (detailType === "instance_daily" && !ctx.str("task-instance-id")) {
|
|
3776
|
+
printError("validation", "--task-instance-id is required when --detail-type is instance_daily");
|
|
3777
|
+
process.exit(1);
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
function buildTaskMetricDetailInput(ctx) {
|
|
3781
|
+
return {
|
|
3782
|
+
project_id: ctx.num("project-id"),
|
|
3783
|
+
task_id: ctx.str("task-id"),
|
|
3784
|
+
start_time: ctx.str("start-time"),
|
|
3785
|
+
end_time: ctx.str("end-time"),
|
|
3786
|
+
metric_id_list: ctx.json("metric-id-list") || void 0,
|
|
3787
|
+
group_type: ctx.optionalNum("group-type"),
|
|
3788
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
3789
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
3790
|
+
request_id: ctx.str("request-id") || void 0
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
function buildTaskDataDetailInput(ctx) {
|
|
3794
|
+
return {
|
|
3795
|
+
project_id: ctx.num("project-id"),
|
|
3796
|
+
task_id: ctx.str("task-id"),
|
|
3797
|
+
detail_type: ctx.str("detail-type"),
|
|
3798
|
+
task_instance_id: ctx.str("task-instance-id") || void 0,
|
|
3799
|
+
start_time: ctx.str("start-time"),
|
|
3800
|
+
end_time: ctx.str("end-time"),
|
|
3801
|
+
data_dim_type: ctx.str("data-dim-type") || void 0,
|
|
3802
|
+
retention_type: ctx.str("retention-type") || void 0,
|
|
3803
|
+
data_view_type: ctx.optionalNum("data-view-type"),
|
|
3804
|
+
push_language_code: ctx.str("push-language-code") || void 0,
|
|
3805
|
+
show_time_zone: ctx.str("show-time-zone") || void 0,
|
|
3806
|
+
request_id: ctx.str("request-id") || void 0
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3809
|
+
function validateDateRange(ctx) {
|
|
3810
|
+
validateDate2(ctx.str("start-time"), "--start-time");
|
|
3811
|
+
validateDate2(ctx.str("end-time"), "--end-time");
|
|
3812
|
+
if (ctx.str("start-time") > ctx.str("end-time")) {
|
|
3813
|
+
printError("validation", "--start-time must be earlier than or equal to --end-time");
|
|
3814
|
+
process.exit(1);
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
function validateDate2(value, flag) {
|
|
3818
|
+
if (value && !ISO_DATE2.test(value)) {
|
|
3819
|
+
printError("validation", `${flag} must be in yyyy-MM-dd format`);
|
|
3820
|
+
process.exit(1);
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
// src/commands/te-engage/engage-task/data-detail/query.ts
|
|
3825
|
+
var dataDetailQuery = createEngageTaskCapabilityCommand({
|
|
3826
|
+
resource: "data-detail",
|
|
3827
|
+
command: "query",
|
|
3828
|
+
capabilityId: "engage-task.task-data.detail",
|
|
3829
|
+
description: "Query task data-detail report data.",
|
|
3830
|
+
flags: taskDataDetailFlags,
|
|
3831
|
+
risk: "read",
|
|
3832
|
+
validate: validateTaskDataDetailInput,
|
|
3833
|
+
buildInput: buildTaskDataDetailInput
|
|
3834
|
+
});
|
|
3835
|
+
|
|
3836
|
+
// src/commands/te-engage/engage-task/effect/query.ts
|
|
3837
|
+
var taskEffectQuery = createEngageTaskCapabilityCommand({
|
|
3838
|
+
resource: "effect",
|
|
3839
|
+
command: "query",
|
|
3840
|
+
capabilityId: "engage-task.task-data.metric-detail",
|
|
3841
|
+
description: "Query task metric-detail report data.",
|
|
3842
|
+
flags: taskMetricDetailFlags,
|
|
3843
|
+
risk: "read",
|
|
3844
|
+
validate: validateTaskMetricDetailInput,
|
|
3845
|
+
buildInput: buildTaskMetricDetailInput
|
|
3846
|
+
});
|
|
3847
|
+
|
|
3077
3848
|
// src/commands/te-engage/engage-task/group/create.ts
|
|
3078
3849
|
var groupCreate = createEngageTaskCapabilityCommand({
|
|
3079
3850
|
resource: "group",
|
|
@@ -3203,7 +3974,7 @@ var operationLogQuery2 = createEngageTaskCapabilityCommand({
|
|
|
3203
3974
|
});
|
|
3204
3975
|
|
|
3205
3976
|
// src/commands/te-engage/engage-task/push-record/query.ts
|
|
3206
|
-
var
|
|
3977
|
+
var ISO_DATE3 = /^\d{4}-\d{2}-\d{2}$/;
|
|
3207
3978
|
var pushRecordQuery = createEngageTaskCapabilityCommand({
|
|
3208
3979
|
resource: "push-record",
|
|
3209
3980
|
command: "query",
|
|
@@ -3231,11 +4002,11 @@ var pushRecordQuery = createEngageTaskCapabilityCommand({
|
|
|
3231
4002
|
validate: (ctx) => {
|
|
3232
4003
|
const startDate = ctx.str("start-date");
|
|
3233
4004
|
const endDate = ctx.str("end-date");
|
|
3234
|
-
if (startDate && !
|
|
4005
|
+
if (startDate && !ISO_DATE3.test(startDate)) {
|
|
3235
4006
|
printError("validation", "--start-date must be in yyyy-MM-dd format");
|
|
3236
4007
|
process.exit(1);
|
|
3237
4008
|
}
|
|
3238
|
-
if (endDate && !
|
|
4009
|
+
if (endDate && !ISO_DATE3.test(endDate)) {
|
|
3239
4010
|
printError("validation", "--end-date must be in yyyy-MM-dd format");
|
|
3240
4011
|
process.exit(1);
|
|
3241
4012
|
}
|
|
@@ -3517,12 +4288,14 @@ var taskSave = createEngageTaskCapabilityCommand({
|
|
|
3517
4288
|
name: "req",
|
|
3518
4289
|
type: "json",
|
|
3519
4290
|
required: true,
|
|
3520
|
-
desc: "Task save JSON;
|
|
4291
|
+
desc: "Task save JSON; triggered tasks require periodTimeSymbol on the primary trigger rule."
|
|
3521
4292
|
}
|
|
3522
4293
|
],
|
|
3523
4294
|
risk: "write",
|
|
3524
4295
|
validate: (ctx) => {
|
|
3525
|
-
readRequiredJsonObject(ctx, "req");
|
|
4296
|
+
const req = readRequiredJsonObject(ctx, "req");
|
|
4297
|
+
validateEmbeddedSemanticDefinitions(req, "--req");
|
|
4298
|
+
validateTaskTriggerPeriodDefinition(req, "--req");
|
|
3526
4299
|
},
|
|
3527
4300
|
buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequiredJsonObject(ctx, "req") })
|
|
3528
4301
|
});
|
|
@@ -3552,6 +4325,8 @@ var commands6 = [
|
|
|
3552
4325
|
taskBuildSaveGuide,
|
|
3553
4326
|
taskSave,
|
|
3554
4327
|
taskManage,
|
|
4328
|
+
taskEffectQuery,
|
|
4329
|
+
dataDetailQuery,
|
|
3555
4330
|
channelRefStats,
|
|
3556
4331
|
groupCreate,
|
|
3557
4332
|
groupDelete,
|
|
@@ -3572,6 +4347,148 @@ var commands6 = [
|
|
|
3572
4347
|
];
|
|
3573
4348
|
var engage_task_default = commands6;
|
|
3574
4349
|
|
|
4350
|
+
// src/commands/te-engage/engage-query/artifact/download.ts
|
|
4351
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
4352
|
+
import { dirname, resolve } from "path";
|
|
4353
|
+
var artifactDownload = {
|
|
4354
|
+
service: "engage-query",
|
|
4355
|
+
resource: "artifact",
|
|
4356
|
+
command: "download",
|
|
4357
|
+
description: "Download a generated engagement query artifact.",
|
|
4358
|
+
flags: [
|
|
4359
|
+
{ name: "run-id", type: "string", required: true, desc: "Query or export run ID." },
|
|
4360
|
+
{ name: "artifact-id", type: "string", required: true, desc: "Artifact ID returned by an export capability." },
|
|
4361
|
+
{ name: "output", type: "string", required: true, desc: "Local output file path. Use a file path, not a directory." }
|
|
4362
|
+
],
|
|
4363
|
+
risk: "read",
|
|
4364
|
+
dryRun: (ctx) => ({
|
|
4365
|
+
method: "GET",
|
|
4366
|
+
url: buildCapabilityGatewayUrl(
|
|
4367
|
+
ctx.host(),
|
|
4368
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4369
|
+
artifactPath(ctx.str("run-id"), ctx.str("artifact-id"))
|
|
4370
|
+
),
|
|
4371
|
+
output_path: resolve(ctx.str("output"))
|
|
4372
|
+
}),
|
|
4373
|
+
execute: async (ctx) => {
|
|
4374
|
+
const runId = ctx.str("run-id");
|
|
4375
|
+
const artifactId = ctx.str("artifact-id");
|
|
4376
|
+
const outputPath = resolve(ctx.str("output"));
|
|
4377
|
+
await ensureArtifactReady(ctx.host(), runId, artifactId);
|
|
4378
|
+
const resp = await fetchArtifact(ctx.host(), runId, artifactId);
|
|
4379
|
+
const bytes = Buffer.from(await resp.arrayBuffer());
|
|
4380
|
+
await mkdir(dirname(outputPath), { recursive: true });
|
|
4381
|
+
await writeFile(outputPath, bytes);
|
|
4382
|
+
return {
|
|
4383
|
+
run_id: runId,
|
|
4384
|
+
artifact_id: artifactId,
|
|
4385
|
+
output_path: outputPath,
|
|
4386
|
+
bytes: bytes.length,
|
|
4387
|
+
content_type: resp.headers.get("content-type") ?? void 0,
|
|
4388
|
+
content_encoding: resp.headers.get("content-encoding") ?? void 0,
|
|
4389
|
+
content_disposition: resp.headers.get("content-disposition") ?? void 0
|
|
4390
|
+
};
|
|
4391
|
+
}
|
|
4392
|
+
};
|
|
4393
|
+
function artifactPath(runId, artifactId) {
|
|
4394
|
+
return `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`;
|
|
4395
|
+
}
|
|
4396
|
+
async function ensureArtifactReady(host, runId, artifactId) {
|
|
4397
|
+
const descriptor = await inspectRun(host, runId);
|
|
4398
|
+
const descriptorArtifactId = descriptor.artifact_id ?? descriptor.artifactId;
|
|
4399
|
+
const artifactStatus = descriptor.artifact_status ?? descriptor.artifactStatus;
|
|
4400
|
+
const errorMessage = descriptor.error_message ?? descriptor.errorMessage;
|
|
4401
|
+
if (descriptorArtifactId && descriptorArtifactId !== artifactId) {
|
|
4402
|
+
throw new CapabilityGatewayError(
|
|
4403
|
+
`artifact_id ${artifactId} does not belong to run_id ${runId}`,
|
|
4404
|
+
"ARTIFACT_RUN_MISMATCH",
|
|
4405
|
+
400,
|
|
4406
|
+
"Use the run_id and artifact_id pair from the same export response."
|
|
4407
|
+
);
|
|
4408
|
+
}
|
|
4409
|
+
const ready = descriptor.status === "SUCCEEDED" && (artifactStatus === "READY" || artifactStatus === "COMPLETED");
|
|
4410
|
+
if (ready) {
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
const reason = errorMessage ? `; error=${errorMessage}` : "";
|
|
4414
|
+
throw new CapabilityGatewayError(
|
|
4415
|
+
`Artifact is not ready: run_status=${descriptor.status ?? "UNKNOWN"}, artifact_status=${artifactStatus ?? "UNKNOWN"}${reason}`,
|
|
4416
|
+
"ARTIFACT_NOT_READY",
|
|
4417
|
+
409,
|
|
4418
|
+
"Run ae-cli engage-query run inspect --run-id <run_id> until status=SUCCEEDED and artifact_status=READY or COMPLETED, then retry artifact download. If status is FAILED or CANCELED, do not retry download."
|
|
4419
|
+
);
|
|
4420
|
+
}
|
|
4421
|
+
async function inspectRun(host, runId) {
|
|
4422
|
+
return await requestCapabilityGateway(
|
|
4423
|
+
host,
|
|
4424
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4425
|
+
`runs/${encodeURIComponent(runId)}`
|
|
4426
|
+
);
|
|
4427
|
+
}
|
|
4428
|
+
async function fetchArtifact(host, runId, artifactId) {
|
|
4429
|
+
return fetchCapabilityGateway(
|
|
4430
|
+
host,
|
|
4431
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4432
|
+
artifactPath(runId, artifactId),
|
|
4433
|
+
"GET",
|
|
4434
|
+
void 0,
|
|
4435
|
+
"application/octet-stream"
|
|
4436
|
+
);
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
// src/commands/te-engage/engage-query/query/cancel.ts
|
|
4440
|
+
var queryCancel = createEngageQueryCapabilityCommand({
|
|
4441
|
+
resource: "query",
|
|
4442
|
+
command: "cancel",
|
|
4443
|
+
capabilityId: "engage-query.query.cancel",
|
|
4444
|
+
description: "Cancel one running engagement query or export run.",
|
|
4445
|
+
flags: [
|
|
4446
|
+
{ name: "run-id", type: "string", required: true, desc: "Query or export run ID." },
|
|
4447
|
+
{ name: "reason", type: "string", required: false, desc: "Optional cancellation reason." }
|
|
4448
|
+
],
|
|
4449
|
+
risk: "write",
|
|
4450
|
+
buildInput: (ctx) => ({
|
|
4451
|
+
run_id: ctx.str("run-id"),
|
|
4452
|
+
reason: ctx.str("reason") || void 0
|
|
4453
|
+
})
|
|
4454
|
+
});
|
|
4455
|
+
|
|
4456
|
+
// src/commands/te-engage/engage-query/run/inspect.ts
|
|
4457
|
+
var runInspect = {
|
|
4458
|
+
service: "engage-query",
|
|
4459
|
+
resource: "run",
|
|
4460
|
+
command: "inspect",
|
|
4461
|
+
description: "Inspect one engagement query or export run status.",
|
|
4462
|
+
flags: [
|
|
4463
|
+
{ name: "run-id", type: "string", required: true, desc: "Query or export run ID." }
|
|
4464
|
+
],
|
|
4465
|
+
risk: "read",
|
|
4466
|
+
dryRun: (ctx) => ({
|
|
4467
|
+
method: "GET",
|
|
4468
|
+
url: buildCapabilityGatewayUrl(
|
|
4469
|
+
ctx.host(),
|
|
4470
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4471
|
+
`runs/${encodeURIComponent(ctx.str("run-id"))}`
|
|
4472
|
+
)
|
|
4473
|
+
}),
|
|
4474
|
+
execute: async (ctx) => {
|
|
4475
|
+
const result = await requestCapabilityGatewayWithEnvelope(
|
|
4476
|
+
ctx.host(),
|
|
4477
|
+
resolveGatewayDomain("engage-query", "engage"),
|
|
4478
|
+
`runs/${encodeURIComponent(ctx.str("run-id"))}`
|
|
4479
|
+
);
|
|
4480
|
+
return withOutputMetadata(result.data, result.meta);
|
|
4481
|
+
}
|
|
4482
|
+
};
|
|
4483
|
+
|
|
4484
|
+
// src/commands/te-engage/engage-query/index.ts
|
|
4485
|
+
var commands7 = [
|
|
4486
|
+
runInspect,
|
|
4487
|
+
artifactDownload,
|
|
4488
|
+
queryCancel
|
|
4489
|
+
];
|
|
4490
|
+
var engage_query_default = commands7;
|
|
4491
|
+
|
|
3575
4492
|
// src/commands/te-engage/index.ts
|
|
3576
4493
|
registerCapabilityGatewayRoute("engage-flow", { gatewayDomain: "engage" });
|
|
3577
4494
|
registerCapabilityGatewayRoute("engage-task", { gatewayDomain: "engage" });
|
|
@@ -3579,15 +4496,17 @@ registerCapabilityGatewayRoute("engage-setting", { gatewayDomain: "engage" });
|
|
|
3579
4496
|
registerCapabilityGatewayRoute("engage-scene", { gatewayDomain: "engage" });
|
|
3580
4497
|
registerCapabilityGatewayRoute("engage-activity", { gatewayDomain: "engage" });
|
|
3581
4498
|
registerCapabilityGatewayRoute("engage-workbench", { gatewayDomain: "engage" });
|
|
3582
|
-
|
|
4499
|
+
registerCapabilityGatewayRoute("engage-query", { gatewayDomain: "engage" });
|
|
4500
|
+
var commands8 = [
|
|
3583
4501
|
...engage_flow_default,
|
|
3584
4502
|
...engage_task_default,
|
|
3585
4503
|
...engage_setting_default,
|
|
3586
4504
|
...engage_scene_default,
|
|
3587
4505
|
...engage_activity_default,
|
|
3588
|
-
...engage_workbench_default
|
|
4506
|
+
...engage_workbench_default,
|
|
4507
|
+
...engage_query_default
|
|
3589
4508
|
];
|
|
3590
|
-
var te_engage_default =
|
|
4509
|
+
var te_engage_default = commands8;
|
|
3591
4510
|
export {
|
|
3592
4511
|
te_engage_default as default
|
|
3593
4512
|
};
|