@dereekb/dbx-cli 13.41.0 → 13.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli-lint-cache",
3
- "version": "13.41.0",
3
+ "version": "13.42.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "devDependencies": {
@@ -8,7 +8,7 @@
8
8
  "eslint": "10.4.0"
9
9
  },
10
10
  "peerDependencies": {
11
- "@dereekb/util": "13.41.0",
11
+ "@dereekb/util": "13.42.0",
12
12
  "yargs": "^18.0.0"
13
13
  }
14
14
  }
@@ -1,4 +1,4 @@
1
- import { Project, Node } from 'ts-morph';
1
+ import { Project, Node, SyntaxKind } from 'ts-morph';
2
2
  import { parseFirestoreModelIdentityArgs, resolveExtendsName } from '@dereekb/dbx-cli';
3
3
 
4
4
  function _define_property$1(obj, key, value) {
@@ -702,6 +702,14 @@ var MCP_TOOL_NAME_SEGMENT_TAG = 'dbxModelMcpToolNameSegment';
702
702
  var MODEL_TYPE_VALUE_PATTERN = /^[a-z][A-Za-z0-9_$]*$/;
703
703
  var TOOL_NAME_SEGMENT_PATTERN = /^[A-Za-z][A-Za-z0-9_$]*$/;
704
704
  var IDENTITY_FN = 'firestoreModelIdentity';
705
+ var SINGLE_ITEM_COLLECTION_FN = 'singleItemFirestoreCollection';
706
+ var ROOT_SINGLE_ITEM_COLLECTION_FN = 'rootSingleItemFirestoreCollection';
707
+ var SINGLE_ITEM_COLLECTION_FN_NAMES = [
708
+ SINGLE_ITEM_COLLECTION_FN,
709
+ ROOT_SINGLE_ITEM_COLLECTION_FN
710
+ ];
711
+ var MODEL_IDENTITY_KEY = 'modelIdentity';
712
+ var SINGLE_ITEM_IDENTIFIER_KEY = 'singleItemIdentifier';
705
713
  var CONVERTER_FN_NAMES = [
706
714
  'snapshotConverterFunctions',
707
715
  'firestoreSubObject',
@@ -736,13 +744,17 @@ var FIRESTORE_FIELD_KEY = 'firestoreField';
736
744
  var enums = readEnums(sourceFile);
737
745
  var modelGroups = readModelGroups(sourceFile);
738
746
  var serviceFactories = readServiceFactories(sourceFile);
747
+ var singleItemCollections = readSingleItemCollections(sourceFile);
748
+ var stringConstants = readStringConstants(sourceFile);
739
749
  return {
740
750
  identities: identities,
741
751
  interfaces: interfaces,
742
752
  converters: converters,
743
753
  enums: enums,
744
754
  modelGroups: modelGroups,
745
- serviceFactories: serviceFactories
755
+ serviceFactories: serviceFactories,
756
+ singleItemCollections: singleItemCollections,
757
+ stringConstants: stringConstants
746
758
  };
747
759
  }
748
760
  function readIdentities(sourceFile) {
@@ -1080,6 +1092,140 @@ function readServiceFactoryModelType(jsDocs) {
1080
1092
  }
1081
1093
  return result;
1082
1094
  }
1095
+ /**
1096
+ * Finds every `singleItemFirestoreCollection` / `rootSingleItemFirestoreCollection` call in the
1097
+ * file. Unlike the other artifacts these are not top-level declarations — they sit inside the
1098
+ * `<model>FirestoreCollectionFactory` function bodies — so this needs a full descendant walk,
1099
+ * guarded on the raw text so files declaring no single-item collection skip it entirely.
1100
+ *
1101
+ * @param sourceFile - The parsed source file.
1102
+ * @returns One entry per resolvable call, in source order.
1103
+ */ function readSingleItemCollections(sourceFile) {
1104
+ var out = [];
1105
+ var text = sourceFile.getFullText();
1106
+ if (SINGLE_ITEM_COLLECTION_FN_NAMES.some(function(name) {
1107
+ return text.includes(name);
1108
+ })) {
1109
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1110
+ try {
1111
+ for(var _iterator = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1112
+ var call = _step.value;
1113
+ var fnName = readCalleeName(call);
1114
+ if (fnName !== SINGLE_ITEM_COLLECTION_FN && fnName !== ROOT_SINGLE_ITEM_COLLECTION_FN) continue;
1115
+ var entry = buildSingleItemCollection(call, fnName === ROOT_SINGLE_ITEM_COLLECTION_FN);
1116
+ if (entry) out.push(entry);
1117
+ }
1118
+ } catch (err) {
1119
+ _didIteratorError = true;
1120
+ _iteratorError = err;
1121
+ } finally{
1122
+ try {
1123
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1124
+ _iterator.return();
1125
+ }
1126
+ } finally{
1127
+ if (_didIteratorError) {
1128
+ throw _iteratorError;
1129
+ }
1130
+ }
1131
+ }
1132
+ }
1133
+ return out;
1134
+ }
1135
+ /**
1136
+ * Resolves a call's function name for both the bare (`singleItemFirestoreCollection(...)`) and the
1137
+ * method (`firestoreContext.singleItemFirestoreCollection(...)`) forms.
1138
+ *
1139
+ * @param call - The call expression.
1140
+ * @returns The called function's name, or the verbatim callee text when it is neither shape.
1141
+ */ function readCalleeName(call) {
1142
+ var expression = call.getExpression();
1143
+ return Node.isPropertyAccessExpression(expression) ? expression.getName() : expression.getText();
1144
+ }
1145
+ function buildSingleItemCollection(call, root) {
1146
+ var result;
1147
+ var args = call.getArguments();
1148
+ if (args.length > 0) {
1149
+ var config = args[0];
1150
+ if (Node.isObjectLiteralExpression(config)) {
1151
+ var identityNode = readPropertyValue(config, MODEL_IDENTITY_KEY);
1152
+ if (identityNode && Node.isIdentifier(identityNode)) {
1153
+ var identifierNode = readPropertyValue(config, SINGLE_ITEM_IDENTIFIER_KEY);
1154
+ result = {
1155
+ identityConst: identityNode.getText(),
1156
+ root: root,
1157
+ documentId: readStringLiteralText(identifierNode),
1158
+ documentIdConstRef: identifierNode && Node.isIdentifier(identifierNode) ? identifierNode.getText() : undefined,
1159
+ explicitIdentifier: config.getProperty(SINGLE_ITEM_IDENTIFIER_KEY) !== undefined,
1160
+ line: call.getStartLineNumber()
1161
+ };
1162
+ }
1163
+ }
1164
+ }
1165
+ return result;
1166
+ }
1167
+ function readStringConstants(sourceFile) {
1168
+ var out = [];
1169
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1170
+ try {
1171
+ for(var _iterator = sourceFile.getVariableStatements()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1172
+ var statement = _step.value;
1173
+ if (!statement.isExported()) continue;
1174
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1175
+ try {
1176
+ for(var _iterator1 = statement.getDeclarations()[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1177
+ var decl = _step1.value;
1178
+ var value = readStringLiteralText(decl.getInitializer());
1179
+ if (value !== undefined) {
1180
+ out.push({
1181
+ name: decl.getName(),
1182
+ value: value
1183
+ });
1184
+ }
1185
+ }
1186
+ } catch (err) {
1187
+ _didIteratorError1 = true;
1188
+ _iteratorError1 = err;
1189
+ } finally{
1190
+ try {
1191
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1192
+ _iterator1.return();
1193
+ }
1194
+ } finally{
1195
+ if (_didIteratorError1) {
1196
+ throw _iteratorError1;
1197
+ }
1198
+ }
1199
+ }
1200
+ }
1201
+ } catch (err) {
1202
+ _didIteratorError = true;
1203
+ _iteratorError = err;
1204
+ } finally{
1205
+ try {
1206
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1207
+ _iterator.return();
1208
+ }
1209
+ } finally{
1210
+ if (_didIteratorError) {
1211
+ throw _iteratorError;
1212
+ }
1213
+ }
1214
+ }
1215
+ return out;
1216
+ }
1217
+ /**
1218
+ * Reads a node's string-literal text, peeling any `as const` / `as Foo` assertion.
1219
+ *
1220
+ * @param node - The candidate node, or `undefined`.
1221
+ * @returns The literal text, or `undefined` when the node is not a string literal.
1222
+ */ function readStringLiteralText(node) {
1223
+ var current = node;
1224
+ while(current !== undefined && Node.isAsExpression(current)){
1225
+ current = current.getExpression();
1226
+ }
1227
+ return current !== undefined && (Node.isStringLiteral(current) || Node.isNoSubstitutionTemplateLiteral(current)) ? current.getLiteralText() : undefined;
1228
+ }
1083
1229
  function readConverters(sourceFile) {
1084
1230
  var out = [];
1085
1231
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/manifest-extract",
3
- "version": "13.41.0",
3
+ "version": "13.42.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "@dereekb/date": "13.15.0",
8
- "@dereekb/dbx-cli": "13.41.0",
8
+ "@dereekb/dbx-cli": "13.42.0",
9
9
  "@dereekb/firebase": "13.15.0",
10
10
  "@dereekb/model": "13.15.0",
11
11
  "@dereekb/nestjs": "13.15.0",
@@ -2,8 +2,10 @@
2
2
  * Per-source-file walker that pulls Firestore-model metadata out of a `.ts`
3
3
  * file: identities, `@dbxModel`-tagged interfaces with their property JSDocs,
4
4
  * snapshot converters (top-level `snapshotConverterFunctions`,
5
- * `firestoreSubObject`, and `firestoreObjectArray` consts), enums, and
6
- * `@dbxModelGroup`-tagged collection containers.
5
+ * `firestoreSubObject`, and `firestoreObjectArray` consts), enums,
6
+ * `@dbxModelGroup`-tagged collection containers, single-item collection
7
+ * declarations (with the fixed document id they pin), and the exported
8
+ * string constants such an id may be declared as.
7
9
  *
