@dereekb/firebase 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/eslint/index.cjs.js +14510 -2052
- package/eslint/index.esm.js +14485 -2053
- package/eslint/package.json +3 -2
- package/eslint/rollup.alias-internal.config.d.ts +1 -0
- package/eslint/src/lib/firebase-rules-text.d.ts +121 -0
- package/eslint/src/lib/firestore-rules-parser.d.ts +61 -0
- package/eslint/src/lib/index.d.ts +10 -1
- package/eslint/src/lib/plugin.d.ts +14 -0
- package/eslint/src/lib/predicate-evaluator.d.ts +47 -0
- package/eslint/src/lib/require-api-details-for-crud-function.rule.d.ts +76 -0
- package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +47 -0
- package/eslint/src/lib/require-dbx-model-service-factory-tag.rule.d.ts +56 -0
- package/eslint/src/lib/require-firestore-rule-for-service-model.rule.d.ts +115 -0
- 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 +80 -0
- package/eslint/src/lib/require-storagefile-policy-matches-rules.rule.d.ts +79 -0
- package/eslint/src/lib/storage-rules-parser.d.ts +38 -0
- package/eslint/src/lib/util.d.ts +140 -0
- package/index.cjs.js +53 -5
- package/index.esm.js +46 -6
- package/package.json +5 -5
- package/src/lib/common/auth/auth.d.ts +8 -0
- package/src/lib/common/auth/oidc/oidc.d.ts +7 -5
- package/src/lib/common/model/function.d.ts +12 -1
- package/src/lib/model/notification/notification.d.ts +6 -0
- package/src/lib/model/oidcmodel/oidcmodel.d.ts +1 -0
- package/src/lib/model/storagefile/storagefile.api.d.ts +113 -2
- package/src/lib/model/storagefile/storagefile.d.ts +2 -0
- package/src/lib/model/storagefile/storagefile.upload.d.ts +33 -1
- package/src/lib/model/system/system.d.ts +1 -0
- package/test/index.cjs.js +2 -4
- package/test/index.esm.js +2 -4
- package/test/package.json +6 -6
- package/eslint/src/lib/comments.d.ts +0 -112
- package/eslint/src/lib/dbx-tag-families.d.ts +0 -280
- package/eslint/src/lib/jsdoc-parser.d.ts +0 -116
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { AstNode } from './util';
|
|
2
|
+
/**
|
|
3
|
+
* Default glob patterns (relative to ESLint `cwd`) used to locate model + factory source files.
|
|
4
|
+
* Mirrors {@link require-firestore-rule-for-service-model}'s search roots so the orphan rule
|
|
5
|
+
* picks up factories declared anywhere a model interface might also live.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_FACTORY_SEARCH_ROOTS: readonly string[];
|
|
8
|
+
/**
|
|
9
|
+
* Default name of the `@dbxModel` marker tag that triggers the orphan check.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_MODEL_MARKER_TAG: string;
|
|
12
|
+
/**
|
|
13
|
+
* Default name of the `@dbxModelServiceFactory <modelType>` tag the rule cross-references.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_FACTORY_TAG: string;
|
|
16
|
+
/**
|
|
17
|
+
* Options for the require-service-factory-for-dbx-model rule.
|
|
18
|
+
*/
|
|
19
|
+
export interface FirebaseRequireServiceFactoryForDbxModelRuleOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Glob patterns (relative to ESLint `cwd`) the rule scans to discover
|
|
22
|
+
* `@dbxModelServiceFactory <modelType>` declarations. Defaults to
|
|
23
|
+
* {@link DEFAULT_FACTORY_SEARCH_ROOTS}.
|
|
24
|
+
*/
|
|
25
|
+
readonly factorySearchRoots?: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* Inline factory set used in tests; bypasses filesystem globbing.
|
|
28
|
+
*/
|
|
29
|
+
readonly virtualFactoryModelTypes?: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Override the `@dbxModel` marker tag name. Defaults to {@link DEFAULT_MODEL_MARKER_TAG}.
|
|
32
|
+
*/
|
|
33
|
+
readonly modelMarkerTag?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Override the `@dbxModelServiceFactory` tag name. Defaults to {@link DEFAULT_FACTORY_TAG}.
|
|
36
|
+
*/
|
|
37
|
+
readonly factoryTag?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Model interface names that are intentionally declared without a matching service factory.
|
|
40
|
+
* Suppresses the warning for each name.
|
|
41
|
+
*/
|
|
42
|
+
readonly ignoreModels?: readonly string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* ESLint rule definition for require-service-factory-for-dbx-model.
|
|
46
|
+
*/
|
|
47
|
+
export interface FirebaseRequireServiceFactoryForDbxModelRuleDefinition {
|
|
48
|
+
readonly meta: {
|
|
49
|
+
readonly type: 'suggestion';
|
|
50
|
+
readonly fixable: undefined;
|
|
51
|
+
readonly docs: {
|
|
52
|
+
readonly description: string;
|
|
53
|
+
readonly recommended: boolean;
|
|
54
|
+
};
|
|
55
|
+
readonly messages: Readonly<Record<string, string>>;
|
|
56
|
+
readonly schema: readonly object[];
|
|
57
|
+
};
|
|
58
|
+
create(context: RuleContext): Record<string, (node: AstNode) => void>;
|
|
59
|
+
}
|
|
60
|
+
interface RuleContext {
|
|
61
|
+
readonly options: FirebaseRequireServiceFactoryForDbxModelRuleOptions[];
|
|
62
|
+
readonly cwd?: string;
|
|
63
|
+
readonly sourceCode: AstNode;
|
|
64
|
+
readonly report: (descriptor: {
|
|
65
|
+
node: AstNode;
|
|
66
|
+
messageId: string;
|
|
67
|
+
data?: Record<string, string>;
|
|
68
|
+
}) => void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* ESLint rule that flags every `@dbxModel`-marked interface that has no matching
|
|
72
|
+
* `@dbxModelServiceFactory <modelType>` declaration elsewhere in the workspace.
|
|
73
|
+
*
|
|
74
|
+
* The expected `modelType` is derived from the interface name by lowercasing the first
|
|
75
|
+
* character (matching the `FirestoreModelIdentity.modelType` convention). Models that are
|
|
76
|
+
* intentionally factory-less (e.g. sub-objects mis-marked as `@dbxModel`) can be silenced via
|
|
77
|
+
* the `ignoreModels` option.
|
|
78
|
+
*/
|
|
79
|
+
export declare const FIREBASE_REQUIRE_SERVICE_FACTORY_FOR_DBX_MODEL_RULE: FirebaseRequireServiceFactoryForDbxModelRuleDefinition;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type AstNode } from './util';
|
|
2
|
+
/**
|
|
3
|
+
* Default type name the rule looks for on top-level declarators. Variables whose type
|
|
4
|
+
* annotation resolves to this identifier are treated as upload policies and validated
|
|
5
|
+
* against `storage.rules`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_STORAGE_FILE_UPLOAD_POLICY_TYPE_NAME: string;
|
|
8
|
+
/**
|
|
9
|
+
* Default file name searched relative to the lint root when `storageRulesPath` is omitted.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_STORAGE_RULES_FILENAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Options for the require-storagefile-policy-matches-rules rule.
|
|
14
|
+
*/
|
|
15
|
+
export interface FirebaseRequireStorageFilePolicyMatchesRulesRuleOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Path to the `storage.rules` file. Resolved against the ESLint `cwd` when relative.
|
|
18
|
+
* Defaults to `<cwd>/storage.rules`.
|
|
19
|
+
*/
|
|
20
|
+
readonly storageRulesPath?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Inline `storage.rules` source used in tests; bypasses filesystem reads when set.
|
|
23
|
+
*/
|
|
24
|
+
readonly virtualStorageRules?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Type-annotation identifier the rule treats as the upload-policy marker. Defaults to
|
|
27
|
+
* {@link DEFAULT_STORAGE_FILE_UPLOAD_POLICY_TYPE_NAME}.
|
|
28
|
+
*/
|
|
29
|
+
readonly policyTypeName?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* ESLint rule definition for require-storagefile-policy-matches-rules.
|
|
33
|
+
*/
|
|
34
|
+
export interface FirebaseRequireStorageFilePolicyMatchesRulesRuleDefinition {
|
|
35
|
+
readonly meta: {
|
|
36
|
+
readonly type: 'problem';
|
|
37
|
+
readonly fixable: undefined;
|
|
38
|
+
readonly docs: {
|
|
39
|
+
readonly description: string;
|
|
40
|
+
readonly recommended: boolean;
|
|
41
|
+
};
|
|
42
|
+
readonly messages: Readonly<Record<string, string>>;
|
|
43
|
+
readonly schema: readonly object[];
|
|
44
|
+
};
|
|
45
|
+
create(context: RuleContext): Record<string, (node: AstNode) => void>;
|
|
46
|
+
}
|
|
47
|
+
interface RuleContext {
|
|
48
|
+
readonly options: FirebaseRequireStorageFilePolicyMatchesRulesRuleOptions[];
|
|
49
|
+
readonly cwd?: string;
|
|
50
|
+
readonly report: (descriptor: {
|
|
51
|
+
node: AstNode;
|
|
52
|
+
messageId: string;
|
|
53
|
+
data?: Record<string, string>;
|
|
54
|
+
}) => void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* ESLint rule that cross-checks every `StorageFilePurposeUploadPolicy`-typed declaration in
|
|
58
|
+
* a `*-firebase` component against the workspace's `storage.rules`. Each policy must have a
|
|
59
|
+
* paired `// Mirrors STORAGE_FILE_PURPOSE_UPLOAD_POLICIES[<KEY>]` match block whose
|
|
60
|
+
* `request.resource.size` cap and `request.resource.contentType` predicate are at least as
|
|
61
|
+
* permissive as the TypeScript policy's `maxFileSizeBytes` and `allowedMimeTypes`.
|
|
62
|
+
*
|
|
63
|
+
* Reports on the TS side so drift surfaces in the normal lint pipeline; mismatches almost
|
|
64
|
+
* always originate from editing one side and forgetting the other.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* // OK — storage.rules has `Mirrors ...[USER_AVATAR_PURPOSE]` block with matching constraints
|
|
69
|
+
* export const USER_AVATAR_UPLOAD_POLICY: StorageFilePurposeUploadPolicy = {
|
|
70
|
+
* purpose: USER_AVATAR_PURPOSE,
|
|
71
|
+
* allowedMimeTypes: ['image/jpeg', 'image/png'],
|
|
72
|
+
* maxFileSizeBytes: 16 * 1024 * 1024,
|
|
73
|
+
* buildUploadPath: ({ uid }) => userAvatarUploadsFilePath(uid),
|
|
74
|
+
* requiresFilenameInput: false
|
|
75
|
+
* };
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const FIREBASE_REQUIRE_STORAGEFILE_POLICY_MATCHES_RULES_RULE: FirebaseRequireStorageFilePolicyMatchesRulesRuleDefinition;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type PredicateBranch } from './predicate-evaluator';
|
|
2
|
+
/**
|
|
3
|
+
* Marker comment that pairs a `storage.rules` match block with a TypeScript policy key
|
|
4
|
+
* in `STORAGE_FILE_PURPOSE_UPLOAD_POLICIES`. The capture group is the policy key constant
|
|
5
|
+
* name, e.g. `USER_AVATAR_PURPOSE`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MIRRORS_POLICY_KEY_MARKER_REGEX: RegExp;
|
|
8
|
+
/**
|
|
9
|
+
* One disjunct of an `allow write: if ...` predicate after helper-function expansion.
|
|
10
|
+
* Always carries a numeric byte cap plus at least one MIME constraint (literal or regex).
|
|
11
|
+
*
|
|
12
|
+
* Structurally identical to the evaluator's {@link PredicateBranch}; the alias keeps the
|
|
13
|
+
* existing public type name stable for downstream consumers.
|
|
14
|
+
*/
|
|
15
|
+
export type ParsedRuleBranch = PredicateBranch;
|
|
16
|
+
/**
|
|
17
|
+
* One `match /<path>` block in `storage.rules` paired with a `// Mirrors ...` marker.
|
|
18
|
+
* `branches` carries the disjunction of (size, MIME) tuples extracted from the block's
|
|
19
|
+
* `allow write` predicate; `unsupported` is set when the parser cannot reduce the
|
|
20
|
+
* predicate to >=1 valid branch.
|
|
21
|
+
*/
|
|
22
|
+
export interface ParsedStorageRulesBlock {
|
|
23
|
+
readonly mirrorsPolicyKey: string;
|
|
24
|
+
readonly matchPath: string;
|
|
25
|
+
readonly branches: readonly ParsedRuleBranch[];
|
|
26
|
+
readonly sourceLine: number;
|
|
27
|
+
readonly sourceColumn: number;
|
|
28
|
+
readonly unsupported?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Parses a `storage.rules` source string and returns every match block paired with a
|
|
32
|
+
* `// Mirrors STORAGE_FILE_PURPOSE_UPLOAD_POLICIES[<KEY>]` marker. Catch-all deny blocks
|
|
33
|
+
* are skipped; the rest of the tree is walked normally.
|
|
34
|
+
*
|
|
35
|
+
* @param source - The raw rules source text.
|
|
36
|
+
* @returns Parsed mirrored blocks in source order.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseStorageRules(source: string): ParsedStorageRulesBlock[];
|
package/eslint/src/lib/util.d.ts
CHANGED
|
@@ -105,3 +105,143 @@ export declare function getFunctionName(node: AstNode): Maybe<string>;
|
|
|
105
105
|
* @returns The node to attach a `context.report` location to.
|
|
106
106
|
*/
|
|
107
107
|
export declare function getFunctionNameNode(node: AstNode): AstNode;
|
|
108
|
+
/**
|
|
109
|
+
* Default CRUD verb names that combine with the `ModelFunction` suffix to form a type-name
|
|
110
|
+
* pattern the api-details rules treat as a CRUD function declaration (e.g. `OnCallCreateModelFunction`,
|
|
111
|
+
* `DemoUpdateModelFunction`).
|
|
112
|
+
*
|
|
113
|
+
* Mirrors the verbs supported by `ModelFirebaseCrudFunctionConfigMap` — see
|
|
114
|
+
* `packages/firebase/src/lib/client/function/model.function.factory.ts`.
|
|
115
|
+
*/
|
|
116
|
+
export declare const DEFAULT_CRUD_FUNCTION_TYPE_VERBS: readonly string[];
|
|
117
|
+
/**
|
|
118
|
+
* Default factory function name that wraps CRUD function declarations and attaches the
|
|
119
|
+
* `_apiDetails` metadata (`inputType`, `outputType`, `mcp.visibility`, `analytics`) consumed
|
|
120
|
+
* by the MCP manifest builder. Defined in `packages/firebase-server/src/lib/nest/model/api.details.ts`.
|
|
121
|
+
*/
|
|
122
|
+
export declare const DEFAULT_API_DETAILS_FACTORY_NAME: string;
|
|
123
|
+
/**
|
|
124
|
+
* Property name on the `withApiDetails(...)` config object that declares the handler's input
|
|
125
|
+
* parameter type (consumed by the MCP manifest builder to generate the tool input schema).
|
|
126
|
+
*/
|
|
127
|
+
export declare const INPUT_TYPE_PROPERTY_NAME: string;
|
|
128
|
+
/**
|
|
129
|
+
* Module the default api-details factory ({@link DEFAULT_API_DETAILS_FACTORY_NAME}) is exported
|
|
130
|
+
* from. Used by the require-api-details auto-fix to insert a missing import.
|
|
131
|
+
*/
|
|
132
|
+
export declare const API_DETAILS_IMPORT_MODULE: string;
|
|
133
|
+
/**
|
|
134
|
+
* Unwraps `TSAsExpression` and `TSTypeAssertion` wrappers around an initializer so callers see the
|
|
135
|
+
* underlying expression (matches the helper in `require-complete-crud-function-config-map.rule.ts`).
|
|
136
|
+
*
|
|
137
|
+
* @param node - The AST node to unwrap.
|
|
138
|
+
* @returns The innermost wrapped expression, or `node` when no cast is present.
|
|
139
|
+
*/
|
|
140
|
+
export declare function unwrapTypeAssertion(node: AstNode): AstNode;
|
|
141
|
+
/**
|
|
142
|
+
* Resolves the identifier name from a `TSTypeReference` annotation, when present.
|
|
143
|
+
*
|
|
144
|
+
* @param node - A `TSTypeReference` node (or anything else).
|
|
145
|
+
* @returns The identifier name when `node` is a TSTypeReference whose typeName is an Identifier; otherwise null.
|
|
146
|
+
*/
|
|
147
|
+
export declare function typeReferenceTypeName(node: AstNode): Maybe<string>;
|
|
148
|
+
/**
|
|
149
|
+
* Resolves the type-argument nodes of a `TSTypeReference`, normalizing across `@typescript-eslint`
|
|
150
|
+
* versions (`typeArguments` in v6+, `typeParameters` in older releases).
|
|
151
|
+
*
|
|
152
|
+
* @param node - A `TSTypeReference` node (or anything else).
|
|
153
|
+
* @returns The generic argument nodes, or null when the reference has no type arguments.
|
|
154
|
+
*/
|
|
155
|
+
export declare function typeReferenceTypeArguments(node: AstNode): Maybe<AstNode[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Resolves the callee identifier name from a `CallExpression`, looking through both bare identifier
|
|
158
|
+
* callees (`withApiDetails(...)`) and member-expression callees (`api.withApiDetails(...)`).
|
|
159
|
+
*
|
|
160
|
+
* @param callee - The `CallExpression.callee` node.
|
|
161
|
+
* @returns The callee name when resolvable; otherwise null.
|
|
162
|
+
*/
|
|
163
|
+
export declare function callExpressionCalleeName(callee: AstNode): Maybe<string>;
|
|
164
|
+
/**
|
|
165
|
+
* Determines whether the (already-unwrapped) initializer is a call to the configured api-details factory.
|
|
166
|
+
*
|
|
167
|
+
* @param initializer - The unwrapped initializer node.
|
|
168
|
+
* @param factoryName - The expected factory identifier name.
|
|
169
|
+
* @returns True when the initializer is a `CallExpression` whose callee resolves to `factoryName`.
|
|
170
|
+
*/
|
|
171
|
+
export declare function isApiDetailsCall(initializer: AstNode, factoryName: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Returns the declarator's identifier name, when present.
|
|
174
|
+
*
|
|
175
|
+
* @param declaratorId - The `VariableDeclarator.id` node.
|
|
176
|
+
* @returns The identifier name, or null when the declarator binds a destructuring pattern.
|
|
177
|
+
*/
|
|
178
|
+
export declare function declaratorName(declaratorId: AstNode): Maybe<string>;
|
|
179
|
+
/**
|
|
180
|
+
* Returns the CRUD verb fragment that `typeName` ends with — i.e. the `<Verb>` in a
|
|
181
|
+
* `<Verb>ModelFunction` suffix for one of the configured verbs (e.g. `OnCallCreateModelFunction` →
|
|
182
|
+
* `Create`, `DemoUpdateModelFunction` → `Update`).
|
|
183
|
+
*
|
|
184
|
+
* @param typeName - The type-reference identifier name.
|
|
185
|
+
* @param verbs - The allowed verb fragments.
|
|
186
|
+
* @returns The matched verb, or null when the suffix matches no recognized CRUD verb.
|
|
187
|
+
*/
|
|
188
|
+
export declare function matchedCrudFunctionVerb(typeName: string, verbs: Iterable<string>): Maybe<string>;
|
|
189
|
+
/**
|
|
190
|
+
* Returns true when `typeName` ends with `<Verb>ModelFunction` for one of the configured verbs.
|
|
191
|
+
*
|
|
192
|
+
* @param typeName - The type-reference identifier name.
|
|
193
|
+
* @param verbs - The allowed verb fragments.
|
|
194
|
+
* @returns True when the suffix matches a recognized CRUD verb.
|
|
195
|
+
*/
|
|
196
|
+
export declare function isCrudFunctionTypeName(typeName: string, verbs: Iterable<string>): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Resolves the input-parameter type-argument node from a CRUD function type reference.
|
|
199
|
+
*
|
|
200
|
+
* @param typeRef - The `TSTypeReference` annotation node.
|
|
201
|
+
* @param typeName - The resolved type-reference name (selects the generic position).
|
|
202
|
+
* @returns The input type-argument node, or null when absent.
|
|
203
|
+
*/
|
|
204
|
+
export declare function crudFunctionInputTypeArgNode(typeRef: AstNode, typeName: string): Maybe<AstNode>;
|
|
205
|
+
/**
|
|
206
|
+
* Returns true when a CRUD function declares no meaningful input — either the input generic argument
|
|
207
|
+
* is absent or it is an empty object type literal (`{}`). Such handlers need no MCP input schema, so
|
|
208
|
+
* the require-input-type rule exempts them.
|
|
209
|
+
*
|
|
210
|
+
* @param typeRef - The `TSTypeReference` annotation node.
|
|
211
|
+
* @param typeName - The resolved type-reference name.
|
|
212
|
+
* @returns True when the input generic is empty or absent.
|
|
213
|
+
*/
|
|
214
|
+
export declare function isEmptyOrAbsentInputGeneric(typeRef: AstNode, typeName: string): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Returns true when an `ObjectExpression` has an own (non-computed) property with the given name.
|
|
217
|
+
*
|
|
218
|
+
* @param objExpr - The `ObjectExpression` node.
|
|
219
|
+
* @param propName - The property name to look for.
|
|
220
|
+
* @returns True when a matching property is present.
|
|
221
|
+
*/
|
|
222
|
+
export declare function objectExpressionHasProperty(objExpr: AstNode, propName: string): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Returns true when an `ObjectExpression` contains a spread element (`{ ...base }`), whose contents
|
|
225
|
+
* cannot be introspected statically.
|
|
226
|
+
*
|
|
227
|
+
* @param objExpr - The `ObjectExpression` node.
|
|
228
|
+
* @returns True when any property is a spread element.
|
|
229
|
+
*/
|
|
230
|
+
export declare function objectExpressionHasSpread(objExpr: AstNode): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Returns the character offset at which an auto-fixer should insert a new import — the start of the
|
|
233
|
+
* first existing `ImportDeclaration`, or offset 0 when the file has no imports yet.
|
|
234
|
+
*
|
|
235
|
+
* @param program - The `Program` AST node.
|
|
236
|
+
* @returns The character offset for the import-insertion point.
|
|
237
|
+
*/
|
|
238
|
+
export declare function findImportInsertionOffset(program: AstNode): number;
|
|
239
|
+
/**
|
|
240
|
+
* Returns true when the given identifier name is already in the module's top-level scope (imported
|
|
241
|
+
* or declared). Used by the require-api-details auto-fix to avoid inserting a duplicate import.
|
|
242
|
+
*
|
|
243
|
+
* @param program - The `Program` AST node.
|
|
244
|
+
* @param name - The identifier name to check.
|
|
245
|
+
* @returns True when an existing import or declaration brings `name` into scope.
|
|
246
|
+
*/
|
|
247
|
+
export declare function isFactoryNameInScope(program: AstNode, name: string): boolean;
|
package/index.cjs.js
CHANGED
|
@@ -11479,6 +11479,9 @@ function mapHttpsCallable(callable, wrap) {
|
|
|
11479
11479
|
/**
|
|
11480
11480
|
* Pre-configured OnCallTypedModelParamsFunctions for 'query'
|
|
11481
11481
|
*/ var onCallQueryModelParams = onCallTypedModelParamsFunction('query');
|
|
11482
|
+
/**
|
|
11483
|
+
* Pre-configured OnCallTypedModelParamsFunctions for 'invoke'
|
|
11484
|
+
*/ var onCallInvokeModelParams = onCallTypedModelParamsFunction('invoke');
|
|
11482
11485
|
/**
|
|
11483
11486
|
* Key used on the front-end and backend that refers to the call function.
|
|
11484
11487
|
*/ var CALL_MODEL_APP_FUNCTION_KEY = 'callModel';
|
|
@@ -11893,8 +11896,9 @@ var READ_MODEL_OIDC_SCOPE = "".concat(CALL_MODEL_OIDC_SCOPE_PREFIX, "read");
|
|
|
11893
11896
|
var UPDATE_MODEL_OIDC_SCOPE = "".concat(CALL_MODEL_OIDC_SCOPE_PREFIX, "update");
|
|
11894
11897
|
var DELETE_MODEL_OIDC_SCOPE = "".concat(CALL_MODEL_OIDC_SCOPE_PREFIX, "delete");
|
|
11895
11898
|
var QUERY_MODEL_OIDC_SCOPE = "".concat(CALL_MODEL_OIDC_SCOPE_PREFIX, "query");
|
|
11899
|
+
var INVOKE_MODEL_OIDC_SCOPE = "".concat(CALL_MODEL_OIDC_SCOPE_PREFIX, "invoke");
|
|
11896
11900
|
/**
|
|
11897
|
-
* Canonical CRUD scopes enforced on the `callModel` API.
|
|
11901
|
+
* Canonical CRUD + invoke scopes enforced on the `callModel` API.
|
|
11898
11902
|
*
|
|
11899
11903
|
* Each scope corresponds 1:1 to a {@link KnownOnCallFunctionType}; see
|
|
11900
11904
|
* {@link CALL_MODEL_OIDC_SCOPE_FOR_CALL_TYPE}.
|
|
@@ -11903,16 +11907,18 @@ var QUERY_MODEL_OIDC_SCOPE = "".concat(CALL_MODEL_OIDC_SCOPE_PREFIX, "query");
|
|
|
11903
11907
|
READ_MODEL_OIDC_SCOPE,
|
|
11904
11908
|
UPDATE_MODEL_OIDC_SCOPE,
|
|
11905
11909
|
DELETE_MODEL_OIDC_SCOPE,
|
|
11906
|
-
QUERY_MODEL_OIDC_SCOPE
|
|
11910
|
+
QUERY_MODEL_OIDC_SCOPE,
|
|
11911
|
+
INVOKE_MODEL_OIDC_SCOPE
|
|
11907
11912
|
];
|
|
11908
11913
|
/**
|
|
11909
|
-
* Maps each known
|
|
11914
|
+
* Maps each known call type to the scope an OIDC token must carry to invoke it.
|
|
11910
11915
|
*/ var CALL_MODEL_OIDC_SCOPE_FOR_CALL_TYPE = {
|
|
11911
11916
|
create: 'model.create',
|
|
11912
11917
|
read: 'model.read',
|
|
11913
11918
|
update: 'model.update',
|
|
11914
11919
|
delete: 'model.delete',
|
|
11915
|
-
query: 'model.query'
|
|
11920
|
+
query: 'model.query',
|
|
11921
|
+
invoke: 'model.invoke'
|
|
11916
11922
|
};
|
|
11917
11923
|
/**
|
|
11918
11924
|
* Resolves the OIDC scope that an OIDC-authenticated caller must hold to invoke
|
|
@@ -11957,6 +11963,11 @@ var QUERY_MODEL_OIDC_SCOPE = "".concat(CALL_MODEL_OIDC_SCOPE_PREFIX, "query");
|
|
|
11957
11963
|
label: 'Query models',
|
|
11958
11964
|
value: 'model.query',
|
|
11959
11965
|
description: 'Query model records via the callModel API'
|
|
11966
|
+
},
|
|
11967
|
+
{
|
|
11968
|
+
label: 'Invoke model operations',
|
|
11969
|
+
value: 'model.invoke',
|
|
11970
|
+
description: 'Invoke RPC-style operations on model records via the callModel API'
|
|
11960
11971
|
}
|
|
11961
11972
|
];
|
|
11962
11973
|
// MARK: Standard OIDC Scopes
|
|
@@ -12036,6 +12047,7 @@ var FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY = 'setupPassword';
|
|
|
12036
12047
|
var FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY = 'setupCommunicationAt';
|
|
12037
12048
|
var FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY = 'resetPassword';
|
|
12038
12049
|
var FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationAt';
|
|
12050
|
+
var FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY = 'resetExpiresAt';
|
|
12039
12051
|
|
|
12040
12052
|
/**
|
|
12041
12053
|
* Extracts the {@link FirebaseAuthContextInfo} from a {@link FirebaseAuthContext}.
|
|
@@ -18820,6 +18832,34 @@ var downloadMultipleStorageFilesParamsType = /* @__PURE__ */ arktype.type({
|
|
|
18820
18832
|
'asAdmin?': model.clearable('boolean'),
|
|
18821
18833
|
'throwOnFirstError?': model.clearable('boolean')
|
|
18822
18834
|
});
|
|
18835
|
+
// MARK: Create Signed Upload URL
|
|
18836
|
+
/**
|
|
18837
|
+
* Lower bound for caller-supplied `expiresInMs` on signed-upload-url generation.
|
|
18838
|
+
*
|
|
18839
|
+
* Anything shorter than 30 seconds is unrealistic for a caller to pick up a
|
|
18840
|
+
* URL, perform the PUT, and acknowledge before the URL expires.
|
|
18841
|
+
*/ var CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MIN_EXPIRES_IN_MS = 30 * 1000;
|
|
18842
|
+
/**
|
|
18843
|
+
* Upper bound for caller-supplied `expiresInMs` on signed-upload-url generation.
|
|
18844
|
+
*
|
|
18845
|
+
* 10 minutes is the longest acceptable window for a one-shot upload URL. Any
|
|
18846
|
+
* legitimate caller should be uploading within this window; longer windows
|
|
18847
|
+
* increase the blast radius if the URL leaks.
|
|
18848
|
+
*/ var CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_EXPIRES_IN_MS = 10 * 60 * 1000;
|
|
18849
|
+
/**
|
|
18850
|
+
* Default `expiresInMs` applied when the caller does not supply one.
|
|
18851
|
+
*/ var DEFAULT_CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_EXPIRES_IN_MS = 5 * 60 * 1000;
|
|
18852
|
+
/**
|
|
18853
|
+
* Maximum length of a caller-supplied filename. Enforced both at the ArkType
|
|
18854
|
+
* layer and again by the handler's sanitizer.
|
|
18855
|
+
*/ var CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_FILENAME_LENGTH = 200;
|
|
18856
|
+
var createStorageFileSignedUploadUrlParamsType = /* @__PURE__ */ arktype.type({
|
|
18857
|
+
purpose: 'string > 0',
|
|
18858
|
+
contentType: 'string > 0',
|
|
18859
|
+
'filename?': model.clearable("string > 0 & string <= ".concat(CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_FILENAME_LENGTH)),
|
|
18860
|
+
fileSizeBytes: 'number > 0',
|
|
18861
|
+
'expiresInMs?': model.clearable("number >= ".concat(CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MIN_EXPIRES_IN_MS, " & number <= ").concat(CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_EXPIRES_IN_MS))
|
|
18862
|
+
});
|
|
18823
18863
|
var createStorageFileGroupParamsType = /* @__PURE__ */ arktype.type({
|
|
18824
18864
|
'model?': model.clearable(firestoreModelKeyType),
|
|
18825
18865
|
'storageFileId?': model.clearable(firestoreModelIdType)
|
|
@@ -18846,7 +18886,7 @@ var initializeAllApplicableStorageFileGroupsParamsType = /* @__PURE__ */ arktype
|
|
|
18846
18886
|
var STORAGE_FILE_FUNCTION_TYPE_CONFIG_MAP = {};
|
|
18847
18887
|
var STORAGE_FILE_MODEL_CRUD_FUNCTIONS_CONFIG = {
|
|
18848
18888
|
storageFile: [
|
|
18849
|
-
'create:_,fromUpload,allFromUpload',
|
|
18889
|
+
'create:_,fromUpload,allFromUpload,signedUploadUrl',
|
|
18850
18890
|
'update:_,process,syncWithGroups',
|
|
18851
18891
|
'delete:_',
|
|
18852
18892
|
'read:download,downloadMultiple'
|
|
@@ -21252,6 +21292,9 @@ exports.CONFLICT_ERROR_CODE = CONFLICT_ERROR_CODE;
|
|
|
21252
21292
|
exports.COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION = COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION;
|
|
21253
21293
|
exports.CREATE_MODEL_OIDC_SCOPE = CREATE_MODEL_OIDC_SCOPE;
|
|
21254
21294
|
exports.CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE;
|
|
21295
|
+
exports.CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_EXPIRES_IN_MS = CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_EXPIRES_IN_MS;
|
|
21296
|
+
exports.CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_FILENAME_LENGTH = CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_FILENAME_LENGTH;
|
|
21297
|
+
exports.CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MIN_EXPIRES_IN_MS = CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MIN_EXPIRES_IN_MS;
|
|
21255
21298
|
exports.ContextGrantedModelRolesReaderInstance = ContextGrantedModelRolesReaderInstance;
|
|
21256
21299
|
exports.DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE = DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE;
|
|
21257
21300
|
exports.DBX_FIREBASE_SERVER_NO_UID_ERROR_CODE = DBX_FIREBASE_SERVER_NO_UID_ERROR_CODE;
|
|
@@ -21259,6 +21302,7 @@ exports.DBX_FIREBASE_SERVER_PASSWORD_RESET_INVALID_CODE_ERROR_CODE = DBX_FIREBAS
|
|
|
21259
21302
|
exports.DBX_FIREBASE_SERVER_PASSWORD_RESET_NO_CONFIG_ERROR_CODE = DBX_FIREBASE_SERVER_PASSWORD_RESET_NO_CONFIG_ERROR_CODE;
|
|
21260
21303
|
exports.DBX_FIREBASE_SERVER_PASSWORD_RESET_SEND_ONCE_ERROR_CODE = DBX_FIREBASE_SERVER_PASSWORD_RESET_SEND_ONCE_ERROR_CODE;
|
|
21261
21304
|
exports.DBX_FIREBASE_SERVER_PASSWORD_RESET_THROTTLE_ERROR_CODE = DBX_FIREBASE_SERVER_PASSWORD_RESET_THROTTLE_ERROR_CODE;
|
|
21305
|
+
exports.DEFAULT_CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_EXPIRES_IN_MS = DEFAULT_CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_EXPIRES_IN_MS;
|
|
21262
21306
|
exports.DEFAULT_DATE_CELL_RANGE_VALUE = DEFAULT_DATE_CELL_RANGE_VALUE;
|
|
21263
21307
|
exports.DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE = DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE;
|
|
21264
21308
|
exports.DEFAULT_FIRESTORE_ITEM_PAGE_ITERATOR_ITEMS_PER_PAGE = DEFAULT_FIRESTORE_ITEM_PAGE_ITERATOR_ITEMS_PER_PAGE;
|
|
@@ -21300,6 +21344,7 @@ exports.FIREBASE_AUTH_QUOTA_EXCEEDED_ERROR = FIREBASE_AUTH_QUOTA_EXCEEDED_ERROR;
|
|
|
21300
21344
|
exports.FIREBASE_AUTH_USER_NOT_FOUND_ERROR = FIREBASE_AUTH_USER_NOT_FOUND_ERROR;
|
|
21301
21345
|
exports.FIREBASE_AUTH_WRONG_PASSWORD = FIREBASE_AUTH_WRONG_PASSWORD;
|
|
21302
21346
|
exports.FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY = FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY;
|
|
21347
|
+
exports.FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY = FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY;
|
|
21303
21348
|
exports.FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY;
|
|
21304
21349
|
exports.FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY = FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY;
|
|
21305
21350
|
exports.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY = FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY;
|
|
@@ -21335,6 +21380,7 @@ exports.FirebaseModelPermissionServiceInstance = FirebaseModelPermissionServiceI
|
|
|
21335
21380
|
exports.FirebaseServerError = FirebaseServerError;
|
|
21336
21381
|
exports.HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
21337
21382
|
exports.INTERNAL_SERVER_ERROR_CODE = INTERNAL_SERVER_ERROR_CODE;
|
|
21383
|
+
exports.INVOKE_MODEL_OIDC_SCOPE = INVOKE_MODEL_OIDC_SCOPE;
|
|
21338
21384
|
exports.LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
21339
21385
|
exports.MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE = MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE;
|
|
21340
21386
|
exports.MAX_ON_CALL_QUERY_MODEL_LIMIT = MAX_ON_CALL_QUERY_MODEL_LIMIT;
|
|
@@ -21498,6 +21544,7 @@ exports.createStorageFileDocumentPair = createStorageFileDocumentPair;
|
|
|
21498
21544
|
exports.createStorageFileDocumentPairFactory = createStorageFileDocumentPairFactory;
|
|
21499
21545
|
exports.createStorageFileGroupParamsType = createStorageFileGroupParamsType;
|
|
21500
21546
|
exports.createStorageFileParamsType = createStorageFileParamsType;
|
|
21547
|
+
exports.createStorageFileSignedUploadUrlParamsType = createStorageFileSignedUploadUrlParamsType;
|
|
21501
21548
|
exports.dataFromDocumentSnapshots = dataFromDocumentSnapshots;
|
|
21502
21549
|
exports.dataFromSnapshotStream = dataFromSnapshotStream;
|
|
21503
21550
|
exports.defaultPagedItemPageDataConverter = defaultPagedItemPageDataConverter;
|
|
@@ -21862,6 +21909,7 @@ exports.onCallCreateModelResult = onCallCreateModelResult;
|
|
|
21862
21909
|
exports.onCallCreateModelResultWithDocs = onCallCreateModelResultWithDocs;
|
|
21863
21910
|
exports.onCallDeleteModelParams = onCallDeleteModelParams;
|
|
21864
21911
|
exports.onCallDevelopmentParams = onCallDevelopmentParams;
|
|
21912
|
+
exports.onCallInvokeModelParams = onCallInvokeModelParams;
|
|
21865
21913
|
exports.onCallQueryModelParams = onCallQueryModelParams;
|
|
21866
21914
|
exports.onCallReadModelParams = onCallReadModelParams;
|
|
21867
21915
|
exports.onCallTypedModelParams = onCallTypedModelParams;
|