@dereekb/firebase-server 13.4.1 → 13.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +455 -113
- package/index.esm.js +456 -114
- package/mailgun/package.json +9 -9
- package/model/index.cjs.js +645 -350
- package/model/index.esm.js +646 -351
- package/model/package.json +9 -9
- package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +1 -0
- package/model/src/lib/notification/index.d.ts +2 -2
- package/model/src/lib/notification/{notification.action.service.d.ts → notification.action.server.d.ts} +53 -1
- package/model/src/lib/notification/{notification.action.init.service.d.ts → notification.action.server.init.d.ts} +20 -0
- package/model/src/lib/notification/notification.config.service.d.ts +2 -0
- package/model/src/lib/notification/notification.create.run.d.ts +1 -0
- package/model/src/lib/notification/notification.error.d.ts +16 -0
- package/model/src/lib/notification/notification.expedite.service.d.ts +11 -3
- package/model/src/lib/notification/notification.module.d.ts +19 -6
- package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +1 -0
- package/model/src/lib/notification/notification.send.service.text.d.ts +2 -0
- package/model/src/lib/notification/notification.task.service.handler.d.ts +1 -0
- package/model/src/lib/notification/notification.task.service.util.d.ts +1 -0
- package/model/src/lib/notification/notification.task.subtask.handler.d.ts +3 -0
- package/model/src/lib/notification/notification.util.d.ts +4 -2
- package/model/src/lib/storagefile/index.d.ts +1 -1
- package/model/src/lib/storagefile/storagefile.action.server.d.ts +98 -1
- package/model/src/lib/storagefile/{storagefile.action.init.service.d.ts → storagefile.action.server.init.d.ts} +13 -2
- package/model/src/lib/storagefile/storagefile.error.d.ts +27 -0
- package/model/src/lib/storagefile/storagefile.module.d.ts +14 -4
- package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +29 -7
- package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +2 -0
- package/oidc/index.cjs.js +150 -32
- package/oidc/index.esm.js +150 -32
- package/oidc/package.json +10 -10
- package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +12 -0
- package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +6 -0
- package/oidc/src/lib/model/jwks/jwks.d.ts +9 -0
- package/oidc/src/lib/model/jwks/jwks.query.d.ts +9 -0
- package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +13 -0
- package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +5 -1
- package/oidc/src/lib/oidc.config.d.ts +2 -1
- package/oidc/src/lib/oidc.module.d.ts +9 -2
- package/oidc/src/lib/service/oidc.account.service.d.ts +7 -0
- package/oidc/src/lib/service/oidc.adapter.service.d.ts +1 -0
- package/oidc/src/lib/service/oidc.config.service.d.ts +1 -0
- package/oidc/src/lib/service/oidc.encryption.service.d.ts +6 -0
- package/oidc/src/lib/service/oidc.interaction.service.d.ts +15 -0
- package/oidc/src/lib/service/oidc.jwks.service.d.ts +18 -2
- package/oidc/src/lib/service/oidc.service.d.ts +7 -3
- package/package.json +10 -10
- package/src/lib/auth/auth.context.d.ts +1 -0
- package/src/lib/auth/auth.service.d.ts +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 +10 -10
- package/zoho/index.cjs.js +8 -6
- package/zoho/index.esm.js +8 -6
- package/zoho/package.json +9 -9
- package/zoho/src/lib/zoho.accounts.firebase.d.ts +2 -1
- package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +2 -1
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, FirestoreDocumentContextType, streamFromOnSnapshot, makeFirestoreQueryConstraintFunctionsDriver, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, firestoreContextFactory, firestoreField, optionalFirestoreField, setIdAndKeyFromKeyIdRefOnDocumentData, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, storageListFilesResultFactory, assertStorageUploadOptionsStringFormat, firebaseStorageContextFactory, inContextFirebaseModelsServiceFactory, useFirebaseModelsService } from '@dereekb/firebase';
|
|
1
|
+
import { DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR, FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, FirestoreDocumentContextType, streamFromOnSnapshot, makeFirestoreQueryConstraintFunctionsDriver, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, firestoreContextFactory, firestoreField, optionalFirestoreField, setIdAndKeyFromKeyIdRefOnDocumentData, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT, ScheduledFunctionDevelopmentFunctionTypeEnum, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, storageListFilesResultFactory, assertStorageUploadOptionsStringFormat, firebaseStorageContextFactory, inContextFirebaseModelsServiceFactory, useFirebaseModelsService } from '@dereekb/firebase';
|
|
2
2
|
import { partialServerError, isServerError, randomNumberFactory, cachedGetter, filterNullAndUndefinedValues, asSet, AUTH_ADMIN_ROLE, AUTH_TOS_SIGNED_ROLE, forEachKeyValue, KeyValueTypleValueFilter, filterUndefinedValues, isThrottled, mapObjectMap, batch, objectToMap, serverError, asArray, containsAllValues, websiteUrlDetails, mergeObjects, cronExpressionRepeatingEveryNMinutes, mapIdentityFunction, slashPathName, toRelativeSlashPathStartType, fixMultiSlashesInSlashPath, SLASH_PATH_SEPARATOR, objectHasNoKeys, pushItemOrArrayItemsIntoArray, makeGetter, asGetter, build } from '@dereekb/util';
|
|
3
3
|
import { HttpsError } from 'firebase-functions/https';
|
|
4
4
|
import { hoursToMs, toISODateString } from '@dereekb/date';
|
|
@@ -72,6 +72,8 @@ function _type_of$7(obj) {
|
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Creates an unauthenticated {@link HttpsError} indicating the request context has no auth data.
|
|
75
|
+
*
|
|
76
|
+
* @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
|
|
75
77
|
*/ function unauthenticatedContextHasNoAuthData() {
|
|
76
78
|
return unauthenticatedError({
|
|
77
79
|
message: 'expected auth',
|
|
@@ -80,6 +82,8 @@ function _type_of$7(obj) {
|
|
|
80
82
|
}
|
|
81
83
|
/**
|
|
82
84
|
* Creates an unauthenticated {@link HttpsError} indicating the request context has no user UID.
|
|
85
|
+
*
|
|
86
|
+
* @returns A new unauthenticated {@link HttpsError} with the no-auth error code.
|
|
83
87
|
*/ function unauthenticatedContextHasNoUidError() {
|
|
84
88
|
return unauthenticatedError({
|
|
85
89
|
message: 'no user uid',
|
|
@@ -93,9 +97,15 @@ function _type_of$7(obj) {
|
|
|
93
97
|
* Each factory wraps the Firebase `HttpsError` with a consistent shape: an HTTP status code,
|
|
94
98
|
* a string error code, and an optional {@link ServerError} detail object.
|
|
95
99
|
*/ var UNAUTHENTICATED_ERROR_CODE = 'UNAUTHENTICATED';
|
|
96
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Creates an unauthenticated (401) {@link HttpsError}.
|
|
102
|
+
*
|
|
103
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
104
|
+
* @returns A new unauthenticated (401) {@link HttpsError}.
|
|
105
|
+
*/ function unauthenticatedError(messageOrError) {
|
|
106
|
+
var _serverError_message;
|
|
97
107
|
var serverError = partialServerError(messageOrError);
|
|
98
|
-
return new HttpsError('unauthenticated', (serverError
|
|
108
|
+
return new HttpsError('unauthenticated', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'unauthenticated', _object_spread_props$c(_object_spread$g({
|
|
99
109
|
status: 401,
|
|
100
110
|
code: UNAUTHENTICATED_ERROR_CODE
|
|
101
111
|
}, serverError), {
|
|
@@ -103,9 +113,15 @@ function _type_of$7(obj) {
|
|
|
103
113
|
}));
|
|
104
114
|
}
|
|
105
115
|
var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
|
|
106
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Creates a forbidden (403) {@link HttpsError}.
|
|
118
|
+
*
|
|
119
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
120
|
+
* @returns A new forbidden (403) {@link HttpsError}.
|
|
121
|
+
*/ function forbiddenError(messageOrError) {
|
|
122
|
+
var _serverError_message;
|
|
107
123
|
var serverError = partialServerError(messageOrError);
|
|
108
|
-
return new HttpsError('permission-denied', (serverError
|
|
124
|
+
return new HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'forbidden', _object_spread_props$c(_object_spread$g({
|
|
109
125
|
status: 403,
|
|
110
126
|
code: FORBIDDEN_ERROR_CODE
|
|
111
127
|
}, serverError), {
|
|
@@ -113,9 +129,15 @@ var FORBIDDEN_ERROR_CODE = 'FORBIDDEN';
|
|
|
113
129
|
}));
|
|
114
130
|
}
|
|
115
131
|
var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
|
|
116
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Creates a permission-denied (403) {@link HttpsError}.
|
|
134
|
+
*
|
|
135
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
136
|
+
* @returns A new permission-denied (403) {@link HttpsError}.
|
|
137
|
+
*/ function permissionDeniedError(messageOrError) {
|
|
138
|
+
var _serverError_message;
|
|
117
139
|
var serverError = partialServerError(messageOrError);
|
|
118
|
-
return new HttpsError('permission-denied', (serverError
|
|
140
|
+
return new HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'permission denied', _object_spread_props$c(_object_spread$g({
|
|
119
141
|
status: 403,
|
|
120
142
|
code: PERMISSION_DENIED_ERROR_CODE
|
|
121
143
|
}, serverError), {
|
|
@@ -123,9 +145,15 @@ var PERMISSION_DENIED_ERROR_CODE = 'PERMISSION_DENIED';
|
|
|
123
145
|
}));
|
|
124
146
|
}
|
|
125
147
|
var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
|
|
126
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Creates a not-found (404) {@link HttpsError}.
|
|
150
|
+
*
|
|
151
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
152
|
+
* @returns A new not-found (404) {@link HttpsError}.
|
|
153
|
+
*/ function notFoundError(messageOrError) {
|
|
154
|
+
var _serverError_message;
|
|
127
155
|
var serverError = partialServerError(messageOrError);
|
|
128
|
-
return new HttpsError('not-found', (serverError
|
|
156
|
+
return new HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'not found', _object_spread_props$c(_object_spread$g({
|
|
129
157
|
status: 404,
|
|
130
158
|
code: NOT_FOUND_ERROR_CODE
|
|
131
159
|
}, serverError), {
|
|
@@ -133,9 +161,15 @@ var NOT_FOUND_ERROR_CODE = 'NOT_FOUND';
|
|
|
133
161
|
}));
|
|
134
162
|
}
|
|
135
163
|
var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
|
|
136
|
-
/**
|
|
164
|
+
/**
|
|
165
|
+
* Creates a model-not-available (404) {@link HttpsError}, used when a Firestore document does not exist.
|
|
166
|
+
*
|
|
167
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
168
|
+
* @returns A new model-not-available (404) {@link HttpsError}.
|
|
169
|
+
*/ function modelNotAvailableError(messageOrError) {
|
|
170
|
+
var _serverError_message;
|
|
137
171
|
var serverError = partialServerError(messageOrError);
|
|
138
|
-
return new HttpsError('not-found', (serverError
|
|
172
|
+
return new 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({
|
|
139
173
|
status: 404,
|
|
140
174
|
code: MODEL_NOT_AVAILABLE_ERROR_CODE
|
|
141
175
|
}, serverError), {
|
|
@@ -143,9 +177,15 @@ var MODEL_NOT_AVAILABLE_ERROR_CODE = 'MODEL_NOT_AVAILABLE';
|
|
|
143
177
|
}));
|
|
144
178
|
}
|
|
145
179
|
var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
|
|
146
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* Creates a bad-request (400) {@link HttpsError}.
|
|
182
|
+
*
|
|
183
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
184
|
+
* @returns A new bad-request (400) {@link HttpsError}.
|
|
185
|
+
*/ function badRequestError(messageOrError) {
|
|
186
|
+
var _serverError_message;
|
|
147
187
|
var serverError = partialServerError(messageOrError);
|
|
148
|
-
return new HttpsError('invalid-argument', (serverError
|
|
188
|
+
return new HttpsError('invalid-argument', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'bad request', _object_spread_props$c(_object_spread$g({
|
|
149
189
|
status: 400,
|
|
150
190
|
code: BAD_REQUEST_ERROR_CODE
|
|
151
191
|
}, serverError), {
|
|
@@ -153,9 +193,15 @@ var BAD_REQUEST_ERROR_CODE = 'BAD_REQUEST';
|
|
|
153
193
|
}));
|
|
154
194
|
}
|
|
155
195
|
var CONFLICT_ERROR_CODE = 'CONFLICT';
|
|
156
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* Creates a precondition-conflict (409) {@link HttpsError}.
|
|
198
|
+
*
|
|
199
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
200
|
+
* @returns A new precondition-conflict (409) {@link HttpsError}.
|
|
201
|
+
*/ function preconditionConflictError(messageOrError) {
|
|
202
|
+
var _serverError_message;
|
|
157
203
|
var serverError = partialServerError(messageOrError);
|
|
158
|
-
return new HttpsError('failed-precondition', (serverError
|
|
204
|
+
return new HttpsError('failed-precondition', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'conflict', _object_spread_props$c(_object_spread$g({
|
|
159
205
|
status: 409,
|
|
160
206
|
code: CONFLICT_ERROR_CODE
|
|
161
207
|
}, serverError), {
|
|
@@ -163,9 +209,15 @@ var CONFLICT_ERROR_CODE = 'CONFLICT';
|
|
|
163
209
|
}));
|
|
164
210
|
}
|
|
165
211
|
var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
|
|
166
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Creates an already-exists (409) {@link HttpsError}.
|
|
214
|
+
*
|
|
215
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
216
|
+
* @returns A new already-exists (409) {@link HttpsError}.
|
|
217
|
+
*/ function alreadyExistsError(messageOrError) {
|
|
218
|
+
var _serverError_message;
|
|
167
219
|
var serverError = partialServerError(messageOrError);
|
|
168
|
-
return new HttpsError('already-exists', (serverError
|
|
220
|
+
return new HttpsError('already-exists', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'already exists', _object_spread_props$c(_object_spread$g({
|
|
169
221
|
status: 409,
|
|
170
222
|
code: ALREADY_EXISTS_ERROR_CODE
|
|
171
223
|
}, serverError), {
|
|
@@ -173,9 +225,15 @@ var ALREADY_EXISTS_ERROR_CODE = 'ALREADY_EXISTS';
|
|
|
173
225
|
}));
|
|
174
226
|
}
|
|
175
227
|
var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
|
|
176
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* Creates an unavailable (503) {@link HttpsError}.
|
|
230
|
+
*
|
|
231
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
232
|
+
* @returns A new unavailable (503) {@link HttpsError}.
|
|
233
|
+
*/ function unavailableError(messageOrError) {
|
|
234
|
+
var _serverError_message;
|
|
177
235
|
var serverError = partialServerError(messageOrError);
|
|
178
|
-
return new HttpsError('unavailable', (serverError
|
|
236
|
+
return new HttpsError('unavailable', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'service unavailable', _object_spread_props$c(_object_spread$g({
|
|
179
237
|
status: 503,
|
|
180
238
|
code: UNAVAILABLE_ERROR_CODE
|
|
181
239
|
}, serverError), {
|
|
@@ -183,9 +241,15 @@ var UNAVAILABLE_ERROR_CODE = 'UNAVAILABLE';
|
|
|
183
241
|
}));
|
|
184
242
|
}
|
|
185
243
|
var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED_FUNCTION';
|
|
186
|
-
/**
|
|
244
|
+
/**
|
|
245
|
+
* Creates an unimplemented (501) {@link HttpsError} for deactivated or unavailable functions.
|
|
246
|
+
*
|
|
247
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
248
|
+
* @returns A new unimplemented (501) {@link HttpsError}.
|
|
249
|
+
*/ function unavailableOrDeactivatedFunctionError(messageOrError) {
|
|
250
|
+
var _serverError_message;
|
|
187
251
|
var serverError = partialServerError(messageOrError);
|
|
188
|
-
return new HttpsError('unimplemented', (serverError
|
|
252
|
+
return new 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({
|
|
189
253
|
status: 501,
|
|
190
254
|
code: UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE
|
|
191
255
|
}, serverError), {
|
|
@@ -193,9 +257,15 @@ var UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE = 'UNAVAILABLE_OR_DEACTIVATED
|
|
|
193
257
|
}));
|
|
194
258
|
}
|
|
195
259
|
var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
196
|
-
/**
|
|
260
|
+
/**
|
|
261
|
+
* Creates an internal-error (500) {@link HttpsError}.
|
|
262
|
+
*
|
|
263
|
+
* @param messageOrError - Optional error message string or partial server error object.
|
|
264
|
+
* @returns A new internal-error (500) {@link HttpsError}.
|
|
265
|
+
*/ function internalServerError(messageOrError) {
|
|
266
|
+
var _serverError_message;
|
|
197
267
|
var serverError = partialServerError(messageOrError);
|
|
198
|
-
return new HttpsError('internal', (serverError
|
|
268
|
+
return new HttpsError('internal', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'internal error', _object_spread_props$c(_object_spread$g({
|
|
199
269
|
status: 500,
|
|
200
270
|
code: INTERNAL_SERVER_ERROR_CODE
|
|
201
271
|
}, serverError), {
|
|
@@ -204,13 +274,19 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
204
274
|
}
|
|
205
275
|
/**
|
|
206
276
|
* Type guard for Firebase {@link HttpsError} instances.
|
|
277
|
+
*
|
|
278
|
+
* @param input - The value to check.
|
|
279
|
+
* @returns `true` if the input is a Firebase {@link HttpsError}.
|
|
207
280
|
*/ function isFirebaseHttpsError(input) {
|
|
208
|
-
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input
|
|
281
|
+
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'httpErrorCode' in input && 'toJSON' in input;
|
|
209
282
|
}
|
|
210
283
|
/**
|
|
211
284
|
* Type guard for Firebase Admin {@link admin.FirebaseError} instances.
|
|
285
|
+
*
|
|
286
|
+
* @param input - The value to check.
|
|
287
|
+
* @returns `true` if the input is a Firebase Admin {@link admin.FirebaseError}.
|
|
212
288
|
*/ function isFirebaseError(input) {
|
|
213
|
-
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input
|
|
289
|
+
return (typeof input === "undefined" ? "undefined" : _type_of$7(input)) === 'object' && input != null && 'code' in input && 'message' in input && 'toJSON' in input;
|
|
214
290
|
}
|
|
215
291
|
/**
|
|
216
292
|
* Analyzes a caught error and extracts structured Firebase error information.
|
|
@@ -219,6 +295,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
219
295
|
* and extracts any embedded error codes and {@link ServerError} details.
|
|
220
296
|
*
|
|
221
297
|
* @param e - The caught error to analyze.
|
|
298
|
+
* @returns Structured {@link FirebaseServerErrorInfo} with classified error details.
|
|
222
299
|
*
|
|
223
300
|
* @example
|
|
224
301
|
* ```typescript
|
|
@@ -263,6 +340,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
263
340
|
}
|
|
264
341
|
/**
|
|
265
342
|
* Returns a tuple of [firebaseErrorCode, errorInfo] for pattern-matching on Firebase error codes.
|
|
343
|
+
*
|
|
344
|
+
* @param e - The caught error to analyze.
|
|
345
|
+
* @returns A tuple of the Firebase error code (if present) and the full error info.
|
|
266
346
|
*/ function firebaseServerErrorInfoCodePair(e) {
|
|
267
347
|
var info = firebaseServerErrorInfo(e);
|
|
268
348
|
return [
|
|
@@ -272,6 +352,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
272
352
|
}
|
|
273
353
|
/**
|
|
274
354
|
* Returns a tuple of [serverError, errorInfo] for pattern-matching on embedded server error details.
|
|
355
|
+
*
|
|
356
|
+
* @param e - The caught error to analyze.
|
|
357
|
+
* @returns A tuple of the server error (if present) and the full error info.
|
|
275
358
|
*/ function firebaseServerErrorInfoServerErrorPair(e) {
|
|
276
359
|
var info = firebaseServerErrorInfo(e);
|
|
277
360
|
return [
|
|
@@ -281,6 +364,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
281
364
|
}
|
|
282
365
|
/**
|
|
283
366
|
* Returns a tuple of [serverErrorCode, errorInfo] for pattern-matching on server error string codes.
|
|
367
|
+
*
|
|
368
|
+
* @param e - The caught error to analyze.
|
|
369
|
+
* @returns A tuple of the server error code (if present) and the full error info.
|
|
284
370
|
*/ function firebaseServerErrorInfoServerErrorCodePair(e) {
|
|
285
371
|
var info = firebaseServerErrorInfo(e);
|
|
286
372
|
return [
|
|
@@ -305,6 +391,9 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
305
391
|
/**
|
|
306
392
|
* Type guard that checks whether the given callable context contains authenticated user data (non-null auth with a uid).
|
|
307
393
|
*
|
|
394
|
+
* @param context - The callable context to check.
|
|
395
|
+
* @returns `true` if the context has authenticated user data with a valid UID.
|
|
396
|
+
*
|
|
308
397
|
* @example
|
|
309
398
|
* ```typescript
|
|
310
399
|
* if (isContextWithAuthData(context)) {
|
|
@@ -313,11 +402,12 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
313
402
|
* ```
|
|
314
403
|
*/ function isContextWithAuthData(context) {
|
|
315
404
|
var _context_auth;
|
|
316
|
-
return Boolean(
|
|
405
|
+
return Boolean((_context_auth = context.auth) === null || _context_auth === void 0 ? void 0 : _context_auth.uid);
|
|
317
406
|
}
|
|
318
407
|
/**
|
|
319
408
|
* Asserts that the callable context contains authenticated user data.
|
|
320
409
|
*
|
|
410
|
+
* @param context - The callable context to assert on.
|
|
321
411
|
* @throws {HttpsError} Throws an unauthenticated error if auth data is missing.
|
|
322
412
|
*
|
|
323
413
|
* @example
|
|
@@ -338,6 +428,7 @@ var INTERNAL_SERVER_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
338
428
|
* including email, phone, and sign-in timestamps.
|
|
339
429
|
*
|
|
340
430
|
* @param token - The decoded ID token from Firebase Admin Auth.
|
|
431
|
+
* @returns A normalized {@link FirebaseAuthToken} with camelCase fields.
|
|
341
432
|
*
|
|
342
433
|
* @example
|
|
343
434
|
* ```typescript
|
|
@@ -521,7 +612,7 @@ function _ts_generator$c(thisArg, body) {
|
|
|
521
612
|
];
|
|
522
613
|
case 2:
|
|
523
614
|
error = _state.sent();
|
|
524
|
-
if (
|
|
615
|
+
if (error.code === FIREBASE_AUTH_USER_NOT_FOUND_ERROR) {
|
|
525
616
|
return [
|
|
526
617
|
2,
|
|
527
618
|
undefined
|
|
@@ -717,6 +808,9 @@ function _array_like_to_array$a(arr, len) {
|
|
|
717
808
|
function _array_with_holes$3(arr) {
|
|
718
809
|
if (Array.isArray(arr)) return arr;
|
|
719
810
|
}
|
|
811
|
+
function _array_without_holes$7(arr) {
|
|
812
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
813
|
+
}
|
|
720
814
|
function _assert_this_initialized$4(self) {
|
|
721
815
|
if (self === void 0) {
|
|
722
816
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -806,6 +900,9 @@ function _inherits$4(subClass, superClass) {
|
|
|
806
900
|
});
|
|
807
901
|
if (superClass) _set_prototype_of$4(subClass, superClass);
|
|
808
902
|
}
|
|
903
|
+
function _iterable_to_array$7(iter) {
|
|
904
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
905
|
+
}
|
|
809
906
|
function _iterable_to_array_limit$3(arr, i) {
|
|
810
907
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
811
908
|
if (_i == null) return;
|
|
@@ -833,6 +930,9 @@ function _iterable_to_array_limit$3(arr, i) {
|
|
|
833
930
|
function _non_iterable_rest$3() {
|
|
834
931
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
835
932
|
}
|
|
933
|
+
function _non_iterable_spread$7() {
|
|
934
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
935
|
+
}
|
|
836
936
|
function _object_spread$f(target) {
|
|
837
937
|
for(var i = 1; i < arguments.length; i++){
|
|
838
938
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -864,6 +964,9 @@ function _set_prototype_of$4(o, p) {
|
|
|
864
964
|
function _sliced_to_array$3(arr, i) {
|
|
865
965
|
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$3();
|
|
866
966
|
}
|
|
967
|
+
function _to_consumable_array$7(arr) {
|
|
968
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$7();
|
|
969
|
+
}
|
|
867
970
|
function _type_of$5(obj) {
|
|
868
971
|
"@swc/helpers - typeof";
|
|
869
972
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -1071,6 +1174,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1071
1174
|
{
|
|
1072
1175
|
/**
|
|
1073
1176
|
* Generates a random numeric string for use as a temporary reset password.
|
|
1177
|
+
*
|
|
1178
|
+
* @returns A random numeric string suitable as a temporary password.
|
|
1074
1179
|
*/ key: "_generateResetPasswordKey",
|
|
1075
1180
|
value: function _generateResetPasswordKey() {
|
|
1076
1181
|
return String(DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR());
|
|
@@ -1251,6 +1356,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1251
1356
|
*
|
|
1252
1357
|
* @param roles - The complete set of roles to assign.
|
|
1253
1358
|
* @param claimsToRetain - Additional claims to merge in alongside the role-derived claims.
|
|
1359
|
+
* @returns Resolves when the claims have been replaced.
|
|
1254
1360
|
*
|
|
1255
1361
|
* @example
|
|
1256
1362
|
* ```typescript
|
|
@@ -1261,7 +1367,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1261
1367
|
return _async_to_generator$b(function() {
|
|
1262
1368
|
var claims;
|
|
1263
1369
|
return _ts_generator$b(this, function(_state) {
|
|
1264
|
-
claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(
|
|
1370
|
+
claims = _object_spread$f({}, claimsToRetain, this._claimsForRolesChange(_to_consumable_array$7(roles)));
|
|
1265
1371
|
return [
|
|
1266
1372
|
2,
|
|
1267
1373
|
this.setClaims(claims)
|
|
@@ -1274,6 +1380,9 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1274
1380
|
/**
|
|
1275
1381
|
* Converts roles to their corresponding claim keys, filtering out null/undefined entries
|
|
1276
1382
|
* that represent unrelated claims in the service's {@link FirebaseServerAuthService.claimsForRoles} output.
|
|
1383
|
+
*
|
|
1384
|
+
* @param roles - The roles to convert to claims.
|
|
1385
|
+
* @returns Filtered claims object with only the relevant role-based entries.
|
|
1277
1386
|
*/ key: "_claimsForRolesChange",
|
|
1278
1387
|
value: function _claimsForRolesChange(roles) {
|
|
1279
1388
|
return filterNullAndUndefinedValues(this.service.claimsForRoles(asSet(roles)));
|
|
@@ -1302,12 +1411,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1302
1411
|
];
|
|
1303
1412
|
case 1:
|
|
1304
1413
|
currentClaims = _state.sent();
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
newClaims = filterNullAndUndefinedValues(newClaims);
|
|
1308
|
-
} else {
|
|
1309
|
-
newClaims = claims;
|
|
1310
|
-
}
|
|
1414
|
+
newClaims = _object_spread$f({}, currentClaims, filterUndefinedValues(claims, false));
|
|
1415
|
+
newClaims = filterNullAndUndefinedValues(newClaims);
|
|
1311
1416
|
return [
|
|
1312
1417
|
2,
|
|
1313
1418
|
this.setClaims(newClaims)
|
|
@@ -1436,6 +1541,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1436
1541
|
*
|
|
1437
1542
|
* @param authService - The auth service to create a context from if needed.
|
|
1438
1543
|
* @param userContextOrUid - A user context or UID string.
|
|
1544
|
+
* @returns The resolved user context instance.
|
|
1439
1545
|
*
|
|
1440
1546
|
* @example
|
|
1441
1547
|
* ```typescript
|
|
@@ -1619,6 +1725,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1619
1725
|
3,
|
|
1620
1726
|
7
|
|
1621
1727
|
];
|
|
1728
|
+
// Cast to string | undefined because claims are cast from raw custom claims which may not have this field at runtime
|
|
1622
1729
|
setupCommunicationAt = setupDetails.claims.setupCommunicationAt;
|
|
1623
1730
|
hasSentCommunication = Boolean(setupCommunicationAt);
|
|
1624
1731
|
if (!((config === null || config === void 0 ? void 0 : config.sendSetupDetailsOnce) && hasSentCommunication)) return [
|
|
@@ -1626,7 +1733,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1626
1733
|
2
|
|
1627
1734
|
];
|
|
1628
1735
|
// do not send.
|
|
1629
|
-
if (config
|
|
1736
|
+
if (config.throwErrors) {
|
|
1630
1737
|
throw new FirebaseServerAuthNewUserSendSetupDetailsSendOnceError();
|
|
1631
1738
|
}
|
|
1632
1739
|
return [
|
|
@@ -1756,6 +1863,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1756
1863
|
key: "updateSetupContentSentTime",
|
|
1757
1864
|
value: /**
|
|
1758
1865
|
* Records the current timestamp as the last setup content communication date in the user's claims.
|
|
1866
|
+
*
|
|
1867
|
+
* @param details - The user's setup details containing the user context.
|
|
1759
1868
|
*/ function updateSetupContentSentTime(details) {
|
|
1760
1869
|
return _async_to_generator$b(function() {
|
|
1761
1870
|
var setupCommunicationAt;
|
|
@@ -1822,6 +1931,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1822
1931
|
*
|
|
1823
1932
|
* Generates a random setup password if none is provided. Override to customize user creation behavior.
|
|
1824
1933
|
*
|
|
1934
|
+
* @param input - The initialization configuration for the new user.
|
|
1935
|
+
* @returns The created user record and the setup password used.
|
|
1825
1936
|
* @throws Throws if the Firebase Admin SDK rejects the user creation.
|
|
1826
1937
|
*/ function createNewUser(input) {
|
|
1827
1938
|
return _async_to_generator$b(function() {
|
|
@@ -1858,7 +1969,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1858
1969
|
case 3:
|
|
1859
1970
|
e = _state.sent();
|
|
1860
1971
|
firebaseError = e;
|
|
1861
|
-
errorCode = firebaseError
|
|
1972
|
+
errorCode = firebaseError.code;
|
|
1862
1973
|
if (errorCode === FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR && phoneNumber) {
|
|
1863
1974
|
throw new FirebaseServerAuthUserExistsError(errorCode, 'phone', phoneNumber);
|
|
1864
1975
|
} else if (errorCode === FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR && email) {
|
|
@@ -1890,6 +2001,8 @@ function _ts_generator$b(thisArg, body) {
|
|
|
1890
2001
|
key: "updateClaimsToClearUser",
|
|
1891
2002
|
value: /**
|
|
1892
2003
|
* Clears setup-related claims (setup password and last communication date) from the user.
|
|
2004
|
+
*
|
|
2005
|
+
* @param userContext - The user context to clear setup claims from.
|
|
1893
2006
|
*/ function updateClaimsToClearUser(userContext) {
|
|
1894
2007
|
return _async_to_generator$b(function() {
|
|
1895
2008
|
var _obj;
|
|
@@ -2095,6 +2208,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
2095
2208
|
* Creates a NestJS provider that binds the given config to the {@link FIREBASE_SERVER_ENV_TOKEN} injection token.
|
|
2096
2209
|
*
|
|
2097
2210
|
* @param env - The Firebase server environment configuration.
|
|
2211
|
+
* @returns A NestJS provider binding the config to the {@link FIREBASE_SERVER_ENV_TOKEN} token.
|
|
2098
2212
|
*
|
|
2099
2213
|
* @example
|
|
2100
2214
|
* ```typescript
|
|
@@ -2113,6 +2227,7 @@ function _ts_generator$b(thisArg, body) {
|
|
|
2113
2227
|
* Use this when the NestJS app needs the config accessible via either token.
|
|
2114
2228
|
*
|
|
2115
2229
|
* @param env - The Firebase server environment configuration.
|
|
2230
|
+
* @returns An array of providers binding the config to both Firebase and base server env tokens.
|
|
2116
2231
|
*
|
|
2117
2232
|
* @example
|
|
2118
2233
|
* ```typescript
|
|
@@ -2154,6 +2269,7 @@ function _class_call_check$m(instance, Constructor) {
|
|
|
2154
2269
|
* Each field in the input maps to an atomic increment operation. Null/undefined values default to 0.
|
|
2155
2270
|
*
|
|
2156
2271
|
* @param input - The increment specification mapping field names to numeric deltas.
|
|
2272
|
+
* @returns Firestore {@link UpdateData} with atomic increment operations.
|
|
2157
2273
|
*
|
|
2158
2274
|
* @example
|
|
2159
2275
|
* ```typescript
|
|
@@ -2226,6 +2342,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
2226
2342
|
* Google Cloud Firestore's {@link FieldValue.arrayUnion} and {@link FieldValue.arrayRemove}.
|
|
2227
2343
|
*
|
|
2228
2344
|
* @param input - The array update specification with `union` and/or `remove` field maps.
|
|
2345
|
+
* @returns Firestore {@link UpdateData} with array union/remove operations.
|
|
2229
2346
|
*
|
|
2230
2347
|
* @example
|
|
2231
2348
|
* ```typescript
|
|
@@ -2235,8 +2352,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
|
|
|
2235
2352
|
* });
|
|
2236
2353
|
* ```
|
|
2237
2354
|
*/ function firestoreServerArrayUpdateToUpdateData(input) {
|
|
2238
|
-
var union = input
|
|
2239
|
-
var remove = input
|
|
2355
|
+
var union = input.union;
|
|
2356
|
+
var remove = input.remove;
|
|
2240
2357
|
function createUpdatesWithArrayFunction(fieldUpdate, arrayUpdateFunction) {
|
|
2241
2358
|
var result;
|
|
2242
2359
|
if (fieldUpdate) {
|
|
@@ -2370,7 +2487,7 @@ function _define_property$p(obj, key, value) {
|
|
|
2370
2487
|
key: "update",
|
|
2371
2488
|
value: function update(data, params) {
|
|
2372
2489
|
if ((params === null || params === void 0 ? void 0 : params.precondition) != null) {
|
|
2373
|
-
this.batch.update(this.documentRef, data, params
|
|
2490
|
+
this.batch.update(this.documentRef, data, params.precondition);
|
|
2374
2491
|
} else {
|
|
2375
2492
|
this.batch.update(this.documentRef, data);
|
|
2376
2493
|
}
|
|
@@ -2387,6 +2504,7 @@ function _define_property$p(obj, key, value) {
|
|
|
2387
2504
|
* the batch applies all queued writes atomically.
|
|
2388
2505
|
*
|
|
2389
2506
|
* @param writeBatch - The Google Cloud WriteBatch to queue operations into.
|
|
2507
|
+
* @returns A factory that creates batch-backed accessors sharing the given WriteBatch.
|
|
2390
2508
|
*
|
|
2391
2509
|
* @example
|
|
2392
2510
|
* ```typescript
|
|
@@ -2429,6 +2547,9 @@ function _define_property$p(obj, key, value) {
|
|
|
2429
2547
|
}();
|
|
2430
2548
|
/**
|
|
2431
2549
|
* Creates a {@link WriteBatchFirestoreDocumentContext} wrapping the given batch.
|
|
2550
|
+
*
|
|
2551
|
+
* @param batch - The Google Cloud WriteBatch to use.
|
|
2552
|
+
* @returns A new {@link WriteBatchFirestoreDocumentContext} for the given batch.
|
|
2432
2553
|
*/ function writeBatchDocumentContext(batch) {
|
|
2433
2554
|
return new WriteBatchFirestoreDocumentContext(batch);
|
|
2434
2555
|
}
|
|
@@ -2555,6 +2676,8 @@ function _define_property$o(obj, key, value) {
|
|
|
2555
2676
|
/**
|
|
2556
2677
|
* Creates a {@link FirestoreDocumentDataAccessorFactory} that produces default (non-batched, non-transactional) accessors.
|
|
2557
2678
|
*
|
|
2679
|
+
* @returns A factory that creates default (non-batched, non-transactional) accessors.
|
|
2680
|
+
*
|
|
2558
2681
|
* @example
|
|
2559
2682
|
* ```typescript
|
|
2560
2683
|
* const factory = defaultFirestoreAccessorFactory<User>();
|
|
@@ -2572,6 +2695,8 @@ function _define_property$o(obj, key, value) {
|
|
|
2572
2695
|
* Creates a {@link FirestoreDocumentContext} with no special execution context (no batch, no transaction).
|
|
2573
2696
|
*
|
|
2574
2697
|
* Operations performed through this context execute immediately against Firestore.
|
|
2698
|
+
*
|
|
2699
|
+
* @returns A {@link FirestoreDocumentContext} for direct Firestore operations.
|
|
2575
2700
|
*/ function defaultFirestoreDocumentContext() {
|
|
2576
2701
|
return {
|
|
2577
2702
|
contextType: FirestoreDocumentContextType.NONE,
|
|
@@ -2701,7 +2826,7 @@ function _define_property$n(obj, key, value) {
|
|
|
2701
2826
|
key: "update",
|
|
2702
2827
|
value: function update(data, params) {
|
|
2703
2828
|
if (params === null || params === void 0 ? void 0 : params.precondition) {
|
|
2704
|
-
this.transaction.update(this.documentRef, data, params
|
|
2829
|
+
this.transaction.update(this.documentRef, data, params.precondition);
|
|
2705
2830
|
} else {
|
|
2706
2831
|
this.transaction.update(this.documentRef, data);
|
|
2707
2832
|
}
|
|
@@ -2718,6 +2843,7 @@ function _define_property$n(obj, key, value) {
|
|
|
2718
2843
|
* atomic operation.
|
|
2719
2844
|
*
|
|
2720
2845
|
* @param transaction - The Google Cloud Transaction to execute operations within.
|
|
2846
|
+
* @returns A factory that creates transaction-backed accessors sharing the given transaction.
|
|
2721
2847
|
*
|
|
2722
2848
|
* @example
|
|
2723
2849
|
* ```typescript
|
|
@@ -2761,6 +2887,9 @@ function _define_property$n(obj, key, value) {
|
|
|
2761
2887
|
}();
|
|
2762
2888
|
/**
|
|
2763
2889
|
* Creates a {@link TransactionFirestoreDocumentContext} wrapping the given transaction.
|
|
2890
|
+
*
|
|
2891
|
+
* @param transaction - The Google Cloud Transaction to use.
|
|
2892
|
+
* @returns A new {@link TransactionFirestoreDocumentContext} for the given transaction.
|
|
2764
2893
|
*/ function transactionDocumentContext(transaction) {
|
|
2765
2894
|
return new TransactionFirestoreDocumentContext(transaction);
|
|
2766
2895
|
}
|
|
@@ -2947,6 +3076,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2947
3076
|
* @param start - A Firestore object that can resolve collection paths (e.g., Firestore instance, DocumentReference).
|
|
2948
3077
|
* @param path - The initial collection path.
|
|
2949
3078
|
* @param pathSegments - Optional pairs of [docId, collectionName] for subcollection traversal.
|
|
3079
|
+
* @returns The resolved {@link CollectionReference} at the given path.
|
|
2950
3080
|
* @throws Error if pathSegments length is odd (segments must come in pairs).
|
|
2951
3081
|
*
|
|
2952
3082
|
* @example
|
|
@@ -2957,7 +3087,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2957
3087
|
*/ function collectionRefForPath(start, path, pathSegments) {
|
|
2958
3088
|
var ref = start.collection(path);
|
|
2959
3089
|
if (pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) {
|
|
2960
|
-
if (
|
|
3090
|
+
if (pathSegments.length % 2 !== 0) {
|
|
2961
3091
|
throw new Error('Invalid number of path segments provided for collection. Path: "'.concat(path, '" + "').concat(pathSegments, '"'));
|
|
2962
3092
|
}
|
|
2963
3093
|
var batches = batch(pathSegments, 2); // batch to tuple [string, string]
|
|
@@ -2977,6 +3107,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2977
3107
|
* @param start - A Firestore object that can resolve document paths (e.g., CollectionReference).
|
|
2978
3108
|
* @param path - Optional document ID or path within the collection.
|
|
2979
3109
|
* @param pathSegments - Optional pairs of [collectionName, docId] for subcollection traversal.
|
|
3110
|
+
* @returns The resolved {@link DocumentReference} at the given path.
|
|
2980
3111
|
*
|
|
2981
3112
|
* @example
|
|
2982
3113
|
* ```typescript
|
|
@@ -3001,6 +3132,8 @@ function _ts_generator$a(thisArg, body) {
|
|
|
3001
3132
|
* Implements document/collection resolution, transaction/batch factories, and context factories
|
|
3002
3133
|
* using the `@google-cloud/firestore` library.
|
|
3003
3134
|
*
|
|
3135
|
+
* @returns A {@link FirestoreAccessorDriver} for the Google Cloud Admin SDK.
|
|
3136
|
+
*
|
|
3004
3137
|
* @example
|
|
3005
3138
|
* ```typescript
|
|
3006
3139
|
* const accessorDriver = googleCloudFirestoreAccessorDriver();
|
|
@@ -3035,18 +3168,10 @@ function _ts_generator$a(thisArg, body) {
|
|
|
3035
3168
|
return function(fn) {
|
|
3036
3169
|
return _async_to_generator$a(function() {
|
|
3037
3170
|
return _ts_generator$a(this, function(_state) {
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
firestore.runTransaction(fn)
|
|
3043
|
-
];
|
|
3044
|
-
case 1:
|
|
3045
|
-
return [
|
|
3046
|
-
2,
|
|
3047
|
-
_state.sent()
|
|
3048
|
-
];
|
|
3049
|
-
}
|
|
3171
|
+
return [
|
|
3172
|
+
2,
|
|
3173
|
+
firestore.runTransaction(fn)
|
|
3174
|
+
];
|
|
3050
3175
|
});
|
|
3051
3176
|
})();
|
|
3052
3177
|
};
|
|
@@ -3171,6 +3296,8 @@ var _obj;
|
|
|
3171
3296
|
* Creates a {@link FirestoreQueryConstraintFunctionsDriver} for the Google Cloud Firestore server SDK.
|
|
3172
3297
|
*
|
|
3173
3298
|
* Translates abstract query constraints into Google Cloud Firestore query builder calls.
|
|
3299
|
+
*
|
|
3300
|
+
* @returns A {@link FirestoreQueryConstraintFunctionsDriver} for the server SDK.
|
|
3174
3301
|
*/ function firestoreClientQueryConstraintFunctionsDriver() {
|
|
3175
3302
|
return makeFirestoreQueryConstraintFunctionsDriver({
|
|
3176
3303
|
mapping: FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING,
|
|
@@ -3192,6 +3319,8 @@ var _obj;
|
|
|
3192
3319
|
* streaming (streamDocs) via `onSnapshot`. Transaction-aware reads are supported
|
|
3193
3320
|
* through the optional transaction parameter in `getDocs`.
|
|
3194
3321
|
*
|
|
3322
|
+
* @returns A complete {@link FirestoreQueryDriver} for the Google Cloud Admin SDK.
|
|
3323
|
+
*
|
|
3195
3324
|
* @example
|
|
3196
3325
|
* ```typescript
|
|
3197
3326
|
* const queryDriver = googleCloudFirestoreQueryDriver();
|
|
@@ -3226,6 +3355,8 @@ var _obj;
|
|
|
3226
3355
|
*
|
|
3227
3356
|
* Bundles the server-side accessor driver and query driver, identified as `@google-cloud/firestore`.
|
|
3228
3357
|
*
|
|
3358
|
+
* @returns A complete set of {@link FirestoreDrivers} for the Google Cloud Admin SDK.
|
|
3359
|
+
*
|
|
3229
3360
|
* @example
|
|
3230
3361
|
* ```typescript
|
|
3231
3362
|
* const drivers = googleCloudFirestoreDrivers();
|
|
@@ -3436,6 +3567,7 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3436
3567
|
/**
|
|
3437
3568
|
* Asserts that the callable context contains auth data with a valid UID.
|
|
3438
3569
|
*
|
|
3570
|
+
* @param context - The callable context to check for auth data.
|
|
3439
3571
|
* @throws {HttpsError} Throws unauthenticated error if no auth data is present.
|
|
3440
3572
|
*
|
|
3441
3573
|
* @example
|
|
@@ -3453,13 +3585,15 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3453
3585
|
*
|
|
3454
3586
|
* @param document - The Firestore document to load data from.
|
|
3455
3587
|
* @param message - Optional custom error message.
|
|
3588
|
+
* @returns The document's snapshot data.
|
|
3456
3589
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
|
|
3457
3590
|
*
|
|
3458
3591
|
* @example
|
|
3459
3592
|
* ```typescript
|
|
3460
3593
|
* const userData = await assertSnapshotData(userDocument);
|
|
3461
3594
|
* ```
|
|
3462
|
-
*/
|
|
3595
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3596
|
+
function assertSnapshotData(document, message) {
|
|
3463
3597
|
return _async_to_generator$9(function() {
|
|
3464
3598
|
var data;
|
|
3465
3599
|
return _ts_generator$9(this, function(_state) {
|
|
@@ -3491,8 +3625,10 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3491
3625
|
*
|
|
3492
3626
|
* @param document - The Firestore document to load data from.
|
|
3493
3627
|
* @param message - Optional custom error message.
|
|
3628
|
+
* @returns The document's snapshot data with `id` and `key` attached.
|
|
3494
3629
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
|
|
3495
|
-
*/
|
|
3630
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3631
|
+
function assertSnapshotDataWithKey(document, message) {
|
|
3496
3632
|
return _async_to_generator$9(function() {
|
|
3497
3633
|
var data;
|
|
3498
3634
|
return _ts_generator$9(this, function(_state) {
|
|
@@ -3518,7 +3654,8 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3518
3654
|
* @param document - The Firestore document to check.
|
|
3519
3655
|
* @param message - Optional custom error message.
|
|
3520
3656
|
* @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document does not exist.
|
|
3521
|
-
*/
|
|
3657
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3658
|
+
function assertDocumentExists(document, message) {
|
|
3522
3659
|
return _async_to_generator$9(function() {
|
|
3523
3660
|
var exists;
|
|
3524
3661
|
return _ts_generator$9(this, function(_state) {
|
|
@@ -3544,7 +3681,12 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3544
3681
|
* Creates a {@link modelNotAvailableError} for the given document's model type.
|
|
3545
3682
|
*
|
|
3546
3683
|
* Used by {@link assertDocumentExists} and other assertion functions.
|
|
3547
|
-
|
|
3684
|
+
*
|
|
3685
|
+
* @param document - The document (or object with `modelType`) to generate the error for.
|
|
3686
|
+
* @param message - Optional custom error message.
|
|
3687
|
+
* @returns A {@link modelNotAvailableError} with the document's model type in the message.
|
|
3688
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirestoreDocument generic requires any for proper type inference
|
|
3689
|
+
function documentModelNotAvailableError(document, message) {
|
|
3548
3690
|
return modelNotAvailableError({
|
|
3549
3691
|
message: message !== null && message !== void 0 ? message : "The ".concat(document.modelType, " was unavailable.")
|
|
3550
3692
|
});
|
|
@@ -3555,6 +3697,8 @@ function _ts_generator$9(thisArg, body) {
|
|
|
3555
3697
|
*/ var PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE = 'PHONE_NUMBER_ALREADY_EXISTS';
|
|
3556
3698
|
/**
|
|
3557
3699
|
* Creates a precondition conflict (409) error indicating the phone number already exists.
|
|
3700
|
+
*
|
|
3701
|
+
* @returns A new precondition-conflict (409) {@link HttpsError} with the phone-number-exists code.
|
|
3558
3702
|
*/ function phoneNumberAlreadyExistsError() {
|
|
3559
3703
|
return preconditionConflictError({
|
|
3560
3704
|
code: PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE,
|
|
@@ -3638,7 +3782,10 @@ function _class_call_check$h(instance, Constructor) {
|
|
|
3638
3782
|
* Creates a default no-op {@link FirebaseServerAnalyticsServiceListener}.
|
|
3639
3783
|
*
|
|
3640
3784
|
* Used when no analytics provider is configured. All methods are no-ops.
|
|
3785
|
+
*
|
|
3786
|
+
* @returns A no-op listener that silently discards all analytics events.
|
|
3641
3787
|
*/ function noopFirebaseServerAnalyticsServiceListener() {
|
|
3788
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3642
3789
|
var noop = function noop() {};
|
|
3643
3790
|
return {
|
|
3644
3791
|
handleOnCallAnalyticsEvent: noop,
|
|
@@ -3946,6 +4093,9 @@ function _ts_generator$8(thisArg, body) {
|
|
|
3946
4093
|
* emitter('triggered').sendEventType('Handler Starting');
|
|
3947
4094
|
* emitter('success').sendEvent('Widget Created', { id: result.id });
|
|
3948
4095
|
* ```
|
|
4096
|
+
*
|
|
4097
|
+
* @param config - The service and context to bind to the emitter factory.
|
|
4098
|
+
* @returns A factory function that creates lifecycle-stage-specific emitters.
|
|
3949
4099
|
*/ function onCallAnalyticsEmitterInstance(config) {
|
|
3950
4100
|
var service = config.service, context = config.context;
|
|
3951
4101
|
return function(lifecycle) {
|
|
@@ -3953,6 +4103,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
3953
4103
|
service: service,
|
|
3954
4104
|
context: context,
|
|
3955
4105
|
lifecycle: lifecycle,
|
|
4106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3956
4107
|
sendEvent: function sendEvent(event, properties) {
|
|
3957
4108
|
service.handleOnCallAnalyticsEvent({
|
|
3958
4109
|
event: event,
|
|
@@ -4152,22 +4303,34 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4152
4303
|
// MARK: Type Guards
|
|
4153
4304
|
/**
|
|
4154
4305
|
* Whether the details are specifier-level (has specifiers map).
|
|
4306
|
+
*
|
|
4307
|
+
* @param details - The API details to check.
|
|
4308
|
+
* @returns True if the details contain a specifiers map.
|
|
4155
4309
|
*/ function isOnCallModelTypeApiDetails(details) {
|
|
4156
4310
|
return details != null && 'specifiers' in details;
|
|
4157
4311
|
}
|
|
4158
4312
|
/**
|
|
4159
4313
|
* Whether the details are CRUD-model-level (has modelTypes map).
|
|
4314
|
+
*
|
|
4315
|
+
* @param details - The API details to check.
|
|
4316
|
+
* @returns True if the details contain a modelTypes map.
|
|
4160
4317
|
*/ function isOnCallCrudModelApiDetails(details) {
|
|
4161
4318
|
return details != null && 'modelTypes' in details;
|
|
4162
4319
|
}
|
|
4163
4320
|
/**
|
|
4164
4321
|
* Whether the details are handler-level (leaf node — no specifiers or modelTypes).
|
|
4322
|
+
*
|
|
4323
|
+
* @param details - The API details to check.
|
|
4324
|
+
* @returns True if the details are handler-level (no specifiers or modelTypes).
|
|
4165
4325
|
*/ function isOnCallHandlerApiDetails(details) {
|
|
4166
4326
|
return details != null && !('specifiers' in details) && !('modelTypes' in details);
|
|
4167
4327
|
}
|
|
4168
4328
|
/**
|
|
4169
4329
|
* Whether the specifier-level details represent a true specifier (multiple sub-operations)
|
|
4170
4330
|
* vs a wrapped direct handler (`isSpecifier: false`, details under `_`).
|
|
4331
|
+
*
|
|
4332
|
+
* @param details - The specifier-level API details to check.
|
|
4333
|
+
* @returns True if the details represent a true specifier with multiple sub-operations.
|
|
4171
4334
|
*/ function isActualSpecifier(details) {
|
|
4172
4335
|
return details.isSpecifier;
|
|
4173
4336
|
}
|
|
@@ -4200,7 +4363,11 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4200
4363
|
* fn: async (request) => { ... }
|
|
4201
4364
|
* });
|
|
4202
4365
|
* ```
|
|
4203
|
-
|
|
4366
|
+
*
|
|
4367
|
+
* @param config - The API details configuration including the handler function.
|
|
4368
|
+
* @returns The handler function with _apiDetails attached.
|
|
4369
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4370
|
+
function withApiDetails(config) {
|
|
4204
4371
|
var optionalAuth = config.optionalAuth, fn = config.fn, apiDetails = _object_without_properties(config, [
|
|
4205
4372
|
"optionalAuth",
|
|
4206
4373
|
"fn"
|
|
@@ -4214,6 +4381,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4214
4381
|
// MARK: Aggregation Utilities
|
|
4215
4382
|
/**
|
|
4216
4383
|
* Reads _apiDetails from a function if present.
|
|
4384
|
+
*
|
|
4385
|
+
* @param fn - The function or object that may carry _apiDetails.
|
|
4386
|
+
* @returns The API details if present, otherwise undefined.
|
|
4217
4387
|
*/ function readApiDetails(fn) {
|
|
4218
4388
|
return fn === null || fn === void 0 ? void 0 : fn._apiDetails;
|
|
4219
4389
|
}
|
|
@@ -4221,6 +4391,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4221
4391
|
* Aggregates _apiDetails from a specifier handler config object.
|
|
4222
4392
|
*
|
|
4223
4393
|
* Returns OnCallModelTypeApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
4394
|
+
*
|
|
4395
|
+
* @param config - Map of specifier keys to handler functions.
|
|
4396
|
+
* @returns Aggregated specifier-level API details, or undefined if no handlers have _apiDetails.
|
|
4224
4397
|
*/ function aggregateSpecifierApiDetails(config) {
|
|
4225
4398
|
var specifiers = {};
|
|
4226
4399
|
var hasAny = false;
|
|
@@ -4258,6 +4431,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4258
4431
|
* Aggregates _apiDetails from a model type map (used by onCallCreateModel, etc.).
|
|
4259
4432
|
*
|
|
4260
4433
|
* Returns OnCallCrudModelApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
4434
|
+
*
|
|
4435
|
+
* @param map - Map of model type strings to handler functions.
|
|
4436
|
+
* @returns Aggregated CRUD-model-level API details, or undefined if no handlers have _apiDetails.
|
|
4261
4437
|
*/ function aggregateCrudModelApiDetails(map) {
|
|
4262
4438
|
var modelTypes = {};
|
|
4263
4439
|
var hasAny = false;
|
|
@@ -4304,6 +4480,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4304
4480
|
* Aggregates _apiDetails from the top-level call model map.
|
|
4305
4481
|
*
|
|
4306
4482
|
* Returns OnCallModelApiDetails if any CRUD handlers have _apiDetails, otherwise undefined.
|
|
4483
|
+
*
|
|
4484
|
+
* @param map - Map of call type strings to CRUD handler functions.
|
|
4485
|
+
* @returns Aggregated model-level API details, or undefined if no handlers have _apiDetails.
|
|
4307
4486
|
*/ function aggregateModelApiDetails(map) {
|
|
4308
4487
|
var result = {};
|
|
4309
4488
|
var hasAny = false;
|
|
@@ -4370,7 +4549,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4370
4549
|
if (modelDetails == null) {
|
|
4371
4550
|
continue;
|
|
4372
4551
|
}
|
|
4373
|
-
if (!models
|
|
4552
|
+
if (!(modelType in models)) {
|
|
4374
4553
|
models[modelType] = {
|
|
4375
4554
|
calls: {}
|
|
4376
4555
|
};
|
|
@@ -4414,9 +4593,16 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4414
4593
|
/**
|
|
4415
4594
|
* Resolves leaf-level analytics details from the aggregated _apiDetails tree.
|
|
4416
4595
|
*
|
|
4417
|
-
* Walks: call
|
|
4596
|
+
* Walks: call -> modelType -> specifier (if specifier-level), then reads the `analytics`
|
|
4418
4597
|
* field from the handler-level {@link OnCallModelFunctionApiDetails}.
|
|
4419
|
-
|
|
4598
|
+
*
|
|
4599
|
+
* @param apiDetails - The top-level aggregated API details.
|
|
4600
|
+
* @param call - The CRUD operation type to look up.
|
|
4601
|
+
* @param modelType - The Firestore model type to look up.
|
|
4602
|
+
* @param specifier - Optional specifier key for variant handlers.
|
|
4603
|
+
* @returns The analytics details for the resolved handler, or undefined.
|
|
4604
|
+
*/ // eslint-disable-next-line @typescript-eslint/max-params
|
|
4605
|
+
function resolveAnalyticsFromApiDetails(apiDetails, call, modelType, specifier) {
|
|
4420
4606
|
var _apiDetails_call;
|
|
4421
4607
|
var modelDetails = (_apiDetails_call = apiDetails[call]) === null || _apiDetails_call === void 0 ? void 0 : _apiDetails_call.modelTypes[modelType];
|
|
4422
4608
|
if (modelDetails) {
|
|
@@ -4439,6 +4625,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4439
4625
|
* which the client can use to display a meaningful "not found" message. Intended to be
|
|
4440
4626
|
* passed to Firebase permission/existence checking utilities as the
|
|
4441
4627
|
* {@link FirebaseDoesNotExistErrorContextErrorFunction} callback.
|
|
4628
|
+
*
|
|
4629
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
4630
|
+
* @returns A model-not-available HTTP error.
|
|
4442
4631
|
*/ var nestFirebaseDoesNotExistError = function nestFirebaseDoesNotExistError(firebaseContextGrantedModelRoles) {
|
|
4443
4632
|
var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
|
|
4444
4633
|
return modelNotAvailableError({
|
|
@@ -4454,6 +4643,10 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4454
4643
|
* Returns a "forbidden" HTTP error including the document key, model type, and the roles
|
|
4455
4644
|
* that were required but not granted. Intended to be passed to Firebase permission checking
|
|
4456
4645
|
* utilities as the {@link FirebasePermissionErrorContextErrorFunction} callback.
|
|
4646
|
+
*
|
|
4647
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
4648
|
+
* @param roles - The roles that were required but not granted.
|
|
4649
|
+
* @returns A forbidden HTTP error.
|
|
4457
4650
|
*/ var nestFirebaseForbiddenPermissionError = function nestFirebaseForbiddenPermissionError(firebaseContextGrantedModelRoles, roles) {
|
|
4458
4651
|
var _firebaseContextGrantedModelRoles_data, _firebaseContextGrantedModelRoles_data1;
|
|
4459
4652
|
return forbiddenError({
|
|
@@ -4506,7 +4699,8 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4506
4699
|
*
|
|
4507
4700
|
* @param fn
|
|
4508
4701
|
* @param request
|
|
4509
|
-
*/
|
|
4702
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- accepts any nest context and input type for generic auth assertion
|
|
4703
|
+
function assertRequestRequiresAuthForFunction(fn, request) {
|
|
4510
4704
|
if (fn._requireAuth !== false) {
|
|
4511
4705
|
assertIsContextWithAuthData(request);
|
|
4512
4706
|
}
|
|
@@ -4556,13 +4750,15 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4556
4750
|
* fromUpload: updateProfileFromUpload
|
|
4557
4751
|
* });
|
|
4558
4752
|
* ```
|
|
4559
|
-
*/
|
|
4753
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4754
|
+
function onCallSpecifierHandler(config) {
|
|
4560
4755
|
var map = objectToMap(config);
|
|
4561
4756
|
var fn = function fn(request) {
|
|
4562
4757
|
var _request_specifier = request.specifier, specifier = _request_specifier === void 0 ? MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT : _request_specifier;
|
|
4563
4758
|
var handler = map.get(specifier);
|
|
4564
4759
|
if (handler != null) {
|
|
4565
4760
|
assertRequestRequiresAuthForFunction(handler, request);
|
|
4761
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4566
4762
|
return handler(request);
|
|
4567
4763
|
} else {
|
|
4568
4764
|
throw unknownModelCrudFunctionSpecifierError(specifier);
|
|
@@ -4579,6 +4775,9 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4579
4775
|
/**
|
|
4580
4776
|
* Creates a bad-request error indicating the provided specifier is not recognized
|
|
4581
4777
|
* by the current model CRUD handler.
|
|
4778
|
+
*
|
|
4779
|
+
* @param specifier - The unrecognized specifier string.
|
|
4780
|
+
* @returns A bad-request error with UNKNOWN_SPECIFIER_ERROR code.
|
|
4582
4781
|
*/ function unknownModelCrudFunctionSpecifierError(specifier) {
|
|
4583
4782
|
return badRequestError(serverError({
|
|
4584
4783
|
status: 400,
|
|
@@ -4681,8 +4880,7 @@ function _object_spread_props$a(target, source) {
|
|
|
4681
4880
|
}
|
|
4682
4881
|
}
|
|
4683
4882
|
var fn = function fn(request) {
|
|
4684
|
-
var
|
|
4685
|
-
var call = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.call;
|
|
4883
|
+
var call = request.data.call;
|
|
4686
4884
|
if (!call) {
|
|
4687
4885
|
throw onCallModelMissingCallTypeError();
|
|
4688
4886
|
}
|
|
@@ -4690,18 +4888,21 @@ function _object_spread_props$a(target, source) {
|
|
|
4690
4888
|
if (!callFn) {
|
|
4691
4889
|
throw onCallModelUnknownCallTypeError(call);
|
|
4692
4890
|
}
|
|
4693
|
-
var
|
|
4891
|
+
var _request_data = request.data, specifier = _request_data.specifier, modelType = _request_data.modelType;
|
|
4892
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4694
4893
|
var auth = request.auth;
|
|
4894
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4695
4895
|
var context = {
|
|
4696
4896
|
call: call,
|
|
4697
4897
|
modelType: modelType,
|
|
4698
4898
|
specifier: specifier,
|
|
4699
4899
|
uid: auth === null || auth === void 0 ? void 0 : auth.uid,
|
|
4700
4900
|
auth: auth,
|
|
4701
|
-
data:
|
|
4901
|
+
data: request.data.data,
|
|
4702
4902
|
request: request
|
|
4703
4903
|
};
|
|
4704
4904
|
preAssert(context);
|
|
4905
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4705
4906
|
var result;
|
|
4706
4907
|
// Resolve analytics from _apiDetails tree — callWithAnalytics handles undefined details
|
|
4707
4908
|
var analyticsService = getAnalyticsService(request);
|
|
@@ -4727,6 +4928,8 @@ function _object_spread_props$a(target, source) {
|
|
|
4727
4928
|
}
|
|
4728
4929
|
/**
|
|
4729
4930
|
* Creates a bad-request error indicating the `call` field was missing from the request payload.
|
|
4931
|
+
*
|
|
4932
|
+
* @returns A bad-request error with CALL_TYPE_MISSING_ERROR code.
|
|
4730
4933
|
*/ function onCallModelMissingCallTypeError() {
|
|
4731
4934
|
return badRequestError(serverError({
|
|
4732
4935
|
status: 400,
|
|
@@ -4736,6 +4939,9 @@ function _object_spread_props$a(target, source) {
|
|
|
4736
4939
|
}
|
|
4737
4940
|
/**
|
|
4738
4941
|
* Creates a bad-request error indicating the provided `call` type is not recognized.
|
|
4942
|
+
*
|
|
4943
|
+
* @param call - The unrecognized call type string.
|
|
4944
|
+
* @returns A bad-request error with UNKNOWN_CALL_TYPE_ERROR code.
|
|
4739
4945
|
*/ function onCallModelUnknownCallTypeError(call) {
|
|
4740
4946
|
return badRequestError(serverError({
|
|
4741
4947
|
status: 400,
|
|
@@ -4752,14 +4958,16 @@ function _object_spread_props$a(target, source) {
|
|
|
4752
4958
|
* Dispatches to the correct model-type handler from the map, enforces auth requirements,
|
|
4753
4959
|
* runs pre-assertions, and aggregates API details from all handlers for MCP introspection.
|
|
4754
4960
|
*
|
|
4961
|
+
* @param map - Maps model type strings to their handler functions.
|
|
4962
|
+
* @param config - Configuration including call type, crud type, and error factory.
|
|
4963
|
+
* @returns A callable function that dispatches to the correct model-type handler.
|
|
4755
4964
|
* @internal Not intended for direct use outside the model CRUD module.
|
|
4756
4965
|
*/ function _onCallWithCallTypeFunction(map, config) {
|
|
4757
|
-
var callType = config.callType
|
|
4966
|
+
var callType = config.callType, _config_preAssert = config.preAssert, preAssert = _config_preAssert === void 0 ? function() {
|
|
4758
4967
|
return undefined;
|
|
4759
4968
|
} : _config_preAssert, throwOnUnknownModelType = config.throwOnUnknownModelType;
|
|
4760
4969
|
var fn = function fn(request) {
|
|
4761
|
-
var
|
|
4762
|
-
var modelType = (_request_data = request.data) === null || _request_data === void 0 ? void 0 : _request_data.modelType;
|
|
4970
|
+
var modelType = request.data.modelType;
|
|
4763
4971
|
var crudFn = map[modelType];
|
|
4764
4972
|
if (crudFn) {
|
|
4765
4973
|
var specifier = request.data.specifier;
|
|
@@ -4806,15 +5014,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4806
5014
|
*/ function onCallCreateModel(map) {
|
|
4807
5015
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4808
5016
|
var preAssert = config.preAssert;
|
|
5017
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4809
5018
|
return _onCallWithCallTypeFunction(map, {
|
|
4810
5019
|
callType: 'create',
|
|
4811
|
-
crudType: 'create',
|
|
4812
5020
|
preAssert: preAssert,
|
|
4813
5021
|
throwOnUnknownModelType: createModelUnknownModelTypeError
|
|
4814
5022
|
});
|
|
4815
5023
|
}
|
|
4816
5024
|
/**
|
|
4817
5025
|
* Creates a bad-request error indicating the requested model type is not valid for creation.
|
|
5026
|
+
*
|
|
5027
|
+
* @param modelType - The unrecognized model type string.
|
|
5028
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4818
5029
|
*/ function createModelUnknownModelTypeError(modelType) {
|
|
4819
5030
|
return badRequestError(serverError({
|
|
4820
5031
|
status: 400,
|
|
@@ -4846,15 +5057,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4846
5057
|
*/ function onCallReadModel(map) {
|
|
4847
5058
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4848
5059
|
var preAssert = config.preAssert;
|
|
5060
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4849
5061
|
return _onCallWithCallTypeFunction(map, {
|
|
4850
5062
|
callType: 'read',
|
|
4851
|
-
crudType: 'read',
|
|
4852
5063
|
preAssert: preAssert,
|
|
4853
5064
|
throwOnUnknownModelType: readModelUnknownModelTypeError
|
|
4854
5065
|
});
|
|
4855
5066
|
}
|
|
4856
5067
|
/**
|
|
4857
5068
|
* Creates a bad-request error indicating the requested model type is not valid for reading.
|
|
5069
|
+
*
|
|
5070
|
+
* @param modelType - The unrecognized model type string.
|
|
5071
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4858
5072
|
*/ function readModelUnknownModelTypeError(modelType) {
|
|
4859
5073
|
return badRequestError(serverError({
|
|
4860
5074
|
status: 400,
|
|
@@ -4889,15 +5103,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4889
5103
|
*/ function onCallUpdateModel(map) {
|
|
4890
5104
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4891
5105
|
var preAssert = config.preAssert;
|
|
5106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4892
5107
|
return _onCallWithCallTypeFunction(map, {
|
|
4893
5108
|
callType: 'update',
|
|
4894
|
-
crudType: 'update',
|
|
4895
5109
|
preAssert: preAssert,
|
|
4896
5110
|
throwOnUnknownModelType: updateModelUnknownModelTypeError
|
|
4897
5111
|
});
|
|
4898
5112
|
}
|
|
4899
5113
|
/**
|
|
4900
5114
|
* Creates a bad-request error indicating the requested model type is not valid for updating.
|
|
5115
|
+
*
|
|
5116
|
+
* @param modelType - The unrecognized model type string.
|
|
5117
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4901
5118
|
*/ function updateModelUnknownModelTypeError(modelType) {
|
|
4902
5119
|
return badRequestError(serverError({
|
|
4903
5120
|
status: 400,
|
|
@@ -4929,15 +5146,18 @@ function _object_spread_props$a(target, source) {
|
|
|
4929
5146
|
*/ function onCallDeleteModel(map) {
|
|
4930
5147
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4931
5148
|
var preAssert = config.preAssert;
|
|
5149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4932
5150
|
return _onCallWithCallTypeFunction(map, {
|
|
4933
5151
|
callType: 'delete',
|
|
4934
|
-
crudType: 'delete',
|
|
4935
5152
|
preAssert: preAssert,
|
|
4936
5153
|
throwOnUnknownModelType: deleteModelUnknownModelTypeError
|
|
4937
5154
|
});
|
|
4938
5155
|
}
|
|
4939
5156
|
/**
|
|
4940
5157
|
* Creates a bad-request error indicating the requested model type is not valid for deletion.
|
|
5158
|
+
*
|
|
5159
|
+
* @param modelType - The unrecognized model type string.
|
|
5160
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
4941
5161
|
*/ function deleteModelUnknownModelTypeError(modelType) {
|
|
4942
5162
|
return badRequestError(serverError({
|
|
4943
5163
|
status: 400,
|
|
@@ -5251,6 +5471,7 @@ FirebaseServerAnalyticsSegmentModule = __decorate([
|
|
|
5251
5471
|
* Creates a NestJS {@link FactoryProvider} that binds a Firebase Admin app getter to {@link FIREBASE_APP_TOKEN}.
|
|
5252
5472
|
*
|
|
5253
5473
|
* @param useFactory - Factory function returning the Firebase Admin app instance.
|
|
5474
|
+
* @returns A NestJS factory provider for the Firebase Admin app.
|
|
5254
5475
|
*
|
|
5255
5476
|
* @example
|
|
5256
5477
|
* ```typescript
|
|
@@ -5348,6 +5569,9 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5348
5569
|
* Returns two providers: the concrete service and an alias that maps
|
|
5349
5570
|
* `FirebaseServerAuthService` to the concrete token, enabling injection by the abstract type.
|
|
5350
5571
|
*
|
|
5572
|
+
* @param provider - The factory provider configuration for the auth service.
|
|
5573
|
+
* @returns A tuple containing the configured provider and an alias provider.
|
|
5574
|
+
*
|
|
5351
5575
|
* @example
|
|
5352
5576
|
* ```typescript
|
|
5353
5577
|
* const providers = provideFirebaseServerAuthService({
|
|
@@ -5373,6 +5597,9 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5373
5597
|
* Generates NestJS {@link ModuleMetadata} for an app's auth module, including the {@link FirebaseServerAuthModule}
|
|
5374
5598
|
* import and the custom {@link FirebaseServerAuthService} provider.
|
|
5375
5599
|
*
|
|
5600
|
+
* @param config - The module metadata configuration including the service provider.
|
|
5601
|
+
* @returns The merged NestJS module metadata.
|
|
5602
|
+
*
|
|
5376
5603
|
* @example
|
|
5377
5604
|
* ```typescript
|
|
5378
5605
|
* @Module(firebaseServerAuthModuleMetadata({
|
|
@@ -5396,15 +5623,21 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5396
5623
|
/**
|
|
5397
5624
|
* Asserts that the caller has admin privileges in the request.
|
|
5398
5625
|
*
|
|
5626
|
+
* @param request - The callable request to check for admin privileges.
|
|
5399
5627
|
* @throws {HttpsError} Throws forbidden (403) if the caller is not an admin.
|
|
5400
|
-
*/
|
|
5628
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5629
|
+
function assertIsAdminInRequest(request) {
|
|
5401
5630
|
if (!isAdminInRequest(request)) {
|
|
5402
5631
|
throw forbiddenError();
|
|
5403
5632
|
}
|
|
5404
5633
|
}
|
|
5405
5634
|
/**
|
|
5406
5635
|
* Checks whether the caller has admin privileges in the request.
|
|
5407
|
-
|
|
5636
|
+
*
|
|
5637
|
+
* @param request - The callable request to check for admin privileges.
|
|
5638
|
+
* @returns True if the caller has admin privileges.
|
|
5639
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5640
|
+
function isAdminInRequest(request) {
|
|
5408
5641
|
return request.nest.authService.context(request).isAdmin;
|
|
5409
5642
|
}
|
|
5410
5643
|
/**
|
|
@@ -5412,9 +5645,12 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5412
5645
|
*
|
|
5413
5646
|
* If the request data contains a `uid` that differs from the caller's auth UID, admin status is required.
|
|
5414
5647
|
*
|
|
5648
|
+
* @param request - The callable request containing the target UID.
|
|
5649
|
+
* @param requireUid - If true, a UID must be present in the request data.
|
|
5415
5650
|
* @returns The resolved target UID (from request data or auth).
|
|
5416
5651
|
* @throws {HttpsError} Throws forbidden (403) if the caller is not authorized.
|
|
5417
|
-
*/
|
|
5652
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5653
|
+
function assertIsAdminOrTargetUserInRequestData(request, requireUid) {
|
|
5418
5654
|
var _request_data_uid;
|
|
5419
5655
|
var _request_auth;
|
|
5420
5656
|
if (!isAdminOrTargetUserInRequestData(request, requireUid)) {
|
|
@@ -5425,8 +5661,11 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5425
5661
|
/**
|
|
5426
5662
|
* Checks whether the caller is an admin or is targeting their own user record in the request data.
|
|
5427
5663
|
*
|
|
5664
|
+
* @param request - The callable request containing the target UID.
|
|
5428
5665
|
* @param requireUid - If true, a UID must be present in the request data.
|
|
5429
|
-
|
|
5666
|
+
* @returns True if the caller is an admin or is targeting their own user record.
|
|
5667
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5668
|
+
function isAdminOrTargetUserInRequestData(request) {
|
|
5430
5669
|
var requireUid = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
5431
5670
|
var _request_auth;
|
|
5432
5671
|
var uid = request.data.uid;
|
|
@@ -5440,8 +5679,10 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5440
5679
|
/**
|
|
5441
5680
|
* Asserts that the caller has signed the Terms of Service.
|
|
5442
5681
|
*
|
|
5682
|
+
* @param request - The callable request to check for ToS status.
|
|
5443
5683
|
* @throws {HttpsError} Throws forbidden (403) if ToS has not been signed.
|
|
5444
|
-
*/
|
|
5684
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5685
|
+
function assertHasSignedTosInRequest(request) {
|
|
5445
5686
|
if (!hasSignedTosInRequest(request)) {
|
|
5446
5687
|
throw forbiddenError({
|
|
5447
5688
|
message: 'ToS has not been signed.'
|
|
@@ -5450,15 +5691,21 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5450
5691
|
}
|
|
5451
5692
|
/**
|
|
5452
5693
|
* Checks whether the caller has signed the Terms of Service.
|
|
5453
|
-
|
|
5694
|
+
*
|
|
5695
|
+
* @param request - The callable request to check for ToS status.
|
|
5696
|
+
* @returns True if the caller has signed the Terms of Service.
|
|
5697
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5698
|
+
function hasSignedTosInRequest(request) {
|
|
5454
5699
|
return request.nest.authService.context(request).hasSignedTos;
|
|
5455
5700
|
}
|
|
5456
5701
|
/**
|
|
5457
5702
|
* Asserts that the caller has all of the specified auth roles.
|
|
5458
5703
|
*
|
|
5704
|
+
* @param request - The callable request to check for auth roles.
|
|
5459
5705
|
* @param authRoles - One or more roles that must all be present.
|
|
5460
5706
|
* @throws {HttpsError} Throws forbidden (403) if any required role is missing.
|
|
5461
|
-
*/
|
|
5707
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5708
|
+
function assertHasRolesInRequest(request, authRoles) {
|
|
5462
5709
|
if (!hasAuthRolesInRequest(request, authRoles)) {
|
|
5463
5710
|
throw forbiddenError({
|
|
5464
5711
|
message: 'Missing required auth roles.',
|
|
@@ -5470,7 +5717,12 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5470
5717
|
}
|
|
5471
5718
|
/**
|
|
5472
5719
|
* Checks whether the caller has all of the specified auth roles.
|
|
5473
|
-
|
|
5720
|
+
*
|
|
5721
|
+
* @param request - The callable request to check for auth roles.
|
|
5722
|
+
* @param authRoles - One or more roles that must all be present.
|
|
5723
|
+
* @returns True if the caller has all of the specified auth roles.
|
|
5724
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5725
|
+
function hasAuthRolesInRequest(request, authRoles) {
|
|
5474
5726
|
return containsAllValues(request.nest.authService.context(request).authRoles, authRoles);
|
|
5475
5727
|
}
|
|
5476
5728
|
/**
|
|
@@ -5478,8 +5730,10 @@ FirebaseServerAuthModule = __decorate([
|
|
|
5478
5730
|
*
|
|
5479
5731
|
* This may be used to filter out new users that were not invited from finishing their onboarding.
|
|
5480
5732
|
*
|
|
5481
|
-
* @param request
|
|
5482
|
-
|
|
5733
|
+
* @param request - The callable request to check for setup password claims.
|
|
5734
|
+
* @returns True if the claims contain a setup password key.
|
|
5735
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5736
|
+
function hasNewUserSetupPasswordInRequest(request) {
|
|
5483
5737
|
var claims = request.nest.authService.context(request).claims;
|
|
5484
5738
|
return claims[FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY] != null;
|
|
5485
5739
|
}
|
|
@@ -5572,6 +5826,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5572
5826
|
}
|
|
5573
5827
|
/**
|
|
5574
5828
|
* Creates a bad-request error indicating the provided development function specifier is not recognized.
|
|
5829
|
+
*
|
|
5830
|
+
* @param specifier - the unrecognized specifier string from the client request.
|
|
5831
|
+
* @returns A bad-request error with the unknown specifier details.
|
|
5575
5832
|
*/ function developmentUnknownSpecifierError(specifier) {
|
|
5576
5833
|
return badRequestError(serverError({
|
|
5577
5834
|
status: 400,
|
|
@@ -5589,6 +5846,8 @@ function _object_spread_props$7(target, source) {
|
|
|
5589
5846
|
/**
|
|
5590
5847
|
* Creates a bad-request error for when the caller sends a 'run' command
|
|
5591
5848
|
* without specifying which scheduled function to execute.
|
|
5849
|
+
*
|
|
5850
|
+
* @returns A bad-request error indicating the missing run name.
|
|
5592
5851
|
*/ function noRunNameSpecifiedForScheduledFunctionDevelopmentFunction() {
|
|
5593
5852
|
return badRequestError({
|
|
5594
5853
|
code: NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE,
|
|
@@ -5601,6 +5860,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5601
5860
|
/**
|
|
5602
5861
|
* Creates a bad-request error for when the requested scheduled function name
|
|
5603
5862
|
* is not found in the registered function map.
|
|
5863
|
+
*
|
|
5864
|
+
* @param name - the unrecognized function name from the client request.
|
|
5865
|
+
* @returns A bad-request error with the unknown function name details.
|
|
5604
5866
|
*/ function unknownScheduledFunctionDevelopmentFunctionName(name) {
|
|
5605
5867
|
return badRequestError({
|
|
5606
5868
|
code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE,
|
|
@@ -5616,6 +5878,9 @@ function _object_spread_props$7(target, source) {
|
|
|
5616
5878
|
/**
|
|
5617
5879
|
* Creates a bad-request error for when the request `type` field does not match
|
|
5618
5880
|
* any supported operation ('run' or 'list').
|
|
5881
|
+
*
|
|
5882
|
+
* @param type - the unrecognized type value from the client request.
|
|
5883
|
+
* @returns A bad-request error with the unknown type details.
|
|
5619
5884
|
*/ function unknownScheduledFunctionDevelopmentFunctionType(type) {
|
|
5620
5885
|
return badRequestError({
|
|
5621
5886
|
code: UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE,
|
|
@@ -5830,7 +6095,7 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5830
6095
|
var result = [];
|
|
5831
6096
|
forEachKeyValue(allScheduledFunctions, {
|
|
5832
6097
|
forEach: function forEach(x) {
|
|
5833
|
-
var _x = _sliced_to_array(x,
|
|
6098
|
+
var _x = _sliced_to_array(x, 1), functionName = _x[0];
|
|
5834
6099
|
result.push({
|
|
5835
6100
|
name: functionName.toString()
|
|
5836
6101
|
});
|
|
@@ -5847,12 +6112,12 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5847
6112
|
data = request.data;
|
|
5848
6113
|
type = data.type;
|
|
5849
6114
|
switch(type){
|
|
5850
|
-
case
|
|
6115
|
+
case ScheduledFunctionDevelopmentFunctionTypeEnum.RUN:
|
|
5851
6116
|
return [
|
|
5852
6117
|
3,
|
|
5853
6118
|
1
|
|
5854
6119
|
];
|
|
5855
|
-
case
|
|
6120
|
+
case ScheduledFunctionDevelopmentFunctionTypeEnum.LIST:
|
|
5856
6121
|
return [
|
|
5857
6122
|
3,
|
|
5858
6123
|
6
|
|
@@ -5910,8 +6175,6 @@ function _ts_generator$7(thisArg, body) {
|
|
|
5910
6175
|
}
|
|
5911
6176
|
];
|
|
5912
6177
|
case 7:
|
|
5913
|
-
throw unknownScheduledFunctionDevelopmentFunctionType(type);
|
|
5914
|
-
case 8:
|
|
5915
6178
|
return [
|
|
5916
6179
|
2
|
|
5917
6180
|
];
|
|
@@ -6099,8 +6362,10 @@ function _ts_generator$6(thisArg, body) {
|
|
|
6099
6362
|
*
|
|
6100
6363
|
* export const { dev } = devFunctions;
|
|
6101
6364
|
* ```
|
|
6102
|
-
*/
|
|
6365
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic type parameters require `any` for Firebase SDK compatibility
|
|
6366
|
+
function firebaseServerDevFunctions(config) {
|
|
6103
6367
|
var enabled = config.enabled, secure = config.secure, nest = config.nest, developerFunctionsMap = config.developerFunctionsMap, onCallFactory = config.onCallFactory, allScheduledFunctions = config.allScheduledFunctions, disableDevelopmentScheduleFunction = config.disableDevelopmentScheduleFunction;
|
|
6368
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- RunnableHttpFunction supports legacy gen 1 deployments
|
|
6104
6369
|
var dev;
|
|
6105
6370
|
if (enabled) {
|
|
6106
6371
|
var fullFunctionsMap = _object_spread$8({}, developerFunctionsMap);
|
|
@@ -6115,7 +6380,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
6115
6380
|
}
|
|
6116
6381
|
dev = onCallFactory(onCallFunction)(nest);
|
|
6117
6382
|
} else {
|
|
6118
|
-
dev = onCallFactory(function(
|
|
6383
|
+
dev = onCallFactory(function() {
|
|
6119
6384
|
return _async_to_generator$6(function() {
|
|
6120
6385
|
return _ts_generator$6(this, function(_state) {
|
|
6121
6386
|
throw unavailableError({
|
|
@@ -6235,6 +6500,8 @@ function _is_native_reflect_construct$1() {
|
|
|
6235
6500
|
key: "developmentSchedulerEnabled",
|
|
6236
6501
|
get: /**
|
|
6237
6502
|
* Enabled when not in production and not in a testing environment.
|
|
6503
|
+
*
|
|
6504
|
+
* @returns True if the development scheduler should be enabled.
|
|
6238
6505
|
*/ function get() {
|
|
6239
6506
|
return !this.isProduction && !this.isTestingEnv;
|
|
6240
6507
|
}
|
|
@@ -6257,6 +6524,9 @@ DefaultFirebaseServerEnvService = __decorate([
|
|
|
6257
6524
|
*
|
|
6258
6525
|
* Useful for conditionally enabling production-only Cloud Functions (e.g., scheduled tasks).
|
|
6259
6526
|
*
|
|
6527
|
+
* @param nest - getter for the NestJS application context promise.
|
|
6528
|
+
* @returns An async decision function that resolves to `true` in production.
|
|
6529
|
+
*
|
|
6260
6530
|
* @example
|
|
6261
6531
|
* ```typescript
|
|
6262
6532
|
* const isProduction = nestAppIsProductionEnvironment(nestAppGetter);
|
|
@@ -6273,6 +6543,9 @@ DefaultFirebaseServerEnvService = __decorate([
|
|
|
6273
6543
|
* Creates an async decision function that resolves to `true` if the development scheduler is enabled.
|
|
6274
6544
|
*
|
|
6275
6545
|
* The development scheduler is enabled in non-production, non-testing environments.
|
|
6546
|
+
*
|
|
6547
|
+
* @param nest - getter for the NestJS application context promise.
|
|
6548
|
+
* @returns An async decision function that resolves to `true` when the development scheduler is enabled.
|
|
6276
6549
|
*/ function nestAppHasDevelopmentSchedulerEnabled(nest) {
|
|
6277
6550
|
return function() {
|
|
6278
6551
|
return nest().then(function(x) {
|
|
@@ -6369,6 +6642,11 @@ FirebaseServerFirestoreContextModule = __decorate([
|
|
|
6369
6642
|
/**
|
|
6370
6643
|
* Creates a NestJS provider that initializes a Firestore collections instance from the app's {@link FirestoreContext}.
|
|
6371
6644
|
*
|
|
6645
|
+
* @param config - The provide token and factory function configuration.
|
|
6646
|
+
* @param config.provide - The class token to provide.
|
|
6647
|
+
* @param config.useFactory - Factory that creates the collections from a FirestoreContext.
|
|
6648
|
+
* @returns A tuple containing the configured NestJS provider.
|
|
6649
|
+
*
|
|
6372
6650
|
* @example
|
|
6373
6651
|
* ```typescript
|
|
6374
6652
|
* const [provider] = provideAppFirestoreCollections({
|
|
@@ -6392,6 +6670,9 @@ FirebaseServerFirestoreContextModule = __decorate([
|
|
|
6392
6670
|
* Generates NestJS {@link ModuleMetadata} for an app's Firestore module, including the
|
|
6393
6671
|
* {@link FirebaseServerFirestoreContextModule} import and the app's collections provider.
|
|
6394
6672
|
*
|
|
6673
|
+
* @param config - The Firestore collections config plus optional additional module metadata.
|
|
6674
|
+
* @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
|
|
6675
|
+
*
|
|
6395
6676
|
* @example
|
|
6396
6677
|
* ```typescript
|
|
6397
6678
|
* @Module(appFirestoreModuleMetadata({
|
|
@@ -6701,6 +6982,7 @@ function _object_spread_props$4(target, source) {
|
|
|
6701
6982
|
* @param makeNestContext - Factory that creates the typed context from the NestJS application context.
|
|
6702
6983
|
* @returns A factory for creating nest-context-aware event function handlers.
|
|
6703
6984
|
*/ function cloudEventHandlerWithNestContextFactory(makeNestContext) {
|
|
6985
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- CloudEvent generic requires `any` for SDK compatibility
|
|
6704
6986
|
return function(fn) {
|
|
6705
6987
|
return function(nestAppPromiseGetter) {
|
|
6706
6988
|
var handlerBuilder = function handlerBuilder(handler) {
|
|
@@ -7065,6 +7347,8 @@ function _ts_generator$5(thisArg, body) {
|
|
|
7065
7347
|
/**
|
|
7066
7348
|
* Default error logger that writes validation error details to the console.
|
|
7067
7349
|
* Used when `logError` is `true` or omitted in the factory options.
|
|
7350
|
+
*
|
|
7351
|
+
* @param details - the validation error details to log.
|
|
7068
7352
|
*/ var defaultFirebaseServerActionsTransformFactoryLogErrorFunction = function defaultFirebaseServerActionsTransformFactoryLogErrorFunction(details) {
|
|
7069
7353
|
console.log('firebaseServerActionsTransformFactory() encountered validation error: ', details);
|
|
7070
7354
|
};
|
|
@@ -7690,7 +7974,8 @@ function _unsupported_iterable_to_array$2(o, minLen) {
|
|
|
7690
7974
|
builder = (_builder1 = builder).exclude.apply(_builder1, _to_consumable_array$2(excludePatterns));
|
|
7691
7975
|
}
|
|
7692
7976
|
(_builder = builder).forRoutes.apply(_builder, _to_consumable_array$2(forRoutes));
|
|
7693
|
-
|
|
7977
|
+
var excludeInfo = excludePatterns.length > 0 ? " (excluding: ".concat(excludePatterns.join(', '), ")") : '';
|
|
7978
|
+
this.logger.debug("Configured AppCheck middleware for routes: ".concat(forRoutes.join(', ')).concat(excludeInfo));
|
|
7694
7979
|
}
|
|
7695
7980
|
}
|
|
7696
7981
|
]);
|
|
@@ -8128,16 +8413,28 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8128
8413
|
}
|
|
8129
8414
|
/**
|
|
8130
8415
|
* Resolves a Google Cloud Storage {@link Bucket} from a {@link StoragePath}.
|
|
8416
|
+
*
|
|
8417
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8418
|
+
* @param path - the storage path containing the bucket ID.
|
|
8419
|
+
* @returns The resolved Google Cloud Storage bucket.
|
|
8131
8420
|
*/ function googleCloudStorageBucketForStorageFilePath(storage, path) {
|
|
8132
8421
|
return storage.bucket(path.bucketId);
|
|
8133
8422
|
}
|
|
8134
8423
|
/**
|
|
8135
8424
|
* Resolves a Google Cloud Storage {@link GoogleCloudFile} from a {@link StoragePath}.
|
|
8425
|
+
*
|
|
8426
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8427
|
+
* @param path - the storage path containing bucket ID and file path.
|
|
8428
|
+
* @returns The resolved Google Cloud Storage file reference.
|
|
8136
8429
|
*/ function googleCloudStorageFileForStorageFilePath(storage, path) {
|
|
8137
8430
|
return googleCloudStorageBucketForStorageFilePath(storage, path).file(path.pathString);
|
|
8138
8431
|
}
|
|
8139
8432
|
/**
|
|
8140
8433
|
* Converts Google Cloud Storage {@link FileMetadata} into the normalized {@link StorageMetadata} format.
|
|
8434
|
+
*
|
|
8435
|
+
* @param file - the Google Cloud Storage file reference.
|
|
8436
|
+
* @param metadata - the raw file metadata from the Google Cloud SDK.
|
|
8437
|
+
* @returns Normalized storage metadata.
|
|
8141
8438
|
*/ function googleCloudFileMetadataToStorageMetadata(file, metadata) {
|
|
8142
8439
|
var _metadata_generation;
|
|
8143
8440
|
var fullPath = file.name;
|
|
@@ -8168,6 +8465,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8168
8465
|
* and ACL operations for a single file in Google Cloud Storage.
|
|
8169
8466
|
*
|
|
8170
8467
|
* Handles emulator-specific edge cases (e.g., signing errors, atomic move fallback).
|
|
8468
|
+
*
|
|
8469
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8470
|
+
* @param storagePath - the storage path identifying the file's bucket and path.
|
|
8471
|
+
* @returns A file accessor with CRUD, streaming, and ACL operations.
|
|
8171
8472
|
*/ function googleCloudStorageAccessorFile(storage, storagePath) {
|
|
8172
8473
|
var file = googleCloudStorageFileForStorageFilePath(storage, storagePath);
|
|
8173
8474
|
function makeDownloadOptions(maxDownloadSizeBytes) {
|
|
@@ -8178,7 +8479,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8178
8479
|
}
|
|
8179
8480
|
function _configureMetadata(options) {
|
|
8180
8481
|
var _options_metadata, _options_metadata1, _options_metadata2, _options_metadata3, _options_metadata4, _options_metadata5;
|
|
8181
|
-
var customMetadata = filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options
|
|
8482
|
+
var customMetadata = filterUndefinedValues(_object_spread$1({}, (_options_metadata = options.metadata) === null || _options_metadata === void 0 ? void 0 : _options_metadata.customMetadata, options.customMetadata));
|
|
8182
8483
|
return filterUndefinedValues({
|
|
8183
8484
|
cacheControl: (_options_metadata1 = options.metadata) === null || _options_metadata1 === void 0 ? void 0 : _options_metadata1.cacheControl,
|
|
8184
8485
|
contentDisposition: (_options_metadata2 = options.metadata) === null || _options_metadata2 === void 0 ? void 0 : _options_metadata2.contentDisposition,
|
|
@@ -8295,7 +8596,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8295
8596
|
return x[0];
|
|
8296
8597
|
}).catch(function(e) {
|
|
8297
8598
|
var publicUrlBackup;
|
|
8298
|
-
if (e && e.name === 'SigningError' && (isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
|
|
8599
|
+
if (_instanceof(e, Error) && e.name === 'SigningError' && (isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
|
|
8299
8600
|
// NOTE: Signing does not behave properly in the emulator as it is not supported.
|
|
8300
8601
|
// https://github.com/firebase/firebase-tools/issues/3400
|
|
8301
8602
|
// we can return the public url instead.
|
|
@@ -8438,7 +8739,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8438
8739
|
},
|
|
8439
8740
|
copy: copy,
|
|
8440
8741
|
delete: function _delete(options) {
|
|
8441
|
-
return file.delete(options).then(function(
|
|
8742
|
+
return file.delete(options).then(function() {
|
|
8442
8743
|
return undefined;
|
|
8443
8744
|
});
|
|
8444
8745
|
},
|
|
@@ -8472,7 +8773,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8472
8773
|
}
|
|
8473
8774
|
var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
8474
8775
|
hasItems: function hasItems(result) {
|
|
8475
|
-
|
|
8776
|
+
var _result_apiResponse_items;
|
|
8777
|
+
return Boolean((_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : result.apiResponse.prefixes);
|
|
8476
8778
|
},
|
|
8477
8779
|
hasNext: function hasNext(result) {
|
|
8478
8780
|
return result.nextQuery != null;
|
|
@@ -8481,7 +8783,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
|
8481
8783
|
var _result_nextQuery;
|
|
8482
8784
|
return (_result_nextQuery = result.nextQuery) === null || _result_nextQuery === void 0 ? void 0 : _result_nextQuery.pageToken;
|
|
8483
8785
|
},
|
|
8484
|
-
next: function next(
|
|
8786
|
+
next: function next(param, result) {
|
|
8787
|
+
var options = param.options, folder = param.folder;
|
|
8485
8788
|
return folder.list(_object_spread$1({}, options, result.nextQuery));
|
|
8486
8789
|
},
|
|
8487
8790
|
file: function file(storage, fileResult) {
|
|
@@ -8491,9 +8794,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
|
8491
8794
|
return googleCloudStorageAccessorFolder(storage, folderResult.storagePath);
|
|
8492
8795
|
},
|
|
8493
8796
|
filesFromResult: function filesFromResult(result) {
|
|
8494
|
-
var
|
|
8495
|
-
var
|
|
8496
|
-
var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.items) !== null && _ref !== void 0 ? _ref : [];
|
|
8797
|
+
var _result_apiResponse_items;
|
|
8798
|
+
var items = (_result_apiResponse_items = result.apiResponse.items) !== null && _result_apiResponse_items !== void 0 ? _result_apiResponse_items : [];
|
|
8497
8799
|
return items.map(function(x) {
|
|
8498
8800
|
return {
|
|
8499
8801
|
raw: x,
|
|
@@ -8506,9 +8808,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
|
8506
8808
|
});
|
|
8507
8809
|
},
|
|
8508
8810
|
foldersFromResult: function foldersFromResult(result, folder) {
|
|
8509
|
-
var
|
|
8510
|
-
var
|
|
8511
|
-
var items = (_ref = (_result_apiResponse = result.apiResponse) === null || _result_apiResponse === void 0 ? void 0 : _result_apiResponse.prefixes) !== null && _ref !== void 0 ? _ref : [];
|
|
8811
|
+
var _result_apiResponse_prefixes;
|
|
8812
|
+
var items = (_result_apiResponse_prefixes = result.apiResponse.prefixes) !== null && _result_apiResponse_prefixes !== void 0 ? _result_apiResponse_prefixes : [];
|
|
8512
8813
|
return items.map(function(prefix) {
|
|
8513
8814
|
return {
|
|
8514
8815
|
raw: prefix,
|
|
@@ -8524,6 +8825,10 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
|
8524
8825
|
/**
|
|
8525
8826
|
* Creates a {@link GoogleCloudStorageAccessorFolder} that supports checking folder existence
|
|
8526
8827
|
* and listing files/subfolders with pagination.
|
|
8828
|
+
*
|
|
8829
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8830
|
+
* @param storagePath - the storage path identifying the folder's bucket and prefix.
|
|
8831
|
+
* @returns A folder accessor with existence checking and listing operations.
|
|
8527
8832
|
*/ function googleCloudStorageAccessorFolder(storage, storagePath) {
|
|
8528
8833
|
var bucket = googleCloudStorageBucketForStorageFilePath(storage, storagePath);
|
|
8529
8834
|
var file = bucket.file(storagePath.pathString);
|
|
@@ -8567,7 +8872,11 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
|
8567
8872
|
nextQuery: nextQuery,
|
|
8568
8873
|
apiResponse: apiResponse
|
|
8569
8874
|
};
|
|
8570
|
-
return googleCloudStorageListFilesResultFactory(
|
|
8875
|
+
return googleCloudStorageListFilesResultFactory({
|
|
8876
|
+
storage: storage,
|
|
8877
|
+
folder: folder,
|
|
8878
|
+
options: options
|
|
8879
|
+
}, result);
|
|
8571
8880
|
});
|
|
8572
8881
|
}
|
|
8573
8882
|
};
|
|
@@ -8576,6 +8885,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
|
8576
8885
|
/**
|
|
8577
8886
|
* Creates a {@link FirebaseStorageAccessorDriver} for Google Cloud Storage (Admin SDK).
|
|
8578
8887
|
*
|
|
8888
|
+
* @returns A server-side storage accessor driver for Google Cloud Storage.
|
|
8889
|
+
*
|
|
8579
8890
|
* @example
|
|
8580
8891
|
* ```typescript
|
|
8581
8892
|
* const driver = googleCloudStorageFirebaseStorageAccessorDriver();
|
|
@@ -8597,6 +8908,8 @@ var googleCloudStorageListFilesResultFactory = storageListFilesResultFactory({
|
|
|
8597
8908
|
*
|
|
8598
8909
|
* Bundles the server-side storage accessor driver, identified as `@google-cloud/storage`.
|
|
8599
8910
|
*
|
|
8911
|
+
* @returns A complete set of storage drivers for server-side usage.
|
|
8912
|
+
*
|
|
8600
8913
|
* @example
|
|
8601
8914
|
* ```typescript
|
|
8602
8915
|
* const drivers = googleCloudFirebaseStorageDrivers();
|
|
@@ -8698,6 +9011,7 @@ function _define_property$3(obj, key, value) {
|
|
|
8698
9011
|
* Storage wrapper and the raw Google Cloud Storage SDK.
|
|
8699
9012
|
*
|
|
8700
9013
|
* @param storage - The Firebase Admin Storage instance.
|
|
9014
|
+
* @returns The underlying Google Cloud Storage client.
|
|
8701
9015
|
*
|
|
8702
9016
|
* @example
|
|
8703
9017
|
* ```typescript
|
|
@@ -8848,6 +9162,7 @@ FirebaseServerStorageContextModule = __decorate([
|
|
|
8848
9162
|
* Creates a NestJS provider that configures the default storage bucket ID.
|
|
8849
9163
|
*
|
|
8850
9164
|
* @param input - A bucket ID string or full factory config object.
|
|
9165
|
+
* @returns A NestJS provider for the storage context factory config token.
|
|
8851
9166
|
* @throws Error if `defaultBucketId` is empty.
|
|
8852
9167
|
*
|
|
8853
9168
|
* @example
|
|
@@ -8868,6 +9183,8 @@ FirebaseServerStorageContextModule = __decorate([
|
|
|
8868
9183
|
}
|
|
8869
9184
|
/**
|
|
8870
9185
|
* Returns the default provider config that creates a standard {@link FirebaseServerStorageService}.
|
|
9186
|
+
*
|
|
9187
|
+
* @returns The default provider configuration for FirebaseServerStorageService.
|
|
8871
9188
|
*/ function defaultProvideFirebaseServerStorageServiceSimple() {
|
|
8872
9189
|
return {
|
|
8873
9190
|
provide: FirebaseServerStorageService,
|
|
@@ -8881,6 +9198,9 @@ FirebaseServerStorageContextModule = __decorate([
|
|
|
8881
9198
|
*
|
|
8882
9199
|
* If the provider token differs from `FirebaseServerStorageService`, an alias provider is added
|
|
8883
9200
|
* so the service can also be injected by the abstract type.
|
|
9201
|
+
*
|
|
9202
|
+
* @param provider - The storage service provider configuration.
|
|
9203
|
+
* @returns An array of NestJS providers for the storage service.
|
|
8884
9204
|
*/ function provideFirebaseServerStorageService(provider) {
|
|
8885
9205
|
var _provider_inject;
|
|
8886
9206
|
var providers = [
|
|
@@ -8902,13 +9222,17 @@ FirebaseServerStorageContextModule = __decorate([
|
|
|
8902
9222
|
* Generates NestJS {@link ModuleMetadata} for an app's storage module, including the
|
|
8903
9223
|
* {@link FirebaseServerStorageContextModule} import and the storage service provider.
|
|
8904
9224
|
*
|
|
9225
|
+
* @param config - Optional configuration including a custom service provider and additional module metadata.
|
|
9226
|
+
* @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
|
|
9227
|
+
*
|
|
8905
9228
|
* @example
|
|
8906
9229
|
* ```typescript
|
|
8907
9230
|
* @Module(firebaseServerStorageModuleMetadata())
|
|
8908
9231
|
* export class AppStorageModule {}
|
|
8909
9232
|
* ```
|
|
8910
9233
|
*/ function firebaseServerStorageModuleMetadata(config) {
|
|
8911
|
-
var
|
|
9234
|
+
var _ref;
|
|
9235
|
+
var serviceProvider = (_ref = config === null || config === void 0 ? void 0 : config.serviceProvider) !== null && _ref !== void 0 ? _ref : defaultProvideFirebaseServerStorageServiceSimple();
|
|
8912
9236
|
var providers = provideFirebaseServerStorageService(serviceProvider);
|
|
8913
9237
|
var tokensToExport = injectionTokensFromProviders(providers);
|
|
8914
9238
|
return mergeModuleMetadata({
|
|
@@ -9166,6 +9490,9 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9166
9490
|
* times with the same app reuses the existing server. The factory wires up Firebase Admin,
|
|
9167
9491
|
* environment config, storage, AppCheck middleware, and webhook routes based on the config.
|
|
9168
9492
|
*
|
|
9493
|
+
* @param config - Configuration for the NestJS server instance including the root module, providers, and middleware options.
|
|
9494
|
+
* @returns A NestServerInstance that manages server lifecycle for the given module class.
|
|
9495
|
+
*
|
|
9169
9496
|
* @example
|
|
9170
9497
|
* ```typescript
|
|
9171
9498
|
* const instance = nestServerInstance({ moduleClass: AppModule, appCheckEnabled: true });
|
|
@@ -9181,7 +9508,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9181
9508
|
var server = express();
|
|
9182
9509
|
var createNestServer = function createNestServer(expressInstance) {
|
|
9183
9510
|
return _async_to_generator$1(function() {
|
|
9184
|
-
var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp;
|
|
9511
|
+
var _config_defaultStorageBucket, _buildNestServerRootModule, rootModule, globalApiRoutePrefixConfig, options, nestApp, configured;
|
|
9185
9512
|
return _ts_generator$1(this, function(_state) {
|
|
9186
9513
|
switch(_state.label){
|
|
9187
9514
|
case 0:
|
|
@@ -9211,7 +9538,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
9211
9538
|
nestApp = nestApp.setGlobalPrefix(globalApiRoutePrefixConfig.globalApiRoutePrefix, globalApiRoutePrefixConfig);
|
|
9212
9539
|
}
|
|
9213
9540
|
if (configureNestServerInstance) {
|
|
9214
|
-
|
|
9541
|
+
configured = configureNestServerInstance(nestApp);
|
|
9542
|
+
if (configured) {
|
|
9543
|
+
nestApp = configured;
|
|
9544
|
+
}
|
|
9215
9545
|
}
|
|
9216
9546
|
return [
|
|
9217
9547
|
2,
|
|
@@ -9488,14 +9818,21 @@ function _ts_generator(thisArg, body) {
|
|
|
9488
9818
|
{
|
|
9489
9819
|
key: "nest",
|
|
9490
9820
|
get: /**
|
|
9821
|
+
* Returns the NestJS application context.
|
|
9822
|
+
*
|
|
9491
9823
|
* @deprecated use nestApplication instead.
|
|
9824
|
+
* @returns The NestJS application context.
|
|
9492
9825
|
*/ function get() {
|
|
9493
9826
|
return this._nestApplication;
|
|
9494
9827
|
}
|
|
9495
9828
|
},
|
|
9496
9829
|
{
|
|
9497
9830
|
key: "nestApplication",
|
|
9498
|
-
get:
|
|
9831
|
+
get: /**
|
|
9832
|
+
* Returns the NestJS application context.
|
|
9833
|
+
*
|
|
9834
|
+
* @returns The NestJS application context.
|
|
9835
|
+
*/ function get() {
|
|
9499
9836
|
return this._nestApplication;
|
|
9500
9837
|
}
|
|
9501
9838
|
}
|
|
@@ -9506,7 +9843,8 @@ function _ts_generator(thisArg, body) {
|
|
|
9506
9843
|
* Abstract class used for the top-level NestJS context for Firebase services.
|
|
9507
9844
|
*
|
|
9508
9845
|
* Your API implementation of this class is usually <AppPrefix>ApiNestContext (e.g. `DemoApiNestContext`).
|
|
9509
|
-
*/
|
|
9846
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- FirebaseModelsService generic requires `any` for SDK compatibility
|
|
9847
|
+
var AbstractFirebaseNestContext = /*#__PURE__*/ function(AbstractNestContext) {
|
|
9510
9848
|
_inherits(AbstractFirebaseNestContext, AbstractNestContext);
|
|
9511
9849
|
function AbstractFirebaseNestContext() {
|
|
9512
9850
|
_class_call_check$1(this, AbstractFirebaseNestContext);
|
|
@@ -9529,13 +9867,13 @@ function _ts_generator(thisArg, body) {
|
|
|
9529
9867
|
{
|
|
9530
9868
|
key: "envService",
|
|
9531
9869
|
get: function get() {
|
|
9532
|
-
return this.
|
|
9870
|
+
return this.nestApplication.get(FirebaseServerEnvService);
|
|
9533
9871
|
}
|
|
9534
9872
|
},
|
|
9535
9873
|
{
|
|
9536
9874
|
key: "storageService",
|
|
9537
9875
|
get: function get() {
|
|
9538
|
-
return this.
|
|
9876
|
+
return this.nestApplication.get(FirebaseServerStorageService);
|
|
9539
9877
|
}
|
|
9540
9878
|
},
|
|
9541
9879
|
{
|
|
@@ -9546,6 +9884,7 @@ function _ts_generator(thisArg, body) {
|
|
|
9546
9884
|
*
|
|
9547
9885
|
* @param auth - The request's auth data reference.
|
|
9548
9886
|
* @param buildFn - Optional builder to customize the context.
|
|
9887
|
+
* @returns A model context with auth, app, and error factories.
|
|
9549
9888
|
*/ key: "makeModelContext",
|
|
9550
9889
|
value: function makeModelContext(auth, buildFn) {
|
|
9551
9890
|
var base = {
|
|
@@ -9567,6 +9906,7 @@ function _ts_generator(thisArg, body) {
|
|
|
9567
9906
|
*
|
|
9568
9907
|
* @param context - The request's auth data reference.
|
|
9569
9908
|
* @param buildFn - Optional builder to customize the model context.
|
|
9909
|
+
* @returns An in-context models service scoped to the given auth context.
|
|
9570
9910
|
*/ key: "model",
|
|
9571
9911
|
value: function model(context, buildFn) {
|
|
9572
9912
|
var firebaseModelContext = this.makeModelContext(context, buildFn);
|
|
@@ -9575,7 +9915,8 @@ function _ts_generator(thisArg, body) {
|
|
|
9575
9915
|
},
|
|
9576
9916
|
{
|
|
9577
9917
|
key: "useModel",
|
|
9578
|
-
value:
|
|
9918
|
+
value: // eslint-disable-next-line @typescript-eslint/no-explicit-any -- implementation signature uses `any` to unify overload return types
|
|
9919
|
+
function useModel(type, select) {
|
|
9579
9920
|
return _async_to_generator(function() {
|
|
9580
9921
|
var _select_use, context, usePromise, use;
|
|
9581
9922
|
return _ts_generator(this, function(_state) {
|
|
@@ -9637,7 +9978,8 @@ function _define_property(obj, key, value) {
|
|
|
9637
9978
|
* Abstract class used for the top-level server NestJS context for server-only services.
|
|
9638
9979
|
*
|
|
9639
9980
|
* Your API implementation of this class is usually <AppPrefix>ApiServerNestContext (e.g. `DemoApiServerNestContext`).
|
|
9640
|
-
*/
|
|
9981
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic type parameters require `any` for Firebase SDK compatibility
|
|
9982
|
+
var AbstractServerFirebaseNestContext = /*#__PURE__*/ function() {
|
|
9641
9983
|
function AbstractServerFirebaseNestContext(c) {
|
|
9642
9984
|
_class_call_check(this, AbstractServerFirebaseNestContext);
|
|
9643
9985
|
_define_property(this, "_context", void 0);
|
|
@@ -9653,7 +9995,7 @@ function _define_property(obj, key, value) {
|
|
|
9653
9995
|
{
|
|
9654
9996
|
key: "nest",
|
|
9655
9997
|
get: function get() {
|
|
9656
|
-
return this.context.
|
|
9998
|
+
return this.context.nestApplication;
|
|
9657
9999
|
}
|
|
9658
10000
|
}
|
|
9659
10001
|
]);
|