@dereekb/dbx-cli 13.11.4 → 13.11.6
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 +706 -16
- package/firebase-api-manifest/package.json +1 -1
- package/index.cjs.js +577 -48
- package/index.esm.js +570 -49
- package/manifest-extract/index.cjs.js +764 -0
- package/manifest-extract/index.esm.js +764 -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 +130 -0
- package/src/lib/runner/run.d.ts +29 -0
package/index.esm.js
CHANGED
|
@@ -9,13 +9,13 @@ import { createInterface } from 'node:readline';
|
|
|
9
9
|
import yargs from 'yargs';
|
|
10
10
|
import { hideBin } from 'yargs/helpers';
|
|
11
11
|
|
|
12
|
-
function _array_like_to_array$
|
|
12
|
+
function _array_like_to_array$7(arr, len) {
|
|
13
13
|
if (len == null || len > arr.length) len = arr.length;
|
|
14
14
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
15
15
|
return arr2;
|
|
16
16
|
}
|
|
17
|
-
function _array_without_holes$
|
|
18
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
17
|
+
function _array_without_holes$4(arr) {
|
|
18
|
+
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
19
19
|
}
|
|
20
20
|
function _assert_this_initialized(self) {
|
|
21
21
|
if (self === void 0) {
|
|
@@ -81,7 +81,7 @@ function _inherits(subClass, superClass) {
|
|
|
81
81
|
});
|
|
82
82
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
83
83
|
}
|
|
84
|
-
function _instanceof$
|
|
84
|
+
function _instanceof$6(left, right) {
|
|
85
85
|
"@swc/helpers - instanceof";
|
|
86
86
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
87
87
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -92,10 +92,10 @@ function _instanceof$5(left, right) {
|
|
|
92
92
|
function _is_native_function(fn) {
|
|
93
93
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
94
94
|
}
|
|
95
|
-
function _iterable_to_array$
|
|
95
|
+
function _iterable_to_array$4(iter) {
|
|
96
96
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
97
97
|
}
|
|
98
|
-
function _non_iterable_spread$
|
|
98
|
+
function _non_iterable_spread$4() {
|
|
99
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.");
|
|
100
100
|
}
|
|
101
101
|
function _object_spread$c(target) {
|
|
@@ -114,7 +114,7 @@ function _object_spread$c(target) {
|
|
|
114
114
|
return target;
|
|
115
115
|
}
|
|
116
116
|
function _possible_constructor_return(self, call) {
|
|
117
|
-
if (call && (_type_of$
|
|
117
|
+
if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
|
|
118
118
|
return call;
|
|
119
119
|
}
|
|
120
120
|
return _assert_this_initialized(self);
|
|
@@ -126,20 +126,20 @@ function _set_prototype_of(o, p) {
|
|
|
126
126
|
};
|
|
127
127
|
return _set_prototype_of(o, p);
|
|
128
128
|
}
|
|
129
|
-
function _to_consumable_array$
|
|
130
|
-
return _array_without_holes$
|
|
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();
|
|
131
131
|
}
|
|
132
|
-
function _type_of$
|
|
132
|
+
function _type_of$3(obj) {
|
|
133
133
|
"@swc/helpers - typeof";
|
|
134
134
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
135
135
|
}
|
|
136
|
-
function _unsupported_iterable_to_array$
|
|
136
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
137
137
|
if (!o) return;
|
|
138
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
138
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
139
139
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
140
140
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
141
141
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
142
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
142
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
143
143
|
}
|
|
144
144
|
function _wrap_native_super(Class) {
|
|
145
145
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
@@ -188,7 +188,7 @@ function _is_native_reflect_construct() {
|
|
|
188
188
|
/id_token[=:]\s*\S+/gi
|
|
189
189
|
];
|
|
190
190
|
var _outputOptions = {};
|
|
191
|
-
var _secretPatterns = _to_consumable_array$
|
|
191
|
+
var _secretPatterns = _to_consumable_array$4(DEFAULT_CLI_SECRET_PATTERNS);
|
|
192
192
|
var _errorMapper;
|
|
193
193
|
/**
|
|
194
194
|
* Configures output options from parsed CLI arguments.
|
|
@@ -317,13 +317,13 @@ function dumpResponse(data, meta) {
|
|
|
317
317
|
return pickFromObject(item, fields);
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$
|
|
320
|
+
if (data != null && (typeof data === "undefined" ? "undefined" : _type_of$3(data)) === 'object') {
|
|
321
321
|
return pickFromObject(data, fields);
|
|
322
322
|
}
|
|
323
323
|
return data;
|
|
324
324
|
}
|
|
325
325
|
function pickFromObject(obj, fields) {
|
|
326
|
-
if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$
|
|
326
|
+
if (obj == null || (typeof obj === "undefined" ? "undefined" : _type_of$3(obj)) !== 'object') {
|
|
327
327
|
return obj;
|
|
328
328
|
}
|
|
329
329
|
var result = {};
|
|
@@ -418,7 +418,7 @@ function pickFromObject(obj, fields) {
|
|
|
418
418
|
return mapped;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
if (_instanceof$
|
|
421
|
+
if (_instanceof$6(error, CliError)) {
|
|
422
422
|
return _object_spread$c({
|
|
423
423
|
ok: false,
|
|
424
424
|
error: sanitizeString(error.message),
|
|
@@ -427,7 +427,7 @@ function pickFromObject(obj, fields) {
|
|
|
427
427
|
suggestion: error.suggestion
|
|
428
428
|
} : {});
|
|
429
429
|
}
|
|
430
|
-
if (_instanceof$
|
|
430
|
+
if (_instanceof$6(error, Error)) {
|
|
431
431
|
return {
|
|
432
432
|
ok: false,
|
|
433
433
|
error: sanitizeString(error.message),
|
|
@@ -470,7 +470,7 @@ function _async_to_generator$f(fn) {
|
|
|
470
470
|
});
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
|
-
function _type_of$
|
|
473
|
+
function _type_of$2(obj) {
|
|
474
474
|
"@swc/helpers - typeof";
|
|
475
475
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
476
476
|
}
|
|
@@ -624,7 +624,7 @@ var CALL_MODEL_API_PATH = "/model/call";
|
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
if (!res.ok) {
|
|
627
|
-
bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$
|
|
627
|
+
bodyMessage = (typeof body === "undefined" ? "undefined" : _type_of$2(body)) === 'object' && body && 'message' in body ? body.message : undefined;
|
|
628
628
|
messageString = typeof bodyMessage === 'string' ? bodyMessage : undefined;
|
|
629
629
|
message = messageString !== null && messageString !== void 0 ? messageString : text || "".concat(res.status, " ").concat(res.statusText);
|
|
630
630
|
throw new CliError({
|
|
@@ -1131,7 +1131,7 @@ function _define_property$a(obj, key, value) {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
return obj;
|
|
1133
1133
|
}
|
|
1134
|
-
function _instanceof$
|
|
1134
|
+
function _instanceof$5(left, right) {
|
|
1135
1135
|
"@swc/helpers - instanceof";
|
|
1136
1136
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
1137
1137
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -1302,7 +1302,7 @@ function _ts_generator$d(thisArg, body) {
|
|
|
1302
1302
|
data = JSON.parse(argv.data);
|
|
1303
1303
|
} catch (e) {
|
|
1304
1304
|
throw new CliError({
|
|
1305
|
-
message: "--data must be valid JSON: ".concat(_instanceof$
|
|
1305
|
+
message: "--data must be valid JSON: ".concat(_instanceof$5(e, Error) ? e.message : String(e)),
|
|
1306
1306
|
code: 'INVALID_DATA_JSON'
|
|
1307
1307
|
});
|
|
1308
1308
|
}
|
|
@@ -1344,6 +1344,201 @@ function _ts_generator$d(thisArg, body) {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
};
|
|
1346
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
|
+
|
|
1347
1542
|
function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1348
1543
|
try {
|
|
1349
1544
|
var info = gen[key](arg);
|
|
@@ -2349,7 +2544,7 @@ function trimSlash(url) {
|
|
|
2349
2544
|
return url.endsWith('/') ? url.slice(0, -1) : url;
|
|
2350
2545
|
}
|
|
2351
2546
|
|
|
2352
|
-
function _array_like_to_array$
|
|
2547
|
+
function _array_like_to_array$5(arr, len) {
|
|
2353
2548
|
if (len == null || len > arr.length) len = arr.length;
|
|
2354
2549
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2355
2550
|
return arr2;
|
|
@@ -2414,15 +2609,15 @@ function _non_iterable_rest$2() {
|
|
|
2414
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.");
|
|
2415
2610
|
}
|
|
2416
2611
|
function _sliced_to_array$2(arr, i) {
|
|
2417
|
-
return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$
|
|
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();
|
|
2418
2613
|
}
|
|
2419
|
-
function _unsupported_iterable_to_array$
|
|
2614
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
2420
2615
|
if (!o) return;
|
|
2421
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
2616
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
2422
2617
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2423
2618
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2424
2619
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2425
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
2620
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
2426
2621
|
}
|
|
2427
2622
|
function _ts_generator$a(thisArg, body) {
|
|
2428
2623
|
var f, y, t, _ = {
|
|
@@ -3918,13 +4113,13 @@ function maskEnv$1(env) {
|
|
|
3918
4113
|
};
|
|
3919
4114
|
}
|
|
3920
4115
|
|
|
3921
|
-
function _array_like_to_array$
|
|
4116
|
+
function _array_like_to_array$4(arr, len) {
|
|
3922
4117
|
if (len == null || len > arr.length) len = arr.length;
|
|
3923
4118
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3924
4119
|
return arr2;
|
|
3925
4120
|
}
|
|
3926
|
-
function _array_without_holes$
|
|
3927
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
4121
|
+
function _array_without_holes$3(arr) {
|
|
4122
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
3928
4123
|
}
|
|
3929
4124
|
function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3930
4125
|
try {
|
|
@@ -3976,10 +4171,10 @@ function _instanceof$2(left, right) {
|
|
|
3976
4171
|
return left instanceof right;
|
|
3977
4172
|
}
|
|
3978
4173
|
}
|
|
3979
|
-
function _iterable_to_array$
|
|
4174
|
+
function _iterable_to_array$3(iter) {
|
|
3980
4175
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3981
4176
|
}
|
|
3982
|
-
function _non_iterable_spread$
|
|
4177
|
+
function _non_iterable_spread$3() {
|
|
3983
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.");
|
|
3984
4179
|
}
|
|
3985
4180
|
function _object_spread$6(target) {
|
|
@@ -3997,16 +4192,16 @@ function _object_spread$6(target) {
|
|
|
3997
4192
|
}
|
|
3998
4193
|
return target;
|
|
3999
4194
|
}
|
|
4000
|
-
function _to_consumable_array$
|
|
4001
|
-
return _array_without_holes$
|
|
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();
|
|
4002
4197
|
}
|
|
4003
|
-
function _unsupported_iterable_to_array$
|
|
4198
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
4004
4199
|
if (!o) return;
|
|
4005
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
4200
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
4006
4201
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4007
4202
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4008
4203
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
4009
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
4204
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
4010
4205
|
}
|
|
4011
4206
|
function _ts_generator$8(thisArg, body) {
|
|
4012
4207
|
var f, y, t, _ = {
|
|
@@ -4448,7 +4643,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
4448
4643
|
*/ function createDoctorCommand(input) {
|
|
4449
4644
|
var _input_checks;
|
|
4450
4645
|
var cliName = input.cliName;
|
|
4451
|
-
var checks = _to_consumable_array$
|
|
4646
|
+
var checks = _to_consumable_array$3(defaultDoctorChecks()).concat(_to_consumable_array$3((_input_checks = input.checks) !== null && _input_checks !== void 0 ? _input_checks : []));
|
|
4452
4647
|
var defaultEnvs = input.defaultEnvs;
|
|
4453
4648
|
return {
|
|
4454
4649
|
command: 'doctor',
|
|
@@ -4615,7 +4810,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
4615
4810
|
};
|
|
4616
4811
|
}
|
|
4617
4812
|
|
|
4618
|
-
function _array_like_to_array$
|
|
4813
|
+
function _array_like_to_array$3(arr, len) {
|
|
4619
4814
|
if (len == null || len > arr.length) len = arr.length;
|
|
4620
4815
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4621
4816
|
return arr2;
|
|
@@ -4735,15 +4930,15 @@ function _object_spread_props$4(target, source) {
|
|
|
4735
4930
|
return target;
|
|
4736
4931
|
}
|
|
4737
4932
|
function _sliced_to_array$1(arr, i) {
|
|
4738
|
-
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$
|
|
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();
|
|
4739
4934
|
}
|
|
4740
|
-
function _unsupported_iterable_to_array$
|
|
4935
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
4741
4936
|
if (!o) return;
|
|
4742
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
4937
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
4743
4938
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4744
4939
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4745
4940
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
4746
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
4941
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
4747
4942
|
}
|
|
4748
4943
|
function _ts_generator$7(thisArg, body) {
|
|
4749
4944
|
var f, y, t, _ = {
|
|
@@ -5312,6 +5507,312 @@ function resolveEnvWithDefault(input) {
|
|
|
5312
5507
|
};
|
|
5313
5508
|
}
|
|
5314
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 includeConverter = fields.some(function(f) {
|
|
5618
|
+
return f.converter !== undefined;
|
|
5619
|
+
});
|
|
5620
|
+
var header = includeConverter ? [
|
|
5621
|
+
'NAME',
|
|
5622
|
+
'LONG NAME',
|
|
5623
|
+
'TYPE',
|
|
5624
|
+
'OPTIONAL',
|
|
5625
|
+
'CONVERTER'
|
|
5626
|
+
] : [
|
|
5627
|
+
'NAME',
|
|
5628
|
+
'LONG NAME',
|
|
5629
|
+
'TYPE',
|
|
5630
|
+
'OPTIONAL'
|
|
5631
|
+
];
|
|
5632
|
+
var rows = [
|
|
5633
|
+
header
|
|
5634
|
+
];
|
|
5635
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5636
|
+
try {
|
|
5637
|
+
for(var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5638
|
+
var field = _step.value;
|
|
5639
|
+
var _field_tsType;
|
|
5640
|
+
var row = [
|
|
5641
|
+
field.name,
|
|
5642
|
+
field.longName,
|
|
5643
|
+
(_field_tsType = field.tsType) !== null && _field_tsType !== void 0 ? _field_tsType : '',
|
|
5644
|
+
field.optional ? 'yes' : 'no'
|
|
5645
|
+
];
|
|
5646
|
+
if (includeConverter) row.push(field.converter ? truncate(field.converter, 60) : '');
|
|
5647
|
+
rows.push(row);
|
|
5648
|
+
}
|
|
5649
|
+
} catch (err) {
|
|
5650
|
+
_didIteratorError = true;
|
|
5651
|
+
_iteratorError = err;
|
|
5652
|
+
} finally{
|
|
5653
|
+
try {
|
|
5654
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5655
|
+
_iterator.return();
|
|
5656
|
+
}
|
|
5657
|
+
} finally{
|
|
5658
|
+
if (_didIteratorError) {
|
|
5659
|
+
throw _iteratorError;
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
}
|
|
5663
|
+
out.push(indentLines$1(renderTable(rows), indent));
|
|
5664
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
5665
|
+
try {
|
|
5666
|
+
for(var _iterator1 = fields[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
5667
|
+
var field1 = _step1.value;
|
|
5668
|
+
if (field1.nestedFields && field1.nestedFields.length > 0) {
|
|
5669
|
+
var label = field1.nestedIsArray ? 'array element' : 'sub-object';
|
|
5670
|
+
out.push(indentLines$1("↳ ".concat(field1.name, " (").concat(label, ", ").concat(field1.nestedFields.length, " field").concat(field1.nestedFields.length === 1 ? '' : 's', ")"), indent + 2));
|
|
5671
|
+
out.push(renderFieldsTree(field1.nestedFields, indent + 4));
|
|
5672
|
+
}
|
|
5673
|
+
}
|
|
5674
|
+
} catch (err) {
|
|
5675
|
+
_didIteratorError1 = true;
|
|
5676
|
+
_iteratorError1 = err;
|
|
5677
|
+
} finally{
|
|
5678
|
+
try {
|
|
5679
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
5680
|
+
_iterator1.return();
|
|
5681
|
+
}
|
|
5682
|
+
} finally{
|
|
5683
|
+
if (_didIteratorError1) {
|
|
5684
|
+
throw _iteratorError1;
|
|
5685
|
+
}
|
|
5686
|
+
}
|
|
5687
|
+
}
|
|
5688
|
+
return out.join('\n');
|
|
5689
|
+
}
|
|
5690
|
+
function renderTable(rows) {
|
|
5691
|
+
if (rows.length === 0) return '';
|
|
5692
|
+
var widths = [];
|
|
5693
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5694
|
+
try {
|
|
5695
|
+
for(var _iterator = rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5696
|
+
var row = _step.value;
|
|
5697
|
+
row.forEach(function(cell, i) {
|
|
5698
|
+
var _widths_i;
|
|
5699
|
+
var cellWidth = cell.length;
|
|
5700
|
+
widths[i] = Math.max((_widths_i = widths[i]) !== null && _widths_i !== void 0 ? _widths_i : 0, cellWidth);
|
|
5701
|
+
});
|
|
5702
|
+
}
|
|
5703
|
+
} catch (err) {
|
|
5704
|
+
_didIteratorError = true;
|
|
5705
|
+
_iteratorError = err;
|
|
5706
|
+
} finally{
|
|
5707
|
+
try {
|
|
5708
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5709
|
+
_iterator.return();
|
|
5710
|
+
}
|
|
5711
|
+
} finally{
|
|
5712
|
+
if (_didIteratorError) {
|
|
5713
|
+
throw _iteratorError;
|
|
5714
|
+
}
|
|
5715
|
+
}
|
|
5716
|
+
}
|
|
5717
|
+
return rows.map(function(row) {
|
|
5718
|
+
return row.map(function(cell, i) {
|
|
5719
|
+
var _widths_i;
|
|
5720
|
+
return i === row.length - 1 ? cell : cell.padEnd((_widths_i = widths[i]) !== null && _widths_i !== void 0 ? _widths_i : 0);
|
|
5721
|
+
}).join(' ').replace(/\s+$/, '');
|
|
5722
|
+
}).join('\n');
|
|
5723
|
+
}
|
|
5724
|
+
function truncate(text, max) {
|
|
5725
|
+
if (text.length <= max) return text;
|
|
5726
|
+
return text.slice(0, max - 1) + '…';
|
|
5727
|
+
}
|
|
5728
|
+
function indentLines$1(text, indent) {
|
|
5729
|
+
if (indent <= 0) return text;
|
|
5730
|
+
var pad = ' '.repeat(indent);
|
|
5731
|
+
return text.split('\n').map(function(line) {
|
|
5732
|
+
return line.length > 0 ? pad + line : line;
|
|
5733
|
+
}).join('\n');
|
|
5734
|
+
}
|
|
5735
|
+
|
|
5736
|
+
/**
|
|
5737
|
+
* Default command name for the model-info command. Top-level so it stays out
|
|
5738
|
+
* of the API-call namespace owned by `model <model> <action>`.
|
|
5739
|
+
*/ var DEFAULT_MODEL_INFO_COMMAND_NAME = 'model-info';
|
|
5740
|
+
/**
|
|
5741
|
+
* Builds the top-level `model-info [model]` command.
|
|
5742
|
+
*
|
|
5743
|
+
* Without an argument: prints a column-aligned table summarising every model
|
|
5744
|
+
* in the manifest. With an argument: looks the model up by `modelType`,
|
|
5745
|
+
* `identityConst`, or `collectionPrefix` and prints its full per-field
|
|
5746
|
+
* documentation, recursing into nested converters when the manifest captured
|
|
5747
|
+
* them.
|
|
5748
|
+
*
|
|
5749
|
+
* Flags:
|
|
5750
|
+
* - `--json` emits a structured `{ ok, data }` envelope instead of the
|
|
5751
|
+
* human-readable table (useful for scripting or LLM agents).
|
|
5752
|
+
* - `--fields` prints only the field table for the resolved model.
|
|
5753
|
+
*
|
|
5754
|
+
* @param manifest - The generated model manifest (e.g. `DEMO_CLI_MODEL_MANIFEST`).
|
|
5755
|
+
* @param options - Optional overrides; see {@link BuildModelInfoCommandOptions}.
|
|
5756
|
+
* @returns A yargs `CommandModule` ready to be passed to `runCli({ configCommands })`.
|
|
5757
|
+
* @__NO_SIDE_EFFECTS__
|
|
5758
|
+
*/ function buildModelInfoCommand(manifest, options) {
|
|
5759
|
+
var _ref;
|
|
5760
|
+
var commandName = (_ref = options === null || options === void 0 ? void 0 : options.commandName) !== null && _ref !== void 0 ? _ref : DEFAULT_MODEL_INFO_COMMAND_NAME;
|
|
5761
|
+
return {
|
|
5762
|
+
command: "".concat(commandName, " [model]"),
|
|
5763
|
+
describe: "Show generated catalog and field info for Firestore models (".concat(manifest.length, " model").concat(manifest.length === 1 ? '' : 's', ")."),
|
|
5764
|
+
builder: function builder(yargs) {
|
|
5765
|
+
return yargs.positional('model', {
|
|
5766
|
+
type: 'string',
|
|
5767
|
+
describe: 'Model to inspect (modelType, identity const, or collection prefix). Omit to list every model.'
|
|
5768
|
+
}).option('json', {
|
|
5769
|
+
type: 'boolean',
|
|
5770
|
+
default: false,
|
|
5771
|
+
describe: 'Emit a structured JSON envelope instead of the human-readable table.'
|
|
5772
|
+
}).option('fields', {
|
|
5773
|
+
type: 'boolean',
|
|
5774
|
+
default: false,
|
|
5775
|
+
describe: 'Print only the field table for the resolved model.'
|
|
5776
|
+
});
|
|
5777
|
+
},
|
|
5778
|
+
handler: function handler(argv) {
|
|
5779
|
+
try {
|
|
5780
|
+
runHandler(manifest, argv);
|
|
5781
|
+
} catch (e) {
|
|
5782
|
+
outputError(e);
|
|
5783
|
+
process.exit(1);
|
|
5784
|
+
}
|
|
5785
|
+
}
|
|
5786
|
+
};
|
|
5787
|
+
}
|
|
5788
|
+
function runHandler(manifest, argv) {
|
|
5789
|
+
var query = typeof argv.model === 'string' && argv.model.length > 0 ? argv.model : undefined;
|
|
5790
|
+
if (!query) {
|
|
5791
|
+
if (argv.json) {
|
|
5792
|
+
outputResult(manifest);
|
|
5793
|
+
return;
|
|
5794
|
+
}
|
|
5795
|
+
process.stdout.write(renderModelManifestList(manifest));
|
|
5796
|
+
return;
|
|
5797
|
+
}
|
|
5798
|
+
var entry = resolveCliModel(manifest, query);
|
|
5799
|
+
if (!entry) {
|
|
5800
|
+
throw new CliError({
|
|
5801
|
+
message: "No model matches '".concat(query, "'. Run `model-info` without an argument to list available models."),
|
|
5802
|
+
code: 'MODEL_INFO_NOT_FOUND'
|
|
5803
|
+
});
|
|
5804
|
+
}
|
|
5805
|
+
if (argv.json) {
|
|
5806
|
+
outputResult(entry);
|
|
5807
|
+
return;
|
|
5808
|
+
}
|
|
5809
|
+
if (argv.fields) {
|
|
5810
|
+
process.stdout.write(renderModelManifestFields(entry));
|
|
5811
|
+
return;
|
|
5812
|
+
}
|
|
5813
|
+
process.stdout.write(renderModelManifestEntry(entry));
|
|
5814
|
+
}
|
|
5815
|
+
|
|
5315
5816
|
function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
|
|
5316
5817
|
try {
|
|
5317
5818
|
var info = gen[key](arg);
|
|
@@ -6739,6 +7240,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
6739
7240
|
* @param input.defaultEnvs - Built-in env presets shipped with the CLI.
|
|
6740
7241
|
* @param input.argv - Argv to parse. Defaults to `hideBin(process.argv)`.
|
|
6741
7242
|
* @param input.disableCallPassthrough - When `true`, omits the built-in `call` passthrough.
|
|
7243
|
+
* @param input.modelManifest - Optional Firestore model manifest. When provided, auto-wires the
|
|
7244
|
+
* built-in `model-info` command. Opt-in per app.
|
|
7245
|
+
* @param input.disableModelInfo - When `true`, suppresses the auto-wired `model-info` command even
|
|
7246
|
+
* if {@link CreateCliInput.modelManifest} is provided.
|
|
6742
7247
|
* @returns The configured yargs `Argv` ready to be `.parse()`-d.
|
|
6743
7248
|
* @__NO_SIDE_EFFECTS__
|
|
6744
7249
|
*/ function createCli(input) {
|
|
@@ -6763,6 +7268,9 @@ function _ts_generator$2(thisArg, body) {
|
|
|
6763
7268
|
cliName: cliName
|
|
6764
7269
|
})
|
|
6765
7270
|
];
|
|
7271
|
+
if (input.modelManifest && input.disableModelInfo !== true) {
|
|
7272
|
+
builtInConfigCommands.push(buildModelInfoCommand(input.modelManifest));
|
|
7273
|
+
}
|
|
6766
7274
|
var allConfigCommands = _to_consumable_array$1(builtInConfigCommands).concat(_to_consumable_array$1((_input_configCommands = input.configCommands) !== null && _input_configCommands !== void 0 ? _input_configCommands : []));
|
|
6767
7275
|
var builtInApiCommands = input.disableCallPassthrough ? [] : [
|
|
6768
7276
|
callPassthroughCommand
|
|
@@ -7220,7 +7728,8 @@ var DATA_HELP_FLAG = '--data-help';
|
|
|
7220
7728
|
var context = {
|
|
7221
7729
|
dataHelpFormat: dataHelpFormat,
|
|
7222
7730
|
helpMode: helpMode,
|
|
7223
|
-
hideOnFocus: hideOnFocus
|
|
7731
|
+
hideOnFocus: hideOnFocus,
|
|
7732
|
+
modelManifest: options === null || options === void 0 ? void 0 : options.modelManifest
|
|
7224
7733
|
};
|
|
7225
7734
|
return [
|
|
7226
7735
|
{
|
|
@@ -7384,6 +7893,7 @@ function buildEntryCommand(entry, context) {
|
|
|
7384
7893
|
var fallbackDescribe = "".concat(entry.verb).concat(specPart, " on ").concat(entry.model);
|
|
7385
7894
|
var describeOneLine = (_oneLineDescription = oneLineDescription(entry.description)) !== null && _oneLineDescription !== void 0 ? _oneLineDescription : fallbackDescribe;
|
|
7386
7895
|
var epilogue = buildEntryEpilogue(entry, context);
|
|
7896
|
+
var expandKeysAvailable = Boolean(context.modelManifest);
|
|
7387
7897
|
return {
|
|
7388
7898
|
command: action,
|
|
7389
7899
|
describe: describeOneLine,
|
|
@@ -7392,6 +7902,13 @@ function buildEntryCommand(entry, context) {
|
|
|
7392
7902
|
type: 'string',
|
|
7393
7903
|
describe: 'JSON-encoded payload (defaults to {} when omitted)'
|
|
7394
7904
|
});
|
|
7905
|
+
if (expandKeysAvailable) {
|
|
7906
|
+
y = y.option('expand-keys', {
|
|
7907
|
+
type: 'boolean',
|
|
7908
|
+
default: false,
|
|
7909
|
+
describe: "Rewrite the response payload's persisted short keys to their long-name form using the generated model manifest."
|
|
7910
|
+
});
|
|
7911
|
+
}
|
|
7395
7912
|
hideGlobalOptions(y, context.hideOnFocus);
|
|
7396
7913
|
return epilogue ? y.epilogue(epilogue) : y;
|
|
7397
7914
|
},
|
|
@@ -7409,7 +7926,10 @@ function buildEntryCommand(entry, context) {
|
|
|
7409
7926
|
]);
|
|
7410
7927
|
return [
|
|
7411
7928
|
4,
|
|
7412
|
-
callEntry(entry, typeof argv.data === 'string' ? argv.data : undefined
|
|
7929
|
+
callEntry(entry, typeof argv.data === 'string' ? argv.data : undefined, {
|
|
7930
|
+
expandKeys: expandKeysAvailable && argv.expandKeys === true,
|
|
7931
|
+
modelManifest: context.modelManifest
|
|
7932
|
+
})
|
|
7413
7933
|
];
|
|
7414
7934
|
case 1:
|
|
7415
7935
|
_state.sent();
|
|
@@ -7734,9 +8254,9 @@ function readArktypeExpression(entry) {
|
|
|
7734
8254
|
}
|
|
7735
8255
|
return result;
|
|
7736
8256
|
}
|
|
7737
|
-
function callEntry(entry, rawData) {
|
|
8257
|
+
function callEntry(entry, rawData, options) {
|
|
7738
8258
|
return _async_to_generator$1(function() {
|
|
7739
|
-
var ctx, data, params, result;
|
|
8259
|
+
var ctx, data, params, result, finalResult;
|
|
7740
8260
|
return _ts_generator$1(this, function(_state) {
|
|
7741
8261
|
switch(_state.label){
|
|
7742
8262
|
case 0:
|
|
@@ -7756,7 +8276,8 @@ function callEntry(entry, rawData) {
|
|
|
7756
8276
|
];
|
|
7757
8277
|
case 1:
|
|
7758
8278
|
result = _state.sent();
|
|
7759
|
-
|
|
8279
|
+
finalResult = options.expandKeys && options.modelManifest ? expandModelKeys(entry.model, result, options.modelManifest) : result;
|
|
8280
|
+
outputResult(finalResult);
|
|
7760
8281
|
return [
|
|
7761
8282
|
2
|
|
7762
8283
|
];
|
|
@@ -8306,4 +8827,4 @@ function printPaginatedOutput(input) {
|
|
|
8306
8827
|
})();
|
|
8307
8828
|
}
|
|
8308
8829
|
|
|
8309
|
-
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 };
|
|
8830
|
+
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 };
|