@thinkingai/ae-cli 6.1.10 → 6.1.12
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 +25 -3
- package/README.zh.md +25 -3
- package/dist/{auth-56Z45UVR.js → auth-GDV3H5I4.js} +18 -8
- package/dist/{auth-ENM3FE6L.js → auth-NN55553T.js} +3 -3
- package/dist/{capability-2H6PAOA3.js → capability-DRLGDVS4.js} +24 -17
- package/dist/{capability-YPOQX6PL.js → capability-P6GK3AQH.js} +24 -17
- package/dist/chunk-4NN5IWVN.js +26 -0
- package/dist/{chunk-DB4Q3ANU.js → chunk-6A2FUCIS.js} +3 -3
- package/dist/{chunk-PVBYJWC2.js → chunk-7KQWSBSL.js} +4 -4
- package/dist/{chunk-24BAVOX3.js → chunk-AXDXJTPC.js} +3 -1
- package/dist/{chunk-CPVTECJ3.js → chunk-DT6Y3TD7.js} +5 -5
- package/dist/{chunk-EGEIXA2Z.js → chunk-DWO43OIB.js} +0 -248
- package/dist/{chunk-V6FR6WTW.js → chunk-GJJA4CQZ.js} +34 -2
- package/dist/{chunk-RGXCNC4N.js → chunk-GS2P7LFD.js} +50 -17
- package/dist/{chunk-LYVNONC4.js → chunk-JHENBQ5B.js} +35 -0
- package/dist/{chunk-3P3562ZX.js → chunk-MVDZ7DBQ.js} +5 -5
- package/dist/{chunk-LCXU3AAT.js → chunk-NBPKWKRA.js} +2 -2
- package/dist/{chunk-HQ2A7ITL.js → chunk-RBNKI5ZW.js} +50 -17
- package/dist/{chunk-LHVM35J4.js → chunk-TS6BUGUY.js} +4 -4
- package/dist/chunk-TUKQZTMI.js +250 -0
- package/dist/{chunk-J7MZHDHQ.js → chunk-VKD5WQKN.js} +5 -5
- package/dist/{chunk-3KI3RRXX.js → chunk-VTXHDCBW.js} +3 -3
- package/dist/{chunk-KTYR3U6D.js → chunk-YTG6Q75E.js} +10 -6
- package/dist/{chunk-IR4ZLVPW.js → chunk-YV52FB5G.js} +25 -3
- package/dist/{chunk-E7UXXHO3.js → chunk-Z3OXWCIA.js} +3 -3
- package/dist/{cli-token-4SBMXAUK.js → cli-token-GL5MS5FK.js} +4 -4
- package/dist/{client-PP5FETMW.js → client-DAIPF7XN.js} +4 -4
- package/dist/{community-report-client-KK2QBANO.js → community-report-client-M2RW4MXD.js} +2 -2
- package/dist/config-4VZNLBKF.js +489 -0
- package/dist/index.js +94 -35
- package/dist/memory-RWJW4XFO.js +892 -0
- package/dist/memory-VO2ZJCRT.js +892 -0
- package/dist/{metadata-JIQ77HFY.js → metadata-YGTHR2XJ.js} +8 -8
- package/dist/{metadata-AN3YFZEV.js → metadata-ZRN2GHPN.js} +8 -8
- package/dist/{model-JASQVOFD.js → model-CLUIK3K5.js} +7 -5
- package/dist/{raw-XJCAT3HX.js → raw-52B4UKO4.js} +8 -7
- package/dist/sync-3REDHGY6.js +10259 -0
- package/dist/{te-agent-JHUG6DVV.js → te-agent-XNPELAKX.js} +580 -84
- package/dist/{te-analysis-ITKTO6JS.js → te-analysis-GJI5FZUL.js} +1152 -13
- package/dist/{te-analysis-RAC67YYD.js → te-analysis-N2BRDJZ5.js} +1152 -13
- package/dist/{te-community-QOYIYEJI.js → te-community-SQXKE5OO.js} +7 -7
- package/dist/{te-community-UFKI6ONP.js → te-community-TYSNU3NQ.js} +7 -7
- package/dist/{te-dataops-PZQ5NQLY.js → te-dataops-5TM7WZDI.js} +370 -189
- package/dist/{te-dataops-XTWVTJCA.js → te-dataops-OWIADNSM.js} +370 -189
- package/dist/{te-engage-NLZUPSBK.js → te-engage-L72HWRGO.js} +716 -118
- package/dist/{te-engage-E7F4HTXU.js → te-engage-QWM4GFS7.js} +716 -118
- package/dist/{te-experiment-N63WF7XA.js → te-experiment-2T2HEZML.js} +189 -10
- package/dist/{te-experiment-D32TB6ZB.js → te-experiment-PVEY7AEZ.js} +189 -10
- package/dist/{te-kb-E7NSCBRB.js → te-kb-VRMEY3D4.js} +6 -6
- package/dist/{te-meta-GBDTMPEL.js → te-meta-53BVXPFI.js} +7 -7
- package/dist/{te-meta-ZTLTSHXC.js → te-meta-TOCBPBXI.js} +7 -7
- package/dist/{te-system-AH7DMCAQ.js → te-system-XGS5EQIQ.js} +4 -4
- package/dist/{te-team-BQ3SKSZV.js → te-team-BZRDV2CM.js} +7 -7
- package/dist/{update-DKG6UXEM.js → update-HEDXGOJH.js} +8 -6
- package/package.json +5 -2
- package/skills/ae-agent/SKILL.md +178 -16
- package/skills/ae-agent/references/add-skill.md +22 -10
- package/skills/ae-agent/references/edit-skill.md +24 -14
- package/skills/ae-agent/references/find-archived-conversations.md +82 -0
- package/skills/ae-agent/references/restore-conversation.md +54 -0
- package/skills/ae-agent/references/upload-skill.md +24 -14
- package/skills/ae-analysis/SKILL.md +1 -1
- package/skills/ae-analysis/references/command_index.md +104 -42
- package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
- package/skills/ae-analysis/references/project_access_detail_get.md +3 -3
- package/skills/ae-analysis/references/project_data_power_delete.md +3 -3
- package/skills/ae-analysis/references/project_data_power_get.md +3 -3
- package/skills/ae-analysis/references/project_data_power_list.md +3 -3
- package/skills/ae-analysis/references/project_data_power_upsert.md +3 -3
- package/skills/ae-analysis/references/project_entity_create.md +3 -3
- package/skills/ae-analysis/references/project_entity_delete.md +3 -3
- package/skills/ae-analysis/references/project_entity_event_list.md +3 -3
- package/skills/ae-analysis/references/project_entity_get.md +3 -3
- package/skills/ae-analysis/references/project_entity_list.md +3 -3
- package/skills/ae-analysis/references/project_entity_update.md +3 -3
- package/skills/ae-analysis/references/project_function_list.md +3 -3
- package/skills/ae-analysis/references/project_info_create.md +25 -0
- package/skills/ae-analysis/references/project_info_delete.md +24 -0
- package/skills/ae-analysis/references/project_info_get.md +3 -3
- package/skills/ae-analysis/references/project_info_list.md +3 -3
- package/skills/ae-analysis/references/project_info_update.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_create.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_delete.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_list.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_update.md +3 -3
- package/skills/ae-analysis/references/project_member_add.md +3 -3
- package/skills/ae-analysis/references/project_member_batch_update.md +3 -3
- package/skills/ae-analysis/references/project_member_candidate_list.md +3 -3
- package/skills/ae-analysis/references/project_member_handover_export.md +3 -3
- package/skills/ae-analysis/references/project_member_handover_run.md +3 -3
- package/skills/ae-analysis/references/project_member_import.md +3 -3
- package/skills/ae-analysis/references/project_member_list.md +3 -3
- package/skills/ae-analysis/references/project_member_receiver_list.md +3 -3
- package/skills/ae-analysis/references/project_member_remove.md +3 -3
- package/skills/ae-analysis/references/project_member_update.md +3 -3
- package/skills/ae-analysis/references/project_owner_update.md +3 -3
- package/skills/ae-analysis/references/project_permission_binding_list.md +3 -3
- package/skills/ae-analysis/references/project_receive_status_update.md +3 -3
- package/skills/ae-analysis/references/project_role_delete.md +3 -3
- package/skills/ae-analysis/references/project_role_function_list.md +3 -3
- package/skills/ae-analysis/references/project_role_get.md +3 -3
- package/skills/ae-analysis/references/project_role_list.md +3 -3
- package/skills/ae-analysis/references/project_role_upsert.md +3 -3
- package/skills/ae-analysis/references/project_role_user_list.md +3 -3
- package/skills/ae-analysis/references/project_space_list.md +1 -1
- package/skills/ae-analysis/references/project_timezone_get.md +3 -3
- package/skills/ae-analysis/references/project_timezone_overview.md +3 -3
- package/skills/ae-analysis/references/project_timezone_update.md +3 -3
- package/skills/ae-analysis/references/project_user_id_items_update.md +3 -3
- package/skills/ae-analysis/references/system_admin_function_list.md +22 -0
- package/skills/ae-analysis/references/system_admin_function_update.md +26 -0
- package/skills/ae-analysis/references/system_admin_list.md +21 -0
- package/skills/ae-analysis/references/system_admin_remove.md +25 -0
- package/skills/ae-analysis/references/system_admin_upsert.md +25 -0
- package/skills/ae-analysis/references/system_function_list.md +21 -0
- package/skills/ae-analysis/references/system_member_add.md +25 -0
- package/skills/ae-analysis/references/system_member_candidate_list.md +22 -0
- package/skills/ae-analysis/references/system_member_delete.md +25 -0
- package/skills/ae-analysis/references/system_member_list.md +24 -0
- package/skills/ae-analysis/references/system_member_mfa_unbind.md +25 -0
- package/skills/ae-analysis/references/system_member_password_reset.md +32 -0
- package/skills/ae-analysis/references/system_member_project_batch_update.md +27 -0
- package/skills/ae-analysis/references/system_member_status_update.md +26 -0
- package/skills/ae-analysis/references/system_member_update.md +23 -0
- package/skills/ae-analysis/references/system_mfa_get.md +21 -0
- package/skills/ae-analysis/references/system_mfa_update.md +25 -0
- package/skills/ae-analysis/references/system_node_monitor_list.md +24 -0
- package/skills/ae-analysis/references/system_oauth2_update.md +22 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_delete.md +25 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_list.md +23 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_test.md +29 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_upsert.md +39 -0
- package/skills/ae-analysis/references/system_preference_get.md +21 -0
- package/skills/ae-analysis/references/system_preference_update.md +22 -0
- package/skills/ae-analysis/references/system_project_usage_list.md +28 -0
- package/skills/ae-analysis/references/system_query_alert_rule_list.md +21 -0
- package/skills/ae-analysis/references/system_query_alert_rule_update.md +26 -0
- package/skills/ae-analysis/references/system_query_monitor_overview.md +26 -0
- package/skills/ae-analysis/references/system_query_task_cancel.md +25 -0
- package/skills/ae-analysis/references/system_query_task_export.md +49 -0
- package/skills/ae-analysis/references/system_query_task_get.md +23 -0
- package/skills/ae-analysis/references/system_query_task_list.md +35 -0
- package/skills/ae-analysis/references/system_query_task_options.md +27 -0
- package/skills/ae-analysis/references/system_receiver_address_delete.md +26 -0
- package/skills/ae-analysis/references/system_receiver_address_overview.md +21 -0
- package/skills/ae-analysis/references/system_receiver_address_project_list.md +21 -0
- package/skills/ae-analysis/references/system_receiver_address_promote.md +24 -0
- package/skills/ae-analysis/references/system_receiver_address_upsert.md +27 -0
- package/skills/ae-analysis/references/system_receiver_detection_get.md +22 -0
- package/skills/ae-analysis/references/system_receiver_detection_run.md +22 -0
- package/skills/ae-analysis/references/system_receiver_detection_update.md +25 -0
- package/skills/ae-analysis/references/system_role_delete.md +26 -0
- package/skills/ae-analysis/references/system_role_function_list.md +22 -0
- package/skills/ae-analysis/references/system_role_get.md +22 -0
- package/skills/ae-analysis/references/system_role_list.md +24 -0
- package/skills/ae-analysis/references/system_role_upsert.md +27 -0
- package/skills/ae-analysis/references/system_role_user_list.md +22 -0
- package/skills/ae-analysis/references/system_seat_list.md +25 -0
- package/skills/ae-analysis/references/system_seat_update.md +26 -0
- package/skills/ae-analysis/references/system_smtp_delete.md +24 -0
- package/skills/ae-analysis/references/system_smtp_get.md +21 -0
- package/skills/ae-analysis/references/system_smtp_test.md +22 -0
- package/skills/ae-analysis/references/system_smtp_upsert.md +31 -0
- package/skills/ae-analysis/references/system_third_party_login_disable.md +25 -0
- package/skills/ae-analysis/references/system_third_party_login_list.md +21 -0
- package/skills/ae-analysis/references/system_third_party_login_upsert.md +33 -0
- package/skills/ae-analysis/references/system_usage_overview.md +21 -0
- package/skills/ae-analysis/references/system_usage_trend_export.md +44 -0
- package/skills/ae-analysis/references/system_usage_trend_query.md +28 -0
- package/skills/ae-dataops/SKILL.md +1 -1
- package/skills/ae-dataops/references/dataops-flow-create.md +51 -16
- package/skills/ae-engage/SKILL.md +67 -27
- package/skills/ae-engage/references/activity-activity.md +3 -0
- package/skills/ae-engage/references/activity-approval.md +12 -4
- package/skills/ae-engage/references/activity-data-detail.md +61 -0
- package/skills/ae-engage/references/activity-task.md +21 -6
- package/skills/ae-engage/references/activity-topic.md +31 -13
- package/skills/ae-engage/references/add-channel.md +170 -41
- package/skills/ae-engage/references/build-task-save-guide.md +66 -29
- package/skills/ae-engage/references/channel-update-config.md +3 -2
- package/skills/ae-engage/references/common-metric.md +88 -115
- package/skills/ae-engage/references/flow-detail.md +13 -0
- package/skills/ae-engage/references/preset-event.md +14 -32
- package/skills/ae-engage/references/save-flow.md +141 -64
- package/skills/ae-engage/references/save-task.md +231 -58
- package/skills/ae-engage/references/scene-config-metric.md +3 -0
- package/skills/ae-engage/references/scene-preset-metric.md +8 -37
- package/skills/ae-engage/references/scene-strategy-audience.md +56 -643
- package/skills/ae-engage/references/scene-strategy.md +6 -6
- package/skills/ae-engage/references/task-detail.md +10 -0
- package/skills/ae-engage/references/task-submit-approval.md +45 -0
- package/skills/ae-engage/references/validate-flow-node-config.md +1 -1
- package/skills/ae-experiment/SKILL.md +38 -5
- package/skills/ae-experiment/references/check_experiment_ready.md +2 -0
- package/skills/ae-experiment/references/delete_metric.md +2 -0
- package/skills/ae-experiment/references/query_experiment_detail.md +6 -0
- package/skills/ae-experiment/references/query_experiment_list.md +4 -0
- package/skills/ae-experiment/references/query_experiment_list_archived.md +3 -0
- package/skills/ae-experiment/references/query_experiment_metric_trend.md +5 -5
- package/skills/ae-experiment/references/query_experiment_report_summary.md +4 -3
- package/skills/ae-experiment/references/query_experiment_sample_size_report.md +6 -5
- package/skills/ae-experiment/references/query_metric_detail.md +5 -0
- package/skills/ae-experiment/references/query_metric_list.md +3 -0
- package/skills/ae-experiment/references/save_build_guide.md +39 -0
- package/skills/ae-experiment/references/save_experiment.md +53 -3
- package/skills/ae-experiment/references/save_metric.md +67 -1
- package/skills/ae-experiment/references/save_submit_experiment.md +3 -0
- package/skills/ae-experiment/references/save_validate.md +33 -0
- package/skills/ae-experiment-design/SKILL.md +149 -0
- package/skills/ae-experiment-design/agents/openai.yaml +4 -0
- package/skills/ae-experiment-design/references/client-experiment-sdk.md +147 -0
- package/skills/ae-experiment-design/references/experiment-creation.md +108 -0
- package/skills/ae-experiment-design/references/experiment-sdk-contract.md +100 -0
- package/skills/ae-experiment-design/references/exposure-contract.md +91 -0
- package/skills/ae-experiment-design/references/hybrid-experiment-sdk.md +74 -0
- package/skills/ae-experiment-design/references/metric-readiness.md +143 -0
- package/skills/ae-experiment-design/references/platform-operations.md +105 -0
- package/skills/ae-experiment-design/references/sdk-index.md +76 -0
- package/skills/ae-experiment-design/references/sdk-integration.md +114 -0
- package/skills/ae-experiment-design/references/sdk-troubleshooting.md +139 -0
- package/skills/ae-experiment-design/references/server-experiment-sdk.md +78 -0
- package/skills/ae-experiment-design/scripts/calculate_experiment_plan.py +450 -0
- package/skills/ae-experiment-insight/SKILL.md +149 -0
- package/skills/ae-experiment-insight/agents/openai.yaml +4 -0
- package/skills/ae-experiment-insight/references/decision-framework.md +69 -0
- package/skills/ae-experiment-insight/references/diagnostic-playbook.md +225 -0
- package/skills/ae-experiment-insight/references/platform-operations.md +82 -0
- package/skills/ae-experiment-insight/scripts/analyze_experiment.py +478 -0
- package/skills/ae-generate-tracking-code/SKILL.md +2 -2
- package/skills/ae-metadata/SKILL.md +1 -1
- package/dist/config-BSSALXEN.js +0 -128
- package/dist/sync-QFP4XFN3.js +0 -485
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapabilityCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TS6BUGUY.js";
|
|
4
4
|
import {
|
|
5
5
|
registerCapabilityGatewayRoute
|
|
6
6
|
} from "./chunk-PTE56QPL.js";
|
|
7
|
-
import "./chunk-HQ2A7ITL.js";
|
|
8
7
|
import {
|
|
9
8
|
printError
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import
|
|
9
|
+
} from "./chunk-YTG6Q75E.js";
|
|
10
|
+
import "./chunk-GS2P7LFD.js";
|
|
11
|
+
import "./chunk-Z3OXWCIA.js";
|
|
12
|
+
import "./chunk-YV52FB5G.js";
|
|
13
|
+
import "./chunk-GJJA4CQZ.js";
|
|
14
|
+
import {
|
|
15
|
+
CliValidationError
|
|
16
|
+
} from "./chunk-AXDXJTPC.js";
|
|
17
|
+
import "./chunk-JHENBQ5B.js";
|
|
16
18
|
|
|
17
19
|
// src/commands/te-engage/shared.ts
|
|
18
20
|
function createEngageCapabilityCommand(cliService, config) {
|
|
@@ -207,6 +209,362 @@ var flowModifyBaseInfo = createEngageFlowCapabilityCommand({
|
|
|
207
209
|
})
|
|
208
210
|
});
|
|
209
211
|
|
|
212
|
+
// src/commands/te-engage/semantic-qp-validation.ts
|
|
213
|
+
var OPERATORS = /* @__PURE__ */ new Set([
|
|
214
|
+
"eq",
|
|
215
|
+
"neq",
|
|
216
|
+
"lt",
|
|
217
|
+
"lte",
|
|
218
|
+
"gt",
|
|
219
|
+
"gte",
|
|
220
|
+
"exists",
|
|
221
|
+
"not_exists",
|
|
222
|
+
"between",
|
|
223
|
+
"contains",
|
|
224
|
+
"not_contains",
|
|
225
|
+
"is_true",
|
|
226
|
+
"is_false",
|
|
227
|
+
"regex",
|
|
228
|
+
"not_regex",
|
|
229
|
+
"relative_current_time",
|
|
230
|
+
"relative_event_time",
|
|
231
|
+
"array_contains",
|
|
232
|
+
"in_cluster",
|
|
233
|
+
"not_in_cluster"
|
|
234
|
+
]);
|
|
235
|
+
var AUDIENCE_AGGREGATIONS = /* @__PURE__ */ new Set([
|
|
236
|
+
"count",
|
|
237
|
+
"active_days",
|
|
238
|
+
"sum",
|
|
239
|
+
"avg",
|
|
240
|
+
"max",
|
|
241
|
+
"min",
|
|
242
|
+
"distinct_count"
|
|
243
|
+
]);
|
|
244
|
+
var METRIC_AGGREGATIONS = /* @__PURE__ */ new Set([
|
|
245
|
+
"total_count",
|
|
246
|
+
"user_count",
|
|
247
|
+
"per_user_count",
|
|
248
|
+
"sum",
|
|
249
|
+
"avg",
|
|
250
|
+
"avg_per_user",
|
|
251
|
+
"max",
|
|
252
|
+
"min",
|
|
253
|
+
"distinct_count",
|
|
254
|
+
"median",
|
|
255
|
+
"percentile",
|
|
256
|
+
"variance",
|
|
257
|
+
"stddev"
|
|
258
|
+
]);
|
|
259
|
+
function validateSemanticAudienceDefinition(value, path) {
|
|
260
|
+
const definition = object(value, path);
|
|
261
|
+
rejectUnknown(definition, ["type", "conditions", "include_filter", "exclude_filter"], path);
|
|
262
|
+
exactString(definition.type, "condition", `${path}.type`);
|
|
263
|
+
validateGroup(definition.conditions, `${path}.conditions`);
|
|
264
|
+
optional(definition.include_filter, (item) => validateGroup(item, `${path}.include_filter`));
|
|
265
|
+
optional(definition.exclude_filter, (item) => validateGroup(item, `${path}.exclude_filter`));
|
|
266
|
+
}
|
|
267
|
+
function validateSemanticEventDefinition(value, path) {
|
|
268
|
+
const event = object(value, path);
|
|
269
|
+
rejectUnknown(event, [
|
|
270
|
+
"type",
|
|
271
|
+
"event",
|
|
272
|
+
"operator",
|
|
273
|
+
"value",
|
|
274
|
+
"aggregation",
|
|
275
|
+
"property",
|
|
276
|
+
"time_range",
|
|
277
|
+
"filters"
|
|
278
|
+
], path);
|
|
279
|
+
exactString(event.type, "event", `${path}.type`);
|
|
280
|
+
nonBlankString(event.event, `${path}.event`);
|
|
281
|
+
optionalEnum(event.operator, OPERATORS, `${path}.operator`);
|
|
282
|
+
optionalNumber(event.value, `${path}.value`);
|
|
283
|
+
optionalEnum(event.aggregation, AUDIENCE_AGGREGATIONS, `${path}.aggregation`);
|
|
284
|
+
optionalString(event.property, `${path}.property`);
|
|
285
|
+
optional(event.time_range, (item) => validateTimeRange(item, `${path}.time_range`));
|
|
286
|
+
optional(event.filters, (item) => validateFilterGroup(item, `${path}.filters`));
|
|
287
|
+
}
|
|
288
|
+
function validateSemanticMetricDefinition(value, path) {
|
|
289
|
+
const metric = object(value, path);
|
|
290
|
+
if (metric.type === "event") {
|
|
291
|
+
validateMetricEvent(metric, path, false);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
if (metric.type === "formula") {
|
|
295
|
+
rejectUnknown(metric, ["type", "expression", "dependencies", "format"], path);
|
|
296
|
+
nonBlankString(metric.expression, `${path}.expression`);
|
|
297
|
+
optionalString(metric.format, `${path}.format`);
|
|
298
|
+
array(metric.dependencies, `${path}.dependencies`, 1).forEach((dependency, index) => validateMetricEvent(
|
|
299
|
+
object(dependency, `${path}.dependencies[${index}]`),
|
|
300
|
+
`${path}.dependencies[${index}]`,
|
|
301
|
+
true
|
|
302
|
+
));
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
invalid(`${path}.type must be event or formula.`);
|
|
306
|
+
}
|
|
307
|
+
function validateEmbeddedSemanticDefinitions(value, path) {
|
|
308
|
+
walk(value, path);
|
|
309
|
+
}
|
|
310
|
+
function walk(value, path) {
|
|
311
|
+
if (Array.isArray(value)) {
|
|
312
|
+
value.forEach((item, index) => walk(item, `${path}[${index}]`));
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (!isObject(value)) return;
|
|
316
|
+
for (const [key, item] of Object.entries(value)) {
|
|
317
|
+
const itemPath = `${path}.${key}`;
|
|
318
|
+
if (item === void 0 || item === null) continue;
|
|
319
|
+
if (["definitionRequest", "targetDefinitionRequest", "topicDefinitionRequest"].includes(key)) {
|
|
320
|
+
validateSemanticAudienceDefinition(item, itemPath);
|
|
321
|
+
} else if (key === "eventDefinition") {
|
|
322
|
+
validateSemanticEventDefinition(item, itemPath);
|
|
323
|
+
} else if (key === "triggerDefinition") {
|
|
324
|
+
validateTriggerDefinition(item, itemPath);
|
|
325
|
+
} else if (key === "config" && typeof item === "string") {
|
|
326
|
+
walkJsonString(item, itemPath);
|
|
327
|
+
} else {
|
|
328
|
+
walk(item, itemPath);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function validateTriggerDefinition(value, path) {
|
|
333
|
+
const definition = object(value, path);
|
|
334
|
+
rejectUnknown(definition, ["rules"], path);
|
|
335
|
+
array(definition.rules, `${path}.rules`, 1).forEach((ruleValue, ruleIndex) => {
|
|
336
|
+
const rulePath = `${path}.rules[${ruleIndex}]`;
|
|
337
|
+
const rule = object(ruleValue, rulePath);
|
|
338
|
+
array(rule.events, `${rulePath}.events`, 1).forEach((event, eventIndex) => {
|
|
339
|
+
const eventPath = `${rulePath}.events[${eventIndex}]`;
|
|
340
|
+
const candidate = object(event, eventPath);
|
|
341
|
+
if ("eventDefinition" in candidate) {
|
|
342
|
+
validateSemanticEventDefinition(candidate.eventDefinition, `${eventPath}.eventDefinition`);
|
|
343
|
+
} else {
|
|
344
|
+
validateSemanticEventDefinition(candidate, eventPath);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
optional(rule.blackList, (items) => array(items, `${rulePath}.blackList`).forEach((event, index) => validateSemanticEventDefinition(
|
|
348
|
+
event,
|
|
349
|
+
`${rulePath}.blackList[${index}]`
|
|
350
|
+
)));
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
function validateGroup(value, path) {
|
|
354
|
+
const group = object(value, path);
|
|
355
|
+
rejectUnknown(group, ["relation", "items"], path);
|
|
356
|
+
enumValue(group.relation, /* @__PURE__ */ new Set(["and", "or"]), `${path}.relation`);
|
|
357
|
+
array(group.items, `${path}.items`, 1).forEach((item, index) => validateCondition(item, `${path}.items[${index}]`));
|
|
358
|
+
}
|
|
359
|
+
function validateCondition(value, path) {
|
|
360
|
+
const condition = object(value, path);
|
|
361
|
+
switch (condition.type) {
|
|
362
|
+
case "event":
|
|
363
|
+
validateSemanticEventDefinition(condition, path);
|
|
364
|
+
required(condition.time_range, `${path}.time_range`);
|
|
365
|
+
return;
|
|
366
|
+
case "user":
|
|
367
|
+
case "tag":
|
|
368
|
+
case "cluster":
|
|
369
|
+
validatePropertyCondition(condition, path);
|
|
370
|
+
return;
|
|
371
|
+
case "compound":
|
|
372
|
+
rejectUnknown(condition, ["type", "group"], path);
|
|
373
|
+
validateGroup(condition.group, `${path}.group`);
|
|
374
|
+
return;
|
|
375
|
+
case "behavior_sequence":
|
|
376
|
+
validateBehaviorSequence(condition, path);
|
|
377
|
+
return;
|
|
378
|
+
default:
|
|
379
|
+
invalid(`${path}.type is unsupported.`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function validatePropertyCondition(condition, path) {
|
|
383
|
+
const extended = condition.type === "tag" || condition.type === "cluster";
|
|
384
|
+
rejectUnknown(condition, [
|
|
385
|
+
"type",
|
|
386
|
+
"field",
|
|
387
|
+
"operator",
|
|
388
|
+
"values",
|
|
389
|
+
"time_relative",
|
|
390
|
+
"time_unit",
|
|
391
|
+
...extended ? ["cluster_date_policy", "specified_cluster_date"] : []
|
|
392
|
+
], path);
|
|
393
|
+
validateField(condition.field, `${path}.field`);
|
|
394
|
+
if (condition.type === "user") enumValue(condition.operator, OPERATORS, `${path}.operator`);
|
|
395
|
+
else optionalEnum(condition.operator, OPERATORS, `${path}.operator`);
|
|
396
|
+
optional(condition.values, (item) => array(item, `${path}.values`));
|
|
397
|
+
optionalString(condition.time_relative, `${path}.time_relative`);
|
|
398
|
+
optionalString(condition.time_unit, `${path}.time_unit`);
|
|
399
|
+
optionalString(condition.cluster_date_policy, `${path}.cluster_date_policy`);
|
|
400
|
+
optionalString(condition.specified_cluster_date, `${path}.specified_cluster_date`);
|
|
401
|
+
}
|
|
402
|
+
function validateBehaviorSequence(condition, path) {
|
|
403
|
+
rejectUnknown(condition, ["type", "completed", "steps", "time_range", "window"], path);
|
|
404
|
+
if (typeof condition.completed !== "boolean") invalid(`${path}.completed must be a boolean.`);
|
|
405
|
+
array(condition.steps, `${path}.steps`, 1).forEach((stepValue, index) => {
|
|
406
|
+
const stepPath = `${path}.steps[${index}]`;
|
|
407
|
+
const step = object(stepValue, stepPath);
|
|
408
|
+
rejectUnknown(step, ["event", "completed", "filters", "relative_to_first", "window"], stepPath);
|
|
409
|
+
nonBlankString(step.event, `${stepPath}.event`);
|
|
410
|
+
optionalBoolean(step.completed, `${stepPath}.completed`);
|
|
411
|
+
optionalBoolean(step.relative_to_first, `${stepPath}.relative_to_first`);
|
|
412
|
+
if (index === 1 && step.relative_to_first === true) {
|
|
413
|
+
invalid(`${stepPath}.relative_to_first must be false or omitted for the second step.`);
|
|
414
|
+
}
|
|
415
|
+
optional(step.filters, (item) => validateFilterGroup(item, `${stepPath}.filters`));
|
|
416
|
+
optional(step.window, (item) => validateWindow(item, `${stepPath}.window`));
|
|
417
|
+
});
|
|
418
|
+
required(condition.time_range, `${path}.time_range`);
|
|
419
|
+
validateTimeRange(condition.time_range, `${path}.time_range`);
|
|
420
|
+
optional(condition.window, (item) => validateWindow(item, `${path}.window`));
|
|
421
|
+
}
|
|
422
|
+
function validateFilterGroup(value, path) {
|
|
423
|
+
const group = object(value, path);
|
|
424
|
+
rejectUnknown(group, ["relation", "items"], path);
|
|
425
|
+
optionalEnum(group.relation, /* @__PURE__ */ new Set(["and", "or"]), `${path}.relation`);
|
|
426
|
+
array(group.items, `${path}.items`, 1).forEach((filterValue, index) => {
|
|
427
|
+
const filterPath = `${path}.items[${index}]`;
|
|
428
|
+
const filter = object(filterValue, filterPath);
|
|
429
|
+
rejectUnknown(filter, ["field", "operator", "values"], filterPath);
|
|
430
|
+
validateField(filter.field, `${filterPath}.field`);
|
|
431
|
+
enumValue(filter.operator, OPERATORS, `${filterPath}.operator`);
|
|
432
|
+
optional(filter.values, (item) => array(item, `${filterPath}.values`));
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function validateField(value, path) {
|
|
436
|
+
if (typeof value === "string") {
|
|
437
|
+
nonBlankString(value, path);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const field = object(value, path);
|
|
441
|
+
rejectUnknown(field, ["name", "type"], path);
|
|
442
|
+
nonBlankString(field.name, `${path}.name`);
|
|
443
|
+
optionalEnum(field.type, /* @__PURE__ */ new Set([
|
|
444
|
+
"event_property",
|
|
445
|
+
"user_property",
|
|
446
|
+
"tag",
|
|
447
|
+
"cluster"
|
|
448
|
+
]), `${path}.type`);
|
|
449
|
+
}
|
|
450
|
+
function validateTimeRange(value, path) {
|
|
451
|
+
const range = object(value, path);
|
|
452
|
+
rejectUnknown(range, ["mode", "unit", "value", "start_time", "end_time"], path);
|
|
453
|
+
if (range.mode === "custom") {
|
|
454
|
+
nonBlankString(range.start_time, `${path}.start_time`);
|
|
455
|
+
nonBlankString(range.end_time, `${path}.end_time`);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
enumValue(range.mode, /* @__PURE__ */ new Set(["recent", "previous"]), `${path}.mode`);
|
|
459
|
+
optional(range.unit, (unit) => exactString(unit, "day", `${path}.unit`));
|
|
460
|
+
positiveInteger(range.value, `${path}.value`);
|
|
461
|
+
}
|
|
462
|
+
function validateWindow(value, path) {
|
|
463
|
+
const window = object(value, path);
|
|
464
|
+
rejectUnknown(window, ["value", "unit"], path);
|
|
465
|
+
positiveInteger(window.value, `${path}.value`);
|
|
466
|
+
nonBlankString(window.unit, `${path}.unit`);
|
|
467
|
+
}
|
|
468
|
+
function validateMetricEvent(metric, path, dependency) {
|
|
469
|
+
rejectUnknown(metric, [
|
|
470
|
+
"type",
|
|
471
|
+
...dependency ? ["key"] : [],
|
|
472
|
+
"event",
|
|
473
|
+
"aggregation",
|
|
474
|
+
"property",
|
|
475
|
+
"percentile",
|
|
476
|
+
"filters",
|
|
477
|
+
"display_name"
|
|
478
|
+
], path);
|
|
479
|
+
exactString(metric.type, "event", `${path}.type`);
|
|
480
|
+
if (dependency) nonBlankString(metric.key, `${path}.key`);
|
|
481
|
+
nonBlankString(metric.event, `${path}.event`);
|
|
482
|
+
enumValue(metric.aggregation, METRIC_AGGREGATIONS, `${path}.aggregation`);
|
|
483
|
+
if (!["total_count", "user_count", "per_user_count"].includes(String(metric.aggregation))) {
|
|
484
|
+
nonBlankString(metric.property, `${path}.property`);
|
|
485
|
+
}
|
|
486
|
+
optionalString(metric.property, `${path}.property`);
|
|
487
|
+
if (metric.aggregation === "percentile") {
|
|
488
|
+
optionalNumber(metric.percentile, `${path}.percentile`);
|
|
489
|
+
if (typeof metric.percentile !== "number" || metric.percentile <= 0 || metric.percentile > 100) {
|
|
490
|
+
invalid(`${path}.percentile must be greater than 0 and at most 100.`);
|
|
491
|
+
}
|
|
492
|
+
} else if (metric.percentile !== void 0 && metric.percentile !== null) {
|
|
493
|
+
invalid(`${path}.percentile is only valid for percentile aggregation.`);
|
|
494
|
+
}
|
|
495
|
+
optionalString(metric.display_name, `${path}.display_name`);
|
|
496
|
+
optional(metric.filters, (item) => validateFilterGroup(item, `${path}.filters`));
|
|
497
|
+
}
|
|
498
|
+
function walkJsonString(value, path) {
|
|
499
|
+
try {
|
|
500
|
+
walk(JSON.parse(value), path);
|
|
501
|
+
} catch (error) {
|
|
502
|
+
if (error instanceof SyntaxError) invalid(`${path} must contain valid JSON.`);
|
|
503
|
+
throw error;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function object(value, path) {
|
|
507
|
+
if (!isObject(value)) invalid(`${path} must be a JSON object.`);
|
|
508
|
+
return value;
|
|
509
|
+
}
|
|
510
|
+
function isObject(value) {
|
|
511
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
512
|
+
}
|
|
513
|
+
function array(value, path, minLength = 0) {
|
|
514
|
+
if (!Array.isArray(value) || value.length < minLength) {
|
|
515
|
+
invalid(`${path} must be an array with at least ${minLength} item(s).`);
|
|
516
|
+
}
|
|
517
|
+
return value;
|
|
518
|
+
}
|
|
519
|
+
function rejectUnknown(value, allowed, path) {
|
|
520
|
+
const supported = new Set(allowed);
|
|
521
|
+
const unknown = Object.keys(value).find((key) => !supported.has(key));
|
|
522
|
+
if (unknown) invalid(`Unsupported field ${path}.${unknown}.`);
|
|
523
|
+
}
|
|
524
|
+
function optional(value, validate) {
|
|
525
|
+
if (value !== void 0 && value !== null) validate(value);
|
|
526
|
+
}
|
|
527
|
+
function required(value, path) {
|
|
528
|
+
if (value === void 0 || value === null) invalid(`${path} is required.`);
|
|
529
|
+
}
|
|
530
|
+
function nonBlankString(value, path) {
|
|
531
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
532
|
+
invalid(`${path} must be a non-blank string.`);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function optionalString(value, path) {
|
|
536
|
+
optional(value, (item) => nonBlankString(item, path));
|
|
537
|
+
}
|
|
538
|
+
function exactString(value, expected, path) {
|
|
539
|
+
if (value !== expected) invalid(`${path} must be ${expected}.`);
|
|
540
|
+
}
|
|
541
|
+
function enumValue(value, allowed, path) {
|
|
542
|
+
if (typeof value !== "string" || !allowed.has(value)) {
|
|
543
|
+
invalid(`${path} must be one of: ${[...allowed].join(", ")}.`);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function optionalEnum(value, allowed, path) {
|
|
547
|
+
optional(value, (item) => enumValue(item, allowed, path));
|
|
548
|
+
}
|
|
549
|
+
function optionalNumber(value, path) {
|
|
550
|
+
optional(value, (item) => {
|
|
551
|
+
if (typeof item !== "number" || !Number.isFinite(item)) invalid(`${path} must be a number.`);
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
function positiveInteger(value, path) {
|
|
555
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
556
|
+
invalid(`${path} must be a positive integer.`);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function optionalBoolean(value, path) {
|
|
560
|
+
optional(value, (item) => {
|
|
561
|
+
if (typeof item !== "boolean") invalid(`${path} must be a boolean.`);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
function invalid(message) {
|
|
565
|
+
throw new CliValidationError(message);
|
|
566
|
+
}
|
|
567
|
+
|
|
210
568
|
// src/commands/te-engage/engage-flow/flow/save.ts
|
|
211
569
|
var allowedOperations = ["build", "preview", "commit"];
|
|
212
570
|
function readRequest(ctx) {
|
|
@@ -221,6 +579,7 @@ function readRequest(ctx) {
|
|
|
221
579
|
if ("sourceFlowUuid" in req) {
|
|
222
580
|
throw new Error("Flag --req.sourceFlowUuid is unsupported; get the source flow and build nodes/edges instead");
|
|
223
581
|
}
|
|
582
|
+
validateEmbeddedSemanticDefinitions(req, "--req");
|
|
224
583
|
return req;
|
|
225
584
|
}
|
|
226
585
|
var flowSave = createEngageFlowCapabilityCommand({
|
|
@@ -230,7 +589,12 @@ var flowSave = createEngageFlowCapabilityCommand({
|
|
|
230
589
|
description: "Build, preview, or commit an operation-based flow draft.",
|
|
231
590
|
flags: [
|
|
232
591
|
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
233
|
-
{
|
|
592
|
+
{
|
|
593
|
+
name: "req",
|
|
594
|
+
type: "json",
|
|
595
|
+
required: true,
|
|
596
|
+
desc: "Operation-based flow save request. Custom audience node configs and branches use targetDefinitionRequest."
|
|
597
|
+
}
|
|
234
598
|
],
|
|
235
599
|
risk: "write",
|
|
236
600
|
validate: (ctx) => {
|
|
@@ -1030,16 +1394,22 @@ var presetEventUpdate = createEngageSettingCapabilityCommand({
|
|
|
1030
1394
|
description: "Update the project's preset metric event config (add/active/recharge event definitions).",
|
|
1031
1395
|
flags: [
|
|
1032
1396
|
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
1033
|
-
{ name: "add-event-
|
|
1034
|
-
{ name: "active-event-
|
|
1035
|
-
{ name: "recharge-event-
|
|
1397
|
+
{ name: "add-event-definition", type: "json", required: false, desc: "Semantic add-event definition." },
|
|
1398
|
+
{ name: "active-event-definition", type: "json", required: false, desc: "Semantic active-event definition." },
|
|
1399
|
+
{ name: "recharge-event-definition", type: "json", required: false, desc: "Semantic recharge event definition." }
|
|
1036
1400
|
],
|
|
1037
1401
|
risk: "write",
|
|
1402
|
+
validate: (ctx) => {
|
|
1403
|
+
for (const name of ["add-event-definition", "active-event-definition", "recharge-event-definition"]) {
|
|
1404
|
+
const definition = ctx.json(name);
|
|
1405
|
+
if (definition !== void 0) validateSemanticEventDefinition(definition, `--${name}`);
|
|
1406
|
+
}
|
|
1407
|
+
},
|
|
1038
1408
|
buildInput: (ctx) => ({
|
|
1039
1409
|
project_id: ctx.num("project-id"),
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1410
|
+
add_event_definition: ctx.json("add-event-definition") || void 0,
|
|
1411
|
+
active_event_definition: ctx.json("active-event-definition") || void 0,
|
|
1412
|
+
recharge_event_definition: ctx.json("recharge-event-definition") || void 0
|
|
1043
1413
|
})
|
|
1044
1414
|
});
|
|
1045
1415
|
|
|
@@ -1077,34 +1447,8 @@ var commonMetricGet = createEngageSettingCapabilityCommand({
|
|
|
1077
1447
|
|
|
1078
1448
|
// src/commands/te-engage/engage-setting/common-metric/metric-qp-validation.ts
|
|
1079
1449
|
var VALID_WINDOW_TIME_UNITS = /* @__PURE__ */ new Set(["minute", "hour", "day"]);
|
|
1080
|
-
function
|
|
1081
|
-
|
|
1082
|
-
try {
|
|
1083
|
-
parsed = JSON.parse(metricQp);
|
|
1084
|
-
} catch {
|
|
1085
|
-
printError(
|
|
1086
|
-
"validation",
|
|
1087
|
-
"--metric-qp must be a valid JSON object string.",
|
|
1088
|
-
"Discover events via analysis-meta event list, then assemble a type=0/1 metric QP object."
|
|
1089
|
-
);
|
|
1090
|
-
process.exit(1);
|
|
1091
|
-
}
|
|
1092
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1093
|
-
printError(
|
|
1094
|
-
"validation",
|
|
1095
|
-
"--metric-qp must be a JSON object string.",
|
|
1096
|
-
'Do not pass placeholders like "event"; pass a complete metric QP object.'
|
|
1097
|
-
);
|
|
1098
|
-
process.exit(1);
|
|
1099
|
-
}
|
|
1100
|
-
if (Object.keys(parsed).length === 0) {
|
|
1101
|
-
printError(
|
|
1102
|
-
"validation",
|
|
1103
|
-
"--metric-qp cannot be an empty JSON object.",
|
|
1104
|
-
"Pass a complete metric QP expression instead of {}."
|
|
1105
|
-
);
|
|
1106
|
-
process.exit(1);
|
|
1107
|
-
}
|
|
1450
|
+
function validateMetricDefinitionFlag(definition) {
|
|
1451
|
+
validateSemanticMetricDefinition(definition, "--metric-definition");
|
|
1108
1452
|
}
|
|
1109
1453
|
function validateMetricWindowTimeUnitFlag(unit) {
|
|
1110
1454
|
if (VALID_WINDOW_TIME_UNITS.has(unit)) {
|
|
@@ -1135,10 +1479,10 @@ var writeFlags = [
|
|
|
1135
1479
|
{ name: "metric-type", type: "number", required: true, desc: "Metric type; create requires 1 (PRESET)." },
|
|
1136
1480
|
{ name: "metric-name", type: "string", required: true, desc: "Metric name (^[a-z][0-9a-z_]{0,79}$)." },
|
|
1137
1481
|
{
|
|
1138
|
-
name: "metric-
|
|
1139
|
-
type: "
|
|
1482
|
+
name: "metric-definition",
|
|
1483
|
+
type: "json",
|
|
1140
1484
|
required: true,
|
|
1141
|
-
desc: "
|
|
1485
|
+
desc: "Semantic event or formula metric definition."
|
|
1142
1486
|
},
|
|
1143
1487
|
{ name: "metric-window-num", type: "number", required: true, desc: "Metric window number." },
|
|
1144
1488
|
{
|
|
@@ -1157,7 +1501,7 @@ var buildWriteInput = (ctx) => ({
|
|
|
1157
1501
|
project_id: ctx.num("project-id"),
|
|
1158
1502
|
metric_type: ctx.num("metric-type"),
|
|
1159
1503
|
metric_name: ctx.str("metric-name"),
|
|
1160
|
-
|
|
1504
|
+
metric_definition: ctx.json("metric-definition"),
|
|
1161
1505
|
metric_window_num: ctx.num("metric-window-num"),
|
|
1162
1506
|
metric_window_time_unit: ctx.str("metric-window-time-unit"),
|
|
1163
1507
|
display_name: ctx.str("display-name"),
|
|
@@ -1170,12 +1514,12 @@ var commonMetricCreate = createEngageSettingCapabilityCommand({
|
|
|
1170
1514
|
resource: "common-metric",
|
|
1171
1515
|
command: "create",
|
|
1172
1516
|
capabilityId: "engage-setting.common-metric.create",
|
|
1173
|
-
description: "Create a PRESET common metric
|
|
1517
|
+
description: "Create a PRESET common metric from a semantic event/formula definition.",
|
|
1174
1518
|
flags: writeFlags,
|
|
1175
1519
|
risk: "write",
|
|
1176
1520
|
validate: (ctx) => {
|
|
1177
1521
|
validatePresetMetricTypeFlag(ctx.num("metric-type"));
|
|
1178
|
-
|
|
1522
|
+
validateMetricDefinitionFlag(ctx.json("metric-definition"));
|
|
1179
1523
|
validateMetricWindowTimeUnitFlag(ctx.str("metric-window-time-unit"));
|
|
1180
1524
|
},
|
|
1181
1525
|
buildInput: buildWriteInput
|
|
@@ -1187,10 +1531,10 @@ var writeFlags2 = [
|
|
|
1187
1531
|
{ name: "metric-type", type: "number", required: true, desc: "Metric type; use 1 (PRESET) for common metrics." },
|
|
1188
1532
|
{ name: "metric-name", type: "string", required: true, desc: "Metric name (existing PRESET metric)." },
|
|
1189
1533
|
{
|
|
1190
|
-
name: "metric-
|
|
1191
|
-
type: "
|
|
1534
|
+
name: "metric-definition",
|
|
1535
|
+
type: "json",
|
|
1192
1536
|
required: true,
|
|
1193
|
-
desc: "
|
|
1537
|
+
desc: "Semantic event or formula metric definition."
|
|
1194
1538
|
},
|
|
1195
1539
|
{ name: "metric-window-num", type: "number", required: true, desc: "Metric window number." },
|
|
1196
1540
|
{
|
|
@@ -1209,7 +1553,7 @@ var buildWriteInput2 = (ctx) => ({
|
|
|
1209
1553
|
project_id: ctx.num("project-id"),
|
|
1210
1554
|
metric_type: ctx.num("metric-type"),
|
|
1211
1555
|
metric_name: ctx.str("metric-name"),
|
|
1212
|
-
|
|
1556
|
+
metric_definition: ctx.json("metric-definition"),
|
|
1213
1557
|
metric_window_num: ctx.num("metric-window-num"),
|
|
1214
1558
|
metric_window_time_unit: ctx.str("metric-window-time-unit"),
|
|
1215
1559
|
display_name: ctx.str("display-name"),
|
|
@@ -1226,7 +1570,7 @@ var commonMetricUpdate = createEngageSettingCapabilityCommand({
|
|
|
1226
1570
|
flags: writeFlags2,
|
|
1227
1571
|
risk: "write",
|
|
1228
1572
|
validate: (ctx) => {
|
|
1229
|
-
|
|
1573
|
+
validateMetricDefinitionFlag(ctx.json("metric-definition"));
|
|
1230
1574
|
validateMetricWindowTimeUnitFlag(ctx.str("metric-window-time-unit"));
|
|
1231
1575
|
},
|
|
1232
1576
|
buildInput: buildWriteInput2
|
|
@@ -1249,44 +1593,6 @@ var commonMetricDelete = createEngageSettingCapabilityCommand({
|
|
|
1249
1593
|
})
|
|
1250
1594
|
});
|
|
1251
1595
|
|
|
1252
|
-
// src/commands/te-engage/engage-setting/query/cluster-qp-skill.ts
|
|
1253
|
-
var queryClusterQpSkill = createEngageSettingCapabilityCommand({
|
|
1254
|
-
resource: "query",
|
|
1255
|
-
command: "cluster-qp-skill",
|
|
1256
|
-
capabilityId: "engage-setting.query.cluster-qp-skill",
|
|
1257
|
-
description: "Query the mix-cluster QP skill definition for audience, trigger, and completion event objects. Returns skill text (not final QP JSON). Use it before save when build-save-guide requires targetConfig.qp, triggerConfig.triggerRule, clientConfig.clientQp, or completionIndicatorDef.event.",
|
|
1258
|
-
flags: [
|
|
1259
|
-
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
1260
|
-
{
|
|
1261
|
-
name: "response-mode",
|
|
1262
|
-
type: "string",
|
|
1263
|
-
required: false,
|
|
1264
|
-
desc: "Skill content mode: base, examples, or full. Default: full."
|
|
1265
|
-
},
|
|
1266
|
-
{
|
|
1267
|
-
name: "condition-subtype",
|
|
1268
|
-
type: "string",
|
|
1269
|
-
required: false,
|
|
1270
|
-
desc: "Condition subtype selector: core, behavior_seq, or all. Default: all."
|
|
1271
|
-
}
|
|
1272
|
-
],
|
|
1273
|
-
risk: "read",
|
|
1274
|
-
buildInput: (ctx) => {
|
|
1275
|
-
const input = {
|
|
1276
|
-
project_id: ctx.num("project-id")
|
|
1277
|
-
};
|
|
1278
|
-
const responseMode = ctx.str("response-mode");
|
|
1279
|
-
const conditionSubtype = ctx.str("condition-subtype");
|
|
1280
|
-
if (responseMode) {
|
|
1281
|
-
input.response_mode = responseMode;
|
|
1282
|
-
}
|
|
1283
|
-
if (conditionSubtype) {
|
|
1284
|
-
input.condition_subtype = conditionSubtype;
|
|
1285
|
-
}
|
|
1286
|
-
return input;
|
|
1287
|
-
}
|
|
1288
|
-
});
|
|
1289
|
-
|
|
1290
1596
|
// src/commands/te-engage/engage-setting/index.ts
|
|
1291
1597
|
var commands2 = [
|
|
1292
1598
|
channelTouchLimitsList,
|
|
@@ -1326,8 +1632,7 @@ var commands2 = [
|
|
|
1326
1632
|
commonMetricGet,
|
|
1327
1633
|
commonMetricCreate,
|
|
1328
1634
|
commonMetricUpdate,
|
|
1329
|
-
commonMetricDelete
|
|
1330
|
-
queryClusterQpSkill
|
|
1635
|
+
commonMetricDelete
|
|
1331
1636
|
];
|
|
1332
1637
|
var engage_setting_default = commands2;
|
|
1333
1638
|
|
|
@@ -1620,21 +1925,31 @@ var presetMetricSet = createEngageSceneCapabilityCommand({
|
|
|
1620
1925
|
resource: "preset-metric",
|
|
1621
1926
|
command: "set",
|
|
1622
1927
|
capabilityId: "engage-scene.preset-metric.set",
|
|
1623
|
-
description: "Set
|
|
1928
|
+
description: "Set semantic impression/click/attend event definitions of a config item.",
|
|
1624
1929
|
flags: [
|
|
1625
1930
|
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
1626
1931
|
{ name: "config-id", type: "string", required: true, desc: "Config item ID." },
|
|
1627
|
-
{ name: "impression-event-
|
|
1628
|
-
{ name: "click-event-
|
|
1629
|
-
{ name: "attend-event-
|
|
1932
|
+
{ name: "impression-event-definition", type: "json", required: false, desc: "Semantic impression event definition." },
|
|
1933
|
+
{ name: "click-event-definition", type: "json", required: false, desc: "Semantic click event definition." },
|
|
1934
|
+
{ name: "attend-event-definition", type: "json", required: false, desc: "Semantic attend event definition." }
|
|
1630
1935
|
],
|
|
1631
1936
|
risk: "write",
|
|
1937
|
+
validate: (ctx) => {
|
|
1938
|
+
for (const name of [
|
|
1939
|
+
"impression-event-definition",
|
|
1940
|
+
"click-event-definition",
|
|
1941
|
+
"attend-event-definition"
|
|
1942
|
+
]) {
|
|
1943
|
+
const definition = ctx.json(name);
|
|
1944
|
+
if (definition !== void 0) validateSemanticEventDefinition(definition, `--${name}`);
|
|
1945
|
+
}
|
|
1946
|
+
},
|
|
1632
1947
|
buildInput: (ctx) => ({
|
|
1633
1948
|
project_id: ctx.num("project-id"),
|
|
1634
1949
|
config_id: ctx.str("config-id"),
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1950
|
+
impression_event_definition: ctx.json("impression-event-definition") || void 0,
|
|
1951
|
+
click_event_definition: ctx.json("click-event-definition") || void 0,
|
|
1952
|
+
attend_event_definition: ctx.json("attend-event-definition") || void 0
|
|
1638
1953
|
})
|
|
1639
1954
|
});
|
|
1640
1955
|
|
|
@@ -1903,13 +2218,17 @@ var strategyCreate = createEngageSceneCapabilityCommand({
|
|
|
1903
2218
|
name: "payload",
|
|
1904
2219
|
type: "json",
|
|
1905
2220
|
required: true,
|
|
1906
|
-
desc: "ConfigStrategyAddDTO JSON body
|
|
2221
|
+
desc: "ConfigStrategyAddDTO JSON body. Custom audiences use definitionRequest."
|
|
1907
2222
|
}
|
|
1908
2223
|
],
|
|
1909
2224
|
risk: "write",
|
|
2225
|
+
validate: (ctx) => {
|
|
2226
|
+
const payload = readRequiredJsonObject(ctx, "payload");
|
|
2227
|
+
validateEmbeddedSemanticDefinitions(payload, "--payload");
|
|
2228
|
+
},
|
|
1910
2229
|
buildInput: (ctx) => ({
|
|
1911
2230
|
project_id: ctx.num("project-id"),
|
|
1912
|
-
payload: ctx
|
|
2231
|
+
payload: readRequiredJsonObject(ctx, "payload")
|
|
1913
2232
|
})
|
|
1914
2233
|
});
|
|
1915
2234
|
|
|
@@ -2002,13 +2321,17 @@ var strategyUpdate = createEngageSceneCapabilityCommand({
|
|
|
2002
2321
|
name: "payload",
|
|
2003
2322
|
type: "json",
|
|
2004
2323
|
required: true,
|
|
2005
|
-
desc: "ConfigStrategyModifyDTO JSON body
|
|
2324
|
+
desc: "ConfigStrategyModifyDTO JSON body including strategyUuid. Custom audiences use definitionRequest."
|
|
2006
2325
|
}
|
|
2007
2326
|
],
|
|
2008
2327
|
risk: "write",
|
|
2328
|
+
validate: (ctx) => {
|
|
2329
|
+
const payload = readRequiredJsonObject(ctx, "payload");
|
|
2330
|
+
validateEmbeddedSemanticDefinitions(payload, "--payload");
|
|
2331
|
+
},
|
|
2009
2332
|
buildInput: (ctx) => ({
|
|
2010
2333
|
project_id: ctx.num("project-id"),
|
|
2011
|
-
payload: ctx
|
|
2334
|
+
payload: readRequiredJsonObject(ctx, "payload")
|
|
2012
2335
|
})
|
|
2013
2336
|
});
|
|
2014
2337
|
|
|
@@ -2038,10 +2361,10 @@ var strategyPredict = createEngageSceneCapabilityCommand({
|
|
|
2038
2361
|
flags: [
|
|
2039
2362
|
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
2040
2363
|
{
|
|
2041
|
-
name: "
|
|
2042
|
-
type: "
|
|
2364
|
+
name: "definition-request",
|
|
2365
|
+
type: "json",
|
|
2043
2366
|
required: true,
|
|
2044
|
-
desc: "
|
|
2367
|
+
desc: "Semantic audience definition request."
|
|
2045
2368
|
},
|
|
2046
2369
|
{
|
|
2047
2370
|
name: "zone-offset",
|
|
@@ -2063,9 +2386,15 @@ var strategyPredict = createEngageSceneCapabilityCommand({
|
|
|
2063
2386
|
}
|
|
2064
2387
|
],
|
|
2065
2388
|
risk: "read",
|
|
2389
|
+
validate: (ctx) => {
|
|
2390
|
+
validateSemanticAudienceDefinition(
|
|
2391
|
+
readRequiredJsonObject(ctx, "definition-request"),
|
|
2392
|
+
"--definition-request"
|
|
2393
|
+
);
|
|
2394
|
+
},
|
|
2066
2395
|
buildInput: (ctx) => ({
|
|
2067
2396
|
project_id: ctx.num("project-id"),
|
|
2068
|
-
|
|
2397
|
+
definition_request: readRequiredJsonObject(ctx, "definition-request"),
|
|
2069
2398
|
zone_offset: ctx.num("zone-offset"),
|
|
2070
2399
|
...ctx.str("strategy-uuid") ? { strategy_uuid: ctx.str("strategy-uuid") } : {},
|
|
2071
2400
|
...ctx.str("request-id") ? { request_id: ctx.str("request-id") } : {}
|
|
@@ -2448,6 +2777,25 @@ var activityInfoList = createEngageActivityCapabilityCommand({
|
|
|
2448
2777
|
})
|
|
2449
2778
|
});
|
|
2450
2779
|
|
|
2780
|
+
// src/commands/te-engage/engage-activity/approval/submit.ts
|
|
2781
|
+
var approvalSubmit = createEngageActivityCapabilityCommand({
|
|
2782
|
+
resource: "approval",
|
|
2783
|
+
command: "submit",
|
|
2784
|
+
capabilityId: "engage-activity.approval.submit",
|
|
2785
|
+
description: "Submit an activity for approval.",
|
|
2786
|
+
flags: [
|
|
2787
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
2788
|
+
{ name: "activity-id", type: "string", required: true, desc: "Activity ID." },
|
|
2789
|
+
{ name: "reason", type: "string", required: false, desc: "Optional submit note." }
|
|
2790
|
+
],
|
|
2791
|
+
risk: "write",
|
|
2792
|
+
buildInput: (ctx) => ({
|
|
2793
|
+
project_id: ctx.num("project-id"),
|
|
2794
|
+
activity_id: ctx.str("activity-id"),
|
|
2795
|
+
reason: ctx.str("reason") || void 0
|
|
2796
|
+
})
|
|
2797
|
+
});
|
|
2798
|
+
|
|
2451
2799
|
// src/commands/te-engage/engage-activity/approval/approve.ts
|
|
2452
2800
|
var approvalApprove = createEngageActivityCapabilityCommand({
|
|
2453
2801
|
resource: "approval",
|
|
@@ -2505,6 +2853,199 @@ var approvalCancel = createEngageActivityCapabilityCommand({
|
|
|
2505
2853
|
})
|
|
2506
2854
|
});
|
|
2507
2855
|
|
|
2856
|
+
// src/commands/te-engage/engage-activity/payload-validation.ts
|
|
2857
|
+
var TOPIC_TASK_OVERRIDE_FIELDS = [
|
|
2858
|
+
"clusterKey",
|
|
2859
|
+
"triggerDefinition",
|
|
2860
|
+
"triggerRule",
|
|
2861
|
+
"triggerType",
|
|
2862
|
+
"triggerTime",
|
|
2863
|
+
"triggerCrontab",
|
|
2864
|
+
"startDate",
|
|
2865
|
+
"endDate",
|
|
2866
|
+
"triggerTimeStrategy",
|
|
2867
|
+
"tzOffset",
|
|
2868
|
+
"channelType",
|
|
2869
|
+
"channelId",
|
|
2870
|
+
"frequencyLimits",
|
|
2871
|
+
"enableChannelTouchLimits",
|
|
2872
|
+
"channelTouchLimitsRuleDef",
|
|
2873
|
+
"whitelistList",
|
|
2874
|
+
"expConfig"
|
|
2875
|
+
];
|
|
2876
|
+
var TOPIC_TASK_EXCLUSION_FIELDS = /* @__PURE__ */ new Set([
|
|
2877
|
+
"clusterOutFilters",
|
|
2878
|
+
"totalOutCFilter",
|
|
2879
|
+
"exclude",
|
|
2880
|
+
"excludes"
|
|
2881
|
+
]);
|
|
2882
|
+
function validateStandaloneActivityPayload(value) {
|
|
2883
|
+
const payload = requireObject(value);
|
|
2884
|
+
validateEmbeddedSemanticDefinitions(payload, "payload");
|
|
2885
|
+
validateTriggerType(payload.triggerType, "triggerType");
|
|
2886
|
+
validateScheduleFields(payload);
|
|
2887
|
+
validateExperiment(payload.expConfig, "expConfig");
|
|
2888
|
+
validateSingleContentGroup(payload.groupContentList, "groupContentList");
|
|
2889
|
+
if (payload.triggerTimeStrategy !== "fixed_time_zone") {
|
|
2890
|
+
fail(
|
|
2891
|
+
"Activity tasks must use triggerTimeStrategy=fixed_time_zone.",
|
|
2892
|
+
"ACTIVITY_TRIGGER_TIME_STRATEGY_UNSUPPORTED",
|
|
2893
|
+
"triggerTimeStrategy",
|
|
2894
|
+
"Use the parent activity timezone. User timezone and user active time are not supported."
|
|
2895
|
+
);
|
|
2896
|
+
}
|
|
2897
|
+
if (typeof payload.tzOffset !== "number" || !Number.isFinite(payload.tzOffset)) {
|
|
2898
|
+
fail(
|
|
2899
|
+
"tzOffset is required for a standalone activity task.",
|
|
2900
|
+
"ACTIVITY_TIMEZONE_REQUIRED",
|
|
2901
|
+
"tzOffset",
|
|
2902
|
+
"Read the parent activity and copy its tzOffset exactly."
|
|
2903
|
+
);
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
function validateActivityTopicPayload(value) {
|
|
2907
|
+
const payload = requireObject(value);
|
|
2908
|
+
validateEmbeddedSemanticDefinitions(payload, "payload");
|
|
2909
|
+
validateTriggerType(payload.triggerType, "triggerType");
|
|
2910
|
+
validateScheduleFields(payload);
|
|
2911
|
+
validateExperiment(payload.expConfig, "expConfig");
|
|
2912
|
+
for (const listField of ["tasks", "modifyTaskList", "addTaskList"]) {
|
|
2913
|
+
const taskList2 = payload[listField];
|
|
2914
|
+
if (!Array.isArray(taskList2)) continue;
|
|
2915
|
+
taskList2.forEach((taskValue, index) => {
|
|
2916
|
+
const task = requireObject(taskValue, `${listField}[${index}]`);
|
|
2917
|
+
if (hasValue(task.targetClusterType) && task.targetClusterType !== 1) {
|
|
2918
|
+
fail(
|
|
2919
|
+
`${listField}[${index}].targetClusterType must be 1 (custom) for a topic task.`,
|
|
2920
|
+
"TOPIC_TASK_OVERRIDE_UNSUPPORTED",
|
|
2921
|
+
`${listField}[${index}].targetClusterType`,
|
|
2922
|
+
"Topic tasks always use the canonical custom audience mode and may only add an inclusion-only definitionRequest."
|
|
2923
|
+
);
|
|
2924
|
+
}
|
|
2925
|
+
for (const field of TOPIC_TASK_OVERRIDE_FIELDS) {
|
|
2926
|
+
if (hasValue(task[field])) {
|
|
2927
|
+
fail(
|
|
2928
|
+
`${listField}[${index}].${field} is not configurable for a topic task.`,
|
|
2929
|
+
"TOPIC_TASK_OVERRIDE_UNSUPPORTED",
|
|
2930
|
+
`${listField}[${index}].${field}`,
|
|
2931
|
+
"Topic tasks inherit schedule, channel, frequency, whitelist, and experiment settings from the topic."
|
|
2932
|
+
);
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
if (containsAnyKey(task.definitionRequest, TOPIC_TASK_EXCLUSION_FIELDS)) {
|
|
2936
|
+
fail(
|
|
2937
|
+
`${listField}[${index}].definitionRequest must be an inclusion-only custom audience.`,
|
|
2938
|
+
"TOPIC_TASK_AUDIENCE_EXCLUSION_UNSUPPORTED",
|
|
2939
|
+
`${listField}[${index}].definitionRequest`,
|
|
2940
|
+
"Remove exclusion filters; topic tasks may only refine the shared topic audience with inclusion conditions."
|
|
2941
|
+
);
|
|
2942
|
+
}
|
|
2943
|
+
validateSingleContentGroup(
|
|
2944
|
+
task.groupContentList,
|
|
2945
|
+
`${listField}[${index}].groupContentList`
|
|
2946
|
+
);
|
|
2947
|
+
});
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
function validateTriggerType(value, field) {
|
|
2951
|
+
if (value === 0 || value === 1) return;
|
|
2952
|
+
fail(
|
|
2953
|
+
`${field} only supports 0 (schedule single) or 1 (schedule repeat) for activities.`,
|
|
2954
|
+
"ACTIVITY_TRIGGER_TYPE_UNSUPPORTED",
|
|
2955
|
+
field,
|
|
2956
|
+
"Use engage-task for manual, event-triggered, or other triggered tasks."
|
|
2957
|
+
);
|
|
2958
|
+
}
|
|
2959
|
+
function validateScheduleFields(payload) {
|
|
2960
|
+
if (payload.triggerType === 0 && !hasValue(payload.triggerTime)) {
|
|
2961
|
+
fail(
|
|
2962
|
+
"triggerTime is required when triggerType=0.",
|
|
2963
|
+
"TRIGGER_TIME_REQUIRED",
|
|
2964
|
+
"triggerTime",
|
|
2965
|
+
"Use yyyy-MM-dd HH:mm in the parent activity timezone."
|
|
2966
|
+
);
|
|
2967
|
+
}
|
|
2968
|
+
if (payload.triggerType === 1) {
|
|
2969
|
+
for (const field of ["startDate", "endDate", "triggerCrontab"]) {
|
|
2970
|
+
if (!hasValue(payload[field])) {
|
|
2971
|
+
fail(
|
|
2972
|
+
`${field} is required when triggerType=1.`,
|
|
2973
|
+
"REPEAT_SCHEDULE_REQUIRED",
|
|
2974
|
+
field,
|
|
2975
|
+
"Provide the complete repeated schedule inside the parent activity period."
|
|
2976
|
+
);
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
function validateExperiment(value, field) {
|
|
2982
|
+
if (value === void 0 || value === null) return;
|
|
2983
|
+
if (!isObject2(value)) {
|
|
2984
|
+
fail(
|
|
2985
|
+
`${field} must be omitted or set to {"enableExp":false}.`,
|
|
2986
|
+
"ACTIVITY_EXPERIMENT_UNSUPPORTED",
|
|
2987
|
+
field,
|
|
2988
|
+
"A/B and horse-race experiments are not supported for activity tasks."
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
for (const [key, item] of Object.entries(value)) {
|
|
2992
|
+
if (key === "enableExp" && item === false) continue;
|
|
2993
|
+
if (hasValue(item)) {
|
|
2994
|
+
fail(
|
|
2995
|
+
`${field} must not enable or configure an experiment.`,
|
|
2996
|
+
"ACTIVITY_EXPERIMENT_UNSUPPORTED",
|
|
2997
|
+
field,
|
|
2998
|
+
"Remove experiment groups and use exactly one non-experiment content group."
|
|
2999
|
+
);
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
function validateSingleContentGroup(value, field) {
|
|
3004
|
+
if (Array.isArray(value) && value.length !== 1) {
|
|
3005
|
+
fail(
|
|
3006
|
+
`${field} must contain exactly one non-experiment content group.`,
|
|
3007
|
+
"ACTIVITY_CONTENT_GROUPS_UNSUPPORTED",
|
|
3008
|
+
field,
|
|
3009
|
+
"Keep language variants inside the single group contentList."
|
|
3010
|
+
);
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
function requireObject(value, field = "payload") {
|
|
3014
|
+
if (!isObject2(value)) {
|
|
3015
|
+
fail(
|
|
3016
|
+
`${field} must be a JSON object.`,
|
|
3017
|
+
"ACTIVITY_PAYLOAD_INVALID",
|
|
3018
|
+
field,
|
|
3019
|
+
"Pass a native camelCase activity task or topic payload."
|
|
3020
|
+
);
|
|
3021
|
+
}
|
|
3022
|
+
return value;
|
|
3023
|
+
}
|
|
3024
|
+
function containsAnyKey(value, keys) {
|
|
3025
|
+
if (Array.isArray(value)) return value.some((item) => containsAnyKey(item, keys));
|
|
3026
|
+
if (!isObject2(value)) return false;
|
|
3027
|
+
return Object.entries(value).some(
|
|
3028
|
+
([key, item]) => keys.has(key) && hasValue(item) || containsAnyKey(item, keys)
|
|
3029
|
+
);
|
|
3030
|
+
}
|
|
3031
|
+
function hasValue(value) {
|
|
3032
|
+
if (value === void 0 || value === null) return false;
|
|
3033
|
+
if (typeof value === "string") return value.trim().length > 0;
|
|
3034
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
3035
|
+
if (isObject2(value)) return Object.keys(value).length > 0;
|
|
3036
|
+
return true;
|
|
3037
|
+
}
|
|
3038
|
+
function isObject2(value) {
|
|
3039
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3040
|
+
}
|
|
3041
|
+
function fail(message, code, field, hint) {
|
|
3042
|
+
throw new CliValidationError(message, {
|
|
3043
|
+
code,
|
|
3044
|
+
hint,
|
|
3045
|
+
location: { field }
|
|
3046
|
+
});
|
|
3047
|
+
}
|
|
3048
|
+
|
|
2508
3049
|
// src/commands/te-engage/engage-activity/topic/create.ts
|
|
2509
3050
|
var topicCreate = createEngageActivityCapabilityCommand({
|
|
2510
3051
|
resource: "topic",
|
|
@@ -2517,10 +3058,11 @@ var topicCreate = createEngageActivityCapabilityCommand({
|
|
|
2517
3058
|
name: "payload",
|
|
2518
3059
|
type: "json",
|
|
2519
3060
|
required: true,
|
|
2520
|
-
desc: "TopicAddDTO JSON body.
|
|
3061
|
+
desc: "TopicAddDTO JSON body. Use triggerType 0/1 and no experiment. Topic tasks may only add an inclusion-only definitionRequest and inherit shared settings."
|
|
2521
3062
|
}
|
|
2522
3063
|
],
|
|
2523
3064
|
risk: "write",
|
|
3065
|
+
validate: (ctx) => validateActivityTopicPayload(ctx.json("payload")),
|
|
2524
3066
|
buildInput: (ctx) => ({
|
|
2525
3067
|
project_id: ctx.num("project-id"),
|
|
2526
3068
|
payload: ctx.json("payload")
|
|
@@ -2539,10 +3081,11 @@ var topicUpdate = createEngageActivityCapabilityCommand({
|
|
|
2539
3081
|
name: "payload",
|
|
2540
3082
|
type: "json",
|
|
2541
3083
|
required: true,
|
|
2542
|
-
desc: "TopicModifyReq JSON body
|
|
3084
|
+
desc: "TopicModifyReq JSON body. Use triggerType 0/1 and no experiment. Topic tasks may retain targetClusterType=1 from get, add an inclusion-only definitionRequest, and otherwise inherit shared settings."
|
|
2543
3085
|
}
|
|
2544
3086
|
],
|
|
2545
3087
|
risk: "write",
|
|
3088
|
+
validate: (ctx) => validateActivityTopicPayload(ctx.json("payload")),
|
|
2546
3089
|
buildInput: (ctx) => ({
|
|
2547
3090
|
project_id: ctx.num("project-id"),
|
|
2548
3091
|
payload: ctx.json("payload")
|
|
@@ -2714,10 +3257,11 @@ var taskCreate = createEngageActivityCapabilityCommand({
|
|
|
2714
3257
|
name: "payload",
|
|
2715
3258
|
type: "json",
|
|
2716
3259
|
required: true,
|
|
2717
|
-
desc: "OperationTaskOpDTO JSON body
|
|
3260
|
+
desc: "OperationTaskOpDTO JSON body. Use triggerType 0/1, fixed_time_zone, no experiment, and one content group. Custom audiences use definitionRequest. Set activityId and leave topicId empty."
|
|
2718
3261
|
}
|
|
2719
3262
|
],
|
|
2720
3263
|
risk: "write",
|
|
3264
|
+
validate: (ctx) => validateStandaloneActivityPayload(ctx.json("payload")),
|
|
2721
3265
|
buildInput: (ctx) => ({
|
|
2722
3266
|
project_id: ctx.num("project-id"),
|
|
2723
3267
|
payload: ctx.json("payload")
|
|
@@ -2732,9 +3276,15 @@ var taskUpdate = createEngageActivityCapabilityCommand({
|
|
|
2732
3276
|
description: "Edit a standalone task from an OperationTaskOpDTO payload (includes taskId).",
|
|
2733
3277
|
flags: [
|
|
2734
3278
|
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
2735
|
-
{
|
|
3279
|
+
{
|
|
3280
|
+
name: "payload",
|
|
3281
|
+
type: "json",
|
|
3282
|
+
required: true,
|
|
3283
|
+
desc: "OperationTaskOpDTO JSON body including taskId. Use triggerType 0/1, fixed_time_zone, no experiment, and one content group."
|
|
3284
|
+
}
|
|
2736
3285
|
],
|
|
2737
3286
|
risk: "write",
|
|
3287
|
+
validate: (ctx) => validateStandaloneActivityPayload(ctx.json("payload")),
|
|
2738
3288
|
buildInput: (ctx) => ({
|
|
2739
3289
|
project_id: ctx.num("project-id"),
|
|
2740
3290
|
payload: ctx.json("payload")
|
|
@@ -2771,7 +3321,7 @@ var commands4 = [
|
|
|
2771
3321
|
activityEnd,
|
|
2772
3322
|
activityStats,
|
|
2773
3323
|
activityInfoList,
|
|
2774
|
-
|
|
3324
|
+
approvalSubmit,
|
|
2775
3325
|
approvalApprove,
|
|
2776
3326
|
approvalReject,
|
|
2777
3327
|
approvalCancel,
|
|
@@ -3213,6 +3763,49 @@ var taskModifyGroup = createEngageTaskCapabilityCommand({
|
|
|
3213
3763
|
})
|
|
3214
3764
|
});
|
|
3215
3765
|
|
|
3766
|
+
// src/commands/te-engage/engage-task/task/submit-approval.ts
|
|
3767
|
+
function buildSubmitApprovalInput(ctx) {
|
|
3768
|
+
const taskId = ctx.str("task-id").trim();
|
|
3769
|
+
const request = ctx.json("request");
|
|
3770
|
+
if (taskId === "" === (request === void 0)) {
|
|
3771
|
+
throw new Error("Exactly one of --task-id or --request is required");
|
|
3772
|
+
}
|
|
3773
|
+
if (request !== void 0 && (request === null || typeof request !== "object" || Array.isArray(request))) {
|
|
3774
|
+
throw new Error("Flag --request must be a JSON object");
|
|
3775
|
+
}
|
|
3776
|
+
return {
|
|
3777
|
+
project_id: ctx.num("project-id"),
|
|
3778
|
+
...taskId !== "" && { task_id: taskId },
|
|
3779
|
+
...request !== void 0 && { request }
|
|
3780
|
+
};
|
|
3781
|
+
}
|
|
3782
|
+
var taskSubmitApproval = createEngageTaskCapabilityCommand({
|
|
3783
|
+
resource: "task",
|
|
3784
|
+
command: "submit-approval",
|
|
3785
|
+
capabilityId: "engage-task.task.submit-approval",
|
|
3786
|
+
description: "Save a draft task and submit it for approval.",
|
|
3787
|
+
flags: [
|
|
3788
|
+
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
3789
|
+
{
|
|
3790
|
+
name: "task-id",
|
|
3791
|
+
type: "string",
|
|
3792
|
+
required: false,
|
|
3793
|
+
desc: "Existing draft task ID. Exactly one of --task-id or --request is required."
|
|
3794
|
+
},
|
|
3795
|
+
{
|
|
3796
|
+
name: "request",
|
|
3797
|
+
type: "json",
|
|
3798
|
+
required: false,
|
|
3799
|
+
desc: "Legacy ApprovalSaveAndSubmitDTO JSON. Exactly one of --task-id or --request is required."
|
|
3800
|
+
}
|
|
3801
|
+
],
|
|
3802
|
+
risk: "write",
|
|
3803
|
+
validate: (ctx) => {
|
|
3804
|
+
buildSubmitApprovalInput(ctx);
|
|
3805
|
+
},
|
|
3806
|
+
buildInput: buildSubmitApprovalInput
|
|
3807
|
+
});
|
|
3808
|
+
|
|
3216
3809
|
// src/commands/te-engage/engage-task/task/build-save-guide.ts
|
|
3217
3810
|
var taskBuildSaveGuide = createEngageTaskCapabilityCommand({
|
|
3218
3811
|
resource: "task",
|
|
@@ -3290,11 +3883,16 @@ var taskSave = createEngageTaskCapabilityCommand({
|
|
|
3290
3883
|
description: "Create a task draft, or update an existing draft/paused task.",
|
|
3291
3884
|
flags: [
|
|
3292
3885
|
{ name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
|
|
3293
|
-
{
|
|
3886
|
+
{
|
|
3887
|
+
name: "req",
|
|
3888
|
+
type: "json",
|
|
3889
|
+
required: true,
|
|
3890
|
+
desc: "Task save JSON; custom audiences use targetConfig.definitionRequest."
|
|
3891
|
+
}
|
|
3294
3892
|
],
|
|
3295
3893
|
risk: "write",
|
|
3296
3894
|
validate: (ctx) => {
|
|
3297
|
-
readRequiredJsonObject(ctx, "req");
|
|
3895
|
+
validateEmbeddedSemanticDefinitions(readRequiredJsonObject(ctx, "req"), "--req");
|
|
3298
3896
|
},
|
|
3299
3897
|
buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequiredJsonObject(ctx, "req") })
|
|
3300
3898
|
});
|
|
@@ -3339,8 +3937,8 @@ var commands6 = [
|
|
|
3339
3937
|
segmentListRename,
|
|
3340
3938
|
segmentListSetVisibility,
|
|
3341
3939
|
taskDelete,
|
|
3342
|
-
taskModifyGroup
|
|
3343
|
-
|
|
3940
|
+
taskModifyGroup,
|
|
3941
|
+
taskSubmitApproval
|
|
3344
3942
|
];
|
|
3345
3943
|
var engage_task_default = commands6;
|
|
3346
3944
|
|