@itentialopensource/adapter-paragon_insights 0.1.2 → 0.2.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.
Files changed (52) hide show
  1. package/.eslintignore +0 -1
  2. package/.jshintrc +3 -0
  3. package/CALLS.md +638 -483
  4. package/CHANGELOG.md +16 -0
  5. package/CONTRIBUTING.md +1 -160
  6. package/ENHANCE.md +2 -2
  7. package/README.md +31 -22
  8. package/adapter.js +10567 -8758
  9. package/adapterBase.js +538 -873
  10. package/changelogs/CHANGELOG.md +16 -0
  11. package/entities/Config/action.json +306 -0
  12. package/entities/Config/mockdatafiles/retrieveHealthbotIngestIfaDeviceIds-default.json +4 -0
  13. package/entities/Config/mockdatafiles/retrieveHealthbotIngestIfaDevices-default.json +10 -0
  14. package/entities/Config/schema.json +16 -1
  15. package/entities/Configuration/action.json +61 -0
  16. package/entities/Configuration/schema.json +4 -1
  17. package/entities/Utility/action.json +44 -0
  18. package/entities/Utility/schema.json +20 -0
  19. package/metadata.json +51 -0
  20. package/package.json +23 -25
  21. package/pronghorn.json +1480 -343
  22. package/propertiesSchema.json +453 -41
  23. package/refs?service=git-upload-pack +0 -0
  24. package/report/adapter-openapi.json +42358 -0
  25. package/report/adapter-openapi.yaml +29640 -0
  26. package/report/adapterInfo.json +8 -8
  27. package/report/updateReport1691508880430.json +120 -0
  28. package/report/updateReport1692202195666.json +120 -0
  29. package/report/updateReport1692203297401.json +120 -0
  30. package/report/updateReport1694469141676.json +120 -0
  31. package/report/updateReport1698422888699.json +120 -0
  32. package/sampleProperties.json +67 -14
  33. package/test/integration/adapterTestBasicGet.js +1 -1
  34. package/test/integration/adapterTestConnectivity.js +91 -42
  35. package/test/integration/adapterTestIntegration.js +640 -2
  36. package/test/unit/adapterBaseTestUnit.js +388 -315
  37. package/test/unit/adapterTestUnit.js +870 -110
  38. package/utils/adapterInfo.js +1 -1
  39. package/utils/addAuth.js +1 -1
  40. package/utils/artifactize.js +1 -1
  41. package/utils/checkMigrate.js +1 -1
  42. package/utils/entitiesToDB.js +1 -0
  43. package/utils/findPath.js +1 -1
  44. package/utils/methodDocumentor.js +71 -23
  45. package/utils/modify.js +13 -15
  46. package/utils/packModificationScript.js +1 -1
  47. package/utils/taskMover.js +309 -0
  48. package/utils/tbScript.js +3 -10
  49. package/utils/tbUtils.js +2 -3
  50. package/utils/testRunner.js +1 -1
  51. package/utils/troubleshootingAdapter.js +1 -3
  52. package/workflows/README.md +0 -3
@@ -4,6 +4,7 @@
4
4
  "properties": {
5
5
  "host": "localhost",
6
6
  "port": 443,
7
+ "choosepath": "",
7
8
  "base_path": "/api",
8
9
  "version": "v2",
9
10
  "cache_location": "none",
@@ -14,6 +15,24 @@
14
15
  "protocol": "https",
15
16
  "authentication": {
16
17
  "auth_method": "multi_step_authentication",
18
+ "username": "admin",
19
+ "password": "pass",
20
+ "token": "token",
21
+ "token_timeout": 1800000,
22
+ "token_cache": "local",
23
+ "invalid_token_error": 401,
24
+ "auth_field": "header.headers.x-iam-token",
25
+ "auth_field_format": "{tokenp2}",
26
+ "auth_logging": false,
27
+ "client_id": "",
28
+ "client_secret": "",
29
+ "grant_type": "",
30
+ "sensitive": [],
31
+ "sso": {
32
+ "protocol": "",
33
+ "host": "",
34
+ "port": 0
35
+ },
17
36
  "multiStepAuthCalls": [
18
37
  {
19
38
  "name": "getFirstToken",
@@ -47,24 +66,13 @@
47
66
  },
48
67
  "successfullResponseCode": 200
49
68
  }
50
- ],
51
- "username": "admin",
52
- "password": "pass",
53
- "token": "token",
54
- "token_timeout": 1800000,
55
- "token_cache": "local",
56
- "invalid_token_error": 401,
57
- "auth_field": "header.headers.x-iam-token",
58
- "auth_field_format": "{tokenp2}",
59
- "auth_logging": false,
60
- "client_id": "",
61
- "client_secret": "",
62
- "grant_type": ""
69
+ ]
63
70
  },
