mftsccs-browser 2.0.3-beta → 2.0.4-beta

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.
@@ -17371,6 +17371,7 @@ function publishMessage(topic, message) {
17371
17371
  __webpack_require__.r(__webpack_exports__);
17372
17372
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
17373
17373
  /* harmony export */ FormatFromConnectionsAlteredArrayExternal: () => (/* binding */ FormatFromConnectionsAlteredArrayExternal),
17374
+ /* harmony export */ FormatFunctionData: () => (/* binding */ FormatFunctionData),
17374
17375
  /* harmony export */ FormatFunctionDataForData: () => (/* binding */ FormatFunctionDataForData)
17375
17376
  /* harmony export */ });
17376
17377
  /* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../app */ "./src/app.ts");
@@ -17481,10 +17482,12 @@ function FormatFunctionDataForData(connections_1, compositionData_1) {
17481
17482
  let mytype = (_h = (_g = toTheConcept === null || toTheConcept === void 0 ? void 0 : toTheConcept.type) === null || _g === void 0 ? void 0 : _g.characterValue) !== null && _h !== void 0 ? _h : "none";
17482
17483
  let value = toTheConcept.characterValue;
17483
17484
  let dataCharacter = linkerConcept.characterValue;
17485
+ let isComp = false;
17484
17486
  // if there is not connection type defined then put the type of the destination concept.
17485
17487
  if (dataCharacter == "") {
17486
17488
  dataCharacter = mytype;
17487
17489
  dataCharacter = (0,_Common_RegexFunction__WEBPACK_IMPORTED_MODULE_1__.removeThePrefix)(dataCharacter);
17490
+ isComp = true;
17488
17491
  }
17489
17492
  let data = {
17490
17493
  "id": toTheConcept.id,
@@ -17492,14 +17495,19 @@ function FormatFunctionDataForData(connections_1, compositionData_1) {
17492
17495
  [mytype]: value
17493
17496
  }
17494
17497
  };
17495
- if (dataCharacter.includes("_s_")) {
17496
- // do nothing
17498
+ if (isNaN(Number(dataCharacter))) {
17499
+ if (dataCharacter.includes("_s_")) {
17500
+ // do nothing
17501
+ }
17502
+ else {
17503
+ if (typeof newData[key] == "string") {
17504
+ newData[key] = {};
17505
+ }
17506
+ newData[key][dataCharacter] = data;
17507
+ }
17497
17508
  }
17498
17509
  else {
17499
- if (typeof newData[key] == "string") {
17500
- newData[key] = {};
17501
- }
17502
- newData[key][dataCharacter] = data;
17510
+ newData[key] = [];
17503
17511
  }
17504
17512
  }
17505
17513
  catch (ex) {
@@ -17523,7 +17531,7 @@ function FormatFunctionDataForData(connections_1, compositionData_1) {
17523
17531
  */
17524
17532
  function FormatFromConnectionsAlteredArrayExternal(connections_1, compositionData_1, newCompositionData_1, mainComposition_1) {
17525
17533
  return __awaiter(this, arguments, void 0, function* (connections, compositionData, newCompositionData, mainComposition, reverse = []) {
17526
- var _a, _b, _c, _d;
17534
+ var _a, _b, _c, _d, _e, _f, _g;
17527
17535
  let startTime = new Date().getTime();
17528
17536
  let mainData = [];
17529
17537
  let myConcepts = [];
@@ -17614,23 +17622,43 @@ function FormatFromConnectionsAlteredArrayExternal(connections_1, compositionDat
17614
17622
  newData[key] = {};
17615
17623
  compositionData[connections[i].ofTheConceptId] = newData;
17616
17624
  }
17625
+ let isComp = true;
17626
+ let linkerConceptValue = linkerConcept.characterValue;
17627
+ if (linkerConceptValue == "") {
17628
+ linkerConceptValue = toTheConcept.characterValue;
17629
+ isComp = true;
17630
+ }
17631
+ if (linkerConceptValue == "") {
17632
+ linkerConceptValue = (_e = toTheConcept === null || toTheConcept === void 0 ? void 0 : toTheConcept.type) === null || _e === void 0 ? void 0 : _e.characterValue;
17633
+ }
17617
17634
  try {
17618
- let isComp = compositionData[connections[i].toTheConceptId];
17619
- if (isComp) {
17635
+ let mytype = (_g = (_f = toTheConcept === null || toTheConcept === void 0 ? void 0 : toTheConcept.type) === null || _f === void 0 ? void 0 : _f.characterValue) !== null && _g !== void 0 ? _g : "none";
17636
+ let myData = compositionData[connections[i].toTheConceptId];
17637
+ if (myData) {
17620
17638
  let data = {
17621
17639
  "id": toTheConcept.id,
17622
17640
  "data": compositionData[connections[i].toTheConceptId]
17623
17641
  };
17624
- if (Array.isArray(newData[key][linkerConcept.characterValue])) {
17625
- newData[key][linkerConcept.characterValue].push(data);
17642
+ if (Array.isArray(newData[key])) {
17643
+ if (isComp) {
17644
+ newData[key].push(myData);
17645
+ }
17646
+ else {
17647
+ newData[key].push(myData);
17648
+ }
17626
17649
  }
17627
17650
  else {
17628
- if (linkerConcept.characterValue.includes("_s_")) {
17629
- newData[key][linkerConcept.characterValue] = [];
17651
+ if (Array.isArray(newData[key][linkerConceptValue])) {
17630
17652
  newData[key][linkerConcept.characterValue].push(data);
17631
17653
  }
17632
17654
  else {
17633
- newData[key][linkerConcept.characterValue] = data;
17655
+ if (linkerConceptValue.includes("_s_")) {
17656
+ newData[key][linkerConceptValue] = [];
17657
+ newData[key][linkerConceptValue].push(data);
17658
+ }
17659
+ else {
17660
+ newData[key][linkerConceptValue] = data;
17661
+ }
17634
17662
  }
17635
17663
  }
17636
17664
  }
@@ -17651,6 +17679,97 @@ function FormatFromConnectionsAlteredArrayExternal(connections_1, compositionDat
17651
17679
  return mainData;
17652
17680
  });
17653
17681
  }
17682
+ /**
17683
+ * ## Format DATA-ID ##
17684
+ * this function takes in connections and creates a single level objects so that all the data are added to its object/ array.
17685
+ * This is then passed on further for stiching.
17686
+ * @param connections
17687
+ * @param compositionData
17688
+ * @param reverse
17689
+ * @returns
17690
+ */
17691
+ function FormatFunctionData(connections_1, compositionData_1) {
17692
+ return __awaiter(this, arguments, void 0, function* (connections, compositionData, reverse = []) {
17693
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17694
+ let myConcepts = [];
17695
+ for (let i = 0; i < connections.length; i++) {
17696
+ myConcepts.push(connections[i].toTheConceptId);
17697
+ myConcepts.push(connections[i].ofTheConceptId);
17698
+ myConcepts.push(connections[i].typeId);
17699
+ }
17700
+ connections.sort(function (x, y) {
17701
+ return y.id - x.id;
17702
+ });
17703
+ for (let i = 0; i < connections.length; i++) {
17704
+ let reverseFlag = false;
17705
+ let ofTheConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.GetTheConcept)(connections[i].ofTheConceptId);
17706
+ let toTheConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.GetTheConcept)(connections[i].toTheConceptId);
17707
+ if (reverse.includes(connections[i].id)) {
17708
+ reverseFlag = true;
17709
+ }
17710
+ if (reverseFlag == true) {
17711
+ if (ofTheConcept.id != 0 && toTheConcept.id != 0) {
17712
+ let newData;
17713
+ let linkerConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.GetTheConcept)(connections[i].typeId);
17714
+ let key = (_b = (_a = toTheConcept.type) === null || _a === void 0 ? void 0 : _a.characterValue) !== null && _b !== void 0 ? _b : "self";
17715
+ if (connections[i].toTheConceptId in compositionData) {
17716
+ newData = compositionData[connections[i].toTheConceptId];
17717
+ }
17718
+ else {
17719
+ newData = {};
17720
+ newData[key] = {};
17721
+ compositionData[connections[i].toTheConceptId] = newData;
17722
+ }
17723
+ try {
17724
+ let mytype = (_d = (_c = ofTheConcept === null || ofTheConcept === void 0 ? void 0 : ofTheConcept.type) === null || _c === void 0 ? void 0 : _c.characterValue) !== null && _d !== void 0 ? _d : "none";
17725
+ let value = ofTheConcept.characterValue;
17726
+ let reverseCharater = linkerConcept.characterValue + "_reverse";
17727
+ if (reverseCharater.includes("_s_")) {
17728
+ if (!(ofTheConcept.id in compositionData)) {
17729
+ compositionData[ofTheConcept.id] = {};
17730
+ }
17731
+ compositionData[ofTheConcept.id][mytype] = value;
17732
+ }
17733
+ compositionData[toTheConcept.id] = {};
17734
+ }
17735
+ catch (ex) {
17736
+ console.log("this is error", ex);
17737
+ }
17738
+ }
17739
+ }
17740
+ else {
17741
+ if (ofTheConcept.id != 0 && toTheConcept.id != 0) {
17742
+ let newData;
17743
+ let linkerConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.GetTheConcept)(connections[i].typeId);
17744
+ let key = (_f = (_e = ofTheConcept.type) === null || _e === void 0 ? void 0 : _e.characterValue) !== null && _f !== void 0 ? _f : "self";
17745
+ if (connections[i].ofTheConceptId in compositionData) {
17746
+ newData = compositionData[connections[i].ofTheConceptId];
17747
+ }
17748
+ else {
17749
+ newData = {};
17750
+ newData[key] = {};
17751
+ compositionData[connections[i].ofTheConceptId] = newData;
17752
+ }
17753
+ try {
17754
+ let mytype = (_h = (_g = toTheConcept === null || toTheConcept === void 0 ? void 0 : toTheConcept.type) === null || _g === void 0 ? void 0 : _g.characterValue) !== null && _h !== void 0 ? _h : "none";
17755
+ let value = toTheConcept.characterValue;
17756
+ if (linkerConcept.characterValue.includes("_s_")) {
17757
+ if (!(toTheConcept.id in compositionData)) {
17758
+ compositionData[toTheConcept.id] = {};
17759
+ }
17760
+ compositionData[toTheConcept.id][mytype] = value;
17761
+ }
17762
+ compositionData[ofTheConcept.id] = {};
17763
+ }
17764
+ catch (ex) {
17765
+ console.log("this is error", ex);
17766
+ }
17767
+ }
17768
+ }
17769
+ }
17770
+ return compositionData;
17771
+ });
17772
+ }
17654
17773
 
17655
17774
 
17656
17775
  /***/ }),
@@ -19205,8 +19324,9 @@ function formatConnectionsDataId(linkers, conceptIds, mainCompositionIds, revers
19205
19324
  let prefetchConnections = yield (0,_GetCompositionBulk__WEBPACK_IMPORTED_MODULE_1__.GetConnectionDataPrefetch)(linkers);
19206
19325
  let compositionData = [];
19207
19326
  let newCompositionData = [];
19208
- compositionData = yield (0,_FormatData__WEBPACK_IMPORTED_MODULE_2__.FormatFunctionData)(prefetchConnections, compositionData, reverse);
19327
+ compositionData = yield (0,_DataIdFormat__WEBPACK_IMPORTED_MODULE_5__.FormatFunctionData)(prefetchConnections, compositionData, reverse);
19209
19328
  compositionData = yield (0,_DataIdFormat__WEBPACK_IMPORTED_MODULE_5__.FormatFunctionDataForData)(prefetchConnections, compositionData, reverse);
19329
+ console.log("this is the composition data", compositionData);
19210
19330
  let output = yield (0,_DataIdFormat__WEBPACK_IMPORTED_MODULE_5__.FormatFromConnectionsAlteredArrayExternal)(prefetchConnections, compositionData, newCompositionData, mainCompositionIds, reverse);
19211
19331
  return output;
19212
19332
  });