@ingestkorea/client-sens 1.10.0 → 1.11.0

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.
Files changed (100) hide show
  1. package/README.md +98 -57
  2. package/dist-cjs/SensClient.js +31 -35
  3. package/dist-cjs/commands/GetAlimtalkResultCommand.js +3 -0
  4. package/dist-cjs/commands/GetAlimtalkStatusCommand.js +8 -1
  5. package/dist-cjs/commands/GetAlimtalkTemplateCommand.js +3 -0
  6. package/dist-cjs/commands/GetSMSResultCommand.js +3 -0
  7. package/dist-cjs/commands/GetSMSStatusCommand.js +8 -1
  8. package/dist-cjs/commands/ListAlimtalkChannelsCommand.js +3 -0
  9. package/dist-cjs/commands/ListAlimtalkStatusCommand.js +17 -3
  10. package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +3 -0
  11. package/dist-cjs/commands/ListSMSStatusCommand.js +16 -3
  12. package/dist-cjs/commands/SendAlimtalkCommand.js +9 -1
  13. package/dist-cjs/commands/SendMMSCommand.js +7 -4
  14. package/dist-cjs/commands/SendSMSCommand.js +23 -9
  15. package/dist-cjs/commands/constants.js +2 -2
  16. package/dist-cjs/index.js +1 -1
  17. package/dist-cjs/middleware/constants.js +2 -1
  18. package/dist-cjs/middleware/middleware-metadata.js +7 -12
  19. package/dist-cjs/middleware/middleware-retry.js +37 -20
  20. package/dist-cjs/middleware/middleware-sign.js +8 -12
  21. package/dist-cjs/models/{SensErrorInfo.js → SensApiError.js} +1 -11
  22. package/dist-cjs/models/{SensError.js → SensClientError.js} +4 -0
  23. package/dist-cjs/models/SensCommand.js +1 -0
  24. package/dist-cjs/models/index.js +2 -2
  25. package/dist-cjs/protocols/GetAlimtalkResult.js +14 -17
  26. package/dist-cjs/protocols/GetAlimtalkStatus.js +21 -17
  27. package/dist-cjs/protocols/GetAlimtalkTemplate.js +29 -17
  28. package/dist-cjs/protocols/GetSMSResult.js +16 -17
  29. package/dist-cjs/protocols/GetSMSStatus.js +10 -16
  30. package/dist-cjs/protocols/ListAlimtalkChannels.js +10 -16
  31. package/dist-cjs/protocols/ListAlimtalkStatus.js +10 -16
  32. package/dist-cjs/protocols/ListAlimtalkTemplates.js +12 -19
  33. package/dist-cjs/protocols/ListSMSStatus.js +10 -16
  34. package/dist-cjs/protocols/SendAlimtalk.js +10 -16
  35. package/dist-cjs/protocols/SendMMS.js +4 -13
  36. package/dist-cjs/protocols/SendSMS.js +11 -17
  37. package/dist-cjs/protocols/constants.js +91 -75
  38. package/dist-es/SensClient.js +25 -22
  39. package/dist-es/commands/GetAlimtalkResultCommand.js +8 -9
  40. package/dist-es/commands/GetAlimtalkStatusCommand.js +8 -9
  41. package/dist-es/commands/GetAlimtalkTemplateCommand.js +8 -9
  42. package/dist-es/commands/GetSMSResultCommand.js +8 -9
  43. package/dist-es/commands/GetSMSStatusCommand.js +8 -9
  44. package/dist-es/commands/ListAlimtalkChannelsCommand.js +8 -9
  45. package/dist-es/commands/ListAlimtalkStatusCommand.js +19 -21
  46. package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -9
  47. package/dist-es/commands/ListSMSStatusCommand.js +20 -22
  48. package/dist-es/commands/SendAlimtalkCommand.js +12 -13
  49. package/dist-es/commands/SendMMSCommand.js +28 -29
  50. package/dist-es/commands/SendSMSCommand.js +20 -22
  51. package/dist-es/commands/constants.js +12 -22
  52. package/dist-es/commands/index.js +12 -28
  53. package/dist-es/index.js +3 -19
  54. package/dist-es/middleware/constants.js +8 -10
  55. package/dist-es/middleware/index.js +3 -19
  56. package/dist-es/middleware/middleware-metadata.js +4 -7
  57. package/dist-es/middleware/middleware-retry.js +39 -19
  58. package/dist-es/middleware/middleware-sign.js +9 -13
  59. package/dist-es/models/GetAlimtalkResult.js +1 -2
  60. package/dist-es/models/GetAlimtalkStatus.js +1 -2
  61. package/dist-es/models/GetAlimtalkTemplate.js +1 -2
  62. package/dist-es/models/GetSMSResult.js +1 -2
  63. package/dist-es/models/GetSMSStatus.js +1 -2
  64. package/dist-es/models/ListAlimtalkChannels.js +1 -2
  65. package/dist-es/models/ListAlimtalkStatus.js +1 -2
  66. package/dist-es/models/ListAlimtalkTemplates.js +1 -2
  67. package/dist-es/models/ListSMSStatus.js +1 -2
  68. package/dist-es/models/MetadataBearer.js +1 -2
  69. package/dist-es/models/SendAlimtalk.js +2 -5
  70. package/dist-es/models/SendMMS.js +2 -5
  71. package/dist-es/models/SendSMS.js +1 -2
  72. package/dist-es/models/SensApiError.js +18 -0
  73. package/dist-es/models/SensClient.js +1 -2
  74. package/dist-es/models/{SensError.js → SensClientError.js} +5 -5
  75. package/dist-es/models/SensCommand.js +2 -5
  76. package/dist-es/models/SensMiddleware.js +1 -2
  77. package/dist-es/models/index.js +18 -34
  78. package/dist-es/protocols/GetAlimtalkResult.js +11 -16
  79. package/dist-es/protocols/GetAlimtalkStatus.js +17 -24
  80. package/dist-es/protocols/GetAlimtalkTemplate.js +12 -17
  81. package/dist-es/protocols/GetSMSResult.js +11 -16
  82. package/dist-es/protocols/GetSMSStatus.js +15 -22
  83. package/dist-es/protocols/ListAlimtalkChannels.js +11 -16
  84. package/dist-es/protocols/ListAlimtalkStatus.js +11 -16
  85. package/dist-es/protocols/ListAlimtalkTemplates.js +15 -22
  86. package/dist-es/protocols/ListSMSStatus.js +11 -16
  87. package/dist-es/protocols/SendAlimtalk.js +12 -18
  88. package/dist-es/protocols/SendMMS.js +5 -10
  89. package/dist-es/protocols/SendSMS.js +12 -18
  90. package/dist-es/protocols/constants.js +96 -84
  91. package/dist-types/SensClient.d.ts +0 -1
  92. package/dist-types/index.d.ts +1 -1
  93. package/dist-types/middleware/constants.d.ts +1 -0
  94. package/dist-types/models/MetadataBearer.d.ts +1 -0
  95. package/dist-types/models/{SensErrorInfo.d.ts → SensApiError.d.ts} +0 -2
  96. package/dist-types/models/SensClient.d.ts +8 -0
  97. package/dist-types/models/{SensError.d.ts → SensClientError.d.ts} +3 -2
  98. package/dist-types/models/index.d.ts +2 -2
  99. package/package.json +4 -4
  100. package/dist-es/models/SensErrorInfo.js +0 -31
