@plyaz/api 1.6.6 → 1.6.8

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 (70) hide show
  1. package/dist/api/client/helpers/interceptors.d.ts.map +1 -1
  2. package/dist/api/endpoints/files.d.ts +38 -0
  3. package/dist/api/endpoints/files.d.ts.map +1 -0
  4. package/dist/api/endpoints/index.d.ts +29 -0
  5. package/dist/api/endpoints/index.d.ts.map +1 -1
  6. package/dist/api/index.d.ts +1 -0
  7. package/dist/api/index.d.ts.map +1 -1
  8. package/dist/api/services/files/DELETE/deleteFile.d.ts +28 -0
  9. package/dist/api/services/files/DELETE/deleteFile.d.ts.map +1 -0
  10. package/dist/api/services/files/DELETE/index.d.ts +7 -0
  11. package/dist/api/services/files/DELETE/index.d.ts.map +1 -0
  12. package/dist/api/services/files/DELETE/useDeleteFile.d.ts +33 -0
  13. package/dist/api/services/files/DELETE/useDeleteFile.d.ts.map +1 -0
  14. package/dist/api/services/files/GET/downloadFile.d.ts +37 -0
  15. package/dist/api/services/files/GET/downloadFile.d.ts.map +1 -0
  16. package/dist/api/services/files/GET/getFile.d.ts +26 -0
  17. package/dist/api/services/files/GET/getFile.d.ts.map +1 -0
  18. package/dist/api/services/files/GET/getSignedUrl.d.ts +34 -0
  19. package/dist/api/services/files/GET/getSignedUrl.d.ts.map +1 -0
  20. package/dist/api/services/files/GET/index.d.ts +11 -0
  21. package/dist/api/services/files/GET/index.d.ts.map +1 -0
  22. package/dist/api/services/files/GET/useDownloadFile.d.ts +41 -0
  23. package/dist/api/services/files/GET/useDownloadFile.d.ts.map +1 -0
  24. package/dist/api/services/files/GET/useGetFile.d.ts +31 -0
  25. package/dist/api/services/files/GET/useGetFile.d.ts.map +1 -0
  26. package/dist/api/services/files/GET/useGetSignedUrl.d.ts +40 -0
  27. package/dist/api/services/files/GET/useGetSignedUrl.d.ts.map +1 -0
  28. package/dist/api/services/files/POST/generateDocument.d.ts +42 -0
  29. package/dist/api/services/files/POST/generateDocument.d.ts.map +1 -0
  30. package/dist/api/services/files/POST/index.d.ts +11 -0
  31. package/dist/api/services/files/POST/index.d.ts.map +1 -0
  32. package/dist/api/services/files/POST/uploadFile.d.ts +40 -0
  33. package/dist/api/services/files/POST/uploadFile.d.ts.map +1 -0
  34. package/dist/api/services/files/POST/uploadFiles.d.ts +49 -0
  35. package/dist/api/services/files/POST/uploadFiles.d.ts.map +1 -0
  36. package/dist/api/services/files/POST/useGenerateDocument.d.ts +39 -0
  37. package/dist/api/services/files/POST/useGenerateDocument.d.ts.map +1 -0
  38. package/dist/api/services/files/POST/useUploadFile.d.ts +34 -0
  39. package/dist/api/services/files/POST/useUploadFile.d.ts.map +1 -0
  40. package/dist/api/services/files/POST/useUploadFiles.d.ts +36 -0
  41. package/dist/api/services/files/POST/useUploadFiles.d.ts.map +1 -0
  42. package/dist/api/services/files/index.d.ts +16 -0
  43. package/dist/api/services/files/index.d.ts.map +1 -0
  44. package/dist/api/services/index.d.ts +1 -0
  45. package/dist/api/services/index.d.ts.map +1 -1
  46. package/dist/api/upload/browser.d.ts +9 -0
  47. package/dist/api/upload/browser.d.ts.map +1 -0
  48. package/dist/api/upload/config.d.ts +9 -0
  49. package/dist/api/upload/config.d.ts.map +1 -0
  50. package/dist/api/upload/constants.d.ts +23 -0
  51. package/dist/api/upload/constants.d.ts.map +1 -0
  52. package/dist/api/upload/index.d.ts +24 -0
  53. package/dist/api/upload/index.d.ts.map +1 -0
  54. package/dist/api/upload/node.d.ts +9 -0
  55. package/dist/api/upload/node.d.ts.map +1 -0
  56. package/dist/api/upload/retry.d.ts +34 -0
  57. package/dist/api/upload/retry.d.ts.map +1 -0
  58. package/dist/api/upload/uploadWithProgress.d.ts +41 -0
  59. package/dist/api/upload/uploadWithProgress.d.ts.map +1 -0
  60. package/dist/api/upload/utils.d.ts +33 -0
  61. package/dist/api/upload/utils.d.ts.map +1 -0
  62. package/dist/entry-frontend.cjs +301 -1
  63. package/dist/entry-frontend.cjs.map +1 -1
  64. package/dist/entry-frontend.mjs +288 -3
  65. package/dist/entry-frontend.mjs.map +1 -1
  66. package/dist/index.cjs +861 -20
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.mjs +847 -22
  69. package/dist/index.mjs.map +1 -1
  70. package/package.json +3 -4
