@dereekb/dbx-cli 13.11.17 → 13.12.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.
- package/firebase-api-manifest/main.js +70 -9
- package/firebase-api-manifest/package.json +1 -1
- package/firestore-indexes/src/firestore-indexes-generate.d.ts +125 -0
- package/firestore-indexes/src/firestore-model-identity-resolver.d.ts +93 -0
- package/firestore-indexes/src/firestore-query-helpers.d.ts +108 -0
- package/firestore-indexes/src/generate-firestore-indexes-cli.d.ts +94 -0
- package/firestore-indexes/src/index.d.ts +7 -0
- package/firestore-indexes/src/model-firebase-index-analyze.d.ts +68 -0
- package/firestore-indexes/src/model-firebase-index-build-manifest.d.ts +123 -0
- package/firestore-indexes/src/model-firebase-index-extract.d.ts +246 -0
- package/firestore-indexes/src/model-firebase-index-runtime.d.ts +126 -0
- package/firestore-indexes/src/model-firebase-index-scan-config-schema.d.ts +58 -0
- package/firestore-indexes/src/model-firebase-index-schema.d.ts +366 -0
- package/generate-firestore-indexes/main.js +1 -1
- package/generate-firestore-indexes/package.json +1 -1
- package/generate-mcp-manifest/src/generate-mcp-manifest/main.d.ts +26 -0
- package/generate-mcp-manifest/src/generate-mcp-manifest/render.d.ts +38 -0
- package/generated/firebase-models.generated.d.ts +3 -0
- package/index.cjs.js +45234 -640
- package/index.esm.js +44941 -643
- package/lint-cache/main.js +19 -19
- package/lint-cache/package.json +2 -2
- package/manifest-extract/index.cjs.js +169 -4
- package/manifest-extract/index.esm.js +169 -4
- package/manifest-extract/package.json +1 -1
- package/manifest-extract/src/lib/types.d.ts +26 -1
- package/package.json +14 -10
- package/src/lib/index.d.ts +3 -0
- package/src/lib/manifest/types.d.ts +155 -0
- package/src/lib/mcp-scan/config/config-schema.d.ts +226 -0
- package/src/lib/mcp-scan/config/load-config.d.ts +63 -0
- package/src/lib/mcp-scan/index.d.ts +16 -0
- package/src/lib/mcp-scan/manifest/actions-loader.d.ts +49 -0
- package/src/lib/mcp-scan/manifest/actions-schema.d.ts +328 -0
- package/src/lib/mcp-scan/manifest/core-topics.d.ts +38 -0
- package/src/lib/mcp-scan/manifest/css-utilities-loader.d.ts +55 -0
- package/src/lib/mcp-scan/manifest/css-utilities-schema.d.ts +168 -0
- package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-loader.d.ts +33 -0
- package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-schema.d.ts +133 -0
- package/src/lib/mcp-scan/manifest/filters-loader.d.ts +61 -0
- package/src/lib/mcp-scan/manifest/filters-schema.d.ts +190 -0
- package/src/lib/mcp-scan/manifest/forge-fields-loader.d.ts +53 -0
- package/src/lib/mcp-scan/manifest/forge-fields-schema.d.ts +170 -0
- package/src/lib/mcp-scan/manifest/index.d.ts +43 -0
- package/src/lib/mcp-scan/manifest/load-actions-registry.d.ts +38 -0
- package/src/lib/mcp-scan/manifest/load-auth-registry.d.ts +82 -0
- package/src/lib/mcp-scan/manifest/load-css-utilities-registry.d.ts +67 -0
- package/src/lib/mcp-scan/manifest/load-dbx-docs-ui-examples-registry.d.ts +45 -0
- package/src/lib/mcp-scan/manifest/load-filters-registry.d.ts +69 -0
- package/src/lib/mcp-scan/manifest/load-forge-fields-registry.d.ts +70 -0
- package/src/lib/mcp-scan/manifest/load-model-firebase-index-registry.d.ts +61 -0
- package/src/lib/mcp-scan/manifest/load-model-snapshot-fields-registry.d.ts +74 -0
- package/src/lib/mcp-scan/manifest/load-pipes-registry.d.ts +69 -0
- package/src/lib/mcp-scan/manifest/load-registry.d.ts +76 -0
- package/src/lib/mcp-scan/manifest/load-tokens-registry.d.ts +69 -0
- package/src/lib/mcp-scan/manifest/load-ui-components-registry.d.ts +70 -0
- package/src/lib/mcp-scan/manifest/load-utils-registry.d.ts +73 -0
- package/src/lib/mcp-scan/manifest/loader.d.ts +120 -0
- package/src/lib/mcp-scan/manifest/manifest-loader-base.d.ts +130 -0
- package/src/lib/mcp-scan/manifest/model-firebase-index-loader.d.ts +53 -0
- package/src/lib/mcp-scan/manifest/model-snapshot-fields-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/model-snapshot-fields-schema.d.ts +127 -0
- package/src/lib/mcp-scan/manifest/pipes-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/pipes-schema.d.ts +125 -0
- package/src/lib/mcp-scan/manifest/semantic-types-schema.d.ts +108 -0
- package/src/lib/mcp-scan/manifest/tokens-loader.d.ts +55 -0
- package/src/lib/mcp-scan/manifest/tokens-schema.d.ts +116 -0
- package/src/lib/mcp-scan/manifest/ui-components-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/ui-components-schema.d.ts +149 -0
- package/src/lib/mcp-scan/manifest/utils-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/utils-schema.d.ts +120 -0
- package/src/lib/mcp-scan/registry/actions-runtime.d.ts +173 -0
- package/src/lib/mcp-scan/registry/archetypes.d.ts +235 -0
- package/src/lib/mcp-scan/registry/auth-builtin.d.ts +59 -0
- package/src/lib/mcp-scan/registry/auth-runtime.d.ts +343 -0
- package/src/lib/mcp-scan/registry/css-utilities-runtime.d.ts +133 -0
- package/src/lib/mcp-scan/registry/dbx-docs-ui-examples-runtime.d.ts +58 -0
- package/src/lib/mcp-scan/registry/downstream-models-runtime.d.ts +93 -0
- package/src/lib/mcp-scan/registry/filters-runtime.d.ts +128 -0
- package/src/lib/mcp-scan/registry/firebase-models.d.ts +387 -0
- package/src/lib/mcp-scan/registry/forge-fields.d.ts +101 -0
- package/src/lib/mcp-scan/registry/form-fields.d.ts +203 -0
- package/src/lib/mcp-scan/registry/index.d.ts +165 -0
- package/src/lib/mcp-scan/registry/model-snapshot-fields-runtime.d.ts +138 -0
- package/src/lib/mcp-scan/registry/pipes-runtime.d.ts +136 -0
- package/src/lib/mcp-scan/registry/reserved-model-folders.d.ts +29 -0
- package/src/lib/mcp-scan/registry/semantic-types.d.ts +81 -0
- package/src/lib/mcp-scan/registry/tokens-runtime.d.ts +96 -0
- package/src/lib/mcp-scan/registry/ui-components-runtime.d.ts +90 -0
- package/src/lib/mcp-scan/registry/utils-runtime.d.ts +136 -0
- package/src/lib/mcp-scan/scan/_jsdoc-tagged-export/extract-base.d.ts +245 -0
- package/src/lib/mcp-scan/scan/actions-build-manifest.d.ts +58 -0
- package/src/lib/mcp-scan/scan/actions-cli.d.ts +38 -0
- package/src/lib/mcp-scan/scan/actions-extract.d.ts +99 -0
- package/src/lib/mcp-scan/scan/actions-scan-config-schema.d.ts +42 -0
- package/src/lib/mcp-scan/scan/auth-extract.d.ts +120 -0
- package/src/lib/mcp-scan/scan/build-manifest.d.ts +76 -0
- package/src/lib/mcp-scan/scan/cli.d.ts +60 -0
- package/src/lib/mcp-scan/scan/css-utilities-build-manifest.d.ts +76 -0
- package/src/lib/mcp-scan/scan/css-utilities-cli.d.ts +36 -0
- package/src/lib/mcp-scan/scan/css-utilities-extract.d.ts +187 -0
- package/src/lib/mcp-scan/scan/css-utilities-scan-config-schema.d.ts +57 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-build-manifest.d.ts +68 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-cli.d.ts +20 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-extract.d.ts +160 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-scan-config-schema.d.ts +56 -0
- package/src/lib/mcp-scan/scan/discover-downstream-packages.d.ts +76 -0
- package/src/lib/mcp-scan/scan/discover-firebase-packages.d.ts +58 -0
- package/src/lib/mcp-scan/scan/extract-models/assemble.d.ts +105 -0
- package/src/lib/mcp-scan/scan/extract-models/collect-inherited.d.ts +22 -0
- package/src/lib/mcp-scan/scan/extract-models/find-converters.d.ts +19 -0
- package/src/lib/mcp-scan/scan/extract-models/find-enums.d.ts +19 -0
- package/src/lib/mcp-scan/scan/extract-models/find-identities.d.ts +25 -0
- package/src/lib/mcp-scan/scan/extract-models/find-interfaces.d.ts +31 -0
- package/src/lib/mcp-scan/scan/extract-models/find-model-groups.d.ts +21 -0
- package/src/lib/mcp-scan/scan/extract-models/find-service-factories.d.ts +19 -0
- package/src/lib/mcp-scan/scan/extract-models/find-sub-object-consts.d.ts +20 -0
- package/src/lib/mcp-scan/scan/extract-models/index.d.ts +74 -0
- package/src/lib/mcp-scan/scan/extract-models/infer-collection-kind.d.ts +22 -0
- package/src/lib/mcp-scan/scan/extract-models/service-factory-constants.d.ts +6 -0
- package/src/lib/mcp-scan/scan/extract-models/types.d.ts +171 -0
- package/src/lib/mcp-scan/scan/extract.d.ts +82 -0
- package/src/lib/mcp-scan/scan/filters-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/filters-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/filters-extract.d.ts +101 -0
- package/src/lib/mcp-scan/scan/filters-scan-config-schema.d.ts +56 -0
- package/src/lib/mcp-scan/scan/forge-fields-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/forge-fields-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/forge-fields-extract.d.ts +165 -0
- package/src/lib/mcp-scan/scan/forge-fields-scan-config-schema.d.ts +61 -0
- package/src/lib/mcp-scan/scan/index.d.ts +60 -0
- package/src/lib/mcp-scan/scan/model-firebase-index-cli.d.ts +22 -0
- package/src/lib/mcp-scan/scan/model-firebase-index-dispatcher-credit.d.ts +47 -0
- package/src/lib/mcp-scan/scan/model-firebase-index-reference-scan.d.ts +100 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-build-manifest.d.ts +79 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-extract.d.ts +115 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-scan-config-schema.d.ts +59 -0
- package/src/lib/mcp-scan/scan/pipes-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/pipes-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/pipes-extract.d.ts +90 -0
- package/src/lib/mcp-scan/scan/pipes-scan-config-schema.d.ts +56 -0
- package/src/lib/mcp-scan/scan/scan-angular-io.d.ts +89 -0
- package/src/lib/mcp-scan/scan/scan-cli-base.d.ts +162 -0
- package/src/lib/mcp-scan/scan/scan-config-schema.d.ts +44 -0
- package/src/lib/mcp-scan/scan/ui-components-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/ui-components-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/ui-components-extract.d.ts +124 -0
- package/src/lib/mcp-scan/scan/ui-components-scan-config-schema.d.ts +62 -0
- package/src/lib/mcp-scan/scan/utils-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/utils-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/utils-extract.d.ts +103 -0
- package/src/lib/mcp-scan/scan/utils-scan-config-schema.d.ts +57 -0
- package/test/package.json +9 -9
- package/index.cjs.default.js +0 -1
- package/index.cjs.mjs +0 -2
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Models Registry.
|
|
3
|
+
*
|
|
4
|
+
* Canonical metadata for @dereekb/firebase Firestore models — their identity
|
|
5
|
+
* (`firestoreModelIdentity(...)`), persisted fields (derived from
|
|
6
|
+
* `snapshotConverterFunctions({ fields: ... })`), and declared enums.
|
|
7
|
+
*
|
|
8
|
+
* The PRIMARY search index is `collectionPrefix` — the short code that appears
|
|
9
|
+
* in Firestore document keys (`sf/abc123` → StorageFile). That's the fastest
|
|
10
|
+
* way to identify a raw document. Secondary indexes: model `name`
|
|
11
|
+
* (`StorageFile`, `NotificationBox`) and parent identity for subcollections.
|
|
12
|
+
*
|
|
13
|
+
* Data lives in the generated module imported below and is emitted by the
|
|
14
|
+
* `generate-firebase-models` nx target (`scripts/extract-firebase-models.mjs`).
|
|
15
|
+
* Edit the script — never the generated file by hand.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* One TypeScript enum value declared alongside a model. The `value` is the
|
|
19
|
+
* raw persisted integer/string; `description` is the leading JSDoc line.
|
|
20
|
+
*/
|
|
21
|
+
export interface FirebaseEnumValue {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly value: number | string;
|
|
24
|
+
readonly description?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A TypeScript enum declared in the same source file as a model. Collected so
|
|
28
|
+
* the decode tool can translate raw integer values (`fs: 2`) back to
|
|
29
|
+
* human-readable names (`StorageFileState.OK`).
|
|
30
|
+
*/
|
|
31
|
+
export interface FirebaseEnum {
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly values: readonly FirebaseEnumValue[];
|
|
34
|
+
readonly description?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A persisted field on a Firestore document.
|
|
38
|
+
*
|
|
39
|
+
* The canonical field list comes from `snapshotConverterFunctions({ fields })`
|
|
40
|
+
* — the converter is the source of truth for what Firestore stores. TypeScript
|
|
41
|
+
* type and JSDoc description are joined in from the corresponding `interface`
|
|
42
|
+
* property when one exists (may be absent for fields inherited from `extends`
|
|
43
|
+
* clauses).
|
|
44
|
+
*/
|
|
45
|
+
export interface FirebaseField {
|
|
46
|
+
/**
|
|
47
|
+
* Field name as it appears in Firestore and on the TS interface.
|
|
48
|
+
*/
|
|
49
|
+
readonly name: string;
|
|
50
|
+
/**
|
|
51
|
+
* Long-form camelCase identifier for the field, sourced from the `@dbxModelVariable` JSDoc tag.
|
|
52
|
+
*
|
|
53
|
+
* The convention is the field's unabbreviated camelCase variable name (e.g. `uid` → `userUid`,
|
|
54
|
+
* `n` → `name`, `crAt` → `createdAt`), providing a human-readable expansion of the (often
|
|
55
|
+
* 1-4 character) persisted name for use by MCP tooling and downstream documentation. Defaults
|
|
56
|
+
* to `name` when no tag is present (and the scanner emits a warning).
|
|
57
|
+
*/
|
|
58
|
+
readonly longName: string;
|
|
59
|
+
/**
|
|
60
|
+
* Raw converter expression, e.g. `'firestoreDate()'`, `'optionalFirestoreString()'`.
|
|
61
|
+
*/
|
|
62
|
+
readonly converter: string;
|
|
63
|
+
/**
|
|
64
|
+
* TS type string from the interface when available (e.g. `'StorageFileState'`, `'Maybe<Date>'`).
|
|
65
|
+
*/
|
|
66
|
+
readonly tsType?: string;
|
|
67
|
+
/**
|
|
68
|
+
* `true` when the interface property is optional (`?:` or `Maybe<T>`).
|
|
69
|
+
*/
|
|
70
|
+
readonly optional: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* First JSDoc paragraph stripped of tags.
|
|
73
|
+
*/
|
|
74
|
+
readonly description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Name of an enum declared in this file referenced by `tsType` / converter.
|
|
77
|
+
*/
|
|
78
|
+
readonly enumRef?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Sync-flag annotation sourced from the `@dbxModelVariableSyncFlag` JSDoc tag on the field.
|
|
81
|
+
*
|
|
82
|
+
* The tag's text describes what the flag synchronizes when the field is set
|
|
83
|
+
* (e.g. `'Sync the Worker record to its Zoho Recruit candidate.'`). Used to
|
|
84
|
+
* generate the cross-model "Sync flags" section in `dbx_model_lookup` output
|
|
85
|
+
* for fields like `zs`, `rs`, `*ss`, etc. — denormalization triggers that
|
|
86
|
+
* `tsType` alone can't reveal. Absent when the field has no
|
|
87
|
+
* `@dbxModelVariableSyncFlag` tag.
|
|
88
|
+
*/
|
|
89
|
+
readonly syncFlag?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Embedded sub-object structure when the field's converter resolves
|
|
92
|
+
* through a `firestoreSubObject<T>` / `firestoreObjectArray<T>` /
|
|
93
|
+
* `firestoreMap<T>` factory whose `T` carries the `@dbxModelSubObject`
|
|
94
|
+
* JSDoc tag. Populated by the rich extractor's cross-file walk so the
|
|
95
|
+
* catalog can render the nested field table and accept the sub-object's
|
|
96
|
+
* long names in `fields:[...]` filters. Absent when the field is a
|
|
97
|
+
* plain primitive or when the sub-object interface cannot be resolved
|
|
98
|
+
* from the validated model root (e.g. external-package shapes).
|
|
99
|
+
*/
|
|
100
|
+
readonly subObject?: FirebaseSubObject;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Catalog metadata for an embedded sub-object interface persisted as
|
|
104
|
+
* part of a parent model's converter (`firestoreSubObject<T>`,
|
|
105
|
+
* `firestoreObjectArray<T>`, `firestoreMap<T>`). Attached to the parent
|
|
106
|
+
* field as {@link FirebaseField.subObject} when both the converter
|
|
107
|
+
* const and the underlying interface (tagged `@dbxModelSubObject`) are
|
|
108
|
+
* visible to the extractor.
|
|
109
|
+
*/
|
|
110
|
+
export interface FirebaseSubObject {
|
|
111
|
+
/**
|
|
112
|
+
* Interface name (the type-argument of the sub-object factory call —
|
|
113
|
+
* e.g. `WorkerPayStubItem`, `BillingGroupRegionEmbeddedBillingGroup`).
|
|
114
|
+
*/
|
|
115
|
+
readonly interfaceName: string;
|
|
116
|
+
/**
|
|
117
|
+
* Factory shape: `'object'` for a single embedded record
|
|
118
|
+
* (`firestoreSubObject`), `'array'` for a list
|
|
119
|
+
* (`firestoreObjectArray`), `'map'` for a keyed map (`firestoreMap`).
|
|
120
|
+
* Drives the formatter's section label.
|
|
121
|
+
*/
|
|
122
|
+
readonly factoryKind: 'object' | 'array' | 'map';
|
|
123
|
+
/**
|
|
124
|
+
* Sub-object's own persisted fields, in declaration order. Each field
|
|
125
|
+
* carries its `@dbxModelVariable` long-name and any nested
|
|
126
|
+
* `@dbxModelSubObject` chain so the catalog can render arbitrarily
|
|
127
|
+
* deep embedded structures.
|
|
128
|
+
*/
|
|
129
|
+
readonly fields: readonly FirebaseField[];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Canonical taxonomy of Firestore-collection shapes a model can declare.
|
|
133
|
+
* Used across the registry, scanners, and downstream validator so consumers
|
|
134
|
+
* see one consistent label set for every Firestore-collection shape.
|
|
135
|
+
*
|
|
136
|
+
* - `'root'`: standard root collection. Type alias `FirestoreCollection<T, D>`,
|
|
137
|
+
* factory body calls `firestoreContext.firestoreCollection({...})`.
|
|
138
|
+
* - `'root-singleton'`: single-document root collection (e.g. an app-config
|
|
139
|
+
* doc). Type alias `RootSingleItemFirestoreCollection<T, D>`, factory body
|
|
140
|
+
* calls `firestoreContext.rootSingleItemFirestoreCollection({...})`.
|
|
141
|
+
* - `'sub-collection'`: multi-item subcollection under a parent. Type alias
|
|
142
|
+
* `FirestoreCollectionWithParent<T, PT, D, PD>`, factory body calls
|
|
143
|
+
* `firestoreContext.firestoreCollectionWithParent({...})`.
|
|
144
|
+
* - `'singleton-sub'`: one-document-per-parent subcollection (e.g.
|
|
145
|
+
* `<parent>/private/private`). Type alias
|
|
146
|
+
* `SingleItemFirestoreCollection<T, PT, D, PD>`, factory body calls
|
|
147
|
+
* `firestoreContext.singleItemFirestoreCollection({...})`.
|
|
148
|
+
*/
|
|
149
|
+
export type FirestoreCollectionKind = 'root' | 'root-singleton' | 'sub-collection' | 'singleton-sub';
|
|
150
|
+
/**
|
|
151
|
+
* A Firestore model entry.
|
|
152
|
+
*/
|
|
153
|
+
export interface FirebaseModel {
|
|
154
|
+
/**
|
|
155
|
+
* Interface / class name (e.g. `'StorageFile'`, `'NotificationBox'`).
|
|
156
|
+
*/
|
|
157
|
+
readonly name: string;
|
|
158
|
+
/**
|
|
159
|
+
* First JSDoc paragraph from the model's `@dbxModel` interface declaration. Captures the
|
|
160
|
+
* business-purpose narrative ("A Worker represents a substitute teacher…") so consumers
|
|
161
|
+
* don't have to open the source file. Absent when the interface has no leading JSDoc.
|
|
162
|
+
*/
|
|
163
|
+
readonly description?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Identity constant name (e.g. `'storageFileIdentity'`).
|
|
166
|
+
*/
|
|
167
|
+
readonly identityConst: string;
|
|
168
|
+
/**
|
|
169
|
+
* Model type string passed to `firestoreModelIdentity` (e.g. `'storageFile'`).
|
|
170
|
+
*/
|
|
171
|
+
readonly modelType: string;
|
|
172
|
+
/**
|
|
173
|
+
* PRIMARY INDEX — collection prefix as it appears in Firestore keys (`'sf'`, `'nb'`, `'sys'`).
|
|
174
|
+
*/
|
|
175
|
+
readonly collectionPrefix: string;
|
|
176
|
+
/**
|
|
177
|
+
* Identity const of the parent model for subcollections. Absent for root collections.
|
|
178
|
+
*/
|
|
179
|
+
readonly parentIdentityConst?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Package the model lives in (`'@dereekb/firebase'` for upstream, downstream
|
|
182
|
+
* package name like `'demo-firebase'` for component packages discovered at
|
|
183
|
+
* runtime).
|
|
184
|
+
*/
|
|
185
|
+
readonly sourcePackage: string;
|
|
186
|
+
/**
|
|
187
|
+
* Source file path relative to the workspace root.
|
|
188
|
+
*/
|
|
189
|
+
readonly sourceFile: string;
|
|
190
|
+
/**
|
|
191
|
+
* Persisted fields, canonical list from the converter.
|
|
192
|
+
*/
|
|
193
|
+
readonly fields: readonly FirebaseField[];
|
|
194
|
+
/**
|
|
195
|
+
* Enums declared in the same file (may be referenced by field types).
|
|
196
|
+
*/
|
|
197
|
+
readonly enums: readonly FirebaseEnum[];
|
|
198
|
+
/**
|
|
199
|
+
* Unique-ish field names used to auto-detect the model from raw JSON when no hint is supplied.
|
|
200
|
+
*/
|
|
201
|
+
readonly detectionHints: readonly string[];
|
|
202
|
+
/**
|
|
203
|
+
* Group name from the `@dbxModelGroup` tag on the model's `<X>FirestoreCollections` container
|
|
204
|
+
* (e.g. `'Notification'`). Defaults to the container name with the `FirestoreCollections`
|
|
205
|
+
* suffix stripped when the tag has no explicit argument.
|
|
206
|
+
*
|
|
207
|
+
* Absent when the file declares no model-group container.
|
|
208
|
+
*/
|
|
209
|
+
readonly modelGroup?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Firestore-collection shape, derived by inspecting the model's
|
|
212
|
+
* `<modelType>FirestoreCollection` / `<modelType>FirestoreCollectionFactory`
|
|
213
|
+
* function body for the `firestoreContext.*` call it makes. Mirrors the
|
|
214
|
+
* consumer-side store-shape labels: `'root'`, `'root-singleton'`,
|
|
215
|
+
* `'sub-collection'`, `'singleton-sub'`. Absent when the scanner cannot
|
|
216
|
+
* locate a recognised call (e.g. exotic factory shapes).
|
|
217
|
+
*/
|
|
218
|
+
readonly collectionKind?: FirestoreCollectionKind;
|
|
219
|
+
/**
|
|
220
|
+
* `true` when the model's interface (or one of its same-file ancestors)
|
|
221
|
+
* extends `UserRelatedById` from `@dereekb/firebase` — meaning the
|
|
222
|
+
* Firestore document's id IS a Firebase Auth user uid, so the doc is 1:1
|
|
223
|
+
* with a user. Surfaced through `dbx_model_lookup`, `dbx_model_search`,
|
|
224
|
+
* and the `dbx://model/firebase/user-keyed-by-id` resource so consumers
|
|
225
|
+
* can quickly enumerate the per-user document set.
|
|
226
|
+
*/
|
|
227
|
+
readonly userKeyedById?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* `true` when the model's interface (or one of its same-file ancestors)
|
|
230
|
+
* extends `UserRelated` (alias of `FirebaseAuthUserIdRef`) from
|
|
231
|
+
* `@dereekb/firebase` — meaning the document carries an explicit `uid`
|
|
232
|
+
* field referencing the Firebase Auth user. Independent of
|
|
233
|
+
* {@link userKeyedById}: a model can have either, both, or neither.
|
|
234
|
+
*/
|
|
235
|
+
readonly hasUserUidField?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* `true` when the model's interface (or one of its same-file ancestors)
|
|
238
|
+
* extends `RegionRelatedById` — i.e. the Firestore document id IS the
|
|
239
|
+
* region key. Parallel signal to {@link userKeyedById} used by the model
|
|
240
|
+
* archetype recommender and by the `dbx://model/firebase/region-keyed-by-id`
|
|
241
|
+
* resource.
|
|
242
|
+
*/
|
|
243
|
+
readonly regionKeyedById?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* `true` when the model's interface extends `DistrictRelatedById` — doc id
|
|
246
|
+
* IS the district key. Parallel signal to {@link regionKeyedById}.
|
|
247
|
+
*/
|
|
248
|
+
readonly districtKeyedById?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* `true` when the model's interface (or one of its same-file ancestors)
|
|
251
|
+
* extends the `ExternalRelatedById` marker — meaning the Firestore document
|
|
252
|
+
* id IS an external vendor id (Zoho candidate id, etc.). Used by the model
|
|
253
|
+
* archetype recommender to disambiguate `external-id-keyed-entity-root` from
|
|
254
|
+
* `external-mirror`.
|
|
255
|
+
*/
|
|
256
|
+
readonly externalIdKeyedById?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* `true` when the model's interface (or one of its same-file ancestors)
|
|
259
|
+
* extends a `*BucketKeyRelatedById` / `*YearWeekRelatedById` marker — i.e.
|
|
260
|
+
* the Firestore document id IS a temporal bucket code (year-week, year-month,
|
|
261
|
+
* …). Drives the `denormalised-aggregate.keying = bucket-code` axis on the
|
|
262
|
+
* archetype recommender.
|
|
263
|
+
*/
|
|
264
|
+
readonly bucketKeyedById?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Archetype slugs for this model. Multiple slugs are emitted when one model
|
|
267
|
+
* legitimately belongs to several catalog entries simultaneously (e.g. a
|
|
268
|
+
* composite-key root that is both `composite-key-root` AND
|
|
269
|
+
* `denormalised-aggregate`).
|
|
270
|
+
* Populated by the `extract-firebase-models` heuristic, or replaced wholesale
|
|
271
|
+
* by one-or-more `@dbxModelArchetype <slug>` JSDoc tags on the model
|
|
272
|
+
* interface. Absent when the heuristic cannot tag the model with high enough
|
|
273
|
+
* confidence.
|
|
274
|
+
*
|
|
275
|
+
* The slug values are the catalog keys from
|
|
276
|
+
* `src/registry/archetypes.ts:MODEL_ARCHETYPES`. Surfaced through
|
|
277
|
+
* `dbx_model_lookup` and consumed by `dbx_model_archetype_search` peer
|
|
278
|
+
* search.
|
|
279
|
+
*/
|
|
280
|
+
readonly archetypes?: readonly string[];
|
|
281
|
+
/**
|
|
282
|
+
* Optional axis refinements keyed by archetype slug — e.g.
|
|
283
|
+
* `{ 'single-item-sub': { subPurpose: 'private' } }` or
|
|
284
|
+
* `{ 'denormalised-aggregate': { keying: 'bucket-code', syncMode: 'flag-eventual' } }`.
|
|
285
|
+
* Populated from the same JSDoc override or heuristic that fills
|
|
286
|
+
* {@link archetypes}. Slugs without refinements are simply absent from the
|
|
287
|
+
* map.
|
|
288
|
+
*/
|
|
289
|
+
readonly archetypeAxesBySlug?: {
|
|
290
|
+
readonly [slug: string]: {
|
|
291
|
+
readonly [axisName: string]: string;
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Names of upstream models this model aggregates from. Populated from
|
|
296
|
+
* `@dbxModelAggregatesFrom <ModelName>` JSDoc tags on the model interface
|
|
297
|
+
* (repeatable). Used by the archetype recommender to derive
|
|
298
|
+
* `aggregatesFromNonEmpty` and `siblingAggregatesFrom` signals.
|
|
299
|
+
*/
|
|
300
|
+
readonly aggregatesFrom?: readonly string[];
|
|
301
|
+
/**
|
|
302
|
+
* `true` when every name in {@link aggregatesFrom} resolves to a model in
|
|
303
|
+
* the same {@link modelGroup}. Derived by the extractor's post-pass so the
|
|
304
|
+
* recommender can decisively boost `root-singleton-aggregate`.
|
|
305
|
+
*/
|
|
306
|
+
readonly siblingAggregatesFrom?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* `true` when the interface carries the `@dbxModelOrganizationalGroupRoot`
|
|
309
|
+
* tag — i.e. the root collection serves as an organizational / tenant
|
|
310
|
+
* boundary that owns subordinate models. Surfaced through the recommender
|
|
311
|
+
* as a signal for the `group-root` archetype.
|
|
312
|
+
*/
|
|
313
|
+
readonly organizationalGroupRoot?: boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Parsed `@dbxModelCompositeKey from=<ModelA>,<ModelB> encoding=<two-way|one-way>`
|
|
316
|
+
* tag — present when the interface declares one. Records which source models
|
|
317
|
+
* the doc id composites from, and which flat-key encoding is used. `from`
|
|
318
|
+
* is `'*'` for framework models (`NotificationBox`, `NotificationSummary`)
|
|
319
|
+
* that accept any source identity. Validators use this to confirm the
|
|
320
|
+
* model's archetype tagging matches the composite-key declaration; the
|
|
321
|
+
* archetype recommender / search use it to surface peer composite-key roots.
|
|
322
|
+
*/
|
|
323
|
+
readonly compositeKey?: {
|
|
324
|
+
readonly from: readonly string[] | '*';
|
|
325
|
+
readonly encoding: 'two-way' | 'one-way';
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Read posture declared by `@dbxModelRead <level>` on the model interface. Closed enum:
|
|
329
|
+
* `system` / `owner` / `admin-only` are statically inferable from common `roleMapForModel`
|
|
330
|
+
* helpers; `permissions` is the escape hatch for non-trivial computed read grants.
|
|
331
|
+
*
|
|
332
|
+
* Absent when the model interface omits the tag — surfaced as `undefined` to MCP catalog
|
|
333
|
+
* consumers so they can distinguish "not declared" from "declared as permissions".
|
|
334
|
+
*/
|
|
335
|
+
readonly read?: 'system' | 'owner' | 'admin-only' | 'permissions';
|
|
336
|
+
/**
|
|
337
|
+
* Joined entry from the `@dbxModelServiceFactory <modelType>`-tagged export that implements
|
|
338
|
+
* this model. Populated by the model extractor's post-pass when a factory with a matching
|
|
339
|
+
* modelType is found in the same scan. Absent when no factory is declared — picked up by
|
|
340
|
+
* the orphan-model lint rule.
|
|
341
|
+
*/
|
|
342
|
+
readonly serviceFactory?: {
|
|
343
|
+
readonly exportName: string;
|
|
344
|
+
readonly sourceFile: string;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* A `<Name>FirestoreCollections` container class tagged with `@dbxModelGroup`.
|
|
349
|
+
*
|
|
350
|
+
* Captures which models are aggregated together for dependency injection and documentation purposes.
|
|
351
|
+
*/
|
|
352
|
+
export interface FirebaseModelGroup {
|
|
353
|
+
/**
|
|
354
|
+
* Group name from `@dbxModelGroup <name>` (e.g. `'Notification'`).
|
|
355
|
+
*
|
|
356
|
+
* Defaults to the container name with the `FirestoreCollections` suffix stripped when the
|
|
357
|
+
* tag is bare (`@dbxModelGroup` with no argument). The scanner emits a warning in that case.
|
|
358
|
+
*/
|
|
359
|
+
readonly name: string;
|
|
360
|
+
/**
|
|
361
|
+
* Name of the abstract class / interface tagged with `@dbxModelGroup`
|
|
362
|
+
* (e.g. `'NotificationFirestoreCollections'`).
|
|
363
|
+
*/
|
|
364
|
+
readonly containerName: string;
|
|
365
|
+
/**
|
|
366
|
+
* Package the group lives in (`'@dereekb/firebase'` for upstream, downstream
|
|
367
|
+
* package name like `'demo-firebase'` for component packages discovered at
|
|
368
|
+
* runtime).
|
|
369
|
+
*/
|
|
370
|
+
readonly sourcePackage: string;
|
|
371
|
+
/**
|
|
372
|
+
* Source file path relative to the workspace root.
|
|
373
|
+
*/
|
|
374
|
+
readonly sourceFile: string;
|
|
375
|
+
/**
|
|
376
|
+
* First JSDoc paragraph from the class declaration.
|
|
377
|
+
*/
|
|
378
|
+
readonly description?: string;
|
|
379
|
+
/**
|
|
380
|
+
* Names of the models referenced by this group's collection accessors (e.g. `['NotificationUser', 'NotificationBox']`).
|
|
381
|
+
*
|
|
382
|
+
* Derived from the `<Model>FirestoreCollection` / `<Model>FirestoreCollectionFactory` / `<Model>FirestoreCollectionGroup`
|
|
383
|
+
* type names found on the group's declared properties.
|
|
384
|
+
*/
|
|
385
|
+
readonly modelNames: readonly string[];
|
|
386
|
+
}
|
|
387
|
+
export { FIREBASE_MODELS, FIREBASE_MODEL_GROUPS } from '../../../../generated/firebase-models.generated.js';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forge-fields runtime registry wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the raw {@link LoadForgeFieldManifestsResult} produced by the loader
|
|
5
|
+
* with domain-friendly accessors so the lookup / search tools and the
|
|
6
|
+
* registry resource don't have to walk Maps directly.
|
|
7
|
+
*
|
|
8
|
+
* The registry is loaded once at server startup and passed into the tool
|
|
9
|
+
* factories. Tests can construct a registry from any manifest entry array
|
|
10
|
+
* via {@link createForgeFieldRegistryFromEntries} to drive the tools without
|
|
11
|
+
* touching disk.
|
|
12
|
+
*
|
|
13
|
+
* Manifest entries (flat, JSON-friendly shape) are converted into the
|
|
14
|
+
* discriminated `FormFieldInfo` union exposed by `registry/index.ts`. The
|
|
15
|
+
* tools and resources continue to consume that legacy shape so this module
|
|
16
|
+
* is the only seam that changed when the hand-written entries were deleted.
|
|
17
|
+
*/
|
|
18
|
+
import type { LoadForgeFieldManifestsResult } from '../manifest/forge-fields-loader.js';
|
|
19
|
+
import type { ForgeFieldEntry } from '../manifest/forge-fields-schema.js';
|
|
20
|
+
import type { FormFieldInfo, FormTier, FormArrayOutput } from './form-fields.js';
|
|
21
|
+
/**
|
|
22
|
+
* Domain-friendly read API over a merged forge-fields manifest set. All
|
|
23
|
+
* accessors return readonly arrays preserving the order the manifests
|
|
24
|
+
* declared their entries (manifests are walked in source order).
|
|
25
|
+
*/
|
|
26
|
+
export interface ForgeFieldRegistry {
|
|
27
|
+
readonly all: readonly FormFieldInfo[];
|
|
28
|
+
readonly loadedSources: readonly string[];
|
|
29
|
+
readonly tiers: readonly FormTier[];
|
|
30
|
+
readonly producesCatalog: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* Returns the entry whose slug matches `slug` exactly. Slugs are unique
|
|
33
|
+
* across manifests (collisions emit a loader warning and the second-loaded
|
|
34
|
+
* entry wins).
|
|
35
|
+
*/
|
|
36
|
+
findBySlug(slug: string): FormFieldInfo | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the entry whose factory name matches `factoryName`
|
|
39
|
+
* (case-insensitive).
|
|
40
|
+
*/
|
|
41
|
+
findByFactoryName(factoryName: string): FormFieldInfo | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Returns every entry whose `produces` field matches `value` exactly.
|
|
44
|
+
*/
|
|
45
|
+
findByProduces(value: string): readonly FormFieldInfo[];
|
|
46
|
+
/**
|
|
47
|
+
* Returns every entry whose `tier` field matches `tier` exactly.
|
|
48
|
+
*/
|
|
49
|
+
findByTier(tier: FormTier): readonly FormFieldInfo[];
|
|
50
|
+
/**
|
|
51
|
+
* Returns every entry whose `arrayOutput` field matches `arrayOutput`
|
|
52
|
+
* exactly.
|
|
53
|
+
*/
|
|
54
|
+
findByArrayOutput(arrayOutput: FormArrayOutput): readonly FormFieldInfo[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Builds a {@link ForgeFieldRegistry} from a loader result.
|
|
58
|
+
*
|
|
59
|
+
* @param loaded - The merged registry returned by `loadForgeFieldManifests`
|
|
60
|
+
* @returns A domain-friendly read API over the merged entries.
|
|
61
|
+
*
|
|
62
|
+
* @__NO_SIDE_EFFECTS__
|
|
63
|
+
*/
|
|
64
|
+
export declare function createForgeFieldRegistry(loaded: LoadForgeFieldManifestsResult): ForgeFieldRegistry;
|
|
65
|
+
/**
|
|
66
|
+
* Builds a {@link ForgeFieldRegistry} from a raw {@link FormFieldInfo} array.
|
|
67
|
+
* Used by tests that need to drive the tools without going through the loader
|
|
68
|
+
* pipeline, and by snapshot tests comparing the merged registry against the
|
|
69
|
+
* legacy hand-written `FORM_FIELDS` constant.
|
|
70
|
+
*
|
|
71
|
+
* @param input - The entries plus the source labels to advertise.
|
|
72
|
+
* @param input.entries - The full entry list.
|
|
73
|
+
* @param input.loadedSources - Source labels reported via `registry.loadedSources`
|
|
74
|
+
* @returns A domain-friendly read API over the supplied entries.
|
|
75
|
+
*
|
|
76
|
+
* @__NO_SIDE_EFFECTS__
|
|
77
|
+
*/
|
|
78
|
+
export declare function createForgeFieldRegistryFromEntries(input: {
|
|
79
|
+
readonly entries: readonly FormFieldInfo[];
|
|
80
|
+
readonly loadedSources: readonly string[];
|
|
81
|
+
}): ForgeFieldRegistry;
|
|
82
|
+
/**
|
|
83
|
+
* Empty registry suitable as a default when the server has no forge-fields
|
|
84
|
+
* manifest sources to load. Tools wired against this registry behave like a
|
|
85
|
+
* registry that loaded successfully with zero entries.
|
|
86
|
+
*/
|
|
87
|
+
export declare const EMPTY_FORGE_FIELD_REGISTRY: ForgeFieldRegistry;
|
|
88
|
+
/**
|
|
89
|
+
* Converts a manifest entry into the discriminated {@link FormFieldInfo}
|
|
90
|
+
* union the existing tools consume. The properties array is rolled back into
|
|
91
|
+
* the `Record<string, PropertyInfo>` shape callers expect on `config`.
|
|
92
|
+
*
|
|
93
|
+
* Tier-specific fields are read off the manifest entry; the schema is
|
|
94
|
+
* permissive (all tier-specific fields are optional) so this function asserts
|
|
95
|
+
* the right combination is present per tier and falls back to safe defaults
|
|
96
|
+
* when a generator emits a partially-populated entry.
|
|
97
|
+
*
|
|
98
|
+
* @param entry - The manifest entry to convert.
|
|
99
|
+
* @returns The matching FormFieldInfo.
|
|
100
|
+
*/
|
|
101
|
+
export declare function toFormFieldInfo(entry: ForgeFieldEntry): FormFieldInfo;
|