@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,93 +1,102 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToUtc = exports.compact = exports.parseErrorBody = exports.parseBody = exports.deserializeMetadata = void 0;
4
- const util_http_handler_1 = require("@ingestkorea/util-http-handler");
5
- const index_js_1 = require("../models/index.js");
6
- const constants_js_1 = require("../middleware/constants.js");
7
- const deserializeMetadata = (response) => {
8
- const attempts = response.headers[constants_js_1.INGESTKOREA_RETRY] || "1";
9
- const totalRetryDelay = response.headers[constants_js_1.INGESTKOREA_RETRY_DELAY] || "0";
1
+ import { collectBodyString, destroyStream } from "@ingestkorea/util-http-handler";
2
+ import { SensError, SENS_ERROR_CODE_SPEC, NCLOUD_ERROR_CODE_SPEC, } from "../models/index.js";
3
+ import { INGESTKOREA_RETRY, INGESTKOREA_RETRY_DELAY, NCP_TRACE_ID } from "../middleware/constants.js";
4
+ const ALLOWED_CONTENT_TYPES = ["application/json"];
5
+ const SENS_ERROR_BODY_SPEC = [
6
+ ["status", "number", true],
7
+ ["errorMessage", "string", false],
8
+ ["errors", "object", false],
9
+ ];
10
+ const NCLOUD_ERROR_BODY_SPEC = [
11
+ ["errorCode", "string", true],
12
+ ["message", "string", false],
13
+ ["details", "string", false],
14
+ ];
15
+ export const deserializeMetadata = (response) => {
16
+ const attempts = response.headers[INGESTKOREA_RETRY] || "1";
17
+ const totalRetryDelay = response.headers[INGESTKOREA_RETRY_DELAY] || "0";
18
+ const traceId = response.headers[NCP_TRACE_ID] || undefined;
10
19
  return {
11
20
  httpStatusCode: response.statusCode,
12
21
  attempts: Number(attempts),
13
22
  totalRetryDelay: Number(totalRetryDelay),
23
+ ...(traceId && { traceId }),
14
24
  };
15
25
  };
16
- exports.deserializeMetadata = deserializeMetadata;
17
- const parseBody = async (output) => {
26
+ export const parseBody = async (output) => {
18
27
  const { statusCode, headers, body: streamBody } = output;
19
- if (!isJsonResponse(headers["content-type"])) {
20
- await (0, util_http_handler_1.destroyStream)(streamBody);
21
- throw new index_js_1.SensError({
22
- code: -1,
28
+ if (!isSupportContentType(ALLOWED_CONTENT_TYPES, headers["content-type"])) {
29
+ await destroyStream(streamBody);
30
+ throw new SensError({
31
+ code: statusCode,
23
32
  type: "SDK.REQUEST_ERROR",
24
- message: "response content-type is not application/json",
33
+ message: `response content-type is not ${ALLOWED_CONTENT_TYPES.join(" or ")}`,
25
34
  });
26
35
  }
27
36
  try {
28
- const data = await (0, util_http_handler_1.collectBodyString)(streamBody);
37
+ const data = await collectBodyString(streamBody);
29
38
  return data.length ? JSON.parse(data) : {};
30
39
  }
31
40
  catch (e) {
32
- throw new index_js_1.SensError({
41
+ throw new SensError({
33
42
  code: -1,
34
43
  type: "SDK.REQUEST_ERROR",
35
- message: e instanceof Error ? e.message : "parse response body error",
44
+ message: "parse response body error",
36
45
  });
37
46
  }
38
47
  };
39
- exports.parseBody = parseBody;
40
- const parseErrorBody = async (output) => {
48
+ export const parseErrorBody = async (output) => {
41
49
  const { statusCode, headers, body: streamBody } = output;
42
- if (!isJsonResponse(headers["content-type"])) {
43
- await (0, util_http_handler_1.destroyStream)(streamBody);
44
- throw new index_js_1.SensError({
50
+ if (!isSupportContentType(ALLOWED_CONTENT_TYPES, headers["content-type"])) {
51
+ await destroyStream(streamBody);
52
+ throw new SensError({
45
53
  code: -1,
46
54
  type: "SDK.REQUEST_ERROR",
47
- message: "response content-type is not application/json",
55
+ message: `response content-type is not ${ALLOWED_CONTENT_TYPES.join(" or ")}`,
48
56
  });
49
57
  }
50
- const data = await (0, util_http_handler_1.collectBodyString)(streamBody);
51
- const sensErrorBody = isSensErrorResponse(data);
52
- const nCloudErrorBody = isNCloudErrorResponse(data);
53
- if (sensErrorBody) {
54
- const errorType = isSensErrorCode(sensErrorBody.status)
55
- ? index_js_1.SENS_ERROR_CODE_SPEC[sensErrorBody.status]
56
- : "SDK.UNKNOWN_ERROR";
57
- throw new index_js_1.SensError({
58
- code: isSensErrorCode(sensErrorBody.status) ? sensErrorBody.status : statusCode,
59
- type: errorType,
60
- message: sensErrorBody.errorMessage || errorType,
61
- ...(sensErrorBody.errors &&
62
- Array.isArray(sensErrorBody.errors) && {
63
- errors: sensErrorBody.errors.filter((d) => !!d),
64
- }),
58
+ try {
59
+ const data = await collectBodyString(streamBody);
60
+ const sensContent = isSensErrorResponse(data);
61
+ const nCloudContent = isNCloudErrorResponse(data);
62
+ if (sensContent) {
63
+ throw handleSensError(sensContent, statusCode);
64
+ }
65
+ if (nCloudContent) {
66
+ throw handleNCloudError(nCloudContent, statusCode);
67
+ }
68
+ const summary = data ? data.slice(0, 100).trim() : "empty response";
69
+ throw new SensError({
70
+ code: -1,
71
+ type: "SDK.UNKNOWN_ERROR",
72
+ message: "Invalid Naver Cloud Platform response format",
73
+ errors: [`HTTP ${statusCode} - ${summary}...`],
65
74
  });
66
75
  }
67
- if (nCloudErrorBody) {
68
- const { errorCode } = nCloudErrorBody.error;
69
- const errorType = isNCloudErrorCode(errorCode)
70
- ? index_js_1.NCLOUD_ERROR_CODE_SPEC[errorCode].type
71
- : "SDK.UNKNOWN_ERROR";
72
- throw new index_js_1.SensError({
73
- code: isNCloudErrorCode(errorCode) ? index_js_1.NCLOUD_ERROR_CODE_SPEC[errorCode].status : statusCode,
74
- type: errorType,
75
- message: nCloudErrorBody.error.details || "Something wrong",
76
- });
76
+ catch (e) {
77
+ await destroyStream(streamBody);
78
+ throw e;
77
79
  }
78
- throw new index_js_1.SensError({
79
- code: -1,
80
- type: "SDK.UNKNOWN_ERROR",
81
- message: "Invalid Naver Cloud Platform response format",
82
- errors: [`${statusCode} - ${data.slice(0, 120)}...`],
83
- });
84
80
  };
85
- exports.parseErrorBody = parseErrorBody;
86
- const isSensErrorCode = (code) => {
87
- return code in index_js_1.SENS_ERROR_CODE_SPEC;
81
+ export const compact = (obj) => {
82
+ if (Array.isArray(obj)) {
83
+ return obj.map((item) => compact(item));
84
+ }
85
+ if (typeof obj === "object" && obj !== null) {
86
+ return Object.fromEntries(Object.entries(obj)
87
+ .filter(([_, value]) => value !== undefined) // undefined 필드 제거
88
+ .map(([key, value]) => [key, compact(value)]) // 내부 값 재귀 처리
89
+ );
90
+ }
91
+ return obj;
88
92
  };
89
- const isNCloudErrorCode = (code) => {
90
- return code in index_js_1.NCLOUD_ERROR_CODE_SPEC;
93
+ export const convertToUtc = (input) => {
94
+ const utcRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
95
+ return utcRegex.test(input) ? input : new Date(input.replace(" ", "T") + "+09:00").toISOString();
96
+ };
97
+ const isSupportContentType = (allowedTypes, contentType) => {
98
+ const matchedType = allowedTypes.find((type) => contentType?.toLowerCase().includes(type));
99
+ return !!matchedType;
91
100
  };
92
101
  const isSensErrorResponse = (input) => {
93
102
  if (typeof input !== "string")
@@ -96,7 +105,7 @@ const isSensErrorResponse = (input) => {
96
105
  const data = JSON.parse(input);
97
106
  if (!data || typeof data !== "object")
98
107
  return null;
99
- const isValid = index_js_1.SENS_ERROR_BODY_SPEC.every(([key, type, required]) => {
108
+ const isValid = SENS_ERROR_BODY_SPEC.every(([key, type, required]) => {
100
109
  const value = data[key];
101
110
  if (required && (value === undefined || value === null))
102
111
  return false;
@@ -106,7 +115,7 @@ const isSensErrorResponse = (input) => {
106
115
  });
107
116
  return isValid ? data : null;
108
117
  }
109
- catch (_a) {
118
+ catch {
110
119
  return null;
111
120
  }
112
121
  };
@@ -117,7 +126,7 @@ const isNCloudErrorResponse = (input) => {
117
126
  const data = JSON.parse(input);
118
127
  if (!(data && typeof data == "object" && typeof data.error == "object"))
119
128
  return null;
120
- const isValid = index_js_1.NCLOUD_ERROR_BODY_SPEC.every(([key, type, required]) => {
129
+ const isValid = NCLOUD_ERROR_BODY_SPEC.every(([key, type, required]) => {
121
130
  const value = data.error[key];
122
131
  if (required && (value === undefined || value === null))
123
132
  return false;
@@ -127,29 +136,32 @@ const isNCloudErrorResponse = (input) => {
127
136
  });
128
137
  return isValid ? data : null;
129
138
  }
130
- catch (_a) {
139
+ catch {
131
140
  return null;
132
141
  }
133
142
  };
134
- const compact = (obj) => {
135
- if (Array.isArray(obj)) {
136
- return obj.map((item) => (0, exports.compact)(item));
137
- }
138
- if (typeof obj === "object" && obj !== null) {
139
- return Object.fromEntries(Object.entries(obj)
140
- .filter(([_, value]) => value !== undefined) // undefined 필드 제거
141
- .map(([key, value]) => [key, (0, exports.compact)(value)]) // 내부 값 재귀 처리
142
- );
143
- }
144
- return obj;
143
+ const isSensErrorCode = (code) => {
144
+ return code in SENS_ERROR_CODE_SPEC;
145
145
  };
146
- exports.compact = compact;
147
- const convertToUtc = (input) => {
148
- const utcRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
149
- return utcRegex.test(input) ? input : new Date(input.replace(" ", "T") + "+09:00").toISOString();
146
+ const isNCloudErrorCode = (code) => {
147
+ return code in NCLOUD_ERROR_CODE_SPEC;
148
+ };
149
+ const handleSensError = (data, httpStatusCode) => {
150
+ return new SensError({
151
+ code: httpStatusCode,
152
+ type: isSensErrorCode(data.status) ? SENS_ERROR_CODE_SPEC[data.status] : "SDK.UNKNOWN_ERROR",
153
+ message: data.errorMessage || "something wrong",
154
+ ...(Array.isArray(data?.errors) && {
155
+ errors: data.errors.filter((d) => !!d).map((d) => String(d)),
156
+ }),
157
+ });
150
158
  };
151
- exports.convertToUtc = convertToUtc;
152
- const isJsonResponse = (contentType) => {
153
- var _a;
154
- return (_a = contentType === null || contentType === void 0 ? void 0 : contentType.toLowerCase().includes("application/json")) !== null && _a !== void 0 ? _a : false;
159
+ const handleNCloudError = (data, httpStatusCode) => {
160
+ const { errorCode, message, details } = data.error;
161
+ throw new SensError({
162
+ code: httpStatusCode,
163
+ type: isNCloudErrorCode(errorCode) ? NCLOUD_ERROR_CODE_SPEC[errorCode].type : "SDK.UNKNOWN_ERROR",
164
+ message: message || "something wrong",
165
+ ...(typeof details == "string" && { errors: [details] }),
166
+ });
155
167
  };
@@ -2,7 +2,6 @@ import { SensClientConfig, SensClientResolvedConfig, SensCommand } from "./model
2
2
  export declare class SensClient {
3
3
  config: SensClientResolvedConfig;
4
4
  private httpHandler;
5
- private requestHandler;
6
5
  constructor(config: SensClientConfig);
7
6
  send<T, P>(command: SensCommand<T, P, SensClientResolvedConfig>): Promise<P>;
8
7
  }
@@ -1,3 +1,3 @@
1
1
  export * from "./commands/index.js";
2
2
  export * from "./SensClient.js";
3
- export * from "./models/SensError.js";
3
+ export * from "./models/SensClientError.js";
@@ -5,3 +5,4 @@ export declare const INGESTKOREA_RETRY_DELAY = "x-ingestkorea-total-retry-delay"
5
5
  export declare const NCP_ACCESS_KEY = "x-ncp-iam-access-key";
6
6
  export declare const NCP_TIMESTAMP = "x-ncp-apigw-timestamp";
7
7
  export declare const NCP_SIGNATURE = "x-ncp-apigw-signature-v2";
8
+ export declare const NCP_TRACE_ID = "x-ncp-trace-id";
@@ -5,4 +5,5 @@ export interface ResponseMetadata {
5
5
  httpStatusCode: number;
6
6
  attempts: number;
7
7
  totalRetryDelay: number;
8
+ traceId?: string;
8
9
  }
@@ -53,5 +53,3 @@ export interface NCloudErrorResponse {
53
53
  details?: string;
54
54
  };
55
55
  }
56
- export declare const SENS_ERROR_BODY_SPEC: [[keyof SensErrorResponse][number], string, boolean][];
57
- export declare const NCLOUD_ERROR_BODY_SPEC: [[keyof NCloudErrorResponse["error"]][number], string, boolean][];
@@ -6,11 +6,19 @@ export type ServiceId = {
6
6
  kakao: string;
7
7
  sms: string;
8
8
  };
9
+ export type HttpHandlerOptions = {
10
+ connectionTimeout: number;
11
+ socketTimeout: number;
12
+ keepAlive: boolean;
13
+ family: 4;
14
+ };
9
15
  export interface SensClientConfig {
10
16
  credentials?: Partial<Credentials>;
11
17
  serviceId?: Partial<ServiceId>;
18
+ httpHandler?: Partial<HttpHandlerOptions>;
12
19
  }
13
20
  export interface SensClientResolvedConfig {
14
21
  credentials: Credentials;
15
22
  serviceId: ServiceId;
23
+ httpHandler: HttpHandlerOptions;
16
24
  }
@@ -1,6 +1,7 @@
1
- import { SesnResponseErrorType } from "./SensErrorInfo.js";
1
+ import { HttpHandlerErrorCode } from "@ingestkorea/util-http-handler";
2
+ import { SesnResponseErrorType } from "./SensApiError.js";
2
3
  type SensClientErrorType = "SDK.AUTH_ERROR" | "SDK.GENERAL_ERROR" | "SDK.REQUEST_ERROR" | "SDK.UNKNOWN_ERROR";
3
- export type SensErrorType = SesnResponseErrorType | SensClientErrorType;
4
+ export type SensErrorType = SesnResponseErrorType | SensClientErrorType | HttpHandlerErrorCode;
4
5
  export interface SensErrorInput {
5
6
  code: number;
6
7
  type: SensErrorType;
@@ -11,8 +11,8 @@ export * from "./MetadataBearer.js";
11
11
  export * from "./SendAlimtalk.js";
12
12
  export * from "./SendMMS.js";
13
13
  export * from "./SendSMS.js";
14
+ export * from "./SensApiError.js";
14
15
  export * from "./SensClient.js";
16
+ export * from "./SensClientError.js";
15
17
  export * from "./SensCommand.js";
16
- export * from "./SensError.js";
17
- export * from "./SensErrorInfo.js";
18
18
  export * from "./SensMiddleware.js";
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ingestkorea/client-sens",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.",
5
5
  "exports": {
6
6
  ".": {
7
+ "types": "./dist-types/index.d.ts",
7
8
  "import": "./dist-es/index.js",
8
- "require": "./dist-cjs/index.js",
9
- "types": "./dist-types/index.d.ts"
9
+ "require": "./dist-cjs/index.js"
10
10
  }
11
11
  },
12
12
  "main": "./dist-cjs/index.js",
@@ -43,7 +43,7 @@
43
43
  "typescript": "^5"
44
44
  },
45
45
  "dependencies": {
46
- "@ingestkorea/util-http-handler": "^1.3.0"
46
+ "@ingestkorea/util-http-handler": "^1.4.0"
47
47
  },
48
48
  "keywords": [
49
49
  "sens",
@@ -1,31 +0,0 @@
1
- "use strict";
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;
4
- exports.SENS_ERROR_CODE_SPEC = {
5
- 400: "Bad Request",
6
- 401: "Unauthorized",
7
- 403: "Forbidden",
8
- 404: "Not Found",
9
- 429: "Too Many Requests",
10
- 500: "Internal Server Error",
11
- };
12
- exports.NCLOUD_ERROR_CODE_SPEC = {
13
- "100": { status: 400, type: exports.SENS_ERROR_CODE_SPEC["400"] },
14
- "200": { status: 401, type: exports.SENS_ERROR_CODE_SPEC["401"] },
15
- "210": { status: 403, type: exports.SENS_ERROR_CODE_SPEC["403"] },
16
- "300": { status: 404, type: exports.SENS_ERROR_CODE_SPEC["404"] },
17
- "400": { status: 429, type: exports.SENS_ERROR_CODE_SPEC["429"] },
18
- "410": { status: 429, type: exports.SENS_ERROR_CODE_SPEC["429"] },
19
- "420": { status: 429, type: exports.SENS_ERROR_CODE_SPEC["429"] },
20
- "900": { status: 500, type: exports.SENS_ERROR_CODE_SPEC["500"] },
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
- ];