@dereekb/firebase-server 13.4.1 → 13.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +405 -93
- package/index.esm.js +406 -94
- package/mailgun/package.json +9 -9
- package/model/index.cjs.js +639 -348
- package/model/index.esm.js +640 -349
- package/model/package.json +10 -10
- 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 +141 -31
- package/oidc/index.esm.js +141 -31
- package/oidc/package.json +11 -11
- 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 +13 -13
- package/src/lib/auth/auth.context.d.ts +1 -0
- package/src/lib/auth/auth.service.d.ts +13 -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 +10 -0
- 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 +11 -11
- 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
|
|
@@ -719,6 +810,9 @@ function _array_like_to_array$a(arr, len) {
|
|
|
719
810
|
function _array_with_holes$3(arr) {
|
|
720
811
|
if (Array.isArray(arr)) return arr;
|
|
721
812
|
}
|
|
813
|
+
function _array_without_holes$7(arr) {
|
|
814
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
815
|
+
}
|
|
722
816
|
function _assert_this_initialized$4(self) {
|
|
723
817
|
if (self === void 0) {
|
|
724
818
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -808,6 +902,9 @@ function _inherits$4(subClass, superClass) {
|
|
|
808
902
|
});
|
|
809
903
|
if (superClass) _set_prototype_of$4(subClass, superClass);
|
|
810
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
|
+
}
|
|
811
908
|
function _iterable_to_array_limit$3(arr, i) {
|
|
812
909
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
813
910
|
if (_i == null) return;
|
|
@@ -835,6 +932,9 @@ function _iterable_to_array_limit$3(arr, i) {
|
|
|
835
932
|
function _non_iterable_rest$3() {
|
|
836
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.");
|
|
837
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
|
+
}
|
|
838
938
|
function _object_spread$f(target) {
|
|
839
939
|
for(var i = 1; i < arguments.length; i++){
|
|
840
940
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -866,6 +966,9 @@ function _set_prototype_of$4(o, p) {
|
|
|
866
966
|
function _sliced_to_array$3(arr, i) {
|
|
867
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();
|
|
868
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
|
+
}
|
|
869
972
|
function _type_of$5(obj) {
|
|
870
973
|
"@swc/helpers - typeof";
|
|
871
974
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -1073,6 +1176,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1073
1176
|
{
|
|
1074
1177
|
/**
|
|
1075
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.
|
|
1076
1181
|
*/ key: "_generateResetPasswordKey",
|
|
1077
1182
|
value: function _generateResetPasswordKey() {
|
|
1078
1183
|
return String(DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR());
|
|
@@ -1253,6 +1358,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1253
1358
|
*
|
|
1254
1359
|
* @param roles - The complete set of roles to assign.
|
|
1255
1360
|
* @param claimsToRetain - Additional claims to merge in alongside the role-derived claims.
|
|
1361
|
+
* @returns Resolves when the claims have been replaced.
|
|
1256
1362
|
*
|
|
1257
1363
|
* @example
|
|
1258
1364
|
* ```typescript
|
|
@@ -1263,7 +1369,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1263
1369
|
return _async_to_generator$b(function() {
|
|
1264
1370
|
var claims;
|
|
1265
1371
|
return _ts_generator$b(this, function(_state) {
|
|
1266
|
-
claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(
|
|
1372
|
+
claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(_to_consumable_array$7(roles)));
|
|
1267
1373
|
return [
|
|
1268
1374
|
2,
|
|
1269
1375
|
this.setClaims(claims)
|
|
@@ -1276,6 +1382,9 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1276
1382
|
/**
|
|
1277
1383
|
* Converts roles to their corresponding claim keys, filtering out null/undefined entries
|
|
1278
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.
|
|
1279
1388
|
*/ key: "_claimsForRolesChange",
|
|
1280
1389
|
value: function _claimsForRolesChange(roles) {
|
|
1281
1390
|
return util.filterNullAndUndefinedValues(this.service.claimsForRoles(util.asSet(roles)));
|
|
@@ -1304,12 +1413,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1304
1413
|
];
|
|
1305
1414
|
case 1:
|
|
1306
1415
|
currentClaims = _state.sent();
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
newClaims = util.filterNullAndUndefinedValues(newClaims);
|
|
1310
|
-
} else {
|
|
1311
|
-
newClaims = claims;
|
|
1312
|
-
}
|
|
1416
|
+
newClaims = _object_spread$f({}, currentClaims, util.filterUndefinedValues(claims, false));
|
|
1417
|
+
newClaims = util.filterNullAndUndefinedValues(newClaims);
|
|
1313
1418
|
return [
|
|
1314
1419
|
2,
|
|
1315
1420
|
this.setClaims(newClaims)
|
|
@@ -1438,6 +1543,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1438
1543
|
*
|
|
1439
1544
|
* @param authService - The auth service to create a context from if needed.
|
|
1440
1545
|
* @param userContextOrUid - A user context or UID string.
|
|
1546
|
+
* @returns The resolved user context instance.
|
|
1441
1547
|
*
|
|
1442
1548
|
* @example
|
|
1443
1549
|
* ```typescript
|
|
@@ -1621,6 +1727,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1621
1727
|
3,
|
|
1622
1728
|
7
|
|
1623
1729
|
];
|
|
1730
|
+
// Cast to string | undefined because claims are cast from raw custom claims which may not have this field at runtime
|
|
1624
1731
|
setupCommunicationAt = setupDetails.claims.setupCommunicationAt;
|
|
1625
1732
|
hasSentCommunication = Boolean(setupCommunicationAt);
|
|
1626
1733
|
if (!((config === null || config === void 0 ? void 0 : config.sendSetupDetailsOnce) && hasSentCommunication)) return [
|
|
@@ -1628,7 +1735,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1628
1735
|
2
|
|
1629
1736
|
];
|
|
1630
1737
|
// do not send.
|
|
1631
|
-
if (config
|
|
1738
|
+
if (config.throwErrors) {
|
|
1632
1739
|
throw new FirebaseServerAuthNewUserSendSetupDetailsSendOnceError();
|
|
1633
1740
|
}
|
|
1634
1741
|
return [
|
|
@@ -1758,6 +1865,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1758
1865
|
key: "updateSetupContentSentTime",
|
|
1759
1866
|
value: /**
|
|
1760
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.
|
|
1761
1870
|
*/ function updateSetupContentSentTime(details) {
|
|
1762
1871
|
return _async_to_generator$b(function() {
|
|
1763
1872
|
var setupCommunicationAt;
|
|
@@ -1824,6 +1933,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1824
1933
|
*
|
|
1825
1934
|
* Generates a random setup password if none is provided. Override to customize user creation behavior.
|
|
1826
1935
|
*
|
|
1936
|
+
* @param input - The initialization configuration for the new user.
|
|
1937
|
+
* @returns The created user record and the setup password used.
|
|
1827
1938
|
* @throws Throws if the Firebase Admin SDK rejects the user creation.
|
|
1828
1939
|
*/ function createNewUser(input) {
|
|
1829
1940
|
return _async_to_generator$b(function() {
|
|
@@ -1860,7 +1971,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1860
1971
|
case 3:
|
|
1861
1972
|
e = _state.sent();
|
|
1862
1973
|
firebaseError = e;
|
|
1863
|
-
errorCode = firebaseError
|
|
1974
|
+
errorCode = firebaseError.code;
|
|
1864
1975
|
if (errorCode === firebase.FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR && phoneNumber) {
|
|
1865
1976
|
throw new FirebaseServerAuthUserExistsError(errorCode, 'phone', phoneNumber);
|
|
1866
1977
|
} else if (errorCode === firebase.FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR && email) {
|
|
@@ -1892,6 +2003,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1892
2003
|
key: "updateClaimsToClearUser",
|
|
1893
2004
|
value: /**
|
|
1894
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.
|
|
1895
2008
|
*/ function updateClaimsToClearUser(userContext) {
|
|
1896
2009
|
return _async_to_generator$b(function() {
|
|
1897
2010
|
var _obj;
|
|
@@ -2097,6 +2210,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
2097
2210
|
* Creates a NestJS provider that binds the given config to the {@link FIREBASE_SERVER_ENV_TOKEN} injection token.
|
|
2098
2211
|
*
|
|
2099
2212
|
* @param env - The Firebase server environment configuration.
|
|
2213
|
+
* @returns A NestJS provider binding the config to the {@link FIREBASE_SERVER_ENV_TOKEN} token.
|
|
2100
2214
|
*
|
|
2101
2215
|
* @example
|
|
2102
2216
|
* ```typescript
|
|
@@ -2115,6 +2229,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
2115
2229
|
* Use this when the NestJS app needs the config accessible via either token.
|
|
2116
2230
|
*
|
|
2117
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.
|
|
2118
2233
|
*
|
|
2119
2234
|
* @example
|
|
2120
2235
|
* ```typescript
|
|
@@ -2156,6 +2271,7 @@ function _class_call_check$m(instance, Constructor) {
|
|
|
2156
2271
|
* Each field in the input maps to an atomic increment operation. Null/undefined values default to 0.
|
|
2157
2272
|
*
|
|
2158
2273
|
* @param input - The increment specification mapping field names to numeric deltas.
|
|
2274
|
+
* @returns Firestore {@link UpdateData} with atomic increment operations.
|
|
2159
2275
|
*
|
|
2160
2276
|
* @example
|
|
2161
2277
|
* ```typescript
|
|
@@ -2228,6 +2344,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
2228
2344
|
* Google Cloud Firestore's {@link FieldValue.arrayUnion} and {@link FieldValue.arrayRemove}.
|
|
2229
2345
|
*
|
|
2230
2346
|
* @param input - The array update specification with `union` and/or `remove` field maps.
|
|
2347
|
+
* @returns Firestore {@link UpdateData} with array union/remove operations.
|
|
2231
2348
|
*
|
|
2232
2349
|
* @example
|
|
2233
2350
|
* ```typescript
|
|
@@ -2237,8 +2354,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
2237
2354
|
* });
|
|
2238
2355
|
* ```
|
|
2239
2356
|
*/ function firestoreServerArrayUpdateToUpdateData(input) {
|
|
2240
|
-
var union = input
|
|
2241
|
-
var remove = input
|
|
2357
|
+
var union = input.union;
|
|
2358
|
+
var remove = input.remove;
|
|
2242
2359
|
function createUpdatesWithArrayFunction(fieldUpdate, arrayUpdateFunction) {
|
|
2243
2360
|
var result;
|
|
2244
2361
|
if (fieldUpdate) {
|
|
@@ -2372,7 +2489,7 @@ function _define_property$p(obj, key, value) {
|
|
|
2372
2489
|
key: "update",
|
|
2373
2490
|
value: function update(data, params) {
|
|
2374
2491
|
if ((params === null || params === void 0 ? void 0 : params.precondition) != null) {
|
|
2375
|
-
this.batch.update(this.documentRef, data, params
|
|
2492
|
+
this.batch.update(this.documentRef, data, params.precondition);
|
|
2376
2493
|
} else {
|
|
2377
2494
|
this.batch.update(this.documentRef, data);
|
|
2378
2495
|
}
|
|
@@ -2389,6 +2506,7 @@ function _define_property$p(obj, key, value) {
|
|
|
2389
2506
|
* the batch applies all queued writes atomically.
|
|
2390
2507
|
*
|
|
2391
2508
|
* @param writeBatch - The Google Cloud WriteBatch to queue operations into.
|
|
2509
|
+
* @returns A factory that creates batch-backed accessors sharing the given WriteBatch.
|
|
2392
2510
|
*
|
|
2393
2511
|
* @example
|
|
2394
2512
|
* ```typescript
|
|
@@ -2431,6 +2549,9 @@ function _define_property$p(obj, key, value) {
|
|
|
2431
2549
|
}();
|
|
2432
2550
|
/**
|
|
2433
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.
|
|
2434
2555
|
*/ function writeBatchDocumentContext(batch) {
|
|
2435
2556
|
return new WriteBatchFirestoreDocumentContext(batch);
|
|
2436
2557
|
}
|
|
@@ -2557,6 +2678,8 @@ function _define_property$o(obj, key, value) {
|
|
|
2557
2678
|
/**
|
|
2558
2679
|
* Creates a {@link FirestoreDocumentDataAccessorFactory} that produces default (non-batched, non-transactional) accessors.
|
|
2559
2680
|
*
|
|
2681
|
+
* @returns A factory that creates default (non-batched, non-transactional) accessors.
|
|
2682
|
+
*
|
|
2560
2683
|
* @example
|
|
2561
2684
|
* ```typescript
|
|
2562
2685
|
* const factory = defaultFirestoreAccessorFactory<User>();
|
|
@@ -2574,6 +2697,8 @@ function _define_property$o(obj, key, value) {
|
|
|
2574
2697
|
* Creates a {@link FirestoreDocumentContext} with no special execution context (no batch, no transaction).
|
|
2575
2698
|
*
|
|
2576
2699
|
* Operations performed through this context execute immediately against Firestore.
|
|
2700
|
+
*
|
|
2701
|
+
* @returns A {@link FirestoreDocumentContext} for direct Firestore operations.
|
|
2577
2702
|
*/ function defaultFirestoreDocumentContext() {
|
|
2578
2703
|
return {
|
|
2579
2704
|
contextType: firebase.FirestoreDocumentContextType.NONE,
|
|
@@ -2703,7 +2828,7 @@ function _define_property$n(obj, key, value) {
|
|
|
2703
2828
|
key: "update",
|
|
2704
2829
|
value: function update(data, params) {
|
|
2705
2830
|
if (params === null || params === void 0 ? void 0 : params.precondition) {
|
|
2706
|
-
this.transaction.update(this.documentRef, data, params
|
|
2831
|
+
this.transaction.update(this.documentRef, data, params.precondition);
|
|
2707
2832
|
} else {
|
|
2708
2833
|
this.transaction.update(this.documentRef, data);
|
|
2709
2834
|
}
|
|
@@ -2720,6 +2845,7 @@ function _define_property$n(obj, key, value) {
|
|
|
2720
2845
|
* atomic operation.
|
|
2721
2846
|
*
|
|
2722
2847
|
* @param transaction - The Google Cloud Transaction to execute operations within.
|
|
2848
|
+
* @returns A factory that creates transaction-backed accessors sharing the given transaction.
|
|
2723
2849
|
*
|
|
2724
2850
|
* @example
|
|
2725
2851
|
* ```typescript
|
|
@@ -2763,6 +2889,9 @@ function _define_property$n(obj, key, value) {
|
|
|
2763
2889
|
}();
|
|
2764
2890
|
/**
|
|
2765
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.
|
|
2766
2895
|
*/ function transactionDocumentContext(transaction) {
|
|
2767
2896
|
return new TransactionFirestoreDocumentContext(transaction);
|
|
2768
2897
|
}
|
|
@@ -2949,6 +3078,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2949
3078
|
* @param start - A Firestore object that can resolve collection paths (e.g., Firestore instance, DocumentReference).
|
|
2950
3079
|
* @param path - The initial collection path.
|
|
2951
3080
|
* @param pathSegments - Optional pairs of [docId, collectionName] for subcollection traversal.
|
|
3081
|
+
* @returns The resolved {@link CollectionReference} at the given path.
|
|
2952
3082
|
* @throws Error if pathSegments length is odd (segments must come in pairs).
|
|
2953
3083
|
*
|
|
2954
3084
|
* @example
|
|
@@ -2959,7 +3089,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2959
3089
|
*/ function collectionRefForPath(start, path, pathSegments) {
|
|
2960
3090
|
var ref = start.collection(path);
|
|
2961
3091
|
if (pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) {
|
|
2962
|
-
if (
|
|
3092
|
+
if (pathSegments.length % 2 !== 0) {
|
|
2963
3093
|
throw new Error('Invalid number of path segments provided for collection. Path: "'.concat(path, '" + "').concat(pathSegments, '"'));
|
|
2964
3094
|
}
|
|
2965
3095
|
var batches = util.batch(pathSegments, 2); // batch to tuple [string, string]
|
|
@@ -2979,6 +3109,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2979
3109
|
* @param start - A Firestore object that can resolve document paths (e.g., CollectionReference).
|
|
2980
3110
|
* @param path - Optional document ID or path within the collection.
|
|
2981
3111
|
* @param pathSegments - Optional pairs of [collectionName, docId] for subcollection traversal.
|
|
3112
|
+
* @returns The resolved {@link DocumentReference} at the given path.
|
|
2982
3113
|
*
|
|
2983
3114
|
* @example
|
|
2984
3115
|
* ```typescript
|
|
@@ -3003,6 +3134,8 @@ function _ts_generator$a(thisArg, body) {
|
|
|
3003
3134
|
* Implements document/collection resolution, transaction/batch factories, and context factories
|
|
3004
3135
|
* using the `@google-cloud/firestore` library.
|
|
3005
3136
|
*
|
|
3137
|
+
* @returns A {@link FirestoreAccessorDriver} for the Google Cloud Admin SDK.
|
|
3138
|
+
*
|
|
3006
3139
|
* @example
|
|
3007
3140
|
* ```typescript
|
|
3008
3141
|
* const accessorDriver = googleCloudFirestoreAccessorDriver();
|
|
@@ -3037,18 +3170,10 @@ function _ts_generator$a(thisArg, body) {
|
|
|
3037
3170
|
return function(fn) {
|
|
3038
3171
|
return _async_to_generator$a(function() {
|
|
3039
3172
|
return _ts_generator$a(this, function(_state) {
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
firestore.runTransaction(fn)
|
|
3045
|
-
];
|
|
3046
|
-
case 1:
|
|
3047
|
-
return [
|
|
3048
|
-
2,
|
|
3049
|
-
_state.sent()
|
|
3050
|
-
];
|
|
3051
|
-
}
|
|
3173
|
+
return [
|
|
3174
|
+
2,
|
|
3175
|
+
firestore.runTransaction(fn)
|
|
3176
|
+
];
|
|
3052
3177
|
});
|
|
3053
3178
|
})();
|
|
3054
3179
|
};
|
|
@@ -3173,6 +3298,8 @@ var _obj;
|
|
|
3173
3298
|
* Creates a {@link FirestoreQueryConstraintFunctionsDriver} for the Google Cloud Firestore server SDK.
|
|
3174
3299
|
*
|
|
3175
3300
|
* Translates abstract query constraints into Google Cloud Firestore query builder calls.
|
|
3301
|
+
*
|
|
3302
|
+
* @returns A {@link FirestoreQueryConstraintFunctionsDriver} for the server SDK.
|
|
3176
3303
|
*/ function firestoreClientQueryConstraintFunctionsDriver() {
|
|
3177
3304
|
return firebase.makeFirestoreQueryConstraintFunctionsDriver({
|
|
3178
3305
|
mapping: FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING,
|
|
@@ -3194,6 +3321,8 @@ var _obj;
|
|
|
3194
3321
|
* streaming (streamDocs) via `onSnapshot`. Transaction-aware reads are supported
|
|
3195
3322
|
* through the optional transaction parameter in `getDocs`.
|
|
3196
3323
|
*
|
|
3324
|
+
* @returns A complete {@link FirestoreQueryDriver} for the Google Cloud Admin SDK.
|
|
3325
|
+
*
|
|
3197
3326
|
* @example
|
|
3198
3327
|
* ```typescript
|
|
3199
3328
|
* const queryDriver = googleCloudFirestoreQueryDriver();
|
|
@@ -3228,6 +3357,8 @@ var _obj;
|
|
|
3228
3357
|
*
|
|
3229
3358
|
* Bundles the server-side accessor driver and query driver, identified as `@google-cloud/firestore`.
|
|
3230
3359
|
*
|
|
3360
|
+
* @returns A complete set of {@link FirestoreDrivers} for the Google Cloud Admin SDK.
|
|
3361
|
+
*
|
|
3231
3362
|
* @example
|
|
3232
3363
|
* ```typescript
|
|
3233
3364
|
* const drivers = googleCloudFirestoreDrivers();
|
|
@@ -3438,6 +3569,7 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3438
3569
|
/**
|
|
3439
3570
|
* Asserts that the callable context contains auth data with a valid UID.
|
|
3440
3571
|
*
|
|
3572
|
+
* @param context - The callable context to check for auth data.
|
|
3441
3573
|
* @throws {HttpsError} Throws unauthenticated error if no auth data is present.
|
|
3442
3574
|
*
|
|
3443
3575
|
* @example
|
|
@@ -3455,6 +3587,7 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3455
3587
|
*
|
|
3456
3588
|
* @param document - The Firestore document to load data from.
|
|
3457
3589
|
* @param message - Optional custom error message.
|
|
3590
|
+
* @returns The document's snapshot data.
|
|
3458
3591
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
|
|
3459
3592
|
*
|
|
3460
3593
|
* @example
|
|
@@ -3493,6 +3626,7 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3493
3626
|
*
|
|
3494
3627
|
* @param document - The Firestore document to load data from.
|
|
3495
3628
|
* @param message - Optional custom error message.
|
|
3629
|
+
* @returns The document's snapshot data with `id` and `key` attached.
|
|
3496
3630
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
|
|
3497
3631
|
*/ function assertSnapshotDataWithKey(document, message) {
|
|
3498
3632
|
return _async_to_generator$9(function() {
|
|
@@ -3546,6 +3680,10 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3546
3680
|
* Creates a {@link modelNotAvailableError} for the given document's model type.
|
|
3547
3681
|
*
|
|
3548
3682
|
* Used by {@link assertDocumentExists} and other assertion functions.
|
|
3683
|
+
*
|
|
3684
|
+
* @param document - The document (or object with `modelType`) to generate the error for.
|
|
3685
|
+
* @param message - Optional custom error message.
|
|
3686
|
+
* @returns A {@link modelNotAvailableError} with the document's model type in the message.
|
|
3549
3687
|
*/ function documentModelNotAvailableError(document, message) {
|
|
3550
3688
|
return modelNotAvailableError({
|
|
3551
3689
|
message: message !== null && message !== void 0 ? message : "The ".concat(document.modelType, " was unavailable.")
|
|
@@ -3557,6 +3695,8 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3557
3695
|
*/ var PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE = 'PHONE_NUMBER_ALREADY_EXISTS';
|
|
3558
3696
|
/**
|
|
3559
3697
|
* Creates a precondition conflict (409) error indicating the phone number already exists.
|
|
3698
|
+
*
|
|
3699
|
+
* @returns A new precondition-conflict (409) {@link HttpsError} with the phone-number-exists code.
|
|
3560
3700
|
*/ function phoneNumberAlreadyExistsError() {
|
|
3561
3701
|
return preconditionConflictError({
|
|
3562
3702
|
code: PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE,
|
|
@@ -3640,7 +3780,10 @@ function _class_call_check$h(instance, Constructor) {
|
|
|
3640
3780
|
* Creates a default no-op {@link FirebaseServerAnalyticsServiceListener}.
|
|
3641
3781
|
*
|
|
3642
3782
|
* Used when no analytics provider is configured. All methods are no-ops.
|
|
3783
|
+
*
|
|
3784
|
+
* @returns A no-op listener that silently discards all analytics events.
|
|
3643
3785
|
*/ function noopFirebaseServerAnalyticsServiceListener() {
|
|
3786
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3644
3787
|
var noop = function noop() {};
|
|
3645
3788
|
return {
|
|
3646
3789
|
handleOnCallAnalyticsEvent: noop,
|
|
@@ -3948,6 +4091,9 @@ function _ts_generator$8(thisArg, body) {
|
|
|
3948
4091
|
* emitter('triggered').sendEventType('Handler Starting');
|
|
3949
4092
|
* emitter('success').sendEvent('Widget Created', { id: result.id });
|
|
3950
4093
|
* ```
|
|
4094
|
+
*
|
|
4095
|
+
* @param config - The service and context to bind to the emitter factory.
|
|
4096
|
+
* @returns A factory function that creates lifecycle-stage-specific emitters.
|
|
3951
4097
|
*/ function onCallAnalyticsEmitterInstance(config) {
|
|
3952
4098
|
var service = config.service, context = config.context;
|
|
3953
4099
|
return function(lifecycle) {
|
|
@@ -4154,22 +4300,34 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4154
4300
|
// MARK: Type Guards
|
|
4155
4301
|
/**
|
|
4156
4302
|
* Whether the details are specifier-level (has specifiers map).
|
|
4303
|
+
*
|
|
4304
|
+
* @param details - The API details to check.
|
|
4305
|
+
* @returns True if the details contain a specifiers map.
|
|
4157
4306
|
*/ function isOnCallModelTypeApiDetails(details) {
|
|
4158
4307
|
return details != null && 'specifiers' in details;
|
|
4159
4308
|
}
|
|
4160
4309
|
/**
|
|
4161
4310
|
* Whether the details are CRUD-model-level (has modelTypes map).
|
|
4311
|
+
*
|
|
4312
|
+
* @param details - The API details to check.
|
|
4313
|
+
* @returns True if the details contain a modelTypes map.
|
|
4162
4314
|
*/ function isOnCallCrudModelApiDetails(details) {
|
|
4163
4315
|
return details != null && 'modelTypes' in details;
|
|
4164
4316
|
}
|
|
4165
4317
|
/**
|
|
4166
4318
|
* Whether the details are handler-level (leaf node — no specifiers or modelTypes).
|
|
4319
|
+
*
|
|
4320
|
+
* @param details - The API details to check.
|
|
4321
|
+
* @returns True if the details are handler-level (no specifiers or modelTypes).
|
|
4167
4322
|
*/ function isOnCallHandlerApiDetails(details) {
|
|
4168
4323
|
return details != null && !('specifiers' in details) && !('modelTypes' in details);
|
|
4169
4324
|
}
|
|
4170
4325
|
/**
|
|
4171
4326
|
* Whether the specifier-level details represent a true specifier (multiple sub-operations)
|
|
4172
4327
|
* vs a wrapped direct handler (`isSpecifier: false`, details under `_`).
|
|
4328
|
+
*
|
|
4329
|
+
* @param details - The specifier-level API details to check.
|
|
4330
|
+
* @returns True if the details represent a true specifier with multiple sub-operations.
|
|
4173
4331
|
*/ function isActualSpecifier(details) {
|
|
4174
4332
|
return details.isSpecifier;
|
|
4175
4333
|
}
|
|
@@ -4202,6 +4360,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4202
4360
|
* fn: async (request) => { ... }
|
|
4203
4361
|
* });
|
|
4204
4362
|
* ```
|
|
4363
|
+
*
|
|
4364
|
+
* @param config - The API details configuration including the handler function.
|
|
4365
|
+
* @returns The handler function with _apiDetails attached.
|
|
4205
4366
|
*/ function withApiDetails(config) {
|
|
4206
4367
|
var optionalAuth = config.optionalAuth, fn = config.fn, apiDetails = _object_without_properties(config, [
|
|
4207
4368
|
"optionalAuth",
|
|
@@ -4216,6 +4377,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4216
4377
|
// MARK: Aggregation Utilities
|
|
4217
4378
|
/**
|
|
4218
4379
|
* Reads _apiDetails from a function if present.
|
|
4380
|
+
*
|
|
4381
|
+
* @param fn - The function or object that may carry _apiDetails.
|
|
4382
|
+
* @returns The API details if present, otherwise undefined.
|
|
4219
4383
|
*/ function readApiDetails(fn) {
|
|
4220
4384
|
return fn === null || fn === void 0 ? void 0 : fn._apiDetails;
|
|
4221
4385
|
}
|
|
@@ -4223,6 +4387,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4223
4387
|
* Aggregates _apiDetails from a specifier handler config object.
|
|
4224
4388
|
*
|
|
4225
4389
|
* Returns OnCallModelTypeApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
4390
|
+
*
|
|
4391
|
+
* @param config - Map of specifier keys to handler functions.
|
|
4392
|
+
* @returns Aggregated specifier-level API details, or undefined if no handlers have _apiDetails.
|
|
4226
4393
|
*/ function aggregateSpecifierApiDetails(config) {
|
|
4227
4394
|
var specifiers = {};
|
|
4228
4395
|
var hasAny = false;
|
|
@@ -4260,6 +4427,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4260
4427
|
* Aggregates _apiDetails from a model type map (used by onCallCreateModel, etc.).
|
|
4261
4428
|
*
|
|
4262
4429
|
* Returns OnCallCrudModelApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
4430
|
+
*
|
|
4431
|
+
* @param map - Map of model type strings to handler functions.
|
|
4432
|
+
* @returns Aggregated CRUD-model-level API details, or undefined if no handlers have _apiDetails.
|
|
4263
4433
|
*/ function aggregateCrudModelApiDetails(map) {
|
|
4264
4434
|
var modelTypes = {};
|
|
4265
4435
|
var hasAny = false;
|
|
@@ -4306,6 +4476,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4306
4476
|
* Aggregates _apiDetails from the top-level call model map.
|
|
4307
4477
|
*
|
|
4308
4478
|
* Returns OnCallModelApiDetails if any CRUD handlers have _apiDetails, otherwise undefined.
|
|
4479
|
+
*
|
|
4480
|
+
* @param map - Map of call type strings to CRUD handler functions.
|
|
4481
|
+
* @returns Aggregated model-level API details, or undefined if no handlers have _apiDetails.
|
|
4309
4482
|
*/ function aggregateModelApiDetails(map) {
|
|
4310
4483
|
var result = {};
|
|
4311
4484
|
var hasAny = false;
|
|
@@ -4372,7 +4545,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4372
4545
|
if (modelDetails == null) {
|
|
4373
4546
|
continue;
|
|
4374
4547
|
}
|
|
4375
|
-
if (!models
|
|
4548
|
+
if (!(modelType in models)) {
|
|
4376
4549
|
models[modelType] = {
|
|
4377
4550
|
calls: {}
|
|
4378
4551
|
};
|
|
@@ -4416,9 +4589,16 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4416
4589
|
/**
|
|
4417
4590
|
* Resolves leaf-level analytics details from the aggregated _apiDetails tree.
|
|
4418
4591
|
*
|
|
4419
|
-
* Walks: call
|
|
4592
|
+
* Walks: call -> modelType -> specifier (if specifier-level), then reads the `analytics`
|
|
4420
4593
|
* field from the handler-level {@link OnCallModelFunctionApiDetails}.
|
|
4421
|
-
|
|
4594
|
+
*
|
|
4595
|
+
* @param apiDetails - The top-level aggregated API details.
|
|
4596
|
+
* @param call - The CRUD operation type to look up.
|
|
4597
|
+
* @param modelType - The Firestore model type to look up.
|
|
4598
|
+
* @param specifier - Optional specifier key for variant handlers.
|
|
4599
|
+
* @returns The analytics details for the resolved handler, or undefined.
|
|
4600
|
+
*/ // eslint-disable-next-line @typescript-eslint/max-params
|
|
4601
|
+
function resolveAnalyticsFromApiDetails(apiDetails, call, modelType, specifier) {
|
|
4422
4602
|
var _apiDetails_call;
|
|
4423
4603
|
var modelDetails = (_apiDetails_call = apiDetails[call]) === null || _apiDetails_call === void 0 ? void 0 : _apiDetails_call.modelTypes[modelType];
|
|
4424
4604
|
if (modelDetails) {
|
|
@@ -4441,6 +4621,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4441
4621
|
* which the client can use to display a meaningful "not found" message. Intended to be
|
|
4442
4622
|
* passed to Firebase permission/existence checking utilities as the
|
|
4443
4623
|
* {@link FirebaseDoesNotExistErrorContextErrorFunction} callback.
|
|
4624
|
+
*
|
|
4625
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
4626
|
+
* @returns A model-not-available HTTP error.
|
|
4444
4627
|
*/ var nestFirebaseDoesNotExistError = function nestFirebaseDoesNotExistError(firebaseContextGrantedModelRoles) {
|
|
4445
4628
|
var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
|
|
4446
4629
|
return modelNotAvailableError({
|
|
@@ -4456,6 +4639,10 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4456
4639
|
* Returns a "forbidden" HTTP error including the document key, model type, and the roles
|
|
4457
4640
|
* that were required but not granted. Intended to be passed to Firebase permission checking
|
|
4458
4641
|
* utilities as the {@link FirebasePermissionErrorContextErrorFunction} callback.
|
|
4642
|
+
*
|
|
4643
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
4644
|
+
* @param roles - The roles that were required but not granted.
|
|
4645
|
+
* @returns A forbidden HTTP error.
|
|
4459
4646
|
*/ var nestFirebaseForbiddenPermissionError = function nestFirebaseForbiddenPermissionError(firebaseContextGrantedModelRoles, roles) {
|
|
4460
4647
|
var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
|
|
4461
4648
|
return forbiddenError({
|
|
@@ -4581,6 +4768,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4581
4768
|
/**
|
|
4582
4769
|
* Creates a bad-request error indicating the provided specifier is not recognized
|
|
4583
4770
|
* by the current model CRUD handler.
|
|
4771
|
+
*
|
|
4772
|
+
* @param specifier - The unrecognized specifier string.
|
|
4773
|
+
* @returns A bad-request error with UNKNOWN_SPECIFIER_ERROR code.
|
|
4584
4774
|
*/ function unknownModelCrudFunctionSpecifierError(specifier) {
|
|
4585
4775
|
return badRequestError(util.serverError({
|
|
4586
4776
|
status: 400,
|
|
@@ -4683,8 +4873,7 @@ function _object_spread_props$a(target, source) {
|
|
|
4683
4873
|
}
|
|
4684
4874
|
}
|
|
4685
4875
|
var fn = function fn(request) {
|
|
4686
|
-
var
|
|
4687
|
-
var call = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.call;
|
|
4876
|
+
var call = request.data.call;
|
|
4688
4877
|
if (!call) {
|
|
4689
4878
|
throw onCallModelMissingCallTypeError();
|
|
4690
4879
|
}
|
|
@@ -4692,7 +4881,7 @@ function _object_spread_props$a(target, source) {
|
|
|
4692
4881
|
if (!callFn) {
|
|
4693
4882
|
throw onCallModelUnknownCallTypeError(call);
|
|
4694
4883
|
}
|
|
4695
|
-
var
|
|
4884
|
+
var _request_data = request.data, specifier = _request_data.specifier, modelType = _request_data.modelType;
|
|
4696
4885
|
var auth = request.auth;
|
|
4697
4886
|
var context = {
|
|
4698
4887
|
call: call,
|
|
@@ -4700,7 +4889,7 @@ function _object_spread_props$a(target, source) {
|
|
|
4700
4889
|
specifier: specifier,
|
|
4701
4890
|
uid: auth === null || auth === void 0 ? void 0 : auth.uid,
|
|
4702
4891
|
auth: auth,
|
|
4703
|
-
data:
|
|
4892
|
+
data: request.data.data,
|
|
4704
4893
|
request: request
|
|
4705
4894
|
};
|
|
4706
4895
|
preAssert(context);
|
|
@@ -4729,6 +4918,8 @@ function _object_spread_props$a(target, source) {
|
|
|
4729
4918
|
}
|
|
4730
4919
|
/**
|
|
4731
4920
|
* Creates a bad-request error indicating the `call` field was missing from the request payload.
|
|
4921
|
+
*
|
|
4922
|
+
* @returns A bad-request error with CALL_TYPE_MISSING_ERROR code.
|
|
4732
4923
|
*/ function onCallModelMissingCallTypeError() {
|
|
4733
4924
|
return badRequestError(util.serverError({
|
|
4734
4925
|
status: 400,
|
|
@@ -4738,6 +4929,9 @@ function _object_spread_props$a(target, source) {
|
|
|
4738
4929
|
}
|
|
4739
4930
|
/**
|
|
4740
4931
|
* Creates a bad-request error indicating the provided `call` type is not recognized.
|
|
4932
|
+
*
|
|
4933
|
+
* @param call - The unrecognized call type string.
|
|
4934
|
+
* @returns A bad-request error with UNKNOWN_CALL_TYPE_ERROR code.
|
|
4741
4935
|
*/ function onCallModelUnknownCallTypeError(call) {
|
|
4742
4936
|
return badRequestError(util.serverError({
|
|
4743
4937
|
status: 400,
|
|
@@ -4754,14 +4948,16 @@ function _object_spread_props$a(target, source) {
|
|
|
4754
4948
|
* Dispatches to the correct model-type handler from the map, enforces auth requirements,
|
|
4755
4949
|
* runs pre-assertions, and aggregates API details from all handlers for MCP introspection.
|
|
4756
4950
|
*
|
|
4951
|
+
* @param map - Maps model type strings to their handler functions.
|
|
4952
|
+
* @param config - Configuration including call type, crud type, and error factory.
|
|
4953
|
+
* @returns A callable function that dispatches to the correct model-type handler.
|
|
4757
4954
|
* @internal Not intended for direct use outside the model CRUD module.
|
|
4758
4955
|
*/ function _onCallWithCallTypeFunction(map, config) {
|
|
4759
|
-
var callType = config.callType
|
|
4956
|
+
var callType = config.callType, _config_preAssert = config.preAssert, preAssert = _config_preAssert === void 0 ? function() {
|
|
4760
4957
|
return undefined;
|
|
4761
4958
|
} : _config_preAssert, throwOnUnknownModelType = config.throwOnUnknownModelType;
|
|
4762
4959
|
var fn = function fn(request) {
|
|
4763
|
-
var
|
|
4764
|
-
var modelType = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.modelType;
|
|
4960
|
+
var modelType = request.data.modelType;
|
|
4765
4961
|
var crudFn = map[modelType];
|
|
4766
4962
|
if (crudFn) {
|
|
4767
4963
|
var specifier = request.data.specifier;
|
|
@@ -4810,13 +5006,15 @@ function _object_spread_props$a(target, source) {
|
|
|
4810
5006
|
var preAssert = config.preAssert;
|
|
4811
5007
|
return _onCallWithCallTypeFunction(map, {
|
|
4812
5008
|
callType: 'create',
|
|
4813
|
-
crudType: 'create',
|
|
4814
5009
|
preAssert: preAssert,
|
|
4815
5010
|
throwOnUnknownModelType: createModelUnknownModelTypeError
|
|
4816
5011
|
});
|
|
4817
5012
|
}
|
|
4818
5013
|
/**
|
|
4819
5014
|
* Creates a bad-request error indicating the requested model type is not valid for creation.
|
|
5015
|
+
*
|
|
5016
|
+
* @param modelType - The unrecognized model type string.
|
|
5017
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4820
5018
|
*/ function createModelUnknownModelTypeError(modelType) {
|
|
4821
5019
|
return badRequestError(util.serverError({
|
|
4822
5020
|
status: 400,
|
|
@@ -4850,13 +5048,15 @@ function _object_spread_props$a(target, source) {
|
|
|
4850
5048
|
var preAssert = config.preAssert;
|
|
4851
5049
|
return _onCallWithCallTypeFunction(map, {
|
|
4852
5050
|
callType: 'read',
|
|
4853
|
-
crudType: 'read',
|
|
4854
5051
|
preAssert: preAssert,
|
|
4855
5052
|
throwOnUnknownModelType: readModelUnknownModelTypeError
|
|
4856
5053
|
});
|
|
4857
5054
|
}
|
|
4858
5055
|
/**
|
|
4859
5056
|
* Creates a bad-request error indicating the requested model type is not valid for reading.
|
|
5057
|
+
*
|
|
5058
|
+
* @param modelType - The unrecognized model type string.
|
|
5059
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4860
5060
|
*/ function readModelUnknownModelTypeError(modelType) {
|
|
4861
5061
|
return badRequestError(util.serverError({
|
|
4862
5062
|
status: 400,
|
|
@@ -4893,13 +5093,15 @@ function _object_spread_props$a(target, source) {
|
|
|
4893
5093
|
var preAssert = config.preAssert;
|
|
4894
5094
|
return _onCallWithCallTypeFunction(map, {
|
|
4895
5095
|
callType: 'update',
|
|
4896
|
-
crudType: 'update',
|
|
4897
5096
|
preAssert: preAssert,
|
|
4898
5097
|
throwOnUnknownModelType: updateModelUnknownModelTypeError
|
|
4899
5098
|
});
|
|
4900
5099
|
}
|
|
4901
5100
|
/**
|
|
4902
5101
|
* Creates a bad-request error indicating the requested model type is not valid for updating.
|
|
5102
|
+
*
|
|
5103
|
+
* @param modelType - The unrecognized model type string.
|
|
5104
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4903
5105
|
*/ function updateModelUnknownModelTypeError(modelType) {
|
|
4904
5106
|
return badRequestError(util.serverError({
|
|
4905
5107
|
status: 400,
|
|
@@ -4933,13 +5135,15 @@ function _object_spread_props$a(target, source) {
|
|
|
4933
5135
|
var preAssert = config.preAssert;
|
|
4934
5136
|
return _onCallWithCallTypeFunction(map, {
|
|
4935
5137
|
callType: 'delete',
|
|
4936
|
-
crudType: 'delete',
|
|
4937
5138
|
preAssert: preAssert,
|
|
4938
5139
|
throwOnUnknownModelType: deleteModelUnknownModelTypeError
|
|
4939
5140
|
});
|
|
4940
5141
|
}
|
|
4941
5142
|
/**
|
|
4942
5143
|
* Creates a bad-request error indicating the requested model type is not valid for deletion.
|
|
5144
|
+
*
|
|
5145
|
+
* @param modelType - The unrecognized model type string.
|
|
5146
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4943
5147
|
*/ function deleteModelUnknownModelTypeError(modelType) {
|
|
4944
5148
|
return badRequestError(util.serverError({
|
|
4945
5149
|
status: 400,
|
|
@@ -5253,6 +5457,7 @@ exports.FirebaseServerAnalyticsSegmentModule = __decorate([
|
|
|
5253
5457
|
* Creates a NestJS {@link FactoryProvider} that binds a Firebase Admin app getter to {@link FIREBASE_APP_TOKEN}.
|
|
5254
5458
|
*
|
|
5255
5459
|
* @param useFactory - Factory function returning the Firebase Admin app instance.
|
|
5460
|
+
* @returns A NestJS factory provider for the Firebase Admin app.
|
|
5256
5461
|
*
|
|
5257
5462
|
* @example
|
|
5258
5463
|
* ```typescript
|
|
@@ -5350,6 +5555,9 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5350
5555
|
* Returns two providers: the concrete service and an alias that maps
|
|
5351
5556
|
* `FirebaseServerAuthService` to the concrete token, enabling injection by the abstract type.
|
|
5352
5557
|
*
|
|
5558
|
+
* @param provider - The factory provider configuration for the auth service.
|
|
5559
|
+
* @returns A tuple containing the configured provider and an alias provider.
|
|
5560
|
+
*
|
|
5353
5561
|
* @example
|
|
5354
5562
|
* ```typescript
|
|
5355
5563
|
* const providers = provideFirebaseServerAuthService({
|
|
@@ -5375,6 +5583,9 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5375
5583
|
* Generates NestJS {@link ModuleMetadata} for an app's auth module, including the {@link FirebaseServerAuthModule}
|
|
5376
5584
|
* import and the custom {@link FirebaseServerAuthService} provider.
|
|
5377
5585
|
*
|
|
5586
|
+
* @param config - The module metadata configuration including the service provider.
|
|
5587
|
+
* @returns The merged NestJS module metadata.
|
|
5588
|
+
*
|
|
5378
5589
|
* @example
|
|
5379
5590
|
* ```typescript
|
|
5380
5591
|
* @Module(firebaseServerAuthModuleMetadata({
|
|
@@ -5398,6 +5609,7 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5398
5609
|
/**
|
|
5399
5610
|
* Asserts that the caller has admin privileges in the request.
|
|
5400
5611
|
*
|
|
5612
|
+
* @param request - The callable request to check for admin privileges.
|
|
5401
5613
|
* @throws {HttpsError} Throws forbidden (403) if the caller is not an admin.
|
|
5402
5614
|
*/ function assertIsAdminInRequest(request) {
|
|
5403
5615
|
if (!isAdminInRequest(request)) {
|
|
@@ -5406,6 +5618,9 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5406
5618
|
}
|
|
5407
5619
|
/**
|
|
5408
5620
|
* Checks whether the caller has admin privileges in the request.
|
|
5621
|
+
*
|
|
5622
|
+
* @param request - The callable request to check for admin privileges.
|
|
5623
|
+
* @returns True if the caller has admin privileges.
|
|
5409
5624
|
*/ function isAdminInRequest(request) {
|
|
5410
5625
|
return request.nest.authService.context(request).isAdmin;
|
|
5411
5626
|
}
|
|
@@ -5414,6 +5629,8 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5414
5629
|
*
|
|
5415
5630
|
* If the request data contains a `uid` that differs from the caller's auth UID, admin status is required.
|
|
5416
5631
|
*
|
|
5632
|
+
* @param request - The callable request containing the target UID.
|
|
5633
|
+
* @param requireUid - If true, a UID must be present in the request data.
|
|
5417
5634
|
* @returns The resolved target UID (from request data or auth).
|
|
5418
5635
|
* @throws {HttpsError} Throws forbidden (403) if the caller is not authorized.
|
|
5419
5636
|
*/ function assertIsAdminOrTargetUserInRequestData(request, requireUid) {
|
|
@@ -5427,7 +5644,9 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5427
5644
|
/**
|
|
5428
5645
|
* Checks whether the caller is an admin or is targeting their own user record in the request data.
|
|
5429
5646
|
*
|
|
5647
|
+
* @param request - The callable request containing the target UID.
|
|
5430
5648
|
* @param requireUid - If true, a UID must be present in the request data.
|
|
5649
|
+
* @returns True if the caller is an admin or is targeting their own user record.
|
|
5431
5650
|
*/ function isAdminOrTargetUserInRequestData(request) {
|
|
5432
5651
|
var requireUid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
5433
5652
|
var _request_auth;
|
|
@@ -5442,6 +5661,7 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5442
5661
|
/**
|
|
5443
5662
|
* Asserts that the caller has signed the Terms of Service.
|
|
5444
5663
|
*
|
|
5664
|
+
* @param request - The callable request to check for ToS status.
|
|
5445
5665
|
* @throws {HttpsError} Throws forbidden (403) if ToS has not been signed.
|
|
5446
5666
|
*/ function assertHasSignedTosInRequest(request) {
|
|
5447
5667
|
if (!hasSignedTosInRequest(request)) {
|
|
@@ -5452,12 +5672,16 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5452
5672
|
}
|
|
5453
5673
|
/**
|
|
5454
5674
|
* Checks whether the caller has signed the Terms of Service.
|
|
5675
|
+
*
|
|
5676
|
+
* @param request - The callable request to check for ToS status.
|
|
5677
|
+
* @returns True if the caller has signed the Terms of Service.
|
|
5455
5678
|
*/ function hasSignedTosInRequest(request) {
|
|
5456
5679
|
return request.nest.authService.context(request).hasSignedTos;
|
|
5457
5680
|
}
|
|
5458
5681
|
/**
|
|
5459
5682
|
* Asserts that the caller has all of the specified auth roles.
|
|
5460
5683
|
*
|
|
5684
|
+
* @param request - The callable request to check for auth roles.
|
|
5461
5685
|
* @param authRoles - One or more roles that must all be present.
|
|
5462
5686
|
* @throws {HttpsError} Throws forbidden (403) if any required role is missing.
|
|
5463
5687
|
*/ function assertHasRolesInRequest(request, authRoles) {
|
|
@@ -5472,6 +5696,10 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5472
5696
|
}
|
|
5473
5697
|
/**
|
|
5474
5698
|
* Checks whether the caller has all of the specified auth roles.
|
|
5699
|
+
*
|
|
5700
|
+
* @param request - The callable request to check for auth roles.
|
|
5701
|
+
* @param authRoles - One or more roles that must all be present.
|
|
5702
|
+
* @returns True if the caller has all of the specified auth roles.
|
|
5475
5703
|
*/ function hasAuthRolesInRequest(request, authRoles) {
|
|
5476
5704
|
return util.containsAllValues(request.nest.authService.context(request).authRoles, authRoles);
|
|
5477
5705
|
}
|
|
@@ -5480,7 +5708,8 @@ exports.FirebaseServerAuthModule = __decorate([
|
|
|
5480
5708
|
*
|
|
5481
5709
|
* This may be used to filter out new users that were not invited from finishing their onboarding.
|
|
5482
5710
|
*
|
|
5483
|
-
* @param request
|
|
5711
|
+
* @param request - The callable request to check for setup password claims.
|
|
5712
|
+
* @returns True if the claims contain a setup password key.
|
|
5484
5713
|
*/ function hasNewUserSetupPasswordInRequest(request) {
|
|
5485
5714
|
var claims = request.nest.authService.context(request).claims;
|
|
5486
5715
|
return claims[firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY] != null;
|
|
@@ -5574,6 +5803,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5574
5803
|
}
|
|
5575
5804
|
/**
|
|
5576
5805
|
* Creates a bad-request error indicating the provided development function specifier is not recognized.
|
|
5806
|
+
*
|
|
5807
|
+
* @param specifier - the unrecognized specifier string from the client request.
|
|
5808
|
+
* @returns A bad-request error with the unknown specifier details.
|
|
5577
5809
|
*/ function developmentUnknownSpecifierError(specifier) {
|
|
5578
5810
|
return badRequestError(util.serverError({
|
|
5579
5811
|
status: 400,
|
|
@@ -5591,6 +5823,8 @@ function _object_spread_props$7(target, source) {
|
|
|
5591
5823
|
/**
|
|
5592
5824
|
* Creates a bad-request error for when the caller sends a 'run' command
|
|
5593
5825
|
* without specifying which scheduled function to execute.
|
|
5826
|
+
*
|
|
5827
|
+
* @returns A bad-request error indicating the missing run name.
|
|
5594
5828
|
*/ function noRunNameSpecifiedForScheduledFunctionDevelopmentFunction() {
|
|
5595
5829
|
return badRequestError({
|
|
5596
5830
|
code: NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE,
|
|
@@ -5603,6 +5837,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5603
5837
|
/**
|
|
5604
5838
|
* Creates a bad-request error for when the requested scheduled function name
|
|
5605
5839
|
* is not found in the registered function map.
|
|
5840
|
+
*
|
|
5841
|
+
* @param name - the unrecognized function name from the client request.
|
|
5842
|
+
* @returns A bad-request error with the unknown function name details.
|
|
5606
5843
|
*/ function unknownScheduledFunctionDevelopmentFunctionName(name) {
|
|
5607
5844
|
return badRequestError({
|
|
5608
5845
|
code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE,
|
|
@@ -5618,6 +5855,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5618
5855
|
/**
|
|
5619
5856
|
* Creates a bad-request error for when the request `type` field does not match
|
|
5620
5857
|
* any supported operation ('run' or 'list').
|
|
5858
|
+
*
|
|
5859
|
+
* @param type - the unrecognized type value from the client request.
|
|
5860
|
+
* @returns A bad-request error with the unknown type details.
|
|
5621
5861
|
*/ function unknownScheduledFunctionDevelopmentFunctionType(type) {
|
|
5622
5862
|
return badRequestError({
|
|
5623
5863
|
code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE,
|
|
@@ -5832,7 +6072,7 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5832
6072
|
var result = [];
|
|
5833
6073
|
util.forEachKeyValue(allScheduledFunctions, {
|
|
5834
6074
|
forEach: function forEach(x) {
|
|
5835
|
-
var _x = _sliced_to_array(x,
|
|
6075
|
+
var _x = _sliced_to_array(x, 1), functionName = _x[0];
|
|
5836
6076
|
result.push({
|
|
5837
6077
|
name: functionName.toString()
|
|
5838
6078
|
});
|
|
@@ -5849,12 +6089,12 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5849
6089
|
data = request.data;
|
|
5850
6090
|
type = data.type;
|
|
5851
6091
|
switch(type){
|
|
5852
|
-
case
|
|
6092
|
+
case firebase.ScheduledFunctionDevelopmentFunctionTypeEnum.RUN:
|
|
5853
6093
|
return [
|
|
5854
6094
|
3,
|
|
5855
6095
|
1
|
|
5856
6096
|
];
|
|
5857
|
-
case
|
|
6097
|
+
case firebase.ScheduledFunctionDevelopmentFunctionTypeEnum.LIST:
|
|
5858
6098
|
return [
|
|
5859
6099
|
3,
|
|
5860
6100
|
6
|
|
@@ -5912,8 +6152,6 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5912
6152
|
}
|
|
5913
6153
|
];
|
|
5914
6154
|
case 7:
|
|
5915
|
-
throw unknownScheduledFunctionDevelopmentFunctionType(type);
|
|
5916
|
-
case 8:
|
|
5917
6155
|
return [
|
|
5918
6156
|
2
|
|
5919
6157
|
];
|
|
@@ -6103,6 +6341,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
6103
6341
|
* ```
|
|
6104
6342
|
*/ function firebaseServerDevFunctions(config) {
|
|
6105
6343
|
var enabled = config.enabled, secure = config.secure, nest = config.nest, developerFunctionsMap = config.developerFunctionsMap, onCallFactory = config.onCallFactory, allScheduledFunctions = config.allScheduledFunctions, disableDevelopmentScheduleFunction = config.disableDevelopmentScheduleFunction;
|
|
6344
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- RunnableHttpFunction supports legacy gen 1 deployments
|
|
6106
6345
|
var dev;
|
|
6107
6346
|
if (enabled) {
|
|
6108
6347
|
var fullFunctionsMap = _object_spread$8({}, developerFunctionsMap);
|
|
@@ -6117,7 +6356,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
6117
6356
|
}
|
|
6118
6357
|
dev = onCallFactory(onCallFunction)(nest);
|
|
6119
6358
|
} else {
|
|
6120
|
-
dev = onCallFactory(function(
|
|
6359
|
+
dev = onCallFactory(function() {
|
|
6121
6360
|
return _async_to_generator$6(function() {
|
|
6122
6361
|
return _ts_generator$6(this, function(_state) {
|
|
6123
6362
|
throw unavailableError({
|
|
@@ -6237,6 +6476,8 @@ function _is_native_reflect_construct$1() {
|
|
|
6237
6476
|
key: "developmentSchedulerEnabled",
|
|
6238
6477
|
get: /**
|
|
6239
6478
|
* Enabled when not in production and not in a testing environment.
|
|
6479
|
+
*
|
|
6480
|
+
* @returns True if the development scheduler should be enabled.
|
|
6240
6481
|
*/ function get() {
|
|
6241
6482
|
return !this.isProduction && !this.isTestingEnv;
|
|
6242
6483
|
}
|
|
@@ -6259,6 +6500,9 @@ exports.DefaultFirebaseServerEnvService = __decorate([
|
|
|
6259
6500
|
*
|
|
6260
6501
|
* Useful for conditionally enabling production-only Cloud Functions (e.g., scheduled tasks).
|
|
6261
6502
|
*
|
|
6503
|
+
* @param nest - getter for the NestJS application context promise.
|
|
6504
|
+
* @returns An async decision function that resolves to `true` in production.
|
|
6505
|
+
*
|
|
6262
6506
|
* @example
|
|
6263
6507
|
* ```typescript
|
|
6264
6508
|
* const isProduction = nestAppIsProductionEnvironment(nestAppGetter);
|
|
@@ -6275,6 +6519,9 @@ exports.DefaultFirebaseServerEnvService = __decorate([
|
|
|
6275
6519
|
* Creates an async decision function that resolves to `true` if the development scheduler is enabled.
|
|
6276
6520
|
*
|
|
6277
6521
|
* The development scheduler is enabled in non-production, non-testing environments.
|
|
6522
|
+
*
|
|
6523
|
+
* @param nest - getter for the NestJS application context promise.
|
|
6524
|
+
* @returns An async decision function that resolves to `true` when the development scheduler is enabled.
|
|
6278
6525
|
*/ function nestAppHasDevelopmentSchedulerEnabled(nest) {
|
|
6279
6526
|
return function() {
|
|
6280
6527
|
return nest().then(function(x) {
|
|
@@ -6371,6 +6618,11 @@ exports.FirebaseServerFirestoreContextModule = __decorate([
|
|
|
6371
6618
|
/**
|
|
6372
6619
|
* Creates a NestJS provider that initializes a Firestore collections instance from the app's {@link FirestoreContext}.
|
|
6373
6620
|
*
|
|
6621
|
+
* @param config - The provide token and factory function configuration.
|
|
6622
|
+
* @param config.provide - The class token to provide.
|
|
6623
|
+
* @param config.useFactory - Factory that creates the collections from a FirestoreContext.
|
|
6624
|
+
* @returns A tuple containing the configured NestJS provider.
|
|
6625
|
+
*
|
|
6374
6626
|
* @example
|
|
6375
6627
|
* ```typescript
|
|
6376
6628
|
* const [provider] = provideAppFirestoreCollections({
|
|
@@ -6394,6 +6646,9 @@ exports.FirebaseServerFirestoreContextModule = __decorate([
|
|
|
6394
6646
|
* Generates NestJS {@link ModuleMetadata} for an app's Firestore module, including the
|
|
6395
6647
|
* {@link FirebaseServerFirestoreContextModule} import and the app's collections provider.
|
|
6396
6648
|
*
|
|
6649
|
+
* @param config - The Firestore collections config plus optional additional module metadata.
|
|
6650
|
+
* @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
|
|
6651
|
+
*
|
|
6397
6652
|
* @example
|
|
6398
6653
|
* ```typescript
|
|
6399
6654
|
* @Module(appFirestoreModuleMetadata({
|
|
@@ -7067,6 +7322,8 @@ function _ts_generator$5(thisArg, body) {
|
|
|
7067
7322
|
/**
|
|
7068
7323
|
* Default error logger that writes validation error details to the console.
|
|
7069
7324
|
* Used when `logError` is `true` or omitted in the factory options.
|
|
7325
|
+
*
|
|
7326
|
+
* @param details - the validation error details to log.
|
|
7070
7327
|
*/ var defaultFirebaseServerActionsTransformFactoryLogErrorFunction = function defaultFirebaseServerActionsTransformFactoryLogErrorFunction(details) {
|
|
7071
7328
|
console.log('firebaseServerActionsTransformFactory() encountered validation error: ', details);
|
|
7072
7329
|
};
|
|
@@ -7692,7 +7949,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
7692
7949
|
builder = (_builder1 = builder).exclude.apply(_builder1, _to_consumable_array$2(excludePatterns));
|
|
7693
7950
|
}
|
|
7694
7951
|
(_builder = builder).forRoutes.apply(_builder, _to_consumable_array$2(forRoutes));
|
|
7695
|
-
|
|
7952
|
+
var excludeInfo = excludePatterns.length > 0 ? " (excluding: ".concat(excludePatterns.join(', '), ")") : '';
|
|
7953
|
+
this.logger.debug("Configured AppCheck middleware for routes: ".concat(forRoutes.join(', ')).concat(excludeInfo));
|
|
7696
7954
|
}
|
|
7697
7955
|
}
|
|
7698
7956
|
]);
|
|
@@ -8130,16 +8388,28 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8130
8388
|
}
|
|
8131
8389
|
/**
|
|
8132
8390
|
* Resolves a Google Cloud Storage {@link Bucket} from a {@link StoragePath}.
|
|
8391
|
+
*
|
|
8392
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8393
|
+
* @param path - the storage path containing the bucket ID.
|
|
8394
|
+
* @returns The resolved Google Cloud Storage bucket.
|
|
8133
8395
|
*/ function googleCloudStorageBucketForStorageFilePath(storage, path) {
|
|
8134
8396
|
return storage.bucket(path.bucketId);
|
|
8135
8397
|
}
|
|
8136
8398
|
/**
|
|
8137
8399
|
* Resolves a Google Cloud Storage {@link GoogleCloudFile} from a {@link StoragePath}.
|
|
8400
|
+
*
|
|
8401
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8402
|
+
* @param path - the storage path containing bucket ID and file path.
|
|
8403
|
+
* @returns The resolved Google Cloud Storage file reference.
|
|
8138
8404
|
*/ function googleCloudStorageFileForStorageFilePath(storage, path) {
|
|
8139
8405
|
return googleCloudStorageBucketForStorageFilePath(storage, path).file(path.pathString);
|
|
8140
8406
|
}
|
|
8141
8407
|
/**
|
|
8142
8408
|
* Converts Google Cloud Storage {@link FileMetadata} into the normalized {@link StorageMetadata} format.
|
|
8409
|
+
*
|
|
8410
|
+
* @param file - the Google Cloud Storage file reference.
|
|
8411
|
+
* @param metadata - the raw file metadata from the Google Cloud SDK.
|
|
8412
|
+
* @returns Normalized storage metadata.
|
|
8143
8413
|
*/ function googleCloudFileMetadataToStorageMetadata(file, metadata) {
|
|
8144
8414
|
var _metadata_generation;
|
|
8145
8415
|
var fullPath = file.name;
|
|
@@ -8170,6 +8440,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8170
8440
|
* and ACL operations for a single file in Google Cloud Storage.
|
|
8171
8441
|
*
|
|
8172
8442
|
* Handles emulator-specific edge cases (e.g., signing errors, atomic move fallback).
|
|
8443
|
+
*
|
|
8444
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8445
|
+
* @param storagePath - the storage path identifying the file's bucket and path.
|
|
8446
|
+
* @returns A file accessor with CRUD, streaming, and ACL operations.
|
|
8173
8447
|
*/ function googleCloudStorageAccessorFile(storage$1, storagePath) {
|
|
8174
8448
|
var file = googleCloudStorageFileForStorageFilePath(storage$1, storagePath);
|
|
8175
8449
|
function makeDownloadOptions(maxDownloadSizeBytes) {
|
|
@@ -8180,7 +8454,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8180
8454
|
}
|
|
8181
8455
|
function _configureMetadata(options) {
|
|
8182
8456
|
var _options_metadata, _options_metadata1, _options_metadata2, _options_metadata3, _options_metadata4, _options_metadata5;
|
|
8183
|
-
var customMetadata = util.filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options
|
|
8457
|
+
var customMetadata = util.filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options.customMetadata));
|
|
8184
8458
|
return util.filterUndefinedValues({
|
|
8185
8459
|
cacheControl: (_options_metadata1 = options.metadata) === null || _options_metadata1 === void 0 ? void 0 : _options_metadata1.cacheControl,
|
|
8186
8460
|
contentDisposition: (_options_metadata2 = options.metadata) === null || _options_metadata2 === void 0 ? void 0 : _options_metadata2.contentDisposition,
|
|
@@ -8297,7 +8571,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8297
8571
|
return x[0];
|
|
8298
8572
|
}).catch(function(e) {
|
|
8299
8573
|
var publicUrlBackup;
|
|
8300
|
-
if (e && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
|
|
8574
|
+
if (_instanceof(e, Error) && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
|
|
8301
8575
|
// NOTE: Signing does not behave properly in the emulator as it is not supported.
|
|
8302
8576
|
// https://github.com/firebase/firebase-tools/issues/3400
|
|
8303
8577
|
// we can return the public url instead.
|
|
@@ -8440,7 +8714,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8440
8714
|
},
|
|
8441
8715
|
copy: copy,
|
|
8442
8716
|
delete: function _delete(options) {
|
|
8443
|
-
return file.delete(options).then(function(
|
|
8717
|
+
return file.delete(options).then(function() {
|
|
8444
8718
|
return undefined;
|
|
8445
8719
|
});
|
|
8446
8720
|
},
|
|
@@ -8474,7 +8748,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8474
8748
|
}
|
|
8475
8749
|
var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFactory({
|
|
8476
8750
|
hasItems: function hasItems(result) {
|
|
8477
|
-
|
|
8751
|
+
var _result_apiResponse_items;
|
|
8752
|
+
return Boolean((_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : result.apiResponse.prefixes);
|
|
8478
8753
|
},
|
|
8479
8754
|
hasNext: function hasNext(result) {
|
|
8480
8755
|
return result.nextQuery != null;
|
|
@@ -8483,7 +8758,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8483
8758
|
var _result_nextQuery;
|
|
8484
8759
|
return (_result_nextQuery = result.nextQuery) === null || _result_nextQuery === void 0 ? void 0 : _result_nextQuery.pageToken;
|
|
8485
8760
|
},
|
|
8486
|
-
next: function next(
|
|
8761
|
+
next: function next(param, result) {
|
|
8762
|
+
var options = param.options, folder = param.folder;
|
|
8487
8763
|
return folder.list(_object_spread$1({}, options, result.nextQuery));
|
|
8488
8764
|
},
|
|
8489
8765
|
file: function file(storage, fileResult) {
|
|
@@ -8493,9 +8769,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8493
8769
|
return googleCloudStorageAccessorFolder(storage, folderResult.storagePath);
|
|
8494
8770
|
},
|
|
8495
8771
|
filesFromResult: function filesFromResult(result) {
|
|
8496
|
-
var
|
|
8497
|
-
var
|
|
8498
|
-
var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.items) !== null && _ref !== void 0 ? _ref : [];
|
|
8772
|
+
var _result_apiResponse_items;
|
|
8773
|
+
var items = (_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : [];
|
|
8499
8774
|
return items.map(function(x) {
|
|
8500
8775
|
return {
|
|
8501
8776
|
raw: x,
|
|
@@ -8508,9 +8783,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8508
8783
|
});
|
|
8509
8784
|
},
|
|
8510
8785
|
foldersFromResult: function foldersFromResult(result, folder) {
|
|
8511
|
-
var
|
|
8512
|
-
var
|
|
8513
|
-
var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.prefixes) !== null && _ref !== void 0 ? _ref : [];
|
|
8786
|
+
var _result_apiResponse_prefixes;
|
|
8787
|
+
var items = (_result_apiResponse_prefixes = result.apiResponse.prefixes) !== null && _result_apiResponse_prefixes !== void 0 ? _result_apiResponse_prefixes : [];
|
|
8514
8788
|
return items.map(function(prefix) {
|
|
8515
8789
|
return {
|
|
8516
8790
|
raw: prefix,
|
|
@@ -8526,6 +8800,10 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8526
8800
|
/**
|
|
8527
8801
|
* Creates a {@link GoogleCloudStorageAccessorFolder} that supports checking folder existence
|
|
8528
8802
|
* and listing files/subfolders with pagination.
|
|
8803
|
+
*
|
|
8804
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8805
|
+
* @param storagePath - the storage path identifying the folder's bucket and prefix.
|
|
8806
|
+
* @returns A folder accessor with existence checking and listing operations.
|
|
8529
8807
|
*/ function googleCloudStorageAccessorFolder(storage, storagePath) {
|
|
8530
8808
|
var bucket = googleCloudStorageBucketForStorageFilePath(storage, storagePath);
|
|
8531
8809
|
var file = bucket.file(storagePath.pathString);
|
|
@@ -8569,7 +8847,11 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8569
8847
|
nextQuery: nextQuery,
|
|
8570
8848
|
apiResponse: apiResponse
|
|
8571
8849
|
};
|
|
8572
|
-
return googleCloudStorageListFilesResultFactory(
|
|
8850
|
+
return googleCloudStorageListFilesResultFactory({
|
|
8851
|
+
storage: storage,
|
|
8852
|
+
folder: folder,
|
|
8853
|
+
options: options
|
|
8854
|
+
}, result);
|
|
8573
8855
|
});
|
|
8574
8856
|
}
|
|
8575
8857
|
};
|
|
@@ -8578,6 +8860,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8578
8860
|
/**
|
|
8579
8861
|
* Creates a {@link FirebaseStorageAccessorDriver} for Google Cloud Storage (Admin SDK).
|
|
8580
8862
|
*
|
|
8863
|
+
* @returns A server-side storage accessor driver for Google Cloud Storage.
|
|
8864
|
+
*
|
|
8581
8865
|
* @example
|
|
8582
8866
|
* ```typescript
|
|
8583
8867
|
* const driver = googleCloudStorageFirebaseStorageAccessorDriver();
|
|
@@ -8599,6 +8883,8 @@ var googleCloudStorageListFilesResultFactory = firebase.storageListFilesResultFa
|
|
|
8599
8883
|
*
|
|
8600
8884
|
* Bundles the server-side storage accessor driver, identified as `@google-cloud/storage`.
|
|
8601
8885
|
*
|
|
8886
|
+
* @returns A complete set of storage drivers for server-side usage.
|
|
8887
|
+
*
|
|
8602
8888
|
* @example
|
|
8603
8889
|
* ```typescript
|
|
8604
8890
|
* const drivers = googleCloudFirebaseStorageDrivers();
|
|
@@ -8700,6 +8986,7 @@ function _define_property$3(obj, key, value) {
|
|
|
8700
8986
|
* Storage wrapper and the raw Google Cloud Storage SDK.
|
|
8701
8987
|
*
|
|
8702
8988
|
* @param storage - The Firebase Admin Storage instance.
|
|
8989
|
+
* @returns The underlying Google Cloud Storage client.
|
|
8703
8990
|
*
|
|
8704
8991
|
* @example
|
|
8705
8992
|
* ```typescript
|
|
@@ -8850,6 +9137,7 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8850
9137
|
* Creates a NestJS provider that configures the default storage bucket ID.
|
|
8851
9138
|
*
|
|
8852
9139
|
* @param input - A bucket ID string or full factory config object.
|
|
9140
|
+
* @returns A NestJS provider for the storage context factory config token.
|
|
8853
9141
|
* @throws Error if `defaultBucketId` is empty.
|
|
8854
9142
|
*
|
|
8855
9143
|
* @example
|
|
@@ -8870,6 +9158,8 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8870
9158
|
}
|
|
8871
9159
|
/**
|
|
8872
9160
|
* Returns the default provider config that creates a standard {@link FirebaseServerStorageService}.
|
|
9161
|
+
*
|
|
9162
|
+
* @returns The default provider configuration for FirebaseServerStorageService.
|
|
8873
9163
|
*/ function defaultProvideFirebaseServerStorageServiceSimple() {
|
|
8874
9164
|
return {
|
|
8875
9165
|
provide: FirebaseServerStorageService,
|
|
@@ -8883,6 +9173,9 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8883
9173
|
*
|
|
8884
9174
|
* If the provider token differs from `FirebaseServerStorageService`, an alias provider is added
|
|
8885
9175
|
* so the service can also be injected by the abstract type.
|
|
9176
|
+
*
|
|
9177
|
+
* @param provider - The storage service provider configuration.
|
|
9178
|
+
* @returns An array of NestJS providers for the storage service.
|
|
8886
9179
|
*/ function provideFirebaseServerStorageService(provider) {
|
|
8887
9180
|
var _provider_inject;
|
|
8888
9181
|
var providers = [
|
|
@@ -8904,13 +9197,17 @@ exports.FirebaseServerStorageContextModule = __decorate([
|
|
|
8904
9197
|
* Generates NestJS {@link ModuleMetadata} for an app's storage module, including the
|
|
8905
9198
|
* {@link FirebaseServerStorageContextModule} import and the storage service provider.
|
|
8906
9199
|
*
|
|
9200
|
+
* @param config - Optional configuration including a custom service provider and additional module metadata.
|
|
9201
|
+
* @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
|
|
9202
|
+
*
|
|
8907
9203
|
* @example
|
|
8908
9204
|
* ```typescript
|
|
8909
9205
|
* @Module(firebaseServerStorageModuleMetadata())
|
|
8910
9206
|
* export class AppStorageModule {}
|
|
8911
9207
|
* ```
|
|
8912
9208
|
*/ function firebaseServerStorageModuleMetadata(config) {
|
|
8913
|
-
var
|
|
9209
|
+
var _ref;
|
|
9210
|
+
var serviceProvider = (_ref = config === null || config === void 0 ? void 0 : config.serviceProvider) !== null && _ref !== void 0 ? _ref : defaultProvideFirebaseServerStorageServiceSimple();
|
|
8914
9211
|
var providers = provideFirebaseServerStorageService(serviceProvider);
|
|
8915
9212
|
var tokensToExport = nestjs.injectionTokensFromProviders(providers);
|
|
8916
9213
|
return nestjs.mergeModuleMetadata({
|
|
@@ -9168,6 +9465,9 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9168
9465
|
* times with the same app reuses the existing server. The factory wires up Firebase Admin,
|
|
9169
9466
|
* environment config, storage, AppCheck middleware, and webhook routes based on the config.
|
|
9170
9467
|
*
|
|
9468
|
+
* @param config - Configuration for the NestJS server instance including the root module, providers, and middleware options.
|
|
9469
|
+
* @returns A NestServerInstance that manages server lifecycle for the given module class.
|
|
9470
|
+
*
|
|
9171
9471
|
* @example
|
|
9172
9472
|
* ```typescript
|
|
9173
9473
|
* const instance = nestServerInstance({ moduleClass: AppModule, appCheckEnabled: true });
|
|
@@ -9183,7 +9483,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9183
9483
|
var server = express();
|
|
9184
9484
|
var createNestServer = function createNestServer(expressInstance) {
|
|
9185
9485
|
return _async_to_generator$1(function() {
|
|
9186
|
-
var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp;
|
|
9486
|
+
var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp, configured;
|
|
9187
9487
|
return _ts_generator$1(this, function(_state) {
|
|
9188
9488
|
switch(_state.label){
|
|
9189
9489
|
case 0:
|
|
@@ -9213,7 +9513,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9213
9513
|
nestApp = nestApp.setGlobalPrefix(globalApiRoutePrefixConfig.globalApiRoutePrefix, globalApiRoutePrefixConfig);
|
|
9214
9514
|
}
|
|
9215
9515
|
if (configureNestServerInstance) {
|
|
9216
|
-
|
|
9516
|
+
configured = configureNestServerInstance(nestApp);
|
|
9517
|
+
if (configured) {
|
|
9518
|
+
nestApp = configured;
|
|
9519
|
+
}
|
|
9217
9520
|
}
|
|
9218
9521
|
return [
|
|
9219
9522
|
2,
|
|
@@ -9490,14 +9793,21 @@ function _ts_generator(thisArg, body) {
|
|
|
9490
9793
|
{
|
|
9491
9794
|
key: "nest",
|
|
9492
9795
|
get: /**
|
|
9796
|
+
* Returns the NestJS application context.
|
|
9797
|
+
*
|
|
9493
9798
|
* @deprecated use nestApplication instead.
|
|
9799
|
+
* @returns The NestJS application context.
|
|
9494
9800
|
*/ function get() {
|
|
9495
9801
|
return this._nestApplication;
|
|
9496
9802
|
}
|
|
9497
9803
|
},
|
|
9498
9804
|
{
|
|
9499
9805
|
key: "nestApplication",
|
|
9500
|
-
get:
|
|
9806
|
+
get: /**
|
|
9807
|
+
* Returns the NestJS application context.
|
|
9808
|
+
*
|
|
9809
|
+
* @returns The NestJS application context.
|
|
9810
|
+
*/ function get() {
|
|
9501
9811
|
return this._nestApplication;
|
|
9502
9812
|
}
|
|
9503
9813
|
}
|
|
@@ -9531,13 +9841,13 @@ function _ts_generator(thisArg, body) {
|
|
|
9531
9841
|
{
|
|
9532
9842
|
key: "envService",
|
|
9533
9843
|
get: function get() {
|
|
9534
|
-
return this.
|
|
9844
|
+
return this.nestApplication.get(FirebaseServerEnvService);
|
|
9535
9845
|
}
|
|
9536
9846
|
},
|
|
9537
9847
|
{
|
|
9538
9848
|
key: "storageService",
|
|
9539
9849
|
get: function get() {
|
|
9540
|
-
return this.
|
|
9850
|
+
return this.nestApplication.get(FirebaseServerStorageService);
|
|
9541
9851
|
}
|
|
9542
9852
|
},
|
|
9543
9853
|
{
|
|
@@ -9548,6 +9858,7 @@ function _ts_generator(thisArg, body) {
|
|
|
9548
9858
|
*
|
|
9549
9859
|
* @param auth - The request's auth data reference.
|
|
9550
9860
|
* @param buildFn - Optional builder to customize the context.
|
|
9861
|
+
* @returns A model context with auth, app, and error factories.
|
|
9551
9862
|
*/ key: "makeModelContext",
|
|
9552
9863
|
value: function makeModelContext(auth, buildFn) {
|
|
9553
9864
|
var base = {
|
|
@@ -9569,6 +9880,7 @@ function _ts_generator(thisArg, body) {
|
|
|
9569
9880
|
*
|
|
9570
9881
|
* @param context - The request's auth data reference.
|
|
9571
9882
|
* @param buildFn - Optional builder to customize the model context.
|
|
9883
|
+
* @returns An in-context models service scoped to the given auth context.
|
|
9572
9884
|
*/ key: "model",
|
|
9573
9885
|
value: function model(context, buildFn) {
|
|
9574
9886
|
var firebaseModelContext = this.makeModelContext(context, buildFn);
|
|
@@ -9655,7 +9967,7 @@ function _define_property(obj, key, value) {
|
|
|
9655
9967
|
{
|
|
9656
9968
|
key: "nest",
|
|
9657
9969
|
get: function get() {
|
|
9658
|
-
return this.context.
|
|
9970
|
+
return this.context.nestApplication;
|
|
9659
9971
|
}
|
|
9660
9972
|
}
|
|
9661
9973
|
]);
|