64
71
  "healthcheck": {
65
72
  "type": "startup",
66
73
  "frequency": 60000,
67
- "query_object": {}
74
+ "query_object": {},
75
+ "addlHeaders": {}
68
76
  },
69
77
  "throttle": {
70
78
  "throttle_enabled": false,
@@ -159,6 +167,12 @@
159
167
  {
160
168
  "path": "/get/devices",
161
169
  "method": "GET",
170
+ "pagination": {
171
+ "offsetVar": "",
172
+ "limitVar": "",
173
+ "incrementBy": "limit",
174
+ "requestLocation": "query"
175
+ },
162
176
  "query": {},
163
177
  "body": {},
164
178
  "headers": {},
@@ -220,6 +234,45 @@
220
234
  "responseFields": {}
221
235
  }
222
236
  ]
237
+ },
238
+ "cache": {
239
+ "enabled": false,
240
+ "entities": [
241
+ {
242
+ "entityType": "",
243
+ "frequency": 1440,
244
+ "flushOnFail": false,
245
+ "limit": 1000,
246
+ "retryAttempts": 5,
247
+ "sort": true,
248
+ "populate": [
249
+ {
250
+ "path": "",
251
+ "method": "GET",
252
+ "pagination": {
253
+ "offsetVar": "",
254
+ "limitVar": "",
255
+ "incrementBy": "limit",
256
+ "requestLocation": "query"
257
+ },
258
+ "query": {},
259
+ "body": {},
260
+ "headers": {},
261
+ "handleFailure": "ignore",
262
+ "requestFields": {},
263
+ "responseDatakey": "",
264
+ "responseFields": {}
265
+ }
266
+ ],
267
+ "cachedTasks": [
268
+ {
269
+ "name": "",
270
+ "filterField": "",
271
+ "filterLoc": ""
272
+ }
273
+ ]
274
+ }
275
+ ]
223
276
  }
224
277
  },
225
278
  "groups": [],
@@ -7,9 +7,9 @@
7
7
  /* eslint import/no-dynamic-require: warn */
8
8
  /* eslint import/no-unresolved: warn */
9
9
 
10
- const mocha = require('mocha');
11
10
  const path = require('path');
12
11
  const assert = require('assert');
12
+ const mocha = require('mocha');
13
13
  const itParam = require('mocha-param');
14
14
 
15
15
  const utils = require('../../utils/tbUtils');
@@ -3,9 +3,12 @@
3
3
  /* global describe it context before after */
4
4
  /* eslint no-unused-vars: warn */
5
5
 
6
- const mocha = require('mocha');
7
6
  const assert = require('assert');
8
- const diagnostics = require('network-diagnostics');
7
+ const http = require('http');
8
+ const https = require('https');
9
+ const mocha = require('mocha');
10
+ const ping = require('ping');
11
+ const dnsLookup = require('dns-lookup-promise');
9
12
 
10
13
  let host;
