@dereekb/firebase-server 13.2.2 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +7506 -1884
- package/index.esm.js +7505 -1890
- package/mailgun/index.cjs.js +333 -31
- package/mailgun/index.esm.js +333 -31
- package/mailgun/package.json +8 -8
- package/mailgun/src/lib/auth.mailgun.d.ts +22 -3
- package/model/index.cjs.js +11334 -3830
- package/model/index.esm.js +11338 -3834
- package/model/package.json +8 -8
- package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +27 -1
- package/model/src/lib/notification/notification.action.init.service.d.ts +93 -1
- package/model/src/lib/notification/notification.action.service.d.ts +151 -2
- package/model/src/lib/notification/notification.config.d.ts +19 -7
- package/model/src/lib/notification/notification.config.service.d.ts +44 -6
- package/model/src/lib/notification/notification.create.run.d.ts +33 -5
- package/model/src/lib/notification/notification.error.d.ts +63 -0
- package/model/src/lib/notification/notification.module.d.ts +11 -0
- package/model/src/lib/notification/notification.send.d.ts +8 -1
- package/model/src/lib/notification/notification.send.service.d.ts +7 -1
- package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +32 -2
- package/model/src/lib/notification/notification.send.service.text.d.ts +11 -3
- package/model/src/lib/notification/notification.task.service.d.ts +13 -1
- package/model/src/lib/notification/notification.task.service.handler.d.ts +27 -3
- package/model/src/lib/notification/notification.task.service.util.d.ts +16 -4
- package/model/src/lib/notification/notification.task.subtask.handler.d.ts +31 -1
- package/model/src/lib/notification/notification.util.d.ts +70 -0
- package/model/src/lib/storagefile/storagefile.action.init.service.d.ts +62 -1
- package/model/src/lib/storagefile/storagefile.action.server.d.ts +124 -2
- package/model/src/lib/storagefile/storagefile.error.d.ts +44 -0
- package/model/src/lib/storagefile/storagefile.module.d.ts +11 -0
- package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +4 -1
- package/model/src/lib/storagefile/storagefile.upload.service.d.ts +13 -1
- package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +43 -1
- package/model/src/lib/storagefile/storagefile.util.d.ts +8 -0
- package/oidc/index.cjs.default.js +1 -0
- package/oidc/index.cjs.js +5607 -0
- package/oidc/index.cjs.mjs +2 -0
- package/oidc/index.d.ts +1 -0
- package/oidc/index.esm.js +5560 -0
- package/oidc/package.json +26 -0
- package/oidc/src/index.d.ts +1 -0
- package/oidc/src/lib/controller/index.d.ts +3 -0
- package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +54 -0
- package/oidc/src/lib/controller/oidc.provider.controller.d.ts +18 -0
- package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +36 -0
- package/oidc/src/lib/index.d.ts +6 -0
- package/oidc/src/lib/middleware/index.d.ts +3 -0
- package/oidc/src/lib/middleware/oauth-auth.decorator.d.ts +14 -0
- package/oidc/src/lib/middleware/oauth-auth.middleware.d.ts +21 -0
- package/oidc/src/lib/middleware/oauth-auth.module.d.ts +50 -0
- package/oidc/src/lib/model/index.d.ts +3 -0
- package/oidc/src/lib/model/jwks/index.d.ts +3 -0
- package/oidc/src/lib/model/jwks/jwks.d.ts +107 -0
- package/oidc/src/lib/model/jwks/jwks.id.d.ts +9 -0
- package/oidc/src/lib/model/jwks/jwks.query.d.ts +18 -0
- package/oidc/src/lib/model/model.d.ts +12 -0
- package/oidc/src/lib/model/oidc/index.d.ts +2 -0
- package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +62 -0
- package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +23 -0
- package/oidc/src/lib/oidc.config.d.ts +175 -0
- package/oidc/src/lib/oidc.module.d.ts +100 -0
- package/oidc/src/lib/service/index.d.ts +10 -0
- package/oidc/src/lib/service/oidc.account.d.ts +36 -0
- package/oidc/src/lib/service/oidc.account.service.d.ts +104 -0
- package/oidc/src/lib/service/oidc.adapter.service.d.ts +20 -0
- package/oidc/src/lib/service/oidc.auth.d.ts +26 -0
- package/oidc/src/lib/service/oidc.client.service.d.ts +57 -0
- package/oidc/src/lib/service/oidc.config.service.d.ts +100 -0
- package/oidc/src/lib/service/oidc.encryption.service.d.ts +53 -0
- package/oidc/src/lib/service/oidc.interaction.service.d.ts +44 -0
- package/oidc/src/lib/service/oidc.jwks.service.d.ts +105 -0
- package/oidc/src/lib/service/oidc.service.d.ts +55 -0
- package/package.json +15 -9
- package/src/lib/auth/auth.context.d.ts +22 -2
- package/src/lib/auth/auth.service.d.ts +5 -0
- package/src/lib/auth/auth.service.error.d.ts +2 -1
- package/src/lib/auth/auth.util.d.ts +15 -3
- package/src/lib/env/env.config.d.ts +42 -0
- package/src/lib/env/env.service.d.ts +17 -0
- package/src/lib/env/index.d.ts +1 -0
- package/src/lib/firestore/array.d.ts +11 -3
- package/src/lib/firestore/driver.accessor.batch.d.ts +27 -4
- package/src/lib/firestore/driver.accessor.d.ts +43 -0
- package/src/lib/firestore/driver.accessor.default.d.ts +20 -0
- package/src/lib/firestore/driver.accessor.transaction.d.ts +28 -4
- package/src/lib/firestore/driver.d.ts +14 -0
- package/src/lib/firestore/driver.query.d.ts +25 -0
- package/src/lib/firestore/increment.d.ts +13 -3
- package/src/lib/firestore/snapshot/index.d.ts +1 -1
- package/src/lib/firestore/snapshot/{snapshot.field.d.ts → snapshot.field.encrypt.d.ts} +13 -27
- package/src/lib/function/assert.d.ts +32 -16
- package/src/lib/function/context.d.ts +26 -0
- package/src/lib/function/error.auth.d.ts +15 -0
- package/src/lib/function/error.d.ts +68 -4
- package/src/lib/nest/app.d.ts +53 -9
- package/src/lib/nest/app.module.d.ts +90 -0
- package/src/lib/nest/auth/auth.module.d.ts +30 -4
- package/src/lib/nest/auth/auth.util.d.ts +38 -0
- package/src/lib/nest/controller/auth.context.server.d.ts +27 -0
- package/src/lib/nest/controller/index.d.ts +1 -0
- package/src/lib/nest/development/development.app.function.d.ts +45 -0
- package/src/lib/nest/development/development.assert.function.d.ts +19 -1
- package/src/lib/nest/development/development.function.d.ts +42 -3
- package/src/lib/nest/development/development.schedule.function.d.ts +29 -0
- package/src/lib/nest/development/development.schedule.function.error.d.ts +21 -0
- package/src/lib/nest/env/env.service.d.ts +9 -0
- package/src/lib/nest/env/env.util.d.ts +16 -0
- package/src/lib/nest/firebase/firebase.module.d.ts +13 -1
- package/src/lib/nest/firestore/firestore.module.d.ts +24 -8
- package/src/lib/nest/function/call.d.ts +75 -6
- package/src/lib/nest/function/context.d.ts +85 -2
- package/src/lib/nest/function/nest.d.ts +46 -0
- package/src/lib/nest/function/schedule.d.ts +49 -0
- package/src/lib/nest/function/v2/blocking.d.ts +92 -8
- package/src/lib/nest/function/v2/call.d.ts +38 -8
- package/src/lib/nest/function/v2/event.d.ts +67 -4
- package/src/lib/nest/function/v2/schedule.d.ts +36 -5
- package/src/lib/nest/index.d.ts +3 -0
- package/src/lib/nest/middleware/appcheck.d.ts +5 -0
- package/src/lib/nest/middleware/appcheck.middleware.d.ts +44 -14
- package/src/lib/nest/middleware/appcheck.module.d.ts +10 -1
- package/src/lib/nest/middleware/globalprefix.d.ts +31 -3
- package/src/lib/nest/middleware/index.d.ts +2 -1
- package/src/lib/nest/middleware/rawbody.middleware.d.ts +6 -0
- package/src/lib/nest/model/call.model.function.d.ts +69 -3
- package/src/lib/nest/model/create.model.function.d.ts +66 -0
- package/src/lib/nest/model/crud.assert.function.d.ts +27 -1
- package/src/lib/nest/model/delete.model.function.d.ts +55 -0
- package/src/lib/nest/model/permission.error.d.ts +15 -0
- package/src/lib/nest/model/read.model.function.d.ts +57 -0
- package/src/lib/nest/model/specifier.function.d.ts +58 -1
- package/src/lib/nest/model/update.model.function.d.ts +58 -0
- package/src/lib/nest/nest.provider.d.ts +24 -11
- package/src/lib/nest/nest.provider.server.d.ts +12 -0
- package/src/lib/nest/storage/storage.module.d.ts +30 -4
- package/src/lib/storage/driver.accessor.d.ts +33 -0
- package/src/lib/storage/driver.d.ts +14 -0
- package/src/lib/storage/storage.d.ts +11 -4
- package/src/lib/storage/storage.service.d.ts +10 -1
- package/src/lib/type.d.ts +7 -2
- package/test/index.cjs.js +4072 -757
- package/test/index.esm.js +4073 -761
- package/test/package.json +8 -8
- package/test/src/lib/firebase/firebase.admin.auth.d.ts +82 -1
- package/test/src/lib/firebase/firebase.admin.collection.d.ts +55 -3
- package/test/src/lib/firebase/firebase.admin.d.ts +64 -0
- package/test/src/lib/firebase/firebase.admin.function.d.ts +84 -0
- package/test/src/lib/firebase/firebase.admin.nest.d.ts +125 -17
- package/test/src/lib/firebase/firebase.admin.nest.function.callable.context.d.ts +44 -0
- package/test/src/lib/firebase/firebase.admin.nest.function.cloud.context.d.ts +41 -0
- package/test/src/lib/firebase/firebase.admin.nest.function.d.ts +98 -0
- package/test/src/lib/firebase/firebase.admin.test.server.d.ts +26 -0
- package/test/src/lib/firebase/firebase.d.ts +57 -2
- package/test/src/lib/firebase/firebase.function.d.ts +138 -0
- package/test/src/lib/firestore/firestore.admin.d.ts +6 -0
- package/test/src/lib/firestore/firestore.d.ts +30 -0
- package/test/src/lib/storage/storage.admin.d.ts +9 -3
- package/test/src/lib/storage/storage.d.ts +30 -0
- package/zoho/index.cjs.js +406 -73
- package/zoho/index.esm.js +406 -73
- package/zoho/package.json +8 -8
- package/zoho/src/lib/zoho.accounts.firebase.d.ts +13 -2
- package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +29 -6
- package/index.cjs.js.map +0 -1
- package/index.esm.js.map +0 -1
- /package/src/lib/nest/middleware/{webhook.d.ts → webhook.module.d.ts} +0 -0
|
@@ -6,10 +6,19 @@ import { type FeaturesList } from 'firebase-functions-test/lib/features';
|
|
|
6
6
|
import { type BlockingFunctionMaybeWithHandler, type CallableHttpFunction } from '@dereekb/firebase-server';
|
|
7
7
|
/**
|
|
8
8
|
* Type fix used for compatability with firebase-functions/v2 the CloudFunction types in unions.
|
|
9
|
+
*
|
|
10
|
+
* The v1 `CloudFunction` type includes a `__trigger` property whose shape conflicts with the v2
|
|
11
|
+
* `CloudFunction` type, making them impossible to use in the same union. This type omits the
|
|
12
|
+
* conflicting property and replaces it with an optional `any`, allowing v1 functions to participate
|
|
13
|
+
* in shared union types alongside v2 functions.
|
|
9
14
|
*/
|
|
10
15
|
export type CloudFunctionV1TypeFix<T> = Omit<CloudFunctionV1Input<T>, '__trigger'> & {
|
|
11
16
|
__trigger?: any;
|
|
12
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Alias for {@link CloudFunctionV1TypeFix} representing a gen 1 Firebase Cloud Function
|
|
20
|
+
* with the union-compatibility fix applied.
|
|
21
|
+
*/
|
|
13
22
|
export type CloudFunctionV1<T> = CloudFunctionV1TypeFix<T>;
|
|
14
23
|
/**
|
|
15
24
|
* @deprecated deprecated gen 1 firebase function type
|
|
@@ -27,7 +36,19 @@ export type WrapCloudFunctionV1Input<T> = CloudFunctionV1<T>;
|
|
|
27
36
|
* Wrapped callable function that only takes in data and options that are used to simulate a Firebase request, then returns the result.
|
|
28
37
|
*/
|
|
29
38
|
export type WrappedCallableRequest<I, O = unknown> = (data: I, options: CallableContextOptions) => PromiseOrValue<O>;
|
|
39
|
+
/**
|
|
40
|
+
* Extracts the input (params) type from a {@link WrappedCallableRequest}.
|
|
41
|
+
*
|
|
42
|
+
* Useful when you need to derive the request payload type from an already-wrapped callable
|
|
43
|
+
* without importing the original input type separately.
|
|
44
|
+
*/
|
|
30
45
|
export type WrappedCallableRequestParams<W extends WrappedCallableRequest<any, any>> = W extends WrappedCallableRequest<infer I> ? I : unknown | undefined | void;
|
|
46
|
+
/**
|
|
47
|
+
* Extracts the output (return) type from a {@link WrappedCallableRequest}.
|
|
48
|
+
*
|
|
49
|
+
* Useful when you need to derive the response type from an already-wrapped callable
|
|
50
|
+
* without importing the original output type separately.
|
|
51
|
+
*/
|
|
31
52
|
export type WrappedCallableRequestOutput<W extends WrappedCallableRequest<any, any>> = W extends WrappedCallableRequest<infer _, infer O> ? O : unknown;
|
|
32
53
|
/**
|
|
33
54
|
* WrapCallableRequestV2 input.
|
|
@@ -43,13 +64,52 @@ export type WrapCallableRequest = <I, O>(callable: WrapCallableRequestInput<I, O
|
|
|
43
64
|
export type WrapCloudFunctionV2 = <T extends CloudEvent<any>>(cloudFunction: CloudFunctionV2<T>) => WrappedV2Function<T>;
|
|
44
65
|
export type WrapCloudFunctionV2Input<E extends CloudEvent<unknown>> = CloudFunctionV2<E>;
|
|
45
66
|
export type WrappedCloudFunctionV2<E extends CloudEvent<unknown>> = WrappedV2Function<E>;
|
|
67
|
+
/**
|
|
68
|
+
* A wrapped gen 2 blocking function that accepts an event input and returns a result.
|
|
69
|
+
*
|
|
70
|
+
* This is the test-time representation of a blocking function that includes a handler
|
|
71
|
+
* (e.g., `beforeUserCreated` with a handler callback).
|
|
72
|
+
*/
|
|
46
73
|
export type WrappedBlockingFunctionWithHandler<E extends object, O> = (input: E) => Promise<O>;
|
|
74
|
+
/**
|
|
75
|
+
* A wrapped gen 2 blocking function with no handler — invocation simply triggers side effects.
|
|
76
|
+
*
|
|
77
|
+
* This is the test-time representation of a blocking function registered without a handler callback.
|
|
78
|
+
*/
|
|
47
79
|
export type WrappedBlockingFunction = () => Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Wrapping function for a {@link BlockingFunctionMaybeWithHandler} that has a handler.
|
|
82
|
+
*
|
|
83
|
+
* Infers the event and output types from the blocking function and returns a
|
|
84
|
+
* correspondingly typed {@link WrappedBlockingFunctionWithHandler}.
|
|
85
|
+
*/
|
|
48
86
|
export type WrapBlockingFunctionWithHandlerFunction = <T extends BlockingFunctionMaybeWithHandler<any, any>>(blockingFunction: T) => T extends BlockingFunctionMaybeWithHandler<infer E, infer O> ? WrappedBlockingFunctionWithHandler<E, O> : never;
|
|
87
|
+
/**
|
|
88
|
+
* Wrapping function for a gen 1 {@link BlockingFunction} (no handler).
|
|
89
|
+
*
|
|
90
|
+
* Returns a {@link WrappedBlockingFunction} that can be invoked in tests.
|
|
91
|
+
*/
|
|
49
92
|
export type WrapBlockingFunctionWithoutHandlerFunction = (blockingFunction: BlockingFunction) => WrappedBlockingFunction;
|
|
93
|
+
/**
|
|
94
|
+
* Combined wrapping function interface for blocking functions.
|
|
95
|
+
*
|
|
96
|
+
* Overloaded to handle both blocking functions with handlers
|
|
97
|
+
* ({@link WrapBlockingFunctionWithHandlerFunction}) and without
|
|
98
|
+
* ({@link WrapBlockingFunctionWithoutHandlerFunction}), allowing a single
|
|
99
|
+
* `wrapBlockingFunction` call to wrap either variant.
|
|
100
|
+
*/
|
|
50
101
|
export interface WrapBlockingFunction extends WrapBlockingFunctionWithHandlerFunction, WrapBlockingFunctionWithoutHandlerFunction {
|
|
51
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Union of all possible wrapped gen 2 function types for a given input.
|
|
105
|
+
*
|
|
106
|
+
* When `I` extends `CloudEvent`, the result may be a wrapped cloud function or a wrapped
|
|
107
|
+
* blocking function (with or without handler). Otherwise it is restricted to blocking function variants.
|
|
108
|
+
*/
|
|
52
109
|
export type WrappedGen2CloudOrBlockingFunction<I extends object> = I extends CloudEvent<unknown> ? WrappedCloudFunctionV2<I> | WrappedBlockingFunctionWithHandler<I, unknown> | WrappedBlockingFunction : WrappedBlockingFunction | WrappedBlockingFunctionWithHandler<I, unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* Union of wrapping function types for gen 2 cloud functions and blocking functions.
|
|
112
|
+
*/
|
|
53
113
|
export type WrapGen2CloudOrBlockingFunction = WrapCloudFunctionV2 | WrapBlockingFunction;
|
|
54
114
|
/**
|
|
55
115
|
* A common interface for a all known types of wrapped cloud functions that excludes WrappedCallableRequest.
|
|
@@ -57,7 +117,19 @@ export type WrapGen2CloudOrBlockingFunction = WrapCloudFunctionV2 | WrapBlocking
|
|
|
57
117
|
* All of these functions are wrapped by FirebaseAdminCloudFunctionWrapper.
|
|
58
118
|
*/
|
|
59
119
|
export type WrappedCloudFunction<I extends object, O = unknown> = (input: I, context?: CallableContextOptions) => Promise<O>;
|
|
120
|
+
/**
|
|
121
|
+
* Unified wrapping function type that can wrap any generation of cloud function.
|
|
122
|
+
*
|
|
123
|
+
* Combines {@link WrapGen2CloudOrBlockingFunction} (gen 2 / blocking) with
|
|
124
|
+
* {@link WrapCloudFunctionV1} (gen 1) into a single callable type.
|
|
125
|
+
*/
|
|
60
126
|
export type WrapCloudFunction = WrapGen2CloudOrBlockingFunction & WrapCloudFunctionV1;
|
|
127
|
+
/**
|
|
128
|
+
* Provides access to a {@link FirebaseAdminCloudFunctionWrapper} via the `fnWrapper` property.
|
|
129
|
+
*
|
|
130
|
+
* Implemented by test fixture classes that need to expose cloud function wrapping capabilities
|
|
131
|
+
* to their consumers.
|
|
132
|
+
*/
|
|
61
133
|
export interface FirebaseAdminCloudFunctionWrapperSource {
|
|
62
134
|
readonly fnWrapper: FirebaseAdminCloudFunctionWrapper;
|
|
63
135
|
}
|
|
@@ -87,10 +159,76 @@ export interface FirebaseAdminCloudFunctionWrapper {
|
|
|
87
159
|
*/
|
|
88
160
|
readonly wrapCloudFunction: WrapCloudFunction;
|
|
89
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Creates a {@link FirebaseAdminCloudFunctionWrapper} from a `firebase-functions-test` {@link FeaturesList} instance.
|
|
164
|
+
*
|
|
165
|
+
* The returned wrapper provides methods to wrap gen 1 cloud functions, gen 2 cloud functions,
|
|
166
|
+
* callable requests, and blocking functions for use in integration tests. Each method delegates
|
|
167
|
+
* to the underlying `FeaturesList.wrap()` with appropriate type coercion.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const testEnv = functionsTest();
|
|
172
|
+
* const wrapper = firebaseAdminCloudFunctionWrapper(testEnv);
|
|
173
|
+
* const wrapped = wrapper.wrapCallableRequest(myCallable);
|
|
174
|
+
* const result = await wrapped({ foo: 'bar' }, { auth: { uid: 'test-user' } });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
90
177
|
export declare function firebaseAdminCloudFunctionWrapper(instance: FeaturesList): FirebaseAdminCloudFunctionWrapper;
|
|
178
|
+
/**
|
|
179
|
+
* Creates a lazy getter that wraps a gen 1 cloud function for testing each time it is called.
|
|
180
|
+
*
|
|
181
|
+
* The returned getter re-wraps on every invocation, so it always reflects the latest function
|
|
182
|
+
* reference from the provided getter — useful when the function under test is re-created between tests.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* const getWrapped = wrapCloudFunctionV1ForTests(wrapper, () => myV1Function);
|
|
187
|
+
* const result = await getWrapped()({ /* event data *\/ });
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @deprecated Prefer gen 2 functions and {@link wrapCloudFunctionV2ForTests} or {@link wrapCloudFunctionTests}.
|
|
191
|
+
*/
|
|
91
192
|
export declare function wrapCloudFunctionV1ForTests<I, T extends WrapCloudFunctionV1Input<I> = WrapCloudFunctionV1Input<I>>(wrapper: FirebaseAdminCloudFunctionWrapper, getter: Getter<T>): Getter<WrappedCloudFunctionV1<I>>;
|
|
193
|
+
/**
|
|
194
|
+
* Creates a lazy getter that wraps a gen 2 cloud function for testing each time it is called.
|
|
195
|
+
*
|
|
196
|
+
* Re-wraps on every invocation so it always reflects the latest function reference,
|
|
197
|
+
* which is important when the function under test is re-created between test cases.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* const getWrapped = wrapCloudFunctionV2ForTests(wrapper, () => myV2CloudFunction);
|
|
202
|
+
* const result = await getWrapped()({ data: payload });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
92
205
|
export declare function wrapCloudFunctionV2ForTests<E extends CloudEvent<unknown>, T extends WrapCloudFunctionV2Input<E> = WrapCloudFunctionV2Input<E>>(wrapper: FirebaseAdminCloudFunctionWrapper, getter: Getter<T>): Getter<WrappedCloudFunctionV2<E>>;
|
|
206
|
+
/**
|
|
207
|
+
* Creates a lazy getter that wraps any cloud function (gen 1 or gen 2) for testing using
|
|
208
|
+
* the unified {@link WrapCloudFunction} interface.
|
|
209
|
+
*
|
|
210
|
+
* This is the most general wrapper — use it when you do not need to distinguish between
|
|
211
|
+
* function generations in your test setup.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* const getWrapped = wrapCloudFunctionTests(wrapper, () => myFunction);
|
|
216
|
+
* const result = await getWrapped()(eventInput);
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
93
219
|
export declare function wrapCloudFunctionTests<I extends object>(wrapper: FirebaseAdminCloudFunctionWrapper, getter: Getter<any>): Getter<WrappedCloudFunction<I>>;
|
|
220
|
+
/**
|
|
221
|
+
* Creates a lazy getter that wraps a {@link CallableHttpFunction} for testing each time it is called.
|
|
222
|
+
*
|
|
223
|
+
* The wrapped callable accepts raw data and {@link CallableContextOptions} (e.g., auth context),
|
|
224
|
+
* simulating an incoming HTTP callable request without needing a running server.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* const getWrapped = wrapCallableRequestForTests(wrapper, () => myCallable);
|
|
229
|
+
* const result = await getWrapped()({ input: 'value' }, { auth: { uid: 'user-1' } });
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
94
232
|
export declare function wrapCallableRequestForTests<I, O = unknown, T extends WrapCallableRequestInput<I, O> = WrapCallableRequestInput<I, O>>(wrapper: FirebaseAdminCloudFunctionWrapper, getter: Getter<T>): Getter<WrappedCallableRequest<I, O>>;
|
|
95
233
|
/**
|
|
96
234
|
* @deprecated use WrappedCallableRequest instead.
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { type TestContextFactory } from '@dereekb/util/test';
|
|
2
2
|
import { type GoogleCloudTestFirestoreContextFixture } from './firestore';
|
|
3
|
+
/**
|
|
4
|
+
* A {@link TestContextFactory} that produces {@link GoogleCloudTestFirestoreContextFixture} instances.
|
|
5
|
+
*
|
|
6
|
+
* Use this type when declaring or accepting pre-configured Firestore test factories
|
|
7
|
+
* (e.g., {@link adminFirestoreFactory}) that manage fixture lifecycle automatically.
|
|
8
|
+
*/
|
|
3
9
|
export type GoogleFirebaseFirestoreTestContextFactory = TestContextFactory<GoogleCloudTestFirestoreContextFixture>;
|
|
4
10
|
/**
|
|
5
11
|
* Default firestore admin factory.
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
import { Firestore } from '@google-cloud/firestore';
|
|
2
2
|
import { type TestFirestoreContext, TestFirestoreInstance, TestFirestoreContextFixture, type TestingFirestoreDrivers } from '@dereekb/firebase/test';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for connecting to a Google Cloud Firestore emulator in tests.
|
|
5
|
+
*/
|
|
3
6
|
export interface GoogleCloudTestFirestoreConfig {
|
|
4
7
|
host: string;
|
|
5
8
|
port: number;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A {@link TestFirestoreContext} backed by `@google-cloud/firestore`.
|
|
12
|
+
*
|
|
13
|
+
* Alias provided for clarity when working within the Google Cloud test context builders.
|
|
14
|
+
*/
|
|
7
15
|
export type GoogleCloudTestFirestoreContext = TestFirestoreContext;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a {@link TestFirestoreContext} wired to a `@google-cloud/firestore` {@link Firestore} instance.
|
|
18
|
+
*
|
|
19
|
+
* The returned context has its `drivers` property set to the provided testing drivers,
|
|
20
|
+
* which enables test-specific behaviors (e.g., subcollection queries, batch operations)
|
|
21
|
+
* backed by the Google Cloud Firestore driver.
|
|
22
|
+
*
|
|
23
|
+
* @param drivers - Testing-aware Firestore driver set to attach to the context.
|
|
24
|
+
* @param firestore - The `@google-cloud/firestore` Firestore instance (typically pointed at an emulator).
|
|
25
|
+
*/
|
|
8
26
|
export declare function makeGoogleFirestoreContext(drivers: TestingFirestoreDrivers, firestore: Firestore): TestFirestoreContext;
|
|
27
|
+
/**
|
|
28
|
+
* A {@link TestFirestoreInstance} backed by `@google-cloud/firestore`.
|
|
29
|
+
*
|
|
30
|
+
* Each instance is constructed with its own {@link Firestore} instance and testing drivers,
|
|
31
|
+
* providing an isolated Firestore context for a single test run.
|
|
32
|
+
*/
|
|
9
33
|
export declare class GoogleCloudTestFirestoreInstance extends TestFirestoreInstance {
|
|
10
34
|
constructor(drivers: TestingFirestoreDrivers, firestore: Firestore);
|
|
11
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Test context fixture for `@google-cloud/firestore`-backed Firestore tests.
|
|
38
|
+
*
|
|
39
|
+
* Manages the lifecycle of a {@link GoogleCloudTestFirestoreInstance}, setting it up
|
|
40
|
+
* before each test and tearing it down afterward via the {@link testContextBuilder} infrastructure.
|
|
41
|
+
*/
|
|
12
42
|
export declare class GoogleCloudTestFirestoreContextFixture extends TestFirestoreContextFixture<GoogleCloudTestFirestoreInstance> {
|
|
13
43
|
}
|
|
14
44
|
/**
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { type TestContextFactory } from '@dereekb/util/test';
|
|
2
2
|
import { type GoogleCloudTestFirebaseStorageContextFixture } from './storage';
|
|
3
|
+
/**
|
|
4
|
+
* A {@link TestContextFactory} that produces {@link GoogleCloudTestFirebaseStorageContextFixture} instances.
|
|
5
|
+
*
|
|
6
|
+
* Use this type when declaring or accepting pre-configured storage test factories
|
|
7
|
+
* (e.g., {@link adminFirebaseStorageFactory}) that manage fixture lifecycle automatically.
|
|
8
|
+
*/
|
|
3
9
|
export type GoogleFirebaseStorageTestContextFactory = TestContextFactory<GoogleCloudTestFirebaseStorageContextFixture>;
|
|
4
10
|
/**
|
|
5
|
-
* Default
|
|
11
|
+
* Default Firebase Storage admin factory.
|
|
6
12
|
*
|
|
7
|
-
* Host of
|
|
13
|
+
* Host of 0.0.0.0, port 9906
|
|
8
14
|
*/
|
|
9
15
|
export declare const adminFirebaseStorageFactory: GoogleFirebaseStorageTestContextFactory;
|
|
10
16
|
/**
|
|
11
17
|
* Convenience mock instance for tests within an authorized context.
|
|
12
18
|
*
|
|
13
|
-
* Uses @google-cloud/
|
|
19
|
+
* Uses @google-cloud/storage
|
|
14
20
|
*/
|
|
15
21
|
export declare const dbxComponentsAdminTestWithMockItemStorage: TestContextFactory<import("@dereekb/firebase/test").MockItemStorageFixture>;
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
import { type TestFirebaseStorageContext, TestFirebaseStorageInstance, TestFirebaseStorageContextFixture, type TestingFirebaseStorageDrivers } from '@dereekb/firebase/test';
|
|
2
2
|
import { type FirebaseStorage } from '@dereekb/firebase';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for connecting to a Google Cloud Storage emulator in tests.
|
|
5
|
+
*/
|
|
3
6
|
export interface GoogleCloudTestFirebaseStorageConfig {
|
|
4
7
|
host: string;
|
|
5
8
|
port: number;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A {@link TestFirebaseStorageContext} backed by `@google-cloud/storage`.
|
|
12
|
+
*
|
|
13
|
+
* Alias provided for clarity when working within the Google Cloud test context builders.
|
|
14
|
+
*/
|
|
7
15
|
export type GoogleCloudTestFirebaseStorageContext = TestFirebaseStorageContext;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a {@link TestFirebaseStorageContext} wired to a `@google-cloud/storage` instance.
|
|
18
|
+
*
|
|
19
|
+
* The returned context has its `drivers` property set to the provided testing drivers,
|
|
20
|
+
* enabling test-specific behaviors backed by the Google Cloud Storage driver.
|
|
21
|
+
*
|
|
22
|
+
* @param drivers - Testing-aware storage driver set to attach to the context.
|
|
23
|
+
* @param firebaseStorage - The `@google-cloud/storage` Storage instance (typically pointed at an emulator).
|
|
24
|
+
* @param defaultBucketId - Optional default bucket name; when provided, storage operations that omit a bucket will use this.
|
|
25
|
+
*/
|
|
8
26
|
export declare function makeGoogleFirebaseStorageContext(drivers: TestingFirebaseStorageDrivers, firebaseStorage: FirebaseStorage, defaultBucketId?: string): TestFirebaseStorageContext;
|
|
27
|
+
/**
|
|
28
|
+
* A {@link TestFirebaseStorageInstance} backed by `@google-cloud/storage`.
|
|
29
|
+
*
|
|
30
|
+
* Each instance is constructed with its own Storage instance, testing drivers, and optional
|
|
31
|
+
* default bucket ID, providing an isolated storage context for a single test run.
|
|
32
|
+
*/
|
|
9
33
|
export declare class GoogleCloudTestFirebaseStorageInstance extends TestFirebaseStorageInstance {
|
|
10
34
|
constructor(drivers: TestingFirebaseStorageDrivers, firebaseStorage: FirebaseStorage, defaultBucketId?: string);
|
|
11
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Test context fixture for `@google-cloud/storage`-backed Firebase Storage tests.
|
|
38
|
+
*
|
|
39
|
+
* Manages the lifecycle of a {@link GoogleCloudTestFirebaseStorageInstance}, setting it up
|
|
40
|
+
* before each test and tearing it down afterward via the {@link testContextBuilder} infrastructure.
|
|
41
|
+
*/
|
|
12
42
|
export declare class GoogleCloudTestFirebaseStorageContextFixture extends TestFirebaseStorageContextFixture<GoogleCloudTestFirebaseStorageInstance> {
|
|
13
43
|
}
|
|
14
44
|
/**
|