@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
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NCP_SIGNATURE = exports.NCP_TIMESTAMP = exports.NCP_ACCESS_KEY = exports.INGESTKOREA_RETRY_DELAY = exports.INGESTKOREA_RETRY = exports.INGESTKOREA_REQUEST_LOG = exports.INGESTKOREA_USER_AGENT = void 0;
3
+ exports.NCP_TRACE_ID = exports.NCP_SIGNATURE = exports.NCP_TIMESTAMP = exports.NCP_ACCESS_KEY = exports.INGESTKOREA_RETRY_DELAY = exports.INGESTKOREA_RETRY = exports.INGESTKOREA_REQUEST_LOG = exports.INGESTKOREA_USER_AGENT = void 0;
4
4
  exports.INGESTKOREA_USER_AGENT = "x-ingestkorea-user-agent";
5
5
  exports.INGESTKOREA_REQUEST_LOG = "x-ingestkorea-request";
6
6
  exports.INGESTKOREA_RETRY = "x-ingestkorea-attempts";
@@ -8,3 +8,4 @@ exports.INGESTKOREA_RETRY_DELAY = "x-ingestkorea-total-retry-delay";
8
8
  exports.NCP_ACCESS_KEY = "x-ncp-iam-access-key";
9
9
  exports.NCP_TIMESTAMP = "x-ncp-apigw-timestamp";
10
10
  exports.NCP_SIGNATURE = "x-ncp-apigw-signature-v2";
11
+ exports.NCP_TRACE_ID = "x-ncp-trace-id";
@@ -1,18 +1,13 @@
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.middlewareIngestkoreaMetadata = void 0;
13
4
  const constants_js_1 = require("./constants.js");
14
- const middlewareIngestkoreaMetadata = (next) => (input, context) => __awaiter(void 0, void 0, void 0, function* () {
15
- input.request.headers = Object.assign(Object.assign({}, input.request.headers), { [constants_js_1.INGESTKOREA_USER_AGENT]: "@ingestkorea/client-sens/1.10.x" });
5
+ const middlewareIngestkoreaMetadata = (next) => async (input, context) => {
6
+ input.request.headers = {
7
+ ...input.request.headers,
8
+ [constants_js_1.INGESTKOREA_USER_AGENT]: "@ingestkorea/client-sens/1.11.x",
9
+ connection: context.httpHandler.keepAlive ? "keep-alive" : "close", // temp
10
+ };
16
11
  return next(input, context);
17
- });
12
+ };
18
13
  exports.middlewareIngestkoreaMetadata = middlewareIngestkoreaMetadata;
@@ -1,50 +1,67 @@
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.middlewareRetry = void 0;
4
+ const util_http_handler_1 = require("@ingestkorea/util-http-handler");
13
5
  const index_js_1 = require("../models/index.js");
14
6
  const constants_js_1 = require("./constants.js");
