files.com 1.0.152 → 1.0.156
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/lib/models/Automation.js +14 -36
- package/lib/models/RemoteServer.js +6 -0
- package/lib/models/Session.js +6 -0
- package/lib/models/Site.js +3 -0
- package/lib/models/UsageDailySnapshot.js +21 -0
- package/lib/models/UsageSnapshot.js +15 -0
- package/package.json +1 -1
- package/src/models/Automation.js +0 -16
- package/src/models/RemoteServer.js +7 -0
- package/src/models/Session.js +7 -0
- package/src/models/Site.js +4 -0
- package/src/models/SsoStrategy.js +1 -1
- package/src/models/UsageDailySnapshot.js +22 -1
- package/src/models/UsageSnapshot.js +29 -14
- package/lib/models/SyncJob.js +0 -128
- package/src/models/SyncJob.js +0 -65
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.156
|
package/lib/models/Automation.js
CHANGED
@@ -143,12 +143,6 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
143
143
|
(0, _defineProperty2.default)(this, "setTriggerActions", function (value) {
|
144
144
|
_this.attributes.trigger_actions = value;
|
145
145
|
});
|
146
|
-
(0, _defineProperty2.default)(this, "getTriggerActionPath", function () {
|
147
|
-
return _this.attributes.trigger_action_path;
|
148
|
-
});
|
149
|
-
(0, _defineProperty2.default)(this, "setTriggerActionPath", function (value) {
|
150
|
-
_this.attributes.trigger_action_path = value;
|
151
|
-
});
|
152
146
|
(0, _defineProperty2.default)(this, "getValue", function () {
|
153
147
|
return _this.attributes.value;
|
154
148
|
});
|
@@ -308,53 +302,45 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
308
302
|
throw new Error("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(trigger_actions)));
|
309
303
|
|
310
304
|
case 36:
|
311
|
-
if (!(params['trigger_action_path'] && !(0, _utils.isString)(params['trigger_action_path']))) {
|
312
|
-
_context.next = 38;
|
313
|
-
break;
|
314
|
-
}
|
315
|
-
|
316
|
-
throw new Error("Bad parameter: trigger_action_path must be of type String, received ".concat((0, _utils.getType)(trigger_action_path)));
|
317
|
-
|
318
|
-
case 38:
|
319
305
|
if (params['id']) {
|
320
|
-
_context.next =
|
306
|
+
_context.next = 42;
|
321
307
|
break;
|
322
308
|
}
|
323
309
|
|
324
310
|
if (!_this.attributes.id) {
|
325
|
-
_context.next =
|
311
|
+
_context.next = 41;
|
326
312
|
break;
|
327
313
|
}
|
328
314
|
|
329
315
|
params['id'] = _this.id;
|
330
|
-
_context.next =
|
316
|
+
_context.next = 42;
|
331
317
|
break;
|
332
318
|
|
333
|
-
case
|
319
|
+
case 41:
|
334
320
|
throw new Error('Parameter missing: id');
|
335
321
|
|
336
|
-
case
|
322
|
+
case 42:
|
337
323
|
if (params['automation']) {
|
338
|
-
_context.next =
|
324
|
+
_context.next = 48;
|
339
325
|
break;
|
340
326
|
}
|
341
327
|
|
342
328
|
if (!_this.attributes.automation) {
|
343
|
-
_context.next =
|
329
|
+
_context.next = 47;
|
344
330
|
break;
|
345
331
|
}
|
346
332
|
|
347
333
|
params['automation'] = _this.automation;
|
348
|
-
_context.next =
|
334
|
+
_context.next = 48;
|
349
335
|
break;
|
350
336
|
|
351
|
-
case
|
337
|
+
case 47:
|
352
338
|
throw new Error('Parameter missing: automation');
|
353
339
|
|
354
|
-
case
|
340
|
+
case 48:
|
355
341
|
return _context.abrupt("return", _Api.default.sendRequest("/automations/".concat(params['id']), 'PATCH', params, _this.options));
|
356
342
|
|
357
|
-
case
|
343
|
+
case 49:
|
358
344
|
case "end":
|
359
345
|
return _context.stop();
|
360
346
|
}
|
@@ -704,22 +690,14 @@ var Automation = /*#__PURE__*/(0, _createClass2.default)(function Automation() {
|
|
704
690
|
throw new Error("Bad parameter: trigger_actions must be of type Array, received ".concat((0, _utils.getType)(trigger_actions)));
|
705
691
|
|
706
692
|
case 32:
|
707
|
-
|
708
|
-
_context5.next = 34;
|
709
|
-
break;
|
710
|
-
}
|
711
|
-
|
712
|
-
throw new Error("Bad parameter: trigger_action_path must be of type String, received ".concat((0, _utils.getType)(trigger_action_path)));
|
713
|
-
|
714
|
-
case 34:
|
715
|
-
_context5.next = 36;
|
693
|
+
_context5.next = 34;
|
716
694
|
return _Api.default.sendRequest("/automations", 'POST', params, options);
|
717
695
|
|
718
|
-
case
|
696
|
+
case 34:
|
719
697
|
response = _context5.sent;
|
720
698
|
return _context5.abrupt("return", new Automation(response === null || response === void 0 ? void 0 : response.data, options));
|
721
699
|
|
722
|
-
case
|
700
|
+
case 36:
|
723
701
|
case "end":
|
724
702
|
return _context5.stop();
|
725
703
|
}
|
@@ -47,6 +47,12 @@ var RemoteServer = /*#__PURE__*/(0, _createClass2.default)(function RemoteServer
|
|
47
47
|
(0, _defineProperty2.default)(this, "setId", function (value) {
|
48
48
|
_this.attributes.id = value;
|
49
49
|
});
|
50
|
+
(0, _defineProperty2.default)(this, "getDisabled", function () {
|
51
|
+
return _this.attributes.disabled;
|
52
|
+
});
|
53
|
+
(0, _defineProperty2.default)(this, "setDisabled", function (value) {
|
54
|
+
_this.attributes.disabled = value;
|
55
|
+
});
|
50
56
|
(0, _defineProperty2.default)(this, "getAuthenticationMethod", function () {
|
51
57
|
return _this.attributes.authentication_method;
|
52
58
|
});
|
package/lib/models/Session.js
CHANGED
@@ -137,6 +137,12 @@ var Session = /*#__PURE__*/(0, _createClass2.default)(function Session() {
|
|
137
137
|
(0, _defineProperty2.default)(this, "setAllowed2faMethodU2f", function (value) {
|
138
138
|
_this.attributes.allowed_2fa_method_u2f = value;
|
139
139
|
});
|
140
|
+
(0, _defineProperty2.default)(this, "getAllowed2faMethodWebauthn", function () {
|
141
|
+
return _this.attributes.allowed_2fa_method_webauthn;
|
142
|
+
});
|
143
|
+
(0, _defineProperty2.default)(this, "setAllowed2faMethodWebauthn", function (value) {
|
144
|
+
_this.attributes.allowed_2fa_method_webauthn = value;
|
145
|
+
});
|
140
146
|
(0, _defineProperty2.default)(this, "getAllowed2faMethodYubi", function () {
|
141
147
|
return _this.attributes.allowed_2fa_method_yubi;
|
142
148
|
});
|
package/lib/models/Site.js
CHANGED
@@ -53,6 +53,9 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
|
|
53
53
|
(0, _defineProperty2.default)(this, "getAllowed2faMethodU2f", function () {
|
54
54
|
return _this.attributes.allowed_2fa_method_u2f;
|
55
55
|
});
|
56
|
+
(0, _defineProperty2.default)(this, "getAllowed2faMethodWebauthn", function () {
|
57
|
+
return _this.attributes.allowed_2fa_method_webauthn;
|
58
|
+
});
|
56
59
|
(0, _defineProperty2.default)(this, "getAllowed2faMethodYubi", function () {
|
57
60
|
return _this.attributes.allowed_2fa_method_yubi;
|
58
61
|
});
|
@@ -47,9 +47,30 @@ var UsageDailySnapshot = /*#__PURE__*/(0, _createClass2.default)(function UsageD
|
|
47
47
|
(0, _defineProperty2.default)(this, "getDate", function () {
|
48
48
|
return _this.attributes.date;
|
49
49
|
});
|
50
|
+
(0, _defineProperty2.default)(this, "getApiUsageAvailable", function () {
|
51
|
+
return _this.attributes.api_usage_available;
|
52
|
+
});
|
53
|
+
(0, _defineProperty2.default)(this, "getReadApiUsage", function () {
|
54
|
+
return _this.attributes.read_api_usage;
|
55
|
+
});
|
56
|
+
(0, _defineProperty2.default)(this, "getWriteApiUsage", function () {
|
57
|
+
return _this.attributes.write_api_usage;
|
58
|
+
});
|
59
|
+
(0, _defineProperty2.default)(this, "getUserCount", function () {
|
60
|
+
return _this.attributes.user_count;
|
61
|
+
});
|
50
62
|
(0, _defineProperty2.default)(this, "getCurrentStorage", function () {
|
51
63
|
return _this.attributes.current_storage;
|
52
64
|
});
|
65
|
+
(0, _defineProperty2.default)(this, "getDeletedFilesStorage", function () {
|
66
|
+
return _this.attributes.deleted_files_storage;
|
67
|
+
});
|
68
|
+
(0, _defineProperty2.default)(this, "getDeletedFilesCountedInMinimum", function () {
|
69
|
+
return _this.attributes.deleted_files_counted_in_minimum;
|
70
|
+
});
|
71
|
+
(0, _defineProperty2.default)(this, "getRootStorage", function () {
|
72
|
+
return _this.attributes.root_storage;
|
73
|
+
});
|
53
74
|
(0, _defineProperty2.default)(this, "getUsageByTopLevelDir", function () {
|
54
75
|
return _this.attributes.usage_by_top_level_dir;
|
55
76
|
});
|
@@ -83,6 +83,21 @@ var UsageSnapshot = /*#__PURE__*/(0, _createClass2.default)(function UsageSnapsh
|
|
83
83
|
(0, _defineProperty2.default)(this, "getDeletedFilesStorage", function () {
|
84
84
|
return _this.attributes.deleted_files_storage;
|
85
85
|
});
|
86
|
+
(0, _defineProperty2.default)(this, "getTotalBillableUsage", function () {
|
87
|
+
return _this.attributes.total_billable_usage;
|
88
|
+
});
|
89
|
+
(0, _defineProperty2.default)(this, "getTotalBillableTransferUsage", function () {
|
90
|
+
return _this.attributes.total_billable_transfer_usage;
|
91
|
+
});
|
92
|
+
(0, _defineProperty2.default)(this, "getBytesSent", function () {
|
93
|
+
return _this.attributes.bytes_sent;
|
94
|
+
});
|
95
|
+
(0, _defineProperty2.default)(this, "getSyncBytesReceived", function () {
|
96
|
+
return _this.attributes.sync_bytes_received;
|
97
|
+
});
|
98
|
+
(0, _defineProperty2.default)(this, "getSyncBytesSent", function () {
|
99
|
+
return _this.attributes.sync_bytes_sent;
|
100
|
+
});
|
86
101
|
Object.entries(attributes).forEach(function (_ref) {
|
87
102
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
88
103
|
key = _ref2[0],
|
package/package.json
CHANGED
package/src/models/Automation.js
CHANGED
@@ -141,13 +141,6 @@ class Automation {
|
|
141
141
|
this.attributes.trigger_actions = value
|
142
142
|
}
|
143
143
|
|
144
|
-
// string # If trigger is `action`, this is the path to watch for the specified trigger actions.
|
145
|
-
getTriggerActionPath = () => this.attributes.trigger_action_path
|
146
|
-
|
147
|
-
setTriggerActionPath = value => {
|
148
|
-
this.attributes.trigger_action_path = value
|
149
|
-
}
|
150
|
-
|
151
144
|
// object # A Hash of attributes specific to the automation type.
|
152
145
|
getValue = () => this.attributes.value
|
153
146
|
|
@@ -179,7 +172,6 @@ class Automation {
|
|
179
172
|
// name - string - Name for this automation.
|
180
173
|
// trigger - string - How this automation is triggered to run. One of: `realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
|
181
174
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
182
|
-
// trigger_action_path - string - If trigger is `action`, this is the path to watch for the specified trigger actions.
|
183
175
|
// value - object - A Hash of attributes specific to the automation type.
|
184
176
|
update = async (params = {}) => {
|
185
177
|
if (!this.attributes.id) {
|
@@ -236,9 +228,6 @@ class Automation {
|
|
236
228
|
if (params['trigger_actions'] && !isArray(params['trigger_actions'])) {
|
237
229
|
throw new Error(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
|
238
230
|
}
|
239
|
-
if (params['trigger_action_path'] && !isString(params['trigger_action_path'])) {
|
240
|
-
throw new Error(`Bad parameter: trigger_action_path must be of type String, received ${getType(trigger_action_path)}`)
|
241
|
-
}
|
242
231
|
|
243
232
|
if (!params['id']) {
|
244
233
|
if (this.attributes.id) {
|
@@ -370,7 +359,6 @@ class Automation {
|
|
370
359
|
// name - string - Name for this automation.
|
371
360
|
// trigger - string - How this automation is triggered to run. One of: `realtime`, `daily`, `custom_schedule`, `webhook`, `email`, or `action`.
|
372
361
|
// trigger_actions - array(string) - If trigger is `action`, this is the list of action types on which to trigger the automation. Valid actions are create, read, update, destroy, move, copy
|
373
|
-
// trigger_action_path - string - If trigger is `action`, this is the path to watch for the specified trigger actions.
|
374
362
|
// value - object - A Hash of attributes specific to the automation type.
|
375
363
|
static create = async (params = {}, options = {}) => {
|
376
364
|
if (!params['automation']) {
|
@@ -433,10 +421,6 @@ class Automation {
|
|
433
421
|
throw new Error(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
|
434
422
|
}
|
435
423
|
|
436
|
-
if (params['trigger_action_path'] && !isString(params['trigger_action_path'])) {
|
437
|
-
throw new Error(`Bad parameter: trigger_action_path must be of type String, received ${getType(trigger_action_path)}`)
|
438
|
-
}
|
439
|
-
|
440
424
|
const response = await Api.sendRequest(`/automations`, 'POST', params, options)
|
441
425
|
|
442
426
|
return new Automation(response?.data, options)
|
@@ -29,6 +29,13 @@ class RemoteServer {
|
|
29
29
|
this.attributes.id = value
|
30
30
|
}
|
31
31
|
|
32
|
+
// boolean # If true, this server has been disabled due to failures. Make any change or set disabled to false to clear this flag.
|
33
|
+
getDisabled = () => this.attributes.disabled
|
34
|
+
|
35
|
+
setDisabled = value => {
|
36
|
+
this.attributes.disabled = value
|
37
|
+
}
|
38
|
+
|
32
39
|
// string # Type of authentication method
|
33
40
|
getAuthenticationMethod = () => this.attributes.authentication_method
|
34
41
|
|
package/src/models/Session.js
CHANGED
@@ -134,6 +134,13 @@ class Session {
|
|
134
134
|
this.attributes.allowed_2fa_method_u2f = value
|
135
135
|
}
|
136
136
|
|
137
|
+
// boolean # Sent only if 2FA setup is needed. Is WebAuthn two factor authentication allowed?
|
138
|
+
getAllowed2faMethodWebauthn = () => this.attributes.allowed_2fa_method_webauthn
|
139
|
+
|
140
|
+
setAllowed2faMethodWebauthn = value => {
|
141
|
+
this.attributes.allowed_2fa_method_webauthn = value
|
142
|
+
}
|
143
|
+
|
137
144
|
// boolean # Sent only if 2FA setup is needed. Is Yubikey two factor authentication allowed?
|
138
145
|
getAllowed2faMethodYubi = () => this.attributes.allowed_2fa_method_yubi
|
139
146
|
|
package/src/models/Site.js
CHANGED
@@ -34,6 +34,9 @@ class Site {
|
|
34
34
|
// boolean # Is U2F two factor authentication allowed?
|
35
35
|
getAllowed2faMethodU2f = () => this.attributes.allowed_2fa_method_u2f
|
36
36
|
|
37
|
+
// boolean # Is WebAuthn two factor authentication allowed?
|
38
|
+
getAllowed2faMethodWebauthn = () => this.attributes.allowed_2fa_method_webauthn
|
39
|
+
|
37
40
|
// boolean # Is yubikey two factor authentication allowed?
|
38
41
|
getAllowed2faMethodYubi = () => this.attributes.allowed_2fa_method_yubi
|
39
42
|
|
@@ -482,6 +485,7 @@ class Site {
|
|
482
485
|
// allowed_2fa_method_sms - boolean - Is SMS two factor authentication allowed?
|
483
486
|
// allowed_2fa_method_u2f - boolean - Is U2F two factor authentication allowed?
|
484
487
|
// allowed_2fa_method_totp - boolean - Is TOTP two factor authentication allowed?
|
488
|
+
// allowed_2fa_method_webauthn - boolean - Is WebAuthn two factor authentication allowed?
|
485
489
|
// allowed_2fa_method_yubi - boolean - Is yubikey two factor authentication allowed?
|
486
490
|
// require_2fa - boolean - Require two-factor authentication for all users?
|
487
491
|
// require_2fa_user_type - string - What type of user is required to use two-factor authentication (when require_2fa is set to `true` for this site)?
|
@@ -127,7 +127,7 @@ class SsoStrategy {
|
|
127
127
|
// string # Domain name that will be appended to LDAP usernames
|
128
128
|
getLdapDomain = () => this.attributes.ldap_domain
|
129
129
|
|
130
|
-
// boolean # Is strategy enabled?
|
130
|
+
// boolean # Is strategy enabled? This may become automatically set to `false` after a high number and duration of failures.
|
131
131
|
getEnabled = () => this.attributes.enabled
|
132
132
|
|
133
133
|
// string # LDAP host
|
@@ -28,9 +28,30 @@ class UsageDailySnapshot {
|
|
28
28
|
// date # The date of this usage record
|
29
29
|
getDate = () => this.attributes.date
|
30
30
|
|
31
|
-
//
|
31
|
+
// boolean # True if the API usage fields `read_api_usage` and `write_api_usage` can be relied upon. If this is false, we suggest hiding that value from any UI.
|
32
|
+
getApiUsageAvailable = () => this.attributes.api_usage_available
|
33
|
+
|
34
|
+
// int64 # Read API Calls used on this day. Note: only updated for days before the current day.
|
35
|
+
getReadApiUsage = () => this.attributes.read_api_usage
|
36
|
+
|
37
|
+
// int64 # Write API Calls used on this day. Note: only updated for days before the current day.
|
38
|
+
getWriteApiUsage = () => this.attributes.write_api_usage
|
39
|
+
|
40
|
+
// int64 # Number of billable users as of this day.
|
41
|
+
getUserCount = () => this.attributes.user_count
|
42
|
+
|
43
|
+
// int64 # GB of Files Native Storage used on this day.
|
32
44
|
getCurrentStorage = () => this.attributes.current_storage
|
33
45
|
|
46
|
+
// int64 # GB of Files Native Storage used on this day for files that have been deleted and are stored as backups.
|
47
|
+
getDeletedFilesStorage = () => this.attributes.deleted_files_storage
|
48
|
+
|
49
|
+
// int64 # GB of Files Native Storage used on this day for files that have been permanently deleted but were uploaded less than 30 days ago, and are still billable.
|
50
|
+
getDeletedFilesCountedInMinimum = () => this.attributes.deleted_files_counted_in_minimum
|
51
|
+
|
52
|
+
// int64 # GB of Files Native Storage used for the root folder. Included here because this value will not be part of `usage_by_top_level_dir`
|
53
|
+
getRootStorage = () => this.attributes.root_storage
|
54
|
+
|
34
55
|
// array # Usage broken down by each top-level folder
|
35
56
|
getUsageByTopLevelDir = () => this.attributes.usage_by_top_level_dir
|
36
57
|
|
@@ -22,48 +22,63 @@ class UsageSnapshot {
|
|
22
22
|
}
|
23
23
|
|
24
24
|
isLoaded = () => !!this.attributes.id
|
25
|
-
// int64 #
|
25
|
+
// int64 # Usage snapshot ID
|
26
26
|
getId = () => this.attributes.id
|
27
27
|
|
28
|
-
// date-time #
|
28
|
+
// date-time # Usage snapshot start date/time
|
29
29
|
getStartAt = () => this.attributes.start_at
|
30
30
|
|
31
|
-
// date-time #
|
31
|
+
// date-time # Usage snapshot end date/time
|
32
32
|
getEndAt = () => this.attributes.end_at
|
33
33
|
|
34
|
-
// date-time #
|
34
|
+
// date-time # DEPRECATED: Usage snapshot created at date/time
|
35
35
|
getCreatedAt = () => this.attributes.created_at
|
36
36
|
|
37
|
-
// double #
|
37
|
+
// double # Highest user count number in time period
|
38
38
|
getHighWaterUserCount = () => this.attributes.high_water_user_count
|
39
39
|
|
40
|
-
// double # Current
|
40
|
+
// double # Current total Storage Usage GB as of end date (not necessarily high water mark, which is used for billing)
|
41
41
|
getCurrentStorage = () => this.attributes.current_storage
|
42
42
|
|
43
|
-
// double #
|
43
|
+
// double # Highest Storage Usage GB recorded in time period (used for billing)
|
44
44
|
getHighWaterStorage = () => this.attributes.high_water_storage
|
45
45
|
|
46
|
-
// int64 # Number of downloads in report time period
|
46
|
+
// int64 # DEPRECATED: Number of downloads in report time period
|
47
47
|
getTotalDownloads = () => this.attributes.total_downloads
|
48
48
|
|
49
|
-
// int64 # Number of uploads in time period
|
49
|
+
// int64 # DEPRECATED: Number of uploads in time period
|
50
50
|
getTotalUploads = () => this.attributes.total_uploads
|
51
51
|
|
52
|
-
// date-time # The last time this site usage report was updated
|
52
|
+
// date-time # DEPRECATED: The last time this site usage report was updated
|
53
53
|
getUpdatedAt = () => this.attributes.updated_at
|
54
54
|
|
55
|
-
// object #
|
55
|
+
// object # Storage Usage - map of root folders to their usage as of end date (not necessarily high water mark, which is used for billing)
|
56
56
|
getUsageByTopLevelDir = () => this.attributes.usage_by_top_level_dir
|
57
57
|
|
58
|
-
// double # Usage for root folder
|
58
|
+
// double # Storage Usage for root folder as of end date (not necessarily high water mark, which is used for billing)
|
59
59
|
getRootStorage = () => this.attributes.root_storage
|
60
60
|
|
61
|
-
// double # Usage for files that are deleted but uploaded within last 30 days
|
61
|
+
// double # Storage Usage for files that are deleted but uploaded within last 30 days as of end date (not necessarily high water mark, which is used for billing)
|
62
62
|
getDeletedFilesCountedInMinimum = () => this.attributes.deleted_files_counted_in_minimum
|
63
63
|
|
64
|
-
// double # Usage for files that are deleted but retained as backups
|
64
|
+
// double # Storage Usage for files that are deleted but retained as backups as of end date (not necessarily high water mark, which is used for billing)
|
65
65
|
getDeletedFilesStorage = () => this.attributes.deleted_files_storage
|
66
66
|
|
67
|
+
// double # Storage + Transfer Usage - Total Billable amount
|
68
|
+
getTotalBillableUsage = () => this.attributes.total_billable_usage
|
69
|
+
|
70
|
+
// double # Transfer usage for period - Total Billable amount
|
71
|
+
getTotalBillableTransferUsage = () => this.attributes.total_billable_transfer_usage
|
72
|
+
|
73
|
+
// double # Transfer Usage for period - Outbound GB from Files Native Storage
|
74
|
+
getBytesSent = () => this.attributes.bytes_sent
|
75
|
+
|
76
|
+
// double # Transfer Usage for period - Inbound GB to Remote Servers (Sync/Mount)
|
77
|
+
getSyncBytesReceived = () => this.attributes.sync_bytes_received
|
78
|
+
|
79
|
+
// double # Transfer Usage for period - Outbound GB from Remote Servers (Sync/Mount)
|
80
|
+
getSyncBytesSent = () => this.attributes.sync_bytes_sent
|
81
|
+
|
67
82
|
|
68
83
|
// Parameters:
|
69
84
|
// 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.
|
package/lib/models/SyncJob.js
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
exports.__esModule = true;
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
9
|
-
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
11
|
-
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
|
-
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
15
|
-
|
16
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
17
|
-
|
18
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
19
|
-
|
20
|
-
var _Api = _interopRequireDefault(require("../Api"));
|
21
|
-
|
22
|
-
var _Logger = _interopRequireDefault(require("../Logger"));
|
23
|
-
|
24
|
-
var _utils = require("../utils");
|
25
|
-
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
27
|
-
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Class SyncJob
|
32
|
-
*/
|
33
|
-
var SyncJob = /*#__PURE__*/(0, _createClass2.default)(function SyncJob() {
|
34
|
-
var _this = this;
|
35
|
-
|
36
|
-
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
37
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
38
|
-
(0, _classCallCheck2.default)(this, SyncJob);
|
39
|
-
(0, _defineProperty2.default)(this, "attributes", {});
|
40
|
-
(0, _defineProperty2.default)(this, "options", {});
|
41
|
-
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
42
|
-
return !!_this.attributes.id;
|
43
|
-
});
|
44
|
-
(0, _defineProperty2.default)(this, "getQueuedAt", function () {
|
45
|
-
return _this.attributes.queued_at;
|
46
|
-
});
|
47
|
-
(0, _defineProperty2.default)(this, "getUpdatedAt", function () {
|
48
|
-
return _this.attributes.updated_at;
|
49
|
-
});
|
50
|
-
(0, _defineProperty2.default)(this, "getStatus", function () {
|
51
|
-
return _this.attributes.status;
|
52
|
-
});
|
53
|
-
(0, _defineProperty2.default)(this, "getRegionalWorkerStatus", function () {
|
54
|
-
return _this.attributes.regional_worker_status;
|
55
|
-
});
|
56
|
-
(0, _defineProperty2.default)(this, "getUuid", function () {
|
57
|
-
return _this.attributes.uuid;
|
58
|
-
});
|
59
|
-
(0, _defineProperty2.default)(this, "getFolderBehaviorId", function () {
|
60
|
-
return _this.attributes.folder_behavior_id;
|
61
|
-
});
|
62
|
-
Object.entries(attributes).forEach(function (_ref) {
|
63
|
-
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
64
|
-
key = _ref2[0],
|
65
|
-
value = _ref2[1];
|
66
|
-
|
67
|
-
var normalizedKey = key.replace('?', '');
|
68
|
-
_this.attributes[normalizedKey] = value;
|
69
|
-
Object.defineProperty(_this, normalizedKey, {
|
70
|
-
value: value,
|
71
|
-
writable: false
|
72
|
-
});
|
73
|
-
});
|
74
|
-
this.options = _objectSpread({}, options);
|
75
|
-
});
|
76
|
-
(0, _defineProperty2.default)(SyncJob, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
77
|
-
var _response$data;
|
78
|
-
|
79
|
-
var params,
|
80
|
-
options,
|
81
|
-
response,
|
82
|
-
_args = arguments;
|
83
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
84
|
-
while (1) {
|
85
|
-
switch (_context.prev = _context.next) {
|
86
|
-
case 0:
|
87
|
-
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
88
|
-
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
89
|
-
|
90
|
-
if (!(params['cursor'] && !(0, _utils.isString)(params['cursor']))) {
|
91
|
-
_context.next = 4;
|
92
|
-
break;
|
93
|
-
}
|
94
|
-
|
95
|
-
throw new Error("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(cursor)));
|
96
|
-
|
97
|
-
case 4:
|
98
|
-
if (!(params['per_page'] && !(0, _utils.isInt)(params['per_page']))) {
|
99
|
-
_context.next = 6;
|
100
|
-
break;
|
101
|
-
}
|
102
|
-
|
103
|
-
throw new Error("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(per_page)));
|
104
|
-
|
105
|
-
case 6:
|
106
|
-
_context.next = 8;
|
107
|
-
return _Api.default.sendRequest("/sync_jobs", 'GET', params, options);
|
108
|
-
|
109
|
-
case 8:
|
110
|
-
response = _context.sent;
|
111
|
-
return _context.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) {
|
112
|
-
return new SyncJob(obj, options);
|
113
|
-
})) || []);
|
114
|
-
|
115
|
-
case 10:
|
116
|
-
case "end":
|
117
|
-
return _context.stop();
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}, _callee);
|
121
|
-
})));
|
122
|
-
(0, _defineProperty2.default)(SyncJob, "all", function () {
|
123
|
-
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
124
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
125
|
-
return SyncJob.list(params, options);
|
126
|
-
});
|
127
|
-
var _default = SyncJob;
|
128
|
-
exports.default = _default;
|
package/src/models/SyncJob.js
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
import Api from '../Api'
|
2
|
-
import Logger from '../Logger'
|
3
|
-
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Class SyncJob
|
7
|
-
*/
|
8
|
-
class SyncJob {
|
9
|
-
attributes = {}
|
10
|
-
options = {}
|
11
|
-
|
12
|
-
constructor(attributes = {}, options = {}) {
|
13
|
-
Object.entries(attributes).forEach(([key, value]) => {
|
14
|
-
const normalizedKey = key.replace('?', '')
|
15
|
-
|
16
|
-
this.attributes[normalizedKey] = value
|
17
|
-
|
18
|
-
Object.defineProperty(this, normalizedKey, { value, writable: false })
|
19
|
-
})
|
20
|
-
|
21
|
-
this.options = { ...options }
|
22
|
-
}
|
23
|
-
|
24
|
-
isLoaded = () => !!this.attributes.id
|
25
|
-
// date-time # Job enqueued at
|
26
|
-
getQueuedAt = () => this.attributes.queued_at
|
27
|
-
|
28
|
-
// date-time # Job updated at
|
29
|
-
getUpdatedAt = () => this.attributes.updated_at
|
30
|
-
|
31
|
-
// string # Status of the job
|
32
|
-
getStatus = () => this.attributes.status
|
33
|
-
|
34
|
-
// string # Most recent reported status of sync worker
|
35
|
-
getRegionalWorkerStatus = () => this.attributes.regional_worker_status
|
36
|
-
|
37
|
-
// string #
|
38
|
-
getUuid = () => this.attributes.uuid
|
39
|
-
|
40
|
-
// int64 #
|
41
|
-
getFolderBehaviorId = () => this.attributes.folder_behavior_id
|
42
|
-
|
43
|
-
|
44
|
-
// Parameters:
|
45
|
-
// 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.
|
46
|
-
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
47
|
-
static list = async (params = {}, options = {}) => {
|
48
|
-
if (params['cursor'] && !isString(params['cursor'])) {
|
49
|
-
throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
50
|
-
}
|
51
|
-
|
52
|
-
if (params['per_page'] && !isInt(params['per_page'])) {
|
53
|
-
throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
54
|
-
}
|
55
|
-
|
56
|
-
const response = await Api.sendRequest(`/sync_jobs`, 'GET', params, options)
|
57
|
-
|
58
|
-
return response?.data?.map(obj => new SyncJob(obj, options)) || []
|
59
|
-
}
|
60
|
-
|
61
|
-
static all = (params = {}, options = {}) =>
|
62
|
-
SyncJob.list(params, options)
|
63
|
-
}
|
64
|
-
|
65
|
-
export default SyncJob
|