@dereekb/dbx-cli 13.37.0 → 13.39.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.
Files changed (106) hide show
  1. package/eslint/package.json +8 -8
  2. package/firebase-api-manifest/main.js +191 -166
  3. package/firebase-api-manifest/package.json +3 -3
  4. package/firestore-query-manifest/main.js +2063 -0
  5. package/firestore-query-manifest/package.json +13 -0
  6. package/firestore-rules/src/firestore-rules-scan.d.ts +89 -0
  7. package/firestore-rules/src/index.d.ts +1 -0
  8. package/generate-firestore-indexes/main.js +2 -2
  9. package/generate-firestore-indexes/package.json +2 -2
  10. package/generate-mcp-manifest/main.js +1 -0
  11. package/generate-mcp-manifest/package.json +3 -3
  12. package/generate-route-manifest/package.json +2 -2
  13. package/index.esm.js +12615 -6863
  14. package/lint-cache/package.json +2 -2
  15. package/manifest-extract/index.esm.js +4 -1
  16. package/manifest-extract/package.json +7 -7
  17. package/manifest-extract/src/lib/types.d.ts +6 -0
  18. package/model-test/LICENSE +21 -0
  19. package/model-test/index.d.ts +1 -0
  20. package/model-test/index.esm.js +5984 -0
  21. package/model-test/package.json +21 -0
  22. package/model-test/src/index.d.ts +41 -0
  23. package/model-test/src/lib/fixture/archetype.d.ts +33 -0
  24. package/model-test/src/lib/fixture/extract.d.ts +37 -0
  25. package/model-test/src/lib/fixture/format.json.d.ts +24 -0
  26. package/model-test/src/lib/fixture/format.markdown.d.ts +23 -0
  27. package/model-test/src/lib/fixture/forward.d.ts +48 -0
  28. package/model-test/src/lib/fixture/framework-fixtures.d.ts +70 -0
  29. package/model-test/src/lib/fixture/inspect.d.ts +22 -0
  30. package/model-test/src/lib/fixture/scaffold.d.ts +74 -0
  31. package/model-test/src/lib/fixture/types.d.ts +175 -0
  32. package/model-test/src/lib/test/discover.d.ts +81 -0
  33. package/model-test/src/lib/test/extract.d.ts +49 -0
  34. package/model-test/src/lib/test/format.hotspots.d.ts +23 -0
  35. package/model-test/src/lib/test/format.json.d.ts +25 -0
  36. package/model-test/src/lib/test/format.list-app.d.ts +30 -0
  37. package/model-test/src/lib/test/format.markdown.d.ts +25 -0
  38. package/model-test/src/lib/test/hotspots.d.ts +98 -0
  39. package/model-test/src/lib/test/inspect.d.ts +32 -0
  40. package/model-test/src/lib/test/search.d.ts +34 -0
  41. package/model-test/src/lib/test/types.d.ts +179 -0
  42. package/package.json +23 -22
  43. package/route/package.json +12 -12
  44. package/src/lib/api/firestore-session.client.d.ts +54 -0
  45. package/src/lib/api/get-args.helper.d.ts +4 -1
  46. package/src/lib/api/get-many.command.d.ts +8 -3
  47. package/src/lib/api/get.command.d.ts +13 -5
  48. package/src/lib/api/index.d.ts +1 -0
  49. package/src/lib/config/env.d.ts +106 -0
  50. package/src/lib/config/firestore-session.cache.d.ts +86 -0
  51. package/src/lib/config/index.d.ts +1 -0
  52. package/src/lib/config/paths.d.ts +3 -1
  53. package/src/lib/context/cli.context.d.ts +87 -3
  54. package/src/lib/doctor/firestore-session.check.d.ts +113 -0
  55. package/src/lib/doctor/index.d.ts +1 -0
  56. package/src/lib/firestore/firestore-get.command.d.ts +28 -0
  57. package/src/lib/firestore/firestore-queries.command.d.ts +26 -0
  58. package/src/lib/firestore/firestore-query.command.d.ts +25 -0
  59. package/src/lib/firestore/firestore.accessor.d.ts +85 -0
  60. package/src/lib/firestore/firestore.collection.d.ts +44 -0
  61. package/src/lib/firestore/firestore.error.d.ts +14 -0
  62. package/src/lib/firestore/firestore.models.d.ts +223 -0
  63. package/src/lib/firestore/firestore.query-params.d.ts +34 -0
  64. package/src/lib/firestore/firestore.query.d.ts +79 -0
  65. package/src/lib/firestore/firestore.read.d.ts +180 -0
  66. package/src/lib/firestore/firestore.session.d.ts +97 -0
  67. package/src/lib/firestore/index.d.ts +13 -0
  68. package/src/lib/firestore/query-info-utils.d.ts +48 -0
  69. package/src/lib/firestore/query-registry.d.ts +32 -0
  70. package/src/lib/index.d.ts +3 -0
  71. package/src/lib/manifest/types.d.ts +117 -0
  72. package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-schema.d.ts +2 -2
  73. package/src/lib/mcp-scan/manifest/model-snapshot-fields-schema.d.ts +2 -2
  74. package/src/lib/mcp-scan/manifest/pipes-schema.d.ts +2 -2
  75. package/src/lib/mcp-scan/manifest/ui-components-schema.d.ts +2 -2
  76. package/src/lib/mcp-scan/manifest/utils-schema.d.ts +2 -2
  77. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-extract.d.ts +1 -1
  78. package/src/lib/mcp-scan/scan/extract-models/types.d.ts +5 -0
  79. package/src/lib/mcp-scan/scan/ui-components-extract.d.ts +1 -1
  80. package/src/lib/middleware/auth.middleware.d.ts +6 -0
  81. package/src/lib/runner/run.d.ts +28 -1
  82. package/src/lib/scan-helpers/emit-generated-ts.d.ts +76 -0
  83. package/src/lib/scan-helpers/exported-from-package.d.ts +29 -0
  84. package/src/lib/util/index.d.ts +1 -0
  85. package/src/lib/util/output.d.ts +10 -0
  86. package/src/lib/util/stdin.d.ts +39 -2
  87. package/src/lib/util/table.d.ts +40 -0
  88. package/test/index.esm.js +4 -2
  89. package/test/package.json +14 -14
  90. package/test/src/lib/cli-test.d.ts +12 -2
  91. package/validate/LICENSE +21 -0
  92. package/validate/index.js +16641 -0
  93. package/validate/package.json +11 -0
  94. package/eslint/index.cjs.default.js +0 -1
  95. package/eslint/index.cjs.js +0 -1112
  96. package/eslint/index.cjs.mjs +0 -2
  97. package/index.cjs.js +0 -59813
  98. package/manifest-extract/index.cjs.default.js +0 -1
  99. package/manifest-extract/index.cjs.js +0 -1592
  100. package/manifest-extract/index.cjs.mjs +0 -2
  101. package/route/index.cjs.default.js +0 -1
  102. package/route/index.cjs.js +0 -18
  103. package/route/index.cjs.mjs +0 -2
  104. package/test/index.cjs.default.js +0 -1
  105. package/test/index.cjs.js +0 -381
  106. package/test/index.cjs.mjs +0 -2
