@longvansoftware/storefront-js-client 3.0.5 → 3.0.7

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 (41) hide show
  1. package/README.md +221 -221
  2. package/dist/src/graphql/auth/mutations.d.ts +1 -0
  3. package/dist/src/graphql/auth/mutations.js +192 -205
  4. package/dist/src/graphql/auth/queries.d.ts +0 -1
  5. package/dist/src/graphql/auth/queries.js +60 -65
  6. package/dist/src/graphql/campaign/mutations.js +26 -26
  7. package/dist/src/graphql/campaign/queries.js +375 -375
  8. package/dist/src/graphql/cashbook/queries.js +93 -93
  9. package/dist/src/graphql/cloud/mutations.js +103 -103
  10. package/dist/src/graphql/cloud/queries.js +112 -112
  11. package/dist/src/graphql/computing/mutations.js +96 -96
  12. package/dist/src/graphql/computing/queries.js +41 -41
  13. package/dist/src/graphql/crm/mutations.js +813 -813
  14. package/dist/src/graphql/crm/queries.js +661 -661
  15. package/dist/src/graphql/fragments/product.d.ts +38 -0
  16. package/dist/src/graphql/fragments/product.js +196 -0
  17. package/dist/src/graphql/payment/mutations.js +146 -146
  18. package/dist/src/graphql/payment/queries.js +116 -116
  19. package/dist/src/graphql/paymentV2/mutations.js +47 -47
  20. package/dist/src/graphql/paymentV2/queries.js +176 -176
  21. package/dist/src/graphql/product/mutations.js +94 -94
  22. package/dist/src/graphql/product/queries.js +472 -472
  23. package/dist/src/graphql/service/mutations.js +304 -304
  24. package/dist/src/graphql/service/queries.js +131 -131
  25. package/dist/src/graphql/store/mutations.js +24 -24
  26. package/dist/src/graphql/store/queries.js +24 -24
  27. package/dist/src/graphql/user/mutations.js +142 -142
  28. package/dist/src/graphql/user/queries.js +298 -298
  29. package/dist/src/lib/auth/index.d.ts +7 -36
  30. package/dist/src/lib/auth/index.js +6 -69
  31. package/dist/src/lib/order/index.d.ts +2 -0
  32. package/dist/src/lib/order/index.js +37 -0
  33. package/dist/src/lib/serviceSDK.js +12 -12
  34. package/dist/src/lib/shareZalo/index.d.ts +5 -0
  35. package/dist/src/lib/shareZalo/index.js +32 -0
  36. package/dist/src/types/auth.d.ts +0 -123
  37. package/dist/src/types/common.d.ts +264 -0
  38. package/dist/src/types/common.js +35 -0
  39. package/dist/src/utils/errorHandler.d.ts +64 -0
  40. package/dist/src/utils/errorHandler.js +197 -0
  41. package/package.json +43 -44
@@ -158,19 +158,11 @@ class AuthService extends serviceSDK_1.Service {
158
158
  }
159
159
  });
160
160
  }
