opengate-js 16.0.0 → 16.1.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.
- package/README.md +66 -11
- package/dist/{opengate-api-bower-16.0.0.js → opengate-api-bower-16.1.0.js} +4384 -19744
- package/dist/opengate-api-bower-16.1.0.js.map +6 -0
- package/dist/opengate-api-bower-16.1.0.min.js +123 -0
- package/dist/opengate-api-bower-16.1.0.min.js.map +6 -0
- package/dist/opengate-api-npm.mjs +37 -26
- package/dist/opengate-api-npm.mjs.map +2 -2
- package/dist/src/provision/country/CountriesCatalog.js +2 -2
- package/dist/src/provision/country/CountriesCatalog.js.map +2 -2
- package/dist/src/provision/entities/BulkBuilder.js +18 -4
- package/dist/src/provision/entities/BulkBuilder.js.map +1 -1
- package/dist/src/provision/entities/DeviceBuilder.js +2 -2
- package/dist/src/provision/entities/DeviceBuilder.js.map +2 -2
- package/dist/src/provision/entities/EntityBuilder.js +2 -2
- package/dist/src/provision/entities/EntityBuilder.js.map +2 -2
- package/dist/src/searching/builder/BasicTypesSearchBuilder.js +22 -11
- package/dist/src/searching/builder/BasicTypesSearchBuilder.js.map +2 -2
- package/package.json +3 -3
- package/src/provision/country/CountriesCatalog.js +2 -2
- package/src/provision/entities/BulkBuilder.js +4 -3
- package/src/provision/entities/DeviceBuilder.js +2 -2
- package/src/provision/entities/EntityBuilder.js +2 -2
- package/src/searching/builder/BasicTypesSearchBuilder.js +22 -11
- package/types/src/provision/entities/BulkBuilder.d.ts +1 -1
- package/dist/opengate-api-bower-16.0.0.js.map +0 -6
- package/dist/opengate-api-bower-16.0.0.min.js +0 -231
- package/dist/opengate-api-bower-16.0.0.min.js.map +0 -6
|
@@ -12248,8 +12248,7 @@ var FieldsDefinitionSearchBuilder = class extends SearchBuilder {
|
|
|
12248
12248
|
|
|
12249
12249
|
// src/searching/builder/BasicTypesSearchBuilder.js
|
|
12250
12250
|
import q28 from "q";
|
|
12251
|
-
import
|
|
12252
|
-
import jp from "jsonpath";
|
|
12251
|
+
import { JSONPath } from "jsonpath-plus";
|
|
12253
12252
|
var BasicTypesSearchBuilder = class {
|
|
12254
12253
|
/**
|
|
12255
12254
|
* Constructor
|
|
@@ -12308,18 +12307,30 @@ var BasicTypesSearchBuilder = class {
|
|
|
12308
12307
|
var resultQuery = response.body;
|
|
12309
12308
|
let statusCode = response.statusCode;
|
|
12310
12309
|
this._og_basic_types = resultQuery;
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
nodes.forEach((element) => {
|
|
12317
|
-
var pathExpression = jp.stringify(element.path);
|
|
12318
|
-
jp.value(resultQuery, pathExpression, element.value);
|
|
12310
|
+
let maxDepth = 10;
|
|
12311
|
+
var nodes = JSONPath({
|
|
12312
|
+
path: "$..['$ref']",
|
|
12313
|
+
json: this._og_basic_types,
|
|
12314
|
+
resultType: "all"
|
|
12319
12315
|
});
|
|
12316
|
+
while (nodes.length > 0 && maxDepth-- > 0) {
|
|
12317
|
+
nodes.forEach((element) => {
|
|
12318
|
+
let newPath = "$.." + element.value.replace("#/definitions/", "");
|
|
12319
|
+
var newValue = JSONPath({ path: newPath, json: resultQuery });
|
|
12320
|
+
if (element.parent && element.parentProperty && newValue && newValue[0]) {
|
|
12321
|
+
delete element.parent[element.parentProperty];
|
|
12322
|
+
Object.assign(element.parent, JSON.parse(JSON.stringify(newValue[0])));
|
|
12323
|
+
}
|
|
12324
|
+
});
|
|
12325
|
+
nodes = JSONPath({
|
|
12326
|
+
path: "$..['$ref']",
|
|
12327
|
+
json: this._og_basic_types,
|
|
12328
|
+
resultType: "all"
|
|
12329
|
+
});
|
|
12330
|
+
}
|
|
12320
12331
|
if (this.path) {
|
|
12321
12332
|
let path = this.path.includes("$") ? this.path : "$.." + this.path;
|
|
12322
|
-
let jsonSchemaValue =
|
|
12333
|
+
let jsonSchemaValue = JSONPath({ path, json: resultQuery })[0] || {
|
|
12323
12334
|
msg: "not Found"
|
|
12324
12335
|
};
|
|
12325
12336
|
defered.resolve({
|
|
@@ -12628,7 +12639,7 @@ var RulesSearchBuilder = class extends SearchBuilder {
|
|
|
12628
12639
|
};
|
|
12629
12640
|
|
|
12630
12641
|
// src/searching/SearchWithoutLimit.js
|
|
12631
|
-
import
|
|
12642
|
+
import merge10 from "merge";
|
|
12632
12643
|
var SearchWithoutLimit = class extends BaseSearch {
|
|
12633
12644
|
/**
|
|
12634
12645
|
* @param {!InternalOpenGateAPI} ogapi - this is configuration about Opengate North API.
|
|
@@ -12643,9 +12654,9 @@ var SearchWithoutLimit = class extends BaseSearch {
|
|
|
12643
12654
|
constructor(ogapi, url, filter, sort, group, select, timeout, urlParams) {
|
|
12644
12655
|
super(ogapi, "search" + url, timeout);
|
|
12645
12656
|
this._setUrlParameters(urlParams);
|
|
12646
|
-
this._postObj =
|
|
12657
|
+
this._postObj = merge10(filter, group, select);
|
|
12647
12658
|
if (typeof sort === "object") {
|
|
12648
|
-
this._postObj =
|
|
12659
|
+
this._postObj = merge10(this._postObj, sort);
|
|
12649
12660
|
}
|
|
12650
12661
|
}
|
|
12651
12662
|
_filter() {
|
|
@@ -16782,7 +16793,7 @@ var Qrating = class {
|
|
|
16782
16793
|
|
|
16783
16794
|
// src/provision/entities/EntityBuilder.js
|
|
16784
16795
|
import q38 from "q";
|
|
16785
|
-
import
|
|
16796
|
+
import { JSONPath as JSONPath3 } from "jsonpath-plus";
|
|
16786
16797
|
import Ajv3 from "ajv";
|
|
16787
16798
|
|
|
16788
16799
|
// src/provision/entities/SimpleBuilder.js
|
|
@@ -17257,7 +17268,7 @@ var SubscriptionBuilder = class extends SimpleBuilder {
|
|
|
17257
17268
|
// src/provision/entities/DeviceBuilder.js
|
|
17258
17269
|
import HttpStatus12 from "http-status-codes";
|
|
17259
17270
|
import q36 from "q";
|
|
17260
|
-
import
|
|
17271
|
+
import { JSONPath as JSONPath2 } from "jsonpath-plus";
|
|
17261
17272
|
var ID = "provision.device.identifier";
|
|
17262
17273
|
var BoxBuilder = class {
|
|
17263
17274
|
constructor(ogapi, obj, url, key, urlParameters, timeout) {
|
|
@@ -17444,7 +17455,7 @@ var BoxBuilder = class {
|
|
|
17444
17455
|
}
|
|
17445
17456
|
}).catch((errores) => {
|
|
17446
17457
|
if (errores.statusCode === HttpStatus12.BAD_REQUEST) {
|
|
17447
|
-
let ms =
|
|
17458
|
+
let ms = JSONPath2({ path: "$..message", json: errores })[0];
|
|
17448
17459
|
if (ms.includes("Entity duplicated")) {
|
|
17449
17460
|
defer.reject({
|
|
17450
17461
|
errors: errores.data.errors,
|
|
@@ -17844,7 +17855,7 @@ var BulkBuilder = class extends BaseProvision {
|
|
|
17844
17855
|
* @param {boolean} [csv_response] - true if you want a response on format csv. False or null if you want a response on format json
|
|
17845
17856
|
*/
|
|
17846
17857
|
deleteAll(rawFile, csv_response) {
|
|
17847
|
-
return this._executeOperation(rawFile, "DELETE
|
|
17858
|
+
return this._executeOperation(rawFile, "DELETE", csv_response, { full: true });
|
|
17848
17859
|
}
|
|
17849
17860
|
/**
|
|
17850
17861
|
* Execute the bulk update operation
|
|
@@ -17868,7 +17879,7 @@ var BulkBuilder = class extends BaseProvision {
|
|
|
17868
17879
|
patch(rawFile, csv_response) {
|
|
17869
17880
|
return this._executeOperation(rawFile, "PATCH", csv_response);
|
|
17870
17881
|
}
|
|
17871
|
-
_executeOperation(rawFile, action, csv_response) {
|
|
17882
|
+
_executeOperation(rawFile, action, csv_response, extraParams) {
|
|
17872
17883
|
let form;
|
|
17873
17884
|
if (typeof rawFile !== "string") {
|
|
17874
17885
|
form = {};
|
|
@@ -17889,9 +17900,9 @@ var BulkBuilder = class extends BaseProvision {
|
|
|
17889
17900
|
this._setExtraHeaders({
|
|
17890
17901
|
accept: "text/plain"
|
|
17891
17902
|
});
|
|
17892
|
-
this._setUrlParameters({
|
|
17903
|
+
this._setUrlParameters(__spreadValues({
|
|
17893
17904
|
action
|
|
17894
|
-
});
|
|
17905
|
+
}, extraParams || {}));
|
|
17895
17906
|
this._ogapi.Napi.post_multipart(petitionUrl, form, {}, this._timeout, this._getExtraHeaders(), this._getUrlParameters()).then((response) => {
|
|
17896
17907
|
let statusCode = response.statusCode;
|
|
17897
17908
|
if (statusCode === 200 || statusCode === 201) {
|
|
@@ -18069,7 +18080,7 @@ var EntityBuilder = class {
|
|
|
18069
18080
|
}
|
|
18070
18081
|
_setDevicesProperties(data, filter) {
|
|
18071
18082
|
let _this = this;
|
|
18072
|
-
let allowedDatastreams =
|
|
18083
|
+
let allowedDatastreams = JSONPath3({ path: "$.datamodels[*].categories[*].datastreams[?(@.calculated === false)]", json: data });
|
|
18073
18084
|
let response = {
|
|
18074
18085
|
allowedDatastreams: [],
|
|
18075
18086
|
schemas: {}
|
|
@@ -23466,7 +23477,7 @@ var Pipeline = class extends BaseProvision {
|
|
|
23466
23477
|
};
|
|
23467
23478
|
|
|
23468
23479
|
// src/provision/country/CountriesCatalog.js
|
|
23469
|
-
import
|
|
23480
|
+
import { JSONPath as JSONPath4 } from "jsonpath-plus";
|
|
23470
23481
|
import q49 from "q";
|
|
23471
23482
|
import HttpStatus16 from "http-status-codes";
|
|
23472
23483
|
var CountriesCatalog = class extends ProvisionGenericFinder {
|
|
@@ -23509,7 +23520,7 @@ var CountriesCatalog = class extends ProvisionGenericFinder {
|
|
|
23509
23520
|
statusCode: HttpStatus16.NOT_FOUND
|
|
23510
23521
|
});
|
|
23511
23522
|
} else {
|
|
23512
|
-
var data = (
|
|
23523
|
+
var data = (JSONPath4({ path: "$." + _this.__filter.ds + "._current.value", json: req.body }) || [])[0];
|
|
23513
23524
|
defered.resolve({
|
|
23514
23525
|
data,
|
|
23515
23526
|
statusCode: req.statusCode
|
|
@@ -24959,7 +24970,7 @@ var InternalOpenGateAPI = class _InternalOpenGateAPI {
|
|
|
24959
24970
|
};
|
|
24960
24971
|
|
|
24961
24972
|
// src/util/NorthAmpliaREST.js
|
|
24962
|
-
import
|
|
24973
|
+
import merge11 from "merge";
|
|
24963
24974
|
import urlencode from "urlencode";
|
|
24964
24975
|
import q50 from "q";
|
|
24965
24976
|
import _8 from "lodash";
|
|
@@ -24974,7 +24985,7 @@ var NorthAmpliaREST = class {
|
|
|
24974
24985
|
* @param {function} backend - this is a backend selected to manage a request to Opengate North API.
|
|
24975
24986
|
*/
|
|
24976
24987
|
constructor(_options, headers) {
|
|
24977
|
-
this._options =
|
|
24988
|
+
this._options = merge11.recursive(true, this.default(), _options);
|
|
24978
24989
|
this._headers = headers;
|
|
24979
24990
|
if (!_8.isEmpty(_options.mocks)) {
|
|
24980
24991
|
this._applyMocks(_options.mocks);
|