@sprucelabs/spruce-file-utils 6.0.208 → 7.0.0

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.
@@ -20,7 +20,10 @@ export default class FileUploaderImpl {
20
20
  }
21
21
  upload(payload) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
- const { base64Body, name } = assertOptions(payload, ['base64Body', 'name']);
23
+ const { base64Body, name } = assertOptions(payload, [
24
+ 'base64Body',
25
+ 'name',
26
+ ]);
24
27
  const { type, ext, buffer } = yield this.findTypeAndBuffer(base64Body, name);
25
28
  const uniqueName = `${uuid.v4()}.${ext}`;
26
29
  const { Location: uri } = yield this.uploadFileToS3(uniqueName, buffer, type);
@@ -32,13 +32,16 @@ const file_type_1 = __importDefault(require("file-type"));
32
32
  const mime_types_1 = __importDefault(require("mime-types"));
33
33
  const uuid = __importStar(require("uuid"));
34
34
  class FileUploaderImpl {
35
+ static Class;
35
36
  constructor() { }
36
37
  static Uploader() {
37
- var _a;
38
- return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)();
38
+ return new (this.Class ?? this)();
39
39
  }
40
40
  async upload(payload) {
41
- const { base64Body, name } = (0, schema_1.assertOptions)(payload, ['base64Body', 'name']);
41
+ const { base64Body, name } = (0, schema_1.assertOptions)(payload, [
42
+ 'base64Body',
43
+ 'name',
44
+ ]);
42
45
  const { type, ext, buffer } = await this.findTypeAndBuffer(base64Body, name);
43
46
  const uniqueName = `${uuid.v4()}.${ext}`;
44
47
  const { Location: uri } = await this.uploadFileToS3(uniqueName, buffer, type);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-file-utils",
3
3
  "description": "Utils for working with files and Sprucebot.",
4
- "version": "6.0.208",
4
+ "version": "7.0.0",
5
5
  "skill": {
6
6
  "namespace": "files"
7
7
  },