@xube/kit-destination 0.0.12 → 0.0.13

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.js CHANGED
@@ -9,12 +9,13 @@ const isConfirmation = (headers, body, log = kit_log_1.XubeLog.getInstance()) =>
9
9
  log.info("Checking if confirmation request");
10
10
  log.info(JSON.stringify(headers));
11
11
  log.info(JSON.stringify(body));
12
- return (0, generated_1.isDestinationHeaders)(headers) &&
12
+ return ((0, generated_1.isDestinationHeaders)(headers) &&
13
13
  headers["x-amz-rules-engine-message-type"] === "DestinationConfirmation" &&
14
- (0, generated_1.isConfirmationRequest)(body);
14
+ (0, generated_1.isConfirmationRequest)(body));
15
15
  };
16
16
  exports.isConfirmation = isConfirmation;
17
17
  const confirmDestination = async (confirmationRequest, log = kit_log_1.XubeLog.getInstance()) => {
18
+ log.info("Attempting to confirm destination");
18
19
  const response = await fetch(confirmationRequest.enableUrl, {
19
20
  method: "GET",
20
21
  headers: {
@@ -28,6 +29,9 @@ const confirmDestination = async (confirmationRequest, log = kit_log_1.XubeLog.g
28
29
  error: "Failed to confirm destination",
29
30
  });
30
31
  }
32
+ else {
33
+ log.info("Successfully confirmed destination");
34
+ }
31
35
  return new kit_request_1.XubeResponse({
32
36
  statusCode: kit_constants_1.StatusCode.OK,
33
37
  data: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xube/kit-destination",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
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.12",
22
+ "@xube/kit-build": "^0.0.13",
23
23
  "ts-node": "^10.9.1",
24
24
  "typescript": "^5.1.6"
25
25
  },
26
26
  "dependencies": {
27
- "@xube/kit-generator": "^0.0.12",
28
- "@xube/kit-log": "^0.0.12",
29
- "@xube/kit-request": "^0.0.12"
27
+ "@xube/kit-generator": "^0.0.13",
28
+ "@xube/kit-log": "^0.0.13",
29
+ "@xube/kit-request": "^0.0.13"
30
30
  }
31
31
  }
package/src/confirm.ts CHANGED
@@ -11,21 +11,24 @@ export const isConfirmation = (
11
11
  headers: Record<string, any>,
12
12
  body: Record<string, any>,
13
13
  log: XubeLog = XubeLog.getInstance()
14
- ): boolean =>{
15
-
14
+ ): boolean => {
16
15
  log.info("Checking if confirmation request");
17
16
 
18
17
  log.info(JSON.stringify(headers));
19
18
  log.info(JSON.stringify(body));
20
19
 
21
- return isDestinationHeaders(headers) &&
22
- headers["x-amz-rules-engine-message-type"] === "DestinationConfirmation" &&
23
- isConfirmationRequest(body);}
20
+ return (
21
+ isDestinationHeaders(headers) &&
22
+ headers["x-amz-rules-engine-message-type"] === "DestinationConfirmation" &&
23
+ isConfirmationRequest(body)
24
+ );
25
+ };
24
26
 
25
27
  export const confirmDestination = async (
26
28
  confirmationRequest: ConfirmationRequest,
27
29
  log: XubeLog = XubeLog.getInstance()
28
30
  ): Promise<XubeResponse<boolean>> => {
31
+ log.info("Attempting to confirm destination");
29
32
  const response = await fetch(confirmationRequest.enableUrl, {
30
33
  method: "GET",
31
34
  headers: {
@@ -39,6 +42,8 @@ export const confirmDestination = async (
39
42
  statusCode: StatusCode.BadRequest,
40
43
  error: "Failed to confirm destination",
41
44
  });
45
+ } else {
46
+ log.info("Successfully confirmed destination");
42
47
  }
43
48
  return new XubeResponse({
44
49
  statusCode: StatusCode.OK,