@dereekb/dbx-cli 13.11.18 → 13.12.1
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/main.js +1314 -0
- package/generate-mcp-manifest/package.json +6 -0
- package/generated/firebase-models.generated.d.ts +3 -0
- package/index.cjs.js +45614 -640
- package/index.esm.js +45321 -643
- package/lint-cache/main.js +32 -28
- 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 +127 -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,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model archetype catalog.
|
|
3
|
+
*
|
|
4
|
+
* Canonical metadata for the 17 Firestore-model archetypes plus 3 field-level
|
|
5
|
+
* add-ons that the `dbx_model_archetype_*` tool cluster recommends, looks up,
|
|
6
|
+
* and filters peers by. Pure data — no imports, no state — so it can be
|
|
7
|
+
* consumed from tools, resources, and tests without bootstrap overhead.
|
|
8
|
+
*
|
|
9
|
+
* Each archetype carries its `slug`, the implied
|
|
10
|
+
* {@link FirestoreCollectionKind}, a short narrative description, a structured
|
|
11
|
+
* "answer template" (`expected`) used by the recommender's scoring algorithm,
|
|
12
|
+
* and the discrete axis values that further refine the slug.
|
|
13
|
+
*
|
|
14
|
+
* The recommender's scoring algorithm walks {@link MODEL_ARCHETYPES} once per
|
|
15
|
+
* call and never mutates the array, so the entire table is frozen at
|
|
16
|
+
* compile-time through `readonly` types. New archetypes are added by appending
|
|
17
|
+
* a {@link ModelArchetypeInfo} entry — the tool cluster picks it up
|
|
18
|
+
* automatically.
|
|
19
|
+
*/
|
|
20
|
+
import type { FirestoreCollectionKind } from './firebase-models.js';
|
|
21
|
+
/**
|
|
22
|
+
* First-class sync-mode taxonomy attached to every model archetype. Mirrors the
|
|
23
|
+
* vocabulary documented in the planning doc (`§3 Sync-Mode Vocabulary`) so the
|
|
24
|
+
* recommender's questionnaire, the catalog UI, and the heuristic extractor all
|
|
25
|
+
* use one set of values.
|
|
26
|
+
*
|
|
27
|
+
* - `always-in-sync` – source of truth or updated synchronously alongside its dependency.
|
|
28
|
+
* - `trigger-eventual` – patched by an `onWrite` / `onCreate` Firestore trigger.
|
|
29
|
+
* - `flag-eventual` – source carries a `@dbxModelVariableSyncFlag` boolean flag walked by a scheduler.
|
|
30
|
+
* - `scheduled-rebuild` – periodic full/partial rebuild on a cron; no per-source flag.
|
|
31
|
+
* - `append-only` – never updated after creation; new docs supersede old.
|
|
32
|
+
* - `pull-on-demand` – read by code when needed; nothing watches it.
|
|
33
|
+
* - `external-bidirectional` – webhook patches in, scheduled reconciler patches out.
|
|
34
|
+
*/
|
|
35
|
+
export type ModelArchetypeSyncMode = 'always-in-sync' | 'trigger-eventual' | 'flag-eventual' | 'scheduled-rebuild' | 'append-only' | 'pull-on-demand' | 'external-bidirectional';
|
|
36
|
+
/**
|
|
37
|
+
* Every recognised sync-mode in declaration order. Exported so resources can
|
|
38
|
+
* surface a stable list (`dbx://model-archetype/by-sync-mode/{mode}`) without
|
|
39
|
+
* re-deriving it from {@link MODEL_ARCHETYPES}.
|
|
40
|
+
*/
|
|
41
|
+
export declare const MODEL_ARCHETYPE_SYNC_MODES: readonly ModelArchetypeSyncMode[];
|
|
42
|
+
/**
|
|
43
|
+
* Discrete values for the `docIdSource` questionnaire field. Used both by the
|
|
44
|
+
* recommender (top-tier discriminator, weight 3) and by the `denormalised-aggregate`
|
|
45
|
+
* archetype's `keying` axis. Keep in sync with the canonical schema in
|
|
46
|
+
* the planning doc (`§4.1`).
|
|
47
|
+
*/
|
|
48
|
+
export type ModelArchetypeDocIdSource = 'auto' | 'parent-id' | 'user-uid' | 'external-vendor-id' | 'geo-key' | 'bucket-code' | 'composite-flat-key' | 'numeric-short-id' | 'fixed';
|
|
49
|
+
/**
|
|
50
|
+
* Discrete values for the `parentRelation` questionnaire field. Captures both
|
|
51
|
+
* the structural parent (one / many parents, no parent) AND the meta-parent
|
|
52
|
+
* cases the recommender uses to disambiguate user-keyed, external-id-keyed,
|
|
53
|
+
* geo-key roots.
|
|
54
|
+
*/
|
|
55
|
+
export type ModelArchetypeParentRelation = 'none' | 'one-parent' | 'many-parents' | 'user-uid' | 'external-vendor-id' | 'region-key' | 'district-key' | 'composite-key';
|
|
56
|
+
/**
|
|
57
|
+
* Discrete values for the `userRelation` questionnaire field. Independent of
|
|
58
|
+
* {@link ModelArchetypeDocIdSource}: a model can have `uid-is-doc-id` AND a
|
|
59
|
+
* field reference (`references-user-key`) in tandem.
|
|
60
|
+
*/
|
|
61
|
+
export type ModelArchetypeUserRelation = 'none' | 'owned-by-uid' | 'uid-is-doc-id' | 'references-user-key' | 'external-vendor-id-is-doc-id';
|
|
62
|
+
/**
|
|
63
|
+
* Discrete values for the `mutability` questionnaire field. The `append-only`
|
|
64
|
+
* case lives on `syncMode`, not here — once a doc is created it can still be
|
|
65
|
+
* `mutable` or `immutable` across its lifetime independently.
|
|
66
|
+
*/
|
|
67
|
+
export type ModelArchetypeMutability = 'mutable' | 'immutable';
|
|
68
|
+
/**
|
|
69
|
+
* Every recognised archetype slug. Axis values (e.g.
|
|
70
|
+
* `single-item-sub.subPurpose`, `denormalised-aggregate.keying`) further refine
|
|
71
|
+
* a slug rather than introducing separate slugs.
|
|
72
|
+
*/
|
|
73
|
+
export type ModelArchetypeSlug = 'root-entity' | 'sub-collection-entity' | 'single-item-sub' | 'user-keyed-entity-root' | 'user-keyed-index-root' | 'external-id-keyed-entity-root' | 'group-root' | 'group-member' | 'composite-key-root' | 'denormalised-aggregate' | 'root-singleton-aggregate' | 'external-mirror' | 'audit-log' | 'lifecycle-item' | 'reference-registry' | 'model-tree-node' | 'system-state-singleton' | 'storagefile-purpose' | 'notification-template' | 'notification-task' | 'state-machine-item' | 'embedded-sub-objects' | 'active-vs-archive-split';
|
|
74
|
+
/**
|
|
75
|
+
* Field-level add-on slugs that never appear as the primary archetype answer —
|
|
76
|
+
* always returned alongside a "real" archetype on the recommender's "Field-level
|
|
77
|
+
* add-ons" list.
|
|
78
|
+
*/
|
|
79
|
+
export declare const MODEL_ARCHETYPE_ADDON_SLUGS: readonly ModelArchetypeSlug[];
|
|
80
|
+
/**
|
|
81
|
+
* Discrete values for `single-item-sub.subPurpose`. Captures why this 1:1
|
|
82
|
+
* subcollection exists — sensitive split, permission table, parent config,
|
|
83
|
+
* parent state, denormalised summary, member-count summary.
|
|
84
|
+
*/
|
|
85
|
+
export type ModelArchetypeSingleItemSubPurpose = 'private' | 'permission' | 'config' | 'state' | 'summary' | 'member-summary';
|
|
86
|
+
/**
|
|
87
|
+
* Discrete values for `denormalised-aggregate.keying`. Combined with
|
|
88
|
+
* `syncMode`, these distinguish parent-keyed digests, bucketed temporal
|
|
89
|
+
* summaries, composite-keyed indexes, and short-id subcollection summaries.
|
|
90
|
+
*/
|
|
91
|
+
export type ModelArchetypeDenormalisedAggregateKeying = 'parent-id' | 'bucket-code' | 'composite-flat-key' | 'numeric-short-id';
|
|
92
|
+
/**
|
|
93
|
+
* Canonical answer template for one archetype. Each field is the *expected*
|
|
94
|
+
* value the recommender looks for on a matching questionnaire; the scoring
|
|
95
|
+
* algorithm sums weighted matches across these dimensions.
|
|
96
|
+
*
|
|
97
|
+
* Each property is optional because not every archetype constrains every
|
|
98
|
+
* dimension — `root-entity` allows any `userRelation`, so its template omits
|
|
99
|
+
* the field rather than forcing one value. Unset answers contribute zero to
|
|
100
|
+
* the score on either side (see `§5.2 Scoring algorithm`).
|
|
101
|
+
*/
|
|
102
|
+
export interface ModelArchetypeExpectedAnswers {
|
|
103
|
+
readonly docIdSource?: readonly ModelArchetypeDocIdSource[];
|
|
104
|
+
readonly parentRelation?: readonly ModelArchetypeParentRelation[];
|
|
105
|
+
readonly userRelation?: readonly ModelArchetypeUserRelation[];
|
|
106
|
+
readonly syncMode?: readonly ModelArchetypeSyncMode[];
|
|
107
|
+
readonly isDenormalization?: boolean;
|
|
108
|
+
readonly isExternalMirror?: boolean;
|
|
109
|
+
readonly isEventLog?: boolean;
|
|
110
|
+
readonly hasInheritance?: boolean;
|
|
111
|
+
readonly isSiblingAggregate?: boolean;
|
|
112
|
+
readonly isSubsystemSingleton?: boolean;
|
|
113
|
+
readonly involvesFileUpload?: boolean;
|
|
114
|
+
readonly sendsMessageToUser?: boolean;
|
|
115
|
+
readonly isMultiCheckpointWorkflow?: boolean;
|
|
116
|
+
readonly hasLifecycleStates?: boolean;
|
|
117
|
+
readonly hasSensitiveFields?: boolean;
|
|
118
|
+
readonly needsFineGrainedPermissions?: boolean;
|
|
119
|
+
readonly hasArchiveCounterpart?: boolean;
|
|
120
|
+
readonly mutability?: readonly ModelArchetypeMutability[];
|
|
121
|
+
readonly instancesPerParent?: readonly ('one' | 'many')[];
|
|
122
|
+
readonly aggregatesFromNonEmpty?: boolean;
|
|
123
|
+
readonly isGroupRoot?: boolean;
|
|
124
|
+
readonly isTreeNode?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Catalog entry for one archetype. Shared by the recommender, lookup, search,
|
|
128
|
+
* resource, and heuristic extractor so they all read from one source of truth.
|
|
129
|
+
*/
|
|
130
|
+
export interface ModelArchetypeInfo {
|
|
131
|
+
readonly slug: ModelArchetypeSlug;
|
|
132
|
+
/**
|
|
133
|
+
* Family the archetype belongs to (`'standalone-entity'`, `'user-external-root'`, …).
|
|
134
|
+
* Surfaced in the catalog group headers and `_lookup` output so users can see
|
|
135
|
+
* sibling archetypes alongside the matched one.
|
|
136
|
+
*/
|
|
137
|
+
readonly family: string;
|
|
138
|
+
/**
|
|
139
|
+
* Implied {@link FirestoreCollectionKind}. Some archetypes (e.g.
|
|
140
|
+
* `denormalised-aggregate`) accept more than one kind depending on axis
|
|
141
|
+
* values — the dominant kind is listed here and the alternative is recorded
|
|
142
|
+
* in `description`. The recommender's "Shape" block prints whichever value
|
|
143
|
+
* the questionnaire actually implies; this field is used by
|
|
144
|
+
* `dbx://model-archetype/by-collection-kind/{kind}` to filter the catalog.
|
|
145
|
+
*/
|
|
146
|
+
readonly collectionKind: FirestoreCollectionKind;
|
|
147
|
+
/**
|
|
148
|
+
* First-paragraph narrative description, also printed by `_lookup`.
|
|
149
|
+
*/
|
|
150
|
+
readonly description: string;
|
|
151
|
+
/**
|
|
152
|
+
* One-line guidance for "when to pick this" — appears in the catalog and
|
|
153
|
+
* single-entry views.
|
|
154
|
+
*/
|
|
155
|
+
readonly whenToUse: string;
|
|
156
|
+
/**
|
|
157
|
+
* Optional extension-cluster name when this archetype hooks into one of the
|
|
158
|
+
* `_m` model-extension clusters (`storagefile_m`, `notification_m`,
|
|
159
|
+
* `system_m`). Absent for plain archetypes.
|
|
160
|
+
*/
|
|
161
|
+
readonly extensionCluster?: 'storagefile_m' | 'notification_m' | 'system_m';
|
|
162
|
+
/**
|
|
163
|
+
* Canonical answer template the scorer compares each questionnaire against.
|
|
164
|
+
*/
|
|
165
|
+
readonly expected: ModelArchetypeExpectedAnswers;
|
|
166
|
+
/**
|
|
167
|
+
* Axis name → allowed values. The recommender returns the resolved axis on
|
|
168
|
+
* its output; `_search` accepts an axes filter on these names.
|
|
169
|
+
*/
|
|
170
|
+
readonly axes: {
|
|
171
|
+
readonly [axisName: string]: readonly string[];
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Implementation pointers — skill names, sync-flag conventions, peer-search
|
|
175
|
+
* notes. Surfaced verbatim on the recommender's "Implementation pointers"
|
|
176
|
+
* bullet list.
|
|
177
|
+
*/
|
|
178
|
+
readonly implementationPointers: readonly string[];
|
|
179
|
+
/**
|
|
180
|
+
* Optional comment shown alongside the slug — used to capture the
|
|
181
|
+
* "is/isn't" disambiguation hints (`external-id-keyed-entity-root` vs.
|
|
182
|
+
* `external-mirror`, `root-singleton-aggregate` vs.
|
|
183
|
+
* `system-state-singleton`, …).
|
|
184
|
+
*/
|
|
185
|
+
readonly disambiguation?: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Full ordered catalog of every archetype. Order follows the planning doc's
|
|
189
|
+
* §2 grouping (standalone-entity → user/external roots → group → aggregate
|
|
190
|
+
* families → mirror/log/registry → framework → add-ons) so the catalog renders
|
|
191
|
+
* predictably.
|
|
192
|
+
*/
|
|
193
|
+
export declare const MODEL_ARCHETYPES: readonly ModelArchetypeInfo[];
|
|
194
|
+
/**
|
|
195
|
+
* Resolves a slug to its archetype entry. Returns `undefined` for unknown
|
|
196
|
+
* slugs.
|
|
197
|
+
*
|
|
198
|
+
* @param slug - Archetype slug (`'root-entity'`, `'denormalised-aggregate'`, …)
|
|
199
|
+
* @returns The matching catalog entry, or `undefined` when no archetype uses the slug.
|
|
200
|
+
*/
|
|
201
|
+
export declare function getModelArchetypeBySlug(slug: ModelArchetypeSlug): ModelArchetypeInfo | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Resolves a slug (case-insensitive) to its archetype entry. The canonical
|
|
204
|
+
* entry point for lookup tools.
|
|
205
|
+
*
|
|
206
|
+
* @param slug - Archetype slug.
|
|
207
|
+
* @returns The matching catalog entry, or `undefined` when no archetype uses the slug.
|
|
208
|
+
*/
|
|
209
|
+
export declare function resolveModelArchetype(slug: string): {
|
|
210
|
+
readonly archetype: ModelArchetypeInfo;
|
|
211
|
+
} | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Returns every catalog entry whose `expected.syncMode` includes the given
|
|
214
|
+
* sync mode. Useful for browsing by sync semantics
|
|
215
|
+
* (`dbx://model-archetype/by-sync-mode/{mode}`).
|
|
216
|
+
*
|
|
217
|
+
* @param mode - Sync mode to filter by.
|
|
218
|
+
* @returns Matching archetypes in declaration order.
|
|
219
|
+
*/
|
|
220
|
+
export declare function getModelArchetypesBySyncMode(mode: ModelArchetypeSyncMode): readonly ModelArchetypeInfo[];
|
|
221
|
+
/**
|
|
222
|
+
* Returns every catalog entry whose implied `collectionKind` matches.
|
|
223
|
+
*
|
|
224
|
+
* @param kind - {@link FirestoreCollectionKind} to filter by.
|
|
225
|
+
* @returns Matching archetypes in declaration order.
|
|
226
|
+
*/
|
|
227
|
+
export declare function getModelArchetypesByCollectionKind(kind: FirestoreCollectionKind): readonly ModelArchetypeInfo[];
|
|
228
|
+
/**
|
|
229
|
+
* Returns every catalog entry whose `axes[axisName]` includes the given value.
|
|
230
|
+
*
|
|
231
|
+
* @param axisName - Axis to filter on (e.g. `'subPurpose'`, `'keying'`)
|
|
232
|
+
* @param axisValue - The value to filter by.
|
|
233
|
+
* @returns Matching archetypes in declaration order.
|
|
234
|
+
*/
|
|
235
|
+
export declare function getModelArchetypesByAxisValue(axisName: string, axisValue: string): readonly ModelArchetypeInfo[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curated baseline auth entries shipped with dbx-components-mcp.
|
|
3
|
+
*
|
|
4
|
+
* The auth catalog has two layers:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Built-in (this file)** — `@dereekb/util` role consts, the
|
|
7
|
+
* `@dereekb/firebase` storage-upload claim, and the five `model.*`
|
|
8
|
+
* OIDC scopes from `@dereekb/firebase-server`. These are catalog
|
|
9
|
+
* entries every dbx-components workspace inherits regardless of
|
|
10
|
+
* which apps it ships.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Downstream-loaded** — entries extracted from a downstream
|
|
13
|
+
* app's `claims.ts` file at server-startup time. The
|
|
14
|
+
* {@link loadAuthRegistry} loader walks `components/*-firebase`
|
|
15
|
+
* and `apps/*` for files tagged with `@dbxAuthClaimsApp`,
|
|
16
|
+
* `@dbxAuthClaimsService`, `@dbxAuthClaim`, and `@dbxAuthRoleTag`,
|
|
17
|
+
* then merges the extracted entries with the layer-1 built-ins.
|
|
18
|
+
*
|
|
19
|
+
* The {@link WORKSPACE_AUTH_CLAIMS} / {@link WORKSPACE_AUTH_APPS}
|
|
20
|
+
* constants below mirror the workspace's demo claims module verbatim so
|
|
21
|
+
* tests can drive the auth tools without spinning up the loader. The
|
|
22
|
+
* production server bootstrap does NOT consume them — it goes through
|
|
23
|
+
* {@link loadAuthRegistry} to extract the same entries from disk.
|
|
24
|
+
*/
|
|
25
|
+
import type { AuthAppInfo, AuthClaimInfo, AuthRoleInfo, AuthScopeInfo } from './auth-runtime.js';
|
|
26
|
+
/**
|
|
27
|
+
* Roles defined by `@dereekb/util` plus the `uploads` role contributed by
|
|
28
|
+
* `@dereekb/firebase`. Tags reflect the catalog convention used by
|
|
29
|
+
* downstream apps:
|
|
30
|
+
*
|
|
31
|
+
* - `system` — built-in role from a `@dereekb/*` package
|
|
32
|
+
* - `auth` — fundamental auth-state role
|
|
33
|
+
* - `privileged` — admin / staff-level role
|
|
34
|
+
* - `verified-user` — applies to vetted onboarded users
|
|
35
|
+
* - `uploads` — role gating storage uploads
|
|
36
|
+
*/
|
|
37
|
+
export declare const BUILTIN_AUTH_ROLES: readonly AuthRoleInfo[];
|
|
38
|
+
/**
|
|
39
|
+
* Library-level custom claims. Today this is just the `fr` upload-restriction
|
|
40
|
+
* claim from `@dereekb/firebase`; downstream apps mix it into their own
|
|
41
|
+
* `*ApiAuthClaims` interfaces.
|
|
42
|
+
*/
|
|
43
|
+
export declare const BUILTIN_AUTH_CLAIMS: readonly AuthClaimInfo[];
|
|
44
|
+
/**
|
|
45
|
+
* The five callModel CRUD scopes enforced by
|
|
46
|
+
* {@link oidcCallModelScopePreAssert}. App-specific scopes live in the
|
|
47
|
+
* downstream catalog layer.
|
|
48
|
+
*/
|
|
49
|
+
export declare const BUILTIN_AUTH_SCOPES: readonly AuthScopeInfo[];
|
|
50
|
+
/**
|
|
51
|
+
* Workspace-level claim catalog (currently just the demo). Apps that live
|
|
52
|
+
* outside this workspace contribute their own entries through the
|
|
53
|
+
* downstream loader.
|
|
54
|
+
*/
|
|
55
|
+
export declare const WORKSPACE_AUTH_CLAIMS: readonly AuthClaimInfo[];
|
|
56
|
+
/**
|
|
57
|
+
* Workspace-level app catalog (currently just demo-api).
|
|
58
|
+
*/
|
|
59
|
+
export declare const WORKSPACE_AUTH_APPS: readonly AuthAppInfo[];
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth runtime registry wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Catalogs three related domains used to gate access in dbx-components apps:
|
|
5
|
+
*
|
|
6
|
+
* - **roles** — `AuthRole` strings used by the role-set permission model.
|
|
7
|
+
* The well-known constants in `@dereekb/util` (admin, onboarded, tos,
|
|
8
|
+
* user) are bundled by default; downstream apps can register additional
|
|
9
|
+
* roles via tagged JSDoc on their own role consts or claims interfaces.
|
|
10
|
+
*
|
|
11
|
+
* - **claims** — JWT custom-claim keys (e.g. `a`, `o`, `fr`) plus the role
|
|
12
|
+
* mapping each one performs through {@link authRoleClaimsService}. Each
|
|
13
|
+
* entry knows which `*ApiAuthClaims` interface declares it and which
|
|
14
|
+
* app it belongs to.
|
|
15
|
+
*
|
|
16
|
+
* - **scopes** — OAuth/OIDC scope names (`model.read`, `model.write`, …)
|
|
17
|
+
* surfaced through the OIDC bridge, plus the source location where each
|
|
18
|
+
* scope is enforced (e.g. `oidcCallModelScopePreAssert`).
|
|
19
|
+
*
|
|
20
|
+
* - **apps** — one entry per downstream app (demo-api, hellosubs-api).
|
|
21
|
+
* Bundles the claims interface name, the claims-service constant name,
|
|
22
|
+
* and the set of claim keys / scopes the app accepts.
|
|
23
|
+
*
|
|
24
|
+
* The registry is loaded once at server startup and passed into the tool
|
|
25
|
+
* factories. Tests can construct a registry from any entry array via
|
|
26
|
+
* {@link createAuthRegistryFromEntries} to drive the tools without touching
|
|
27
|
+
* disk.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Whether an entry is a built-in `@dereekb/*` definition (`'system'`) or
|
|
31
|
+
* was contributed by a downstream app's catalog (`'app'`). Used by the
|
|
32
|
+
* lookup tools to label provenance and by the catalog to filter.
|
|
33
|
+
*/
|
|
34
|
+
export type AuthEntrySource = 'system' | 'app';
|
|
35
|
+
/**
|
|
36
|
+
* One AuthRole entry.
|
|
37
|
+
*/
|
|
38
|
+
export interface AuthRoleInfo {
|
|
39
|
+
/**
|
|
40
|
+
* The string value of the role as it appears in an `AuthRoleSet`
|
|
41
|
+
* (`'admin'`, `'onboarded'`, `'uploads'`).
|
|
42
|
+
*/
|
|
43
|
+
readonly role: string;
|
|
44
|
+
/**
|
|
45
|
+
* TypeScript constant name when the role originates from an exported
|
|
46
|
+
* const (e.g. `'AUTH_ADMIN_ROLE'`). Optional for app-defined roles
|
|
47
|
+
* declared inline.
|
|
48
|
+
*/
|
|
49
|
+
readonly constName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Origin of the entry — `'system'` for `@dereekb/*` built-ins, `'app'`
|
|
52
|
+
* for catalog entries contributed by a downstream app.
|
|
53
|
+
*/
|
|
54
|
+
readonly source: AuthEntrySource;
|
|
55
|
+
/**
|
|
56
|
+
* Workspace-relative path to the file that declares the role (or the
|
|
57
|
+
* mapping that introduces it).
|
|
58
|
+
*/
|
|
59
|
+
readonly sourcePath: string;
|
|
60
|
+
/**
|
|
61
|
+
* 1-based line number of the role declaration. Optional — included
|
|
62
|
+
* when the extractor / hand-curated entry knows the line.
|
|
63
|
+
*/
|
|
64
|
+
readonly sourceLine?: number;
|
|
65
|
+
/**
|
|
66
|
+
* One-line description.
|
|
67
|
+
*/
|
|
68
|
+
readonly description: string;
|
|
69
|
+
/**
|
|
70
|
+
* Free-form catalog tags (e.g. `'privileged'`, `'verified-user'`).
|
|
71
|
+
* Tags come from `@dbxAuthRoleTag` JSDoc on the claim that maps to the
|
|
72
|
+
* role, or from the curated entry. Used by `dbx_auth_role_lookup` to
|
|
73
|
+
* filter.
|
|
74
|
+
*/
|
|
75
|
+
readonly tags: readonly string[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Role-mapping payload nested inside an {@link AuthClaimInfo}. Mirrors the
|
|
79
|
+
* shape of {@link AuthRoleClaimsFactoryConfigEntry} after normalisation —
|
|
80
|
+
* inverse vs forward, the resolved role list, and any non-default claim
|
|
81
|
+
* value.
|
|
82
|
+
*/
|
|
83
|
+
export interface AuthClaimRoleMappingInfo {
|
|
84
|
+
/**
|
|
85
|
+
* Roles set (or revoked, when `inverse` is true) by the claim.
|
|
86
|
+
*/
|
|
87
|
+
readonly roles: readonly string[];
|
|
88
|
+
/**
|
|
89
|
+
* Whether the mapping is an inverse claim (claim presence revokes roles
|
|
90
|
+
* instead of granting them).
|
|
91
|
+
*/
|
|
92
|
+
readonly inverse: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* For inverse mappings, the SetIncludesMode controlling when the claim
|
|
95
|
+
* value is set during encoding.
|
|
96
|
+
*/
|
|
97
|
+
readonly inverseMode?: 'any' | 'all';
|
|
98
|
+
/**
|
|
99
|
+
* Override claim value when set. `undefined` means the default
|
|
100
|
+
* ({@link DEFAULT_AUTH_ROLE_CLAIMS_CLAIM_VALUE}) is used.
|
|
101
|
+
*/
|
|
102
|
+
readonly claimValue?: string | number | boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Custom encode/decode entry — used by claims that don't fit the
|
|
105
|
+
* `roles` shape and supply functions instead. The presence of this
|
|
106
|
+
* field signals callers that the role list is approximate.
|
|
107
|
+
*/
|
|
108
|
+
readonly customEncodeDecode: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* One auth-claim entry.
|
|
112
|
+
*/
|
|
113
|
+
export interface AuthClaimInfo {
|
|
114
|
+
/**
|
|
115
|
+
* Claim key as it appears on the JWT custom-claims object (`'a'`,
|
|
116
|
+
* `'o'`, `'fr'`).
|
|
117
|
+
*/
|
|
118
|
+
readonly key: string;
|
|
119
|
+
/**
|
|
120
|
+
* TypeScript-ish summary of the claim value type (e.g. `'1'`,
|
|
121
|
+
* `'StorageFileUploadUserRestriction'`).
|
|
122
|
+
*/
|
|
123
|
+
readonly type: string;
|
|
124
|
+
/**
|
|
125
|
+
* One-line description of the claim's meaning.
|
|
126
|
+
*/
|
|
127
|
+
readonly description: string;
|
|
128
|
+
/**
|
|
129
|
+
* Slug of the app that owns the claim (e.g. `'demo-api'`). `undefined`
|
|
130
|
+
* for shared library claims (e.g. `fr` from `@dereekb/firebase`).
|
|
131
|
+
*/
|
|
132
|
+
readonly app?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Name of the TypeScript interface that declares the claim
|
|
135
|
+
* (e.g. `'DemoApiAuthClaims'`, `'StorageFileUploadUserClaims'`).
|
|
136
|
+
*/
|
|
137
|
+
readonly interfaceName?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Workspace-relative path to the file declaring the claim.
|
|
140
|
+
*/
|
|
141
|
+
readonly sourcePath: string;
|
|
142
|
+
/**
|
|
143
|
+
* 1-based line number of the claim's property declaration. Optional.
|
|
144
|
+
*/
|
|
145
|
+
readonly sourceLine?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Origin of the entry. App-owned claims are `'app'`; library claims
|
|
148
|
+
* (e.g. `fr`) are `'system'`.
|
|
149
|
+
*/
|
|
150
|
+
readonly source: AuthEntrySource;
|
|
151
|
+
/**
|
|
152
|
+
* Role-mapping payload. Always present — every catalogued claim maps
|
|
153
|
+
* to at least one role (or revokes one for inverse claims).
|
|
154
|
+
*/
|
|
155
|
+
readonly mapping: AuthClaimRoleMappingInfo;
|
|
156
|
+
/**
|
|
157
|
+
* Free-form catalog tags pulled from `@dbxAuthRoleTag` JSDoc on the
|
|
158
|
+
* claim's property declaration.
|
|
159
|
+
*/
|
|
160
|
+
readonly tags: readonly string[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Where a scope is enforced. Multiple entries are allowed when a scope is
|
|
164
|
+
* checked in more than one place (e.g. `model.read` is enforced by the
|
|
165
|
+
* callModel preAssert and by per-app middleware).
|
|
166
|
+
*/
|
|
167
|
+
export interface AuthScopeEnforcementInfo {
|
|
168
|
+
readonly path: string;
|
|
169
|
+
readonly line?: number;
|
|
170
|
+
/**
|
|
171
|
+
* One-line description of the gate (e.g. `'oidcCallModelScopePreAssert'`).
|
|
172
|
+
*/
|
|
173
|
+
readonly description: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* One OIDC scope entry.
|
|
177
|
+
*/
|
|
178
|
+
export interface AuthScopeInfo {
|
|
179
|
+
/**
|
|
180
|
+
* Full scope name (`'model.read'`, `'demo'`).
|
|
181
|
+
*/
|
|
182
|
+
readonly scope: string;
|
|
183
|
+
/**
|
|
184
|
+
* Conventional prefix shared by a family of scopes
|
|
185
|
+
* (e.g. `'model.'` for the callModel CRUD scopes).
|
|
186
|
+
*/
|
|
187
|
+
readonly prefix?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Logical CRUD verb associated with the scope. `undefined` for app-
|
|
190
|
+
* specific or non-CRUD scopes.
|
|
191
|
+
*/
|
|
192
|
+
readonly callType?: string;
|
|
193
|
+
/**
|
|
194
|
+
* One-line description.
|
|
195
|
+
*/
|
|
196
|
+
readonly description: string;
|
|
197
|
+
/**
|
|
198
|
+
* Source files that declare or enforce the scope.
|
|
199
|
+
*/
|
|
200
|
+
readonly enforcedAt: readonly AuthScopeEnforcementInfo[];
|
|
201
|
+
/**
|
|
202
|
+
* Error code thrown when the gate rejects a request. Optional.
|
|
203
|
+
*/
|
|
204
|
+
readonly errorCode?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Origin of the entry.
|
|
207
|
+
*/
|
|
208
|
+
readonly source: AuthEntrySource;
|
|
209
|
+
/**
|
|
210
|
+
* Workspace-relative path to the file that defines the scope constant
|
|
211
|
+
* or scope catalog. Optional for app-defined scopes that don't have a
|
|
212
|
+
* single canonical declaration.
|
|
213
|
+
*/
|
|
214
|
+
readonly sourcePath?: string;
|
|
215
|
+
/**
|
|
216
|
+
* 1-based line number of the scope declaration. Optional.
|
|
217
|
+
*/
|
|
218
|
+
readonly sourceLine?: number;
|
|
219
|
+
/**
|
|
220
|
+
* Apps that surface this scope to callers (subset of the claim catalog
|
|
221
|
+
* apps). Empty for system scopes that aren't tied to a specific app.
|
|
222
|
+
*/
|
|
223
|
+
readonly apps: readonly string[];
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* One per downstream app catalogued by the registry.
|
|
227
|
+
*/
|
|
228
|
+
export interface AuthAppInfo {
|
|
229
|
+
/**
|
|
230
|
+
* App slug — typically the Nx project name (`'demo-api'`).
|
|
231
|
+
*/
|
|
232
|
+
readonly app: string;
|
|
233
|
+
/**
|
|
234
|
+
* `*ApiAuthClaims`-style interface name declared by the app
|
|
235
|
+
* (e.g. `'DemoApiAuthClaims'`).
|
|
236
|
+
*/
|
|
237
|
+
readonly claimsInterfaceName: string;
|
|
238
|
+
/**
|
|
239
|
+
* Constant exported by the app's `claims.ts` for the
|
|
240
|
+
* {@link authRoleClaimsService} return value (e.g. `'DEMO_AUTH_CLAIMS_SERVICE'`).
|
|
241
|
+
*/
|
|
242
|
+
readonly serviceConstName?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Workspace-relative path to the app's `claims.ts` (or equivalent).
|
|
245
|
+
*/
|
|
246
|
+
readonly sourcePath: string;
|
|
247
|
+
/**
|
|
248
|
+
* Claim keys catalogued for the app.
|
|
249
|
+
*/
|
|
250
|
+
readonly claimKeys: readonly string[];
|
|
251
|
+
/**
|
|
252
|
+
* OIDC scope names accepted by the app, in registry order.
|
|
253
|
+
*/
|
|
254
|
+
readonly scopes: readonly string[];
|
|
255
|
+
/**
|
|
256
|
+
* Optional one-line summary of what the app's auth surface gates.
|
|
257
|
+
*/
|
|
258
|
+
readonly description?: string;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Domain-friendly read API over the merged auth catalog.
|
|
262
|
+
*/
|
|
263
|
+
export interface AuthRegistry {
|
|
264
|
+
readonly roles: readonly AuthRoleInfo[];
|
|
265
|
+
readonly claims: readonly AuthClaimInfo[];
|
|
266
|
+
readonly scopes: readonly AuthScopeInfo[];
|
|
267
|
+
readonly apps: readonly AuthAppInfo[];
|
|
268
|
+
readonly loadedSources: readonly string[];
|
|
269
|
+
/**
|
|
270
|
+
* Returns the role entry whose `role` string or `constName` matches
|
|
271
|
+
* `key` (case-insensitive). Returns `undefined` when no entry matches.
|
|
272
|
+
*/
|
|
273
|
+
findRole(key: string): AuthRoleInfo | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* Returns every role tagged with the given tag (case-insensitive).
|
|
276
|
+
*/
|
|
277
|
+
findRolesByTag(tag: string): readonly AuthRoleInfo[];
|
|
278
|
+
/**
|
|
279
|
+
* Returns the claim entry whose `key` matches `key` exactly. When
|
|
280
|
+
* `app` is supplied the lookup is scoped to that app; otherwise the
|
|
281
|
+
* first match in registry order wins.
|
|
282
|
+
*/
|
|
283
|
+
findClaim(key: string, app?: string): AuthClaimInfo | undefined;
|
|
284
|
+
/**
|
|
285
|
+
* Returns every claim catalogued for the given app (case-insensitive).
|
|
286
|
+
*/
|
|
287
|
+
findClaimsByApp(app: string): readonly AuthClaimInfo[];
|
|
288
|
+
/**
|
|
289
|
+
* Returns every claim whose `interfaceName` matches `interfaceName`
|
|
290
|
+
* (case-insensitive). Useful when callers know the type name but not
|
|
291
|
+
* the app slug.
|
|
292
|
+
*/
|
|
293
|
+
findClaimsByInterface(interfaceName: string): readonly AuthClaimInfo[];
|
|
294
|
+
/**
|
|
295
|
+
* Returns the scope entry whose `scope` matches exactly. Case-sensitive
|
|
296
|
+
* because OIDC scope names are case-sensitive.
|
|
297
|
+
*/
|
|
298
|
+
findScope(scope: string): AuthScopeInfo | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Returns the app entry whose slug matches `app` exactly
|
|
301
|
+
* (case-insensitive).
|
|
302
|
+
*/
|
|
303
|
+
findApp(app: string): AuthAppInfo | undefined;
|
|
304
|
+
/**
|
|
305
|
+
* Returns the app entry whose `claimsInterfaceName` matches
|
|
306
|
+
* (case-insensitive).
|
|
307
|
+
*/
|
|
308
|
+
findAppByInterface(interfaceName: string): AuthAppInfo | undefined;
|
|
309
|
+
/**
|
|
310
|
+
* Returns every role that is set (or revoked) by at least one claim.
|
|
311
|
+
* Combined with the claim catalog this lets `dbx_auth_role_lookup`
|
|
312
|
+
* answer "which claims set this role?".
|
|
313
|
+
*/
|
|
314
|
+
findClaimsForRole(role: string): readonly AuthClaimInfo[];
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Input to {@link createAuthRegistryFromEntries}. Every field is optional
|
|
318
|
+
* to make registry composition easy in tests.
|
|
319
|
+
*/
|
|
320
|
+
export interface CreateAuthRegistryFromEntriesInput {
|
|
321
|
+
readonly roles?: readonly AuthRoleInfo[];
|
|
322
|
+
readonly claims?: readonly AuthClaimInfo[];
|
|
323
|
+
readonly scopes?: readonly AuthScopeInfo[];
|
|
324
|
+
readonly apps?: readonly AuthAppInfo[];
|
|
325
|
+
readonly loadedSources?: readonly string[];
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Builds an {@link AuthRegistry} from raw entry arrays. The constructed
|
|
329
|
+
* registry indexes by every accessor's primary key so all lookups are O(1)
|
|
330
|
+
* after construction.
|
|
331
|
+
*
|
|
332
|
+
* @param input - The entry arrays plus the source labels to advertise.
|
|
333
|
+
* @returns A fully-indexed registry suitable for tools and resources.
|
|
334
|
+
*
|
|
335
|
+
* @__NO_SIDE_EFFECTS__
|
|
336
|
+
*/
|
|
337
|
+
export declare function createAuthRegistryFromEntries(input?: CreateAuthRegistryFromEntriesInput): AuthRegistry;
|
|
338
|
+
/**
|
|
339
|
+
* Empty registry used when no auth catalog has been loaded. Tools wired
|
|
340
|
+
* against this registry behave as if the catalog loaded successfully with
|
|
341
|
+
* zero entries.
|
|
342
|
+
*/
|
|
343
|
+
export declare const EMPTY_AUTH_REGISTRY: AuthRegistry;
|