8
10
  * Mirrors the per-file outputs of `dbx-components-mcp`'s `extractModels()`
9
11
  * but lives inside `@dereekb/dbx-cli/manifest-extract` so the `dbx-cli`
@@ -279,6 +279,20 @@ export interface ModelExtraction {
279
279
  * manifest can surface the implementing factory alongside each model.
280
280
  */
281
281
  readonly serviceFactories: readonly ModelExtractionServiceFactory[];
282
+ /**
283
+ * `singleItemFirestoreCollection(...)` / `rootSingleItemFirestoreCollection(...)` calls found
284
+ * anywhere in this file (they live inside collection-factory function bodies, not at the top
285
+ * level). The orchestrator joins these onto matching model entries by `identityConst` so the
286
+ * runtime manifest can publish each singleton model's fixed document id.
287
+ */
288
+ readonly singleItemCollections: readonly ModelExtractionSingleItemCollection[];
289
+ /**
290
+ * Exported `const <NAME> = '<literal>'` string constants declared in this file. Aggregated by
291
+ * the orchestrator into a cross-file registry so a
292
+ * {@link ModelExtractionSingleItemCollection.documentIdConstRef} declared in a sibling file
293
+ * still resolves.
294
+ */
295
+ readonly stringConstants: readonly ModelExtractionStringConstant[];
282
296
  }
