@contember/bindx-uploader 0.1.0
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/UploaderError.d.ts +6 -0
- package/dist/UploaderError.d.ts.map +1 -0
- package/dist/components/MultiUploader.d.ts +43 -0
- package/dist/components/MultiUploader.d.ts.map +1 -0
- package/dist/components/Uploader.d.ts +58 -0
- package/dist/components/Uploader.d.ts.map +1 -0
- package/dist/components/UploaderDropzoneArea.d.ts +6 -0
- package/dist/components/UploaderDropzoneArea.d.ts.map +1 -0
- package/dist/components/UploaderDropzoneRoot.d.ts +8 -0
- package/dist/components/UploaderDropzoneRoot.d.ts.map +1 -0
- package/dist/components/UploaderEachFile.d.ts +14 -0
- package/dist/components/UploaderEachFile.d.ts.map +1 -0
- package/dist/components/UploaderFileStateSwitch.d.ts +24 -0
- package/dist/components/UploaderFileStateSwitch.d.ts.map +1 -0
- package/dist/components/UploaderHasFile.d.ts +14 -0
- package/dist/components/UploaderHasFile.d.ts.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/contexts.d.ts +32 -0
- package/dist/contexts.d.ts.map +1 -0
- package/dist/extractors/getAudioFileDataExtractor.d.ts +9 -0
- package/dist/extractors/getAudioFileDataExtractor.d.ts.map +1 -0
- package/dist/extractors/getFileUrlDataExtractor.d.ts +9 -0
- package/dist/extractors/getFileUrlDataExtractor.d.ts.map +1 -0
- package/dist/extractors/getGenericFileMetadataExtractor.d.ts +12 -0
- package/dist/extractors/getGenericFileMetadataExtractor.d.ts.map +1 -0
- package/dist/extractors/getImageFileDataExtractor.d.ts +10 -0
- package/dist/extractors/getImageFileDataExtractor.d.ts.map +1 -0
- package/dist/extractors/getVideoFileDataExtractor.d.ts +11 -0
- package/dist/extractors/getVideoFileDataExtractor.d.ts.map +1 -0
- package/dist/extractors/index.d.ts +6 -0
- package/dist/extractors/index.d.ts.map +1 -0
- package/dist/extractors/types.d.ts +13 -0
- package/dist/extractors/types.d.ts.map +1 -0
- package/dist/fileTypes/createAnyFileType.d.ts +27 -0
- package/dist/fileTypes/createAnyFileType.d.ts.map +1 -0
- package/dist/fileTypes/createAudioFileType.d.ts +29 -0
- package/dist/fileTypes/createAudioFileType.d.ts.map +1 -0
- package/dist/fileTypes/createImageFileType.d.ts +47 -0
- package/dist/fileTypes/createImageFileType.d.ts.map +1 -0
- package/dist/fileTypes/createVideoFileType.d.ts +33 -0
- package/dist/fileTypes/createVideoFileType.d.ts.map +1 -0
- package/dist/fileTypes/index.d.ts +5 -0
- package/dist/fileTypes/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useS3Client.d.ts +7 -0
- package/dist/hooks/useS3Client.d.ts.map +1 -0
- package/dist/hooks/useUploaderStateFiles.d.ts +8 -0
- package/dist/hooks/useUploaderStateFiles.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/internal/hooks/index.d.ts +5 -0
- package/dist/internal/hooks/index.d.ts.map +1 -0
- package/dist/internal/hooks/useFillEntity.d.ts +17 -0
- package/dist/internal/hooks/useFillEntity.d.ts.map +1 -0
- package/dist/internal/hooks/useGetPreviewUrls.d.ts +6 -0
- package/dist/internal/hooks/useGetPreviewUrls.d.ts.map +1 -0
- package/dist/internal/hooks/useUploadState.d.ts +12 -0
- package/dist/internal/hooks/useUploadState.d.ts.map +1 -0
- package/dist/internal/hooks/useUploaderDoUpload.d.ts +7 -0
- package/dist/internal/hooks/useUploaderDoUpload.d.ts.map +1 -0
- package/dist/internal/utils/executeExtractors.d.ts +16 -0
- package/dist/internal/utils/executeExtractors.d.ts.map +1 -0
- package/dist/internal/utils/index.d.ts +4 -0
- package/dist/internal/utils/index.d.ts.map +1 -0
- package/dist/internal/utils/resolveAccept.d.ts +7 -0
- package/dist/internal/utils/resolveAccept.d.ts.map +1 -0
- package/dist/internal/utils/uploaderErrorHandler.d.ts +7 -0
- package/dist/internal/utils/uploaderErrorHandler.d.ts.map +1 -0
- package/dist/types.d.ts +168 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/uploadClient/S3UploadClient.d.ts +19 -0
- package/dist/uploadClient/S3UploadClient.d.ts.map +1 -0
- package/dist/uploadClient/index.d.ts +3 -0
- package/dist/uploadClient/index.d.ts.map +1 -0
- package/dist/uploadClient/types.d.ts +29 -0
- package/dist/uploadClient/types.d.ts.map +1 -0
- package/dist/utils/attrAccept.d.ts +16 -0
- package/dist/utils/attrAccept.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/urlSigner.d.ts +8 -0
- package/dist/utils/urlSigner.d.ts.map +1 -0
- package/package.json +35 -0
- package/src/UploaderError.ts +7 -0
- package/src/components/MultiUploader.tsx +210 -0
- package/src/components/Uploader.tsx +174 -0
- package/src/components/UploaderDropzoneArea.tsx +29 -0
- package/src/components/UploaderDropzoneRoot.tsx +32 -0
- package/src/components/UploaderEachFile.tsx +46 -0
- package/src/components/UploaderFileStateSwitch.tsx +66 -0
- package/src/components/UploaderHasFile.tsx +35 -0
- package/src/components/index.ts +7 -0
- package/src/contexts.ts +76 -0
- package/src/extractors/getAudioFileDataExtractor.ts +44 -0
- package/src/extractors/getFileUrlDataExtractor.ts +22 -0
- package/src/extractors/getGenericFileMetadataExtractor.ts +40 -0
- package/src/extractors/getImageFileDataExtractor.ts +50 -0
- package/src/extractors/getVideoFileDataExtractor.ts +60 -0
- package/src/extractors/index.ts +5 -0
- package/src/extractors/types.ts +14 -0
- package/src/fileTypes/createAnyFileType.ts +56 -0
- package/src/fileTypes/createAudioFileType.ts +67 -0
- package/src/fileTypes/createImageFileType.ts +87 -0
- package/src/fileTypes/createVideoFileType.ts +75 -0
- package/src/fileTypes/index.ts +4 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useS3Client.ts +26 -0
- package/src/hooks/useUploaderStateFiles.ts +22 -0
- package/src/index.ts +126 -0
- package/src/internal/hooks/index.ts +4 -0
- package/src/internal/hooks/useFillEntity.ts +89 -0
- package/src/internal/hooks/useGetPreviewUrls.ts +26 -0
- package/src/internal/hooks/useUploadState.ts +159 -0
- package/src/internal/hooks/useUploaderDoUpload.ts +129 -0
- package/src/internal/utils/executeExtractors.ts +46 -0
- package/src/internal/utils/index.ts +3 -0
- package/src/internal/utils/resolveAccept.ts +26 -0
- package/src/internal/utils/uploaderErrorHandler.ts +15 -0
- package/src/types.ts +242 -0
- package/src/uploadClient/S3UploadClient.ts +119 -0
- package/src/uploadClient/index.ts +2 -0
- package/src/uploadClient/types.ts +30 -0
- package/src/utils/attrAccept.ts +87 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/urlSigner.ts +117 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useUploadState, type UseUploadStateResult } from './useUploadState.js';
|
|
2
|
+
export { useUploaderDoUpload } from './useUploaderDoUpload.js';
|
|
3
|
+
export { useGetPreviewUrls } from './useGetPreviewUrls.js';
|
|
4
|
+
export { useFillEntity, type UseFillEntityArgs } from './useFillEntity.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EntityRef, HasOneRef } from '@contember/bindx';
|
|
2
|
+
import type { FileType, UploaderEvents } from '../../types.js';
|
|
3
|
+
export interface UseFillEntityArgs<TEntity = Record<string, unknown>> extends UploaderEvents {
|
|
4
|
+
/**
|
|
5
|
+
* The entity to fill. Can be:
|
|
6
|
+
* - EntityRef: fill the entity directly
|
|
7
|
+
* - HasOneRef: fill the related entity (disconnect first on upload start)
|
|
8
|
+
*/
|
|
9
|
+
entity: EntityRef<TEntity> | HasOneRef<TEntity>;
|
|
10
|
+
fileType: FileType<TEntity>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Hook that connects upload events to entity field population.
|
|
14
|
+
* Handles both direct EntityRef and HasOneRef (for has-one relations).
|
|
15
|
+
*/
|
|
16
|
+
export declare const useFillEntity: <TEntity extends Record<string, unknown>>({ entity, fileType, ...events }: UseFillEntityArgs<TEntity>) => UploaderEvents;
|
|
17
|
+
//# sourceMappingURL=useFillEntity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFillEntity.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useFillEntity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAoB,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAIhF,MAAM,WAAW,iBAAiB,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,cAAc;IAC3F;;;;OAIG;IACH,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/C,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;CAC3B;AAoBD;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,iCAIpE,iBAAiB,CAAC,OAAO,CAAC,KAAG,cA8C/B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetPreviewUrls.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useGetPreviewUrls.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAmB3D,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UploaderEvents, UploaderState } from '../../types.js';
|
|
2
|
+
export interface UseUploadStateResult extends UploaderEvents {
|
|
3
|
+
files: UploaderState;
|
|
4
|
+
purgeFinal: () => void;
|
|
5
|
+
purgeAll: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hook that manages the upload state machine.
|
|
9
|
+
* Tracks file states through the upload lifecycle: initial -> uploading -> finalizing -> success/error
|
|
10
|
+
*/
|
|
11
|
+
export declare const useUploadState: ({ onBeforeUpload, onStartUpload, onSuccess, onError, onProgress, onAfterUpload, }: UploaderEvents) => UseUploadStateResult;
|
|
12
|
+
//# sourceMappingURL=useUploadState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploadState.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useUploadState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAOX,cAAc,EAEd,aAAa,EACb,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC3D,KAAK,EAAE,aAAa,CAAA;IACpB,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,mFAO5B,cAAc,KAAG,oBAgInB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UploaderEvents } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that orchestrates the file upload process.
|
|
4
|
+
* Handles file preparation, validation, and upload execution.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useUploaderDoUpload: ({ onBeforeUpload, onError, onProgress, onSuccess, onStartUpload, onAfterUpload, }: UploaderEvents) => ((files: File[]) => Promise<void>);
|
|
7
|
+
//# sourceMappingURL=useUploaderDoUpload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploaderDoUpload.d.ts","sourceRoot":"","sources":["../../../src/internal/hooks/useUploaderDoUpload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAKlE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,mFAOjC,cAAc,KAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CA+GpD,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EntityRef } from '@contember/bindx';
|
|
2
|
+
import type { FileType, FileWithMeta, FileUploadResult } from '../../types.js';
|
|
3
|
+
interface ExecuteExtractorsArgs {
|
|
4
|
+
fileType: FileType;
|
|
5
|
+
file: FileWithMeta;
|
|
6
|
+
result: FileUploadResult;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Executes all extractors for a file type and returns a populator function
|
|
10
|
+
* that can be used to fill entity fields.
|
|
11
|
+
*/
|
|
12
|
+
export declare const executeExtractors: ({ fileType, file, result, }: ExecuteExtractorsArgs) => Promise<((options: {
|
|
13
|
+
entity: EntityRef<unknown>;
|
|
14
|
+
}) => void) | undefined>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=executeExtractors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeExtractors.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/executeExtractors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAE9E,UAAU,qBAAqB;IAC9B,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,YAAY,CAAA;IAClB,MAAM,EAAE,gBAAgB,CAAA;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAU,6BAIrC,qBAAqB,KAAG,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;CAAE,KAAK,IAAI,CAAC,GAAG,SAAS,CA4BjG,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FileType, FileWithMeta } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a file is accepted by a single file type.
|
|
4
|
+
* Returns false if rejected, true if accepted.
|
|
5
|
+
*/
|
|
6
|
+
export declare const resolveAcceptingSingleType: (file: FileWithMeta, fileType: FileType) => Promise<boolean>;
|
|
7
|
+
//# sourceMappingURL=resolveAccept.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAccept.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/resolveAccept.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG5D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GACtC,MAAM,YAAY,EAClB,UAAU,QAAQ,KAChB,OAAO,CAAC,OAAO,CAejB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ErrorEvent } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default error handler that filters out expected errors (fileRejected, aborted)
|
|
4
|
+
* and logs unexpected errors.
|
|
5
|
+
*/
|
|
6
|
+
export declare const uploaderErrorHandler: (event: ErrorEvent) => void;
|
|
7
|
+
//# sourceMappingURL=uploaderErrorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploaderErrorHandler.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/uploaderErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,UAAU,KAAG,IAOxD,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import type { EntityRef } from '@contember/bindx';
|
|
2
|
+
export interface UploadClient<Options = unknown, Result extends FileUploadResult = FileUploadResult> {
|
|
3
|
+
upload: (args: UploadClientUploadArgs & Omit<Options, keyof UploadClientUploadArgs>) => Promise<Result>;
|
|
4
|
+
}
|
|
5
|
+
export interface FileUploadResult {
|
|
6
|
+
publicUrl: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FileUploadProgress {
|
|
9
|
+
progress: number;
|
|
10
|
+
uploadedBytes: number;
|
|
11
|
+
totalBytes: number;
|
|
12
|
+
}
|
|
13
|
+
export interface UploadClientUploadArgs {
|
|
14
|
+
file: File;
|
|
15
|
+
signal: AbortSignal;
|
|
16
|
+
onProgress: (progress: FileUploadProgress) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface FileWithMeta {
|
|
19
|
+
id: string;
|
|
20
|
+
file: File;
|
|
21
|
+
previewUrl: string;
|
|
22
|
+
abortController: AbortController;
|
|
23
|
+
}
|
|
24
|
+
export interface UploaderFileStateInitial {
|
|
25
|
+
state: 'initial';
|
|
26
|
+
file: FileWithMeta;
|
|
27
|
+
}
|
|
28
|
+
export interface UploaderFileStateUploading {
|
|
29
|
+
state: 'uploading';
|
|
30
|
+
file: FileWithMeta;
|
|
31
|
+
progress: FileUploadProgress;
|
|
32
|
+
}
|
|
33
|
+
export interface UploaderFileStateFinalizing {
|
|
34
|
+
state: 'finalizing';
|
|
35
|
+
file: FileWithMeta;
|
|
36
|
+
result: FileUploadResult;
|
|
37
|
+
}
|
|
38
|
+
export interface UploaderFileStateSuccess {
|
|
39
|
+
state: 'success';
|
|
40
|
+
file: FileWithMeta;
|
|
41
|
+
result: FileUploadResult;
|
|
42
|
+
dismiss: () => void;
|
|
43
|
+
}
|
|
44
|
+
export interface UploaderFileStateError {
|
|
45
|
+
state: 'error';
|
|
46
|
+
file: FileWithMeta;
|
|
47
|
+
error: unknown;
|
|
48
|
+
dismiss: () => void;
|
|
49
|
+
}
|
|
50
|
+
export type UploaderFileState = UploaderFileStateInitial | UploaderFileStateUploading | UploaderFileStateFinalizing | UploaderFileStateSuccess | UploaderFileStateError;
|
|
51
|
+
export type UploaderState = UploaderFileState[];
|
|
52
|
+
export interface BeforeUploadEvent {
|
|
53
|
+
file: FileWithMeta;
|
|
54
|
+
reject: (reason: string) => never;
|
|
55
|
+
}
|
|
56
|
+
export interface StartUploadEvent {
|
|
57
|
+
file: FileWithMeta;
|
|
58
|
+
fileType: FileType;
|
|
59
|
+
}
|
|
60
|
+
export interface ProgressEvent {
|
|
61
|
+
file: FileWithMeta;
|
|
62
|
+
progress: FileUploadProgress;
|
|
63
|
+
fileType: FileType;
|
|
64
|
+
}
|
|
65
|
+
export interface SuccessEvent {
|
|
66
|
+
file: FileWithMeta;
|
|
67
|
+
result: FileUploadResult;
|
|
68
|
+
fileType: FileType;
|
|
69
|
+
}
|
|
70
|
+
export interface AfterUploadEvent {
|
|
71
|
+
file: FileWithMeta;
|
|
72
|
+
result: FileUploadResult;
|
|
73
|
+
fileType: FileType;
|
|
74
|
+
}
|
|
75
|
+
export interface ErrorEvent {
|
|
76
|
+
file: FileWithMeta;
|
|
77
|
+
error: unknown;
|
|
78
|
+
fileType?: FileType;
|
|
79
|
+
}
|
|
80
|
+
export interface UploaderEvents {
|
|
81
|
+
onBeforeUpload: (event: BeforeUploadEvent) => Promise<FileType | undefined>;
|
|
82
|
+
onStartUpload: (event: StartUploadEvent) => void;
|
|
83
|
+
onProgress: (event: ProgressEvent) => void;
|
|
84
|
+
onAfterUpload: (event: AfterUploadEvent) => Promise<void> | void;
|
|
85
|
+
onSuccess: (event: SuccessEvent) => void;
|
|
86
|
+
onError: (event: ErrorEvent) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Extract string keys from entity type (field names).
|
|
90
|
+
*/
|
|
91
|
+
export type FieldName<TEntity> = keyof TEntity & string;
|
|
92
|
+
/**
|
|
93
|
+
* Result from file data extraction that can populate entity fields
|
|
94
|
+
*/
|
|
95
|
+
export type FileDataExtractorPopulator<TEntity> = (options: {
|
|
96
|
+
entity: EntityRef<TEntity>;
|
|
97
|
+
result: FileUploadResult;
|
|
98
|
+
}) => void;
|
|
99
|
+
/**
|
|
100
|
+
* File data extractor interface for bindx.
|
|
101
|
+
* Provides field names for selection collection and data extraction/population methods.
|
|
102
|
+
*/
|
|
103
|
+
export interface FileDataExtractor<TEntity = Record<string, unknown>> {
|
|
104
|
+
/**
|
|
105
|
+
* Returns the field names this extractor will populate.
|
|
106
|
+
* Used by the selection system to know which fields to fetch.
|
|
107
|
+
*/
|
|
108
|
+
getFieldNames: () => FieldName<TEntity>[];
|
|
109
|
+
/**
|
|
110
|
+
* Extract data from the file (async, e.g., image dimensions)
|
|
111
|
+
*/
|
|
112
|
+
extractFileData?: (file: FileWithMeta) => Promise<FileDataExtractorPopulator<TEntity> | undefined> | FileDataExtractorPopulator<TEntity> | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Populate entity fields synchronously (e.g., URL field from upload result)
|
|
115
|
+
*/
|
|
116
|
+
populateFields?: (options: {
|
|
117
|
+
entity: EntityRef<TEntity>;
|
|
118
|
+
result: FileUploadResult;
|
|
119
|
+
}) => void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Configuration for a file type that defines how files are handled.
|
|
123
|
+
*/
|
|
124
|
+
export interface FileType<TEntity = Record<string, unknown>> {
|
|
125
|
+
/**
|
|
126
|
+
* Accepted MIME types and extensions.
|
|
127
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker#accept
|
|
128
|
+
* undefined means "any mime type"
|
|
129
|
+
*/
|
|
130
|
+
accept?: Record<string, string[]> | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Custom file validation. Optionally reject with rejection reason.
|
|
133
|
+
*/
|
|
134
|
+
acceptFile?: ((file: FileWithMeta) => boolean | Promise<void>) | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Data extractors for this file type
|
|
137
|
+
*/
|
|
138
|
+
extractors?: FileDataExtractor<TEntity>[];
|
|
139
|
+
/**
|
|
140
|
+
* Custom upload client (overrides default)
|
|
141
|
+
*/
|
|
142
|
+
uploader?: UploadClient<unknown>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* File type with optional base field for discriminated uploads.
|
|
146
|
+
*/
|
|
147
|
+
export interface DiscriminatedFileType<TEntity = Record<string, unknown>> extends FileType<TEntity> {
|
|
148
|
+
/**
|
|
149
|
+
* Base field name for has-one relation (e.g., 'image' for article.image)
|
|
150
|
+
*/
|
|
151
|
+
baseField?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Map of discriminator values to file types for polymorphic file handling.
|
|
155
|
+
*/
|
|
156
|
+
export type DiscriminatedFileTypeMap<TEntity = Record<string, unknown>> = Record<string, DiscriminatedFileType<TEntity>>;
|
|
157
|
+
export interface UploaderOptions {
|
|
158
|
+
accept?: Record<string, string[]>;
|
|
159
|
+
multiple: boolean;
|
|
160
|
+
}
|
|
161
|
+
export type UploaderErrorType = 'fileRejected' | 'networkError' | 'httpError' | 'aborted' | 'timeout';
|
|
162
|
+
export interface UploaderErrorOptions {
|
|
163
|
+
type: UploaderErrorType;
|
|
164
|
+
endUserMessage?: string;
|
|
165
|
+
developerMessage?: string;
|
|
166
|
+
error?: unknown;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmC,MAAM,kBAAkB,CAAA;AAMlF,MAAM,WAAW,YAAY,CAC5B,OAAO,GAAG,OAAO,EACjB,MAAM,SAAS,gBAAgB,GAAG,gBAAgB;IAElD,MAAM,EAAE,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,sBAAsB,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACvG;AAED,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,EAAE,WAAW,CAAA;IACnB,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAA;CAClD;AAMD,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,IAAI,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,eAAe,CAAA;CAChC;AAMD,MAAM,WAAW,wBAAwB;IACxC,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,EAAE,YAAY,CAAA;CAClB;AAED,MAAM,WAAW,0BAA0B;IAC1C,KAAK,EAAE,WAAW,CAAA;IAClB,IAAI,EAAE,YAAY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AAE,iBAAiB,CAAA;IACvB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,OAAO,CAAA;CACf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UploadClient, UploadClientUploadArgs } from '../types.js';
|
|
2
|
+
import type { S3FileParameters, S3UrlSigner } from './types.js';
|
|
3
|
+
export interface S3UploadClientOptions {
|
|
4
|
+
signUrl: S3UrlSigner;
|
|
5
|
+
getUploadOptions?: (file: File) => Partial<S3FileParameters>;
|
|
6
|
+
concurrency?: number;
|
|
7
|
+
}
|
|
8
|
+
export type S3FileOptions = Partial<S3FileParameters>;
|
|
9
|
+
export declare class S3UploadClient implements UploadClient<S3FileOptions> {
|
|
10
|
+
readonly options: S3UploadClientOptions;
|
|
11
|
+
private activeCount;
|
|
12
|
+
private resolverQueue;
|
|
13
|
+
constructor(options: S3UploadClientOptions);
|
|
14
|
+
upload({ file, signal, onProgress, ...options }: UploadClientUploadArgs & S3FileOptions): Promise<{
|
|
15
|
+
publicUrl: string;
|
|
16
|
+
}>;
|
|
17
|
+
private uploadSingleFile;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=S3UploadClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"S3UploadClient.d.ts","sourceRoot":"","sources":["../../src/uploadClient/S3UploadClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAuB,WAAW,EAAE,MAAM,YAAY,CAAA;AAGpF,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,WAAW,CAAA;IACpB,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAErD,qBAAa,cAAe,YAAW,YAAY,CAAC,aAAa,CAAC;aAI9B,OAAO,EAAE,qBAAqB;IAHjE,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,aAAa,CAAwB;gBAEV,OAAO,EAAE,qBAAqB;IAEpD,MAAM,CAAC,EACnB,IAAI,EACJ,MAAM,EACN,UAAU,EACV,GAAG,OAAO,EACV,EAAE,sBAAsB,GAAG,aAAa,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;YAe5D,gBAAgB;CAgB9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uploadClient/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACpG,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S3 upload URL signing types.
|
|
3
|
+
* These types mirror @contember/client's GenerateUploadUrlMutationBuilder types
|
|
4
|
+
* but are self-contained for bindx-uploader.
|
|
5
|
+
*/
|
|
6
|
+
export type S3Acl = 'PUBLIC_READ' | 'PRIVATE' | 'NONE';
|
|
7
|
+
export interface S3FileParameters {
|
|
8
|
+
contentType: string;
|
|
9
|
+
expiration?: number;
|
|
10
|
+
size?: number;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
extension?: string;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
fileName?: string;
|
|
15
|
+
acl?: S3Acl;
|
|
16
|
+
}
|
|
17
|
+
export interface S3SignedUrlResponse {
|
|
18
|
+
url: string;
|
|
19
|
+
publicUrl: string;
|
|
20
|
+
method: string;
|
|
21
|
+
headers: Array<{
|
|
22
|
+
key: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export type S3UrlSigner = (args: S3FileParameters & {
|
|
27
|
+
file: File;
|
|
28
|
+
}) => Promise<S3SignedUrlResponse>;
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/uploadClient/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,KAAK,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,CAAA;AAEtD,MAAM,WAAW,gBAAgB;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,KAAK,CAAA;CACX;AAED,MAAM,WAAW,mBAAmB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,KAAK,CAAC;QACd,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;CACF;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,gBAAgB,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a file type matches an accept specification.
|
|
3
|
+
* Ported from react-dropzone's attr-accept utility.
|
|
4
|
+
*
|
|
5
|
+
* @param file - File or object with type and name properties
|
|
6
|
+
* @param accept - Accept specification (MIME type, extension, or wildcard)
|
|
7
|
+
*/
|
|
8
|
+
export declare function attrAccept(file: {
|
|
9
|
+
type?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
}, accept?: string | string[] | Record<string, string[]>): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Convert accept record to a flat string for input accept attribute.
|
|
14
|
+
*/
|
|
15
|
+
export declare function acceptToString(accept?: Record<string, string[]>): string | undefined;
|
|
16
|
+
//# sourceMappingURL=attrAccept.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attrAccept.d.ts","sourceRoot":"","sources":["../../src/utils/attrAccept.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EACtC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACnD,OAAO,CAiCT;AA0BD;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,GAAG,SAAS,CAcpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GraphQlClient } from '@contember/graphql-client';
|
|
2
|
+
import type { S3FileParameters, S3SignedUrlResponse } from '../uploadClient/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an S3 URL signer that batches requests to reduce API calls.
|
|
5
|
+
* Uses microtask scheduling to batch concurrent signing requests into a single GraphQL mutation.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createContentApiS3Signer: (client: GraphQlClient) => ((parameters: S3FileParameters) => Promise<S3SignedUrlResponse>);
|
|
8
|
+
//# sourceMappingURL=urlSigner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlSigner.d.ts","sourceRoot":"","sources":["../../src/utils/urlSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAErF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACpC,QAAQ,aAAa,KACnB,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAiCjE,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contember/bindx-uploader",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "File upload components for bindx data binding",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc --build",
|
|
12
|
+
"typecheck": "tsc --build"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"react": ">=18.0.0"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@contember/bindx": "0.1.0",
|
|
19
|
+
"@contember/bindx-react": "0.1.0",
|
|
20
|
+
"@contember/bindx-repeater": "0.1.0",
|
|
21
|
+
"@contember/graphql-client": "*",
|
|
22
|
+
"@radix-ui/react-slot": "^1.2.3",
|
|
23
|
+
"react-dropzone": "^14.3.8"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"src"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/contember/bindx.git",
|
|
33
|
+
"directory": "packages/bindx-uploader"
|
|
34
|
+
}
|
|
35
|
+
}
|