files.com 1.0.236 → 1.0.238

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.
Files changed (72) hide show
  1. package/_VERSION +1 -1
  2. package/docs/Errors.md +1 -0
  3. package/docs/models/BundleNotification.md +35 -0
  4. package/lib/Api.js +153 -159
  5. package/lib/Errors.js +680 -666
  6. package/lib/isomorphic/File.node.js +24 -28
  7. package/lib/models/ActionNotificationExport.js +97 -101
  8. package/lib/models/ActionNotificationExportResult.js +44 -46
  9. package/lib/models/ActionWebhookFailure.js +42 -44
  10. package/lib/models/ApiKey.js +271 -287
  11. package/lib/models/App.js +26 -28
  12. package/lib/models/As2IncomingMessage.js +32 -34
  13. package/lib/models/As2OutgoingMessage.js +32 -34
  14. package/lib/models/As2Partner.js +231 -241
  15. package/lib/models/As2Station.js +219 -229
  16. package/lib/models/Automation.js +333 -343
  17. package/lib/models/AutomationRun.js +75 -79
  18. package/lib/models/BandwidthSnapshot.js +26 -28
  19. package/lib/models/Behavior.js +323 -337
  20. package/lib/models/Bundle.js +375 -387
  21. package/lib/models/BundleDownload.js +38 -40
  22. package/lib/models/BundleNotification.js +223 -173
  23. package/lib/models/BundleRecipient.js +104 -108
  24. package/lib/models/BundleRegistration.js +38 -40
  25. package/lib/models/Clickwrap.js +213 -223
  26. package/lib/models/DnsRecord.js +26 -28
  27. package/lib/models/ExternalEvent.js +93 -99
  28. package/lib/models/File.js +726 -766
  29. package/lib/models/FileComment.js +180 -188
  30. package/lib/models/FileCommentReaction.js +84 -88
  31. package/lib/models/FileMigration.js +31 -33
  32. package/lib/models/Folder.js +94 -98
  33. package/lib/models/FormFieldSet.js +189 -199
  34. package/lib/models/Group.js +207 -217
  35. package/lib/models/GroupUser.js +230 -238
  36. package/lib/models/History.js +266 -276
  37. package/lib/models/HistoryExport.js +175 -179
  38. package/lib/models/HistoryExportResult.js +44 -46
  39. package/lib/models/InboxRecipient.js +104 -108
  40. package/lib/models/InboxRegistration.js +32 -34
  41. package/lib/models/InboxUpload.js +38 -40
  42. package/lib/models/Invoice.js +57 -61
  43. package/lib/models/IpAddress.js +78 -84
  44. package/lib/models/Lock.js +148 -154
  45. package/lib/models/Message.js +267 -277
  46. package/lib/models/MessageComment.js +207 -217
  47. package/lib/models/MessageCommentReaction.js +147 -155
  48. package/lib/models/MessageReaction.js +147 -155
  49. package/lib/models/Notification.js +255 -265
  50. package/lib/models/Payment.js +57 -61
  51. package/lib/models/Permission.js +128 -134
  52. package/lib/models/Priority.js +45 -47
  53. package/lib/models/Project.js +183 -193
  54. package/lib/models/PublicKey.js +207 -217
  55. package/lib/models/RemoteBandwidthSnapshot.js +26 -28
  56. package/lib/models/RemoteServer.js +805 -819
  57. package/lib/models/Request.js +166 -174
  58. package/lib/models/Session.js +47 -51
  59. package/lib/models/SettingsChange.js +26 -28
  60. package/lib/models/SftpHostKey.js +177 -187
  61. package/lib/models/Site.js +412 -418
  62. package/lib/models/SsoStrategy.js +99 -105
  63. package/lib/models/Style.js +127 -133
  64. package/lib/models/UsageDailySnapshot.js +26 -28
  65. package/lib/models/UsageSnapshot.js +26 -28
  66. package/lib/models/User.js +587 -603
  67. package/lib/models/UserCipherUse.js +32 -34
  68. package/lib/models/UserRequest.js +147 -155
  69. package/lib/models/WebhookTest.js +54 -56
  70. package/package.json +1 -1
  71. package/src/Errors.js +1 -0
  72. package/src/models/BundleNotification.js +39 -1
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.236
1
+ 1.0.238
package/docs/Errors.md CHANGED
@@ -63,6 +63,7 @@ These errors are derived from the error groups listed above.
63
63
  ### BadRequest_InvalidInputEncodingError
64
64
  ### BadRequest_InvalidInterfaceError
