@itentialopensource/adapter-db_mysql 0.1.16 → 0.2.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.
- package/.eslintignore +1 -0
- package/AUTH.md +25 -0
- package/CALLS.md +40 -0
- package/CHANGELOG.md +16 -0
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +3 -148
- package/ENHANCE.md +28 -0
- package/PROPERTIES.md +111 -0
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +22 -0
- package/TAB1.md +11 -0
- package/TAB2.md +73 -0
- package/TROUBLESHOOT.md +28 -0
- package/changelogs/changelog.md +104 -0
- package/compliance-report.json +9 -0
- package/compliance-report.txt +5 -0
- package/error.json +12 -0
- package/metadata.json +90 -0
- package/package.json +22 -25
- package/propertiesDecorators.json +14 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +10 -0
- package/sampleProperties.json +1 -3
- package/test/unit/adapterTestUnit.js +28 -16
- package/utils/adapterInfo.js +206 -0
- package/utils/artifactize.js +1 -1
- package/utils/packModificationScript.js +1 -1
- package/utils/removeHooks.js +20 -0
- package/utils/testRunner.js +17 -17
- package/workflows/README.md +0 -3
- package/workflows/mysql-test1.json +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
|
|
2
|
+
## 0.1.16 [06-30-2023]
|
|
3
|
+
|
|
4
|
+
* Remove sensitive data logging
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!11
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 0.1.15 [08-03-2022]
|
|
11
|
+
|
|
12
|
+
* Patch/adapt 2277
|
|
13
|
+
|
|
14
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!9
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 0.1.14 [08-01-2022]
|
|
19
|
+
|
|
20
|
+
* Patch/adapt 2277
|
|
21
|
+
|
|
22
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!8
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 0.1.13 [08-01-2022]
|
|
27
|
+
|
|
28
|
+
* Changed connection handling. Added healthcheck.
|
|
29
|
+
|
|
30
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!7
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 0.1.12 [08-10-2021]
|
|
35
|
+
|
|
36
|
+
* change the connection and base wait
|
|
37
|
+
|
|
38
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!6
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 0.1.11 [08-10-2021]
|
|
43
|
+
|
|
44
|
+
* add delays in the connect retries
|
|
45
|
+
|
|
46
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!5
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 0.1.10 [08-06-2021]
|
|
51
|
+
|
|
52
|
+
* include Raj changes for connection recovery as well as other stuff
|
|
53
|
+
|
|
54
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!4
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 0.1.9 [11-26-2019]
|
|
59
|
+
|
|
60
|
+
* Patch/add ssl
|
|
61
|
+
|
|
62
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!3
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 0.1.8 [11-26-2019]
|
|
67
|
+
|
|
68
|
+
* Patch/add ssl
|
|
69
|
+
|
|
70
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!3
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 0.1.7 [11-25-2019]
|
|
75
|
+
|
|
76
|
+
* improve README.
|
|
77
|
+
|
|
78
|
+
See merge request itentialopensource/adapters/persistence/adapter-db_mysql!1
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 0.1.6 [11-21-2019]
|
|
83
|
+
|
|
84
|
+
* Bug fixes and performance improvements
|
|
85
|
+
|
|
86
|
+
See commit 469d9ab
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 0.1.5 [11-21-2019]
|
|
91
|
+
|
|
92
|
+
* Bug fixes and performance improvements
|
|
93
|
+
|
|
94
|
+
See commit 6b15e9a
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 0.1.4 [11-21-2019]
|
|
99
|
+
|
|
100
|
+
* Bug fixes and performance improvements
|
|
101
|
+
|
|
102
|
+
See commit a6d2f9a
|
|
103
|
+
|
|
104
|
+
---
|
|
@@ -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,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "adapter-db_mysql",
|
|
3
|
+
"webName": "Adapter for Integration to Oracle MySQL Database",
|
|
4
|
+
"vendor": "Oracle",
|
|
5
|
+
"product": "MySQL",
|
|
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_mysql",
|
|
40
|
+
"repoLink": "https://gitlab.com/itentialopensource/adapters/adapter-db_mysql",
|
|
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/mysql/",
|
|
53
|
+
"vendorLink": "https://www.oracle.com/",
|
|
54
|
+
"productLink": "https://www.mysql.com/",
|
|
55
|
+
"apiLinks": [
|
|
56
|
+
{
|
|
57
|
+
"title": "MySQL SQL Reference",
|
|
58
|
+
"link": "https://dev.mysql.com/doc/refman/8.4/en/sql-statements.html",
|
|
59
|
+
"public": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"title": "MySQL Node Library Documentation",
|
|
63
|
+
"link": "https://www.npmjs.com/package/mysql",
|
|
64
|
+
"public": true
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"assets": [],
|
|
69
|
+
"relatedItems": {
|
|
70
|
+
"adapters": [],
|
|
71
|
+
"integrations": [],
|
|
72
|
+
"ecosystemApplications": [],
|
|
73
|
+
"workflowProjects": [
|
|
74
|
+
{
|
|
75
|
+
"name": "Mysql Adapter Test",
|
|
76
|
+
"webName": "Mysql Adapter Test",
|
|
77
|
+
"overview": "This Pre-Built is used to test the MySQL adapter. This pre-built contains a workflow that uses the MySQL adapter in IAP to perform CRUD operations on the MySQL server (i.e. creating, inserting, updating, selecting, deleting, and dropping tables).",
|
|
78
|
+
"isDependency": false,
|
|
79
|
+
"versions": [
|
|
80
|
+
"0.0.6"
|
|
81
|
+
],
|
|
82
|
+
"repoLink": "https://gitlab.com/itentialopensource/pre-built-automations/mysql-adapter-test",
|
|
83
|
+
"docLink": "<TBD>",
|
|
84
|
+
"webLink": "https://www.itential.com/automations/mysql-adapter-test/"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"transformationProjects": [],
|
|
88
|
+
"exampleProjects": []
|
|
89
|
+
}
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-db_mysql",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Itential adapter to connect to mysql",
|
|
5
5
|
"main": "adapter.js",
|
|
6
|
-
"wizardVersion": "2.
|
|
7
|
-
"engineVersion": "1.
|
|
6
|
+
"wizardVersion": "2.44.7",
|
|
7
|
+
"engineVersion": "1.67.14",
|
|
8
|
+
"adapterType": "Library",
|
|
8
9
|
"scripts": {
|
|
9
10
|
"artifactize": "npm i && node utils/packModificationScript.js",
|
|
10
|
-
"preinstall": "node utils/setup.js
|
|
11
|
-
"
|
|
11
|
+
"preinstall": "node utils/setup.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",
|
|
12
14
|
"lint:errors": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet",
|
|
13
15
|
"test:unit": "mocha test/unit/adapterTestUnit.js --LOG=error",
|
|
14
16
|
"test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
|
|
15
|
-
"test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
|
|
16
17
|
"test": "npm run test:unit && npm run test:integration",
|
|
17
18
|
"deploy": "npm publish --registry=https://registry.npmjs.org --access=public",
|
|
18
19
|
"build": "npm run deploy"
|
|
@@ -30,35 +31,31 @@
|
|
|
30
31
|
],
|
|
31
32
|
"license": "Apache-2.0",
|
|
32
33
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
34
|
+
"node": ">=14.0.0",
|
|
35
|
+
"npm": ">=6.0.0"
|
|
34
36
|
},
|
|
35
37
|
"repository": {
|
|
36
38
|
"type": "git",
|
|
37
|
-
"url": "git@gitlab.com:itentialopensource/adapters/
|
|
39
|
+
"url": "git@gitlab.com:itentialopensource/adapters/adapter-db_mysql.git"
|
|
38
40
|
},
|
|
39
41
|
"author": "Itential",
|
|
40
|
-
"homepage": "https://gitlab.com/itentialopensource/adapters/
|
|
42
|
+
"homepage": "https://gitlab.com/itentialopensource/adapters/adapter-db_mysql#readme",
|
|
41
43
|
"dependencies": {
|
|
42
|
-
"ajv": "^
|
|
43
|
-
"fs-extra": "^
|
|
44
|
+
"ajv": "^8.12.0",
|
|
45
|
+
"fs-extra": "^11.1.1",
|
|
44
46
|
"mysql": "^2.17.1",
|
|
45
47
|
"readline-sync": "^1.4.10",
|
|
46
48
|
"uuid": "^3.0.1"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"chai": "^4.3.
|
|
50
|
-
"eslint": "^
|
|
51
|
-
"eslint-config-airbnb-base": "^
|
|
52
|
-
"eslint-plugin-import": "^2.
|
|
53
|
-
"eslint-plugin-json": "^3.
|
|
54
|
-
"mocha": "^
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"testdouble": "^3.16.6",
|
|
58
|
-
"winston": "^3.8.1"
|
|
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"
|
|
59
59
|
},
|
|
60
|
-
"private": false
|
|
61
|
-
"resolutions": {
|
|
62
|
-
"minimist": "^1.2.5"
|
|
63
|
-
}
|
|
60
|
+
"private": false
|
|
64
61
|
}
|
|
Binary file
|
package/sampleProperties.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"ssl": {
|
|
16
16
|
"enabled": false,
|
|
17
|
-
"accept_invalid_cert":
|
|
17
|
+
"accept_invalid_cert": false,
|
|
18
18
|
"ca_file": ""
|
|
19
19
|
},
|
|
20
20
|
"connectionOptions": {
|
|
@@ -29,8 +29,6 @@
|
|
|
29
29
|
"frequency": 60000
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
"groups": [],
|
|
33
|
-
"brokers": [],
|
|
34
32
|
"logLevel": "none",
|
|
35
33
|
"timeout": 60000
|
|
36
34
|
}
|
|
@@ -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
|
|
@@ -198,23 +200,33 @@ describe('[unit] MySQL Adapter Test', () => {
|
|
|
198
200
|
});
|
|
199
201
|
});
|
|
200
202
|
it('package.json should be validated', (done) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
203
|
+
try {
|
|
204
|
+
const packageDotJson = require('../../package.json');
|
|
205
|
+
// Define the JSON schema for package.json
|
|
206
|
+
const packageJsonSchema = {
|
|
207
|
+
type: 'object',
|
|
208
|
+
properties: {
|
|
209
|
+
name: { type: 'string' },
|
|
210
|
+
version: { type: 'string' }
|
|
211
|
+
// May need to add more properties as needed
|
|
212
|
+
},
|
|
213
|
+
required: ['name', 'version']
|
|
214
|
+
};
|
|
215
|
+
const validate = ajv.compile(packageJsonSchema);
|
|
216
|
+
const isValid = validate(packageDotJson);
|
|
217
|
+
|
|
218
|
+
if (isValid === false) {
|
|
219
|
+
log.error('The package.json contains errors');
|
|
220
|
+
assert.equal(true, isValid);
|
|
221
|
+
} else {
|
|
222
|
+
assert.equal(true, isValid);
|
|
223
|
+
}
|
|
216
224
|
|
|
217
|
-
|
|
225
|
+
done();
|
|
226
|
+
} catch (error) {
|
|
227
|
+
log.error(`Test Failure: ${error}`);
|
|
228
|
+
done(error);
|
|
229
|
+
}
|
|
218
230
|
});
|
|
219
231
|
it('package.json should be customized', (done) => {
|
|
220
232
|
const packageDotJson = require('../../package.json');
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* @copyright Itential, LLC 2019 */
|
|
3
|
+
/* eslint global-require:warn */
|
|
4
|
+
/* eslint import/no-dynamic-require:warn */
|
|
5
|
+
/* eslint prefer-destructuring:warn */
|
|
6
|
+
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const fs = require('fs-extra');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This script will determine the information about the adapter and store
|
|
12
|
+
* it into a file in the adapter.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* get adapter information
|
|
17
|
+
*/
|
|
18
|
+
function adapterInfo() {
|
|
19
|
+
// set the base pase of the adapter - tool shoud be one level up in utils
|
|
20
|
+
let adaptdir = __dirname;
|
|
21
|
+
const infoRes = {};
|
|
22
|
+
|
|
23
|
+
if (adaptdir.endsWith('/utils')) {
|
|
24
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 6);
|
|
25
|
+
}
|
|
26
|
+
const pack = require(`${adaptdir}/package.json`);
|
|
27
|
+
infoRes.version = pack.version;
|
|
28
|
+
|
|
29
|
+
let configCount = 0;
|
|
30
|
+
if (fs.existsSync(`${adaptdir}/pronghorn.json`)) {
|
|
31
|
+
const cFile = fs.readFileSync(`${adaptdir}/pronghorn.json`, 'utf8');
|
|
32
|
+
configCount += cFile.split('\n').length;
|
|
33
|
+
} else {
|
|
34
|
+
console.log('Missing - pronghorn.json');
|
|
35
|
+
}
|
|
36
|
+
if (fs.existsSync(`${adaptdir}/propertiesSchema.json`)) {
|
|
37
|
+
const cFile = fs.readFileSync(`${adaptdir}/propertiesSchema.json`, 'utf8');
|
|
38
|
+
configCount += cFile.split('\n').length;
|
|
39
|
+
} else {
|
|
40
|
+
console.log('Missing - propertiesSchema.json');
|
|
41
|
+
}
|
|
42
|
+
if (fs.existsSync(`${adaptdir}/error.json`)) {
|
|
43
|
+
const cFile = fs.readFileSync(`${adaptdir}/error.json`, 'utf8');
|
|
44
|
+
configCount += cFile.split('\n').length;
|
|
45
|
+
} else {
|
|
46
|
+
console.log('Missing - error.json');
|
|
47
|
+
}
|
|
48
|
+
const entitydir = path.join(adaptdir, '/entities');
|
|
49
|
+
if (fs.existsSync(entitydir) && fs.statSync(entitydir).isDirectory()) {
|
|
50
|
+
const entities = fs.readdirSync(entitydir);
|
|
51
|
+
// need to go through each entity in the entities directory
|
|
52
|
+
for (let e = 0; e < entities.length; e += 1) {
|
|
53
|
+
if (fs.statSync(`${entitydir}/${entities[e]}`).isDirectory()) {
|
|
54
|
+
const cfiles = fs.readdirSync(entitydir);
|
|
55
|
+
for (let c = 0; c < cfiles.length; c += 1) {
|
|
56
|
+
if (cfiles[c].endsWith('.json')) {
|
|
57
|
+
const ccFile = fs.readFileSync(`${entitydir}/${entities[e]}/${cfiles[c]}`, 'utf8');
|
|
58
|
+
configCount += ccFile.split('\n').length;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
console.log('Could not find the entities directory');
|
|
65
|
+
}
|
|
66
|
+
infoRes.configLines = configCount;
|
|
67
|
+
|
|
68
|
+
let scodeCount = 0;
|
|
69
|
+
if (fs.existsSync(`${adaptdir}/utils/artifactize.js`)) {
|
|
70
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/artifactize.js`, 'utf8');
|
|
71
|
+
scodeCount += sFile.split('\n').length;
|
|
72
|
+
} else {
|
|
73
|
+
console.log('Missing - utils/artifactize.js');
|
|
74
|
+
}
|
|
75
|
+
if (fs.existsSync(`${adaptdir}/utils/basicGet.js`)) {
|
|
76
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/basicGet.js`, 'utf8');
|
|
77
|
+
scodeCount += sFile.split('\n').length;
|
|
78
|
+
} else {
|
|
79
|
+
console.log('Missing - utils/basicGet.js');
|
|
80
|
+
}
|
|
81
|
+
if (fs.existsSync(`${adaptdir}/utils/checkMigrate.js`)) {
|
|
82
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/checkMigrate.js`, 'utf8');
|
|
83
|
+
scodeCount += sFile.split('\n').length;
|
|
84
|
+
} else {
|
|
85
|
+
console.log('Missing - utils/checkMigrate.js');
|
|
86
|
+
}
|
|
87
|
+
if (fs.existsSync(`${adaptdir}/utils/findPath.js`)) {
|
|
88
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/findPath.js`, 'utf8');
|
|
89
|
+
scodeCount += sFile.split('\n').length;
|
|
90
|
+
} else {
|
|
91
|
+
console.log('Missing - utils/findPath.js');
|
|
92
|
+
}
|
|
93
|
+
if (fs.existsSync(`${adaptdir}/utils/modify.js`)) {
|
|
94
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/modify.js`, 'utf8');
|
|
95
|
+
scodeCount += sFile.split('\n').length;
|
|
96
|
+
} else {
|
|
97
|
+
console.log('Missing - utils/modify.js');
|
|
98
|
+
}
|
|
99
|
+
if (fs.existsSync(`${adaptdir}/utils/packModificationScript.js`)) {
|
|
100
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/packModificationScript.js`, 'utf8');
|
|
101
|
+
scodeCount += sFile.split('\n').length;
|
|
102
|
+
} else {
|
|
103
|
+
console.log('Missing - utils/packModificationScript.js');
|
|
104
|
+
}
|
|
105
|
+
if (fs.existsSync(`${adaptdir}/utils/setup.js`)) {
|
|
106
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/setup.js`, 'utf8');
|
|
107
|
+
scodeCount += sFile.split('\n').length;
|
|
108
|
+
} else {
|
|
109
|
+
console.log('Missing - utils/setup.js');
|
|
110
|
+
}
|
|
111
|
+
if (fs.existsSync(`${adaptdir}/utils/tbScript.js`)) {
|
|
112
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/tbScript.js`, 'utf8');
|
|
113
|
+
scodeCount += sFile.split('\n').length;
|
|
114
|
+
} else {
|
|
115
|
+
console.log('Missing - utils/tbScript.js');
|
|
116
|
+
}
|
|
117
|
+
if (fs.existsSync(`${adaptdir}/utils/tbUtils.js`)) {
|
|
118
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/tbUtils.js`, 'utf8');
|
|
119
|
+
scodeCount += sFile.split('\n').length;
|
|
120
|
+
} else {
|
|
121
|
+
console.log('Missing - utils/tbUtils.js');
|
|
122
|
+
}
|
|
123
|
+
if (fs.existsSync(`${adaptdir}/utils/testRunner.js`)) {
|
|
124
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/testRunner.js`, 'utf8');
|
|
125
|
+
scodeCount += sFile.split('\n').length;
|
|
126
|
+
} else {
|
|
127
|
+
console.log('Missing - utils/testRunner.js');
|
|
128
|
+
}
|
|
129
|
+
if (fs.existsSync(`${adaptdir}/utils/troubleshootingAdapter.js`)) {
|
|
130
|
+
const sFile = fs.readFileSync(`${adaptdir}/utils/troubleshootingAdapter.js`, 'utf8');
|
|
131
|
+
scodeCount += sFile.split('\n').length;
|
|
132
|
+
} else {
|
|
133
|
+
console.log('Missing - utils/troubleshootingAdapter.js');
|
|
134
|
+
}
|
|
135
|
+
infoRes.scriptLines = scodeCount;
|
|
136
|
+
|
|
137
|
+
let codeCount = 0;
|
|
138
|
+
if (fs.existsSync(`${adaptdir}/adapter.js`)) {
|
|
139
|
+
const aFile = fs.readFileSync(`${adaptdir}/adapter.js`, 'utf8');
|
|
140
|
+
codeCount += aFile.split('\n').length;
|
|
141
|
+
} else {
|
|
142
|
+
console.log('Missing - utils/adapter.js');
|
|
143
|
+
}
|
|
144
|
+
if (fs.existsSync(`${adaptdir}/adapterBase.js`)) {
|
|
145
|
+
const aFile = fs.readFileSync(`${adaptdir}/adapterBase.js`, 'utf8');
|
|
146
|
+
codeCount += aFile.split('\n').length;
|
|
147
|
+
} else {
|
|
148
|
+
console.log('Missing - utils/adapterBase.js');
|
|
149
|
+
}
|
|
150
|
+
infoRes.codeLines = codeCount;
|
|
151
|
+
|
|
152
|
+
let tcodeCount = 0;
|
|
153
|
+
let ttestCount = 0;
|
|
154
|
+
if (fs.existsSync(`${adaptdir}/test/integration/adapterTestBasicGet.js`)) {
|
|
155
|
+
const tFile = fs.readFileSync(`${adaptdir}/test/integration/adapterTestBasicGet.js`, 'utf8');
|
|
156
|
+
tcodeCount += tFile.split('\n').length;
|
|
157
|
+
ttestCount += tFile.split('it(\'').length;
|
|
158
|
+
} else {
|
|
159
|
+
console.log('Missing - test/integration/adapterTestBasicGet.js');
|
|
160
|
+
}
|
|
161
|
+
if (fs.existsSync(`${adaptdir}/test/integration/adapterTestConnectivity.js`)) {
|
|
162
|
+
const tFile = fs.readFileSync(`${adaptdir}/test/integration/adapterTestConnectivity.js`, 'utf8');
|
|
163
|
+
tcodeCount += tFile.split('\n').length;
|
|
164
|
+
ttestCount += tFile.split('it(\'').length;
|
|
165
|
+
} else {
|
|
166
|
+
console.log('Missing - test/integration/adapterTestConnectivity.js');
|
|
167
|
+
}
|
|
168
|
+
if (fs.existsSync(`${adaptdir}/test/integration/adapterTestIntegration.js`)) {
|
|
169
|
+
const tFile = fs.readFileSync(`${adaptdir}/test/integration/adapterTestIntegration.js`, 'utf8');
|
|
170
|
+
tcodeCount += tFile.split('\n').length;
|
|
171
|
+
ttestCount += tFile.split('it(\'').length;
|
|
172
|
+
} else {
|
|
173
|
+
console.log('Missing - test/integration/adapterTestIntegration.js');
|
|
174
|
+
}
|
|
175
|
+
if (fs.existsSync(`${adaptdir}/test/unit/adapterBaseTestUnit.js`)) {
|
|
176
|
+
const tFile = fs.readFileSync(`${adaptdir}/test/unit/adapterBaseTestUnit.js`, 'utf8');
|
|
177
|
+
tcodeCount += tFile.split('\n').length;
|
|
178
|
+
ttestCount += tFile.split('it(\'').length;
|
|
179
|
+
} else {
|
|
180
|
+
console.log('Missing - test/unit/adapterBaseTestUnit.js');
|
|
181
|
+
}
|
|
182
|
+
if (fs.existsSync(`${adaptdir}/test/unit/adapterTestUnit.js`)) {
|
|
183
|
+
const tFile = fs.readFileSync(`${adaptdir}/test/unit/adapterTestUnit.js`, 'utf8');
|
|
184
|
+
tcodeCount += tFile.split('\n').length;
|
|
185
|
+
ttestCount += tFile.split('it(\'').length;
|
|
186
|
+
} else {
|
|
187
|
+
console.log('Missing - test/unit/adapterTestUnit.js');
|
|
188
|
+
}
|
|
189
|
+
infoRes.testLines = tcodeCount;
|
|
190
|
+
infoRes.testCases = ttestCount;
|
|
191
|
+
infoRes.totalCodeLines = scodeCount + codeCount + tcodeCount;
|
|
192
|
+
|
|
193
|
+
if (fs.existsSync(`${adaptdir}/pronghorn.json`)) {
|
|
194
|
+
// Read the entity schema from the file system
|
|
195
|
+
const phFile = path.join(adaptdir, '/pronghorn.json');
|
|
196
|
+
const prong = require(phFile);
|
|
197
|
+
infoRes.wfTasks = prong.methods.length;
|
|
198
|
+
} else {
|
|
199
|
+
console.log('Missing - pronghorn.json');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
console.log(JSON.stringify(infoRes));
|
|
203
|
+
fs.writeFileSync(`${adaptdir}/report/adapterInfo.json`, JSON.stringify(infoRes, null, 2));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
adapterInfo();
|
package/utils/artifactize.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* @copyright Itential, LLC 2019 */
|
|
3
3
|
|
|
4
|
-
const fs = require('fs-extra');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
const { spawnSync } = require('child_process');
|
|
6
|
+
const fs = require('fs-extra');
|
|
7
7
|
const { createBundle } = require('./artifactize');
|
|
8
8
|
|
|
9
9
|
const nodeEntryPath = path.resolve('.');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This script will uninstall pre-commit or pre-push hooks in case there's ever a need to
|
|
5
|
+
* commit/push something that has issues
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const precommitPath = '.git/hooks/pre-commit';
|
|
9
|
+
const prepushPath = '.git/hooks/pre-push';
|
|
10
|
+
fs.unlink(precommitPath, (err) => {
|
|
11
|
+
if (err && err.code !== 'ENOENT') {
|
|
12
|
+
console.log(`${err.message}`);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
fs.unlink(prepushPath, (err) => {
|
|
17
|
+
if (err && err.code !== 'ENOENT') {
|
|
18
|
+
console.log(`${err.message}`);
|
|
19
|
+
}
|
|
20
|
+
});
|