files.com 1.0.161 → 1.0.164
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/README.md +1 -1
- package/_VERSION +1 -1
- package/lib/models/File.js +1 -1
- package/lib/models/RemoteServer.js +39 -17
- package/lib/models/SsoStrategy.js +96 -34
- package/package.json +1 -1
- package/src/models/File.js +1 -1
- package/src/models/RemoteServer.js +16 -0
- package/src/models/SsoStrategy.js +26 -0
- package/test/src/index.js +8 -4
package/README.md
CHANGED
@@ -136,7 +136,7 @@ You can set the following global properties using static methods on the `Files`
|
|
136
136
|
#### Getting a file record by path
|
137
137
|
|
138
138
|
import File from 'files.com/lib/models/File'
|
139
|
-
const foundFile = await File.
|
139
|
+
const foundFile = await File.findDownload(remoteFilePath)
|
140
140
|
|
141
141
|
#### Download a file (not available in browser)
|
142
142
|
|
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.164
|
package/lib/models/File.js
CHANGED
@@ -1166,7 +1166,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
1166
1166
|
return _ref21.apply(this, arguments);
|
1167
1167
|
};
|
1168
1168
|
}());
|
1169
|
-
(0, _defineProperty2.default)(File, "
|
1169
|
+
(0, _defineProperty2.default)(File, "findDownload", /*#__PURE__*/function () {
|
1170
1170
|
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
|
1171
1171
|
var response;
|
1172
1172
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
@@ -245,6 +245,12 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
|
|
245
245
|
(0, _defineProperty2.default)(this, "setS3CompatibleEndpoint", function (value) {
|
246
246
|
_this.attributes.s3_compatible_endpoint = value;
|
247
247
|
});
|
248
|
+
(0, _defineProperty2.default)(this, "getS3CompatibleRegion", function () {
|
249
|
+
return _this.attributes.s3_compatible_region;
|
250
|
+
});
|
251
|
+
(0, _defineProperty2.default)(this, "setS3CompatibleRegion", function (value) {
|
252
|
+
_this.attributes.s3_compatible_region = value;
|
253
|
+
});
|
248
254
|
(0, _defineProperty2.default)(this, "getS3CompatibleAccessKey", function () {
|
249
255
|
return _this.attributes.s3_compatible_access_key;
|
250
256
|
});
|
@@ -660,43 +666,51 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
|
|
660
666
|
throw new Error("Bad parameter: s3_compatible_endpoint must be of type String, received ".concat((0, _utils.getType)(s3_compatible_endpoint)));
|
661
667
|
|
662
668
|
case 82:
|
663
|
-
if (!(params['
|
669
|
+
if (!(params['s3_compatible_region'] && !(0, _utils.isString)(params['s3_compatible_region']))) {
|
664
670
|
_context.next = 84;
|
665
671
|
break;
|
666
672
|
}
|
667
673
|
|
668
|
-
throw new Error("Bad parameter:
|
674
|
+
throw new Error("Bad parameter: s3_compatible_region must be of type String, received ".concat((0, _utils.getType)(s3_compatible_region)));
|
669
675
|
|
670
676
|
case 84:
|
671
|
-
if (!(params['
|
677
|
+
if (!(params['s3_compatible_access_key'] && !(0, _utils.isString)(params['s3_compatible_access_key']))) {
|
672
678
|
_context.next = 86;
|
673
679
|
break;
|
674
680
|
}
|
675
681
|
|
676
|
-
throw new Error("Bad parameter:
|
682
|
+
throw new Error("Bad parameter: s3_compatible_access_key must be of type String, received ".concat((0, _utils.getType)(s3_compatible_access_key)));
|
677
683
|
|
678
684
|
case 86:
|
685
|
+
if (!(params['s3_compatible_secret_key'] && !(0, _utils.isString)(params['s3_compatible_secret_key']))) {
|
686
|
+
_context.next = 88;
|
687
|
+
break;
|
688
|
+
}
|
689
|
+
|
690
|
+
throw new Error("Bad parameter: s3_compatible_secret_key must be of type String, received ".concat((0, _utils.getType)(s3_compatible_secret_key)));
|
691
|
+
|
692
|
+
case 88:
|
679
693
|
if (params['id']) {
|
680
|
-
_context.next =
|
694
|
+
_context.next = 94;
|
681
695
|
break;
|
682
696
|
}
|
683
697
|
|
684
698
|
if (!_this.attributes.id) {
|
685
|
-
_context.next =
|
699
|
+
_context.next = 93;
|
686
700
|
break;
|
687
701
|
}
|
688
702
|
|
689
703
|
params['id'] = _this.id;
|
690
|
-
_context.next =
|
704
|
+
_context.next = 94;
|
691
705
|
break;
|
692
706
|
|
693
|
-
case
|
707
|
+
case 93:
|
694
708
|
throw new Error('Parameter missing: id');
|
695
709
|
|
696
|
-
case
|
710
|
+
case 94:
|
697
711
|
return _context.abrupt("return", _Api.default.sendRequest("/remote_servers/".concat(params['id']), 'PATCH', params, _this.options));
|
698
712
|
|
699
|
-
case
|
713
|
+
case 95:
|
700
714
|
case "end":
|
701
715
|
return _context.stop();
|
702
716
|
}
|
@@ -1214,30 +1228,38 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
|
|
1214
1228
|
throw new Error("Bad parameter: s3_compatible_endpoint must be of type String, received ".concat((0, _utils.getType)(s3_compatible_endpoint)));
|
1215
1229
|
|
1216
1230
|
case 76:
|
1217
|
-
if (!(params['
|
1231
|
+
if (!(params['s3_compatible_region'] && !(0, _utils.isString)(params['s3_compatible_region']))) {
|
1218
1232
|
_context5.next = 78;
|
1219
1233
|
break;
|
1220
1234
|
}
|
1221
1235
|
|
1222
|
-
throw new Error("Bad parameter:
|
1236
|
+
throw new Error("Bad parameter: s3_compatible_region must be of type String, received ".concat((0, _utils.getType)(s3_compatible_region)));
|
1223
1237
|
|
1224
1238
|
case 78:
|
1225
|
-
if (!(params['
|
1239
|
+
if (!(params['s3_compatible_access_key'] && !(0, _utils.isString)(params['s3_compatible_access_key']))) {
|
1226
1240
|
_context5.next = 80;
|
1227
1241
|
break;
|
1228
1242
|
}
|
1229
1243
|
|
1230
|
-
throw new Error("Bad parameter:
|
1244
|
+
throw new Error("Bad parameter: s3_compatible_access_key must be of type String, received ".concat((0, _utils.getType)(s3_compatible_access_key)));
|
1231
1245
|
|
1232
1246
|
case 80:
|
1233
|
-
|
1234
|
-
|
1247
|
+
if (!(params['s3_compatible_secret_key'] && !(0, _utils.isString)(params['s3_compatible_secret_key']))) {
|
1248
|
+
_context5.next = 82;
|
1249
|
+
break;
|
1250
|
+
}
|
1251
|
+
|
1252
|
+
throw new Error("Bad parameter: s3_compatible_secret_key must be of type String, received ".concat((0, _utils.getType)(s3_compatible_secret_key)));
|
1235
1253
|
|
1236
1254
|
case 82:
|
1255
|
+
_context5.next = 84;
|
1256
|
+
return _Api.default.sendRequest("/remote_servers", 'POST', params, options);
|
1257
|
+
|
1258
|
+
case 84:
|
1237
1259
|
response = _context5.sent;
|
1238
1260
|
return _context5.abrupt("return", new RemoteServer(response === null || response === void 0 ? void 0 : response.data, options));
|
1239
1261
|
|
1240
|
-
case
|
1262
|
+
case 86:
|
1241
1263
|
case "end":
|
1242
1264
|
return _context5.stop();
|
1243
1265
|
}
|
@@ -7,10 +7,10 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
9
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
11
|
-
|
12
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
11
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
|
+
|
14
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
15
15
|
|
16
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
@@ -170,10 +170,72 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
170
170
|
(0, _defineProperty2.default)(this, "getLdapUsernameField", function () {
|
171
171
|
return _this.attributes.ldap_username_field;
|
172
172
|
});
|
173
|
-
|
174
|
-
var
|
175
|
-
|
176
|
-
|
173
|
+
(0, _defineProperty2.default)(this, "sync", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
174
|
+
var params,
|
175
|
+
_args = arguments;
|
176
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
177
|
+
while (1) {
|
178
|
+
switch (_context.prev = _context.next) {
|
179
|
+
case 0:
|
180
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
181
|
+
|
182
|
+
if (_this.attributes.id) {
|
183
|
+
_context.next = 3;
|
184
|
+
break;
|
185
|
+
}
|
186
|
+
|
187
|
+
throw new Error('Current object has no id');
|
188
|
+
|
189
|
+
case 3:
|
190
|
+
if ((0, _utils.isObject)(params)) {
|
191
|
+
_context.next = 5;
|
192
|
+
break;
|
193
|
+
}
|
194
|
+
|
195
|
+
throw new Error("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
196
|
+
|
197
|
+
case 5:
|
198
|
+
params.id = _this.attributes.id;
|
199
|
+
|
200
|
+
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
201
|
+
_context.next = 8;
|
202
|
+
break;
|
203
|
+
}
|
204
|
+
|
205
|
+
throw new Error("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
206
|
+
|
207
|
+
case 8:
|
208
|
+
if (params['id']) {
|
209
|
+
_context.next = 14;
|
210
|
+
break;
|
211
|
+
}
|
212
|
+
|
213
|
+
if (!_this.attributes.id) {
|
214
|
+
_context.next = 13;
|
215
|
+
break;
|
216
|
+
}
|
217
|
+
|
218
|
+
params['id'] = _this.id;
|
219
|
+
_context.next = 14;
|
220
|
+
break;
|
221
|
+
|
222
|
+
case 13:
|
223
|
+
throw new Error('Parameter missing: id');
|
224
|
+
|
225
|
+
case 14:
|
226
|
+
return _context.abrupt("return", _Api.default.sendRequest("/sso_strategies/".concat(params['id'], "/sync"), 'POST', params, _this.options));
|
227
|
+
|
228
|
+
case 15:
|
229
|
+
case "end":
|
230
|
+
return _context.stop();
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}, _callee);
|
234
|
+
})));
|
235
|
+
Object.entries(attributes).forEach(function (_ref2) {
|
236
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
237
|
+
key = _ref3[0],
|
238
|
+
value = _ref3[1];
|
177
239
|
|
178
240
|
var normalizedKey = key.replace('?', '');
|
179
241
|
_this.attributes[normalizedKey] = value;
|
@@ -184,22 +246,22 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
184
246
|
});
|
185
247
|
this.options = _objectSpread({}, options);
|
186
248
|
});
|
187
|
-
(0, _defineProperty2.default)(SsoStrategy, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
249
|
+
(0, _defineProperty2.default)(SsoStrategy, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
188
250
|
var _response$data;
|
189
251
|
|
190
252
|
var params,
|
191
253
|
options,
|
192
254
|
response,
|
193
|
-
|
194
|
-
return _regenerator.default.wrap(function
|
255
|
+
_args2 = arguments;
|
256
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
195
257
|
while (1) {
|
196
|
-
switch (
|
258
|
+
switch (_context2.prev = _context2.next) {
|
197
259
|
case 0:
|
198
|
-
params =
|
199
|
-
options =
|
260
|
+
params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
261
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
200
262
|
|
201
263
|
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
202
|
-
|
264
|
+
_context2.next = 4;
|
203
265
|
break;
|
204
266
|
}
|
205
267
|
|
@@ -207,28 +269,28 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
207
269
|
|
208
270
|
case 4:
|
209
271
|
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
210
|
-
|
272
|
+
_context2.next = 6;
|
211
273
|
break;
|
212
274
|
}
|
213
275
|
|
214
276
|
throw new Error("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(per_page)));
|
215
277
|
|
216
278
|
case 6:
|
217
|
-
|
279
|
+
_context2.next = 8;
|
218
280
|
return _Api.default.sendRequest("/sso_strategies", 'GET', params, options);
|
219
281
|
|
220
282
|
case 8:
|
221
|
-
response =
|
222
|
-
return
|
283
|
+
response = _context2.sent;
|
284
|
+
return _context2.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
223
285
|
return new SsoStrategy(obj, options);
|
224
286
|
})) || []);
|
225
287
|
|
226
288
|
case 10:
|
227
289
|
case "end":
|
228
|
-
return
|
290
|
+
return _context2.stop();
|
229
291
|
}
|
230
292
|
}
|
231
|
-
},
|
293
|
+
}, _callee2);
|
232
294
|
})));
|
233
295
|
(0, _defineProperty2.default)(SsoStrategy, "all", function () {
|
234
296
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -236,20 +298,20 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
236
298
|
return SsoStrategy.list(params, options);
|
237
299
|
});
|
238
300
|
(0, _defineProperty2.default)(SsoStrategy, "find", /*#__PURE__*/function () {
|
239
|
-
var
|
301
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(id) {
|
240
302
|
var params,
|
241
303
|
options,
|
242
304
|
response,
|
243
|
-
|
244
|
-
return _regenerator.default.wrap(function
|
305
|
+
_args3 = arguments;
|
306
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
245
307
|
while (1) {
|
246
|
-
switch (
|
308
|
+
switch (_context3.prev = _context3.next) {
|
247
309
|
case 0:
|
248
|
-
params =
|
249
|
-
options =
|
310
|
+
params = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
311
|
+
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
250
312
|
|
251
313
|
if ((0, _utils.isObject)(params)) {
|
252
|
-
|
314
|
+
_context3.next = 4;
|
253
315
|
break;
|
254
316
|
}
|
255
317
|
|
@@ -259,7 +321,7 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
259
321
|
params['id'] = id;
|
260
322
|
|
261
323
|
if (params['id']) {
|
262
|
-
|
324
|
+
_context3.next = 7;
|
263
325
|
break;
|
264
326
|
}
|
265
327
|
|
@@ -267,30 +329,30 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
|
|
267
329
|
|
268
330
|
case 7:
|
269
331
|
if (!(params['id'] && !(0, _utils.isInt)(params['id']))) {
|
270
|
-
|
332
|
+
_context3.next = 9;
|
271
333
|
break;
|
272
334
|
}
|
273
335
|
|
274
336
|
throw new Error("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
|
275
337
|
|
276
338
|
case 9:
|
277
|
-
|
339
|
+
_context3.next = 11;
|
278
340
|
return _Api.default.sendRequest("/sso_strategies/".concat(params['id']), 'GET', params, options);
|
279
341
|
|
280
342
|
case 11:
|
281
|
-
response =
|
282
|
-
return
|
343
|
+
response = _context3.sent;
|
344
|
+
return _context3.abrupt("return", new SsoStrategy(response === null || response === void 0 ? void 0 : response.data, options));
|
283
345
|
|
284
346
|
case 13:
|
285
347
|
case "end":
|
286
|
-
return
|
348
|
+
return _context3.stop();
|
287
349
|
}
|
288
350
|
}
|
289
|
-
},
|
351
|
+
}, _callee3);
|
290
352
|
}));
|
291
353
|
|
292
354
|
return function (_x) {
|
293
|
-
return
|
355
|
+
return _ref5.apply(this, arguments);
|
294
356
|
};
|
295
357
|
}());
|
296
358
|
(0, _defineProperty2.default)(SsoStrategy, "get", function (id) {
|
package/package.json
CHANGED
package/src/models/File.js
CHANGED
@@ -178,7 +178,7 @@ class File {
|
|
178
178
|
return saveUrlToFile(this.download_uri, destinationPath)
|
179
179
|
}
|
180
180
|
|
181
|
-
static
|
181
|
+
static findDownload = async path => {
|
182
182
|
const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'GET')
|
183
183
|
return new File(response.data)
|
184
184
|
}
|
@@ -260,6 +260,13 @@ class RemoteServer {
|
|
260
260
|
this.attributes.s3_compatible_endpoint = value
|
261
261
|
}
|
262
262
|
|
263
|
+
// string # S3-compatible endpoint
|
264
|
+
getS3CompatibleRegion = () => this.attributes.s3_compatible_region
|
265
|
+
|
266
|
+
setS3CompatibleRegion = value => {
|
267
|
+
this.attributes.s3_compatible_region = value
|
268
|
+
}
|
269
|
+
|
263
270
|
// string # S3-compatible Access Key.
|
264
271
|
getS3CompatibleAccessKey = () => this.attributes.s3_compatible_access_key
|
265
272
|
|
@@ -398,6 +405,7 @@ class RemoteServer {
|
|
398
405
|
// azure_blob_storage_container - string - Azure Blob Storage Container name
|
399
406
|
// s3_compatible_bucket - string - S3-compatible Bucket name
|
400
407
|
// s3_compatible_endpoint - string - S3-compatible endpoint
|
408
|
+
// s3_compatible_region - string - S3-compatible endpoint
|
401
409
|
// enable_dedicated_ips - boolean - `true` if remote server only accepts connections from dedicated IPs
|
402
410
|
// s3_compatible_access_key - string - S3-compatible Access Key.
|
403
411
|
// s3_compatible_secret_key - string - S3-compatible secret key
|
@@ -525,6 +533,9 @@ class RemoteServer {
|
|
525
533
|
if (params['s3_compatible_endpoint'] && !isString(params['s3_compatible_endpoint'])) {
|
526
534
|
throw new Error(`Bad parameter: s3_compatible_endpoint must be of type String, received ${getType(s3_compatible_endpoint)}`)
|
527
535
|
}
|
536
|
+
if (params['s3_compatible_region'] && !isString(params['s3_compatible_region'])) {
|
537
|
+
throw new Error(`Bad parameter: s3_compatible_region must be of type String, received ${getType(s3_compatible_region)}`)
|
538
|
+
}
|
528
539
|
if (params['s3_compatible_access_key'] && !isString(params['s3_compatible_access_key'])) {
|
529
540
|
throw new Error(`Bad parameter: s3_compatible_access_key must be of type String, received ${getType(s3_compatible_access_key)}`)
|
530
541
|
}
|
@@ -665,6 +676,7 @@ class RemoteServer {
|
|
665
676
|
// azure_blob_storage_container - string - Azure Blob Storage Container name
|
666
677
|
// s3_compatible_bucket - string - S3-compatible Bucket name
|
667
678
|
// s3_compatible_endpoint - string - S3-compatible endpoint
|
679
|
+
// s3_compatible_region - string - S3-compatible endpoint
|
668
680
|
// enable_dedicated_ips - boolean - `true` if remote server only accepts connections from dedicated IPs
|
669
681
|
// s3_compatible_access_key - string - S3-compatible Access Key.
|
670
682
|
// s3_compatible_secret_key - string - S3-compatible secret key
|
@@ -817,6 +829,10 @@ class RemoteServer {
|
|
817
829
|
throw new Error(`Bad parameter: s3_compatible_endpoint must be of type String, received ${getType(s3_compatible_endpoint)}`)
|
818
830
|
}
|
819
831
|
|
832
|
+
if (params['s3_compatible_region'] && !isString(params['s3_compatible_region'])) {
|
833
|
+
throw new Error(`Bad parameter: s3_compatible_region must be of type String, received ${getType(s3_compatible_region)}`)
|
834
|
+
}
|
835
|
+
|
820
836
|
if (params['s3_compatible_access_key'] && !isString(params['s3_compatible_access_key'])) {
|
821
837
|
throw new Error(`Bad parameter: s3_compatible_access_key must be of type String, received ${getType(s3_compatible_access_key)}`)
|
822
838
|
}
|
@@ -152,6 +152,32 @@ class SsoStrategy {
|
|
152
152
|
getLdapUsernameField = () => this.attributes.ldap_username_field
|
153
153
|
|
154
154
|
|
155
|
+
// Synchronize provisioning data with the SSO remote server
|
156
|
+
sync = async (params = {}) => {
|
157
|
+
if (!this.attributes.id) {
|
158
|
+
throw new Error('Current object has no id')
|
159
|
+
}
|
160
|
+
|
161
|
+
if (!isObject(params)) {
|
162
|
+
throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
163
|
+
}
|
164
|
+
|
165
|
+
params.id = this.attributes.id
|
166
|
+
if (params['id'] && !isInt(params['id'])) {
|
167
|
+
throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
168
|
+
}
|
169
|
+
|
170
|
+
if (!params['id']) {
|
171
|
+
if (this.attributes.id) {
|
172
|
+
params['id'] = this.id
|
173
|
+
} else {
|
174
|
+
throw new Error('Parameter missing: id')
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
return Api.sendRequest(`/sso_strategies/${params['id']}/sync`, 'POST', params, this.options)
|
179
|
+
}
|
180
|
+
|
155
181
|
// Parameters:
|
156
182
|
// cursor - string - Used for pagination. Send a cursor value to resume an existing list from the point at which you left off. Get a cursor from an existing list via either the X-Files-Cursor-Next header or the X-Files-Cursor-Prev header.
|
157
183
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
package/test/src/index.js
CHANGED
@@ -40,12 +40,16 @@ const testSuite = async () => {
|
|
40
40
|
const nonce = new Date().getTime()
|
41
41
|
|
42
42
|
const testFolderListAutoPagination = async () => {
|
43
|
-
Files.
|
43
|
+
Files.configureNetwork({
|
44
|
+
autoPaginate: false,
|
45
|
+
})
|
44
46
|
const firstPageItems = await Folder.listFor('/', { per_page: 1 })
|
45
|
-
assert(firstPageItems.length === 1)
|
46
47
|
|
47
|
-
|
48
|
+
assert(firstPageItems.length === 1)
|
48
49
|
|
50
|
+
Files.configureNetwork({
|
51
|
+
autoPaginate: true,
|
52
|
+
})
|
49
53
|
// note: this test will fail if the root folder has <= 1 file or folder
|
50
54
|
const allPageItems = await Folder.listFor('/', { per_page: 1 })
|
51
55
|
|
@@ -66,7 +70,7 @@ const testSuite = async () => {
|
|
66
70
|
assert(!!file.path)
|
67
71
|
assert(file.display_name === displayName)
|
68
72
|
|
69
|
-
const foundFile = await File.
|
73
|
+
const foundFile = await File.findDownload(destinationPath)
|
70
74
|
|
71
75
|
assert(foundFile.path === destinationPath)
|
72
76
|
assert(foundFile.display_name === displayName)
|