@ingestkorea/client-sens 1.9.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 (102) hide show
  1. package/README.md +99 -57
  2. package/dist-cjs/SensClient.js +42 -43
  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 +22 -10
  10. package/dist-cjs/commands/ListAlimtalkTemplatesCommand.js +3 -0
  11. package/dist-cjs/commands/ListSMSStatusCommand.js +21 -10
  12. package/dist-cjs/commands/SendAlimtalkCommand.js +15 -14
  13. package/dist-cjs/commands/SendMMSCommand.js +16 -23
  14. package/dist-cjs/commands/SendSMSCommand.js +28 -16
  15. package/dist-cjs/commands/constants.js +8 -19
  16. package/dist-cjs/index.js +1 -0
  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 +48 -38
  20. package/dist-cjs/middleware/middleware-sign.js +8 -12
  21. package/dist-cjs/models/SensApiError.js +21 -0
  22. package/dist-cjs/models/{SensErrorInfo.js → SensClientError.js} +6 -1
  23. package/dist-cjs/models/SensCommand.js +1 -0
  24. package/dist-cjs/models/index.js +2 -1
  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 +124 -82
  38. package/dist-es/SensClient.js +37 -31
  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 +24 -28
  46. package/dist-es/commands/ListAlimtalkTemplatesCommand.js +8 -9
  47. package/dist-es/commands/ListSMSStatusCommand.js +25 -29
  48. package/dist-es/commands/SendAlimtalkCommand.js +18 -26
  49. package/dist-es/commands/SendMMSCommand.js +37 -48
  50. package/dist-es/commands/SendSMSCommand.js +25 -29
  51. package/dist-es/commands/constants.js +18 -39
  52. package/dist-es/commands/index.js +12 -28
  53. package/dist-es/index.js +3 -18
  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 +47 -38
  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/SensClientError.js +14 -0
  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 -33
  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 +126 -88
  91. package/dist-types/SensClient.d.ts +0 -1
  92. package/dist-types/index.d.ts +1 -0
  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/SensApiError.d.ts +55 -0
  96. package/dist-types/models/SensClient.d.ts +8 -1
  97. package/dist-types/models/SensClientError.d.ts +18 -0
  98. package/dist-types/models/index.d.ts +2 -1
  99. package/dist-types/protocols/constants.d.ts +1 -1
  100. package/package.json +4 -5
  101. package/dist-es/models/SensErrorInfo.js +0 -13
  102. package/dist-types/models/SensErrorInfo.d.ts +0 -21