@@ -1,6 +1,7 @@
1
1
  import type { MiddlewareFunction } from 'yargs';
2
2
  import { type CliEnvDefault } from '../config/env';
3
3
  import { type CliContext } from '../context/cli.context';
4
+ import { type CliFirestoreBinding } from '../firestore/firestore.models';
4
5
  import { type CliModelManifest } from '../manifest/types';
5
6
  export interface CreateAuthMiddlewareInput {
6
7
  readonly cliName: string;
@@ -19,6 +20,11 @@ export interface CreateAuthMiddlewareInput {
19
20
  * can resolve `prefix/id` keys to a `modelType` via `decodeFirestoreModelKey`.
20
21
  */
21
22
  readonly modelManifest?: CliModelManifest;
23
+ /**
24
+ * The app-supplied direct-Firestore binding. When present, the attached {@link CliContext}
25
+ * exposes `getFirestoreModels()`.
26
+ */
27
+ readonly firestore?: CliFirestoreBinding;
22
28
  }
23
29
  /**
24
30
  * Yargs middleware that resolves the active env, loads/refreshes its access token, and attaches
@@ -3,7 +3,8 @@ import { type ActionCommandSpec } from '../action/action.command.factory';
3
3
  import { type CliEnvDefault } from '../config/env';
4
4
  import { type CliContext } from '../context/cli.context';
5
5
  import { type DoctorCheck } from '../doctor/doctor.command.factory';
6
- import { type CliModelManifest } from '../manifest/types';
6
+ import { type CliFirestoreQueryManifest, type CliModelManifest } from '../manifest/types';
7
+ import { type CliFirestoreBinding } from '../firestore/firestore.models';
7
8
  /**
8
9
  * Names of the global options registered by {@link createCli} that are not
9
10
  * specific to a single manifest command's payload. Manifest commands hide
@@ -101,6 +102,30 @@ export interface CreateCliInput {
101
102
  * not want to surface the key-decode command itself.
102
103
  */
103
104
  readonly disableModelDecode?: boolean;
105
+ /**
106
+ * The app-supplied direct-Firestore binding — `cliFirestoreBinding({ collections, models })`.
107
+ *
108
+ * `dbx-cli` cannot import an app's collections factory, so this one option is what makes the
109
+ * generic `firestore-get` / `firestore-query` commands possible at all. Supplying it wires them
110
+ * for EVERY registered model at once.
111
+ */
112
+ readonly firestore?: CliFirestoreBinding;
113
+ /**
114
+ * The generated Firestore query catalog (`<NS>_FIRESTORE_QUERY_MANIFEST`).
115
+ *
116
+ * Enables the auth-bypassed `firestore-queries` catalog command on its own, and — paired with
117
+ * {@link firestore} — the `firestore-query` execution command.
118
+ */
119
+ readonly firestoreQueryManifest?: CliFirestoreQueryManifest;
120
+ /**
121
+ * Disable the built-in `firestore-query` command even when {@link firestore} and
122
+ * {@link firestoreQueryManifest} are both provided.
123
+ */
124
+ readonly disableFirestoreQuery?: boolean;
125
+ /**
126
+ * Disable the built-in `firestore-get` command even when {@link firestore} is provided.
127
+ */
128
+ readonly disableFirestoreGet?: boolean;
104
129
  /**
105
130
  * Test-only override that bypasses the auth middleware entirely and attaches the supplied
106
131
  * {@link CliContext} on every command invocation.
@@ -150,6 +175,8 @@ export interface CreateCliInput {
150
175
  * built-in `model-info` command. Opt-in per app.
151
176
  * @param input.disableModelInfo - When `true`, suppresses the auto-wired `model-info` command even
152
177
  * if {@link CreateCliInput.modelManifest} is provided.
178
+ * @param input.firestore - The app-supplied direct-Firestore binding; enables `firestore-get` / `firestore-query`.
179
+ * @param input.firestoreQueryManifest - The generated Firestore query catalog; enables `firestore-queries`.
153
180
  * @returns The configured yargs `Argv` ready to be `.parse()`-d.
154
181
  * @__NO_SIDE_EFFECTS__
155
182
  */
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Shared emission primitives for the build-time manifest generators.
3
+ *
4
+ * Every generator ends the same way: group the runtime imports it needs by
5
+ * package, render a banner + module source, format it with the workspace
6
+ * prettier config so the output matches a `prettier --write` of the committed
7
+ * file, then skip the write when the bytes are unchanged so incremental builds
8
+ * see a preserved mtime. That tail lives here once instead of being copied
9
+ * into each `<generator>/src/emit.ts`.
10
+ */
11
+ /**
12
+ * One named runtime import a generated module needs.
13
+ */
14
+ export interface GeneratedTsImport {
15
+ /**
16
+ * Module specifier to import from — typically a package name.
17
+ */
18
+ readonly packageName: string;
19
+ /**
20
+ * Identifier to import.
21
+ */
22
+ readonly identifier: string;
23
+ }
24
+ /**
25
+ * Result of {@link writeGeneratedTsFile}.
26
+ *
27
+ * `unchanged` means the file already held byte-identical content and was left
28
+ * untouched, preserving its mtime.
29
+ */
30
+ export type WriteGeneratedTsFileOutcome = 'wrote' | 'unchanged';
31
+ /**
32
+ * Inputs for {@link writeGeneratedTsFile}.
33
+ */
34
+ export interface WriteGeneratedTsFileInput {
35
+ /**
36
+ * Absolute path of the file to write.
37
+ */
38
+ readonly outputFile: string;
39
+ /**
40
+ * Full file contents.
41
+ */
42
+ readonly contents: string;
43
+ }
44
+ /**
45
+ * Groups named imports by their module specifier and renders one
46
+ * `import { … } from '…';` line per package, packages sorted by specifier and
47
+ * identifiers sorted within each line.
48
+ *
49
+ * @param imports - Every identifier the generated module references, with the package it comes from.
50
+ * @returns One import line per distinct package, in specifier order.
51
+ *
52
+ * @__NO_SIDE_EFFECTS__
53
+ */
54
+ export declare function renderGroupedImportLines(imports: readonly GeneratedTsImport[]): string[];
55
+ /**
56
+ * Formats generated TypeScript source with the workspace prettier config
57
+ * resolved for `outputFile`, so the emitted bytes match what
58
+ * `prettier --write` would produce on the committed file.
59
+ *
60
+ * @param source - The unformatted module source.
61
+ * @param outputFile - Path the source will be written to; selects the prettier config and parser.
62
+ * @returns The formatted source.
63
+ */
64
+ export declare function formatGeneratedTs(source: string, outputFile: string): Promise<string>;
65
+ /**
66
+ * Writes generated content to disk, creating the containing directory when
67
+ * missing and skipping the write entirely when the existing file is
68
+ * byte-identical.
69
+ *
70
+ * Skipping matters for incremental builds: rewriting identical bytes would
71
+ * bump the mtime and invalidate every downstream target.
72
+ *
73
+ * @param input - Output path and full contents.
74
+ * @returns `'unchanged'` when the write was skipped, `'wrote'` otherwise.
75
+ */
76
+ export declare function writeGeneratedTsFile(input: WriteGeneratedTsFileInput): WriteGeneratedTsFileOutcome;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Confirms an identifier is exported from a source package's barrel chain.
3
+ *
4
+ * Verification is deliberately textual rather than a full ts-morph resolve:
5
+ * the generators call this once per candidate identifier across whole
6
+ * packages, and the only question that matters is "would `import { X } from
7
+ * '<pkg>'` resolve". We string-search the package's `src/index.ts` and follow
8
+ * `export * from './...';` re-exports recursively until the declaration turns
9
+ * up, falling back to declaration barrels so installed `@dereekb/*` packages
10
+ * in `node_modules` resolve the same way.
11
+ */
12
+ /**
13
+ * Inputs for {@link isExportedFromPackage}.
14
+ */
15
+ export interface IsExportedInput {
16
+ readonly packageRoot: string;
17
+ readonly identifier: string;
18
+ }
19
+ /**
20
+ * Confirms an identifier is exported from a package's barrel —
21
+ * directly or via re-export chains. Tries the source barrel
22
+ * (`packageRoot/src/index.ts`) first, then falls back to declaration
23
+ * barrels (`src/index.d.ts`, `index.d.ts`) so installed `@dereekb/*`
24
+ * packages in `node_modules` resolve the same way.
25
+ *
26
+ * @param input - Package root + identifier to look up.
27
+ * @returns `true` when the identifier is reachable from the barrel.
28
+ */
29
+ export declare function isExportedFromPackage(input: IsExportedInput): boolean;
@@ -5,3 +5,4 @@ export * from './interactive';
5
5
  export * from './output';
6
6
  export * from './pagination';
7
7
  export * from './stdin';
8
+ export * from './table';
@@ -142,6 +142,16 @@ export declare function configureCliSecretPatterns(patterns: CliSecretPattern[])
142
142
  * @param mapper - The mapper to install, or `undefined` to clear any previously registered mapper.
143
143
  */
144
144
  export declare function configureCliErrorMapper(mapper?: CliErrorMapper): void;
145
+ /**
146
+ * Chains an additional {@link CliErrorMapper} BEHIND any already-registered one.
147
+ *
148
+ * Only one mapper slot exists, and an app may already own it (see `@dereekb/zoho/cli`). A built-in
149
+ * that wants to map its own error family therefore appends rather than installing, so the app's
150
+ * mapper keeps first refusal and the built-in only sees what the app declined.
151
+ *
152
+ * @param mapper - The mapper to consult after the current one defers.
153
+ */
154
+ export declare function appendCliErrorMapper(mapper: CliErrorMapper): void;
145
155
  /**
146
156
  * Applies the configured secret-redaction patterns to a string, replacing each match with `[REDACTED]`.
147
157
  *
@@ -1,13 +1,46 @@
1
+ /**
2
+ * Error code thrown by {@link readAllStdin} when `-` was passed but stdin is an interactive
3
+ * terminal, so no piped input will ever arrive.
4
+ */
5
+ export declare const STDIN_NOT_PIPED_ERROR_CODE = "STDIN_NOT_PIPED";
6
+ /**
7
+ * Records the raw argv the parser was handed so {@link isStdinPositionalSentinel} can distinguish a
8
+ * user-typed `-` from an ordinary empty positional.
9
+ *
10
+ * Called by `createCli` with the same argv it passes to yargs, which keeps the behaviour identical
11
+ * under the `CreateCliInput.argv` test override as it is in production.
12
+ *
13
+ * @param argv - The argv the parser was constructed with.
14
+ */
15
+ export declare function setCliRawArgv(argv: readonly string[]): void;
1
16
  /**
2
17
  * Returns `true` when the user passed `-` (the conventional "read from stdin" sentinel) as a
3
- * positional or flag value. Centralizes the convention so command handlers can pattern-match
4
- * consistently.
18
+ * flag value. Centralizes the convention so command handlers can pattern-match consistently.
19
+ *
20
+ * Only reliable for flag values, and only when the option declares `.nargs(<name>, 1)` — without it
21
+ * yargs treats the `-` in `--data -` as the next option rather than the flag's value, and the flag
22
+ * parses as boolean `true`. Positionals cannot be expressed this way; use
23
+ * {@link isStdinPositionalSentinel} for those.
5
24
  *
6
25
  * @param value - The raw argv value to inspect.
7
26
  * @returns `true` when the value is exactly `'-'`.
8
27
  * @__NO_SIDE_EFFECTS__
9
28
  */
10
29
  export declare function isStdinSentinel(value: unknown): boolean;
30
+ /**
31
+ * Returns `true` when a *positional* carried the `-` stdin sentinel.
32
+ *
33
+ * yargs cannot surface a lone `-` positional intact: with `type: 'string'` it coerces to `''`, and
34
+ * with no type at all to `true` — the raw `-` survives only in yargs-parser's `_`, which the
35
+ * positional mapping has already consumed by the time a handler runs. So an empty positional is
36
+ * treated as the sentinel only when the argv actually contained a bare `-`, which keeps a genuinely
37
+ * empty argument from being mistaken for a request to read stdin.
38
+ *
39
+ * @param value - The parsed positional value to inspect.
40
+ * @returns `true` when the positional was the stdin sentinel.
41
+ * @__NO_SIDE_EFFECTS__
42
+ */
43
+ export declare function isStdinPositionalSentinel(value: unknown): boolean;
11
44
  /**
12
45
  * Reads the entire contents of `process.stdin` as a UTF-8 string.
13
46
  *
@@ -15,7 +48,11 @@ export declare function isStdinSentinel(value: unknown): boolean;
15
48
  * `get-many -`). Resolves once the stream emits `end`; no timeout is applied — callers that
16
49
  * need one should wrap with `Promise.race`.
17
50
  *
51
+ * Throws when stdin is an interactive terminal: nothing is piped in, so the read would block
52
+ * forever and the CLI would appear to hang rather than report a usage mistake.
53
+ *
18
54
  * @returns The UTF-8 decoded stdin contents.
55
+ * @throws {CliError} When stdin is a TTY, with `code: 'STDIN_NOT_PIPED'`.
19
56
  */
20
57
  export declare function readAllStdin(): Promise<string>;
21
58
  /**
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Plain-text table and indentation helpers shared by the CLI's human-readable
3
+ * renderers (`model-info`, `firestore-queries`, ...).
4
+ *
5
+ * These started life private to `manifest/model-info-utils.ts`; every catalog
6
+ * command renders the same column-aligned shape, so they live here once.
7
+ */
8
+ /**
9
+ * Renders rows as a column-aligned, two-space-separated table.
10
+ *
11
+ * Every column except the last is padded to the widest cell in that column,
12
+ * and trailing whitespace is stripped from each line.
13
+ *
14
+ * @param rows - The rows to render, each an ordered list of cell texts.
15
+ * @returns The formatted table with no trailing newline, or `''` when empty.
16
+ *
17
+ * @__NO_SIDE_EFFECTS__
18
+ */
19
+ export declare function renderTable(rows: readonly (readonly string[])[]): string;
20
+ /**
21
+ * Truncates `text` to at most `max` characters, replacing the final character
22
+ * with an ellipsis when a cut is made.
23
+ *
24
+ * @param text - The text to truncate.
25
+ * @param max - The maximum length of the result.
26
+ * @returns The original text, or a truncated copy ending in `…`.
27
+ *
28
+ * @__NO_SIDE_EFFECTS__
29
+ */
30
+ export declare function truncate(text: string, max: number): string;
31
+ /**
32
+ * Indents every non-empty line of `text` by `indent` spaces.
33
+ *
34
+ * @param text - The text to indent.
35
+ * @param indent - The number of spaces to prefix. Values `<= 0` are a no-op.
36
+ * @returns The indented text.
37
+ *
38
+ * @__NO_SIDE_EFFECTS__
39
+ */
40
+ export declare function indentLines(text: string, indent: number): string;
package/test/index.esm.js CHANGED
@@ -172,7 +172,7 @@ function _ts_generator(thisArg, body) {
172
172
  * Thin wrapper around {@link createCliContext} that exists so test code can import from a single
173
173
  * test-only entry without pulling in production-only types.
174
174
  *
175
- * @param input - The context inputs (cliName, envName, env, accessToken, optional modelManifest).
175
+ * @param input - The context inputs (cliName, envName, env, accessToken, optional modelManifest / firestore binding / session cache).
176
176
  * @returns The constructed {@link CliContext} that drives `callModel` / `getModel` / `getMultipleModels`
177
177
  * against `input.env.apiBaseUrl` with `input.accessToken` as the Bearer token.
178
178
  * @__NO_SIDE_EFFECTS__
@@ -182,7 +182,9 @@ function _ts_generator(thisArg, body) {
182
182
  envName: input.envName,
183
183
  env: input.env,
184
184
  accessToken: input.accessToken,
185
- modelManifest: input.modelManifest
185
+ modelManifest: input.modelManifest,
186
+ firestore: input.firestore,
187
+ firestoreSessionCache: input.firestoreSessionCache
186
188
  });
187
189
  }
