@celljs/lambda-adapter 4.0.0 → 4.2.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/esm/node/api-gateway-application-entry.js +8 -11
- package/esm/node/api-gateway-application-entry.js.map +1 -1
- package/esm/node/module.d.ts +1 -1
- package/lib/node/api-gateway-application-entry.d.ts.map +1 -1
- package/lib/node/api-gateway-application-entry.js +8 -14
- package/lib/node/api-gateway-application-entry.js.map +1 -1
- package/lib/node/module.d.ts +1 -1
- package/package.json +9 -8
- package/src/node/api-gateway-application-entry.ts +9 -12
|
@@ -12,26 +12,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
import { container } from '@celljs/core/lib/common/container/dynamic-container';
|
|
13
13
|
import { Application } from '@celljs/core/lib/common/application/application-protocol';
|
|
14
14
|
import { ContainerProvider } from '@celljs/core/lib/common/container/container-provider';
|
|
15
|
-
import {
|
|
16
|
-
import { Context } from '@celljs/web/lib/node/context';
|
|
15
|
+
import { HttpServerUtil } from '@celljs/web/lib/node/server';
|
|
17
16
|
import { FaaSEventListener } from '@celljs/faas-adapter/lib/node/event/event-protocol';
|
|
18
17
|
import { FaaSUtils } from '@celljs/faas-adapter/lib/node/utils';
|
|
19
|
-
import express from 'express';
|
|
20
18
|
const createProxy = require('@vendia/serverless-express');
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/** Set once the application has started; the proxy only passes requests on after that. */
|
|
20
|
+
let handle;
|
|
21
|
+
const app = (req, res) => handle(req, res);
|
|
22
|
+
// @vendia/serverless-express calls app.handle(req, res) for express-style apps.
|
|
23
|
+
const proxy = createProxy({ app: { handle: app } });
|
|
23
24
|
let listeners;
|
|
24
25
|
function start() {
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
27
|
const c = yield container;
|
|
27
28
|
ContainerProvider.set(c);
|
|
28
|
-
app.all('*', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const dispatcher = c.get(Dispatcher);
|
|
30
|
-
const httpContext = new Context(req, res);
|
|
31
|
-
Context.run(() => dispatcher.dispatch(httpContext));
|
|
32
|
-
}));
|
|
33
29
|
listeners = c.getAll(FaaSEventListener);
|
|
34
|
-
|
|
30
|
+
yield c.get(Application).start();
|
|
31
|
+
handle = HttpServerUtil.createHandler(c);
|
|
35
32
|
});
|
|
36
33
|
}
|
|
37
34
|
const startPromise = start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-gateway-application-entry.js","sourceRoot":"","sources":["../../src/node/api-gateway-application-entry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"api-gateway-application-entry.js","sourceRoot":"","sources":["../../src/node/api-gateway-application-entry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,0DAA0D,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,cAAc,EAAmB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,MAAM,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE1D,0FAA0F;AAC1F,IAAI,MAAuB,CAAC;AAE5B,MAAM,GAAG,GAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE5D,gFAAgF;AAChF,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAEpD,IAAI,SAAyC,CAAC;AAE9C,SAAe,KAAK;;QAChB,MAAM,CAAC,GAAG,MAAM,SAAS,CAAC;QAC1B,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzB,SAAS,GAAG,CAAC,CAAC,MAAM,CAA+B,iBAAiB,CAAC,CAAC;QACtE,MAAM,CAAC,CAAC,GAAG,CAAc,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9C,MAAM,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;CAAA;AAED,MAAM,YAAY,GAAG,KAAK,EAAE,CAAC;AAE7B,MAAM,UAAgB,OAAO,CAAC,KAAa,EAAE,OAAY;;QACrD,MAAM,YAAY,CAAC;QACnB,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,8BAA8B,GAAG,SAAS,CAAC,iCAAiC,EAAE,CAAC;QACvF,OAAO,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;CAAA"}
|
package/esm/node/module.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-gateway-application-entry.d.ts","sourceRoot":"","sources":["../../src/node/api-gateway-application-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-gateway-application-entry.d.ts","sourceRoot":"","sources":["../../src/node/api-gateway-application-entry.ts"],"names":[],"mappings":"AA4BA,wBAAsB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,gBAKxD"}
|
|
@@ -8,34 +8,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.handler = handler;
|
|
16
13
|
const dynamic_container_1 = require("@celljs/core/lib/common/container/dynamic-container");
|
|
17
14
|
const application_protocol_1 = require("@celljs/core/lib/common/application/application-protocol");
|
|
18
15
|
const container_provider_1 = require("@celljs/core/lib/common/container/container-provider");
|
|
19
|
-
const
|
|
20
|
-
const context_1 = require("@celljs/web/lib/node/context");
|
|
16
|
+
const server_1 = require("@celljs/web/lib/node/server");
|
|
21
17
|
const event_protocol_1 = require("@celljs/faas-adapter/lib/node/event/event-protocol");
|
|
22
18
|
const utils_1 = require("@celljs/faas-adapter/lib/node/utils");
|
|
23
|
-
const express_1 = __importDefault(require("express"));
|
|
24
19
|
const createProxy = require('@vendia/serverless-express');
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
/** Set once the application has started; the proxy only passes requests on after that. */
|
|
21
|
+
let handle;
|
|
22
|
+
const app = (req, res) => handle(req, res);
|
|
23
|
+
// @vendia/serverless-express calls app.handle(req, res) for express-style apps.
|
|
24
|
+
const proxy = createProxy({ app: { handle: app } });
|
|
27
25
|
let listeners;
|
|
28
26
|
function start() {
|
|
29
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
28
|
const c = yield dynamic_container_1.container;
|
|
31
29
|
container_provider_1.ContainerProvider.set(c);
|
|
32
|
-
app.all('*', (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const dispatcher = c.get(dispatcher_protocol_1.Dispatcher);
|
|
34
|
-
const httpContext = new context_1.Context(req, res);
|
|
35
|
-
context_1.Context.run(() => dispatcher.dispatch(httpContext));
|
|
36
|
-
}));
|
|
37
30
|
listeners = c.getAll(event_protocol_1.FaaSEventListener);
|
|
38
|
-
|
|
31
|
+
yield c.get(application_protocol_1.Application).start();
|
|
32
|
+
handle = server_1.HttpServerUtil.createHandler(c);
|
|
39
33
|
});
|
|
40
34
|
}
|
|
41
35
|
const startPromise = start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-gateway-application-entry.js","sourceRoot":"","sources":["../../src/node/api-gateway-application-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-gateway-application-entry.js","sourceRoot":"","sources":["../../src/node/api-gateway-application-entry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2FAAgF;AAChF,mGAAuF;AACvF,6FAAyF;AACzF,wDAA8E;AAC9E,uFAAuF;AACvF,+DAAgE;AAChE,MAAM,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE1D,0FAA0F;AAC1F,IAAI,MAAuB,CAAC;AAE5B,MAAM,GAAG,GAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE5D,gFAAgF;AAChF,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;AAEpD,IAAI,SAAyC,CAAC;AAE9C,SAAe,KAAK;;QAChB,MAAM,CAAC,GAAG,MAAM,6BAAS,CAAC;QAC1B,sCAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzB,SAAS,GAAG,CAAC,CAAC,MAAM,CAA+B,kCAAiB,CAAC,CAAC;QACtE,MAAM,CAAC,CAAC,GAAG,CAAc,kCAAW,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9C,MAAM,GAAG,uBAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;CAAA;AAED,MAAM,YAAY,GAAG,KAAK,EAAE,CAAC;AAE7B,iBAA8B,KAAa,EAAE,OAAY;;QACrD,MAAM,YAAY,CAAC;QACnB,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,8BAA8B,GAAG,iBAAS,CAAC,iCAAiC,EAAE,CAAC;QACvF,OAAO,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;CAAA"}
|
package/lib/node/module.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/lambda-adapter",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
"url": "https://github.com/cellbang/cell.git"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18.0.0"
|
|
19
|
+
},
|
|
17
20
|
"main": "lib/node/index.js",
|
|
18
21
|
"typings": "lib/node/index.d.ts",
|
|
19
22
|
"files": [
|
|
@@ -32,13 +35,11 @@
|
|
|
32
35
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
|
-
"@celljs/cloud": "4.
|
|
36
|
-
"@celljs/core": "4.
|
|
37
|
-
"@celljs/faas-adapter": "4.
|
|
38
|
-
"@celljs/web": "4.
|
|
39
|
-
"@vendia/serverless-express": "^4.5.2"
|
|
40
|
-
"express": "^4.17.1",
|
|
41
|
-
"tslib": "^2.8.0"
|
|
38
|
+
"@celljs/cloud": "4.2.0",
|
|
39
|
+
"@celljs/core": "4.2.0",
|
|
40
|
+
"@celljs/faas-adapter": "4.2.0",
|
|
41
|
+
"@celljs/web": "4.2.0",
|
|
42
|
+
"@vendia/serverless-express": "^4.5.2"
|
|
42
43
|
},
|
|
43
44
|
"publishConfig": {
|
|
44
45
|
"access": "public"
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { container } from '@celljs/core/lib/common/container/dynamic-container';
|
|
2
2
|
import { Application } from '@celljs/core/lib/common/application/application-protocol';
|
|
3
3
|
import { ContainerProvider } from '@celljs/core/lib/common/container/container-provider';
|
|
4
|
-
import {
|
|
5
|
-
import { Context } from '@celljs/web/lib/node/context';
|
|
4
|
+
import { HttpServerUtil, RequestListener } from '@celljs/web/lib/node/server';
|
|
6
5
|
import { FaaSEventListener } from '@celljs/faas-adapter/lib/node/event/event-protocol';
|
|
7
6
|
import { FaaSUtils } from '@celljs/faas-adapter/lib/node/utils';
|
|
8
|
-
import express from 'express';
|
|
9
7
|
const createProxy = require('@vendia/serverless-express');
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
/** Set once the application has started; the proxy only passes requests on after that. */
|
|
10
|
+
let handle: RequestListener;
|
|
12
11
|
|
|
13
|
-
const
|
|
12
|
+
const app: RequestListener = (req, res) => handle(req, res);
|
|
13
|
+
|
|
14
|
+
// @vendia/serverless-express calls app.handle(req, res) for express-style apps.
|
|
15
|
+
const proxy = createProxy({ app: { handle: app } });
|
|
14
16
|
|
|
15
17
|
let listeners: FaaSEventListener<any, void>[];
|
|
16
18
|
|
|
17
19
|
async function start() {
|
|
18
20
|
const c = await container;
|
|
19
21
|
ContainerProvider.set(c);
|
|
20
|
-
app.all('*', async (req: any, res: any) => {
|
|
21
|
-
const dispatcher = c.get<Dispatcher<Context>>(Dispatcher);
|
|
22
|
-
const httpContext = new Context(req, res);
|
|
23
|
-
Context.run(() => dispatcher.dispatch(httpContext));
|
|
24
|
-
});
|
|
25
22
|
listeners = c.getAll<FaaSEventListener<any, void>>(FaaSEventListener);
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
await c.get<Application>(Application).start();
|
|
24
|
+
handle = HttpServerUtil.createHandler(c);
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
const startPromise = start();
|