@toxplanet/pegasus-sdk 1.0.1 → 1.1.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.
@@ -0,0 +1,27 @@
1
+ module.exports = {
2
+ environment: 'acc',
3
+ region: 'us-east-1',
4
+ secretName: 'arn:aws:secretsmanager:us-east-1:292931567094:secret:rds!cluster-b851c3ce-58cc-41cd-aeae-05cc7f5e031a-ZYSjiI',
5
+ openSearchEndpoint: 'https://war8lk73nzswquk8dcz1.us-east-1.aoss.amazonaws.com',
6
+ openSearchIndex: 'chemicals',
7
+ database: {
8
+ host: 'cr-chemicals.cluster-cz0iqdg8irhb.us-east-1.rds.amazonaws.com',
9
+ name: 'chemicals'
10
+ },
11
+ postgres: {
12
+ maxConnections: 2,
13
+ minConnections: 0,
14
+ idleTimeoutMillis: 30000,
15
+ connectionTimeoutMillis: 5000,
16
+ statementTimeout: 30000,
17
+ queryTimeout: 30000,
18
+ ssl: {
19
+ rejectUnauthorized: false
20
+ }
21
+ },
22
+ indexRoutes: {
23
+ chemicals: ['chemicals*'],
24
+ documents: ['documents*'],
25
+ search: [/^(chemicals|substances|search)/]
26
+ }
27
+ };
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- environment: 'development',
2
+ environment: 'dev',
3
3
  region: 'us-east-1',
4
4
  secretName: 'arn:aws:secretsmanager:us-east-1:292931567094:secret:rds!cluster-b851c3ce-58cc-41cd-aeae-05cc7f5e031a-ZYSjiI',
5
5
  openSearchEndpoint: 'https://war8lk73nzswquk8dcz1.us-east-1.aoss.amazonaws.com',
@@ -18,5 +18,10 @@ module.exports = {
18
18
  ssl: {
19
19
  rejectUnauthorized: false
20
20
  }
21
+ },
22
+ indexRoutes: {
23
+ chemicals: ['chemicals*'],
24
+ documents: ['documents*'],
25
+ search: [/^(chemicals|substances|search)/]
21
26
  }
22
27
  };
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- environment: 'production',
2
+ environment: 'prod',
3
3
  region: 'us-east-1',
4
4
  secretName: 'pegasus/production/database',
5
5
  openSearchEndpoint: null,
@@ -18,5 +18,10 @@ module.exports = {
18
18
  ssl: {
19
19
  rejectUnauthorized: true
20
20
  }
21
+ },
22
+ indexRoutes: {
23
+ chemicals: ['chemicals*'],
24
+ documents: ['documents*'],
25
+ search: [/^(chemicals|substances|search)/]
21
26
  }
22
27
  };
@@ -18,5 +18,10 @@ module.exports = {
18
18
  ssl: {
19
19
  rejectUnauthorized: true
20
20
  }
21
+ },
22
+ indexRoutes: {
23
+ chemicals: ['chemicals*'],
24
+ documents: ['documents*'],
25
+ search: [/^(chemicals|substances|search)/]
21
26
  }
22
27
  };
package/config/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const { logInfo } = require('@toxplanet/tphelper/logging');
2
2
 
3
3
  function loadConfig(envOverride = null) {
4
- const env = envOverride || process.env.NODE_ENV || 'development';
4
+ const env = envOverride || process.env.NODE_ENV || 'dev';
5
5
 
6
6
  let envConfig;
7
7
  try {
package/index.js CHANGED
@@ -1,37 +1,44 @@
1
- const PegasusConnection = require('./lib/connection');
2
- const ChemicalsService = require('./lib/chemicals');
3
- const DocumentsService = require('./lib/documents');
4
- const SearchService = require('./lib/search');
5
- const SyncService = require('./lib/sync');
6
- const UtilsService = require('./lib/utils');
7
-
8
- class PegasusSDK {
9
- constructor(config) {
10
- this.connection = new PegasusConnection(config);
11
- this.chemicals = new ChemicalsService(this.connection);
12
- this.documents = new DocumentsService(this.connection);
13
- this.search = new SearchService(this.connection);
14
- this.sync = new SyncService(this.connection);
15
- this.utils = new UtilsService(this.connection);
16
- }
17
-
18
- async connect() {
19
- return this.connection.connect();
20
- }
21
-
22
- async disconnect() {
23
- return this.connection.disconnect();
24
- }
25
-
26
- async healthCheck() {
27
- return this.connection.testConnection();
28
- }
29
- }
30
-
31
- module.exports = PegasusSDK;
32
- module.exports.PegasusConnection = PegasusConnection;
33
- module.exports.ChemicalsService = ChemicalsService;
34
- module.exports.DocumentsService = DocumentsService;
35
- module.exports.SearchService = SearchService;
36
- module.exports.SyncService = SyncService;
37
- module.exports.UtilsService = UtilsService;
1
+ const PegasusConnection = require('./lib/connection');
2
+ const ChemicalsService = require('./lib/chemicals');
3
+ const DocumentsService = require('./lib/documents');
4
+ const SearchService = require('./lib/search');
5
+ const SyncService = require('./lib/sync');
6
+ const UtilsService = require('./lib/utils');
7
+ const ElasticsearchService = require('./lib/elasticsearch');
8
+
9
+ class PegasusSDK {
10
+ constructor(config) {
11
+ this.connection = new PegasusConnection(config);
12
+ this.elasticsearch = new ElasticsearchService(this.connection);
13
+ this.chemicals = new ChemicalsService(this.connection);
14
+ this.documents = new DocumentsService(this.connection);
15
+ this.search = new SearchService(this.connection);
16
+ this.sync = new SyncService(this.connection);
17
+ this.utils = new UtilsService(this.connection);
18
+
19
+ this.chemicals.registerElasticsearchHandlers(this.elasticsearch);
20
+ this.documents.registerElasticsearchHandlers(this.elasticsearch);
21
+ this.search.registerElasticsearchHandlers(this.elasticsearch);
22
+ }
23
+
24
+ async connect() {
25
+ return this.connection.connect();
26
+ }
27
+
28
+ async disconnect() {
29
+ return this.connection.disconnect();
30
+ }
31
+
32
+ async healthCheck() {
33
+ return this.connection.testConnection();
34
+ }
35
+ }
36
+
37
+ module.exports = PegasusSDK;
38
+ module.exports.PegasusConnection = PegasusConnection;
39
+ module.exports.ChemicalsService = ChemicalsService;
40
+ module.exports.DocumentsService = DocumentsService;
41
+ module.exports.SearchService = SearchService;
42
+ module.exports.SyncService = SyncService;
43
+ module.exports.UtilsService = UtilsService;
44
+ module.exports.ElasticsearchService = ElasticsearchService;