@@ -0,0 +1,39 @@
1
+ /**
2
+ * React Query Mutation Hook for Generating Documents
3
+ * Provides mutation state for document generation
4
+ */
5
+ import { createApiMutation } from '../../../hooks/factories';
6
+ import type { GenerateDocumentRequest, GenerateDocumentResponse, ServiceOptions } from '@plyaz/types/api';
7
+ import type { ErrorResponse } from '@plyaz/types/errors';
8
+ import type { EndpointsList } from '@/api/endpoints';
9
+ /**
10
+ * Hook for generating documents
11
+ *
12
+ * @param serviceOptions - Service options (apiClient, apiConfig, updateConfigOptions)
13
+ * @param mutationOptions - React Query mutation options
14
+ * @returns React Query mutation result
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const { mutate, isPending, data } = useGenerateDocument();
19
+ *
20
+ * const handleGenerate = () => {
21
+ * mutate({
22
+ * templateId: 'invoices/standard',
23
+ * templateData: { invoiceNumber: 'INV-001', total: 100 },
24
+ * outputFormat: 'pdf',
25
+ * }, {
26
+ * onSuccess: (result) => {
27
+ * // Convert base64 to blob and download
28
+ * const blob = new Blob([
29
+ * Uint8Array.from(atob(result.buffer), c => c.charCodeAt(0))
30
+ * ], { type: 'application/pdf' });
31
+ * const url = URL.createObjectURL(blob);
32
+ * window.open(url);
33
+ * }
34
+ * });
35
+ * };
36
+ * ```
37
+ */
38
+ export declare function useGenerateDocument<TEndpoints = EndpointsList>(serviceOptions?: ServiceOptions<TEndpoints>, mutationOptions?: Parameters<ReturnType<typeof createApiMutation<GenerateDocumentResponse, ErrorResponse, GenerateDocumentRequest, unknown, TEndpoints>>>[1]): ReturnType<ReturnType<typeof createApiMutation<GenerateDocumentResponse, ErrorResponse, GenerateDocumentRequest, unknown, TEndpoints>>>;
39
+ //# sourceMappingURL=useGenerateDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGenerateDocument.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/POST/useGenerateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAG,aAAa,EAC5D,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,eAAe,CAAC,EAAE,UAAU,CAC1B,UAAU,CACR,OAAO,iBAAiB,CACtB,wBAAwB,EACxB,aAAa,EACb,uBAAuB,EACvB,OAAO,EACP,UAAU,CACX,CACF,CACF,CAAC,CAAC,CAAC,GACH,UAAU,CACX,UAAU,CACR,OAAO,iBAAiB,CACtB,wBAAwB,EACxB,aAAa,EACb,uBAAuB,EACvB,OAAO,EACP,UAAU,CACX,CACF,CACF,CAWA"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * React Query Mutation Hook for Uploading Files
3
+ * Provides mutation state and cache invalidation
4
+ */
5
+ import { createApiMutation } from '../../../hooks/factories';
6
+ import type { UploadFileRequest, UploadFileResponse, ServiceOptions } from '@plyaz/types/api';
7
+ import type { ErrorResponse } from '@plyaz/types/errors';
8
+ import type { EndpointsList } from '@/api/endpoints';
9
+ /**
10
+ * Hook for uploading files
11
+ *
12
+ * @param serviceOptions - Service options (apiClient, apiConfig, updateConfigOptions)
13
+ * @param mutationOptions - React Query mutation options
14
+ * @returns React Query mutation result
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const { mutate, isPending } = useUploadFile();
19
+ *
20
+ * const handleUpload = () => {
21
+ * mutate({
22
+ * templateId: 'invoices/standard',
23
+ * templateData: { invoiceNumber: 'INV-001' },
24
+ * filename: 'invoice.pdf',
25
+ * }, {
26
+ * onSuccess: (result) => {
27
+ * console.log('File uploaded:', result.url);
28
+ * }
29
+ * });
30
+ * };
31
+ * ```
32
+ */
33
+ export declare function useUploadFile<TEndpoints = EndpointsList>(serviceOptions?: ServiceOptions<TEndpoints>, mutationOptions?: Parameters<ReturnType<typeof createApiMutation<UploadFileResponse, ErrorResponse, UploadFileRequest, unknown, TEndpoints>>>[1]): ReturnType<ReturnType<typeof createApiMutation<UploadFileResponse, ErrorResponse, UploadFileRequest, unknown, TEndpoints>>>;
34
+ //# sourceMappingURL=useUploadFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUploadFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/POST/useUploadFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,UAAU,GAAG,aAAa,EACtD,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,eAAe,CAAC,EAAE,UAAU,CAC1B,UAAU,CACR,OAAO,iBAAiB,CACtB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,UAAU,CACX,CACF,CACF,CAAC,CAAC,CAAC,GACH,UAAU,CACX,UAAU,CACR,OAAO,iBAAiB,CACtB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,UAAU,CACX,CACF,CACF,CAkBA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * React Query Mutation Hook for Uploading Multiple Files
3
+ * Provides mutation state and cache invalidation
4
+ */
5
+ import { createApiMutation } from '../../../hooks/factories';
6
+ import type { UploadFilesRequest, UploadFilesResponse, ServiceOptions } from '@plyaz/types/api';
7
+ import type { ErrorResponse } from '@plyaz/types/errors';
8
+ import type { EndpointsList } from '@/api/endpoints';
9
+ /**
10
+ * Hook for uploading multiple files
11
+ *
12
+ * @param serviceOptions - Service options (apiClient, apiConfig, updateConfigOptions)
13
+ * @param mutationOptions - React Query mutation options
14
+ * @returns React Query mutation result
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const { mutate, isPending } = useUploadFiles();
19
+ *
20
+ * const handleBulkUpload = () => {
21
+ * mutate({
22
+ * files: [
23
+ * { base64: '...', mimeType: 'image/png', category: 'images', entityType: 'user', entityId: 'user-1' },
24
+ * { base64: '...', mimeType: 'image/jpeg', category: 'images', entityType: 'user', entityId: 'user-1' },
25
+ * ],
26
+ * options: { concurrency: 3, continueOnError: true }
27
+ * }, {
28
+ * onSuccess: (result) => {
29
+ * console.log(`Uploaded ${result.summary.succeeded}/${result.summary.total} files`);
30
+ * }
31
+ * });
32
+ * };
33
+ * ```
34
+ */
35
+ export declare function useUploadFiles<TEndpoints = EndpointsList>(serviceOptions?: ServiceOptions<TEndpoints>, mutationOptions?: Parameters<ReturnType<typeof createApiMutation<UploadFilesResponse, ErrorResponse, UploadFilesRequest, unknown, TEndpoints>>>[1]): ReturnType<ReturnType<typeof createApiMutation<UploadFilesResponse, ErrorResponse, UploadFilesRequest, unknown, TEndpoints>>>;
36
+ //# sourceMappingURL=useUploadFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUploadFiles.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/POST/useUploadFiles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,UAAU,GAAG,aAAa,EACvD,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,eAAe,CAAC,EAAE,UAAU,CAC1B,UAAU,CACR,OAAO,iBAAiB,CACtB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,UAAU,CACX,CACF,CACF,CAAC,CAAC,CAAC,GACH,UAAU,CACX,UAAU,CACR,OAAO,iBAAiB,CACtB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,UAAU,CACX,CACF,CACF,CAkBA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Files Services and Hooks
3
+ * Complete file operations with React Query integration
4
+ *
5
+ * Supports:
6
+ * - File upload (single and bulk with concurrency control)
7
+ * - Document generation (returns buffer without upload)
8
+ * - File metadata retrieval
9
+ * - File download
10
+ * - Signed URL generation
11
+ * - File deletion
12
+ */
13
+ export * from './GET';
14
+ export * from './POST';
15
+ export * from './DELETE';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/services/files/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,OAAO,CAAC;AAGtB,cAAc,QAAQ,CAAC;AAGvB,cAAc,UAAU,CAAC"}
@@ -8,4 +8,5 @@ export * from './featureFlags';
8
8
  export * from './infobip';