11
14
  process.argv.forEach((val) => {
@@ -16,78 +19,124 @@ process.argv.forEach((val) => {
16
19
 
17
20
  describe('[integration] Adapter Test', () => {
18
21
  context(`Testing network connection on ${host}`, () => {
19
- before(() => {
20
- diagnostics.setTestURL(host);
21
- });
22
-
23
22
  after((done) => {
24
23
  done();
25
24
  });
26
25
 
27
26
  it('DNS resolve', (done) => {
28
- diagnostics.haveDNS((result) => {
29
- try {
30
- assert.equal(result, true);
31
- done();
32
- } catch (error) {
33
- done(error);
34
- }
35
- });
27
+ dnsLookup(host)
28
+ .then((addresses) => {
29
+ try {
30
+ assert.ok(addresses.length > 0);
31
+ done();
32
+ } catch (error) {
33
+ done(error);
34
+ }
35
+ })
36
+ .catch((err) => {
37
+ done(err);
38
+ });
36
39
  });
37
40
 
38
41
  it('Responds to ping', (done) => {
39
- diagnostics.havePing((result) => {
40
- try {
41
- assert.equal(result, true);
42
- done();
43
- } catch (error) {
44
- done(error);
45
- }
46
- });
42
+ ping.promise.probe(host)
43
+ .then((result) => {
44
+ try {
45
+ assert.ok(result.alive);
46
+ done();
47
+ } catch (error) {
48
+ done(error);
49
+ }
50
+ })
51
+ .catch((err) => {
52
+ done(err);
53
+ });
47
54
  });
48
55
 
49
56
  it('Support HTTP on port 80', (done) => {
50
- diagnostics.haveHTTP((result) => {
57
+ const requestOptions = {
58
+ host,
59
+ port: 80,
60
+ method: 'HEAD'
61
+ };
62
+
63
+ const req = http.request(requestOptions, (res) => {
51
64
  try {
52
- assert.equal(result, true);
65
+ assert.ok(res.statusCode >= 200 && res.statusCode < 400);
53
66
  done();
54
67
  } catch (error) {
55
68
  done(error);
56
69
  }
57
70
  });
71
+
72
+ req.on('error', (err) => {
73
+ done(err);
74
+ });
75
+
76
+ req.end();
58
77
  });
59
78
 
60
79
  it('Support HTTPS on port 443', (done) => {
61
- diagnostics.haveHTTPS((result) => {
80
+ const requestOptions = {
81
+ host,
82
+ port: 443,
83
+ method: 'HEAD'
84
+ };
85
+
86
+ const req = https.request(requestOptions, (res) => {
62
87
  try {
63
- assert.equal(result, true);
88
+ assert.ok(res.statusCode >= 200 && res.statusCode < 400);
64
89
  done();
65
90
  } catch (error) {
66
91
  done(error);
67
92
  }
68
93
  });
94
+
95
+ req.on('error', (err) => {
96
+ done(err);
97
+ });
98
+
99
+ req.end();
69
100
  });
70
101
 
71
102
  it('Support IPv4', (done) => {
72
- diagnostics.haveIPv4Async((result) => {
73
- try {
74
- assert.equal(result, true);
75
- done();
76
- } catch (error) {
77
- done(error);
78
- }
79
- });
103
+ const options = {
104
+ family: 4,
105
+ hints: dnsLookup.ADDRCONFIG
106
+ };
107
+
108
+ dnsLookup.lookup(host, options)
109
+ .then((address, family) => {
110
+ try {
111
+ assert.ok(address !== null && family === 4);
112
+ done();
113
+ } catch (error) {
114
+ done(error);
115
+ }
116
+ })
117
+ .catch((err) => {
118
+ done(err);
119
+ });
80
120
  });
81
121
 
82
122
  it('Support IPv6', (done) => {
83
- diagnostics.haveIPv6Async((result) => {
84
- try {
85
- assert.equal(result, true);
86
- done();
87
- } catch (error) {
88
- done(error);
89
- }
90
- });
123
+ const options = {
124
+ family: 6,
125
+ hints: dnsLookup.ADDRCONFIG
126
+ };
127
+
128
+ dnsLookup.lookup(host, options)
129
+ .then((address, family) => {
130
+ try {
131
+ assert.ok(address !== null && family === 6);
132
+ done();
133
+ } catch (error) {
134
+ done(error);
135
+ }
136
+ })
137
+ .catch((err) => {
138
+ done(err);
139
+ });
91
140
  });
92
141
  });
93
142
  });