161
- /**
162
- * Creates user detail for the specified user login ID.
163
- * Uses the SDK's configured orgId automatically.
164
- *
165
- * @param userLoginId - The user login ID to create detail for.
166
- * @returns A promise that resolves to the created user detail with full profile information.
167
- * @throws Will throw an error if the GraphQL mutation fails.
168
- */
169
161
  createUserDetail(userLoginId) {
170
162
  return __awaiter(this, void 0, void 0, function* () {
171
163
  const variables = {
172
164
  userLoginId,
173
- orgId: this.orgId,
165
+ partnerId: this.orgId,
174
166
  };
175
167
  try {
176
168
  const response = yield this.graphqlMutation(mutations_1.CREATE_USER_DETAIL_MUTATION, variables);
@@ -314,7 +306,7 @@ class AuthService extends serviceSDK_1.Service {
314
306
  * Creates a new organization.
315
307
  *
316
308
  * @param orgName - The name of the organization to create.
317
- * @returns A promise that resolves to the created organization details.
309
+ * @returns A promise that resolves to the result of the createOrg mutation.
318
310
  * @throws Will throw an error if the GraphQL mutation fails.
319
311
  */
320
312
  createOrg(orgName) {
@@ -416,7 +408,7 @@ class AuthService extends serviceSDK_1.Service {
416
408
  const variables = {
417
409
  orgId: this.orgId,
418
410
  phone,
419
- channelType: type || "SMS", // Default to SMS if not specified
411
+ channelType: type || 'SMS', // Default to SMS if not specified
420
412
  };
421
413
  try {
422
414
  const response = yield this.graphqlMutation(mutations_1.SEND_OTP_MUTATION, variables);
@@ -442,7 +434,7 @@ class AuthService extends serviceSDK_1.Service {
442
434
  const variables = {
443
435
  otpCode,
444
436
  phone,
445
- channelType: type || "SMS",
437
+ channelType: type || 'SMS',
446
438
  };
447
439
  try {
448
440
  const response = yield this.graphqlMutation(mutations_1.VALIDATE_OTP_MUTATION, variables);
@@ -469,10 +461,10 @@ class AuthService extends serviceSDK_1.Service {
469
461
  const variables = {
470
462
  otpCode,
471
463
  phone,
472
- channelType: type || "SMS",
464
+ channelType: type || 'SMS',
473
465
  };
474
466
  try {
475
- const response = yield this.graphqlQuery(queries_1.GET_ACCESS_TOKEN_BY_OTP, variables);
467
+ const response = yield this.graphqlMutation(mutations_1.GET_ACCESS_TOKEN_BY_OTP_MUTATION, variables);
476
468
  return { accessToken: response.getAccessTokenByOTP };
477
469
  }
478
470
  catch (error) {
@@ -481,60 +473,5 @@ class AuthService extends serviceSDK_1.Service {
481
473
  }
482
474
  });
483
475
  }
484
- /**
485
- * Updates user information.
486
- * Uses the SDK's configured orgId and access token automatically.
487
- *
488
- * @param updateUserRequest - The user information to update.
489
- * @param type - Optional type parameter.
490
- * @param password - Optional password for verification.
491
- * @returns A promise that resolves to the updated user information.
492
- * @throws Will throw an error if the GraphQL mutation fails.
493
- */
494
- updateInfo(updateUserRequest, type, password) {
495
- return __awaiter(this, void 0, void 0, function* () {
496
- const variables = {
497
- orgId: this.orgId,
498
- accessToken: this.token,
499
- updateUserRequest,
500
- type,
501
- password,
502
- };
503
- try {
504
- const response = yield this.graphqlMutation(mutations_1.UPDATE_INFO_MUTATION, variables);
505
- return response.updateInfo;
506
- }
507
- catch (error) {
508
- console.log(`Error in updateInfo: ${error}`);
509
- throw error;
510
- }
511
- });
512
- }
513
- /**
514
- * Creates/updates user password.
515
- * Uses the SDK's configured orgId and access token automatically.
516
- * This is a simplified version of updateInfo specifically for password creation.
517
- *
518
- * @param password - The new password to set.
519
- * @returns A promise that resolves to the updated user information.
520
- * @throws Will throw an error if the GraphQL mutation fails.
521
- */
522
- createPassword(password) {
523
- return __awaiter(this, void 0, void 0, function* () {
524
- const variables = {
525
- orgId: this.orgId,
526
- accessToken: this.token,
527
- password,
528
- };
529
- try {
530
- const response = yield this.graphqlMutation(mutations_1.UPDATE_INFO_MUTATION, variables);
531
- return response.updateInfo;
532
- }
533
- catch (error) {
534
- console.log(`Error in createPassword: ${error}`);
535
- throw error;
536
- }
537
- });
538
- }
539
476
  }
540
477
  exports.AuthService = AuthService;
@@ -304,6 +304,7 @@ export declare class OrderService extends Service {
304
304
  * @throws If an error occurs while updating the customer and shipping address.
305
305
  */
306
306
  getListSellOrder(requestData: OrderQuery): Promise<any>;
307
+ getListSellOrderV2(requestData: OrderQuery, storeId: string): Promise<any>;
307
308
  getListSellOrderAll(requestData: OrderQuery): Promise<any>;
308
309
  getDiaries(requestData: OrderQuery): Promise<any>;
309
310
  /**
@@ -320,6 +321,7 @@ export declare class OrderService extends Service {
320
321
  * @throws If an error occurs while updating the customer and shipping address.
321
322
  */
322
323
  getListReturnOrder(requestData: OrderQuery): Promise<any>;
324
+ getListReturnOrderV2(requestData: OrderQuery, storeId: string): Promise<any>;
323
325
  /**
324
326
  * Get list return order status
325
327
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -787,6 +787,25 @@ class OrderService extends serviceSDK_1.Service {
787
787
  }
788
788
  });
789
789
  }
790
+ getListSellOrderV2(requestData, storeId) {
791
+ return __awaiter(this, void 0, void 0, function* () {
792
+ // Convert requestData to a format suitable for URLSearchParams
793
+ const params = new URLSearchParams(Object.entries(requestData).reduce((acc, [key, value]) => {
794
+ acc[key] = Array.isArray(value) ? value.join(",") : value.toString();
795
+ return acc;
796
+ }, {})).toString();
797
+ const endpoint = `/orders/${this.orgId}/${storeId}/sell_order?${params}`;
798
+ const method = "GET";
799
+ try {
800
+ const response = yield this.restApiCallWithToken(endpoint, method);
801
+ return response;
802
+ }
803
+ catch (error) {
804
+ console.error(`Error in getListSellOrder: ${error}`);
805
+ throw error;
806
+ }
807
+ });
808
+ }
790
809
  // get list all store
791
810
  getListSellOrderAll(requestData) {
792
811
  return __awaiter(this, void 0, void 0, function* () {
@@ -870,6 +889,24 @@ class OrderService extends serviceSDK_1.Service {
870
889
  }
871
890
  });
872
891
  }
892
+ getListReturnOrderV2(requestData, storeId) {
893
+ return __awaiter(this, void 0, void 0, function* () {
894
+ const params = new URLSearchParams(Object.entries(requestData).reduce((acc, [key, value]) => {
895
+ acc[key] = Array.isArray(value) ? value.join(",") : value.toString();
896
+ return acc;
897
+ }, {})).toString();
898
+ const endpoint = `/orders/${this.orgId}/${storeId}/return_order?${params}`;
899
+ const method = "GET";
900
+ try {
901
+ const response = yield this.restApiCallWithToken(endpoint, method);
902
+ return response;
903
+ }
904
+ catch (error) {
905
+ console.log(`Error in getListReturnOrder: ${error}`);
906
+ throw error;
907
+ }
908
+ });
909
+ }
873
910
  /**
874
911
  * Get list return order status
875
912
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -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,5 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class ShareZaloService extends Service {
3
+ constructor(endpoint: string, orgId: string, storeId: string);
4
+ shareOrder(dataRequet: any): Promise<any>;
5
+ }
@@ -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;
@@ -157,126 +157,3 @@ export interface GetAccessTokenByOTPResponse {
157
157
  /** The access token string */
158
158
  accessToken: string;
159
159
  }
160
- /**
161
- * Response interface for creating organization
162
- * Returns the created PartyGroup object
163
- */
164
- export interface CreateOrgResponse {
165
- /** Organization ID */
166
- id: string;
167
- /** Party ID */
168
- partyId: string;
169
- /** Code ID */
170
- codeId: string;
171
- /** Group name */
172
- groupName: string;
173
- /** Group type */
174
- groupType: string;
175
- /** Short name */
176
- shortName: string;
177
- /** Group name local */
178
- groupNameLocal: string;
179
- /** Office site name */
180
- officeSiteName: string;
181
- /** Comments */
182
- comments: string;
183
- /** Logo image URL */
184
- logoImageUrl: string;
185
- /** Is incorporated */
186
- isIncorporated: boolean;
187
- /** Federal tax ID */
188
- federalTaxId: string;
189
- /** Description */
190
- description: string;
191
- /** Deleted flag */
192
- deleted: boolean;
193
- /** Status */
194
- status: string;
195
- /** Position index ID */
196
- positionIndexId: string;
197
- /** Prefix */
198
- prefix: string;
199
- }
200
- /**
201
- * Response interface for creating user detail
202
- * Returns the created user detail with full profile information
203
- */
204
- export interface CreateUserDetailResponse {
205
- /** Party ID */
206
- partyId: string;
207
- /** Organization ID */
208
- orgId: string;
209
- /** Full name */
210
- fullName: string;
211
- /** Email address */
212
- email: string;
213
- /** Phone number */
214
- phone: string;
215
- /** Address */
216
- address: string;
217
- /** Identity number */
218
- identityNumber: string;
219
- /** Gender */
220
- gender: string;
221
- /** Birth date */
222
- birthDate: string;
223
- /** Avatar URL */
224
- avatarUrl: string;
225
- /** Access token */
226
- accessToken: string;
227
- /** Username */
228
- username: string;
229
- /** Ready V2 flag */
230
- readyV2: boolean;
231
- /** Organization permissions map */
232
- orgPermissionsMap: Record<string, any>;
233
- /** Organization positions map */
234
- orgPositionsMap: Record<string, any>;
235
- /** Organization roles map */
236
- orgRolesMap: Record<string, any>;
237
- }
238
- /**
239
- * Request interface for updating user information
240
- */
241
- export interface UpdateInfoRequest {
242
- /** Full name */
243
- fullName?: string;
244
- /** Email address */
245
- email?: string;
246
- /** Phone number */
247
- phone?: string;
248
- /** Address */
249
- address?: string;
250
- /** Identity number */
251
- identityNumber?: string;
252
- /** Gender */
253
- gender?: string;
254
- /** Birth date */
255
- birthDate?: string;
256
- /** Avatar URL */
257
- avatarUrl?: string;
258
- }
259
- /**
260
- * Response interface for updating user information
261
- * Returns the updated user profile with full information
262
- */
263
- export interface UpdateInfoResponse {
264
- /** Party ID */
265
- partyId: string;
266
- /** Full name */
267
- fullName: string;
268
- /** Email address */
269
- email: string;
270
- /** Phone number */
271
- phone: string;
272
- /** Address */
273
- address: string;
274
- /** Identity number */
275
- identityNumber: string;
276
- /** Gender */
277
- gender: string;
278
- /** Birth date */
279
- birthDate: string;
280
- /** Avatar URL */
281
- avatarUrl: string;
282
- }
@@ -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;