15
- const middlewareRetry = (next) => (input, context) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const RETRYABLE_ERROR_TYPE = [
8
+ "SDK.TIMEOUT",
9
+ "SDK.NETWORK_ERROR",
10
+ "Too Many Requests",
11
+ "Internal Server Error",
12
+ ];
13
+ const middlewareRetry = (next) => async (input, context) => {
16
14
  const MAX_RETRIES = 3;
17
15
  const MIN_DELAY_MS = 300;
18
16
  const BASE_DELAY_MS = 500;
19
- const MAX_DELAY_MS = 5000;
17
+ const MAX_DELAY_MS = 5_000;
20
18
  let attempts = 0;
21
19
  let totalRetryDelay = 0;
22
- input.request.headers = Object.assign({}, input.request.headers);
20
+ input.request.headers = input.request.headers ?? {};
23
21
  while (attempts < MAX_RETRIES) {
24
22
  attempts++;
25
23
  const requestLog = `attempt=${attempts}; max=${MAX_RETRIES}; totalRetryDelay=${totalRetryDelay}`;
26
24
  input.request.headers[constants_js_1.INGESTKOREA_REQUEST_LOG] = requestLog;
27
25
  try {
28
- const { response } = yield next(input, context);
26
+ const { response } = await next(input, context);
29
27
  response.headers[constants_js_1.INGESTKOREA_RETRY] = attempts.toString();
30
28
  response.headers[constants_js_1.INGESTKOREA_RETRY_DELAY] = totalRetryDelay.toString();
31
29
  return { response };
32
30
  }
33
31
  catch (error) {
34
- if (attempts >= MAX_RETRIES) {
35
- throw new index_js_1.SensError({
32
+ let currentError;
33
+ if (error instanceof index_js_1.SensError) {
34
+ currentError = error;
35
+ }
36
+ else if (error instanceof util_http_handler_1.HttpHandlerError) {
37
+ currentError = new index_js_1.SensError({
36
38
  code: -1,
37
- type: "SDK.REQUEST_ERROR",
38
- message: error instanceof Error ? error.message : requestLog,
39
+ type: error.code,
40
+ message: error.message,
39
41
  });
40
42
  }
41
- const exp = BASE_DELAY_MS * Math.pow(2, (attempts - 1));
43
+ else {
44
+ currentError = new index_js_1.SensError({
45
+ code: -1,
46
+ type: "SDK.UNKNOWN_ERROR",
47
+ message: error instanceof Error ? error.message : String(error),
48
+ });
49
+ }
50
+ const isRetryable = RETRYABLE_ERROR_TYPE.some((type) => currentError.type.startsWith(type));
51
+ if (!isRetryable) {
52
+ throw currentError;
53
+ }
54
+ if (attempts >= MAX_RETRIES) {
55
+ currentError.errors.push(requestLog);
56
+ throw currentError;
57
+ }
58
+ const exp = BASE_DELAY_MS * 2 ** (attempts - 1);
42
59
  const capped = Math.min(MAX_DELAY_MS, exp);
43
60
  const baseWait = Math.max(MIN_DELAY_MS, Math.floor(capped / 2));
44
61
  const jitter = Math.floor(Math.random() * (capped - baseWait));
45
62
  const delay = baseWait + jitter;
46
63
  totalRetryDelay += delay;
47
- yield new Promise((resolve) => setTimeout(resolve, delay));
64
+ await new Promise((resolve) => setTimeout(resolve, delay));
48
65
  }
49
66
  }
50
67
  throw new index_js_1.SensError({
@@ -52,5 +69,5 @@ const middlewareRetry = (next) => (input, context) => __awaiter(void 0, void 0,
52
69
  type: "SDK.UNKNOWN_ERROR",
53
70
  message: "Unexpected retry loop termination",
54
71
  });
55
- });
72
+ };
56
73
  exports.middlewareRetry = middlewareRetry;
@@ -1,19 +1,10 @@
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.middlewareNcpSign = void 0;
13
4
  const crypto_1 = require("crypto");
14
5
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
15
6
  const constants_js_1 = require("./constants.js");
16
- const middlewareNcpSign = (next) => (input, context) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const middlewareNcpSign = (next) => async (input, context) => {
17
8
  const { accessKey, secretKey } = context.credentials;
18
9
  const method = input.request.method;
19
10
  const queryString = (0, util_http_handler_1.buildQueryString)(input.request.query);
@@ -23,7 +14,12 @@ const middlewareNcpSign = (next) => (input, context) => __awaiter(void 0, void 0
23
14
  const timestamp = new Date().getTime().toString();
24
15
  const stringToSign = [method + space + path, timestamp, accessKey].join(newLine);
25
16
  const signature = (0, crypto_1.createHmac)("sha256", secretKey).update(stringToSign).digest("base64");
26
- input.request.headers = Object.assign(Object.assign({}, input.request.headers), { [constants_js_1.NCP_ACCESS_KEY]: accessKey, [constants_js_1.NCP_TIMESTAMP]: timestamp, [constants_js_1.NCP_SIGNATURE]: signature });
17
+ input.request.headers = {
18
+ ...input.request.headers,
19
+ [constants_js_1.NCP_ACCESS_KEY]: accessKey,
20
+ [constants_js_1.NCP_TIMESTAMP]: timestamp,
21
+ [constants_js_1.NCP_SIGNATURE]: signature,
22
+ };
27
23
  return next(input, context);
28
- });
24
+ };
29
25
  exports.middlewareNcpSign = middlewareNcpSign;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NCLOUD_ERROR_BODY_SPEC = exports.SENS_ERROR_BODY_SPEC = exports.NCLOUD_ERROR_CODE_SPEC = exports.SENS_ERROR_CODE_SPEC = void 0;
3
+ exports.NCLOUD_ERROR_CODE_SPEC = exports.SENS_ERROR_CODE_SPEC = void 0;
4
4
  exports.SENS_ERROR_CODE_SPEC = {
5
5
  400: "Bad Request",
6
6
  401: "Unauthorized",
@@ -19,13 +19,3 @@ exports.NCLOUD_ERROR_CODE_SPEC = {
19
19
  "420": { status: 429, type: exports.SENS_ERROR_CODE_SPEC["429"] },
20
20
  "900": { status: 500, type: exports.SENS_ERROR_CODE_SPEC["500"] },
21
21
  };
22
- exports.SENS_ERROR_BODY_SPEC = [
23
- ["status", "number", true],
24
- ["errorMessage", "string", false],
25
- ["errors", "object", false],
26
- ];
27
- exports.NCLOUD_ERROR_BODY_SPEC = [
28
- ["errorCode", "string", true],
29
- ["message", "string", false],
30
- ["details", "string", false],
31
- ];
@@ -2,6 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SensError = void 0;
4
4
  class SensError extends Error {
5
+ code;
6
+ type;
7
+ errors;
8
+ timestamp;
5
9
  constructor(info) {
6
10
  super(info.message);
7
11
  this.name = "SensError";
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SensCommand = void 0;
4
4
  class SensCommand {
5
+ input;
5
6
  constructor(input) {
6
7
  this.input = input;
7
8
  }
@@ -27,8 +27,8 @@ __exportStar(require("./MetadataBearer.js"), exports);
27
27
  __exportStar(require("./SendAlimtalk.js"), exports);
28
28
  __exportStar(require("./SendMMS.js"), exports);
29
29
  __exportStar(require("./SendSMS.js"), exports);
30
+ __exportStar(require("./SensApiError.js"), exports);
30
31
  __exportStar(require("./SensClient.js"), exports);
32
+ __exportStar(require("./SensClientError.js"), exports);
31
33
  __exportStar(require("./SensCommand.js"), exports);
32
- __exportStar(require("./SensError.js"), exports);
33
- __exportStar(require("./SensErrorInfo.js"), exports);
34
34
  __exportStar(require("./SensMiddleware.js"), exports);
@@ -1,19 +1,10 @@
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.de_GetAlimtalkResultCommand = exports.se_GetAlimtalkResultCommand = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const constants_js_1 = require("./constants.js");
15
6
  const GetAlimtalkStatus_js_1 = require("./GetAlimtalkStatus.js");
16
- const se_GetAlimtalkResultCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const se_GetAlimtalkResultCommand = async (input, config) => {
17
8
  const hostname = "sens.apigw.ntruss.com";
18
9
  const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages/" + input.messageId;
19
10
  const headers = {
@@ -26,18 +17,24 @@ const se_GetAlimtalkResultCommand = (input, config) => __awaiter(void 0, void 0,
26
17
  path,
27
18
  headers,
28
19
  });
29
- });
20
+ };
30
21
  exports.se_GetAlimtalkResultCommand = se_GetAlimtalkResultCommand;
31
- const de_GetAlimtalkResultCommand = (response, config) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const de_GetAlimtalkResultCommand = async (response, config) => {
32
23
  if (response.statusCode >= 300)
33
- yield (0, constants_js_1.parseErrorBody)(response);
34
- const data = yield (0, constants_js_1.parseBody)(response);
24
+ await (0, constants_js_1.parseErrorBody)(response);
25
+ const data = await (0, constants_js_1.parseBody)(response);
35
26
  const contents = de_GetAlimtalkResultResult(data);
36
- return Object.assign({ $metadata: (0, constants_js_1.deserializeMetadata)(response) }, (0, constants_js_1.compact)(contents));
37
- });
27
+ return {
28
+ $metadata: (0, constants_js_1.deserializeMetadata)(response),
29
+ ...(0, constants_js_1.compact)(contents),
30
+ };
31
+ };
38
32
  exports.de_GetAlimtalkResultCommand = de_GetAlimtalkResultCommand;
39
33
  const de_GetAlimtalkResultResult = (output) => {
40
- return Object.assign(Object.assign({}, (0, GetAlimtalkStatus_js_1.de_AlimtalkMessageStatus)(output)), { failover: output.failover ? de_Failover(output.failover) : undefined });
34
+ return {
35
+ ...(0, GetAlimtalkStatus_js_1.de_AlimtalkMessageStatus)(output),
36
+ failover: output.failover ? de_Failover(output.failover) : undefined,
37
+ };
41
38
  };
42
39
  const de_Failover = (output) => {
43
40
  return {
@@ -1,19 +1,10 @@
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.de_AlimtalkMessageStatus = exports.de_GetAlimtalkStatusResult = exports.de_GetAlimtalkStatusCommand = exports.se_GetAlimtalkStatusCommand = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const constants_js_1 = require("./constants.js");
15
6
  const SendAlimtalk_js_1 = require("./SendAlimtalk.js");
16
- const se_GetAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const se_GetAlimtalkStatusCommand = async (input, config) => {
17
8
  const hostname = "sens.apigw.ntruss.com";
18
9
  const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
19
10
  const headers = {
@@ -33,15 +24,18 @@ const se_GetAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0,
33
24
  headers,
34
25
  query,
35
26
  });
36
- });
27
+ };
37
28
  exports.se_GetAlimtalkStatusCommand = se_GetAlimtalkStatusCommand;
