@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.
- package/config/environment.acc.js +27 -0
- package/config/environment.dev.js +6 -1
- package/config/environment.prod.js +6 -1
- package/config/environment.qa.js +5 -0
- package/config/index.js +1 -1
- package/index.js +44 -37
- package/lib/chemicals.js +293 -229
- package/lib/connection.js +223 -223
- package/lib/documents.js +94 -47
- package/lib/elasticsearch.js +404 -0
- package/lib/search.js +336 -307
- package/lib/sync.js +43 -41
- package/lib/utils.js +49 -47
- package/package.json +48 -25
- package/env.example +0 -21
- package/index.d.ts +0 -252
- package/tests/chemicals.js +0 -165
- package/tests/search.js +0 -138
|
@@ -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: '
|
|
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: '
|
|
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
|
};
|
package/config/environment.qa.js
CHANGED
package/config/index.js
CHANGED
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
module.exports
|
|
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;
|