@plyaz/api 1.6.5 → 1.6.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.
- package/dist/api/endpoints/files.d.ts +38 -0
- package/dist/api/endpoints/files.d.ts.map +1 -0
- package/dist/api/endpoints/index.d.ts +29 -0
- package/dist/api/endpoints/index.d.ts.map +1 -1
- package/dist/api/services/files/DELETE/deleteFile.d.ts +28 -0
- package/dist/api/services/files/DELETE/deleteFile.d.ts.map +1 -0
- package/dist/api/services/files/DELETE/index.d.ts +7 -0
- package/dist/api/services/files/DELETE/index.d.ts.map +1 -0
- package/dist/api/services/files/DELETE/useDeleteFile.d.ts +33 -0
- package/dist/api/services/files/DELETE/useDeleteFile.d.ts.map +1 -0
- package/dist/api/services/files/GET/downloadFile.d.ts +37 -0
- package/dist/api/services/files/GET/downloadFile.d.ts.map +1 -0
- package/dist/api/services/files/GET/getFile.d.ts +26 -0
- package/dist/api/services/files/GET/getFile.d.ts.map +1 -0
- package/dist/api/services/files/GET/getSignedUrl.d.ts +34 -0
- package/dist/api/services/files/GET/getSignedUrl.d.ts.map +1 -0
- package/dist/api/services/files/GET/index.d.ts +11 -0
- package/dist/api/services/files/GET/index.d.ts.map +1 -0
- package/dist/api/services/files/GET/useDownloadFile.d.ts +41 -0
- package/dist/api/services/files/GET/useDownloadFile.d.ts.map +1 -0
- package/dist/api/services/files/GET/useGetFile.d.ts +31 -0
- package/dist/api/services/files/GET/useGetFile.d.ts.map +1 -0
- package/dist/api/services/files/GET/useGetSignedUrl.d.ts +40 -0
- package/dist/api/services/files/GET/useGetSignedUrl.d.ts.map +1 -0
- package/dist/api/services/files/POST/generateDocument.d.ts +42 -0
- package/dist/api/services/files/POST/generateDocument.d.ts.map +1 -0
- package/dist/api/services/files/POST/index.d.ts +11 -0
- package/dist/api/services/files/POST/index.d.ts.map +1 -0
- package/dist/api/services/files/POST/uploadFile.d.ts +40 -0
- package/dist/api/services/files/POST/uploadFile.d.ts.map +1 -0
- package/dist/api/services/files/POST/uploadFiles.d.ts +49 -0
- package/dist/api/services/files/POST/uploadFiles.d.ts.map +1 -0
- package/dist/api/services/files/POST/useGenerateDocument.d.ts +39 -0
- package/dist/api/services/files/POST/useGenerateDocument.d.ts.map +1 -0
- package/dist/api/services/files/POST/useUploadFile.d.ts +34 -0
- package/dist/api/services/files/POST/useUploadFile.d.ts.map +1 -0
- package/dist/api/services/files/POST/useUploadFiles.d.ts +36 -0
- package/dist/api/services/files/POST/useUploadFiles.d.ts.map +1 -0
- package/dist/api/services/files/index.d.ts +16 -0
- package/dist/api/services/files/index.d.ts.map +1 -0
- package/dist/api/services/index.d.ts +1 -0
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/entry-frontend.cjs +300 -0
- package/dist/entry-frontend.cjs.map +1 -1
- package/dist/entry-frontend.mjs +286 -1
- package/dist/entry-frontend.mjs.map +1 -1
- package/dist/index.cjs +300 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +286 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Files endpoints configuration
|
|
3
|
+
* Endpoints for file upload, download, and document generation via @plyaz/storage
|
|
4
|
+
*
|
|
5
|
+
* NOTE: Uses :id (UUID) as path param since files are stored in media table.
|
|
6
|
+
* Will integrate with db service and media repository for CRUD operations.
|
|
7
|
+
*/
|
|
8
|
+
export declare const filesEndpoints: {
|
|
9
|
+
readonly uploadFile: {
|
|
10
|
+
readonly url: "/upload";
|
|
11
|
+
readonly method: "POST";
|
|
12
|
+
};
|
|
13
|
+
readonly uploadFiles: {
|
|
14
|
+
readonly url: "/upload/bulk";
|
|
15
|
+
readonly method: "POST";
|
|
16
|
+
};
|
|
17
|
+
readonly generateDocument: {
|
|
18
|
+
readonly url: "/generate-document";
|
|
19
|
+
readonly method: "POST";
|
|
20
|
+
};
|
|
21
|
+
readonly downloadFile: {
|
|
22
|
+
readonly url: "/files/:id/download";
|
|
23
|
+
readonly method: "GET";
|
|
24
|
+
};
|
|
25
|
+
readonly getSignedUrl: {
|
|
26
|
+
readonly url: "/files/:id/signed-url";
|
|
27
|
+
readonly method: "GET";
|
|
28
|
+
};
|
|
29
|
+
readonly getFile: {
|
|
30
|
+
readonly url: "/files/:id";
|
|
31
|
+
readonly method: "GET";
|
|
32
|
+
};
|
|
33
|
+
readonly deleteFile: {
|
|
34
|
+
readonly url: "/files/:id";
|
|
35
|
+
readonly method: "DELETE";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCjB,CAAC"}
|
|
@@ -131,6 +131,34 @@ export declare const endpoints: {
|
|
|
131
131
|
readonly url: "/resources/:resourceId/reserve";
|
|
132
132
|
readonly method: "POST";
|
|
133
133
|
};
|
|
134
|
+
readonly uploadFile: {
|
|
135
|
+
readonly url: "/upload";
|
|
136
|
+
readonly method: "POST";
|
|
137
|
+
};
|
|
138
|
+
readonly uploadFiles: {
|
|
139
|
+
readonly url: "/upload/bulk";
|
|
140
|
+
readonly method: "POST";
|
|
141
|
+
};
|
|
142
|
+
readonly generateDocument: {
|
|
143
|
+
readonly url: "/generate-document";
|
|
144
|
+
readonly method: "POST";
|
|
145
|
+
};
|
|
146
|
+
readonly downloadFile: {
|
|
147
|
+
readonly url: "/files/:id/download";
|
|
148
|
+
readonly method: "GET";
|
|
149
|
+
};
|
|
150
|
+
readonly getSignedUrl: {
|
|
151
|
+
readonly url: "/files/:id/signed-url";
|
|
152
|
+
readonly method: "GET";
|
|
153
|
+
};
|
|
154
|
+
readonly getFile: {
|
|
155
|
+
readonly url: "/files/:id";
|
|
156
|
+
readonly method: "GET";
|
|
157
|
+
};
|
|
158
|
+
readonly deleteFile: {
|
|
159
|
+
readonly url: "/files/:id";
|
|
160
|
+
readonly method: "DELETE";
|
|
161
|
+
};
|
|
134
162
|
readonly evaluateFeatureFlag: {
|
|
135
163
|
readonly url: "/feature-flags/:key/evaluate";
|
|
136
164
|
readonly method: "POST";
|
|
@@ -218,6 +246,7 @@ export type EndpointsList = typeof endpoints;
|
|
|
218
246
|
*/
|
|
219
247
|
export { campaignEndpoints } from './campaigns';
|
|
220
248
|
export { featureFlagEndpoints } from './featureFlags';
|
|
249
|
+
export { filesEndpoints } from './files';
|
|
221
250
|
export { pollingEndpoints } from './polling';
|
|
222
251
|
export { infobipEndpoints, infobipEmailEndpoints } from './infobip';
|
|
223
252
|
export { virusTotalEndpoints } from './virustotal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,SAAS,CAAC;AAE7C;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEhG;;GAEG;AACH,OAAO,EAEL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete File Service
|
|
3
|
+
* Deletes a file from storage by ID
|
|
4
|
+
*/
|
|
5
|
+
import type { DeleteFileRequest, ServiceOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
7
|
+
import type { FetchResponse } from 'fetchff';
|
|
8
|
+
/**
|
|
9
|
+
* Delete a file from storage
|
|
10
|
+
* Uses endpoint: DELETE /files/:id
|
|
11
|
+
*
|
|
12
|
+
* @param request - Request with file ID
|
|
13
|
+
* @param options - Optional service options (client override, config overrides)
|
|
14
|
+
* @returns Promise<DeleteFileResponse>
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Delete a file by ID
|
|
19
|
+
* const result = await deleteFile({ id: '550e8400-e29b-41d4-a716-446655440000' });
|
|
20
|
+
* if (result.success) {
|
|
21
|
+
* console.log('File deleted successfully');
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @throws {ApiPackageError} When the file is not found or deletion fails
|
|
26
|
+
*/
|
|
27
|
+
export declare function deleteFile<TEndpoints = EndpointsList>(request: DeleteFileRequest, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
28
|
+
//# sourceMappingURL=deleteFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/DELETE/deleteFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,UAAU,CAAC,UAAU,GAAG,aAAa,EACzD,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CA2BxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/DELETE/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Query Mutation Hook for Deleting Files
|
|
3
|
+
* Provides mutation state and cache invalidation
|
|
4
|
+
*/
|
|
5
|
+
import { createApiMutation } from '../../../hooks/factories';
|
|
6
|
+
import type { DeleteFileRequest, DeleteFileResponse, ServiceOptions } from '@plyaz/types/api';
|
|
7
|
+
import type { ErrorResponse } from '@plyaz/types/errors';
|
|
8
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
9
|
+
/**
|
|
10
|
+
* Hook for deleting 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 } = useDeleteFile();
|
|
19
|
+
*
|
|
20
|
+
* const handleDelete = (fileId: string) => {
|
|
21
|
+
* mutate({ id: fileId }, {
|
|
22
|
+
* onSuccess: () => {
|
|
23
|
+
* toast.success('File deleted');
|
|
24
|
+
* },
|
|
25
|
+
* onError: (error) => {
|
|
26
|
+
* toast.error(`Failed to delete: ${error.message}`);
|
|
27
|
+
* }
|
|
28
|
+
* });
|
|
29
|
+
* };
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function useDeleteFile<TEndpoints = EndpointsList>(serviceOptions?: ServiceOptions<TEndpoints>, mutationOptions?: Parameters<ReturnType<typeof createApiMutation<DeleteFileResponse, ErrorResponse, DeleteFileRequest, unknown, TEndpoints>>>[1]): ReturnType<ReturnType<typeof createApiMutation<DeleteFileResponse, ErrorResponse, DeleteFileRequest, unknown, TEndpoints>>>;
|
|
33
|
+
//# sourceMappingURL=useDeleteFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/DELETE/useDeleteFile.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;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,CA4BA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Download File Service
|
|
3
|
+
* Downloads a file from storage by ID
|
|
4
|
+
*/
|
|
5
|
+
import type { DownloadFileRequest, ServiceOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
7
|
+
import type { FetchResponse } from 'fetchff';
|
|
8
|
+
/**
|
|
9
|
+
* Download a file from storage
|
|
10
|
+
* Uses endpoint: GET /files/:id/download
|
|
11
|
+
*
|
|
12
|
+
* @param request - Request with file ID
|
|
13
|
+
* @param options - Optional service options (client override, config overrides)
|
|
14
|
+
* @returns Promise<DownloadFileResponse>
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Download a file by ID
|
|
19
|
+
* const result = await downloadFile({ id: '550e8400-e29b-41d4-a716-446655440000' });
|
|
20
|
+
*
|
|
21
|
+
* // The result.buffer is base64 encoded
|
|
22
|
+
* const blob = new Blob([
|
|
23
|
+
* Uint8Array.from(atob(result.buffer), c => c.charCodeAt(0))
|
|
24
|
+
* ], { type: result.mimeType });
|
|
25
|
+
*
|
|
26
|
+
* // Create download link
|
|
27
|
+
* const url = URL.createObjectURL(blob);
|
|
28
|
+
* const a = document.createElement('a');
|
|
29
|
+
* a.href = url;
|
|
30
|
+
* a.download = result.filename || 'download';
|
|
31
|
+
* a.click();
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @throws {ApiPackageError} When the file is not found or download fails
|
|
35
|
+
*/
|
|
36
|
+
export declare function downloadFile<TEndpoints = EndpointsList>(request: DownloadFileRequest, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
37
|
+
//# sourceMappingURL=downloadFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/GET/downloadFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,YAAY,CAAC,UAAU,GAAG,aAAa,EAC3D,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CA8BxB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get File Service
|
|
3
|
+
* Gets file metadata by ID
|
|
4
|
+
*/
|
|
5
|
+
import type { GetFileRequest, ServiceOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
7
|
+
import type { FetchResponse } from 'fetchff';
|
|
8
|
+
/**
|
|
9
|
+
* Get file metadata by ID
|
|
10
|
+
* Uses endpoint: GET /files/:id
|
|
11
|
+
*
|
|
12
|
+
* @param request - Request with file ID
|
|
13
|
+
* @param options - Optional service options (client override, config overrides)
|
|
14
|
+
* @returns Promise<GetFileResponse>
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Get file metadata
|
|
19
|
+
* const file = await getFile({ id: '550e8400-e29b-41d4-a716-446655440000' });
|
|
20
|
+
* console.log(file.filename, file.mimeType, file.size);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @throws {ApiPackageError} When the file is not found
|
|
24
|
+
*/
|
|
25
|
+
export declare function getFile<TEndpoints = EndpointsList>(request: GetFileRequest, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
26
|
+
//# sourceMappingURL=getFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/GET/getFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,OAAO,CAAC,UAAU,GAAG,aAAa,EACtD,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CA2BxB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get Signed URL Service
|
|
3
|
+
* Gets a temporary signed URL for file access
|
|
4
|
+
*/
|
|
5
|
+
import type { GetSignedUrlRequest, ServiceOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
7
|
+
import type { FetchResponse } from 'fetchff';
|
|
8
|
+
/**
|
|
9
|
+
* Get a signed URL for temporary file access
|
|
10
|
+
* Uses endpoint: GET /files/:id/signed-url
|
|
11
|
+
*
|
|
12
|
+
* @param request - Request with file ID and optional expiration
|
|
13
|
+
* @param options - Optional service options (client override, config overrides)
|
|
14
|
+
* @returns Promise<GetSignedUrlResponse>
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Get a signed URL (default expiration)
|
|
19
|
+
* const { url, expiresAt } = await getSignedUrl({ id: '550e8400-e29b-41d4-a716-446655440000' });
|
|
20
|
+
*
|
|
21
|
+
* // Get a signed URL with custom expiration
|
|
22
|
+
* const { url } = await getSignedUrl({
|
|
23
|
+
* id: '550e8400-e29b-41d4-a716-446655440000',
|
|
24
|
+
* query: { expiresIn: 3600 } // 1 hour
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Use the signed URL
|
|
28
|
+
* window.open(url);
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @throws {ApiPackageError} When the file is not found
|
|
32
|
+
*/
|
|
33
|
+
export declare function getSignedUrl<TEndpoints = EndpointsList>(request: GetSignedUrlRequest, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
34
|
+
//# sourceMappingURL=getSignedUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSignedUrl.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/GET/getSignedUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,wBAAsB,YAAY,CAAC,UAAU,GAAG,aAAa,EAC3D,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CA4BxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Files GET Operations
|
|
3
|
+
* Exports all GET services and hooks for file operations
|
|
4
|
+
*/
|
|
5
|
+
export { getFile } from './getFile';
|
|
6
|
+
export { downloadFile } from './downloadFile';
|
|
7
|
+
export { getSignedUrl } from './getSignedUrl';
|
|
8
|
+
export { useGetFile } from './useGetFile';
|
|
9
|
+
export { useDownloadFile } from './useDownloadFile';
|
|
10
|
+
export { useGetSignedUrl } from './useGetSignedUrl';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/GET/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Query Hook for Downloading Files
|
|
3
|
+
* Provides caching and state management for file downloads
|
|
4
|
+
*/
|
|
5
|
+
import type { DownloadFileRequest, DownloadFileResponse, ServiceOptions, QueryKey, UseQueryResult, ApiQueryOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { ErrorResponse } from '@plyaz/types/errors';
|
|
7
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
8
|
+
/**
|
|
9
|
+
* Hook for downloading a file
|
|
10
|
+
*
|
|
11
|
+
* @param queryKey - React Query cache key
|
|
12
|
+
* @param request - Request with file ID
|
|
13
|
+
* @param serviceOptions - Optional service options (apiClient override, apiConfig override)
|
|
14
|
+
* @param queryOptions - Optional React Query options (enabled, staleTime, etc.)
|
|
15
|
+
* @returns React Query result with download data
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* function FileViewer({ fileId }: Props) {
|
|
20
|
+
* const { data, isLoading, error } = useDownloadFile(
|
|
21
|
+
* ['file', fileId],
|
|
22
|
+
* { id: fileId },
|
|
23
|
+
* undefined,
|
|
24
|
+
* { enabled: !!fileId }
|
|
25
|
+
* );
|
|
26
|
+
*
|
|
27
|
+
* if (isLoading) return <Spinner />;
|
|
28
|
+
* if (error) return <ErrorMessage error={error} />;
|
|
29
|
+
*
|
|
30
|
+
* // Convert base64 to blob URL
|
|
31
|
+
* const blob = new Blob([
|
|
32
|
+
* Uint8Array.from(atob(data.buffer), c => c.charCodeAt(0))
|
|
33
|
+
* ], { type: data.mimeType });
|
|
34
|
+
* const blobUrl = URL.createObjectURL(blob);
|
|
35
|
+
*
|
|
36
|
+
* return <iframe src={blobUrl} />;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useDownloadFile<TEndpoints = EndpointsList>(queryKey: QueryKey, request: DownloadFileRequest, serviceOptions?: ServiceOptions<TEndpoints>, queryOptions?: Omit<ApiQueryOptions<DownloadFileResponse, ErrorResponse>, 'apiClient' | 'apiConfig'>): UseQueryResult<DownloadFileResponse, ErrorResponse>;
|
|
41
|
+
//# sourceMappingURL=useDownloadFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDownloadFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/GET/useDownloadFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAG,aAAa,EACxD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,mBAAmB,EAC5B,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,CAAC,oBAAoB,EAAE,aAAa,CAAC,EACpD,WAAW,GAAG,WAAW,CAC1B,GACA,cAAc,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAarD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Query Hook for Getting File Metadata
|
|
3
|
+
* Provides query state and caching
|
|
4
|
+
*/
|
|
5
|
+
import type { GetFileRequest, GetFileResponse, ServiceOptions, QueryKey, UseQueryResult, ApiQueryOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { ErrorResponse } from '@plyaz/types/errors';
|
|
7
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
8
|
+
/**
|
|
9
|
+
* Hook for getting file metadata
|
|
10
|
+
*
|
|
11
|
+
* @param queryKey - React Query cache key
|
|
12
|
+
* @param request - Request with file ID
|
|
13
|
+
* @param serviceOptions - Service options (apiClient, apiConfig, updateConfigOptions)
|
|
14
|
+
* @param queryOptions - React Query options
|
|
15
|
+
* @returns React Query result
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const { data: file, isLoading } = useGetFile(
|
|
20
|
+
* ['file', fileId],
|
|
21
|
+
* { id: fileId },
|
|
22
|
+
* undefined,
|
|
23
|
+
* { enabled: !!fileId }
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* if (isLoading) return <Spinner />;
|
|
27
|
+
* return <div>{file.filename} - {file.size} bytes</div>;
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function useGetFile<TEndpoints = EndpointsList>(queryKey: QueryKey, request: GetFileRequest, serviceOptions?: ServiceOptions<TEndpoints>, queryOptions?: Omit<ApiQueryOptions<GetFileResponse, ErrorResponse>, 'apiClient' | 'apiConfig'>): UseQueryResult<GetFileResponse, ErrorResponse>;
|
|
31
|
+
//# sourceMappingURL=useGetFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/GET/useGetFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,UAAU,GAAG,aAAa,EACnD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,cAAc,EACvB,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,YAAY,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,aAAa,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC,GAC9F,cAAc,CAAC,eAAe,EAAE,aAAa,CAAC,CAahD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Query Hook for Getting Signed URLs
|
|
3
|
+
* Provides caching and state management for signed URL generation
|
|
4
|
+
*/
|
|
5
|
+
import type { GetSignedUrlRequest, GetSignedUrlResponse, ServiceOptions, QueryKey, UseQueryResult, ApiQueryOptions } from '@plyaz/types/api';
|
|
6
|
+
import type { ErrorResponse } from '@plyaz/types/errors';
|
|
7
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
8
|
+
/**
|
|
9
|
+
* Hook for getting signed URLs
|
|
10
|
+
*
|
|
11
|
+
* Note: Signed URLs expire, so consider short staleTime values
|
|
12
|
+
* or refetch on window focus for security-sensitive scenarios.
|
|
13
|
+
*
|
|
14
|
+
* @param queryKey - React Query cache key
|
|
15
|
+
* @param request - Request with file ID and optional expiration
|
|
16
|
+
* @param serviceOptions - Optional service options (apiClient override, apiConfig override)
|
|
17
|
+
* @param queryOptions - Optional React Query options (enabled, staleTime, etc.)
|
|
18
|
+
* @returns React Query result with signed URL data
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* function FileLink({ fileId }: Props) {
|
|
23
|
+
* const { data, isLoading } = useGetSignedUrl(
|
|
24
|
+
* ['signedUrl', fileId],
|
|
25
|
+
* { id: fileId, query: { expiresIn: 300 } }, // 5 minutes
|
|
26
|
+
* undefined,
|
|
27
|
+
* {
|
|
28
|
+
* enabled: !!fileId,
|
|
29
|
+
* staleTime: 4 * 60 * 1000, // Refetch 1 minute before expiry
|
|
30
|
+
* }
|
|
31
|
+
* );
|
|
32
|
+
*
|
|
33
|
+
* if (isLoading) return <Spinner />;
|
|
34
|
+
*
|
|
35
|
+
* return <a href={data?.url}>Download File</a>;
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function useGetSignedUrl<TEndpoints = EndpointsList>(queryKey: QueryKey, request: GetSignedUrlRequest, serviceOptions?: ServiceOptions<TEndpoints>, queryOptions?: Omit<ApiQueryOptions<GetSignedUrlResponse, ErrorResponse>, 'apiClient' | 'apiConfig'>): UseQueryResult<GetSignedUrlResponse, ErrorResponse>;
|
|
40
|
+
//# sourceMappingURL=useGetSignedUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetSignedUrl.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/GET/useGetSignedUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAG,aAAa,EACxD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,mBAAmB,EAC5B,cAAc,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAC3C,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,CAAC,oBAAoB,EAAE,aAAa,CAAC,EACpD,WAAW,GAAG,WAAW,CAC1B,GACA,cAAc,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAarD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate Document Service
|
|
3
|
+
* Generates a document from a template without uploading
|
|
4
|
+
*/
|
|
5
|
+
import type { GenerateDocumentRequest } from '@plyaz/types/api';
|
|
6
|
+
import type { ServiceOptions } from '@plyaz/types/api';
|
|
7
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
8
|
+
import type { FetchResponse } from 'fetchff';
|
|
9
|
+
/**
|
|
10
|
+
* Generate a document from a template
|
|
11
|
+
* Uses endpoint: POST /generate-document
|
|
12
|
+
*
|
|
13
|
+
* Returns the generated document as a base64-encoded buffer without uploading.
|
|
14
|
+
* Useful for preview or direct download scenarios.
|
|
15
|
+
*
|
|
16
|
+
* @param data - Document generation request data
|
|
17
|
+
* @param options - Optional service options (client override, config overrides)
|
|
18
|
+
* @returns Promise<GenerateDocumentResponse>
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Generate a PDF invoice
|
|
23
|
+
* const result = await generateDocument({
|
|
24
|
+
* templateId: 'invoices/standard-invoice',
|
|
25
|
+
* templateData: {
|
|
26
|
+
* invoiceNumber: 'INV-001',
|
|
27
|
+
* customerName: 'John Doe',
|
|
28
|
+
* items: [{ description: 'Product', quantity: 2, unitPrice: 50 }],
|
|
29
|
+
* },
|
|
30
|
+
* outputFormat: 'pdf',
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // The result.buffer is base64 encoded
|
|
34
|
+
* const pdfBlob = new Blob([
|
|
35
|
+
* Uint8Array.from(atob(result.buffer), c => c.charCodeAt(0))
|
|
36
|
+
* ], { type: 'application/pdf' });
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @throws {ApiPackageError} When document generation fails
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateDocument<TEndpoints = EndpointsList>(data: GenerateDocumentRequest, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
42
|
+
//# sourceMappingURL=generateDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateDocument.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/POST/generateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,GAAG,aAAa,EAC/D,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CAqBxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Files POST Operations
|
|
3
|
+
* Exports all POST services and hooks for file operations
|
|
4
|
+
*/
|
|
5
|
+
export { uploadFile } from './uploadFile';
|
|
6
|
+
export { uploadFiles } from './uploadFiles';
|
|
7
|
+
export { generateDocument } from './generateDocument';
|
|
8
|
+
export { useUploadFile } from './useUploadFile';
|
|
9
|
+
export { useUploadFiles } from './useUploadFiles';
|
|
10
|
+
export { useGenerateDocument } from './useGenerateDocument';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/POST/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload File Service
|
|
3
|
+
* Uploads a file to storage with optional template-based generation
|
|
4
|
+
*/
|
|
5
|
+
import type { UploadFileRequest } from '@plyaz/types/api';
|
|
6
|
+
import type { ServiceOptions } from '@plyaz/types/api';
|
|
7
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
8
|
+
import type { FetchResponse } from 'fetchff';
|
|
9
|
+
/**
|
|
10
|
+
* Upload a file to storage
|
|
11
|
+
* Uses endpoint: POST /upload
|
|
12
|
+
*
|
|
13
|
+
* Supports:
|
|
14
|
+
* - Direct file upload (with metadata)
|
|
15
|
+
* - Template-based document generation (when templateId is provided)
|
|
16
|
+
*
|
|
17
|
+
* @param data - Upload request data
|
|
18
|
+
* @param options - Optional service options (client override, config overrides)
|
|
19
|
+
* @returns Promise<UploadFileResponse>
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Template-based generation with upload
|
|
24
|
+
* const result = await uploadFile({
|
|
25
|
+
* templateId: 'invoices/standard-invoice',
|
|
26
|
+
* templateData: { invoiceNumber: 'INV-001', total: 100 },
|
|
27
|
+
* filename: 'invoice.pdf',
|
|
28
|
+
* outputFormat: 'pdf',
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // With custom timeout for large files
|
|
32
|
+
* const result = await uploadFile(data, {
|
|
33
|
+
* apiConfig: { timeout: 120000 }
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @throws {ApiPackageError} When the upload fails
|
|
38
|
+
*/
|
|
39
|
+
export declare function uploadFile<TEndpoints = EndpointsList>(data: UploadFileRequest, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
40
|
+
//# sourceMappingURL=uploadFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/POST/uploadFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,UAAU,CAAC,UAAU,GAAG,aAAa,EACzD,IAAI,EAAE,iBAAiB,EACvB,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CAqBxB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload Files (Bulk) Service
|
|
3
|
+
* Uploads multiple files to storage with concurrency control
|
|
4
|
+
*/
|
|
5
|
+
import type { UploadFilesRequest } from '@plyaz/types/api';
|
|
6
|
+
import type { ServiceOptions } from '@plyaz/types/api';
|
|
7
|
+
import type { EndpointsList } from '@/api/endpoints';
|
|
8
|
+
import type { FetchResponse } from 'fetchff';
|
|
9
|
+
/**
|
|
10
|
+
* Upload multiple files to storage
|
|
11
|
+
* Uses endpoint: POST /upload/bulk
|
|
12
|
+
*
|
|
13
|
+
* Supports:
|
|
14
|
+
* - Parallel uploads with concurrency control
|
|
15
|
+
* - Continue on error (partial success)
|
|
16
|
+
* - Queue mode for background processing
|
|
17
|
+
*
|
|
18
|
+
* @param data - Bulk upload request data (files array + options)
|
|
19
|
+
* @param options - Optional service options (client override, config overrides)
|
|
20
|
+
* @returns Promise<UploadFilesResponse>
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Upload multiple files with default concurrency
|
|
25
|
+
* const result = await uploadFiles({
|
|
26
|
+
* files: [
|
|
27
|
+
* { base64: '...', mimeType: 'image/png', category: 'images', entityType: 'user', entityId: 'user-1' },
|
|
28
|
+
* { base64: '...', mimeType: 'image/jpeg', category: 'images', entityType: 'user', entityId: 'user-1' },
|
|
29
|
+
* ]
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // With concurrency control and continue on error
|
|
33
|
+
* const result = await uploadFiles({
|
|
34
|
+
* files: [...],
|
|
35
|
+
* options: {
|
|
36
|
+
* concurrency: 3,
|
|
37
|
+
* continueOnError: true
|
|
38
|
+
* }
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Check results
|
|
42
|
+
* console.log(result.summary); // { total: 5, succeeded: 4, failed: 1 }
|
|
43
|
+
* console.log(result.allSucceeded); // false
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @throws {ApiPackageError} When all uploads fail (unless continueOnError is true)
|
|
47
|
+
*/
|
|
48
|
+
export declare function uploadFiles<TEndpoints = EndpointsList>(data: UploadFilesRequest, options?: ServiceOptions<TEndpoints>): Promise<FetchResponse>;
|
|
49
|
+
//# sourceMappingURL=uploadFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadFiles.d.ts","sourceRoot":"","sources":["../../../../../src/api/services/files/POST/uploadFiles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,WAAW,CAAC,UAAU,GAAG,aAAa,EAC1D,IAAI,EAAE,kBAAkB,EACxB,OAAO,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CAqBxB"}
|
|
@@ -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"}
|