@itentialopensource/adapter-db_postgresql 0.2.1 → 1.0.1

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,40 @@
1
+
2
+ ## 0.2.1 [11-22-2019]
3
+
4
+ * fix pipeline
5
+
6
+ See merge request itentialopensource/adapters/persistence/adapter-db_postgresql!2
7
+
8
+ ---
9
+
10
+ ## 0.2.0 [11-22-2019]
11
+
12
+ * adding ssl support
13
+
14
+ See merge request itentialopensource/adapters/persistence/adapter-db_postgresql!1
15
+
16
+ ---
17
+
18
+ ## 0.1.3 [11-21-2019]
19
+
20
+ * Bug fixes and performance improvements
21
+
22
+ See commit 8ffc69e
23
+
24
+ ---
25
+
26
+ ## 0.1.2 [11-21-2019]
27
+
28
+ * Bug fixes and performance improvements
29
+
30
+ See commit 4b1b47f
31
+
32
+ ---
33
+
34
+ ## 0.1.1 [11-19-2019]
35
+
36
+ * Bug fixes and performance improvements
37
+
38
+ See commit 77e4b6c
39
+
40
+ ---
@@ -0,0 +1,9 @@
1
+ {
2
+ "ComplianceEntries": [
3
+ {
4
+ "name": "Compliance Summary",
5
+ "numInvalidProjects": 0,
6
+ "numValidProjects": 0
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,5 @@
1
+ ---------------------------------------------------------------------------------------------
2
+ **** Project Compliance Summary ****
3
+ 0 project(s) are not valid
4
+ 0 project(s) are valid
5
+ ---------------------------------------------------------------------------------------------
package/error.json CHANGED
@@ -96,6 +96,12 @@
96
96
  "displayString": "Invalid properties: $VARIABLE$",
97
97
  "recommendation": "Verify the properties for the adapter"
98
98
  },
99
+ {
100
+ "key": "Missing Properties",
101
+ "icode": "AD.306",
102
+ "displayString": "Property $VARIABLE$ is required",
103
+ "recommendation": "Please provide the required property"
104
+ },
99
105
  {
100
106
  "key": "Query Not Translated",
101
107
  "icode": "AD.310",
@@ -168,6 +174,12 @@
168
174
  "displayString": "Failure response received for $VARIABLE$",
169
175
  "recommendation": "Check the reason for failure in the stack trace"
170
176
  },
177
+ {
178
+ "key": "Suspended Adapter",
179
+ "icode": "AD.600",
180
+ "displayString": "Adapter is suspended",
181
+ "recommendation": "Check if external system is functional and unsuspend if appropriate"
182
+ },
171
183
  {
172
184
  "key": "Caught Exception",
173
185
  "icode": "AD.900",
package/metadata.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "adapter-db_postgresql",
3
+ "webName": "Adapter for Integration to PostgreSQL Database",
4
+ "vendor": "PostgreSQL",
5
+ "product": "PostgreSQL",
6
+ "osVersion": [],
7
+ "apiVersions": [],
8
+ "iapVersions": [
9
+ "2021.1.x",
10
+ "2021.2.x",
11
+ "2022.1.x",
12
+ "2023.1.x"
13
+ ],
14
+ "method": "Library",
15
+ "type": "Adapter",
16
+ "domains": [
17
+ "Data Storage"
18
+ ],
19
+ "tags": [
20
+ "Database & Repository Operations"
21
+ ],
22
+ "useCases": [
23
+ "CRUD Operations",
24
+ "Persist Data"
25
+ ],
26
+ "deprecated": {
27
+ "isDeprecated": false
28
+ },
29
+ "brokerSince": "",
30
+ "authMethods": [
31
+ {
32
+ "type": "Database Auth",
33
+ "subtypes": [],
34
+ "primary": true
35
+ }
36
+ ],
37
+ "documentation": {
38
+ "storeLink": "",
39
+ "npmLink": "https://www.npmjs.com/package/@itentialopensource/adapter-db_postgresql",
40
+ "repoLink": "https://gitlab.com/itentialopensource/adapters/adapter-db_postgresql",
41
+ "docLink": "",
42
+ "demoLinks": [],
43
+ "trainingLinks": [
44
+ {
45
+ "title": "Itential Academy",
46
+ "link": "https://www.itential.com/itential-academy/"
47
+ }
48
+ ],
49
+ "faqLink": "https://docs.itential.com/opensource/docs/troubleshooting-an-adapter",
50
+ "contributeLink": "https://gitlab.com/itentialopensource/adapters/contributing-guide",
51
+ "issueLink": "https://itential.atlassian.net/servicedesk/customer/portals",
52
+ "webLink": "https://www.itential.com/adapters/postgresql/",
53
+ "vendorLink": "https://www.postgresql.org/",
54
+ "productLink": "https://www.postgresql.org/",
55
+ "apiLinks": [
56
+ {
57
+ "title": "PostgreSQL SQL Reference",
58
+ "link": "https://www.postgresqltutorial.com/",
59
+ "public": true
60
+ },
61
+ {
62
+ "title": "PostgreSQL Node Library Documentation",
63
+ "link": "https://www.npmjs.com/package/pg",
64
+ "public": true
65
+ }
66
+ ]
67
+ },
68
+ "assets": [],
69
+ "relatedItems": {
70
+ "adapters": [],
71
+ "integrations": [],
72
+ "ecosystemApplications": [],
73
+ "workflowProjects": [],
74
+ "transformationProjects": [],
75
+ "exampleProjects": []
76
+ }
77
+ }
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-db_postgresql",
3
- "version": "0.2.1",
3
+ "version": "1.0.1",
4
4
  "description": "Itential adapter to connect to postgresql",
5
5
  "main": "adapter.js",
6
- "wizardVersion": "2.41.0",
7
- "engineVersion": "1.44.2",
6
+ "wizardVersion": "2.44.7",
7
+ "engineVersion": "1.67.14",
8
+ "adapterType": "http",
8
9
  "scripts": {
9
10
  "artifactize": "npm i && node utils/packModificationScript.js",
10
11
  "preinstall": "node utils/setup.js",
11
- "lint": "eslint . --ext .json --ext .js",
12
+ "deinstall": "node utils/removeHooks.js",
13
+ "lint": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js",
14
+ "lint:errors": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet",
12
15
  "test:unit": "mocha test/unit/adapterTestUnit.js --LOG=error",
13
16
  "test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
14
- "test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
15
17
  "test": "npm run test:unit && npm run test:integration",
16
- "deploy": "npm publish --registry=http://registry.npmjs.org --access=public",
18
+ "deploy": "npm publish --registry=https://registry.npmjs.org --access=public",
17
19
  "build": "npm run deploy"
18
20
  },
19
21
  "keywords": [
@@ -29,32 +31,31 @@
29
31
  ],
30
32
  "license": "Apache-2.0",
31
33
  "engines": {
32
- "node": ">= 0.12.7"
34
+ "node": ">=14.0.0",
35
+ "npm": ">=6.0.0"
33
36
  },
34
37
  "repository": {
35
38
  "type": "git",
36
- "url": "git@gitlab.com:itentialopensource/adapters/persistence/adapter-db_postgresql.git"
39
+ "url": "git@gitlab.com:itentialopensource/adapters/adapter-db_postgresql.git"
37
40
  },
38
41
  "author": "Itential",
39
- "homepage": "https://gitlab.com/itentialopensource/adapters/persistence/adapter-db_postgresql#readme",
42
+ "homepage": "https://gitlab.com/itentialopensource/adapters/adapter-db_postgresql#readme",
40
43
  "dependencies": {
41
- "ajv": "^6.10.0",
42
- "fs-extra": "^7.0.0",
43
- "pg": "^7.12.1",
44
- "package-json-validator": "^0.6.3",
45
- "readline-sync": "^1.4.9",
44
+ "ajv": "^8.12.0",
45
+ "fs-extra": "^11.1.1",
46
+ "pg": "^8.11.3",
47
+ "readline-sync": "^1.4.10",
46
48
  "uuid": "^3.0.1"
47
49
  },
48
50
  "devDependencies": {
49
- "chai": "^4.2.0",
50
- "eslint": "^5.14.1",
51
- "eslint-config-airbnb-base": "^13.1.0",
52
- "eslint-plugin-import": "^2.16.0",
53
- "eslint-plugin-json": "^1.4.0",
54
- "mocha": "^5.2.0",
55
- "nyc": "^14.1.1",
56
- "testdouble": "^3.8.1",
57
- "winston": "^2.4.0"
51
+ "chai": "^4.3.7",
52
+ "eslint": "^8.44.0",
53
+ "eslint-config-airbnb-base": "^15.0.0",
54
+ "eslint-plugin-import": "^2.27.5",
55
+ "eslint-plugin-json": "^3.1.0",
56
+ "mocha": "^10.7.0",
57
+ "testdouble": "^3.18.0",
58
+ "winston": "^3.13.1"
58
59
  },
59
60
  "private": false
60
61
  }
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "type": "encryption",
4
+ "pointer": "/authentication/password"
5
+ },
6
+ {
7
+ "type": "encryption",
8
+ "pointer": "/authentication/token"
9
+ },
10
+ {
11
+ "type": "encryption",
12
+ "pointer": "/mongo/password"
13
+ }
14
+ ]
Binary file
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": "0.2.1",
3
+ "configLines": 468,
4
+ "scriptLines": 516,
5
+ "codeLines": 532,
6
+ "testLines": 964,
7
+ "testCases": 45,
8
+ "totalCodeLines": 2012,
9
+ "wfTasks": 7
10
+ }
@@ -6,12 +6,12 @@
6
6
  "host": "localhost",
