@dereekb/dbx-cli 13.11.3 → 13.11.5

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.esm.js CHANGED
@@ -1,20 +1,21 @@
1
1
  import { existsSync, mkdirSync, writeFileSync, appendFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  export { CALL_MODEL_APP_FUNCTION_KEY } from '@dereekb/firebase';
4
- import { expirationDetails, generatePkceCodeVerifier, generatePkceCodeChallenge, noop } from '@dereekb/util';
4
+ import { expirationDetails, generatePkceCodeVerifier, generatePkceCodeChallenge, noop, MS_IN_SECOND } from '@dereekb/util';
5
+ import { durationDataToMilliseconds, parseDurationString } from '@dereekb/date';
5
6
  import { readJsonFile, writeJsonFile, createMemoizedJsonFileAsyncKeyedValueCache } from '@dereekb/nestjs';
6
7
  import { homedir } from 'node:os';
7
8
  import { createInterface } from 'node:readline';
8
9
  import yargs from 'yargs';
9
10
  import { hideBin } from 'yargs/helpers';
10
11
 
11
- function _array_like_to_array$5(arr, len) {
12
+ function _array_like_to_array$7(arr, len) {
12
13
  if (len == null || len > arr.length) len = arr.length;
13
14
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
14
15
  return arr2;
15
16
  }
16
- function _array_without_holes$3(arr) {
17
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
17
+ function _array_without_holes$4(arr) {
18
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
18
19
  }
19
20
  function _assert_this_initialized(self) {
20
21
  if (self === void 0) {
@@ -80,7 +81,7 @@ function _inherits(subClass, superClass) {
80
81
  });
81
82
  if (superClass) _set_prototype_of(subClass, superClass);
82
83
  }
83
- function _instanceof$5(left, right) {
84
+ function _instanceof$6(left, right) {
84
85
  "@swc/helpers - instanceof";
85
86
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
86
87
  return !!right[Symbol.hasInstance](left);
@@ -91,10 +92,10 @@ function _instanceof$5(left, right) {
91
92
  function _is_native_function(fn) {
92
93
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
93
94
  }
94
- function _iterable_to_array$3(iter) {
95
+ function _iterable_to_array$4(iter) {
95
96
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
96
97
  }
97
- function _non_iterable_spread$3() {
98
+ function _non_iterable_spread$4() {
98
99
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
99
100
  }
100
101
  function _object_spread$c(target) {
@@ -113,7 +114,7 @@ function _object_spread$c(target) {
113
114
  return target;
114
115
  }
115
116
  function _possible_constructor_return(self, call) {
116
- if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
117
+ if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
117
118
  return call;
118
119
  }
119
120
  return _assert_this_initialized(self);
@@ -125,20 +126,20 @@ function _set_prototype_of(o, p) {
125
126
  };
126
127
  return _set_prototype_of(o, p);
127
128
  }
128
- function _to_consumable_array$3(arr) {
129
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
129
+ function _to_consumable_array$4(arr) {
130
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$4();
130
131
  }
131
- function _type_of$2(obj) {
132
+ function _type_of$3(obj) {
132
133
  "@swc/helpers - typeof";
133
134
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
134
135
  }
135
- function _unsupported_iterable_to_array$5(o, minLen) {
136
+ function _unsupported_iterable_to_array$7(o, minLen) {
136
137
  if (!o) return;
137
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
138
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
138
139
  var n = Object.prototype.toString.call(o).slice(8, -1);
139
140
  if (n === "Object" && o.constructor) n = o.constructor.name;
140
141
  if (n === "Map" || n === "Set") return Array.from(n);
141
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
142
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
142
143
  }
143
144
  function _wrap_native_super(Class) {
144
145
  var _cache = typeof Map === "function" ? new Map() : undefined;
@@ -187,7 +188,7 @@ function _is_native_reflect_construct() {
187
188
  /id_token[=:]\s*\S+/gi
188
189
  ];
189
190
  var _outputOptions = {};
190
- var _secretPatterns = _to_consumable_array$3(DEFAULT_CLI_SECRET_PATTERNS);
191
+ var _secretPatterns = _to_consumable_array$4(DEFAULT_CLI_SECRET_PATTERNS);
191
192
  var _errorMapper;
192
193
  /**
193
194
  * Configures output options from parsed CLI arguments.
@@ -316,13 +317,13 @@ function dumpResponse(data, meta) {
316
317
  return pickFromObject(item, fields);
317
318
  });
318
319
  }
319
- if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$2(data)) === 'object') {
320
+ if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$3(data)) === 'object') {
320
321
  return pickFromObject(data, fields);
321
322
  }
322
323
  return data;
323
324
  }
324
325
  function pickFromObject(obj, fields) {
325
- if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$2(obj)) !== 'object') {
326
+ if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$3(obj)) !== 'object') {
326
327
  return obj;
327
328
  }
328
329
  var result = {};
@@ -417,7 +418,7 @@ function pickFromObject(obj, fields) {
417
418
  return mapped;
418
419
  }
419
420
  }
420
- if (_instanceof$5(error, CliError)) {
421
+ if (_instanceof$6(error, CliError)) {
421
422
  return _object_spread$c({
422
423
  ok: false,
423
424
  error: sanitizeString(error.message),
@@ -426,7 +427,7 @@ function pickFromObject(obj, fields) {
426
427
  suggestion: error.suggestion
427
428
  } : {});
428
429
  }
429
- if (_instanceof$5(error, Error)) {
430
+ if (_instanceof$6(error, Error)) {
430
431
  return {
431
432
  ok: false,
432
433
  error: sanitizeString(error.message),
@@ -469,7 +470,7 @@ function _async_to_generator$f(fn) {
469
470
  });
470
471
  };
471
472
  }
472
- function _type_of$1(obj) {
473
+ function _type_of$2(obj) {
473
474
  "@swc/helpers - typeof";
474
475
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
475
476
  }
@@ -623,7 +624,7 @@ var CALL_MODEL_API_PATH = "/model/call";
623
624
  }
624
625
  }
625
626
  if (!res.ok) {
626
- bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$1(body)) === 'object' && body && 'message' in body ? body.message : undefined;
627
+ bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$2(body)) === 'object' && body && 'message' in body ? body.message : undefined;
627
628
  messageString = typeof bodyMessage === 'string' ? bodyMessage : undefined;
628
629
  message = messageString !== null && messageString !== void 0 ? messageString : text || "".concat(res.status, " ").concat(res.statusText);
629
630
  throw new CliError({
@@ -1130,7 +1131,7 @@ function _define_property$a(obj, key, value) {
1130
1131
  }
1131
1132
  return obj;
1132
1133
  }
1133
- function _instanceof$4(left, right) {
1134
+ function _instanceof$5(left, right) {
1134
1135
  "@swc/helpers - instanceof";
1135
1136
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1136
1137
  return !!right[Symbol.hasInstance](left);
@@ -1301,7 +1302,7 @@ function _ts_generator$d(thisArg, body) {
1301
1302
  data = JSON.parse(argv.data);
1302
1303
  } catch (e) {
1303
1304
  throw new CliError({
1304
- message: "--data must be valid JSON: ".concat(_instanceof$4(e, Error) ? e.message : String(e)),
1305
+ message: "--data must be valid JSON: ".concat(_instanceof$5(e, Error) ? e.message : String(e)),
1305
1306
  code: 'INVALID_DATA_JSON'
1306
1307
  });
1307
1308
  }
@@ -1343,6 +1344,201 @@ function _ts_generator$d(thisArg, body) {
1343
1344
  }
1344
1345
  };
1345
1346
 
1347
+ function _array_like_to_array$6(arr, len) {
1348
+ if (len == null || len > arr.length) len = arr.length;
1349
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1350
+ return arr2;
1351
+ }
1352
+ function _array_with_holes$3(arr) {
1353
+ if (Array.isArray(arr)) return arr;
1354
+ }
1355
+ function _instanceof$4(left, right) {
1356
+ "@swc/helpers - instanceof";
1357
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1358
+ return !!right[Symbol.hasInstance](left);
1359
+ } else {
1360
+ return left instanceof right;
1361
+ }
1362
+ }
1363
+ function _iterable_to_array_limit$3(arr, i) {
1364
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1365
+ if (_i == null) return;
1366
+ var _arr = [];
1367
+ var _n = true;
1368
+ var _d = false;
1369
+ var _s, _e;
1370
+ try {
1371
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1372
+ _arr.push(_s.value);
1373
+ if (i && _arr.length === i) break;
1374
+ }
1375
+ } catch (err) {
1376
+ _d = true;
1377
+ _e = err;
1378
+ } finally{
1379
+ try {
1380
+ if (!_n && _i["return"] != null) _i["return"]();
1381
+ } finally{
1382
+ if (_d) throw _e;
1383
+ }
1384
+ }
1385
+ return _arr;
1386
+ }
1387
+ function _non_iterable_rest$3() {
1388
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1389
+ }
1390
+ function _sliced_to_array$3(arr, i) {
1391
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$3();
1392
+ }
1393
+ function _type_of$1(obj) {
1394
+ "@swc/helpers - typeof";
1395
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1396
+ }
1397
+ function _unsupported_iterable_to_array$6(o, minLen) {
1398
+ if (!o) return;
1399
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
1400
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1401
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1402
+ if (n === "Map" || n === "Set") return Array.from(n);
1403
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
1404
+ }
1405
+ /**
1406
+ * Resolves the manifest entry for `modelType`. Lookup tries
1407
+ * `modelType` first, then falls back to `identityConst` and `collectionPrefix`
1408
+ * so callers can pass any of the three forms a user might type at the CLI.
1409
+ *
1410
+ * @param modelType - identifier to look up.
1411
+ * @param manifest - generated model manifest.
1412
+ * @returns the matching entry, or `undefined` when none exists.
1413
+ * @__NO_SIDE_EFFECTS__
1414
+ */ function findCliModelManifestEntry(modelType, manifest) {
1415
+ var result;
1416
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1417
+ try {
1418
+ for(var _iterator = manifest[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1419
+ var entry = _step.value;
1420
+ if (entry.modelType === modelType || entry.identityConst === modelType || entry.collectionPrefix === modelType) {
1421
+ result = entry;
1422
+ break;
1423
+ }
1424
+ }
1425
+ } catch (err) {
1426
+ _didIteratorError = true;
1427
+ _iteratorError = err;
1428
+ } finally{
1429
+ try {
1430
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1431
+ _iterator.return();
1432
+ }
1433
+ } finally{
1434
+ if (_didIteratorError) {
1435
+ throw _iteratorError;
1436
+ }
1437
+ }
1438
+ }
1439
+ return result;
1440
+ }
1441
+ /**
1442
+ * Rewrites the persisted (short) keys in `data` to the long-name form
1443
+ * declared in the model's manifest entry. Recurses into nested object-array
1444
+ * and sub-object fields when the manifest captured a nested field map.
1445
+ *
1446
+ * Returns the input untouched when `modelType` is not in the manifest, when
1447
+ * the model has no fields, or when the input is not a plain object/array.
1448
+ * Unknown keys, primitives, `Date`, `null`, and `undefined` pass through
1449
+ * unchanged.
1450
+ *
1451
+ * @param modelType - the model identifier (`modelType`, `identityConst`,
1452
+ * or `collectionPrefix`) used to look up the rewrite map.
1453
+ * @param data - the value to rewrite (typically a `read`/`query` response
1454
+ * payload).
1455
+ * @param manifest - generated model manifest.
1456
+ * @returns the rewritten value, or `data` unchanged when no rewrite applies.
1457
+ * @__NO_SIDE_EFFECTS__
1458
+ */ function expandModelKeys(modelType, data, manifest) {
1459
+ var entry = findCliModelManifestEntry(modelType, manifest);
1460
+ if (!entry) return data;
1461
+ return rewriteWithFields(data, entry.fields);
1462
+ }
1463
+ function rewriteWithFields(value, fields) {
1464
+ if (Array.isArray(value)) {
1465
+ return value.map(function(item) {
1466
+ return rewriteWithFields(item, fields);
1467
+ });
1468
+ }
1469
+ if (!isPlainObject(value)) return value;
1470
+ var fieldByName = new Map();
1471
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1472
+ try {
1473
+ for(var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1474
+ var field = _step.value;
1475
+ fieldByName.set(field.name, field);
1476
+ }
1477
+ } catch (err) {
1478
+ _didIteratorError = true;
1479
+ _iteratorError = err;
1480
+ } finally{
1481
+ try {
1482
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1483
+ _iterator.return();
1484
+ }
1485
+ } finally{
1486
+ if (_didIteratorError) {
1487
+ throw _iteratorError;
1488
+ }
1489
+ }
1490
+ }
1491
+ var out = {};
1492
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1493
+ try {
1494
+ for(var _iterator1 = Object.entries(value)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1495
+ var _step_value = _sliced_to_array$3(_step1.value, 2), key = _step_value[0], raw = _step_value[1];
1496
+ var field1 = fieldByName.get(key);
1497
+ if (!field1) {
1498
+ out[key] = raw;
1499
+ continue;
1500
+ }
1501
+ var longKey = field1.longName.length > 0 ? field1.longName : key;
1502
+ out[longKey] = rewriteFieldValue(raw, field1);
1503
+ }
1504
+ } catch (err) {
1505
+ _didIteratorError1 = true;
1506
+ _iteratorError1 = err;
1507
+ } finally{
1508
+ try {
1509
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1510
+ _iterator1.return();
1511
+ }
1512
+ } finally{
1513
+ if (_didIteratorError1) {
1514
+ throw _iteratorError1;
1515
+ }
1516
+ }
1517
+ }
1518
+ return out;
1519
+ }
1520
+ function rewriteFieldValue(value, field) {
1521
+ var nested = field.nestedFields;
1522
+ if (!nested || nested.length === 0) return value;
1523
+ if (field.nestedIsArray) {
1524
+ if (!Array.isArray(value)) return value;
1525
+ return value.map(function(item) {
1526
+ return rewriteWithFields(item, nested);
1527
+ });
1528
+ }
1529
+ if (!isPlainObject(value)) return value;
1530
+ return rewriteWithFields(value, nested);
1531
+ }
1532
+ function isPlainObject(value) {
1533
+ if (value === null || (typeof value === "undefined" ? "undefined" : _type_of$1(value)) !== 'object') return false;
1534
+ if (Array.isArray(value)) return false;
1535
+ if (_instanceof$4(value, Date)) return false;
1536
+ // Objects from JSON.parse have Object.prototype as their proto. Anything
1537
+ // exotic (Map, Set, Buffer, class instances) we leave untouched.
1538
+ var proto = Object.getPrototypeOf(value);
1539
+ return proto === Object.prototype || proto === null;
1540
+ }
1541
+
1346
1542
  function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
1347
1543
  try {
1348
1544
  var info = gen[key](arg);
@@ -2348,7 +2544,7 @@ function trimSlash(url) {
2348
2544
  return url.endsWith('/') ? url.slice(0, -1) : url;
2349
2545
  }
2350
2546
 
2351
- function _array_like_to_array$4(arr, len) {
2547
+ function _array_like_to_array$5(arr, len) {
2352
2548
  if (len == null || len > arr.length) len = arr.length;
2353
2549
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2354
2550
  return arr2;
@@ -2413,15 +2609,15 @@ function _non_iterable_rest$2() {
2413
2609
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2414
2610
  }
2415
2611
  function _sliced_to_array$2(arr, i) {
2416
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$2();
2612
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
2417
2613
  }
2418
- function _unsupported_iterable_to_array$4(o, minLen) {
2614
+ function _unsupported_iterable_to_array$5(o, minLen) {
2419
2615
  if (!o) return;
2420
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
2616
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
2421
2617
  var n = Object.prototype.toString.call(o).slice(8, -1);
2422
2618
  if (n === "Object" && o.constructor) n = o.constructor.name;
2423
2619
  if (n === "Map" || n === "Set") return Array.from(n);
2424
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
2620
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
2425
2621
  }
2426
2622
  function _ts_generator$a(thisArg, body) {
2427
2623
  var f, y, t, _ = {
@@ -2551,6 +2747,15 @@ function _ts_generator$a(thisArg, body) {
2551
2747
  code_challenge_method: 'S256',
2552
2748
  state: input.state
2553
2749
  };
2750
+ if (input.requestedSessionTtlSeconds != null) {
2751
+ if (!Number.isInteger(input.requestedSessionTtlSeconds) || input.requestedSessionTtlSeconds <= 0) {
2752
+ throw new CliError({
2753
+ message: "requestedSessionTtlSeconds must be a positive integer (got ".concat(input.requestedSessionTtlSeconds, ")."),
2754
+ code: 'AUTH_LOGIN_FOR_INVALID'
2755
+ });
2756
+ }
2757
+ authParams.dbx_session_ttl = String(input.requestedSessionTtlSeconds);
2758
+ }
2554
2759
  var endpoint;
2555
2760
  if (input.appClientUrl) {
2556
2761
  endpoint = rebaseUrlOrigin({
@@ -3330,11 +3535,14 @@ function maskEnv$1(env) {
3330
3535
  type: 'boolean',
3331
3536
  default: false,
3332
3537
  describe: 'Drop model.create/model.update/model.delete from the requested scopes (keeps model.read and model.query)'
3538
+ }).option('login-for', {
3539
+ type: 'string',
3540
+ describe: 'Requested login duration with a unit (e.g. 30d, 12h, 3600s). Mixed units are allowed (e.g. "1h30m", "2d 12h"). Subject to server/client caps. Applied to Session, Grant, and RefreshToken.'
3333
3541
  });
3334
3542
  },
3335
3543
  handler: function handler(argv) {
3336
3544
  return _async_to_generator$9(function() {
3337
- var _argv_code, _tokenResponse_expires_in, _ref, envName, env, meta, _ref1, codeVerifier, codeChallenge, state, requestedScopes, url, pasted, _tmp, code, tokenResponse, expiresAt, entry, e;
3545
+ var _argv_code, _tokenResponse_expires_in, _ref, envName, env, meta, _ref1, codeVerifier, codeChallenge, state, requestedScopes, requestedSessionTtlSeconds, ms, url, pasted, _tmp, code, tokenResponse, expiresAt, entry, e;
3338
3546
  return _ts_generator$9(this, function(_state) {
3339
3547
  switch(_state.label){
3340
3548
  case 0:
@@ -3379,6 +3587,16 @@ function maskEnv$1(env) {
3379
3587
  _ref1 = _state.sent(), codeVerifier = _ref1.codeVerifier, codeChallenge = _ref1.codeChallenge;
3380
3588
  state = generateOAuthState();
3381
3589
  requestedScopes = argv.readOnlyScopes ? filterReadOnlyModelScopes(env.scopes) : env.scopes;
3590
+ if (argv.loginFor) {
3591
+ ms = durationDataToMilliseconds(parseDurationString(argv.loginFor));
3592
+ if (ms <= 0) {
3593
+ throw new CliError({
3594
+ message: '--login-for: invalid duration "'.concat(argv.loginFor, '". Use formats like "30d", "12h", "3600s", or mixed units like "1h30m" or "2d 12h".'),
3595
+ code: 'AUTH_LOGIN_FOR_INVALID'
3596
+ });
3597
+ }
3598
+ requestedSessionTtlSeconds = Math.floor(ms / MS_IN_SECOND);
3599
+ }
3382
3600
  url = buildAuthorizationUrl({
3383
3601
  authorizationEndpoint: meta.authorization_endpoint,
3384
3602
  apiBaseUrl: env.apiBaseUrl,
@@ -3387,7 +3605,8 @@ function maskEnv$1(env) {
3387
3605
  redirectUri: env.redirectUri,
3388
3606
  scopes: requestedScopes,
3389
3607
  state: state,
3390
- codeChallenge: codeChallenge
3608
+ codeChallenge: codeChallenge,
3609
+ requestedSessionTtlSeconds: requestedSessionTtlSeconds
3391
3610
  });
3392
3611
  // The CLI never opens a browser itself — it prints the URL and reads the redirect back.
3393
3612
  // Emit the URL through a clearly-prefixed stderr line so JSON stdout stays parseable.
@@ -3894,13 +4113,13 @@ function maskEnv$1(env) {
3894
4113
  };
3895
4114
  }
3896
4115
 
3897
- function _array_like_to_array$3(arr, len) {
4116
+ function _array_like_to_array$4(arr, len) {
3898
4117
  if (len == null || len > arr.length) len = arr.length;
3899
4118
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3900
4119
  return arr2;
3901
4120
  }
3902
- function _array_without_holes$2(arr) {
3903
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
4121
+ function _array_without_holes$3(arr) {
4122
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
3904
4123
  }
3905
4124
  function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
3906
4125
  try {
@@ -3952,10 +4171,10 @@ function _instanceof$2(left, right) {
3952
4171
  return left instanceof right;
3953
4172
  }
3954
4173
  }
3955
- function _iterable_to_array$2(iter) {
4174
+ function _iterable_to_array$3(iter) {
3956
4175
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3957
4176
  }
3958
- function _non_iterable_spread$2() {
4177
+ function _non_iterable_spread$3() {
3959
4178
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3960
4179
  }
3961
4180
  function _object_spread$6(target) {
@@ -3973,16 +4192,16 @@ function _object_spread$6(target) {
3973
4192
  }
3974
4193
  return target;
3975
4194
  }
3976
- function _to_consumable_array$2(arr) {
3977
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$2();
4195
+ function _to_consumable_array$3(arr) {
4196
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
3978
4197
  }
3979
- function _unsupported_iterable_to_array$3(o, minLen) {
4198
+ function _unsupported_iterable_to_array$4(o, minLen) {
3980
4199
  if (!o) return;
3981
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
4200
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
3982
4201
  var n = Object.prototype.toString.call(o).slice(8, -1);
3983
4202
  if (n === "Object" && o.constructor) n = o.constructor.name;
3984
4203
  if (n === "Map" || n === "Set") return Array.from(n);
3985
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
4204
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
3986
4205
  }
3987
4206
  function _ts_generator$8(thisArg, body) {
3988
4207
  var f, y, t, _ = {
@@ -4424,7 +4643,7 @@ function _ts_generator$8(thisArg, body) {
4424
4643
  */ function createDoctorCommand(input) {
4425
4644
  var _input_checks;
4426
4645
  var cliName = input.cliName;
4427
- var checks = _to_consumable_array$2(defaultDoctorChecks()).concat(_to_consumable_array$2((_input_checks = input.checks) !== null && _input_checks !== void 0 ? _input_checks : []));
4646
+ var checks = _to_consumable_array$3(defaultDoctorChecks()).concat(_to_consumable_array$3((_input_checks = input.checks) !== null && _input_checks !== void 0 ? _input_checks : []));
4428
4647
  var defaultEnvs = input.defaultEnvs;
4429
4648
  return {
4430
4649
  command: 'doctor',
@@ -4591,7 +4810,7 @@ function _ts_generator$8(thisArg, body) {
4591
4810
  };
4592
4811
  }
4593
4812
 
4594
- function _array_like_to_array$2(arr, len) {
4813
+ function _array_like_to_array$3(arr, len) {
4595
4814
  if (len == null || len > arr.length) len = arr.length;
4596
4815
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4597
4816
  return arr2;
@@ -4711,15 +4930,15 @@ function _object_spread_props$4(target, source) {
4711
4930
  return target;
4712
4931
  }
4713
4932
  function _sliced_to_array$1(arr, i) {
4714
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
4933
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$1();
4715
4934
  }
4716
- function _unsupported_iterable_to_array$2(o, minLen) {
4935
+ function _unsupported_iterable_to_array$3(o, minLen) {
4717
4936
  if (!o) return;
4718
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
4937
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
4719
4938
  var n = Object.prototype.toString.call(o).slice(8, -1);
4720
4939
  if (n === "Object" && o.constructor) n = o.constructor.name;
4721
4940
  if (n === "Map" || n === "Set") return Array.from(n);
4722
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
4941
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
4723
4942
  }
4724
4943
  function _ts_generator$7(thisArg, body) {
4725
4944
  var f, y, t, _ = {
@@ -5288,6 +5507,302 @@ function resolveEnvWithDefault(input) {
5288
5507
  };
5289
5508
  }
5290
5509
 
5510
+ function _array_like_to_array$2(arr, len) {
5511
+ if (len == null || len > arr.length) len = arr.length;
5512
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5513
+ return arr2;
5514
+ }
5515
+ function _array_without_holes$2(arr) {
5516
+ if (Array.isArray(arr)) return _array_like_to_array$2(arr);
5517
+ }
5518
+ function _iterable_to_array$2(iter) {
5519
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5520
+ }
5521
+ function _non_iterable_spread$2() {
5522
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5523
+ }
5524
+ function _to_consumable_array$2(arr) {
5525
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
5526
+ }
5527
+ function _unsupported_iterable_to_array$2(o, minLen) {
5528
+ if (!o) return;
5529
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
5530
+ var n = Object.prototype.toString.call(o).slice(8, -1);
5531
+ if (n === "Object" && o.constructor) n = o.constructor.name;
5532
+ if (n === "Map" || n === "Set") return Array.from(n);
5533
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
5534
+ }
5535
+ /**
5536
+ * Resolves the manifest entry for `query` against `modelType`, `identityConst`,
5537
+ * and `collectionPrefix` in that order.
5538
+ *
5539
+ * Re-exports {@link findCliModelManifestEntry} under a more descriptive name
5540
+ * for the model-info command.
5541
+ *
5542
+ * @param manifest - the generated model manifest.
5543
+ * @param query - identifier to look up.
5544
+ * @returns the matching entry or `undefined`.
5545
+ * @__NO_SIDE_EFFECTS__
5546
+ */ function resolveCliModel(manifest, query) {
5547
+ return findCliModelManifestEntry(query, manifest);
5548
+ }
5549
+ /**
5550
+ * Produces a column-aligned summary table of every model in the manifest.
5551
+ *
5552
+ * @param manifest - the generated model manifest.
5553
+ * @returns the formatted table as a single string with a trailing newline.
5554
+ * @__NO_SIDE_EFFECTS__
5555
+ */ function renderModelManifestList(manifest) {
5556
+ if (manifest.length === 0) {
5557
+ return 'No models found in the generated manifest.\n';
5558
+ }
5559
+ var rows = [
5560
+ [
5561
+ 'MODEL',
5562
+ 'PREFIX',
5563
+ 'GROUP',
5564
+ 'FIELDS',
5565
+ 'PACKAGE',
5566
+ 'IDENTITY'
5567
+ ]
5568
+ ].concat(_to_consumable_array$2(manifest.map(function(m) {
5569
+ var _m_modelGroup;
5570
+ return [
5571
+ m.modelType,
5572
+ m.collectionPrefix,
5573
+ (_m_modelGroup = m.modelGroup) !== null && _m_modelGroup !== void 0 ? _m_modelGroup : '',
5574
+ String(m.fields.length),
5575
+ m.sourcePackage,
5576
+ m.identityConst
5577
+ ];
5578
+ })));
5579
+ return renderTable(rows);
5580
+ }
5581
+ /**
5582
+ * Produces a human-readable summary of one model entry: header, description,
5583
+ * and an indented field tree (recursing into `nestedFields`).
5584
+ *
5585
+ * @param entry - the manifest entry to render.
5586
+ * @returns the formatted summary as a single string with a trailing newline.
5587
+ * @__NO_SIDE_EFFECTS__
5588
+ */ function renderModelManifestEntry(entry) {
5589
+ var lines = [];
5590
+ lines.push("# ".concat(entry.modelType) + (entry.modelGroup ? " \xb7 group ".concat(entry.modelGroup) : ''));
5591
+ lines.push("Identity: ".concat(entry.identityConst));
5592
+ lines.push("Collection prefix: ".concat(entry.collectionPrefix));
5593
+ if (entry.parentIdentityConst) lines.push("Parent identity: ".concat(entry.parentIdentityConst));
5594
+ lines.push("Source package: ".concat(entry.sourcePackage));
5595
+ lines.push("Source file: ".concat(entry.sourceFile));
5596
+ if (entry.description) {
5597
+ lines.push('');
5598
+ lines.push(entry.description);
5599
+ }
5600
+ lines.push('');
5601
+ lines.push("Fields (".concat(entry.fields.length, "):"));
5602
+ lines.push(renderFieldsTree(entry.fields, 0));
5603
+ return lines.join('\n') + '\n';
5604
+ }
5605
+ /**
5606
+ * Produces the field-table portion of {@link renderModelManifestEntry} on its
5607
+ * own, used by the `--fields` flag of the `model-info` command.
5608
+ *
5609
+ * @param entry - the manifest entry whose fields should be rendered.
5610
+ * @returns the formatted field tree as a single string with a trailing newline.
5611
+ * @__NO_SIDE_EFFECTS__
5612
+ */ function renderModelManifestFields(entry) {
5613
+ return renderFieldsTree(entry.fields, 0) + '\n';
5614
+ }
5615
+ function renderFieldsTree(fields, indent) {
5616
+ var out = [];
5617
+ var rows = [
5618
+ [
5619
+ 'NAME',
5620
+ 'LONG NAME',
5621
+ 'TYPE',
5622
+ 'OPTIONAL',
5623
+ 'CONVERTER'
5624
+ ]
5625
+ ];
5626
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5627
+ try {
5628
+ for(var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5629
+ var field = _step.value;
5630
+ var _field_tsType;
5631
+ rows.push([
5632
+ field.name,
5633
+ field.longName,
5634
+ (_field_tsType = field.tsType) !== null && _field_tsType !== void 0 ? _field_tsType : '',
5635
+ field.optional ? 'yes' : 'no',
5636
+ truncate(field.converter, 60)
5637
+ ]);
5638
+ }
5639
+ } catch (err) {
5640
+ _didIteratorError = true;
5641
+ _iteratorError = err;
5642
+ } finally{
5643
+ try {
5644
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5645
+ _iterator.return();
5646
+ }
5647
+ } finally{
5648
+ if (_didIteratorError) {
5649
+ throw _iteratorError;
5650
+ }
5651
+ }
5652
+ }
5653
+ out.push(indentLines$1(renderTable(rows), indent));
5654
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
5655
+ try {
5656
+ for(var _iterator1 = fields[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
5657
+ var field1 = _step1.value;
5658
+ if (field1.nestedFields && field1.nestedFields.length > 0) {
5659
+ var label = field1.nestedIsArray ? 'array element' : 'sub-object';
5660
+ out.push(indentLines$1("↳ ".concat(field1.name, " (").concat(label, ", ").concat(field1.nestedFields.length, " field").concat(field1.nestedFields.length === 1 ? '' : 's', ")"), indent + 2));
5661
+ out.push(renderFieldsTree(field1.nestedFields, indent + 4));
5662
+ }
5663
+ }
5664
+ } catch (err) {
5665
+ _didIteratorError1 = true;
5666
+ _iteratorError1 = err;
5667
+ } finally{
5668
+ try {
5669
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
5670
+ _iterator1.return();
5671
+ }
5672
+ } finally{
5673
+ if (_didIteratorError1) {
5674
+ throw _iteratorError1;
5675
+ }
5676
+ }
5677
+ }
5678
+ return out.join('\n');
5679
+ }
5680
+ function renderTable(rows) {
5681
+ if (rows.length === 0) return '';
5682
+ var widths = [];
5683
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5684
+ try {
5685
+ for(var _iterator = rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5686
+ var row = _step.value;
5687
+ row.forEach(function(cell, i) {
5688
+ var _widths_i;
5689
+ var cellWidth = cell.length;
5690
+ widths[i] = Math.max((_widths_i = widths[i]) !== null && _widths_i !== void 0 ? _widths_i : 0, cellWidth);
5691
+ });
5692
+ }
5693
+ } catch (err) {
5694
+ _didIteratorError = true;
5695
+ _iteratorError = err;
5696
+ } finally{
5697
+ try {
5698
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5699
+ _iterator.return();
5700
+ }
5701
+ } finally{
5702
+ if (_didIteratorError) {
5703
+ throw _iteratorError;
5704
+ }
5705
+ }
5706
+ }
5707
+ return rows.map(function(row) {
5708
+ return row.map(function(cell, i) {
5709
+ var _widths_i;
5710
+ return i === row.length - 1 ? cell : cell.padEnd((_widths_i = widths[i]) !== null && _widths_i !== void 0 ? _widths_i : 0);
5711
+ }).join(' ').replace(/\s+$/, '');
5712
+ }).join('\n');
5713
+ }
5714
+ function truncate(text, max) {
5715
+ if (text.length <= max) return text;
5716
+ return text.slice(0, max - 1) + '…';
5717
+ }
5718
+ function indentLines$1(text, indent) {
5719
+ if (indent <= 0) return text;
5720
+ var pad = ' '.repeat(indent);
5721
+ return text.split('\n').map(function(line) {
5722
+ return line.length > 0 ? pad + line : line;
5723
+ }).join('\n');
5724
+ }
5725
+
5726
+ /**
5727
+ * Default command name for the model-info command. Top-level so it stays out
5728
+ * of the API-call namespace owned by `model <model> <action>`.
5729
+ */ var DEFAULT_MODEL_INFO_COMMAND_NAME = 'model-info';
5730
+ /**
5731
+ * Builds the top-level `model-info [model]` command.
5732
+ *
5733
+ * Without an argument: prints a column-aligned table summarising every model
5734
+ * in the manifest. With an argument: looks the model up by `modelType`,
5735
+ * `identityConst`, or `collectionPrefix` and prints its full per-field
5736
+ * documentation, recursing into nested converters when the manifest captured
5737
+ * them.
5738
+ *
5739
+ * Flags:
5740
+ * - `--json` emits a structured `{ ok, data }` envelope instead of the
5741
+ * human-readable table (useful for scripting or LLM agents).
5742
+ * - `--fields` prints only the field table for the resolved model.
5743
+ *
5744
+ * @param manifest - The generated model manifest (e.g. `DEMO_CLI_MODEL_MANIFEST`).
5745
+ * @param options - Optional overrides; see {@link BuildModelInfoCommandOptions}.
5746
+ * @returns A yargs `CommandModule` ready to be passed to `runCli({ configCommands })`.
5747
+ * @__NO_SIDE_EFFECTS__
5748
+ */ function buildModelInfoCommand(manifest, options) {
5749
+ var _ref;
5750
+ var commandName = (_ref = options === null || options === void 0 ? void 0 : options.commandName) !== null && _ref !== void 0 ? _ref : DEFAULT_MODEL_INFO_COMMAND_NAME;
5751
+ return {
5752
+ command: "".concat(commandName, " [model]"),
5753
+ describe: "Show generated catalog and field info for Firestore models (".concat(manifest.length, " model").concat(manifest.length === 1 ? '' : 's', ")."),
5754
+ builder: function builder(yargs) {
5755
+ return yargs.positional('model', {
5756
+ type: 'string',
5757
+ describe: 'Model to inspect (modelType, identity const, or collection prefix). Omit to list every model.'
5758
+ }).option('json', {
5759
+ type: 'boolean',
5760
+ default: false,
5761
+ describe: 'Emit a structured JSON envelope instead of the human-readable table.'
5762
+ }).option('fields', {
5763
+ type: 'boolean',
5764
+ default: false,
5765
+ describe: 'Print only the field table for the resolved model.'
5766
+ });
5767
+ },
5768
+ handler: function handler(argv) {
5769
+ try {
5770
+ runHandler(manifest, argv);
5771
+ } catch (e) {
5772
+ outputError(e);
5773
+ process.exit(1);
5774
+ }
5775
+ }
5776
+ };
5777
+ }
5778
+ function runHandler(manifest, argv) {
5779
+ var query = typeof argv.model === 'string' && argv.model.length > 0 ? argv.model : undefined;
5780
+ if (!query) {
5781
+ if (argv.json) {
5782
+ outputResult(manifest);
5783
+ return;
5784
+ }
5785
+ process.stdout.write(renderModelManifestList(manifest));
5786
+ return;
5787
+ }
5788
+ var entry = resolveCliModel(manifest, query);
5789
+ if (!entry) {
5790
+ throw new CliError({
5791
+ message: "No model matches '".concat(query, "'. Run `model-info` without an argument to list available models."),
5792
+ code: 'MODEL_INFO_NOT_FOUND'
5793
+ });
5794
+ }
5795
+ if (argv.json) {
5796
+ outputResult(entry);
5797
+ return;
5798
+ }
5799
+ if (argv.fields) {
5800
+ process.stdout.write(renderModelManifestFields(entry));
5801
+ return;
5802
+ }
5803
+ process.stdout.write(renderModelManifestEntry(entry));
5804
+ }
5805
+
5291
5806
  function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
5292
5807
  try {
5293
5808
  var info = gen[key](arg);
@@ -6715,6 +7230,10 @@ function _ts_generator$2(thisArg, body) {
6715
7230
  * @param input.defaultEnvs - Built-in env presets shipped with the CLI.
6716
7231
  * @param input.argv - Argv to parse. Defaults to `hideBin(process.argv)`.
6717
7232
  * @param input.disableCallPassthrough - When `true`, omits the built-in `call` passthrough.
7233
+ * @param input.modelManifest - Optional Firestore model manifest. When provided, auto-wires the
7234
+ * built-in `model-info` command. Opt-in per app.
7235
+ * @param input.disableModelInfo - When `true`, suppresses the auto-wired `model-info` command even
7236
+ * if {@link CreateCliInput.modelManifest} is provided.
6718
7237
  * @returns The configured yargs `Argv` ready to be `.parse()`-d.
6719
7238
  * @__NO_SIDE_EFFECTS__
6720
7239
  */ function createCli(input) {
@@ -6739,6 +7258,9 @@ function _ts_generator$2(thisArg, body) {
6739
7258
  cliName: cliName
6740
7259
  })
6741
7260
  ];
7261
+ if (input.modelManifest && input.disableModelInfo !== true) {
7262
+ builtInConfigCommands.push(buildModelInfoCommand(input.modelManifest));
7263
+ }
6742
7264
  var allConfigCommands = _to_consumable_array$1(builtInConfigCommands).concat(_to_consumable_array$1((_input_configCommands = input.configCommands) !== null && _input_configCommands !== void 0 ? _input_configCommands : []));
6743
7265
  var builtInApiCommands = input.disableCallPassthrough ? [] : [
6744
7266
  callPassthroughCommand
@@ -7196,7 +7718,8 @@ var DATA_HELP_FLAG = '--data-help';
7196
7718
  var context = {
7197
7719
  dataHelpFormat: dataHelpFormat,
7198
7720
  helpMode: helpMode,
7199
- hideOnFocus: hideOnFocus
7721
+ hideOnFocus: hideOnFocus,
7722
+ modelManifest: options === null || options === void 0 ? void 0 : options.modelManifest
7200
7723
  };
7201
7724
  return [
7202
7725
  {
@@ -7360,6 +7883,7 @@ function buildEntryCommand(entry, context) {
7360
7883
  var fallbackDescribe = "".concat(entry.verb).concat(specPart, " on ").concat(entry.model);
7361
7884
  var describeOneLine = (_oneLineDescription = oneLineDescription(entry.description)) !== null && _oneLineDescription !== void 0 ? _oneLineDescription : fallbackDescribe;
7362
7885
  var epilogue = buildEntryEpilogue(entry, context);
7886
+ var expandKeysAvailable = Boolean(context.modelManifest);
7363
7887
  return {
7364
7888
  command: action,
7365
7889
  describe: describeOneLine,
@@ -7368,6 +7892,13 @@ function buildEntryCommand(entry, context) {
7368
7892
  type: 'string',
7369
7893
  describe: 'JSON-encoded payload (defaults to {} when omitted)'
7370
7894
  });
7895
+ if (expandKeysAvailable) {
7896
+ y = y.option('expand-keys', {
7897
+ type: 'boolean',
7898
+ default: false,
7899
+ describe: "Rewrite the response payload's persisted short keys to their long-name form using the generated model manifest."
7900
+ });
7901
+ }
7371
7902
  hideGlobalOptions(y, context.hideOnFocus);
7372
7903
  return epilogue ? y.epilogue(epilogue) : y;
7373
7904
  },
@@ -7385,7 +7916,10 @@ function buildEntryCommand(entry, context) {
7385
7916
  ]);
7386
7917
  return [
7387
7918
  4,
7388
- callEntry(entry, typeof argv.data === 'string' ? argv.data : undefined)
7919
+ callEntry(entry, typeof argv.data === 'string' ? argv.data : undefined, {
7920
+ expandKeys: expandKeysAvailable && argv.expandKeys === true,
7921
+ modelManifest: context.modelManifest
7922
+ })
7389
7923
  ];
7390
7924
  case 1:
7391
7925
  _state.sent();
@@ -7710,9 +8244,9 @@ function readArktypeExpression(entry) {
7710
8244
  }
7711
8245
  return result;
7712
8246
  }
7713
- function callEntry(entry, rawData) {
8247
+ function callEntry(entry, rawData, options) {
7714
8248
  return _async_to_generator$1(function() {
7715
- var ctx, data, params, result;
8249
+ var ctx, data, params, result, finalResult;
7716
8250
  return _ts_generator$1(this, function(_state) {
7717
8251
  switch(_state.label){
7718
8252
  case 0:
@@ -7732,7 +8266,8 @@ function callEntry(entry, rawData) {
7732
8266
  ];
7733
8267
  case 1:
7734
8268
  result = _state.sent();
7735
- outputResult(result);
8269
+ finalResult = options.expandKeys && options.modelManifest ? expandModelKeys(entry.model, result, options.modelManifest) : result;
8270
+ outputResult(finalResult);
7736
8271
  return [
7737
8272
  2
7738
8273
  ];
@@ -8282,4 +8817,4 @@ function printPaginatedOutput(input) {
8282
8817
  })();
8283
8818
  }
8284
8819
 
8285
- export { CALL_MODEL_API_PATH, CliError, DEFAULT_CLI_OIDC_SCOPES, DEFAULT_CLI_SECRET_PATTERNS, DEFAULT_MANIFEST_HELP_DATA_FORMAT, DEFAULT_MANIFEST_HELP_MODE, DEFAULT_MANIFEST_MODEL_COMMAND_NAME, DUMP_MERGE_MODES, DUMP_OUTPUT_MODES, MODEL_WRITE_OIDC_SCOPES, MULTIPLE_PAGES_OUTPUT_MODES, PROMPT_CANCELLED_ERROR_CODE, STANDARD_GLOBAL_OPTION_NAMES, applyEnvVarOverrides, buildAuthorizationUrl, buildCliPaths, buildDumpFilePath, buildErrorOutput, buildManifestCommands, callModelOverHttp, callPassthroughCommand, configureCliErrorMapper, configureCliSecretPatterns, configureOutputOptions, createAuthCommand, createAuthMiddleware, createCallModelCommand, createCli, createCliContext, createCliTokenCacheStore, createContextSlot, createDoctorCommand, createEnvCommand, createOutputCommand, createOutputMiddleware, defaultDoctorChecks, detectDataHelpFormat, detectHelpMode, discoverOidcMetadata, dumpTimestamp, exchangeAuthorizationCode, fetchUserInfo, filterReadOnlyModelScopes, findCliEnvDefault, generateOAuthState, generatePkceMaterial, getCliContext, getOutputOptions, isCliEnvConfigComplete, isTokenExpired, loadCliConfig, maskSecret, mergeCliConfig, mergeCliEnvWithDefault, mergeOutputConfig, openStreamingDump, outputError, outputResult, parsePastedRedirect, pickFields, promptLine, refreshAccessToken, requireCliContext, resolveActiveEnvName, resolveOutputConfig, revokeToken, runCli, runPaginatedList, sanitizeString, saveCliConfig, setCliContext, withCallModelArgs, withEnv, withMultiplePages, withOutput, wrapCommandHandler };
8820
+ export { CALL_MODEL_API_PATH, CliError, DEFAULT_CLI_OIDC_SCOPES, DEFAULT_CLI_SECRET_PATTERNS, DEFAULT_MANIFEST_HELP_DATA_FORMAT, DEFAULT_MANIFEST_HELP_MODE, DEFAULT_MANIFEST_MODEL_COMMAND_NAME, DEFAULT_MODEL_INFO_COMMAND_NAME, DUMP_MERGE_MODES, DUMP_OUTPUT_MODES, MODEL_WRITE_OIDC_SCOPES, MULTIPLE_PAGES_OUTPUT_MODES, PROMPT_CANCELLED_ERROR_CODE, STANDARD_GLOBAL_OPTION_NAMES, applyEnvVarOverrides, buildAuthorizationUrl, buildCliPaths, buildDumpFilePath, buildErrorOutput, buildManifestCommands, buildModelInfoCommand, callModelOverHttp, callPassthroughCommand, configureCliErrorMapper, configureCliSecretPatterns, configureOutputOptions, createAuthCommand, createAuthMiddleware, createCallModelCommand, createCli, createCliContext, createCliTokenCacheStore, createContextSlot, createDoctorCommand, createEnvCommand, createOutputCommand, createOutputMiddleware, defaultDoctorChecks, detectDataHelpFormat, detectHelpMode, discoverOidcMetadata, dumpTimestamp, exchangeAuthorizationCode, expandModelKeys, fetchUserInfo, filterReadOnlyModelScopes, findCliEnvDefault, findCliModelManifestEntry, generateOAuthState, generatePkceMaterial, getCliContext, getOutputOptions, isCliEnvConfigComplete, isTokenExpired, loadCliConfig, maskSecret, mergeCliConfig, mergeCliEnvWithDefault, mergeOutputConfig, openStreamingDump, outputError, outputResult, parsePastedRedirect, pickFields, promptLine, refreshAccessToken, renderModelManifestEntry, renderModelManifestFields, renderModelManifestList, requireCliContext, resolveActiveEnvName, resolveCliModel, resolveOutputConfig, revokeToken, runCli, runPaginatedList, sanitizeString, saveCliConfig, setCliContext, withCallModelArgs, withEnv, withMultiplePages, withOutput, wrapCommandHandler };