38
- const de_GetAlimtalkStatusCommand = (response, config) => __awaiter(void 0, void 0, void 0, function* () {
29
+ const de_GetAlimtalkStatusCommand = async (response, config) => {
39
30
  if (response.statusCode >= 300)
40
- yield (0, constants_js_1.parseErrorBody)(response);
41
- const data = yield (0, constants_js_1.parseBody)(response);
31
+ await (0, constants_js_1.parseErrorBody)(response);
32
+ const data = await (0, constants_js_1.parseBody)(response);
42
33
  const contents = (0, exports.de_GetAlimtalkStatusResult)(data);
43
- return Object.assign({ $metadata: (0, constants_js_1.deserializeMetadata)(response) }, (0, constants_js_1.compact)(contents));
44
- });
34
+ return {
35
+ $metadata: (0, constants_js_1.deserializeMetadata)(response),
36
+ ...(0, constants_js_1.compact)(contents),
37
+ };
38
+ };
45
39
  exports.de_GetAlimtalkStatusCommand = de_GetAlimtalkStatusCommand;
46
40
  const de_GetAlimtalkStatusResult = (output) => {
47
41
  return {
@@ -61,6 +55,16 @@ const de_AlimtalkMessageStatusList = (output) => {
61
55
  return (output || []).filter((e) => e != null).map((entry) => (0, exports.de_AlimtalkMessageStatus)(entry));
62
56
  };
63
57
  const de_AlimtalkMessageStatus = (output) => {
64
- return Object.assign(Object.assign({}, (0, SendAlimtalk_js_1.de_AlimtalkMessageRequestStatus)(output)), { requestId: output.requestId ? output.requestId : undefined, requestTime: output.requestTime ? (0, constants_js_1.convertToUtc)(output.requestTime) : undefined, plusFriendId: output.plusFriendId ? output.plusFriendId : undefined, templateCode: output.templateCode ? output.templateCode : undefined, completeTime: output.completeTime ? (0, constants_js_1.convertToUtc)(output.completeTime) : undefined, messageStatusCode: output.messageStatusCode ? output.messageStatusCode : undefined, messageStatusName: output.messageStatusName ? output.messageStatusName : undefined, messageStatusDesc: output.messageStatusDesc ? output.messageStatusDesc : undefined });
58
+ return {
59
+ ...(0, SendAlimtalk_js_1.de_AlimtalkMessageRequestStatus)(output),
60
+ requestId: output.requestId ? output.requestId : undefined,
61
+ requestTime: output.requestTime ? (0, constants_js_1.convertToUtc)(output.requestTime) : undefined,
62
+ plusFriendId: output.plusFriendId ? output.plusFriendId : undefined,
63
+ templateCode: output.templateCode ? output.templateCode : undefined,
64
+ completeTime: output.completeTime ? (0, constants_js_1.convertToUtc)(output.completeTime) : undefined,
65
+ messageStatusCode: output.messageStatusCode ? output.messageStatusCode : undefined,
66
+ messageStatusName: output.messageStatusName ? output.messageStatusName : undefined,
67
+ messageStatusDesc: output.messageStatusDesc ? output.messageStatusDesc : undefined,
68
+ };
65
69
  };
66
70
  exports.de_AlimtalkMessageStatus = de_AlimtalkMessageStatus;
@@ -1,19 +1,10 @@
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.de_GetAlimtalkTemplateCommand = exports.se_GetAlimtalkTemplateCommand = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const constants_js_1 = require("./constants.js");
15
6
  const ListAlimtalkTemplates_js_1 = require("./ListAlimtalkTemplates.js");
16
- const se_GetAlimtalkTemplateCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const se_GetAlimtalkTemplateCommand = async (input, config) => {
17
8
  const hostname = "sens.apigw.ntruss.com";
18
9
  const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/templates";
19
10
  const headers = {
@@ -31,15 +22,18 @@ const se_GetAlimtalkTemplateCommand = (input, config) => __awaiter(void 0, void
31
22
  query,
32
23
  headers,
33
24
  });
34
- });
25
+ };
35
26
  exports.se_GetAlimtalkTemplateCommand = se_GetAlimtalkTemplateCommand;