283
297
  /**
284
298
  * One `@dbxModelServiceFactory <modelType>`-tagged variable export.
@@ -294,3 +308,54 @@ export interface ModelExtractionServiceFactory {
294
308
  */
295
309
  readonly exportName: string;
296
310
  }
311
+ /**
312
+ * One `firestoreContext.singleItemFirestoreCollection({ ... })` or
313
+ * `firestoreContext.rootSingleItemFirestoreCollection({ ... })` call — the declaration that a
314
+ * model's collection holds exactly one document, at a fixed id.
315
+ *
316
+ * The id is what a caller needs to build a document key and what the manifest could not express
317
+ * before: it defaults to `DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER` (`'0'`)
318
+ * but is frequently overridden, so `'/0'` cannot be inferred.
319
+ */
320
+ export interface ModelExtractionSingleItemCollection {
321
+ /**
322
+ * Identity const named by the call's `modelIdentity` property (e.g.
323
+ * `billingGroupInvoiceSummaryIdentity`) — the join key back to the model entry.
324
+ */
325
+ readonly identityConst: string;
326
+ /**
327
+ * `true` for the `rootSingleItemFirestoreCollection` variant (a root collection holding one
328
+ * document), `false` for the `singleItemFirestoreCollection` subcollection variant.
329
+ */
330
+ readonly root: boolean;
331
+ /**
332
+ * Document id when `singleItemIdentifier` is a string literal. `undefined` when the property is
333
+ * absent, names a const (see {@link documentIdConstRef}), or is an unresolvable expression.
334
+ */
335
+ readonly documentId: string | undefined;
336
+ /**
337
+ * Const name when `singleItemIdentifier` is an identifier reference (e.g.
338
+ * `BILLING_GROUP_SUMMARY_BILLING_SINGLE_IDENTIFIER`), resolved by the orchestrator against the
339
+ * cross-file string-constant registry.
340
+ */
341
+ readonly documentIdConstRef: string | undefined;
342
+ /**
343
+ * `true` when the config object declares a `singleItemIdentifier` property at all. `false` means
344
+ * the runtime default applies; `true` with neither {@link documentId} nor
345
+ * {@link documentIdConstRef} means the value is an expression the walker could not read, and the
346
+ * id is genuinely unknown rather than defaulted.
347
+ */
348
+ readonly explicitIdentifier: boolean;
349
+ /**
350
+ * Source-line number of the call (1-based) for diagnostics.
351
+ */
352
+ readonly line: number;
353
+ }
354
+ /**
355
+ * One exported `const <NAME> = '<literal>'` string constant, captured so cross-file
356
+ * `singleItemIdentifier: SOME_CONST` references resolve without type-checker access.
357
+ */
358
+ export interface ModelExtractionStringConstant {
359
+ readonly name: string;
360
+ readonly value: string;
361
+ }
@@ -438,31 +438,6 @@ function toPosix(p) {
438
438
  return p.split(sep).join('/');
439
439
  }
