@dereekb/dbx-cli 13.11.13 → 13.11.15
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 +345 -255
- package/firebase-api-manifest/package.json +1 -1
- package/index.cjs.js +1102 -933
- package/index.esm.js +1100 -931
- package/lint-cache/main.js +655 -0
- package/lint-cache/package.json +12 -0
- package/manifest-extract/index.cjs.js +152 -125
- package/manifest-extract/index.esm.js +152 -125
- package/manifest-extract/package.json +1 -1
- package/manifest-extract/src/lib/extract-crud.d.ts +2 -2
- package/manifest-extract/src/lib/extract-models.d.ts +2 -2
- package/package.json +12 -7
- package/src/lib/action/iterate.d.ts +3 -4
- package/src/lib/api/call.passthrough.command.d.ts +1 -1
- package/src/lib/api/expand-keys.d.ts +9 -7
- package/src/lib/api/get-args.helper.d.ts +6 -0
- package/src/lib/api/get-many.command.d.ts +1 -1
- package/src/lib/api/get.command.d.ts +1 -1
- package/src/lib/auth/oidc.flow.d.ts +3 -0
- package/src/lib/manifest/build-manifest-commands.d.ts +4 -2
- package/src/lib/manifest/build-model-decode-command.d.ts +5 -2
- package/src/lib/manifest/model-info-utils.d.ts +13 -9
- package/src/lib/middleware/auth.middleware.d.ts +3 -2
- package/test/package.json +9 -9
|
@@ -12,8 +12,8 @@ var SUPPORTED_VERBS = new Set([
|
|
|
12
12
|
* callable leaf (CRUD or standalone). Best-effort: malformed configs return
|
|
13
13
|
* fewer entries rather than throwing.
|
|
14
14
|
*
|
|
15
|
-
* @param source -
|
|
16
|
-
* @returns
|
|
15
|
+
* @param source - In-memory source name + text pair to extract.
|
|
16
|
+
* @returns The CRUD extraction with group name, model keys, entries, and
|
|
17
17
|
* `*Functions` class name (when present).
|
|
18
18
|
*/ // eslint-disable-next-line sonarjs/cognitive-complexity
|
|
19
19
|
function extractCrudEntries(source) {
|
|
@@ -31,17 +31,18 @@ function extractCrudEntries(source) {
|
|
|
31
31
|
var functionsClassName = findFunctionsClassName(sourceFile);
|
|
32
32
|
var typeDocsCache = new Map();
|
|
33
33
|
var resolveTypeDocs = function resolveTypeDocs(typeName) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
var result;
|
|
35
|
+
if (typeName) {
|
|
36
|
+
if (typeDocsCache.has(typeName)) {
|
|
37
|
+
result = typeDocsCache.get(typeName);
|
|
38
|
+
} else {
|
|
39
|
+
result = readTypeDocs(sourceFile, typeName);
|
|
40
|
+
if (result) {
|
|
41
|
+
typeDocsCache.set(typeName, result);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
43
44
|
}
|
|
44
|
-
return
|
|
45
|
+
return result;
|
|
45
46
|
};
|
|
46
47
|
if (crudConfigType) {
|
|
47
48
|
var literal = crudConfigType.getTypeNode();
|
|
@@ -174,12 +175,14 @@ function extractCrudEntries(source) {
|
|
|
174
175
|
};
|
|
175
176
|
}
|
|
176
177
|
function findTypeAliasByEnding(sourceFile, ending) {
|
|
178
|
+
var result;
|
|
177
179
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
178
180
|
try {
|
|
179
181
|
for(var _iterator = sourceFile.getTypeAliases()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
180
182
|
var alias = _step.value;
|
|
181
183
|
if (alias.getName().endsWith(ending) && alias.getTypeNode()) {
|
|
182
|
-
|
|
184
|
+
result = alias;
|
|
185
|
+
break;
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
} catch (err) {
|
|
@@ -196,9 +199,10 @@ function findTypeAliasByEnding(sourceFile, ending) {
|
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
201
|
}
|
|
199
|
-
return
|
|
202
|
+
return result;
|
|
200
203
|
}
|
|
201
204
|
function findFunctionsClassName(sourceFile) {
|
|
205
|
+
var result;
|
|
202
206
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
203
207
|
try {
|
|
204
208
|
for(var _iterator = sourceFile.getClasses()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -208,7 +212,8 @@ function findFunctionsClassName(sourceFile) {
|
|
|
208
212
|
}
|
|
209
213
|
var name = cls.getName();
|
|
210
214
|
if (name === null || name === void 0 ? void 0 : name.endsWith('Functions')) {
|
|
211
|
-
|
|
215
|
+
result = name;
|
|
216
|
+
break;
|
|
212
217
|
}
|
|
213
218
|
}
|
|
214
219
|
} catch (err) {
|
|
@@ -225,9 +230,10 @@ function findFunctionsClassName(sourceFile) {
|
|
|
225
230
|
}
|
|
226
231
|
}
|
|
227
232
|
}
|
|
228
|
-
return
|
|
233
|
+
return result;
|
|
229
234
|
}
|
|
230
235
|
function inferGroupName(sourceFile) {
|
|
236
|
+
var result;
|
|
231
237
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
232
238
|
try {
|
|
233
239
|
for(var _iterator = sourceFile.getTypeAliases()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -236,7 +242,8 @@ function inferGroupName(sourceFile) {
|
|
|
236
242
|
if (name.endsWith('ModelCrudFunctionsConfig')) {
|
|
237
243
|
var stem = name.slice(0, -'ModelCrudFunctionsConfig'.length);
|
|
238
244
|
if (stem.length > 0) {
|
|
239
|
-
|
|
245
|
+
result = stem;
|
|
246
|
+
break;
|
|
240
247
|
}
|
|
241
248
|
}
|
|
242
249
|
}
|
|
@@ -254,42 +261,46 @@ function inferGroupName(sourceFile) {
|
|
|
254
261
|
}
|
|
255
262
|
}
|
|
256
263
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
for(var _iterator1 = sourceFile.getTypeAliases()[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
260
|
-
var alias1 = _step1.value;
|
|
261
|
-
var name1 = alias1.getName();
|
|
262
|
-
if (name1.endsWith('FunctionTypeMap')) {
|
|
263
|
-
var stem1 = name1.slice(0, -'FunctionTypeMap'.length);
|
|
264
|
-
if (stem1.length > 0) {
|
|
265
|
-
return stem1;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
} catch (err) {
|
|
270
|
-
_didIteratorError1 = true;
|
|
271
|
-
_iteratorError1 = err;
|
|
272
|
-
} finally{
|
|
264
|
+
if (result === undefined) {
|
|
265
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
273
266
|
try {
|
|
274
|
-
|
|
275
|
-
|
|
267
|
+
for(var _iterator1 = sourceFile.getTypeAliases()[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
268
|
+
var alias1 = _step1.value;
|
|
269
|
+
var name1 = alias1.getName();
|
|
270
|
+
if (name1.endsWith('FunctionTypeMap')) {
|
|
271
|
+
var stem1 = name1.slice(0, -'FunctionTypeMap'.length);
|
|
272
|
+
if (stem1.length > 0) {
|
|
273
|
+
result = stem1;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
276
277
|
}
|
|
278
|
+
} catch (err) {
|
|
279
|
+
_didIteratorError1 = true;
|
|
280
|
+
_iteratorError1 = err;
|
|
277
281
|
} finally{
|
|
278
|
-
|
|
279
|
-
|
|
282
|
+
try {
|
|
283
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
284
|
+
_iterator1.return();
|
|
285
|
+
}
|
|
286
|
+
} finally{
|
|
287
|
+
if (_didIteratorError1) {
|
|
288
|
+
throw _iteratorError1;
|
|
289
|
+
}
|
|
280
290
|
}
|
|
281
291
|
}
|
|
282
292
|
}
|
|
283
|
-
return
|
|
293
|
+
return result;
|
|
284
294
|
}
|
|
285
295
|
function isNullLiteralType(node) {
|
|
296
|
+
var result = false;
|
|
286
297
|
if (Node.isLiteralTypeNode(node)) {
|
|
287
298
|
var literal = node.getLiteral();
|
|
288
299
|
if (Node.isNullLiteral(literal)) {
|
|
289
|
-
|
|
300
|
+
result = true;
|
|
290
301
|
}
|
|
291
302
|
}
|
|
292
|
-
return
|
|
303
|
+
return result;
|
|
293
304
|
}
|
|
294
305
|
function collectVerbEntries(input) {
|
|
295
306
|
var _readTupleParamsResult;
|
|
@@ -356,39 +367,40 @@ function collectVerbEntries(input) {
|
|
|
356
367
|
});
|
|
357
368
|
}
|
|
358
369
|
function readTupleParamsResult(node) {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
370
|
+
var pair;
|
|
371
|
+
if (Node.isTupleTypeNode(node)) {
|
|
372
|
+
var elements = node.getElements();
|
|
373
|
+
if (elements.length > 0) {
|
|
374
|
+
var params = elements[0] ? typeNodeName(elements[0]) : undefined;
|
|
375
|
+
var result = elements[1] ? typeNodeName(elements[1]) : undefined;
|
|
376
|
+
pair = {
|
|
377
|
+
params: params,
|
|
378
|
+
result: result
|
|
379
|
+
};
|
|
380
|
+
}
|
|
365
381
|
}
|
|
366
|
-
|
|
367
|
-
var result = elements[1] ? typeNodeName(elements[1]) : undefined;
|
|
368
|
-
return {
|
|
369
|
-
params: params,
|
|
370
|
-
result: result
|
|
371
|
-
};
|
|
382
|
+
return pair;
|
|
372
383
|
}
|
|
373
384
|
function readBareParams(node) {
|
|
374
385
|
var params = typeNodeName(node);
|
|
375
|
-
|
|
376
|
-
return undefined;
|
|
377
|
-
}
|
|
378
|
-
return {
|
|
386
|
+
return params ? {
|
|
379
387
|
params: params,
|
|
380
388
|
result: undefined
|
|
381
|
-
};
|
|
389
|
+
} : undefined;
|
|
382
390
|
}
|
|
383
391
|
function typeNodeName(node) {
|
|
392
|
+
var result;
|
|
384
393
|
if (Node.isTypeReference(node)) {
|
|
385
|
-
|
|
394
|
+
result = node.getTypeName().getText();
|
|
395
|
+
} else {
|
|
396
|
+
// Fall back to the raw text for primitive / inline types like `boolean`.
|
|
397
|
+
var text = node.getText().trim();
|
|
398
|
+
result = text.length > 0 ? text : undefined;
|
|
386
399
|
}
|
|
387
|
-
|
|
388
|
-
var text = node.getText().trim();
|
|
389
|
-
return text.length > 0 ? text : undefined;
|
|
400
|
+
return result;
|
|
390
401
|
}
|
|
391
402
|
function readTypeDocs(sourceFile, typeName) {
|
|
403
|
+
var result;
|
|
392
404
|
var interfaceDecl = sourceFile.getInterface(typeName);
|
|
393
405
|
if (interfaceDecl) {
|
|
394
406
|
var typeDescription = readJsDocSummary(interfaceDecl);
|
|
@@ -426,31 +438,36 @@ function readTypeDocs(sourceFile, typeName) {
|
|
|
426
438
|
}
|
|
427
439
|
}
|
|
428
440
|
}
|
|
429
|
-
if (
|
|
430
|
-
|
|
441
|
+
if (typeDescription || fields.length > 0) {
|
|
442
|
+
result = {
|
|
443
|
+
typeDescription: typeDescription,
|
|
444
|
+
fields: fields.length > 0 ? fields : undefined
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
} else {
|
|
448
|
+
var typeAlias = sourceFile.getTypeAlias(typeName);
|
|
449
|
+
if (typeAlias) {
|
|
450
|
+
var typeDescription1 = readJsDocSummary(typeAlias);
|
|
451
|
+
if (typeDescription1) {
|
|
452
|
+
result = {
|
|
453
|
+
typeDescription: typeDescription1
|
|
454
|
+
};
|
|
455
|
+
}
|
|
431
456
|
}
|
|
432
|
-
return {
|
|
433
|
-
typeDescription: typeDescription,
|
|
434
|
-
fields: fields.length > 0 ? fields : undefined
|
|
435
|
-
};
|
|
436
457
|
}
|
|
437
|
-
|
|
438
|
-
if (typeAlias) {
|
|
439
|
-
var typeDescription1 = readJsDocSummary(typeAlias);
|
|
440
|
-
return typeDescription1 ? {
|
|
441
|
-
typeDescription: typeDescription1
|
|
442
|
-
} : undefined;
|
|
443
|
-
}
|
|
444
|
-
return undefined;
|
|
458
|
+
return result;
|
|
445
459
|
}
|
|
446
460
|
function readJsDocSummary(node) {
|
|
461
|
+
var result;
|
|
447
462
|
var docs = node.getJsDocs();
|
|
448
|
-
if (docs.length
|
|
449
|
-
|
|
463
|
+
if (docs.length > 0) {
|
|
464
|
+
var last = docs[docs.length - 1];
|
|
465
|
+
var description = last.getDescription().trim();
|
|
466
|
+
if (description.length > 0) {
|
|
467
|
+
result = description;
|
|
468
|
+
}
|
|
450
469
|
}
|
|
451
|
-
|
|
452
|
-
var description = last.getDescription().trim();
|
|
453
|
-
return description.length > 0 ? description : undefined;
|
|
470
|
+
return result;
|
|
454
471
|
}
|
|
455
472
|
|
|
456
473
|
function _define_property(obj, key, value) {
|
|
@@ -516,8 +533,8 @@ var OBJECT_FIELD_KEY = 'objectField';
|
|
|
516
533
|
* Best-effort: a malformed call shape leaves the corresponding entry out
|
|
517
534
|
* rather than throwing.
|
|
518
535
|
*
|
|
519
|
-
* @param input -
|
|
520
|
-
* @returns
|
|
536
|
+
* @param input - In-memory `{ name, text }` source pair.
|
|
537
|
+
* @returns The per-file extraction. Aggregation across files happens in the
|
|
521
538
|
* firebase-api-manifest orchestrator so cross-file converter consts can be
|
|
522
539
|
* resolved against a global registry.
|
|
523
540
|
*/ function extractModelsFromSource(input) {
|
|
@@ -714,8 +731,8 @@ function buildInterface(decl) {
|
|
|
714
731
|
* through utility-wrapped declarations like
|
|
715
732
|
* `extends Partial<MaybeMap<Omit<Base, '…'>>>`.
|
|
716
733
|
*
|
|
717
|
-
* @param expr -
|
|
718
|
-
* @returns
|
|
734
|
+
* @param expr - The `ExpressionWithTypeArguments` produced by `getExtends()`
|
|
735
|
+
* @returns The resolved interface name, or the original leftmost identifier when no inner reference is reachable.
|
|
719
736
|
*/ function resolveExtendsName(expr) {
|
|
720
737
|
var head = expr.getExpression().getText();
|
|
721
738
|
var result = head;
|
|
@@ -820,20 +837,25 @@ function readGenericInterfaceName(call) {
|
|
|
820
837
|
function readConverterFields(call) {
|
|
821
838
|
var fnName = call.getExpression().getText();
|
|
822
839
|
var args = call.getArguments();
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
840
|
+
var result;
|
|
841
|
+
if (args.length > 0) {
|
|
842
|
+
var config = args[0];
|
|
843
|
+
if (Node.isObjectLiteralExpression(config)) {
|
|
844
|
+
var fieldsLiteral;
|
|
845
|
+
if (fnName === SNAPSHOT_FN) {
|
|
846
|
+
fieldsLiteral = readObjectProperty(config, FIELDS_LITERAL_KEY);
|
|
847
|
+
} else {
|
|
848
|
+
var objectField = readPropertyValue(config, OBJECT_FIELD_KEY);
|
|
849
|
+
if (objectField && Node.isObjectLiteralExpression(objectField)) {
|
|
850
|
+
fieldsLiteral = readObjectProperty(objectField, FIELDS_LITERAL_KEY);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
if (fieldsLiteral) {
|
|
854
|
+
result = readFieldEntries(fieldsLiteral);
|
|
855
|
+
}
|
|
833
856
|
}
|
|
834
857
|
}
|
|
835
|
-
|
|
836
|
-
return readFieldEntries(fieldsLiteral);
|
|
858
|
+
return result;
|
|
837
859
|
}
|
|
838
860
|
function readFieldEntries(fields) {
|
|
839
861
|
var out = [];
|
|
@@ -877,36 +899,41 @@ function readFieldEntries(fields) {
|
|
|
877
899
|
return out;
|
|
878
900
|
}
|
|
879
901
|
function readNestedFromExpression(expr) {
|
|
880
|
-
if (!Node.isCallExpression(expr)) return undefined;
|
|
881
|
-
var fnName = expr.getExpression().getText();
|
|
882
|
-
if (fnName !== SUB_OBJECT_FN && fnName !== OBJECT_ARRAY_FN) return undefined;
|
|
883
|
-
var args = expr.getArguments();
|
|
884
|
-
if (args.length === 0) return undefined;
|
|
885
|
-
var config = args[0];
|
|
886
|
-
if (!Node.isObjectLiteralExpression(config)) return undefined;
|
|
887
|
-
var objectField = readPropertyValue(config, OBJECT_FIELD_KEY);
|
|
888
|
-
if (!objectField) return undefined;
|
|
889
|
-
var isArray = fnName === OBJECT_ARRAY_FN;
|
|
890
902
|
var result;
|
|
891
|
-
if (Node.
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
903
|
+
if (Node.isCallExpression(expr)) {
|
|
904
|
+
var fnName = expr.getExpression().getText();
|
|
905
|
+
if (fnName === SUB_OBJECT_FN || fnName === OBJECT_ARRAY_FN) {
|
|
906
|
+
var args = expr.getArguments();
|
|
907
|
+
if (args.length > 0) {
|
|
908
|
+
var config = args[0];
|
|
909
|
+
if (Node.isObjectLiteralExpression(config)) {
|
|
910
|
+
var objectField = readPropertyValue(config, OBJECT_FIELD_KEY);
|
|
911
|
+
if (objectField) {
|
|
912
|
+
var isArray = fnName === OBJECT_ARRAY_FN;
|
|
913
|
+
if (Node.isIdentifier(objectField)) {
|
|
914
|
+
result = {
|
|
915
|
+
ref: objectField.getText(),
|
|
916
|
+
isArray: isArray
|
|
917
|
+
};
|
|
918
|
+
} else if (Node.isObjectLiteralExpression(objectField)) {
|
|
919
|
+
var fieldsLiteral = readObjectProperty(objectField, FIELDS_LITERAL_KEY);
|
|
920
|
+
if (fieldsLiteral) {
|
|
921
|
+
var inlineFields = readFieldEntries(fieldsLiteral);
|
|
922
|
+
result = {
|
|
923
|
+
inline: {
|
|
924
|
+
converterConst: undefined,
|
|
925
|
+
factory: fnName,
|
|
926
|
+
interfaceName: readGenericInterfaceName(expr),
|
|
927
|
+
fields: inlineFields,
|
|
928
|
+
line: expr.getStartLineNumber()
|
|
929
|
+
},
|
|
930
|
+
isArray: isArray
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
910
937
|
}
|
|
911
938
|
}
|
|
912
939
|
return result;
|
|
@@ -29,8 +29,8 @@ export interface ExtractCrudInput {
|
|
|
29
29
|
* callable leaf (CRUD or standalone). Best-effort: malformed configs return
|
|
30
30
|
* fewer entries rather than throwing.
|
|
31
31
|
*
|
|
32
|
-
* @param source -
|
|
33
|
-
* @returns
|
|
32
|
+
* @param source - In-memory source name + text pair to extract.
|
|
33
|
+
* @returns The CRUD extraction with group name, model keys, entries, and
|
|
34
34
|
* `*Functions` class name (when present).
|
|
35
35
|
*/
|
|
36
36
|
export declare function extractCrudEntries(source: ExtractCrudInput): CrudExtraction;
|
|
@@ -25,8 +25,8 @@ export interface ExtractModelsFromSourceInput {
|
|
|
25
25
|
* Best-effort: a malformed call shape leaves the corresponding entry out
|
|
26
26
|
* rather than throwing.
|
|
27
27
|
*
|
|
28
|
-
* @param input -
|
|
29
|
-
* @returns
|
|
28
|
+
* @param input - In-memory `{ name, text }` source pair.
|
|
29
|
+
* @returns The per-file extraction. Aggregation across files happens in the
|
|
30
30
|
* firebase-api-manifest orchestrator so cross-file converter consts can be
|
|
31
31
|
* resolved against a global registry.
|
|
32
32
|
*/
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-cli",
|
|
3
|
-
"version": "13.11.
|
|
3
|
+
"version": "13.11.15",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"bin": {
|
|
6
|
-
"dbx-cli-generate-firebase-api-manifest": "firebase-api-manifest/main.js"
|
|
6
|
+
"dbx-cli-generate-firebase-api-manifest": "firebase-api-manifest/main.js",
|
|
7
|
+
"dbx-cli-lint-cache": "lint-cache/main.js"
|
|
7
8
|
},
|
|
8
9
|
"exports": {
|
|
9
10
|
"./firebase-api-manifest": {
|
|
10
11
|
"default": "./firebase-api-manifest/main.js"
|
|
11
12
|
},
|
|
13
|
+
"./lint-cache": {
|
|
14
|
+
"default": "./lint-cache/main.js"
|
|
15
|
+
},
|
|
12
16
|
"./manifest-extract": {
|
|
13
17
|
"module": "./manifest-extract/index.esm.js",
|
|
14
18
|
"types": "./manifest-extract/index.d.ts",
|
|
@@ -30,15 +34,16 @@
|
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
"peerDependencies": {
|
|
33
|
-
"@dereekb/date": "13.11.
|
|
34
|
-
"@dereekb/firebase": "13.11.
|
|
35
|
-
"@dereekb/nestjs": "13.11.
|
|
36
|
-
"@dereekb/util": "13.11.
|
|
37
|
+
"@dereekb/date": "13.11.15",
|
|
38
|
+
"@dereekb/firebase": "13.11.15",
|
|
39
|
+
"@dereekb/nestjs": "13.11.15",
|
|
40
|
+
"@dereekb/util": "13.11.15",
|
|
37
41
|
"arktype": "^2.2.0",
|
|
38
42
|
"yargs": "^18.0.0"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"@types/yargs": "^17.0.35"
|
|
45
|
+
"@types/yargs": "^17.0.35",
|
|
46
|
+
"eslint": "10.4.0"
|
|
42
47
|
},
|
|
43
48
|
"module": "./index.esm.js",
|
|
44
49
|
"main": "./index.cjs.js",
|
|
@@ -203,6 +203,9 @@ export interface IterateDbxCliCallModelResult<TItem, TItemResult, TPageResult> {
|
|
|
203
203
|
* Concurrency: pages are fetched serially (cursor dependency); items within a page can run
|
|
204
204
|
* in parallel via `maxParallelPerPage` (forwarded to `performAsyncTasks`).
|
|
205
205
|
*
|
|
206
|
+
* @param config - Iterator configuration.
|
|
207
|
+
* @returns The aggregate result.
|
|
208
|
+
*
|
|
206
209
|
* @example
|
|
207
210
|
* ```ts
|
|
208
211
|
* // Exhaust every published Guestbook entry for a single Guestbook.
|
|
@@ -212,7 +215,6 @@ export interface IterateDbxCliCallModelResult<TItem, TItemResult, TPageResult> {
|
|
|
212
215
|
* params: { guestbook: 'gb/abc', published: true }
|
|
213
216
|
* });
|
|
214
217
|
* ```
|
|
215
|
-
*
|
|
216
218
|
* @example
|
|
217
219
|
* ```ts
|
|
218
220
|
* // Fan out to a child action per Guestbook, with 4-way parallelism per page.
|
|
@@ -224,8 +226,5 @@ export interface IterateDbxCliCallModelResult<TItem, TItemResult, TPageResult> {
|
|
|
224
226
|
* iterateItem: ({ context, key }) => queryGuestbookEntriesForGuestbook({ context, guestbook: key, published: true })
|
|
225
227
|
* });
|
|
226
228
|
* ```
|
|
227
|
-
*
|
|
228
|
-
* @param config - Iterator configuration.
|
|
229
|
-
* @returns The aggregate result.
|
|
230
229
|
*/
|
|
231
230
|
export declare function iterateDbxCliCallModel<TParams, TItem, TRaw = OnCallQueryModelResult<TItem>, TItemResult = void, TPageResult = void>(config: IterateDbxCliCallModelConfig<TParams, TItem, TRaw, TItemResult, TPageResult>): Promise<IterateDbxCliCallModelResult<TItem, TItemResult, TPageResult>>;
|
|
@@ -5,4 +5,4 @@ import type { CommandModule } from 'yargs';
|
|
|
5
5
|
* Provides direct access to the demo-api's typed model dispatch without typed wrappers — useful
|
|
6
6
|
* for ad-hoc admin tasks, scripting, and the MVP demo CLI before model-specific commands ship.
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const CALL_PASSTHROUGH_COMMAND: CommandModule;
|
|
@@ -4,9 +4,10 @@ import type { CliModelManifest, CliModelManifestEntry } from '../manifest/types'
|
|
|
4
4
|
* `modelType` first, then falls back to `identityConst` and `collectionPrefix`
|
|
5
5
|
* so callers can pass any of the three forms a user might type at the CLI.
|
|
6
6
|
*
|
|
7
|
-
* @param modelType -
|
|
8
|
-
* @param manifest -
|
|
9
|
-
* @returns
|
|
7
|
+
* @param modelType - Identifier to look up.
|
|
8
|
+
* @param manifest - Generated model manifest.
|
|
9
|
+
* @returns The matching entry, or `undefined` when none exists.
|
|
10
|
+
*
|
|
10
11
|
* @__NO_SIDE_EFFECTS__
|
|
11
12
|
*/
|
|
12
13
|
export declare function findCliModelManifestEntry(modelType: string, manifest: CliModelManifest): CliModelManifestEntry | undefined;
|
|
@@ -20,12 +21,13 @@ export declare function findCliModelManifestEntry(modelType: string, manifest: C
|
|
|
20
21
|
* Unknown keys, primitives, `Date`, `null`, and `undefined` pass through
|
|
21
22
|
* unchanged.
|
|
22
23
|
*
|
|
23
|
-
* @param modelType -
|
|
24
|
+
* @param modelType - The model identifier (`modelType`, `identityConst`,
|
|
24
25
|
* or `collectionPrefix`) used to look up the rewrite map.
|
|
25
|
-
* @param data -
|
|
26
|
+
* @param data - The value to rewrite (typically a `read`/`query` response
|
|
26
27
|
* payload).
|
|
27
|
-
* @param manifest -
|
|
28
|
-
* @returns
|
|
28
|
+
* @param manifest - Generated model manifest.
|
|
29
|
+
* @returns The rewritten value, or `data` unchanged when no rewrite applies.
|
|
30
|
+
*
|
|
29
31
|
* @__NO_SIDE_EFFECTS__
|
|
30
32
|
*/
|
|
31
33
|
export declare function expandModelKeys(modelType: string, data: unknown, manifest: CliModelManifest): unknown;
|
|
@@ -26,10 +26,13 @@ export interface ParsedGetManyArgs {
|
|
|
26
26
|
* {@link CliError} if the manifest is missing, the prefix is unresolved, or the leaf
|
|
27
27
|
* has no `modelType`.
|
|
28
28
|
*
|
|
29
|
+
* @param input - Positionals captured by yargs plus the optional model manifest.
|
|
29
30
|
* @param input.modelOrKey - The first positional from yargs.
|
|
30
31
|
* @param input.key - The optional second positional from yargs.
|
|
31
32
|
* @param input.manifest - The generated model manifest (for prefix lookup).
|
|
32
33
|
* @returns The parsed `{ modelType, key }` pair.
|
|
34
|
+
* @throws {CliError} When `modelOrKey` is missing, when no manifest is wired but inference is required, when the bare positional is not a full key, or when the manifest cannot resolve the key's prefix.
|
|
35
|
+
*
|
|
33
36
|
* @__NO_SIDE_EFFECTS__
|
|
34
37
|
*/
|
|
35
38
|
export declare function parseGetArgs(input: {
|
|
@@ -48,10 +51,13 @@ export declare function parseGetArgs(input: {
|
|
|
48
51
|
*
|
|
49
52
|
* Always rejects empty key lists and lists exceeding 50 keys.
|
|
50
53
|
*
|
|
54
|
+
* @param input - Positionals captured by yargs plus the optional model manifest.
|
|
51
55
|
* @param input.firstArg - The first positional from yargs.
|
|
52
56
|
* @param input.rest - The remaining positionals from yargs.
|
|
53
57
|
* @param input.manifest - The generated model manifest (used only in the inferred-key branch).
|
|
54
58
|
* @returns The parsed `{ modelType, keys }` pair.
|
|
59
|
+
* @throws {CliError} When positionals are missing, when an inferred-key call lacks a manifest, when one or more keys cannot be resolved, or when the keys span multiple `modelType`s.
|
|
60
|
+
*
|
|
55
61
|
* @__NO_SIDE_EFFECTS__
|
|
56
62
|
*/
|
|
57
63
|
export declare function parseGetManyArgs(input: {
|
|
@@ -12,4 +12,4 @@ import type { CommandModule } from 'yargs';
|
|
|
12
12
|
*
|
|
13
13
|
* Backend: `POST <apiBaseUrl>/model/<modelType>/get` with body `{ keys }` (ModelApiController.getMany).
|
|
14
14
|
*/
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const GET_MANY_COMMAND: CommandModule;
|
|
@@ -68,6 +68,8 @@ export interface BuildAuthorizationUrlInput {
|
|
|
68
68
|
* @param input.state - The opaque OAuth state token used for CSRF protection.
|
|
69
69
|
* @param input.codeChallenge - The PKCE code challenge derived from the verifier.
|
|
70
70
|
* @returns The full authorization URL with all OAuth params merged in.
|
|
71
|
+
* @throws {CliError} When `requestedSessionTtlSeconds` is provided but is not a positive integer.
|
|
72
|
+
*
|
|
71
73
|
* @__NO_SIDE_EFFECTS__
|
|
72
74
|
*/
|
|
73
75
|
export declare function buildAuthorizationUrl(input: BuildAuthorizationUrlInput): string;
|
|
@@ -104,5 +106,6 @@ export interface ParsedRedirect {
|
|
|
104
106
|
* @param input.pasted - The redirect URL or bare authorization code pasted by the user.
|
|
105
107
|
* @param input.expectedState - Optional state value to assert against `state` when present in the URL.
|
|
106
108
|
* @returns The {@link ParsedRedirect} containing `code` and (when present) `state`.
|
|
109
|
+
* @throws {CliError} When `pasted` is empty, when the URL contains no `code` parameter, or when `expectedState` does not match the URL's `state`.
|
|
107
110
|
*/
|
|
108
111
|
export declare function parsePastedRedirect(input: ParsePastedRedirectInput): ParsedRedirect;
|
|
@@ -125,7 +125,7 @@ export declare function buildManifestCommands(manifest: CliApiManifest, options?
|
|
|
125
125
|
* value is needed when each command's builder runs — which is before yargs
|
|
126
126
|
* parses argv. Unrecognized values fall back to the default.
|
|
127
127
|
*
|
|
128
|
-
* @param argv -
|
|
128
|
+
* @param argv - Argv to inspect (defaults to `process.argv`).
|
|
129
129
|
* @returns The detected format, or {@link DEFAULT_MANIFEST_HELP_DATA_FORMAT}.
|
|
130
130
|
*/
|
|
131
131
|
export declare function detectDataHelpFormat(argv?: readonly string[]): ManifestHelpDataFormat;
|
|
@@ -138,7 +138,7 @@ export declare function detectDataHelpFormat(argv?: readonly string[]): Manifest
|
|
|
138
138
|
* value is needed when each command's builder runs — which is before yargs
|
|
139
139
|
* parses argv.
|
|
140
140
|
*
|
|
141
|
-
* @param argv -
|
|
141
|
+
* @param argv - Argv to inspect (defaults to `process.argv`).
|
|
142
142
|
* @returns The detected mode, or {@link DEFAULT_MANIFEST_HELP_MODE}.
|
|
143
143
|
*/
|
|
144
144
|
export declare function detectHelpMode(argv?: readonly string[]): ManifestHelpMode;
|
|
@@ -162,6 +162,8 @@ export declare function detectHelpMode(argv?: readonly string[]): ManifestHelpMo
|
|
|
162
162
|
* @param manifest - The generated model manifest used to look up the model's `collectionPrefix`
|
|
163
163
|
* and `parentIdentityConst`. When omitted, the key passes through unchanged.
|
|
164
164
|
* @returns The resolved Firestore model key ready for `context.getModel(model, key)`.
|
|
165
|
+
* @throws {CliError} When `model` resolves to a subcollection entry and only a bare doc id is supplied.
|
|
166
|
+
*
|
|
165
167
|
* @__NO_SIDE_EFFECTS__
|
|
166
168
|
*/
|
|
167
169
|
export declare function resolvePerModelGetKey(model: string, key: string, manifest: CliModelManifest | undefined): string;
|