@golemio/core 1.2.21-dev.663817604 → 1.2.21-dev.669576538

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.
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import { ILogger } from "../../Logger";
3
+ import { AbstractStorageService } from "./AbstractStorageService";
4
+ export declare class NoopStorageService extends AbstractStorageService {
5
+ private readonly log;
6
+ constructor(log: ILogger);
7
+ uploadFile(data: Buffer | string, pathPrefix: string, ext: string, fileName?: string): Promise<void>;
8
+ deleteFile(fileKey: string): Promise<void>;
9
+ getFileStream(fileKey: string): Promise<undefined>;
10
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.NoopStorageService = void 0;
13
+ const AbstractStorageService_1 = require("./AbstractStorageService");
14
+ class NoopStorageService extends AbstractStorageService_1.AbstractStorageService {
15
+ constructor(log) {
16
+ super();
17
+ this.log = log;
18
+ }
19
+ uploadFile(data, pathPrefix, ext, fileName) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ this.log.silly("[NoopStorageService] Storage is disabled. Skipping file upload.");
22
+ });
23
+ }
24
+ deleteFile(fileKey) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ this.log.silly("[NoopStorageService] Storage is disabled. Skipping file deletion.");
27
+ });
28
+ }
29
+ getFileStream(fileKey) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ this.log.silly("[NoopStorageService] Storage is disabled. Skipping file fetching.");
32
+ return;
33
+ });
34
+ }
35
+ }
36
+ exports.NoopStorageService = NoopStorageService;
37
+ //# sourceMappingURL=NoopStorageService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopStorageService.js","sourceRoot":"","sources":["../../../../src/helpers/data-access/storage/NoopStorageService.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qEAAkE;AAElE,MAAa,kBAAmB,SAAQ,+CAAsB;IAC1D,YAA6B,GAAY;QACrC,KAAK,EAAE,CAAC;QADiB,QAAG,GAAH,GAAG,CAAS;IAEzC,CAAC;IAEY,UAAU,CAAC,IAAqB,EAAE,UAAkB,EAAE,GAAW,EAAE,QAAiB;;YAC7F,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;QACtF,CAAC;KAAA;IAEY,UAAU,CAAC,OAAe;;YACnC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;QACxF,CAAC;KAAA;IAEY,aAAa,CAAC,OAAe;;YACtC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;YACpF,OAAO;QACX,CAAC;KAAA;CACJ;AAjBD,gDAiBC"}
@@ -8,9 +8,11 @@ export interface IStorageConfig {
8
8
  };
9
9
  }
10
10
  export declare enum StorageProvider {
11
- Azure = 0
11
+ Noop = 0,
12
+ Azure = 1
12
13
  }
13
14
  export declare class StorageServiceFactory {
15
+ private config;
14
16
  private dictionary;
15
17
  constructor(config: IStorageConfig, log: ILogger);
16
18
  getService(storageProvider: StorageProvider): AbstractStorageService | undefined;
@@ -2,22 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StorageServiceFactory = exports.StorageProvider = void 0;
4
4
  const AzureBlobStorageService_1 = require("./AzureBlobStorageService");
5
+ const NoopStorageService_1 = require("./NoopStorageService");
5
6
  var StorageProvider;
6
7
  (function (StorageProvider) {
7
- StorageProvider[StorageProvider["Azure"] = 0] = "Azure";
8
+ StorageProvider[StorageProvider["Noop"] = 0] = "Noop";
9
+ StorageProvider[StorageProvider["Azure"] = 1] = "Azure";
8
10
  })(StorageProvider = exports.StorageProvider || (exports.StorageProvider = {}));
9
11
  class StorageServiceFactory {
10
12
  constructor(config, log) {
13
+ this.config = config;
11
14
  this.dictionary = new Map();
12
15
  if (config.enabled) {
13
16
  this.dictionary.set(StorageProvider.Azure, new AzureBlobStorageService_1.AzureBlobStorageService(config.provider.azure, log));
14
17
  }
15
18
  else {
16
- log.silly("[StorageServiceFactory] Storage is disabled. Skipping");
19
+ log.silly("[StorageServiceFactory] Storage is disabled.");
20
+ this.dictionary.set(StorageProvider.Noop, new NoopStorageService_1.NoopStorageService(log));
17
21
  }
18
22
  }
19
23
  getService(storageProvider) {
20
- return this.dictionary.get(storageProvider);
24
+ if (this.config.enabled) {
25
+ return this.dictionary.get(storageProvider);
26
+ }
27
+ else {
28
+ return this.dictionary.get(StorageProvider.Noop);
29
+ }
21
30
  }
22
31
  }
23
32
  exports.StorageServiceFactory = StorageServiceFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"StorageServiceFactory.js","sourceRoot":"","sources":["../../../../src/helpers/data-access/storage/StorageServiceFactory.ts"],"names":[],"mappings":";;;AAEA,uEAA6F;AAS7F,IAAY,eAEX;AAFD,WAAY,eAAe;IACvB,uDAAK,CAAA;AACT,CAAC,EAFW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAE1B;AAED,MAAa,qBAAqB;IAG9B,YAAY,MAAsB,EAAE,GAAY;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;QAE5B,IAAI,MAAM,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,iDAAuB,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;SACvG;aAAM;YACH,GAAG,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;SACtE;IACL,CAAC;IAEM,UAAU,CAAC,eAAgC;QAC9C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;CACJ;AAhBD,sDAgBC"}
1
+ {"version":3,"file":"StorageServiceFactory.js","sourceRoot":"","sources":["../../../../src/helpers/data-access/storage/StorageServiceFactory.ts"],"names":[],"mappings":";;;AAEA,uEAA6F;AAC7F,6DAAqF;AASrF,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,qDAAI,CAAA;IACJ,uDAAK,CAAA;AACT,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAED,MAAa,qBAAqB;IAG9B,YAAoB,MAAsB,EAAE,GAAY;QAApC,WAAM,GAAN,MAAM,CAAgB;QACtC,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;QAE5B,IAAI,MAAM,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,iDAAuB,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;SACvG;aAAM;YACH,GAAG,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;YAC1D,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,uCAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;SAC1E;IACL,CAAC;IAEM,UAAU,CAAC,eAAgC;QAC9C,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACrB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;SAC/C;aAAM;YACH,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACpD;IACL,CAAC;CACJ;AArBD,sDAqBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/core",
3
- "version": "1.2.21-dev.663817604",
3
+ "version": "1.2.21-dev.669576538",
4
4
  "description": "Golemio Core Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",