@wraps.dev/cli 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2575,8 +2575,16 @@ var init_client = __esm({
2575
2575
  });
2576
2576
 
2577
2577
  // src/telemetry/events.ts
2578
+ function trackCommandFallback(command6, metadata) {
2579
+ const failing = metadata?.success === false;
2580
+ if (failing ? reportedOutcome === "failure" : reportedOutcome !== "none") {
2581
+ return;
2582
+ }
2583
+ trackCommand(command6, metadata);
2584
+ }
2578
2585
  function trackCommand(command6, metadata) {
2579
2586
  const client2 = getTelemetryClient();
2587
+ reportedOutcome = metadata?.success === false || reportedOutcome === "failure" ? "failure" : "success";
2580
2588
  const sanitized = metadata ? { ...metadata } : {};
2581
2589
  sanitized.domain = void 0;
2582
2590
  sanitized.accountId = void 0;
@@ -2624,11 +2632,13 @@ function trackServiceRemoved(service, metadata) {
2624
2632
  ...metadata
2625
2633
  });
2626
2634
  }
2635
+ var reportedOutcome;
2627
2636
  var init_events = __esm({
2628
2637
  "src/telemetry/events.ts"() {
2629
2638
  "use strict";
2630
2639
  init_esm_shims();
2631
2640
  init_client();
2641
+ reportedOutcome = "none";
2632
2642
  }
2633
2643
  });
2634
2644
 