7
7
  "port": 5432,
8
8
  "authentication": {
9
- "username": "your username",
10
- "password": "your password"
9
+ "username": "your username",
10
+ "password": "your password"
11
11
  },
12
12
  "ssl": {
13
13
  "enabled": false,
14
- "accept_invalid_cert": true,
14
+ "accept_invalid_cert": false,
15
15
  "ca_file": ""
16
16
  }
17
17
  },
@@ -19,4 +19,4 @@
19
19
  "brokers": [],
20
20
  "logLevel": "none",
21
21
  "timeout": 60000
22
- }
22
+ }
package/test/.eslintrc.js CHANGED
@@ -1,16 +1,16 @@
1
1
  module.exports = {
2
2
  env: {
3
- mocha: true,
3
+ mocha: true
4
4
  },
5
5
  globals: {
6
6
  // Pronghorn globals.
7
- log: true,
7
+ log: true
8
8
  },
9
9
  rules: {
10
10
  // Mocha preference for describe context.
11
11
  'prefer-arrow-callback': 'off',
12
12
  'func-names': 'off',
13
13
  // We want to isolate dependencies.
14
- 'global-require': 'off',
15
- },
14
+ 'global-require': 'off'
15
+ }
16
16
  };
@@ -1,7 +1,7 @@
1
1
  /* @copyright Itential, LLC 2019 (pre-modifications) */
