@itentialopensource/adapter-utils 4.45.7 → 4.46.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/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ ## 4.46.0 [07-27-2022]
3
+
4
+ * Added code to skip split string on dot for special cases
5
+
6
+ Closes ADAPT-2266
7
+
8
+ See merge request itentialopensource/adapter-utils!234
9
+
10
+ ---
11
+
2
12
  ## 4.45.7 [07-25-2022]
3
13
 
4
14
  * Fix issue on no token where it takes exception
@@ -247,6 +247,7 @@ function extractObject(dataObj, entitySchema, dynamicFields) {
247
247
  log.trace(origin);
248
248
  const returnObj = {};
249
249
  let addFields = dynamicFields;
250
+ const regex = /(?<!\\)\./gm;
250
251
 
251
252
  // if no translation needed - just return the object
252
253
  if (Object.hasOwnProperty.call(entitySchema, 'translate')
@@ -278,7 +279,7 @@ function extractObject(dataObj, entitySchema, dynamicFields) {
278
279
  // if the external name is something get that field
279
280
  if (field.external_name) {
280
281
  // need to determine the field in the incoming object where the data is
281
- const externalPath = field.external_name.split('.');
282
+ const externalPath = field.external_name.split(regex).map((e) => (e.replace(/\\./g, '.')));
282
283
  let location = dataObj;
283
284
  let inField = null;
284
285
 
@@ -349,7 +350,7 @@ function extractObject(dataObj, entitySchema, dynamicFields) {
349
350
  // if the field is not in the schema - we need to add it
350
351
  // using the field name that came in since no translation
351
352
  if (field.external_name) {
352
- const externalPath = field.external_name.split('.');
353
+ const externalPath = field.external_name.split(regex).map((e) => (e.replace(/\\./g, '.')));
353
354
 
354
355
  if (externalPath[externalPath.length - 1] === objectKeys[o]) {
355
356
  found = true;
@@ -488,7 +489,7 @@ function extractJSONEntity(dataObj, entitySchema) {
488
489
  function buildObject(dataObj, entitySchema, dynamicFields) {
489
490
  const origin = `${id}-translatorUtil-buildObject`;
490
491
  log.trace(origin);
491
-
492
+ const regex = /(?<!\\)\./gm;
492
493
  const returnObj = {};
493
494
  let addFields = dynamicFields;
494
495
 
@@ -531,7 +532,7 @@ function buildObject(dataObj, entitySchema, dynamicFields) {
531
532
  // if in the data object, add to the system entity
532
533
  if (fieldValue !== null) {
533
534
  // need to determine the field in the object where the data should go
534
- const externalPath = field.external_name.split('.');
535
+ const externalPath = field.external_name.split(regex).map((e) => (e.replace(/\\./g, '.')));
535
536
  let location = returnObj;
536
537
 
537
538
  // get to the field in the object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "4.45.7",
3
+ "version": "4.46.0",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",