@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
|
@@ -62,19 +62,33 @@ export interface OnCallModelFunctionAnalyticsDetails<R = any, O = any> {
|
|
|
62
62
|
* @typeParam I - The input/request data type.
|
|
63
63
|
*/
|
|
64
64
|
export interface OnCallAnalyticsContext<I = any> {
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* The CRUD operation type (e.g., `'create'`, `'update'`).
|
|
67
|
+
*/
|
|
66
68
|
readonly call: OnCallFunctionType;
|
|
67
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* The model type being operated on (e.g., `'guestbook'`).
|
|
71
|
+
*/
|
|
68
72
|
readonly modelType: FirestoreModelType;
|
|
69
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Optional operation specifier for variant handlers.
|
|
75
|
+
*/
|
|
70
76
|
readonly specifier: Maybe<ModelFirebaseCrudFunctionSpecifier>;
|
|
71
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The Firebase Auth UID of the calling user.
|
|
79
|
+
*/
|
|
72
80
|
readonly uid?: FirebaseAuthUserId;
|
|
73
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* The full Firebase Auth context.
|
|
83
|
+
*/
|
|
74
84
|
readonly auth?: AuthData;
|
|
75
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* The typed request data.
|
|
87
|
+
*/
|
|
76
88
|
readonly data?: I;
|
|
77
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* The full NestContext callable request with auth and specifier.
|
|
91
|
+
*/
|
|
78
92
|
readonly request: NestContextCallableRequestWithAuth<unknown, I> & ModelFirebaseCrudFunctionSpecifierRef;
|
|
79
93
|
}
|
|
80
94
|
/**
|
|
@@ -32,6 +32,9 @@ export type OnCallAnalyticsEmitterInstance = (lifecycle: OnCallModelAnalyticsEve
|
|
|
32
32
|
* emitter('triggered').sendEventType('Handler Starting');
|
|
33
33
|
* emitter('success').sendEvent('Widget Created', { id: result.id });
|
|
34
34
|
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param config - The service and context to bind to the emitter factory.
|
|
37
|
+
* @returns A factory function that creates lifecycle-stage-specific emitters.
|
|
35
38
|
*/
|
|
36
39
|
export declare function onCallAnalyticsEmitterInstance(config: OnCallAnalyticsEmitterInstanceConfig): OnCallAnalyticsEmitterInstance;
|
|
37
40
|
/**
|
|
@@ -11,25 +11,45 @@ import { type Maybe } from '@dereekb/util';
|
|
|
11
11
|
* Consumed by {@link OnCallModelAnalyticsService} and forwarded to provider-specific listeners.
|
|
12
12
|
*/
|
|
13
13
|
export interface OnCallModelAnalyticsEvent {
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The event name describing what happened (e.g., `'Guestbook Created'`).
|
|
16
|
+
*/
|
|
15
17
|
readonly event: string;
|
|
16
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The lifecycle stage at which this event was emitted.
|
|
20
|
+
*/
|
|
17
21
|
readonly lifecycle: 'triggered' | 'success' | 'error' | 'complete';
|
|
18
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The CRUD operation type (e.g., `'create'`, `'update'`, `'delete'`).
|
|
24
|
+
*/
|
|
19
25
|
readonly call: OnCallFunctionType;
|
|
20
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The model type being operated on (e.g., `'guestbook'`, `'profile'`).
|
|
28
|
+
*/
|
|
21
29
|
readonly modelType: FirestoreModelType;
|
|
22
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Optional operation specifier for variant handlers (e.g., `'subscribeToNotifications'`).
|
|
32
|
+
*/
|
|
23
33
|
readonly specifier?: Maybe<ModelFirebaseCrudFunctionSpecifier>;
|
|
24
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* The Firebase Auth UID of the calling user, if authenticated.
|
|
36
|
+
*/
|
|
25
37
|
readonly uid?: Maybe<FirebaseAuthUserId>;
|
|
26
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* The full Firebase Auth context, if available.
|
|
40
|
+
*/
|
|
27
41
|
readonly auth?: Maybe<AuthData>;
|
|
28
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The raw request object passed to the handler.
|
|
44
|
+
*/
|
|
29
45
|
readonly request?: Maybe<unknown>;
|
|
30
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Custom key-value properties attached by lifecycle callbacks.
|
|
48
|
+
*/
|
|
31
49
|
readonly properties?: Maybe<Record<string, any>>;
|
|
32
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The error object, if this event was emitted during the `'error'` lifecycle stage.
|
|
52
|
+
*/
|
|
33
53
|
readonly error?: Maybe<unknown>;
|
|
34
54
|
}
|
|
35
55
|
/**
|
|
@@ -106,19 +106,31 @@ export interface OnCallApiDetailsRef {
|
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* Whether the details are specifier-level (has specifiers map).
|
|
109
|
+
*
|
|
110
|
+
* @param details - The API details to check.
|
|
111
|
+
* @returns True if the details contain a specifiers map.
|
|
109
112
|
*/
|
|
110
113
|
export declare function isOnCallModelTypeApiDetails(details: OnCallApiDetails): details is OnCallModelTypeApiDetails;
|
|
111
114
|
/**
|
|
112
115
|
* Whether the details are CRUD-model-level (has modelTypes map).
|
|
116
|
+
*
|
|
117
|
+
* @param details - The API details to check.
|
|
118
|
+
* @returns True if the details contain a modelTypes map.
|
|
113
119
|
*/
|
|
114
120
|
export declare function isOnCallCrudModelApiDetails(details: OnCallApiDetails): details is OnCallCrudModelApiDetails;
|
|
115
121
|
/**
|
|
116
122
|
* Whether the details are handler-level (leaf node — no specifiers or modelTypes).
|
|
123
|
+
*
|
|
124
|
+
* @param details - The API details to check.
|
|
125
|
+
* @returns True if the details are handler-level (no specifiers or modelTypes).
|
|
117
126
|
*/
|
|
118
127
|
export declare function isOnCallHandlerApiDetails(details: OnCallApiDetails): details is OnCallModelFunctionApiDetails;
|
|
119
128
|
/**
|
|
120
129
|
* Whether the specifier-level details represent a true specifier (multiple sub-operations)
|
|
121
130
|
* vs a wrapped direct handler (`isSpecifier: false`, details under `_`).
|
|
131
|
+
*
|
|
132
|
+
* @param details - The specifier-level API details to check.
|
|
133
|
+
* @returns True if the details represent a true specifier with multiple sub-operations.
|
|
122
134
|
*/
|
|
123
135
|
export declare function isActualSpecifier(details: OnCallModelTypeApiDetails): boolean;
|
|
124
136
|
/**
|
|
@@ -177,16 +189,25 @@ export interface WithApiDetailsConfig<F extends (...args: any[]) => any> extends
|
|
|
177
189
|
* fn: async (request) => { ... }
|
|
178
190
|
* });
|
|
179
191
|
* ```
|
|
192
|
+
*
|
|
193
|
+
* @param config - The API details configuration including the handler function.
|
|
194
|
+
* @returns The handler function with _apiDetails attached.
|
|
180
195
|
*/
|
|
181
196
|
export declare function withApiDetails<F extends (...args: any[]) => any>(config: WithApiDetailsConfig<F>): F & OnCallModelFunctionApiDetailsRef;
|
|
182
197
|
/**
|
|
183
198
|
* Reads _apiDetails from a function if present.
|
|
199
|
+
*
|
|
200
|
+
* @param fn - The function or object that may carry _apiDetails.
|
|
201
|
+
* @returns The API details if present, otherwise undefined.
|
|
184
202
|
*/
|
|
185
203
|
export declare function readApiDetails(fn: Maybe<OnCallApiDetailsRef>): Maybe<OnCallApiDetails>;
|
|
186
204
|
/**
|
|
187
205
|
* Aggregates _apiDetails from a specifier handler config object.
|
|
188
206
|
*
|
|
189
207
|
* Returns OnCallModelTypeApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
208
|
+
*
|
|
209
|
+
* @param config - Map of specifier keys to handler functions.
|
|
210
|
+
* @returns Aggregated specifier-level API details, or undefined if no handlers have _apiDetails.
|
|
190
211
|
*/
|
|
191
212
|
export declare function aggregateSpecifierApiDetails(config: {
|
|
192
213
|
readonly [key: string]: Maybe<OnCallApiDetailsRef>;
|
|
@@ -195,6 +216,9 @@ export declare function aggregateSpecifierApiDetails(config: {
|
|
|
195
216
|
* Aggregates _apiDetails from a model type map (used by onCallCreateModel, etc.).
|
|
196
217
|
*
|
|
197
218
|
* Returns OnCallCrudModelApiDetails if any handlers have _apiDetails, otherwise undefined.
|
|
219
|
+
*
|
|
220
|
+
* @param map - Map of model type strings to handler functions.
|
|
221
|
+
* @returns Aggregated CRUD-model-level API details, or undefined if no handlers have _apiDetails.
|
|
198
222
|
*/
|
|
199
223
|
export declare function aggregateCrudModelApiDetails(map: {
|
|
200
224
|
readonly [key: string]: Maybe<OnCallApiDetailsRef>;
|
|
@@ -203,6 +227,9 @@ export declare function aggregateCrudModelApiDetails(map: {
|
|
|
203
227
|
* Aggregates _apiDetails from the top-level call model map.
|
|
204
228
|
*
|
|
205
229
|
* Returns OnCallModelApiDetails if any CRUD handlers have _apiDetails, otherwise undefined.
|
|
230
|
+
*
|
|
231
|
+
* @param map - Map of call type strings to CRUD handler functions.
|
|
232
|
+
* @returns Aggregated model-level API details, or undefined if no handlers have _apiDetails.
|
|
206
233
|
*/
|
|
207
234
|
export declare function aggregateModelApiDetails(map: {
|
|
208
235
|
readonly [key: string]: Maybe<OnCallApiDetailsRef>;
|
|
@@ -275,8 +302,14 @@ export declare function getModelApiDetails(callModelFn: Maybe<OnCallApiDetailsRe
|
|
|
275
302
|
/**
|
|
276
303
|
* Resolves leaf-level analytics details from the aggregated _apiDetails tree.
|
|
277
304
|
*
|
|
278
|
-
* Walks: call
|
|
305
|
+
* Walks: call -> modelType -> specifier (if specifier-level), then reads the `analytics`
|
|
279
306
|
* field from the handler-level {@link OnCallModelFunctionApiDetails}.
|
|
307
|
+
*
|
|
308
|
+
* @param apiDetails - The top-level aggregated API details.
|
|
309
|
+
* @param call - The CRUD operation type to look up.
|
|
310
|
+
* @param modelType - The Firestore model type to look up.
|
|
311
|
+
* @param specifier - Optional specifier key for variant handlers.
|
|
312
|
+
* @returns The analytics details for the resolved handler, or undefined.
|
|
280
313
|
*/
|
|
281
314
|
export declare function resolveAnalyticsFromApiDetails(apiDetails: OnCallModelApiDetails, call: OnCallFunctionType, modelType: FirestoreModelType, specifier?: ModelFirebaseCrudFunctionSpecifier): Maybe<OnCallModelFunctionAnalyticsDetails>;
|
|
282
315
|
/**
|
|
@@ -55,10 +55,15 @@ export interface OnCallModelConfig {
|
|
|
55
55
|
export declare function onCallModel(map: OnCallModelMap, config?: OnCallModelConfig): OnCallWithNestContext<unknown, OnCallTypedModelParams> & OnCallApiDetailsRef;
|
|
56
56
|
/**
|
|
57
57
|
* Creates a bad-request error indicating the `call` field was missing from the request payload.
|
|
58
|
+
*
|
|
59
|
+
* @returns A bad-request error with CALL_TYPE_MISSING_ERROR code.
|
|
58
60
|
*/
|
|
59
61
|
export declare function onCallModelMissingCallTypeError(): import("firebase-functions/https").HttpsError;
|
|
60
62
|
/**
|
|
61
63
|
* Creates a bad-request error indicating the provided `call` type is not recognized.
|
|
64
|
+
*
|
|
65
|
+
* @param call - The unrecognized call type string.
|
|
66
|
+
* @returns A bad-request error with UNKNOWN_CALL_TYPE_ERROR code.
|
|
62
67
|
*/
|
|
63
68
|
export declare function onCallModelUnknownCallTypeError(call: OnCallFunctionType): import("firebase-functions/https").HttpsError;
|
|
64
69
|
/**
|
|
@@ -82,13 +87,21 @@ export type OnCallWithCallTypeModelMap<N, T extends FirestoreModelIdentity = Fir
|
|
|
82
87
|
* @typeParam N - The NestJS context type.
|
|
83
88
|
*/
|
|
84
89
|
export interface OnCallWithCallTypeModelConfig<N> {
|
|
85
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* The call type string (e.g., 'create', 'read') passed through to assertions.
|
|
92
|
+
*/
|
|
86
93
|
readonly callType: string;
|
|
87
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* The CRUD category used by {@link AssertModelCrudRequestFunction}.
|
|
96
|
+
*/
|
|
88
97
|
readonly crudType: AssertModelCrudRequestFunctionContextCrudType;
|
|
89
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Optional assertion run before the model handler; throw to reject.
|
|
100
|
+
*/
|
|
90
101
|
readonly preAssert?: AssertModelCrudRequestFunction<N, OnCallTypedModelParams>;
|
|
91
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Error factory invoked when the requested model type has no handler in the map.
|
|
104
|
+
*/
|
|
92
105
|
readonly throwOnUnknownModelType: (modelType: FirestoreModelType) => Error;
|
|
93
106
|
}
|
|
94
107
|
/**
|
|
@@ -97,6 +110,9 @@ export interface OnCallWithCallTypeModelConfig<N> {
|
|
|
97
110
|
* Dispatches to the correct model-type handler from the map, enforces auth requirements,
|
|
98
111
|
* runs pre-assertions, and aggregates API details from all handlers for MCP introspection.
|
|
99
112
|
*
|
|
113
|
+
* @param map - Maps model type strings to their handler functions.
|
|
114
|
+
* @param config - Configuration including call type, crud type, and error factory.
|
|
115
|
+
* @returns A callable function that dispatches to the correct model-type handler.
|
|
100
116
|
* @internal Not intended for direct use outside the model CRUD module.
|
|
101
117
|
*/
|
|
102
118
|
export declare function _onCallWithCallTypeFunction<N>(map: OnCallWithCallTypeModelMap<N>, config: OnCallWithCallTypeModelConfig<N>): OnCallWithAuthAwareNestContext<N, OnCallTypedModelParams, unknown> & OnCallApiDetailsRef;
|
|
@@ -61,7 +61,9 @@ export type OnCallCreateModelMap<N, T extends FirestoreModelIdentity = Firestore
|
|
|
61
61
|
* Configuration for {@link onCallCreateModel}.
|
|
62
62
|
*/
|
|
63
63
|
export interface OnCallCreateModelConfig<N> {
|
|
64
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Optional assertion run before the create handler; throw to reject.
|
|
66
|
+
*/
|
|
65
67
|
readonly preAssert?: AssertModelCrudRequestFunction<N, OnCallCreateModelParams>;
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
@@ -85,5 +87,8 @@ export interface OnCallCreateModelConfig<N> {
|
|
|
85
87
|
export declare function onCallCreateModel<N>(map: OnCallCreateModelMap<N>, config?: OnCallCreateModelConfig<N>): OnCallWithNestContext<N, OnCallCreateModelParams, OnCallCreateModelResult>;
|
|
86
88
|
/**
|
|
87
89
|
* Creates a bad-request error indicating the requested model type is not valid for creation.
|
|
90
|
+
*
|
|
91
|
+
* @param modelType - The unrecognized model type string.
|
|
92
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
88
93
|
*/
|
|
89
94
|
export declare function createModelUnknownModelTypeError(modelType: FirestoreModelType): import("firebase-functions/https").HttpsError;
|
|
@@ -18,13 +18,21 @@ export type AssertModelCrudRequestFunctionContextCrudType = 'call' | 'create' |
|
|
|
18
18
|
* @typeParam I - The input data type of the request.
|
|
19
19
|
*/
|
|
20
20
|
export interface AssertModelCrudRequestFunctionContext<N, I = unknown> {
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* The original callable request including the NestJS context and caller data.
|
|
23
|
+
*/
|
|
22
24
|
readonly request: NestContextCallableRequest<N, I>;
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The CRUD call type string (e.g., 'create', 'read').
|
|
27
|
+
*/
|
|
24
28
|
readonly call: OnCallFunctionType;
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* The Firestore model type being targeted (e.g., 'profile', 'guestbook').
|
|
31
|
+
*/
|
|
26
32
|
readonly modelType: FirestoreModelType;
|
|
27
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The optional sub-operation specifier (e.g., 'username', 'fromUpload').
|
|
35
|
+
*/
|
|
28
36
|
readonly specifier: Maybe<string>;
|
|
29
37
|
}
|
|
30
38
|
/**
|
|
@@ -50,7 +50,9 @@ export type OnCallDeleteModelMap<N, T extends FirestoreModelIdentity = Firestore
|
|
|
50
50
|
* Configuration for {@link onCallDeleteModel}.
|
|
51
51
|
*/
|
|
52
52
|
export interface OnCallDeleteModelConfig<N> {
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Optional assertion run before the delete handler; throw to reject.
|
|
55
|
+
*/
|
|
54
56
|
readonly preAssert?: AssertModelCrudRequestFunction<N, OnCallDeleteModelParams>;
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
@@ -74,5 +76,8 @@ export interface OnCallDeleteModelConfig<N> {
|
|
|
74
76
|
export declare function onCallDeleteModel<N>(map: OnCallDeleteModelMap<N>, config?: OnCallDeleteModelConfig<N>): OnCallWithNestContext<N, OnCallDeleteModelParams, unknown>;
|
|
75
77
|
/**
|
|
76
78
|
* Creates a bad-request error indicating the requested model type is not valid for deletion.
|
|
79
|
+
*
|
|
80
|
+
* @param modelType - The unrecognized model type string.
|
|
81
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
77
82
|
*/
|
|
78
83
|
export declare function deleteModelUnknownModelTypeError(modelType: FirestoreModelType): import("firebase-functions/https").HttpsError;
|
|
@@ -6,6 +6,9 @@ import { type FirebaseDoesNotExistErrorContextErrorFunction, type FirebasePermis
|
|
|
6
6
|
* which the client can use to display a meaningful "not found" message. Intended to be
|
|
7
7
|
* passed to Firebase permission/existence checking utilities as the
|
|
8
8
|
* {@link FirebaseDoesNotExistErrorContextErrorFunction} callback.
|
|
9
|
+
*
|
|
10
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
11
|
+
* @returns A model-not-available HTTP error.
|
|
9
12
|
*/
|
|
10
13
|
export declare const nestFirebaseDoesNotExistError: FirebaseDoesNotExistErrorContextErrorFunction;
|
|
11
14
|
/**
|
|
@@ -14,5 +17,9 @@ export declare const nestFirebaseDoesNotExistError: FirebaseDoesNotExistErrorCon
|
|
|
14
17
|
* Returns a "forbidden" HTTP error including the document key, model type, and the roles
|
|
15
18
|
* that were required but not granted. Intended to be passed to Firebase permission checking
|
|
16
19
|
* utilities as the {@link FirebasePermissionErrorContextErrorFunction} callback.
|
|
20
|
+
*
|
|
21
|
+
* @param firebaseContextGrantedModelRoles - The granted model roles context containing the document reference.
|
|
22
|
+
* @param roles - The roles that were required but not granted.
|
|
23
|
+
* @returns A forbidden HTTP error.
|
|
17
24
|
*/
|
|
18
25
|
export declare const nestFirebaseForbiddenPermissionError: FirebasePermissionErrorContextErrorFunction;
|
|
@@ -52,7 +52,9 @@ export type OnCallReadModelMap<N, T extends FirestoreModelIdentity = FirestoreMo
|
|
|
52
52
|
* Configuration for {@link onCallReadModel}.
|
|
53
53
|
*/
|
|
54
54
|
export interface OnCallReadModelConfig<N> {
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Optional assertion run before the read handler; throw to reject.
|
|
57
|
+
*/
|
|
56
58
|
readonly preAssert?: AssertModelCrudRequestFunction<N, OnCallReadModelParams>;
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
@@ -76,5 +78,8 @@ export interface OnCallReadModelConfig<N> {
|
|
|
76
78
|
export declare function onCallReadModel<N>(map: OnCallReadModelMap<N>, config?: OnCallReadModelConfig<N>): OnCallWithNestContext<N, OnCallReadModelParams, unknown>;
|
|
77
79
|
/**
|
|
78
80
|
* Creates a bad-request error indicating the requested model type is not valid for reading.
|
|
81
|
+
*
|
|
82
|
+
* @param modelType - The unrecognized model type string.
|
|
83
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
79
84
|
*/
|
|
80
85
|
export declare function readModelUnknownModelTypeError(modelType: FirestoreModelType): import("firebase-functions/https").HttpsError;
|
|
@@ -76,5 +76,8 @@ export declare function onCallSpecifierHandler<N, I = any, O = any>(config: OnCa
|
|
|
76
76
|
/**
|
|
77
77
|
* Creates a bad-request error indicating the provided specifier is not recognized
|
|
78
78
|
* by the current model CRUD handler.
|
|
79
|
+
*
|
|
80
|
+
* @param specifier - The unrecognized specifier string.
|
|
81
|
+
* @returns A bad-request error with UNKNOWN_SPECIFIER_ERROR code.
|
|
79
82
|
*/
|
|
80
83
|
export declare function unknownModelCrudFunctionSpecifierError(specifier: ModelFirebaseCrudFunctionSpecifier): import("firebase-functions/https").HttpsError;
|
|
@@ -50,7 +50,9 @@ export type OnCallUpdateModelMap<N, T extends FirestoreModelIdentity = Firestore
|
|
|
50
50
|
* Configuration for {@link onCallUpdateModel}.
|
|
51
51
|
*/
|
|
52
52
|
export interface OnCallUpdateModelConfig<N> {
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Optional assertion run before the update handler; throw to reject.
|
|
55
|
+
*/
|
|
54
56
|
readonly preAssert?: AssertModelCrudRequestFunction<N, OnCallUpdateModelParams>;
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
@@ -77,5 +79,8 @@ export interface OnCallUpdateModelConfig<N> {
|
|
|
77
79
|
export declare function onCallUpdateModel<N>(map: OnCallUpdateModelMap<N>, config?: OnCallUpdateModelConfig<N>): OnCallWithNestContext<N, OnCallUpdateModelParams, unknown>;
|
|
78
80
|
/**
|
|
79
81
|
* Creates a bad-request error indicating the requested model type is not valid for updating.
|
|
82
|
+
*
|
|
83
|
+
* @param modelType - The unrecognized model type string.
|
|
84
|
+
* @returns A bad-request error with UNKNOWN_TYPE_ERROR code.
|
|
80
85
|
*/
|
|
81
86
|
export declare function updateModelUnknownModelTypeError(modelType: FirestoreModelType): import("firebase-functions/https").HttpsError;
|
|
@@ -28,9 +28,17 @@ export declare abstract class AbstractNestContext {
|
|
|
28
28
|
private readonly _nestApplication;
|
|
29
29
|
constructor(nestApplication: INestApplicationContext);
|
|
30
30
|
/**
|
|
31
|
+
* Returns the NestJS application context.
|
|
32
|
+
*
|
|
31
33
|
* @deprecated use nestApplication instead.
|
|
34
|
+
* @returns The NestJS application context.
|
|
32
35
|
*/
|
|
33
36
|
get nest(): INestApplicationContext;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the NestJS application context.
|
|
39
|
+
*
|
|
40
|
+
* @returns The NestJS application context.
|
|
41
|
+
*/
|
|
34
42
|
get nestApplication(): INestApplicationContext;
|
|
35
43
|
}
|
|
36
44
|
/**
|
|
@@ -67,6 +75,7 @@ export declare abstract class AbstractFirebaseNestContext<A, Y extends FirebaseM
|
|
|
67
75
|
*
|
|
68
76
|
* @param auth - The request's auth data reference.
|
|
69
77
|
* @param buildFn - Optional builder to customize the context.
|
|
78
|
+
* @returns A model context with auth, app, and error factories.
|
|
70
79
|
*/
|
|
71
80
|
makeModelContext(auth: AuthDataRef, buildFn?: BuildFunction<FirebaseAppModelContext<A>>): FirebaseAppModelContext<A>;
|
|
72
81
|
/**
|
|
@@ -75,6 +84,7 @@ export declare abstract class AbstractFirebaseNestContext<A, Y extends FirebaseM
|
|
|
75
84
|
*
|
|
76
85
|
* @param context - The request's auth data reference.
|
|
77
86
|
* @param buildFn - Optional builder to customize the model context.
|
|
87
|
+
* @returns An in-context models service scoped to the given auth context.
|
|
78
88
|
*/
|
|
79
89
|
model(context: AuthDataRef, buildFn?: BuildFunction<FirebaseAppModelContext<A>>): InContextFirebaseModelsService<Y>;
|
|
80
90
|
useModel<T extends FirebaseModelsServiceTypes<Y>, O>(type: T, select: UseModelInput<FirebaseAppModelContext<A>, Y, T, O>): Promise<O>;
|
|
@@ -28,6 +28,7 @@ export declare class FirebaseServerStorageContextModule {
|
|
|
28
28
|
* Creates a NestJS provider that configures the default storage bucket ID.
|
|
29
29
|
*
|
|
30
30
|
* @param input - A bucket ID string or full factory config object.
|
|
31
|
+
* @returns A NestJS provider for the storage context factory config token.
|
|
31
32
|
* @throws Error if `defaultBucketId` is empty.
|
|
32
33
|
*
|
|
33
34
|
* @example
|
|
@@ -44,6 +45,8 @@ export type ProvideFirebaseServerStorageServiceSimple<T extends FirebaseServerSt
|
|
|
44
45
|
};
|
|
45
46
|
/**
|
|
46
47
|
* Returns the default provider config that creates a standard {@link FirebaseServerStorageService}.
|
|
48
|
+
*
|
|
49
|
+
* @returns The default provider configuration for FirebaseServerStorageService.
|
|
47
50
|
*/
|
|
48
51
|
export declare function defaultProvideFirebaseServerStorageServiceSimple(): ProvideFirebaseServerStorageServiceSimple<FirebaseServerStorageService>;
|
|
49
52
|
export type ProvideFirebaseServerStorageService<T extends FirebaseServerStorageService> = FactoryProvider<T> | ProvideFirebaseServerStorageServiceSimple<T>;
|
|
@@ -52,6 +55,9 @@ export type ProvideFirebaseServerStorageService<T extends FirebaseServerStorageS
|
|
|
52
55
|
*
|
|
53
56
|
* If the provider token differs from `FirebaseServerStorageService`, an alias provider is added
|
|
54
57
|
* so the service can also be injected by the abstract type.
|
|
58
|
+
*
|
|
59
|
+
* @param provider - The storage service provider configuration.
|
|
60
|
+
* @returns An array of NestJS providers for the storage service.
|
|
55
61
|
*/
|
|
56
62
|
export declare function provideFirebaseServerStorageService<T extends FirebaseServerStorageService = FirebaseServerStorageService>(provider: ProvideFirebaseServerStorageService<T>): Provider<T>[];
|
|
57
63
|
export interface FirebaseServerStorageModuleMetadataConfig<T extends FirebaseServerStorageService = FirebaseServerStorageService> extends AdditionalModuleMetadata {
|
|
@@ -61,6 +67,9 @@ export interface FirebaseServerStorageModuleMetadataConfig<T extends FirebaseSer
|
|
|
61
67
|
* Generates NestJS {@link ModuleMetadata} for an app's storage module, including the
|
|
62
68
|
* {@link FirebaseServerStorageContextModule} import and the storage service provider.
|
|
63
69
|
*
|
|
70
|
+
* @param config - Optional configuration including a custom service provider and additional module metadata.
|
|
71
|
+
* @returns NestJS module metadata ready to be passed to the `@Module()` decorator.
|
|
72
|
+
*
|
|
64
73
|
* @example
|
|
65
74
|
* ```typescript
|
|
66
75
|
* @Module(firebaseServerStorageModuleMetadata())
|
|
@@ -3,10 +3,18 @@ import { type SlashPathFolder } from '@dereekb/util';
|
|
|
3
3
|
import { type GetFilesOptions, type Storage as GoogleCloudStorage, type File as GoogleCloudFile, type FileMetadata, type Bucket } from '@google-cloud/storage';
|
|
4
4
|
/**
|
|
5
5
|
* Resolves a Google Cloud Storage {@link Bucket} from a {@link StoragePath}.
|
|
6
|
+
*
|
|
7
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
8
|
+
* @param path - the storage path containing the bucket ID.
|
|
9
|
+
* @returns The resolved Google Cloud Storage bucket.
|
|
6
10
|
*/
|
|
7
11
|
export declare function googleCloudStorageBucketForStorageFilePath(storage: GoogleCloudStorage, path: StoragePath): Bucket;
|
|
8
12
|
/**
|
|
9
13
|
* Resolves a Google Cloud Storage {@link GoogleCloudFile} from a {@link StoragePath}.
|
|
14
|
+
*
|
|
15
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
16
|
+
* @param path - the storage path containing bucket ID and file path.
|
|
17
|
+
* @returns The resolved Google Cloud Storage file reference.
|
|
10
18
|
*/
|
|
11
19
|
export declare function googleCloudStorageFileForStorageFilePath(storage: GoogleCloudStorage, path: StoragePath): GoogleCloudFile;
|
|
12
20
|
/**
|
|
@@ -15,6 +23,10 @@ export declare function googleCloudStorageFileForStorageFilePath(storage: Google
|
|
|
15
23
|
export type GoogleCloudStorageAccessorFile = FirebaseStorageAccessorFile<GoogleCloudFile> & Required<Pick<FirebaseStorageAccessorFile<GoogleCloudFile>, 'uploadStream' | 'getStream'>>;
|
|
16
24
|
/**
|
|
17
25
|
* Converts Google Cloud Storage {@link FileMetadata} into the normalized {@link StorageMetadata} format.
|
|
26
|
+
*
|
|
27
|
+
* @param file - the Google Cloud Storage file reference.
|
|
28
|
+
* @param metadata - the raw file metadata from the Google Cloud SDK.
|
|
29
|
+
* @returns Normalized storage metadata.
|
|
18
30
|
*/
|
|
19
31
|
export declare function googleCloudFileMetadataToStorageMetadata(file: GoogleCloudFile, metadata: FileMetadata): StorageMetadata;
|
|
20
32
|
/**
|
|
@@ -22,6 +34,10 @@ export declare function googleCloudFileMetadataToStorageMetadata(file: GoogleClo
|
|
|
22
34
|
* and ACL operations for a single file in Google Cloud Storage.
|
|
23
35
|
*
|
|
24
36
|
* Handles emulator-specific edge cases (e.g., signing errors, atomic move fallback).
|
|
37
|
+
*
|
|
38
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
39
|
+
* @param storagePath - the storage path identifying the file's bucket and path.
|
|
40
|
+
* @returns A file accessor with CRUD, streaming, and ACL operations.
|
|
25
41
|
*/
|
|
26
42
|
export declare function googleCloudStorageAccessorFile(storage: GoogleCloudStorage, storagePath: StoragePath): GoogleCloudStorageAccessorFile;
|
|
27
43
|
/**
|
|
@@ -49,11 +65,17 @@ export declare const googleCloudStorageListFilesResultFactory: import("@dereekb/
|
|
|
49
65
|
/**
|
|
50
66
|
* Creates a {@link GoogleCloudStorageAccessorFolder} that supports checking folder existence
|
|
51
67
|
* and listing files/subfolders with pagination.
|
|
68
|
+
*
|
|
69
|
+
* @param storage - the Google Cloud Storage client instance.
|
|
70
|
+
* @param storagePath - the storage path identifying the folder's bucket and prefix.
|
|
71
|
+
* @returns A folder accessor with existence checking and listing operations.
|
|
52
72
|
*/
|
|
53
73
|
export declare function googleCloudStorageAccessorFolder(storage: GoogleCloudStorage, storagePath: StoragePath): GoogleCloudStorageAccessorFolder;
|
|
54
74
|
/**
|
|
55
75
|
* Creates a {@link FirebaseStorageAccessorDriver} for Google Cloud Storage (Admin SDK).
|
|
56
76
|
*
|
|
77
|
+
* @returns A server-side storage accessor driver for Google Cloud Storage.
|
|
78
|
+
*
|
|
57
79
|
* @example
|
|
58
80
|
* ```typescript
|
|
59
81
|
* const driver = googleCloudStorageFirebaseStorageAccessorDriver();
|
|
@@ -8,6 +8,8 @@ export type GoogleCloudFirebaseStorageDrivers = FirebaseStorageDrivers;
|
|
|
8
8
|
*
|
|
9
9
|
* Bundles the server-side storage accessor driver, identified as `@google-cloud/storage`.
|
|
10
10
|
*
|
|
11
|
+
* @returns A complete set of storage drivers for server-side usage.
|
|
12
|
+
*
|
|
11
13
|
* @example
|
|
12
14
|
* ```typescript
|
|
13
15
|
* const drivers = googleCloudFirebaseStorageDrivers();
|
|
@@ -12,6 +12,7 @@ export declare const googleCloudFirebaseStorageContextFactory: FirebaseStorageCo
|
|
|
12
12
|
* Storage wrapper and the raw Google Cloud Storage SDK.
|
|
13
13
|
*
|
|
14
14
|
* @param storage - The Firebase Admin Storage instance.
|
|
15
|
+
* @returns The underlying Google Cloud Storage client.
|
|
15
16
|
*
|
|
16
17
|
* @example
|
|
17
18
|
* ```typescript
|
package/test/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/test",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.4.
|
|
6
|
-
"@dereekb/date": "13.4.
|
|
7
|
-
"@dereekb/firebase": "13.4.
|
|
8
|
-
"@dereekb/firebase-server": "13.4.
|
|
9
|
-
"@dereekb/model": "13.4.
|
|
10
|
-
"@dereekb/nestjs": "13.4.
|
|
11
|
-
"@dereekb/rxjs": "13.4.
|
|
12
|
-
"@dereekb/util": "13.4.
|
|
5
|
+
"@dereekb/analytics": "13.4.2",
|
|
6
|
+
"@dereekb/date": "13.4.2",
|
|
7
|
+
"@dereekb/firebase": "13.4.2",
|
|
8
|
+
"@dereekb/firebase-server": "13.4.2",
|
|
9
|
+
"@dereekb/model": "13.4.2",
|
|
10
|
+
"@dereekb/nestjs": "13.4.2",
|
|
11
|
+
"@dereekb/rxjs": "13.4.2",
|
|
12
|
+
"@dereekb/util": "13.4.2",
|
|
13
13
|
"@google-cloud/firestore": "^7.11.6",
|
|
14
14
|
"@google-cloud/storage": "^7.19.0",
|
|
15
15
|
"@nestjs/common": "^11.1.16",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"make-error": "^1.3.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@dereekb/nestjs": "13.4.
|
|
24
|
+
"@dereekb/nestjs": "13.4.2"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
"./package.json": "./package.json",
|
package/zoho/index.cjs.js
CHANGED
|
@@ -49,7 +49,8 @@ var zohoAccessTokenSystemStateEmbeddedTokenConverter = firebase.firestoreSubObje
|
|
|
49
49
|
* Loads the {@link SystemStateDocument} that stores {@link ZohoAccessTokenSystemStateData},
|
|
50
50
|
* using {@link ZOHO_ACCESS_TOKEN_SYSTEM_STATE_TYPE} as the document ID.
|
|
51
51
|
*
|
|
52
|
-
* @param accessor - the document accessor for the SystemState collection
|
|
52
|
+
* @param accessor - the document accessor for the SystemState collection.
|
|
53
|
+
* @returns The SystemState document for the Zoho access token data.
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* ```ts
|
|
@@ -267,7 +268,8 @@ function _ts_generator(thisArg, body) {
|
|
|
267
268
|
* Tokens are stored in a single {@link SystemState} document (type {@link ZOHO_ACCESS_TOKEN_SYSTEM_STATE_TYPE})
|
|
268
269
|
* and token updates/clears use Firestore transactions for concurrency safety.
|
|
269
270
|
*
|
|
270
|
-
* @param systemStateCollection - the Firestore collection for system state documents
|
|
271
|
+
* @param systemStateCollection - the Firestore collection for system state documents.
|
|
272
|
+
* @returns A cache service backed by Firestore system state documents.
|
|
271
273
|
*
|
|
272
274
|
* @example
|
|
273
275
|
* ```ts
|
|
@@ -282,7 +284,7 @@ function _ts_generator(thisArg, body) {
|
|
|
282
284
|
var cache = {
|
|
283
285
|
loadCachedToken: function loadCachedToken() {
|
|
284
286
|
return _async_to_generator(function() {
|
|
285
|
-
var document, existingData, result,
|
|
287
|
+
var document, existingData, result, tokensArray;
|
|
286
288
|
return _ts_generator(this, function(_state) {
|
|
287
289
|
switch(_state.label){
|
|
288
290
|
case 0:
|
|
@@ -295,7 +297,7 @@ function _ts_generator(thisArg, body) {
|
|
|
295
297
|
existingData = _state.sent();
|
|
296
298
|
result = null;
|
|
297
299
|
if (existingData != null) {
|
|
298
|
-
tokensArray =
|
|
300
|
+
tokensArray = existingData.data.tokens;
|
|
299
301
|
result = tokensArray.find(function(x) {
|
|
300
302
|
return x.key === serviceKey;
|
|
301
303
|
});
|
|
@@ -318,7 +320,7 @@ function _ts_generator(thisArg, body) {
|
|
|
318
320
|
4,
|
|
319
321
|
systemStateCollection.firestoreContext.runTransaction(function(transaction) {
|
|
320
322
|
return _async_to_generator(function() {
|
|
321
|
-
var _ref,
|
|
323
|
+
var _ref, documentInTransaction, existingData, existingTokens, tokens, templateOrUpdate;
|
|
322
324
|
return _ts_generator(this, function(_state) {
|
|
323
325
|
switch(_state.label){
|
|
324
326
|
case 0:
|
|
@@ -329,7 +331,7 @@ function _ts_generator(thisArg, body) {
|
|
|
329
331
|
];
|
|
330
332
|
case 1:
|
|
331
333
|
existingData = _state.sent();
|
|
332
|
-
existingTokens = (_ref = existingData === null || existingData === void 0 ? void 0 :
|
|
334
|
+
existingTokens = (_ref = existingData === null || existingData === void 0 ? void 0 : existingData.data.tokens) !== null && _ref !== void 0 ? _ref : [];
|
|
333
335
|
tokens = // filter any potential old token for this service key
|
|
334
336
|
_to_consumable_array(existingTokens.filter(function(x) {
|
|
335
337
|
return x.key !== serviceKey;
|