36
- const de_GetAlimtalkTemplateCommand = (response, config) => __awaiter(void 0, void 0, void 0, function* () {
27
+ const de_GetAlimtalkTemplateCommand = async (response, config) => {
37
28
  if (response.statusCode >= 300)
38
- yield (0, constants_js_1.parseErrorBody)(response);
39
- const data = yield (0, constants_js_1.parseBody)(response);
29
+ await (0, constants_js_1.parseErrorBody)(response);
30
+ const data = await (0, constants_js_1.parseBody)(response);
40
31
  const contents = de_GetAlimtalkTemplateResult(data);
41
- return Object.assign({ $metadata: (0, constants_js_1.deserializeMetadata)(response) }, (0, constants_js_1.compact)(contents));
42
- });
32
+ return {
33
+ $metadata: (0, constants_js_1.deserializeMetadata)(response),
34
+ ...(0, constants_js_1.compact)(contents),
35
+ };
36
+ };
43
37
  exports.de_GetAlimtalkTemplateCommand = de_GetAlimtalkTemplateCommand;
44
38
  const de_GetAlimtalkTemplateResult = (output) => {
45
39
  return {
@@ -50,7 +44,25 @@ const de_TemplateDetailList = (output) => {
50
44
  return (output || []).filter((e) => e != null).map((entry) => de_TemplateDetail(entry));
51
45
  };
52
46
  const de_TemplateDetail = (output) => {
53
- return Object.assign(Object.assign({}, (0, ListAlimtalkTemplates_js_1.de_Template)(output)), { categoryCode: output.categoryCode != undefined ? output.categoryCode : undefined, categoryName: output.categoryName != undefined ? output.categoryName : undefined, messageType: output.messageType != undefined ? output.messageType : undefined, emphasizeType: output.emphasizeType != undefined ? output.emphasizeType : undefined, content: output.content != undefined ? output.content : undefined, adContent: output.adContent != undefined ? output.adContent : undefined, extraContent: output.extraContent != undefined ? output.extraContent : undefined, title: output.title != undefined ? output.title : undefined, additionalTitle: output.additionalTitle != undefined ? output.additionalTitle : undefined, comments: output.comments != undefined ? de_CommentList(output.comments) : [], templateInspectionStatus: output.templateInspectionStatus != undefined ? output.templateInspectionStatus : undefined, templateStatus: output.templateStatus != undefined ? output.templateStatus : undefined, buttons: output.buttons != undefined ? de_TemplateButtonExtendList(output.buttons) : [], securityFlag: output.securityFlag !== undefined ? output.securityFlag : undefined, isBlock: output.isBlock !== undefined ? output.isBlock : undefined, isDormant: output.isDormant !== undefined ? output.isDormant : undefined });
47
+ return {
48
+ ...(0, ListAlimtalkTemplates_js_1.de_Template)(output),
49
+ categoryCode: output.categoryCode != undefined ? output.categoryCode : undefined,
50
+ categoryName: output.categoryName != undefined ? output.categoryName : undefined,
51
+ messageType: output.messageType != undefined ? output.messageType : undefined,
52
+ emphasizeType: output.emphasizeType != undefined ? output.emphasizeType : undefined,
53
+ content: output.content != undefined ? output.content : undefined,
54
+ adContent: output.adContent != undefined ? output.adContent : undefined,
55
+ extraContent: output.extraContent != undefined ? output.extraContent : undefined,
56
+ title: output.title != undefined ? output.title : undefined,
57
+ additionalTitle: output.additionalTitle != undefined ? output.additionalTitle : undefined,
58
+ comments: output.comments != undefined ? de_CommentList(output.comments) : [],
59
+ templateInspectionStatus: output.templateInspectionStatus != undefined ? output.templateInspectionStatus : undefined,
60
+ templateStatus: output.templateStatus != undefined ? output.templateStatus : undefined,
61
+ buttons: output.buttons != undefined ? de_TemplateButtonExtendList(output.buttons) : [],
62
+ securityFlag: output.securityFlag !== undefined ? output.securityFlag : undefined,
63
+ isBlock: output.isBlock !== undefined ? output.isBlock : undefined,
64
+ isDormant: output.isDormant !== undefined ? output.isDormant : undefined,
65
+ };
54
66
  };
55
67
  const de_CommentList = (output) => {
56
68
  return (output || []).filter((e) => e != null).map((entry) => de_Comment(entry));
@@ -1,19 +1,10 @@
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.de_GetSMSResultCommand = exports.se_GetSMSResultCommand = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const constants_js_1 = require("./constants.js");
15
6
  const GetSMSStatus_js_1 = require("./GetSMSStatus.js");
16
- const se_GetSMSResultCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const se_GetSMSResultCommand = async (input, config) => {
17
8
  const hostname = "sens.apigw.ntruss.com";
18
9
  const path = "/sms/v2/services/" + config.serviceId.sms + "/messages" + "/" + input.messageId;
19
10
  const headers = {
@@ -26,15 +17,18 @@ const se_GetSMSResultCommand = (input, config) => __awaiter(void 0, void 0, void
26
17
  path,
27
18
  headers,
28
19
  });
29
- });
20
+ };
30
21
  exports.se_GetSMSResultCommand = se_GetSMSResultCommand;
31
- const de_GetSMSResultCommand = (response, config) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const de_GetSMSResultCommand = async (response, config) => {
32
23
  if (response.statusCode >= 300)
33
- yield (0, constants_js_1.parseErrorBody)(response);
34
- const data = yield (0, constants_js_1.parseBody)(response);
24
+ await (0, constants_js_1.parseErrorBody)(response);
25
+ const data = await (0, constants_js_1.parseBody)(response);
35
26
  const contents = de_GetSMSResultResult(data);
36
- return Object.assign({ $metadata: (0, constants_js_1.deserializeMetadata)(response) }, (0, constants_js_1.compact)(contents));
37
- });
27
+ return {
28
+ $metadata: (0, constants_js_1.deserializeMetadata)(response),
29
+ ...(0, constants_js_1.compact)(contents),
30
+ };
31
+ };
38
32
  exports.de_GetSMSResultCommand = de_GetSMSResultCommand;
