@itentialopensource/adapter-nokia_altiplano 0.5.0 → 0.5.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/AUTH.md +15 -13
- package/BROKER.md +195 -0
- package/CALLS.md +163 -89
- package/CHANGELOG.md +8 -0
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +88 -74
- package/ENHANCE.md +14 -14
- package/PROPERTIES.md +483 -89
- package/README.md +131 -51
- package/SUMMARY.md +2 -2
- package/SYSTEMINFO.md +6 -7
- package/TROUBLESHOOT.md +4 -3
- package/adapter.js +190 -382
- package/adapterBase.js +616 -160
- package/entities/.generic/action.json +105 -0
- package/entities/.generic/schema.json +6 -1
- package/entities/Intent/action.json +2 -2
- package/package.json +3 -2
- package/pronghorn.json +92 -3
- package/propertiesSchema.json +37 -7
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1652197536783.json +120 -0
- package/sampleProperties.json +82 -0
- package/test/integration/adapterTestIntegration.js +2 -1
- package/test/unit/adapterBaseTestUnit.js +10 -3
- package/test/unit/adapterTestUnit.js +25 -17
- package/utils/adapterInfo.js +206 -0
- package/utils/pre-commit.sh +3 -0
|
@@ -52,6 +52,7 @@ global.pronghornProps = {
|
|
|
52
52
|
version: '',
|
|
53
53
|
cache_location: 'none',
|
|
54
54
|
encode_pathvars: true,
|
|
55
|
+
encode_queryvars: true,
|
|
55
56
|
save_metric: false,
|
|
56
57
|
stub,
|
|
57
58
|
protocol,
|
|
@@ -475,6 +476,7 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
475
476
|
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUnsuspendAdapter'));
|
|
476
477
|
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterQueue'));
|
|
477
478
|
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
|
|
479
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequestNoBasePath'));
|
|
478
480
|
done();
|
|
479
481
|
} catch (error) {
|
|
480
482
|
log.error(`Test Failure: ${error}`);
|
|
@@ -646,6 +648,8 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
646
648
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
|
|
647
649
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
|
|
648
650
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
|
|
651
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
|
|
652
|
+
assert.notEqual(null, propertiesDotJson.definitions.ssl);
|
|
649
653
|
assert.notEqual('', propertiesDotJson.definitions.ssl);
|
|
650
654
|
assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
|
|
651
655
|
assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
|
|
@@ -659,6 +663,7 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
659
663
|
assert.equal('string', propertiesDotJson.properties.version.type);
|
|
660
664
|
assert.equal('string', propertiesDotJson.properties.cache_location.type);
|
|
661
665
|
assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
|
|
666
|
+
assert.equal('boolean', propertiesDotJson.properties.encode_queryvars.type);
|
|
662
667
|
assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
|
|
663
668
|
assert.equal('string', propertiesDotJson.properties.protocol.type);
|
|
664
669
|
assert.notEqual(undefined, propertiesDotJson.definitions);
|
|
@@ -707,8 +712,6 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
707
712
|
assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
|
|
708
713
|
assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
|
|
709
714
|
assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
|
|
710
|
-
assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
|
|
711
|
-
assert.notEqual(null, propertiesDotJson.definitions.ssl);
|
|
712
715
|
assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
|
|
713
716
|
assert.notEqual(null, propertiesDotJson.definitions.mongo);
|
|
714
717
|
assert.notEqual('', propertiesDotJson.definitions.mongo);
|
|
@@ -1291,18 +1294,6 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
1291
1294
|
});
|
|
1292
1295
|
});
|
|
1293
1296
|
|
|
1294
|
-
describe('#hasDevices', () => {
|
|
1295
|
-
it('should have a hasDevices function', (done) => {
|
|
1296
|
-
try {
|
|
1297
|
-
assert.equal(true, typeof a.hasDevices === 'function');
|
|
1298
|
-
done();
|
|
1299
|
-
} catch (error) {
|
|
1300
|
-
log.error(`Test Failure: ${error}`);
|
|
1301
|
-
done(error);
|
|
1302
|
-
}
|
|
1303
|
-
});
|
|
1304
|
-
});
|
|
1305
|
-
|
|
1306
1297
|
describe('#getDevice', () => {
|
|
1307
1298
|
it('should have a getDevice function', (done) => {
|
|
1308
1299
|
try {
|
|
@@ -1938,11 +1929,28 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
1938
1929
|
done(error);
|
|
1939
1930
|
}
|
|
1940
1931
|
}).timeout(attemptTimeout);
|
|
1941
|
-
it('should error if - missing
|
|
1932
|
+
it('should error if - missing intentType', (done) => {
|
|
1942
1933
|
try {
|
|
1943
|
-
a.deleteIbnIntent(null, (data, error) => {
|
|
1934
|
+
a.deleteIbnIntent(null, null, (data, error) => {
|
|
1944
1935
|
try {
|
|
1945
|
-
const displayE = '
|
|
1936
|
+
const displayE = 'intentType is required';
|
|
1937
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-deleteIbnIntent', displayE);
|
|
1938
|
+
done();
|
|
1939
|
+
} catch (err) {
|
|
1940
|
+
log.error(`Test Failure: ${err}`);
|
|
1941
|
+
done(err);
|
|
1942
|
+
}
|
|
1943
|
+
});
|
|
1944
|
+
} catch (error) {
|
|
1945
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1946
|
+
done(error);
|
|
1947
|
+
}
|
|
1948
|
+
}).timeout(attemptTimeout);
|
|
1949
|
+
it('should error if - missing target', (done) => {
|
|
1950
|
+
try {
|
|
1951
|
+
a.deleteIbnIntent('fakedata', null, (data, error) => {
|
|
1952
|
+
try {
|
|
1953
|
+
const displayE = 'target is required';
|
|
1946
1954
|
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-deleteIbnIntent', displayE);
|
|
1947
1955
|
done();
|
|
1948
1956
|
} catch (err) {
|
|
@@ -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 fs = require('fs-extra');
|
|
8
|
+
const path = require('path');
|
|
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/pre-commit.sh
CHANGED
|
@@ -17,6 +17,9 @@ printf "%b" "Running pre-commit hooks...\\n"
|
|
|
17
17
|
# verify testing script is stubbed and no credentials
|
|
18
18
|
node utils/testRunner.js -r
|
|
19
19
|
|
|
20
|
+
# update the adapter information file
|
|
21
|
+
node utils/adapterInfo.js
|
|
22
|
+
|
|
20
23
|
# security audit on the code
|
|
21
24
|
npm audit --registry=https://registry.npmjs.org --audit-level=moderate
|
|
22
25
|
|