Move dropbox vendors (#576)

* Move vendor files

* Move sync/vendor & config updates

* Update dropbox sdk from v4.0.9 to v4.0.13

* Fix typo

* Fix zip path

* Pass fetch option to Dropbox
This commit is contained in:
Rob Garrison 2018-11-28 18:56:17 -06:00 committed by GitHub
parent eafa5110c0
commit a4c08084bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 361 additions and 211 deletions

View File

@ -168,8 +168,8 @@
<script src="js/sections-util.js"></script> <script src="js/sections-util.js"></script>
<script src="js/storage-util.js"></script> <script src="js/storage-util.js"></script>
<script src="sync/vendor/dropbox/dropbox-sdk.js" async></script> <script src="vendor/dropbox/dropbox-sdk.js" async></script>
<script src="sync/vendor/zipjs/zip.js" defer></script> <script src="vendor/zipjs-browserify/zip.js" defer></script>
<script src="sync/compress-text.js" defer></script> <script src="sync/compress-text.js" defer></script>
<script src="sync/cross-browser-functions.js" defer></script> <script src="sync/cross-browser-functions.js" defer></script>
<script src="sync/import-export-dropbox.js" async></script> <script src="sync/import-export-dropbox.js" async></script>

View File

@ -8,6 +8,7 @@
"devDependencies": { "devDependencies": {
"archiver": "^3.0.0", "archiver": "^3.0.0",
"codemirror": "^5.41.0", "codemirror": "^5.41.0",
"dropbox": "^4.0.13",
"endent": "^1.2.0", "endent": "^1.2.0",
"eslint": "^5.9.0", "eslint": "^5.9.0",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",
@ -21,7 +22,8 @@
"updates": "^5.1.2", "updates": "^5.1.2",
"usercss-meta": "^0.8.3", "usercss-meta": "^0.8.3",
"web-ext": "^2.9.2", "web-ext": "^2.9.2",
"webext-tx-fix": "^0.3.1" "webext-tx-fix": "^0.3.1",
"zipjs-browserify": "^1.0.1"
}, },
"scripts": { "scripts": {
"lint": "eslint **/*.js --cache || exit 0", "lint": "eslint **/*.js --cache || exit 0",

View File

@ -3,7 +3,7 @@
'use strict'; 'use strict';
onDOMready().then(() => { onDOMready().then(() => {
zip.workerScriptsPath = '/sync/vendor/zipjs/'; zip.workerScriptsPath = '../vendor/zipjs-browserify/';
}); });
/** /**

View File

@ -31,7 +31,10 @@ function hasDropboxAccessToken() {
} }
function requestDropboxAccessToken() { function requestDropboxAccessToken() {
const client = new Dropbox.Dropbox({clientId: DROPBOX_API_KEY}); const client = new Dropbox.Dropbox({
clientId: DROPBOX_API_KEY,
fetch
});
const authUrl = client.getAuthenticationUrl(getRedirectUrlAuthFlow()); const authUrl = client.getAuthenticationUrl(getRedirectUrlAuthFlow());
return launchWebAuthFlow({url: authUrl, interactive: true}) return launchWebAuthFlow({url: authUrl, interactive: true})
.then(urlReturned => { .then(urlReturned => {
@ -57,7 +60,8 @@ $('#sync-dropbox-export').onclick = () => {
.then(token => { .then(token => {
const client = new Dropbox.Dropbox({ const client = new Dropbox.Dropbox({
clientId: DROPBOX_API_KEY, clientId: DROPBOX_API_KEY,
accessToken: token accessToken: token,
fetch
}); });
return client.filesDownload({path: '/' + DROPBOX_FILE}) return client.filesDownload({path: '/' + DROPBOX_FILE})
.then(() => messageBox.confirm(t('overwriteFileExport'))) .then(() => messageBox.confirm(t('overwriteFileExport')))
@ -130,7 +134,8 @@ $('#sync-dropbox-import').onclick = () => {
.then(token => { .then(token => {
const client = new Dropbox.Dropbox({ const client = new Dropbox.Dropbox({
clientId: DROPBOX_API_KEY, clientId: DROPBOX_API_KEY,
accessToken: token accessToken: token,
fetch
}); });
return client.filesDownload({path: '/' + DROPBOX_FILE}) return client.filesDownload({path: '/' + DROPBOX_FILE})
.then(response => { .then(response => {

View File

@ -11,6 +11,9 @@ const files = {
'*', // only update existing vendor files '*', // only update existing vendor files
'theme' // update all theme files 'theme' // update all theme files
], ],
'dropbox': [
'dist/Dropbox-sdk.js → dropbox-sdk.js'
],
'jsonlint': [ 'jsonlint': [
'lib/jsonlint.js → jsonlint.js' 'lib/jsonlint.js → jsonlint.js'
], ],
@ -31,6 +34,12 @@ const files = {
], ],
'usercss-meta': [ 'usercss-meta': [
'dist/usercss-meta.min.js → usercss-meta.min.js' 'dist/usercss-meta.min.js → usercss-meta.min.js'
],
'zipjs-browserify': [
'vendor/deflate.js → deflate.js',
'vendor/inflate.js → inflate.js',
'vendor/z-worker.js → z-worker.js',
'vendor/zip.js → zip.js'
] ]
}; };

0
sync/vendor/dropbox/LICENSE → vendor/dropbox/LICENSE vendored Executable file → Normal file
View File

12
vendor/dropbox/README.md vendored Normal file
View File

@ -0,0 +1,12 @@
## Dropbox SDK v4.0.13
Dropbox SDK JS installed via npm - source repo:
https://github.com/dropbox/dropbox-sdk-js/tree/v4.0.13
The source repo **does not** include the `dist` folder with the generated `dropbox-sdk.js`
distribution file. It can only be obtained from the npm `node_modules` folder after installing
the module.
- https://www.npmjs.com/package/dropbox
- https://github.com/dropbox/dropbox-sdk-js/releases

View File

@ -27,6 +27,27 @@ routes.authTokenRevoke = function (arg) {
return this.request('auth/token/revoke', arg, 'user', 'api', 'rpc'); return this.request('auth/token/revoke', arg, 'user', 'api', 'rpc');
}; };
/**
* Removes all manually added contacts. You'll still keep contacts who are on
* your team or who you imported. New contacts will be added when you share.
* @function Dropbox#contactsDeleteManualContacts
* @arg {void} arg - The request parameters.
* @returns {Promise.<void, Error.<void>>}
*/
routes.contactsDeleteManualContacts = function (arg) {
return this.request('contacts/delete_manual_contacts', arg, 'user', 'api', 'rpc');
};
/**
* Removes manually added contacts from the given list.
* @function Dropbox#contactsDeleteManualContactsBatch
* @arg {ContactsDeleteManualContactsArg} arg - The request parameters.
* @returns {Promise.<void, Error.<ContactsDeleteManualContactsError>>}
*/
routes.contactsDeleteManualContactsBatch = function (arg) {
return this.request('contacts/delete_manual_contacts_batch', arg, 'user', 'api', 'rpc');
};
/** /**
* Add property groups to a Dropbox file. See templates/add_for_user or * Add property groups to a Dropbox file. See templates/add_for_user or
* templates/add_for_team to create new templates. * templates/add_for_team to create new templates.
@ -284,6 +305,17 @@ routes.filesAlphaUpload = function (arg) {
return this.request('files/alpha/upload', arg, 'user', 'content', 'upload'); return this.request('files/alpha/upload', arg, 'user', 'content', 'upload');
}; };
/**
* Copy a file or folder to a different location in the user's Dropbox. If the
* source path is a folder all its contents will be copied.
* @function Dropbox#filesCopyV2
* @arg {FilesRelocationArg} arg - The request parameters.
* @returns {Promise.<FilesRelocationResult, Error.<FilesRelocationError>>}
*/
routes.filesCopyV2 = function (arg) {
return this.request('files/copy_v2', arg, 'user', 'api', 'rpc');
};
/** /**
* Copy a file or folder to a different location in the user's Dropbox. If the * Copy a file or folder to a different location in the user's Dropbox. If the
* source path is a folder all its contents will be copied. * source path is a folder all its contents will be copied.
@ -299,9 +331,9 @@ routes.filesCopy = function (arg) {
/** /**
* Copy multiple files or folders to different locations at once in the user's * Copy multiple files or folders to different locations at once in the user's
* Dropbox. If RelocationBatchArg.allow_shared_folder is false, this route is * Dropbox. If RelocationBatchArg.allow_shared_folder is false, this route is
* atomic. If on entry failes, the whole transaction will abort. If * atomic. If one entry fails, the whole transaction will abort. If
* RelocationBatchArg.allow_shared_folder is true, not atomicity is guaranteed, * RelocationBatchArg.allow_shared_folder is true, atomicity is not guaranteed,
* but you will be able to copy the contents of shared folders to new locations. * but it allows you to copy the contents of shared folders to new locations.
* This route will return job ID immediately and do the async copy job in * This route will return job ID immediately and do the async copy job in
* background. Please use copy_batch/check to check the job status. * background. Please use copy_batch/check to check the job status.
* @function Dropbox#filesCopyBatch * @function Dropbox#filesCopyBatch
@ -346,14 +378,13 @@ routes.filesCopyReferenceSave = function (arg) {
}; };
/** /**
* Copy a file or folder to a different location in the user's Dropbox. If the * Create a folder at a given path.
* source path is a folder all its contents will be copied. * @function Dropbox#filesCreateFolderV2
* @function Dropbox#filesCopyV2 * @arg {FilesCreateFolderArg} arg - The request parameters.
* @arg {FilesRelocationArg} arg - The request parameters. * @returns {Promise.<FilesCreateFolderResult, Error.<FilesCreateFolderError>>}
* @returns {Promise.<FilesRelocationResult, Error.<FilesRelocationError>>}
*/ */
routes.filesCopyV2 = function (arg) { routes.filesCreateFolderV2 = function (arg) {
return this.request('files/copy_v2', arg, 'user', 'api', 'rpc'); return this.request('files/create_folder_v2', arg, 'user', 'api', 'rpc');
}; };
/** /**
@ -394,13 +425,17 @@ routes.filesCreateFolderBatchCheck = function (arg) {
}; };
/** /**
* Create a folder at a given path. * Delete the file or folder at a given path. If the path is a folder, all its
* @function Dropbox#filesCreateFolderV2 * contents will be deleted too. A successful response indicates that the file
* @arg {FilesCreateFolderArg} arg - The request parameters. * or folder was deleted. The returned metadata will be the corresponding
* @returns {Promise.<FilesCreateFolderResult, Error.<FilesCreateFolderError>>} * FileMetadata or FolderMetadata for the item at time of deletion, and not a
* DeletedMetadata object.
* @function Dropbox#filesDeleteV2
* @arg {FilesDeleteArg} arg - The request parameters.
* @returns {Promise.<FilesDeleteResult, Error.<FilesDeleteError>>}
*/ */
routes.filesCreateFolderV2 = function (arg) { routes.filesDeleteV2 = function (arg) {
return this.request('files/create_folder_v2', arg, 'user', 'api', 'rpc'); return this.request('files/delete_v2', arg, 'user', 'api', 'rpc');
}; };
/** /**
@ -441,20 +476,6 @@ routes.filesDeleteBatchCheck = function (arg) {
return this.request('files/delete_batch/check', arg, 'user', 'api', 'rpc'); return this.request('files/delete_batch/check', arg, 'user', 'api', 'rpc');
}; };
/**
* Delete the file or folder at a given path. If the path is a folder, all its
* contents will be deleted too. A successful response indicates that the file
* or folder was deleted. The returned metadata will be the corresponding
* FileMetadata or FolderMetadata for the item at time of deletion, and not a
* DeletedMetadata object.
* @function Dropbox#filesDeleteV2
* @arg {FilesDeleteArg} arg - The request parameters.
* @returns {Promise.<FilesDeleteResult, Error.<FilesDeleteError>>}
*/
routes.filesDeleteV2 = function (arg) {
return this.request('files/delete_v2', arg, 'user', 'api', 'rpc');
};
/** /**
* Download a file from a user's Dropbox. * Download a file from a user's Dropbox.
* @function Dropbox#filesDownload * @function Dropbox#filesDownload
@ -467,8 +488,8 @@ routes.filesDownload = function (arg) {
/** /**
* Download a folder from the user's Dropbox, as a zip file. The folder must be * Download a folder from the user's Dropbox, as a zip file. The folder must be
* less than 1 GB in size and have fewer than 10,000 total files. The input * less than 20 GB in size and have fewer than 10,000 total files. The input
* cannot be a single file. * cannot be a single file. Any single file must be less than 4GB in size.
* @function Dropbox#filesDownloadZip * @function Dropbox#filesDownloadZip
* @arg {FilesDownloadZipArg} arg - The request parameters. * @arg {FilesDownloadZipArg} arg - The request parameters.
* @returns {Promise.<FilesDownloadZipResult, Error.<FilesDownloadZipError>>} * @returns {Promise.<FilesDownloadZipResult, Error.<FilesDownloadZipError>>}
@ -504,7 +525,8 @@ routes.filesGetPreview = function (arg) {
/** /**
* Get a temporary link to stream content of a file. This link will expire in * Get a temporary link to stream content of a file. This link will expire in
* four hours and afterwards you will get 410 Gone. Content-Type of the link is * four hours and afterwards you will get 410 Gone. So this URL should not be
* used to display content directly in the browser. Content-Type of the link is
* determined automatically by the file's mime type. * determined automatically by the file's mime type.
* @function Dropbox#filesGetTemporaryLink * @function Dropbox#filesGetTemporaryLink
* @arg {FilesGetTemporaryLinkArg} arg - The request parameters. * @arg {FilesGetTemporaryLinkArg} arg - The request parameters.
@ -514,6 +536,42 @@ routes.filesGetTemporaryLink = function (arg) {
return this.request('files/get_temporary_link', arg, 'user', 'api', 'rpc'); return this.request('files/get_temporary_link', arg, 'user', 'api', 'rpc');
}; };
/**
* Get a one-time use temporary upload link to upload a file to a Dropbox
* location. This endpoint acts as a delayed upload. The returned temporary
* upload link may be used to make a POST request with the data to be uploaded.
* The upload will then be perfomed with the CommitInfo previously provided to
* get_temporary_upload_link but evaluated only upon consumption. Hence, errors
* stemming from invalid CommitInfo with respect to the state of the user's
* Dropbox will only be communicated at consumption time. Additionally, these
* errors are surfaced as generic HTTP 409 Conflict responses, potentially
* hiding issue details. The maximum temporary upload link duration is 4 hours.
* Upon consumption or expiration, a new link will have to be generated.
* Multiple links may exist for a specific upload path at any given time. The
* POST request on the temporary upload link must have its Content-Type set to
* "application/octet-stream". Example temporary upload link consumption
* request: curl -X POST
* https://dl.dropboxusercontent.com/apitul/1/bNi2uIYF51cVBND --header
* "Content-Type: application/octet-stream" --data-binary @local_file.txt A
* successful temporary upload link consumption request returns the content hash
* of the uploaded data in JSON format. Example succesful temporary upload link
* consumption response: {"content-hash":
* "599d71033d700ac892a0e48fa61b125d2f5994"} An unsuccessful temporary upload
* link consumption request returns any of the following status codes: HTTP 400
* Bad Request: Content-Type is not one of application/octet-stream and
* text/plain or request is invalid. HTTP 409 Conflict: The temporary upload
* link does not exist or is currently unavailable, the upload failed, or
* another error happened. HTTP 410 Gone: The temporary upload link is expired
* or consumed. Example unsuccessful temporary upload link consumption
* response: Temporary upload link has been recently consumed.
* @function Dropbox#filesGetTemporaryUploadLink
* @arg {FilesGetTemporaryUploadLinkArg} arg - The request parameters.
* @returns {Promise.<FilesGetTemporaryUploadLinkResult, Error.<void>>}
*/
routes.filesGetTemporaryUploadLink = function (arg) {
return this.request('files/get_temporary_upload_link', arg, 'user', 'api', 'rpc');
};
/** /**
* Get a thumbnail for an image. This method currently supports files with the * Get a thumbnail for an image. This method currently supports files with the
* following file extensions: jpg, jpeg, png, tiff, tif, gif and bmp. Photos * following file extensions: jpg, jpeg, png, tiff, tif, gif and bmp. Photos
@ -625,6 +683,17 @@ routes.filesListRevisions = function (arg) {
return this.request('files/list_revisions', arg, 'user', 'api', 'rpc'); return this.request('files/list_revisions', arg, 'user', 'api', 'rpc');
}; };
/**
* Move a file or folder to a different location in the user's Dropbox. If the
* source path is a folder all its contents will be moved.
* @function Dropbox#filesMoveV2
* @arg {FilesRelocationArg} arg - The request parameters.
* @returns {Promise.<FilesRelocationResult, Error.<FilesRelocationError>>}
*/
routes.filesMoveV2 = function (arg) {
return this.request('files/move_v2', arg, 'user', 'api', 'rpc');
};
/** /**
* Move a file or folder to a different location in the user's Dropbox. If the * Move a file or folder to a different location in the user's Dropbox. If the
* source path is a folder all its contents will be moved. * source path is a folder all its contents will be moved.
@ -662,17 +731,6 @@ routes.filesMoveBatchCheck = function (arg) {
return this.request('files/move_batch/check', arg, 'user', 'api', 'rpc'); return this.request('files/move_batch/check', arg, 'user', 'api', 'rpc');
}; };
/**
* Move a file or folder to a different location in the user's Dropbox. If the
* source path is a folder all its contents will be moved.
* @function Dropbox#filesMoveV2
* @arg {FilesRelocationArg} arg - The request parameters.
* @returns {Promise.<FilesRelocationResult, Error.<FilesRelocationError>>}
*/
routes.filesMoveV2 = function (arg) {
return this.request('files/move_v2', arg, 'user', 'api', 'rpc');
};
/** /**
* Permanently delete the file or folder at a given path (see * Permanently delete the file or folder at a given path (see
* https://www.dropbox.com/en/help/40). Note: This endpoint is only available * https://www.dropbox.com/en/help/40). Note: This endpoint is only available
@ -746,7 +804,7 @@ routes.filesPropertiesUpdate = function (arg) {
}; };
/** /**
* Restore a file to a specific revision. * Restore a specific revision of a file to the given path.
* @function Dropbox#filesRestore * @function Dropbox#filesRestore
* @arg {FilesRestoreArg} arg - The request parameters. * @arg {FilesRestoreArg} arg - The request parameters.
* @returns {Promise.<FilesFileMetadata, Error.<FilesRestoreError>>} * @returns {Promise.<FilesFileMetadata, Error.<FilesRestoreError>>}
@ -790,7 +848,11 @@ routes.filesSearch = function (arg) {
/** /**
* Create a new file with the contents provided in the request. Do not use this * Create a new file with the contents provided in the request. Do not use this
* to upload a file larger than 150 MB. Instead, create an upload session with * to upload a file larger than 150 MB. Instead, create an upload session with
* upload_session/start. * upload_session/start. Calls to this endpoint will count as data transport
* calls for any Dropbox Business teams with a limit on the number of data
* transport calls allowed per month. For more information, see the Data
* transport limit page
* https://www.dropbox.com/developers/reference/data-transport-limit.
* @function Dropbox#filesUpload * @function Dropbox#filesUpload
* @arg {FilesCommitInfo} arg - The request parameters. * @arg {FilesCommitInfo} arg - The request parameters.
* @returns {Promise.<FilesFileMetadata, Error.<FilesUploadError>>} * @returns {Promise.<FilesFileMetadata, Error.<FilesUploadError>>}
@ -799,10 +861,29 @@ routes.filesUpload = function (arg) {
return this.request('files/upload', arg, 'user', 'content', 'upload'); return this.request('files/upload', arg, 'user', 'content', 'upload');
}; };
/**
* Append more data to an upload session. When the parameter close is set, this
* call will close the session. A single request should not upload more than 150
* MB. The maximum size of a file one can upload to an upload session is 350 GB.
* Calls to this endpoint will count as data transport calls for any Dropbox
* Business teams with a limit on the number of data transport calls allowed per
* month. For more information, see the Data transport limit page
* https://www.dropbox.com/developers/reference/data-transport-limit.
* @function Dropbox#filesUploadSessionAppendV2
* @arg {FilesUploadSessionAppendArg} arg - The request parameters.
* @returns {Promise.<void, Error.<FilesUploadSessionLookupError>>}
*/
routes.filesUploadSessionAppendV2 = function (arg) {
return this.request('files/upload_session/append_v2', arg, 'user', 'content', 'upload');
};
/** /**
* Append more data to an upload session. A single request should not upload * Append more data to an upload session. A single request should not upload
* more than 150 MB. The maximum size of a file one can upload to an upload * more than 150 MB. The maximum size of a file one can upload to an upload
* session is 350 GB. * session is 350 GB. Calls to this endpoint will count as data transport calls
* for any Dropbox Business teams with a limit on the number of data transport
* calls allowed per month. For more information, see the Data transport limit
* page https://www.dropbox.com/developers/reference/data-transport-limit.
* @function Dropbox#filesUploadSessionAppend * @function Dropbox#filesUploadSessionAppend
* @deprecated * @deprecated
* @arg {FilesUploadSessionCursor} arg - The request parameters. * @arg {FilesUploadSessionCursor} arg - The request parameters.
@ -812,22 +893,14 @@ routes.filesUploadSessionAppend = function (arg) {
return this.request('files/upload_session/append', arg, 'user', 'content', 'upload'); return this.request('files/upload_session/append', arg, 'user', 'content', 'upload');
}; };
/**
* Append more data to an upload session. When the parameter close is set, this
* call will close the session. A single request should not upload more than 150
* MB. The maximum size of a file one can upload to an upload session is 350 GB.
* @function Dropbox#filesUploadSessionAppendV2
* @arg {FilesUploadSessionAppendArg} arg - The request parameters.
* @returns {Promise.<void, Error.<FilesUploadSessionLookupError>>}
*/
routes.filesUploadSessionAppendV2 = function (arg) {
return this.request('files/upload_session/append_v2', arg, 'user', 'content', 'upload');
};
/** /**
* Finish an upload session and save the uploaded data to the given file path. A * Finish an upload session and save the uploaded data to the given file path. A
* single request should not upload more than 150 MB. The maximum size of a file * single request should not upload more than 150 MB. The maximum size of a file
* one can upload to an upload session is 350 GB. * one can upload to an upload session is 350 GB. Calls to this endpoint will
* count as data transport calls for any Dropbox Business teams with a limit on
* the number of data transport calls allowed per month. For more information,
* see the Data transport limit page
* https://www.dropbox.com/developers/reference/data-transport-limit.
* @function Dropbox#filesUploadSessionFinish * @function Dropbox#filesUploadSessionFinish
* @arg {FilesUploadSessionFinishArg} arg - The request parameters. * @arg {FilesUploadSessionFinishArg} arg - The request parameters.
* @returns {Promise.<FilesFileMetadata, Error.<FilesUploadSessionFinishError>>} * @returns {Promise.<FilesFileMetadata, Error.<FilesUploadSessionFinishError>>}
@ -849,7 +922,11 @@ routes.filesUploadSessionFinish = function (arg) {
* background. Use upload_session/finish_batch/check to check the job status. * background. Use upload_session/finish_batch/check to check the job status.
* For the same account, this route should be executed serially. That means you * For the same account, this route should be executed serially. That means you
* should not start the next job before current job finishes. We allow up to * should not start the next job before current job finishes. We allow up to
* 1000 entries in a single request. * 1000 entries in a single request. Calls to this endpoint will count as data
* transport calls for any Dropbox Business teams with a limit on the number of
* data transport calls allowed per month. For more information, see the Data
* transport limit page
* https://www.dropbox.com/developers/reference/data-transport-limit.
* @function Dropbox#filesUploadSessionFinishBatch * @function Dropbox#filesUploadSessionFinishBatch
* @arg {FilesUploadSessionFinishBatchArg} arg - The request parameters. * @arg {FilesUploadSessionFinishBatchArg} arg - The request parameters.
* @returns {Promise.<FilesUploadSessionFinishBatchLaunch, Error.<void>>} * @returns {Promise.<FilesUploadSessionFinishBatchLaunch, Error.<void>>}
@ -879,7 +956,11 @@ routes.filesUploadSessionFinishBatchCheck = function (arg) {
* is 350 GB. An upload session can be used for a maximum of 48 hours. * is 350 GB. An upload session can be used for a maximum of 48 hours.
* Attempting to use an UploadSessionStartResult.session_id with * Attempting to use an UploadSessionStartResult.session_id with
* upload_session/append_v2 or upload_session/finish more than 48 hours after * upload_session/append_v2 or upload_session/finish more than 48 hours after
* its creation will return a UploadSessionLookupError.not_found. * its creation will return a UploadSessionLookupError.not_found. Calls to this
* endpoint will count as data transport calls for any Dropbox Business teams
* with a limit on the number of data transport calls allowed per month. For
* more information, see the Data transport limit page
* https://www.dropbox.com/developers/reference/data-transport-limit.
* @function Dropbox#filesUploadSessionStart * @function Dropbox#filesUploadSessionStart
* @arg {FilesUploadSessionStartArg} arg - The request parameters. * @arg {FilesUploadSessionStartArg} arg - The request parameters.
* @returns {Promise.<FilesUploadSessionStartResult, Error.<void>>} * @returns {Promise.<FilesUploadSessionStartResult, Error.<void>>}
@ -1818,39 +1899,41 @@ function responseHandler(res, data) {
return result; return result;
} }
function downloadRequest(path, args, auth, host, accessToken, options) { function downloadRequest(fetch) {
if (auth !== 'user') { return function downloadRequestWithFetch(path, args, auth, host, accessToken, options) {
throw new Error('Unexpected auth type: ' + auth); if (auth !== 'user') {
} throw new Error('Unexpected auth type: ' + auth);
var fetchOptions = {
method: 'POST',
headers: {
Authorization: 'Bearer ' + accessToken,
'Dropbox-API-Arg': httpHeaderSafeJson(args)
} }
};
if (options) { var fetchOptions = {
if (options.selectUser) { method: 'POST',
fetchOptions.headers['Dropbox-API-Select-User'] = options.selectUser; headers: {
} Authorization: 'Bearer ' + accessToken,
if (options.selectAdmin) { 'Dropbox-API-Arg': httpHeaderSafeJson(args)
fetchOptions.headers['Dropbox-API-Select-Admin'] = options.selectAdmin; }
} };
}
return fetch(getBaseURL(host) + path, fetchOptions).then(function (res) { if (options) {
return getDataFromConsumer(res).then(function (data) { if (options.selectUser) {
return [res, data]; fetchOptions.headers['Dropbox-API-Select-User'] = options.selectUser;
}
if (options.selectAdmin) {
fetchOptions.headers['Dropbox-API-Select-Admin'] = options.selectAdmin;
}
}
return fetch(getBaseURL(host) + path, fetchOptions).then(function (res) {
return getDataFromConsumer(res).then(function (data) {
return [res, data];
});
}).then(function (_ref) {
var _ref2 = slicedToArray(_ref, 2),
res = _ref2[0],
data = _ref2[1];
return responseHandler(res, data);
}); });
}).then(function (_ref) { };
var _ref2 = slicedToArray(_ref, 2),
res = _ref2[0],
data = _ref2[1];
return responseHandler(res, data);
});
} }
function parseBodyToType$1(res) { function parseBodyToType$1(res) {
@ -1868,53 +1951,55 @@ function parseBodyToType$1(res) {
}); });
} }
function uploadRequest(path, args, auth, host, accessToken, options) { function uploadRequest(fetch) {
if (auth !== 'user') { return function uploadRequestWithFetch(path, args, auth, host, accessToken, options) {
throw new Error('Unexpected auth type: ' + auth); if (auth !== 'user') {
} throw new Error('Unexpected auth type: ' + auth);
var contents = args.contents;
delete args.contents;
var fetchOptions = {
body: contents,
method: 'POST',
headers: {
Authorization: 'Bearer ' + accessToken,
'Content-Type': 'application/octet-stream',
'Dropbox-API-Arg': httpHeaderSafeJson(args)
} }
var contents = args.contents;
delete args.contents;
var fetchOptions = {
body: contents,
method: 'POST',
headers: {
Authorization: 'Bearer ' + accessToken,
'Content-Type': 'application/octet-stream',
'Dropbox-API-Arg': httpHeaderSafeJson(args)
}
};
if (options) {
if (options.selectUser) {
fetchOptions.headers['Dropbox-API-Select-User'] = options.selectUser;
}
if (options.selectAdmin) {
fetchOptions.headers['Dropbox-API-Select-Admin'] = options.selectAdmin;
}
}
return fetch(getBaseURL(host) + path, fetchOptions).then(function (res) {
return parseBodyToType$1(res);
}).then(function (_ref) {
var _ref2 = slicedToArray(_ref, 2),
res = _ref2[0],
data = _ref2[1];
// maintaining existing API for error codes not equal to 200 range
if (!res.ok) {
// eslint-disable-next-line no-throw-literal
throw {
error: data,
response: res,
status: res.status
};
}
return data;
});
}; };
if (options) {
if (options.selectUser) {
fetchOptions.headers['Dropbox-API-Select-User'] = options.selectUser;
}
if (options.selectAdmin) {
fetchOptions.headers['Dropbox-API-Select-Admin'] = options.selectAdmin;
}
}
return fetch(getBaseURL(host) + path, fetchOptions).then(function (res) {
return parseBodyToType$1(res);
}).then(function (_ref) {
var _ref2 = slicedToArray(_ref, 2),
res = _ref2[0],
data = _ref2[1];
// maintaining existing API for error codes not equal to 200 range
if (!res.ok) {
// eslint-disable-next-line no-throw-literal
throw {
error: data,
response: res,
status: res.status
};
}
return data;
});
} }
function createCommonjsModule(fn, module) { function createCommonjsModule(fn, module) {
@ -3850,78 +3935,76 @@ function numberIsNaN (obj) {
var buffer_1 = buffer.Buffer; var buffer_1 = buffer.Buffer;
function parseBodyToType$2(res) { function parseBodyToType$2(res) {
var clone = res.clone(); if (res.headers.get('Content-Type') === 'application/json') {
return new Promise(function (resolve) { return res.json().then(function (data) {
res.json().then(function (data) { return [res, data];
return resolve(data);
}).catch(function () {
return clone.text().then(function (data) {
return resolve(data);
});
}); });
}).then(function (data) { }
return res.text().then(function (data) {
return [res, data]; return [res, data];
}); });
} }
function rpcRequest(path, body, auth, host, accessToken, options) { function rpcRequest(fetch) {
var fetchOptions = { return function rpcRequestWithFetch(path, body, auth, host, accessToken, options) {
method: 'POST', var fetchOptions = {
body: body ? JSON.stringify(body) : null method: 'POST',
}; body: body ? JSON.stringify(body) : null
var headers = {}; };
if (body) { var headers = {};
headers['Content-Type'] = 'application/json'; if (body) {
} headers['Content-Type'] = 'application/json';
var authHeader = ''; }
var authHeader = '';
switch (auth) { switch (auth) {
case 'app': case 'app':
if (!options.clientId || !options.clientSecret) { if (!options.clientId || !options.clientSecret) {
throw new Error('A client id and secret is required for this function'); throw new Error('A client id and secret is required for this function');
}
authHeader = new buffer_1(options.clientId + ':' + options.clientSecret).toString('base64');
headers.Authorization = 'Basic ' + authHeader;
break;
case 'team':
case 'user':
headers.Authorization = 'Bearer ' + accessToken;
break;
case 'noauth':
break;
default:
throw new Error('Unhandled auth type: ' + auth);
}
if (options) {
if (options.selectUser) {
headers['Dropbox-API-Select-User'] = options.selectUser;
}
if (options.selectAdmin) {
headers['Dropbox-API-Select-Admin'] = options.selectAdmin;
} }
authHeader = new buffer_1(options.clientId + ':' + options.clientSecret).toString('base64');
headers.Authorization = 'Basic ' + authHeader;
break;
case 'team':
case 'user':
headers.Authorization = 'Bearer ' + accessToken;
break;
case 'noauth':
break;
default:
throw new Error('Unhandled auth type: ' + auth);
}
if (options) {
if (options.selectUser) {
headers['Dropbox-API-Select-User'] = options.selectUser;
}
if (options.selectAdmin) {
headers['Dropbox-API-Select-Admin'] = options.selectAdmin;
}
}
fetchOptions.headers = headers;
return fetch(getBaseURL(host) + path, fetchOptions).then(function (res) {
return parseBodyToType$2(res);
}).then(function (_ref) {
var _ref2 = slicedToArray(_ref, 2),
res = _ref2[0],
data = _ref2[1];
// maintaining existing API for error codes not equal to 200 range
if (!res.ok) {
// eslint-disable-next-line no-throw-literal
throw {
error: data,
response: res,
status: res.status
};
} }
return data; fetchOptions.headers = headers;
}); return fetch(getBaseURL(host) + path, fetchOptions).then(function (res) {
return parseBodyToType$2(res);
}).then(function (_ref) {
var _ref2 = slicedToArray(_ref, 2),
res = _ref2[0],
data = _ref2[1];
// maintaining existing API for error codes not equal to 200 range
if (!res.ok) {
// eslint-disable-next-line no-throw-literal
throw {
error: data,
response: res,
status: res.status
};
}
return data;
});
};
} }
/* eslint-disable */ /* eslint-disable */
@ -4018,6 +4101,7 @@ if (!Array.prototype.includes) {
* shared between Dropbox and DropboxTeam classes. It is marked as private so * shared between Dropbox and DropboxTeam classes. It is marked as private so
* that it doesn't show up in the docs because it is never used directly. * that it doesn't show up in the docs because it is never used directly.
* @arg {Object} options * @arg {Object} options
* @arg {Function} [options.fetch] - fetch library for making requests.
* @arg {String} [options.accessToken] - An access token for making authenticated * @arg {String} [options.accessToken] - An access token for making authenticated
* requests. * requests.
* @arg {String} [options.clientId] - The client id for your app. Used to create * @arg {String} [options.clientId] - The client id for your app. Used to create
@ -4054,6 +4138,10 @@ var DropboxBase = function () {
this.clientSecret = options.clientSecret; this.clientSecret = options.clientSecret;
this.selectUser = options.selectUser; this.selectUser = options.selectUser;
this.selectAdmin = options.selectAdmin; this.selectAdmin = options.selectAdmin;
this.fetch = options.fetch || fetch;
if (!options.fetch) {
console.warn('Global fetch is deprecated and will be unsupported in a future version. Please pass fetch function as option when instantiating dropbox instance: new Dropbox({fetch})');
} // eslint-disable-line no-console
} }
/** /**
@ -4198,7 +4286,7 @@ var DropboxBase = function () {
} }
}; };
return fetch(path, fetchOptions).then(function (res) { return this.fetch(path, fetchOptions).then(function (res) {
return parseBodyToType(res); return parseBodyToType(res);
}).then(function (_ref) { }).then(function (_ref) {
var _ref2 = slicedToArray(_ref, 2), var _ref2 = slicedToArray(_ref, 2),
@ -4327,7 +4415,7 @@ var DropboxBase = function () {
key: 'getRpcRequest', key: 'getRpcRequest',
value: function getRpcRequest() { value: function getRpcRequest() {
if (this.rpcRequest === undefined) { if (this.rpcRequest === undefined) {
this.rpcRequest = rpcRequest; this.rpcRequest = rpcRequest(this.fetch);
} }
return this.rpcRequest; return this.rpcRequest;
} }
@ -4340,7 +4428,7 @@ var DropboxBase = function () {
key: 'getDownloadRequest', key: 'getDownloadRequest',
value: function getDownloadRequest() { value: function getDownloadRequest() {
if (this.downloadRequest === undefined) { if (this.downloadRequest === undefined) {
this.downloadRequest = downloadRequest; this.downloadRequest = downloadRequest(this.fetch);
} }
return this.downloadRequest; return this.downloadRequest;
} }
@ -4353,7 +4441,7 @@ var DropboxBase = function () {
key: 'getUploadRequest', key: 'getUploadRequest',
value: function getUploadRequest() { value: function getUploadRequest() {
if (this.uploadRequest === undefined) { if (this.uploadRequest === undefined) {
this.uploadRequest = uploadRequest; this.uploadRequest = uploadRequest(this.fetch);
} }
return this.uploadRequest; return this.uploadRequest;
} }
@ -4367,6 +4455,7 @@ var DropboxBase = function () {
* @classdesc The Dropbox SDK class that provides methods to read, write and * @classdesc The Dropbox SDK class that provides methods to read, write and
* create files or folders in a user's Dropbox. * create files or folders in a user's Dropbox.
* @arg {Object} options * @arg {Object} options
* @arg {Function} [options.fetch] - fetch library for making requests.
* @arg {String} [options.accessToken] - An access token for making authenticated * @arg {String} [options.accessToken] - An access token for making authenticated
* requests. * requests.
* @arg {String} [options.clientId] - The client id for your app. Used to create * @arg {String} [options.clientId] - The client id for your app. Used to create
@ -4807,6 +4896,31 @@ routes$1.teamMembersListContinue = function (arg) {
return this.request('team/members/list/continue', arg, 'team', 'api', 'rpc'); return this.request('team/members/list/continue', arg, 'team', 'api', 'rpc');
}; };
/**
* Moves removed member's files to a different member. This endpoint initiates
* an asynchronous job. To obtain the final result of the job, the client should
* periodically poll members/move_former_member_files/job_status/check.
* Permission : Team member management.
* @function DropboxTeam#teamMembersMoveFormerMemberFiles
* @arg {TeamMembersDataTransferArg} arg - The request parameters.
* @returns {Promise.<AsyncLaunchEmptyResult, Error.<TeamMembersTransferFormerMembersFilesError>>}
*/
routes$1.teamMembersMoveFormerMemberFiles = function (arg) {
return this.request('team/members/move_former_member_files', arg, 'team', 'api', 'rpc');
};
/**
* Once an async_job_id is returned from members/move_former_member_files , use
* this to poll the status of the asynchronous request. Permission : Team member
* management.
* @function DropboxTeam#teamMembersMoveFormerMemberFilesJobStatusCheck
* @arg {AsyncPollArg} arg - The request parameters.
* @returns {Promise.<AsyncPollEmptyResult, Error.<AsyncPollError>>}
*/
routes$1.teamMembersMoveFormerMemberFilesJobStatusCheck = function (arg) {
return this.request('team/members/move_former_member_files/job_status/check', arg, 'team', 'api', 'rpc');
};
/** /**
* Recover a deleted member. Permission : Team member management Exactly one of * Recover a deleted member. Permission : Team member management Exactly one of
* team_member_id, email, or external_id must be provided to identify the user * team_member_id, email, or external_id must be provided to identify the user
@ -4914,7 +5028,7 @@ routes$1.teamMembersUnsuspend = function (arg) {
* be owned by other users or other teams. Duplicates may occur in the list. * be owned by other users or other teams. Duplicates may occur in the list.
* @function DropboxTeam#teamNamespacesList * @function DropboxTeam#teamNamespacesList
* @arg {TeamTeamNamespacesListArg} arg - The request parameters. * @arg {TeamTeamNamespacesListArg} arg - The request parameters.
* @returns {Promise.<TeamTeamNamespacesListResult, Error.<void>>} * @returns {Promise.<TeamTeamNamespacesListResult, Error.<TeamTeamNamespacesListError>>}
*/ */
routes$1.teamNamespacesList = function (arg) { routes$1.teamNamespacesList = function (arg) {
return this.request('team/namespaces/list', arg, 'team', 'api', 'rpc'); return this.request('team/namespaces/list', arg, 'team', 'api', 'rpc');

0
sync/vendor/zipjs/LICENSE → vendor/zipjs-browserify/LICENSE vendored Executable file → Normal file
View File

8
vendor/zipjs-browserify/README.md vendored Normal file
View File

@ -0,0 +1,8 @@
## zipjs-browserify v1.0.1
zipjs installed via npm - source repo:
- https://github.com/juliangruber/zipjs-browserify/tree/v1.0.1/vendor/deflate.js
- https://github.com/juliangruber/zipjs-browserify/tree/v1.0.1/vendor/inflate.js
- https://github.com/juliangruber/zipjs-browserify/tree/v1.0.1/vendor/z-worker.js
- https://github.com/juliangruber/zipjs-browserify/tree/v1.0.1/vendor/zip.js

0
sync/vendor/zipjs/deflate.js → vendor/zipjs-browserify/deflate.js vendored Executable file → Normal file
View File

0
sync/vendor/zipjs/inflate.js → vendor/zipjs-browserify/inflate.js vendored Executable file → Normal file
View File

View File

0
sync/vendor/zipjs/zip.js → vendor/zipjs-browserify/zip.js vendored Executable file → Normal file
View File