@dereekb/firebase-server 4.0.1 → 5.0.1
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/CHANGELOG.md +44 -0
- package/LICENSE +21 -0
- package/package.json +17 -8
- package/src/lib/auth/auth.nest.d.ts +3 -2
- package/src/lib/auth/auth.nest.js +10 -8
- package/src/lib/auth/auth.nest.js.map +1 -1
- package/src/lib/auth/auth.service.d.ts +14 -6
- package/src/lib/auth/auth.service.js +5 -5
- package/src/lib/auth/auth.service.js.map +1 -1
- package/src/lib/firebase/firebase.nest.d.ts +2 -2
- package/src/lib/firestore/driver.accessor.batch.d.ts +4 -4
- package/src/lib/firestore/driver.accessor.batch.js +1 -1
- package/src/lib/firestore/driver.accessor.batch.js.map +1 -1
- package/src/lib/firestore/driver.accessor.d.ts +1 -1
- package/src/lib/firestore/driver.accessor.default.d.ts +3 -3
- package/src/lib/firestore/driver.accessor.default.js +2 -2
- package/src/lib/firestore/driver.accessor.default.js.map +1 -1
- package/src/lib/firestore/driver.accessor.js +2 -5
- package/src/lib/firestore/driver.accessor.js.map +1 -1
- package/src/lib/firestore/driver.accessor.transaction.d.ts +4 -4
- package/src/lib/firestore/driver.accessor.transaction.js +1 -1
- package/src/lib/firestore/driver.accessor.transaction.js.map +1 -1
- package/src/lib/firestore/driver.d.ts +1 -2
- package/src/lib/firestore/driver.query.d.ts +3 -3
- package/src/lib/firestore/driver.query.js.map +1 -1
- package/src/lib/firestore/firestore.nest.d.ts +1 -1
- package/src/lib/firestore/firestore.nest.js +12 -6
- package/src/lib/firestore/firestore.nest.js.map +1 -1
- package/src/lib/function/context.js +1 -1
- package/src/lib/function/context.js.map +1 -1
- package/src/lib/function/type.d.ts +8 -2
- package/src/lib/nest/app.d.ts +14 -2
- package/src/lib/nest/app.js +15 -12
- package/src/lib/nest/app.js.map +1 -1
- package/src/lib/nest/function/context.d.ts +4 -5
- package/src/lib/nest/function/index.d.ts +2 -2
- package/src/lib/nest/function/index.js +2 -2
- package/src/lib/nest/function/index.js.map +1 -1
- package/src/lib/nest/function/transform.d.ts +1 -1
- package/src/lib/nest/function/v1/call.d.ts +36 -0
- package/src/lib/nest/function/v1/call.js +28 -0
- package/src/lib/nest/function/v1/call.js.map +1 -0
- package/src/lib/nest/function/{nest.utility.d.ts → v1/call.utility.d.ts} +3 -3
- package/src/lib/nest/function/{nest.utility.js → v1/call.utility.js} +3 -3
- package/src/lib/nest/function/v1/call.utility.js.map +1 -0
- package/src/lib/nest/function/v1/event.d.ts +38 -0
- package/src/lib/nest/function/v1/event.js +41 -0
- package/src/lib/nest/function/v1/event.js.map +1 -0
- package/src/lib/nest/function/v1/index.d.ts +3 -0
- package/src/lib/nest/function/v1/index.js +7 -0
- package/src/lib/nest/function/v1/index.js.map +1 -0
- package/src/lib/nest/function/v2/blocking.d.ts +19 -0
- package/src/lib/nest/function/v2/blocking.js +23 -0
- package/src/lib/nest/function/v2/blocking.js.map +1 -0
- package/src/lib/nest/function/v2/call.d.ts +36 -0
- package/src/lib/nest/function/v2/call.js +28 -0
- package/src/lib/nest/function/v2/call.js.map +1 -0
- package/src/lib/nest/function/v2/event.d.ts +20 -0
- package/src/lib/nest/function/v2/event.js +23 -0
- package/src/lib/nest/function/v2/event.js.map +1 -0
- package/src/lib/nest/function/v2/index.d.ts +4 -0
- package/src/lib/nest/function/v2/index.js +8 -0
- package/src/lib/nest/function/v2/index.js.map +1 -0
- package/src/lib/nest/function/v2/taskqueue.d.ts +19 -0
- package/src/lib/nest/function/v2/taskqueue.js +23 -0
- package/src/lib/nest/function/v2/taskqueue.js.map +1 -0
- package/src/lib/nest/index.d.ts +2 -0
- package/src/lib/nest/index.js +2 -0
- package/src/lib/nest/index.js.map +1 -1
- package/src/lib/nest/middleware/index.d.ts +2 -0
- package/src/lib/nest/middleware/index.js +6 -0
- package/src/lib/nest/middleware/index.js.map +1 -0
- package/src/lib/nest/middleware/rawbody.middleware.d.ts +6 -0
- package/src/lib/nest/middleware/rawbody.middleware.js +16 -0
- package/src/lib/nest/middleware/rawbody.middleware.js.map +1 -0
- package/src/lib/nest/middleware/webhook.d.ts +10 -0
- package/src/lib/nest/middleware/webhook.js +28 -0
- package/src/lib/nest/middleware/webhook.js.map +1 -0
- package/src/lib/nest/nest.provider.d.ts +23 -0
- package/src/lib/nest/nest.provider.js +13 -0
- package/src/lib/nest/nest.provider.js.map +1 -0
- package/test/CHANGELOG.md +17 -0
- package/test/package.json +12 -11
- package/test/src/lib/firebase/firebase.admin.auth.d.ts +3 -3
- package/test/src/lib/firebase/firebase.admin.auth.js +7 -9
- package/test/src/lib/firebase/firebase.admin.auth.js.map +1 -1
- package/test/src/lib/firebase/firebase.admin.collection.d.ts +2 -2
- package/test/src/lib/firebase/firebase.admin.collection.js +0 -1
- package/test/src/lib/firebase/firebase.admin.collection.js.map +1 -1
- package/test/src/lib/firebase/firebase.admin.d.ts +7 -19
- package/test/src/lib/firebase/firebase.admin.function.d.ts +5 -4
- package/test/src/lib/firebase/firebase.admin.function.js +8 -6
- package/test/src/lib/firebase/firebase.admin.function.js.map +1 -1
- package/test/src/lib/firebase/firebase.admin.js +7 -13
- package/test/src/lib/firebase/firebase.admin.js.map +1 -1
- package/test/src/lib/firebase/firebase.admin.nest.d.ts +2 -2
- package/test/src/lib/firebase/firebase.admin.nest.function.context.d.ts +5 -5
- package/test/src/lib/firebase/firebase.admin.nest.function.context.js +2 -0
- package/test/src/lib/firebase/firebase.admin.nest.function.context.js.map +1 -1
- package/test/src/lib/firebase/firebase.admin.nest.function.d.ts +11 -12
- package/test/src/lib/firebase/firebase.admin.nest.function.js +8 -7
- package/test/src/lib/firebase/firebase.admin.nest.function.js.map +1 -1
- package/test/src/lib/firebase/firebase.admin.nest.js +2 -2
- package/test/src/lib/firebase/firebase.admin.nest.js.map +1 -1
- package/test/src/lib/firebase/firebase.admin.test.server.d.ts +1 -1
- package/test/src/lib/firebase/firebase.admin.test.server.js.map +1 -1
- package/test/src/lib/firebase/firebase.function.d.ts +23 -0
- package/test/src/lib/firebase/firebase.function.js +27 -0
- package/test/src/lib/firebase/firebase.function.js.map +1 -0
- package/test/src/lib/firebase/firebase.js.map +1 -1
- package/test/src/lib/firestore/firestore.js +1 -1
- package/test/src/lib/firestore/firestore.js.map +1 -1
- package/test-setup.js.map +1 -1
- package/src/lib/nest/function/nest.d.ts +0 -91
- package/src/lib/nest/function/nest.js +0 -74
- package/src/lib/nest/function/nest.js.map +0 -1
- package/src/lib/nest/function/nest.utility.js.map +0 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PromiseOrValue } from '@dereekb/util';
|
|
2
|
+
import { Runnable, HttpsFunction } from 'firebase-functions/v1';
|
|
3
|
+
import { CallableFunction } from 'firebase-functions/v2/https';
|
|
2
4
|
/**
|
|
3
|
-
* Union of firebase-functions HttpsFunction and Runnable
|
|
5
|
+
* Firebase Functions V1 - Union of firebase-functions HttpsFunction and Runnable.
|
|
4
6
|
*/
|
|
5
7
|
export declare type RunnableHttpFunction<I> = HttpsFunction & Runnable<I>;
|
|
8
|
+
/**
|
|
9
|
+
* Firebase Functions V2 - CallableFunction with output as an optional type.
|
|
10
|
+
*/
|
|
11
|
+
export declare type CallableHttpFunction<I, O = unknown> = CallableFunction<I, PromiseOrValue<O>>;
|
package/src/lib/nest/app.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassType, Getter } from '@dereekb/util';
|
|
2
|
-
import { INestApplicationContext, Provider } from '@nestjs/common';
|
|
2
|
+
import { INestApplicationContext, NestApplicationOptions, Provider } from '@nestjs/common';
|
|
3
3
|
import * as express from 'express';
|
|
4
4
|
import * as admin from 'firebase-admin';
|
|
5
5
|
export interface NestServer {
|
|
@@ -8,6 +8,10 @@ export interface NestServer {
|
|
|
8
8
|
}
|
|
9
9
|
export declare type NestAppPromiseGetter = Getter<Promise<INestApplicationContext>>;
|
|
10
10
|
export interface NestServerInstance<T> {
|
|
11
|
+
/**
|
|
12
|
+
* Root module class of the app.
|
|
13
|
+
*/
|
|
14
|
+
readonly moduleClass: ClassType<T>;
|
|
11
15
|
/**
|
|
12
16
|
* Initializes and returns the Nest Server.
|
|
13
17
|
*
|
|
@@ -31,6 +35,14 @@ export interface NestServerInstanceConfig<T> {
|
|
|
31
35
|
/**
|
|
32
36
|
* Additional providers to provide globally.
|
|
33
37
|
*/
|
|
34
|
-
providers?: Provider<
|
|
38
|
+
readonly providers?: Provider<unknown>[];
|
|
39
|
+
/**
|
|
40
|
+
* Whether or not to configure webhook usage. This will configure routes to use
|
|
41
|
+
*/
|
|
42
|
+
readonly configureWebhooks?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Additional nest application options.
|
|
45
|
+
*/
|
|
46
|
+
readonly applicationOptions?: NestApplicationOptions;
|
|
35
47
|
}
|
|
36
48
|
export declare function nestServerInstance<T>(config: NestServerInstanceConfig<T>): NestServerInstance<T>;
|
package/src/lib/nest/app.js
CHANGED
|
@@ -7,6 +7,7 @@ const core_1 = require("@nestjs/core");
|
|
|
7
7
|
const platform_express_1 = require("@nestjs/platform-express");
|
|
8
8
|
const express = require("express");
|
|
9
9
|
const firebase_nest_1 = require("../firebase/firebase.nest");
|
|
10
|
+
const webhook_1 = require("./middleware/webhook");
|
|
10
11
|
class FirebaseNestServerRootModule {
|
|
11
12
|
}
|
|
12
13
|
exports.FirebaseNestServerRootModule = FirebaseNestServerRootModule;
|
|
@@ -23,23 +24,24 @@ function nestServerInstance(config) {
|
|
|
23
24
|
if (additionalProviders) {
|
|
24
25
|
(0, util_1.mergeArrayOrValueIntoArray)(providers, additionalProviders);
|
|
25
26
|
}
|
|
27
|
+
const imports = [moduleClass];
|
|
28
|
+
// NOTE: https://cloud.google.com/functions/docs/writing/http#parsing_http_requests
|
|
29
|
+
const options = { bodyParser: false }; // firebase already parses the requests
|
|
30
|
+
if (config.configureWebhooks) {
|
|
31
|
+
imports.push(webhook_1.ConfigureFirebaseWebhookMiddlewareModule);
|
|
32
|
+
}
|
|
26
33
|
const providersModule = {
|
|
27
34
|
module: FirebaseNestServerRootModule,
|
|
28
|
-
imports
|
|
35
|
+
imports,
|
|
29
36
|
providers,
|
|
30
37
|
exports: providers,
|
|
31
38
|
global: true
|
|
32
39
|
};
|
|
33
|
-
const nestApp = yield core_1.NestFactory.create(providersModule, new platform_express_1.ExpressAdapter(expressInstance));
|
|
40
|
+
const nestApp = yield core_1.NestFactory.create(providersModule, new platform_express_1.ExpressAdapter(expressInstance), options);
|
|
34
41
|
return nestApp.init();
|
|
35
42
|
});
|
|
36
|
-
const nest = createNestServer(server)
|
|
37
|
-
.
|
|
38
|
-
console.log('Nest Ready');
|
|
39
|
-
return v;
|
|
40
|
-
})
|
|
41
|
-
.catch(err => {
|
|
42
|
-
console.error('Nest broken', err);
|
|
43
|
+
const nest = createNestServer(server).catch((err) => {
|
|
44
|
+
console.error('Nest failed startup.', err);
|
|
43
45
|
throw err;
|
|
44
46
|
});
|
|
45
47
|
nestServer = { server, nest: (0, util_1.makeGetter)(nest) };
|
|
@@ -49,12 +51,12 @@ function nestServerInstance(config) {
|
|
|
49
51
|
};
|
|
50
52
|
const removeNestServer = (firebaseApp) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
53
|
const appName = firebaseApp.name;
|
|
52
|
-
|
|
54
|
+
const nestServer = serversCache.get(appName);
|
|
53
55
|
let removed;
|
|
54
56
|
if (nestServer) {
|
|
55
|
-
removed = nestServer.nest().then(x => {
|
|
57
|
+
removed = nestServer.nest().then((x) => {
|
|
56
58
|
serversCache.delete(appName);
|
|
57
|
-
return x.close().then(
|
|
59
|
+
return x.close().then(() => true);
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
else {
|
|
@@ -63,6 +65,7 @@ function nestServerInstance(config) {
|
|
|
63
65
|
return removed;
|
|
64
66
|
});
|
|
65
67
|
return {
|
|
68
|
+
moduleClass,
|
|
66
69
|
initNestServer,
|
|
67
70
|
removeNestServer
|
|
68
71
|
};
|
package/src/lib/nest/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../../../packages/firebase-server/src/lib/nest/app.ts"],"names":[],"mappings":";;;;AAAA,wCAAoG;AAEpG,uCAA2C;AAC3C,+DAA0D;AAC1D,mCAAmC;AACnC,6DAA2E;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../../../packages/firebase-server/src/lib/nest/app.ts"],"names":[],"mappings":";;;;AAAA,wCAAoG;AAEpG,uCAA2C;AAC3C,+DAA0D;AAC1D,mCAAmC;AACnC,6DAA2E;AAE3E,kDAAgF;AA6BhF,MAAa,4BAA4B;CAAG;AAA5C,oEAA4C;AAqB5C,SAAgB,kBAAkB,CAAI,MAAmC;IACvE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAAC;IAC/D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEnD,MAAM,cAAc,GAAG,CAAC,WAA0B,EAAc,EAAE;QAChE,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;QACjC,IAAI,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE3C,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC;YACzB,MAAM,gBAAgB,GAAG,CAAO,eAAgC,EAAE,EAAE;gBAClE,MAAM,SAAS,GAAG,CAAC,IAAA,8CAA8B,EAAC,IAAA,eAAQ,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBAE1E,IAAI,mBAAmB,EAAE;oBACvB,IAAA,iCAA0B,EAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;iBAC5D;gBAED,MAAM,OAAO,GAAoB,CAAC,WAAW,CAAC,CAAC;gBAE/C,mFAAmF;gBACnF,MAAM,OAAO,GAA2B,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,uCAAuC;gBAEtG,IAAI,MAAM,CAAC,iBAAiB,EAAE;oBAC5B,OAAO,CAAC,IAAI,CAAC,kDAAwC,CAAC,CAAC;iBACxD;gBAED,MAAM,eAAe,GAAkB;oBACrC,MAAM,EAAE,4BAA4B;oBACpC,OAAO;oBACP,SAAS;oBACT,OAAO,EAAE,SAAS;oBAClB,MAAM,EAAE,IAAI;iBACb,CAAC;gBAEF,MAAM,OAAO,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,iCAAc,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;gBAExG,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;YACxB,CAAC,CAAA,CAAC;YAEF,MAAM,IAAI,GAA8B,gBAAgB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7E,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;gBAC3C,MAAM,GAAG,CAAC;YACZ,CAAC,CAA8B,CAAC;YAEhC,UAAU,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAA,iBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;YAChD,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;SACvC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,CAAO,WAA0B,EAAoB,EAAE;QAC9E,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;QACjC,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,OAAyB,CAAC;QAE9B,IAAI,UAAU,EAAE;YACd,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;gBACrC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC7B,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SAClC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAA,CAAC;IAEF,OAAO;QACL,WAAW;QACX,cAAc;QACd,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAzED,gDAyEC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { TransformAndValidateFunctionResultFactory, TransformAndValidateObjectFactory } from
|
|
2
|
-
import { FirebaseServerActionsTransformContext } from
|
|
1
|
+
import { TransformAndValidateFunctionResultFactory, TransformAndValidateObjectFactory } from '@dereekb/model';
|
|
2
|
+
import { FirebaseServerActionsTransformContext } from './transform';
|
|
3
3
|
/**
|
|
4
4
|
* Context used for building FirebaseServerActions. It contains references to reusable factories.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
7
|
-
}
|
|
6
|
+
export declare type FirebaseServerActionsContext = FirebaseServerActionsTransformContext;
|
|
8
7
|
export declare abstract class AbstractFirebaseServerActionsContext implements FirebaseServerActionsContext {
|
|
9
8
|
abstract readonly firebaseServerActionTransformFactory: TransformAndValidateObjectFactory;
|
|
10
|
-
abstract readonly firebaseServerActionTransformFunctionFactory: TransformAndValidateFunctionResultFactory<
|
|
9
|
+
abstract readonly firebaseServerActionTransformFunctionFactory: TransformAndValidateFunctionResultFactory<unknown>;
|
|
11
10
|
}
|
|
12
11
|
export declare function firebaseServerActionsContext(): FirebaseServerActionsContext;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./v1"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./v2"), exports);
|
|
4
6
|
tslib_1.__exportStar(require("./context"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./nest"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./nest.utility"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./transform"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/src/lib/nest/function/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/src/lib/nest/function/index.ts"],"names":[],"mappings":";;;AAAA,+CAAqB;AACrB,+CAAqB;AACrB,oDAA0B;AAC1B,sDAA4B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TransformAndValidateFunctionResultFactory, TransformAndValidateObjectFactory } from
|
|
1
|
+
import { TransformAndValidateFunctionResultFactory, TransformAndValidateObjectFactory } from '@dereekb/model';
|
|
2
2
|
/**
|
|
3
3
|
* Context used for transforming content.
|
|
4
4
|
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as functions from 'firebase-functions';
|
|
2
|
+
import { INestApplicationContext } from '@nestjs/common';
|
|
3
|
+
import { RunnableHttpFunction } from '../../../function/type';
|
|
4
|
+
import { MakeNestContext, NestApplicationFunctionFactory } from '../../nest.provider';
|
|
5
|
+
export declare type NestApplicationRunnableHttpFunctionFactory<I> = NestApplicationFunctionFactory<RunnableHttpFunction<I>>;
|
|
6
|
+
/**
|
|
7
|
+
* Runnable function that is passed an INestApplicationContext in addition to the usual data/context provided by firebase.
|
|
8
|
+
*/
|
|
9
|
+
export declare type OnCallWithNestApplication<I = unknown, O = unknown> = (nest: INestApplicationContext, data: I, context: functions.https.CallableContext) => O;
|
|
10
|
+
/**
|
|
11
|
+
* Factory function for generating a NestApplicationFunctionFactory for a HttpsFunctions/Runnable firebase function.
|
|
12
|
+
*/
|
|
13
|
+
export declare type OnCallWithNestApplicationFactory = <I, O>(fn: OnCallWithNestApplication<I, O>) => NestApplicationRunnableHttpFunctionFactory<I>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a factory for generating OnCallWithNestApplication functions.
|
|
16
|
+
*
|
|
17
|
+
* @param nestAppPromiseGetter
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function onCallWithNestApplicationFactory(): OnCallWithNestApplicationFactory;
|
|
21
|
+
/**
|
|
22
|
+
* Runnable function that is passed an arbitrary nest context object in addition to the usual data/context provided by firebase.
|
|
23
|
+
*/
|
|
24
|
+
export declare type OnCallWithNestContext<C, I = unknown, O = unknown> = (nestContext: C, data: I, context: functions.https.CallableContext) => O;
|
|
25
|
+
/**
|
|
26
|
+
* Factory function for generating HttpsFunctions/Runnable firebase function that returns the value from the input OnCallWithNestContext function.
|
|
27
|
+
*/
|
|
28
|
+
export declare type OnCallWithNestContextFactory<C> = <I, O>(fn: OnCallWithNestContext<C, I, O>) => NestApplicationRunnableHttpFunctionFactory<I>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a factory for generating OnCallWithNestContext functions with a nest context object that is generated by the input function.
|
|
31
|
+
*
|
|
32
|
+
* @param appFactory
|
|
33
|
+
* @param makeNestContext
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare function onCallWithNestContextFactory<C>(appFactory: OnCallWithNestApplicationFactory, makeNestContext: MakeNestContext<C>): OnCallWithNestContextFactory<C>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onCallWithNestContextFactory = exports.onCallWithNestApplicationFactory = void 0;
|
|
4
|
+
const functions = require("firebase-functions");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a factory for generating OnCallWithNestApplication functions.
|
|
7
|
+
*
|
|
8
|
+
* @param nestAppPromiseGetter
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function onCallWithNestApplicationFactory() {
|
|
12
|
+
return (fn) => {
|
|
13
|
+
return (nestAppPromiseGetter) => functions.https.onCall((data, context) => nestAppPromiseGetter().then((x) => fn(x, data, context)));
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.onCallWithNestApplicationFactory = onCallWithNestApplicationFactory;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a factory for generating OnCallWithNestContext functions with a nest context object that is generated by the input function.
|
|
19
|
+
*
|
|
20
|
+
* @param appFactory
|
|
21
|
+
* @param makeNestContext
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
function onCallWithNestContextFactory(appFactory, makeNestContext) {
|
|
25
|
+
return (fn) => appFactory((nest, data, context) => fn(makeNestContext(nest), data, context));
|
|
26
|
+
}
|
|
27
|
+
exports.onCallWithNestContextFactory = onCallWithNestContextFactory;
|
|
28
|
+
//# sourceMappingURL=call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v1/call.ts"],"names":[],"mappings":";;;AAAA,gDAAgD;AAkBhD;;;;;GAKG;AACH,SAAgB,gCAAgC;IAC9C,OAAO,CAAO,EAAmC,EAAE,EAAE;QACnD,OAAO,CAAC,oBAAkD,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAO,EAAE,OAAwC,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACzM,CAAC,CAAC;AACJ,CAAC;AAJD,4EAIC;AAYD;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAI,UAA4C,EAAE,eAAmC;IAC/H,OAAO,CAAO,EAAkC,EAAE,EAAE,CAAC,UAAU,CAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3I,CAAC;AAFD,oEAEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CallableContextWithAuthData } from
|
|
2
|
-
import { OnCallWithNestContext } from
|
|
3
|
-
export declare type OnCallWithAuthorizedNestContext<C, I =
|
|
1
|
+
import { CallableContextWithAuthData } from '../../../function/context';
|
|
2
|
+
import { OnCallWithNestContext } from './call';
|
|
3
|
+
export declare type OnCallWithAuthorizedNestContext<C, I = unknown, O = unknown> = (nestContext: C, data: I, context: CallableContextWithAuthData) => O;
|
|
4
4
|
/**
|
|
5
5
|
* Creates an OnCallWithNestContext wrapper that validates the input CallableContext to assert the context has auth data before entering the function.
|
|
6
6
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.inAuthContext = void 0;
|
|
4
|
-
const context_1 = require("
|
|
5
|
-
const error_1 = require("
|
|
4
|
+
const context_1 = require("../../../function/context");
|
|
5
|
+
const error_1 = require("../../../function/error");
|
|
6
6
|
/**
|
|
7
7
|
* Creates an OnCallWithNestContext wrapper that validates the input CallableContext to assert the context has auth data before entering the function.
|
|
8
8
|
*
|
|
@@ -20,4 +20,4 @@ function inAuthContext(fn) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
exports.inAuthContext = inAuthContext;
|
|
23
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=call.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.utility.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v1/call.utility.ts"],"names":[],"mappings":";;;AACA,uDAA+F;AAC/F,mDAA8E;AAK9E;;;;;GAKG;AACH,SAAgB,aAAa,CAAU,EAA4C;IACjF,OAAO,CAAC,WAAc,EAAE,IAAO,EAAE,OAAwC,EAAE,EAAE;QAC3E,IAAI,IAAA,+BAAqB,EAAC,OAAO,CAAC,EAAE;YAClC,OAAO,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SACvC;aAAM;YACL,MAAM,IAAA,2CAAmC,GAAE,CAAC;SAC7C;IACH,CAAC,CAAC;AACJ,CAAC;AARD,sCAQC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PromiseOrValue } from '@dereekb/util';
|
|
2
|
+
import { INestApplicationContext } from '@nestjs/common';
|
|
3
|
+
import * as functions from 'firebase-functions';
|
|
4
|
+
import { EventContext } from 'firebase-functions';
|
|
5
|
+
import { MakeNestContext, NestApplicationFunctionFactory } from '../../nest.provider';
|
|
6
|
+
export declare type FirestoreEventHandler<I = unknown, O = unknown> = (data: I, context: EventContext) => PromiseOrValue<O>;
|
|
7
|
+
export declare type NestApplicationEventHandler<I = unknown, O = unknown> = (nest: INestApplicationContext, data: I, context: EventContext) => PromiseOrValue<O>;
|
|
8
|
+
export declare type NestApplicationEventHandlerBuilder<I = unknown, O = unknown> = (handler: NestApplicationEventHandler<I, O>) => FirestoreEventHandler<I, O>;
|
|
9
|
+
export declare type OnEventWithNestApplicationBuilder<I = unknown, O = unknown> = (nest: NestApplicationEventHandlerBuilder<I, O>) => functions.CloudFunction<I>;
|
|
10
|
+
/**
|
|
11
|
+
* Factory function for generating a CloudFunctionHandler via a NestApplicationCloudFunctionHandler.
|
|
12
|
+
*/
|
|
13
|
+
export declare type OnEventWithNestApplicationFactory = <I, O>(fn: OnEventWithNestApplicationBuilder<I, O>) => NestApplicationFunctionFactory<functions.CloudFunction<I>>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a factory for generating OnEventWithNestApplicationBuilder values.
|
|
16
|
+
*
|
|
17
|
+
* @param nestAppPromiseGetter
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function onEventWithNestApplicationFactory(): OnEventWithNestApplicationFactory;
|
|
21
|
+
export declare type NestContextEventHandler<C, I = unknown, O = unknown> = (nest: C, data: I, context: EventContext) => Promise<O>;
|
|
22
|
+
export declare type NestContextEventHandlerBuilder<C, I = unknown, O = unknown> = (handler: NestContextEventHandler<C, I, O>) => FirestoreEventHandler<I, O>;
|
|
23
|
+
/**
|
|
24
|
+
* Runnable function that is passed an arbitrary nest context object in addition to the usual data/context provided by firebase.
|
|
25
|
+
*/
|
|
26
|
+
export declare type OnEventWithNestContextBuilder<C, I = unknown, O = unknown> = (nest: NestContextEventHandlerBuilder<C, I, O>) => functions.CloudFunction<I>;
|
|
27
|
+
/**
|
|
28
|
+
* Factory function for generating a firebase CloudFunction for a specific event.
|
|
29
|
+
*/
|
|
30
|
+
export declare type OnEventWithNestContextFactory<C> = <I, O = unknown>(fn: OnEventWithNestContextBuilder<C, I, O>) => NestApplicationFunctionFactory<functions.CloudFunction<I>>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a factory for generating OnCallWithNestContext functions with a nest context object that is generated by the input function.
|
|
33
|
+
*
|
|
34
|
+
* @param appFactory
|
|
35
|
+
* @param makeNestContext
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
export declare function onEventWithNestContextFactory<C>(makeNestContext: MakeNestContext<C>): OnEventWithNestContextFactory<C>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onEventWithNestContextFactory = exports.onEventWithNestApplicationFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a factory for generating OnEventWithNestApplicationBuilder values.
|
|
6
|
+
*
|
|
7
|
+
* @param nestAppPromiseGetter
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
function onEventWithNestApplicationFactory() {
|
|
11
|
+
return (fn) => {
|
|
12
|
+
return (nestAppPromiseGetter) => {
|
|
13
|
+
const handlerBuilder = (handler) => {
|
|
14
|
+
const fnHandler = (data, context) => nestAppPromiseGetter().then((nest) => handler(nest, data, context));
|
|
15
|
+
return fnHandler;
|
|
16
|
+
};
|
|
17
|
+
return fn(handlerBuilder);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.onEventWithNestApplicationFactory = onEventWithNestApplicationFactory;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a factory for generating OnCallWithNestContext functions with a nest context object that is generated by the input function.
|
|
24
|
+
*
|
|
25
|
+
* @param appFactory
|
|
26
|
+
* @param makeNestContext
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
function onEventWithNestContextFactory(makeNestContext) {
|
|
30
|
+
return (fn) => {
|
|
31
|
+
return (nestAppPromiseGetter) => {
|
|
32
|
+
const handlerBuilder = (handler) => {
|
|
33
|
+
const fnHandler = (data, context) => nestAppPromiseGetter().then((nest) => handler(makeNestContext(nest), data, context));
|
|
34
|
+
return fnHandler;
|
|
35
|
+
};
|
|
36
|
+
return fn(handlerBuilder);
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.onEventWithNestContextFactory = onEventWithNestContextFactory;
|
|
41
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v1/event.ts"],"names":[],"mappings":";;;AAkBA;;;;;GAKG;AACH,SAAgB,iCAAiC;IAC/C,OAAO,CAAO,EAA2C,EAAE,EAAE;QAC3D,OAAO,CAAC,oBAAkD,EAAE,EAAE;YAC5D,MAAM,cAAc,GAA6C,CAAC,OAAO,EAAE,EAAE;gBAC3E,MAAM,SAAS,GAAgC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;gBACtI,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC;YAEF,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAXD,8EAWC;AAeD;;;;;;GAMG;AACH,SAAgB,6BAA6B,CAAI,eAAmC;IAClF,OAAO,CAAiB,EAA0C,EAAE,EAAE;QACpE,OAAO,CAAC,oBAAkD,EAAE,EAAE;YAC5D,MAAM,cAAc,GAA4C,CAAC,OAAO,EAAE,EAAE;gBAC1E,MAAM,SAAS,GAAgC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;gBACvJ,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC;YAEF,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAXD,sEAWC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./call"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./call.utility"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./event"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v1/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,yDAA+B;AAC/B,kDAAwB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PromiseOrValue } from '@dereekb/util';
|
|
2
|
+
import { BlockingFunction } from 'firebase-functions';
|
|
3
|
+
import { MakeNestContext, NestApplicationFunctionFactory } from '../../nest.provider';
|
|
4
|
+
export declare type BlockingFunctionHandler<E, O = unknown> = (event: E) => PromiseOrValue<O>;
|
|
5
|
+
export declare type NestContextBlockingFunctionHandler<C, E, O = unknown> = (nest: C, event: E) => PromiseOrValue<O>;
|
|
6
|
+
export declare type NestContextBlockingFunctionHandlerBuilder<C, E, O = unknown> = (handler: NestContextBlockingFunctionHandler<C, E, O>) => BlockingFunctionHandler<E, O>;
|
|
7
|
+
export declare type BlockingFunctionHandlerWithNestContextBuilder<C, E, O = unknown> = (nest: NestContextBlockingFunctionHandlerBuilder<C, E, O>) => BlockingFunction;
|
|
8
|
+
/**
|
|
9
|
+
* Factory function for generating a firebase BlockingFunction for a specific event.
|
|
10
|
+
*/
|
|
11
|
+
export declare type BlockingFunctionHandlerWithNestContextFactory<C> = <E, O = unknown>(fn: BlockingFunctionHandlerWithNestContextBuilder<C, E, O>) => NestApplicationFunctionFactory<BlockingFunction>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a BlockingFunctionHandlerWithNestContextFactory.
|
|
14
|
+
*
|
|
15
|
+
* @param appFactory
|
|
16
|
+
* @param makeNestContext
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare function blockingFunctionHandlerWithNestContextFactory<C>(makeNestContext: MakeNestContext<C>): BlockingFunctionHandlerWithNestContextFactory<C>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blockingFunctionHandlerWithNestContextFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a BlockingFunctionHandlerWithNestContextFactory.
|
|
6
|
+
*
|
|
7
|
+
* @param appFactory
|
|
8
|
+
* @param makeNestContext
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function blockingFunctionHandlerWithNestContextFactory(makeNestContext) {
|
|
12
|
+
return (fn) => {
|
|
13
|
+
return (nestAppPromiseGetter) => {
|
|
14
|
+
const handlerBuilder = (handler) => {
|
|
15
|
+
const fnHandler = (event) => nestAppPromiseGetter().then((nest) => handler(makeNestContext(nest), event));
|
|
16
|
+
return fnHandler;
|
|
17
|
+
};
|
|
18
|
+
return fn(handlerBuilder);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.blockingFunctionHandlerWithNestContextFactory = blockingFunctionHandlerWithNestContextFactory;
|
|
23
|
+
//# sourceMappingURL=blocking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocking.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v2/blocking.ts"],"names":[],"mappings":";;;AAeA;;;;;;GAMG;AACH,SAAgB,6CAA6C,CAAI,eAAmC;IAClG,OAAO,CAAO,EAA0D,EAAE,EAAE;QAC1E,OAAO,CAAC,oBAAkD,EAAE,EAAE;YAC5D,MAAM,cAAc,GAAuD,CAAC,OAAoD,EAAE,EAAE;gBAClI,MAAM,SAAS,GAAkC,CAAC,KAAQ,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;gBAC5I,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC;YAEF,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAXD,sGAWC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { INestApplicationContext } from '@nestjs/common';
|
|
2
|
+
import { CallableRequest } from 'firebase-functions/v2/https';
|
|
3
|
+
import { CallableHttpFunction } from '../../../function/type';
|
|
4
|
+
import { MakeNestContext, NestApplicationFunctionFactory } from '../../nest.provider';
|
|
5
|
+
export declare type NestApplicationCallableHttpFunctionFactory<I, O = unknown> = NestApplicationFunctionFactory<CallableHttpFunction<I, O>>;
|
|
6
|
+
/**
|
|
7
|
+
* Runnable function that is passed an INestApplicationContext in addition to the usual data/context provided by firebase.
|
|
8
|
+
*/
|
|
9
|
+
export declare type OnCallHandlerWithNestApplication<I = unknown, O = unknown> = (nest: INestApplicationContext, request: CallableRequest<I>) => O;
|
|
10
|
+
/**
|
|
11
|
+
* Factory function for generating a NestApplicationFunctionFactory for a HttpsFunctions/Runnable firebase function.
|
|
12
|
+
*/
|
|
13
|
+
export declare type OnCallHandlerWithNestApplicationFactory = <I, O>(fn: OnCallHandlerWithNestApplication<I, O>) => NestApplicationCallableHttpFunctionFactory<I, O>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a factory for generating OnCallWithNestApplication functions.
|
|
16
|
+
*
|
|
17
|
+
* @param nestAppPromiseGetter
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function onCallHandlerWithNestApplicationFactory(): OnCallHandlerWithNestApplicationFactory;
|
|
21
|
+
/**
|
|
22
|
+
* Runnable function that is passed an arbitrary nest context object in addition to the usual data/context provided by firebase.
|
|
23
|
+
*/
|
|
24
|
+
export declare type OnCallHandlerWithNestContext<C, I = unknown, O = unknown> = (nestContext: C, request: CallableRequest<I>) => O;
|
|
25
|
+
/**
|
|
26
|
+
* Factory function for generating HttpsFunctions/Runnable firebase function that returns the value from the input OnCallWithNestContext function.
|
|
27
|
+
*/
|
|
28
|
+
export declare type OnCallHandlerWithNestContextFactory<C> = <I, O>(fn: OnCallHandlerWithNestContext<C, I, O>) => NestApplicationCallableHttpFunctionFactory<I>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a factory for generating OnCallWithNestContext functions with a nest context object that is generated by the input function.
|
|
31
|
+
*
|
|
32
|
+
* @param appFactory
|
|
33
|
+
* @param makeNestContext
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare function onCallHandlerWithNestContextFactory<C>(appFactory: OnCallHandlerWithNestApplicationFactory, makeNestContext: MakeNestContext<C>): OnCallHandlerWithNestContextFactory<C>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onCallHandlerWithNestContextFactory = exports.onCallHandlerWithNestApplicationFactory = void 0;
|
|
4
|
+
const v2_1 = require("firebase-functions/v2");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a factory for generating OnCallWithNestApplication functions.
|
|
7
|
+
*
|
|
8
|
+
* @param nestAppPromiseGetter
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function onCallHandlerWithNestApplicationFactory() {
|
|
12
|
+
return (fn) => {
|
|
13
|
+
return (nestAppPromiseGetter) => v2_1.https.onCall((request) => nestAppPromiseGetter().then((x) => fn(x, request)));
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.onCallHandlerWithNestApplicationFactory = onCallHandlerWithNestApplicationFactory;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a factory for generating OnCallWithNestContext functions with a nest context object that is generated by the input function.
|
|
19
|
+
*
|
|
20
|
+
* @param appFactory
|
|
21
|
+
* @param makeNestContext
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
function onCallHandlerWithNestContextFactory(appFactory, makeNestContext) {
|
|
25
|
+
return (fn) => appFactory((nest, request) => fn(makeNestContext(nest), request));
|
|
26
|
+
}
|
|
27
|
+
exports.onCallHandlerWithNestContextFactory = onCallHandlerWithNestContextFactory;
|
|
28
|
+
//# sourceMappingURL=call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v2/call.ts"],"names":[],"mappings":";;;AAEA,8CAA8C;AAmB9C;;;;;GAKG;AACH,SAAgB,uCAAuC;IACrD,OAAO,CAAO,EAA0C,EAAE,EAAE;QAC1D,OAAO,CAAC,oBAAkD,EAAE,EAAE,CAAC,UAAK,CAAC,MAAM,CAAC,CAAC,OAA2B,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACnK,CAAC,CAAC;AACJ,CAAC;AAJD,0FAIC;AAYD;;;;;;GAMG;AACH,SAAgB,mCAAmC,CAAI,UAAmD,EAAE,eAAmC;IAC7I,OAAO,CAAO,EAAyC,EAAE,EAAE,CAAC,UAAU,CAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AACtI,CAAC;AAFD,kFAEC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PromiseOrValue } from '@dereekb/util';
|
|
2
|
+
import { CloudEvent, CloudFunction } from 'firebase-functions/v2';
|
|
3
|
+
import { MakeNestContext, NestApplicationFunctionFactory } from '../../nest.provider';
|
|
4
|
+
export declare type CloudEventHandler<E extends CloudEvent<unknown>, O = unknown> = (event: E) => PromiseOrValue<O>;
|
|
5
|
+
export declare type NestContextCloudEventHandler<C, E extends CloudEvent<unknown>, O = unknown> = (nest: C, event: E) => PromiseOrValue<O>;
|
|
6
|
+
export declare type NestContextCloudEventHandlerBuilder<C, E extends CloudEvent<unknown>, O = unknown> = (handler: NestContextCloudEventHandler<C, E, O>) => CloudEventHandler<E, O>;
|
|
7
|
+
export declare type NestContextCloudEventHandlerWithData<C, I, O = unknown> = NestContextCloudEventHandler<C, CloudEvent<I>, O>;
|
|
8
|
+
export declare type CloudEventHandlerWithNestContextBuilder<C, E extends CloudEvent<unknown>, O = unknown> = (nest: NestContextCloudEventHandlerBuilder<C, E, O>) => CloudFunction<E>;
|
|
9
|
+
/**
|
|
10
|
+
* Factory function for generating a firebase CloudFunction for a specific event.
|
|
11
|
+
*/
|
|
12
|
+
export declare type CloudEventHandlerWithNestContextFactory<C> = <E extends CloudEvent<unknown>, O = unknown>(fn: CloudEventHandlerWithNestContextBuilder<C, E, O>) => NestApplicationFunctionFactory<CloudFunction<E>>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a CloudEventHandlerWithNestContextFactory.
|
|
15
|
+
*
|
|
16
|
+
* @param appFactory
|
|
17
|
+
* @param makeNestContext
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function cloudEventHandlerWithNestContextFactory<C>(makeNestContext: MakeNestContext<C>): CloudEventHandlerWithNestContextFactory<C>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloudEventHandlerWithNestContextFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a CloudEventHandlerWithNestContextFactory.
|
|
6
|
+
*
|
|
7
|
+
* @param appFactory
|
|
8
|
+
* @param makeNestContext
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function cloudEventHandlerWithNestContextFactory(makeNestContext) {
|
|
12
|
+
return (fn) => {
|
|
13
|
+
return (nestAppPromiseGetter) => {
|
|
14
|
+
const handlerBuilder = (handler) => {
|
|
15
|
+
const fnHandler = (event) => nestAppPromiseGetter().then((nest) => handler(makeNestContext(nest), event));
|
|
16
|
+
return fnHandler;
|
|
17
|
+
};
|
|
18
|
+
return fn(handlerBuilder);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.cloudEventHandlerWithNestContextFactory = cloudEventHandlerWithNestContextFactory;
|
|
23
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v2/event.ts"],"names":[],"mappings":";;;AAgBA;;;;;;GAMG;AACH,SAAgB,uCAAuC,CAAI,eAAmC;IAC5F,OAAO,CAA6C,EAAoD,EAAE,EAAE;QAC1G,OAAO,CAAC,oBAAkD,EAAE,EAAE;YAC5D,MAAM,cAAc,GAAiD,CAAC,OAA8C,EAAE,EAAE;gBACtH,MAAM,SAAS,GAA4B,CAAC,KAAQ,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;gBACtI,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC;YAEF,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAXD,0FAWC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./blocking"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./call"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./event"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./taskqueue"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v2/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,iDAAuB;AACvB,kDAAwB;AACxB,sDAA4B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PromiseOrValue } from '@dereekb/util';
|
|
2
|
+
import { TaskQueueFunction } from 'firebase-functions/v2/tasks';
|
|
3
|
+
import { MakeNestContext, NestApplicationFunctionFactory } from '../../nest.provider';
|
|
4
|
+
export declare type TaskQueueFunctionHandler<E = unknown> = (event: E) => PromiseOrValue<void>;
|
|
5
|
+
export declare type NestContextTaskQueueFunctionHandler<C, E = unknown> = (nest: C, event: E) => PromiseOrValue<void>;
|
|
6
|
+
export declare type NestContextTaskQueueFunctionHandlerBuilder<C, E = unknown> = (handler: NestContextTaskQueueFunctionHandler<C, E>) => TaskQueueFunctionHandler<E>;
|
|
7
|
+
export declare type TaskQueueFunctionHandlerWithNestContextBuilder<C, E = unknown> = (nest: NestContextTaskQueueFunctionHandlerBuilder<C, E>) => TaskQueueFunction<E>;
|
|
8
|
+
/**
|
|
9
|
+
* Factory function for generating a TaskQueueFunction for a specific task.
|
|
10
|
+
*/
|
|
11
|
+
export declare type TaskQueueFunctionHandlerWithNestContextFactory<C> = <E = unknown>(fn: TaskQueueFunctionHandlerWithNestContextBuilder<C, E>) => NestApplicationFunctionFactory<TaskQueueFunction<E>>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a TaskQueueFunctionHandlerWithNestContextFactory.
|
|
14
|
+
*
|
|
15
|
+
* @param appFactory
|
|
16
|
+
* @param makeNestContext
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare function taskQueueFunctionHandlerWithNestContextFactory<C>(makeNestContext: MakeNestContext<C>): TaskQueueFunctionHandlerWithNestContextFactory<C>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taskQueueFunctionHandlerWithNestContextFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a TaskQueueFunctionHandlerWithNestContextFactory.
|
|
6
|
+
*
|
|
7
|
+
* @param appFactory
|
|
8
|
+
* @param makeNestContext
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function taskQueueFunctionHandlerWithNestContextFactory(makeNestContext) {
|
|
12
|
+
return (fn) => {
|
|
13
|
+
return (nestAppPromiseGetter) => {
|
|
14
|
+
const handlerBuilder = (handler) => {
|
|
15
|
+
const fnHandler = (event) => nestAppPromiseGetter().then((nest) => handler(makeNestContext(nest), event));
|
|
16
|
+
return fnHandler;
|
|
17
|
+
};
|
|
18
|
+
return fn(handlerBuilder);
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.taskQueueFunctionHandlerWithNestContextFactory = taskQueueFunctionHandlerWithNestContextFactory;
|
|
23
|
+
//# sourceMappingURL=taskqueue.js.map
|