65
65
  ### BadRequest_InvalidOauthProviderError
66
+ ### BadRequest_InvalidPathError
66
67
  ### BadRequest_InvalidReturnToUrlError
67
68
  ### BadRequest_InvalidUploadOffsetError
68
69
  ### BadRequest_InvalidUploadPartGapError
@@ -7,6 +7,7 @@
7
7
  "bundle_id": 1,
8
8
  "id": 1,
9
9
  "notify_on_registration": true,
10
+ "notify_on_upload": true,
10
11
  "user_id": 1
11
12
  }
12
13
  ```
@@ -14,6 +15,7 @@
14
15
  * `bundle_id` (int64): Bundle ID to notify on
15
16
  * `id` (int64): Bundle Notification ID
16
17
  * `notify_on_registration` (boolean): Triggers bundle notification when a registration action occurs for it.
18
+ * `notify_on_upload` (boolean): Triggers bundle notification when a upload action occurs for it.
17
19
  * `user_id` (int64): The id of the user to notify.
18
20
 
19
21
  ---
@@ -57,6 +59,7 @@ await BundleNotification.find(id)
57
59
  await BundleNotification.create({
58
60
  'user_id': 1,
59
61
  'notify_on_registration': true,
62
+ 'notify_on_upload': true,
60
63
  'bundle_id': 1,
61
64
  })
62
65
  ```
