@dereekb/dbx-cli 13.14.0 → 13.16.0

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/index.cjs.js CHANGED
@@ -351,11 +351,17 @@ function _ts_generator$1f(thisArg, body) {
351
351
  /client_secret[=:]\s*\S+/gi,
352
352
  /id_token[=:]\s*\S+/gi
353
353
  ];
354
+ /**
355
+ * Default per-request HTTP timeout in milliseconds, applied when no explicit `--timeout` is set.
356
+ *
357
+ * Without a default, the HTTP layer's `fetch` waits indefinitely on an unresponsive server, which
358
+ * surfaces as a CLI (or CI test) that hangs forever rather than failing with a clear error.
359
+ */ var DEFAULT_CLI_HTTP_TIMEOUT_MS = 60000;
354
360
  var _outputOptions = {};
355
361
  var _secretPatterns = _to_consumable_array$Z(DEFAULT_CLI_SECRET_PATTERNS);
356
362
  var _errorMapper;
357
363
  var _verbose = false;
358
- var _timeoutMs;
364
+ var _timeoutMs = DEFAULT_CLI_HTTP_TIMEOUT_MS;
359
365
  /**
360
366
  * Configures output options from parsed CLI arguments.
361
367
  *
@@ -410,7 +416,8 @@ var _timeoutMs;
410
416
  * @returns The fetch Response.
411
417
  */ function tracedFetch(fetcher, input, init) {
412
418
  return _async_to_generator$1f(function() {
413
- var _ref, fetchImpl, timeoutMs, method, url, controller, timeoutHandle, finalInit, localController, e;
419
+ var _ref, fetchImpl, timeoutMs, method, url, controller, timeoutHandle, finalInit, // Don't let the abort timer itself keep the Node event loop (or a test worker) alive.
420
+ _timeoutHandle_unref, localController, e;
414
421
  return _ts_generator$1f(this, function(_state) {
415
422
  switch(_state.label){
416
423
  case 0:
@@ -426,12 +433,13 @@ var _timeoutMs;
426
433
  }
427
434
  verboseLog("".concat(method, " ").concat(url));
428
435
  finalInit = init;
429
- if (timeoutMs != null && (init === null || init === void 0 ? void 0 : init.signal) == null) {
436
+ if (timeoutMs != null && timeoutMs > 0 && (init === null || init === void 0 ? void 0 : init.signal) == null) {
430
437
  localController = new AbortController();
431
438
  controller = localController;
432
439
  timeoutHandle = setTimeout(function() {
433
440
  return localController.abort();
434
441
  }, timeoutMs);
442
+ (_timeoutHandle_unref = timeoutHandle.unref) === null || _timeoutHandle_unref === void 0 ? void 0 : _timeoutHandle_unref.call(timeoutHandle);
435
443
  finalInit = _object_spread_props$t(_object_spread$L({}, init), {
436
444
  signal: localController.signal
437
445
  });
@@ -478,12 +486,13 @@ var _timeoutMs;
478
486
  /**
479
487
  * Sets the process-wide HTTP timeout (in milliseconds) honored by the HTTP layer.
480
488
  *
481
- * Pass `undefined` to clear. The HTTP helpers thread this into an `AbortController`
482
- * so individual `fetch` calls cancel after the configured duration.
489
+ * The HTTP helpers thread a positive value into an `AbortController` so individual `fetch` calls
490
+ * cancel after the configured duration. `undefined` falls back to {@link DEFAULT_CLI_HTTP_TIMEOUT_MS};
491
+ * `0` (or a negative value) disables the timeout entirely (the request waits indefinitely).
483
492
  *
484
- * @param ms - Timeout in ms, or `undefined` to clear.
493
+ * @param ms - Timeout in ms, `0`/negative to disable, or `undefined` to fall back to the default.
485
494
  */ function setCliTimeoutMs(ms) {
486
- _timeoutMs = ms;
495
+ _timeoutMs = ms === undefined ? DEFAULT_CLI_HTTP_TIMEOUT_MS : ms;
487
496
  }
488
497
  /**
489
498
  * @returns The current process-wide HTTP timeout in ms, or `undefined` when unset.
@@ -7055,11 +7064,11 @@ function resolveAuthSetupPrompt(input) {
7055
7064
  tokenType: tokenResponse.token_type,
7056
7065
  scope: tokenResponse.scope,
7057
7066
  expiresAt: expiresAt
7058
- }, sessionExpiresAt != null ? {
7067
+ }, sessionExpiresAt == null ? {} : {
7059
7068
  sessionExpiresAt: sessionExpiresAt
7060
- } : {}, rotationDisabled != null ? {
7069
+ }, rotationDisabled == null ? {} : {
7061
7070
  rotationDisabled: rotationDisabled
7062
- } : {});
7071
+ });
7063
7072
  return [
7064
7073
  4,
7065
7074
  tokens.set(envName, entry)
@@ -9279,14 +9288,15 @@ function _ts_generator$_(thisArg, body) {
9279
9288
  });
9280
9289
  return function(argv) {
9281
9290
  return _async_to_generator$_(function() {
9282
- var _argv__, command, _ref, _ref1, envName, env, entry, _readEnvTokenEntry, _refreshed_refresh_token, _refreshed_token_type, _refreshed_scope, _refreshed_expires_in, meta, suppliedRefreshToken, refreshed, e;
9291
+ var _argv__, command, _ref, envName, env, entry, e;
9283
9292
  return _ts_generator$_(this, function(_state) {
9284
9293
  switch(_state.label){
9285
9294
  case 0:
9286
9295
  // Configure verbose/timeout as early as possible so HTTP calls made from this very
9287
9296
  // middleware (OIDC discovery + token refresh) honor the flags.
9288
9297
  setCliVerbose(Boolean(argv.verbose));
9289
- setCliTimeoutMs(typeof argv.timeout === 'number' && argv.timeout > 0 ? argv.timeout * 1000 : undefined);
9298
+ // No `--timeout` flag undefined the default timeout applies. `--timeout 0` disables it.
9299
+ setCliTimeoutMs(typeof argv.timeout === 'number' ? argv.timeout * 1000 : undefined);
9290
9300
  command = (_argv__ = argv._) === null || _argv__ === void 0 ? void 0 : _argv__[0];
9291
9301
  if (typeof command === 'string' && input.skipCommands.has(command)) {
9292
9302
  return [
@@ -9297,9 +9307,9 @@ function _ts_generator$_(thisArg, body) {
9297
9307
  case 1:
9298
9308
  _state.trys.push([
9299
9309
  1,
9300
- 9,
9310
+ 4,
9301
9311
  ,
9302
- 10
9312
+ 5
9303
9313
  ]);
9304
9314
  return [
9305
9315
  4,
@@ -9312,86 +9322,18 @@ function _ts_generator$_(thisArg, body) {
9312
9322
  })
9313
9323
  ];
9314
9324
  case 2:
9315
- _ref1 = _state.sent(), envName = _ref1.envName, env = _ref1.env;
9325
+ _ref = _state.sent(), envName = _ref.envName, env = _ref.env;
9316
9326
  return [
9317
9327
  4,
9318
- tokens.get(envName)
9319
- ];
9320
- case 3:
9321
- entry = (_ref = _state.sent()) !== null && _ref !== void 0 ? _ref : undefined;
9322
- if (!entry) {
9323
- entry = (_readEnvTokenEntry = readEnvTokenEntry({
9324
- cliName: input.cliName
9325
- })) !== null && _readEnvTokenEntry !== void 0 ? _readEnvTokenEntry : undefined;
9326
- }
9327
- if (!(entry === null || entry === void 0 ? void 0 : entry.accessToken) && !(entry === null || entry === void 0 ? void 0 : entry.refreshToken)) {
9328
- throw new CliError({
9329
- message: 'No tokens for env "'.concat(envName, '". Run `').concat(input.cliName, " auth login --env ").concat(envName, "`."),
9330
- code: 'NOT_LOGGED_IN'
9331
- });
9332
- }
9333
- if (!(!entry.accessToken || isTokenExpired(entry))) return [
9334
- 3,
9335
- 8
9336
- ];
9337
- if (!entry.refreshToken) {
9338
- throw new CliError({
9339
- message: 'Token for env "'.concat(envName, '" is expired and no refresh token is cached. Re-login.'),
9340
- code: 'TOKEN_EXPIRED',
9341
- suggestion: "Run `".concat(input.cliName, " auth login --env ").concat(envName, "`.")
9342
- });
9343
- }
9344
- return [
9345
- 4,
9346
- discoverOidcMetadata({
9347
- issuer: env.oidcIssuer,
9348
- fallbackBaseUrl: env.apiBaseUrl
9349
- })
9350
- ];
9351
- case 4:
9352
- meta = _state.sent();
9353
- suppliedRefreshToken = entry.refreshToken;
9354
- return [
9355
- 4,
9356
- refreshAccessToken({
9357
- tokenEndpoint: meta.token_endpoint,
9358
- clientId: env.clientId,
9359
- clientSecret: env.clientSecret,
9360
- refreshToken: suppliedRefreshToken
9328
+ resolveAccessTokenEntry({
9329
+ cliName: input.cliName,
9330
+ envName: envName,
9331
+ env: env,
9332
+ tokens: tokens
9361
9333
  })
9362
9334
  ];
9363
- case 5:
9364
- refreshed = _state.sent();
9365
- entry = _object_spread_props$l(_object_spread$A({}, entry), {
9366
- accessToken: refreshed.access_token,
9367
- refreshToken: (_refreshed_refresh_token = refreshed.refresh_token) !== null && _refreshed_refresh_token !== void 0 ? _refreshed_refresh_token : entry.refreshToken,
9368
- tokenType: (_refreshed_token_type = refreshed.token_type) !== null && _refreshed_token_type !== void 0 ? _refreshed_token_type : entry.tokenType,
9369
- scope: (_refreshed_scope = refreshed.scope) !== null && _refreshed_scope !== void 0 ? _refreshed_scope : entry.scope,
9370
- expiresAt: Date.now() + ((_refreshed_expires_in = refreshed.expires_in) !== null && _refreshed_expires_in !== void 0 ? _refreshed_expires_in : 0) * 1000
9371
- });
9372
- if (!entry.fromEnv) return [
9373
- 3,
9374
- 6
9375
- ];
9376
- // Service tokens do not rotate, so a one-shot env-sourced invocation is durable without
9377
- // persisting. If a *rotating* refresh token was supplied, the rotation is lost on exit —
9378
- // warn that env credentials should be non-rotating service tokens.
9379
- if (refreshed.refresh_token != null && refreshed.refresh_token !== suppliedRefreshToken) {
9380
- process.stderr.write('Warning: the refresh token supplied via environment rotated on use; the rotated token cannot be persisted for a one-shot invocation. Use a non-rotating service token (auth login --service-token).\n');
9381
- }
9382
- return [
9383
- 3,
9384
- 8
9385
- ];
9386
- case 6:
9387
- return [
9388
- 4,
9389
- tokens.set(envName, entry)
9390
- ];
9391
- case 7:
9392
- _state.sent();
9393
- _state.label = 8;
9394
- case 8:
9335
+ case 3:
9336
+ entry = _state.sent();
9395
9337
  setCliContext(createCliContext({
9396
9338
  cliName: input.cliName,
9397
9339
  envName: envName,
@@ -9401,17 +9343,17 @@ function _ts_generator$_(thisArg, body) {
9401
9343
  }));
9402
9344
  return [
9403
9345
  3,
9404
- 10
9346
+ 5
9405
9347
  ];
9406
- case 9:
9348
+ case 4:
9407
9349
  e = _state.sent();
9408
9350
  outputError(e);
9409
9351
  process.exit(CLI_EXIT_CODE_AUTH);
9410
9352
  return [
9411
9353
  3,
9412
- 10
9354
+ 5
9413
9355
  ];
9414
- case 10:
9356
+ case 5:
9415
9357
  return [
9416
9358
  2
9417
9359
  ];
@@ -9420,6 +9362,146 @@ function _ts_generator$_(thisArg, body) {
9420
9362
  })();
9421
9363
  };
9422
9364
  }
9365
+ /**
9366
+ * Resolves the access-token entry for an env: prefers the cached token, falls
9367
+ * back to an env-supplied token, requires at least one token to be present,
9368
+ * and refreshes when the access token is missing or expired.
9369
+ *
9370
+ * @param input - The CLI name, resolved env, env name, and token cache store.
9371
+ * @returns The resolved (and refreshed when necessary) token entry.
9372
+ * @throws {CliError} When no tokens are available for the env.
9373
+ */ function resolveAccessTokenEntry(input) {
9374
+ return _async_to_generator$_(function() {
9375
+ var _ref, cliName, envName, env, tokens, entry, _readEnvTokenEntry;
9376
+ return _ts_generator$_(this, function(_state) {
9377
+ switch(_state.label){
9378
+ case 0:
9379
+ cliName = input.cliName, envName = input.envName, env = input.env, tokens = input.tokens;
9380
+ return [
9381
+ 4,
9382
+ tokens.get(envName)
9383
+ ];
9384
+ case 1:
9385
+ entry = (_ref = _state.sent()) !== null && _ref !== void 0 ? _ref : undefined;
9386
+ if (!entry) {
9387
+ entry = (_readEnvTokenEntry = readEnvTokenEntry({
9388
+ cliName: cliName
9389
+ })) !== null && _readEnvTokenEntry !== void 0 ? _readEnvTokenEntry : undefined;
9390
+ }
9391
+ if (!(entry === null || entry === void 0 ? void 0 : entry.accessToken) && !(entry === null || entry === void 0 ? void 0 : entry.refreshToken)) {
9392
+ throw new CliError({
9393
+ message: 'No tokens for env "'.concat(envName, '". Run `').concat(cliName, " auth login --env ").concat(envName, "`."),
9394
+ code: 'NOT_LOGGED_IN'
9395
+ });
9396
+ }
9397
+ if (!(!entry.accessToken || isTokenExpired(entry))) return [
9398
+ 3,
9399
+ 3
9400
+ ];
9401
+ return [
9402
+ 4,
9403
+ refreshTokenEntry({
9404
+ cliName: cliName,
9405
+ envName: envName,
9406
+ env: env,
9407
+ tokens: tokens,
9408
+ entry: entry
9409
+ })
9410
+ ];
9411
+ case 2:
9412
+ entry = _state.sent();
9413
+ _state.label = 3;
9414
+ case 3:
9415
+ return [
9416
+ 2,
9417
+ entry
9418
+ ];
9419
+ }
9420
+ });
9421
+ })();
9422
+ }
9423
+ /**
9424
+ * Refreshes an absent/expired access token via OIDC. Cache-sourced entries are
9425
+ * persisted; env-sourced service tokens are durable for the one-shot
9426
+ * invocation and not written back (and a rotated env refresh token is warned
9427
+ * about, since it cannot be persisted).
9428
+ *
9429
+ * @param input - The CLI name, env, env name, token store, and the entry to refresh.
9430
+ * @returns The refreshed token entry.
9431
+ * @throws {CliError} When the entry is expired and has no refresh token.
9432
+ */ function refreshTokenEntry(input) {
9433
+ return _async_to_generator$_(function() {
9434
+ var _refreshed_refresh_token, _refreshed_token_type, _refreshed_scope, _refreshed_expires_in, cliName, envName, env, tokens, entry, meta, suppliedRefreshToken, refreshed, updated;
9435
+ return _ts_generator$_(this, function(_state) {
9436
+ switch(_state.label){
9437
+ case 0:
9438
+ cliName = input.cliName, envName = input.envName, env = input.env, tokens = input.tokens, entry = input.entry;
9439
+ if (!entry.refreshToken) {
9440
+ throw new CliError({
9441
+ message: 'Token for env "'.concat(envName, '" is expired and no refresh token is cached. Re-login.'),
9442
+ code: 'TOKEN_EXPIRED',
9443
+ suggestion: "Run `".concat(cliName, " auth login --env ").concat(envName, "`.")
9444
+ });
9445
+ }
9446
+ return [
9447
+ 4,
9448
+ discoverOidcMetadata({
9449
+ issuer: env.oidcIssuer,
9450
+ fallbackBaseUrl: env.apiBaseUrl
9451
+ })
9452
+ ];
9453
+ case 1:
9454
+ meta = _state.sent();
9455
+ suppliedRefreshToken = entry.refreshToken;
9456
+ return [
9457
+ 4,
9458
+ refreshAccessToken({
9459
+ tokenEndpoint: meta.token_endpoint,
9460
+ clientId: env.clientId,
9461
+ clientSecret: env.clientSecret,
9462
+ refreshToken: suppliedRefreshToken
9463
+ })
9464
+ ];
9465
+ case 2:
9466
+ refreshed = _state.sent();
9467
+ updated = _object_spread_props$l(_object_spread$A({}, entry), {
9468
+ accessToken: refreshed.access_token,
9469
+ refreshToken: (_refreshed_refresh_token = refreshed.refresh_token) !== null && _refreshed_refresh_token !== void 0 ? _refreshed_refresh_token : entry.refreshToken,
9470
+ tokenType: (_refreshed_token_type = refreshed.token_type) !== null && _refreshed_token_type !== void 0 ? _refreshed_token_type : entry.tokenType,
9471
+ scope: (_refreshed_scope = refreshed.scope) !== null && _refreshed_scope !== void 0 ? _refreshed_scope : entry.scope,
9472
+ expiresAt: Date.now() + ((_refreshed_expires_in = refreshed.expires_in) !== null && _refreshed_expires_in !== void 0 ? _refreshed_expires_in : 0) * 1000
9473
+ });
9474
+ if (!updated.fromEnv) return [
9475
+ 3,
9476
+ 3
9477
+ ];
9478
+ // Service tokens do not rotate, so a one-shot env-sourced invocation is durable without
9479
+ // persisting. If a *rotating* refresh token was supplied, the rotation is lost on exit —
9480
+ // warn that env credentials should be non-rotating service tokens.
9481
+ if (refreshed.refresh_token != null && refreshed.refresh_token !== suppliedRefreshToken) {
9482
+ process.stderr.write('Warning: the refresh token supplied via environment rotated on use; the rotated token cannot be persisted for a one-shot invocation. Use a non-rotating service token (auth login --service-token).\n');
9483
+ }
9484
+ return [
9485
+ 3,
9486
+ 5
9487
+ ];
9488
+ case 3:
9489
+ return [
9490
+ 4,
9491
+ tokens.set(envName, updated)
9492
+ ];
9493
+ case 4:
9494
+ _state.sent();
9495
+ _state.label = 5;
9496
+ case 5:
9497
+ return [
9498
+ 2,
9499
+ updated
9500
+ ];
9501
+ }
9502
+ });
9503
+ })();
9504
+ }
9423
9505
  /**
9424
9506
  * Test-only middleware that skips OIDC discovery, disk token loading, and token refresh, attaching
9425
9507
  * a pre-built {@link CliContext} directly via {@link setCliContext}.
@@ -9672,7 +9754,8 @@ function _ts_generator$Z(thisArg, body) {
9672
9754
  // (auth, env, doctor, output) — which bypass the auth middleware via skipCommands —
9673
9755
  // still respect `--verbose` and `--timeout`.
9674
9756
  setCliVerbose(Boolean(argv.verbose));
9675
- setCliTimeoutMs(typeof argv.timeout === 'number' && argv.timeout > 0 ? argv.timeout * 1000 : undefined);
9757
+ // No `--timeout` flag undefined the default timeout applies. `--timeout 0` disables it.
9758
+ setCliTimeoutMs(typeof argv.timeout === 'number' ? argv.timeout * 1000 : undefined);
9676
9759
  commandPath = argv._ ? argv._.map(String) : [];
9677
9760
  topCommand = commandPath[0];
9678
9761
  setDumpDir = argv.setDumpDir;
@@ -10450,7 +10533,7 @@ function _ts_generator$X(thisArg, body) {
10450
10533
  }).option('timeout', {
10451
10534
  type: 'number',
10452
10535
  global: true,
10453
- describe: 'Per-HTTP-request timeout in seconds (aborts via AbortController)'
10536
+ describe: 'Per-HTTP-request timeout in seconds (default 60; 0 disables; aborts via AbortController)'
10454
10537
  }).option('data-help', {
10455
10538
  type: 'string',
10456
10539
  choices: [
@@ -11271,6 +11354,7 @@ function hideGlobalOptions(yargs, names) {
11271
11354
  * @returns Multi-section epilogue string, or `undefined` when the entry has no
11272
11355
  * metadata worth surfacing.
11273
11356
  */ function buildEntryEpilogue(entry, context) {
11357
+ var _sections, _sections1;
11274
11358
  var dataHelpFormat = context.dataHelpFormat, helpMode = context.helpMode;
11275
11359
  var showAction = helpMode === 'action' || helpMode === 'both';
11276
11360
  var showParams = helpMode === 'params' || helpMode === 'both';
@@ -11279,31 +11363,67 @@ function hideGlobalOptions(yargs, names) {
11279
11363
  var actionSection = buildActionSection(entry);
11280
11364
  if (actionSection) sections.push(actionSection);
11281
11365
  }
11282
- var schemaSections = [];
11283
- if (showParams) {
11284
- var _sections;
11285
- var paramsSection = buildParamsSection(entry);
11286
- if (paramsSection) sections.push(paramsSection);
11287
- schemaSections = renderParamsSchemaSections(entry, dataHelpFormat);
11288
- (_sections = sections).push.apply(_sections, _to_consumable_array$P(schemaSections));
11289
- var resultSection = buildResultSection(entry);
11290
- if (resultSection) {
11291
- sections.push(resultSection);
11292
- } else if (entry.resultTypeName) {
11293
- sections.push("Result: ".concat(entry.resultTypeName));
11294
- }
11295
- }
11366
+ var params = showParams ? collectParamsSections(entry, dataHelpFormat) : {
11367
+ sections: [],
11368
+ schemaCount: 0
11369
+ };
11370
+ (_sections = sections).push.apply(_sections, _to_consumable_array$P(params.sections));
11296
11371
  if (entry.sourceFile) {
11297
11372
  sections.push("Source: ".concat(entry.sourceFile));
11298
11373
  }
11299
- if (showParams && schemaSections.length > 0 && dataHelpFormat !== 'both') {
11374
+ (_sections1 = sections).push.apply(_sections1, _to_consumable_array$P(collectHelpHints({
11375
+ entry: entry,
11376
+ helpMode: helpMode,
11377
+ dataHelpFormat: dataHelpFormat,
11378
+ showParams: showParams,
11379
+ schemaCount: params.schemaCount
11380
+ })));
11381
+ return sections.length > 0 ? sections.join('\n\n') : undefined;
11382
+ }
11383
+ /**
11384
+ * Collects the params-side help sections (params interface, schema renders,
11385
+ * result) for an entry, reporting how many schema sections were produced so
11386
+ * the caller can decide whether to surface the schema-format hint.
11387
+ *
11388
+ * @param entry - The manifest entry being documented.
11389
+ * @param dataHelpFormat - The requested schema render format.
11390
+ * @returns The ordered sections and the number of schema sections produced.
11391
+ */ function collectParamsSections(entry, dataHelpFormat) {
11392
+ var _sections;
11393
+ var sections = [];
11394
+ var paramsSection = buildParamsSection(entry);
11395
+ if (paramsSection) sections.push(paramsSection);
11396
+ var schemaSections = renderParamsSchemaSections(entry, dataHelpFormat);
11397
+ (_sections = sections).push.apply(_sections, _to_consumable_array$P(schemaSections));
11398
+ var resultSection = buildResultSection(entry);
11399
+ if (resultSection) {
11400
+ sections.push(resultSection);
11401
+ } else if (entry.resultTypeName) {
11402
+ sections.push("Result: ".concat(entry.resultTypeName));
11403
+ }
11404
+ return {
11405
+ sections: sections,
11406
+ schemaCount: schemaSections.length
11407
+ };
11408
+ }
11409
+ /**
11410
+ * Builds the trailing `--help` hint lines: how to switch the schema format,
11411
+ * and (in `both` mode, when there is something to focus on) how to narrow the
11412
+ * help to a single section.
11413
+ *
11414
+ * @param input - The entry, help mode, schema format, params visibility, and schema-section count.
11415
+ * @returns The hint lines (possibly empty).
11416
+ */ function collectHelpHints(input) {
11417
+ var entry = input.entry, helpMode = input.helpMode, dataHelpFormat = input.dataHelpFormat, showParams = input.showParams, schemaCount = input.schemaCount;
11418
+ var hints = [];
11419
+ if (showParams && schemaCount > 0 && dataHelpFormat !== 'both') {
11300
11420
  var other = dataHelpFormat === 'jsonschema' ? 'arktype' : 'jsonschema';
11301
- sections.push("(Pass --data-help=".concat(other, " or --data-help=both to switch the schema format above.)"));
11421
+ hints.push("(Pass --data-help=".concat(other, " or --data-help=both to switch the schema format above.)"));
11302
11422
  }
11303
11423
  if (helpMode === 'both' && (entry.description || entry.paramsTypeDescription || entry.paramsFields && entry.paramsFields.length > 0)) {
11304
- sections.push("(Pass --help-mode=action or --help-mode=params to focus this help on a single section.)");
11424
+ hints.push("(Pass --help-mode=action or --help-mode=params to focus this help on a single section.)");
11305
11425
  }
11306
- return sections.length > 0 ? sections.join('\n\n') : undefined;
11426
+ return hints;
11307
11427
  }
11308
11428
  function buildActionSection(entry) {
11309
11429
  return entry.description ? "About:\n".concat(indentLines(entry.description, ' ')) : undefined;
@@ -11319,31 +11439,8 @@ function buildParamsSection(entry) {
11319
11439
  lines.push(indentLines(entry.paramsTypeDescription, ' '));
11320
11440
  }
11321
11441
  if (entry.paramsFields && entry.paramsFields.length > 0) {
11322
- lines.push('', 'Fields:');
11323
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
11324
- try {
11325
- for(var _iterator = entry.paramsFields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
11326
- var field = _step.value;
11327
- var header = " - ".concat(field.name, ": ").concat(field.typeText);
11328
- lines.push(header);
11329
- if (field.description) {
11330
- lines.push(indentLines(field.description, ' '));
11331
- }
11332
- }
11333
- } catch (err) {
11334
- _didIteratorError = true;
11335
- _iteratorError = err;
11336
- } finally{
11337
- try {
11338
- if (!_iteratorNormalCompletion && _iterator.return != null) {
11339
- _iterator.return();
11340
- }
11341
- } finally{
11342
- if (_didIteratorError) {
11343
- throw _iteratorError;
11344
- }
11345
- }
11346
- }
11442
+ var _lines;
11443
+ (_lines = lines).push.apply(_lines, _to_consumable_array$P(buildFieldLines(entry.paramsFields)));
11347
11444
  }
11348
11445
  result = lines.join('\n');
11349
11446
  }
@@ -11360,36 +11457,49 @@ function buildResultSection(entry) {
11360
11457
  lines.push(indentLines(entry.resultTypeDescription, ' '));
11361
11458
  }
11362
11459
  if (entry.resultFields && entry.resultFields.length > 0) {
11363
- lines.push('', 'Fields:');
11364
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
11365
- try {
11366
- for(var _iterator = entry.resultFields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
11367
- var field = _step.value;
11368
- var header = " - ".concat(field.name, ": ").concat(field.typeText);
11369
- lines.push(header);
11370
- if (field.description) {
11371
- lines.push(indentLines(field.description, ' '));
11372
- }
11373
- }
11374
- } catch (err) {
11375
- _didIteratorError = true;
11376
- _iteratorError = err;
11377
- } finally{
11378
- try {
11379
- if (!_iteratorNormalCompletion && _iterator.return != null) {
11380
- _iterator.return();
11381
- }
11382
- } finally{
11383
- if (_didIteratorError) {
11384
- throw _iteratorError;
11385
- }
11386
- }
11387
- }
11460
+ var _lines;
11461
+ (_lines = lines).push.apply(_lines, _to_consumable_array$P(buildFieldLines(entry.resultFields)));
11388
11462
  }
11389
11463
  result = lines.join('\n');
11390
11464
  }
11391
11465
  return result;
11392
11466
  }
11467
+ /**
11468
+ * Renders the `Fields:` block shared by the params and result help sections —
11469
+ * one `- name: type` header per field, with its indented description below.
11470
+ *
11471
+ * @param fields - The manifest fields to render.
11472
+ * @returns The lines for the fields block, beginning with a blank line and the `Fields:` header.
11473
+ */ function buildFieldLines(fields) {
11474
+ var lines = [
11475
+ '',
11476
+ 'Fields:'
11477
+ ];
11478
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
11479
+ try {
11480
+ for(var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
11481
+ var field = _step.value;
11482
+ lines.push(" - ".concat(field.name, ": ").concat(field.typeText));
11483
+ if (field.description) {
11484
+ lines.push(indentLines(field.description, ' '));
11485
+ }
11486
+ }
11487
+ } catch (err) {
11488
+ _didIteratorError = true;
11489
+ _iteratorError = err;
11490
+ } finally{
11491
+ try {
11492
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
11493
+ _iterator.return();
11494
+ }
11495
+ } finally{
11496
+ if (_didIteratorError) {
11497
+ throw _iteratorError;
11498
+ }
11499
+ }
11500
+ }
11501
+ return lines;
11502
+ }
11393
11503
  function indentLines(text, indent) {
11394
11504
  return text.split('\n').map(function(line) {
11395
11505
  return "".concat(indent).concat(line);
@@ -11398,25 +11508,38 @@ function indentLines(text, indent) {
11398
11508
  function renderParamsSchemaSections(entry, dataHelpFormat) {
11399
11509
  var sections = [];
11400
11510
  if (entry.paramsValidator) {
11401
- if (dataHelpFormat === 'jsonschema' || dataHelpFormat === 'both') {
11402
- var jsonSchemaSection = renderJsonSchemaSection(entry);
11403
- if (jsonSchemaSection) {
11404
- sections.push(jsonSchemaSection);
11405
- }
11511
+ sections = collectSchemaSections(entry, dataHelpFormat);
11512
+ }
11513
+ return sections;
11514
+ }
11515
+ /**
11516
+ * Renders the requested params-schema sections (JSON Schema and/or arktype),
11517
+ * with a last-ditch arktype-expression fallback when the requested format
11518
+ * produced nothing usable. Assumes the entry has a bound params validator.
11519
+ *
11520
+ * @param entry - The manifest entry whose params validator is rendered.
11521
+ * @param dataHelpFormat - The requested schema render format.
11522
+ * @returns The rendered schema sections (possibly empty).
11523
+ */ function collectSchemaSections(entry, dataHelpFormat) {
11524
+ var sections = [];
11525
+ if (dataHelpFormat === 'jsonschema' || dataHelpFormat === 'both') {
11526
+ var jsonSchemaSection = renderJsonSchemaSection(entry);
11527
+ if (jsonSchemaSection) {
11528
+ sections.push(jsonSchemaSection);
11406
11529
  }
11407
- if (dataHelpFormat === 'arktype' || dataHelpFormat === 'both') {
11408
- var arktypeSection = renderArktypeExpressionSection(entry);
11409
- if (arktypeSection) {
11410
- sections.push(arktypeSection);
11411
- }
11530
+ }
11531
+ if (dataHelpFormat === 'arktype' || dataHelpFormat === 'both') {
11532
+ var arktypeSection = renderArktypeExpressionSection(entry);
11533
+ if (arktypeSection) {
11534
+ sections.push(arktypeSection);
11412
11535
  }
11413
- if (sections.length === 0) {
11414
- // Last-ditch fallback when the requested format produced nothing usable
11415
- // (e.g. arktype was requested but the bound validator has no expression).
11416
- var expression = readArktypeExpression(entry);
11417
- if (expression) {
11418
- sections.push("Params Schema (arktype): ".concat(expression));
11419
- }
11536
+ }
11537
+ if (sections.length === 0) {
11538
+ // Last-ditch fallback when the requested format produced nothing usable
11539
+ // (e.g. arktype was requested but the bound validator has no expression).
11540
+ var expression = readArktypeExpression(entry);
11541
+ if (expression) {
11542
+ sections.push("Params Schema (arktype): ".concat(expression));
11420
11543
  }
11421
11544
  }
11422
11545
  return sections;
@@ -19790,28 +19913,50 @@ function buildModelEntry(args) {
19790
19913
  sourceFile: input.sourceFile,
19791
19914
  fields: fields,
19792
19915
  enums: relevantEnums.map(function(e) {
19793
- return _object_spread$u({
19794
- name: e.name,
19795
- values: e.values.map(function(v) {
19796
- return v.description ? {
19797
- name: v.name,
19798
- value: v.value,
19799
- description: v.description
19800
- } : {
19801
- name: v.name,
19802
- value: v.value
19803
- };
19804
- })
19805
- }, e.description ? {
19806
- description: e.description
19807
- } : {});
19916
+ return buildModelEnumEntry(e);
19808
19917
  }),
19809
19918
  detectionHints: detectionHints
19810
19919
  }), groupName ? {
19811
19920
  modelGroup: groupName
19812
19921
  } : {}, collectionKind ? {
19813
19922
  collectionKind: collectionKind
19814
- } : {}, markers.userKeyedById ? {
19923
+ } : {}, buildModelMarkerFlags(markers), buildModelArchetypeFields(archetypeInfo), compositeKey ? {
19924
+ compositeKey: compositeKey
19925
+ } : {}, iface.tags.dbxModelRead ? {
19926
+ read: iface.tags.dbxModelRead
19927
+ } : {});
19928
+ }
19929
+ /**
19930
+ * Projects one extracted enum into the manifest enum shape, omitting empty
19931
+ * value/enum descriptions.
19932
+ *
19933
+ * @param e - The extracted enum.
19934
+ * @returns The manifest enum entry.
19935
+ */ function buildModelEnumEntry(e) {
19936
+ return _object_spread$u({
19937
+ name: e.name,
19938
+ values: e.values.map(function(v) {
19939
+ return v.description ? {
19940
+ name: v.name,
19941
+ value: v.value,
19942
+ description: v.description
19943
+ } : {
19944
+ name: v.name,
19945
+ value: v.value
19946
+ };
19947
+ })
19948
+ }, e.description ? {
19949
+ description: e.description
19950
+ } : {});
19951
+ }
19952
+ /**
19953
+ * Builds the optional keyed-by/aggregation marker flags portion of a model
19954
+ * entry, including each flag only when set.
19955
+ *
19956
+ * @param markers - The computed marker flags.
19957
+ * @returns A partial model entry with only the active marker fields.
19958
+ */ function buildModelMarkerFlags(markers) {
19959
+ return _object_spread$u({}, markers.userKeyedById ? {
19815
19960
  userKeyedById: true
19816
19961
  } : {}, markers.hasUserUidField ? {
19817
19962
  hasUserUidField: true
@@ -19827,14 +19972,19 @@ function buildModelEntry(args) {
19827
19972
  organizationalGroupRoot: true
19828
19973
  } : {}, markers.aggregatesFromNonEmpty ? {
19829
19974
  aggregatesFrom: markers.aggregatesFrom
19830
- } : {}, archetypeInfo.archetypes.length > 0 ? {
19975
+ } : {});
19976
+ }
19977
+ /**
19978
+ * Builds the optional archetype portion of a model entry, including the
19979
+ * archetype list and per-slug axes only when present.
19980
+ *
19981
+ * @param archetypeInfo - The computed archetype info.
19982
+ * @returns A partial model entry with only the present archetype fields.
19983
+ */ function buildModelArchetypeFields(archetypeInfo) {
19984
+ return _object_spread$u({}, archetypeInfo.archetypes.length > 0 ? {
19831
19985
  archetypes: archetypeInfo.archetypes
19832
19986
  } : {}, archetypeInfo.archetypeAxesBySlug ? {
19833
19987
  archetypeAxesBySlug: archetypeInfo.archetypeAxesBySlug
19834
- } : {}, compositeKey ? {
19835
- compositeKey: compositeKey
19836
- } : {}, iface.tags.dbxModelRead ? {
19837
- read: iface.tags.dbxModelRead
19838
19988
  } : {});
19839
19989
  }
19840
19990
  function filterRelevantEnums(fields, enums) {
@@ -20884,25 +21034,8 @@ var COMPOSITE_KEY_MODEL_NAME_RE = /^[A-Za-z][A-Za-z0-9_$]*$/;
20884
21034
  var key = token.slice(0, eq).trim();
20885
21035
  var v = token.slice(eq + 1).trim();
20886
21036
  if (key === 'from') {
20887
- if (v === '*') {
20888
- fromValue = '*';
20889
- } else if (v.length > 0) {
20890
- // Tolerate the wildcard mixed with concrete entries here; the
20891
- // validator emits MODEL_COMPOSITE_KEY_WILDCARD_MIXED when it sees both.
20892
- var parts = v.split(',').map(function(p) {
20893
- return p.trim();
20894
- }).filter(function(p) {
20895
- return p.length > 0;
20896
- });
20897
- if (parts.includes('*')) {
20898
- // Preserve the literal list so the validator can flag the mix.
20899
- fromValue = parts;
20900
- } else {
20901
- fromValue = parts.filter(function(p) {
20902
- return COMPOSITE_KEY_MODEL_NAME_RE.test(p);
20903
- });
20904
- }
20905
- }
21037
+ var parsedFrom = parseCompositeKeyFromValue(v);
21038
+ if (parsedFrom !== undefined) fromValue = parsedFrom;
20906
21039
  } else if (key === 'encoding' && (v === 'two-way' || v === 'one-way')) encoding = v;
20907
21040
  }
20908
21041
  } catch (err) {
@@ -20924,6 +21057,32 @@ var COMPOSITE_KEY_MODEL_NAME_RE = /^[A-Za-z][A-Za-z0-9_$]*$/;
20924
21057
  encoding: encoding
20925
21058
  };
20926
21059
  }
21060
+ /**
21061
+ * Parses the `from=` value of a `@dbxModelCompositeKey` tag into the wildcard
21062
+ * `'*'` or a concrete model-name list. Returns `undefined` for an empty value
21063
+ * so the caller leaves any previously-parsed `from` untouched.
21064
+ *
21065
+ * @param v - The raw text after `from=`.
21066
+ * @returns `'*'`, the parsed model-name list, or `undefined` when the value is empty.
21067
+ */ function parseCompositeKeyFromValue(v) {
21068
+ var result;
21069
+ if (v === '*') {
21070
+ result = '*';
21071
+ } else if (v.length > 0) {
21072
+ // Tolerate the wildcard mixed with concrete entries here; the validator
21073
+ // emits MODEL_COMPOSITE_KEY_WILDCARD_MIXED when it sees both.
21074
+ var parts = v.split(',').map(function(p) {
21075
+ return p.trim();
21076
+ }).filter(function(p) {
21077
+ return p.length > 0;
21078
+ });
21079
+ // Preserve the literal list (incl. `*`) so the validator can flag the mix.
21080
+ result = parts.includes('*') ? parts : parts.filter(function(p) {
21081
+ return COMPOSITE_KEY_MODEL_NAME_RE.test(p);
21082
+ });
21083
+ }
21084
+ return result;
21085
+ }
20927
21086
  function takeFirstTagText(current, tag) {
20928
21087
  var _tag_getCommentText;
20929
21088
  if (current !== undefined) return current;
@@ -30965,14 +31124,7 @@ var EMPTY_ROLE_CONST_RESOLUTION = {
30965
31124
  */ function resolveRoleConstByName(name, ctx) {
30966
31125
  var result;
30967
31126
  var scalar = ctx.knownRoles.get(name);
30968
- if (scalar !== undefined) {
30969
- result = {
30970
- roles: [
30971
- scalar
30972
- ],
30973
- unresolved: []
30974
- };
30975
- } else {
31127
+ if (scalar === undefined) {
30976
31128
  var arrayExpr = ctx.localArrayRoles.get(name);
30977
31129
  if (arrayExpr === undefined) {
30978
31130
  result = {
@@ -30990,6 +31142,13 @@ var EMPTY_ROLE_CONST_RESOLUTION = {
30990
31142
  seen: nextSeen
30991
31143
  }));
30992
31144
  }
31145
+ } else {
31146
+ result = {
31147
+ roles: [
31148
+ scalar
31149
+ ],
31150
+ unresolved: []
31151
+ };
30993
31152
  }
30994
31153
  return result;
30995
31154
  }
@@ -42794,7 +42953,7 @@ var DEFAULT_EXCLUDE = [
42794
42953
  * @returns Map keyed by entry slug → reference count + locations.
42795
42954
  */ function scanFactoryReferences(input) {
42796
42955
  return _async_to_generator$z(function() {
42797
- var projectRoot, entries, _input_include, include, _input_exclude, exclude, _input_readFile, readFile, _input_globber, globber, result, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, entry, namesBySlug, declFilePathsBySlug, declFilePaths, filePaths, combinedPattern, sitesBySlug, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, entry1, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, relPath, absolutePath, err, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _step_value, slug, sites, specCount, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, site;
42956
+ var projectRoot, entries, _input_include, include, _input_exclude, exclude, _input_readFile, readFile, _input_globber, globber, result, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, entry, namesBySlug, declFilePathsBySlug, declFilePaths, filePaths, combinedPattern, sitesBySlug, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, slug, sites;
42798
42957
  return _ts_generator$z(this, function(_state) {
42799
42958
  switch(_state.label){
42800
42959
  case 0:
@@ -42827,7 +42986,7 @@ var DEFAULT_EXCLUDE = [
42827
42986
  }
42828
42987
  if (!(entries.length > 0)) return [
42829
42988
  3,
42830
- 10
42989
+ 3
42831
42990
  ];
42832
42991
  namesBySlug = buildNameLookup(entries);
42833
42992
  declFilePathsBySlug = buildDeclFilePathLookup(entries);
@@ -42845,14 +43004,27 @@ var DEFAULT_EXCLUDE = [
42845
43004
  combinedPattern = buildCombinedRegex(Array.from(namesBySlug.values()));
42846
43005
  if (!(combinedPattern !== undefined)) return [
42847
43006
  3,
42848
- 10
43007
+ 3
42849
43008
  ];
42850
- sitesBySlug = new Map();
43009
+ return [
43010
+ 4,
43011
+ collectReferenceSites({
43012
+ entries: entries,
43013
+ filePaths: filePaths,
43014
+ projectRoot: projectRoot,
43015
+ declFilePaths: declFilePaths,
43016
+ readFile: readFile,
43017
+ combinedPattern: combinedPattern,
43018
+ namesBySlug: namesBySlug
43019
+ })
43020
+ ];
43021
+ case 2:
43022
+ sitesBySlug = _state.sent();
42851
43023
  _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
42852
43024
  try {
42853
- for(_iterator1 = entries[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
42854
- entry1 = _step1.value;
42855
- sitesBySlug.set(entry1.slug, []);
43025
+ for(_iterator1 = sitesBySlug[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
43026
+ _step_value = _sliced_to_array$2(_step1.value, 2), slug = _step_value[0], sites = _step_value[1];
43027
+ result.set(slug, tallyReferenceSites(sites));
42856
43028
  }
42857
43029
  } catch (err) {
42858
43030
  _didIteratorError1 = true;
@@ -42868,30 +43040,72 @@ var DEFAULT_EXCLUDE = [
42868
43040
  }
42869
43041
  }
42870
43042
  }
42871
- _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
42872
- _state.label = 2;
42873
- case 2:
42874
- _state.trys.push([
43043
+ _state.label = 3;
43044
+ case 3:
43045
+ return [
42875
43046
  2,
43047
+ result
43048
+ ];
43049
+ }
43050
+ });
43051
+ })();
43052
+ }
43053
+ /**
43054
+ * Seeds an empty site list per entry slug, then scans every non-declaration
43055
+ * file for factory references, accumulating the hits per slug.
43056
+ *
43057
+ * @param input - The entries, globbed file paths, project root, declaration-file guard set, reader, combined pattern, and name lookup.
43058
+ * @returns The reference sites discovered, keyed by entry slug.
43059
+ */ function collectReferenceSites(input) {
43060
+ return _async_to_generator$z(function() {
43061
+ var entries, filePaths, projectRoot, declFilePaths, readFile, combinedPattern, namesBySlug, sitesBySlug, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, entry, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, relPath, absolutePath, err;
43062
+ return _ts_generator$z(this, function(_state) {
43063
+ switch(_state.label){
43064
+ case 0:
43065
+ entries = input.entries, filePaths = input.filePaths, projectRoot = input.projectRoot, declFilePaths = input.declFilePaths, readFile = input.readFile, combinedPattern = input.combinedPattern, namesBySlug = input.namesBySlug;
43066
+ sitesBySlug = new Map();
43067
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
43068
+ try {
43069
+ for(_iterator = entries[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
43070
+ entry = _step.value;
43071
+ sitesBySlug.set(entry.slug, []);
43072
+ }
43073
+ } catch (err) {
43074
+ _didIteratorError = true;
43075
+ _iteratorError = err;
43076
+ } finally{
43077
+ try {
43078
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
43079
+ _iterator.return();
43080
+ }
43081
+ } finally{
43082
+ if (_didIteratorError) {
43083
+ throw _iteratorError;
43084
+ }
43085
+ }
43086
+ }
43087
+ _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
43088
+ _state.label = 1;
43089
+ case 1:
43090
+ _state.trys.push([
43091
+ 1,
43092
+ 6,
42876
43093
  7,
42877
- 8,
42878
- 9
43094
+ 8
42879
43095
  ]);
42880
- _iterator2 = filePaths[Symbol.iterator]();
42881
- _state.label = 3;
42882
- case 3:
42883
- if (!!(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done)) return [
43096
+ _iterator1 = filePaths[Symbol.iterator]();
43097
+ _state.label = 2;
43098
+ case 2:
43099
+ if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)) return [
42884
43100
  3,
42885
- 6
43101
+ 5
42886
43102
  ];
42887
- relPath = _step2.value;
43103
+ relPath = _step1.value;
42888
43104
  absolutePath = node_path.resolve(projectRoot, relPath);
42889
- if (declFilePaths.has(absolutePath)) {
42890
- return [
42891
- 3,
42892
- 5
42893
- ];
42894
- }
43105
+ if (!!declFilePaths.has(absolutePath)) return [
43106
+ 3,
43107
+ 4
43108
+ ];
42895
43109
  return [
42896
43110
  4,
42897
43111
  scanOneFile({
@@ -42903,100 +43117,87 @@ var DEFAULT_EXCLUDE = [
42903
43117
  sitesBySlug: sitesBySlug
42904
43118
  })
42905
43119
  ];
42906
- case 4:
43120
+ case 3:
42907
43121
  _state.sent();
42908
- _state.label = 5;
42909
- case 5:
42910
- _iteratorNormalCompletion2 = true;
43122
+ _state.label = 4;
43123
+ case 4:
43124
+ _iteratorNormalCompletion1 = true;
42911
43125
  return [
42912
43126
  3,
42913
- 3
43127
+ 2
42914
43128
  ];
42915
- case 6:
43129
+ case 5:
42916
43130
  return [
42917
43131
  3,
42918
- 9
43132
+ 8
42919
43133
  ];
42920
- case 7:
43134
+ case 6:
42921
43135
  err = _state.sent();
42922
- _didIteratorError2 = true;
42923
- _iteratorError2 = err;
43136
+ _didIteratorError1 = true;
43137
+ _iteratorError1 = err;
42924
43138
  return [
42925
43139
  3,
42926
- 9
43140
+ 8
42927
43141
  ];
42928
- case 8:
43142
+ case 7:
42929
43143
  try {
42930
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
42931
- _iterator2.return();
43144
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
43145
+ _iterator1.return();
42932
43146
  }
42933
43147
  } finally{
42934
- if (_didIteratorError2) {
42935
- throw _iteratorError2;
43148
+ if (_didIteratorError1) {
43149
+ throw _iteratorError1;
42936
43150
  }
42937
43151
  }
42938
43152
  return [
42939
43153
  7
42940
43154
  ];
42941
- case 9:
42942
- _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
42943
- try {
42944
- for(_iterator3 = sitesBySlug[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
42945
- _step_value = _sliced_to_array$2(_step3.value, 2), slug = _step_value[0], sites = _step_value[1];
42946
- specCount = 0;
42947
- _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
42948
- try {
42949
- for(_iterator4 = sites[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){
42950
- site = _step4.value;
42951
- if (site.isSpec) {
42952
- specCount += 1;
42953
- }
42954
- }
42955
- } catch (err) {
42956
- _didIteratorError4 = true;
42957
- _iteratorError4 = err;
42958
- } finally{
42959
- try {
42960
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
42961
- _iterator4.return();
42962
- }
42963
- } finally{
42964
- if (_didIteratorError4) {
42965
- throw _iteratorError4;
42966
- }
42967
- }
42968
- }
42969
- result.set(slug, {
42970
- count: sites.length,
42971
- productionCount: sites.length - specCount,
42972
- specCount: specCount,
42973
- referencedBy: sites
42974
- });
42975
- }
42976
- } catch (err) {
42977
- _didIteratorError3 = true;
42978
- _iteratorError3 = err;
42979
- } finally{
42980
- try {
42981
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
42982
- _iterator3.return();
42983
- }
42984
- } finally{
42985
- if (_didIteratorError3) {
42986
- throw _iteratorError3;
42987
- }
42988
- }
42989
- }
42990
- _state.label = 10;
42991
- case 10:
43155
+ case 8:
42992
43156
  return [
42993
43157
  2,
42994
- result
43158
+ sitesBySlug
42995
43159
  ];
42996
43160
  }
42997
43161
  });
42998
43162
  })();
42999
43163
  }
43164
+ /**
43165
+ * Tallies one slug's reference sites into a {@link FactoryReferenceCount},
43166
+ * splitting production callers from spec-only callers.
43167
+ *
43168
+ * @param sites - The reference sites found for one factory.
43169
+ * @returns The total/production/spec counts plus the sites themselves.
43170
+ */ function tallyReferenceSites(sites) {
43171
+ var specCount = 0;
43172
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
43173
+ try {
43174
+ for(var _iterator = sites[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
43175
+ var site = _step.value;
43176
+ if (site.isSpec) {
43177
+ specCount += 1;
43178
+ }
43179
+ }
43180
+ } catch (err) {
43181
+ _didIteratorError = true;
43182
+ _iteratorError = err;
43183
+ } finally{
43184
+ try {
43185
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
43186
+ _iterator.return();
43187
+ }
43188
+ } finally{
43189
+ if (_didIteratorError) {
43190
+ throw _iteratorError;
43191
+ }
43192
+ }
43193
+ }
43194
+ return {
43195
+ count: sites.length,
43196
+ productionCount: sites.length - specCount,
43197
+ specCount: specCount,
43198
+ referencedBy: sites
43199
+ };
43200
+ }
43000
43201
  /**
43001
43202
  * Returns true when the supplied workspace-relative subpath looks like a
43002
43203
  * Vitest/Jest spec file. The scanner uses this to tag each
@@ -43151,7 +43352,7 @@ function buildCombinedRegex(names) {
43151
43352
  return result;
43152
43353
  }
43153
43354
  function escapeRegex(value) {
43154
- return value.replace(/[.*+?^${}()|[\]\\]/g, String.raw(_templateObject()));
43355
+ return value.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw(_templateObject()));
43155
43356
  }
43156
43357
  function computeLineOffsets(contents) {
43157
43358
  var offsets = [
@@ -51659,10 +51860,9 @@ function collectExternalCssUtilitySources(configResult) {
51659
51860
  try {
51660
51861
  for(var _iterator = ((_ref = cluster === null || cluster === void 0 ? void 0 : cluster.sources) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
51661
51862
  var source = _step.value;
51662
- var absolute = node_path.isAbsolute(source) ? source : node_path.resolve(baseDir, source);
51663
51863
  externalSources.push({
51664
51864
  origin: 'external',
51665
- path: absolute
51865
+ path: toAbsolutePath$1(baseDir, source)
51666
51866
  });
51667
51867
  }
51668
51868
  } catch (err) {
@@ -51685,10 +51885,9 @@ function collectExternalCssUtilitySources(configResult) {
51685
51885
  var scan = _step1.value;
51686
51886
  var out = scan.out;
51687
51887
  if (typeof out === 'string' && out.length > 0) {
51688
- var absolute1 = node_path.isAbsolute(out) ? out : node_path.resolve(baseDir, out);
51689
51888
  externalSources.push({
51690
51889
  origin: 'external',
51691
- path: absolute1
51890
+ path: toAbsolutePath$1(baseDir, out)
51692
51891
  });
51693
51892
  }
51694
51893
  }
@@ -51709,6 +51908,16 @@ function collectExternalCssUtilitySources(configResult) {
51709
51908
  }
51710
51909
  return externalSources;
51711
51910
  }
51911
+ /**
51912
+ * Resolves `value` against `baseDir` when it is relative, leaving an
51913
+ * already-absolute path untouched (so its original spelling is preserved).
51914
+ *
51915
+ * @param baseDir - Directory a relative `value` is resolved against.
51916
+ * @param value - An absolute or relative path.
51917
+ * @returns The absolute path.
51918
+ */ function toAbsolutePath$1(baseDir, value) {
51919
+ return node_path.isAbsolute(value) ? value : node_path.resolve(baseDir, value);
51920
+ }
51712
51921
  /**
51713
51922
  * Re-exported so callers can build a deterministic test fixture pointing
51714
51923
  * at the package's bundled manifests without touching `import.meta.url`.
@@ -55361,10 +55570,9 @@ function collectExternalTokenSources(configResult) {
55361
55570
  try {
55362
55571
  for(var _iterator = ((_ref = tokensCluster === null || tokensCluster === void 0 ? void 0 : tokensCluster.sources) !== null && _ref !== void 0 ? _ref : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
55363
55572
  var source = _step.value;
55364
- var absolute = node_path.isAbsolute(source) ? source : node_path.resolve(baseDir, source);
55365
55573
  externalSources.push({
55366
55574
  origin: 'external',
55367
- path: absolute
55575
+ path: toAbsolutePath(baseDir, source)
55368
55576
  });
55369
55577
  }
55370
55578
  } catch (err) {
@@ -55387,10 +55595,9 @@ function collectExternalTokenSources(configResult) {
55387
55595
  var scan = _step1.value;
55388
55596
  var out = scan.out;
55389
55597
  if (typeof out === 'string' && out.length > 0) {
55390
- var absolute1 = node_path.isAbsolute(out) ? out : node_path.resolve(baseDir, out);
55391
55598
  externalSources.push({
55392
55599
  origin: 'external',
55393
- path: absolute1
55600
+ path: toAbsolutePath(baseDir, out)
55394
55601
  });
55395
55602
  }
55396
55603
  }
@@ -55411,6 +55618,16 @@ function collectExternalTokenSources(configResult) {
55411
55618
  }
55412
55619
  return externalSources;
55413
55620
  }
55621
+ /**
55622
+ * Resolves `value` against `baseDir` when it is relative, leaving an
55623
+ * already-absolute path untouched (so its original spelling is preserved).
55624
+ *
55625
+ * @param baseDir - Directory a relative `value` is resolved against.
55626
+ * @param value - An absolute or relative path.
55627
+ * @returns The absolute path.
55628
+ */ function toAbsolutePath(baseDir, value) {
55629
+ return node_path.isAbsolute(value) ? value : node_path.resolve(baseDir, value);
55630
+ }
55414
55631
  /**
55415
55632
  * Re-exported so callers can build a deterministic test fixture pointing at
55416
55633
  * the package's bundled manifests without touching `import.meta.url`.
@@ -56934,6 +57151,7 @@ exports.DBX_DOCS_UI_EXAMPLES_SCAN_CONFIG_FILENAME = DBX_DOCS_UI_EXAMPLES_SCAN_CO
56934
57151
  exports.DBX_DOCS_UI_EXAMPLE_USE_KINDS = DBX_DOCS_UI_EXAMPLE_USE_KINDS;
56935
57152
  exports.DEFAULT_ACTIONS_SCAN_OUT_PATH = DEFAULT_ACTIONS_SCAN_OUT_PATH;
56936
57153
  exports.DEFAULT_ACTION_COMMAND_NAME = DEFAULT_ACTION_COMMAND_NAME;
57154
+ exports.DEFAULT_CLI_HTTP_TIMEOUT_MS = DEFAULT_CLI_HTTP_TIMEOUT_MS;
56937
57155
  exports.DEFAULT_CLI_OIDC_SCOPES = DEFAULT_CLI_OIDC_SCOPES;
56938
57156
  exports.DEFAULT_CLI_REDIRECT_URI = DEFAULT_CLI_REDIRECT_URI;
56939
57157
  exports.DEFAULT_CLI_SECRET_PATTERNS = DEFAULT_CLI_SECRET_PATTERNS;