@testrelic/maestro-analytics 1.2.1-next.56 → 1.2.2-next.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -976,6 +976,34 @@ function normalizeMaestroCommandName(key) {
976
976
  const withoutSuffix = key.replace(/Command$/, "");
977
977
  return MAESTRO_COMMAND_NAME_MAP[withoutSuffix] ?? withoutSuffix;
978
978
  }
979
+ var RESERVED_CHILD_KEYS = /* @__PURE__ */ new Set([
980
+ "metadata",
981
+ "command",
982
+ "commandName",
983
+ "name",
984
+ "status",
985
+ "duration",
986
+ "durationMs",
987
+ "timestamp",
988
+ "time",
989
+ "error",
990
+ "errorMessage",
991
+ "selector",
992
+ "commands",
993
+ "subSteps",
994
+ "children",
995
+ "sequenceNumber"
996
+ ]);
997
+ function findInlineCommandKey(raw) {
998
+ for (const key of Object.keys(raw)) {
999
+ if (RESERVED_CHILD_KEYS.has(key)) continue;
1000
+ const value = raw[key];
1001
+ if (value && typeof value === "object" && !Array.isArray(value)) {
1002
+ return key;
1003
+ }
1004
+ }
1005
+ return void 0;
1006
+ }
979
1007
  function extractMaestroSelector(params) {
980
1008
  if (params.selector && typeof params.selector === "object") {
981
1009
  const sel = params.selector;
@@ -1081,7 +1109,8 @@ function extractCommandDetails(commandName, params) {
1081
1109
  case "runScript":
1082
1110
  case "evalScript": {
1083
1111
  if (typeof params.path === "string") details.path = params.path;
1084
- if (typeof params.script === "string") details.script = truncate(params.script, MAX_SCRIPT_DETAIL_LENGTH);
1112
+ const inlineScript = params.script ?? params.scriptString;
1113
+ if (typeof inlineScript === "string") details.script = truncate(inlineScript, MAX_SCRIPT_DETAIL_LENGTH);
1085
1114
  if (typeof params.sourceDescription === "string") details.sourceDescription = params.sourceDescription;
1086
1115
  break;
1087
1116
  }
@@ -1145,9 +1174,18 @@ function parseRawCommand(raw, index, baseTimestamp) {
1145
1174
  details = extractCommandDetails(command, params);
1146
1175
  children = extractChildCommands(params, raw, baseTimestamp);
1147
1176
  } else {
1148
- command = raw.command ?? raw.commandName ?? raw.name ?? `step-${index}`;
1149
- selector = raw.selector ?? void 0;
1150
- children = extractChildCommands({}, raw, baseTimestamp);
1177
+ const inlineKey = findInlineCommandKey(raw);
1178
+ if (inlineKey) {
1179
+ command = normalizeMaestroCommandName(inlineKey);
1180
+ const params = raw[inlineKey] ?? {};
1181
+ selector = extractMaestroSelector(params);
1182
+ details = extractCommandDetails(command, params);
1183
+ children = extractChildCommands(params, raw, baseTimestamp);
1184
+ } else {
1185
+ command = raw.command ?? raw.commandName ?? raw.name ?? `step-${index}`;
1186
+ selector = raw.selector ?? void 0;
1187
+ children = extractChildCommands({}, raw, baseTimestamp);
1188
+ }
1151
1189
  }
1152
1190
  const meta = raw.metadata ?? {};
1153
1191
  const status = mapStatus(meta.status ?? raw.status);
@@ -1902,6 +1940,7 @@ function buildStepTitle(cmd) {
1902
1940
  case "evalScript":
1903
1941
  if (typeof d.path === "string") return `${cmd.command} ${d.path}`;
1904
1942
  if (typeof d.sourceDescription === "string") return `${cmd.command} ${d.sourceDescription}`;
1943
+ if (typeof d.script === "string") return `${cmd.command} ${d.script}`;
1905
1944
  break;
1906
1945
  case "assertWithAI":
1907
1946
  case "assertNoDefectsWithAI":