opengate-js 10.5.2 → 10.6.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/bower.json +1 -1
- package/dist/{opengate-api-bower-10.5.2.js → opengate-api-bower-10.6.1.js} +12716 -286
- package/dist/opengate-api-bower-10.6.1.js.map +1 -0
- package/dist/{opengate-api-bower-10.5.2.min.js → opengate-api-bower-10.6.1.min.js} +35 -33
- package/dist/opengate-api-bower-10.6.1.min.js.map +1 -0
- package/dist/src/provision/bulk/BulkExecutionBuilder.js +1 -4
- package/dist/src/provision/bulk/BulkExecutionBuilder.js.map +1 -1
- package/dist/src/util/NorthAmpliaREST.js +126 -50
- package/dist/src/util/NorthAmpliaREST.js.map +1 -1
- package/dist/src/util/searchingFields/IotFields.js +2 -0
- package/dist/src/util/searchingFields/IotFields.js.map +1 -1
- package/docs/ast/source/provision/bulk/BulkExecutionBuilder.js.json +1840 -2555
- package/docs/ast/source/util/NorthAmpliaREST.js.json +17082 -11354
- package/docs/ast/source/util/searchingFields/IotFields.js.json +2416 -2088
- package/docs/class/src/util/NorthAmpliaREST.js~NorthAmpliaREST.html +7 -7
- package/docs/dump.json +440 -412
- package/docs/file/src/provision/bulk/BulkExecutionBuilder.js.html +1 -4
- package/docs/file/src/util/NorthAmpliaREST.js.html +115 -45
- package/docs/file/src/util/searchingFields/IotFields.js.html +5 -3
- package/docs/package.json +1 -1
- package/docs/source.html +197 -197
- package/features/features/provision/bulk/execute_bulk.feature +0 -1
- package/features/features/provision/bulk/find_bulk_execution.feature +0 -1
- package/features/features/provision/processors/create_delete_processors.feature +3 -3
- package/features/features/provision/processors/find_provision_processors.feature +1 -2
- package/features/features/provision/processors/update_provision_processors.feature +28 -9
- package/features/features/searching/bulk/searching_bulk_executions.feature +0 -1
- package/features/step_definitions/when_step_definitions.js +142 -53
- package/package.json +1 -1
- package/src/provision/bulk/BulkExecutionBuilder.js +1 -4
- package/src/util/NorthAmpliaREST.js +115 -45
- package/src/util/searchingFields/IotFields.js +5 -3
- package/dist/opengate-api-bower-10.5.2.js.map +0 -1
- package/dist/opengate-api-bower-10.5.2.min.js.map +0 -1
|
@@ -323,10 +323,7 @@ export default class BulkExecutionBuilder extends BaseProvision {
|
|
|
323
323
|
let form;
|
|
324
324
|
if (typeof rawFile !== 'string') {
|
|
325
325
|
form = new FormData();
|
|
326
|
-
|
|
327
|
-
type: this._extension
|
|
328
|
-
});
|
|
329
|
-
form.append('file', processorBulkFile);
|
|
326
|
+
form.append('file', rawFile);
|
|
330
327
|
} else {
|
|
331
328
|
form = {};
|
|
332
329
|
form.processorBulkFile = rawFile;
|
|
@@ -246,9 +246,9 @@
|
|
|
246
246
|
|
|
247
247
|
import merge from 'merge';
|
|
248
248
|
import urlencode from 'urlencode';
|
|
249
|
-
import request from 'superagent';
|
|
249
|
+
import request, { mkcol } from 'superagent';
|
|
250
250
|
import q from 'q';
|
|
251
|
-
import
|
|
251
|
+
import _ from 'lodash'
|
|
252
252
|
// MOCK user searching
|
|
253
253
|
import _mock from 'superagent-mocker';
|
|
254
254
|
const mock = _mock(request);
|
|
@@ -265,8 +265,11 @@ export default class NorthAmpliaREST {
|
|
|
265
265
|
constructor(_options, headers) {
|
|
266
266
|
this._options = merge.recursive(true, this.default(), _options);
|
|
267
267
|
this._headers = headers;
|
|
268
|
+
if (!_.isEmpty(_options.mocks)) {
|
|
269
|
+
this._applyMocks(_options.mocks)
|
|
270
|
+
}
|
|
268
271
|
|
|
269
|
-
// ----------------------------------
|
|
272
|
+
// ---------------------------------- EXAMPLE
|
|
270
273
|
/*
|
|
271
274
|
mock.post(_options.url + '/search/channels', function(req) {
|
|
272
275
|
return {
|
|
@@ -282,49 +285,116 @@ export default class NorthAmpliaREST {
|
|
|
282
285
|
};
|
|
283
286
|
});
|
|
284
287
|
*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
288
|
+
/*mock.post(_options.url + '/datasets/provision/organizations/:organization/:dataset/data', function(req){
|
|
289
|
+
return {
|
|
290
|
+
body: {
|
|
291
|
+
"page": {
|
|
292
|
+
"number": 26
|
|
293
|
+
},
|
|
294
|
+
"columns": [
|
|
295
|
+
"Coll Mobile ICC value",
|
|
296
|
+
"Coll Mobile ICC date",
|
|
297
|
+
"Prov Identifier",
|
|
298
|
+
"Coll manufacturer"
|
|
299
|
+
],
|
|
300
|
+
"data": [
|
|
301
|
+
[
|
|
302
|
+
"icc1",
|
|
303
|
+
"2021-04-06T12:35:22.784Z",
|
|
304
|
+
"MyDevice1",
|
|
305
|
+
"OpenGate"
|
|
306
|
+
],
|
|
307
|
+
[
|
|
308
|
+
"icc2",
|
|
309
|
+
"2021-04-06T07:45:57.468Z",
|
|
310
|
+
"MyDevice2",
|
|
311
|
+
"OpenGate"
|
|
312
|
+
]
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
statusCode: 200
|
|
316
|
+
};
|
|
317
|
+
});
|
|
318
|
+
mock.get(_options.url + '/datasets/provision/organizations/:organization', function(req) {
|
|
319
|
+
return {
|
|
320
|
+
body: {
|
|
321
|
+
datasets: [
|
|
322
|
+
{
|
|
323
|
+
name: 'dataset1',
|
|
324
|
+
identifier: '111',
|
|
325
|
+
description: 'mock',
|
|
326
|
+
type: 'CURRENT'
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'dataset2',
|
|
330
|
+
identifier: '2222',
|
|
331
|
+
description: 'mock',
|
|
332
|
+
type: 'HISTORY'
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
},
|
|
336
|
+
statusCode: 200
|
|
337
|
+
};
|
|
338
|
+
});
|
|
339
|
+
mock.get(_options.url + '/datasets/provision/organizations/:organization/:dataset', function(req) {
|
|
340
|
+
return {
|
|
341
|
+
body:
|
|
342
|
+
{
|
|
343
|
+
"name": "dataset_name",
|
|
344
|
+
"description": "My dataset to get inventory data",
|
|
345
|
+
"type": "CURRENT",
|
|
346
|
+
"columns": [
|
|
347
|
+
{
|
|
348
|
+
"path": "provision.device.identifier._current.value",
|
|
349
|
+
"name": "Prov identifier",
|
|
350
|
+
"filter": "YES",
|
|
351
|
+
"sort": true
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"path": "device.model._current.value.manufacturer",
|
|
355
|
+
"name": "Coll manufacturer",
|
|
356
|
+
"filter": "ALWAYS",
|
|
357
|
+
"sort": false
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"path": "device.communicationModules[0].subscriber.mobile.icc._current.value",
|
|
361
|
+
"name": "Coll Mobile ICC value",
|
|
362
|
+
"filter": "NO",
|
|
363
|
+
"sort": false
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"path": "device.communicationModules[0].subscriber.mobile.icc._current.at",
|
|
367
|
+
"name": "Coll Mobile ICC date",
|
|
368
|
+
"filter": "YES",
|
|
369
|
+
"sort": false
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
statusCode: 200
|
|
374
|
+
};
|
|
375
|
+
});
|
|
376
|
+
*/
|
|
377
|
+
}
|
|
327
378
|
|
|
379
|
+
_applyMocks (mocks) {
|
|
380
|
+
const methods = Object.keys(mocks).filter((method) => !_.isEmpty(mocks[method]))
|
|
381
|
+
methods.forEach(method => {
|
|
382
|
+
console.log(`Mocking ${method.toLocaleUpperCase()} requests`);
|
|
383
|
+
Object.keys(mocks[method]).forEach(url => {
|
|
384
|
+
console.log('Mocking url:', url);
|
|
385
|
+
console.log('Data returned:', mocks[method][url])
|
|
386
|
+
const methodByUrl = mocks[method][url]
|
|
387
|
+
mock[method](this._options.url + url, (req) => {
|
|
388
|
+
if(typeof methodByUrl === 'function'){
|
|
389
|
+
return methodByUrl(req)
|
|
390
|
+
} else{
|
|
391
|
+
const data = mocks[method][url]
|
|
392
|
+
if (!data.headers) data.headers = {}
|
|
393
|
+
return data
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
})
|
|
397
|
+
})
|
|
328
398
|
}
|
|
329
399
|
|
|
330
400
|
/**
|
|
@@ -449,6 +449,7 @@ export const IOT_FIELDS = {
|
|
|
449
449
|
"description": "areas.description",
|
|
450
450
|
"entities": "areas.entities",
|
|
451
451
|
"geometry": "areas.geometry",
|
|
452
|
+
"color": "areas.color",
|
|
452
453
|
"organization": "areas.organization"
|
|
453
454
|
}
|
|
454
455
|
},
|
|
@@ -489,6 +490,7 @@ export const IOT_FIELDS = {
|
|
|
489
490
|
"identifier": "bulks.identifier",
|
|
490
491
|
"provisionProcessorId": "bulks.provisionProcessorId",
|
|
491
492
|
"organization": "bulks.organization",
|
|
493
|
+
"userEmail": "bulks.request.userEmail",
|
|
492
494
|
"fileName": "bulks.request.fileName",
|
|
493
495
|
"headerAccept": "bulks.request.header.accept",
|
|
494
496
|
"contentType": "bulks.request.header.contentType",
|
|
@@ -511,7 +513,7 @@ export const IOT_FIELDS = {
|
|
|
511
513
|
"ENTITY_ALARM": {
|
|
512
514
|
"ENTITY_ALARM": {
|
|
513
515
|
"alarmId": "alarm.identifier",
|
|
514
|
-
"alarmSubEntityIdentifier": "alarm.subEntityIdentifier",
|
|
516
|
+
"alarmSubEntityIdentifier": "alarm.subEntityIdentifier",
|
|
515
517
|
"entityId": "alarm.entityIdentifier",
|
|
516
518
|
"entityType": "alarm.resourceType",
|
|
517
519
|
"organizationName": "alarm.organization",
|
|
@@ -519,11 +521,11 @@ export const IOT_FIELDS = {
|
|
|
519
521
|
"alarmRuleName": "alarm.rule",
|
|
520
522
|
"alarmName": "alarm.name",
|
|
521
523
|
"alarmSeverity": "alarm.severity",
|
|
522
|
-
"alarmPriority"
|
|
524
|
+
"alarmPriority": "alarm.priority",
|
|
523
525
|
"alarmDescription": "alarm.description",
|
|
524
526
|
"alarmStatus": "alarm.status",
|
|
525
527
|
"alarmOpenDate": "alarm.openingDate",
|
|
526
|
-
"alarmAttentionDate"
|
|
528
|
+
"alarmAttentionDate": "alarm.attentionDate",
|
|
527
529
|
"alarmAttentionUser": "alarm.attentionUser",
|
|
528
530
|
"alarmAttentionNote": "alarm.attentionNote",
|
|
529
531
|
"alarmClosureDate": "alarm.closureDate",
|