files.com 1.0.192 → 1.0.195

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 CHANGED
@@ -1 +1 @@
1
- 1.0.192
1
+ 1.0.195
@@ -178,6 +178,7 @@
178
178
  "dav_permission": true,
179
179
  "disabled": true,
180
180
  "email": "john.doe@files.com",
181
+ "first_login_at": "2000-01-01T01:00:00Z",
181
182
  "ftp_permission": true,
182
183
  "group_ids": "",
183
184
  "header_text": "User-specific message.",
@@ -209,6 +210,7 @@
209
210
  "externally_managed": true,
210
211
  "time_zone": "Pacific Time (US & Canada)",
211
212
  "type_of_2fa": "yubi",
213
+ "updated_at": "2000-01-01T01:00:00Z",
212
214
  "user_root": ""
213
215
  },
214
216
  "user_lockout": true,
@@ -22,6 +22,7 @@
22
22
  "dav_permission": true,
23
23
  "disabled": true,
24
24
  "email": "john.doe@files.com",
25
+ "first_login_at": "2000-01-01T01:00:00Z",
25
26
  "ftp_permission": true,
26
27
  "group_ids": "",
27
28
  "header_text": "User-specific message.",
@@ -53,6 +54,7 @@
53
54
  "externally_managed": true,
54
55
  "time_zone": "Pacific Time (US & Canada)",
55
56
  "type_of_2fa": "yubi",
57
+ "updated_at": "2000-01-01T01:00:00Z",
56
58
  "user_root": ""
57
59
  }
58
60
  ```
@@ -73,6 +75,7 @@
73
75
  * `dav_permission` (boolean): Can the user connect with WebDAV?
74
76
  * `disabled` (boolean): Is user disabled? Disabled users cannot log in, and do not count for billing purposes. Users can be automatically disabled after an inactivity period via a Site setting.
75
77
  * `email` (email): User email address
78
+ * `first_login_at` (date-time): User's first login time
76
79
  * `ftp_permission` (boolean): Can the user access with FTP/FTPS?
77
80
  * `group_ids` (string): Comma-separated list of group IDs of which this user is a member
78
81
  * `header_text` (string): Text to display to the user in the header of the UI
@@ -104,6 +107,7 @@
104
107
  * `externally_managed` (boolean): Is this user managed by a SsoStrategy?
105
108
  * `time_zone` (string): User time zone
106
109
  * `type_of_2fa` (string): Type(s) of 2FA methods in use. Will be either `sms`, `totp`, `u2f`, `yubi`, or multiple values sorted alphabetically and joined by an underscore.
110
+ * `updated_at` (date-time): User record last updated at. Note this may be incremented because of internal or external updates.
107
111
  * `user_root` (string): Root folder for FTP (and optionally SFTP if the appropriate site-wide setting is set.) Note that this is not used for API, Desktop, or Web interface.
108
112
  * `avatar_file` (file): An image file for your user avatar.
109
113
  * `avatar_delete` (boolean): If true, the avatar will be deleted.
@@ -414,6 +418,7 @@ await user.update({
414
418
  "dav_permission": true,
415
419
  "disabled": true,
416
420
  "email": "john.doe@files.com",
421
+ "first_login_at": "2000-01-01T01:00:00Z",
417
422
  "ftp_permission": true,
418
423
  "group_ids": "",
419
424
  "header_text": "User-specific message.",
@@ -445,6 +450,7 @@ await user.update({
445
450
  "externally_managed": true,
446
451
  "time_zone": "Pacific Time (US & Canada)",
447
452
  "type_of_2fa": "yubi",
453
+ "updated_at": "2000-01-01T01:00:00Z",
448
454
  "user_root": ""
449
455
  }
450
456
  ```
package/lib/Errors.js CHANGED
@@ -69,7 +69,7 @@ var errorClasses = {
69
69
  };
70
70
 
