@xube/kit-aws-hooks 0.0.38 → 0.0.39

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/send.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import { TableItem } from "@xube/kit-aws";
2
2
  import { XubeResponse } from "@xube/kit-request";
3
- export declare const sendDataToEndpoints: (webhookTableName: string, indexName: string, items: TableItem[]) => Promise<XubeResponse<boolean>>;
3
+ import { XubeLog } from "@xube/kit-log";
4
+ export declare const sendDataToEndpoints: (webhookTableName: string, indexName: string, items: TableItem[], log?: XubeLog) => Promise<XubeResponse<boolean>>;
package/dist/send.js CHANGED
@@ -7,7 +7,8 @@ const types_1 = require("./types");
7
7
  const kit_request_1 = require("@xube/kit-request");
8
8
  const webhook_1 = require("./schemas/webhook");
9
9
  const kit_constants_1 = require("@xube/kit-constants");
10
- const sendDataToEndpoints = async (webhookTableName, indexName, items) => {
10
+ const kit_log_1 = require("@xube/kit-log");
11
+ const sendDataToEndpoints = async (webhookTableName, indexName, items, log = kit_log_1.XubeLog.getInstance()) => {
11
12
  const endpointSends = [];
12
13
  for (const item of items) {
13
14
  const invertedWebhookKey = {
@@ -22,6 +23,7 @@ const sendDataToEndpoints = async (webhookTableName, indexName, items) => {
22
23
  console.log(`No webhook endpoints found for webhook endpoint ${item.id} and type ${types_1.WebhookTypes.data}`);
23
24
  continue;
24
25
  }
26
+ log.info(`Found webhook endpoint ${JSON.stringify(invertedWebhookKey)} for id: ${item.id}`);
25
27
  const webhookEndpoints = getWebhookEndpointsResponse.data;
26
28
  for (const webhookEndpoint of webhookEndpoints) {
27
29
  if (!(0, webhook_1.isWebhookEndpoint)(webhookEndpoint)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xube/kit-aws-hooks",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -17,12 +17,12 @@
17
17
  },
18
18
  "homepage": "https://github.com/XubeLtd/dev-kit#readme",
19
19
  "devDependencies": {
20
- "@xube/kit-build": "^0.0.38"
20
+ "@xube/kit-build": "^0.0.39"
21
21
  },
22
22
  "dependencies": {
23
- "@xube/kit-aws": "^0.0.38",
24
- "@xube/kit-log": "^0.0.38",
25
- "@xube/kit-request": "^0.0.38",
23
+ "@xube/kit-aws": "^0.0.39",
24
+ "@xube/kit-log": "^0.0.39",
25
+ "@xube/kit-request": "^0.0.39",
26
26
  "zod": "^3.22.4"
27
27
  }
28
28
  }
package/src/send.ts CHANGED
@@ -4,11 +4,13 @@ import { WebhookTypes } from "./types";
4
4
  import { XubeResponse } from "@xube/kit-request";
5
5
  import { isWebhookEndpoint } from "./schemas/webhook";
6
6
  import { StatusCode } from "@xube/kit-constants";
7
+ import { XubeLog } from "@xube/kit-log";
7
8
 
8
9
  export const sendDataToEndpoints = async (
9
10
  webhookTableName: string,
10
11
  indexName: string,
11
- items: TableItem[]
12
+ items: TableItem[],
13
+ log: XubeLog = XubeLog.getInstance()
12
14
  ): Promise<XubeResponse<boolean>> => {
13
15
  const endpointSends: Promise<Response>[] = [];
14
16
 
@@ -17,6 +19,7 @@ export const sendDataToEndpoints = async (
17
19
  PK: getWebhookSortKey(item.id, WebhookTypes.data),
18
20
  };
19
21
 
22
+
20
23
  const getWebhookEndpointsResponse = await queryItemsFromTable(
21
24
  webhookTableName,
22
25
  invertedWebhookKey,
@@ -37,6 +40,12 @@ export const sendDataToEndpoints = async (
37
40
  continue;
38
41
  }
39
42
 
43
+ log.info(
44
+ `Found webhook endpoint ${JSON.stringify(invertedWebhookKey)} for id: ${
45
+ item.id
46
+ }`
47
+ );
48
+
40
49
  const webhookEndpoints: TableItem[] = getWebhookEndpointsResponse.data;
41
50
 
42
51
  for (const webhookEndpoint of webhookEndpoints) {