@dereekb/firebase-server 13.4.0 → 13.4.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/index.cjs.js +553 -119
- package/index.esm.js +553 -121
- package/mailgun/package.json +9 -9
- package/model/index.cjs.js +645 -350
- package/model/index.esm.js +646 -351
- package/model/package.json +9 -9
- package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +1 -0
- package/model/src/lib/notification/index.d.ts +2 -2
- package/model/src/lib/notification/{notification.action.service.d.ts → notification.action.server.d.ts} +53 -1
- package/model/src/lib/notification/{notification.action.init.service.d.ts → notification.action.server.init.d.ts} +20 -0
- package/model/src/lib/notification/notification.config.service.d.ts +2 -0
- package/model/src/lib/notification/notification.create.run.d.ts +1 -0
- package/model/src/lib/notification/notification.error.d.ts +16 -0
- package/model/src/lib/notification/notification.expedite.service.d.ts +11 -3
- package/model/src/lib/notification/notification.module.d.ts +19 -6
- package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +1 -0
- package/model/src/lib/notification/notification.send.service.text.d.ts +2 -0
- package/model/src/lib/notification/notification.task.service.handler.d.ts +1 -0
- package/model/src/lib/notification/notification.task.service.util.d.ts +1 -0
- package/model/src/lib/notification/notification.task.subtask.handler.d.ts +3 -0
- package/model/src/lib/notification/notification.util.d.ts +4 -2
- package/model/src/lib/storagefile/index.d.ts +1 -1
- package/model/src/lib/storagefile/storagefile.action.server.d.ts +98 -1
- package/model/src/lib/storagefile/{storagefile.action.init.service.d.ts → storagefile.action.server.init.d.ts} +13 -2
- package/model/src/lib/storagefile/storagefile.error.d.ts +27 -0
- package/model/src/lib/storagefile/storagefile.module.d.ts +14 -4
- package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +29 -7
- package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +2 -0
- package/oidc/index.cjs.js +150 -32
- package/oidc/index.esm.js +150 -32
- package/oidc/package.json +10 -10
- package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +12 -0
- package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +6 -0
- package/oidc/src/lib/model/jwks/jwks.d.ts +9 -0
- package/oidc/src/lib/model/jwks/jwks.query.d.ts +9 -0
- package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +13 -0
- package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +5 -1
- package/oidc/src/lib/oidc.config.d.ts +2 -1
- package/oidc/src/lib/oidc.module.d.ts +9 -2
- package/oidc/src/lib/service/oidc.account.service.d.ts +7 -0
- package/oidc/src/lib/service/oidc.adapter.service.d.ts +1 -0
- package/oidc/src/lib/service/oidc.config.service.d.ts +1 -0
- package/oidc/src/lib/service/oidc.encryption.service.d.ts +6 -0
- package/oidc/src/lib/service/oidc.interaction.service.d.ts +15 -0
- package/oidc/src/lib/service/oidc.jwks.service.d.ts +18 -2
- package/oidc/src/lib/service/oidc.service.d.ts +7 -3
- package/package.json +10 -10
- package/src/lib/auth/auth.context.d.ts +1 -0
- package/src/lib/auth/auth.service.d.ts +17 -1
- package/src/lib/auth/auth.service.error.d.ts +46 -0
- package/src/lib/env/env.config.d.ts +2 -0
- package/src/lib/env/env.service.d.ts +21 -7
- package/src/lib/firestore/array.d.ts +1 -0
- package/src/lib/firestore/driver.accessor.batch.d.ts +4 -0
- package/src/lib/firestore/driver.accessor.d.ts +4 -0
- package/src/lib/firestore/driver.accessor.default.d.ts +5 -1
- package/src/lib/firestore/driver.accessor.transaction.d.ts +4 -0
- package/src/lib/firestore/driver.d.ts +2 -0
- package/src/lib/firestore/driver.query.d.ts +4 -0
- package/src/lib/firestore/increment.d.ts +1 -0
- package/src/lib/function/assert.d.ts +7 -0
- package/src/lib/function/context.d.ts +4 -0
- package/src/lib/function/error.auth.d.ts +2 -0
- package/src/lib/function/error.d.ts +86 -11
- package/src/lib/index.d.ts +0 -1
- package/src/lib/nest/analytics/analytics.service.listener.d.ts +2 -0
- package/src/lib/nest/app.d.ts +6 -3
- package/src/lib/nest/auth/auth.module.d.ts +6 -0
- package/src/lib/nest/auth/auth.util.d.ts +19 -1
- package/src/lib/nest/development/development.app.function.d.ts +12 -4
- package/src/lib/nest/development/development.assert.function.d.ts +6 -2
- package/src/lib/nest/development/development.function.d.ts +6 -1
- package/src/lib/nest/development/development.schedule.function.d.ts +3 -1
- package/src/lib/nest/development/development.schedule.function.error.d.ts +8 -0
- package/src/lib/nest/env/env.service.d.ts +2 -0
- package/src/lib/nest/env/env.util.d.ts +6 -0
- package/src/lib/nest/firebase/firebase.module.d.ts +1 -0
- package/src/lib/nest/firestore/firestore.module.d.ts +8 -0
- package/src/lib/nest/function/context.d.ts +2 -0
- package/src/lib/nest/model/analytics.details.d.ts +21 -7
- package/src/lib/nest/model/analytics.emit.d.ts +3 -0
- package/src/lib/nest/model/analytics.handler.d.ts +30 -10
- package/src/lib/nest/model/api.details.d.ts +34 -1
- package/src/lib/nest/model/call.model.function.d.ts +20 -4
- package/src/lib/nest/model/create.model.function.d.ts +6 -1
- package/src/lib/nest/model/crud.assert.function.d.ts +12 -4
- package/src/lib/nest/model/delete.model.function.d.ts +6 -1
- package/src/lib/nest/model/permission.error.d.ts +7 -0
- package/src/lib/nest/model/read.model.function.d.ts +6 -1
- package/src/lib/nest/model/specifier.function.d.ts +3 -0
- package/src/lib/nest/model/update.model.function.d.ts +6 -1
- package/src/lib/nest/nest.provider.d.ts +16 -2
- package/src/lib/nest/storage/storage.module.d.ts +9 -0
- package/src/lib/storage/driver.accessor.d.ts +22 -0
- package/src/lib/storage/driver.d.ts +2 -0
- package/src/lib/storage/storage.d.ts +1 -0
- package/test/package.json +10 -10
- package/zoho/index.cjs.js +8 -6
- package/zoho/index.esm.js +8 -6
- package/zoho/package.json +9 -9
- package/zoho/src/lib/zoho.accounts.firebase.d.ts +2 -1
- package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +2 -1
package/index.cjs.js
CHANGED
|
@@ -74,6 +74,8 @@ function _type_of$7(obj) {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Creates an unauthenticated {@link HttpsError} indicating the request context has no auth data.
|
|
77
|
+
*
|
|
78
|
+
* @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
|
|
77
79
|
*/ function unauthenticatedContextHasNoAuthData() {
|
|
78
80
|
return unauthenticatedError({
|
|
79
81
|
message: 'expected auth',
|
|
@@ -82,6 +84,8 @@ function _type_of$7(obj) {
|
|
|
82
84
|
}
|
|
83
85
|
/**
|
|
84
86
|
* Creates an unauthenticated {@link HttpsError} indicating the request context has no user UID.
|
|
87
|
+
*
|
|
88
|
+
* @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
|
|
85
89
|
*/ function unauthenticatedContextHasNoUidError() {
|
|
86
90
|
return unauthenticatedError({
|
|
87
91
|
message: 'no user uid',
|
|
@@ -95,9 +99,15 @@ function _type_of$7(obj) {
|
|
|
95
99
|
* Each factory wraps the Firebase `HttpsError` with a consistent shape: an HTTP status code,
|
|
96
100
|
* a string error code, and an optional {@link ServerError} detail object.
|
|
97
101
|
*/ var UNAUTHENTICATED_ERROR_CODE = 'UNAUTHENTICATED';
|
|
98
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Creates an unauthenticated (401) {@link HttpsError}.
|
|
104
|
+
*
|
|
105
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
106
|
+
* @returns A new unauthenticated (401) {@link HttpsError}.
|
|
107
|
+
*/ function unauthenticatedError(messageOrError) {
|
|
108
|
+
var _serverError_message;
|
|
99
109
|
var serverError = util.partialServerError(messageOrError);
|
|
100
|
-
return new https.HttpsError('unauthenticated', (serverError
|
|
110
|
+
return new https.HttpsError('unauthenticated', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'unauthenticated', _object_spread_props$c(_object_spread$g({
|
|
101
111
|
status: 401,
|
|
102
112
|
code: UNAUTHENTICATED_ERROR_CODE
|
|
103
113
|
}, serverError), {
|
|
@@ -105,9 +115,15 @@ function _type_of$7(obj) {
|
|
|
105
115
|
}));
|
|
106
116
|
}
|
|
107
117
|
var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
|
|
108
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* Creates a forbidden (403) {@link HttpsError}.
|
|
120
|
+
*
|
|
121
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
122
|
+
* @returns A new forbidden (403) {@link HttpsError}.
|
|
123
|
+
*/ function forbiddenError(messageOrError) {
|
|
124
|
+
var _serverError_message;
|
|
109
125
|
var serverError = util.partialServerError(messageOrError);
|
|
110
|
-
return new https.HttpsError('permission-denied', (serverError
|
|
126
|
+
return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'forbidden', _object_spread_props$c(_object_spread$g({
|
|
111
127
|
status: 403,
|
|
112
128
|
code: FORBIDDEN_ERROR_CODE
|
|
113
129
|
}, serverError), {
|
|
@@ -115,9 +131,15 @@ var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
|
|
|
115
131
|
}));
|
|
116
132
|
}
|
|
117
133
|
var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
|
|
118
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Creates a permission-denied (403) {@link HttpsError}.
|
|
136
|
+
*
|
|
137
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
138
|
+
* @returns A new permission-denied (403) {@link HttpsError}.
|
|
139
|
+
*/ function permissionDeniedError(messageOrError) {
|
|
140
|
+
var _serverError_message;
|
|
119
141
|
var serverError = util.partialServerError(messageOrError);
|
|
120
|
-
return new https.HttpsError('permission-denied', (serverError
|
|
142
|
+
return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'permission denied', _object_spread_props$c(_object_spread$g({
|
|
121
143
|
status: 403,
|
|
122
144
|
code: PERMISSION_DENIED_ERROR_CODE
|
|
123
145
|
}, serverError), {
|
|
@@ -125,9 +147,15 @@ var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
|
|
|
125
147
|
}));
|
|
126
148
|
}
|
|
127
149
|
var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
|
|
128
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* Creates a not-found (404) {@link HttpsError}.
|
|
152
|
+
*
|
|
153
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
154
|
+
* @returns A new not-found (404) {@link HttpsError}.
|
|
155
|
+
*/ function notFoundError(messageOrError) {
|
|
156
|
+
var _serverError_message;
|
|
129
157
|
var serverError = util.partialServerError(messageOrError);
|
|
130
|
-
return new https.HttpsError('not-found', (serverError
|
|
158
|
+
return new https.HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'not found', _object_spread_props$c(_object_spread$g({
|
|
131
159
|
status: 404,
|
|
132
160
|
code: NOT_FOUND_ERROR_CODE
|
|
133
161
|
}, serverError), {
|
|
@@ -135,9 +163,15 @@ var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
|
|
|
135
163
|
}));
|
|
136
164
|
}
|
|
137
165
|
var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
|
|
138
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Creates a model-not-available (404) {@link HttpsError}, used when a Firestore document does not exist.
|
|
168
|
+
*
|
|
169
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
170
|
+
* @returns A new model-not-available (404) {@link HttpsError}.
|
|
171
|
+
*/ function modelNotAvailableError(messageOrError) {
|
|
172
|
+
var _serverError_message;
|
|
139
173
|
var serverError = util.partialServerError(messageOrError);
|
|
140
|
-
return new https.HttpsError('not-found', (serverError
|
|
174
|
+
return new https.HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'model was not available', _object_spread_props$c(_object_spread$g({
|
|
141
175
|
status: 404,
|
|
142
176
|
code: MODEL_NOT_AVAILABLE_ERROR_CODE
|
|
143
177
|
}, serverError), {
|
|
@@ -145,9 +179,15 @@ var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
|
|
|
145
179
|
}));
|
|
146
180
|
}
|
|
147
181
|
var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
|
|
148
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* Creates a bad-request (400) {@link HttpsError}.
|
|
184
|
+
*
|
|
185
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
186
|
+
* @returns A new bad-request (400) {@link HttpsError}.
|
|
187
|
+
*/ function badRequestError(messageOrError) {
|
|
188
|
+
var _serverError_message;
|
|
149
189
|
var serverError = util.partialServerError(messageOrError);
|
|
150
|
-
return new https.HttpsError('invalid-argument', (serverError
|
|
190
|
+
return new https.HttpsError('invalid-argument', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'bad request', _object_spread_props$c(_object_spread$g({
|
|
151
191
|
status: 400,
|
|
152
192
|
code: BAD_REQUEST_ERROR_CODE
|
|
153
193
|
}, serverError), {
|
|
@@ -155,9 +195,15 @@ var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
|
|
|
155
195
|
}));
|
|
156
196
|
}
|
|
157
197
|
var CONFLICT_ERROR_CODE = 'CONFLICT';
|
|
158
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* Creates a precondition-conflict (409) {@link HttpsError}.
|
|
200
|
+
*
|
|
201
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
202
|
+
* @returns A new precondition-conflict (409) {@link HttpsError}.
|
|
203
|
+
*/ function preconditionConflictError(messageOrError) {
|
|
204
|
+
var _serverError_message;
|
|
159
205
|
var serverError = util.partialServerError(messageOrError);
|
|
160
|
-
return new https.HttpsError('failed-precondition', (serverError
|
|
206
|
+
return new https.HttpsError('failed-precondition', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'conflict', _object_spread_props$c(_object_spread$g({
|
|
161
207
|
status: 409,
|
|
162
208
|
code: CONFLICT_ERROR_CODE
|
|
163
209
|
}, serverError), {
|
|
@@ -165,9 +211,15 @@ var CONFLICT_ERROR_CODE = 'CONFLICT';
|
|
|
165
211
|
}));
|
|
166
212
|
}
|
|
167
213
|
var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
|
|
168
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* Creates an already-exists (409) {@link HttpsError}.
|
|
216
|
+
*
|
|
217
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
218
|
+
* @returns A new already-exists (409) {@link HttpsError}.
|
|
219
|
+
*/ function alreadyExistsError(messageOrError) {
|
|
220
|
+
var _serverError_message;
|
|
169
221
|
var serverError = util.partialServerError(messageOrError);
|
|
170
|
-
return new https.HttpsError('already-exists', (serverError
|
|
222
|
+
return new https.HttpsError('already-exists', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'already exists', _object_spread_props$c(_object_spread$g({
|
|
171
223
|
status: 409,
|
|
172
224
|
code: ALREADY_EXISTS_ERROR_CODE
|
|
173
225
|
}, serverError), {
|
|
@@ -175,9 +227,15 @@ var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
|
|
|
175
227
|
}));
|
|
176
228
|
}
|
|
177
229
|
var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
|
|
178
|
-
/**
|
|
230
|
+
/**
|
|
231
|
+
* Creates an unavailable (503) {@link HttpsError}.
|
|
232
|
+
*
|
|
233
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
234
|
+
* @returns A new unavailable (503) {@link HttpsError}.
|
|
235
|
+
*/ function unavailableError(messageOrError) {
|
|
236
|
+
var _serverError_message;
|
|
179
237
|
var serverError = util.partialServerError(messageOrError);
|
|
180
|
-
return new https.HttpsError('unavailable', (serverError
|
|
238
|
+
return new https.HttpsError('unavailable', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'service unavailable', _object_spread_props$c(_object_spread$g({
|
|
181
239
|
status: 503,
|
|
182
240
|
code: UNAVAILABLE_ERROR_CODE
|
|
183
241
|
}, serverError), {
|
|
@@ -185,9 +243,15 @@ var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
|
|
|
185
243
|
}));
|
|
186
244
|
}
|
|
187
245
|
var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED_FUNCTION';
|
|
188
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* Creates an unimplemented (501) {@link HttpsError} for deactivated or unavailable functions.
|
|
248
|
+
*
|
|
249
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
250
|
+
* @returns A new unimplemented (501) {@link HttpsError}.
|
|
251
|
+
*/ function unavailableOrDeactivatedFunctionError(messageOrError) {
|
|
252
|
+
var _serverError_message;
|
|
189
253
|
var serverError = util.partialServerError(messageOrError);
|
|
190
|
-
return new https.HttpsError('unimplemented', (serverError
|
|
254
|
+
return new https.HttpsError('unimplemented', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'the requested function is not available or has been deactivated for use', _object_spread_props$c(_object_spread$g({
|
|
191
255
|
status: 501,
|
|
192
256
|
code: UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE
|
|
193
257
|
}, serverError), {
|
|
@@ -195,9 +259,15 @@ var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED
|
|
|
195
259
|
}));
|
|
196
260
|
}
|
|
197
261
|
var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
198
|
-
/**
|
|
262
|
+
/**
|
|
263
|
+
* Creates an internal-error (500) {@link HttpsError}.
|
|
264
|
+
*
|
|
265
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
266
|
+
* @returns A new internal-error (500) {@link HttpsError}.
|
|
267
|
+
*/ function internalServerError(messageOrError) {
|
|
268
|
+
var _serverError_message;
|
|
199
269
|
var serverError = util.partialServerError(messageOrError);
|
|
200
|
-
return new https.HttpsError('internal', (serverError
|
|
270
|
+
return new https.HttpsError('internal', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'internal error', _object_spread_props$c(_object_spread$g({
|
|
201
271
|
status: 500,
|
|
202
272
|
code: INTERNAL_SERVER_ERROR_CODE
|
|
203
273
|
}, serverError), {
|
|
@@ -206,13 +276,19 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
206
276
|
}
|
|
207
277
|
/**
|
|
208
278
|
* Type guard for Firebase {@link HttpsError} instances.
|
|
279
|
+
*
|
|
280
|
+
* @param input - The value to check.
|
|
281
|
+
* @returns `true` if the input is a Firebase {@link HttpsError}.
|
|
209
282
|
*/ function isFirebaseHttpsError(input) {
|
|
210
|
-
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input
|
|
283
|
+
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'httpErrorCode' in input && 'toJSON' in input;
|
|
211
284
|
}
|
|
212
285
|
/**
|
|
213
286
|
* Type guard for Firebase Admin {@link admin.FirebaseError} instances.
|
|
287
|
+
*
|
|
288
|
+
* @param input - The value to check.
|
|
289
|
+
* @returns `true` if the input is a Firebase Admin {@link admin.FirebaseError}.
|
|
214
290
|
*/ function isFirebaseError(input) {
|
|
215
|
-
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input
|
|
291
|
+
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'message' in input && 'toJSON' in input;
|
|
216
292
|
}
|
|
217
293
|
/**
|
|
218
294
|
* Analyzes a caught error and extracts structured Firebase error information.
|
|
@@ -221,6 +297,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
221
297
|
* and extracts any embedded error codes and {@link ServerError} details.
|
|
222
298
|
*
|
|
223
299
|
* @param e - The caught error to analyze.
|
|
300
|
+
* @returns Structured {@link FirebaseServerErrorInfo} with classified error details.
|
|
224
301
|
*
|
|
225
302
|
* @example
|
|
226
303
|
* ```typescript
|
|
@@ -265,6 +342,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
265
342
|
}
|
|
266
343
|
/**
|
|
267
344
|
* Returns a tuple of [firebaseErrorCode, errorInfo] for pattern-matching on Firebase error codes.
|
|
345
|
+
*
|
|
346
|
+
* @param e - The caught error to analyze.
|
|
347
|
+
* @returns A tuple of the Firebase error code (if present) and the full error info.
|
|
268
348
|
*/ function firebaseServerErrorInfoCodePair(e) {
|
|
269
349
|
var info = firebaseServerErrorInfo(e);
|
|
270
350
|
return [
|
|
@@ -274,6 +354,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
274
354
|
}
|
|
275
355
|
/**
|
|
276
356
|
* Returns a tuple of [serverError, errorInfo] for pattern-matching on embedded server error details.
|
|
357
|
+
*
|
|
358
|
+
* @param e - The caught error to analyze.
|
|
359
|
+
* @returns A tuple of the server error (if present) and the full error info.
|
|
277
360
|
*/ function firebaseServerErrorInfoServerErrorPair(e) {
|
|
278
361
|
var info = firebaseServerErrorInfo(e);
|
|
279
362
|
return [
|
|
@@ -283,6 +366,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
283
366
|
}
|
|
284
367
|
/**
|
|
285
368
|
* Returns a tuple of [serverErrorCode, errorInfo] for pattern-matching on server error string codes.
|
|
369
|
+
*
|
|
370
|
+
* @param e - The caught error to analyze.
|
|
371
|
+
* @returns A tuple of the server error code (if present) and the full error info.
|
|
286
372
|
*/ function firebaseServerErrorInfoServerErrorCodePair(e) {
|
|
287
373
|
var info = firebaseServerErrorInfo(e);
|
|
288
374
|
return [
|
|
@@ -307,6 +393,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
307
393
|
/**
|
|
308
394
|
* Type guard that checks whether the given callable context contains authenticated user data (non-null auth with a uid).
|
|
309
395
|
*
|
|
396
|
+
* @param context - The callable context to check.
|
|
397
|
+
* @returns `true` if the context has authenticated user data with a valid UID.
|
|
398
|
+
*
|
|
310
399
|
* @example
|
|
311
400
|
* ```typescript
|
|
312
401
|
* if (isContextWithAuthData(context)) {
|
|
@@ -315,11 +404,12 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
315
404
|
* ```
|
|
316
405
|
*/ function isContextWithAuthData(context) {
|
|
317
406
|
var _context_auth;
|
|
318
|
-
return Boolean(
|
|
407
|
+
return Boolean((_context_auth = context.auth) === null || _context_auth === void 0 ? void 0 : _context_auth.uid);
|
|
319
408
|
}
|
|
320
409
|
/**
|
|
321
410
|
* Asserts that the callable context contains authenticated user data.
|
|
322
411
|
*
|
|
412
|
+
* @param context - The callable context to assert on.
|
|
323
413
|
* @throws {HttpsError} Throws an unauthenticated error if auth data is missing.
|
|
324
414
|
*
|
|
325
415
|
* @example
|
|
@@ -340,6 +430,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
340
430
|
* including email, phone, and sign-in timestamps.
|
|
341
431
|
*
|
|
342
432
|
* @param token - The decoded ID token from Firebase Admin Auth.
|
|
433
|
+
* @returns A normalized {@link FirebaseAuthToken} with camelCase fields.
|
|
343
434
|
*
|
|
344
435
|
* @example
|
|
345
436
|
* ```typescript
|
|
@@ -523,7 +614,7 @@ function _ts_generator$c(thisArg, body) {
|
|
|
523
614
|
];
|
|
524
615
|
case 2:
|
|
525
616
|
error = _state.sent();
|
|
526
|
-
if (
|
|
617
|
+
if (error.code === firebase.FIREBASE_AUTH_USER_NOT_FOUND_ERROR) {
|
|
527
618
|
return [
|
|
528
619
|
2,
|
|
529
620
|
undefined
|
|
@@ -612,6 +703,63 @@ function _is_native_reflect_construct$5() {
|
|
|
612
703
|
return !!result;
|
|
613
704
|
})();
|
|
614
705
|
}
|
|
706
|
+
/**
|
|
707
|
+
* Thrown by {@link AbstractFirebaseServerNewUserService.createNewUser} when Firebase Auth rejects
|
|
708
|
+
* user creation because the provided phone number or email is already associated with another account.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```typescript
|
|
712
|
+
* try {
|
|
713
|
+
* await newUserService.initializeNewUser({ email, phone });
|
|
714
|
+
* } catch (e) {
|
|
715
|
+
* if (e instanceof FirebaseServerAuthUserExistsError && e.identifierType === 'phone') {
|
|
716
|
+
* const existingUser = await auth.getUserByPhoneNumber(e.identifierValue);
|
|
717
|
+
* }
|
|
718
|
+
* }
|
|
719
|
+
* ```
|
|
720
|
+
*/ var FirebaseServerAuthUserExistsError = /*#__PURE__*/ function(BaseError) {
|
|
721
|
+
_inherits$5(FirebaseServerAuthUserExistsError, BaseError);
|
|
722
|
+
function FirebaseServerAuthUserExistsError(code, identifierType, identifierValue) {
|
|
723
|
+
_class_call_check$o(this, FirebaseServerAuthUserExistsError);
|
|
724
|
+
var _this;
|
|
725
|
+
_this = _call_super$5(this, FirebaseServerAuthUserExistsError, [
|
|
726
|
+
"A user with the provided ".concat(identifierType, " already exists.")
|
|
727
|
+
]), _define_property$s(_this, "code", void 0), _define_property$s(_this, "identifierType", void 0), _define_property$s(_this, "identifierValue", void 0);
|
|
728
|
+
_this.code = code;
|
|
729
|
+
_this.identifierType = identifierType;
|
|
730
|
+
_this.identifierValue = identifierValue;
|
|
731
|
+
return _this;
|
|
732
|
+
}
|
|
733
|
+
return FirebaseServerAuthUserExistsError;
|
|
734
|
+
}(makeError.BaseError);
|
|
735
|
+
/**
|
|
736
|
+
* Thrown by {@link AbstractFirebaseServerNewUserService.createNewUser} when Firebase Auth rejects
|
|
737
|
+
* user creation due to invalid input (e.g., a malformed phone number).
|
|
738
|
+
*
|
|
739
|
+
* @example
|
|
740
|
+
* ```typescript
|
|
741
|
+
* try {
|
|
742
|
+
* await newUserService.initializeNewUser({ email, phone: 'not-e164' });
|
|
743
|
+
* } catch (e) {
|
|
744
|
+
* if (e instanceof FirebaseServerAuthUserBadInputError) {
|
|
745
|
+
* console.log(`Bad input (${e.code}): ${e.inputValue}`);
|
|
746
|
+
* }
|
|
747
|
+
* }
|
|
748
|
+
* ```
|
|
749
|
+
*/ var FirebaseServerAuthUserBadInputError = /*#__PURE__*/ function(BaseError) {
|
|
750
|
+
_inherits$5(FirebaseServerAuthUserBadInputError, BaseError);
|
|
751
|
+
function FirebaseServerAuthUserBadInputError(code, inputValue, message) {
|
|
752
|
+
_class_call_check$o(this, FirebaseServerAuthUserBadInputError);
|
|
753
|
+
var _this;
|
|
754
|
+
_this = _call_super$5(this, FirebaseServerAuthUserBadInputError, [
|
|
755
|
+
message !== null && message !== void 0 ? message : "Invalid input for user creation: ".concat(inputValue)
|
|
756
|
+
]), _define_property$s(_this, "code", void 0), _define_property$s(_this, "inputValue", void 0);
|
|
757
|
+
_this.code = code;
|
|
758
|
+
_this.inputValue = inputValue;
|
|
759
|
+
return _this;
|
|
760
|
+
}
|
|
761
|
+
return FirebaseServerAuthUserBadInputError;
|
|
762
|
+
}(makeError.BaseError);
|
|
615
763
|
/**
|
|
616
764
|
* Thrown by sendSetupDetails() if the user has no setup configuration available, meaning they probably already have accepted their invite or is in an invalid state.
|
|
617
765
|
*/ var FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError = /*#__PURE__*/ function(BaseError) {
|
|
@@ -662,6 +810,9 @@ function _array_like_to_array$a(arr, len) {
|
|
|
662
810
|
function _array_with_holes$3(arr) {
|
|
663
811
|
if (Array.isArray(arr)) return arr;
|
|
664
812
|
}
|
|
813
|
+
function _array_without_holes$7(arr) {
|
|
814
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
815
|
+
}
|
|
665
816
|
function _assert_this_initialized$4(self) {
|
|
666
817
|
if (self === void 0) {
|
|
667
818
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -751,6 +902,9 @@ function _inherits$4(subClass, superClass) {
|
|
|
751
902
|
});
|
|
752
903
|
if (superClass) _set_prototype_of$4(subClass, superClass);
|
|
753
904
|
}
|
|
905
|
+
function _iterable_to_array$7(iter) {
|
|
906
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
907
|
+
}
|
|
754
908
|
function _iterable_to_array_limit$3(arr, i) {
|
|
755
909
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
756
910
|
if (_i == null) return;
|
|
@@ -778,6 +932,9 @@ function _iterable_to_array_limit$3(arr, i) {
|
|
|
778
932
|
function _non_iterable_rest$3() {
|
|
779
933
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
780
934
|
}
|
|
935
|
+
function _non_iterable_spread$7() {
|
|
936
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
937
|
+
}
|
|
781
938
|
function _object_spread$f(target) {
|
|
782
939
|
for(var i = 1; i < arguments.length; i++){
|
|
783
940
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -809,6 +966,9 @@ function _set_prototype_of$4(o, p) {
|
|
|
809
966
|
function _sliced_to_array$3(arr, i) {
|
|
810
967
|
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$3();
|
|
811
968
|
}
|
|
969
|
+
function _to_consumable_array$7(arr) {
|
|
970
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$7();
|
|
971
|
+
}
|
|
812
972
|
function _type_of$5(obj) {
|
|
813
973
|
"@swc/helpers - typeof";
|
|
814
974
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -1016,6 +1176,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1016
1176
|
{
|
|
1017
1177
|
/**
|
|
1018
1178
|
* Generates a random numeric string for use as a temporary reset password.
|
|
1179
|
+
*
|
|
1180
|
+
* @returns A random numeric string suitable as a temporary password.
|
|
1019
1181
|
*/ key: "_generateResetPasswordKey",
|
|
1020
1182
|
value: function _generateResetPasswordKey() {
|
|
1021
1183
|
return String(DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR());
|
|
@@ -1196,6 +1358,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1196
1358
|
*
|
|
1197
1359
|
* @param roles - The complete set of roles to assign.
|
|
1198
1360
|
* @param claimsToRetain - Additional claims to merge in alongside the role-derived claims.
|
|
1361
|
+
* @returns Resolves when the claims have been replaced.
|
|
1199
1362
|
*
|
|
1200
1363
|
* @example
|
|
1201
1364
|
* ```typescript
|
|
@@ -1206,7 +1369,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1206
1369
|
return _async_to_generator$b(function() {
|
|
1207
1370
|
var claims;
|
|
1208
1371
|
return _ts_generator$b(this, function(_state) {
|
|
1209
|
-
claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(
|
|
1372
|
+
claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(_to_consumable_array$7(roles)));
|
|
1210
1373
|
return [
|
|
1211
1374
|
2,
|
|
1212
1375
|
this.setClaims(claims)
|
|
@@ -1219,6 +1382,9 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1219
1382
|
/**
|
|
1220
1383
|
* Converts roles to their corresponding claim keys, filtering out null/undefined entries
|
|
1221
1384
|
* that represent unrelated claims in the service's {@link FirebaseServerAuthService.claimsForRoles} output.
|
|
1385
|
+
*
|
|
1386
|
+
* @param roles - The roles to convert to claims.
|
|
1387
|
+
* @returns Filtered claims object with only the relevant role-based entries.
|
|
1222
1388
|
*/ key: "_claimsForRolesChange",
|
|
1223
1389
|
value: function _claimsForRolesChange(roles) {
|
|
1224
1390
|
return util.filterNullAndUndefinedValues(this.service.claimsForRoles(util.asSet(roles)));
|
|
@@ -1247,12 +1413,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1247
1413
|
];
|
|
1248
1414
|
case 1:
|
|
1249
1415
|
currentClaims = _state.sent();
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
newClaims = util.filterNullAndUndefinedValues(newClaims);
|
|
1253
|
-
} else {
|
|
1254
|
-
newClaims = claims;
|
|
1255
|
-
}
|
|
1416
|
+
newClaims = _object_spread$f({}, currentClaims, util.filterUndefinedValues(claims, false));
|
|
1417
|
+
newClaims = util.filterNullAndUndefinedValues(newClaims);
|
|
1256
1418
|
return [
|
|
1257
1419
|
2,
|
|
1258
1420
|
this.setClaims(newClaims)
|
|
@@ -1381,6 +1543,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1381
1543
|
*
|
|
1382
1544
|
* @param authService - The auth service to create a context from if needed.
|
|
1383
1545
|
* @param userContextOrUid - A user context or UID string.
|
|
1546
|
+
* @returns The resolved user context instance.
|
|
1384
1547
|
*
|
|
1385
1548
|
* @example
|
|
1386
1549
|
* ```typescript
|
|
@@ -1564,6 +1727,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1564
1727
|
3,
|
|
1565
1728
|
7
|
|
1566
1729
|
];
|
|
1730
|
+
// Cast to string | undefined because claims are cast from raw custom claims which may not have this field at runtime
|
|
1567
1731
|
setupCommunicationAt = setupDetails.claims.setupCommunicationAt;
|
|
1568
1732
|
hasSentCommunication = Boolean(setupCommunicationAt);
|
|
1569
1733
|
if (!((config === null || config === void 0 ? void 0 : config.sendSetupDetailsOnce) && hasSentCommunication)) return [
|
|
@@ -1571,7 +1735,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1571
1735
|
2
|
|
1572
1736
|
];
|
|
1573
1737
|
// do not send.
|
|
1574
|
-
if (config
|
|
1738
|
+
if (config.throwErrors) {
|
|
1575
1739
|
throw new FirebaseServerAuthNewUserSendSetupDetailsSendOnceError();
|
|
1576
1740
|
}
|
|
1577
1741
|
return [
|
|
@@ -1701,6 +1865,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1701
1865
|
key: "updateSetupContentSentTime",
|
|
1702
1866
|
value: /**
|
|
1703
1867
|
* Records the current timestamp as the last setup content communication date in the user's claims.
|
|
1868
|
+
*
|
|
1869
|
+
* @param details - The user's setup details containing the user context.
|
|
1704
1870
|
*/ function updateSetupContentSentTime(details) {
|
|
1705
1871
|
return _async_to_generator$b(function() {
|
|
1706
1872
|
var setupCommunicationAt;
|
|
@@ -1767,15 +1933,25 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1767
1933
|
*
|
|
1768
1934
|
* Generates a random setup password if none is provided. Override to customize user creation behavior.
|
|
1769
1935
|
*
|
|
1936
|
+
* @param input - The initialization configuration for the new user.
|
|
1937
|
+
* @returns The created user record and the setup password used.
|
|
1770
1938
|
* @throws Throws if the Firebase Admin SDK rejects the user creation.
|
|
1771
1939
|
*/ function createNewUser(input) {
|
|
1772
1940
|
return _async_to_generator$b(function() {
|
|
1773
|
-
var uid, displayName, email, phoneNumber, inputPassword, password, user;
|
|
1941
|
+
var uid, displayName, email, phoneNumber, inputPassword, password, user, e, firebaseError, errorCode;
|
|
1774
1942
|
return _ts_generator$b(this, function(_state) {
|
|
1775
1943
|
switch(_state.label){
|
|
1776
1944
|
case 0:
|
|
1777
1945
|
uid = input.uid, displayName = input.displayName, email = input.email, phoneNumber = input.phone, inputPassword = input.setupPassword;
|
|
1778
1946
|
password = inputPassword !== null && inputPassword !== void 0 ? inputPassword : this.generateRandomSetupPassword();
|
|
1947
|
+
_state.label = 1;
|
|
1948
|
+
case 1:
|
|
1949
|
+
_state.trys.push([
|
|
1950
|
+
1,
|
|
1951
|
+
3,
|
|
1952
|
+
,
|
|
1953
|
+
4
|
|
1954
|
+
]);
|
|
1779
1955
|
return [
|
|
1780
1956
|
4,
|
|
1781
1957
|
this.authService.auth.createUser({
|
|
@@ -1786,8 +1962,25 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1786
1962
|
password: password
|
|
1787
1963
|
})
|
|
1788
1964
|
];
|
|
1789
|
-
case
|
|
1965
|
+
case 2:
|
|
1790
1966
|
user = _state.sent();
|
|
1967
|
+
return [
|
|
1968
|
+
3,
|
|
1969
|
+
4
|
|
1970
|
+
];
|
|
1971
|
+
case 3:
|
|
1972
|
+
e = _state.sent();
|
|
1973
|
+
firebaseError = e;
|
|
1974
|
+
errorCode = firebaseError.code;
|
|
1975
|
+
if (errorCode === firebase.FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR && phoneNumber) {
|
|
1976
|
+
throw new FirebaseServerAuthUserExistsError(errorCode, 'phone', phoneNumber);
|
|
1977
|
+
} else if (errorCode === firebase.FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR && email) {
|
|
1978
|
+
throw new FirebaseServerAuthUserExistsError(errorCode, 'email', email);
|
|
1979
|
+
} else if (errorCode === firebase.FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR && phoneNumber) {
|
|
1980
|
+
throw new FirebaseServerAuthUserBadInputError(errorCode, phoneNumber);
|
|
1981
|
+
}
|
|
1982
|
+
throw e;
|
|
1983
|
+
case 4:
|
|
1791
1984
|
return [
|
|
1792
1985
|
2,
|
|
1793
1986
|
{
|
|
@@ -1810,6 +2003,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1810
2003
|
key: "updateClaimsToClearUser",
|
|
1811
2004
|
value: /**
|
|
1812
2005
|
* Clears setup-related claims (setup password and last communication date) from the user.
|
|
2006
|
+
*
|
|
2007
|
+
* @param userContext - The user context to clear setup claims from.
|
|
1813
2008
|
*/ function updateClaimsToClearUser(userContext) {
|
|
1814
2009
|
return _async_to_generator$b(function() {
|
|
1815
2010
|
var _obj;
|
|
@@ -2015,6 +2210,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
2015
2210
|
* Creates a NestJS provider that binds the given config to the {@link FIREBASE_SERVER_ENV_TOKEN} injection token.
|
|
2016
2211
|
*
|
|
2017
2212
|
* @param env - The Firebase server environment configuration.
|
|
2213
|
+
* @returns A NestJS provider binding the config to the {@link FIREBASE_SERVER_ENV_TOKEN} token.
|
|
2018
2214
|
*
|
|
2019
2215
|
* @example
|
|
2020
2216
|
* ```typescript
|
|
@@ -2033,6 +2229,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
2033
2229
|
* Use this when the NestJS app needs the config accessible via either token.
|
|
2034
2230
|
*
|
|
2035
2231
|
* @param env - The Firebase server environment configuration.
|
|
2232
|
+
* @returns An array of providers binding the config to both Firebase and base server env tokens.
|
|
2036
2233
|
*
|
|
2037
2234
|
* @example
|
|
2038
2235
|
* ```typescript
|
|
@@ -2074,6 +2271,7 @@ function _class_call_check$m(instance, Constructor) {
|
|
|
2074
2271
|
* Each field in the input maps to an atomic increment operation. Null/undefined values default to 0.
|
|
2075
2272
|
*
|
|
2076
2273
|
* @param input - The increment specification mapping field names to numeric deltas.
|
|
2274
|
+
* @returns Firestore {@link UpdateData} with atomic increment operations.
|
|
2077
2275
|
*
|
|
2078
2276
|
* @example
|
|
2079
2277
|
* ```typescript
|
|
@@ -2146,6 +2344,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
2146
2344
|
* Google Cloud Firestore's {@link FieldValue.arrayUnion} and {@link FieldValue.arrayRemove}.
|
|
2147
2345
|
*
|
|
2148
2346
|
* @param input - The array update specification with `union` and/or `remove` field maps.
|
|
2347
|
+
* @returns Firestore {@link UpdateData} with array union/remove operations.
|
|
2149
2348
|
*
|
|
2150
2349
|
* @example
|
|
2151
2350
|
* ```typescript
|
|
@@ -2155,8 +2354,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
2155
2354
|
* });
|
|
2156
2355
|
* ```
|
|
2157
2356
|
*/ function firestoreServerArrayUpdateToUpdateData(input) {
|
|
2158
|
-
var union = input
|
|
2159
|
-
var remove = input
|
|
2357
|
+
var union = input.union;
|
|
2358
|
+
var remove = input.remove;
|
|
2160
2359
|
function createUpdatesWithArrayFunction(fieldUpdate, arrayUpdateFunction) {
|
|
2161
2360
|
var result;
|
|
2162
2361
|
if (fieldUpdate) {
|
|
@@ -2290,7 +2489,7 @@ function _define_property$p(obj, key, value) {
|
|
|
2290
2489
|
key: "update",
|
|
2291
2490
|
value: function update(data, params) {
|
|
2292
2491
|
if ((params === null || params === void 0 ? void 0 : params.precondition) != null) {
|
|
2293
|
-
this.batch.update(this.documentRef, data, params
|
|
2492
|
+
this.batch.update(this.documentRef, data, params.precondition);
|
|
2294
2493
|
} else {
|
|
2295
2494
|
this.batch.update(this.documentRef, data);
|
|
2296
2495
|
}
|
|
@@ -2307,6 +2506,7 @@ function _define_property$p(obj, key, value) {
|
|
|
2307
2506
|
* the batch applies all queued writes atomically.
|
|
2308
2507
|
*
|
|
2309
2508
|
* @param writeBatch - The Google Cloud WriteBatch to queue operations into.
|
|
2509
|
+
* @returns A factory that creates batch-backed accessors sharing the given WriteBatch.
|
|
2310
2510
|
*
|
|
2311
2511
|
* @example
|
|
2312
2512
|
* ```typescript
|
|
@@ -2349,6 +2549,9 @@ function _define_property$p(obj, key, value) {
|
|
|
2349
2549
|
}();
|
|
2350
2550
|
/**
|
|
2351
2551
|
* Creates a {@link WriteBatchFirestoreDocumentContext} wrapping the given batch.
|
|
2552
|
+
*
|
|
2553
|
+
* @param batch - The Google Cloud WriteBatch to use.
|
|
2554
|
+
* @returns A new {@link WriteBatchFirestoreDocumentContext} for the given batch.
|
|
2352
2555
|
*/ function writeBatchDocumentContext(batch) {
|
|
2353
2556
|
return new WriteBatchFirestoreDocumentContext(batch);
|
|
2354
2557
|
}
|
|
@@ -2475,6 +2678,8 @@ function _define_property$o(obj, key, value) {
|
|
|
2475
2678
|
/**
|
|
2476
2679
|
* Creates a {@link FirestoreDocumentDataAccessorFactory} that produces default (non-batched, non-transactional) accessors.
|
|
2477
2680
|
*
|
|
2681
|
+
* @returns A factory that creates default (non-batched, non-transactional) accessors.
|
|
2682
|
+
*
|
|
2478
2683
|
* @example
|
|
2479
2684
|
* ```typescript
|
|
2480
2685
|
* const factory = defaultFirestoreAccessorFactory<User>();
|
|
@@ -2492,6 +2697,8 @@ function _define_property$o(obj, key, value) {
|
|
|
2492
2697
|
* Creates a {@link FirestoreDocumentContext} with no special execution context (no batch, no transaction).
|
|
2493
2698
|
*
|
|
2494
2699
|
* Operations performed through this context execute immediately against Firestore.
|
|
2700
|
+
*
|
|
2701
|
+
* @returns A {@link FirestoreDocumentContext} for direct Firestore operations.
|
|
2495
2702
|
*/ function defaultFirestoreDocumentContext() {
|
|
2496
2703
|
return {
|
|
2497
2704
|
contextType: firebase.FirestoreDocumentContextType.NONE,
|
|
@@ -2621,7 +2828,7 @@ function _define_property$n(obj, key, value) {
|
|
|
2621
2828
|
key: "update",
|
|
2622
2829
|
value: function update(data, params) {
|
|
2623
2830
|
if (params === null || params === void 0 ? void 0 : params.precondition) {
|
|
2624
|
-
this.transaction.update(this.documentRef, data, params
|
|
2831
|
+
this.transaction.update(this.documentRef, data, params.precondition);
|
|
2625
2832
|
} else {
|
|
2626
2833
|
this.transaction.update(this.documentRef, data);
|
|
2627
2834
|
}
|
|
@@ -2638,6 +2845,7 @@ function _define_property$n(obj, key, value) {
|
|
|
2638
2845
|
* atomic operation.
|
|
2639
2846
|
*
|
|
2640
2847
|
* @param transaction - The Google Cloud Transaction to execute operations within.
|
|
2848
|
+
* @returns A factory that creates transaction-backed accessors sharing the given transaction.
|
|
2641
2849
|
*
|
|
2642
2850
|
* @example
|
|
2643
2851
|
* ```typescript
|
|
@@ -2681,6 +2889,9 @@ function _define_property$n(obj, key, value) {
|
|
|
2681
2889
|
}();
|
|
2682
2890
|
/**
|
|
2683
2891
|
* Creates a {@link TransactionFirestoreDocumentContext} wrapping the given transaction.
|
|
2892
|
+
*
|
|
2893
|
+
* @param transaction - The Google Cloud Transaction to use.
|
|
2894
|
+
* @returns A new {@link TransactionFirestoreDocumentContext} for the given transaction.
|
|
2684
2895
|
*/ function transactionDocumentContext(transaction) {
|
|
2685
2896
|
return new TransactionFirestoreDocumentContext(transaction);
|
|
2686
2897
|
}
|
|
@@ -2867,6 +3078,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2867
3078
|
* @param start - A Firestore object that can resolve collection paths (e.g., Firestore instance, DocumentReference).
|
|
2868
3079
|
* @param path - The initial collection path.
|
|
2869
3080
|
* @param pathSegments - Optional pairs of [docId, collectionName] for subcollection traversal.
|
|
3081
|
+
* @returns The resolved {@link CollectionReference} at the given path.
|
|
2870
3082
|
* @throws Error if pathSegments length is odd (segments must come in pairs).
|
|
2871
3083
|
*
|
|
2872
3084
|
* @example
|
|
@@ -2877,7 +3089,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2877
3089
|
*/ function collectionRefForPath(start, path, pathSegments) {
|
|
2878
3090
|
var ref = start.collection(path);
|
|
2879
3091
|
if (pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) {
|
|
2880
|
-
if (
|
|
3092
|
+
if (pathSegments.length % 2 !== 0) {
|
|
2881
3093
|
throw new Error('Invalid number of path segments provided for collection. Path: "'.concat(path, '" + "').concat(pathSegments, '"'));
|
|
2882
3094
|
}
|
|
2883
3095
|
var batches = util.batch(pathSegments, 2); // batch to tuple [string, string]
|
|
@@ -2897,6 +3109,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2897
3109
|
* @param start - A Firestore object that can resolve document paths (e.g., CollectionReference).
|
|
2898
3110
|
* @param path - Optional document ID or path within the collection.
|
|
2899
3111
|
* @param pathSegments - Optional pairs of [collectionName, docId] for subcollection traversal.
|
|
3112
|
+
* @returns The resolved {@link DocumentReference} at the given path.
|
|
2900
3113
|
*
|
|
2901
3114
|
* @example
|
|
2902
3115
|
* ```typescript
|
|
@@ -2921,6 +3134,8 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2921
3134
|
* Implements document/collection resolution, transaction/batch factories, and context factories
|
|
2922
3135
|
* using the `@google-cloud/firestore` library.
|
|
2923
3136
|
*
|
|
3137
|
+
* @returns A {@link FirestoreAccessorDriver} for the Google Cloud Admin SDK.
|
|
3138
|
+
*
|
|
2924
3139
|
* @example
|
|
2925
3140
|
* ```typescript
|
|
2926
3141
|
* const accessorDriver = googleCloudFirestoreAccessorDriver();
|
|
@@ -2955,18 +3170,10 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2955
3170
|
return function(fn) {
|
|
2956
3171
|
return _async_to_generator$a(function() {
|
|
2957
3172
|
return _ts_generator$a(this, function(_state) {
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
firestore.runTransaction(fn)
|
|
2963
|
-
];
|
|
2964
|
-
case 1:
|
|
2965
|
-
return [
|
|
2966
|
-
2,
|
|
2967
|
-
_state.sent()
|
|
2968
|
-
];
|
|
2969
|
-
}
|
|
3173
|
+
return [
|
|
3174
|
+
2,
|
|
3175
|
+
firestore.runTransaction(fn)
|
|
3176
|
+
];
|
|
2970
3177
|
});
|
|
2971
3178
|
})();
|
|
2972
3179
|
};
|
|
@@ -3091,6 +3298,8 @@ var _obj;
|
|
|
3091
3298
|
* Creates a {@link FirestoreQueryConstraintFunctionsDriver} for the Google Cloud Firestore server SDK.
|
|
3092
3299
|
*
|
|
3093
3300
|
* Translates abstract query constraints into Google Cloud Firestore query builder calls.
|
|
3301
|
+
*
|
|
3302
|
+
* @returns A {@link FirestoreQueryConstraintFunctionsDriver} for the server SDK.
|
|
3094
3303
|
*/ function firestoreClientQueryConstraintFunctionsDriver() {
|
|
3095
3304
|
return firebase.makeFirestoreQueryConstraintFunctionsDriver({
|
|
3096
3305
|
mapping: FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING,
|
|
@@ -3112,6 +3321,8 @@ var _obj;
|
|
|
3112
3321
|
* streaming (streamDocs) via `onSnapshot`. Transaction-aware reads are supported
|
|
3113
3322
|
* through the optional transaction parameter in `getDocs`.
|
|
3114
3323
|
*
|
|
3324
|
+
* @returns A complete {@link FirestoreQueryDriver} for the Google Cloud Admin SDK.
|
|
3325
|
+
*
|
|
3115
3326
|
* @example
|
|
3116
3327
|
* ```typescript
|
|
3117
3328
|
* const queryDriver = googleCloudFirestoreQueryDriver();
|
|
@@ -3146,6 +3357,8 @@ var _obj;
|
|
|
3146
3357
|
*
|
|
3147
3358
|
* Bundles the server-side accessor driver and query driver, identified as `@google-cloud/firestore`.
|
|
3148
3359
|
*
|
|
3360
|
+
* @returns A complete set of {@link FirestoreDrivers} for the Google Cloud Admin SDK.
|
|
3361
|
+
*
|
|
3149
3362
|
* @example
|
|
3150
3363
|
* ```typescript
|
|
3151
3364
|
* const drivers = googleCloudFirestoreDrivers();
|
|
@@ -3356,6 +3569,7 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3356
3569
|
/**
|
|
3357
3570
|
* Asserts that the callable context contains auth data with a valid UID.
|
|
3358
3571
|
*
|
|
3572
|
+
* @param context - The callable context to check for auth data.
|
|
3359
3573
|
* @throws {HttpsError} Throws unauthenticated error if no auth data is present.
|
|
3360
3574
|
*
|
|
3361
3575
|
* @example
|
|
@@ -3373,13 +3587,15 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3373
3587
|
*
|
|
3374
3588
|
* @param document - The Firestore document to load data from.
|
|
3375
3589
|
* @param message - Optional custom error message.
|
|
3590
|
+
* @returns The document's snapshot data.
|
|
3376
3591
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
|
|
3377
3592
|
*
|
|
3378
3593
|
* @example
|
|
3379
3594
|
* ```typescript
|
|
3380
3595
|
* const userData = await assertSnapshotData(userDocument);
|
|
3381
3596
|
* ```
|
|
3382
|
-
*/
|
|
3597
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3598
|
+
function assertSnapshotData(document, message) {
|
|
3383
3599
|
return _async_to_generator$9(function() {
|
|
3384
3600
|
var data;
|
|
3385
3601
|
return _ts_generator$9(this, function(_state) {
|
|
@@ -3411,8 +3627,10 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3411
3627
|
*
|
|
3412
3628
|
* @param document - The Firestore document to load data from.
|
|
3413
3629
|
* @param message - Optional custom error message.
|
|
3630
|
+
* @returns The document's snapshot data with `id` and `key` attached.
|
|
3414
3631
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
|
|
3415
|
-
*/
|
|
3632
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3633
|
+
function assertSnapshotDataWithKey(document, message) {
|
|
3416
3634
|
return _async_to_generator$9(function() {
|
|
3417
3635
|
var data;
|
|
3418
3636
|
return _ts_generator$9(this, function(_state) {
|
|
@@ -3438,7 +3656,8 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3438
3656
|
* @param document - The Firestore document to check.
|
|
3439
3657
|
* @param message - Optional custom error message.
|
|
3440
3658
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document does not exist.
|
|
3441
|
-
*/
|
|
3659
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3660
|
+
function assertDocumentExists(document, message) {
|
|
3442
3661
|
return _async_to_generator$9(function() {
|
|
3443
3662
|
var exists;
|
|
3444
3663
|
return _ts_generator$9(this, function(_state) {
|
|
@@ -3464,7 +3683,12 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3464
3683
|
* Creates a {@link modelNotAvailableError} for the given document's model type.
|
|
3465
3684
|
*
|
|
3466
3685
|
* Used by {@link assertDocumentExists} and other assertion functions.
|
|
3467
|
-
|
|
3686
|
+
*
|
|
3687
|
+
* @param document - The document (or object with `modelType`) to generate the error for.
|
|
3688
|
+
* @param message - Optional custom error message.
|
|
3689
|
+
* @returns A {@link modelNotAvailableError} with the document's model type in the message.
|
|
3690
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3691
|
+
function documentModelNotAvailableError(document, message) {
|
|
3468
3692
|
return modelNotAvailableError({
|
|
3469
3693
|
message: message !== null && message !== void 0 ? message : "The ".concat(document.modelType, " was unavailable.")
|
|
3470
3694
|
});
|
|
@@ -3475,6 +3699,8 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3475
3699
|
*/ var PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE = 'PHONE_NUMBER_ALREADY_EXISTS';
|
|
3476
3700
|
/**
|
|
3477
3701
|
* Creates a precondition conflict (409) error indicating the phone number already exists.
|
|
3702
|
+
*
|
|
3703
|
+
* @returns A new precondition-conflict (409) {@link HttpsError} with the phone-number-exists code.
|
|
3478
3704
|
*/ function phoneNumberAlreadyExistsError() {
|
|
3479
3705
|
return preconditionConflictError({
|
|
3480
3706
|
code: PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE,
|
|
@@ -3492,7 +3718,7 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3492
3718
|
*/ function handleFirebaseAuthError(e, handleUnknownCode) {
|
|
3493
3719
|
handleFirebaseError(e, function(firebaseError) {
|
|
3494
3720
|
switch(firebaseError.code){
|
|
3495
|
-
case
|
|
3721
|
+
case firebase.FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR:
|
|
3496
3722
|
throw phoneNumberAlreadyExistsError();
|
|
3497
3723
|
default:
|
|
3498
3724
|
handleUnknownCode === null || handleUnknownCode === void 0 ? void 0 : handleUnknownCode(firebaseError);
|
|
@@ -3558,7 +3784,10 @@ function _class_call_check$h(instance, Constructor) {
|
|
|
3558
3784
|
* Creates a default no-op {@link FirebaseServerAnalyticsServiceListener}.
|
|
3559
3785
|
*
|
|
3560
3786
|
* Used when no analytics provider is configured. All methods are no-ops.
|
|
3787
|
+
*
|
|
3788
|
+
* @returns A no-op listener that silently discards all analytics events.
|
|
3561
3789
|
*/ function noopFirebaseServerAnalyticsServiceListener() {
|
|
3790
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3562
3791
|
var noop = function noop() {};
|
|
3563
3792
|
return {
|
|
3564
3793
|
handleOnCallAnalyticsEvent: noop,
|
|
@@ -3866,6 +4095,9 @@ function _ts_generator$8(thisArg, body) {
|
|
|
3866
4095
|
* emitter('triggered').sendEventType('Handler Starting');
|
|
3867
4096
|
* emitter('success').sendEvent('Widget Created', { id: result.id });
|
|
3868
4097
|
* ```
|
|
4098
|
+
*
|
|
4099
|
+
* @param config - The service and context to bind to the emitter factory.
|
|
4100
|
+
* @returns A factory function that creates lifecycle-stage-specific emitters.
|
|
3869
4101
|
*/ function onCallAnalyticsEmitterInstance(config) {
|
|
3870
4102
|
var service = config.service, context = config.context;
|
|
3871
4103
|
return function(lifecycle) {
|
|
@@ -3873,6 +4105,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
3873
4105
|
service: service,
|
|
3874
4106
|
context: context,
|
|
3875
4107
|
lifecycle: lifecycle,
|
|
4108
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3876
4109
|
sendEvent: function sendEvent(event, properties) {
|
|
3877
4110
|
service.handleOnCallAnalyticsEvent({
|
|
3878
4111
|
event: event,
|
|
@@ -4072,22 +4305,34 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4072
4305
|
// MARK: Type Guards
|
|
4073
4306
|
/**
|
|
4074
4307
|
* Whether the details are specifier-level (has specifiers map).
|
|
4308
|
+
*
|
|
4309
|
+
* @param details - The API details to check.
|
|
4310
|
+
* @returns True if the details contain a specifiers map.
|
|
4075
4311
|
*/ function isOnCallModelTypeApiDetails(details) {
|
|
4076
4312
|
return details != null && 'specifiers' in details;
|
|
4077
4313
|
}
|
|
4078
4314
|
/**
|
|
4079
4315
|
* Whether the details are CRUD-model-level (has modelTypes map).
|
|
4316
|
+
*
|
|
4317
|
+
* @param details - The API details to check.
|
|
4318
|
+
* @returns True if the details contain a modelTypes map.
|
|
4080
4319
|
*/ function isOnCallCrudModelApiDetails(details) {
|
|
4081
4320
|
return details != null && 'modelTypes' in details;
|
|
4082
4321
|
}
|
|
4083
4322
|
/**
|
|
4084
4323
|
* Whether the details are handler-level (leaf node — no specifiers or modelTypes).
|
|
4324
|
+
*
|
|
4325
|
+
* @param details - The API details to check.
|
|
4326
|
+
* @returns True if the details are handler-level (no specifiers or modelTypes).
|
|
4085
4327
|
*/ function isOnCallHandlerApiDetails(details) {
|
|
4086
4328
|
return details != null && !('specifiers' in details) && !('modelTypes' in details);
|
|
4087
4329
|
}
|
|
4088
4330
|
/**
|
|
4089
4331
|
* Whether the specifier-level details represent a true specifier (multiple sub-operations)
|
|
4090
4332
|
* vs a wrapped direct handler (`isSpecifier: false`, details under `_`).
|
|
4333
|
+
*
|
|
4334
|
+
* @param details - The specifier-level API details to check.
|
|
4335
|
+
* @returns True if the details represent a true specifier with multiple sub-operations.
|
|
4091
4336
|
*/ function isActualSpecifier(details) {
|
|
4092
4337
|
return details.isSpecifier;
|
|
4093
4338
|
}
|
|
@@ -4120,7 +4365,11 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4120
4365
|
* fn: async (request) => { ... }
|
|
4121
4366
|
* });
|
|
4122
4367
|
* ```
|
|
4123
|
-
|
|
4368
|
+
*
|
|
4369
|
+
* @param config - The API details configuration including the handler function.
|
|
4370
|
+
* @returns The handler function with _apiDetails attached.
|
|
4371
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4372
|
+
function withApiDetails(config) {
|
|
4124
4373
|
var optionalAuth = config.optionalAuth, fn = config.fn, apiDetails = _object_without_properties(config, [
|
|
4125
4374
|
"optionalAuth",
|
|
4126
4375
|
"fn"
|
|
@@ -4134,6 +4383,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4134
4383
|
// MARK: Aggregation Utilities
|
|
4135
4384
|
/**
|
|
4136
4385
|
* Reads _apiDetails from a function if present.
|
|
4386
|
+
*
|
|
4387
|
+
* @param fn - The function or object that may carry _apiDetails.
|
|
4388
|
+
* @returns The API details if present, otherwise undefined.
|
|
4137
4389
|
*/ function readApiDetails(fn) {
|
|
4138
4390
|
return fn === null || fn === void 0 ? void 0 : fn._apiDetails;
|
|
4139
4391
|
}
|
|
@@ -4141,6 +4393,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4141
4393
|
* Aggregates _apiDetails from a specifier handler config object.
|
|
4142
4394
|
*
|
|
4143
4395
|
* Returns OnCallModelTypeApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
4396
|
+
*
|
|
4397
|
+
* @param config - Map of specifier keys to handler functions.
|
|
4398
|
+
* @returns Aggregated specifier-level API details, or undefined if no handlers have _apiDetails.
|
|
4144
4399
|
*/ function aggregateSpecifierApiDetails(config) {
|
|
4145
4400
|
var specifiers = {};
|
|
4146
4401
|
var hasAny = false;
|
|
@@ -4178,6 +4433,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4178
4433
|
* Aggregates _apiDetails from a model type map (used by onCallCreateModel, etc.).
|
|
4179
4434
|
*
|
|
4180
4435
|
* Returns OnCallCrudModelApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
4436
|
+
*
|
|
4437
|
+
* @param map - Map of model type strings to handler functions.
|
|
4438
|
+
* @returns Aggregated CRUD-model-level API details, or undefined if no handlers have _apiDetails.
|
|
4181
4439
|
*/ function aggregateCrudModelApiDetails(map) {
|
|
4182
4440
|
var modelTypes = {};
|
|
4183
4441
|
var hasAny = false;
|
|
@@ -4224,6 +4482,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4224
4482
|
* Aggregates _apiDetails from the top-level call model map.
|
|
4225
4483
|
*
|
|
4226
4484
|
* Returns OnCallModelApiDetails if any CRUD handlers have _apiDetails, otherwise undefined.
|
|
4485
|
+
*
|
|
4486
|
+
* @param map - Map of call type strings to CRUD handler functions.
|
|
4487
|
+
* @returns Aggregated model-level API details, or undefined if no handlers have _apiDetails.
|
|
4227
4488
|
*/ function aggregateModelApiDetails(map) {
|
|
4228
4489
|
var result = {};
|
|
4229
4490
|
var hasAny = false;
|
|
@@ -4290,7 +4551,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4290
4551
|
if (modelDetails == null) {
|
|
4291
4552
|
continue;
|
|
4292
4553
|
}
|
|
4293
|
-
if (!models
|
|
4554
|
+
if (!(modelType in models)) {
|
|
4294
4555
|
models[modelType] = {
|
|
4295
4556
|
calls: {}
|
|
4296
4557
|
};
|
|
@@ -4334,9 +4595,16 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4334
4595
|
/**
|
|
4335
4596
|
* Resolves leaf-level analytics details from the aggregated _apiDetails tree.
|
|
4336
4597
|
*
|
|
4337
|
-
* Walks: call
|
|
4598
|
+
* Walks: call -> modelType -> specifier (if specifier-level), then reads the `analytics`
|
|
4338
4599
|
* field from the handler-level {@link OnCallModelFunctionApiDetails}.
|
|
4339
|
-
|
|
4600
|
+
*
|
|
4601
|
+
* @param apiDetails - The top-level aggregated API details.
|
|
4602
|
+
* @param call - The CRUD operation type to look up.
|
|
4603
|
+
* @param modelType - The Firestore model type to look up.
|
|
4604
|
+
* @param specifier - Optional specifier key for variant handlers.
|
|
4605
|
+
* @returns The analytics details for the resolved handler, or undefined.
|
|
4606
|
+
*/ // eslint-disable-next-line @typescript-eslint/max-params
|
|
4607
|
+
function resolveAnalyticsFromApiDetails(apiDetails, call, modelType, specifier) {
|
|
4340
4608
|
var _apiDetails_call;
|
|
4341
4609
|
var modelDetails = (_apiDetails_call = apiDetails[call]) === null || _apiDetails_call === void 0 ? void 0 : _apiDetails_call.modelTypes[modelType];
|
|
4342
4610
|
if (modelDetails) {
|
|
@@ -4359,6 +4627,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4359
4627
|
* which the client can use to display a meaningful "not found" message. Intended to be
|
|
4360
4628
|
* passed to Firebase permission/existence checking utilities as the
|
|
4361
4629
|
* {@link FirebaseDoesNotExistErrorContextErrorFunction} callback.
|
|
4630
|
+
*
|
|
4631
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
4632
|
+
* @returns A model-not-available HTTP error.
|
|
4362
4633
|
*/ var nestFirebaseDoesNotExistError = function nestFirebaseDoesNotExistError(firebaseContextGrantedModelRoles) {
|
|
4363
4634
|
var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
|
|
4364
4635
|
return modelNotAvailableError({
|
|
@@ -4374,6 +4645,10 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4374
4645
|
* Returns a "forbidden" HTTP error including the document key, model type, and the roles
|
|
4375
4646
|
* that were required but not granted. Intended to be passed to Firebase permission checking
|
|
4376
4647
|
* utilities as the {@link FirebasePermissionErrorContextErrorFunction} callback.
|
|
4648
|
+
*
|
|
4649
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
4650
|
+
* @param roles - The roles that were required but not granted.
|
|
4651
|
+
* @returns A forbidden HTTP error.
|
|
4377
4652
|
*/ var nestFirebaseForbiddenPermissionError = function nestFirebaseForbiddenPermissionError(firebaseContextGrantedModelRoles, roles) {
|
|
4378
4653
|
var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
|
|
4379
4654
|
return forbiddenError({
|
|
@@ -4426,7 +4701,8 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4426
4701
|
*
|
|
4427
4702
|
* @param fn
|
|
4428
4703
|
* @param request
|
|
4429
|
-
*/
|
|
4704
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepts any nest context and input type for generic auth assertion
|
|
4705
|
+
function assertRequestRequiresAuthForFunction(fn, request) {
|
|
4430
4706
|
if (fn._requireAuth !== false) {
|
|
4431
4707
|
assertIsContextWithAuthData(request);
|
|
4432
4708
|
}
|
|
@@ -4476,13 +4752,15 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4476
4752
|
* fromUpload: updateProfileFromUpload
|
|
4477
4753
|
* });
|
|
4478
4754
|
* ```
|
|
4479
|
-
*/
|
|
4755
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4756
|
+
function onCallSpecifierHandler(config) {
|
|
4480
4757
|
var map = util.objectToMap(config);
|
|
4481
4758
|
var fn = function fn(request) {
|
|
4482
4759
|
var _request_specifier = request.specifier, specifier = _request_specifier === void 0 ? firebase.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT : _request_specifier;
|
|
4483
4760
|
var handler = map.get(specifier);
|
|
4484
4761
|
if (handler != null) {
|
|
4485
4762
|
assertRequestRequiresAuthForFunction(handler, request);
|
|
4763
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4486
4764
|
return handler(request);
|
|
4487
4765
|
} else {
|
|
4488
4766
|
throw unknownModelCrudFunctionSpecifierError(specifier);
|
|
@@ -4499,6 +4777,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4499
4777
|
/**
|
|
4500
4778
|
* Creates a bad-request error indicating the provided specifier is not recognized
|
|
4501
4779
|
* by the current model CRUD handler.
|
|
4780
|
+
*
|
|
4781
|
+
* @param specifier - The unrecognized specifier string.
|
|
4782
|
+
* @returns A bad-request error with UNKNOWN_SPECIFIER_ERROR code.
|
|
4502
4783
|
*/ function unknownModelCrudFunctionSpecifierError(specifier) {
|
|
4503
4784
|
return badRequestError(util.serverError({
|
|
4504
4785
|
status: 400,
|
|
@@ -4601,8 +4882,7 @@ function _object_spread_props$a(target, source) {
|
|
|
4601
4882
|
}
|
|
4602
4883
|
}
|
|
4603
4884
|
var fn = function fn(request) {
|
|
4604
|
-
var
|
|
4605
|
-
var call = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.call;
|
|
4885
|
+
var call = request.data.call;
|
|
4606
4886
|
if (!call) {
|
|
4607
4887
|
throw onCallModelMissingCallTypeError();
|
|
4608
4888
|
}
|
|
@@ -4610,18 +4890,21 @@ function _object_spread_props$a(target, source) {
|
|
|
4610
4890
|
if (!callFn) {
|
|
4611
4891
|
throw onCallModelUnknownCallTypeError(call);
|
|
4612
4892
|
}
|
|
4613
|
-
var
|
|
4893
|
+
var _request_data = request.data, specifier = _request_data.specifier, modelType = _request_data.modelType;
|
|
4894
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4614
4895
|
var auth = request.auth;
|
|
4896
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4615
4897
|
var context = {
|
|
4616
4898
|
call: call,
|
|
4617
4899
|
modelType: modelType,
|
|
4618
4900
|
specifier: specifier,
|
|
4619
4901
|
uid: auth === null || auth === void 0 ? void 0 : auth.uid,
|
|
4620
4902
|
auth: auth,
|
|
4621
|
-
data:
|
|
4903
|
+
data: request.data.data,
|
|
4622
4904
|
request: request
|
|
4623
4905
|
};
|
|
4624
4906
|
preAssert(context);
|
|
4907
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4625
4908
|
var result;
|
|
4626
4909
|
// Resolve analytics from _apiDetails tree — callWithAnalytics handles undefined details
|
|
4627
4910
|
var analyticsService = getAnalyticsService(request);
|
|
@@ -4647,6 +4930,8 @@ function _object_spread_props$a(target, source) {
|
|
|
4647
4930
|
}
|
|
4648
4931
|
/**
|
|
4649
4932
|
* Creates a bad-request error indicating the `call` field was missing from the request payload.
|
|
4933
|
+
*
|
|
4934
|
+
* @returns A bad-request error with CALL_TYPE_MISSING_ERROR code.
|
|
4650
4935
|
*/ function onCallModelMissingCallTypeError() {
|
|
4651
4936
|
return badRequestError(util.serverError({
|
|
4652
4937
|
status: 400,
|
|
@@ -4656,6 +4941,9 @@ function _object_spread_props$a(target, source) {
|
|
|
4656
4941
|
}
|
|
4657
4942
|
/**
|
|
4658
4943
|
* Creates a bad-request error indicating the provided `call` type is not recognized.
|
|
4944
|
+
*
|
|
4945
|
+
* @param call - The unrecognized call type string.
|
|
4946
|
+
* @returns A bad-request error with UNKNOWN_CALL_TYPE_ERROR code.
|
|
4659
4947
|
*/ function onCallModelUnknownCallTypeError(call) {
|
|
4660
4948
|
return badRequestError(util.serverError({
|
|
4661
4949
|
status: 400,
|
|
@@ -4672,14 +4960,16 @@ function _object_spread_props$a(target, source) {
|
|
|
4672
4960
|
* Dispatches to the correct model-type handler from the map, enforces auth requirements,
|
|
4673
4961
|
* runs pre-assertions, and aggregates API details from all handlers for MCP introspection.
|
|
4674
4962
|
*
|
|
4963
|
+
* @param map - Maps model type strings to their handler functions.
|
|
4964
|
+
* @param config - Configuration including call type, crud type, and error factory.
|
|
4965
|
+
* @returns A callable function that dispatches to the correct model-type handler.
|
|
4675
4966
|
* @internal Not intended for direct use outside the model CRUD module.
|
|
4676
4967
|
*/ function _onCallWithCallTypeFunction(map, config) {
|
|
4677
|
-
var callType = config.callType
|
|
4968
|
+
var callType = config.callType, _config_preAssert = config.preAssert, preAssert = _config_preAssert === void 0 ? function() {
|
|
4678
4969
|
return undefined;
|
|
4679
4970
|
} : _config_preAssert, throwOnUnknownModelType = config.throwOnUnknownModelType;
|
|
4680
4971
|
var fn = function fn(request) {
|
|
4681
|
-
var
|
|
4682
|
-
var modelType = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.modelType;
|
|
4972
|
+
var modelType = request.data.modelType;
|
|
4683
4973
|
var crudFn = map[modelType];
|
|
4684
4974
|
if (crudFn) {
|
|
4685
4975
|
var specifier = request.data.specifier;
|
|
@@ -4726,15 +5016,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4726
5016
|
*/ function onCallCreateModel(map) {
|
|
4727
5017
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4728
5018
|
var preAssert = config.preAssert;
|
|
5019
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4729
5020
|
return _onCallWithCallTypeFunction(map, {
|
|
4730
5021
|
callType: 'create',
|
|
4731
|
-
crudType: 'create',
|
|
4732
5022
|
preAssert: preAssert,
|
|
4733
5023
|
throwOnUnknownModelType: createModelUnknownModelTypeError
|
|
4734
5024
|
});
|
|
4735
5025
|
}
|
|
4736
5026
|
/**
|
|
4737
5027
|
* Creates a bad-request error indicating the requested model type is not valid for creation.
|
|
5028
|
+
*
|
|
5029
|
+
* @param modelType - The unrecognized model type string.
|
|
5030
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4738
5031
|
*/ function createModelUnknownModelTypeError(modelType) {
|
|
4739
5032
|
return badRequestError(util.serverError({
|
|
4740
5033
|
status: 400,
|
|
@@ -4766,15 +5059,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4766
5059
|
*/ function onCallReadModel(map) {
|
|
4767
5060
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4768
5061
|
var preAssert = config.preAssert;
|
|
5062
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4769
5063
|
return _onCallWithCallTypeFunction(map, {
|
|
4770
5064
|
callType: 'read',
|
|
4771
|
-
crudType: 'read',
|
|
4772
5065
|
preAssert: preAssert,
|
|
4773
5066
|
throwOnUnknownModelType: readModelUnknownModelTypeError
|
|
4774
5067
|
});
|
|
4775
5068
|
}
|
|
4776
5069
|
/**
|
|
4777
5070
|
* Creates a bad-request error indicating the requested model type is not valid for reading.
|
|
5071
|
+
*
|
|
5072
|
+
* @param modelType - The unrecognized model type string.
|
|
5073
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4778
5074
|
*/ function readModelUnknownModelTypeError(modelType) {
|
|
4779
5075
|
return badRequestError(util.serverError({
|
|
4780
5076
|
status: 400,
|
|
@@ -4809,15 +5105,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4809
5105
|
*/ function onCallUpdateModel(map) {
|
|
4810
5106
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4811
5107
|
var preAssert = config.preAssert;
|
|
5108
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4812
5109
|
return _onCallWithCallTypeFunction(map, {
|
|
4813
5110
|
callType: 'update',
|
|
4814
|
-
crudType: 'update',
|
|
4815
5111
|
preAssert: preAssert,
|
|
4816
5112
|
throwOnUnknownModelType: updateModelUnknownModelTypeError
|
|
4817
5113
|
});
|
|
4818
5114
|
}
|
|
4819
5115
|
/**
|
|
4820
5116
|
* Creates a bad-request error indicating the requested model type is not valid for updating.
|
|
5117
|
+
*
|
|
5118
|
+
* @param modelType - The unrecognized model type string.
|
|
5119
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4821
5120
|
*/ function updateModelUnknownModelTypeError(modelType) {
|
|
4822
5121
|
return badRequestError(util.serverError({
|
|
4823
5122
|
status: 400,
|
|
@@ -4849,15 +5148,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4849
5148
|
*/ function onCallDeleteModel(map) {
|
|
4850
5149
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4851
5150
|
var preAssert = config.preAssert;
|
|
5151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4852
5152
|
return _onCallWithCallTypeFunction(map, {
|
|
4853
5153
|
callType: 'delete',
|
|
4854
|
-
crudType: 'delete',
|
|
4855
5154
|
preAssert: preAssert,
|
|
4856
5155
|
throwOnUnknownModelType: deleteModelUnknownModelTypeError
|
|
4857
5156
|
});
|
|
4858
5157
|
}
|
|
4859
5158
|
/**
|
|
4860
5159
|
* Creates a bad-request error indicating the requested model type is not valid for deletion.
|
|
5160
|
+
*
|
|
5161
|
+
* @param modelType - The unrecognized model type string.
|
|
5162
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4861
5163
|
*/ function deleteModelUnknownModelTypeError(modelType) {
|
|
4862
5164
|
return badRequestError(util.serverError({
|
|
4863
5165
|
status: 400,
|
|
@@ -5171,6 +5473,7 @@ exports.FirebaseServerAnalyticsSegmentModule = __decorate([
|
|
|
5171
5473
|
* Creates a NestJS {@link FactoryProvider} that binds a Firebase Admin app getter to {@link FIREBASE_APP_TOKEN}.
|
|
5172
5474
|
*
|
|
5173
5475
|
* @param useFactory - Factory function returning the Firebase Admin app instance.
|
|
5476
|
+
* @returns A NestJS factory provider for the Firebase Admin app.
|
|
5174
5477
|
*
|
|
5175
5478
|
* @example
|
|
5176
5479
|
* ```typescript
|
|
@@ -5268,6 +5571,9 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5268
5571
|
* Returns two providers: the concrete service and an alias that maps
|
|
5269
5572
|
* `FirebaseServerAuthService` to the concrete token, enabling injection by the abstract type.
|
|
5270
5573
|
*
|
|
5574
|
+
* @param provider - The factory provider configuration for the auth service.
|
|
5575
|
+
* @returns A tuple containing the configured provider and an alias provider.
|
|
5576
|
+
*
|
|
5271
5577
|
* @example
|
|
5272
5578
|
* ```typescript
|
|
5273
5579
|
* const providers = provideFirebaseServerAuthService({
|
|
@@ -5293,6 +5599,9 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5293
5599
|
* Generates NestJS {@link ModuleMetadata} for an app's auth module, including the {@link FirebaseServerAuthModule}
|
|
5294
5600
|
* import and the custom {@link FirebaseServerAuthService} provider.
|
|
5295
5601
|
*
|
|
5602
|
+
* @param config - The module metadata configuration including the service provider.
|
|
5603
|
+
* @returns The merged NestJS module metadata.
|
|
5604
|
+
*
|
|
5296
5605
|
* @example
|
|
5297
5606
|
* ```typescript
|
|
5298
5607
|
* @Module(firebaseServerAuthModuleMetadata({
|
|
@@ -5316,15 +5625,21 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5316
5625
|
/**
|
|
5317
5626
|
* Asserts that the caller has admin privileges in the request.
|
|
5318
5627
|
*
|
|
5628
|
+
* @param request - The callable request to check for admin privileges.
|
|
5319
5629
|
* @throws {HttpsError} Throws forbidden (403) if the caller is not an admin.
|
|
5320
|
-
*/
|
|
5630
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5631
|
+
function assertIsAdminInRequest(request) {
|
|
5321
5632
|
if (!isAdminInRequest(request)) {
|
|
5322
5633
|
throw forbiddenError();
|
|
5323
5634
|
}
|
|
5324
5635
|
}
|
|
5325
5636
|
/**
|
|
5326
5637
|
* Checks whether the caller has admin privileges in the request.
|
|
5327
|
-
|
|
5638
|
+
*
|
|
5639
|
+
* @param request - The callable request to check for admin privileges.
|
|
5640
|
+
* @returns True if the caller has admin privileges.
|
|
5641
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5642
|
+
function isAdminInRequest(request) {
|
|
5328
5643
|
return request.nest.authService.context(request).isAdmin;
|
|
5329
5644
|
}
|
|
5330
5645
|
/**
|
|
@@ -5332,9 +5647,12 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5332
5647
|
*
|
|
5333
5648
|
* If the request data contains a `uid` that differs from the caller's auth UID, admin status is required.
|
|
5334
5649
|
*
|
|
5650
|
+
* @param request - The callable request containing the target UID.
|
|
5651
|
+
* @param requireUid - If true, a UID must be present in the request data.
|
|
5335
5652
|
* @returns The resolved target UID (from request data or auth).
|
|
5336
5653
|
* @throws {HttpsError} Throws forbidden (403) if the caller is not authorized.
|
|
5337
|
-
*/
|
|
5654
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5655
|
+
function assertIsAdminOrTargetUserInRequestData(request, requireUid) {
|
|
5338
5656
|
var _request_data_uid;
|
|
5339
5657
|
var _request_auth;
|
|
5340
5658
|
if (!isAdminOrTargetUserInRequestData(request, requireUid)) {
|
|
@@ -5345,8 +5663,11 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5345
5663
|
/**
|
|
5346
5664
|
* Checks whether the caller is an admin or is targeting their own user record in the request data.
|
|
5347
5665
|
*
|
|
5666
|
+
* @param request - The callable request containing the target UID.
|
|
5348
5667
|
* @param requireUid - If true, a UID must be present in the request data.
|
|
5349
|
-
|
|
5668
|
+
* @returns True if the caller is an admin or is targeting their own user record.
|
|
5669
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5670
|
+
function isAdminOrTargetUserInRequestData(request) {
|
|
5350
5671
|
var requireUid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
5351
5672
|
var _request_auth;
|
|
5352
5673
|
var uid = request.data.uid;
|
|
@@ -5360,8 +5681,10 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5360
5681
|
/**
|
|
5361
5682
|
* Asserts that the caller has signed the Terms of Service.
|
|
5362
5683
|
*
|
|
5684
|
+
* @param request - The callable request to check for ToS status.
|
|
5363
5685
|
* @throws {HttpsError} Throws forbidden (403) if ToS has not been signed.
|
|
5364
|
-
*/
|
|
5686
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5687
|
+
function assertHasSignedTosInRequest(request) {
|
|
5365
5688
|
if (!hasSignedTosInRequest(request)) {
|
|
5366
5689
|
throw forbiddenError({
|
|
5367
5690
|
message: 'ToS has not been signed.'
|
|
@@ -5370,15 +5693,21 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5370
5693
|
}
|
|
5371
5694
|
/**
|
|
5372
5695
|
* Checks whether the caller has signed the Terms of Service.
|
|
5373
|
-
|
|
5696
|
+
*
|
|
5697
|
+
* @param request - The callable request to check for ToS status.
|
|
5698
|
+
* @returns True if the caller has signed the Terms of Service.
|
|
5699
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5700
|
+
function hasSignedTosInRequest(request) {
|
|
5374
5701
|
return request.nest.authService.context(request).hasSignedTos;
|
|
5375
5702
|
}
|
|
5376
5703
|
/**
|
|
5377
5704
|
* Asserts that the caller has all of the specified auth roles.
|
|
5378
5705
|
*
|
|
5706
|
+
* @param request - The callable request to check for auth roles.
|
|
5379
5707
|
* @param authRoles - One or more roles that must all be present.
|
|
5380
5708
|
* @throws {HttpsError} Throws forbidden (403) if any required role is missing.
|
|
5381
|
-
*/
|
|
5709
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5710
|
+
function assertHasRolesInRequest(request, authRoles) {
|
|
5382
5711
|
if (!hasAuthRolesInRequest(request, authRoles)) {
|
|
5383
5712
|
throw forbiddenError({
|
|
5384
5713
|
message: 'Missing required auth roles.',
|
|
@@ -5390,7 +5719,12 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5390
5719
|
}
|
|
5391
5720
|
/**
|
|
5392
5721
|
* Checks whether the caller has all of the specified auth roles.
|
|
5393
|
-
|
|
5722
|
+
*
|
|
5723
|
+
* @param request - The callable request to check for auth roles.
|
|
5724
|
+
* @param authRoles - One or more roles that must all be present.
|
|
5725
|
+
* @returns True if the caller has all of the specified auth roles.
|
|
5726
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5727
|
+
function hasAuthRolesInRequest(request, authRoles) {
|
|
5394
5728
|
return util.containsAllValues(request.nest.authService.context(request).authRoles, authRoles);
|
|
5395
5729
|
}
|
|
5396
5730
|
/**
|
|
@@ -5398,8 +5732,10 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5398
5732
|
*
|
|
5399
5733
|
* This may be used to filter out new users that were not invited from finishing their onboarding.
|
|
5400
5734
|
*
|
|
5401
|
-
* @param request
|
|
5402
|
-
|
|
5735
|
+
* @param request - The callable request to check for setup password claims.
|
|
5736
|
+
* @returns True if the claims contain a setup password key.
|
|
5737
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5738
|
+
function hasNewUserSetupPasswordInRequest(request) {
|
|
5403
5739
|
var claims = request.nest.authService.context(request).claims;
|
|
5404
5740
|
return claims[firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY] != null;
|
|
5405
5741
|
}
|
|
@@ -5492,6 +5828,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5492
5828
|
}
|
|
5493
5829
|
/**
|
|
5494
5830
|
* Creates a bad-request error indicating the provided development function specifier is not recognized.
|
|
5831
|
+
*
|
|
5832
|
+
* @param specifier - the unrecognized specifier string from the client request.
|
|
5833
|
+
* @returns A bad-request error with the unknown specifier details.
|
|
5495
5834
|
*/ function developmentUnknownSpecifierError(specifier) {
|
|
5496
5835
|
return badRequestError(util.serverError({
|
|
5497
5836
|
status: 400,
|
|
@@ -5509,6 +5848,8 @@ function _object_spread_props$7(target, source) {
|
|
|
5509
5848
|
/**
|
|
5510
5849
|
* Creates a bad-request error for when the caller sends a 'run' command
|
|
5511
5850
|
* without specifying which scheduled function to execute.
|
|
5851
|
+
*
|
|
5852
|
+
* @returns A bad-request error indicating the missing run name.
|
|
5512
5853
|
*/ function noRunNameSpecifiedForScheduledFunctionDevelopmentFunction() {
|
|
5513
5854
|
return badRequestError({
|
|
5514
5855
|
code: NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE,
|
|
@@ -5521,6 +5862,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5521
5862
|
/**
|
|
5522
5863
|
* Creates a bad-request error for when the requested scheduled function name
|
|
5523
5864
|
* is not found in the registered function map.
|
|
5865
|
+
*
|
|
5866
|
+
* @param name - the unrecognized function name from the client request.
|
|
5867
|
+
* @returns A bad-request error with the unknown function name details.
|
|
5524
5868
|
*/ function unknownScheduledFunctionDevelopmentFunctionName(name) {
|
|
5525
5869
|
return badRequestError({
|
|
5526
5870
|
code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE,
|
|
@@ -5536,6 +5880,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5536
5880
|
/**
|
|
5537
5881
|
* Creates a bad-request error for when the request `type` field does not match
|
|
5538
5882
|
* any supported operation ('run' or 'list').
|
|
5883
|
+
*
|
|
5884
|
+
* @param type - the unrecognized type value from the client request.
|
|
5885
|
+
* @returns A bad-request error with the unknown type details.
|
|
5539
5886
|
*/ function unknownScheduledFunctionDevelopmentFunctionType(type) {
|
|
5540
5887
|
return badRequestError({
|
|
5541
5888
|
code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE,
|
|
@@ -5750,7 +6097,7 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5750
6097
|
var result = [];
|
|
5751
6098
|
util.forEachKeyValue(allScheduledFunctions, {
|
|
5752
6099
|
forEach: function forEach(x) {
|
|
5753
|
-
var _x = _sliced_to_array(x,
|
|
6100
|
+
var _x = _sliced_to_array(x, 1), functionName = _x[0];
|
|
5754
6101
|
result.push({
|
|
5755
6102
|
name: functionName.toString()
|
|
5756
6103
|
});
|
|
@@ -5767,12 +6114,12 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5767
6114
|
data = request.data;
|
|
5768
6115
|
type = data.type;
|
|
5769
6116
|
switch(type){
|
|
5770
|
-
case
|
|
6117
|
+
case firebase.ScheduledFunctionDevelopmentFunctionTypeEnum.RUN:
|
|
5771
6118
|
return [
|
|
5772
6119
|
3,
|
|
5773
6120
|
1
|
|
5774
6121
|
];
|
|
5775
|
-
case
|
|
6122
|
+
case firebase.ScheduledFunctionDevelopmentFunctionTypeEnum.LIST:
|
|
5776
6123
|
return [
|
|
5777
6124
|
3,
|
|
5778
6125
|
6
|
|
@@ -5830,8 +6177,6 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5830
6177
|
}
|
|
5831
6178
|
];
|
|
5832
6179
|
case 7:
|
|
5833
|
-
throw unknownScheduledFunctionDevelopmentFunctionType(type);
|
|
5834
|
-
case 8:
|
|
5835
6180
|
return [
|
|
5836
6181
|
2
|
|
5837
6182
|
];
|
|
@@ -6019,8 +6364,10 @@ function _ts_generator$6(thisArg, body) {
|
|
|
6019
6364
|
*
|
|
6020
6365
|
* export const { dev } = devFunctions;
|
|
6021
6366
|
* ```
|
|
6022
|
-
*/
|
|
6367
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic type parameters require `any` for Firebase SDK compatibility
|
|
6368
|
+
function firebaseServerDevFunctions(config) {
|
|
6023
6369
|
var enabled = config.enabled, secure = config.secure, nest = config.nest, developerFunctionsMap = config.developerFunctionsMap, onCallFactory = config.onCallFactory, allScheduledFunctions = config.allScheduledFunctions, disableDevelopmentScheduleFunction = config.disableDevelopmentScheduleFunction;
|
|
6370
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- RunnableHttpFunction supports legacy gen 1 deployments
|
|
6024
6371
|
var dev;
|
|
6025
6372
|
if (enabled) {
|
|
6026
6373
|
var fullFunctionsMap = _object_spread$8({}, developerFunctionsMap);
|
|
@@ -6035,7 +6382,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
6035
6382
|
}
|
|
6036
6383
|
dev = onCallFactory(onCallFunction)(nest);
|
|
6037
6384
|
} else {
|
|
6038
|
-
dev = onCallFactory(function(
|
|
6385
|
+
dev = onCallFactory(function() {
|
|
6039
6386
|
return _async_to_generator$6(function() {
|
|
6040
6387
|
return _ts_generator$6(this, function(_state) {
|
|
6041
6388
|
throw unavailableError({
|
|
@@ -6155,6 +6502,8 @@ function _is_native_reflect_construct$1() {
|
|
|
6155
6502
|
key: "developmentSchedulerEnabled",
|
|
6156
6503
|
get: /**
|
|
6157
6504
|
* Enabled when not in production and not in a testing environment.
|
|
6505
|
+
*
|
|
6506
|
+
* @returns True if the development scheduler should be enabled.
|
|
6158
6507
|
*/ function get() {
|
|
6159
6508
|
return !this.isProduction && !this.isTestingEnv;
|
|
6160
6509
|
}
|
|
@@ -6177,6 +6526,9 @@ exports.DefaultFirebaseServerEnvService = __decorate([
|
|
|
6177
6526
|
*
|
|
6178
6527
|
* Useful for conditionally enabling production-only Cloud Functions (e.g., scheduled tasks).
|
|
6179
6528
|
*
|
|
6529
|
+
* @param nest - getter for the NestJS application context promise.
|
|
6530
|
+
* @returns An async decision function that resolves to `true` in production.
|
|
6531
|
+
*
|
|
6180
6532
|
* @example
|
|
6181
6533
|
* ```typescript
|
|
6182
6534
|
* const isProduction = nestAppIsProductionEnvironment(nestAppGetter);
|
|
@@ -6193,6 +6545,9 @@ exports.DefaultFirebaseServerEnvService = __decorate([
|
|
|
6193
6545
|
* Creates an async decision function that resolves to `true` if the development scheduler is enabled.
|
|
6194
6546
|
*
|
|
6195
6547
|
* The development scheduler is enabled in non-production, non-testing environments.
|
|
6548
|
+
*
|
|
6549
|
+
* @param nest - getter for the NestJS application context promise.
|
|
6550
|
+
* @returns An async decision function that resolves to `true` when the development scheduler is enabled.
|
|
6196
6551
|
*/ function nestAppHasDevelopmentSchedulerEnabled(nest) {
|
|
6197
6552
|
return function() {
|
|
6198
6553
|
return nest().then(function(x) {
|
|
@@ -6289,6 +6644,11 @@ exports.FirebaseServerFirestoreContextModule = __decorate([
|
|
|
6289
6644
|
/**
|
|
6290
6645
|
* Creates a NestJS provider that initializes a Firestore collections instance from the app's {@link FirestoreContext}.
|
|
6291
6646
|
*
|
|
6647
|
+
* @param config - The provide token and factory function configuration.
|
|
6648
|
+
* @param config.provide - The class token to provide.
|
|
6649
|
+
* @param config.useFactory - Factory that creates the collections from a FirestoreContext.
|
|
6650
|
+
* @returns A tuple containing the configured NestJS provider.
|
|
6651
|
+
*
|
|
6292
6652
|
* @example
|
|
6293
6653
|
* ```typescript
|
|
6294
6654
|
* const [provider] = provideAppFirestoreCollections({
|
|
@@ -6312,6 +6672,9 @@ exports.FirebaseServerFirestoreContextModule = __decorate([
|
|
|
6312
6672
|
* Generates NestJS {@link ModuleMetadata} for an app's Firestore module, including the
|
|
6313
6673
|
* {@link FirebaseServerFirestoreContextModule} import and the app's collections provider.
|
|
6314
6674
|
*
|
|
6675
|
+
* @param config - The Firestore collections config plus optional additional module metadata.
|
|
6676
|
+
* @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
|
|
6677
|
+
*
|
|
6315
6678
|
* @example
|
|
6316
6679
|
* ```typescript
|
|
6317
6680
|
* @Module(appFirestoreModuleMetadata({
|
|
@@ -6621,6 +6984,7 @@ function _object_spread_props$4(target, source) {
|
|
|
6621
6984
|
* @param makeNestContext - Factory that creates the typed context from the NestJS application context.
|
|
6622
6985
|
* @returns A factory for creating nest-context-aware event function handlers.
|
|
6623
6986
|
*/ function cloudEventHandlerWithNestContextFactory(makeNestContext) {
|
|
6987
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- CloudEvent generic requires `any` for SDK compatibility
|
|
6624
6988
|
return function(fn) {
|
|
6625
6989
|
return function(nestAppPromiseGetter) {
|
|
6626
6990
|
var handlerBuilder = function handlerBuilder(handler) {
|
|
@@ -6985,6 +7349,8 @@ function _ts_generator$5(thisArg, body) {
|
|
|
6985
7349
|
/**
|
|
6986
7350
|
* Default error logger that writes validation error details to the console.
|
|
6987
7351
|
* Used when `logError` is `true` or omitted in the factory options.
|
|
7352
|
+
*
|
|
7353
|
+
* @param details - the validation error details to log.
|
|
6988
7354
|
*/ var defaultFirebaseServerActionsTransformFactoryLogErrorFunction = function defaultFirebaseServerActionsTransformFactoryLogErrorFunction(details) {
|
|
6989
7355
|
console.log('firebaseServerActionsTransformFactory() encountered validation error: ', details);
|
|
6990
7356
|
};
|
|
@@ -7610,7 +7976,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
7610
7976
|
builder = (_builder1 = builder).exclude.apply(_builder1, _to_consumable_array$2(excludePatterns));
|
|
7611
7977
|
}
|
|
7612
7978
|
(_builder = builder).forRoutes.apply(_builder, _to_consumable_array$2(forRoutes));
|
|
7613
|
-
|
|
7979
|
+
var excludeInfo = excludePatterns.length > 0 ? " (excluding: ".concat(excludePatterns.join(', '), ")") : '';
|
|
7980
|
+
this.logger.debug("Configured AppCheck middleware for routes: ".concat(forRoutes.join(', ')).concat(excludeInfo));
|
|
7614
7981
|
}
|
|
7615
7982
|
}
|
|
7616
7983
|
]);
|
|
@@ -8048,16 +8415,28 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8048
8415
|
}
|
|
8049
8416
|
/**
|
|
8050
8417
|
* Resolves a Google Cloud Storage {@link Bucket} from a {@link StoragePath}.
|
|
8418
|
+
*
|
|
8419
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8420
|
+
* @param path - the storage path containing the bucket ID.
|
|
8421
|
+
* @returns The resolved Google Cloud Storage bucket.
|
|
8051
8422
|
*/ function googleCloudStorageBucketForStorageFilePath(storage, path) {
|
|
8052
8423
|
return storage.bucket(path.bucketId);
|
|
8053
8424
|
}
|
|
8054
8425
|
/**
|
|
8055
8426
|
* Resolves a Google Cloud Storage {@link GoogleCloudFile} from a {@link StoragePath}.
|
|
8427
|
+
*
|
|
8428
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8429
|
+
* @param path - the storage path containing bucket ID and file path.
|
|
8430
|
+
* @returns The resolved Google Cloud Storage file reference.
|
|
8056
8431
|
*/ function googleCloudStorageFileForStorageFilePath(storage, path) {
|
|
8057
8432
|
return googleCloudStorageBucketForStorageFilePath(storage, path).file(path.pathString);
|
|
8058
8433
|
}
|
|
8059
8434
|
/**
|
|
8060
8435
|
* Converts Google Cloud Storage {@link FileMetadata} into the normalized {@link StorageMetadata} format.
|
|
8436
|
+
*
|
|
8437
|
+
* @param file - the Google Cloud Storage file reference.
|
|
8438
|
+
* @param metadata - the raw file metadata from the Google Cloud SDK.
|
|
8439
|
+
* @returns Normalized storage metadata.
|
|
8061
8440
|
*/ function googleCloudFileMetadataToStorageMetadata(file, metadata) {
|
|
8062
8441
|
var _metadata_generation;
|
|
8063
8442
|
var fullPath = file.name;
|
|
@@ -8088,6 +8467,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8088
8467
|
* and ACL operations for a single file in Google Cloud Storage.
|
|
8089
8468
|
*
|
|
8090
8469
|
* Handles emulator-specific edge cases (e.g., signing errors, atomic move fallback).
|
|
8470
|
+
*
|
|
8471
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8472
|
+
* @param storagePath - the storage path identifying the file's bucket and path.
|
|
8473
|
+
* @returns A file accessor with CRUD, streaming, and ACL operations.
|
|
8091
8474
|
*/ function googleCloudStorageAccessorFile(storage$1, storagePath) {
|
|
8092
8475
|
var file = googleCloudStorageFileForStorageFilePath(storage$1, storagePath);
|
|
8093
8476
|
function makeDownloadOptions(maxDownloadSizeBytes) {
|
|
@@ -8098,7 +8481,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8098
8481
|
}
|
|
8099
8482
|
function _configureMetadata(options) {
|
|
8100
8483
|
var _options_metadata, _options_metadata1, _options_metadata2, _options_metadata3, _options_metadata4, _options_metadata5;
|
|
8101
|
-
var customMetadata = util.filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options
|
|
8484
|
+
var customMetadata = util.filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options.customMetadata));
|
|
8102
8485
|
return util.filterUndefinedValues({
|
|
8103
8486
|
cacheControl: (_options_metadata1 = options.metadata) === null || _options_metadata1 === void 0 ? void 0 : _options_metadata1.cacheControl,
|
|
8104
8487
|
contentDisposition: (_options_metadata2 = options.metadata) === null || _options_metadata2 === void 0 ? void 0 : _options_metadata2.contentDisposition,
|
|
@@ -8215,7 +8598,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8215
8598
|
return x[0];
|
|
8216
8599
|
}).catch(function(e) {
|
|
8217
8600
|
var publicUrlBackup;
|
|
8218
|
-
if (e && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
|
|
8601
|
+
if (_instanceof(e, Error) && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
|
|
8219
8602
|
// NOTE: Signing does not behave properly in the emulator as it is not supported.
|
|
8220
8603
|
// https://github.com/firebase/firebase-tools/issues/3400
|
|
8221
8604
|
// we can return the public url instead.
|
|
@@ -8358,7 +8741,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8358
8741
|
},
|
|
8359
8742
|
copy: copy,
|
|
8360
8743
|
delete: function _delete(options) {
|
|
8361
|
-
return file.delete(options).then(function(
|
|
8744
|
+
return file.delete(options).then(function() {
|
|
8362
8745
|
return undefined;
|
|
8363
8746
|
});
|
|
8364
8747
|
},
|
|
@@ -8392,7 +8775,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8392
8775
|
}
|
|
8393
8776
|
var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFactory({
|
|
8394
8777
|
hasItems: function hasItems(result) {
|
|
8395
|
-
|
|
8778
|
+
var _result_apiResponse_items;
|
|
8779
|
+
return Boolean((_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : result.apiResponse.prefixes);
|
|
8396
8780
|
},
|
|
8397
8781
|
hasNext: function hasNext(result) {
|
|
8398
8782
|
return result.nextQuery != null;
|
|
@@ -8401,7 +8785,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8401
8785
|
var _result_nextQuery;
|
|
8402
8786
|
return (_result_nextQuery = result.nextQuery) === null || _result_nextQuery === void 0 ? void 0 : _result_nextQuery.pageToken;
|
|
8403
8787
|
},
|
|
8404
|
-
next: function next(
|
|
8788
|
+
next: function next(param, result) {
|
|
8789
|
+
var options = param.options, folder = param.folder;
|
|
8405
8790
|
return folder.list(_object_spread$1({}, options, result.nextQuery));
|
|
8406
8791
|
},
|
|
8407
8792
|
file: function file(storage, fileResult) {
|
|
@@ -8411,9 +8796,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8411
8796
|
return googleCloudStorageAccessorFolder(storage, folderResult.storagePath);
|
|
8412
8797
|
},
|
|
8413
8798
|
filesFromResult: function filesFromResult(result) {
|
|
8414
|
-
var
|
|
8415
|
-
var
|
|
8416
|
-
var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.items) !== null && _ref !== void 0 ? _ref : [];
|
|
8799
|
+
var _result_apiResponse_items;
|
|
8800
|
+
var items = (_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : [];
|
|
8417
8801
|
return items.map(function(x) {
|
|
8418
8802
|
return {
|
|
8419
8803
|
raw: x,
|
|
@@ -8426,9 +8810,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8426
8810
|
});
|
|
8427
8811
|
},
|
|
8428
8812
|
foldersFromResult: function foldersFromResult(result, folder) {
|
|
8429
|
-
var
|
|
8430
|
-
var
|
|
8431
|
-
var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.prefixes) !== null && _ref !== void 0 ? _ref : [];
|
|
8813
|
+
var _result_apiResponse_prefixes;
|
|
8814
|
+
var items = (_result_apiResponse_prefixes = result.apiResponse.prefixes) !== null && _result_apiResponse_prefixes !== void 0 ? _result_apiResponse_prefixes : [];
|
|
8432
8815
|
return items.map(function(prefix) {
|
|
8433
8816
|
return {
|
|
8434
8817
|
raw: prefix,
|
|
@@ -8444,6 +8827,10 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8444
8827
|
/**
|
|
8445
8828
|
* Creates a {@link GoogleCloudStorageAccessorFolder} that supports checking folder existence
|
|
8446
8829
|
* and listing files/subfolders with pagination.
|
|
8830
|
+
*
|
|
8831
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8832
|
+
* @param storagePath - the storage path identifying the folder's bucket and prefix.
|
|
8833
|
+
* @returns A folder accessor with existence checking and listing operations.
|
|
8447
8834
|
*/ function googleCloudStorageAccessorFolder(storage, storagePath) {
|
|
8448
8835
|
var bucket = googleCloudStorageBucketForStorageFilePath(storage, storagePath);
|
|
8449
8836
|
var file = bucket.file(storagePath.pathString);
|
|
@@ -8487,7 +8874,11 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8487
8874
|
nextQuery: nextQuery,
|
|
8488
8875
|
apiResponse: apiResponse
|
|
8489
8876
|
};
|
|
8490
|
-
return googleCloudStorageListFilesResultFactory(
|
|
8877
|
+
return googleCloudStorageListFilesResultFactory({
|
|
8878
|
+
storage: storage,
|
|
8879
|
+
folder: folder,
|
|
8880
|
+
options: options
|
|
8881
|
+
}, result);
|
|
8491
8882
|
});
|
|
8492
8883
|
}
|
|
8493
8884
|
};
|
|
@@ -8496,6 +8887,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8496
8887
|
/**
|
|
8497
8888
|
* Creates a {@link FirebaseStorageAccessorDriver} for Google Cloud Storage (Admin SDK).
|
|
8498
8889
|
*
|
|
8890
|
+
* @returns A server-side storage accessor driver for Google Cloud Storage.
|
|
8891
|
+
*
|
|
8499
8892
|
* @example
|
|
8500
8893
|
* ```typescript
|
|
8501
8894
|
* const driver = googleCloudStorageFirebaseStorageAccessorDriver();
|
|
@@ -8517,6 +8910,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8517
8910
|
*
|
|
8518
8911
|
* Bundles the server-side storage accessor driver, identified as `@google-cloud/storage`.
|
|
8519
8912
|
*
|
|
8913
|
+
* @returns A complete set of storage drivers for server-side usage.
|
|
8914
|
+
*
|
|
8520
8915
|
* @example
|
|
8521
8916
|
* ```typescript
|
|
8522
8917
|
* const drivers = googleCloudFirebaseStorageDrivers();
|
|
@@ -8618,6 +9013,7 @@ function _define_property$3(obj, key, value) {
|
|
|
8618
9013
|
* Storage wrapper and the raw Google Cloud Storage SDK.
|
|
8619
9014
|
*
|
|
8620
9015
|
* @param storage - The Firebase Admin Storage instance.
|
|
9016
|
+
* @returns The underlying Google Cloud Storage client.
|
|
8621
9017
|
*
|
|
8622
9018
|
* @example
|
|
8623
9019
|
* ```typescript
|
|
@@ -8768,6 +9164,7 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8768
9164
|
* Creates a NestJS provider that configures the default storage bucket ID.
|
|
8769
9165
|
*
|
|
8770
9166
|
* @param input - A bucket ID string or full factory config object.
|
|
9167
|
+
* @returns A NestJS provider for the storage context factory config token.
|
|
8771
9168
|
* @throws Error if `defaultBucketId` is empty.
|
|
8772
9169
|
*
|
|
8773
9170
|
* @example
|
|
@@ -8788,6 +9185,8 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8788
9185
|
}
|
|
8789
9186
|
/**
|
|
8790
9187
|
* Returns the default provider config that creates a standard {@link FirebaseServerStorageService}.
|
|
9188
|
+
*
|
|
9189
|
+
* @returns The default provider configuration for FirebaseServerStorageService.
|
|
8791
9190
|
*/ function defaultProvideFirebaseServerStorageServiceSimple() {
|
|
8792
9191
|
return {
|
|
8793
9192
|
provide: FirebaseServerStorageService,
|
|
@@ -8801,6 +9200,9 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8801
9200
|
*
|
|
8802
9201
|
* If the provider token differs from `FirebaseServerStorageService`, an alias provider is added
|
|
8803
9202
|
* so the service can also be injected by the abstract type.
|
|
9203
|
+
*
|
|
9204
|
+
* @param provider - The storage service provider configuration.
|
|
9205
|
+
* @returns An array of NestJS providers for the storage service.
|
|
8804
9206
|
*/ function provideFirebaseServerStorageService(provider) {
|
|
8805
9207
|
var _provider_inject;
|
|
8806
9208
|
var providers = [
|
|
@@ -8822,13 +9224,17 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8822
9224
|
* Generates NestJS {@link ModuleMetadata} for an app's storage module, including the
|
|
8823
9225
|
* {@link FirebaseServerStorageContextModule} import and the storage service provider.
|
|
8824
9226
|
*
|
|
9227
|
+
* @param config - Optional configuration including a custom service provider and additional module metadata.
|
|
9228
|
+
* @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
|
|
9229
|
+
*
|
|
8825
9230
|
* @example
|
|
8826
9231
|
* ```typescript
|
|
8827
9232
|
* @Module(firebaseServerStorageModuleMetadata())
|
|
8828
9233
|
* export class AppStorageModule {}
|
|
8829
9234
|
* ```
|
|
8830
9235
|
*/ function firebaseServerStorageModuleMetadata(config) {
|
|
8831
|
-
var
|
|
9236
|
+
var _ref;
|
|
9237
|
+
var serviceProvider = (_ref = config === null || config === void 0 ? void 0 : config.serviceProvider) !== null && _ref !== void 0 ? _ref : defaultProvideFirebaseServerStorageServiceSimple();
|
|
8832
9238
|
var providers = provideFirebaseServerStorageService(serviceProvider);
|
|
8833
9239
|
var tokensToExport = nestjs.injectionTokensFromProviders(providers);
|
|
8834
9240
|
return nestjs.mergeModuleMetadata({
|
|
@@ -9086,6 +9492,9 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9086
9492
|
* times with the same app reuses the existing server. The factory wires up Firebase Admin,
|
|
9087
9493
|
* environment config, storage, AppCheck middleware, and webhook routes based on the config.
|
|
9088
9494
|
*
|
|
9495
|
+
* @param config - Configuration for the NestJS server instance including the root module, providers, and middleware options.
|
|
9496
|
+
* @returns A NestServerInstance that manages server lifecycle for the given module class.
|
|
9497
|
+
*
|
|
9089
9498
|
* @example
|
|
9090
9499
|
* ```typescript
|
|
9091
9500
|
* const instance = nestServerInstance({ moduleClass: AppModule, appCheckEnabled: true });
|
|
@@ -9101,7 +9510,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9101
9510
|
var server = express();
|
|
9102
9511
|
var createNestServer = function createNestServer(expressInstance) {
|
|
9103
9512
|
return _async_to_generator$1(function() {
|
|
9104
|
-
var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp;
|
|
9513
|
+
var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp, configured;
|
|
9105
9514
|
return _ts_generator$1(this, function(_state) {
|
|
9106
9515
|
switch(_state.label){
|
|
9107
9516
|
case 0:
|
|
@@ -9131,7 +9540,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9131
9540
|
nestApp = nestApp.setGlobalPrefix(globalApiRoutePrefixConfig.globalApiRoutePrefix, globalApiRoutePrefixConfig);
|
|
9132
9541
|
}
|
|
9133
9542
|
if (configureNestServerInstance) {
|
|
9134
|
-
|
|
9543
|
+
configured = configureNestServerInstance(nestApp);
|
|
9544
|
+
if (configured) {
|
|
9545
|
+
nestApp = configured;
|
|
9546
|
+
}
|
|
9135
9547
|
}
|
|
9136
9548
|
return [
|
|
9137
9549
|
2,
|
|
@@ -9399,16 +9811,31 @@ function _ts_generator(thisArg, body) {
|
|
|
9399
9811
|
/**
|
|
9400
9812
|
* Abstract class that wraps an INestApplicationContext value.
|
|
9401
9813
|
*/ var AbstractNestContext = /*#__PURE__*/ function() {
|
|
9402
|
-
function AbstractNestContext(
|
|
9814
|
+
function AbstractNestContext(nestApplication) {
|
|
9403
9815
|
_class_call_check$1(this, AbstractNestContext);
|
|
9404
|
-
_define_property$1(this, "
|
|
9405
|
-
this.
|
|
9816
|
+
_define_property$1(this, "_nestApplication", void 0);
|
|
9817
|
+
this._nestApplication = nestApplication;
|
|
9406
9818
|
}
|
|
9407
9819
|
_create_class$1(AbstractNestContext, [
|
|
9408
9820
|
{
|
|
9409
9821
|
key: "nest",
|
|
9410
|
-
get:
|
|
9411
|
-
|
|
9822
|
+
get: /**
|
|
9823
|
+
* Returns the NestJS application context.
|
|
9824
|
+
*
|
|
9825
|
+
* @deprecated use nestApplication instead.
|
|
9826
|
+
* @returns The NestJS application context.
|
|
9827
|
+
*/ function get() {
|
|
9828
|
+
return this._nestApplication;
|
|
9829
|
+
}
|
|
9830
|
+
},
|
|
9831
|
+
{
|
|
9832
|
+
key: "nestApplication",
|
|
9833
|
+
get: /**
|
|
9834
|
+
* Returns the NestJS application context.
|
|
9835
|
+
*
|
|
9836
|
+
* @returns The NestJS application context.
|
|
9837
|
+
*/ function get() {
|
|
9838
|
+
return this._nestApplication;
|
|
9412
9839
|
}
|
|
9413
9840
|
}
|
|
9414
9841
|
]);
|
|
@@ -9418,7 +9845,8 @@ function _ts_generator(thisArg, body) {
|
|
|
9418
9845
|
* Abstract class used for the top-level NestJS context for Firebase services.
|
|
9419
9846
|
*
|
|
9420
9847
|
* Your API implementation of this class is usually <AppPrefix>ApiNestContext (e.g. `DemoApiNestContext`).
|
|
9421
|
-
*/
|
|
9848
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirebaseModelsService generic requires `any` for SDK compatibility
|
|
9849
|
+
var AbstractFirebaseNestContext = /*#__PURE__*/ function(AbstractNestContext) {
|
|
9422
9850
|
_inherits(AbstractFirebaseNestContext, AbstractNestContext);
|
|
9423
9851
|
function AbstractFirebaseNestContext() {
|
|
9424
9852
|
_class_call_check$1(this, AbstractFirebaseNestContext);
|
|
@@ -9441,13 +9869,13 @@ function _ts_generator(thisArg, body) {
|
|
|
9441
9869
|
{
|
|
9442
9870
|
key: "envService",
|
|
9443
9871
|
get: function get() {
|
|
9444
|
-
return this.
|
|
9872
|
+
return this.nestApplication.get(FirebaseServerEnvService);
|
|
9445
9873
|
}
|
|
9446
9874
|
},
|
|
9447
9875
|
{
|
|
9448
9876
|
key: "storageService",
|
|
9449
9877
|
get: function get() {
|
|
9450
|
-
return this.
|
|
9878
|
+
return this.nestApplication.get(FirebaseServerStorageService);
|
|
9451
9879
|
}
|
|
9452
9880
|
},
|
|
9453
9881
|
{
|
|
@@ -9458,6 +9886,7 @@ function _ts_generator(thisArg, body) {
|
|
|
9458
9886
|
*
|
|
9459
9887
|
* @param auth - The request's auth data reference.
|
|
9460
9888
|
* @param buildFn - Optional builder to customize the context.
|
|
9889
|
+
* @returns A model context with auth, app, and error factories.
|
|
9461
9890
|
*/ key: "makeModelContext",
|
|
9462
9891
|
value: function makeModelContext(auth, buildFn) {
|
|
9463
9892
|
var base = {
|
|
@@ -9479,6 +9908,7 @@ function _ts_generator(thisArg, body) {
|
|
|
9479
9908
|
*
|
|
9480
9909
|
* @param context - The request's auth data reference.
|
|
9481
9910
|
* @param buildFn - Optional builder to customize the model context.
|
|
9911
|
+
* @returns An in-context models service scoped to the given auth context.
|
|
9482
9912
|
*/ key: "model",
|
|
9483
9913
|
value: function model(context, buildFn) {
|
|
9484
9914
|
var firebaseModelContext = this.makeModelContext(context, buildFn);
|
|
@@ -9487,7 +9917,8 @@ function _ts_generator(thisArg, body) {
|
|
|
9487
9917
|
},
|
|
9488
9918
|
{
|
|
9489
9919
|
key: "useModel",
|
|
9490
|
-
value:
|
|
9920
|
+
value: // eslint-disable-next-line @typescript-eslint/no-explicit-any -- implementation signature uses `any` to unify overload return types
|
|
9921
|
+
function useModel(type, select) {
|
|
9491
9922
|
return _async_to_generator(function() {
|
|
9492
9923
|
var _select_use, context, usePromise, use;
|
|
9493
9924
|
return _ts_generator(this, function(_state) {
|
|
@@ -9549,7 +9980,8 @@ function _define_property(obj, key, value) {
|
|
|
9549
9980
|
* Abstract class used for the top-level server NestJS context for server-only services.
|
|
9550
9981
|
*
|
|
9551
9982
|
* Your API implementation of this class is usually <AppPrefix>ApiServerNestContext (e.g. `DemoApiServerNestContext`).
|
|
9552
|
-
*/
|
|
9983
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic type parameters require `any` for Firebase SDK compatibility
|
|
9984
|
+
var AbstractServerFirebaseNestContext = /*#__PURE__*/ function() {
|
|
9553
9985
|
function AbstractServerFirebaseNestContext(c) {
|
|
9554
9986
|
_class_call_check(this, AbstractServerFirebaseNestContext);
|
|
9555
9987
|
_define_property(this, "_context", void 0);
|
|
@@ -9565,7 +9997,7 @@ function _define_property(obj, key, value) {
|
|
|
9565
9997
|
{
|
|
9566
9998
|
key: "nest",
|
|
9567
9999
|
get: function get() {
|
|
9568
|
-
return this.context.
|
|
10000
|
+
return this.context.nestApplication;
|
|
9569
10001
|
}
|
|
9570
10002
|
}
|
|
9571
10003
|
]);
|
|
@@ -9604,6 +10036,8 @@ exports.FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError = FirebaseSe
|
|
|
9604
10036
|
exports.FirebaseServerAuthNewUserSendSetupDetailsSendOnceError = FirebaseServerAuthNewUserSendSetupDetailsSendOnceError;
|
|
9605
10037
|
exports.FirebaseServerAuthNewUserSendSetupDetailsThrottleError = FirebaseServerAuthNewUserSendSetupDetailsThrottleError;
|
|
9606
10038
|
exports.FirebaseServerAuthService = FirebaseServerAuthService;
|
|
10039
|
+
exports.FirebaseServerAuthUserBadInputError = FirebaseServerAuthUserBadInputError;
|
|
10040
|
+
exports.FirebaseServerAuthUserExistsError = FirebaseServerAuthUserExistsError;
|
|
9607
10041
|
exports.FirebaseServerEnvService = FirebaseServerEnvService;
|
|
9608
10042
|
exports.FirebaseServerStorageService = FirebaseServerStorageService;
|
|
9609
10043
|
exports.GlobalRoutePrefixConfig = GlobalRoutePrefixConfig;
|