440
440
 
441
- function _array_like_to_array$6(arr, len) {
442
- if (len == null || len > arr.length) len = arr.length;
443
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
444
- return arr2;
445
- }
446
- function _array_without_holes$6(arr) {
447
- if (Array.isArray(arr)) return _array_like_to_array$6(arr);
448
- }
449
- function _iterable_to_array$6(iter) {
450
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
451
- }
452
- function _non_iterable_spread$6() {
453
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
454
- }
455
- function _to_consumable_array$6(arr) {
456
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$6();
457
- }
458
- function _unsupported_iterable_to_array$6(o, minLen) {
459
- if (!o) return;
460
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
461
- var n = Object.prototype.toString.call(o).slice(8, -1);
462
- if (n === "Object" && o.constructor) n = o.constructor.name;
463
- if (n === "Map" || n === "Set") return Array.from(n);
464
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
465
- }
466
441
  var SPEC_FILE_VIRTUAL_PATH = '__spec__/spec.ts';
467
442
  var FIXTURE_CONTEXT_SUFFIX = 'Context';
468
443
  var FIXTURE_FACTORY_SUFFIX = 'ContextFactory';
@@ -670,7 +645,7 @@ function isItName(name) {
670
645
  }
671
646
  }
672
647
  }
673
- return _to_consumable_array$6(seen);
648
+ return Array.from(seen);
674
649
  }
