@dereekb/firebase 13.12.0 → 13.12.2
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/eslint/index.cjs.js +10984 -1649
- package/eslint/index.esm.js +10985 -1655
- package/eslint/package.json +2 -3
- package/eslint/src/lib/index.d.ts +3 -2
- package/eslint/src/lib/plugin.d.ts +2 -0
- package/eslint/src/lib/require-api-details-for-crud-function.rule.d.ts +10 -17
- package/eslint/src/lib/require-firestore-rule-for-service-model.rule.d.ts +1 -1
- package/eslint/src/lib/require-input-type-for-api-details.rule.d.ts +72 -0
- package/eslint/src/lib/require-service-factory-for-dbx-model.rule.d.ts +10 -4
- package/eslint/src/lib/require-storagefile-policy-matches-rules.rule.d.ts +25 -5
- package/eslint/src/lib/storage-rules-parser.d.ts +25 -9
- package/eslint/src/lib/storagefile-import-resolver.d.ts +33 -0
- package/eslint/src/lib/storagefile-path-fold.d.ts +121 -0
- package/eslint/src/lib/util.d.ts +184 -0
- package/package.json +5 -5
- package/test/package.json +6 -6
package/eslint/src/lib/util.d.ts
CHANGED
|
@@ -3,6 +3,50 @@ import type { Maybe } from '@dereekb/util';
|
|
|
3
3
|
* Module that publishes the `@dereekb/firebase` Firestore constraint factories (`where`, `orderBy`, etc.).
|
|
4
4
|
*/
|
|
5
5
|
export declare const FIREBASE_MODULE = "@dereekb/firebase";
|
|
6
|
+
/**
|
|
7
|
+
* Directory names the layout-agnostic discovery globs never descend into: installed dependencies
|
|
8
|
+
* and build/cache output. Excluding these keeps a broad `**\/*.ts` scan from walking a downstream
|
|
9
|
+
* consumer's `node_modules` (which can hold tens of thousands of declaration files) and from
|
|
10
|
+
* double-counting compiled output under `dist`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_DISCOVERY_EXCLUDED_DIRS: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* Builds the `exclude` predicate passed to `fs.globSync(pattern, { cwd, exclude })` for the broad,
|
|
15
|
+
* layout-agnostic discovery globs. Node invokes the predicate on each visited path (directories
|
|
16
|
+
* included) and prunes the subtree when it returns true, so excluding a directory name here stops
|
|
17
|
+
* the walk from ever descending into it.
|
|
18
|
+
*
|
|
19
|
+
* @param excludedDirs - Directory names to prune. Defaults to {@link DEFAULT_DISCOVERY_EXCLUDED_DIRS}.
|
|
20
|
+
* @returns A predicate that returns true for any path containing an excluded directory segment.
|
|
21
|
+
*/
|
|
22
|
+
export declare function discoveryGlobExcludeFilter(excludedDirs?: readonly string[]): (path: string) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the absolute path to the installed `@dereekb/firebase` package's `src/lib/model`
|
|
25
|
+
* directory, as seen from the ESLint `cwd`. Used by rules that need to read the framework model
|
|
26
|
+
* declarations (identities, service factories) directly from the package a consumer has installed —
|
|
27
|
+
* the downstream case where these live under `node_modules/@dereekb/firebase/...` as compiled
|
|
28
|
+
* bundles plus `.d.ts` rather than a scannable source tree.
|
|
29
|
+
*
|
|
30
|
+
* Resolution uses Node's own module resolver (`require.resolve('@dereekb/firebase/package.json')`
|
|
31
|
+
* anchored at `cwd`), so it transparently handles hoisting / nested `node_modules`. Returns null
|
|
32
|
+
* when `@dereekb/firebase` is not resolvable as a dependency from `cwd` (e.g. inside the
|
|
33
|
+
* dbx-components monorepo itself, where it is consumed via TS path mapping rather than
|
|
34
|
+
* `node_modules`) — callers fall back to their cwd-relative source globs in that case.
|
|
35
|
+
*
|
|
36
|
+
* @param cwd - The ESLint working directory to resolve the dependency from.
|
|
37
|
+
* @returns The absolute model directory, or null when it cannot be resolved.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveInstalledFirebaseModelDir(cwd: string): Maybe<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the referenced type name from either a `TSTypeReference` (`Foo<…>` / `ns.Foo<…>`) or a
|
|
42
|
+
* `TSImportType` (`import("…").Foo<…>` — the form the TypeScript compiler emits in declaration
|
|
43
|
+
* files for cross-module type references). Returns the rightmost identifier name in a qualified
|
|
44
|
+
* name.
|
|
45
|
+
*
|
|
46
|
+
* @param node - A `TSTypeReference` or `TSImportType` node (or anything else).
|
|
47
|
+
* @returns The referenced type name, or null when the node is neither shape.
|
|
48
|
+
*/
|
|
49
|
+
export declare function referencedTypeName(node: AstNode): Maybe<string>;
|
|
6
50
|
/**
|
|
7
51
|
* JSDoc tag name that marks an exported query factory whose body should be scanned by
|
|
8
52
|
* `dbx-components-mcp`'s index extractor (`packages/dbx-components-mcp/src/scan/model-firebase-index-extract.ts`).
|
|
@@ -105,3 +149,143 @@ export declare function getFunctionName(node: AstNode): Maybe<string>;
|
|
|
105
149
|
* @returns The node to attach a `context.report` location to.
|
|
106
150
|
*/
|
|
107
151
|
export declare function getFunctionNameNode(node: AstNode): AstNode;
|
|
152
|
+
/**
|
|
153
|
+
* Default CRUD verb names that combine with the `ModelFunction` suffix to form a type-name
|
|
154
|
+
* pattern the api-details rules treat as a CRUD function declaration (e.g. `OnCallCreateModelFunction`,
|
|
155
|
+
* `DemoUpdateModelFunction`).
|
|
156
|
+
*
|
|
157
|
+
* Mirrors the verbs supported by `ModelFirebaseCrudFunctionConfigMap` — see
|
|
158
|
+
* `packages/firebase/src/lib/client/function/model.function.factory.ts`.
|
|
159
|
+
*/
|
|
160
|
+
export declare const DEFAULT_CRUD_FUNCTION_TYPE_VERBS: readonly string[];
|
|
161
|
+
/**
|
|
162
|
+
* Default factory function name that wraps CRUD function declarations and attaches the
|
|
163
|
+
* `_apiDetails` metadata (`inputType`, `outputType`, `mcp.visibility`, `analytics`) consumed
|
|
164
|
+
* by the MCP manifest builder. Defined in `packages/firebase-server/src/lib/nest/model/api.details.ts`.
|
|
165
|
+
*/
|
|
166
|
+
export declare const DEFAULT_API_DETAILS_FACTORY_NAME: string;
|
|
167
|
+
/**
|
|
168
|
+
* Property name on the `withApiDetails(...)` config object that declares the handler's input
|
|
169
|
+
* parameter type (consumed by the MCP manifest builder to generate the tool input schema).
|
|
170
|
+
*/
|
|
171
|
+
export declare const INPUT_TYPE_PROPERTY_NAME: string;
|
|
172
|
+
/**
|
|
173
|
+
* Module the default api-details factory ({@link DEFAULT_API_DETAILS_FACTORY_NAME}) is exported
|
|
174
|
+
* from. Used by the require-api-details auto-fix to insert a missing import.
|
|
175
|
+
*/
|
|
176
|
+
export declare const API_DETAILS_IMPORT_MODULE: string;
|
|
177
|
+
/**
|
|
178
|
+
* Unwraps `TSAsExpression` and `TSTypeAssertion` wrappers around an initializer so callers see the
|
|
179
|
+
* underlying expression (matches the helper in `require-complete-crud-function-config-map.rule.ts`).
|
|
180
|
+
*
|
|
181
|
+
* @param node - The AST node to unwrap.
|
|
182
|
+
* @returns The innermost wrapped expression, or `node` when no cast is present.
|
|
183
|
+
*/
|
|
184
|
+
export declare function unwrapTypeAssertion(node: AstNode): AstNode;
|
|
185
|
+
/**
|
|
186
|
+
* Resolves the identifier name from a `TSTypeReference` annotation, when present.
|
|
187
|
+
*
|
|
188
|
+
* @param node - A `TSTypeReference` node (or anything else).
|
|
189
|
+
* @returns The identifier name when `node` is a TSTypeReference whose typeName is an Identifier; otherwise null.
|
|
190
|
+
*/
|
|
191
|
+
export declare function typeReferenceTypeName(node: AstNode): Maybe<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Resolves the type-argument nodes of a `TSTypeReference`, normalizing across `@typescript-eslint`
|
|
194
|
+
* versions (`typeArguments` in v6+, `typeParameters` in older releases).
|
|
195
|
+
*
|
|
196
|
+
* @param node - A `TSTypeReference` node (or anything else).
|
|
197
|
+
* @returns The generic argument nodes, or null when the reference has no type arguments.
|
|
198
|
+
*/
|
|
199
|
+
export declare function typeReferenceTypeArguments(node: AstNode): Maybe<AstNode[]>;
|
|
200
|
+
/**
|
|
201
|
+
* Resolves the callee identifier name from a `CallExpression`, looking through both bare identifier
|
|
202
|
+
* callees (`withApiDetails(...)`) and member-expression callees (`api.withApiDetails(...)`).
|
|
203
|
+
*
|
|
204
|
+
* @param callee - The `CallExpression.callee` node.
|
|
205
|
+
* @returns The callee name when resolvable; otherwise null.
|
|
206
|
+
*/
|
|
207
|
+
export declare function callExpressionCalleeName(callee: AstNode): Maybe<string>;
|
|
208
|
+
/**
|
|
209
|
+
* Determines whether the (already-unwrapped) initializer is a call to the configured api-details factory.
|
|
210
|
+
*
|
|
211
|
+
* @param initializer - The unwrapped initializer node.
|
|
212
|
+
* @param factoryName - The expected factory identifier name.
|
|
213
|
+
* @returns True when the initializer is a `CallExpression` whose callee resolves to `factoryName`.
|
|
214
|
+
*/
|
|
215
|
+
export declare function isApiDetailsCall(initializer: AstNode, factoryName: string): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Returns the declarator's identifier name, when present.
|
|
218
|
+
*
|
|
219
|
+
* @param declaratorId - The `VariableDeclarator.id` node.
|
|
220
|
+
* @returns The identifier name, or null when the declarator binds a destructuring pattern.
|
|
221
|
+
*/
|
|
222
|
+
export declare function declaratorName(declaratorId: AstNode): Maybe<string>;
|
|
223
|
+
/**
|
|
224
|
+
* Returns the CRUD verb fragment that `typeName` ends with — i.e. the `<Verb>` in a
|
|
225
|
+
* `<Verb>ModelFunction` suffix for one of the configured verbs (e.g. `OnCallCreateModelFunction` →
|
|
226
|
+
* `Create`, `DemoUpdateModelFunction` → `Update`).
|
|
227
|
+
*
|
|
228
|
+
* @param typeName - The type-reference identifier name.
|
|
229
|
+
* @param verbs - The allowed verb fragments.
|
|
230
|
+
* @returns The matched verb, or null when the suffix matches no recognized CRUD verb.
|
|
231
|
+
*/
|
|
232
|
+
export declare function matchedCrudFunctionVerb(typeName: string, verbs: Iterable<string>): Maybe<string>;
|
|
233
|
+
/**
|
|
234
|
+
* Returns true when `typeName` ends with `<Verb>ModelFunction` for one of the configured verbs.
|
|
235
|
+
*
|
|
236
|
+
* @param typeName - The type-reference identifier name.
|
|
237
|
+
* @param verbs - The allowed verb fragments.
|
|
238
|
+
* @returns True when the suffix matches a recognized CRUD verb.
|
|
239
|
+
*/
|
|
240
|
+
export declare function isCrudFunctionTypeName(typeName: string, verbs: Iterable<string>): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Resolves the input-parameter type-argument node from a CRUD function type reference.
|
|
243
|
+
*
|
|
244
|
+
* @param typeRef - The `TSTypeReference` annotation node.
|
|
245
|
+
* @param typeName - The resolved type-reference name (selects the generic position).
|
|
246
|
+
* @returns The input type-argument node, or null when absent.
|
|
247
|
+
*/
|
|
248
|
+
export declare function crudFunctionInputTypeArgNode(typeRef: AstNode, typeName: string): Maybe<AstNode>;
|
|
249
|
+
/**
|
|
250
|
+
* Returns true when a CRUD function declares no meaningful input — either the input generic argument
|
|
251
|
+
* is absent or it is an empty object type literal (`{}`). Such handlers need no MCP input schema, so
|
|
252
|
+
* the require-input-type rule exempts them.
|
|
253
|
+
*
|
|
254
|
+
* @param typeRef - The `TSTypeReference` annotation node.
|
|
255
|
+
* @param typeName - The resolved type-reference name.
|
|
256
|
+
* @returns True when the input generic is empty or absent.
|
|
257
|
+
*/
|
|
258
|
+
export declare function isEmptyOrAbsentInputGeneric(typeRef: AstNode, typeName: string): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Returns true when an `ObjectExpression` has an own (non-computed) property with the given name.
|
|
261
|
+
*
|
|
262
|
+
* @param objExpr - The `ObjectExpression` node.
|
|
263
|
+
* @param propName - The property name to look for.
|
|
264
|
+
* @returns True when a matching property is present.
|
|
265
|
+
*/
|
|
266
|
+
export declare function objectExpressionHasProperty(objExpr: AstNode, propName: string): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Returns true when an `ObjectExpression` contains a spread element (`{ ...base }`), whose contents
|
|
269
|
+
* cannot be introspected statically.
|
|
270
|
+
*
|
|
271
|
+
* @param objExpr - The `ObjectExpression` node.
|
|
272
|
+
* @returns True when any property is a spread element.
|
|
273
|
+
*/
|
|
274
|
+
export declare function objectExpressionHasSpread(objExpr: AstNode): boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Returns the character offset at which an auto-fixer should insert a new import — the start of the
|
|
277
|
+
* first existing `ImportDeclaration`, or offset 0 when the file has no imports yet.
|
|
278
|
+
*
|
|
279
|
+
* @param program - The `Program` AST node.
|
|
280
|
+
* @returns The character offset for the import-insertion point.
|
|
281
|
+
*/
|
|
282
|
+
export declare function findImportInsertionOffset(program: AstNode): number;
|
|
283
|
+
/**
|
|
284
|
+
* Returns true when the given identifier name is already in the module's top-level scope (imported
|
|
285
|
+
* or declared). Used by the require-api-details auto-fix to avoid inserting a duplicate import.
|
|
286
|
+
*
|
|
287
|
+
* @param program - The `Program` AST node.
|
|
288
|
+
* @param name - The identifier name to check.
|
|
289
|
+
* @returns True when an existing import or declaration brings `name` into scope.
|
|
290
|
+
*/
|
|
291
|
+
export declare function isFactoryNameInScope(program: AstNode, name: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./test": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@dereekb/util": "13.12.
|
|
28
|
-
"@dereekb/date": "13.12.
|
|
29
|
-
"@dereekb/model": "13.12.
|
|
30
|
-
"@dereekb/rxjs": "13.12.
|
|
27
|
+
"@dereekb/util": "13.12.2",
|
|
28
|
+
"@dereekb/date": "13.12.2",
|
|
29
|
+
"@dereekb/model": "13.12.2",
|
|
30
|
+
"@dereekb/rxjs": "13.12.2",
|
|
31
31
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
32
32
|
"arktype": "^2.2.0",
|
|
33
33
|
"date-fns": "^4.1.0",
|
package/test/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/test",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.12.
|
|
6
|
-
"@dereekb/firebase": "13.12.
|
|
7
|
-
"@dereekb/model": "13.12.
|
|
8
|
-
"@dereekb/rxjs": "13.12.
|
|
9
|
-
"@dereekb/util": "13.12.
|
|
5
|
+
"@dereekb/date": "13.12.2",
|
|
6
|
+
"@dereekb/firebase": "13.12.2",
|
|
7
|
+
"@dereekb/model": "13.12.2",
|
|
8
|
+
"@dereekb/rxjs": "13.12.2",
|
|
9
|
+
"@dereekb/util": "13.12.2",
|
|
10
10
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
11
11
|
"date-fns": "^4.1.0",
|
|
12
12
|
"firebase": "^12.12.1",
|