diff --git a/client/commonJs/all.js b/client/commonJs/all.js deleted file mode 100644 index 1fae592f0..000000000 --- a/client/commonJs/all.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -module.exports = require("../all.fine-uploader/all.fine-uploader"); diff --git a/client/commonJs/core/all.js b/client/commonJs/all/index.js similarity index 86% rename from client/commonJs/core/all.js rename to client/commonJs/all/index.js index 5f28b0229..d021bee66 100644 --- a/client/commonJs/core/all.js +++ b/client/commonJs/all/index.js @@ -1,3 +1,3 @@ "use strict"; -module.exports = require("../../all.fine-uploader/all.fine-uploader.core"); +module.exports = require("../../all.fine-uploader/all.fine-uploader"); diff --git a/client/commonJs/all/package.json b/client/commonJs/all/package.json new file mode 100644 index 000000000..5d611ddef --- /dev/null +++ b/client/commonJs/all/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/azure.js b/client/commonJs/azure.js deleted file mode 100644 index 508d9f05e..000000000 --- a/client/commonJs/azure.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -module.exports = require("../azure.fine-uploader/azure.fine-uploader"); diff --git a/client/commonJs/core/azure.js b/client/commonJs/azure/index.js similarity index 83% rename from client/commonJs/core/azure.js rename to client/commonJs/azure/index.js index 29bf8a1ce..4d1521730 100644 --- a/client/commonJs/core/azure.js +++ b/client/commonJs/azure/index.js @@ -1,3 +1,3 @@ "use strict"; -module.exports = require("../../azure.fine-uploader/azure.fine-uploader.core"); +module.exports = require("../../azure.fine-uploader/azure.fine-uploader"); diff --git a/client/commonJs/azure/package.json b/client/commonJs/azure/package.json new file mode 100644 index 000000000..5d611ddef --- /dev/null +++ b/client/commonJs/azure/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/core/all/index.js b/client/commonJs/core/all/index.js new file mode 100644 index 000000000..8e2775357 --- /dev/null +++ b/client/commonJs/core/all/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = require("../../../all.fine-uploader/all.fine-uploader.core"); diff --git a/client/commonJs/core/all/package.json b/client/commonJs/core/all/package.json new file mode 100644 index 000000000..71fb4440b --- /dev/null +++ b/client/commonJs/core/all/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/core/azure/index.js b/client/commonJs/core/azure/index.js new file mode 100644 index 000000000..da03b6b4f --- /dev/null +++ b/client/commonJs/core/azure/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = require("../../../azure.fine-uploader/azure.fine-uploader.core"); diff --git a/client/commonJs/core/azure/package.json b/client/commonJs/core/azure/package.json new file mode 100644 index 000000000..71fb4440b --- /dev/null +++ b/client/commonJs/core/azure/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/core/package.json b/client/commonJs/core/package.json new file mode 100644 index 000000000..5d611ddef --- /dev/null +++ b/client/commonJs/core/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/core/s3/index.js b/client/commonJs/core/s3/index.js new file mode 100644 index 000000000..9fa5cc544 --- /dev/null +++ b/client/commonJs/core/s3/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = require("../../../s3.fine-uploader/s3.fine-uploader.core"); diff --git a/client/commonJs/core/s3/package.json b/client/commonJs/core/s3/package.json new file mode 100644 index 000000000..71fb4440b --- /dev/null +++ b/client/commonJs/core/s3/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/core/traditional.js b/client/commonJs/core/traditional.js deleted file mode 100644 index 075686efe..000000000 --- a/client/commonJs/core/traditional.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -module.exports = require("../../fine-uploader/fine-uploader.core"); diff --git a/client/commonJs/core/traditional/index.js b/client/commonJs/core/traditional/index.js new file mode 100644 index 000000000..2a6f4861a --- /dev/null +++ b/client/commonJs/core/traditional/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = require("../../../fine-uploader/fine-uploader.core"); diff --git a/client/commonJs/core/traditional/package.json b/client/commonJs/core/traditional/package.json new file mode 100644 index 000000000..71fb4440b --- /dev/null +++ b/client/commonJs/core/traditional/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/dnd.js b/client/commonJs/dnd/index.js similarity index 100% rename from client/commonJs/dnd.js rename to client/commonJs/dnd/index.js diff --git a/client/commonJs/dnd/package.json b/client/commonJs/dnd/package.json new file mode 100644 index 000000000..5d611ddef --- /dev/null +++ b/client/commonJs/dnd/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/s3.js b/client/commonJs/s3.js deleted file mode 100644 index 4aebe030f..000000000 --- a/client/commonJs/s3.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -module.exports = require("../s3.fine-uploader/s3.fine-uploader"); diff --git a/client/commonJs/core/s3.js b/client/commonJs/s3/index.js similarity index 88% rename from client/commonJs/core/s3.js rename to client/commonJs/s3/index.js index 808da9e2a..61dcd85ad 100644 --- a/client/commonJs/core/s3.js +++ b/client/commonJs/s3/index.js @@ -1,3 +1,3 @@ "use strict"; -module.exports = require("../../s3.fine-uploader/s3.fine-uploader.core"); +module.exports = require("../../s3.fine-uploader/s3.fine-uploader"); diff --git a/client/commonJs/s3/package.json b/client/commonJs/s3/package.json new file mode 100644 index 000000000..5d611ddef --- /dev/null +++ b/client/commonJs/s3/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../typescript/fine-uploader.d.ts" +} diff --git a/client/commonJs/traditional.js b/client/commonJs/traditional.js deleted file mode 100644 index ae4412a1c..000000000 --- a/client/commonJs/traditional.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; - -module.exports = require("../fine-uploader/fine-uploader"); diff --git a/client/commonJs/traditional/index.js b/client/commonJs/traditional/index.js new file mode 100644 index 000000000..8ec32a9c1 --- /dev/null +++ b/client/commonJs/traditional/index.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = require("../../fine-uploader/fine-uploader"); diff --git a/client/commonJs/traditional/package.json b/client/commonJs/traditional/package.json new file mode 100644 index 000000000..5d611ddef --- /dev/null +++ b/client/commonJs/traditional/package.json @@ -0,0 +1,3 @@ +{ + "typings": "../../typescript/fine-uploader.d.ts" +} diff --git a/client/typescript/fine-uploader.d.ts b/client/typescript/fine-uploader.d.ts index c687309ca..d1b74e448 100644 --- a/client/typescript/fine-uploader.d.ts +++ b/client/typescript/fine-uploader.d.ts @@ -1,6 +1,7 @@ // Type definitions for FineUploader 5.x.x // Project: http://fineuploader.com/ // Definitions by: Sukhdeep Singh +// Bradley Ayers declare module "fine-uploader/lib/core" { @@ -909,6 +910,10 @@ declare module "fine-uploader/lib/core" { * RequestOptions */ request?: RequestOptions; + /** + * RetryOptions + */ + retry?: RetryOptions; /** * ScalingOptions */ @@ -933,8 +938,6 @@ declare module "fine-uploader/lib/core" { * Core callback functions */ callbacks?: CoreEvents; - - } /** @@ -2691,6 +2694,14 @@ declare module "fine-uploader" { } +declare module "fine-uploader/lib/all" { + import { azure } from 'fine-uploader/lib/azure'; + export * from 'fine-uploader'; + import { s3 } from 'fine-uploader/lib/s3'; + + export import azure = azure; + export import s3 = s3; +} declare module "fine-uploader/lib/azure" { @@ -2700,21 +2711,12 @@ declare module "fine-uploader/lib/azure" { UIDeleteFileOptions, UIMessages, UIPasteOptions, + UIRetryOptions, UIScalingOptions, UITextOptions } from 'fine-uploader'; - import { - FineUploaderBasic as FineUploaderBasicCore, - ChunkingOptions, - CorsOptions, - RequestOptions, - CoreOptions, - ResumableFileObject, - PromiseOptions - } from 'fine-uploader/lib/core'; - - + import { azure as azureCore } from 'fine-uploader/lib/core/azure'; export namespace azure { @@ -2771,6 +2773,99 @@ declare module "fine-uploader/lib/azure" { setUploadSuccessParams(newParams: any, id?: number): void; } + /** + * AzureFailedUploadTextDisplayOptions + */ + export interface AzureFailedUploadTextDisplayOptions { + /** + * You will most likely want to keep this at the default value of 'custom'. See the UI options documentation for more info on this option. + * + * @default `'custom'` + */ + mode?: string; + } + + /** + * AzureUIOptions + */ + export interface AzureUIOptions extends UIOptions, AzureCoreOptions { + /** + * failedUploadText options + */ + failedUploadTextDisplay?: AzureFailedUploadTextDisplayOptions; + + /** + * chunking options + */ + chunking?: AzureChunkingOptions; + /** + * cors options + */ + cors?: AzureCorsOptions; + /** + * deleteFile options + */ + deleteFile?: UIDeleteFileOptions; + /** + * messages + */ + messages?: UIMessages; + /** + * paste UI options + */ + paste?: UIPasteOptions; + /** + * UI scaling options + */ + scaling?: UIScalingOptions; + /** + * UI text options + */ + text?: UITextOptions; + /** + * RequestOptions + */ + request?: AzureRequestOptions; + /** + * Retry options + */ + retry?: UIRetryOptions; + } + + export import AzureChunkingOptions = azureCore.AzureChunkingOptions; + export import AzureCorsOptions = azureCore.AzureCorsOptions; + export import AzureCoreOptions = azureCore.AzureCoreOptions; + export import AzureRequestOptions = azureCore.AzureRequestOptions; + export import AzureResumableFileObject = azureCore.AzureResumableFileObject; + + } + +} + +declare module "fine-uploader/lib/core/all" { + import { azure } from 'fine-uploader/lib/core/azure'; + export * from 'fine-uploader/lib/core'; + import { s3 } from 'fine-uploader/lib/core/s3'; + + export import azure = azure; + export import s3 = s3; +} + +declare module "fine-uploader/lib/core/azure" { + + import { + FineUploaderBasic as FineUploaderBasicCore, + ChunkingOptions, + CorsOptions, + RequestOptions, + RetryOptions, + CoreOptions, + ResumableFileObject, + PromiseOptions + } from 'fine-uploader/lib/core'; + + export namespace azure { + export class FineUploaderBasic extends FineUploaderBasicCore { /** @@ -2969,18 +3064,6 @@ declare module "fine-uploader/lib/azure" { params?: any; } - /** - * AzureFailedUploadTextDisplayOptions - */ - export interface AzureFailedUploadTextDisplayOptions { - /** - * You will most likely want to keep this at the default value of 'custom'. See the UI options documentation for more info on this option. - * - * @default `'custom'` - */ - mode?: string; - } - /** * Resumable file object type for Azure */ @@ -3021,51 +3104,6 @@ declare module "fine-uploader/lib/azure" { uploadSuccess?: AzureUploadSuccessOptions; } - /** - * AzureUIOptions - */ - export interface AzureUIOptions extends UIOptions, AzureCoreOptions { - /** - * failedUploadText options - */ - failedUploadTextDisplay?: AzureFailedUploadTextDisplayOptions; - - /** - * chunking options - */ - chunking?: AzureChunkingOptions; - /** - * cors options - */ - cors?: AzureCorsOptions; - /** - * deleteFile options - */ - deleteFile?: UIDeleteFileOptions; - /** - * messages - */ - messages?: UIMessages; - /** - * paste UI options - */ - paste?: UIPasteOptions; - /** - * UI scaling options - */ - scaling?: UIScalingOptions; - /** - * UI text options - */ - text?: UITextOptions; - /** - * RequestOptions - */ - request?: AzureRequestOptions; - - } - - } } @@ -3079,26 +3117,26 @@ declare module "fine-uploader/lib/s3" { UIDeleteFileOptions, UIMessages, UIPasteOptions, + UIRetryOptions, UIScalingOptions, UITextOptions } from 'fine-uploader'; import { - FineUploaderBasic as FineUploaderBasicCore, ChunkingOptions, CorsOptions, RequestOptions, 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 +3213,89 @@ 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; + /** + * UI scaling options + */ + scaling?: UIScalingOptions; + /** + * UI text options + */ + text?: UITextOptions; + } + + export import S3ChunkingOptions = s3Core.S3ChunkingOptions; + export import S3CredentialsOptions = s3Core.S3CredentialsOptions; + export import S3CorsOptions = s3Core.S3CorsOptions; + export import S3iFrameSupportOptions = s3Core.S3iFrameSupportOptions; + export import BucketFunction = s3Core.BucketFunction; + export import HostFunction = s3Core.HostFunction; + export import KeyFunction = s3Core.KeyFunction; + export import S3ObjectPropertyOptions = s3Core.S3ObjectPropertyOptions; + export import S3RequestOptions = s3Core.S3RequestOptions; + export import S3CustomHeaderFunction = s3Core.S3CustomHeaderFunction; + export import S3SignatureOptions = s3Core.S3SignatureOptions; + export import S3UploadSuccessOptions = s3Core.S3UploadSuccessOptions; + export import S3CoreOptions = s3Core.S3CoreOptions; + export import S3FailedUploadTextDisplayOptions = s3Core.S3FailedUploadTextDisplayOptions; + export import OnCredentialsExpired = s3Core.OnCredentialsExpired; + export import S3Events = s3Core.S3Events; + export import 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 +3373,6 @@ declare module "fine-uploader/lib/s3" { } - /** * S3CredentialsOptions */ @@ -3583,48 +3703,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 +3712,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..82fb820d1 100644 --- a/client/typescript/fine-uploader.test.ts +++ b/client/typescript/fine-uploader.test.ts @@ -1,7 +1,11 @@ import { FineUploader, UIOptions } from 'fine-uploader'; +import * as qqAll from 'fine-uploader/lib/all'; import { s3 } from 'fine-uploader/lib/s3'; import { azure } from 'fine-uploader/lib/azure'; -import { PromiseOptions } from 'fine-uploader/lib/core'; +import { PromiseOptions, FineUploaderBasic } from 'fine-uploader/lib/core'; +import * as qqCoreAll from 'fine-uploader/lib/core/all'; +import { azure as azureCore } from 'fine-uploader/lib/core/azure'; +import { s3 as s3Core } from 'fine-uploader/lib/core/s3'; /** * Prepare/set options for the core + UI FineUploader @@ -59,6 +63,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 @@ -83,6 +115,40 @@ let azureUIOptions: azure.AzureUIOptions = { } let azureUploader = new azure.FineUploader(azureUIOptions); + +/** + * Prepare/set options for the Amazon S3 FineUploader + */ +let azureCoreOptions: azureCore.AzureCoreOptions = { + request: { + endpoint: 'https://{ YOUR_STORAGE_ACCOUNT_NAME }.blob.core.windows.net/{ YOUR_CONTAINER_NAME }' + }, + signature: { + endpoint: '/signature' + }, + uploadSuccess: { + endpoint: '/success' + }, + retry: { + enableAuto: true + }, + deleteFile: { + enabled: true + } +} +let azureCoreUploader = new azureCore.FineUploaderBasic(azureCoreOptions); + +// Basic checks that fine-uploader/lib/all namespace is composed of correctly +let a1: typeof azure = qqAll.azure; +let a2: typeof s3 = qqAll.s3; +let a3: typeof FineUploader = qqAll.FineUploader; + +// Basic checks that fine-uploader/lib/core/all namespaces is composed +// correctly. +let b1: typeof azureCore = qqCoreAll.azure; +let b2: typeof s3Core = qqCoreAll.s3; +let b3: typeof FineUploaderBasic = qqCoreAll.FineUploaderBasic; + /** * Manually upload files to the server. This method should be called on some button click event */ @@ -102,4 +168,4 @@ promise.then(() => { }); promise.done(() => { //promise is fulfilled whether successful or not, do something here -}); \ No newline at end of file +}); diff --git a/docs/features/modules.jmd b/docs/features/modules.jmd index d03136ea6..269b81bb0 100644 --- a/docs/features/modules.jmd +++ b/docs/features/modules.jmd @@ -46,8 +46,8 @@ import qq from 'fine-uploader/lib/core' const uploader = new qq.FineUploaderBasic({...}) ``` -You will find core builds for S3, Azure, and "all" in `lib/core/s3.js`, `lib/core/azure.js`, -and `lib/core/all.js` (respectively) +You will find core builds for S3, Azure, and "all" in `lib/core/s3/index.js`, `lib/core/azure/index.js`, +and `lib/core/all/index.js` (respectively) ```javascript @@ -139,13 +139,13 @@ commonjs({ 'node_modules/fine-uploader/**' ], namedExports: { - 'node_modules/fine-uploader/lib/traditional.js': ['FineUploader'] + 'node_modules/fine-uploader/lib/traditional/index.js': ['FineUploader'] } }) ``` -If you are not using traditional Fine Uploader flavour, remember to change `node_modules/fine-uploader/lib/traditional.js` accordingly. -For example: for s3 Fine Uploader this should be `node_modules/fine-uploader/lib/s3.js` +If you are not using traditional Fine Uploader flavour, remember to change `node_modules/fine-uploader/lib/traditional/index.js` accordingly. +For example: for s3 Fine Uploader this should be `node_modules/fine-uploader/lib/s3/index.js` ## CommonJS @@ -161,8 +161,8 @@ var qq = require('fine-uploader/lib/core') var uploader = new qq.FineUploaderBasic({...}) ``` -You will find core builds for S3, Azure, and "all" in `lib/core/s3.js`, `lib/core/azure.js`, -and `lib/core/all.js` (respectively) +You will find core builds for S3, Azure, and "all" in `lib/core/s3/index.js`, `lib/core/azure/index.js`, +and `lib/core/all/index.js` (respectively) ```javascript