dropbox-client
Advanced tools
Comparing version 1.0.0 to 2.0.0
{ | ||
"name": "dropbox-client", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Dropbox API client", | ||
"author": "Michael Jackson", | ||
"license": "MIT", | ||
"webpack": "lib", | ||
"browser": "umd/dropbox-client.min.js", | ||
"main": "lib", | ||
@@ -25,3 +23,3 @@ "files": [ | ||
"dependencies": { | ||
"http-client": "^2.4.1", | ||
"http-client": "^3.0.0", | ||
"query-string": "^3.0.1" | ||
@@ -47,3 +45,9 @@ }, | ||
"url": "https://github.com/mjackson/dropbox-client.git" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015", | ||
"stage-1" | ||
] | ||
} | ||
} |
@@ -9,3 +9,3 @@ # dropbox-client [![Travis][build-badge]][build] [![npm package][npm-badge]][npm] | ||
[dropbox-client](https://www.npmjs.com/package/dropbox-client) is a client for the Dropbox developer API v2 that uses JavaScript's [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). | ||
[dropbox-client](https://www.npmjs.com/package/dropbox-client) is a client for the [Dropbox API v2](https://www.dropbox.com/developers). | ||
@@ -18,2 +18,4 @@ ## Installation | ||
dropbox-client requires you to bring your own [global `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch) function. [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) is a great polyfill. | ||
Then, use as you would anything else: | ||
@@ -23,28 +25,8 @@ | ||
// using ES6 modules | ||
import { fetch, createFetch } from 'dropbox-client' | ||
import { getFile } from 'dropbox-client' | ||
// using CommonJS modules | ||
var fetch = require('dropbox-client').fetch | ||
var createFetch = require('dropbox-client').createFetch | ||
var getFile = require('dropbox-client').getFile | ||
``` | ||
In node, dropbox-client automatically uses the [node-fetch](https://github.com/bitinn/node-fetch) library under the hood so no extra configuration is necessary. You'll need to be running node >= 4. Be sure to read about the [known differences](https://github.com/bitinn/node-fetch/blob/master/LIMITS.md) between node-fetch and [the fetch spec](https://fetch.spec.whatwg.org/). | ||
You'll need to shim `window.fetch` in [browsers that do not support it](http://caniuse.com/#feat=fetch) (Safari and IE). [github/fetch](https://github.com/github/fetch) is a great polyfill. | ||
If you're bundling dropbox-client with [webpack](https://webpack.github.io/), you'll want to include the following in your webpack config: | ||
```js | ||
const webpack = require('webpack') | ||
module.exports = { | ||
plugins: [ | ||
new webpack.IgnorePlugin(/node-fetch/), | ||
new webpack.DefinePlugin({ | ||
'typeof window': JSON.stringify('object') | ||
}) | ||
] | ||
} | ||
``` | ||
The UMD build is also available on [npmcdn](https://npmcdn.com): | ||
@@ -51,0 +33,0 @@ |
@@ -257,3 +257,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (!ret[key]) { | ||
if (!ret.hasOwnProperty(key)) { | ||
ret[key] = val; | ||
@@ -267,3 +267,3 @@ } else if (Array.isArray(ret[key])) { | ||
return ret; | ||
}, Object.create(null)); | ||
}, {}); | ||
}; | ||
@@ -319,8 +319,4 @@ | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _queryString = __webpack_require__(2); | ||
var globalFetch = typeof fetch !== 'function' ? ( false ? 'undefined' : _typeof(window)) !== 'object' && __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"node-fetch\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())) : fetch; | ||
var resolvePromise = function resolvePromise(promise, callback) { | ||
@@ -350,3 +346,3 @@ return promise.then(function (value) { | ||
var enhancedFetch = enhanceFetch(globalFetch); | ||
var enhancedFetch = enhanceFetch(fetch); | ||
@@ -396,3 +392,3 @@ var stringifyJSON = function stringifyJSON(json) { | ||
return enhanceFetch(function (input, options) { | ||
return stack(globalFetch, input, options); | ||
return stack(fetch, input, options); | ||
}); | ||
@@ -399,0 +395,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DropboxClient=t():e.DropboxClient=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);Object.defineProperty(t,"generateAuthorizeURL",{enumerable:!0,get:function(){return r.generateAuthorizeURL}}),Object.defineProperty(t,"getBearerToken",{enumerable:!0,get:function(){return r.getBearerToken}});var o=n(5);Object.defineProperty(t,"copy",{enumerable:!0,get:function(){return o.copy}}),Object.defineProperty(t,"createFolder",{enumerable:!0,get:function(){return o.createFolder}}),Object.defineProperty(t,"getMetadata",{enumerable:!0,get:function(){return o.getMetadata}}),Object.defineProperty(t,"listFolder",{enumerable:!0,get:function(){return o.listFolder}}),Object.defineProperty(t,"listFolderContinue",{enumerable:!0,get:function(){return o.listFolderContinue}}),Object.defineProperty(t,"getAccount",{enumerable:!0,get:function(){return o.getAccount}}),Object.defineProperty(t,"getAccountBatch",{enumerable:!0,get:function(){return o.getAccountBatch}}),Object.defineProperty(t,"getCurrentAccount",{enumerable:!0,get:function(){return o.getCurrentAccount}}),Object.defineProperty(t,"getSpaceUsage",{enumerable:!0,get:function(){return o.getSpaceUsage}});var u=n(4);Object.defineProperty(t,"download",{enumerable:!0,get:function(){return u.download}}),Object.defineProperty(t,"getPreview",{enumerable:!0,get:function(){return u.getPreview}}),Object.defineProperty(t,"getThumbnail",{enumerable:!0,get:function(){return u.getThumbnail}}),Object.defineProperty(t,"upload",{enumerable:!0,get:function(){return u.upload}}),Object.defineProperty(t,"getFile",{enumerable:!0,get:function(){return u.download}}),Object.defineProperty(t,"putFile",{enumerable:!0,get:function(){return u.upload}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.requestInfo=t.parseJSON=t.parseText=t.handleResponse=t.params=t.json=t.body=t.query=t.base=t.accept=t.auth=t.header=t.method=t.createFetch=t.createStack=t.fetch=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=n(2),u="function"!=typeof fetch?"object"!==r(window)&&n(!function(){var e=new Error('Cannot find module "node-fetch"');throw e.code="MODULE_NOT_FOUND",e}()):fetch,i=function(e,t){return e.then(function(e){return t(null,e)},t)},c=function(e){return function(t,n,r){"function"!=typeof r&&("function"==typeof n?(r=n,n=void 0):"function"==typeof t&&(r=t,t=void 0));var o=e(t,n);return"function"==typeof r?i(o,r):o}},a=c(u),f=function(e){return"string"==typeof e?e:JSON.stringify(e)},d=function(e){return"string"==typeof e?e:(0,o.stringify)(e)},l=function(e,t,n){return e(t,n)};t.fetch=a;var s=t.createStack=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return 0===t.length?l:t.reduceRight(function(e,t){return function(n,r,o){return t(function(t,r){return e(n,t,r)},r,o)}})},p=(t.createFetch=function(){if(0===arguments.length)return a;var e=s.apply(void 0,arguments);return c(function(t,n){return e(u,t,n)})},function(e,t,n){(e.headers||(e.headers={}))[t]=n}),h=(t.method=function(e){return function(t,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return r.method=e,t(n,r)}},t.header=function(e,t){return function(n,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return p(o,e,t),n(r,o)}}),g=(t.auth=function(e){return h("Authorization",e)},t.accept=function(e){return h("Accept",e)},t.base=function(e){return function(t,n,r){return t(e+(n||""),r)}},t.query=function(e){var t=d(e);return function(e,n,r){return e(n+(-1===n.indexOf("?")?"?":"&")+t,r)}}),v=t.body=function(e,t){return function(n,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=e,null!=e.length&&p(o,"Content-Length",e.length),t&&p(o,"Content-Type",t),n(r,o)}},b=(t.json=function(e){return v(f(e),"application/json")},t.params=function(e){var t=d(e);return function(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(r.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?g(t):v(t,"application/x-www-form-urlencoded");return u(e,n,r)}},t.handleResponse=function(e){return function(t,n,r){return t(n,r).then(e)}});t.parseText=function(){var e=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return b(function(t){return t.text().then(function(n){return t[e]=n,t})})},t.parseJSON=function(){var e=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return b(function(t){return t.json().then(function(n){return t[e]=n,t},function(e){throw new Error("Error parsing JSON: "+e.stack)})})},t.requestInfo=function(){return function(e,t,n){return e(t,n).then(function(e){return e.requestInput=t,e.requestOptions=n,e},function(){var e=arguments.length<=0||void 0===arguments[0]?new Error:arguments[0];throw e.requestInput=t,e.requestOptions=n,e})}}},function(e,t,n){"use strict";var r=n(6);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e){return"string"!=typeof e?{}:(e=e.trim().replace(/^(\?|#|&)/,""),e?e.split("&").reduce(function(e,t){var n=t.replace(/\+/g," ").split("="),r=n.shift(),o=n.length>0?n.join("="):void 0;return r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),e[r]?Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]:e[r]=o,e},Object.create(null)):{})},t.stringify=function(e){return e?Object.keys(e).sort().map(function(t){var n=e[t];return void 0===n?"":null===n?t:Array.isArray(n)?n.slice().sort().map(function(e){return r(t)+"="+r(e)}).join("&"):r(t)+"="+r(n)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBearerToken=t.generateAuthorizeURL=void 0;var r=n(2),o=n(1),u=(t.generateAuthorizeURL=function(e,t,n){var o=arguments.length<=3||void 0===arguments[3]?!1:arguments[3];return"https://www.dropbox.com/1/oauth2/authorize?"+(0,r.stringify)({response_type:"code",client_id:e,redirect_uri:t,state:n,force_reapprove:o})},(0,o.createStack)((0,o.handleResponse)(function(e){var t=e.jsonData;if(t.error)throw new Error(t.error+": "+t.error_description);return t}),(0,o.parseJSON)()));t.getBearerToken=function(e,t,n,r){var i=(0,o.createFetch)((0,o.method)("POST"),(0,o.params)({client_id:e,client_secret:t,grant_type:"authorization_code",redirect_uri:r,code:n}),u);return i("https://api.dropboxapi.com/1/oauth2/token").then(function(e){return e.access_token})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.upload=t.getThumbnail=t.getPreview=t.download=void 0;var r=n(1),o=function(e){return(0,r.auth)("Bearer "+e)},u=function(e){return(0,r.base)("https://content.dropboxapi.com/"+e)},i=function(e){return(0,r.header)("Dropbox-API-Arg",JSON.stringify(e))},c=function(){var e=arguments.length<=0||void 0===arguments[0]?"apiResult":arguments[0];return(0,r.handleResponse)(function(t){var n=t.headers.get("Dropbox-API-Result");return n&&(t[e]=JSON.parse(n)),t})},a=(0,r.createStack)((0,r.handleResponse)(function(e){return{metadata:e.apiResult,content:e.body}}),c()),f=function(e,t,n){return(0,r.createFetch)(o(e),u(2),i(n),a)(t)},d=function(e,t,n,c,a){return(0,r.createFetch)(o(e),u(2),i(a),(0,r.body)(t,n))(c)};t.download=function(e,t){return f(e,"/files/download",{path:t})},t.getPreview=function(e,t){return f(e,"/files/get_preview",{path:t})},t.getThumbnail=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?"jpeg":arguments[2],r=arguments.length<=3||void 0===arguments[3]?"w64h64":arguments[3];return f(e,"/files/get_thumbnail",{path:t,format:n,size:r})},t.upload=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?"application/octet-stream":arguments[2],r=arguments.length<=3||void 0===arguments[3]?"add":arguments[3],o=arguments.length<=4||void 0===arguments[4]?!1:arguments[4],u=arguments.length<=5||void 0===arguments[5]?void 0:arguments[5],i=arguments.length<=6||void 0===arguments[6]?!1:arguments[6];return d(e,t,n,"/files/upload",{mode:r,autorename:o,client_modified:u,mute:i})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSpaceUsage=t.getCurrentAccount=t.getAccountBatch=t.getAccount=t.listFolderContinue=t.listFolder=t.getMetadata=t.createFolder=t.copy=void 0;var r=n(1),o=function(e){return(0,r.auth)("Bearer "+e)},u=function(e){return(0,r.base)("https://api.dropboxapi.com/"+e)},i=(0,r.createStack)((0,r.handleResponse)(function(e){var t=e.jsonData;if(t.error_summary)throw new Error(t.error_summary);return t}),(0,r.parseJSON)()),c=function(e,t,n){return(0,r.createFetch)(o(e),u(2),(0,r.method)("POST"),(0,r.json)(n),i)(t)};t.copy=function(e,t,n){return c(e,"/files/copy",{from_path:t,to_path:n})},t.createFolder=function(e,t){return c(e,"/files/create_folder",{path:t})},t.getMetadata=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],r=arguments.length<=3||void 0===arguments[3]?!1:arguments[3];return c(e,"/files/get_metadata",{path:t,include_media_info:n,include_deleted:r})},t.listFolder=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],r=arguments.length<=3||void 0===arguments[3]?!1:arguments[3],o=arguments.length<=4||void 0===arguments[4]?!1:arguments[4];return c(e,"/files/list_folder",{path:t,recursive:n,include_media_info:r,include_deleted:o})},t.listFolderContinue=function(e,t){return c(e,"/files/list_folder/continue",{cursor:t})},t.getAccount=function(e,t){return c(e,"/users/get_account",{account_id:t})},t.getAccountBatch=function(e,t){return c(e,"/users/get_account_batch",{account_ids:t})},t.getCurrentAccount=function(e){return(0,r.createFetch)(o(e),u(2),(0,r.method)("POST"),i)("/users/get_current_account")},t.getSpaceUsage=function(e){return(0,r.createFetch)(o(e),u(2),(0,r.method)("POST"),i)("/users/get_space_usage")}},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DropboxClient=t():e.DropboxClient=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3);Object.defineProperty(t,"generateAuthorizeURL",{enumerable:!0,get:function(){return r.generateAuthorizeURL}}),Object.defineProperty(t,"getBearerToken",{enumerable:!0,get:function(){return r.getBearerToken}});var o=n(5);Object.defineProperty(t,"copy",{enumerable:!0,get:function(){return o.copy}}),Object.defineProperty(t,"createFolder",{enumerable:!0,get:function(){return o.createFolder}}),Object.defineProperty(t,"getMetadata",{enumerable:!0,get:function(){return o.getMetadata}}),Object.defineProperty(t,"listFolder",{enumerable:!0,get:function(){return o.listFolder}}),Object.defineProperty(t,"listFolderContinue",{enumerable:!0,get:function(){return o.listFolderContinue}}),Object.defineProperty(t,"getAccount",{enumerable:!0,get:function(){return o.getAccount}}),Object.defineProperty(t,"getAccountBatch",{enumerable:!0,get:function(){return o.getAccountBatch}}),Object.defineProperty(t,"getCurrentAccount",{enumerable:!0,get:function(){return o.getCurrentAccount}}),Object.defineProperty(t,"getSpaceUsage",{enumerable:!0,get:function(){return o.getSpaceUsage}});var u=n(4);Object.defineProperty(t,"download",{enumerable:!0,get:function(){return u.download}}),Object.defineProperty(t,"getPreview",{enumerable:!0,get:function(){return u.getPreview}}),Object.defineProperty(t,"getThumbnail",{enumerable:!0,get:function(){return u.getThumbnail}}),Object.defineProperty(t,"upload",{enumerable:!0,get:function(){return u.upload}}),Object.defineProperty(t,"getFile",{enumerable:!0,get:function(){return u.download}}),Object.defineProperty(t,"putFile",{enumerable:!0,get:function(){return u.upload}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.requestInfo=t.parseJSON=t.parseText=t.handleResponse=t.params=t.json=t.body=t.query=t.base=t.accept=t.auth=t.header=t.method=t.createFetch=t.createStack=t.fetch=void 0;var r=n(2),o=function(e,t){return e.then(function(e){return t(null,e)},t)},u=function(e){return function(t,n,r){"function"!=typeof r&&("function"==typeof n?(r=n,n=void 0):"function"==typeof t&&(r=t,t=void 0));var u=e(t,n);return"function"==typeof r?o(u,r):u}},i=u(fetch),c=function(e){return"string"==typeof e?e:JSON.stringify(e)},a=function(e){return"string"==typeof e?e:(0,r.stringify)(e)},f=function(e,t,n){return e(t,n)};t.fetch=i;var d=t.createStack=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return 0===t.length?f:t.reduceRight(function(e,t){return function(n,r,o){return t(function(t,r){return e(n,t,r)},r,o)}})},l=(t.createFetch=function(){if(0===arguments.length)return i;var e=d.apply(void 0,arguments);return u(function(t,n){return e(fetch,t,n)})},function(e,t,n){(e.headers||(e.headers={}))[t]=n}),s=(t.method=function(e){return function(t,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return r.method=e,t(n,r)}},t.header=function(e,t){return function(n,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return l(o,e,t),n(r,o)}}),p=(t.auth=function(e){return s("Authorization",e)},t.accept=function(e){return s("Accept",e)},t.base=function(e){return function(t,n,r){return t(e+(n||""),r)}},t.query=function(e){var t=a(e);return function(e,n,r){return e(n+(-1===n.indexOf("?")?"?":"&")+t,r)}}),g=t.body=function(e,t){return function(n,r){var o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return o.body=e,null!=e.length&&l(o,"Content-Length",e.length),t&&l(o,"Content-Type",t),n(r,o)}},h=(t.json=function(e){return g(c(e),"application/json")},t.params=function(e){var t=a(e);return function(e,n){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],o=(r.method||"GET").toUpperCase(),u="GET"===o||"HEAD"===o?p(t):g(t,"application/x-www-form-urlencoded");return u(e,n,r)}},t.handleResponse=function(e){return function(t,n,r){return t(n,r).then(e)}});t.parseText=function(){var e=arguments.length<=0||void 0===arguments[0]?"textString":arguments[0];return h(function(t){return t.text().then(function(n){return t[e]=n,t})})},t.parseJSON=function(){var e=arguments.length<=0||void 0===arguments[0]?"jsonData":arguments[0];return h(function(t){return t.json().then(function(n){return t[e]=n,t},function(e){throw new Error("Error parsing JSON: "+e.stack)})})},t.requestInfo=function(){return function(e,t,n){return e(t,n).then(function(e){return e.requestInput=t,e.requestOptions=n,e},function(){var e=arguments.length<=0||void 0===arguments[0]?new Error:arguments[0];throw e.requestInput=t,e.requestOptions=n,e})}}},function(e,t,n){"use strict";var r=n(6);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e){return"string"!=typeof e?{}:(e=e.trim().replace(/^(\?|#|&)/,""),e?e.split("&").reduce(function(e,t){var n=t.replace(/\+/g," ").split("="),r=n.shift(),o=n.length>0?n.join("="):void 0;return r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),e.hasOwnProperty(r)?Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]:e[r]=o,e},{}):{})},t.stringify=function(e){return e?Object.keys(e).sort().map(function(t){var n=e[t];return void 0===n?"":null===n?t:Array.isArray(n)?n.slice().sort().map(function(e){return r(t)+"="+r(e)}).join("&"):r(t)+"="+r(n)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBearerToken=t.generateAuthorizeURL=void 0;var r=n(2),o=n(1),u=(t.generateAuthorizeURL=function(e,t,n){var o=arguments.length<=3||void 0===arguments[3]?!1:arguments[3];return"https://www.dropbox.com/1/oauth2/authorize?"+(0,r.stringify)({response_type:"code",client_id:e,redirect_uri:t,state:n,force_reapprove:o})},(0,o.createStack)((0,o.handleResponse)(function(e){var t=e.jsonData;if(t.error)throw new Error(t.error+": "+t.error_description);return t}),(0,o.parseJSON)()));t.getBearerToken=function(e,t,n,r){var i=(0,o.createFetch)((0,o.method)("POST"),(0,o.params)({client_id:e,client_secret:t,grant_type:"authorization_code",redirect_uri:r,code:n}),u);return i("https://api.dropboxapi.com/1/oauth2/token").then(function(e){return e.access_token})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.upload=t.getThumbnail=t.getPreview=t.download=void 0;var r=n(1),o=function(e){return(0,r.auth)("Bearer "+e)},u=function(e){return(0,r.base)("https://content.dropboxapi.com/"+e)},i=function(e){return(0,r.header)("Dropbox-API-Arg",JSON.stringify(e))},c=function(){var e=arguments.length<=0||void 0===arguments[0]?"apiResult":arguments[0];return(0,r.handleResponse)(function(t){var n=t.headers.get("Dropbox-API-Result");return n&&(t[e]=JSON.parse(n)),t})},a=(0,r.createStack)((0,r.handleResponse)(function(e){return{metadata:e.apiResult,content:e.body}}),c()),f=function(e,t,n){return(0,r.createFetch)(o(e),u(2),i(n),a)(t)},d=function(e,t,n,c,a){return(0,r.createFetch)(o(e),u(2),i(a),(0,r.body)(t,n))(c)};t.download=function(e,t){return f(e,"/files/download",{path:t})},t.getPreview=function(e,t){return f(e,"/files/get_preview",{path:t})},t.getThumbnail=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?"jpeg":arguments[2],r=arguments.length<=3||void 0===arguments[3]?"w64h64":arguments[3];return f(e,"/files/get_thumbnail",{path:t,format:n,size:r})},t.upload=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?"application/octet-stream":arguments[2],r=arguments.length<=3||void 0===arguments[3]?"add":arguments[3],o=arguments.length<=4||void 0===arguments[4]?!1:arguments[4],u=arguments.length<=5||void 0===arguments[5]?void 0:arguments[5],i=arguments.length<=6||void 0===arguments[6]?!1:arguments[6];return d(e,t,n,"/files/upload",{mode:r,autorename:o,client_modified:u,mute:i})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSpaceUsage=t.getCurrentAccount=t.getAccountBatch=t.getAccount=t.listFolderContinue=t.listFolder=t.getMetadata=t.createFolder=t.copy=void 0;var r=n(1),o=function(e){return(0,r.auth)("Bearer "+e)},u=function(e){return(0,r.base)("https://api.dropboxapi.com/"+e)},i=(0,r.createStack)((0,r.handleResponse)(function(e){var t=e.jsonData;if(t.error_summary)throw new Error(t.error_summary);return t}),(0,r.parseJSON)()),c=function(e,t,n){return(0,r.createFetch)(o(e),u(2),(0,r.method)("POST"),(0,r.json)(n),i)(t)};t.copy=function(e,t,n){return c(e,"/files/copy",{from_path:t,to_path:n})},t.createFolder=function(e,t){return c(e,"/files/create_folder",{path:t})},t.getMetadata=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],r=arguments.length<=3||void 0===arguments[3]?!1:arguments[3];return c(e,"/files/get_metadata",{path:t,include_media_info:n,include_deleted:r})},t.listFolder=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],r=arguments.length<=3||void 0===arguments[3]?!1:arguments[3],o=arguments.length<=4||void 0===arguments[4]?!1:arguments[4];return c(e,"/files/list_folder",{path:t,recursive:n,include_media_info:r,include_deleted:o})},t.listFolderContinue=function(e,t){return c(e,"/files/list_folder/continue",{cursor:t})},t.getAccount=function(e,t){return c(e,"/users/get_account",{account_id:t})},t.getAccountBatch=function(e,t){return c(e,"/users/get_account_batch",{account_ids:t})},t.getCurrentAccount=function(e){return(0,r.createFetch)(o(e),u(2),(0,r.method)("POST"),i)("/users/get_current_account")},t.getSpaceUsage=function(e){return(0,r.createFetch)(o(e),u(2),(0,r.method)("POST"),i)("/users/get_space_usage")}},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}}])}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9
44505
816
36
+ Addedhttp-client@3.1.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedhttp-client@2.4.2(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedsafer-buffer@2.1.2(transitive)
Updatedhttp-client@^3.0.0