@@ -66,10 +69,42 @@ await BundleNotification.create({
66
69
 
67
70
  * `user_id` (int64): Required - The id of the user to notify.
68
71
  * `notify_on_registration` (boolean): Triggers bundle notification when a registration action occurs for it.
72
+ * `notify_on_upload` (boolean): Triggers bundle notification when a upload action occurs for it.
69
73
  * `bundle_id` (int64): Required - Bundle ID to notify on
70
74
 
71
75
  ---
72
76
 
77
+ ## Update Bundle Notification
78
+
79
+ ```
80
+ const [bundle_notification] = await BundleNotification.list()
81
+
82
+ await bundle_notification.update({
83
+ 'notify_on_registration': true,
84
+ 'notify_on_upload': true,
85
+ })
86
+ ```
87
+
88
+ ### Parameters
89
+
90
+ * `id` (int64): Required - Bundle Notification ID.
91
+ * `notify_on_registration` (boolean): Triggers bundle notification when a registration action occurs for it.
92
+ * `notify_on_upload` (boolean): Triggers bundle notification when a upload action occurs for it.
93
+
94
+ ### Example Response
95
+
96
+ ```json
97
+ {
98
+ "bundle_id": 1,
99
+ "id": 1,
100
+ "notify_on_registration": true,
101
+ "notify_on_upload": true,
102
+ "user_id": 1
103
+ }
104
+ ```
105
+
106
+ ---
107
+
73
108
  ## Delete Bundle Notification
74
109
 
75
110
  ```
package/lib/Api.js CHANGED
@@ -37,53 +37,51 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
37
37
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(path, verb, options) {
38
38
  var isExternal, baseUrl, url, response;
39
39
  return _regenerator.default.wrap(function _callee$(_context) {
40
- while (1) {
41
- switch (_context.prev = _context.next) {
42
- case 0:
43
- isExternal = /^[a-zA-Z]+:\/\//.test(path);
44
- baseUrl = _Files.default.getBaseUrl();
45
- if (!(!isExternal && !baseUrl)) {
46
- _context.next = 4;
47
- break;
48
- }
49
- throw new errors.ConfigurationError('Base URL has not been set - use Files.setBaseUrl() to set it');
50
- case 4:
51
- url = isExternal ? path : "".concat(baseUrl).concat(_Files.default.getEndpointPrefix()).concat(path);
52
- _Logger.default.debug("Sending request: ".concat(verb, " ").concat(url));
53
- _Logger.default.debug('Sending options:', _objectSpread(_objectSpread({}, options), {}, {
54
- headers: _objectSpread(_objectSpread({}, options.headers), {}, {
55
- 'X-FilesAPI-Key': '<redacted>'
56
- })
57
- }));
58
- Api._configureAutoRetry();
59
- _context.prev = 8;
60
- _context.next = 11;
61
- return (0, _axios.default)(_objectSpread({
62
- method: verb,
63
- timeout: _Files.default.getNetworkTimeout() * 1000,
64
- url: url
65
- }, options));
66
- case 11:
67
- response = _context.sent;
68
- _Logger.default.debug("Status: ".concat(response.status, " ").concat(response.statusText));
69
- if (_Files.default.shouldDebugResponseHeaders()) {
70
- _Logger.default.debug('Response Headers: ');
71
- _Logger.default.debug(response.headers);
72
- }
73
- return _context.abrupt("return", {
74
- status: response.status,
75
- reason: response.statusText,
76
- headers: response.headers,
77
- data: response.data
78
- });
79
- case 17:
80
- _context.prev = 17;
81
- _context.t0 = _context["catch"](8);
82
- errors.handleErrorResponse(_context.t0);
83
- case 20:
84
- case "end":
85
- return _context.stop();
86
- }
40
+ while (1) switch (_context.prev = _context.next) {
41
+ case 0:
42
+ isExternal = /^[a-zA-Z]+:\/\//.test(path);
43
+ baseUrl = _Files.default.getBaseUrl();
44
+ if (!(!isExternal && !baseUrl)) {
45
+ _context.next = 4;
46
+ break;
47
+ }
48
+ throw new errors.ConfigurationError('Base URL has not been set - use Files.setBaseUrl() to set it');
49
+ case 4:
50
+ url = isExternal ? path : "".concat(baseUrl).concat(_Files.default.getEndpointPrefix()).concat(path);
51
+ _Logger.default.debug("Sending request: ".concat(verb, " ").concat(url));
52
+ _Logger.default.debug('Sending options:', _objectSpread(_objectSpread({}, options), {}, {
53
+ headers: _objectSpread(_objectSpread({}, options.headers), {}, {
54
+ 'X-FilesAPI-Key': '<redacted>'
55
+ })
56
+ }));
57
+ Api._configureAutoRetry();
58
+ _context.prev = 8;
59
+ _context.next = 11;
60
+ return (0, _axios.default)(_objectSpread({
61
+ method: verb,
62
+ timeout: _Files.default.getNetworkTimeout() * 1000,
63
+ url: url
64
+ }, options));
65
+ case 11:
66
+ response = _context.sent;
67
+ _Logger.default.debug("Status: ".concat(response.status, " ").concat(response.statusText));
68
+ if (_Files.default.shouldDebugResponseHeaders()) {
69
+ _Logger.default.debug('Response Headers: ');
70
+ _Logger.default.debug(response.headers);
71
+ }
72
+ return _context.abrupt("return", {
73
+ status: response.status,
74
+ reason: response.statusText,
75
+ headers: response.headers,
76
+ data: response.data
77
+ });
78
+ case 17:
79
+ _context.prev = 17;
80
+ _context.t0 = _context["catch"](8);
81
+ errors.handleErrorResponse(_context.t0);
82
+ case 20:
83
+ case "end":
84
+ return _context.stop();
87
85
  }
88
86
  }, _callee, null, [[8, 17]]);
89
87
  }));
@@ -106,44 +104,42 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
106
104
  var _options$autoPaginate;
107
105
  var _response$headers, nextCursor, _ref3, autoPaginateCount, previousAutoPaginateData, nextPage, nextParams, nextMetadata;
108
106
  return _regenerator.default.wrap(function _callee2$(_context2) {
109
- while (1) {
110
- switch (_context2.prev = _context2.next) {
111
- case 0:
112
- if (!((_options$autoPaginate = options.autoPaginate) !== null && _options$autoPaginate !== void 0 ? _options$autoPaginate : _Files.default.getAutoPaginate())) {
113
- _context2.next = 12;
114
- break;
115
- }
116
- nextCursor = response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers['x-files-cursor'];
117
- _ref3 = metadata || {}, autoPaginateCount = _ref3.autoPaginateCount, previousAutoPaginateData = _ref3.previousAutoPaginateData;
118
- if (!nextCursor) {
119
- _context2.next = 10;
120
- break;
121
- }
122
- nextPage = (Number(params === null || params === void 0 ? void 0 : params.page) || 1) + 1;
123
- nextParams = _objectSpread(_objectSpread({}, params), {}, {
124
- cursor: nextCursor,
125
- page: nextPage
126
- });
127
- nextMetadata = {
128
- autoPaginateCount: (autoPaginateCount || 1) + 1,
129
- previousAutoPaginateData: [].concat((0, _toConsumableArray2.default)(previousAutoPaginateData || []), (0, _toConsumableArray2.default)((response === null || response === void 0 ? void 0 : response.data) || []))
130
- };
131
- return _context2.abrupt("return", Api.sendRequest(path, verb, nextParams, options, nextMetadata));
132
- case 10:
133
- if (!previousAutoPaginateData) {
134
- _context2.next = 12;
135
- break;
136
- }
137
- return _context2.abrupt("return", _objectSpread(_objectSpread({}, response), {}, {
138
- autoPaginateRequests: autoPaginateCount,
139
- data: [].concat((0, _toConsumableArray2.default)(previousAutoPaginateData), (0, _toConsumableArray2.default)((response === null || response === void 0 ? void 0 : response.data) || []))
140
- }));
141
- case 12:
142
- return _context2.abrupt("return", response);
143
- case 13:
144
- case "end":
145
- return _context2.stop();
146
- }
107
+ while (1) switch (_context2.prev = _context2.next) {
108
+ case 0:
109
+ if (!((_options$autoPaginate = options.autoPaginate) !== null && _options$autoPaginate !== void 0 ? _options$autoPaginate : _Files.default.getAutoPaginate())) {
110
+ _context2.next = 12;
111
+ break;
112
+ }
113
+ nextCursor = response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers['x-files-cursor'];
114
+ _ref3 = metadata || {}, autoPaginateCount = _ref3.autoPaginateCount, previousAutoPaginateData = _ref3.previousAutoPaginateData;
115
+ if (!nextCursor) {
116
+ _context2.next = 10;
117
+ break;
118
+ }
119
+ nextPage = (Number(params === null || params === void 0 ? void 0 : params.page) || 1) + 1;
120
+ nextParams = _objectSpread(_objectSpread({}, params), {}, {
121
+ cursor: nextCursor,
122
+ page: nextPage
123
+ });
124
+ nextMetadata = {
125
+ autoPaginateCount: (autoPaginateCount || 1) + 1,
126
+ previousAutoPaginateData: [].concat((0, _toConsumableArray2.default)(previousAutoPaginateData || []), (0, _toConsumableArray2.default)((response === null || response === void 0 ? void 0 : response.data) || []))
127
+ };
128
+ return _context2.abrupt("return", Api.sendRequest(path, verb, nextParams, options, nextMetadata));
129
+ case 10:
130
+ if (!previousAutoPaginateData) {
131
+ _context2.next = 12;
132
+ break;
133
+ }
134
+ return _context2.abrupt("return", _objectSpread(_objectSpread({}, response), {}, {
135
+ autoPaginateRequests: autoPaginateCount,
136
+ data: [].concat((0, _toConsumableArray2.default)(previousAutoPaginateData), (0, _toConsumableArray2.default)((response === null || response === void 0 ? void 0 : response.data) || []))
137
+ }));
138
+ case 12:
139
+ return _context2.abrupt("return", response);
140
+ case 13:
141
+ case "end":
142
+ return _context2.stop();
147
143
  }
148
144
  }, _callee2);
149
145
  }));
@@ -168,83 +164,81 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
168
164
  response,
169
165
  _args3 = arguments;
170
166
  return _regenerator.default.wrap(function _callee3$(_context3) {
171
- while (1) {
172
- switch (_context3.prev = _context3.next) {
173
- case 0:
174
- params = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
175
- options = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : {};
176
- metadata = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
177
- headers = _objectSpread(_objectSpread({
178
- Accept: 'application/json'
179
- }, options.headers), {}, {
180
- 'User-Agent': _Files.default.getUserAgent()
181
- });
182
- isExternal = /^[a-zA-Z]+:\/\//.test(path);
183
- if (isExternal) {
184
- _context3.next = 17;
185
- break;
186
- }
187
- sessionId = options.sessionId || _Files.default.getSessionId();
188
- if (!sessionId) {
189
- _context3.next = 11;
190
- break;
191
- }
192
- headers['X-FilesAPI-Auth'] = sessionId;
167
+ while (1) switch (_context3.prev = _context3.next) {
168
+ case 0:
169
+ params = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
170
+ options = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : {};
171
+ metadata = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
172
+ headers = _objectSpread(_objectSpread({
173
+ Accept: 'application/json'
174
+ }, options.headers), {}, {
175
+ 'User-Agent': _Files.default.getUserAgent()
176
+ });
177
+ isExternal = /^[a-zA-Z]+:\/\//.test(path);
178
+ if (isExternal) {
193
179
  _context3.next = 17;
194
180
  break;
195
- case 11:
196
- isCreatingSession = path === '/sessions' && verb.toUpperCase() === 'POST'; // api key cannot be used when creating a session
197
- if (isCreatingSession) {
198
- _context3.next = 17;
199
- break;
200
- }
201
- apiKey = options.apiKey || _Files.default.getApiKey();
202
- if (apiKey) {
203
- _context3.next = 16;
204
- break;
205
- }
206
- throw new errors.ConfigurationError('API key has not been set - use Files.setApiKey() to set it');
207
- case 16:
208
- headers['X-FilesAPI-Key'] = apiKey;
209
- case 17:
210
- updatedOptions = _objectSpread(_objectSpread({}, options), {}, {
211
- headers: headers
212
- });
213
- requestPath = path;
214
- hasParams = (0, _utils.isObject)(params) && !(0, _utils.isEmpty)(params);
215
- if (hasParams) {
216
- if (verb.toUpperCase() === 'GET') {
217
- pairs = Object.entries(params).map(function (_ref5) {
218
- var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
219
- key = _ref6[0],
220
- value = _ref6[1];
221
- return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
222
- });
223
- requestPath += path.includes('?') ? '&' : '?';
224
- requestPath += pairs.join('&');
225
- } else {
226
- updatedOptions.data = JSON.stringify(params);
227
- headers['Content-Type'] = 'application/json';
228
- }
229
- }
230
- if (_Files.default.shouldDebugRequest()) {
231
- _Logger.default.debug('Request Options:');
232
- _Logger.default.debug(_objectSpread(_objectSpread({}, updatedOptions), {}, {
233
- data: hasParams ? "payload keys: ".concat(Object.keys(params).join(', ')) : '(none)',
234
- headers: _objectSpread(_objectSpread({}, headers), {}, {
235
- 'X-FilesAPI-Key': '<redacted>'
236
- })
237
- }));
181
+ }
182
+ sessionId = options.sessionId || _Files.default.getSessionId();
183
+ if (!sessionId) {
184
+ _context3.next = 11;
185
+ break;
186
+ }
187
+ headers['X-FilesAPI-Auth'] = sessionId;
188
+ _context3.next = 17;
189
+ break;
190
+ case 11:
191
+ isCreatingSession = path === '/sessions' && verb.toUpperCase() === 'POST'; // api key cannot be used when creating a session
192
+ if (isCreatingSession) {
193
+ _context3.next = 17;
194
+ break;
195
+ }
196
+ apiKey = options.apiKey || _Files.default.getApiKey();
197
+ if (apiKey) {
198
+ _context3.next = 16;
199
+ break;
200
+ }
201
+ throw new errors.ConfigurationError('API key has not been set - use Files.setApiKey() to set it');
202
+ case 16:
203
+ headers['X-FilesAPI-Key'] = apiKey;
204
+ case 17:
205
+ updatedOptions = _objectSpread(_objectSpread({}, options), {}, {
206
+ headers: headers
207
+ });
208
+ requestPath = path;
209
+ hasParams = (0, _utils.isObject)(params) && !(0, _utils.isEmpty)(params);
210
+ if (hasParams) {
211
+ if (verb.toUpperCase() === 'GET') {
212
+ pairs = Object.entries(params).map(function (_ref5) {
213
+ var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
214
+ key = _ref6[0],
215
+ value = _ref6[1];
216
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
217
+ });
218
+ requestPath += path.includes('?') ? '&' : '?';
219
+ requestPath += pairs.join('&');
220
+ } else {
221
+ updatedOptions.data = JSON.stringify(params);
222
+ headers['Content-Type'] = 'application/json';
238
223
  }
239
- _context3.next = 24;
240
- return Api._sendVerbatim(requestPath, verb, updatedOptions);
241
- case 24:
242
- response = _context3.sent;
243
- return _context3.abrupt("return", Api._autoPaginate(path, verb, params, updatedOptions, response, metadata));
244
- case 26:
245
- case "end":
246
- return _context3.stop();
247
- }
224
+ }
225
+ if (_Files.default.shouldDebugRequest()) {
226
+ _Logger.default.debug('Request Options:');
227
+ _Logger.default.debug(_objectSpread(_objectSpread({}, updatedOptions), {}, {
228
+ data: hasParams ? "payload keys: ".concat(Object.keys(params).join(', ')) : '(none)',
229
+ headers: _objectSpread(_objectSpread({}, headers), {}, {
230
+ 'X-FilesAPI-Key': '<redacted>'
231
+ })
232
+ }));
233
+ }
234
+ _context3.next = 24;
235
+ return Api._sendVerbatim(requestPath, verb, updatedOptions);
236
+ case 24:
237
+ response = _context3.sent;
238
+ return _context3.abrupt("return", Api._autoPaginate(path, verb, params, updatedOptions, response, metadata));
239
+ case 26:
240
+ case "end":
241
+ return _context3.stop();
248
242
  }
249
243
  }, _callee3);
250
244
  }));