39
33
  const de_GetSMSResultResult = (output) => {
40
34
  return {
@@ -47,7 +41,12 @@ const de_SMSMessageStatusList = (output) => {
47
41
  return (output || []).filter((e) => e != null).map((entry) => de_SMSMessageStatus(entry));
48
42
  };
49
43
  const de_SMSMessageStatus = (output) => {
50
- return Object.assign(Object.assign({}, (0, GetSMSStatus_js_1.de_SMSMessageRequestStatus)(output)), { subject: output.subject ? output.subject : undefined, content: output.content ? output.content : undefined, files: output.files ? de_FileList(output.files) : [] });
44
+ return {
45
+ ...(0, GetSMSStatus_js_1.de_SMSMessageRequestStatus)(output),
46
+ subject: output.subject ? output.subject : undefined,
47
+ content: output.content ? output.content : undefined,
48
+ files: output.files ? de_FileList(output.files) : [],
49
+ };
51
50
  };
52
51
  const de_FileList = (output) => {
53
52
  return (output || []).filter((e) => e != null).map((entry) => de_File(entry));
@@ -1,18 +1,9 @@
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.de_SMSMessageRequestStatus = exports.de_GetSMSStatusResult = exports.de_GetSMSStatusCommand = exports.se_GetSMSStatusCommand = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const constants_js_1 = require("./constants.js");
15
- const se_GetSMSStatusCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
6
+ const se_GetSMSStatusCommand = async (input, config) => {
16
7
  const hostname = "sens.apigw.ntruss.com";
17
8
  const path = "/sms/v2/services/" + config.serviceId.sms + "/messages";
18
9
  const headers = {
@@ -32,15 +23,18 @@ const se_GetSMSStatusCommand = (input, config) => __awaiter(void 0, void 0, void
32
23
  query,
33
24
  headers,
34
25
  });
35
- });
26
+ };
36
27
  exports.se_GetSMSStatusCommand = se_GetSMSStatusCommand;
37
- const de_GetSMSStatusCommand = (response, config) => __awaiter(void 0, void 0, void 0, function* () {
28
+ const de_GetSMSStatusCommand = async (response, config) => {
38
29
  if (response.statusCode >= 300)
39
- yield (0, constants_js_1.parseErrorBody)(response);
40
- const data = yield (0, constants_js_1.parseBody)(response);
30
+ await (0, constants_js_1.parseErrorBody)(response);
31
+ const data = await (0, constants_js_1.parseBody)(response);
41
32
  const contents = (0, exports.de_GetSMSStatusResult)(data);
42
- return Object.assign({ $metadata: (0, constants_js_1.deserializeMetadata)(response) }, (0, constants_js_1.compact)(contents));
43
- });
33
+ return {
34
+ $metadata: (0, constants_js_1.deserializeMetadata)(response),
35
+ ...(0, constants_js_1.compact)(contents),
36
+ };
37
+ };
44
38
  exports.de_GetSMSStatusCommand = de_GetSMSStatusCommand;
45
39
  const de_GetSMSStatusResult = (output) => {
46
40
  return {
@@ -1,18 +1,9 @@
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.de_ListAlimtalkChannelsCommand = exports.se_ListAlimtalkChannelsCommand = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const constants_js_1 = require("./constants.js");
15
- const se_ListAlimtalkChannelsCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
6
+ const se_ListAlimtalkChannelsCommand = async (input, config) => {
16
7
  const hostname = "sens.apigw.ntruss.com";
17
8
  const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/channels";
18
9
  const headers = {
@@ -25,15 +16,18 @@ const se_ListAlimtalkChannelsCommand = (input, config) => __awaiter(void 0, void
25
16
  path: path,
26
17
  headers: headers,
27
18
  });
28
- });
19
+ };
29
20
  exports.se_ListAlimtalkChannelsCommand = se_ListAlimtalkChannelsCommand;
30
- const de_ListAlimtalkChannelsCommand = (response, config) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const de_ListAlimtalkChannelsCommand = async (response, config) => {
31
22
  if (response.statusCode >= 300)
32
- yield (0, constants_js_1.parseErrorBody)(response);
33
- const data = yield (0, constants_js_1.parseBody)(response);
23
+ await (0, constants_js_1.parseErrorBody)(response);
24
+ const data = await (0, constants_js_1.parseBody)(response);
34
25
  const contents = de_ListAlimtalkChannelsResult(data);
35
- return Object.assign({ $metadata: (0, constants_js_1.deserializeMetadata)(response) }, (0, constants_js_1.compact)(contents));
36
- });
26
+ return {
27
+ $metadata: (0, constants_js_1.deserializeMetadata)(response),
28
+ ...(0, constants_js_1.compact)(contents),
29
+ };
30
+ };
37
31
  exports.de_ListAlimtalkChannelsCommand = de_ListAlimtalkChannelsCommand;