188
190
  /**
package/test/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/test",
3
- "version": "13.37.0",
3
+ "version": "13.39.0",
4
+ "type": "module",
4
5
  "peerDependencies": {
5
- "@dereekb/date": "13.37.0",
6
- "@dereekb/dbx-cli": "13.37.0",
7
- "@dereekb/firebase": "13.37.0",
8
- "@dereekb/firebase-server/test": "13.37.0",
9
- "@dereekb/model": "13.37.0",
10
- "@dereekb/nestjs": "13.37.0",
11
- "@dereekb/rxjs": "13.37.0",
12
- "@dereekb/util": "13.37.0",
6
+ "@dereekb/date": "13.39.0",
7
+ "@dereekb/dbx-cli": "13.39.0",
8
+ "@dereekb/firebase": "13.39.0",
9
+ "@dereekb/firebase-server/test": "13.39.0",
10
+ "@dereekb/model": "13.39.0",
11
+ "@dereekb/nestjs": "13.39.0",
12
+ "@dereekb/rxjs": "13.39.0",
13
+ "@dereekb/util": "13.39.0",
13
14
  "@nestjs/common": "^11.1.19",
14
15
  "arktype": "^2.2.0",
15
16
  "vitest": "4.1.5",
@@ -18,13 +19,12 @@
18
19
  "exports": {
19
20
  "./package.json": "./package.json",
20
21
  ".": {
21
- "module": "./index.esm.js",
22
22
  "types": "./index.d.ts",
23
- "import": "./index.cjs.mjs",
24
- "default": "./index.cjs.js"
23
+ "import": "./index.esm.js",
24
+ "default": "./index.esm.js"
25
25
  }
26
26
  },
27
27
  "module": "./index.esm.js",
28
- "main": "./index.cjs.js",
28
+ "main": "./index.esm.js",
29
29
  "types": "./index.d.ts"
30
- }
30
+ }
@@ -1,5 +1,5 @@
1
1
  import { type INestApplication } from '@nestjs/common';
2
- import { type CliContext, type CliEnvConfig, type CliModelManifest, type CreateCliInput } from '@dereekb/dbx-cli';
2
+ import { type CliContext, type CliEnvConfig, type CliFirestoreBinding, type CliFirestoreSessionCacheStore, type CliModelManifest, type CreateCliInput } from '@dereekb/dbx-cli';
3
3
  /**
4
4
  * Input for {@link buildTestCliContext}.
5
5
  */