2
2
 
3
3
  // Set globals
4
- /* global describe it log pronghornProps */
4
+ /* global pronghornProps */
5
5
  /* eslint no-unused-vars: warn */
6
6
  /* eslint no-underscore-dangle: warn */
7
7
 
@@ -93,7 +93,7 @@ process.argv.forEach((val) => {
93
93
  });
94
94
 
95
95
  // need to set global logging
96
- global.log = new (winston.Logger)({
96
+ global.log = winston.createLogger({
97
97
  level: logLevel,
98
98
  levels: myCustomLevels.levels,
99
99
  transports: [
@@ -129,7 +129,7 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
129
129
  }
130
130
 
131
131
  // require the adapter that we are going to be using
132
- const PostgreSQL = require('../../adapter.js');
132
+ const PostgreSQL = require('../../adapter');
133
133
 
134
134
  // begin the testing - these should be pretty well defined between the describe and the it!
135
135
  describe('[integration] PostgreSQL Adapter Test', () => {
@@ -183,7 +183,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
183
183
  }
184
184
  });
185
185
 
186
- describe('heatlhCheck should yield', function () {
186
+ describe('heatlhCheck should yield', () => {
187
187
  if (!stub) {
188
188
  it('healthcheck should succeed', (done) => {
189
189
  try {
@@ -216,7 +216,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
216
216
  */
217
217
 
218
218
  const createSQL = 'CREATE TABLE Dogs (DogID int, Name varchar(255));';
219
- describe('#create', function () {
219
+ describe('#create', () => {
220
220
  if (!stub) {
221
221
  it('should create a table', (done) => {
222
222
  try {
@@ -239,7 +239,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
239
239
  });
240
240
 
241
241
  const insertSQL = 'INSERT INTO Dogs (DogID, Name) VALUES (001, \'dog001\');';
242
- describe('#insert', function () {
242
+ describe('#insert', () => {
243
243
  if (!stub) {
244
244
  it('should insert a record', (done) => {
245
245
  try {
@@ -262,7 +262,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
262
262
  });
263
263
 
264
264
  const selectSQL = 'SELECT Name FROM Dogs;';
265
- describe('#select', function () {
265
+ describe('#select', () => {
266
266
  if (!stub) {
267
267
  it('should select a record', (done) => {
268
268
  try {
@@ -285,7 +285,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
285
285
  });
286
286
 
287
287
  const querySQL = 'SELECT Name FROM Dogs;';
288
- describe('#query', function () {
288
+ describe('#query', () => {
289
289
  if (!stub) {
290
290
  it('should query a record', (done) => {
291
291
  try {
@@ -308,7 +308,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
308
308
  });
309
309
 
310
310
  const updateSQL = 'UPDATE Dogs SET Name=\'dogs001\' WHERE DogID=1;';
311
- describe('#update', function () {
311
+ describe('#update', () => {
312
312
  if (!stub) {
313
313
  it('should update a record', (done) => {
314
314
  try {
@@ -331,7 +331,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
331
331
  });
332
332
 
333
333
  const deleteSQL = 'DELETE FROM Dogs WHERE DogID=1;';
334
- describe('#delete', function () {
334
+ describe('#delete', () => {
335
335
  if (!stub) {
336
336
  it('should delete a record', (done) => {
337
337
  try {
@@ -354,7 +354,7 @@ describe('[integration] PostgreSQL Adapter Test', () => {
354
354
  });
355
355
 
356
356
  const dropSQL = 'DROP TABLE Dogs;';
357
- describe('#drop', function () {
357
+ describe('#drop', () => {
358
358
  if (!stub) {
359
359
  it('should drop a record', (done) => {
360
360
  try {
@@ -1,7 +1,7 @@
1
1
  /* @copyright Itential, LLC 2019 (pre-modifications) */
2
2
 
3
3
  // Set globals
4
- /* global describe it log pronghornProps */
4
+ /* global pronghornProps */
5
5
  /* eslint global-require:warn */
6
6
  /* eslint no-unused-vars: warn */
7
7
 
@@ -16,7 +16,9 @@ const execute = require('child_process').execSync;
16
16
  const { expect } = require('chai');
17
17
  const { use } = require('chai');
18
18
  const td = require('testdouble');
19
+ const Ajv = require('ajv');
19
20
 
21
+ const ajv = new Ajv({ strictSchema: false, allErrors: true, allowUnionTypes: true });
20
22
  const anything = td.matchers.anything();
21
23
 
22
24
  // stub and attemptTimeout are used throughout the code so set them here
@@ -97,7 +99,7 @@ process.argv.forEach((val) => {
97
99
  });
98
100
 
99
101
  // need to set global logging
100
- global.log = new (winston.Logger)({
102
+ global.log = winston.createLogger({
101
103
  level: logLevel,
102
104
  levels: myCustomLevels.levels,
103
105
  transports: [
@@ -121,9 +123,8 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
121
123
  assert.equal(displayStr, error.IAPerror.displayString);
122
124
  }
123
125
 
124
-
125
126
  // require the adapter that we are going to be using
126
- const PostgreSQL = require('../../adapter.js');
127
+ const PostgreSQL = require('../../adapter');
127
128
 
128
129
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
129
130
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
@@ -187,23 +188,33 @@ describe('[unit] PostgreSQL Adapter Test', () => {
187
188
  });
188
189
  });
189
190
  it('package.json should be validated', (done) => {
190
- const packageDotJson = require('../../package.json');
191
- const { PJV } = require('package-json-validator');
192
- const options = {
193
- warnings: true, // show warnings
194
- recommendations: true // show recommendations
195
- };
196
- const results = PJV.validate(JSON.stringify(packageDotJson), 'npm', options);
197
-
198
- if (results.valid === false) {
199
- log.error('The package.json contains the following errors: ');
200
- log.error(util.inspect(results));
201
- assert.equal(true, results.valid);
202
- } else {
203
- assert.equal(true, results.valid);
204
- }
191
+ try {
192
+ const packageDotJson = require('../../package.json');
193
+ // Define the JSON schema for package.json
194
+ const packageJsonSchema = {
195
+ type: 'object',
196
+ properties: {
197
+ name: { type: 'string' },
198
+ version: { type: 'string' }
199
+ // May need to add more properties as needed
200
+ },
201
+ required: ['name', 'version']
202
+ };
203
+ const validate = ajv.compile(packageJsonSchema);
204
+ const isValid = validate(packageDotJson);
205
+
206
+ if (isValid === false) {
207
+ log.error('The package.json contains errors');
208
+ assert.equal(true, isValid);
209
+ } else {
210
+ assert.equal(true, isValid);
211
+ }
205
212
 
206
- done();
213
+ done();
214
+ } catch (error) {
215
+ log.error(`Test Failure: ${error}`);
216
+ done(error);
217
+ }
207
218
  });
208
219
  it('package.json should be customized', (done) => {
209
220
  const packageDotJson = require('../../package.json');