38
32
  const de_ListAlimtalkChannelsResult = (output) => {
39
33
  return {
@@ -1,19 +1,10 @@
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.de_ListAlimtalkStatusCommand = exports.se_ListAlimtalkStatusCommand = void 0;
13
4
  const util_http_handler_1 = require("@ingestkorea/util-http-handler");
14
5
  const constants_js_1 = require("./constants.js");
15
6
  const GetAlimtalkStatus_js_1 = require("./GetAlimtalkStatus.js");
16
- const se_ListAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const se_ListAlimtalkStatusCommand = async (input, config) => {
17
8
  const hostname = "sens.apigw.ntruss.com";
18
9
  const path = "/alimtalk/v2/services/" + config.serviceId.kakao + "/messages";
19
10
  const headers = {
@@ -33,15 +24,18 @@ const se_ListAlimtalkStatusCommand = (input, config) => __awaiter(void 0, void 0
33
24
  headers: headers,
34
25
  query,
35
26
  });
36
- });
27
+ };
37
28
  exports.se_ListAlimtalkStatusCommand = se_ListAlimtalkStatusCommand;
38
- const de_ListAlimtalkStatusCommand = (response, config) => __awaiter(void 0, void 0, void 0, function* () {
29
+ const de_ListAlimtalkStatusCommand = async (response, config) => {
39
30
  if (response.statusCode >= 300)
40
- yield (0, constants_js_1.parseErrorBody)(response);
41
- const data = yield (0, constants_js_1.parseBody)(response);
31
+ await (0, constants_js_1.parseErrorBody)(response);
32
+ const data = await (0, constants_js_1.parseBody)(response);
42
33
  const contents = de_ListAlimtalkStatusResult(data);
43
- return Object.assign({ $metadata: (0, constants_js_1.deserializeMetadata)(response) }, (0, constants_js_1.compact)(contents));
44
- });
34
+ return {
35
+ $metadata: (0, constants_js_1.deserializeMetadata)(response),
36
+ ...(0, constants_js_1.compact)(contents),
37
+ };
38
+ };
45
39
  exports.de_ListAlimtalkStatusCommand = de_ListAlimtalkStatusCommand;
46
40
  const de_ListAlimtalkStatusResult = (output) => {
47
41
  return (0, GetAlimtalkStatus_js_1.de_GetAlimtalkStatusResult)(output);