@@ -56305,11 +56315,6 @@ ${pc46.dim("Documentation:")}`);
56305
56315
  }
56306
56316
  async function permissions(options) {
56307
56317
  const startTime = Date.now();
56308
- trackCommand("permissions", {
56309
- json: options.json,
56310
- preset: options.preset,
56311
- service: options.service
56312
- });
56313
56318
  const policy = buildPolicy(options.service, options.preset);
56314
56319
  if (isJsonMode()) {
56315
56320
  jsonSuccess("permissions", {
@@ -56332,7 +56337,10 @@ async function permissions(options) {
56332
56337
  }
56333
56338
  trackCommand("permissions", {
56334
56339
  success: true,
56335
- duration_ms: Date.now() - startTime
56340
+ duration_ms: Date.now() - startTime,
56341
+ json: options.json,
56342
+ preset: options.preset,
56343
+ service: options.service
56336
56344
  });
56337
56345
  }
56338
56346
 
@@ -66744,14 +66752,22 @@ function suggestCommand(input, known = TOP_LEVEL_COMMANDS) {
66744
66752
  var UNKNOWN = "unknown";
66745
66753
  var COMMAND_WORD = /^[a-z][a-z0-9-]{0,31}$/;
66746
66754
  var COMMANDS_WITH_DATA_SECOND_POSITIONAL = ["push"];
66747
- function telemetryCommandName(primaryCommand2, subCommand2) {
66755
+ var PAIRS_WITH_DATA_THIRD_POSITIONAL = ["email:check"];
66756
+ function telemetryCommandName(primaryCommand2, subCommand2, thirdPositional) {
66748
66757
  if (!(primaryCommand2 && TOP_LEVEL_COMMANDS.includes(primaryCommand2))) {
66749
66758
  return UNKNOWN;
66750
66759
  }
66751
66760
  if (!subCommand2 || COMMANDS_WITH_DATA_SECOND_POSITIONAL.includes(primaryCommand2)) {
66752
66761
  return primaryCommand2;
66753
66762
  }
66754
- return COMMAND_WORD.test(subCommand2) ? `${primaryCommand2}:${subCommand2}` : `${primaryCommand2}:${UNKNOWN}`;
66763
+ if (!COMMAND_WORD.test(subCommand2)) {
66764
+ return `${primaryCommand2}:${UNKNOWN}`;
66765
+ }
66766
+ const pair = `${primaryCommand2}:${subCommand2}`;
66767
+ if (!(thirdPositional && COMMAND_WORD.test(thirdPositional)) || PAIRS_WITH_DATA_THIRD_POSITIONAL.includes(pair)) {
66768
+ return pair;
66769
+ }
66770
+ return `${pair}:${thirdPositional}`;
66755
66771
  }
66756
66772
 
66757
66773
  // src/cli.ts
@@ -67860,7 +67876,7 @@ async function run() {
67860
67876
  }
67861
67877
  const emailDuration = Date.now() - startTime;
67862
67878
  const emailCommandName = `email:${subCommand}`;
67863
- trackCommand(emailCommandName, {
67879
+ trackCommandFallback(emailCommandName, {
67864
67880
  success: true,
67865
67881
  duration_ms: emailDuration,
67866
67882
  service: "email"
@@ -67884,7 +67900,7 @@ async function run() {
67884
67900
  "Run wraps --help for available commands."
67885
67901
  );
67886
67902
  }
67887
- trackCommand(`license:${subCommand}`, {
67903
+ trackCommandFallback(`license:${subCommand}`, {
67888
67904
  success: true,
67889
67905
  duration_ms: Date.now() - startTime,
67890
67906
  service: "license"
@@ -67958,7 +67974,7 @@ async function run() {
67958
67974
  }
67959
67975
  const selfhostDuration = Date.now() - startTime;
67960
67976
  const selfhostCommandName = `selfhost:${subCommand}`;
67961
- trackCommand(selfhostCommandName, {
67977
+ trackCommandFallback(selfhostCommandName, {
67962
67978
  success: true,
67963
67979
  duration_ms: selfhostDuration,
67964
67980
  service: "selfhost"
@@ -68042,7 +68058,7 @@ async function run() {
68042
68058
  }
68043
68059
  const smsDuration = Date.now() - startTime;
68044
68060
  const smsCommandName = `sms:${subCommand}`;
68045
- trackCommand(smsCommandName, {
68061
+ trackCommandFallback(smsCommandName, {
68046
68062
  success: true,
68047
68063
  duration_ms: smsDuration,
68048
68064
  service: "sms"
@@ -68104,7 +68120,7 @@ async function run() {
68104
68120
  }
68105
68121
  const cdnDuration = Date.now() - startTime;
68106
68122
  const cdnCommandName = `cdn:${subCommand}`;
68107
- trackCommand(cdnCommandName, {
68123
+ trackCommandFallback(cdnCommandName, {
68108
68124
  success: true,
68109
68125
  duration_ms: cdnDuration,
68110
68126
  service: "cdn"
@@ -68127,7 +68143,7 @@ async function run() {
68127
68143
  }
68128
68144
  const workflowDuration = Date.now() - startTime;
68129
68145
  const workflowCommandName = `workflow:${subCommand}`;
68130
- trackCommand(workflowCommandName, {
68146
+ trackCommandFallback(workflowCommandName, {
68131
68147
  success: true,
68132
68148
  duration_ms: workflowDuration,
68133
68149
  service: "workflow"
@@ -68138,7 +68154,7 @@ async function run() {
68138
68154
  if (!subCommand) {
68139
68155
  await platform2();
68140
68156
  const platformDuration2 = Date.now() - startTime;
68141
- trackCommand("platform", {
68157
+ trackCommandFallback("platform", {
68142
68158
  success: true,
68143
68159
  duration_ms: platformDuration2
68144
68160
  });
@@ -68177,7 +68193,7 @@ async function run() {
68177
68193
  }
68178
68194
  const platformDuration = Date.now() - startTime;
68179
68195
  const platformCommandName = `platform:${subCommand}`;
68180
- trackCommand(platformCommandName, {
68196
+ trackCommandFallback(platformCommandName, {
68181
68197
  success: true,
68182
68198
  duration_ms: platformDuration
68183
68199
  });
@@ -68220,7 +68236,7 @@ async function run() {
68220
68236
  }
68221
68237
  const awsDuration = Date.now() - startTime;
68222
68238
  const awsCommandName = `aws:${subCommand}`;
68223
- trackCommand(awsCommandName, {
68239
+ trackCommandFallback(awsCommandName, {
68224
68240
  success: true,
68225
68241
  duration_ms: awsDuration
68226
68242
  });
@@ -68334,15 +68350,23 @@ Run wraps --help for available commands.` : "Run wraps --help for available comm
68334
68350
  }
68335
68351
  }
68336
68352
  const duration = Date.now() - startTime;
68337
- const commandName = telemetryCommandName(primaryCommand, subCommand);
68338
- trackCommand(commandName, {
68353
+ const commandName = telemetryCommandName(
68354
+ primaryCommand,
68355
+ subCommand,
68356
+ sub[2]
68357
+ );
68358
+ trackCommandFallback(commandName, {
68339
68359
  success: true,
68340
68360
  duration_ms: duration
68341
68361
  });
68342
68362
  } catch (error) {
68343
68363
  const duration = Date.now() - startTime;
68344
- const commandName = telemetryCommandName(primaryCommand, subCommand);
68345
- trackCommand(commandName, {
68364
+ const commandName = telemetryCommandName(
68365
+ primaryCommand,
68366
+ subCommand,
68367
+ sub[2]
68368
+ );
68369
+ trackCommandFallback(commandName, {
68346
68370
  success: false,
68347
68371
  duration_ms: duration
68348
68372
  });