files.com 1.0.291 → 1.0.293

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.291
1
+ 1.0.293
@@ -5,6 +5,11 @@
5
5
  ```
6
6
  {
7
7
  "code": "abc123",
8
+ "color_left": "#0066a7",
9
+ "color_link": "#d34f5d",
10
+ "color_text": "#0066a7",
11
+ "color_top": "#000000",
12
+ "color_top_text": "#ffffff",
8
13
  "url": "https://subdomain.files.com/f/12345678",
9
14
  "description": "The public description of the bundle.",
10
15
  "expires_at": "2000-01-01T01:00:00Z",
@@ -58,6 +63,11 @@
58
63
  ```
59
64
 
60
65
  * `code` (string): Bundle code. This code forms the end part of the Public URL.
66
+ * `color_left` (string): Page link and button color
67
+ * `color_link` (string): Top bar link color
68
+ * `color_text` (string): Page link and button color
69
+ * `color_top` (string): Top bar background color
70
+ * `color_top_text` (string): Top bar text color
61
71
  * `url` (string): Public URL of Share Link
62
72
  * `description` (string): Public description
63
73
  * `expires_at` (date-time): Bundle expiration date/time
@@ -283,6 +293,11 @@ await bundle.update({
283
293
  ```json
284
294
  {
285
295
  "code": "abc123",
296
+ "color_left": "#0066a7",
297
+ "color_link": "#d34f5d",
298
+ "color_text": "#0066a7",
299
+ "color_top": "#000000",
300
+ "color_top_text": "#ffffff",
286
301
  "url": "https://subdomain.files.com/f/12345678",
287
302
  "description": "The public description of the bundle.",
288
303
  "expires_at": "2000-01-01T01:00:00Z",
@@ -38,6 +38,41 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
38
38
  (0, _defineProperty2.default)(this, "setCode", function (value) {
39
39
  _this.attributes.code = value;
40
40
  });
41
+ // string # Page link and button color
42
+ (0, _defineProperty2.default)(this, "getColorLeft", function () {
43
+ return _this.attributes.color_left;
44
+ });
45
+ (0, _defineProperty2.default)(this, "setColorLeft", function (value) {
46
+ _this.attributes.color_left = value;
47
+ });
48
+ // string # Top bar link color
49
+ (0, _defineProperty2.default)(this, "getColorLink", function () {
50
+ return _this.attributes.color_link;
51
+ });
52
+ (0, _defineProperty2.default)(this, "setColorLink", function (value) {
53
+ _this.attributes.color_link = value;
54
+ });
55
+ // string # Page link and button color
56
+ (0, _defineProperty2.default)(this, "getColorText", function () {
57
+ return _this.attributes.color_text;
58
+ });
59
+ (0, _defineProperty2.default)(this, "setColorText", function (value) {
60
+ _this.attributes.color_text = value;
61
+ });
62
+ // string # Top bar background color
63
+ (0, _defineProperty2.default)(this, "getColorTop", function () {
64
+ return _this.attributes.color_top;
65
+ });
66
+ (0, _defineProperty2.default)(this, "setColorTop", function (value) {
67
+ _this.attributes.color_top = value;
68
+ });
69
+ // string # Top bar text color
70
+ (0, _defineProperty2.default)(this, "getColorTopText", function () {
71
+ return _this.attributes.color_top_text;
72
+ });
73
+ (0, _defineProperty2.default)(this, "setColorTopText", function (value) {
74
+ _this.attributes.color_top_text = value;
75
+ });
41
76
  // string # Public URL of Share Link
42
77
  (0, _defineProperty2.default)(this, "getUrl", function () {
43
78
  return _this.attributes.url;
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  exports.__esModule = true;
6
6
  exports.default = void 0;
7
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
7
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
@@ -18,6 +19,7 @@ var _Logger = _interopRequireDefault(require("../Logger"));
18
19
  var _utils = require("../utils");
19
20
  var _FileAction = _interopRequireDefault(require("./FileAction"));
20
21
  var _FileUploadPart = _interopRequireDefault(require("./FileUploadPart"));
22
+ var _excluded = ["determinePartUploadUri"];
21
23
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
25
  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; }
@@ -902,30 +904,31 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
902
904
  return _ref16.apply(this, arguments);
903
905
  };
904
906
  }());
905
- (0, _defineProperty2.default)(File, "_determinePartUploadUri", function (fileUploadPart) {
906
- return fileUploadPart.upload_uri;
907
- });
908
907
  /**
909
908
  * @note see File.copy() for list of supported params
910
909
  */
911
910
  (0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
912
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, readableStream, params, options) {
913
- var firstFileUploadPart, file;
911
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, readableStream, params, optionsRaw) {
912
+ var _ref18, determinePartUploadUriRaw, options, firstFileUploadPart, determinePartUploadUri, file;
914
913
  return _regenerator.default.wrap(function _callee17$(_context17) {
915
914
  while (1) switch (_context17.prev = _context17.next) {
916
915
  case 0:
917
- _context17.next = 2;
916
+ _ref18 = optionsRaw || {}, determinePartUploadUriRaw = _ref18.determinePartUploadUri, options = (0, _objectWithoutProperties2.default)(_ref18, _excluded);
917
+ _context17.next = 3;
918
918
  return File._openUpload(destinationPath, params, options);
919
- case 2:
919
+ case 3:
920
920
  firstFileUploadPart = _context17.sent;
921
921
  if (firstFileUploadPart) {
922
- _context17.next = 5;
922
+ _context17.next = 6;
923
923
  break;
924
924
  }
925
925
  return _context17.abrupt("return");
926
- case 5:
927
- _context17.prev = 5;
928
- _context17.next = 8;
926
+ case 6:
927
+ determinePartUploadUri = determinePartUploadUriRaw || function (fileUploadPart) {
928
+ return fileUploadPart.upload_uri;
929
+ };
930
+ _context17.prev = 7;
931
+ _context17.next = 10;
929
932
  return new Promise(function (resolve, reject) {
930
933
  var part = 0;
931
934
  var chunks = [];
@@ -935,7 +938,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
935
938
  reject(error);
936
939
  });
937
940
  readableStream.on('data', /*#__PURE__*/function () {
938
- var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(chunk) {
941
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(chunk) {
939
942
  var nextLength, excessLength, chunkBuffer, tailLength, lastChunkForPart, firstChunkForNextPart, buffer, nextFileUploadPart, upload_uri, uploadPromise;
940
943
  return _regenerator.default.wrap(function _callee15$(_context15) {
941
944
  while (1) switch (_context15.prev = _context15.next) {
@@ -960,7 +963,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
960
963
  return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
961
964
  case 13:
962
965
  nextFileUploadPart = _context15.sent;
963
- upload_uri = File._determinePartUploadUri(nextFileUploadPart);
966
+ upload_uri = determinePartUploadUri(nextFileUploadPart);
964
967
  uploadPromise = _Api.default.sendFilePart(upload_uri, 'PUT', buffer);
965
968
  if (!firstFileUploadPart.parallel_parts) {
966
969
  _context15.next = 20;
@@ -995,7 +998,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
995
998
  }, _callee15, null, [[0, 31]]);
996
999
  }));
997
1000
  return function (_x20) {
998
- return _ref18.apply(this, arguments);
1001
+ return _ref19.apply(this, arguments);
999
1002
  };
1000
1003
  }());
1001
1004
  readableStream.on('end', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
@@ -1013,7 +1016,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1013
1016
  return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
1014
1017
  case 5:
1015
1018
  nextFileUploadPart = _context16.sent;
1016
- upload_uri = File._determinePartUploadUri(nextFileUploadPart);
1019
+ upload_uri = determinePartUploadUri(nextFileUploadPart);
1017
1020
  concurrentUploads.push(_Api.default.sendFilePart(upload_uri, 'PUT', buffer));
1018
1021
  case 8:
1019
1022
  _context16.next = 10;
@@ -1038,18 +1041,18 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1038
1041
  }, _callee16, null, [[0, 17]]);
1039
1042
  })));
1040
1043
  });
1041
- case 8:
1044
+ case 10:
1042
1045
  file = _context17.sent;
1043
1046
  return _context17.abrupt("return", file);
1044
- case 12:
1045
- _context17.prev = 12;
1046
- _context17.t0 = _context17["catch"](5);
1047
+ case 14:
1048
+ _context17.prev = 14;
1049
+ _context17.t0 = _context17["catch"](7);
1047
1050
  errors.handleErrorResponse(_context17.t0);
1048
- case 15:
1051
+ case 17:
1049
1052
  case "end":
1050
1053
  return _context17.stop();
1051
1054
  }
1052
- }, _callee17, null, [[5, 12]]);
1055
+ }, _callee17, null, [[7, 14]]);
1053
1056
  }));
1054
1057
  return function (_x16, _x17, _x18, _x19) {
1055
1058
  return _ref17.apply(this, arguments);
@@ -1060,7 +1063,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1060
1063
  * @note see File.copy() for list of supported params
1061
1064
  */
1062
1065
  (0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
1063
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, data, params, options) {
1066
+ var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, data, params, options) {
1064
1067
  return _regenerator.default.wrap(function _callee18$(_context18) {
1065
1068
  while (1) switch (_context18.prev = _context18.next) {
1066
1069
  case 0:
@@ -1078,14 +1081,14 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1078
1081
  }, _callee18);
1079
1082
  }));
1080
1083
  return function (_x21, _x22, _x23, _x24) {
1081
- return _ref20.apply(this, arguments);
1084
+ return _ref21.apply(this, arguments);
1082
1085
  };
1083
1086
  }());
1084
1087
  /**
1085
1088
  * @note see File.copy() for list of supported params
1086
1089
  */
1087
1090
  (0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
1088
- var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(destinationPath, sourceFilePath, params, options) {
1091
+ var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(destinationPath, sourceFilePath, params, options) {
1089
1092
  var _require4, openDiskFileReadStream, stream;
1090
1093
  return _regenerator.default.wrap(function _callee19$(_context19) {
1091
1094
  while (1) switch (_context19.prev = _context19.next) {
@@ -1106,7 +1109,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1106
1109
  }, _callee19);
1107
1110
  }));
1108
1111
  return function (_x25, _x26, _x27, _x28) {
1109
- return _ref21.apply(this, arguments);
1112
+ return _ref22.apply(this, arguments);
1110
1113
  };
1111
1114
  }());
1112
1115
  // Parameters:
@@ -1125,7 +1128,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1125
1128
  // structure - string - If copying folder, copy just the structure?
1126
1129
  // with_rename - boolean - Allow file rename instead of overwrite?
1127
1130
  (0, _defineProperty2.default)(File, "create", /*#__PURE__*/function () {
1128
- var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
1131
+ var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
1129
1132
  var params,
1130
1133
  options,
1131
1134
  response,
@@ -1220,7 +1223,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1220
1223
  }, _callee20);
1221
1224
  }));
1222
1225
  return function (_x29) {
1223
- return _ref22.apply(this, arguments);
1226
+ return _ref23.apply(this, arguments);
1224
1227
  };
1225
1228
  }());
1226
1229
  // Parameters:
@@ -1229,7 +1232,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1229
1232
  // with_previews - boolean - Include file preview information?
1230
1233
  // with_priority_color - boolean - Include file priority color information?
1231
1234
  (0, _defineProperty2.default)(File, "find", /*#__PURE__*/function () {
1232
- var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(path) {
1235
+ var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(path) {
1233
1236
  var params,
1234
1237
  options,
1235
1238
  response,
@@ -1276,7 +1279,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1276
1279
  }, _callee21);
1277
1280
  }));
1278
1281
  return function (_x30) {
1279
- return _ref23.apply(this, arguments);
1282
+ return _ref24.apply(this, arguments);
1280
1283
  };
1281
1284
  }());
1282
1285
  (0, _defineProperty2.default)(File, "get", function (path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.291",
3
+ "version": "1.0.293",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
@@ -30,6 +30,41 @@ class Bundle {
30
30
  this.attributes.code = value
31
31
  }
32
32
 
33
+ // string # Page link and button color
34
+ getColorLeft = () => this.attributes.color_left
35
+
36
+ setColorLeft = value => {
37
+ this.attributes.color_left = value
38
+ }
39
+
40
+ // string # Top bar link color
41
+ getColorLink = () => this.attributes.color_link
42
+
43
+ setColorLink = value => {
44
+ this.attributes.color_link = value
45
+ }
46
+
47
+ // string # Page link and button color
48
+ getColorText = () => this.attributes.color_text
49
+
50
+ setColorText = value => {
51
+ this.attributes.color_text = value
52
+ }
53
+
54
+ // string # Top bar background color
55
+ getColorTop = () => this.attributes.color_top
56
+
57
+ setColorTop = value => {
58
+ this.attributes.color_top = value
59
+ }
60
+
61
+ // string # Top bar text color
62
+ getColorTopText = () => this.attributes.color_top_text
63
+
64
+ setColorTopText = value => {
65
+ this.attributes.color_top_text = value
66
+ }
67
+
33
68
  // string # Public URL of Share Link
34
69
  getUrl = () => this.attributes.url
35
70
 
@@ -76,20 +76,20 @@ class File {
76
76
  return Api.sendRequest(`/files/${encodeURIComponent(firstFileUploadPart.path)}`, 'POST', params, options)
77
77
  }
78
78
 
79
- static _determinePartUploadUri = fileUploadPart => {
80
- return fileUploadPart.upload_uri
81
- }
82
-
83
79
  /**
84
80
  * @note see File.copy() for list of supported params
85
81
  */
86
- static uploadStream = async (destinationPath, readableStream, params, options) => {
82
+ static uploadStream = async (destinationPath, readableStream, params, optionsRaw) => {
83
+ const { determinePartUploadUri: determinePartUploadUriRaw, ...options } = optionsRaw || {}
84
+
87
85
  const firstFileUploadPart = await File._openUpload(destinationPath, params, options)
88
86
 
89
87
  if (!firstFileUploadPart) {
90
88
  return
91
89
  }
92
90
 
91
+ const determinePartUploadUri = determinePartUploadUriRaw || (fileUploadPart => fileUploadPart.upload_uri)
92
+
93
93
  try {
94
94
  const file = await new Promise((resolve, reject) => {
95
95
  let part = 0
@@ -120,7 +120,7 @@ class File {
120
120
  const buffer = Buffer.concat(chunks)
121
121
  const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart, options)
122
122
 
123
- const upload_uri = this._determinePartUploadUri(nextFileUploadPart)
123
+ const upload_uri = determinePartUploadUri(nextFileUploadPart)
124
124
  const uploadPromise = Api.sendFilePart(upload_uri, 'PUT', buffer)
125
125
 
126
126
  if (firstFileUploadPart.parallel_parts) {
@@ -148,7 +148,7 @@ class File {
148
148
  const buffer = Buffer.concat(chunks)
149
149
  const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart, options)
150
150
 
151
- const upload_uri = this._determinePartUploadUri(nextFileUploadPart)
151
+ const upload_uri = determinePartUploadUri(nextFileUploadPart)
152
152
  concurrentUploads.push(Api.sendFilePart(upload_uri, 'PUT', buffer))
153
153
  }
154
154