@socket.tech/dl-common 1.0.3-test.37 → 1.0.3-test.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.
@@ -1,10 +1,10 @@
1
1
  export declare const initQueue: (region: string) => void;
2
2
  export declare const sendStandardSqsMessage: (queueUrl: string, data: any, DelaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
3
- export declare const sendStandardBatchMessages: (QueueUrl: string, dataArray: any[], DelaySecondsArray?: number[]) => Promise<import("@aws-sdk/client-sqs").SendMessageBatchCommandOutput>;
3
+ export declare const sendStandardBatchMessages: (QueueUrl: string, dataArray: any[], DelaySecondsArray?: number[]) => Promise<void>;
4
4
  export declare const sendFifoSqsMessage: (queueUrl: string, data: any, MessageGroupId: string) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
5
5
  declare const _default: {
6
6
  sendStandardSqsMessage: (queueUrl: string, data: any, DelaySeconds?: number) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
7
7
  sendFifoSqsMessage: (queueUrl: string, data: any, MessageGroupId: string) => Promise<import("@aws-sdk/client-sqs").SendMessageCommandOutput>;
8
- sendStandardBatchMessages: (QueueUrl: string, dataArray: any[], DelaySecondsArray?: number[]) => Promise<import("@aws-sdk/client-sqs").SendMessageBatchCommandOutput>;
8
+ sendStandardBatchMessages: (QueueUrl: string, dataArray: any[], DelaySecondsArray?: number[]) => Promise<void>;
9
9
  };
10
10
  export default _default;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendFifoSqsMessage = exports.sendStandardBatchMessages = exports.sendStandardSqsMessage = exports.initQueue = void 0;
4
4
  const client_sqs_1 = require("@aws-sdk/client-sqs");
5
+ const utils_1 = require("../utils");
5
6
  let client;
6
7
  const initQueue = (region) => {
7
8
  client = new client_sqs_1.SQSClient({ region });
@@ -19,21 +20,28 @@ const sendStandardSqsMessage = async (queueUrl, data, DelaySeconds = 0) => {
19
20
  };
20
21
  exports.sendStandardSqsMessage = sendStandardSqsMessage;
21
22
  const sendStandardBatchMessages = async (QueueUrl, dataArray, DelaySecondsArray = []) => {
22
- let Entries = [];
23
- for (let i = 0; i < dataArray.length; i++) {
24
- Entries.push({
25
- MessageBody: JSON.stringify(dataArray[i]),
26
- Id: i,
27
- DelaySeconds: DelaySecondsArray[i] ? DelaySecondsArray[i] : 0,
28
- });
23
+ var _a;
24
+ const dataChunks = [...(0, utils_1.chunks)(dataArray, 10)];
25
+ const delayChunks = [...(0, utils_1.chunks)(DelaySecondsArray, 10)];
26
+ for (let i = 0; i < dataChunks.length; i++) {
27
+ let Entries = [];
28
+ let currentDataArray = dataChunks[i];
29
+ let currentDelayArray = delayChunks[i];
30
+ for (let j = 0; j < currentDataArray.length; j++) {
31
+ Entries.push({
32
+ MessageBody: JSON.stringify(currentDataArray[j]),
33
+ Id: String(i) + "-" + String(j),
34
+ DelaySeconds: (_a = currentDelayArray[j]) !== null && _a !== void 0 ? _a : 0,
35
+ });
36
+ }
37
+ let sqsOrderData = {
38
+ Entries,
39
+ QueueUrl,
40
+ };
41
+ // Send the order data to the SQS queue
42
+ const command = new client_sqs_1.SendMessageBatchCommand(sqsOrderData);
43
+ await client.send(command);
29
44
  }
30
- let sqsOrderData = {
31
- Entries,
32
- QueueUrl,
33
- };
34
- // Send the order data to the SQS queue
35
- const command = new client_sqs_1.SendMessageBatchCommand(sqsOrderData);
36
- return await client.send(command);
37
45
  };
38
46
  exports.sendStandardBatchMessages = sendStandardBatchMessages;
39
47
  const sendFifoSqsMessage = async (queueUrl, data, MessageGroupId) => {
@@ -37,7 +37,7 @@ exports.getFileFromS3 = getFileFromS3;
37
37
  const getS3Config = async (deploymentMode, region = "us-east-1", account = __1.Accounts.dl) => {
38
38
  const S3_BUCKET_NAME = deploymentMode == dl_core_1.DeploymentMode.PROD
39
39
  ? `socket-${account}-` + deploymentMode
40
- : `socket-dl-` + deploymentMode;
40
+ : `socket-ll-` + deploymentMode;
41
41
  const S3_RPC_CONFIG_FILE_PATH = deploymentMode + "RpcConfig.json";
42
42
  (0, exports.initS3Client)(region);
43
43
  return await (0, exports.getFileFromS3)(S3_BUCKET_NAME, S3_RPC_CONFIG_FILE_PATH);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socket.tech/dl-common",
3
- "version": "1.0.3-test.37",
3
+ "version": "1.0.3-test.39",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "description": "common utilities for socket data layer.",
@@ -20,11 +20,11 @@
20
20
  "start": "serverless offline start --reloadHandler -s dev",
21
21
  "start:dev": "serverless offline start --reloadHandler -s dev",
22
22
  "deploy": "npm run lint && npx sls deploy -s dev --verbose",
23
- "deploy:prod": "npm run lint && export AWS_PROFILE=dlprod && npx sls deploy -s prod --verbose",
23
+ "deploy:prod": "npm run lint && export AWS_PROFILE=llprod && npx sls deploy -s prod --verbose",
24
24
  "deploy:surge": "npx sls deploy -s surge --verbose",
25
25
  "build": "tsc --project lib.tsconfig.json",
26
26
  "build:clean": "rm -rf tsconfig.build.tsbuildinfo && rm -rf ./dist",
27
- "eslint:check": "npx eslint src --ext ts,js",
27
+ "eslint:check": "npx eslint src/ --ext .ts,.js",
28
28
  "eslint:fix": "npx eslint src --ext ts,js --fix",
29
29
  "lint": "tsc && npm run prettier:fix",
30
30
  "prettier:fix": "npx prettier src dl-common __tests__ --write ./**/*.{ts,js,json,yml,md}",
@@ -32,11 +32,18 @@
32
32
  "format:check": "prettier \"./**\" --ignore-unknown --check",
33
33
  "prepare": "husky install",
34
34
  "publishp": "yarn lint && yarn build",
35
+ "eslint:cachefix":"eslint --fix",
35
36
  "testc": "jest --testPathIgnorePatterns '.db.test.ts$' --coverage",
36
37
  "testdb": "jest --testMatch **/*.db.test.ts --runInBand",
37
38
  "testdbc": "jest --testMatch **/*.db.test.ts --runInBand --coverage",
38
39
  "test": "jest --testPathIgnorePatterns '.db.test.ts$'"
39
40
  },
41
+ "lint-staged": {
42
+ "*.{ts,js}": "eslint --cache --fix",
43
+ "*.{ts,js,css,md}": "prettier --write",
44
+ "*.js": "eslint --cache --fix",
45
+ "*.{js,css,md}": "prettier --write"
46
+ },
40
47
  "dependencies": {
41
48
  "@aws-sdk/client-eventbridge": "^3.449.0",
42
49
  "@aws-sdk/client-kms": "^3.454.0",
@@ -65,6 +72,8 @@
65
72
  "@babel/preset-typescript": "^7.23.3",
66
73
  "@commitlint/cli": "^16.2.3",
67
74
  "@commitlint/config-conventional": "^16.2.1",
75
+ "@eslint/eslintrc": "^3.0.2",
76
+ "@eslint/js": "^9.0.0",
68
77
  "@jest/globals": "^29.7.0",
69
78
  "@types/aws-lambda": "^8.10.108",
70
79
  "@types/bn.js": "^5.1.5",
@@ -80,17 +89,18 @@
80
89
  "csv-parse": "^5.5.2",
81
90
  "esbuild": "^0.19.3",
82
91
  "eslint": "^8.0.1",
83
- "eslint-config-prettier": "8.3.0",
84
- "eslint-config-standard-with-typescript": "^39.1.0",
92
+ "eslint-config-prettier": "^9.1.0",
93
+ "eslint-config-standard-with-typescript": "^43.0.1",
85
94
  "eslint-plugin-import": "^2.25.2",
86
95
  "eslint-plugin-jsdoc": "^48.2.3",
87
96
  "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
88
97
  "eslint-plugin-node": "^11.1.0",
89
98
  "eslint-plugin-promise": "^6.0.0",
90
99
  "eslint-plugin-tsdoc": "^0.2.14",
91
- "husky": "^7.0.4",
100
+ "globals": "^15.0.0",
101
+ "husky": "^8.0.0",
92
102
  "jest": "^29.7.0",
93
- "lint-staged": "^12.3.7",
103
+ "lint-staged": "^15.2.2",
94
104
  "nodemon": "^2.0.15",
95
105
  "prettier": "2.7.1",
96
106
  "serverless": "3.22.0",
@@ -103,6 +113,7 @@
103
113
  "serverless-plugin-aws-alerts": "^1.7.5",
104
114
  "ts-jest": "^29.1.1",
105
115
  "ts-node": "^10.7.0",
106
- "typescript": "*"
116
+ "typescript": "*",
117
+ "typescript-eslint": "^7.6.0"
107
118
  }
108
119
  }