package/README.md CHANGED
@@ -2,39 +2,49 @@
2
2
 
3
3
  [![npm (scoped)](https://img.shields.io/npm/v/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
5
- ![build status](https://codebuild.ap-northeast-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiOTYrKzNDRklOaWJxS2ZoTkZvY05TU2VGVFdxWFlSWE9DZXJTYVBlbCtwc0J5YTcvdUFKRjlSc1RDTHNDV1J4YnhxMmRLaFdIakpSVWN3QzBHQXp0KzdRPSIsIml2UGFyYW1ldGVyU3BlYyI6IjQ1dUtTMlE1UWhmWmFTRGsiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)
6
5
  [![license](https://img.shields.io/github/license/ingestkorea/client-sens?style=flat-square)](https://www.npmjs.com/package/@ingestkorea/client-sens)
7
6
 
8
7
  ## Description
9
8
 
10
9
  INGESTKOREA SDK - Naver Cloud Platform SENS Client for Node.js.
11
10
 
12
- INGESTKOREA SDK - SENS Client for Node.js is a lightweight library that contains only the essential features frequently used in SENS.
11
+ SENS(Simple & Easy Notification Service) SDK는 [네이버 클라우드 SENS](https://www.ncloud.com/product/applicationService/sens)에서 필수적으로 사용되는 메서드 위주로 구현된 가벼운 라이브러리입니다.
13
12
 
14
- This SDK performs tasks such as the following automatically.
13
+ SDK 아래 작업들을 내부적으로 수행합니다.
15
14
 
16
- - Authentication using an API Signature
17
- - Retrying requests
18
- - Handling error responses
15
+ - 공통 헤더를 이용한 인증(Signature, Timestamp, AccessKey)
16
+ - API 요청 실패시 지능형 재시도
17
+ - SENS API, Ncloud API 표준 에러 핸들링
19
18
 
20
- ## Installing
19
+ SDK는 [SENS API Docs](https://api.ncloud-docs.com/docs/sens-overview), [Ncloud API Docs](https://api.ncloud-docs.com/docs/common-ncpapi#응답)에서 제공하는 형식을 준수합니다.
20
+
21
+ **주의사항**: SENS 서비스 이용을 위해서는 아래 정보들이 필요합니다
22
+
23
+ - [Naver Cloud Platform API 인증키](https://www.ncloud.com/mypage/manage/authkey): **AccessKey**, **SecretKey**
24
+ - [SENS 이용 서비스 정보](https://console.ncloud.com/sens/project): **ServiceId**
25
+
26
+ ## Getting Started
27
+
28
+ ### Installing
21
29
 
22
30
  ```sh
23
31
  npm install @ingestkorea/client-sens
24
32
  ```
25
33
 
26
- ## Getting Started
27
-
28
34
  ### Pre-requisites
29
35
 
30
- - Use TypeScript v5.x
31
- - Includes the TypeScript definitions for node.
32
- ```sh
33
- npm install -D typescript # save dev mode
34
- npm install -D @types/node # save dev mode
35
- ```
36
+ SDK는 아래 사항들을 요구합니다.
37
+
38
+ - TypeScript v5 이상
39
+ - Node v22 이상
36
40
 
37
- ### Support Commands
41
+ ```sh
42
+ # save dev mode
43
+ npm install -D typescript
44
+ npm install -D @types/node
45
+ ```
46
+
47
+ ## Support Methods
38
48
 
39
49
  #### Kakao Alimtalk
40
50
 
@@ -54,11 +64,11 @@ npm install @ingestkorea/client-sens
54
64
  - GetSMSResult (SMS, LMS, MMS)
55
65
  - ListSMSStatus (SMS, LMS, MMS)
56
66
 
57
- ### Import
67
+ ## Import
58
68
 
59
- The INGESTKOREA SDK - SENS Client is modulized by `client` and `commands`.
69
+ Simple & Easy Notification Service SDK는 `client`, `commands` 개의 모듈로 구성되어 있습니다.
60
70
 
61
- To send a request, you only need to import the SensClient and the commands you need, for example SendMessageCommand:
71
+ SDK 사용을 위해서는 `SensClient`, 필요한 `Command` 개만 import 하면 됩니다. (예시를 위해 `SendMessageCommand`를 사용하겠습니다.)
62
72
 
63
73
  ```ts
64
74
  import { SensClient, SendAlimtalkCommand } from "@ingestkorea/client-sens";
@@ -66,30 +76,36 @@ import { SensClient, SendAlimtalkCommand } from "@ingestkorea/client-sens";
66
76
 
67
77
  ### Usage
68
78
 
69
- To send a request, you:
79
+ 요청을 보내기 위해서는
80
+
81
+ - Client 초기화 / 설정 정보 필요(ex. credentials)
82
+ - Command 초기화 / 파라미터 값들 필요
83
+ - `send` 메서드 호출 / Command 객체 필요
70
84
 
71
- - Initiate client with configuration.
72
- - Initiate command with input parameters.
73
- - Call `send` operation on client with command object as input.
85
+ `SensClient`가 내부적으로 사용하는 **httpHandler**는 기본적으로 다음 옵션이 적용됩니다.
86
+
87
+ - **connectionTimeout**: 2000ms
88
+ - **socketTimeout**: 3000ms
89
+ - **keepAlive**: false
90
+ - **family**: ipv4
74
91
 
75
92
  ```ts
93
+ // 초기화된 client는 다른 요청에도 재사용 가능합니다.
76
94
  const client = new SensClient({
77
- /**
78
- * AccessKey, SecretKey: https://www.ncloud.com/mypage/manage/authkey
79
- * serviceId: https://console.ncloud.com/sens/project
80
- */
81
95
  credentials: {
82
96
  accessKey: "YOUR_ACCESS_KEY",
83
97
  secretKey: "YOUR_SECRET_KEY",
84
98
  },
85
- /**
86
- * at least one serviceId required
87
- * if you call send operation without serviceId, sdk throw error
88
- */
99
+ // 최소 1개 이상의 serviceId 정보가 필요합니다.
89
100
  serviceId: {
90
101
  kakao: "ncp:kkobizmsg:kr:xxxxxx:your-service-name",
91
102
  sms: "ncp:sms:kr:xxxxxx:your-service-name",
92
103
  },
104
+ // 선택 (필요시 변경 가능)
105
+ httpHandler: {
106
+ connectionTimeout: 2000,
107
+ ...
108
+ },
93
109
  });
94
110
  ```
95
111
 
@@ -97,20 +113,43 @@ const client = new SensClient({
97
113
 
98
114
  ```ts
99
115
  const command = new SendAlimtalkCommand({
100
- /** Required: Kakao PlusFriend ID (e.g., @kakao) */
101
- plusFriendId: "PLUS_FRIEND_ID",
102
-
103
- /** Required: Kakao Alimtalk TemplateCode ID (e.g., welcomeTemplate) */
104
- templateCode: "TEMPLATE_CODE",
105
-
106
- /** Required: List of messages to send (Max 100) */
116
+ plusFriendId: "PLUS_FRIEND_ID", // @plusfriendId
117
+ templateCode: "TEMPLATE_CODE", // TemplateCode ID (e.g., welcomeTemplate)
107
118
  messages: [
108
- /** Recipient phone number (digits only), Message content */
119
+ // 최대 100개까지 요청 가능
109
120
  { to: "01012345678", content: "YOUR_CONTENT" },
110
121
  ],
111
122
  });
112
123
  ```
113
124
 
125
+ ```json
126
+ {
127
+ "$metadata": {
128
+ "httpStatusCode": 202,
129
+ "attempts": 1,
130
+ "totalRetryDelay": 0,
131
+ "traceId": "xxxxxx"
132
+ },
133
+ "requestId": "xxxx-xxxx-xxxx-xxxx-xxxx",
134
+ "requestTime": "2026-01-23T12:34:56.789Z",
135
+ "statusCode": "202",
136
+ "statusName": "processing",
137
+ "messages": [
138
+ {
139
+ "messageId": "xxxx-xxx-xxxx-xxxx-xxxx",
140
+ "to": "010xxxxzzzz",
141
+ "countryCode": "82",
142
+ "content": "xxxx",
143
+ ...
144
+ "requestStatusCode": "A000",
145
+ "requestStatusName": "success",
146
+ "requestStatusDesc": "성공",
147
+ "useSmsFailover": false
148
+ }
149
+ ]
150
+ }
151
+ ```
152
+
114
153
  #### ListAlimtalkStatus
115
154
 
116
155
  ```ts
@@ -135,7 +174,9 @@ const command = new ListAlimtalkStatusCommand({
135
174
  #### GetAlimtalkStatus
136
175
 
137
176
  ```ts
138
- const command = new GetAlimtalkStatusCommand({ requestId: "ALIMTALK_REQUEST_ID" });
177
+ const command = new GetAlimtalkStatusCommand({
178
+ requestId: "ALIMTALK_REQUEST_ID",
179
+ });
139
180
  ```
140
181
 
141
182
  #### SendSMS (SMS, LMS)
@@ -192,33 +233,33 @@ const command = new SendMMSCommand({
192
233
  });
193
234
  ```
194
235
 
195
- #### Async/await
236
+ ### Async/await
196
237
 
197
238
  ```ts
239
+ import {
240
+ SensClient, SendAlimtalkCommand, SensError
241
+ } from "@ingestkorea/client-sens";
242
+
198
243
  (async () => {
199
244
  try {
200
- const data = await client.send(command);
201
- console.dir(data, { depth: 4 });
202
- } catch (err) {
203
- console.dir(err, { depth: 4 });
245
+ // a client can be shared by different commands.
246
+ const client = new SensClient({...});
247
+ const command = new SendAlimtalkCommand({...});
248
+
249
+ const output = await client.send(command);
250
+ console.log(output);
251
+ } catch (error) {
252
+ if (error instanceof SensError) {
253
+ ...
254
+ }
255
+ console.error(error)
204
256
  }
205
257
  })();
206
258
  ```
207
259
 
208
- #### Promises
209
-
210
- ```ts
211
- client
212
- .send(command)
213
- .then((data) => console.dir(data, { depth: 4 }))
214
- .catch((err) => console.dir(err, { depth: 4 }));
215
- ```
216
-
217
260
  ## Getting Help
218
261
 
219
- We use the GitHub issues for tracking bugs and feature requests.
220
-
221
- If it turns out that you may have found a bug, please open an issue.
262
+ 기능 추가 요청, 버그 신고는 깃허브 이슈를 사용해주세요.
222
263
 
223
264
  ## License
224
265
 
@@ -1,48 +1,45 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.SensClient = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const index_js_1 = require("./models/index.js");
15
6
  const index_js_2 = require("./middleware/index.js");
16
7
  class SensClient {
8
+ config;
9
+ httpHandler;
17
10
  constructor(config) {
18
- this.httpHandler = new util_http_handler_1.NodeHttpHandler({ connectionTimeout: 3000, socketTimeout: 3000 });
19
- this.requestHandler = (input, context) => __awaiter(this, void 0, void 0, function* () { return this.httpHandler.handle(input.request); });
20
11
  this.config = {
21
12
  credentials: resolveCredentials(config),
22
13
  serviceId: resolveServiceId(config),
14
+ httpHandler: {
15
+ connectionTimeout: config.httpHandler?.connectionTimeout ?? 2000,
16
+ socketTimeout: config.httpHandler?.socketTimeout ?? 3000,
17
+ keepAlive: config.httpHandler?.keepAlive ?? false,
18
+ family: 4,
19
+ },
23
20
  };
21
+ this.httpHandler = new util_http_handler_1.NodeHttpHandler(this.config.httpHandler);
24
22
  }
25
- send(command) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- const { input, serializer, deserializer } = command;
28
- const middlewares = [index_js_2.middlewareIngestkoreaMetadata, index_js_2.middlewareNcpSign, index_js_2.middlewareRetry];
29
- const handler = composeMiddleware(middlewares, this.requestHandler);
30
- try {
31
- const request = yield serializer(input, this.config);
32
- const { response } = yield handler({ request }, this.config);
33
- const output = yield deserializer(response, this.config);
34
- return output;
35
- }
36
- catch (err) {
37
- if (err instanceof index_js_1.SensError)
38
- throw err;
39
- throw new index_js_1.SensError({
40
- code: -1,
41
- type: "SDK.UNKNOWN_ERROR",
42
- message: err instanceof Error ? err.message : "unknown error",
43
- });
44
- }
45
- });
23
+ async send(command) {
24
+ const { input, serializer, deserializer } = command;
25
+ const middlewares = [index_js_2.middlewareIngestkoreaMetadata, index_js_2.middlewareNcpSign, index_js_2.middlewareRetry];
26
+ const finalHandler = async (input, context) => this.httpHandler.handle(input.request);
27
+ const handler = composeMiddleware(middlewares, finalHandler);
28
+ try {
29
+ const request = await serializer(input, this.config);
30
+ const { response } = await handler({ request }, this.config);
31
+ const output = await deserializer(response, this.config);
32
+ return output;
33
+ }
34
+ catch (error) {
35
+ if (error instanceof index_js_1.SensError)
36
+ throw error;
37
+ throw new index_js_1.SensError({
38
+ code: -1,
39
+ type: "SDK.UNKNOWN_ERROR",
40
+ message: error instanceof Error ? error.message : "unknown error",
41
+ });
42
+ }
46
43
  }
47
44
  }
48
45
  exports.SensClient = SensClient;
@@ -75,7 +72,6 @@ const resolveCredentials = (config) => {
75
72
  };
76
73
  };
77
74
  const resolveServiceId = (config) => {
78
- var _a, _b;
79
75
  const { serviceId } = config;
80
76
  const error = new index_js_1.SensError({
81
77
  code: -1,
@@ -90,7 +86,7 @@ const resolveServiceId = (config) => {
90
86
  throw error;
91
87
  }
92
88
  return {
93
- kakao: (_a = serviceId.kakao) !== null && _a !== void 0 ? _a : "",
94
- sms: (_b = serviceId.sms) !== null && _b !== void 0 ? _b : "",
89
+ kakao: serviceId.kakao ?? "",
90
+ sms: serviceId.sms ?? "",
95
91
  };
96
92
  };
@@ -4,6 +4,9 @@ exports.GetAlimtalkResultCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const GetAlimtalkResult_js_1 = require("../protocols/GetAlimtalkResult.js");
6
6
  class GetAlimtalkResultCommand extends index_js_1.SensCommand {
7
+ input;
8
+ serializer;
9
+ deserializer;
7
10
  constructor(input) {
8
11
  super(input);
9
12
  this.input = {
@@ -5,9 +5,16 @@ const index_js_1 = require("../models/index.js");
5
5
  const GetAlimtalkStatus_js_1 = require("../protocols/GetAlimtalkStatus.js");
6
6
  const MAX_LIMIT = 100;
7
7
  class GetAlimtalkStatusCommand extends index_js_1.SensCommand {
8
+ input;
9
+ serializer;
10
+ deserializer;
8
11
  constructor(input) {
9
12
  super(input);
10
- this.input = Object.assign({ requestId: input.requestId, pageSize: input.pageSize ? Math.min(MAX_LIMIT, Math.max(1, input.pageSize)) : MAX_LIMIT }, (input.nextToken && { nextToken: input.nextToken }));
13
+ this.input = {
14
+ requestId: input.requestId,
15
+ pageSize: input.pageSize ? Math.min(MAX_LIMIT, Math.max(1, input.pageSize)) : MAX_LIMIT,
16
+ ...(input.nextToken && { nextToken: input.nextToken }),
17
+ };
11
18
  this.serializer = GetAlimtalkStatus_js_1.se_GetAlimtalkStatusCommand;
12
19
  this.deserializer = GetAlimtalkStatus_js_1.de_GetAlimtalkStatusCommand;
13
20
  }
@@ -4,6 +4,9 @@ exports.GetAlimtalkTemplateCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const GetAlimtalkTemplate_js_1 = require("../protocols/GetAlimtalkTemplate.js");
6
6
  class GetAlimtalkTemplateCommand extends index_js_1.SensCommand {
7
+ input;
8
+ serializer;
9
+ deserializer;
7
10
  constructor(input) {
8
11
  super(input);
9
12
  this.input = {
@@ -4,6 +4,9 @@ exports.GetSMSResultCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const GetSMSResult_js_1 = require("../protocols/GetSMSResult.js");
6
6
  class GetSMSResultCommand extends index_js_1.SensCommand {
7
+ input;
8
+ serializer;
9
+ deserializer;
7
10
  constructor(input) {
8
11
  super(input);
9
12
  this.input = {
@@ -5,9 +5,16 @@ const index_js_1 = require("../models/index.js");
5
5
  const GetSMSStatus_js_1 = require("../protocols/GetSMSStatus.js");
6
6
  const MAX_LIMIT = 100;
7
7
  class GetSMSStatusCommand extends index_js_1.SensCommand {
8
+ input;
9
+ serializer;
10
+ deserializer;
8
11
  constructor(input) {
9
12
  super(input);
10
- this.input = Object.assign({ requestId: input.requestId, pageSize: input.pageSize ? Math.min(MAX_LIMIT, Math.max(1, input.pageSize)) : MAX_LIMIT }, (input.nextToken && { nextToken: input.nextToken }));
13
+ this.input = {
14
+ requestId: input.requestId,
15
+ pageSize: input.pageSize ? Math.min(MAX_LIMIT, Math.max(1, input.pageSize)) : MAX_LIMIT,
16
+ ...(input.nextToken && { nextToken: input.nextToken }),
17
+ };
11
18
  this.serializer = GetSMSStatus_js_1.se_GetSMSStatusCommand;
12
19
  this.deserializer = GetSMSStatus_js_1.de_GetSMSStatusCommand;
13
20
  }
@@ -4,6 +4,9 @@ exports.ListAlimtalkChannelsCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const ListAlimtalkChannels_js_1 = require("../protocols/ListAlimtalkChannels.js");
6
6
  class ListAlimtalkChannelsCommand extends index_js_1.SensCommand {
7
+ input;
8
+ serializer;
9
+ deserializer;
7
10
  constructor(input) {
8
11
  super(input);
9
12
  this.input = {};
@@ -4,12 +4,14 @@ exports.ListAlimtalkStatusCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const ListAlimtalkStatus_js_1 = require("../protocols/ListAlimtalkStatus.js");
6
6
  const constants_js_1 = require("./constants.js");
7
- const DURATION_LIMIT_MS = 30 * 24 * 3600000; // 30일 이내만 조회 가능
7
+ const DURATION_LIMIT_MS = 30 * 24 * 3_600_000; // 30일 이내만 조회 가능
8
8
  const MAX_LIMIT = 100;
9
9
  const DEFAULT_LIMIT = 20;
10
10
  class ListAlimtalkStatusCommand extends index_js_1.SensCommand {
11
+ input;
12
+ serializer;
13
+ deserializer;
11
14
  constructor(input) {
12
- var _a;
13
15
  super(input);
14
16
  if (input.nextToken && (!input.requestStartTime || !input.requestEndTime)) {
15
17
  throw new index_js_1.SensError({
@@ -27,7 +29,19 @@ class ListAlimtalkStatusCommand extends index_js_1.SensCommand {
27
29
  startTime: input.requestStartTime ? (0, constants_js_1.convertToUtc)(input.requestStartTime) : defaultDuration.startTime,
28
30
  endTime: input.requestEndTime ? (0, constants_js_1.convertToUtc)(input.requestEndTime) : defaultDuration.endTime,
29
31
  }, { durationLimitMs: DURATION_LIMIT_MS });
30
- this.input = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ plusFriendId: input.plusFriendId, requestStartTime: (0, constants_js_1.convertToKst)(startTimeMs), requestEndTime: (0, constants_js_1.convertToKst)(endTimeMs), pageSize: Math.min(MAX_LIMIT, Math.max(1, (_a = input.pageSize) !== null && _a !== void 0 ? _a : DEFAULT_LIMIT)) }, (input.requestStatusName && { requestStatusName: input.requestStatusName })), (input.messageStatusName && { messageStatusName: input.messageStatusName })), (input.requestId && { requestId: input.requestId, pageSize: MAX_LIMIT })), (input.messageId && { messageId: input.messageId })), (input.templateCode && { templateCode: input.templateCode })), (input.to && { to: (0, constants_js_1.prettyPhoneNum)(input.to) })), (input.nextToken && { nextToken: input.nextToken }));
32
+ this.input = {
33
+ plusFriendId: input.plusFriendId,
34
+ requestStartTime: (0, constants_js_1.convertToKst)(startTimeMs),
35
+ requestEndTime: (0, constants_js_1.convertToKst)(endTimeMs),
36
+ pageSize: Math.min(MAX_LIMIT, Math.max(1, input.pageSize ?? DEFAULT_LIMIT)),
37
+ ...(input.requestStatusName && { requestStatusName: input.requestStatusName }),
38
+ ...(input.messageStatusName && { messageStatusName: input.messageStatusName }),
39
+ ...(input.requestId && { requestId: input.requestId, pageSize: MAX_LIMIT }),
40
+ ...(input.messageId && { messageId: input.messageId }),
41
+ ...(input.templateCode && { templateCode: input.templateCode }),
42
+ ...(input.to && { to: (0, constants_js_1.prettyPhoneNum)(input.to) }),
43
+ ...(input.nextToken && { nextToken: input.nextToken }),
44
+ };
31
45
  this.serializer = ListAlimtalkStatus_js_1.se_ListAlimtalkStatusCommand;
32
46
  this.deserializer = ListAlimtalkStatus_js_1.de_ListAlimtalkStatusCommand;
33
47
  }
@@ -4,6 +4,9 @@ exports.ListAlimtalkTemplatesCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const ListAlimtalkTemplates_js_1 = require("../protocols/ListAlimtalkTemplates.js");
6
6
  class ListAlimtalkTemplatesCommand extends index_js_1.SensCommand {
7
+ input;
8
+ serializer;
9
+ deserializer;
7
10
  constructor(input) {
8
11
  super(input);
9
12
  this.input = {
@@ -4,12 +4,14 @@ exports.ListSMSStatusCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const ListSMSStatus_js_1 = require("../protocols/ListSMSStatus.js");
6
6
  const constants_js_1 = require("./constants.js");
7
- const DURATION_LIMIT_MS = 30 * 24 * 3600000; // 30일 이내만 조회 가능
7
+ const DURATION_LIMIT_MS = 30 * 24 * 3_600_000; // 30일 이내만 조회 가능
8
8
  const MAX_LIMIT = 100;
9
9
  const DEFAULT_LIMIT = 20;
10
10
  class ListSMSStatusCommand extends index_js_1.SensCommand {
11
+ input;
12
+ serializer;
13
+ deserializer;
11
14
  constructor(input) {
12
- var _a;
13
15
  super(input);
14
16
  if (input.nextToken && (!input.requestStartTime || !input.requestEndTime)) {
15
17
  throw new index_js_1.SensError({
@@ -27,7 +29,18 @@ class ListSMSStatusCommand extends index_js_1.SensCommand {
27
29
  startTime: input.requestStartTime ? (0, constants_js_1.convertToUtc)(input.requestStartTime) : defaultDuration.startTime,
28
30
  endTime: input.requestEndTime ? (0, constants_js_1.convertToUtc)(input.requestEndTime) : defaultDuration.endTime,
29
31
  }, { durationLimitMs: DURATION_LIMIT_MS });
30
- this.input = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ requestStartTime: (0, constants_js_1.convertToKst)(startTimeMs), requestEndTime: (0, constants_js_1.convertToKst)(endTimeMs), pageSize: Math.min(MAX_LIMIT, Math.max(1, (_a = input.pageSize) !== null && _a !== void 0 ? _a : DEFAULT_LIMIT)) }, (input.type && { type: input.type })), (input.contentType && { contentType: input.contentType })), (input.status && { status: input.status })), (input.from && { from: (0, constants_js_1.prettyPhoneNum)(input.from) })), (input.to && { to: (0, constants_js_1.prettyPhoneNum)(input.to) })), (input.statusName && { statusName: input.statusName })), (input.nextToken && { nextToken: input.nextToken }));
32
+ this.input = {
33
+ requestStartTime: (0, constants_js_1.convertToKst)(startTimeMs),
34
+ requestEndTime: (0, constants_js_1.convertToKst)(endTimeMs),
35
+ pageSize: Math.min(MAX_LIMIT, Math.max(1, input.pageSize ?? DEFAULT_LIMIT)),
36
+ ...(input.type && { type: input.type }),
37
+ ...(input.contentType && { contentType: input.contentType }),
38
+ ...(input.status && { status: input.status }),
39
+ ...(input.from && { from: (0, constants_js_1.prettyPhoneNum)(input.from) }),
40
+ ...(input.to && { to: (0, constants_js_1.prettyPhoneNum)(input.to) }),
41
+ ...(input.statusName && { statusName: input.statusName }),
42
+ ...(input.nextToken && { nextToken: input.nextToken }),
43
+ };
31
44
  this.serializer = ListSMSStatus_js_1.se_ListSMSStatusCommand;
32
45
  this.deserializer = ListSMSStatus_js_1.de_ListSMSStatusCommand;
33
46
  }
@@ -4,6 +4,9 @@ exports.SendAlimtalkCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const SendAlimtalk_js_1 = require("../protocols/SendAlimtalk.js");
6
6
  class SendAlimtalkCommand extends index_js_1.SensCommand {
7
+ input;
8
+ serializer;
9
+ deserializer;
7
10
  constructor(input) {
8
11
  super(input);
9
12
  this.input = {
@@ -35,7 +38,12 @@ const resolveAlimtalkMessages = (messages, config) => {
35
38
  message: `알림톡 최대 길이는 ${config.maxContentLength}글자입니다`,
36
39
  });
37
40
  }
38
- return Object.assign({ to: message.to.replace(/\-/gi, ""), content: message.content, useSmsFailover: message.useSmsFailover != undefined ? message.useSmsFailover : false }, (message.buttons && message.buttons.length && { buttons: message.buttons }));
41
+ return {
42
+ to: message.to.replace(/\-/gi, ""),
43
+ content: message.content,
44
+ useSmsFailover: message.useSmsFailover != undefined ? message.useSmsFailover : false,
45
+ ...(message.buttons && message.buttons.length && { buttons: message.buttons }),
46
+ };
39
47
  });
40
48
  return result;
41
49
  };
@@ -6,16 +6,19 @@ const node_crypto_1 = require("node:crypto");
6
6
  const node_fs_1 = require("node:fs");
7
7
  const index_js_1 = require("../models/index.js");
8
8
  const SendMMS_js_1 = require("../protocols/SendMMS.js");
9
- const constants_1 = require("./constants");
9
+ const constants_js_1 = require("./constants.js");
10
10
  const SendSMSCommand_js_1 = require("./SendSMSCommand.js");
11
11
  class SendMMSCommand extends index_js_1.SensCommand {
12
+ input;
13
+ serializer;
14
+ deserializer;
12
15
  constructor(input) {
13
16
  super(input);
14
- const content = input.content ? (0, constants_1.trimText)(input.content) : "내용없음";
15
- const subject = input.subject ? (0, constants_1.trimText)(input.subject) : "제목없음";
17
+ const content = input.content ? (0, constants_js_1.trimText)(input.content) : "내용없음";
18
+ const subject = input.subject ? (0, constants_js_1.trimText)(input.subject) : "제목없음";
16
19
  const messages = (0, SendSMSCommand_js_1.resolveInputMessages)(input.messages, { defaultContent: content, defaultSubject: subject });
17
20
  this.input = {
18
- from: (0, constants_1.prettyPhoneNum)(input.from),
21
+ from: (0, constants_js_1.prettyPhoneNum)(input.from),
19
22
  content,
20
23
  messages,
21
24
  type: "MMS",
@@ -3,16 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveInputMessages = exports.SendSMSCommand = void 0;
4
4
  const index_js_1 = require("../models/index.js");
5
5
  const SendSMS_js_1 = require("../protocols/SendSMS.js");
6
- const constants_1 = require("./constants");
6
+ const constants_js_1 = require("./constants.js");
7
7
  class SendSMSCommand extends index_js_1.SensCommand {
8
+ input;
9
+ serializer;
10
+ deserializer;
8
11
  constructor(input) {
9
12
  super(input);
10
- const content = input.content ? (0, constants_1.trimText)(input.content) : "내용없음";
11
- const subject = input.subject ? (0, constants_1.trimText)(input.subject) : "제목없음";
13
+ const content = input.content ? (0, constants_js_1.trimText)(input.content) : "내용없음";
14
+ const subject = input.subject ? (0, constants_js_1.trimText)(input.subject) : "제목없음";
12
15
  const messages = (0, exports.resolveInputMessages)(input.messages, { defaultContent: content, defaultSubject: subject });
13
16
  const isLMS = !!messages.filter((msg) => !!msg.subject).length;
14
- this.input = Object.assign({ from: (0, constants_1.prettyPhoneNum)(input.from), content,
15
- messages, type: isLMS ? "LMS" : "SMS", contentType: input.contentType ? input.contentType : "COMM", countryCode: input.countryCode ? input.countryCode : "82" }, (isLMS && { subject }));
17
+ this.input = {
18
+ from: (0, constants_js_1.prettyPhoneNum)(input.from),
19
+ content,
20
+ messages,
21
+ type: isLMS ? "LMS" : "SMS",
22
+ contentType: input.contentType ? input.contentType : "COMM",
23
+ countryCode: input.countryCode ? input.countryCode : "82",
24
+ ...(isLMS && { subject }),
25
+ };
16
26
  this.serializer = SendSMS_js_1.se_SendSMSCommand;
17
27
  this.deserializer = SendSMS_js_1.de_SendSMSCommand;
18
28
  }
@@ -22,10 +32,14 @@ const resolveInputMessages = (messages, config) => {
22
32
  const output = messages
23
33
  .filter((d) => !!d)
24
34
  .map((message) => {
25
- const content = message.content ? (0, constants_1.trimText)(message.content) : config.defaultContent;
26
- const subject = message.subject ? (0, constants_1.trimText)(message.subject) : config.defaultSubject;
35
+ const content = message.content ? (0, constants_js_1.trimText)(message.content) : config.defaultContent;
36
+ const subject = message.subject ? (0, constants_js_1.trimText)(message.subject) : config.defaultSubject;
27
37
  const msgType = getMessageType({ content });
28
- return Object.assign({ to: (0, constants_1.prettyPhoneNum)(message.to), content }, (msgType === "LMS" && { subject }));
38
+ return {
39
+ to: (0, constants_js_1.prettyPhoneNum)(message.to),
40
+ content,
41
+ ...(msgType === "LMS" && { subject }),
42
+ };
29
43
  });
30
44
  return output;
31
45
  };
@@ -33,7 +47,7 @@ exports.resolveInputMessages = resolveInputMessages;
33
47
  const getMessageType = (input) => {
34
48
  const SMS_MAX_CONTENT_LENGTH = 90;
35
49
  const LMS_MAX_CONTENT_LENGTH = 2000;
36
- const contentLength = (0, constants_1.getContentLength)(input.content);
50
+ const contentLength = (0, constants_js_1.getContentLength)(input.content);
37
51
  if (!contentLength) {
38
52
  throw new index_js_1.SensError({
39
53
  code: -1,
@@ -22,7 +22,7 @@ const convertToUtc = (input) => {
22
22
  };
23
23
  exports.convertToUtc = convertToUtc;
24
24
  const convertToKst = (input) => {
25
- const KST_OFFSET = 9 * 3600000;
25
+ const KST_OFFSET = 9 * 3_600_000;
26
26
  return new Date(input + KST_OFFSET).toISOString().replace(/\.\d{3}Z$/, "");
27
27
  };
28
28
  exports.convertToKst = convertToKst;
@@ -52,7 +52,7 @@ const resolveRequestDuration = (input, config) => {
52
52
  throw new index_js_1.SensError({
53
53
  code: -1,
54
54
  type: "SDK.GENERAL_ERROR",
55
- message: `최대 ${config.durationLimitMs / (24 * 3600000)}일 이내에서 조회 가능합니다.`,
55
+ message: `최대 ${config.durationLimitMs / (24 * 3_600_000)}일 이내에서 조회 가능합니다.`,
56
56
  });
57
57
  }
58
58
  return {
package/dist-cjs/index.js CHANGED
@@ -16,4 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./commands/index.js"), exports);
18
18
  __exportStar(require("./SensClient.js"), exports);
19
- __exportStar(require("./models/SensError.js"), exports);
19
+ __exportStar(require("./models/SensClientError.js"), exports);