@meru2802/aux-server 1.0.6 → 1.0.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"apiController.d.ts","sourceRoot":"","sources":["../../src/controllers/apiController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKjE,qBAAa,aAAc,SAAQ,cAAc;gBACnC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,YAAY,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAyEtE;IAEK,cAAc,GACnB,KAAK,OAAO,EACZ,KAAK,QAAQ,KACZ,OAAO,CAAC,IAAI,CAAC,CAiEd;CACH"}
1
+ {"version":3,"file":"apiController.d.ts","sourceRoot":"","sources":["../../src/controllers/apiController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKjE,qBAAa,aAAc,SAAQ,cAAc;gBACnC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,YAAY,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CA2EtE;IAEK,cAAc,GACnB,KAAK,OAAO,EACZ,KAAK,QAAQ,KACZ,OAAO,CAAC,IAAI,CAAC,CAiEd;CACH"}
@@ -45,15 +45,18 @@ class ApiController extends BaseController_1.BaseController {
45
45
  },
46
46
  validateStatus: () => true,
47
47
  });
48
- const getKeyResult = await axios_1.default.get(`https://${this.config.epmConfig.server}/accounts/apikeys/`, {
49
- headers: {
50
- "X-API-KEY": this.config.epmConfig.masterApiKey,
51
- },
52
- });
53
- const apiKeyData = getKeyResult.data;
54
- const key = (_b = apiKeyData.find((key) => key.user == userEpmId)) === null || _b === void 0 ? void 0 : _b.key;
48
+ const nexus_epm_api_key_query = "select key from accounts_apikey where name= $1";
49
+ const nexus_epm_api_key = await this.dbPool.query(nexus_epm_api_key_query, [keyName]);
50
+ if (nexus_epm_api_key.rows.length === 0) {
51
+ const errorResponse = {
52
+ error: `Api key with name '${keyName}' Not Found`,
53
+ timestamp: new Date().toISOString(),
54
+ };
55
+ res.status(400).json(errorResponse);
56
+ return;
57
+ }
55
58
  res.status(200).json({
56
- epmKey: key,
59
+ epmKey: (_b = nexus_epm_api_key.rows[0]) === null || _b === void 0 ? void 0 : _b.key,
57
60
  expiration: expiration.toUTCString(),
58
61
  });
59
62
  }
@@ -17,7 +17,7 @@ class HealthController extends BaseController_1.BaseController {
17
17
  this.status = (req, res) => {
18
18
  const response = {
19
19
  service: "aux-server",
20
- version: "1.0.6",
20
+ version: "1.0.7",
21
21
  meshCentral: {
22
22
  connected: this.isWebSocketConnected,
23
23
  server: this.meshServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meru2802/aux-server",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Nexus EPM auxillary server to facilitate additional functionality required by Scogo Iceberg",
5
5
  "main": "index.js",
6
6
  "files": [