sealights-plugins-common 2.0.102 → 2.0.112

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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "sealights-plugins-common",
3
- "version": "2.0.102",
3
+ "version": "2.0.112",
4
4
  "description": "> TODO: description",
5
5
  "author": "Roni Segal <roni@sealights.io>",
6
- "homepage": "https://github.com/RoniSegal/SL.OnPremis.Plugins.JavaScript#readme",
6
+ "homepage": "https://github.com/Sealights/SL.OnPremis.Plugins.JavaScript#readme",
7
7
  "license": "ISC",
8
8
  "main": "tsOutputs/lib/index.js",
9
9
  "directories": {
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/RoniSegal/SL.OnPremis.Plugins.JavaScript.git"
18
+ "url": "git+https://github.com/Sealights/SL.OnPremis.Plugins.JavaScript.git"
19
19
  },
20
20
  "scripts": {
21
21
  "prebuild": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version) + ';'\" > lib/version.ts",
@@ -23,7 +23,7 @@
23
23
  "test": "mocha ./tsOutputs/test"
24
24
  },
25
25
  "bugs": {
26
- "url": "https://github.com/RoniSegal/SL.OnPremis.Plugins.JavaScript/issues"
26
+ "url": "https://github.com/Sealights/SL.OnPremis.Plugins.JavaScript/issues"
27
27
  },
28
28
  "dependencies": {
29
29
  "minimist": "^1.2.5",
@@ -33,5 +33,5 @@
33
33
  "mocha": "^9.1.3",
34
34
  "typescript": "^4.4.4"
35
35
  },
36
- "gitHead": "3cc7677ddec4e42f45f7461e8c3b776627ed14b0"
36
+ "gitHead": "d4c0a7d90bfd8468636ec5cc4ca3b12b1166f36d"
37
37
  }
@@ -4,6 +4,8 @@ export declare abstract class BaseSlConfigProvider<T extends ITestRunnerArgs> im
4
4
  protected config: Record<string, unknown>;
5
5
  constructor(config?: T);
6
6
  abstract init(): Promise<void>;
7
+ protected applyDefaultValues(): void;
8
+ protected getDefaultValueForKey(key: string): unknown;
7
9
  getConfig(): T;
8
10
  getValue<K extends keyof T>(key: K): T[K];
9
11
  }
@@ -5,15 +5,40 @@ class BaseSlConfigProvider {
5
5
  constructor(config = {}) {
6
6
  this.config = {};
7
7
  const keys = Object.keys(config);
8
- keys.forEach(key => {
8
+ keys.forEach((key) => {
9
9
  this.config[key.toLowerCase()] = config[key];
10
10
  });
11
+ this.applyDefaultValues();
12
+ }
13
+ applyDefaultValues() {
14
+ if (!this.config['tokenfile'] && !this.config['token']) {
15
+ this.config['tokenfile'] = 'sltoken.txt';
16
+ }
17
+ if (!this.config['buildsessionidfile'] && !this.config['buildsessionid']) {
18
+ this.config['buildsessionidfile'] = 'buildSessionId';
19
+ }
20
+ }
21
+ getDefaultValueForKey(key) {
22
+ const lowerKey = key.toLowerCase();
23
+ if (lowerKey === 'tokenfile' &&
24
+ !this.config['tokenfile'] &&
25
+ !this.config['token']) {
26
+ return 'sltoken.txt';
27
+ }
28
+ if (lowerKey === 'buildsessionidfile' &&
29
+ !this.config['buildsessionidfile'] &&
30
+ !this.config['buildsessionid']) {
31
+ return 'buildSessionId';
32
+ }
33
+ return undefined;
11
34
  }
12
35
  getConfig() {
13
36
  return this.config;
14
37
  }
15
38
  getValue(key) {
16
- return this.config[key.toString().toLowerCase()];
39
+ const lowerKey = key.toString().toLowerCase();
40
+ const defaultValue = this.getDefaultValueForKey(lowerKey);
41
+ return (this.config[lowerKey] || defaultValue);
17
42
  }
18
43
  }
19
44
  exports.BaseSlConfigProvider = BaseSlConfigProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"base-config-provider.js","sourceRoot":"","sources":["../../../lib/config/base-config-provider.ts"],"names":[],"mappings":";;;AAGA,MAAsB,oBAAoB;IAGtC,YAAY,SAAS,EAAO;QAFlB,WAAM,GAA4B,EAAE,CAAA;QAG1C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,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B,CAAC,GAAW;QACzC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAEnC,IACE,QAAQ,KAAK,WAAW;YACxB,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;YACzB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EACrB;YACA,OAAO,aAAa,CAAC;SACtB;QAED,IACE,QAAQ,KAAK,oBAAoB;YACjC,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YAClC,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAC9B;YACA,OAAO,gBAAgB,CAAC;SACzB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAW,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAoB,GAAM;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAE1D,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,YAAY,CAAS,CAAC;IACzD,CAAC;CACF;AA/DD,oDA+DC"}
@@ -1 +1 @@
1
- export declare const version = "2.0.102";
1
+ export declare const version = "2.0.112";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = "2.0.102";
4
+ exports.version = "2.0.112";
5
5
  //# sourceMappingURL=version.js.map