675
650
  /**
676
651
  * `true` when the import specifier points at the conventional fixture module
@@ -730,7 +705,7 @@ function sharedPrefix(a, b) {
730
705
  return s;
731
706
  }
732
707
  function dedupedSorted(names) {
733
- return _to_consumable_array$6(new Set(names)).sort(function(a, b) {
708
+ return Array.from(new Set(names)).sort(function(a, b) {
734
709
  return a.localeCompare(b);
735
710
  });
736
711
  }
@@ -1294,31 +1269,6 @@ var KNOWN_NON_MODEL_FIXTURE_FAMILIES = [
1294
1269
  });
1295
1270
  }
1296
1271
 
1297
- function _array_like_to_array$5(arr, len) {
1298
- if (len == null || len > arr.length) len = arr.length;
1299
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1300
- return arr2;
1301
- }
1302
- function _array_without_holes$5(arr) {
1303
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
1304
- }
1305
- function _iterable_to_array$5(iter) {
1306
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1307
- }
1308
- function _non_iterable_spread$5() {
1309
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1310
- }
1311
- function _to_consumable_array$5(arr) {
1312
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$5();
1313
- }
1314
- function _unsupported_iterable_to_array$5(o, minLen) {
1315
- if (!o) return;
1316
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
1317
- var n = Object.prototype.toString.call(o).slice(8, -1);
1318
- if (n === "Object" && o.constructor) n = o.constructor.name;
1319
- if (n === "Map" || n === "Set") return Array.from(n);
1320
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
1321
- }
1322
1272
  var FIXTURE_SUFFIX = 'TestContextFixture';
1323
1273
  var INSTANCE_SUFFIX = 'TestContextInstance';
1324
1274
  var PARAMS_SUFFIX = 'TestContextParams';
@@ -2239,7 +2189,7 @@ function readFactoryArgInfo(args) {
2239
2189
  }
2240
2190
  }
2241
2191
  }
2242
- var list = _to_consumable_array$5(all);
2192
+ var list = Array.from(all);
2243
2193
  list.sort(function(a, b) {
2244
2194
  var _ref, _fixtures_get, _ref1, _fixtures_get1;
2245
2195
  var _this, _this1;
@@ -2388,7 +2338,7 @@ function readFactoryArgInfo(args) {
2388
2338
  }
2389
2339
  }
2390
2340
  }
2391
- var list = _to_consumable_array$5(out);
2341
+ var list = Array.from(out);
2392
2342
  list.sort(function(a, b) {
2393
2343
  return a.localeCompare(b);
2394
2344
  });
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/model-test",
3
- "version": "13.41.0",
3
+ "version": "13.42.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "@dereekb/util": "13.41.0",
7
+ "@dereekb/util": "13.42.0",
8
8
  "ts-morph": "^21.0.0"
9
9
  },
10
10
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli",
3
- "version": "13.41.0",
3
+ "version": "13.42.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "bin": {
@@ -66,11 +66,11 @@
66
66
  }
67
67
  },
68
68
  "peerDependencies": {
69
- "@dereekb/date": "13.41.0",
70
- "@dereekb/firebase": "13.41.0",
71
- "@dereekb/model": "13.41.0",
72
- "@dereekb/nestjs": "13.41.0",
73
- "@dereekb/util": "13.41.0",
69
+ "@dereekb/date": "13.42.0",
70
+ "@dereekb/firebase": "13.42.0",
71
+ "@dereekb/model": "13.42.0",
72
+ "@dereekb/nestjs": "13.42.0",
73
+ "@dereekb/util": "13.42.0",
74
74
  "@nestjs/common": "^11.1.19",
75
75
  "arktype": "^2.2.0",
76
76
  "firebase": "^12.12.1",
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/route",
3
- "version": "13.41.0",
3
+ "version": "13.42.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "@dereekb/date": "13.41.0",
8
- "@dereekb/dbx-cli": "13.41.0",
9
- "@dereekb/firebase": "13.41.0",
10
- "@dereekb/model": "13.41.0",
11
- "@dereekb/nestjs": "13.41.0",
12
- "@dereekb/util": "13.41.0"
7
+ "@dereekb/date": "13.42.0",
8
+ "@dereekb/dbx-cli": "13.42.0",
9
+ "@dereekb/firebase": "13.42.0",
10
+ "@dereekb/model": "13.42.0",
11
+ "@dereekb/nestjs": "13.42.0",
12
+ "@dereekb/util": "13.42.0"
13
13
  },
14
14
  "exports": {
15
15
  "./package.json": "./package.json",
@@ -46,8 +46,9 @@ export interface CliModelField {
46
46
  readonly description?: string;
47
47
  /**
48
48
  * Enum name referenced by either the interface property's TS type or the
49
- * converter's `firestoreEnum<Enum>()` generic argument, when an enum is
50
- * present in the same source file.
49
+ * converter's `firestoreEnum<Enum>()` generic argument, resolved against
50
+ * every enum in the scan — the declaring file does not have to be the
51
+ * converter's own.
51
52
  */
