@itentialopensource/adapter-generic 0.1.1 → 0.1.3

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.
@@ -116,30 +116,32 @@
116
116
  }
117
117
  },
118
118
  "devicebroker": {
119
+ "enabled": false,
119
120
  "getDevice": [
120
121
  {
121
- "path": "/get/devices/{id}",
122
+ "path": "/not/mapped",
122
123
  "method": "GET",
123
124
  "query": {},
124
125
  "body": {},
125
126
  "headers": {},
126
127
  "handleFailure": "ignore",
127
128
  "requestFields": {
128
- "id": "name"
129
+ "insample": "{port}"
129
130
  },
130
131
  "responseDatakey": "",
131
132
  "responseFields": {
132
- "name": "host",
133
- "ostype": "os",
134
- "ostypePrefix": "system-",
135
- "ipaddress": "attributes.ipaddr",
136
- "port": "443"
133
+ "name": "{this}{||}{that}",
134
+ "ostype": "{osfield}",
135
+ "ostypePrefix": "meraki-",
136
+ "port": "{port}",
137
+ "ipaddress": "{ip_addr}",
138
+ "serial" : "{serial}"
137
139
  }
138
140
  }
139
141
  ],
140
142
  "getDevicesFiltered": [
141
143
  {
142
- "path": "/get/devices",
144
+ "path": "/not/mapped",
143
145
  "method": "GET",
144
146
  "pagination": {
145
147
  "offsetVar": "",
@@ -154,42 +156,44 @@
154
156
  "requestFields": {},
155
157
  "responseDatakey": "",
156
158
  "responseFields": {
157
- "name": "host",
158
- "ostype": "os",
159
- "ostypePrefix": "system-",
160
- "ipaddress": "attributes.ipaddr",
161
- "port": "443"
159
+ "name": "{this}{||}{that}",
160
+ "ostype": "{osfield}",
161
+ "ostypePrefix": "meraki-",
162
+ "port": "{port}",
163
+ "ipaddress": "{ip_addr}",
164
+ "serial" : "{serial}",
165
+ "id": "{myid}"
162
166
  }
163
167
  }
164
168
  ],
165
169
  "isAlive": [
166
170
  {
167
- "path": "/get/devices/{id}/status",
171
+ "path": "/not/mapped/{devID}",
168
172
  "method": "GET",
169
173
  "query": {},
170
174
  "body": {},
171
175
  "headers": {},
172
176
  "handleFailure": "ignore",
173
177
  "requestFields": {
174
- "id": "name"
178
+ "devID": "{id}"
175
179
  },
176
180
  "responseDatakey": "",
177
181
  "responseFields": {
178
- "status": "status",
179
- "statusValue": "online"
182
+ "status": "return2xx",
183
+ "statusValue": "AD.200"
180
184
  }
181
185
  }
182
186
  ],
183
187
  "getConfig": [
184
188
  {
185
- "path": "/get/devices/{id}/configPart1",
189
+ "path": "/not/mapped/{devID}",
186
190
  "method": "GET",
187
191
  "query": {},
188
192
  "body": {},
189
193
  "headers": {},
190
194
  "handleFailure": "ignore",
191
195
  "requestFields": {
192
- "id": "name"
196
+ "devID": "{id}"
193
197
  },
194
198
  "responseDatakey": "",
195
199
  "responseFields": {}
@@ -197,7 +201,7 @@
197
201
  ],
198
202
  "getCount": [
199
203
  {
200
- "path": "/get/devices",
204
+ "path": "/not/mapped",
201
205
  "method": "GET",
202
206
  "query": {},
203
207
  "body": {},
@@ -213,15 +217,15 @@
213
217
  "enabled": false,
214
218
  "entities": [
215
219
  {
216
- "entityType": "",
217
- "frequency": 1440,
220
+ "entityType": "device",
221
+ "frequency": 3600,
218
222
  "flushOnFail": false,
219
- "limit": 1000,
223
+ "limit": 10000,
220
224
  "retryAttempts": 5,
221
225
  "sort": true,
222
226
  "populate": [
223
227
  {
224
- "path": "",
228
+ "path": "/not/mapped",
225
229
  "method": "GET",
226
230
  "pagination": {
227
231
  "offsetVar": "",
@@ -235,7 +239,15 @@
235
239
  "handleFailure": "ignore",
236
240
  "requestFields": {},
237
241
  "responseDatakey": "",
238
- "responseFields": {}
242
+ "responseFields": {
243
+ "name": "{this}{||}{that}",
244
+ "ostype": "{osfield}",
245
+ "ostypePrefix": "meraki-",
246
+ "port": "{port}",
247
+ "ipaddress": "{ip_addr}",
248
+ "serial" : "{serial}",
249
+ "id": "{myid}"
250
+ }
239
251
  }
240
252
  ],
241
253
  "cachedTasks": [
@@ -46,6 +46,7 @@ samProps.ssl.accept_invalid_cert = false;
46
46
  if (samProps.request.attempt_timeout < 30000) {
47
47
  samProps.request.attempt_timeout = 30000;
48
48
  }
49
+ samProps.devicebroker.enabled = true;
49
50
  const attemptTimeout = samProps.request.attempt_timeout;
50
51
  const { stub } = samProps;
51
52
 
@@ -284,7 +284,6 @@ describe('[unit] Generic Adapter Test', () => {
284
284
  assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
285
285
  assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
286
286
  assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
287
- assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
288
287
  assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
289
288
  assert.equal('npm publish --registry=https://registry.npmjs.org --access=public', packageDotJson.scripts.deploy);
290
289
  assert.equal('npm run deploy', packageDotJson.scripts.build);
@@ -315,17 +314,16 @@ describe('[unit] Generic Adapter Test', () => {
315
314
  assert.notEqual(undefined, packageDotJson.dependencies);
316
315
  assert.notEqual(null, packageDotJson.dependencies);
317
316
  assert.notEqual('', packageDotJson.dependencies);
318
- assert.equal('^8.12.0', packageDotJson.dependencies.ajv);
319
- assert.equal('^1.4.0', packageDotJson.dependencies.axios);
317
+ assert.equal('^8.17.1', packageDotJson.dependencies.ajv);
318
+ assert.equal('^1.7.2', packageDotJson.dependencies.axios);
320
319
  assert.equal('^11.0.0', packageDotJson.dependencies.commander);
321
- assert.equal('^11.1.1', packageDotJson.dependencies['fs-extra']);
322
- assert.equal('^10.2.0', packageDotJson.dependencies.mocha);
320
+ assert.equal('^11.2.0', packageDotJson.dependencies['fs-extra']);
321
+ assert.equal('^10.7.0', packageDotJson.dependencies.mocha);
323
322
  assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
324
- assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
325
323
  assert.equal('^0.4.4', packageDotJson.dependencies.ping);
326
324
  assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
327
- assert.equal('^7.5.3', packageDotJson.dependencies.semver);
328
- assert.equal('^3.9.0', packageDotJson.dependencies.winston);
325
+ assert.equal('^7.6.3', packageDotJson.dependencies.semver);
326
+ assert.equal('^3.13.1', packageDotJson.dependencies.winston);
329
327
  done();
330
328
  } catch (error) {
331
329
  log.error(`Test Failure: ${error}`);
@@ -420,33 +418,33 @@ describe('[unit] Generic Adapter Test', () => {
420
418
  // it('pronghorn.json should only expose workflow functions', (done) => {
421
419
  // try {
422
420
  // const pronghornDotJson = require('../../pronghorn.json');
423
-
421
+ //
424
422
  // for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
425
423
  // let found = false;
426
424
  // let paramissue = false;
427
-
425
+ //
428
426
  // for (let w = 0; w < wffunctions.length; w += 1) {
429
427
  // if (pronghornDotJson.methods[m].name === wffunctions[w]) {
430
428
  // found = true;
431
429
  // const methLine = execute(`grep " ${wffunctions[w]}(" adapter.js | grep "callback) {"`).toString();
432
430
  // let wfparams = [];
433
-
431
+ //
434
432
  // if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
435
433
  // const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
436
434
  // wfparams = temp.split(',');
437
-
435
+ //
438
436
  // for (let t = 0; t < wfparams.length; t += 1) {
439
437
  // // remove default value from the parameter name
440
438
  // wfparams[t] = wfparams[t].substring(0, wfparams[t].search(/=/) > 0 ? wfparams[t].search(/#|\?|=/) : wfparams[t].length);
441
439
  // // remove spaces
442
440
  // wfparams[t] = wfparams[t].trim();
443
-
441
+ //
444
442
  // if (wfparams[t] === 'callback') {
445
443
  // wfparams.splice(t, 1);
446
444
  // }
447
445
  // }
448
446
  // }
449
-
447
+ //
450
448
  // // if there are inputs defined but not on the method line
451
449
  // if (wfparams.length === 0 && (pronghornDotJson.methods[m].input
452
450
  // && pronghornDotJson.methods[m].input.length > 0)) {
@@ -463,7 +461,7 @@ describe('[unit] Generic Adapter Test', () => {
463
461
  // pfound = true;
464
462
  // }
465
463
  // }
466
-
464
+ //
467
465
  // if (!pfound) {
468
466
  // paramissue = true;
469
467
  // }
@@ -475,17 +473,17 @@ describe('[unit] Generic Adapter Test', () => {
475
473
  // pfound = true;
476
474
  // }
477
475
  // }
478
-
476
+ //
479
477
  // if (!pfound) {
480
478
  // paramissue = true;
481
479
  // }
482
480
  // }
483
481
  // }
484
-
482
+ //
485
483
  // break;
486
484
  // }
487
485
  // }
488
-
486
+ //
489
487
  // if (!found) {
490
488
  // // this is the reason to go through both loops - log which ones are not found so
491
489
  // // they can be worked
@@ -563,7 +561,7 @@ describe('[unit] Generic Adapter Test', () => {
563
561
  log.error(`Adapter Exception: ${error}`);
564
562
  done(error);
565
563
  }
566
- });
564
+ }).timeout(attemptTimeout);
567
565
  });
568
566
 
569
567
  describe('propertiesSchema.json', () => {