quidproquo-actionprocessor-awslambda 0.0.203 → 0.0.205
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/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/autoRespond.d.ts +1 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/getRecords.d.ts +2 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/getRecords.js +1 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/getStorySession.d.ts +1 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/index.d.ts +5 -5
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.d.ts +1 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.d.ts +1 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.js +8 -1
- package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/types.d.ts +2 -4
- package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/autoRespond.js +2 -3
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/autoRespond.d.ts +1 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/getRecords.d.ts +2 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/getRecords.js +1 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/getStorySession.d.ts +1 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/index.d.ts +5 -5
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/matchStory.d.ts +1 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.d.ts +1 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.js +8 -1
- package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/types.d.ts +2 -4
- package/lib/esm/getActionProcessor/core/event/eventBridgeEvent/deployStack/autoRespond.js +2 -3
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QPQConfig, EventAutoRespondActionProcessor } from 'quidproquo-core';
|
|
2
2
|
import { MatchResult } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/AutoRespond": EventAutoRespondActionProcessor<import("
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": EventAutoRespondActionProcessor<import("quidproquo-webserver").HTTPEvent, MatchResult, import("quidproquo-webserver").HTTPEventResponse>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QPQConfig, EventGetRecordsActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { HTTPEvent } from 'quidproquo-webserver';
|
|
2
3
|
import { EventInput } from './types';
|
|
3
4
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/Event/GetRecords": EventGetRecordsActionProcessor<EventInput,
|
|
5
|
+
"@quidproquo-core/Event/GetRecords": EventGetRecordsActionProcessor<EventInput, HTTPEvent>;
|
|
5
6
|
};
|
|
6
7
|
export default _default;
|
|
@@ -25,7 +25,7 @@ const getProcessGetRecords = (qpqConfig) => {
|
|
|
25
25
|
const internalEventRecord = {
|
|
26
26
|
path,
|
|
27
27
|
query: Object.assign(Object.assign({}, (apiGatewayEvent.multiValueQueryStringParameters || {})), (apiGatewayEvent.queryStringParameters || {})),
|
|
28
|
-
body: apiGatewayEvent.body,
|
|
28
|
+
body: apiGatewayEvent.body === null ? undefined : apiGatewayEvent.body,
|
|
29
29
|
headers: apiGatewayEvent.headers,
|
|
30
30
|
method: apiGatewayEvent.httpMethod,
|
|
31
31
|
correlation: context.awsRequestId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QPQConfig, EventGetStorySessionActionProcessor } from 'quidproquo-core';
|
|
2
2
|
import { EventInput } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/GetStorySession": EventGetStorySessionActionProcessor<EventInput, import("
|
|
4
|
+
"@quidproquo-core/event/GetStorySession": EventGetStorySessionActionProcessor<EventInput, import("quidproquo-webserver").HTTPEvent>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { QPQConfig } from 'quidproquo-core';
|
|
2
2
|
export declare const getApiGatewayApiEventEventProcessor: (qpqConfig: QPQConfig) => {
|
|
3
|
-
"@quidproquo-core/event/TransformResponseResult": import("quidproquo-core").EventTransformResponseResultActionProcessor<import("./types").EventInput, import("
|
|
4
|
-
"@quidproquo-core/event/AutoRespond": import("quidproquo-core").EventAutoRespondActionProcessor<import("
|
|
5
|
-
"@quidproquo-core/event/MatchStory": import("quidproquo-core").EventMatchStoryActionProcessor<import("
|
|
6
|
-
"@quidproquo-core/Event/GetRecords": import("quidproquo-core").EventGetRecordsActionProcessor<import("./types").EventInput, import("
|
|
7
|
-
"@quidproquo-core/event/GetStorySession": import("quidproquo-core").EventGetStorySessionActionProcessor<import("./types").EventInput, import("
|
|
3
|
+
"@quidproquo-core/event/TransformResponseResult": import("quidproquo-core").EventTransformResponseResultActionProcessor<import("./types").EventInput, import("quidproquo-webserver").HTTPEventResponse, import("aws-lambda").APIGatewayProxyResult>;
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": import("quidproquo-core").EventAutoRespondActionProcessor<import("quidproquo-webserver").HTTPEvent, import("./types").MatchResult, import("quidproquo-webserver").HTTPEventResponse>;
|
|
5
|
+
"@quidproquo-core/event/MatchStory": import("quidproquo-core").EventMatchStoryActionProcessor<import("quidproquo-webserver").HTTPEvent, import("./types").MatchResult>;
|
|
6
|
+
"@quidproquo-core/Event/GetRecords": import("quidproquo-core").EventGetRecordsActionProcessor<import("./types").EventInput, import("quidproquo-webserver").HTTPEvent>;
|
|
7
|
+
"@quidproquo-core/event/GetStorySession": import("quidproquo-core").EventGetStorySessionActionProcessor<import("./types").EventInput, import("quidproquo-webserver").HTTPEvent>;
|
|
8
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventMatchStoryActionProcessor, QPQConfig } from 'quidproquo-core';
|
|
2
2
|
import { MatchResult } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/MatchStory": EventMatchStoryActionProcessor<import("
|
|
4
|
+
"@quidproquo-core/event/MatchStory": EventMatchStoryActionProcessor<import("quidproquo-webserver").HTTPEvent, MatchResult>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QPQConfig, EventTransformResponseResultActionProcessor } from 'quidproquo-core';
|
|
2
2
|
import { EventInput } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/TransformResponseResult": EventTransformResponseResultActionProcessor<EventInput, import("
|
|
4
|
+
"@quidproquo-core/event/TransformResponseResult": EventTransformResponseResultActionProcessor<EventInput, import("quidproquo-webserver").HTTPEventResponse, import("aws-lambda").APIGatewayProxyResult>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
package/lib/commonjs/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.js
CHANGED
|
@@ -44,7 +44,14 @@ const getProcessTransformResponseResult = (qpqConfig) => {
|
|
|
44
44
|
const [apiGatewayEvent] = eventParams;
|
|
45
45
|
const [record] = qpqEventRecordResponses;
|
|
46
46
|
// If we have an error, we need to transform it to a response, otherwise we can just use the record as is
|
|
47
|
-
|
|
47
|
+
let successRecord = record.success ? record.result : getResponseFromErrorResult(record.error);
|
|
48
|
+
// Return an error if the body is the wrong type.
|
|
49
|
+
if (successRecord.body && typeof successRecord.body !== 'string') {
|
|
50
|
+
successRecord = getResponseFromErrorResult({
|
|
51
|
+
errorText: 'Response body must be a string',
|
|
52
|
+
errorType: quidproquo_core_1.ErrorTypeEnum.GenericError,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
48
55
|
// Add the cors headers
|
|
49
56
|
const currentHeaders = successRecord.headers || {};
|
|
50
57
|
const headers = Object.assign(Object.assign({}, quidproquo_webserver_1.qpqWebServerUtils.getCorsHeaders(qpqConfig, {}, apiGatewayEvent.headers)), currentHeaders);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { HTTPEvent, HTTPEventResponse } from 'quidproquo-webserver';
|
|
2
2
|
import { APIGatewayEvent, Context, APIGatewayProxyResult } from 'aws-lambda';
|
|
3
3
|
import { MatchStoryResult } from 'quidproquo-core';
|
|
4
|
-
export type AnyHTTPEvent = HTTPEvent<any>;
|
|
5
|
-
export type AnyHTTPEventResponse = HTTPEventResponse<any>;
|
|
6
4
|
export type EventInput = [APIGatewayEvent, Context];
|
|
7
5
|
export type EventOutput = APIGatewayProxyResult;
|
|
8
|
-
export type InternalEventRecord =
|
|
9
|
-
export type InternalEventOutput =
|
|
6
|
+
export type InternalEventRecord = HTTPEvent;
|
|
7
|
+
export type InternalEventOutput = HTTPEventResponse;
|
|
10
8
|
export type MatchResult = MatchStoryResult<any, any>;
|
package/lib/commonjs/getActionProcessor/core/event/eventBridgeEvent/deployStack/autoRespond.js
CHANGED
|
@@ -14,9 +14,8 @@ const getProcessAutoRespond = (qpqConfig) => {
|
|
|
14
14
|
return ({ qpqEventRecord, matchResult }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
// exit if we don't know what deploy type this is, probably another stack
|
|
16
16
|
const earlyExit = qpqEventRecord.deployEventType === quidproquo_core_1.DeployEventType.Unknown || qpqEventRecord.deployEventStatusType === quidproquo_core_1.DeployEventStatusType.Unknown;
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
return (0, quidproquo_core_1.actionResult)(earlyExit);
|
|
17
|
+
// This is strange, but null means don't early exit.
|
|
18
|
+
return (0, quidproquo_core_1.actionResult)(!earlyExit ? null : void 0);
|
|
20
19
|
});
|
|
21
20
|
};
|
|
22
21
|
exports.default = (qpqConfig) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QPQConfig, EventAutoRespondActionProcessor } from 'quidproquo-core';
|
|
2
2
|
import { MatchResult } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/AutoRespond": EventAutoRespondActionProcessor<import("
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": EventAutoRespondActionProcessor<import("quidproquo-webserver").HTTPEvent, MatchResult, import("quidproquo-webserver").HTTPEventResponse>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QPQConfig, EventGetRecordsActionProcessor } from 'quidproquo-core';
|
|
2
|
+
import { HTTPEvent } from 'quidproquo-webserver';
|
|
2
3
|
import { EventInput } from './types';
|
|
3
4
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/Event/GetRecords": EventGetRecordsActionProcessor<EventInput,
|
|
5
|
+
"@quidproquo-core/Event/GetRecords": EventGetRecordsActionProcessor<EventInput, HTTPEvent>;
|
|
5
6
|
};
|
|
6
7
|
export default _default;
|
|
@@ -17,7 +17,7 @@ const getProcessGetRecords = (qpqConfig) => {
|
|
|
17
17
|
...(apiGatewayEvent.multiValueQueryStringParameters || {}),
|
|
18
18
|
...(apiGatewayEvent.queryStringParameters || {}),
|
|
19
19
|
},
|
|
20
|
-
body: apiGatewayEvent.body,
|
|
20
|
+
body: apiGatewayEvent.body === null ? undefined : apiGatewayEvent.body,
|
|
21
21
|
headers: apiGatewayEvent.headers,
|
|
22
22
|
method: apiGatewayEvent.httpMethod,
|
|
23
23
|
correlation: context.awsRequestId,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QPQConfig, EventGetStorySessionActionProcessor } from 'quidproquo-core';
|
|
2
2
|
import { EventInput } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/GetStorySession": EventGetStorySessionActionProcessor<EventInput, import("
|
|
4
|
+
"@quidproquo-core/event/GetStorySession": EventGetStorySessionActionProcessor<EventInput, import("quidproquo-webserver").HTTPEvent>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { QPQConfig } from 'quidproquo-core';
|
|
2
2
|
export declare const getApiGatewayApiEventEventProcessor: (qpqConfig: QPQConfig) => {
|
|
3
|
-
"@quidproquo-core/event/TransformResponseResult": import("quidproquo-core").EventTransformResponseResultActionProcessor<import("./types").EventInput, import("
|
|
4
|
-
"@quidproquo-core/event/AutoRespond": import("quidproquo-core").EventAutoRespondActionProcessor<import("
|
|
5
|
-
"@quidproquo-core/event/MatchStory": import("quidproquo-core").EventMatchStoryActionProcessor<import("
|
|
6
|
-
"@quidproquo-core/Event/GetRecords": import("quidproquo-core").EventGetRecordsActionProcessor<import("./types").EventInput, import("
|
|
7
|
-
"@quidproquo-core/event/GetStorySession": import("quidproquo-core").EventGetStorySessionActionProcessor<import("./types").EventInput, import("
|
|
3
|
+
"@quidproquo-core/event/TransformResponseResult": import("quidproquo-core").EventTransformResponseResultActionProcessor<import("./types").EventInput, import("quidproquo-webserver").HTTPEventResponse, import("aws-lambda").APIGatewayProxyResult>;
|
|
4
|
+
"@quidproquo-core/event/AutoRespond": import("quidproquo-core").EventAutoRespondActionProcessor<import("quidproquo-webserver").HTTPEvent, import("./types").MatchResult, import("quidproquo-webserver").HTTPEventResponse>;
|
|
5
|
+
"@quidproquo-core/event/MatchStory": import("quidproquo-core").EventMatchStoryActionProcessor<import("quidproquo-webserver").HTTPEvent, import("./types").MatchResult>;
|
|
6
|
+
"@quidproquo-core/Event/GetRecords": import("quidproquo-core").EventGetRecordsActionProcessor<import("./types").EventInput, import("quidproquo-webserver").HTTPEvent>;
|
|
7
|
+
"@quidproquo-core/event/GetStorySession": import("quidproquo-core").EventGetStorySessionActionProcessor<import("./types").EventInput, import("quidproquo-webserver").HTTPEvent>;
|
|
8
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventMatchStoryActionProcessor, QPQConfig } from 'quidproquo-core';
|
|
2
2
|
import { MatchResult } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/MatchStory": EventMatchStoryActionProcessor<import("
|
|
4
|
+
"@quidproquo-core/event/MatchStory": EventMatchStoryActionProcessor<import("quidproquo-webserver").HTTPEvent, MatchResult>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
package/lib/esm/getActionProcessor/core/event/apiGatwayEvent/api/transformResponseResult.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QPQConfig, EventTransformResponseResultActionProcessor } from 'quidproquo-core';
|
|
2
2
|
import { EventInput } from './types';
|
|
3
3
|
declare const _default: (qpqConfig: QPQConfig) => {
|
|
4
|
-
"@quidproquo-core/event/TransformResponseResult": EventTransformResponseResultActionProcessor<EventInput, import("
|
|
4
|
+
"@quidproquo-core/event/TransformResponseResult": EventTransformResponseResultActionProcessor<EventInput, import("quidproquo-webserver").HTTPEventResponse, import("aws-lambda").APIGatewayProxyResult>;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -33,7 +33,14 @@ const getProcessTransformResponseResult = (qpqConfig) => {
|
|
|
33
33
|
const [apiGatewayEvent] = eventParams;
|
|
34
34
|
const [record] = qpqEventRecordResponses;
|
|
35
35
|
// If we have an error, we need to transform it to a response, otherwise we can just use the record as is
|
|
36
|
-
|
|
36
|
+
let successRecord = record.success ? record.result : getResponseFromErrorResult(record.error);
|
|
37
|
+
// Return an error if the body is the wrong type.
|
|
38
|
+
if (successRecord.body && typeof successRecord.body !== 'string') {
|
|
39
|
+
successRecord = getResponseFromErrorResult({
|
|
40
|
+
errorText: 'Response body must be a string',
|
|
41
|
+
errorType: ErrorTypeEnum.GenericError,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
37
44
|
// Add the cors headers
|
|
38
45
|
const currentHeaders = successRecord.headers || {};
|
|
39
46
|
const headers = {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { HTTPEvent, HTTPEventResponse } from 'quidproquo-webserver';
|
|
2
2
|
import { APIGatewayEvent, Context, APIGatewayProxyResult } from 'aws-lambda';
|
|
3
3
|
import { MatchStoryResult } from 'quidproquo-core';
|
|
4
|
-
export type AnyHTTPEvent = HTTPEvent<any>;
|
|
5
|
-
export type AnyHTTPEventResponse = HTTPEventResponse<any>;
|
|
6
4
|
export type EventInput = [APIGatewayEvent, Context];
|
|
7
5
|
export type EventOutput = APIGatewayProxyResult;
|
|
8
|
-
export type InternalEventRecord =
|
|
9
|
-
export type InternalEventOutput =
|
|
6
|
+
export type InternalEventRecord = HTTPEvent;
|
|
7
|
+
export type InternalEventOutput = HTTPEventResponse;
|
|
10
8
|
export type MatchResult = MatchStoryResult<any, any>;
|
|
@@ -3,9 +3,8 @@ const getProcessAutoRespond = (qpqConfig) => {
|
|
|
3
3
|
return async ({ qpqEventRecord, matchResult }) => {
|
|
4
4
|
// exit if we don't know what deploy type this is, probably another stack
|
|
5
5
|
const earlyExit = qpqEventRecord.deployEventType === DeployEventType.Unknown || qpqEventRecord.deployEventStatusType === DeployEventStatusType.Unknown;
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
return actionResult(earlyExit);
|
|
6
|
+
// This is strange, but null means don't early exit.
|
|
7
|
+
return actionResult(!earlyExit ? null : void 0);
|
|
9
8
|
};
|
|
10
9
|
};
|
|
11
10
|
export default (qpqConfig) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-actionprocessor-awslambda",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.205",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"node-cache": "^5.1.2",
|
|
53
53
|
"node-match-path": "^0.6.3",
|
|
54
|
-
"quidproquo-config-aws": "0.0.
|
|
55
|
-
"quidproquo-core": "0.0.
|
|
56
|
-
"quidproquo-webserver": "0.0.
|
|
54
|
+
"quidproquo-config-aws": "0.0.205",
|
|
55
|
+
"quidproquo-core": "0.0.205",
|
|
56
|
+
"quidproquo-webserver": "0.0.205"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/aws-lambda": "^8.10.109",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/jsonwebtoken": "^9.0.2",
|
|
62
62
|
"@types/lodash": "^4.14.194",
|
|
63
63
|
"@types/node": "^18.11.9",
|
|
64
|
-
"quidproquo-tsconfig": "0.0.
|
|
64
|
+
"quidproquo-tsconfig": "0.0.205",
|
|
65
65
|
"typescript": "^4.9.3"
|
|
66
66
|
}
|
|
67
67
|
}
|