@h4ad/serverless-adapter 2.13.0 → 2.14.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/adapters/aws/base/aws-simple-adapter.d.ts +85 -0
- package/lib/adapters/aws/base/aws-simple-adapter.js +99 -0
- package/lib/adapters/aws/base/aws-simple-adapter.js.map +1 -0
- package/lib/adapters/aws/base/index.d.ts +1 -0
- package/lib/adapters/aws/base/index.js +18 -0
- package/lib/adapters/aws/base/index.js.map +1 -0
- package/lib/adapters/aws/dynamodb.adapter.d.ts +5 -19
- package/lib/adapters/aws/dynamodb.adapter.js +12 -39
- package/lib/adapters/aws/dynamodb.adapter.js.map +1 -1
- package/lib/adapters/aws/event-bridge.adapter.d.ts +4 -18
- package/lib/adapters/aws/event-bridge.adapter.js +10 -38
- package/lib/adapters/aws/event-bridge.adapter.js.map +1 -1
- package/lib/adapters/aws/index.d.ts +1 -0
- package/lib/adapters/aws/index.js +1 -0
- package/lib/adapters/aws/index.js.map +1 -1
- package/lib/adapters/aws/s3.adapter.d.ts +5 -19
- package/lib/adapters/aws/s3.adapter.js +11 -39
- package/lib/adapters/aws/s3.adapter.js.map +1 -1
- package/lib/adapters/aws/sns.adapter.d.ts +4 -18
- package/lib/adapters/aws/sns.adapter.js +10 -38
- package/lib/adapters/aws/sns.adapter.js.map +1 -1
- package/lib/adapters/aws/sqs.adapter.d.ts +6 -20
- package/lib/adapters/aws/sqs.adapter.js +13 -40
- package/lib/adapters/aws/sqs.adapter.js.map +1 -1
- package/lib/frameworks/body-parser/base-body-parser.framework.d.ts +3 -0
- package/lib/frameworks/body-parser/base-body-parser.framework.js.map +1 -1
- package/lib/handlers/firebase/http-firebase.handler.js +20 -5
- package/lib/handlers/firebase/http-firebase.handler.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Context, SQSBatchItemFailure } from 'aws-lambda';
|
|
2
|
+
import { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps } from '../../../contracts/index';
|
|
3
|
+
import { IEmptyResponse } from '../../../core/index';
|
|
4
|
+
/**
|
|
5
|
+
* The options to customize the {@link AwsSimpleAdapter}
|
|
6
|
+
*
|
|
7
|
+
* @breadcrumb Adapters / AWS / AWS Simple Adapter
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface AWSSimpleAdapterOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The path that will be used to create a request to be forwarded to the framework.
|
|
13
|
+
*/
|
|
14
|
+
forwardPath: string;
|
|
15
|
+
/**
|
|
16
|
+
* The http method that will be used to create a request to be forwarded to the framework.
|
|
17
|
+
*/
|
|
18
|
+
forwardMethod: string;
|
|
19
|
+
/**
|
|
20
|
+
* The AWS Service host that will be injected inside headers to developer being able to validate if request originate from the library.
|
|
21
|
+
*/
|
|
22
|
+
host: string;
|
|
23
|
+
/**
|
|
24
|
+
* Tells if this adapter should support batch item failures.
|
|
25
|
+
*/
|
|
26
|
+
batch?: true | false;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The batch item failure response expected from the API server
|
|
30
|
+
*
|
|
31
|
+
* @breadcrumb Adapters / AWS / AWS Simple Adapter
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare type BatchItemFailureResponse = SQSBatchItemFailure;
|
|
35
|
+
/**
|
|
36
|
+
* The possible options of response for {@link AwsSimpleAdapter}
|
|
37
|
+
*
|
|
38
|
+
* @breadcrumb Adapters / AWS / AWS Simple Adapter
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export declare type AWSSimpleAdapterResponseType = BatchItemFailureResponse | IEmptyResponse;
|
|
42
|
+
/**
|
|
43
|
+
* The abstract adapter to use to implement other simple AWS adapters
|
|
44
|
+
*
|
|
45
|
+
* @breadcrumb Adapters / AWS / AWS Simple Adapter
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare abstract class AwsSimpleAdapter<TEvent> implements AdapterContract<TEvent, Context, AWSSimpleAdapterResponseType> {
|
|
49
|
+
protected readonly options: AWSSimpleAdapterOptions;
|
|
50
|
+
/**
|
|
51
|
+
* Default constructor
|
|
52
|
+
*
|
|
53
|
+
* @param options - The options to customize the {@link AwsSimpleAdapter}
|
|
54
|
+
*/
|
|
55
|
+
constructor(options: AWSSimpleAdapterOptions);
|
|
56
|
+
/**
|
|
57
|
+
* {@inheritDoc}
|
|
58
|
+
*/
|
|
59
|
+
getAdapterName(): string;
|
|
60
|
+
/**
|
|
61
|
+
* {@inheritDoc}
|
|
62
|
+
*/
|
|
63
|
+
canHandle(event: unknown): event is TEvent;
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc}
|
|
66
|
+
*/
|
|
67
|
+
getRequest(event: TEvent): AdapterRequest;
|
|
68
|
+
/**
|
|
69
|
+
* {@inheritDoc}
|
|
70
|
+
*/
|
|
71
|
+
getResponse({ body, headers, isBase64Encoded, event, statusCode, }: GetResponseAdapterProps<TEvent>): AWSSimpleAdapterResponseType;
|
|
72
|
+
/**
|
|
73
|
+
* {@inheritDoc}
|
|
74
|
+
*/
|
|
75
|
+
onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<TEvent, AWSSimpleAdapterResponseType>): void;
|
|
76
|
+
/**
|
|
77
|
+
* Check if the status code is invalid
|
|
78
|
+
*
|
|
79
|
+
* @param statusCode - The status code
|
|
80
|
+
*/
|
|
81
|
+
protected hasInvalidStatusCode(statusCode: number): boolean;
|
|
82
|
+
}
|
|
83
|
+
export declare type __ΩAWSSimpleAdapterOptions = any[];
|
|
84
|
+
export declare type __ΩBatchItemFailureResponse = any[];
|
|
85
|
+
export declare type __ΩAWSSimpleAdapterResponseType = any[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AwsSimpleAdapter = exports.__ΩAWSSimpleAdapterResponseType = exports.__ΩBatchItemFailureResponse = exports.__ΩAWSSimpleAdapterOptions = void 0;
|
|
4
|
+
const { __ΩAdapterRequest } = require('../../../contracts/index');
|
|
5
|
+
const { __ΩGetResponseAdapterProps } = require('../../../contracts/index');
|
|
6
|
+
const { __ΩOnErrorProps } = require('../../../contracts/index');
|
|
7
|
+
const { __ΩIEmptyResponse } = require('../../../core/index');
|
|
8
|
+
const index_1 = require("../../../core/index");
|
|
9
|
+
const __ΩAWSSimpleAdapterOptions = ['forwardPath', 'forwardMethod', 'host', true, false, 'batch', 'P&4!&4"&4#P.$.%J4&8M'];
|
|
10
|
+
exports.__ΩAWSSimpleAdapterOptions = __ΩAWSSimpleAdapterOptions;
|
|
11
|
+
const __ΩBatchItemFailureResponse = ['"'];
|
|
12
|
+
exports.__ΩBatchItemFailureResponse = __ΩBatchItemFailureResponse;
|
|
13
|
+
const __ΩAWSSimpleAdapterResponseType = [() => __ΩBatchItemFailureResponse, () => __ΩIEmptyResponse, 'Pn!n"J'];
|
|
14
|
+
exports.__ΩAWSSimpleAdapterResponseType = __ΩAWSSimpleAdapterResponseType;
|
|
15
|
+
/**
|
|
16
|
+
* The abstract adapter to use to implement other simple AWS adapters
|
|
17
|
+
*
|
|
18
|
+
* @breadcrumb Adapters / AWS / AWS Simple Adapter
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
class AwsSimpleAdapter {
|
|
22
|
+
//#region Constructor
|
|
23
|
+
/**
|
|
24
|
+
* Default constructor
|
|
25
|
+
*
|
|
26
|
+
* @param options - The options to customize the {@link AwsSimpleAdapter}
|
|
27
|
+
*/
|
|
28
|
+
constructor(options) {
|
|
29
|
+
this.options = options;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region Public Methods
|
|
33
|
+
/**
|
|
34
|
+
* {@inheritDoc}
|
|
35
|
+
*/
|
|
36
|
+
getAdapterName() {
|
|
37
|
+
throw new Error('not implemented.');
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* {@inheritDoc}
|
|
41
|
+
*/
|
|
42
|
+
canHandle(event) {
|
|
43
|
+
throw new Error('not implemented.');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* {@inheritDoc}
|
|
47
|
+
*/
|
|
48
|
+
getRequest(event) {
|
|
49
|
+
const path = this.options.forwardPath;
|
|
50
|
+
const method = this.options.forwardMethod;
|
|
51
|
+
const [body, contentLength] = (0, index_1.getEventBodyAsBuffer)(JSON.stringify(event), false);
|
|
52
|
+
const headers = {
|
|
53
|
+
host: this.options.host,
|
|
54
|
+
'content-type': 'application/json',
|
|
55
|
+
'content-length': String(contentLength),
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
method,
|
|
59
|
+
headers,
|
|
60
|
+
body,
|
|
61
|
+
path,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc}
|
|
66
|
+
*/
|
|
67
|
+
getResponse({ body, headers, isBase64Encoded, event, statusCode, }) {
|
|
68
|
+
if (this.hasInvalidStatusCode(statusCode)) {
|
|
69
|
+
throw new Error(JSON.stringify({ body, headers, isBase64Encoded, event, statusCode }));
|
|
70
|
+
}
|
|
71
|
+
if (!this.options.batch)
|
|
72
|
+
return index_1.EmptyResponse;
|
|
73
|
+
if (isBase64Encoded) {
|
|
74
|
+
throw new Error('SERVERLESS_ADAPTER: The response could not be base64 encoded when you set batch: true, the response should be a JSON.');
|
|
75
|
+
}
|
|
76
|
+
if (!body)
|
|
77
|
+
return index_1.EmptyResponse;
|
|
78
|
+
return JSON.parse(body);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* {@inheritDoc}
|
|
82
|
+
*/
|
|
83
|
+
onErrorWhileForwarding({ error, delegatedResolver, }) {
|
|
84
|
+
delegatedResolver.fail(error);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region Protected Methods
|
|
88
|
+
/**
|
|
89
|
+
* Check if the status code is invalid
|
|
90
|
+
*
|
|
91
|
+
* @param statusCode - The status code
|
|
92
|
+
*/
|
|
93
|
+
hasInvalidStatusCode(statusCode) {
|
|
94
|
+
return statusCode < 200 || statusCode >= 400;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.AwsSimpleAdapter = AwsSimpleAdapter;
|
|
98
|
+
AwsSimpleAdapter.__type = ['TEvent', () => __ΩAWSSimpleAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle', () => __ΩAdapterRequest, 'getRequest', () => __ΩGetResponseAdapterProps, 'param0', () => __ΩAWSSimpleAdapterResponseType, 'getResponse', () => __ΩOnErrorProps, () => __ΩAWSSimpleAdapterResponseType, 'onErrorWhileForwarding', 'statusCode', 'hasInvalidStatusCode', () => __ΩAWSSimpleAdapterResponseType, 'b!Pn"2#<9"0$P&0%P#2&!0\'Pe"!2&n(0)Pe"!o*"2+n,0-Pe"!n/o.#2+$00P\'21)02<5e!!"n36$'];
|
|
99
|
+
//# sourceMappingURL=aws-simple-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-simple-adapter.js","sourceRoot":"","sources":["../../../../src/adapters/aws/base/aws-simple-adapter.ts"],"names":[],"mappings":";;;sCAQO,0BAA0B;+CAA1B,0BAA0B;oCAA1B,0BAA0B;sCAK1B,qBAAqB;AAJ5B,+CAI6B;;;;;;;AAkD7B;;;;;GAKG;AACH,MAAsB,gBAAgB;IAGpC,qBAAqB;IAErB;;;;OAIG;IACH,YAA+B,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IAEnE,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,cAAc;QACnB,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,KAAc;QAC7B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,UAAU,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;QAE1C,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,IAAA,4BAAoB,EAChD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EACrB,KAAK,CACN,CAAC;QAEF,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,cAAc,EAAE,kBAAkB;YAClC,gBAAgB,EAAE,MAAM,CAAC,aAAa,CAAC;SACxC,CAAC;QAEF,OAAO;YACL,MAAM;YACN,OAAO;YACP,IAAI;YACJ,IAAI;SACL,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,WAAW,CAAC,EACjB,IAAI,EACJ,OAAO,EACP,eAAe,EACf,KAAK,EACL,UAAU,GACsB;QAChC,IAAI,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE;YACzC,MAAM,IAAI,KAAK,CACb,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CACtE,CAAC;SACH;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK;YAAE,OAAO,qBAAa,CAAC;QAE9C,IAAI,eAAe,EAAE;YACnB,MAAM,IAAI,KAAK,CACb,uHAAuH,CACxH,CAAC;SACH;QAED,IAAI,CAAC,IAAI;YAAE,OAAO,qBAAa,CAAC;QAEhC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,EAC5B,KAAK,EACL,iBAAiB,GACkC;QACnD,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,YAAY;IAEZ,2BAA2B;IAE3B;;;;OAIG;IACO,oBAAoB,CAAC,UAAkB;QAC/C,OAAO,UAAU,GAAG,GAAG,IAAI,UAAU,IAAI,GAAG,CAAC;IAC/C,CAAC;;AA1GH,4CA6GC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './aws-simple-adapter';
|
|
@@ -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("./aws-simple-adapter"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/aws/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { IEmptyResponse } from '../../core';
|
|
1
|
+
import type { DynamoDBStreamEvent } from 'aws-lambda';
|
|
2
|
+
import { AWSSimpleAdapterOptions, AwsSimpleAdapter } from './base/index';
|
|
4
3
|
/**
|
|
5
4
|
* The options to customize the {@link DynamoDBAdapter}
|
|
6
5
|
*
|
|
7
6
|
* @breadcrumb Adapters / AWS / DynamoDBAdapter
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export interface DynamoDBAdapterOptions {
|
|
9
|
+
export interface DynamoDBAdapterOptions extends Pick<AWSSimpleAdapterOptions, 'batch'> {
|
|
11
10
|
/**
|
|
12
11
|
* The path that will be used to create a request to be forwarded to the framework.
|
|
13
12
|
*
|
|
@@ -38,14 +37,13 @@ export interface DynamoDBAdapterOptions {
|
|
|
38
37
|
* @breadcrumb Adapters / AWS / DynamoDBAdapter
|
|
39
38
|
* @public
|
|
40
39
|
*/
|
|
41
|
-
export declare class DynamoDBAdapter
|
|
42
|
-
protected readonly options?: DynamoDBAdapterOptions | undefined;
|
|
40
|
+
export declare class DynamoDBAdapter extends AwsSimpleAdapter<DynamoDBStreamEvent> {
|
|
43
41
|
/**
|
|
44
42
|
* Default constructor
|
|
45
43
|
*
|
|
46
44
|
* @param options - The options to customize the {@link DynamoDBAdapter}
|
|
47
45
|
*/
|
|
48
|
-
constructor(options?: DynamoDBAdapterOptions
|
|
46
|
+
constructor(options?: DynamoDBAdapterOptions);
|
|
49
47
|
/**
|
|
50
48
|
* {@inheritDoc}
|
|
51
49
|
*/
|
|
@@ -54,17 +52,5 @@ export declare class DynamoDBAdapter implements AdapterContract<DynamoDBStreamEv
|
|
|
54
52
|
* {@inheritDoc}
|
|
55
53
|
*/
|
|
56
54
|
canHandle(event: unknown): event is DynamoDBStreamEvent;
|
|
57
|
-
/**
|
|
58
|
-
* {@inheritDoc}
|
|
59
|
-
*/
|
|
60
|
-
getRequest(event: DynamoDBStreamEvent): AdapterRequest;
|
|
61
|
-
/**
|
|
62
|
-
* {@inheritDoc}
|
|
63
|
-
*/
|
|
64
|
-
getResponse(): IEmptyResponse;
|
|
65
|
-
/**
|
|
66
|
-
* {@inheritDoc}
|
|
67
|
-
*/
|
|
68
|
-
onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<DynamoDBStreamEvent, IEmptyResponse>): void;
|
|
69
55
|
}
|
|
70
56
|
export declare type __ΩDynamoDBAdapterOptions = any[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DynamoDBAdapter = exports.__ΩDynamoDBAdapterOptions = void 0;
|
|
4
|
-
const { __Ω
|
|
5
|
-
const
|
|
6
|
-
const { __ΩOnErrorProps } = require('../../contracts');
|
|
4
|
+
const { __ΩAWSSimpleAdapterOptions } = require('./base/index');
|
|
5
|
+
const __ΩPick = ['T', 'K', 'l+e#!e"!fRb!b"Pde""N#!'];
|
|
7
6
|
const core_1 = require("../../core");
|
|
8
|
-
const
|
|
7
|
+
const index_1 = require("./base/index");
|
|
8
|
+
const __ΩDynamoDBAdapterOptions = [() => __ΩPick, () => __ΩAWSSimpleAdapterOptions, "batch", 'dynamoDBForwardPath', 'dynamoDBForwardMethod', 'Pn".#o!#&4$8&4%8M'];
|
|
9
9
|
exports.__ΩDynamoDBAdapterOptions = __ΩDynamoDBAdapterOptions;
|
|
10
10
|
/**
|
|
11
11
|
* The adapter to handle requests from AWS DynamoDB.
|
|
@@ -24,7 +24,7 @@ exports.__ΩDynamoDBAdapterOptions = __ΩDynamoDBAdapterOptions;
|
|
|
24
24
|
* @breadcrumb Adapters / AWS / DynamoDBAdapter
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
class DynamoDBAdapter {
|
|
27
|
+
class DynamoDBAdapter extends index_1.AwsSimpleAdapter {
|
|
28
28
|
//#region Constructor
|
|
29
29
|
/**
|
|
30
30
|
* Default constructor
|
|
@@ -32,7 +32,12 @@ class DynamoDBAdapter {
|
|
|
32
32
|
* @param options - The options to customize the {@link DynamoDBAdapter}
|
|
33
33
|
*/
|
|
34
34
|
constructor(options) {
|
|
35
|
-
|
|
35
|
+
super({
|
|
36
|
+
forwardPath: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.dynamoDBForwardPath, '/dynamo'),
|
|
37
|
+
forwardMethod: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.dynamoDBForwardMethod, 'POST'),
|
|
38
|
+
batch: options === null || options === void 0 ? void 0 : options.batch,
|
|
39
|
+
host: 'dynamodb.amazonaws.com',
|
|
40
|
+
});
|
|
36
41
|
}
|
|
37
42
|
//#endregion
|
|
38
43
|
//#region Public Methods
|
|
@@ -53,39 +58,7 @@ class DynamoDBAdapter {
|
|
|
53
58
|
const eventSource = (_a = dynamoDBevent.Records[0]) === null || _a === void 0 ? void 0 : _a.eventSource;
|
|
54
59
|
return eventSource === 'aws:dynamodb';
|
|
55
60
|
}
|
|
56
|
-
/**
|
|
57
|
-
* {@inheritDoc}
|
|
58
|
-
*/
|
|
59
|
-
getRequest(event) {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
const path = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.dynamoDBForwardPath, '/dynamo');
|
|
62
|
-
const method = (0, core_1.getDefaultIfUndefined)((_b = this.options) === null || _b === void 0 ? void 0 : _b.dynamoDBForwardMethod, 'POST');
|
|
63
|
-
const [body, contentLength] = (0, core_1.getEventBodyAsBuffer)(JSON.stringify(event), false);
|
|
64
|
-
const headers = {
|
|
65
|
-
host: 'dynamodb.amazonaws.com',
|
|
66
|
-
'content-type': 'application/json',
|
|
67
|
-
'content-length': String(contentLength),
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
method,
|
|
71
|
-
headers,
|
|
72
|
-
body,
|
|
73
|
-
path,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* {@inheritDoc}
|
|
78
|
-
*/
|
|
79
|
-
getResponse() {
|
|
80
|
-
return core_1.EmptyResponse;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* {@inheritDoc}
|
|
84
|
-
*/
|
|
85
|
-
onErrorWhileForwarding({ error, delegatedResolver, }) {
|
|
86
|
-
delegatedResolver.fail(error);
|
|
87
|
-
}
|
|
88
61
|
}
|
|
89
62
|
exports.DynamoDBAdapter = DynamoDBAdapter;
|
|
90
|
-
DynamoDBAdapter.__type = [() => __ΩDynamoDBAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle',
|
|
63
|
+
DynamoDBAdapter.__type = [() => index_1.AwsSimpleAdapter, () => __ΩDynamoDBAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle', 'P"7!Pn"2#8"0$P&0%P#2&!0\'5"6"'];
|
|
91
64
|
//# sourceMappingURL=dynamodb.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamodb.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/dynamodb.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamodb.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/dynamodb.adapter.ts"],"names":[],"mappings":";;;+CAI0D,cAAc;;AADxE,qCAAmD;AACnD,wCAAyE;;;AA2BzE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,eAAgB,SAAQ,wBAAqC;IACxE,qBAAqB;IAErB;;;;OAIG;IACH,YAAY,OAAgC;QAC1C,KAAK,CAAC;YACJ,WAAW,EAAE,IAAA,4BAAqB,EAChC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB,EAC5B,SAAS,CACV;YACD,aAAa,EAAE,IAAA,4BAAqB,EAClC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,qBAAqB,EAC9B,MAAM,CACP;YACD,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK;YACrB,IAAI,EAAE,wBAAwB;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,cAAc;QACnB,OAAO,eAAe,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,KAAc;;QAC7B,MAAM,aAAa,GAAG,KAAqC,CAAC;QAE5D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAEzD,MAAM,WAAW,GAAG,MAAA,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAE,WAAW,CAAC;QAE1D,OAAO,WAAW,KAAK,cAAc,CAAC;IACxC,CAAC;;AA7CH,0CAgDC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { IEmptyResponse } from '../../core';
|
|
1
|
+
import type { EventBridgeEvent } from 'aws-lambda';
|
|
2
|
+
import { AwsSimpleAdapter } from './base/index';
|
|
4
3
|
/**
|
|
5
4
|
* The options to customize the {@link EventBridgeAdapter}
|
|
6
5
|
*
|
|
@@ -45,14 +44,13 @@ export declare type EventBridgeEventAll = EventBridgeEvent<any, any>;
|
|
|
45
44
|
* @breadcrumb Adapters / AWS / EventBridgeAdapter
|
|
46
45
|
* @public
|
|
47
46
|
*/
|
|
48
|
-
export declare class EventBridgeAdapter
|
|
49
|
-
protected readonly options?: EventBridgeOptions | undefined;
|
|
47
|
+
export declare class EventBridgeAdapter extends AwsSimpleAdapter<EventBridgeEventAll> {
|
|
50
48
|
/**
|
|
51
49
|
* Default constructor
|
|
52
50
|
*
|
|
53
51
|
* @param options - The options to customize the {@link EventBridgeAdapter}
|
|
54
52
|
*/
|
|
55
|
-
constructor(options?: EventBridgeOptions
|
|
53
|
+
constructor(options?: EventBridgeOptions);
|
|
56
54
|
/**
|
|
57
55
|
* {@inheritDoc}
|
|
58
56
|
*/
|
|
@@ -61,18 +59,6 @@ export declare class EventBridgeAdapter implements AdapterContract<EventBridgeEv
|
|
|
61
59
|
* {@inheritDoc}
|
|
62
60
|
*/
|
|
63
61
|
canHandle(event: unknown): event is EventBridgeEventAll;
|
|
64
|
-
/**
|
|
65
|
-
* {@inheritDoc}
|
|
66
|
-
*/
|
|
67
|
-
getRequest(event: EventBridgeEventAll): AdapterRequest;
|
|
68
|
-
/**
|
|
69
|
-
* {@inheritDoc}
|
|
70
|
-
*/
|
|
71
|
-
getResponse(): IEmptyResponse;
|
|
72
|
-
/**
|
|
73
|
-
* {@inheritDoc}
|
|
74
|
-
*/
|
|
75
|
-
onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<EventBridgeEventAll, IEmptyResponse>): void;
|
|
76
62
|
}
|
|
77
63
|
export declare type __ΩEventBridgeOptions = any[];
|
|
78
64
|
export declare type __ΩEventBridgeEventAll = any[];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
//#region Imports
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.EventBridgeAdapter = exports.__ΩEventBridgeEventAll = exports.__ΩEventBridgeOptions = void 0;
|
|
4
|
-
const { __ΩAdapterRequest } = require('../../contracts');
|
|
5
|
-
const { __ΩIEmptyResponse } = require('../../core');
|
|
6
|
-
const { __ΩOnErrorProps } = require('../../contracts');
|
|
7
5
|
const core_1 = require("../../core");
|
|
6
|
+
const index_1 = require("./base/index");
|
|
8
7
|
const __ΩEventBridgeOptions = ['eventBridgeForwardPath', 'eventBridgeForwardMethod', 'P&4!8&4"8M'];
|
|
9
8
|
exports.__ΩEventBridgeOptions = __ΩEventBridgeOptions;
|
|
10
9
|
const __ΩEventBridgeEventAll = ['"'];
|
|
@@ -26,7 +25,7 @@ exports.__ΩEventBridgeEventAll = __ΩEventBridgeEventAll;
|
|
|
26
25
|
* @breadcrumb Adapters / AWS / EventBridgeAdapter
|
|
27
26
|
* @public
|
|
28
27
|
*/
|
|
29
|
-
class EventBridgeAdapter {
|
|
28
|
+
class EventBridgeAdapter extends index_1.AwsSimpleAdapter {
|
|
30
29
|
//#region Constructor
|
|
31
30
|
/**
|
|
32
31
|
* Default constructor
|
|
@@ -34,7 +33,12 @@ class EventBridgeAdapter {
|
|
|
34
33
|
* @param options - The options to customize the {@link EventBridgeAdapter}
|
|
35
34
|
*/
|
|
36
35
|
constructor(options) {
|
|
37
|
-
|
|
36
|
+
super({
|
|
37
|
+
forwardPath: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.eventBridgeForwardPath, '/eventbridge'),
|
|
38
|
+
forwardMethod: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.eventBridgeForwardMethod, 'POST'),
|
|
39
|
+
batch: false,
|
|
40
|
+
host: 'events.amazonaws.com',
|
|
41
|
+
});
|
|
38
42
|
}
|
|
39
43
|
//#endregion
|
|
40
44
|
//#region Public Methods
|
|
@@ -65,39 +69,7 @@ class EventBridgeAdapter {
|
|
|
65
69
|
typeof eventBridgeEvent.detail === 'object' &&
|
|
66
70
|
!Array.isArray(eventBridgeEvent.detail));
|
|
67
71
|
}
|
|
68
|
-
/**
|
|
69
|
-
* {@inheritDoc}
|
|
70
|
-
*/
|
|
71
|
-
getRequest(event) {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
const path = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.eventBridgeForwardPath, '/eventbridge');
|
|
74
|
-
const method = (0, core_1.getDefaultIfUndefined)((_b = this.options) === null || _b === void 0 ? void 0 : _b.eventBridgeForwardMethod, 'POST');
|
|
75
|
-
const [body, contentLength] = (0, core_1.getEventBodyAsBuffer)(JSON.stringify(event), false);
|
|
76
|
-
const headers = {
|
|
77
|
-
host: 'events.amazonaws.com',
|
|
78
|
-
'content-type': 'application/json',
|
|
79
|
-
'content-length': String(contentLength),
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
method,
|
|
83
|
-
headers,
|
|
84
|
-
body,
|
|
85
|
-
path,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* {@inheritDoc}
|
|
90
|
-
*/
|
|
91
|
-
getResponse() {
|
|
92
|
-
return core_1.EmptyResponse;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* {@inheritDoc}
|
|
96
|
-
*/
|
|
97
|
-
onErrorWhileForwarding({ error, delegatedResolver, }) {
|
|
98
|
-
delegatedResolver.fail(error);
|
|
99
|
-
}
|
|
100
72
|
}
|
|
101
73
|
exports.EventBridgeAdapter = EventBridgeAdapter;
|
|
102
|
-
EventBridgeAdapter.__type = [() => __Ω
|
|
74
|
+
EventBridgeAdapter.__type = [() => __ΩEventBridgeEventAll, () => index_1.AwsSimpleAdapter, () => __ΩEventBridgeOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle', () => __ΩEventBridgeEventAll, 'Pn!7"Pn#2$8"0%P&0&P#2\'!0(5n)6"'];
|
|
103
75
|
//# sourceMappingURL=event-bridge.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bridge.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/event-bridge.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-bridge.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/event-bridge.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAGjB,qCAAmD;AACnD,wCAAgD;;;;;AAkChD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAmB,SAAQ,wBAAqC;IAC3E,qBAAqB;IAErB;;;;OAIG;IACH,YAAY,OAA4B;QACtC,KAAK,CAAC;YACJ,WAAW,EAAE,IAAA,4BAAqB,EAChC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,sBAAsB,EAC/B,cAAc,CACf;YACD,aAAa,EAAE,IAAA,4BAAqB,EAClC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,wBAAwB,EACjC,MAAM,CACP;YACD,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,sBAAsB;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,cAAc;QACnB,OAAO,kBAAkB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,KAAc;QAC7B,MAAM,gBAAgB,GAAG,KAAqC,CAAC;QAE/D,gJAAgJ;QAChJ,OAAO,CAAC,CAAC,CACP,gBAAgB;YAChB,gBAAgB,CAAC,OAAO;YACxB,gBAAgB,CAAC,OAAO,KAAK,GAAG;YAChC,gBAAgB,CAAC,EAAE;YACnB,gBAAgB,CAAC,aAAa,CAAC;YAC/B,gBAAgB,CAAC,MAAM;YACvB,gBAAgB,CAAC,OAAO;YACxB,gBAAgB,CAAC,IAAI;YACrB,gBAAgB,CAAC,MAAM;YACvB,gBAAgB,CAAC,SAAS;YAC1B,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC;YACzC,gBAAgB,CAAC,MAAM;YACvB,OAAO,gBAAgB,CAAC,MAAM,KAAK,QAAQ;YAC3C,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CACxC,CAAC;IACJ,CAAC;;AAzDH,gDA4DC"}
|
|
@@ -23,4 +23,5 @@ __exportStar(require("./lambda-edge.adapter"), exports);
|
|
|
23
23
|
__exportStar(require("./s3.adapter"), exports);
|
|
24
24
|
__exportStar(require("./sns.adapter"), exports);
|
|
25
25
|
__exportStar(require("./sqs.adapter"), exports);
|
|
26
|
+
__exportStar(require("./base"), exports);
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/aws/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,2DAAyC;AACzC,2DAAyC;AACzC,qDAAmC;AACnC,yDAAuC;AACvC,wDAAsC;AACtC,+CAA6B;AAC7B,gDAA8B;AAC9B,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/aws/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,2DAAyC;AACzC,2DAAyC;AACzC,qDAAmC;AACnC,yDAAuC;AACvC,wDAAsC;AACtC,+CAA6B;AAC7B,gDAA8B;AAC9B,gDAA8B;AAC9B,yCAAuB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { IEmptyResponse } from '../../core';
|
|
1
|
+
import type { S3Event } from 'aws-lambda';
|
|
2
|
+
import { AwsSimpleAdapter } from './base/index';
|
|
4
3
|
/**
|
|
5
4
|
* The options to customize the {@link S3Adapter}
|
|
6
5
|
*
|
|
@@ -38,14 +37,13 @@ export interface S3AdapterOptions {
|
|
|
38
37
|
* @breadcrumb Adapters / AWS / S3Adapter
|
|
39
38
|
* @public
|
|
40
39
|
*/
|
|
41
|
-
export declare class S3Adapter
|
|
42
|
-
protected readonly options?: S3AdapterOptions | undefined;
|
|
40
|
+
export declare class S3Adapter extends AwsSimpleAdapter<S3Event> {
|
|
43
41
|
/**
|
|
44
42
|
* Default constructor
|
|
45
43
|
*
|
|
46
|
-
* @param options - The options to customize the {@link
|
|
44
|
+
* @param options - The options to customize the {@link SNSAdapter}
|
|
47
45
|
*/
|
|
48
|
-
constructor(options?: S3AdapterOptions
|
|
46
|
+
constructor(options?: S3AdapterOptions);
|
|
49
47
|
/**
|
|
50
48
|
* {@inheritDoc}
|
|
51
49
|
*/
|
|
@@ -54,17 +52,5 @@ export declare class S3Adapter implements AdapterContract<S3Event, Context, IEmp
|
|
|
54
52
|
* {@inheritDoc}
|
|
55
53
|
*/
|
|
56
54
|
canHandle(event: unknown): event is S3Event;
|
|
57
|
-
/**
|
|
58
|
-
* {@inheritDoc}
|
|
59
|
-
*/
|
|
60
|
-
getRequest(event: S3Event): AdapterRequest;
|
|
61
|
-
/**
|
|
62
|
-
* {@inheritDoc}
|
|
63
|
-
*/
|
|
64
|
-
getResponse(): IEmptyResponse;
|
|
65
|
-
/**
|
|
66
|
-
* {@inheritDoc}
|
|
67
|
-
*/
|
|
68
|
-
onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<S3Event, IEmptyResponse>): void;
|
|
69
55
|
}
|
|
70
56
|
export declare type __ΩS3AdapterOptions = any[];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
//#region Imports
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.S3Adapter = exports.__ΩS3AdapterOptions = void 0;
|
|
4
|
-
const { __ΩAdapterRequest } = require('../../contracts');
|
|
5
|
-
const { __ΩIEmptyResponse } = require('../../core');
|
|
6
|
-
const { __ΩOnErrorProps } = require('../../contracts');
|
|
7
5
|
const core_1 = require("../../core");
|
|
6
|
+
const index_1 = require("./base/index");
|
|
8
7
|
const __ΩS3AdapterOptions = ['s3ForwardPath', 's3ForwardMethod', 'P&4!8&4"8M'];
|
|
9
8
|
exports.__ΩS3AdapterOptions = __ΩS3AdapterOptions;
|
|
10
9
|
/**
|
|
@@ -24,15 +23,20 @@ exports.__ΩS3AdapterOptions = __ΩS3AdapterOptions;
|
|
|
24
23
|
* @breadcrumb Adapters / AWS / S3Adapter
|
|
25
24
|
* @public
|
|
26
25
|
*/
|
|
27
|
-
class S3Adapter {
|
|
26
|
+
class S3Adapter extends index_1.AwsSimpleAdapter {
|
|
28
27
|
//#region Constructor
|
|
29
28
|
/**
|
|
30
29
|
* Default constructor
|
|
31
30
|
*
|
|
32
|
-
* @param options - The options to customize the {@link
|
|
31
|
+
* @param options - The options to customize the {@link SNSAdapter}
|
|
33
32
|
*/
|
|
34
33
|
constructor(options) {
|
|
35
|
-
|
|
34
|
+
super({
|
|
35
|
+
forwardPath: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.s3ForwardPath, '/s3'),
|
|
36
|
+
forwardMethod: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.s3ForwardMethod, 'POST'),
|
|
37
|
+
batch: false,
|
|
38
|
+
host: 's3.amazonaws.com',
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
41
|
//#endregion
|
|
38
42
|
//#region Public Methods
|
|
@@ -53,39 +57,7 @@ class S3Adapter {
|
|
|
53
57
|
const eventSource = (_a = s3Event.Records[0]) === null || _a === void 0 ? void 0 : _a.eventSource;
|
|
54
58
|
return eventSource === 'aws:s3';
|
|
55
59
|
}
|
|
56
|
-
/**
|
|
57
|
-
* {@inheritDoc}
|
|
58
|
-
*/
|
|
59
|
-
getRequest(event) {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
const path = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.s3ForwardPath, '/s3');
|
|
62
|
-
const method = (0, core_1.getDefaultIfUndefined)((_b = this.options) === null || _b === void 0 ? void 0 : _b.s3ForwardMethod, 'POST');
|
|
63
|
-
const [body, contentLength] = (0, core_1.getEventBodyAsBuffer)(JSON.stringify(event), false);
|
|
64
|
-
const headers = {
|
|
65
|
-
host: 's3.amazonaws.com',
|
|
66
|
-
'content-type': 'application/json',
|
|
67
|
-
'content-length': String(contentLength),
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
method,
|
|
71
|
-
headers,
|
|
72
|
-
body,
|
|
73
|
-
path,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* {@inheritDoc}
|
|
78
|
-
*/
|
|
79
|
-
getResponse() {
|
|
80
|
-
return core_1.EmptyResponse;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* {@inheritDoc}
|
|
84
|
-
*/
|
|
85
|
-
onErrorWhileForwarding({ error, delegatedResolver, }) {
|
|
86
|
-
delegatedResolver.fail(error);
|
|
87
|
-
}
|
|
88
60
|
}
|
|
89
61
|
exports.S3Adapter = S3Adapter;
|
|
90
|
-
S3Adapter.__type = [() => __ΩS3AdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle',
|
|
62
|
+
S3Adapter.__type = [() => index_1.AwsSimpleAdapter, () => __ΩS3AdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle', 'P"7!Pn"2#8"0$P&0%P#2&!0\'5"6"'];
|
|
91
63
|
//# sourceMappingURL=s3.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/s3.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"s3.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/s3.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAGjB,qCAAmD;AACnD,wCAAgD;;;AA0BhD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,SAAU,SAAQ,wBAAyB;IACtD,qBAAqB;IAErB;;;;OAIG;IACH,YAAY,OAA0B;QACpC,KAAK,CAAC;YACJ,WAAW,EAAE,IAAA,4BAAqB,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,EAAE,KAAK,CAAC;YACjE,aAAa,EAAE,IAAA,4BAAqB,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,EAAE,MAAM,CAAC;YACtE,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,kBAAkB;SACzB,CAAC,CAAC;IACL,CAAC;IAED,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,cAAc;QACnB,OAAO,SAAS,CAAC,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,KAAc;;QAC7B,MAAM,OAAO,GAAG,KAAyB,CAAC;QAE1C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAEnD,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAE,WAAW,CAAC;QAEpD,OAAO,WAAW,KAAK,QAAQ,CAAC;IAClC,CAAC;;AAvCH,8BA0CC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { IEmptyResponse } from '../../core';
|
|
1
|
+
import type { SNSEvent } from 'aws-lambda';
|
|
2
|
+
import { AwsSimpleAdapter } from './base/index';
|
|
4
3
|
/**
|
|
5
4
|
* The options to customize the {@link SNSAdapter}
|
|
6
5
|
*
|
|
@@ -38,14 +37,13 @@ export interface SNSAdapterOptions {
|
|
|
38
37
|
* @breadcrumb Adapters / AWS / SNSAdapter
|
|
39
38
|
* @public
|
|
40
39
|
*/
|
|
41
|
-
export declare class SNSAdapter
|
|
42
|
-
protected readonly options?: SNSAdapterOptions | undefined;
|
|
40
|
+
export declare class SNSAdapter extends AwsSimpleAdapter<SNSEvent> {
|
|
43
41
|
/**
|
|
44
42
|
* Default constructor
|
|
45
43
|
*
|
|
46
44
|
* @param options - The options to customize the {@link SNSAdapter}
|
|
47
45
|
*/
|
|
48
|
-
constructor(options?: SNSAdapterOptions
|
|
46
|
+
constructor(options?: SNSAdapterOptions);
|
|
49
47
|
/**
|
|
50
48
|
* {@inheritDoc}
|
|
51
49
|
*/
|
|
@@ -54,17 +52,5 @@ export declare class SNSAdapter implements AdapterContract<SNSEvent, Context, IE
|
|
|
54
52
|
* {@inheritDoc}
|
|
55
53
|
*/
|
|
56
54
|
canHandle(event: unknown): event is SNSEvent;
|
|
57
|
-
/**
|
|
58
|
-
* {@inheritDoc}
|
|
59
|
-
*/
|
|
60
|
-
getRequest(event: SNSEvent): AdapterRequest;
|
|
61
|
-
/**
|
|
62
|
-
* {@inheritDoc}
|
|
63
|
-
*/
|
|
64
|
-
getResponse(): IEmptyResponse;
|
|
65
|
-
/**
|
|
66
|
-
* {@inheritDoc}
|
|
67
|
-
*/
|
|
68
|
-
onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<SNSEvent, IEmptyResponse>): void;
|
|
69
55
|
}
|
|
70
56
|
export declare type __ΩSNSAdapterOptions = any[];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
//#region Imports
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.SNSAdapter = exports.__ΩSNSAdapterOptions = void 0;
|
|
4
|
-
const { __ΩAdapterRequest } = require('../../contracts');
|
|
5
|
-
const { __ΩIEmptyResponse } = require('../../core');
|
|
6
|
-
const { __ΩOnErrorProps } = require('../../contracts');
|
|
7
5
|
const core_1 = require("../../core");
|
|
6
|
+
const index_1 = require("./base/index");
|
|
8
7
|
const __ΩSNSAdapterOptions = ['snsForwardPath', 'snsForwardMethod', 'P&4!8&4"8M'];
|
|
9
8
|
exports.__ΩSNSAdapterOptions = __ΩSNSAdapterOptions;
|
|
10
9
|
/**
|
|
@@ -24,7 +23,7 @@ exports.__ΩSNSAdapterOptions = __ΩSNSAdapterOptions;
|
|
|
24
23
|
* @breadcrumb Adapters / AWS / SNSAdapter
|
|
25
24
|
* @public
|
|
26
25
|
*/
|
|
27
|
-
class SNSAdapter {
|
|
26
|
+
class SNSAdapter extends index_1.AwsSimpleAdapter {
|
|
28
27
|
//#region Constructor
|
|
29
28
|
/**
|
|
30
29
|
* Default constructor
|
|
@@ -32,7 +31,12 @@ class SNSAdapter {
|
|
|
32
31
|
* @param options - The options to customize the {@link SNSAdapter}
|
|
33
32
|
*/
|
|
34
33
|
constructor(options) {
|
|
35
|
-
|
|
34
|
+
super({
|
|
35
|
+
forwardPath: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.snsForwardPath, '/sns'),
|
|
36
|
+
forwardMethod: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.snsForwardMethod, 'POST'),
|
|
37
|
+
batch: false,
|
|
38
|
+
host: 'sns.amazonaws.com',
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
41
|
//#endregion
|
|
38
42
|
//#region Public Methods
|
|
@@ -53,39 +57,7 @@ class SNSAdapter {
|
|
|
53
57
|
const eventSource = (_a = snsEvent.Records[0]) === null || _a === void 0 ? void 0 : _a.EventSource;
|
|
54
58
|
return eventSource === 'aws:sns';
|
|
55
59
|
}
|
|
56
|
-
/**
|
|
57
|
-
* {@inheritDoc}
|
|
58
|
-
*/
|
|
59
|
-
getRequest(event) {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
const path = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.snsForwardPath, '/sns');
|
|
62
|
-
const method = (0, core_1.getDefaultIfUndefined)((_b = this.options) === null || _b === void 0 ? void 0 : _b.snsForwardMethod, 'POST');
|
|
63
|
-
const [body, contentLength] = (0, core_1.getEventBodyAsBuffer)(JSON.stringify(event), false);
|
|
64
|
-
const headers = {
|
|
65
|
-
host: 'sns.amazonaws.com',
|
|
66
|
-
'content-type': 'application/json',
|
|
67
|
-
'content-length': String(contentLength),
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
method,
|
|
71
|
-
headers,
|
|
72
|
-
body,
|
|
73
|
-
path,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* {@inheritDoc}
|
|
78
|
-
*/
|
|
79
|
-
getResponse() {
|
|
80
|
-
return core_1.EmptyResponse;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* {@inheritDoc}
|
|
84
|
-
*/
|
|
85
|
-
onErrorWhileForwarding({ error, delegatedResolver, }) {
|
|
86
|
-
delegatedResolver.fail(error);
|
|
87
|
-
}
|
|
88
60
|
}
|
|
89
61
|
exports.SNSAdapter = SNSAdapter;
|
|
90
|
-
SNSAdapter.__type = [() => __ΩSNSAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle',
|
|
62
|
+
SNSAdapter.__type = [() => index_1.AwsSimpleAdapter, () => __ΩSNSAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle', 'P"7!Pn"2#8"0$P&0%P#2&!0\'5"6"'];
|
|
91
63
|
//# sourceMappingURL=sns.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sns.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/sns.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sns.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/sns.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAGjB,qCAAmD;AACnD,wCAAgD;;;AA0BhD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,UAAW,SAAQ,wBAA0B;IACxD,qBAAqB;IAErB;;;;OAIG;IACH,YAAY,OAA2B;QACrC,KAAK,CAAC;YACJ,WAAW,EAAE,IAAA,4BAAqB,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,EAAE,MAAM,CAAC;YACnE,aAAa,EAAE,IAAA,4BAAqB,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,EAAE,MAAM,CAAC;YACvE,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,mBAAmB;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,cAAc;QACnB,OAAO,UAAU,CAAC,IAAI,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,KAAc;;QAC7B,MAAM,QAAQ,GAAG,KAA0B,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAEpD,MAAM,WAAW,GAAG,MAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAE,WAAW,CAAC;QAErD,OAAO,WAAW,KAAK,SAAS,CAAC;IACnC,CAAC;;AAvCH,gCA0CC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { IEmptyResponse } from '../../core';
|
|
1
|
+
import type { SQSEvent } from 'aws-lambda';
|
|
2
|
+
import { AWSSimpleAdapterOptions, AwsSimpleAdapter } from './base/index';
|
|
4
3
|
/**
|
|
5
4
|
* The options to customize the {@link SQSAdapter}
|
|
6
5
|
*
|
|
7
6
|
* @breadcrumb Adapters / AWS / SQSAdapter
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export interface SQSAdapterOptions {
|
|
9
|
+
export interface SQSAdapterOptions extends Pick<AWSSimpleAdapterOptions, 'batch'> {
|
|
11
10
|
/**
|
|
12
11
|
* The path that will be used to create a request to be forwarded to the framework.
|
|
13
12
|
*
|
|
@@ -38,14 +37,13 @@ export interface SQSAdapterOptions {
|
|
|
38
37
|
* @breadcrumb Adapters / AWS / SQSAdapter
|
|
39
38
|
* @public
|
|
40
39
|
*/
|
|
41
|
-
export declare class SQSAdapter
|
|
42
|
-
protected readonly options?: SQSAdapterOptions | undefined;
|
|
40
|
+
export declare class SQSAdapter extends AwsSimpleAdapter<SQSEvent> {
|
|
43
41
|
/**
|
|
44
42
|
* Default constructor
|
|
45
43
|
*
|
|
46
|
-
* @param options - The options to customize the {@link
|
|
44
|
+
* @param options - The options to customize the {@link SNSAdapter}
|
|
47
45
|
*/
|
|
48
|
-
constructor(options?: SQSAdapterOptions
|
|
46
|
+
constructor(options?: SQSAdapterOptions);
|
|
49
47
|
/**
|
|
50
48
|
* {@inheritDoc}
|
|
51
49
|
*/
|
|
@@ -54,17 +52,5 @@ export declare class SQSAdapter implements AdapterContract<SQSEvent, Context, IE
|
|
|
54
52
|
* {@inheritDoc}
|
|
55
53
|
*/
|
|
56
54
|
canHandle(event: unknown): event is SQSEvent;
|
|
57
|
-
/**
|
|
58
|
-
* {@inheritDoc}
|
|
59
|
-
*/
|
|
60
|
-
getRequest(event: SQSEvent): AdapterRequest;
|
|
61
|
-
/**
|
|
62
|
-
* {@inheritDoc}
|
|
63
|
-
*/
|
|
64
|
-
getResponse(): IEmptyResponse;
|
|
65
|
-
/**
|
|
66
|
-
* {@inheritDoc}
|
|
67
|
-
*/
|
|
68
|
-
onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<SQSEvent, IEmptyResponse>): void;
|
|
69
55
|
}
|
|
70
56
|
export declare type __ΩSQSAdapterOptions = any[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SQSAdapter = exports.__ΩSQSAdapterOptions = void 0;
|
|
4
|
-
const { __Ω
|
|
5
|
-
const
|
|
6
|
-
const { __ΩOnErrorProps } = require('../../contracts');
|
|
4
|
+
const { __ΩAWSSimpleAdapterOptions } = require('./base/index');
|
|
5
|
+
const __ΩPick = ['T', 'K', 'l+e#!e"!fRb!b"Pde""N#!'];
|
|
7
6
|
const core_1 = require("../../core");
|
|
8
|
-
const
|
|
7
|
+
const index_1 = require("./base/index");
|
|
8
|
+
const __ΩSQSAdapterOptions = [() => __ΩPick, () => __ΩAWSSimpleAdapterOptions, "batch", 'sqsForwardPath', 'sqsForwardMethod', 'Pn".#o!#&4$8&4%8M'];
|
|
9
9
|
exports.__ΩSQSAdapterOptions = __ΩSQSAdapterOptions;
|
|
10
10
|
/**
|
|
11
11
|
* The adapter to handle requests from AWS SQS.
|
|
@@ -24,15 +24,20 @@ exports.__ΩSQSAdapterOptions = __ΩSQSAdapterOptions;
|
|
|
24
24
|
* @breadcrumb Adapters / AWS / SQSAdapter
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
class SQSAdapter {
|
|
27
|
+
class SQSAdapter extends index_1.AwsSimpleAdapter {
|
|
28
28
|
//#region Constructor
|
|
29
29
|
/**
|
|
30
30
|
* Default constructor
|
|
31
31
|
*
|
|
32
|
-
* @param options - The options to customize the {@link
|
|
32
|
+
* @param options - The options to customize the {@link SNSAdapter}
|
|
33
33
|
*/
|
|
34
34
|
constructor(options) {
|
|
35
|
-
|
|
35
|
+
super({
|
|
36
|
+
forwardPath: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.sqsForwardPath, '/sqs'),
|
|
37
|
+
forwardMethod: (0, core_1.getDefaultIfUndefined)(options === null || options === void 0 ? void 0 : options.sqsForwardMethod, 'POST'),
|
|
38
|
+
batch: options === null || options === void 0 ? void 0 : options.batch,
|
|
39
|
+
host: 'sqs.amazonaws.com',
|
|
40
|
+
});
|
|
36
41
|
}
|
|
37
42
|
//#endregion
|
|
38
43
|
//#region Public Methods
|
|
@@ -53,39 +58,7 @@ class SQSAdapter {
|
|
|
53
58
|
const eventSource = (_a = sqsEvent.Records[0]) === null || _a === void 0 ? void 0 : _a.eventSource;
|
|
54
59
|
return eventSource === 'aws:sqs';
|
|
55
60
|
}
|
|
56
|
-
/**
|
|
57
|
-
* {@inheritDoc}
|
|
58
|
-
*/
|
|
59
|
-
getRequest(event) {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
const path = (0, core_1.getDefaultIfUndefined)((_a = this.options) === null || _a === void 0 ? void 0 : _a.sqsForwardPath, '/sqs');
|
|
62
|
-
const method = (0, core_1.getDefaultIfUndefined)((_b = this.options) === null || _b === void 0 ? void 0 : _b.sqsForwardMethod, 'POST');
|
|
63
|
-
const [body, contentLength] = (0, core_1.getEventBodyAsBuffer)(JSON.stringify(event), false);
|
|
64
|
-
const headers = {
|
|
65
|
-
host: 'sqs.amazonaws.com',
|
|
66
|
-
'content-type': 'application/json',
|
|
67
|
-
'content-length': String(contentLength),
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
method,
|
|
71
|
-
headers,
|
|
72
|
-
body,
|
|
73
|
-
path,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* {@inheritDoc}
|
|
78
|
-
*/
|
|
79
|
-
getResponse() {
|
|
80
|
-
return core_1.EmptyResponse;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* {@inheritDoc}
|
|
84
|
-
*/
|
|
85
|
-
onErrorWhileForwarding({ error, delegatedResolver, }) {
|
|
86
|
-
delegatedResolver.fail(error);
|
|
87
|
-
}
|
|
88
61
|
}
|
|
89
62
|
exports.SQSAdapter = SQSAdapter;
|
|
90
|
-
SQSAdapter.__type = [() => __ΩSQSAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle',
|
|
63
|
+
SQSAdapter.__type = [() => index_1.AwsSimpleAdapter, () => __ΩSQSAdapterOptions, 'options', 'constructor', 'getAdapterName', 'event', 'canHandle', 'P"7!Pn"2#8"0$P&0%P#2&!0\'5"6"'];
|
|
91
64
|
//# sourceMappingURL=sqs.adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqs.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/sqs.adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqs.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/sqs.adapter.ts"],"names":[],"mappings":";;;+CAI0D,cAAc;;AADxE,qCAAmD;AACnD,wCAAyE;;;AA2BzE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,UAAW,SAAQ,wBAA0B;IACxD,qBAAqB;IAErB;;;;OAIG;IACH,YAAY,OAA2B;QACrC,KAAK,CAAC;YACJ,WAAW,EAAE,IAAA,4BAAqB,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,EAAE,MAAM,CAAC;YACnE,aAAa,EAAE,IAAA,4BAAqB,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,gBAAgB,EAAE,MAAM,CAAC;YACvE,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK;YACrB,IAAI,EAAE,mBAAmB;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,cAAc;QACnB,OAAO,UAAU,CAAC,IAAI,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,KAAc;;QAC7B,MAAM,QAAQ,GAAG,KAA0B,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAEpD,MAAM,WAAW,GAAG,MAAA,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAE,WAAW,CAAC;QAErD,OAAO,WAAW,KAAK,SAAS,CAAC;IACnC,CAAC;;AAvCH,gCA0CC"}
|
|
@@ -5,6 +5,9 @@ import type { HttpError } from 'http-errors';
|
|
|
5
5
|
import { FrameworkContract } from '../../contracts';
|
|
6
6
|
/**
|
|
7
7
|
* The options for {@link BaseBodyParserFramework}
|
|
8
|
+
*
|
|
9
|
+
* @breadcrumb Frameworks / BodyParserFramework
|
|
10
|
+
* @public
|
|
8
11
|
*/
|
|
9
12
|
export declare type BodyParserOptions = {
|
|
10
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-body-parser.framework.js","sourceRoot":"","sources":["../../../src/frameworks/body-parser/base-body-parser.framework.ts"],"names":[],"mappings":";;;yCAKkC,iBAAiB;;;;;;AACnD,qCAAmD;;;
|
|
1
|
+
{"version":3,"file":"base-body-parser.framework.js","sourceRoot":"","sources":["../../../src/frameworks/body-parser/base-body-parser.framework.ts"],"names":[],"mappings":";;;yCAKkC,iBAAiB;;;;;;AACnD,qCAAmD;;;AAqCnD;;;;;GAKG;AACH,MAAa,uBAAuB;IAClC,qBAAqB;IAErB;;OAEG;IACH,YACqB,SAAkC,EAClC,UAA8B,EAC9B,OAA2B;;QAF3B,cAAS,GAAT,SAAS,CAAyB;QAClC,eAAU,GAAV,UAAU,CAAoB;QAC9B,YAAO,GAAP,OAAO,CAAoB;QAE9C,IAAI,CAAC,YAAY,GAAG,IAAA,4BAAqB,EACvC,MAAA,IAAI,CAAC,OAAO,0CAAE,kBAAkB,EAChC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CACrC,CAAC;IACJ,CAAC;IAaD,YAAY;IAEZ,wBAAwB;IAExB;;OAEG;IACI,WAAW,CAChB,GAAS,EACT,OAAwB,EACxB,QAAwB;QAExB,IAAI,CAAC,UAAU,CACb,OAAO,EACP,QAAQ,EACR,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAClD,CAAC;IACJ,CAAC;IAED,YAAY;IAEZ,2BAA2B;IAE3B;;OAEG;IACO,oBAAoB,CAC5B,GAAS,EACT,OAAwB,EACxB,QAAwB;QAExB,oBAAO,CAAC,GAAS,EAAE,EAAE;YACnB,IAAI,GAAG;gBAAE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;YAE1D,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACrD,CAAC,2BAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACO,oBAAoB,CAC5B,OAAwB,EACxB,QAAwB,EACxB,KAAqB;QAErB,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QACjD,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACvC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;;AAjFH,0DAoFC"}
|
|
@@ -7,6 +7,8 @@ function __assignType(fn, args) {
|
|
|
7
7
|
return fn;
|
|
8
8
|
}
|
|
9
9
|
const firebase_functions_1 = require("firebase-functions");
|
|
10
|
+
const core_1 = require("../../core");
|
|
11
|
+
const network_1 = require("../../network");
|
|
10
12
|
//#endregion
|
|
11
13
|
/**
|
|
12
14
|
* The class that implements a handler for Firebase Https Events
|
|
@@ -23,12 +25,25 @@ class HttpFirebaseHandler {
|
|
|
23
25
|
*/
|
|
24
26
|
getHandler(app, framework) {
|
|
25
27
|
return firebase_functions_1.https.onRequest(__assignType((request, response) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const expressRequestParsed = request;
|
|
29
|
+
const headers = (0, core_1.getFlattenedHeadersMap)(request.headers, ',', true);
|
|
30
|
+
const remoteAddress = headers['x-forwarded-for'];
|
|
31
|
+
let body;
|
|
32
|
+
if (expressRequestParsed.body &&
|
|
33
|
+
typeof expressRequestParsed.body === 'object') {
|
|
34
|
+
const jsonContent = JSON.stringify(expressRequestParsed.body);
|
|
35
|
+
const [bufferBody, contentLength] = (0, core_1.getEventBodyAsBuffer)(jsonContent, false);
|
|
36
|
+
body = bufferBody;
|
|
37
|
+
headers['content-length'] = String(contentLength);
|
|
30
38
|
}
|
|
31
|
-
|
|
39
|
+
const customRequest = new network_1.ServerlessRequest({
|
|
40
|
+
method: request.method,
|
|
41
|
+
url: request.url,
|
|
42
|
+
body,
|
|
43
|
+
headers,
|
|
44
|
+
remoteAddress,
|
|
45
|
+
});
|
|
46
|
+
return framework.sendRequest(app, customRequest, response);
|
|
32
47
|
}, ['request', 'response', '', 'P!2!!2""/#']));
|
|
33
48
|
}
|
|
34
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-firebase.handler.js","sourceRoot":"","sources":["../../../src/handlers/firebase/http-firebase.handler.ts"],"names":[],"mappings":";;;yCAImD,iBAAiB;;;;;AADpE,2DAA2C;
|
|
1
|
+
{"version":3,"file":"http-firebase.handler.js","sourceRoot":"","sources":["../../../src/handlers/firebase/http-firebase.handler.ts"],"names":[],"mappings":";;;yCAImD,iBAAiB;;;;;AADpE,2DAA2C;AAE3C,qCAA0E;AAC1E,2CAAkD;AAElD,YAAY;AAEZ;;;;;;;GAOG;AACH,MAAa,mBAAmB;IAI9B,wBAAwB;IAExB;;OAEG;IACI,UAAU,CACf,GAAS,EACT,SAAkC;QAElC,OAAO,0BAAK,CAAC,SAAS,cACpB,CAAC,OAAwB,EAAE,QAAwB,EAAE,EAAE;YACrD,MAAM,oBAAoB,GAAG,OAE5B,CAAC;YAEF,MAAM,OAAO,GAAG,IAAA,6BAAsB,EAAC,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;YACnE,MAAM,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAEjD,IAAI,IAAwB,CAAC;YAE7B,IACE,oBAAoB,CAAC,IAAI;gBACzB,OAAO,oBAAoB,CAAC,IAAI,KAAK,QAAQ,EAC7C;gBACA,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;gBAE9D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,2BAAoB,EACtD,WAAW,EACX,KAAK,CACN,CAAC;gBAEF,IAAI,GAAG,UAAU,CAAC;gBAClB,OAAO,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;aACnD;YAED,MAAM,aAAa,GAAG,IAAI,2BAAiB,CAAC;gBAC1C,MAAM,EAAE,OAAO,CAAC,MAAO;gBACvB,GAAG,EAAE,OAAO,CAAC,GAAI;gBACjB,IAAI;gBACJ,OAAO;gBACP,aAAa;aACd,CAAC,CAAC;YAEH,OAAO,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC,6CACF,CAAC;IACJ,CAAC;;AAlDH,kDAqDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h4ad/serverless-adapter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.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, Digital Ocean and many other clouds.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|