@dereekb/dbx-cli 13.11.4 → 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/firebase-api-manifest/main.js +666 -16
- package/firebase-api-manifest/package.json +1 -1
- package/index.cjs.js +567 -48
- package/index.esm.js +560 -49
- package/manifest-extract/index.cjs.js +705 -0
- package/manifest-extract/index.esm.js +705 -1
- package/manifest-extract/package.json +1 -1
- package/manifest-extract/src/index.d.ts +1 -0
- package/manifest-extract/src/lib/extract-models.d.ts +33 -0
- package/manifest-extract/src/lib/types.d.ts +148 -0
- package/package.json +5 -5
- package/src/lib/api/expand-keys.d.ts +31 -0
- package/src/lib/api/index.d.ts +1 -0
- package/src/lib/manifest/build-manifest-commands.d.ts +12 -1
- package/src/lib/manifest/build-model-info-command.d.ts +37 -0
- package/src/lib/manifest/index.d.ts +2 -0
- package/src/lib/manifest/model-info-utils.d.ts +40 -0
- package/src/lib/manifest/types.d.ts +126 -0
- package/src/lib/runner/run.d.ts +29 -0
package/index.cjs.js
CHANGED
|
@@ -11,13 +11,13 @@ var node_readline = require('node:readline');
|
|
|
11
11
|
var yargs = require('yargs');
|
|
12
12
|
var helpers = require('yargs/helpers');
|
|
13
13
|
|
|
14
|
-
function _array_like_to_array$
|
|
14
|
+
function _array_like_to_array$7(arr, len) {
|
|
15
15
|
if (len == null || len > arr.length) len = arr.length;
|
|
16
16
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
17
17
|
return arr2;
|
|
18
18
|
}
|
|
19
|
-
function _array_without_holes$
|
|
20
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
19
|
+
function _array_without_holes$4(arr) {
|
|
20
|
+
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
21
21
|
}
|
|
22
22
|
function _assert_this_initialized(self) {
|
|
23
23
|
if (self === void 0) {
|
|
@@ -83,7 +83,7 @@ function _inherits(subClass, superClass) {
|
|
|
83
83
|
});
|
|
84
84
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
85
85
|
}
|
|
86
|
-
function _instanceof$
|
|
86
|
+
function _instanceof$6(left, right) {
|
|
87
87
|
"@swc/helpers - instanceof";
|
|
88
88
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
89
89
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -94,10 +94,10 @@ function _instanceof$5(left, right) {
|
|
|
94
94
|
function _is_native_function(fn) {
|
|
95
95
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
96
96
|
}
|
|
97
|
-
function _iterable_to_array$
|
|
97
|
+
function _iterable_to_array$4(iter) {
|
|
98
98
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
99
99
|
}
|
|
100
|
-
function _non_iterable_spread$
|
|
100
|
+
function _non_iterable_spread$4() {
|
|
101
101
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
102
102
|
}
|
|
103
103
|
function _object_spread$c(target) {
|
|
@@ -116,7 +116,7 @@ function _object_spread$c(target) {
|
|
|
116
116
|
return target;
|
|
117
117
|
}
|
|
118
118
|
function _possible_constructor_return(self, call) {
|
|
119
|
-
if (call && (_type_of$
|
|
119
|
+
if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
|
|
120
120
|
return call;
|
|
121
121
|
}
|
|
122
122
|
return _assert_this_initialized(self);
|
|
@@ -128,20 +128,20 @@ function _set_prototype_of(o, p) {
|
|
|
128
128
|
};
|
|
129
129
|
return _set_prototype_of(o, p);
|
|
130
130
|
}
|
|
131
|
-
function _to_consumable_array$
|
|
132
|
-
return _array_without_holes$
|
|
131
|
+
function _to_consumable_array$4(arr) {
|
|
132
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$4();
|
|
133
133
|
}
|
|
134
|
-
function _type_of$
|
|
134
|
+
function _type_of$3(obj) {
|
|
135
135
|
"@swc/helpers - typeof";
|
|
136
136
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
137
137
|
}
|
|
138
|
-
function _unsupported_iterable_to_array$
|
|
138
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
139
139
|
if (!o) return;
|
|
140
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
140
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
141
141
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
142
142
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
143
143
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
144
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
144
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
145
145
|
}
|
|
146
146
|
function _wrap_native_super(Class) {
|
|
147
147
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
@@ -190,7 +190,7 @@ function _is_native_reflect_construct() {
|
|
|
190
190
|
/id_token[=:]\s*\S+/gi
|
|
191
191
|
];
|
|
192
192
|
var _outputOptions = {};
|
|
193
|
-
var _secretPatterns = _to_consumable_array$
|
|
193
|
+
var _secretPatterns = _to_consumable_array$4(DEFAULT_CLI_SECRET_PATTERNS);
|
|
194
194
|
var _errorMapper;
|
|
195
195
|
/**
|
|
196
196
|
* Configures output options from parsed CLI arguments.
|
|
@@ -319,13 +319,13 @@ function dumpResponse(data, meta) {
|
|
|
319
319
|
return pickFromObject(item, fields);
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
|
-
if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$
|
|
322
|
+
if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$3(data)) === 'object') {
|
|
323
323
|
return pickFromObject(data, fields);
|
|
324
324
|
}
|
|
325
325
|
return data;
|
|
326
326
|
}
|
|
327
327
|
function pickFromObject(obj, fields) {
|
|
328
|
-
if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$
|
|
328
|
+
if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$3(obj)) !== 'object') {
|
|
329
329
|
return obj;
|
|
330
330
|
}
|
|
331
331
|
var result = {};
|
|
@@ -420,7 +420,7 @@ function pickFromObject(obj, fields) {
|
|
|
420
420
|
return mapped;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
if (_instanceof$
|
|
423
|
+
if (_instanceof$6(error, CliError)) {
|
|
424
424
|
return _object_spread$c({
|
|
425
425
|
ok: false,
|
|
426
426
|
error: sanitizeString(error.message),
|
|
@@ -429,7 +429,7 @@ function pickFromObject(obj, fields) {
|
|
|
429
429
|
suggestion: error.suggestion
|
|
430
430
|
} : {});
|
|
431
431
|
}
|
|
432
|
-
if (_instanceof$
|
|
432
|
+
if (_instanceof$6(error, Error)) {
|
|
433
433
|
return {
|
|
434
434
|
ok: false,
|
|
435
435
|
error: sanitizeString(error.message),
|
|
@@ -472,7 +472,7 @@ function _async_to_generator$f(fn) {
|
|
|
472
472
|
});
|
|
473
473
|
};
|
|
474
474
|
}
|
|
475
|
-
function _type_of$
|
|
475
|
+
function _type_of$2(obj) {
|
|
476
476
|
"@swc/helpers - typeof";
|
|
477
477
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
478
478
|
}
|
|
@@ -626,7 +626,7 @@ var CALL_MODEL_API_PATH = "/model/call";
|
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
if (!res.ok) {
|
|
629
|
-
bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$
|
|
629
|
+
bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$2(body)) === 'object' && body && 'message' in body ? body.message : undefined;
|
|
630
630
|
messageString = typeof bodyMessage === 'string' ? bodyMessage : undefined;
|
|
631
631
|
message = messageString !== null && messageString !== void 0 ? messageString : text || "".concat(res.status, " ").concat(res.statusText);
|
|
632
632
|
throw new CliError({
|
|
@@ -1133,7 +1133,7 @@ function _define_property$a(obj, key, value) {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
return obj;
|
|
1135
1135
|
}
|
|
1136
|
-
function _instanceof$
|
|
1136
|
+
function _instanceof$5(left, right) {
|
|
1137
1137
|
"@swc/helpers - instanceof";
|
|
1138
1138
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
1139
1139
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -1304,7 +1304,7 @@ function _ts_generator$d(thisArg, body) {
|
|
|
1304
1304
|
data = JSON.parse(argv.data);
|
|
1305
1305
|
} catch (e) {
|
|
1306
1306
|
throw new CliError({
|
|
1307
|
-
message: "--data must be valid JSON: ".concat(_instanceof$
|
|
1307
|
+
message: "--data must be valid JSON: ".concat(_instanceof$5(e, Error) ? e.message : String(e)),
|
|
1308
1308
|
code: 'INVALID_DATA_JSON'
|
|
1309
1309
|
});
|
|
1310
1310
|
}
|
|
@@ -1346,6 +1346,201 @@ function _ts_generator$d(thisArg, body) {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
};
|
|
1348
1348
|
|
|
1349
|
+
function _array_like_to_array$6(arr, len) {
|
|
1350
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1351
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1352
|
+
return arr2;
|
|
1353
|
+
}
|
|
1354
|
+
function _array_with_holes$3(arr) {
|
|
1355
|
+
if (Array.isArray(arr)) return arr;
|
|
1356
|
+
}
|
|
1357
|
+
function _instanceof$4(left, right) {
|
|
1358
|
+
"@swc/helpers - instanceof";
|
|
1359
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
1360
|
+
return !!right[Symbol.hasInstance](left);
|
|
1361
|
+
} else {
|
|
1362
|
+
return left instanceof right;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
function _iterable_to_array_limit$3(arr, i) {
|
|
1366
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1367
|
+
if (_i == null) return;
|
|
1368
|
+
var _arr = [];
|
|
1369
|
+
var _n = true;
|
|
1370
|
+
var _d = false;
|
|
1371
|
+
var _s, _e;
|
|
1372
|
+
try {
|
|
1373
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
1374
|
+
_arr.push(_s.value);
|
|
1375
|
+
if (i && _arr.length === i) break;
|
|
1376
|
+
}
|
|
1377
|
+
} catch (err) {
|
|
1378
|
+
_d = true;
|
|
1379
|
+
_e = err;
|
|
1380
|
+
} finally{
|
|
1381
|
+
try {
|
|
1382
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
1383
|
+
} finally{
|
|
1384
|
+
if (_d) throw _e;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
return _arr;
|
|
1388
|
+
}
|
|
1389
|
+
function _non_iterable_rest$3() {
|
|
1390
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1391
|
+
}
|
|
1392
|
+
function _sliced_to_array$3(arr, i) {
|
|
1393
|
+
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$3();
|
|
1394
|
+
}
|
|
1395
|
+
function _type_of$1(obj) {
|
|
1396
|
+
"@swc/helpers - typeof";
|
|
1397
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1398
|
+
}
|
|
1399
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
1400
|
+
if (!o) return;
|
|
1401
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
1402
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1403
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1404
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1405
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Resolves the manifest entry for `modelType`. Lookup tries
|
|
1409
|
+
* `modelType` first, then falls back to `identityConst` and `collectionPrefix`
|
|
1410
|
+
* so callers can pass any of the three forms a user might type at the CLI.
|
|
1411
|
+
*
|
|
1412
|
+
* @param modelType - identifier to look up.
|
|
1413
|
+
* @param manifest - generated model manifest.
|
|
1414
|
+
* @returns the matching entry, or `undefined` when none exists.
|
|
1415
|
+
* @__NO_SIDE_EFFECTS__
|
|
1416
|
+
*/ function findCliModelManifestEntry(modelType, manifest) {
|
|
1417
|
+
var result;
|
|
1418
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1419
|
+
try {
|
|
1420
|
+
for(var _iterator = manifest[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1421
|
+
var entry = _step.value;
|
|
1422
|
+
if (entry.modelType === modelType || entry.identityConst === modelType || entry.collectionPrefix === modelType) {
|
|
1423
|
+
result = entry;
|
|
1424
|
+
break;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
} catch (err) {
|
|
1428
|
+
_didIteratorError = true;
|
|
1429
|
+
_iteratorError = err;
|
|
1430
|
+
} finally{
|
|
1431
|
+
try {
|
|
1432
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1433
|
+
_iterator.return();
|
|
1434
|
+
}
|
|
1435
|
+
} finally{
|
|
1436
|
+
if (_didIteratorError) {
|
|
1437
|
+
throw _iteratorError;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
return result;
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Rewrites the persisted (short) keys in `data` to the long-name form
|
|
1445
|
+
* declared in the model's manifest entry. Recurses into nested object-array
|
|
1446
|
+
* and sub-object fields when the manifest captured a nested field map.
|
|
1447
|
+
*
|
|
1448
|
+
* Returns the input untouched when `modelType` is not in the manifest, when
|
|
1449
|
+
* the model has no fields, or when the input is not a plain object/array.
|
|
1450
|
+
* Unknown keys, primitives, `Date`, `null`, and `undefined` pass through
|
|
1451
|
+
* unchanged.
|
|
1452
|
+
*
|
|
1453
|
+
* @param modelType - the model identifier (`modelType`, `identityConst`,
|
|
1454
|
+
* or `collectionPrefix`) used to look up the rewrite map.
|
|
1455
|
+
* @param data - the value to rewrite (typically a `read`/`query` response
|
|
1456
|
+
* payload).
|
|
1457
|
+
* @param manifest - generated model manifest.
|
|
1458
|
+
* @returns the rewritten value, or `data` unchanged when no rewrite applies.
|
|
1459
|
+
* @__NO_SIDE_EFFECTS__
|
|
1460
|
+
*/ function expandModelKeys(modelType, data, manifest) {
|
|
1461
|
+
var entry = findCliModelManifestEntry(modelType, manifest);
|
|
1462
|
+
if (!entry) return data;
|
|
1463
|
+
return rewriteWithFields(data, entry.fields);
|
|
1464
|
+
}
|
|
1465
|
+
function rewriteWithFields(value, fields) {
|
|
1466
|
+
if (Array.isArray(value)) {
|
|
1467
|
+
return value.map(function(item) {
|
|
1468
|
+
return rewriteWithFields(item, fields);
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
if (!isPlainObject(value)) return value;
|
|
1472
|
+
var fieldByName = new Map();
|
|
1473
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1474
|
+
try {
|
|
1475
|
+
for(var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1476
|
+
var field = _step.value;
|
|
1477
|
+
fieldByName.set(field.name, field);
|
|
1478
|
+
}
|
|
1479
|
+
} catch (err) {
|
|
1480
|
+
_didIteratorError = true;
|
|
1481
|
+
_iteratorError = err;
|
|
1482
|
+
} finally{
|
|
1483
|
+
try {
|
|
1484
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1485
|
+
_iterator.return();
|
|
1486
|
+
}
|
|
1487
|
+
} finally{
|
|
1488
|
+
if (_didIteratorError) {
|
|
1489
|
+
throw _iteratorError;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
var out = {};
|
|
1494
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1495
|
+
try {
|
|
1496
|
+
for(var _iterator1 = Object.entries(value)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
1497
|
+
var _step_value = _sliced_to_array$3(_step1.value, 2), key = _step_value[0], raw = _step_value[1];
|
|
1498
|
+
var field1 = fieldByName.get(key);
|
|
1499
|
+
if (!field1) {
|
|
1500
|
+
out[key] = raw;
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1503
|
+
var longKey = field1.longName.length > 0 ? field1.longName : key;
|
|
1504
|
+
out[longKey] = rewriteFieldValue(raw, field1);
|
|
1505
|
+
}
|
|
1506
|
+
} catch (err) {
|
|
1507
|
+
_didIteratorError1 = true;
|
|
1508
|
+
_iteratorError1 = err;
|
|
1509
|
+
} finally{
|
|
1510
|
+
try {
|
|
1511
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
1512
|
+
_iterator1.return();
|
|
1513
|
+
}
|
|
1514
|
+
} finally{
|
|
1515
|
+
if (_didIteratorError1) {
|
|
1516
|
+
throw _iteratorError1;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
return out;
|
|
1521
|
+
}
|
|
1522
|
+
function rewriteFieldValue(value, field) {
|
|
1523
|
+
var nested = field.nestedFields;
|
|
1524
|
+
if (!nested || nested.length === 0) return value;
|
|
1525
|
+
if (field.nestedIsArray) {
|
|
1526
|
+
if (!Array.isArray(value)) return value;
|
|
1527
|
+
return value.map(function(item) {
|
|
1528
|
+
return rewriteWithFields(item, nested);
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
if (!isPlainObject(value)) return value;
|
|
1532
|
+
return rewriteWithFields(value, nested);
|
|
1533
|
+
}
|
|
1534
|
+
function isPlainObject(value) {
|
|
1535
|
+
if (value === null || (typeof value === "undefined" ? "undefined" : _type_of$1(value)) !== 'object') return false;
|
|
1536
|
+
if (Array.isArray(value)) return false;
|
|
1537
|
+
if (_instanceof$4(value, Date)) return false;
|
|
1538
|
+
// Objects from JSON.parse have Object.prototype as their proto. Anything
|
|
1539
|
+
// exotic (Map, Set, Buffer, class instances) we leave untouched.
|
|
1540
|
+
var proto = Object.getPrototypeOf(value);
|
|
1541
|
+
return proto === Object.prototype || proto === null;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1349
1544
|
function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1350
1545
|
try {
|
|
1351
1546
|
var info = gen[key](arg);
|
|
@@ -2351,7 +2546,7 @@ function trimSlash(url) {
|
|
|
2351
2546
|
return url.endsWith('/') ? url.slice(0, -1) : url;
|
|
2352
2547
|
}
|
|
2353
2548
|
|
|
2354
|
-
function _array_like_to_array$
|
|
2549
|
+
function _array_like_to_array$5(arr, len) {
|
|
2355
2550
|
if (len == null || len > arr.length) len = arr.length;
|
|
2356
2551
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2357
2552
|
return arr2;
|
|
@@ -2416,15 +2611,15 @@ function _non_iterable_rest$2() {
|
|
|
2416
2611
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2417
2612
|
}
|
|
2418
2613
|
function _sliced_to_array$2(arr, i) {
|
|
2419
|
-
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$
|
|
2614
|
+
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
|
|
2420
2615
|
}
|
|
2421
|
-
function _unsupported_iterable_to_array$
|
|
2616
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
2422
2617
|
if (!o) return;
|
|
2423
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
2618
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
2424
2619
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2425
2620
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2426
2621
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2427
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
2622
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
2428
2623
|
}
|
|
2429
2624
|
function _ts_generator$a(thisArg, body) {
|
|
2430
2625
|
var f, y, t, _ = {
|
|
@@ -3920,13 +4115,13 @@ function maskEnv$1(env) {
|
|
|
3920
4115
|
};
|
|
3921
4116
|
}
|
|
3922
4117
|
|
|
3923
|
-
function _array_like_to_array$
|
|
4118
|
+
function _array_like_to_array$4(arr, len) {
|
|
3924
4119
|
if (len == null || len > arr.length) len = arr.length;
|
|
3925
4120
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3926
4121
|
return arr2;
|
|
3927
4122
|
}
|
|
3928
|
-
function _array_without_holes$
|
|
3929
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
4123
|
+
function _array_without_holes$3(arr) {
|
|
4124
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
3930
4125
|
}
|
|
3931
4126
|
function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3932
4127
|
try {
|
|
@@ -3978,10 +4173,10 @@ function _instanceof$2(left, right) {
|
|
|
3978
4173
|
return left instanceof right;
|
|
3979
4174
|
}
|
|
3980
4175
|
}
|
|
3981
|
-
function _iterable_to_array$
|
|
4176
|
+
function _iterable_to_array$3(iter) {
|
|
3982
4177
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3983
4178
|
}
|
|
3984
|
-
function _non_iterable_spread$
|
|
4179
|
+
function _non_iterable_spread$3() {
|
|
3985
4180
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3986
4181
|
}
|
|
3987
4182
|
function _object_spread$6(target) {
|
|
@@ -3999,16 +4194,16 @@ function _object_spread$6(target) {
|
|
|
3999
4194
|
}
|
|
4000
4195
|
return target;
|
|
4001
4196
|
}
|
|
4002
|
-
function _to_consumable_array$
|
|
4003
|
-
return _array_without_holes$
|
|
4197
|
+
function _to_consumable_array$3(arr) {
|
|
4198
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
|
|
4004
4199
|
}
|
|
4005
|
-
function _unsupported_iterable_to_array$
|
|
4200
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
4006
4201
|
if (!o) return;
|
|
4007
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
4202
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
4008
4203
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4009
4204
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4010
4205
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
4011
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
4206
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
4012
4207
|
}
|
|
4013
4208
|
function _ts_generator$8(thisArg, body) {
|
|
4014
4209
|
var f, y, t, _ = {
|
|
@@ -4450,7 +4645,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
4450
4645
|
*/ function createDoctorCommand(input) {
|
|
4451
4646
|
var _input_checks;
|
|
4452
4647
|
var cliName = input.cliName;
|
|
4453
|
-
var checks = _to_consumable_array$
|
|
4648
|
+
var checks = _to_consumable_array$3(defaultDoctorChecks()).concat(_to_consumable_array$3((_input_checks = input.checks) !== null && _input_checks !== void 0 ? _input_checks : []));
|
|
4454
4649
|
var defaultEnvs = input.defaultEnvs;
|
|
4455
4650
|
return {
|
|
4456
4651
|
command: 'doctor',
|
|
@@ -4617,7 +4812,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
4617
4812
|
};
|
|
4618
4813
|
}
|
|
4619
4814
|
|
|
4620
|
-
function _array_like_to_array$
|
|
4815
|
+
function _array_like_to_array$3(arr, len) {
|
|
4621
4816
|
if (len == null || len > arr.length) len = arr.length;
|
|
4622
4817
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4623
4818
|
return arr2;
|
|
@@ -4737,15 +4932,15 @@ function _object_spread_props$4(target, source) {
|
|
|
4737
4932
|
return target;
|
|
4738
4933
|
}
|
|
4739
4934
|
function _sliced_to_array$1(arr, i) {
|
|
4740
|
-
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$
|
|
4935
|
+
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$1();
|
|
4741
4936
|
}
|
|
4742
|
-
function _unsupported_iterable_to_array$
|
|
4937
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
4743
4938
|
if (!o) return;
|
|
4744
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
4939
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
4745
4940
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4746
4941
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4747
4942
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
4748
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
4943
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
4749
4944
|
}
|
|
4750
4945
|
function _ts_generator$7(thisArg, body) {
|
|
4751
4946
|
var f, y, t, _ = {
|
|
@@ -5314,6 +5509,302 @@ function resolveEnvWithDefault(input) {
|
|
|
5314
5509
|
};
|
|
5315
5510
|
}
|
|
5316
5511
|
|
|
5512
|
+
function _array_like_to_array$2(arr, len) {
|
|
5513
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
5514
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5515
|
+
return arr2;
|
|
5516
|
+
}
|
|
5517
|
+
function _array_without_holes$2(arr) {
|
|
5518
|
+
if (Array.isArray(arr)) return _array_like_to_array$2(arr);
|
|
5519
|
+
}
|
|
5520
|
+
function _iterable_to_array$2(iter) {
|
|
5521
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
5522
|
+
}
|
|
5523
|
+
function _non_iterable_spread$2() {
|
|
5524
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5525
|
+
}
|
|
5526
|
+
function _to_consumable_array$2(arr) {
|
|
5527
|
+
return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
|
|
5528
|
+
}
|
|
5529
|
+
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
5530
|
+
if (!o) return;
|
|
5531
|
+
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
5532
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5533
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5534
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
5535
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
5536
|
+
}
|
|
5537
|
+
/**
|
|
5538
|
+
* Resolves the manifest entry for `query` against `modelType`, `identityConst`,
|
|
5539
|
+
* and `collectionPrefix` in that order.
|
|
5540
|
+
*
|
|
5541
|
+
* Re-exports {@link findCliModelManifestEntry} under a more descriptive name
|
|
5542
|
+
* for the model-info command.
|
|
5543
|
+
*
|
|
5544
|
+
* @param manifest - the generated model manifest.
|
|
5545
|
+
* @param query - identifier to look up.
|
|
5546
|
+
* @returns the matching entry or `undefined`.
|
|
5547
|
+
* @__NO_SIDE_EFFECTS__
|
|
5548
|
+
*/ function resolveCliModel(manifest, query) {
|
|
5549
|
+
return findCliModelManifestEntry(query, manifest);
|
|
5550
|
+
}
|
|
5551
|
+
/**
|
|
5552
|
+
* Produces a column-aligned summary table of every model in the manifest.
|
|
5553
|
+
*
|
|
5554
|
+
* @param manifest - the generated model manifest.
|
|
5555
|
+
* @returns the formatted table as a single string with a trailing newline.
|
|
5556
|
+
* @__NO_SIDE_EFFECTS__
|
|
5557
|
+
*/ function renderModelManifestList(manifest) {
|
|
5558
|
+
if (manifest.length === 0) {
|
|
5559
|
+
return 'No models found in the generated manifest.\n';
|
|
5560
|
+
}
|
|
5561
|
+
var rows = [
|
|
5562
|
+
[
|
|
5563
|
+
'MODEL',
|
|
5564
|
+
'PREFIX',
|
|
5565
|
+
'GROUP',
|
|
5566
|
+
'FIELDS',
|
|
5567
|
+
'PACKAGE',
|
|
5568
|
+
'IDENTITY'
|
|
5569
|
+
]
|
|
5570
|
+
].concat(_to_consumable_array$2(manifest.map(function(m) {
|
|
5571
|
+
var _m_modelGroup;
|
|
5572
|
+
return [
|
|
5573
|
+
m.modelType,
|
|
5574
|
+
m.collectionPrefix,
|
|
5575
|
+
(_m_modelGroup = m.modelGroup) !== null && _m_modelGroup !== void 0 ? _m_modelGroup : '',
|
|
5576
|
+
String(m.fields.length),
|
|
5577
|
+
m.sourcePackage,
|
|
5578
|
+
m.identityConst
|
|
5579
|
+
];
|
|
5580
|
+
})));
|
|
5581
|
+
return renderTable(rows);
|
|
5582
|
+
}
|
|
5583
|
+
/**
|
|
5584
|
+
* Produces a human-readable summary of one model entry: header, description,
|
|
5585
|
+
* and an indented field tree (recursing into `nestedFields`).
|
|
5586
|
+
*
|
|
5587
|
+
* @param entry - the manifest entry to render.
|
|
5588
|
+
* @returns the formatted summary as a single string with a trailing newline.
|
|
5589
|
+
* @__NO_SIDE_EFFECTS__
|
|
5590
|
+
*/ function renderModelManifestEntry(entry) {
|
|
5591
|
+
var lines = [];
|
|
5592
|
+
lines.push("# ".concat(entry.modelType) + (entry.modelGroup ? " \xb7 group ".concat(entry.modelGroup) : ''));
|
|
5593
|
+
lines.push("Identity: ".concat(entry.identityConst));
|
|
5594
|
+
lines.push("Collection prefix: ".concat(entry.collectionPrefix));
|
|
5595
|
+
if (entry.parentIdentityConst) lines.push("Parent identity: ".concat(entry.parentIdentityConst));
|
|
5596
|
+
lines.push("Source package: ".concat(entry.sourcePackage));
|
|
5597
|
+
lines.push("Source file: ".concat(entry.sourceFile));
|
|
5598
|
+
if (entry.description) {
|
|
5599
|
+
lines.push('');
|
|
5600
|
+
lines.push(entry.description);
|
|
5601
|
+
}
|
|
5602
|
+
lines.push('');
|
|
5603
|
+
lines.push("Fields (".concat(entry.fields.length, "):"));
|
|
5604
|
+
lines.push(renderFieldsTree(entry.fields, 0));
|
|
5605
|
+
return lines.join('\n') + '\n';
|
|
5606
|
+
}
|
|
5607
|
+
/**
|
|
5608
|
+
* Produces the field-table portion of {@link renderModelManifestEntry} on its
|
|
5609
|
+
* own, used by the `--fields` flag of the `model-info` command.
|
|
5610
|
+
*
|
|
5611
|
+
* @param entry - the manifest entry whose fields should be rendered.
|
|
5612
|
+
* @returns the formatted field tree as a single string with a trailing newline.
|
|
5613
|
+
* @__NO_SIDE_EFFECTS__
|
|
5614
|
+
*/ function renderModelManifestFields(entry) {
|
|
5615
|
+
return renderFieldsTree(entry.fields, 0) + '\n';
|
|
5616
|
+
}
|
|
5617
|
+
function renderFieldsTree(fields, indent) {
|
|
5618
|
+
var out = [];
|
|
5619
|
+
var rows = [
|
|
5620
|
+
[
|
|
5621
|
+
'NAME',
|
|
5622
|
+
'LONG NAME',
|
|
5623
|
+
'TYPE',
|
|
5624
|
+
'OPTIONAL',
|
|
5625
|
+
'CONVERTER'
|
|
5626
|
+
]
|
|
5627
|
+
];
|
|
5628
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5629
|
+
try {
|
|
5630
|
+
for(var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5631
|
+
var field = _step.value;
|
|
5632
|
+
var _field_tsType;
|
|
5633
|
+
rows.push([
|
|
5634
|
+
field.name,
|
|
5635
|
+
field.longName,
|
|
5636
|
+
(_field_tsType = field.tsType) !== null && _field_tsType !== void 0 ? _field_tsType : '',
|
|
5637
|
+
field.optional ? 'yes' : 'no',
|
|
5638
|
+
truncate(field.converter, 60)
|
|
5639
|
+
]);
|
|
5640
|
+
}
|
|
5641
|
+
} catch (err) {
|
|
5642
|
+
_didIteratorError = true;
|
|
5643
|
+
_iteratorError = err;
|
|
5644
|
+
} finally{
|
|
5645
|
+
try {
|
|
5646
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5647
|
+
_iterator.return();
|
|
5648
|
+
}
|
|
5649
|
+
} finally{
|
|
5650
|
+
if (_didIteratorError) {
|
|
5651
|
+
throw _iteratorError;
|
|
5652
|
+
}
|
|
5653
|
+
}
|
|
5654
|
+
}
|
|
5655
|
+
out.push(indentLines$1(renderTable(rows), indent));
|
|
5656
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
5657
|
+
try {
|
|
5658
|
+
for(var _iterator1 = fields[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
5659
|
+
var field1 = _step1.value;
|
|
5660
|
+
if (field1.nestedFields && field1.nestedFields.length > 0) {
|
|
5661
|
+
var label = field1.nestedIsArray ? 'array element' : 'sub-object';
|
|
5662
|
+
out.push(indentLines$1("↳ ".concat(field1.name, " (").concat(label, ", ").concat(field1.nestedFields.length, " field").concat(field1.nestedFields.length === 1 ? '' : 's', ")"), indent + 2));
|
|
5663
|
+
out.push(renderFieldsTree(field1.nestedFields, indent + 4));
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5666
|
+
} catch (err) {
|
|
5667
|
+
_didIteratorError1 = true;
|
|
5668
|
+
_iteratorError1 = err;
|
|
5669
|
+
} finally{
|
|
5670
|
+
try {
|
|
5671
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
5672
|
+
_iterator1.return();
|
|
5673
|
+
}
|
|
5674
|
+
} finally{
|
|
5675
|
+
if (_didIteratorError1) {
|
|
5676
|
+
throw _iteratorError1;
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5679
|
+
}
|
|
5680
|
+
return out.join('\n');
|
|
5681
|
+
}
|
|
5682
|
+
function renderTable(rows) {
|
|
5683
|
+
if (rows.length === 0) return '';
|
|
5684
|
+
var widths = [];
|
|
5685
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5686
|
+
try {
|
|
5687
|
+
for(var _iterator = rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5688
|
+
var row = _step.value;
|
|
5689
|
+
row.forEach(function(cell, i) {
|
|
5690
|
+
var _widths_i;
|
|
5691
|
+
var cellWidth = cell.length;
|
|
5692
|
+
widths[i] = Math.max((_widths_i = widths[i]) !== null && _widths_i !== void 0 ? _widths_i : 0, cellWidth);
|
|
5693
|
+
});
|
|
5694
|
+
}
|
|
5695
|
+
} catch (err) {
|
|
5696
|
+
_didIteratorError = true;
|
|
5697
|
+
_iteratorError = err;
|
|
5698
|
+
} finally{
|
|
5699
|
+
try {
|
|
5700
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5701
|
+
_iterator.return();
|
|
5702
|
+
}
|
|
5703
|
+
} finally{
|
|
5704
|
+
if (_didIteratorError) {
|
|
5705
|
+
throw _iteratorError;
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
}
|
|
5709
|
+
return rows.map(function(row) {
|
|
5710
|
+
return row.map(function(cell, i) {
|
|
5711
|
+
var _widths_i;
|
|
5712
|
+
return i === row.length - 1 ? cell : cell.padEnd((_widths_i = widths[i]) !== null && _widths_i !== void 0 ? _widths_i : 0);
|
|
5713
|
+
}).join(' ').replace(/\s+$/, '');
|
|
5714
|
+
}).join('\n');
|
|
5715
|
+
}
|
|
5716
|
+
function truncate(text, max) {
|
|
5717
|
+
if (text.length <= max) return text;
|
|
5718
|
+
return text.slice(0, max - 1) + '…';
|
|
5719
|
+
}
|
|
5720
|
+
function indentLines$1(text, indent) {
|
|
5721
|
+
if (indent <= 0) return text;
|
|
5722
|
+
var pad = ' '.repeat(indent);
|
|
5723
|
+
return text.split('\n').map(function(line) {
|
|
5724
|
+
return line.length > 0 ? pad + line : line;
|
|
5725
|
+
}).join('\n');
|
|
5726
|
+
}
|
|
5727
|
+
|
|
5728
|
+
/**
|
|
5729
|
+
* Default command name for the model-info command. Top-level so it stays out
|
|
5730
|
+
* of the API-call namespace owned by `model <model> <action>`.
|
|
5731
|
+
*/ var DEFAULT_MODEL_INFO_COMMAND_NAME = 'model-info';
|
|
5732
|
+
/**
|
|
5733
|
+
* Builds the top-level `model-info [model]` command.
|
|
5734
|
+
*
|
|
5735
|
+
* Without an argument: prints a column-aligned table summarising every model
|
|
5736
|
+
* in the manifest. With an argument: looks the model up by `modelType`,
|
|
5737
|
+
* `identityConst`, or `collectionPrefix` and prints its full per-field
|
|
5738
|
+
* documentation, recursing into nested converters when the manifest captured
|
|
5739
|
+
* them.
|
|
5740
|
+
*
|
|
5741
|
+
* Flags:
|
|
5742
|
+
* - `--json` emits a structured `{ ok, data }` envelope instead of the
|
|
5743
|
+
* human-readable table (useful for scripting or LLM agents).
|
|
5744
|
+
* - `--fields` prints only the field table for the resolved model.
|
|
5745
|
+
*
|
|
5746
|
+
* @param manifest - The generated model manifest (e.g. `DEMO_CLI_MODEL_MANIFEST`).
|
|
5747
|
+
* @param options - Optional overrides; see {@link BuildModelInfoCommandOptions}.
|
|
5748
|
+
* @returns A yargs `CommandModule` ready to be passed to `runCli({ configCommands })`.
|
|
5749
|
+
* @__NO_SIDE_EFFECTS__
|
|
5750
|
+
*/ function buildModelInfoCommand(manifest, options) {
|
|
5751
|
+
var _ref;
|
|
5752
|
+
var commandName = (_ref = options === null || options === void 0 ? void 0 : options.commandName) !== null && _ref !== void 0 ? _ref : DEFAULT_MODEL_INFO_COMMAND_NAME;
|
|
5753
|
+
return {
|
|
5754
|
+
command: "".concat(commandName, " [model]"),
|
|
5755
|
+
describe: "Show generated catalog and field info for Firestore models (".concat(manifest.length, " model").concat(manifest.length === 1 ? '' : 's', ")."),
|
|
5756
|
+
builder: function builder(yargs) {
|
|
5757
|
+
return yargs.positional('model', {
|
|
5758
|
+
type: 'string',
|
|
5759
|
+
describe: 'Model to inspect (modelType, identity const, or collection prefix). Omit to list every model.'
|
|
5760
|
+
}).option('json', {
|
|
5761
|
+
type: 'boolean',
|
|
5762
|
+
default: false,
|
|
5763
|
+
describe: 'Emit a structured JSON envelope instead of the human-readable table.'
|
|
5764
|
+
}).option('fields', {
|
|
5765
|
+
type: 'boolean',
|
|
5766
|
+
default: false,
|
|
5767
|
+
describe: 'Print only the field table for the resolved model.'
|
|
5768
|
+
});
|
|
5769
|
+
},
|
|
5770
|
+
handler: function handler(argv) {
|
|
5771
|
+
try {
|
|
5772
|
+
runHandler(manifest, argv);
|
|
5773
|
+
} catch (e) {
|
|
5774
|
+
outputError(e);
|
|
5775
|
+
process.exit(1);
|
|
5776
|
+
}
|
|
5777
|
+
}
|
|
5778
|
+
};
|
|
5779
|
+
}
|
|
5780
|
+
function runHandler(manifest, argv) {
|
|
5781
|
+
var query = typeof argv.model === 'string' && argv.model.length > 0 ? argv.model : undefined;
|
|
5782
|
+
if (!query) {
|
|
5783
|
+
if (argv.json) {
|
|
5784
|
+
outputResult(manifest);
|
|
5785
|
+
return;
|
|
5786
|
+
}
|
|
5787
|
+
process.stdout.write(renderModelManifestList(manifest));
|
|
5788
|
+
return;
|
|
5789
|
+
}
|
|
5790
|
+
var entry = resolveCliModel(manifest, query);
|
|
5791
|
+
if (!entry) {
|
|
5792
|
+
throw new CliError({
|
|
5793
|
+
message: "No model matches '".concat(query, "'. Run `model-info` without an argument to list available models."),
|
|
5794
|
+
code: 'MODEL_INFO_NOT_FOUND'
|
|
5795
|
+
});
|
|
5796
|
+
}
|
|
5797
|
+
if (argv.json) {
|
|
5798
|
+
outputResult(entry);
|
|
5799
|
+
return;
|
|
5800
|
+
}
|
|
5801
|
+
if (argv.fields) {
|
|
5802
|
+
process.stdout.write(renderModelManifestFields(entry));
|
|
5803
|
+
return;
|
|
5804
|
+
}
|
|
5805
|
+
process.stdout.write(renderModelManifestEntry(entry));
|
|
5806
|
+
}
|
|
5807
|
+
|
|
5317
5808
|
function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
|
|
5318
5809
|
try {
|
|
5319
5810
|
var info = gen[key](arg);
|
|
@@ -6741,6 +7232,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
6741
7232
|
* @param input.defaultEnvs - Built-in env presets shipped with the CLI.
|
|
6742
7233
|
* @param input.argv - Argv to parse. Defaults to `hideBin(process.argv)`.
|
|
6743
7234
|
* @param input.disableCallPassthrough - When `true`, omits the built-in `call` passthrough.
|
|
7235
|
+
* @param input.modelManifest - Optional Firestore model manifest. When provided, auto-wires the
|
|
7236
|
+
* built-in `model-info` command. Opt-in per app.
|
|
7237
|
+
* @param input.disableModelInfo - When `true`, suppresses the auto-wired `model-info` command even
|
|
7238
|
+
* if {@link CreateCliInput.modelManifest} is provided.
|
|
6744
7239
|
* @returns The configured yargs `Argv` ready to be `.parse()`-d.
|
|
6745
7240
|
* @__NO_SIDE_EFFECTS__
|
|
6746
7241
|
*/ function createCli(input) {
|
|
@@ -6765,6 +7260,9 @@ function _ts_generator$2(thisArg, body) {
|
|
|
6765
7260
|
cliName: cliName
|
|
6766
7261
|
})
|
|
6767
7262
|
];
|
|
7263
|
+
if (input.modelManifest && input.disableModelInfo !== true) {
|
|
7264
|
+
builtInConfigCommands.push(buildModelInfoCommand(input.modelManifest));
|
|
7265
|
+
}
|
|
6768
7266
|
var allConfigCommands = _to_consumable_array$1(builtInConfigCommands).concat(_to_consumable_array$1((_input_configCommands = input.configCommands) !== null && _input_configCommands !== void 0 ? _input_configCommands : []));
|
|
6769
7267
|
var builtInApiCommands = input.disableCallPassthrough ? [] : [
|
|
6770
7268
|
callPassthroughCommand
|
|
@@ -7222,7 +7720,8 @@ var DATA_HELP_FLAG = '--data-help';
|
|
|
7222
7720
|
var context = {
|
|
7223
7721
|
dataHelpFormat: dataHelpFormat,
|
|
7224
7722
|
helpMode: helpMode,
|
|
7225
|
-
hideOnFocus: hideOnFocus
|
|
7723
|
+
hideOnFocus: hideOnFocus,
|
|
7724
|
+
modelManifest: options === null || options === void 0 ? void 0 : options.modelManifest
|
|
7226
7725
|
};
|
|
7227
7726
|
return [
|
|
7228
7727
|
{
|
|
@@ -7386,6 +7885,7 @@ function buildEntryCommand(entry, context) {
|
|
|
7386
7885
|
var fallbackDescribe = "".concat(entry.verb).concat(specPart, " on ").concat(entry.model);
|
|
7387
7886
|
var describeOneLine = (_oneLineDescription = oneLineDescription(entry.description)) !== null && _oneLineDescription !== void 0 ? _oneLineDescription : fallbackDescribe;
|
|
7388
7887
|
var epilogue = buildEntryEpilogue(entry, context);
|
|
7888
|
+
var expandKeysAvailable = Boolean(context.modelManifest);
|
|
7389
7889
|
return {
|
|
7390
7890
|
command: action,
|
|
7391
7891
|
describe: describeOneLine,
|
|
@@ -7394,6 +7894,13 @@ function buildEntryCommand(entry, context) {
|
|
|
7394
7894
|
type: 'string',
|
|
7395
7895
|
describe: 'JSON-encoded payload (defaults to {} when omitted)'
|
|
7396
7896
|
});
|
|
7897
|
+
if (expandKeysAvailable) {
|
|
7898
|
+
y = y.option('expand-keys', {
|
|
7899
|
+
type: 'boolean',
|
|
7900
|
+
default: false,
|
|
7901
|
+
describe: "Rewrite the response payload's persisted short keys to their long-name form using the generated model manifest."
|
|
7902
|
+
});
|
|
7903
|
+
}
|
|
7397
7904
|
hideGlobalOptions(y, context.hideOnFocus);
|
|
7398
7905
|
return epilogue ? y.epilogue(epilogue) : y;
|
|
7399
7906
|
},
|
|
@@ -7411,7 +7918,10 @@ function buildEntryCommand(entry, context) {
|
|
|
7411
7918
|
]);
|
|
7412
7919
|
return [
|
|
7413
7920
|
4,
|
|
7414
|
-
callEntry(entry, typeof argv.data === 'string' ? argv.data : undefined
|
|
7921
|
+
callEntry(entry, typeof argv.data === 'string' ? argv.data : undefined, {
|
|
7922
|
+
expandKeys: expandKeysAvailable && argv.expandKeys === true,
|
|
7923
|
+
modelManifest: context.modelManifest
|
|
7924
|
+
})
|
|
7415
7925
|
];
|
|
7416
7926
|
case 1:
|
|
7417
7927
|
_state.sent();
|
|
@@ -7736,9 +8246,9 @@ function readArktypeExpression(entry) {
|
|
|
7736
8246
|
}
|
|
7737
8247
|
return result;
|
|
7738
8248
|
}
|
|
7739
|
-
function callEntry(entry, rawData) {
|
|
8249
|
+
function callEntry(entry, rawData, options) {
|
|
7740
8250
|
return _async_to_generator$1(function() {
|
|
7741
|
-
var ctx, data, params, result;
|
|
8251
|
+
var ctx, data, params, result, finalResult;
|
|
7742
8252
|
return _ts_generator$1(this, function(_state) {
|
|
7743
8253
|
switch(_state.label){
|
|
7744
8254
|
case 0:
|
|
@@ -7758,7 +8268,8 @@ function callEntry(entry, rawData) {
|
|
|
7758
8268
|
];
|
|
7759
8269
|
case 1:
|
|
7760
8270
|
result = _state.sent();
|
|
7761
|
-
|
|
8271
|
+
finalResult = options.expandKeys && options.modelManifest ? expandModelKeys(entry.model, result, options.modelManifest) : result;
|
|
8272
|
+
outputResult(finalResult);
|
|
7762
8273
|
return [
|
|
7763
8274
|
2
|
|
7764
8275
|
];
|
|
@@ -8319,6 +8830,7 @@ exports.DEFAULT_CLI_SECRET_PATTERNS = DEFAULT_CLI_SECRET_PATTERNS;
|
|
|
8319
8830
|
exports.DEFAULT_MANIFEST_HELP_DATA_FORMAT = DEFAULT_MANIFEST_HELP_DATA_FORMAT;
|
|
8320
8831
|
exports.DEFAULT_MANIFEST_HELP_MODE = DEFAULT_MANIFEST_HELP_MODE;
|
|
8321
8832
|
exports.DEFAULT_MANIFEST_MODEL_COMMAND_NAME = DEFAULT_MANIFEST_MODEL_COMMAND_NAME;
|
|
8833
|
+
exports.DEFAULT_MODEL_INFO_COMMAND_NAME = DEFAULT_MODEL_INFO_COMMAND_NAME;
|
|
8322
8834
|
exports.DUMP_MERGE_MODES = DUMP_MERGE_MODES;
|
|
8323
8835
|
exports.DUMP_OUTPUT_MODES = DUMP_OUTPUT_MODES;
|
|
8324
8836
|
exports.MODEL_WRITE_OIDC_SCOPES = MODEL_WRITE_OIDC_SCOPES;
|
|
@@ -8331,6 +8843,7 @@ exports.buildCliPaths = buildCliPaths;
|
|
|
8331
8843
|
exports.buildDumpFilePath = buildDumpFilePath;
|
|
8332
8844
|
exports.buildErrorOutput = buildErrorOutput;
|
|
8333
8845
|
exports.buildManifestCommands = buildManifestCommands;
|
|
8846
|
+
exports.buildModelInfoCommand = buildModelInfoCommand;
|
|
8334
8847
|
exports.callModelOverHttp = callModelOverHttp;
|
|
8335
8848
|
exports.callPassthroughCommand = callPassthroughCommand;
|
|
8336
8849
|
exports.configureCliErrorMapper = configureCliErrorMapper;
|
|
@@ -8353,9 +8866,11 @@ exports.detectHelpMode = detectHelpMode;
|
|
|
8353
8866
|
exports.discoverOidcMetadata = discoverOidcMetadata;
|
|
8354
8867
|
exports.dumpTimestamp = dumpTimestamp;
|
|
8355
8868
|
exports.exchangeAuthorizationCode = exchangeAuthorizationCode;
|
|
8869
|
+
exports.expandModelKeys = expandModelKeys;
|
|
8356
8870
|
exports.fetchUserInfo = fetchUserInfo;
|
|
8357
8871
|
exports.filterReadOnlyModelScopes = filterReadOnlyModelScopes;
|
|
8358
8872
|
exports.findCliEnvDefault = findCliEnvDefault;
|
|
8873
|
+
exports.findCliModelManifestEntry = findCliModelManifestEntry;
|
|
8359
8874
|
exports.generateOAuthState = generateOAuthState;
|
|
8360
8875
|
exports.generatePkceMaterial = generatePkceMaterial;
|
|
8361
8876
|
exports.getCliContext = getCliContext;
|
|
@@ -8374,8 +8889,12 @@ exports.parsePastedRedirect = parsePastedRedirect;
|
|
|
8374
8889
|
exports.pickFields = pickFields;
|
|
8375
8890
|
exports.promptLine = promptLine;
|
|
8376
8891
|
exports.refreshAccessToken = refreshAccessToken;
|
|
8892
|
+
exports.renderModelManifestEntry = renderModelManifestEntry;
|
|
8893
|
+
exports.renderModelManifestFields = renderModelManifestFields;
|
|
8894
|
+
exports.renderModelManifestList = renderModelManifestList;
|
|
8377
8895
|
exports.requireCliContext = requireCliContext;
|
|
8378
8896
|
exports.resolveActiveEnvName = resolveActiveEnvName;
|
|
8897
|
+
exports.resolveCliModel = resolveCliModel;
|
|
8379
8898
|
exports.resolveOutputConfig = resolveOutputConfig;
|
|
8380
8899
|
exports.revokeToken = revokeToken;
|
|
8381
8900
|
exports.runCli = runCli;
|