@sprucelabs/spruce-file-utils 9.2.1 → 9.2.2

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.
@@ -4,7 +4,7 @@ export default class FileUploaderImpl implements FileUploader {
4
4
  static Class?: new (options: FileUploaderConstructorOptions) => FileUploader;
5
5
  private localUploadDir?;
6
6
  private uploadStrategy;
7
- private settings;
7
+ private settings?;
8
8
  protected constructor(options: FileUploaderConstructorOptions);
9
9
  static Uploader(settings: SettingsStore): FileUploader;
10
10
  upload(payload: UploadPayload): Promise<{
@@ -36,6 +36,6 @@ export interface UploadStrategy {
36
36
  }
37
37
  interface FileUploaderConstructorOptions {
38
38
  localUploadDir?: string;
39
- settings: SettingsStore;
39
+ settings?: SettingsStore;
40
40
  }
41
41
  export {};
@@ -31,13 +31,14 @@ export default class FileUploaderImpl {
31
31
  }
32
32
  upload(payload) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
+ var _a;
34
35
  const { base64Body, name, organizationId } = assertOptions(payload, [
35
36
  'base64Body',
36
37
  'name',
37
38
  ]);
38
- const settings = yield this.settings.findOne({
39
+ const settings = yield ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.findOne({
39
40
  'target.organizationId': organizationId,
40
- });
41
+ }));
41
42
  const { type, ext, buffer } = yield this.findTypeAndBuffer(base64Body, name);
42
43
  const uniqueName = `${uuid.v4()}.${ext}`;
43
44
  const uri = yield this.uploadStrategy.upload({
@@ -4,7 +4,7 @@ export default class FileUploaderImpl implements FileUploader {
4
4
  static Class?: new (options: FileUploaderConstructorOptions) => FileUploader;
5
5
  private localUploadDir?;
6
6
  private uploadStrategy;
7
- private settings;
7
+ private settings?;
8
8
  protected constructor(options: FileUploaderConstructorOptions);
9
9
  static Uploader(settings: SettingsStore): FileUploader;
10
10
  upload(payload: UploadPayload): Promise<{
@@ -36,6 +36,6 @@ export interface UploadStrategy {
36
36
  }
37
37
  interface FileUploaderConstructorOptions {
38
38
  localUploadDir?: string;
39
- settings: SettingsStore;
39
+ settings?: SettingsStore;
40
40
  }
41
41
  export {};
@@ -62,7 +62,7 @@ class FileUploaderImpl {
62
62
  'base64Body',
63
63
  'name',
64
64
  ]);
65
- const settings = await this.settings.findOne({
65
+ const settings = await this.settings?.findOne({
66
66
  'target.organizationId': organizationId,
67
67
  });
68
68
  const { type, ext, buffer } = await this.findTypeAndBuffer(base64Body, name);
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": "9.2.1",
4
+ "version": "9.2.2",
5
5
  "skill": {
6
6
  "namespace": "files"
7
7
  },