52
53
  readonly enumRef?: string;
53
54
  /**
@@ -107,6 +108,38 @@ export interface CliModelManifestEntry {
107
108
  * Parent identity const name when the model is a subcollection.
108
109
  */
109
110
  readonly parentIdentityConst?: string;
111
+ /**
112
+ * `true` when the model's collection holds exactly one document — built by
113
+ * `singleItemFirestoreCollection` (one per parent) or
114
+ * `rootSingleItemFirestoreCollection` (one, full stop). Absent for ordinary
115
+ * multi-document collections.
116
+ */
117
+ readonly singleton?: boolean;
118
+ /**
119
+ * Fixed document id of a {@link singleton} model's one document: the value passed as
120
+ * `singleItemIdentifier`, or `'0'`
121
+ * (`DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER`) when the collection
122
+ * factory omits it.
123
+ *
124
+ * This cannot be inferred from the rest of the entry — plenty of single-item collections
125
+ * override the default (`bgbs`, `bgsu`, …) — so a caller building a document key must read
126
+ * it here rather than assume `/0`. Absent when {@link singleton} is `true` but the id was
127
+ * declared as an expression the generator could not resolve (a build-time warning is
128
+ * printed for that case).
129
+ */
130
+ readonly singleItemIdentifier?: string;
131
+ /**
132
+ * A ready-to-use example document key for this model, with the parent chain resolved from
133
+ * the identity graph and `<…Id>` placeholders standing in for the ids a caller supplies
134
+ * (e.g. `p/<profileId>`, `bg/<billingGroupId>/bgi/<billingGroupInvoiceId>`). A
135
+ * {@link singleton} model's own segment is its literal {@link singleItemIdentifier}, so the
136
+ * key is exact past the last placeholder (e.g. `bg/<billingGroupId>/bgis/bgbs`).
137
+ *
138
+ * Key *shape* — parent chain plus fixed document id — is what consumers of the manifest
139
+ * actually get wrong, so it is published pre-assembled. Absent only when some ancestor
140
+ * identity could not be resolved.
141
+ */
142
+ readonly exampleKey?: string;
110
143
  /**
111
144
  * First paragraph of the source interface's JSDoc, when present.
112
145
  */
