@karpeleslab/klbfw 0.2.26 → 0.2.27
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/index.d.ts +25 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -61,6 +61,25 @@ interface RestResponse<T = any> {
|
|
|
61
61
|
[key: string]: any;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Context object for REST API calls.
|
|
66
|
+
* Keys are single characters representing different context dimensions.
|
|
67
|
+
*/
|
|
68
|
+
interface Context {
|
|
69
|
+
/** Branch identifier */
|
|
70
|
+
b?: string;
|
|
71
|
+
/** Currency code (e.g., 'USD', 'EUR') */
|
|
72
|
+
c?: string;
|
|
73
|
+
/** Group identifier */
|
|
74
|
+
g?: string;
|
|
75
|
+
/** Language/locale code (e.g., 'en-US', 'ja-JP') */
|
|
76
|
+
l?: string;
|
|
77
|
+
/** Timezone identifier (e.g., 'Asia/Tokyo', 'America/New_York') */
|
|
78
|
+
t?: string;
|
|
79
|
+
/** User identifier */
|
|
80
|
+
u?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
64
83
|
/** REST API error object (thrown on promise rejection) */
|
|
65
84
|
interface RestError {
|
|
66
85
|
/** Always 'error' for error responses */
|
|
@@ -172,7 +191,7 @@ interface Price extends PriceValue {
|
|
|
172
191
|
tax_rate?: number;
|
|
173
192
|
}
|
|
174
193
|
|
|
175
|
-
declare function rest<T = any>(name: string, verb: string, params?: Record<string, any>, context?:
|
|
194
|
+
declare function rest<T = any>(name: string, verb: string, params?: Record<string, any>, context?: Context): Promise<RestResponse<T>>;
|
|
176
195
|
declare function rest_get<T = any>(name: string, params?: Record<string, any>): Promise<RestResponse<T>>; // Backward compatibility
|
|
177
196
|
declare function restGet<T = any>(name: string, params?: Record<string, any>): Promise<RestResponse<T>>;
|
|
178
197
|
|
|
@@ -218,7 +237,7 @@ interface SSESource {
|
|
|
218
237
|
close(): void;
|
|
219
238
|
}
|
|
220
239
|
|
|
221
|
-
declare function restSSE(name: string, method?: string, params?: Record<string, any>, context?:
|
|
240
|
+
declare function restSSE(name: string, method?: string, params?: Record<string, any>, context?: Context): SSESource;
|
|
222
241
|
|
|
223
242
|
// Upload module types
|
|
224
243
|
|
|
@@ -266,7 +285,7 @@ interface UploadLegacyOptions {
|
|
|
266
285
|
/** @deprecated Use uploadFile() instead */
|
|
267
286
|
declare const upload: {
|
|
268
287
|
init(path: string, params?: Record<string, any>, notify?: (status: any) => void): Promise<any> | ((files: any) => Promise<any>);
|
|
269
|
-
append(path: string, file: File | object, params?: Record<string, any>, context?:
|
|
288
|
+
append(path: string, file: File | object, params?: Record<string, any>, context?: Context): Promise<any>;
|
|
270
289
|
run(): void;
|
|
271
290
|
getStatus(): { queue: any[]; running: any[]; failed: any[] };
|
|
272
291
|
resume(): void;
|
|
@@ -284,7 +303,7 @@ declare function uploadFile(
|
|
|
284
303
|
buffer: UploadFileInput,
|
|
285
304
|
method?: string,
|
|
286
305
|
params?: Record<string, any>,
|
|
287
|
-
context?:
|
|
306
|
+
context?: Context,
|
|
288
307
|
options?: UploadFileOptions
|
|
289
308
|
): Promise<any>;
|
|
290
309
|
|
|
@@ -294,7 +313,7 @@ declare function uploadManyFiles(
|
|
|
294
313
|
files: UploadFileInput[],
|
|
295
314
|
method?: string,
|
|
296
315
|
params?: Record<string, any>,
|
|
297
|
-
context?:
|
|
316
|
+
context?: Context,
|
|
298
317
|
options?: UploadManyFilesOptions
|
|
299
318
|
): Promise<any[]>;
|
|
300
319
|
|
|
@@ -334,6 +353,7 @@ export {
|
|
|
334
353
|
uploadManyFiles,
|
|
335
354
|
getI18N,
|
|
336
355
|
trimPrefix,
|
|
356
|
+
Context,
|
|
337
357
|
RestPaging,
|
|
338
358
|
RestResponse,
|
|
339
359
|
RestError,
|