diff --git a/client/typescript/fine-uploader.d.ts b/client/typescript/fine-uploader.d.ts index c687309ca..570b4b265 100644 --- a/client/typescript/fine-uploader.d.ts +++ b/client/typescript/fine-uploader.d.ts @@ -909,6 +909,10 @@ declare module "fine-uploader/lib/core" { * RequestOptions */ request?: RequestOptions; + /** + * RetryOptions + */ + retry?: RetryOptions; /** * ScalingOptions */ @@ -933,8 +937,6 @@ declare module "fine-uploader/lib/core" { * Core callback functions */ callbacks?: CoreEvents; - - } /** @@ -2700,6 +2702,7 @@ declare module "fine-uploader/lib/azure" { UIDeleteFileOptions, UIMessages, UIPasteOptions, + UIRetryOptions, UIScalingOptions, UITextOptions } from 'fine-uploader'; @@ -2709,6 +2712,7 @@ declare module "fine-uploader/lib/azure" { ChunkingOptions, CorsOptions, RequestOptions, + RetryOptions, CoreOptions, ResumableFileObject, PromiseOptions @@ -3062,10 +3066,12 @@ declare module "fine-uploader/lib/azure" { * RequestOptions */ request?: AzureRequestOptions; - + /** + * Retry options + */ + retry?: UIRetryOptions & RetryOptions; } - } } @@ -3079,6 +3085,7 @@ declare module "fine-uploader/lib/s3" { UIDeleteFileOptions, UIMessages, UIPasteOptions, + UIRetryOptions, UIScalingOptions, UITextOptions } from 'fine-uploader'; @@ -3091,14 +3098,14 @@ declare module "fine-uploader/lib/s3" { CoreOptions, ResumableFileObject, CoreEvents, - PromiseOptions + PromiseOptions, + RetryOptions } from 'fine-uploader/lib/core'; - + import { s3 as s3Core } from 'fine-uploader/lib/core/s3'; export namespace s3 { - export class FineUploader extends FineUploaderCore { constructor(fineuploaderOptions?: S3UIOptions); @@ -3175,6 +3182,90 @@ declare module "fine-uploader/lib/s3" { setUploadSuccessParams(newParams: any, id?: number): void; } + /** + * S3UIOptions + */ + export interface S3UIOptions extends UIOptions, S3CoreOptions { + /** + * failedUploadText options + */ + failedUploadTextDisplay?: S3FailedUploadTextDisplayOptions; + /** + * chunking options + */ + chunking?: S3ChunkingOptions; + /** + * cors options + */ + cors?: S3CorsOptions; + /** + * request options + */ + request?: S3RequestOptions; + /** + * deleteFile options + */ + deleteFile?: UIDeleteFileOptions; + /** + * messages + */ + messages?: UIMessages; + /** + * paste UI options + */ + paste?: UIPasteOptions; + /** + * Retry options + */ + retry?: UIRetryOptions & RetryOptions; + /** + * UI scaling options + */ + scaling?: UIScalingOptions; + /** + * UI text options + */ + text?: UITextOptions; + } + + export const FineUploaderBasic: typeof s3Core.FineUploaderBasic; + export type S3ChunkingOptions = s3Core.S3ChunkingOptions; + export type S3CredentialsOptions = s3Core.S3CredentialsOptions; + export type S3CorsOptions = s3Core.S3CorsOptions; + export type S3iFrameSupportOptions = s3Core.S3iFrameSupportOptions; + export type BucketFunction = s3Core.BucketFunction; + export type HostFunction = s3Core.HostFunction; + export type KeyFunction = s3Core.KeyFunction; + export type S3ObjectPropertyOptions = s3Core.S3ObjectPropertyOptions; + export type S3RequestOptions = s3Core.S3RequestOptions; + export type S3CustomHeaderFunction = s3Core.S3CustomHeaderFunction; + export type S3SignatureOptions = s3Core.S3SignatureOptions; + export type S3UploadSuccessOptions = s3Core.S3UploadSuccessOptions; + export type S3CoreOptions = s3Core.S3CoreOptions; + export type S3FailedUploadTextDisplayOptions = s3Core.S3FailedUploadTextDisplayOptions; + export type OnCredentialsExpired = s3Core.OnCredentialsExpired; + export type S3Events = s3Core.S3Events; + export type S3ResumableFileObject = s3Core.S3ResumableFileObject; + + } + +} + +declare module "fine-uploader/lib/core/s3" { + + import { + FineUploaderBasic as FineUploaderBasicCore, + ChunkingOptions, + CorsOptions, + RequestOptions, + CoreOptions, + ResumableFileObject, + CoreEvents, + PromiseOptions + } from 'fine-uploader/lib/core'; + + export namespace s3 { + export class FineUploaderBasic extends FineUploaderBasicCore { constructor(fineuploaderOptions?: S3CoreOptions); @@ -3252,7 +3343,6 @@ declare module "fine-uploader/lib/s3" { } - /** * S3CredentialsOptions */ @@ -3583,48 +3673,6 @@ declare module "fine-uploader/lib/s3" { onCredentialsExpired?: OnCredentialsExpired; } - /** - * S3UIOptions - */ - export interface S3UIOptions extends UIOptions, S3CoreOptions { - /** - * failedUploadText options - */ - failedUploadTextDisplay?: S3FailedUploadTextDisplayOptions; - /** - * chunking options - */ - chunking?: S3ChunkingOptions; - /** - * cors options - */ - cors?: S3CorsOptions; - /** - * request options - */ - request?: S3RequestOptions; - /** - * deleteFile options - */ - deleteFile?: UIDeleteFileOptions; - /** - * messages - */ - messages?: UIMessages; - /** - * paste UI options - */ - paste?: UIPasteOptions; - /** - * UI scaling options - */ - scaling?: UIScalingOptions; - /** - * UI text options - */ - text?: UITextOptions; - } - /** * Resumable file object type for S3 */ @@ -3634,6 +3682,7 @@ declare module "fine-uploader/lib/s3" { */ key?: string; } + } -} \ No newline at end of file +} diff --git a/client/typescript/fine-uploader.test.ts b/client/typescript/fine-uploader.test.ts index 0b416872d..94538cae0 100644 --- a/client/typescript/fine-uploader.test.ts +++ b/client/typescript/fine-uploader.test.ts @@ -2,6 +2,7 @@ import { FineUploader, UIOptions } from 'fine-uploader'; import { s3 } from 'fine-uploader/lib/s3'; import { azure } from 'fine-uploader/lib/azure'; import { PromiseOptions } from 'fine-uploader/lib/core'; +import { s3 as s3Core } from 'fine-uploader/lib/core/s3'; /** * Prepare/set options for the core + UI FineUploader @@ -59,6 +60,34 @@ let s3UIOptions: s3.S3UIOptions = { let s3Uploader = new s3.FineUploader(s3UIOptions); +/** + * Prepare/set options for the core Amazon S3 FineUploaderBasic + */ +let s3CoreOptions: s3Core.S3CoreOptions = { + debug: true, + request: { + endpoint: '{ YOUR_BUCKET_NAME }.s3.amazonaws.com', + accessKey: '{ YOUR_ACCESS_KEY }' + }, + signature: { + endpoint: '/s3/signature' + }, + uploadSuccess: { + endpoint: '/s3/success' + }, + iframeSupport: { + localBlankPagePath: '/success.html' + }, + retry: { + enableAuto: true // defaults to false + }, + deleteFile: { + enabled: true, + endpoint: '/s3handler' + } +} +let s3CoreUploader = new s3Core.FineUploaderBasic(s3CoreOptions); + /** * Prepare/set options for the Amazon S3 FineUploader @@ -102,4 +131,4 @@ promise.then(() => { }); promise.done(() => { //promise is fulfilled whether successful or not, do something here -}); \ No newline at end of file +});