9
9
  export * from './virustotal';
10
10
  export * from './cdn';
11
+ export * from './files';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrE,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAG7B,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrE,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAG7B,cAAc,OAAO,CAAC;AAGtB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Browser Upload Implementation
3
+ */
4
+ import type { UploadWithProgressOptions, UploadWithProgressResult } from '@plyaz/types/api';
5
+ /**
6
+ * Execute upload with retry logic for browser
7
+ */
8
+ export declare function uploadWithProgressBrowser(options: UploadWithProgressOptions): Promise<UploadWithProgressResult>;
9
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/api/upload/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EAIzB,MAAM,kBAAkB,CAAC;AAqH1B;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CA2CnC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Upload Configuration Helpers
3
+ */
4
+ import type { UploadWithProgressOptions, MergedUploadConfig } from '@plyaz/types/api';
5
+ /**
6
+ * Get merged configuration from global config and options
7
+ */
8
+ export declare function getMergedConfig(options: UploadWithProgressOptions): MergedUploadConfig;
9
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/api/upload/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAe,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAmEnG;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CAgBtF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Upload Constants
3
+ */
4
+ export declare const UPLOAD_CONSTANTS: {
5
+ readonly DEFAULT_CHUNK_SIZE: number;
6
+ readonly DEFAULT_THROTTLE_MS: 100;
7
+ readonly DEFAULT_CONTENT_TYPE: "application/octet-stream";
8
+ readonly DEFAULT_TIMEOUT: 120000;
9
+ readonly DEFAULT_RETRY_DELAY: 1000;
10
+ readonly DEFAULT_RETRY_BACKOFF: 2;
11
+ readonly DEFAULT_RETRY_MAX_DELAY: 30000;
12
+ readonly PROGRESS_PERCENTAGE_THRESHOLD: 5;
13
+ readonly FULL_PERCENTAGE: 100;
14
+ readonly HTTPS_DEFAULT_PORT: 443;
15
+ readonly HTTP_DEFAULT_PORT: 80;
16
+ /** Max server error status code (exclusive boundary for 5xx range) */
17
+ readonly MAX_SERVER_ERROR_STATUS: 600;
18
+ };
19
+ /** Error codes that indicate retryable network/connection issues */
20
+ export declare const RETRYABLE_ERROR_CODES: readonly ["ETIMEDOUT", "ECONNRESET", "ECONNREFUSED", "ENOTFOUND", "ENETUNREACH", "EAI_AGAIN"];
21
+ /** Message patterns that indicate retryable errors */
22
+ export declare const RETRYABLE_MESSAGE_PATTERNS: readonly ["timeout", "timed out", "network", "econnreset", "econnrefused", "etimedout", "service unavailable", "rate limit", "too many requests"];
23
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/api/upload/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;IAY3B,sEAAsE;;CAE9D,CAAC;AAEX,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,+FAOxB,CAAC;AAEX,sDAAsD;AACtD,eAAO,MAAM,0BAA0B,mJAU7B,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Upload Module
3
+ * Provides upload functionality with progress tracking
4
+ *
5
+ * Cross-platform upload helper that provides real-time progress events.
6
+ * - Node.js: Uses http/https modules with chunked writes
7
+ * - Browser: Uses XMLHttpRequest with progress events
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { uploadWithProgress } from '@plyaz/api';
12
+ *
13
+ * const result = await uploadWithProgress({
14
+ * url: 'https://storage.example.com/upload',
15
+ * data: fileBuffer,
16
+ * contentType: 'application/pdf',
17
+ * onProgress: (event) => {
18
+ * console.log(`${event.percentage}% uploaded`);
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+ export { uploadWithProgress } from './uploadWithProgress';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/upload/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Node.js Upload Implementation
3
+ */
4
+ import type { UploadWithProgressOptions, UploadWithProgressResult } from '@plyaz/types/api';
5
+ /**
6
+ * Execute upload with retry logic for Node.js
7
+ */
8
+ export declare function uploadWithProgressNode(options: UploadWithProgressOptions): Promise<UploadWithProgressResult>;
9
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/api/upload/node.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EAIzB,MAAM,kBAAkB,CAAC;AAwJ1B;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CA2CnC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Upload Retry Helpers
3
+ */
4
+ import type { RetryConfig, UploadWithProgressResult, MergedUploadConfig, RetryContext, RetryErrorParams } from '@plyaz/types/api';
5
+ /**
6
+ * Check if an error is retryable based on error type or HTTP status
7
+ * Uses patterns consistent with BaseError.isRetryable() and notifications retry logic
8
+ */
9
+ export declare function isRetryableError(error: Error, status?: number): boolean;
10
+ /**
11
+ * Calculate delay for retry attempt with exponential backoff
12
+ */
13
+ export declare function calculateRetryDelay(attempt: number, config: RetryConfig): number;
14
+ /**
15
+ * Handle retry error notification
16
+ */
17
+ export declare function notifyRetryError(params: RetryErrorParams): void;
18
+ /**
19
+ * Handle final error notification
20
+ */
21
+ export declare function notifyFinalError(ctx: RetryContext, error: Error): void;
22
+ /**
23
+ * Check if we should retry a failed result
24
+ */
25
+ export declare function shouldRetryResult(result: UploadWithProgressResult, config: MergedUploadConfig, attempt: number, maxAttempts: number): boolean;
26
+ /**
27
+ * Check if we should retry an error
28
+ */
29
+ export declare function shouldRetryError(error: Error, config: MergedUploadConfig, attempt: number, maxAttempts: number): boolean;
30
+ /**
31
+ * Handle retry delay
32
+ */
33
+ export declare function handleRetryDelay(attempt: number, config: RetryConfig): Promise<void>;
34
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/api/upload/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,wBAAwB,EACxB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AA4C1B;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAYvE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAMhF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAa/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAUtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,wBAAwB,EAChC,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,OAAO,CAMT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,OAAO,CAIT;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1F"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Upload with Progress Tracking
3
+ *
4
+ * Cross-platform upload helper that provides real-time progress events.
5
+ * - Node.js: Uses http/https modules with chunked writes
6
+ * - Browser: Uses XMLHttpRequest with progress events
7
+ *
8
+ * Integrates with @plyaz/api global configuration:
9
+ * - Automatically merges global headers (auth, etc.)
10
+ * - Uses global timeout, baseURL, retry, onError, withCredentials
11
+ * - Respects API client configuration
12
+ */
13
+ import type { UploadWithProgressOptions, UploadWithProgressResult } from '@plyaz/types/api';
14
+ /**
15
+ * Upload data to a URL with progress tracking
16
+ *
17
+ * Automatically selects the appropriate implementation:
18
+ * - Node.js: Uses http/https modules with chunked writes
19
+ * - Browser: Uses XMLHttpRequest with progress events
20
+ *
21
+ * @param options - Upload options
22
+ * @returns Promise resolving to upload result
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const result = await uploadWithProgress({
27
+ * url: 'https://storage.example.com/upload',
28
+ * data: fileBuffer,
29
+ * contentType: 'application/pdf',
30
+ * onProgress: (event) => {
31
+ * console.log(`${event.percentage}% - ${event.speed} bytes/s`);
32
+ * },
33
+ * });
34
+ *
35
+ * if (result.success) {
36
+ * console.log('Upload complete!');
37
+ * }
38
+ * ```
39
+ */
40
+ export declare function uploadWithProgress(options: UploadWithProgressOptions): Promise<UploadWithProgressResult>;
41
+ //# sourceMappingURL=uploadWithProgress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadWithProgress.d.ts","sourceRoot":"","sources":["../../../src/api/upload/uploadWithProgress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAK5F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAKnC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Upload Utility Functions
3
+ */
4
+ import type { UploadProgressEvent, UploadState } from '@plyaz/types/api';
5
+ /**
6
+ * Resolve URL with baseURL if provided
7
+ */
8
+ export declare function resolveUrl(url: string, baseURL?: string): string;
9
+ /**
10
+ * Convert data to Buffer (Node.js) or ensure it's usable
11
+ */
12
+ export declare function normalizeData(data: Buffer | Blob | ArrayBuffer | Uint8Array): Buffer | Uint8Array;
13
+ /**
14
+ * Create initial upload state
15
+ */
16
+ export declare function createUploadState(totalSize: number): UploadState;
17
+ /**
18
+ * Calculate progress metrics
19
+ */
20
+ export declare function calculateProgress(state: UploadState): UploadProgressEvent;
21
+ /**
22
+ * Emit final progress event
23
+ */
24
+ export declare function emitFinalProgress(onProgress: ((event: UploadProgressEvent) => void) | undefined, totalSize: number, startTime: number): void;
25
+ /**
26
+ * Check if progress should be emitted based on throttling
27
+ */
28
+ export declare function shouldEmitProgress(state: UploadState, totalSize: number, throttleMs: number): boolean;
29
+ /**
30
+ * Parse response headers from Node.js response
31
+ */
32
+ export declare function parseNodeHeaders(headers: Record<string, string | string[] | undefined>): Record<string, string>;
33
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/api/upload/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKzE;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAUhE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CASjG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAUhE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAiBzE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC,GAAG,SAAS,EAC9D,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,IAAI,CAUN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAaT;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GACrD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxB"}