@@ -9,6 +9,16 @@ export interface BuildTestCliContextInput {
9
9
  readonly env: CliEnvConfig;
10
10
  readonly accessToken: string;
11
11
  readonly modelManifest?: CliModelManifest;
12
+ /**
13
+ * The app-supplied direct-Firestore binding. Supply it when the test drives `firestore-get` /
14
+ * `firestore-query`, which reach for `context.getFirestoreModels()`.
15
+ */
16
+ readonly firestore?: CliFirestoreBinding;
17
+ /**
18
+ * Optional on-disk direct-Firestore session cache. Point it at a temp dir when a test wants the
19
+ * cross-invocation caching behaviour.
20
+ */
21
+ readonly firestoreSessionCache?: CliFirestoreSessionCacheStore;
12
22
  }
13
23
  /**
14
24
  * Builds a {@link CliContext} for use as `testCliContext` on {@link createCli}.
@@ -16,7 +26,7 @@ export interface BuildTestCliContextInput {
16
26
  * Thin wrapper around {@link createCliContext} that exists so test code can import from a single
17
27
  * test-only entry without pulling in production-only types.
18
28
  *
19
- * @param input - The context inputs (cliName, envName, env, accessToken, optional modelManifest).
29
+ * @param input - The context inputs (cliName, envName, env, accessToken, optional modelManifest / firestore binding / session cache).
20
30
  * @returns The constructed {@link CliContext} that drives `callModel` / `getModel` / `getMultipleModels`
21
31
  * against `input.env.apiBaseUrl` with `input.accessToken` as the Bearer token.
22
32
  * @__NO_SIDE_EFFECTS__
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hapier Creative LLC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.