@h4ad/serverless-adapter 2.8.1 → 2.9.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/lib/@types/digital-ocean/digital-ocean-http-event.d.ts +38 -0
- package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts.map +1 -0
- package/lib/@types/digital-ocean/digital-ocean-http-event.js +7 -0
- package/lib/@types/digital-ocean/digital-ocean-http-event.js.map +1 -0
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts +23 -0
- package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts.map +1 -0
- package/lib/@types/digital-ocean/digital-ocean-http-response.js +7 -0
- package/lib/@types/digital-ocean/digital-ocean-http-response.js.map +1 -0
- package/lib/@types/digital-ocean/index.d.ts +2 -0
- package/lib/@types/digital-ocean/index.d.ts.map +1 -0
- package/lib/@types/digital-ocean/index.js +18 -0
- package/lib/@types/digital-ocean/index.js.map +1 -0
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts +66 -0
- package/lib/adapters/digital-ocean/http-function.adapter.d.ts.map +1 -0
- package/lib/adapters/digital-ocean/http-function.adapter.js +118 -0
- package/lib/adapters/digital-ocean/http-function.adapter.js.map +1 -0
- package/lib/adapters/digital-ocean/index.d.ts +2 -0
- package/lib/adapters/digital-ocean/index.d.ts.map +1 -0
- package/lib/adapters/digital-ocean/index.js +18 -0
- package/lib/adapters/digital-ocean/index.js.map +1 -0
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts +17 -0
- package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts.map +1 -0
- package/lib/handlers/digital-ocean/digital-ocean.handler.js +34 -0
- package/lib/handlers/digital-ocean/digital-ocean.handler.js.map +1 -0
- package/lib/handlers/digital-ocean/index.d.ts +2 -0
- package/lib/handlers/digital-ocean/index.d.ts.map +1 -0
- package/lib/handlers/digital-ocean/index.js +18 -0
- package/lib/handlers/digital-ocean/index.js.map +1 -0
- package/package.json +10 -7
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SingleValueHeaders } from '../headers';
|
|
2
|
+
/**
|
|
3
|
+
* The interface to represents the values of args send when someone calls a function using HTTP Endpoint.
|
|
4
|
+
* To be able to receive this event, inside your `project.yml`, instead of `web: true` change to `web: 'raw'`.
|
|
5
|
+
*
|
|
6
|
+
* {@link https://www.digitalocean.com/community/questions/digitalocean-functions-how-to-differentiate-query-params-from-body-params | Reference}
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
* @breadcrumb Types / Digital Ocean / DigitalOceanHttpEvent
|
|
10
|
+
*/
|
|
11
|
+
export interface DigitalOceanHttpEvent {
|
|
12
|
+
/**
|
|
13
|
+
* The HTTP Method of the request
|
|
14
|
+
*/
|
|
15
|
+
__ow_method: string;
|
|
16
|
+
/**
|
|
17
|
+
* The query porams of the request
|
|
18
|
+
*/
|
|
19
|
+
__ow_query: string;
|
|
20
|
+
/**
|
|
21
|
+
* The body of the request.
|
|
22
|
+
*/
|
|
23
|
+
__ow_body?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Indicates if body is base64 string
|
|
26
|
+
*/
|
|
27
|
+
__ow_isBase64Encoded?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The HTTP Headers of the request
|
|
30
|
+
*/
|
|
31
|
+
__ow_headers: SingleValueHeaders;
|
|
32
|
+
/**
|
|
33
|
+
* The path in the request
|
|
34
|
+
*/
|
|
35
|
+
__ow_path: string;
|
|
36
|
+
}
|
|
37
|
+
export declare type __ΩDigitalOceanHttpEvent = any[];
|
|
38
|
+
//# sourceMappingURL=digital-ocean-http-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digital-ocean-http-event.d.ts","sourceRoot":"","sources":["../../../src/@types/digital-ocean/digital-ocean-http-event.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,YAAY,EAAE,kBAAkB,CAAC;IAEjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__ΩDigitalOceanHttpEvent = void 0;
|
|
4
|
+
const { __ΩSingleValueHeaders } = require('../headers');
|
|
5
|
+
const __ΩDigitalOceanHttpEvent = ['__ow_method', '__ow_query', '__ow_body', '__ow_isBase64Encoded', () => __ΩSingleValueHeaders, '__ow_headers', '__ow_path', 'P&4!&4"&4#8)4$8n%4&&4\'M'];
|
|
6
|
+
exports.__ΩDigitalOceanHttpEvent = __ΩDigitalOceanHttpEvent;
|
|
7
|
+
//# sourceMappingURL=digital-ocean-http-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digital-ocean-http-event.js","sourceRoot":"","sources":["../../../src/@types/digital-ocean/digital-ocean-http-event.ts"],"names":[],"mappings":";;;0CAEmC,YAAY"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SingleValueHeaders } from '../headers';
|
|
2
|
+
/**
|
|
3
|
+
* The interface to represents the response of Digital Ocean Function.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
* @breadcrumb Types / Digital Ocean / DigitalOceanHttpResponse
|
|
7
|
+
*/
|
|
8
|
+
export interface DigitalOceanHttpResponse {
|
|
9
|
+
/**
|
|
10
|
+
* The HTTP Headers of the response
|
|
11
|
+
*/
|
|
12
|
+
headers?: SingleValueHeaders;
|
|
13
|
+
/**
|
|
14
|
+
* The body of the response
|
|
15
|
+
*/
|
|
16
|
+
body: unknown;
|
|
17
|
+
/**
|
|
18
|
+
* The HTTP Status code of the response
|
|
19
|
+
*/
|
|
20
|
+
statusCode: number;
|
|
21
|
+
}
|
|
22
|
+
export declare type __ΩDigitalOceanHttpResponse = any[];
|
|
23
|
+
//# sourceMappingURL=digital-ocean-http-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digital-ocean-http-response.d.ts","sourceRoot":"","sources":["../../../src/@types/digital-ocean/digital-ocean-http-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__ΩDigitalOceanHttpResponse = void 0;
|
|
4
|
+
const { __ΩSingleValueHeaders } = require('../headers');
|
|
5
|
+
const __ΩDigitalOceanHttpResponse = [() => __ΩSingleValueHeaders, 'headers', 'body', 'statusCode', 'Pn!4"8#4#\'4$M'];
|
|
6
|
+
exports.__ΩDigitalOceanHttpResponse = __ΩDigitalOceanHttpResponse;
|
|
7
|
+
//# sourceMappingURL=digital-ocean-http-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digital-ocean-http-response.js","sourceRoot":"","sources":["../../../src/@types/digital-ocean/digital-ocean-http-response.ts"],"names":[],"mappings":";;;0CAEmC,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/@types/digital-ocean/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./digital-ocean-http-event"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/@types/digital-ocean/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DigitalOceanHttpEvent } from '../../@types/digital-ocean';
|
|
2
|
+
import { DigitalOceanHttpResponse } from '../../@types/digital-ocean/digital-ocean-http-response';
|
|
3
|
+
import { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps } from '../../contracts';
|
|
4
|
+
/**
|
|
5
|
+
* The options to customize the {@link HttpFunctionAdapter}
|
|
6
|
+
*
|
|
7
|
+
* @breadcrumb Adapters / Digital Ocean / HttpFunctionAdapter
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface HttpFunctionAdapterOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Strip base path for custom domains
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue ''
|
|
15
|
+
*/
|
|
16
|
+
stripBasePath?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The adapter to handle requests from Digital Ocean Functions when called from HTTP Endpoint.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const stripBasePath = '/any/custom/base/path'; // default ''
|
|
24
|
+
* const adapter = new HttpFunctionAdapter({ stripBasePath });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @breadcrumb Adapters / Digital Ocean / HttpFunctionAdapter
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare class HttpFunctionAdapter implements AdapterContract<DigitalOceanHttpEvent, void, DigitalOceanHttpResponse> {
|
|
31
|
+
protected readonly options?: HttpFunctionAdapterOptions | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Default constructor
|
|
34
|
+
*
|
|
35
|
+
* @param options - The options to customize the {@link HttpFunctionAdapter}
|
|
36
|
+
*/
|
|
37
|
+
constructor(options?: HttpFunctionAdapterOptions | undefined);
|
|
38
|
+
/**
|
|
39
|
+
* {@inheritDoc}
|
|
40
|
+
*/
|
|
41
|
+
getAdapterName(): string;
|
|
42
|
+
/**
|
|
43
|
+
* {@inheritDoc}
|
|
44
|
+
*/
|
|
45
|
+
canHandle(event: unknown): event is DigitalOceanHttpEvent;
|
|
46
|
+
/**
|
|
47
|
+
* {@inheritDoc}
|
|
48
|
+
*/
|
|
49
|
+
getRequest(event: DigitalOceanHttpEvent): AdapterRequest;
|
|
50
|
+
/**
|
|
51
|
+
* {@inheritDoc}
|
|
52
|
+
*/
|
|
53
|
+
getResponse({ headers: responseHeaders, body, statusCode, }: GetResponseAdapterProps<DigitalOceanHttpEvent>): DigitalOceanHttpResponse;
|
|
54
|
+
/**
|
|
55
|
+
* {@inheritDoc}
|
|
56
|
+
*/
|
|
57
|
+
onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<DigitalOceanHttpEvent, DigitalOceanHttpResponse>): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get path from event with query strings
|
|
60
|
+
*
|
|
61
|
+
* @param event - The event sent by digital ocean
|
|
62
|
+
*/
|
|
63
|
+
protected getPathFromEvent(event: DigitalOceanHttpEvent): string;
|
|
64
|
+
}
|
|
65
|
+
export declare type __ΩHttpFunctionAdapterOptions = any[];
|
|
66
|
+
//# sourceMappingURL=http-function.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-function.adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/digital-ocean/http-function.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAUzB;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,mBACX,YACE,eAAe,CAAC,qBAAqB,EAAE,IAAI,EAAE,wBAAwB,CAAC;IAS5D,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;IALvC;;;;OAIG;gBAC4B,OAAO,CAAC,wCAA4B;IAMnE;;OAEG;IACI,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB;IAWhE;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,qBAAqB,GAAG,cAAc;IA4B/D;;OAEG;IACI,WAAW,CAAC,EACjB,OAAO,EAAE,eAAe,EACxB,IAAI,EACJ,UAAU,GACX,EAAE,uBAAuB,CAAC,qBAAqB,CAAC,GAAG,wBAAwB;IAU5E;;OAEG;IACI,sBAAsB,CAAC,EAC5B,KAAK,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,EACL,GAAG,GACJ,EAAE,YAAY,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,IAAI;IAkBvE;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM;CAcjE"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpFunctionAdapter = exports.__ΩHttpFunctionAdapterOptions = void 0;
|
|
4
|
+
const { __ΩDigitalOceanHttpEvent } = require('../../@types/digital-ocean');
|
|
5
|
+
const { __ΩAdapterRequest } = require('../../contracts');
|
|
6
|
+
const { __ΩGetResponseAdapterProps } = require('../../contracts');
|
|
7
|
+
const { __ΩDigitalOceanHttpResponse } = require('../../@types/digital-ocean/digital-ocean-http-response');
|
|
8
|
+
const { __ΩOnErrorProps } = require('../../contracts');
|
|
9
|
+
const core_1 = require("../../core");
|
|
10
|
+
const __ΩHttpFunctionAdapterOptions = ['stripBasePath', 'P&4!8M'];
|
|
11
|
+
exports.__ΩHttpFunctionAdapterOptions = __ΩHttpFunctionAdapterOptions;
|
|
12
|
+
/**
|
|
13
|
+
* The adapter to handle requests from Digital Ocean Functions when called from HTTP Endpoint.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const stripBasePath = '/any/custom/base/path'; // default ''
|
|
18
|
+
* const adapter = new HttpFunctionAdapter({ stripBasePath });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @breadcrumb Adapters / Digital Ocean / HttpFunctionAdapter
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
class HttpFunctionAdapter {
|
|
25
|
+
//#region Constructor
|
|
26
|
+
/**
|
|
27
|
+
* Default constructor
|
|
28
|
+
*
|
|
29
|
+
* @param options - The options to customize the {@link HttpFunctionAdapter}
|
|
30
|
+
*/
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.options = options;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region Public Methods
|
|
36
|
+
/**
|
|
37
|
+
* {@inheritDoc}
|
|
38
|
+
*/
|
|
39
|
+
getAdapterName() {
|
|
40
|
+
return HttpFunctionAdapter.name;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* {@inheritDoc}
|
|
44
|
+
*/
|
|
45
|
+
canHandle(event) {
|
|
46
|
+
const digitalOceanHttpEvent = event;
|
|
47
|
+
return (!!digitalOceanHttpEvent &&
|
|
48
|
+
digitalOceanHttpEvent.__ow_path !== undefined &&
|
|
49
|
+
digitalOceanHttpEvent.__ow_method !== undefined &&
|
|
50
|
+
digitalOceanHttpEvent.__ow_headers !== undefined);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* {@inheritDoc}
|
|
54
|
+
*/
|
|
55
|
+
getRequest(event) {
|
|
56
|
+
const headers = event.__ow_headers;
|
|
57
|
+
const method = event.__ow_method.toUpperCase();
|
|
58
|
+
const path = this.getPathFromEvent(event);
|
|
59
|
+
let body;
|
|
60
|
+
if (event.__ow_body) {
|
|
61
|
+
const [bufferBody, contentLength] = (0, core_1.getEventBodyAsBuffer)(event.__ow_body, !!event.__ow_isBase64Encoded);
|
|
62
|
+
body = bufferBody;
|
|
63
|
+
headers['content-length'] = String(contentLength);
|
|
64
|
+
}
|
|
65
|
+
const remoteAddress = headers['x-forwarded-for'];
|
|
66
|
+
return {
|
|
67
|
+
method,
|
|
68
|
+
headers,
|
|
69
|
+
body,
|
|
70
|
+
remoteAddress,
|
|
71
|
+
path,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* {@inheritDoc}
|
|
76
|
+
*/
|
|
77
|
+
getResponse({ headers: responseHeaders, body, statusCode, }) {
|
|
78
|
+
const headers = (0, core_1.getFlattenedHeadersMap)(responseHeaders);
|
|
79
|
+
return {
|
|
80
|
+
statusCode,
|
|
81
|
+
body,
|
|
82
|
+
headers,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* {@inheritDoc}
|
|
87
|
+
*/
|
|
88
|
+
onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }) {
|
|
89
|
+
const body = respondWithErrors ? error.stack : '';
|
|
90
|
+
const errorResponse = this.getResponse({
|
|
91
|
+
event,
|
|
92
|
+
statusCode: 500,
|
|
93
|
+
body: body || '',
|
|
94
|
+
headers: {},
|
|
95
|
+
isBase64Encoded: false,
|
|
96
|
+
log,
|
|
97
|
+
});
|
|
98
|
+
delegatedResolver.succeed(errorResponse);
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region Protected Methods
|
|
102
|
+
/**
|
|
103
|
+
* Get path from event with query strings
|
|
104
|
+
*
|
|
105
|
+
* @param event - The event sent by digital ocean
|
|
106
|
+
*/
|
|
107
|
+
getPathFromEvent(event) {
|
|
108
|
+
var _a;
|
|
109
|
+
const stripBasePath = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.stripBasePath, '');
|
|
110
|
+
const replaceRegex = new RegExp(`^${stripBasePath}`);
|
|
111
|
+
const path = event.__ow_path.replace(replaceRegex, '');
|
|
112
|
+
const queryParams = event.__ow_query;
|
|
113
|
+
return (0, core_1.getPathWithQueryStringParams)(path, queryParams || {});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.HttpFunctionAdapter = HttpFunctionAdapter;
|
|
117
|
+
HttpFunctionAdapter.__type = [() => __ΩHttpFunctionAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle', () => __ΩDigitalOceanHttpEvent, () => __ΩAdapterRequest, 'getRequest', () => __ΩGetResponseAdapterProps, () => __ΩDigitalOceanHttpEvent, 'param0', () => __ΩDigitalOceanHttpResponse, 'getResponse', () => __ΩOnErrorProps, () => __ΩDigitalOceanHttpEvent, () => __ΩDigitalOceanHttpResponse, 'onErrorWhileForwarding', () => __ΩDigitalOceanHttpEvent, 'getPathFromEvent', () => __ΩDigitalOceanHttpEvent, () => __ΩDigitalOceanHttpResponse, 'Pn!2"8<9"0#P&0$P#2%!0&Pn\'2%n(0)Pn+o*"2,n-0.Pn0n1o/#2,$02Pn32%&04<5n5$n66$'];
|
|
118
|
+
//# sourceMappingURL=http-function.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-function.adapter.js","sourceRoot":"","sources":["../../../src/adapters/digital-ocean/http-function.adapter.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/digital-ocean/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./http-function.adapter"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/digital-ocean/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BinarySettings } from '../../@types';
|
|
2
|
+
import { AdapterContract, FrameworkContract, ResolverContract, ServerlessHandler } from '../../contracts';
|
|
3
|
+
import { ILogger } from '../../core';
|
|
4
|
+
import { DefaultHandler } from '../default';
|
|
5
|
+
/**
|
|
6
|
+
* The class that implements a serverless handler for Digital Ocean Functions.
|
|
7
|
+
*
|
|
8
|
+
* @breadcrumb Handlers / DigitalOceanHandler
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare class DigitalOceanHandler<TApp, TEvent, TResponse, TReturn> extends DefaultHandler<TApp, TEvent, void, void, TResponse, TReturn> {
|
|
12
|
+
/**
|
|
13
|
+
* {@inheritDoc}
|
|
14
|
+
*/
|
|
15
|
+
getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, void, TResponse>[], resolverFactory: ResolverContract<TEvent, void, void, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=digital-ocean.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digital-ocean.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/digital-ocean/digital-ocean.handler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C;;;;;GAKG;AACH,qBAAa,mBAAmB,CAC9B,IAAI,EACJ,MAAM,EACN,SAAS,EACT,OAAO,CACP,SAAQ,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;IACpE;;OAEG;IACI,UAAU,CACf,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EACpD,eAAe,EAAE,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EACzE,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC;CAc9B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DigitalOceanHandler = void 0;
|
|
4
|
+
const { __ΩDigitalOceanHttpEvent } = require('../../@types/digital-ocean');
|
|
5
|
+
const { __ΩFrameworkContract } = require('../../contracts');
|
|
6
|
+
const { __ΩAdapterContract } = require('../../contracts');
|
|
7
|
+
const { __ΩResolverContract } = require('../../contracts');
|
|
8
|
+
const { __ΩBinarySettings } = require('../../@types');
|
|
9
|
+
const { __ΩILogger } = require('../../core');
|
|
10
|
+
const { __ΩServerlessHandler } = require('../../contracts');
|
|
11
|
+
function __assignType(fn, args) {
|
|
12
|
+
fn.__type = args;
|
|
13
|
+
return fn;
|
|
14
|
+
}
|
|
15
|
+
const default_1 = require("../default");
|
|
16
|
+
//#endregion
|
|
17
|
+
/**
|
|
18
|
+
* The class that implements a serverless handler for Digital Ocean Functions.
|
|
19
|
+
*
|
|
20
|
+
* @breadcrumb Handlers / DigitalOceanHandler
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
class DigitalOceanHandler extends default_1.DefaultHandler {
|
|
24
|
+
/**
|
|
25
|
+
* {@inheritDoc}
|
|
26
|
+
*/
|
|
27
|
+
getHandler(app, framework, adapters, resolverFactory, binarySettings, respondWithErrors, log) {
|
|
28
|
+
const defaultHandler = super.getHandler(app, framework, adapters, resolverFactory, binarySettings, respondWithErrors, log);
|
|
29
|
+
return __assignType((event) => defaultHandler(event, undefined, undefined), [() => __ΩDigitalOceanHttpEvent, 'event', '', 'Pn!2""/#']);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.DigitalOceanHandler = DigitalOceanHandler;
|
|
33
|
+
DigitalOceanHandler.__type = ['TApp', 'TEvent', 'TResponse', 'TReturn', () => default_1.DefaultHandler, 'app', () => __ΩFrameworkContract, 'framework', () => __ΩAdapterContract, 'adapters', () => __ΩResolverContract, 'resolverFactory', () => __ΩBinarySettings, 'binarySettings', 'respondWithErrors', () => __ΩILogger, 'log', () => __ΩServerlessHandler, 'getHandler', 'b!b"b#b$Pe"!e""$$e"#e"$7%Pe"!2&e"!o\'"2(e""$e"#o)$F2*e""$$e"#e"$o+&2,n-2.)2/n021e"$o2"035e!!e!"$$e!#e!$6\''];
|
|
34
|
+
//# sourceMappingURL=digital-ocean.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digital-ocean.handler.js","sourceRoot":"","sources":["../../../src/handlers/digital-ocean/digital-ocean.handler.ts"],"names":[],"mappings":";;;6CAIsC,4BAA4B;yCAM3D,iBAAiB;uCAAjB,iBAAiB;wCAAjB,iBAAiB;sCAPO,cAAc;+BAQrB,YAAY;yCAD7B,iBAAiB;;;;;AAExB,wCAA4C;AAE5C,YAAY;AAEZ;;;;;GAKG;AACH,MAAa,mBAKX,SAAQ,wBAA4D;IACpE;;OAEG;IACI,UAAU,CACf,GAAS,EACT,SAAkC,EAClC,QAAoD,EACpD,eAAyE,EACzE,cAA8B,EAC9B,iBAA0B,EAC1B,GAAY;QAEZ,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,GAAG,EACH,SAAS,EACT,QAAQ,EACR,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,GAAG,CACJ,CAAC;QAEF,oBAAO,CAAC,KAA4B,EAAE,EAAE,CACtC,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,6DAAC;IAChD,CAAC;;AA9BH,kDA+BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/handlers/digital-ocean/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./digital-ocean.handler"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/handlers/digital-ocean/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h4ad/serverless-adapter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Huawei and many other clouds.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"api gateway",
|
|
43
43
|
"sqs",
|
|
44
44
|
"sns",
|
|
45
|
-
"lambda
|
|
45
|
+
"lambda edge",
|
|
46
46
|
"alb",
|
|
47
47
|
"lambda",
|
|
48
48
|
"express",
|
|
@@ -55,13 +55,16 @@
|
|
|
55
55
|
"functiongraph",
|
|
56
56
|
"trpc",
|
|
57
57
|
"azure",
|
|
58
|
-
"azure
|
|
59
|
-
"http
|
|
58
|
+
"azure functions",
|
|
59
|
+
"http trigger v4",
|
|
60
60
|
"firebase",
|
|
61
|
-
"firebase
|
|
62
|
-
"firebase
|
|
61
|
+
"firebase functions",
|
|
62
|
+
"firebase http events",
|
|
63
63
|
"deepkit",
|
|
64
|
-
"deepkit http"
|
|
64
|
+
"deepkit http",
|
|
65
|
+
"digital ocean",
|
|
66
|
+
"digital ocean functions",
|
|
67
|
+
"digital ocean serverless"
|
|
65
68
|
],
|
|
66
69
|
"bugs": {
|
|
67
70
|
"url": "https://github.com/H4ad/serverless-adapter/issues"
|