@xube/kit-destination 0.0.11 → 0.0.12
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/dist/confirm.d.ts +1 -1
- package/dist/confirm.js +8 -3
- package/package.json +5 -5
- package/src/confirm.ts +11 -4
package/dist/confirm.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfirmationRequest } from "./generated";
|
|
2
2
|
import { XubeLog } from "@xube/kit-log";
|
|
3
3
|
import { XubeResponse } from "@xube/kit-request";
|
|
4
|
-
export declare const isConfirmation: (headers: Record<string, any>, body: Record<string, any
|
|
4
|
+
export declare const isConfirmation: (headers: Record<string, any>, body: Record<string, any>, log?: XubeLog) => boolean;
|
|
5
5
|
export declare const confirmDestination: (confirmationRequest: ConfirmationRequest, log?: XubeLog) => Promise<XubeResponse<boolean>>;
|
package/dist/confirm.js
CHANGED
|
@@ -5,9 +5,14 @@ const generated_1 = require("./generated");
|
|
|
5
5
|
const kit_constants_1 = require("@xube/kit-constants");
|
|
6
6
|
const kit_log_1 = require("@xube/kit-log");
|
|
7
7
|
const kit_request_1 = require("@xube/kit-request");
|
|
8
|
-
const isConfirmation = (headers, body
|
|
9
|
-
|
|
10
|
-
(
|
|
8
|
+
const isConfirmation = (headers, body, log = kit_log_1.XubeLog.getInstance()) => {
|
|
9
|
+
log.info("Checking if confirmation request");
|
|
10
|
+
log.info(JSON.stringify(headers));
|
|
11
|
+
log.info(JSON.stringify(body));
|
|
12
|
+
return (0, generated_1.isDestinationHeaders)(headers) &&
|
|
13
|
+
headers["x-amz-rules-engine-message-type"] === "DestinationConfirmation" &&
|
|
14
|
+
(0, generated_1.isConfirmationRequest)(body);
|
|
15
|
+
};
|
|
11
16
|
exports.isConfirmation = isConfirmation;
|
|
12
17
|
const confirmDestination = async (confirmationRequest, log = kit_log_1.XubeLog.getInstance()) => {
|
|
13
18
|
const response = await fetch(confirmationRequest.enableUrl, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xube/kit-destination",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"homepage": "https://github.com/XubeLtd/dev-kit#readme",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.4.7",
|
|
22
|
-
"@xube/kit-build": "^0.0.
|
|
22
|
+
"@xube/kit-build": "^0.0.12",
|
|
23
23
|
"ts-node": "^10.9.1",
|
|
24
24
|
"typescript": "^5.1.6"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@xube/kit-generator": "^0.0.
|
|
28
|
-
"@xube/kit-log": "^0.0.
|
|
29
|
-
"@xube/kit-request": "^0.0.
|
|
27
|
+
"@xube/kit-generator": "^0.0.12",
|
|
28
|
+
"@xube/kit-log": "^0.0.12",
|
|
29
|
+
"@xube/kit-request": "^0.0.12"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/confirm.ts
CHANGED
|
@@ -9,11 +9,18 @@ import { XubeResponse } from "@xube/kit-request";
|
|
|
9
9
|
|
|
10
10
|
export const isConfirmation = (
|
|
11
11
|
headers: Record<string, any>,
|
|
12
|
-
body: Record<string, any
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
body: Record<string, any>,
|
|
13
|
+
log: XubeLog = XubeLog.getInstance()
|
|
14
|
+
): boolean =>{
|
|
15
|
+
|
|
16
|
+
log.info("Checking if confirmation request");
|
|
17
|
+
|
|
18
|
+
log.info(JSON.stringify(headers));
|
|
19
|
+
log.info(JSON.stringify(body));
|
|
20
|
+
|
|
21
|
+
return isDestinationHeaders(headers) &&
|
|
15
22
|
headers["x-amz-rules-engine-message-type"] === "DestinationConfirmation" &&
|
|
16
|
-
isConfirmationRequest(body);
|
|
23
|
+
isConfirmationRequest(body);}
|
|
17
24
|
|
|
18
25
|
export const confirmDestination = async (
|
|
19
26
|
confirmationRequest: ConfirmationRequest,
|