files.com 1.0.200 → 1.0.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_VERSION +1 -1
- package/lib/Api.js +11 -8
- package/lib/models/File.js +4 -2
- package/package.json +1 -1
- package/src/Api.js +10 -7
- package/src/models/File.js +1 -0
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.203
|
package/lib/Api.js
CHANGED
@@ -203,6 +203,7 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
|
|
203
203
|
sessionId,
|
204
204
|
isCreatingSession,
|
205
205
|
apiKey,
|
206
|
+
updatedOptions,
|
206
207
|
requestPath,
|
207
208
|
hasParams,
|
208
209
|
pairs,
|
@@ -215,8 +216,9 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
|
|
215
216
|
params = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
|
216
217
|
options = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : {};
|
217
218
|
metadata = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
|
218
|
-
headers = _objectSpread(_objectSpread({
|
219
|
-
Accept: 'application/json'
|
219
|
+
headers = _objectSpread(_objectSpread({
|
220
|
+
Accept: 'application/json'
|
221
|
+
}, options.headers), {}, {
|
220
222
|
'User-Agent': 'Files.com JavaScript SDK v1.0'
|
221
223
|
});
|
222
224
|
isExternal = /^[a-zA-Z]+:\/\//.test(path);
|
@@ -258,6 +260,9 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
|
|
258
260
|
headers['X-FilesAPI-Key'] = apiKey;
|
259
261
|
|
260
262
|
case 17:
|
263
|
+
updatedOptions = _objectSpread(_objectSpread({}, options), {}, {
|
264
|
+
headers: headers
|
265
|
+
});
|
261
266
|
requestPath = path;
|
262
267
|
hasParams = (0, _utils.isObject)(params) && !(0, _utils.isEmpty)(params);
|
263
268
|
|
@@ -273,17 +278,15 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
|
|
273
278
|
requestPath += path.includes('?') ? '&' : '?';
|
274
279
|
requestPath += pairs.join('&');
|
275
280
|
} else {
|
276
|
-
|
281
|
+
updatedOptions.data = JSON.stringify(params);
|
277
282
|
headers['Content-Type'] = 'application/json';
|
278
283
|
}
|
279
284
|
}
|
280
285
|
|
281
|
-
options.headers = headers;
|
282
|
-
|
283
286
|
if (_Files.default.shouldDebugRequest()) {
|
284
287
|
_Logger.default.debug('Request Options:');
|
285
288
|
|
286
|
-
_Logger.default.debug(_objectSpread(_objectSpread({},
|
289
|
+
_Logger.default.debug(_objectSpread(_objectSpread({}, updatedOptions), {}, {
|
287
290
|
data: hasParams ? "payload keys: ".concat(Object.keys(params).join(', ')) : '(none)',
|
288
291
|
headers: _objectSpread(_objectSpread({}, headers), {}, {
|
289
292
|
'X-FilesAPI-Key': '<redacted>'
|
@@ -292,11 +295,11 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
|
|
292
295
|
}
|
293
296
|
|
294
297
|
_context3.next = 24;
|
295
|
-
return Api._sendVerbatim(requestPath, verb,
|
298
|
+
return Api._sendVerbatim(requestPath, verb, updatedOptions);
|
296
299
|
|
297
300
|
case 24:
|
298
301
|
response = _context3.sent;
|
299
|
-
return _context3.abrupt("return", Api._autoPaginate(path, verb, params,
|
302
|
+
return _context3.abrupt("return", Api._autoPaginate(path, verb, params, updatedOptions, response, metadata));
|
300
303
|
|
301
304
|
case 26:
|
302
305
|
case "end":
|
package/lib/models/File.js
CHANGED
@@ -31,6 +31,8 @@ var _Logger = _interopRequireDefault(require("../Logger"));
|
|
31
31
|
|
32
32
|
var _utils = require("../utils");
|
33
33
|
|
34
|
+
var _FileAction = _interopRequireDefault(require("./FileAction"));
|
35
|
+
|
34
36
|
var _FileUploadPart = _interopRequireDefault(require("./FileUploadPart"));
|
35
37
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -663,7 +665,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
663
665
|
|
664
666
|
case 24:
|
665
667
|
response = _context8.sent;
|
666
|
-
return _context8.abrupt("return", new
|
668
|
+
return _context8.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
667
669
|
|
668
670
|
case 26:
|
669
671
|
case "end":
|
@@ -757,7 +759,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
757
759
|
|
758
760
|
case 24:
|
759
761
|
response = _context9.sent;
|
760
|
-
return _context9.abrupt("return", new
|
762
|
+
return _context9.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
761
763
|
|
762
764
|
case 26:
|
763
765
|
case "end":
|
package/package.json
CHANGED
package/src/Api.js
CHANGED
@@ -117,8 +117,8 @@ class Api {
|
|
117
117
|
|
118
118
|
static sendRequest = async (path, verb, params = null, options = {}, metadata = null) => {
|
119
119
|
const headers = {
|
120
|
-
...options.headers,
|
121
120
|
Accept: 'application/json',
|
121
|
+
...options.headers,
|
122
122
|
'User-Agent': 'Files.com JavaScript SDK v1.0',
|
123
123
|
}
|
124
124
|
|
@@ -145,6 +145,11 @@ class Api {
|
|
145
145
|
}
|
146
146
|
}
|
147
147
|
|
148
|
+
const updatedOptions = {
|
149
|
+
...options,
|
150
|
+
headers,
|
151
|
+
}
|
152
|
+
|
148
153
|
let requestPath = path
|
149
154
|
const hasParams = isObject(params) && !isEmpty(params)
|
150
155
|
|
@@ -154,17 +159,15 @@ class Api {
|
|
154
159
|
requestPath += path.includes('?') ? '&' : '?'
|
155
160
|
requestPath += pairs.join('&')
|
156
161
|
} else {
|
157
|
-
|
162
|
+
updatedOptions.data = JSON.stringify(params)
|
158
163
|
headers['Content-Type'] = 'application/json'
|
159
164
|
}
|
160
165
|
}
|
161
166
|
|
162
|
-
options.headers = headers
|
163
|
-
|
164
167
|
if (Files.shouldDebugRequest()) {
|
165
168
|
Logger.debug('Request Options:')
|
166
169
|
Logger.debug({
|
167
|
-
...
|
170
|
+
...updatedOptions,
|
168
171
|
data: hasParams
|
169
172
|
? `payload keys: ${Object.keys(params).join(', ')}`
|
170
173
|
: '(none)',
|
@@ -175,9 +178,9 @@ class Api {
|
|
175
178
|
})
|
176
179
|
}
|
177
180
|
|
178
|
-
const response = await Api._sendVerbatim(requestPath, verb,
|
181
|
+
const response = await Api._sendVerbatim(requestPath, verb, updatedOptions)
|
179
182
|
|
180
|
-
return Api._autoPaginate(path, verb, params,
|
183
|
+
return Api._autoPaginate(path, verb, params, updatedOptions, response, metadata)
|
181
184
|
}
|
182
185
|
}
|
183
186
|
|
package/src/models/File.js
CHANGED
@@ -5,6 +5,7 @@ import Api from '../Api'
|
|
5
5
|
import * as errors from '../Errors'
|
6
6
|
import Logger from '../Logger'
|
7
7
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
8
|
+
import FileAction from './FileAction'
|
8
9
|
import FileUploadPart from './FileUploadPart'
|
9
10
|
|
10
11
|
/**
|