@@ -327,6 +360,23 @@ export interface McpManifestModelEntry {
327
360
  readonly identityConst: string;
328
361
  readonly collectionPrefix: string;
329
362
  readonly parentIdentityConst?: string;
363
+ /**
364
+ * `true` when the model's collection holds exactly one document, at the fixed
365
+ * {@link singleItemIdentifier} (mirror of {@link CliModelManifestEntry.singleton}).
366
+ */
367
+ readonly singleton?: boolean;
368
+ /**
369
+ * Fixed document id of a {@link singleton} model's one document — `'0'` by default but
370
+ * frequently overridden, so it cannot be inferred (mirror of
371
+ * {@link CliModelManifestEntry.singleItemIdentifier}).
372
+ */
373
+ readonly singleItemIdentifier?: string;
374
+ /**
375
+ * Example document key with the parent chain resolved and `<…Id>` placeholders for the ids a
376
+ * caller supplies (mirror of {@link CliModelManifestEntry.exampleKey}). Surfaced by
377
+ * `model-info` so a `model-get` caller can build a valid key without reading source.
378
+ */
379
+ readonly exampleKey?: string;
330
380
  readonly description?: string;
331
381
  readonly sourcePackage: string;
332
382
  readonly sourceFile: string;
@@ -106,7 +106,7 @@ export declare const CssUtilityEntry: import("arktype/internal/variants/object.t
106
106
  property: string;
107
107
  value: string;
108
108
  }[];
109
- role?: "text" | "state" | "size" | "layout" | "misc" | "flex" | "spacing" | "interaction" | "color" | "text-color" | "surface" | "radius" | undefined;
109
+ role?: "color" | "text" | "state" | "size" | "layout" | "misc" | "flex" | "spacing" | "interaction" | "text-color" | "surface" | "radius" | undefined;
110
110
  intent?: string | undefined;
111
111
  seeAlso?: string[] | undefined;
112
112
  antiUse?: string | undefined;
@@ -149,7 +149,7 @@ export declare const CssUtilityManifest: import("arktype/internal/variants/objec
149
149
  property: string;
150
150
  value: string;
151
151
  }[];
152
- role?: "text" | "state" | "size" | "layout" | "misc" | "flex" | "spacing" | "interaction" | "color" | "text-color" | "surface" | "radius" | undefined;
152
+ role?: "color" | "text" | "state" | "size" | "layout" | "misc" | "flex" | "spacing" | "interaction" | "text-color" | "surface" | "radius" | undefined;
153
153
  intent?: string | undefined;
154
154
  seeAlso?: string[] | undefined;
155
155
  antiUse?: string | undefined;
@@ -58,7 +58,7 @@ export type TokenDefaults = typeof TokenDefaults.infer;
58
58
  export declare const TokenEntry: import("arktype/internal/variants/object.ts").ObjectType<{
59
59
  cssVariable: string;
60
60
  source: "app" | "dbx-web" | "dbx-form" | "mat-sys" | "mdc";
61
- role: "breakpoint" | "size" | "misc" | "spacing" | "color" | "text-color" | "surface" | "radius" | "elevation" | "shadow" | "typography" | "motion" | "state-layer";
61
+ role: "color" | "breakpoint" | "size" | "misc" | "spacing" | "text-color" | "surface" | "radius" | "elevation" | "shadow" | "typography" | "motion" | "state-layer";
62
62
  intents: string[];
63
63
  description: string;
64
64
  defaults: {
@@ -96,7 +96,7 @@ export declare const TokenManifest: import("arktype/internal/variants/object.ts"
96
96
  entries: {
97
97
  cssVariable: string;
98
98
  source: "app" | "dbx-web" | "dbx-form" | "mat-sys" | "mdc";
99
- role: "breakpoint" | "size" | "misc" | "spacing" | "color" | "text-color" | "surface" | "radius" | "elevation" | "shadow" | "typography" | "motion" | "state-layer";
99
+ role: "color" | "breakpoint" | "size" | "misc" | "spacing" | "text-color" | "surface" | "radius" | "elevation" | "shadow" | "typography" | "motion" | "state-layer";
100
100
  intents: string[];
101
101
  description: string;
102
102
  defaults: {
package/test/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/test",
3
- "version": "13.41.0",
3
+ "version": "13.42.0",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
- "@dereekb/date": "13.41.0",
7
- "@dereekb/dbx-cli": "13.41.0",
8
- "@dereekb/firebase": "13.41.0",
9
- "@dereekb/firebase-server/test": "13.41.0",
10
- "@dereekb/model": "13.41.0",
11
- "@dereekb/nestjs": "13.41.0",
12
- "@dereekb/rxjs": "13.41.0",
13
- "@dereekb/util": "13.41.0",
6
+ "@dereekb/date": "13.42.0",
7
+ "@dereekb/dbx-cli": "13.42.0",
8
+ "@dereekb/firebase": "13.42.0",
9
+ "@dereekb/firebase-server/test": "13.42.0",
10
+ "@dereekb/model": "13.42.0",
11
+ "@dereekb/nestjs": "13.42.0",
12
+ "@dereekb/rxjs": "13.42.0",
13
+ "@dereekb/util": "13.42.0",
14
14
  "@nestjs/common": "^11.1.19",
15
15
  "arktype": "^2.2.0",
16
16
  "vitest": "4.1.5",