71
71
  var toPascalCase = function toPascalCase(string) {
72
- return string.replace('-', ' ').split(' ').map(function (part) {
72
+ return string.replace(/-/g, ' ').split(' ').map(function (part) {
73
73
  return part[0].toUpperCase() + part.substring(1);
74
74
  }).join('');
75
75
  };
@@ -99,26 +99,28 @@ var handleErrorResponse = function handleErrorResponse(error) {
99
99
  }
100
100
 
101
101
  var parts = errorData.type.split('/');
102
- var errorFamily;
103
- var errorType;
104
102
  var className;
105
103
 
106
104
  if (parts.length > 1) {
107
- var _parts$map = parts.map(toPascalCase);
105
+ var _parts$map = parts.map(toPascalCase),
106
+ _parts$map2 = (0, _slicedToArray2.default)(_parts$map, 2),
107
+ errorFamily = _parts$map2[0],
108
+ errorType = _parts$map2[1];
108
109
 
109
- var _parts$map2 = (0, _slicedToArray2.default)(_parts$map, 2);
110
-
111
- errorFamily = _parts$map2[0];
112
- errorType = _parts$map2[1];
113
110
  className = "".concat(errorFamily, "_").concat(errorType, "Error");
114
111
  } else {
115
- errorFamily = toPascalCase(parts[0]);
116
- className = "".concat(errorType, "Error");
112
+ var _errorType = toPascalCase(parts[0]);
113
+
114
+ className = "".concat(_errorType, "Error");
117
115
  }
118
116
 
119
- var ErrorClass = errorClasses[className];
117
+ var ErrorClass = errorClasses[className] || FilesApiError;
118
+
119
+ if (!errorClasses[className]) {
120
+ _Logger.default.debug("Unable to find exception with name of ".concat(className, " - falling back to FilesApiError"));
121
+ }
120
122
 
121
- _Logger.default.error("".concat(className, " Exception >"), code, message);
123
+ _Logger.default.error("".concat(ErrorClass.name, " Exception >"), code, message);
122
124
 
123
125
  throw new ErrorClass(message, code);
124
126
  }; // general errors
@@ -142,6 +142,12 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
142
142
  (0, _defineProperty2.default)(this, "setEmail", function (value) {
143
143
  _this.attributes.email = value;
144
144
  });
145
+ (0, _defineProperty2.default)(this, "getFirstLoginAt", function () {
146
+ return _this.attributes.first_login_at;
147
+ });
148
+ (0, _defineProperty2.default)(this, "setFirstLoginAt", function (value) {
149
+ _this.attributes.first_login_at = value;
150
+ });
145
151
  (0, _defineProperty2.default)(this, "getFtpPermission", function () {
146
152
  return _this.attributes.ftp_permission;
147
153
  });
@@ -328,6 +334,9 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
328
334
  (0, _defineProperty2.default)(this, "setTypeOf2fa", function (value) {
329
335
  _this.attributes.type_of_2fa = value;
330
336
  });
337
+ (0, _defineProperty2.default)(this, "getUpdatedAt", function () {
338
+ return _this.attributes.updated_at;
339
+ });
331
340
  (0, _defineProperty2.default)(this, "getUserRoot", function () {
332
341
  return _this.attributes.user_root;
333
342
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.192",
3
+ "version": "1.0.195",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Errors.js CHANGED
@@ -20,7 +20,7 @@ const errorClasses = {
20
20
  }
21
21
 
22
22
  const toPascalCase = string =>
23
- string.replace('-', ' ').split(' ')
23
+ string.replace(/-/g, ' ').split(' ')
24
24
  .map(part => part[0].toUpperCase() + part.substring(1))
25
25
  .join('')
26
26
 
@@ -47,21 +47,23 @@ export const handleErrorResponse = error => {
47
47
 
48
48
  const parts = errorData.type.split('/')
49
49
 
50
- let errorFamily
51
- let errorType
52
50
  let className
53
-
51
+
54
52
  if (parts.length > 1) {
55
- [errorFamily, errorType] = parts.map(toPascalCase)
53
+ const [errorFamily, errorType] = parts.map(toPascalCase)
56
54
  className = `${errorFamily}_${errorType}Error`
57
55
  } else {
58
- errorFamily = toPascalCase(parts[0])
56
+ const errorType = toPascalCase(parts[0])
59
57
  className = `${errorType}Error`
60
58
  }
61
59
 
62
- const ErrorClass = errorClasses[className]
60
+ const ErrorClass = errorClasses[className] || FilesApiError
61
+
62
+ if (!errorClasses[className]) {
63
+ Logger.debug(`Unable to find exception with name of ${className} - falling back to FilesApiError`)
64
+ }
63
65
 
64
- Logger.error(`${className} Exception >`, code, message)
66
+ Logger.error(`${ErrorClass.name} Exception >`, code, message)
65
67
  throw new ErrorClass(message, code)
66
68
  }
67
69
 
@@ -131,6 +131,13 @@ class User {
131
131
  this.attributes.email = value
132
132
  }
133
133
 
134
+ // date-time # User's first login time
135
+ getFirstLoginAt = () => this.attributes.first_login_at
136
+
137
+ setFirstLoginAt = value => {
138
+ this.attributes.first_login_at = value
139
+ }
140
+
134
141
  // boolean # Can the user access with FTP/FTPS?
135
142
  getFtpPermission = () => this.attributes.ftp_permission
136
143
 
@@ -348,6 +355,9 @@ class User {
348
355
  this.attributes.type_of_2fa = value
349
356
  }
350
357
 
358
+ // date-time # User record last updated at. Note this may be incremented because of internal or external updates.
359
+ getUpdatedAt = () => this.attributes.updated_at
360
+
351
361
  // string # Root folder for FTP (and optionally SFTP if the appropriate site-wide setting is set.) Note that this is not used for API, Desktop, or Web interface.
352
362
  getUserRoot = () => this.attributes.user_root
353
363