files.com 1.2.258 → 1.2.259
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/docs/models/Site.md +4 -0
- package/docs/models/Sync.md +252 -0
- package/docs/models/SyncRun.md +81 -0
- package/lib/Files.js +1 -1
- package/lib/models/Site.js +5 -0
- package/lib/models/Sync.js +676 -0
- package/lib/models/SyncRun.js +245 -0
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/Site.js +4 -0
- package/src/models/Sync.js +464 -0
- package/src/models/SyncRun.js +153 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _Api = _interopRequireDefault(require("../Api"));
|
|
14
|
+
var errors = _interopRequireWildcard(require("../Errors"));
|
|
15
|
+
var _utils = require("../utils");
|
|
16
|
+
var _SyncRun;
|
|
17
|
+
/* eslint-disable no-unused-vars */
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
/* eslint-enable no-unused-vars */
|
|
22
|
+
/**
|
|
23
|
+
* Class SyncRun
|
|
24
|
+
*/
|
|
25
|
+
var SyncRun = /*#__PURE__*/(0, _createClass2.default)(function SyncRun() {
|
|
26
|
+
var _this = this;
|
|
27
|
+
var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
29
|
+
(0, _classCallCheck2.default)(this, SyncRun);
|
|
30
|
+
(0, _defineProperty2.default)(this, "attributes", {});
|
|
31
|
+
(0, _defineProperty2.default)(this, "options", {});
|
|
32
|
+
(0, _defineProperty2.default)(this, "isLoaded", function () {
|
|
33
|
+
return !!_this.attributes.id;
|
|
34
|
+
});
|
|
35
|
+
// int64 # SyncRun ID
|
|
36
|
+
(0, _defineProperty2.default)(this, "getId", function () {
|
|
37
|
+
return _this.attributes.id;
|
|
38
|
+
});
|
|
39
|
+
// int64 # ID of the Sync this run belongs to
|
|
40
|
+
(0, _defineProperty2.default)(this, "getSyncId", function () {
|
|
41
|
+
return _this.attributes.sync_id;
|
|
42
|
+
});
|
|
43
|
+
// int64 # Site ID
|
|
44
|
+
(0, _defineProperty2.default)(this, "getSiteId", function () {
|
|
45
|
+
return _this.attributes.site_id;
|
|
46
|
+
});
|
|
47
|
+
// string # Status of the sync run (success, failure, partial_failure, in_progress, skipped)
|
|
48
|
+
(0, _defineProperty2.default)(this, "getStatus", function () {
|
|
49
|
+
return _this.attributes.status;
|
|
50
|
+
});
|
|
51
|
+
// string # Type of remote server used, if any
|
|
52
|
+
(0, _defineProperty2.default)(this, "getRemoteServerType", function () {
|
|
53
|
+
return _this.attributes.remote_server_type;
|
|
54
|
+
});
|
|
55
|
+
// string # Log or summary body for this run
|
|
56
|
+
(0, _defineProperty2.default)(this, "getBody", function () {
|
|
57
|
+
return _this.attributes.body;
|
|
58
|
+
});
|
|
59
|
+
// array(array) # Array of errors encountered during the run
|
|
60
|
+
(0, _defineProperty2.default)(this, "getEventErrors", function () {
|
|
61
|
+
return _this.attributes.event_errors;
|
|
62
|
+
});
|
|
63
|
+
// int64 # Total bytes synced in this run
|
|
64
|
+
(0, _defineProperty2.default)(this, "getBytesSynced", function () {
|
|
65
|
+
return _this.attributes.bytes_synced;
|
|
66
|
+
});
|
|
67
|
+
// int64 # Number of files compared
|
|
68
|
+
(0, _defineProperty2.default)(this, "getComparedFiles", function () {
|
|
69
|
+
return _this.attributes.compared_files;
|
|
70
|
+
});
|
|
71
|
+
// int64 # Number of folders compared
|
|
72
|
+
(0, _defineProperty2.default)(this, "getComparedFolders", function () {
|
|
73
|
+
return _this.attributes.compared_folders;
|
|
74
|
+
});
|
|
75
|
+
// int64 # Number of files that errored
|
|
76
|
+
(0, _defineProperty2.default)(this, "getErroredFiles", function () {
|
|
77
|
+
return _this.attributes.errored_files;
|
|
78
|
+
});
|
|
79
|
+
// int64 # Number of files successfully synced
|
|
80
|
+
(0, _defineProperty2.default)(this, "getSuccessfulFiles", function () {
|
|
81
|
+
return _this.attributes.successful_files;
|
|
82
|
+
});
|
|
83
|
+
// float # Total runtime in seconds
|
|
84
|
+
(0, _defineProperty2.default)(this, "getRuntime", function () {
|
|
85
|
+
return _this.attributes.runtime;
|
|
86
|
+
});
|
|
87
|
+
// string # S3 path to the main log file
|
|
88
|
+
(0, _defineProperty2.default)(this, "getS3BodyPath", function () {
|
|
89
|
+
return _this.attributes.s3_body_path;
|
|
90
|
+
});
|
|
91
|
+
// string # S3 path to the internal log file
|
|
92
|
+
(0, _defineProperty2.default)(this, "getS3InternalBodyPath", function () {
|
|
93
|
+
return _this.attributes.s3_internal_body_path;
|
|
94
|
+
});
|
|
95
|
+
// date-time # When this run was completed
|
|
96
|
+
(0, _defineProperty2.default)(this, "getCompletedAt", function () {
|
|
97
|
+
return _this.attributes.completed_at;
|
|
98
|
+
});
|
|
99
|
+
// boolean # Whether notifications were sent for this run
|
|
100
|
+
(0, _defineProperty2.default)(this, "getNotified", function () {
|
|
101
|
+
return _this.attributes.notified;
|
|
102
|
+
});
|
|
103
|
+
// date-time # When this run was created
|
|
104
|
+
(0, _defineProperty2.default)(this, "getCreatedAt", function () {
|
|
105
|
+
return _this.attributes.created_at;
|
|
106
|
+
});
|
|
107
|
+
// date-time # When this run was last updated
|
|
108
|
+
(0, _defineProperty2.default)(this, "getUpdatedAt", function () {
|
|
109
|
+
return _this.attributes.updated_at;
|
|
110
|
+
});
|
|
111
|
+
Object.entries(attributes).forEach(function (_ref) {
|
|
112
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
113
|
+
key = _ref2[0],
|
|
114
|
+
value = _ref2[1];
|
|
115
|
+
var normalizedKey = key.replace('?', '');
|
|
116
|
+
_this.attributes[normalizedKey] = value;
|
|
117
|
+
Object.defineProperty(_this, normalizedKey, {
|
|
118
|
+
value: value,
|
|
119
|
+
writable: false
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
this.options = _objectSpread({}, options);
|
|
123
|
+
});
|
|
124
|
+
_SyncRun = SyncRun;
|
|
125
|
+
// Parameters:
|
|
126
|
+
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
127
|
+
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
128
|
+
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
129
|
+
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `sync_id`, `created_at` or `status`.
|
|
130
|
+
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `status` and `sync_id`. Valid field combinations are `[ sync_id, status ]`.
|
|
131
|
+
// sync_id (required) - int64 - ID of the Sync this run belongs to
|
|
132
|
+
(0, _defineProperty2.default)(SyncRun, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
133
|
+
var _response$data;
|
|
134
|
+
var params,
|
|
135
|
+
options,
|
|
136
|
+
response,
|
|
137
|
+
_args = arguments;
|
|
138
|
+
return _regenerator.default.wrap(function (_context) {
|
|
139
|
+
while (1) switch (_context.prev = _context.next) {
|
|
140
|
+
case 0:
|
|
141
|
+
params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
142
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
143
|
+
if (params.sync_id) {
|
|
144
|
+
_context.next = 1;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
throw new errors.MissingParameterError('Parameter missing: sync_id');
|
|
148
|
+
case 1:
|
|
149
|
+
if (!(params.user_id && !(0, _utils.isInt)(params.user_id))) {
|
|
150
|
+
_context.next = 2;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
throw new errors.InvalidParameterError("Bad parameter: user_id must be of type Int, received ".concat((0, _utils.getType)(params.user_id)));
|
|
154
|
+
case 2:
|
|
155
|
+
if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
|
|
156
|
+
_context.next = 3;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
|
|
160
|
+
case 3:
|
|
161
|
+
if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
|
|
162
|
+
_context.next = 4;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
|
|
166
|
+
case 4:
|
|
167
|
+
if (!(params.sync_id && !(0, _utils.isInt)(params.sync_id))) {
|
|
168
|
+
_context.next = 5;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
throw new errors.InvalidParameterError("Bad parameter: sync_id must be of type Int, received ".concat((0, _utils.getType)(params.sync_id)));
|
|
172
|
+
case 5:
|
|
173
|
+
_context.next = 6;
|
|
174
|
+
return _Api.default.sendRequest('/sync_runs', 'GET', params, options);
|
|
175
|
+
case 6:
|
|
176
|
+
response = _context.sent;
|
|
177
|
+
return _context.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
|
178
|
+
return new _SyncRun(obj, options);
|
|
179
|
+
})) || []);
|
|
180
|
+
case 7:
|
|
181
|
+
case "end":
|
|
182
|
+
return _context.stop();
|
|
183
|
+
}
|
|
184
|
+
}, _callee);
|
|
185
|
+
})));
|
|
186
|
+
(0, _defineProperty2.default)(SyncRun, "all", function () {
|
|
187
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
188
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
189
|
+
return _SyncRun.list(params, options);
|
|
190
|
+
});
|
|
191
|
+
// Parameters:
|
|
192
|
+
// id (required) - int64 - Sync Run ID.
|
|
193
|
+
(0, _defineProperty2.default)(SyncRun, "find", /*#__PURE__*/function () {
|
|
194
|
+
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(id) {
|
|
195
|
+
var params,
|
|
196
|
+
options,
|
|
197
|
+
response,
|
|
198
|
+
_args2 = arguments;
|
|
199
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
200
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
201
|
+
case 0:
|
|
202
|
+
params = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
203
|
+
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
204
|
+
if ((0, _utils.isObject)(params)) {
|
|
205
|
+
_context2.next = 1;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
209
|
+
case 1:
|
|
210
|
+
params.id = id;
|
|
211
|
+
if (params.id) {
|
|
212
|
+
_context2.next = 2;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
throw new errors.MissingParameterError('Parameter missing: id');
|
|
216
|
+
case 2:
|
|
217
|
+
if (!(params.id && !(0, _utils.isInt)(params.id))) {
|
|
218
|
+
_context2.next = 3;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
|
|
222
|
+
case 3:
|
|
223
|
+
_context2.next = 4;
|
|
224
|
+
return _Api.default.sendRequest("/sync_runs/".concat(encodeURIComponent(params.id)), 'GET', params, options);
|
|
225
|
+
case 4:
|
|
226
|
+
response = _context2.sent;
|
|
227
|
+
return _context2.abrupt("return", new _SyncRun(response === null || response === void 0 ? void 0 : response.data, options));
|
|
228
|
+
case 5:
|
|
229
|
+
case "end":
|
|
230
|
+
return _context2.stop();
|
|
231
|
+
}
|
|
232
|
+
}, _callee2);
|
|
233
|
+
}));
|
|
234
|
+
return function (_x) {
|
|
235
|
+
return _ref4.apply(this, arguments);
|
|
236
|
+
};
|
|
237
|
+
}());
|
|
238
|
+
(0, _defineProperty2.default)(SyncRun, "get", function (id) {
|
|
239
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
240
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
241
|
+
return _SyncRun.find(id, params, options);
|
|
242
|
+
});
|
|
243
|
+
var _default = exports.default = SyncRun;
|
|
244
|
+
module.exports = SyncRun;
|
|
245
|
+
module.exports.default = SyncRun;
|
package/package.json
CHANGED
package/src/Files.js
CHANGED
package/src/models/Site.js
CHANGED
|
@@ -193,6 +193,9 @@ class Site {
|
|
|
193
193
|
// boolean # Use legacy checksums mode?
|
|
194
194
|
getLegacyChecksumsMode = () => this.attributes.legacy_checksums_mode
|
|
195
195
|
|
|
196
|
+
// boolean # If true, we will migrate all remote server syncs to the new Sync model.
|
|
197
|
+
getMigrateRemoteServerSyncToSync = () => this.attributes.migrate_remote_server_sync_to_sync
|
|
198
|
+
|
|
196
199
|
// boolean # Is the mobile app enabled?
|
|
197
200
|
getMobileApp = () => this.attributes.mobile_app
|
|
198
201
|
|
|
@@ -594,6 +597,7 @@ class Site {
|
|
|
594
597
|
// calculate_file_checksums_sha1 - boolean - Calculate SHA1 checksums for files?
|
|
595
598
|
// calculate_file_checksums_sha256 - boolean - Calculate SHA256 checksums for files?
|
|
596
599
|
// legacy_checksums_mode - boolean - Use legacy checksums mode?
|
|
600
|
+
// migrate_remote_server_sync_to_sync - boolean - If true, we will migrate all remote server syncs to the new Sync model.
|
|
597
601
|
// session_expiry - double - Session expiry in hours
|
|
598
602
|
// ssl_required - boolean - Is SSL required? Disabling this is insecure.
|
|
599
603
|
// tls_disabled - boolean - DO NOT ENABLE. This setting allows TLSv1.0 and TLSv1.1 to be used on your site. We intend to remove this capability entirely in early 2024. If set, the `sftp_insecure_ciphers` flag will be automatically set to true.
|