@longvansoftware/storefront-js-client 3.1.4 → 3.1.6
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.
- package/README.md +221 -221
- package/dist/src/graphql/auth/mutations.js +224 -224
- package/dist/src/graphql/auth/queries.js +59 -59
- package/dist/src/graphql/campaign/mutations.js +26 -26
- package/dist/src/graphql/campaign/queries.js +375 -375
- package/dist/src/graphql/cashbook/queries.js +93 -93
- package/dist/src/graphql/cloud/mutations.js +103 -103
- package/dist/src/graphql/cloud/queries.js +112 -112
- package/dist/src/graphql/computing/mutations.js +96 -96
- package/dist/src/graphql/computing/queries.js +41 -41
- package/dist/src/graphql/crm/mutations.js +813 -813
- package/dist/src/graphql/crm/queries.js +661 -661
- package/dist/src/graphql/fragments/product.d.ts +38 -0
- package/dist/src/graphql/fragments/product.js +196 -0
- package/dist/src/graphql/payment/mutations.js +146 -146
- package/dist/src/graphql/payment/queries.js +116 -116
- package/dist/src/graphql/paymentV2/mutations.js +47 -47
- package/dist/src/graphql/paymentV2/queries.js +176 -176
- package/dist/src/graphql/product/mutations.js +94 -94
- package/dist/src/graphql/product/queries.js +472 -472
- package/dist/src/graphql/service/mutations.js +304 -304
- package/dist/src/graphql/service/queries.js +131 -131
- package/dist/src/graphql/store/mutations.js +24 -24
- package/dist/src/graphql/store/queries.js +24 -24
- package/dist/src/graphql/user/mutations.js +142 -142
- package/dist/src/graphql/user/queries.d.ts +1 -0
- package/dist/src/graphql/user/queries.js +319 -299
- package/dist/src/lib/SDK.d.ts +1 -0
- package/dist/src/lib/SDK.js +1 -1
- package/dist/src/lib/serviceSDK.js +12 -12
- package/dist/src/lib/shareZalo/index.d.ts +5 -0
- package/dist/src/lib/shareZalo/index.js +32 -0
- package/dist/src/lib/user/index.d.ts +2 -1
- package/dist/src/lib/user/index.js +20 -2
- package/dist/src/types/common.d.ts +264 -0
- package/dist/src/types/common.js +35 -0
- package/dist/src/utils/errorHandler.d.ts +64 -0
- package/dist/src/utils/errorHandler.js +197 -0
- package/package.json +44 -44
|
@@ -57,8 +57,8 @@ class Service {
|
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
try {
|
|
59
59
|
const { data, errors } = yield this.client.query({
|
|
60
|
-
query: (0, client_1.gql) `
|
|
61
|
-
${query}
|
|
60
|
+
query: (0, client_1.gql) `
|
|
61
|
+
${query}
|
|
62
62
|
`,
|
|
63
63
|
variables,
|
|
64
64
|
context: {
|
|
@@ -84,8 +84,8 @@ class Service {
|
|
|
84
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
try {
|
|
86
86
|
const { data, errors } = yield this.client.mutate({
|
|
87
|
-
mutation: (0, client_1.gql) `
|
|
88
|
-
${mutation}
|
|
87
|
+
mutation: (0, client_1.gql) `
|
|
88
|
+
${mutation}
|
|
89
89
|
`,
|
|
90
90
|
variables,
|
|
91
91
|
context: {
|
|
@@ -169,8 +169,8 @@ class Service {
|
|
|
169
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
170
|
try {
|
|
171
171
|
const { data, errors } = yield this.client.query({
|
|
172
|
-
query: (0, client_1.gql) `
|
|
173
|
-
${query}
|
|
172
|
+
query: (0, client_1.gql) `
|
|
173
|
+
${query}
|
|
174
174
|
`,
|
|
175
175
|
variables,
|
|
176
176
|
context: {
|
|
@@ -197,8 +197,8 @@ class Service {
|
|
|
197
197
|
return __awaiter(this, void 0, void 0, function* () {
|
|
198
198
|
try {
|
|
199
199
|
const { data, errors } = yield this.client.mutate({
|
|
200
|
-
mutation: (0, client_1.gql) `
|
|
201
|
-
${mutation}
|
|
200
|
+
mutation: (0, client_1.gql) `
|
|
201
|
+
${mutation}
|
|
202
202
|
`,
|
|
203
203
|
variables,
|
|
204
204
|
context: {
|
|
@@ -224,8 +224,8 @@ class Service {
|
|
|
224
224
|
return __awaiter(this, void 0, void 0, function* () {
|
|
225
225
|
try {
|
|
226
226
|
const { data, errors } = yield this.client.query({
|
|
227
|
-
query: (0, client_1.gql) `
|
|
228
|
-
${query}
|
|
227
|
+
query: (0, client_1.gql) `
|
|
228
|
+
${query}
|
|
229
229
|
`,
|
|
230
230
|
variables,
|
|
231
231
|
context: {
|
|
@@ -252,8 +252,8 @@ class Service {
|
|
|
252
252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
253
253
|
try {
|
|
254
254
|
const { data, errors } = yield this.client.mutate({
|
|
255
|
-
mutation: (0, client_1.gql) `
|
|
256
|
-
${mutation}
|
|
255
|
+
mutation: (0, client_1.gql) `
|
|
256
|
+
${mutation}
|
|
257
257
|
`,
|
|
258
258
|
variables,
|
|
259
259
|
context: {
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ShareZaloService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
class ShareZaloService extends serviceSDK_1.Service {
|
|
15
|
+
constructor(endpoint, orgId, storeId) {
|
|
16
|
+
super(endpoint, orgId, storeId);
|
|
17
|
+
}
|
|
18
|
+
shareOrder(dataRequet) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const endpoint = ``;
|
|
21
|
+
const method = "POST";
|
|
22
|
+
try {
|
|
23
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, dataRequet);
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ShareZaloService = ShareZaloService;
|
|
@@ -17,7 +17,8 @@ export declare class UserService extends Service {
|
|
|
17
17
|
getEmployeesByStoreChannelId(): Promise<any>;
|
|
18
18
|
getCompanyByContactInfoId(contactId: string): Promise<any>;
|
|
19
19
|
getContactInfosByCompanyId(companyId: string): Promise<any>;
|
|
20
|
-
getProvinces(): Promise<any>;
|
|
20
|
+
getProvinces(version: number): Promise<any>;
|
|
21
|
+
getWardsByProvinceId(provinceId: string): Promise<any>;
|
|
21
22
|
getDistricts(provinceId: string): Promise<any>;
|
|
22
23
|
getWards(districtId: string): Promise<any>;
|
|
23
24
|
getPersonByPartyId(partyId: string): Promise<any>;
|
|
@@ -295,10 +295,12 @@ class UserService extends serviceSDK_1.Service {
|
|
|
295
295
|
}
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
|
-
getProvinces() {
|
|
298
|
+
getProvinces(version) {
|
|
299
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
300
300
|
const query = queries_1.GET_PROVINCES;
|
|
301
|
-
const variables = {
|
|
301
|
+
const variables = {
|
|
302
|
+
version,
|
|
303
|
+
};
|
|
302
304
|
try {
|
|
303
305
|
const response = yield this.graphqlQuery(query, variables);
|
|
304
306
|
return response.getProvinces;
|
|
@@ -309,6 +311,22 @@ class UserService extends serviceSDK_1.Service {
|
|
|
309
311
|
}
|
|
310
312
|
});
|
|
311
313
|
}
|
|
314
|
+
getWardsByProvinceId(provinceId) {
|
|
315
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
316
|
+
const query = queries_1.GET_WARDS_BY_PROVINCEID;
|
|
317
|
+
const variables = {
|
|
318
|
+
provinceId,
|
|
319
|
+
};
|
|
320
|
+
try {
|
|
321
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
322
|
+
return response.getWardsByProvinceId;
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
console.log(`Error in getWardsByProvinceId: ${error}`);
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
312
330
|
getDistricts(provinceId) {
|
|
313
331
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
332
|
const query = queries_1.GET_DISTRICTS;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common types used across the SDK
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Environment configuration
|
|
6
|
+
*/
|
|
7
|
+
export type Environment = 'dev' | 'live';
|
|
8
|
+
/**
|
|
9
|
+
* HTTP methods supported by REST API calls
|
|
10
|
+
*/
|
|
11
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
12
|
+
/**
|
|
13
|
+
* Pagination parameters
|
|
14
|
+
*/
|
|
15
|
+
export interface PaginationParams {
|
|
16
|
+
currentPage?: number;
|
|
17
|
+
maxResult?: number;
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Pagination response
|
|
22
|
+
*/
|
|
23
|
+
export interface PaginationResponse<T> {
|
|
24
|
+
total: number;
|
|
25
|
+
currentPage: number;
|
|
26
|
+
maxResult: number;
|
|
27
|
+
totalPage: number;
|
|
28
|
+
data: T[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Search parameters
|
|
32
|
+
*/
|
|
33
|
+
export interface SearchParams extends PaginationParams {
|
|
34
|
+
keyword?: string;
|
|
35
|
+
sortBy?: string;
|
|
36
|
+
sortOrder?: 'ASC' | 'DESC';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* API Response wrapper
|
|
40
|
+
*/
|
|
41
|
+
export interface ApiResponse<T = any> {
|
|
42
|
+
success: boolean;
|
|
43
|
+
data?: T;
|
|
44
|
+
message?: string;
|
|
45
|
+
errors?: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Service configuration
|
|
49
|
+
*/
|
|
50
|
+
export interface ServiceConfig {
|
|
51
|
+
endpoint: string;
|
|
52
|
+
orgId: string;
|
|
53
|
+
storeId: string;
|
|
54
|
+
token?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* GraphQL variables base interface
|
|
58
|
+
*/
|
|
59
|
+
export interface GraphQLVariables {
|
|
60
|
+
partnerId?: string;
|
|
61
|
+
storeChannel?: string;
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* REST API headers
|
|
66
|
+
*/
|
|
67
|
+
export interface RestApiHeaders {
|
|
68
|
+
'Content-Type'?: string;
|
|
69
|
+
'Authorization'?: string;
|
|
70
|
+
'PartnerId'?: string;
|
|
71
|
+
'Partner-Id'?: string;
|
|
72
|
+
'X-Ecomos-Access-Token'?: string;
|
|
73
|
+
[key: string]: string | undefined;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* File upload configuration
|
|
77
|
+
*/
|
|
78
|
+
export interface FileUploadConfig {
|
|
79
|
+
maxSize?: number;
|
|
80
|
+
allowedTypes?: string[];
|
|
81
|
+
multiple?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Cache configuration
|
|
85
|
+
*/
|
|
86
|
+
export interface CacheConfig {
|
|
87
|
+
ttl?: number;
|
|
88
|
+
maxSize?: number;
|
|
89
|
+
enabled?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Retry configuration
|
|
93
|
+
*/
|
|
94
|
+
export interface RetryConfig {
|
|
95
|
+
maxRetries?: number;
|
|
96
|
+
baseDelay?: number;
|
|
97
|
+
maxDelay?: number;
|
|
98
|
+
exponentialBackoff?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* SDK Configuration
|
|
102
|
+
*/
|
|
103
|
+
export interface SDKConfig {
|
|
104
|
+
orgId: string;
|
|
105
|
+
storeId: string;
|
|
106
|
+
environment: Environment;
|
|
107
|
+
cache?: CacheConfig;
|
|
108
|
+
retry?: RetryConfig;
|
|
109
|
+
timeout?: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Service method options
|
|
113
|
+
*/
|
|
114
|
+
export interface ServiceMethodOptions {
|
|
115
|
+
timeout?: number;
|
|
116
|
+
retry?: RetryConfig;
|
|
117
|
+
cache?: boolean;
|
|
118
|
+
headers?: RestApiHeaders;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Base entity interface
|
|
122
|
+
*/
|
|
123
|
+
export interface BaseEntity {
|
|
124
|
+
id: string;
|
|
125
|
+
createdAt?: string;
|
|
126
|
+
updatedAt?: string;
|
|
127
|
+
createdBy?: string;
|
|
128
|
+
updatedBy?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Address interface
|
|
132
|
+
*/
|
|
133
|
+
export interface Address {
|
|
134
|
+
street?: string;
|
|
135
|
+
city?: string;
|
|
136
|
+
state?: string;
|
|
137
|
+
country?: string;
|
|
138
|
+
postalCode?: string;
|
|
139
|
+
fullAddress?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Contact information
|
|
143
|
+
*/
|
|
144
|
+
export interface ContactInfo {
|
|
145
|
+
email?: string;
|
|
146
|
+
phone?: string;
|
|
147
|
+
website?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Money/Price interface
|
|
151
|
+
*/
|
|
152
|
+
export interface Money {
|
|
153
|
+
amount: number;
|
|
154
|
+
currency?: string;
|
|
155
|
+
formatted?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Image interface
|
|
159
|
+
*/
|
|
160
|
+
export interface Image {
|
|
161
|
+
id?: string;
|
|
162
|
+
url: string;
|
|
163
|
+
alt?: string;
|
|
164
|
+
width?: number;
|
|
165
|
+
height?: number;
|
|
166
|
+
size?: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Category interface
|
|
170
|
+
*/
|
|
171
|
+
export interface Category extends BaseEntity {
|
|
172
|
+
title: string;
|
|
173
|
+
handle?: string;
|
|
174
|
+
description?: string;
|
|
175
|
+
image?: string;
|
|
176
|
+
icon?: string;
|
|
177
|
+
parentId?: string;
|
|
178
|
+
level?: number;
|
|
179
|
+
children?: Category[];
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Tag interface
|
|
183
|
+
*/
|
|
184
|
+
export interface Tag {
|
|
185
|
+
id: string;
|
|
186
|
+
name: string;
|
|
187
|
+
color?: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Attribute interface
|
|
191
|
+
*/
|
|
192
|
+
export interface Attribute {
|
|
193
|
+
name: string;
|
|
194
|
+
value: string;
|
|
195
|
+
type?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Unit interface
|
|
199
|
+
*/
|
|
200
|
+
export interface Unit {
|
|
201
|
+
id: string;
|
|
202
|
+
name: string;
|
|
203
|
+
symbol?: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Status enum
|
|
207
|
+
*/
|
|
208
|
+
export declare enum Status {
|
|
209
|
+
ACTIVE = "ACTIVE",
|
|
210
|
+
INACTIVE = "INACTIVE",
|
|
211
|
+
PENDING = "PENDING",
|
|
212
|
+
DRAFT = "DRAFT",
|
|
213
|
+
PUBLISHED = "PUBLISHED",
|
|
214
|
+
ARCHIVED = "ARCHIVED"
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Gender enum
|
|
218
|
+
*/
|
|
219
|
+
export declare enum Gender {
|
|
220
|
+
MALE = "MALE",
|
|
221
|
+
FEMALE = "FEMALE",
|
|
222
|
+
OTHER = "OTHER"
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Sort order enum
|
|
226
|
+
*/
|
|
227
|
+
export declare enum SortOrder {
|
|
228
|
+
ASC = "ASC",
|
|
229
|
+
DESC = "DESC"
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Utility type for making all properties optional
|
|
233
|
+
*/
|
|
234
|
+
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
235
|
+
/**
|
|
236
|
+
* Utility type for making all properties required
|
|
237
|
+
*/
|
|
238
|
+
export type RequiredBy<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
239
|
+
/**
|
|
240
|
+
* Utility type for nullable properties
|
|
241
|
+
*/
|
|
242
|
+
export type Nullable<T> = T | null;
|
|
243
|
+
/**
|
|
244
|
+
* Utility type for optional properties
|
|
245
|
+
*/
|
|
246
|
+
export type Optional<T> = T | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Deep partial type
|
|
249
|
+
*/
|
|
250
|
+
export type DeepPartial<T> = {
|
|
251
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Promise result type
|
|
255
|
+
*/
|
|
256
|
+
export type PromiseResult<T> = Promise<T>;
|
|
257
|
+
/**
|
|
258
|
+
* Callback function type
|
|
259
|
+
*/
|
|
260
|
+
export type Callback<T = void> = (error?: Error, result?: T) => void;
|
|
261
|
+
/**
|
|
262
|
+
* Event handler type
|
|
263
|
+
*/
|
|
264
|
+
export type EventHandler<T = any> = (event: T) => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Common types used across the SDK
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SortOrder = exports.Gender = exports.Status = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Status enum
|
|
9
|
+
*/
|
|
10
|
+
var Status;
|
|
11
|
+
(function (Status) {
|
|
12
|
+
Status["ACTIVE"] = "ACTIVE";
|
|
13
|
+
Status["INACTIVE"] = "INACTIVE";
|
|
14
|
+
Status["PENDING"] = "PENDING";
|
|
15
|
+
Status["DRAFT"] = "DRAFT";
|
|
16
|
+
Status["PUBLISHED"] = "PUBLISHED";
|
|
17
|
+
Status["ARCHIVED"] = "ARCHIVED";
|
|
18
|
+
})(Status || (exports.Status = Status = {}));
|
|
19
|
+
/**
|
|
20
|
+
* Gender enum
|
|
21
|
+
*/
|
|
22
|
+
var Gender;
|
|
23
|
+
(function (Gender) {
|
|
24
|
+
Gender["MALE"] = "MALE";
|
|
25
|
+
Gender["FEMALE"] = "FEMALE";
|
|
26
|
+
Gender["OTHER"] = "OTHER";
|
|
27
|
+
})(Gender || (exports.Gender = Gender = {}));
|
|
28
|
+
/**
|
|
29
|
+
* Sort order enum
|
|
30
|
+
*/
|
|
31
|
+
var SortOrder;
|
|
32
|
+
(function (SortOrder) {
|
|
33
|
+
SortOrder["ASC"] = "ASC";
|
|
34
|
+
SortOrder["DESC"] = "DESC";
|
|
35
|
+
})(SortOrder || (exports.SortOrder = SortOrder = {}));
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { SDKError } from '../lib/serviceSDK';
|
|
2
|
+
/**
|
|
3
|
+
* Error types for better categorization
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ErrorType {
|
|
6
|
+
GRAPHQL_ERROR = "GRAPHQL_ERROR",
|
|
7
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
8
|
+
REST_API_ERROR = "REST_API_ERROR",
|
|
9
|
+
VALIDATION_ERROR = "VALIDATION_ERROR",
|
|
10
|
+
AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
|
|
11
|
+
AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR",
|
|
12
|
+
NOT_FOUND_ERROR = "NOT_FOUND_ERROR",
|
|
13
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error severity levels
|
|
17
|
+
*/
|
|
18
|
+
export declare enum ErrorSeverity {
|
|
19
|
+
LOW = "LOW",
|
|
20
|
+
MEDIUM = "MEDIUM",
|
|
21
|
+
HIGH = "HIGH",
|
|
22
|
+
CRITICAL = "CRITICAL"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Enhanced SDK Error with additional metadata
|
|
26
|
+
*/
|
|
27
|
+
export declare class EnhancedSDKError extends SDKError {
|
|
28
|
+
readonly severity: ErrorSeverity;
|
|
29
|
+
readonly timestamp: Date;
|
|
30
|
+
readonly context?: Record<string, any>;
|
|
31
|
+
readonly retryable: boolean;
|
|
32
|
+
constructor(message: string, type: ErrorType, originalError?: any, severity?: ErrorSeverity, context?: Record<string, any>, retryable?: boolean);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Error handler utility class
|
|
36
|
+
*/
|
|
37
|
+
export declare class ErrorHandler {
|
|
38
|
+
/**
|
|
39
|
+
* Create a standardized error from various error sources
|
|
40
|
+
*/
|
|
41
|
+
static createError(error: any, context?: Record<string, any>): EnhancedSDKError;
|
|
42
|
+
/**
|
|
43
|
+
* Determine error severity based on error characteristics
|
|
44
|
+
*/
|
|
45
|
+
private static determineSeverity;
|
|
46
|
+
/**
|
|
47
|
+
* Determine if an error is retryable
|
|
48
|
+
*/
|
|
49
|
+
private static isRetryable;
|
|
50
|
+
/**
|
|
51
|
+
* Log error with appropriate level
|
|
52
|
+
*/
|
|
53
|
+
static logError(error: EnhancedSDKError, operation?: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Check if error should trigger retry logic
|
|
56
|
+
*/
|
|
57
|
+
static shouldRetry(error: EnhancedSDKError, attemptCount: number, maxRetries?: number): boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Retry utility with exponential backoff
|
|
61
|
+
*/
|
|
62
|
+
export declare class RetryManager {
|
|
63
|
+
static withExponentialBackoff<T>(operation: () => Promise<T>, maxRetries?: number, baseDelay?: number): Promise<T>;
|
|
64
|
+
}
|