@@ -1,91 +1,104 @@
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) => {
27
+ const { statusCode, headers, body: streamBody } = output;
28
+ if (!isSupportContentType(ALLOWED_CONTENT_TYPES, headers["content-type"])) {
29
+ await destroyStream(streamBody);
30
+ throw new SensError({
31
+ code: statusCode,
32
+ type: "SDK.REQUEST_ERROR",
33
+ message: `response content-type is not ${ALLOWED_CONTENT_TYPES.join(" or ")}`,
34
+ });
35
+ }
36
+ try {
37
+ const data = await collectBodyString(streamBody);
38
+ return data.length ? JSON.parse(data) : {};
39
+ }
40
+ catch (e) {
41
+ throw new SensError({
42
+ code: -1,
43
+ type: "SDK.REQUEST_ERROR",
44
+ message: "parse response body error",
45
+ });
46
+ }
47
+ };
48
+ export const parseErrorBody = async (output) => {
18
49
  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: statusCode !== null && statusCode !== void 0 ? statusCode : 400,
23
- type: "Bad Request",
24
- message: "response content-type is not application/json",
50
+ if (!isSupportContentType(ALLOWED_CONTENT_TYPES, headers["content-type"])) {
51
+ await destroyStream(streamBody);
52
+ throw new SensError({
53
+ code: -1,
54
+ type: "SDK.REQUEST_ERROR",
55
+ message: `response content-type is not ${ALLOWED_CONTENT_TYPES.join(" or ")}`,
25
56
  });
26
57
  }
27
- const data = await (0, util_http_handler_1.collectBodyString)(streamBody);
28
- if (data.length) {
29
- try {
30
- return JSON.parse(data);
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);
31
64
  }
32
- catch (e) {
33
- await (0, util_http_handler_1.destroyStream)(streamBody);
34
- throw new index_js_1.SensError({
35
- code: statusCode !== null && statusCode !== void 0 ? statusCode : 400,
36
- type: "Bad Request",
37
- message: "parse response body error",
38
- });
65
+ if (nCloudContent) {
66
+ throw handleNCloudError(nCloudContent, statusCode);
39
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}...`],
74
+ });
75
+ }
76
+ catch (e) {
77
+ await destroyStream(streamBody);
78
+ throw e;
40
79
  }
41
- return {};
42
80
  };
43
- exports.parseBody = parseBody;
44
- const parseErrorBody = async (output) => {
45
- const { statusCode, headers, body: streamBody } = output;
46
- const error = new index_js_1.SensError({
47
- code: statusCode !== null && statusCode !== void 0 ? statusCode : 400,
48
- type: "Bad Request",
49
- message: "something wrong",
50
- });
51
- if (!isJsonResponse(headers["content-type"])) {
52
- await (0, util_http_handler_1.destroyStream)(streamBody);
53
- error.message = "response content-type is not application/json";
54
- throw error;
81
+ export const compact = (obj) => {
82
+ if (Array.isArray(obj)) {
83
+ return obj.map((item) => compact(item));
55
84
  }
56
- const data = await (0, util_http_handler_1.collectBodyString)(streamBody);
57
- await (0, util_http_handler_1.destroyStream)(streamBody);
58
- const sensErrorBody = isSensErrorBody(data);
59
- if (!sensErrorBody) {
60
- throw error;
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
+ );
61
90
  }
62
- throw new index_js_1.SensError({
63
- code: sensErrorBody.status,
64
- type: SENS_ERROR_CODE_SPEC[sensErrorBody.status] || "Unknown Error",
65
- message: sensErrorBody.errorMessage || "Something wrong",
66
- ...(sensErrorBody.errors &&
67
- Array.isArray(sensErrorBody.errors) && {
68
- invalidInputs: sensErrorBody.errors.map((msg) => {
69
- return { type: "not-valid.args", message: msg };
70
- }),
71
- }),
72
- });
91
+ return obj;
73
92
  };
74
- exports.parseErrorBody = parseErrorBody;
75
- const SENS_ERROR_CODE_SPEC = {
76
- 400: "Bad Request",
77
- 401: "Unauthorized",
78
- 403: "Forbidden",
79
- 404: "Not Found",
80
- 429: "Too Many Requests",
81
- 500: "Internal Server Error",
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();
82
96
  };
83
- const SENS_ERROR_BODY_SPEC = [
84
- ["status", "number", true],
85
- ["errorMessage", "string", false],
86
- ["errors", "object", false],
87
- ];
88
- const isSensErrorBody = (input) => {
97
+ const isSupportContentType = (allowedTypes, contentType) => {
98
+ const matchedType = allowedTypes.find((type) => contentType?.toLowerCase().includes(type));
99
+ return !!matchedType;
100
+ };
101
+ const isSensErrorResponse = (input) => {
89
102
  if (typeof input !== "string")
90
103
  return null;
91
104
  try {
@@ -102,28 +115,53 @@ const isSensErrorBody = (input) => {
102
115
  });
103
116
  return isValid ? data : null;
104
117
  }
105
- catch (_a) {
118
+ catch {
106
119
  return null;
107
120
  }
108
121
  };
109
- const compact = (obj) => {
110
- if (Array.isArray(obj)) {
111
- return obj.map((item) => (0, exports.compact)(item));
122
+ const isNCloudErrorResponse = (input) => {
123
+ if (typeof input !== "string")
124
+ return null;
125
+ try {
126
+ const data = JSON.parse(input);
127
+ if (!(data && typeof data == "object" && typeof data.error == "object"))
128
+ return null;
129
+ const isValid = NCLOUD_ERROR_BODY_SPEC.every(([key, type, required]) => {
130
+ const value = data.error[key];
131
+ if (required && (value === undefined || value === null))
132
+ return false;
133
+ if (value !== undefined && typeof value !== type)
134
+ return false;
135
+ return true;
136
+ });
137
+ return isValid ? data : null;
112
138
  }
113
- if (typeof obj === "object" && obj !== null) {
114
- return Object.fromEntries(Object.entries(obj)
115
- .filter(([_, value]) => value !== undefined) // undefined 필드 제거
116
- .map(([key, value]) => [key, (0, exports.compact)(value)]) // 내부 값 재귀 처리
117
- );
139
+ catch {
140
+ return null;
118
141
  }
119
- return obj;
120
142
  };
121
- exports.compact = compact;
122
- const convertToUtc = (input) => {
123
- const utcRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/;
124
- return utcRegex.test(input) ? input : new Date(input.replace(" ", "T") + "+09:00").toISOString();
143
+ const isSensErrorCode = (code) => {
144
+ return code in SENS_ERROR_CODE_SPEC;
125
145
  };
126
- exports.convertToUtc = convertToUtc;
127
- const isJsonResponse = (contentType) => {
128
- return /application\/json/gi.exec(contentType || "") ? true : false;
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
+ });
158
+ };
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
+ });
129
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,2 +1,3 @@
1
1
  export * from "./commands/index.js";
2
2
  export * from "./SensClient.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
  }
@@ -0,0 +1,55 @@
1
+ export declare const SENS_ERROR_CODE_SPEC: {
2
+ readonly 400: "Bad Request";
3
+ readonly 401: "Unauthorized";
4
+ readonly 403: "Forbidden";
5
+ readonly 404: "Not Found";
6
+ readonly 429: "Too Many Requests";
7
+ readonly 500: "Internal Server Error";
8
+ };
9
+ export declare const NCLOUD_ERROR_CODE_SPEC: {
10
+ readonly "100": {
11
+ readonly status: 400;
12
+ readonly type: "Bad Request";
13
+ };
14
+ readonly "200": {
15
+ readonly status: 401;
16
+ readonly type: "Unauthorized";
17
+ };
18
+ readonly "210": {
19
+ readonly status: 403;
20
+ readonly type: "Forbidden";
21
+ };
22
+ readonly "300": {
23
+ readonly status: 404;
24
+ readonly type: "Not Found";
25
+ };
26
+ readonly "400": {
27
+ readonly status: 429;
28
+ readonly type: "Too Many Requests";
29
+ };
30
+ readonly "410": {
31
+ readonly status: 429;
32
+ readonly type: "Too Many Requests";
33
+ };
34
+ readonly "420": {
35
+ readonly status: 429;
36
+ readonly type: "Too Many Requests";
37
+ };
38
+ readonly "900": {
39
+ readonly status: 500;
40
+ readonly type: "Internal Server Error";
41
+ };
42
+ };
43
+ export type SesnResponseErrorType = (typeof SENS_ERROR_CODE_SPEC)[keyof typeof SENS_ERROR_CODE_SPEC];
44
+ export interface SensErrorResponse {
45
+ status: number;
46
+ errorMessage?: string;
47
+ errors?: object;
48
+ }
49
+ export interface NCloudErrorResponse {
50
+ error: {
51
+ errorCode: string;
52
+ message?: string;
53
+ details?: string;
54
+ };
55
+ }
@@ -4,14 +4,21 @@ export type Credentials = {
4
4
  };
5
5
  export type ServiceId = {
6
6
  kakao: string;
7
- push: string;
8
7
  sms: string;
9
8
  };
9
+ export type HttpHandlerOptions = {
10
+ connectionTimeout: number;
11
+ socketTimeout: number;
12
+ keepAlive: boolean;
13
+ family: 4;
14
+ };
10
15
  export interface SensClientConfig {
11
16
  credentials?: Partial<Credentials>;
12
17
  serviceId?: Partial<ServiceId>;
18
+ httpHandler?: Partial<HttpHandlerOptions>;
13
19
  }
14
20
  export interface SensClientResolvedConfig {
15
21
  credentials: Credentials;
16
22
  serviceId: ServiceId;
23
+ httpHandler: HttpHandlerOptions;
17
24
  }
@@ -0,0 +1,18 @@
1
+ import { HttpHandlerErrorCode } from "@ingestkorea/util-http-handler";
2
+ import { SesnResponseErrorType } from "./SensApiError.js";
3
+ type SensClientErrorType = "SDK.AUTH_ERROR" | "SDK.GENERAL_ERROR" | "SDK.REQUEST_ERROR" | "SDK.UNKNOWN_ERROR";
4
+ export type SensErrorType = SesnResponseErrorType | SensClientErrorType | HttpHandlerErrorCode;
5
+ export interface SensErrorInput {
6
+ code: number;
7
+ type: SensErrorType;
8
+ message: string;
9
+ errors?: string[];
10
+ }
11
+ export declare class SensError extends Error {
12
+ readonly code: number;
13
+ readonly type: SensErrorType;
14
+ readonly errors: string[];
15
+ readonly timestamp: string;
16
+ constructor(info: SensErrorInput);
17
+ }
18
+ export {};
@@ -11,7 +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 "./SensErrorInfo.js";
17
18
  export * from "./SensMiddleware.js";
@@ -2,6 +2,6 @@ import { HttpResponse } from "@ingestkorea/util-http-handler";
2
2
  import { ResponseMetadata } from "../models/index.js";
3
3
  export declare const deserializeMetadata: (response: HttpResponse) => ResponseMetadata;
4
4
  export declare const parseBody: (output: HttpResponse) => Promise<any>;
5
- export declare const parseErrorBody: (output: HttpResponse) => Promise<void>;
5
+ export declare const parseErrorBody: (output: HttpResponse) => Promise<never>;
6
6
  export declare const compact: <T>(obj: T) => T;
7
7
  export declare const convertToUtc: (input: string) => string;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ingestkorea/client-sens",
3
- "version": "1.9.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,8 +43,7 @@
43
43
  "typescript": "^5"
44
44
  },
45
45
  "dependencies": {
46
- "@ingestkorea/util-error-handler": "^1.0.3",
47
- "@ingestkorea/util-http-handler": "^1.1.2"
46
+ "@ingestkorea/util-http-handler": "^1.4.0"
48
47
  },
49
48
  "keywords": [
50
49
  "sens",
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SensError = void 0;
4
- class SensError extends Error {
5
- constructor(info) {
6
- super(info.message);
7
- this.name = "SensError";
8
- this.code = info.code;
9
- this.type = info.type;
10
- this.invalidInputs = info.invalidInputs || [];
11
- }
12
- }
13
- exports.SensError = SensError;
@@ -1,21 +0,0 @@
1
- export interface SensErrorResponse {
2
- status: number;
3
- errorMessage?: string;
4
- errors?: object;
5
- }
6
- export interface SensErrorInput {
7
- code: number;
8
- type: string;
9
- message: string;
10
- invalidInputs?: InvalidInputs[];
11
- }
12
- export type InvalidInputs = {
13
- type: string;
14
- message: string;
15
- };
16
- export declare class SensError extends Error {
17
- readonly code: number;
18
- readonly type: string;
19
- readonly invalidInputs: InvalidInputs[];
20
- constructor(info: SensErrorInput);
21
- }