mftsccs-browser 1.1.2 → 1.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.
package/dist/bundle.js CHANGED
@@ -4949,6 +4949,80 @@ class ConnectionOfTheTree {
4949
4949
  ConnectionOfTheTree.node = null;
4950
4950
 
4951
4951
 
4952
+ /***/ }),
4953
+
4954
+ /***/ "./src/DataStructures/ConnectionBinaryTree/ConnectionTypeNode.ts":
4955
+ /*!***********************************************************************!*\
4956
+ !*** ./src/DataStructures/ConnectionBinaryTree/ConnectionTypeNode.ts ***!
4957
+ \***********************************************************************/
4958
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4959
+
4960
+ __webpack_require__.r(__webpack_exports__);
4961
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4962
+ /* harmony export */ ConnectionTypeNode: () => (/* binding */ ConnectionTypeNode)
4963
+ /* harmony export */ });
4964
+ /* harmony import */ var _NodePrimitive__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NodePrimitive */ "./src/DataStructures/ConnectionBinaryTree/NodePrimitive.ts");
4965
+
4966
+ class ConnectionTypeNode extends _NodePrimitive__WEBPACK_IMPORTED_MODULE_0__.NodePrimitive {
4967
+ constructor(key, value, leftNode, rightNode) {
4968
+ super(key, value, leftNode, rightNode);
4969
+ this.key = "";
4970
+ this.value = [];
4971
+ this.height = 1;
4972
+ this.key = key;
4973
+ this.value = value;
4974
+ this.leftNode = leftNode;
4975
+ this.rightNode = rightNode;
4976
+ }
4977
+ addNode(passedNode, node, height) {
4978
+ if (node == null) {
4979
+ node = passedNode;
4980
+ return node;
4981
+ }
4982
+ let LeftNode = node.leftNode;
4983
+ let RightNode = node.rightNode;
4984
+ if (node.key > passedNode.key) {
4985
+ node.leftNode = this.addNode(passedNode, LeftNode, height);
4986
+ }
4987
+ else if (node.key < passedNode.key) {
4988
+ node.rightNode = this.addNode(passedNode, RightNode, height);
4989
+ }
4990
+ else {
4991
+ return node;
4992
+ }
4993
+ node.height = 1 + Math.max(this.getHeight(node.leftNode), this.getHeight(node.rightNode));
4994
+ let balancingFactor = this.getBalanceFactor(node);
4995
+ if (balancingFactor > 1) {
4996
+ if (node.leftNode) {
4997
+ if (passedNode.key < node.leftNode.key) {
4998
+ let returner = this.rightRotate(node);
4999
+ return returner;
5000
+ }
5001
+ else if (passedNode.key > node.leftNode.key) {
5002
+ node.leftNode = this.leftRotate(node.leftNode);
5003
+ let returner = this.rightRotate(node);
5004
+ return returner;
5005
+ }
5006
+ }
5007
+ }
5008
+ if (balancingFactor < -1) {
5009
+ if (node.rightNode) {
5010
+ if (passedNode.key > node.rightNode.key) {
5011
+ let returner = this.leftRotate(node);
5012
+ return returner;
5013
+ }
5014
+ else if (passedNode.key < node.rightNode.key) {
5015
+ node.rightNode = this.rightRotate(node.rightNode);
5016
+ let returner = this.leftRotate(node);
5017
+ return returner;
5018
+ }
5019
+ }
5020
+ }
5021
+ return node;
5022
+ }
5023
+ }
5024
+
5025
+
4952
5026
  /***/ }),
4953
5027
 
4954
5028
  /***/ "./src/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.ts":
@@ -4961,8 +5035,7 @@ __webpack_require__.r(__webpack_exports__);
4961
5035
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4962
5036
  /* harmony export */ ConnectionTypeTree: () => (/* binding */ ConnectionTypeTree)
4963
5037
  /* harmony export */ });
4964
- /* harmony import */ var _IdentifierFlags__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../IdentifierFlags */ "./src/DataStructures/IdentifierFlags.ts");
4965
- /* harmony import */ var _ConnectionNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ConnectionNode */ "./src/DataStructures/ConnectionBinaryTree/ConnectionNode.ts");
5038
+ /* harmony import */ var _ConnectionTypeNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ConnectionTypeNode */ "./src/DataStructures/ConnectionBinaryTree/ConnectionTypeNode.ts");
4966
5039
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
4967
5040
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4968
5041
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -4973,92 +5046,90 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
4973
5046
  });
4974
5047
  };
4975
5048
 
4976
-
4977
5049
  class ConnectionTypeTree {
4978
- static addNodeToTree(node) {
5050
+ static CreateCompositionKey(typeId) {
5051
+ return typeId;
5052
+ }
5053
+ /**
5054
+ * This is a function to add the connectionNode to the existing tree
5055
+ * @param connectionOfNode This is the node that needs to be added to the tree.
5056
+ * @returns ConnectionOfNode
5057
+ */
5058
+ static addNodeToTree(connectionOfNode) {
4979
5059
  return __awaiter(this, void 0, void 0, function* () {
4980
5060
  if (this.connectionTypeRoot == null) {
4981
- this.connectionTypeRoot = node;
5061
+ this.connectionTypeRoot = connectionOfNode;
4982
5062
  return this.connectionTypeRoot;
4983
5063
  }
4984
5064
  else {
4985
- this.connectionTypeRoot = this.connectionTypeRoot.addTypeNode(node, this.connectionTypeRoot, this.connectionTypeRoot.height);
5065
+ this.connectionTypeRoot = this.connectionTypeRoot.addNode(connectionOfNode, this.connectionTypeRoot, this.connectionTypeRoot.height);
4986
5066
  }
4987
5067
  return this.connectionTypeRoot;
4988
5068
  });
4989
5069
  }
4990
- static waitForDataToLoad() {
4991
- return __awaiter(this, void 0, void 0, function* () {
4992
- return new Promise((resolve, reject) => {
4993
- this.checkFlag(resolve);
4994
- setTimeout(() => {
4995
- reject("not");
4996
- }, 25000);
4997
- });
4998
- });
4999
- }
5000
- static checkFlag(resolve) {
5001
- if (_IdentifierFlags__WEBPACK_IMPORTED_MODULE_0__.IdentifierFlags.isConnectionTypeLoaded) {
5002
- return resolve("done");
5003
- }
5004
- else {
5005
- setTimeout(ConnectionTypeTree.checkFlag, 1000, resolve);
5006
- }
5007
- }
5008
- ;
5070
+ /**
5071
+ * This function lets you add a connection by composite key with of the concept id and type id.
5072
+ * This function checks if the connection already exists and then updates in the case that it does not
5073
+ * If the connection of the concept id and type id combination is encountered first time then a node is created.
5074
+ * @param connection connection that needs to be added.
5075
+ */
5009
5076
  static addConnectionToTree(connection) {
5010
- if (connection.typeId != 0) {
5011
- let node = new _ConnectionNode__WEBPACK_IMPORTED_MODULE_1__.ConnectionNode(connection.typeId, connection, null, null);
5012
- this.addNodeToTree(node);
5077
+ if (connection.id > 0) {
5078
+ let key = this.CreateCompositionKey(connection.typeId);
5079
+ if (this.connectionTypeRoot) {
5080
+ // let event = new Event(`${key}`);
5081
+ // // console.log("dispatched the of the concecpt event", event);
5082
+ // dispatchEvent(event);
5083
+ let existingNode = this.connectionTypeRoot.getFromNode(key, this.connectionTypeRoot);
5084
+ if (existingNode) {
5085
+ let connectionList = existingNode === null || existingNode === void 0 ? void 0 : existingNode.value;
5086
+ if (connectionList.length == 0) {
5087
+ existingNode.value = [];
5088
+ }
5089
+ if (!connectionList.includes(connection.id)) {
5090
+ connectionList.push(connection.id);
5091
+ }
5092
+ }
5093
+ else {
5094
+ let list = [];
5095
+ list.push(connection.id);
5096
+ let connectionNode = new _ConnectionTypeNode__WEBPACK_IMPORTED_MODULE_0__.ConnectionTypeNode(key, list, null, null);
5097
+ this.addNodeToTree(connectionNode);
5098
+ }
5099
+ }
5100
+ else {
5101
+ let list = [];
5102
+ list.push(connection.id);
5103
+ let connectionNode = new _ConnectionTypeNode__WEBPACK_IMPORTED_MODULE_0__.ConnectionTypeNode(key, list, null, null);
5104
+ this.addNodeToTree(connectionNode);
5105
+ }
5013
5106
  }
5014
- }
5015
- static removeTypeConcept(typeId, id) {
5016
- if (this.connectionTypeRoot) {
5017
- this.connectionTypeRoot = this.connectionTypeRoot.removeNodeWithVariants(this.connectionTypeRoot, typeId, id);
5107
+ else {
5108
+ console.log("cannot insert key id with n 0 to the connection tree", connection);
5018
5109
  }
5019
5110
  }
5020
- static getNodeFromTree(id) {
5111
+ // static async removeNodeFromTree(id:number){
5112
+ // if(this.connectionTypeRoot){
5113
+ // this.connectionTypeRoot = this.connectionTypeRoot.removeNode(this.connectionTypeRoot,id);
5114
+ // }
5115
+ // }
5116
+ // commented
5117
+ // static getNodeFromTree(id:number){
5118
+ // if(this.connectionTypeRoot){
5119
+ // let Node = this.connectionTypeRoot.getFromNode(id, this.connectionTypeRoot);
5120
+ // return Node;
5121
+ // }
5122
+ // return this.connectionTypeRoot;
5123
+ // }
5124
+ static GetConnectionByOfTheConceptAndTypeId(ofTheConceptId) {
5125
+ let key = this.CreateCompositionKey(ofTheConceptId);
5021
5126
  if (this.connectionTypeRoot) {
5022
- let Node = this.connectionTypeRoot.getFromNode(id, this.connectionTypeRoot);
5023
- return Node;
5024
- }
5025
- return this.connectionTypeRoot;
5026
- }
5027
- static getTypeVariantsFromTree(typeId) {
5028
- return __awaiter(this, void 0, void 0, function* () {
5029
- let connection = [];
5030
- // try{
5031
- // let data = await this.waitForDataToLoad();
5032
- // }
5033
- // catch(exception){
5034
- // return connection;
5035
- // }
5036
- let Node = this.getNodeFromTree(typeId);
5037
- if (Node) {
5038
- connection.push(Node === null || Node === void 0 ? void 0 : Node.value);
5039
- for (let i = 0; i < Node.variants.length; i++) {
5040
- connection.push(Node.variants[i].value);
5041
- }
5042
- return connection;
5043
- }
5044
- });
5045
- }
5046
- static getTypeVariantsFromTreeWithUserId(typeId, userId) {
5047
- return __awaiter(this, void 0, void 0, function* () {
5048
- var concepts = [];
5049
- var Node = this.getNodeFromTree(typeId);
5050
- if (Node) {
5051
- if (Node.value.userId == userId) {
5052
- concepts.push(Node === null || Node === void 0 ? void 0 : Node.value);
5053
- }
5054
- for (let i = 0; i < Node.variants.length; i++) {
5055
- if (Node.variants[i].value.userId == userId) {
5056
- concepts.push(Node.variants[i].value);
5057
- }
5058
- }
5127
+ let existingNode = this.connectionTypeRoot.getFromNode(key, this.connectionTypeRoot);
5128
+ if (existingNode) {
5129
+ return existingNode.value;
5059
5130
  }
5060
- return concepts;
5061
- });
5131
+ }
5132
+ return null;
5062
5133
  }
5063
5134
  }
5064
5135
  ConnectionTypeTree.connectionTypeRoot = null;
@@ -5277,7 +5348,7 @@ class ConnectionData {
5277
5348
  if (connection.id != 0) {
5278
5349
  (0,_Database_indexeddb__WEBPACK_IMPORTED_MODULE_0__.removeFromDatabase)("connection", connection.id);
5279
5350
  _ConnectionBinaryTree_ConnectionBinaryTree__WEBPACK_IMPORTED_MODULE_2__.ConnectionBinaryTree.removeNodeFromTree(connection.id);
5280
- _ConnectionBinaryTree_ConnectionTypeTree__WEBPACK_IMPORTED_MODULE_4__.ConnectionTypeTree.removeTypeConcept(connection.typeId, connection.id);
5351
+ // ConnectionTypeTree.removeTypeConcept(connection.typeId, connection.id);
5281
5352
  _ConnectionBinaryTree_ConnectionOfTheTree__WEBPACK_IMPORTED_MODULE_3__.ConnectionOfTheTree.removeNodeFromTree(connection.id);
5282
5353
  }
5283
5354
  }
@@ -5333,28 +5404,31 @@ class ConnectionData {
5333
5404
  return myConnection;
5334
5405
  });
5335
5406
  }
5407
+ // commented
5336
5408
  static GetConnectionsOfCompositionLocal(id) {
5337
5409
  return __awaiter(this, void 0, void 0, function* () {
5338
5410
  let connections = [];
5339
- let node = yield _ConnectionBinaryTree_ConnectionTypeTree__WEBPACK_IMPORTED_MODULE_4__.ConnectionTypeTree.getNodeFromTree(id);
5340
- if (node === null || node === void 0 ? void 0 : node.value) {
5341
- let returnedConnection = node.value;
5342
- if (returnedConnection) {
5343
- let myConnection = returnedConnection;
5344
- connections.push(myConnection);
5345
- for (let i = 0; i < node.variants.length; i++) {
5346
- connections.push(node.variants[i].value);
5347
- }
5411
+ let connectionIds = [];
5412
+ connectionIds = _ConnectionBinaryTree_ConnectionTypeTree__WEBPACK_IMPORTED_MODULE_4__.ConnectionTypeTree.GetConnectionByOfTheConceptAndTypeId(id);
5413
+ for (let i = 0; i < connectionIds.length; i++) {
5414
+ let conn = yield _ConnectionBinaryTree_ConnectionBinaryTree__WEBPACK_IMPORTED_MODULE_2__.ConnectionBinaryTree.getNodeFromTree(connectionIds[i]);
5415
+ if (conn) {
5416
+ connections.push(conn.value);
5348
5417
  }
5349
5418
  }
5350
- // if(myConcept.id == 0 || myConcept == null){
5351
- // for(var i=0; i<this.conceptsArray.length; i++){
5352
- // if(this.conceptsArray[i].id == id){
5353
- // myConcept = this.conceptsArray[i];
5419
+ return connections;
5420
+ //let node = await ConnectionTypeTree.getNodeFromTree(id);
5421
+ // if(node?.value){
5422
+ // let returnedConnection = node.value;
5423
+ // if(returnedConnection){
5424
+ // let myConnection = returnedConnection as Connection;
5425
+ // connections.push(myConnection);
5426
+ // for(let i=0; i<node.variants.length;i++){
5427
+ // connections.push(node.variants[i].value);
5354
5428
  // }
5355
5429
  // }
5356
5430
  // }
5357
- return connections;
5431
+ //return connections;
5358
5432
  });
5359
5433
  }
5360
5434
  static GetConnectionsOfConcept(id) {
@@ -10917,8 +10991,7 @@ __webpack_require__.r(__webpack_exports__);
10917
10991
  /* harmony export */ });
10918
10992
  /* harmony import */ var _Api_DeleteTheConnection__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Api/DeleteTheConnection */ "./src/Api/DeleteTheConnection.ts");
10919
10993
  /* harmony import */ var _DataStructures_ConnectionBinaryTree_ConnectionBinaryTree__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../DataStructures/ConnectionBinaryTree/ConnectionBinaryTree */ "./src/DataStructures/ConnectionBinaryTree/ConnectionBinaryTree.ts");
10920
- /* harmony import */ var _DataStructures_ConnectionBinaryTree_ConnectionTypeTree__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DataStructures/ConnectionBinaryTree/ConnectionTypeTree */ "./src/DataStructures/ConnectionBinaryTree/ConnectionTypeTree.ts");
10921
- /* harmony import */ var _GetConnections__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GetConnections */ "./src/Services/GetConnections.ts");
10994
+ /* harmony import */ var _GetConnections__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GetConnections */ "./src/Services/GetConnections.ts");
10922
10995
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
10923
10996
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10924
10997
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10931,14 +11004,13 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
10931
11004
 
10932
11005
 
10933
11006
 
10934
-
10935
11007
  function DeleteConnectionById(id) {
10936
11008
  return __awaiter(this, void 0, void 0, function* () {
10937
- let connection = yield (0,_GetConnections__WEBPACK_IMPORTED_MODULE_3__.GetConnectionById)(id);
11009
+ let connection = yield (0,_GetConnections__WEBPACK_IMPORTED_MODULE_2__.GetConnectionById)(id);
10938
11010
  yield (0,_Api_DeleteTheConnection__WEBPACK_IMPORTED_MODULE_0__["default"])(id);
10939
11011
  //removeFromDatabase("connection",id);
10940
11012
  _DataStructures_ConnectionBinaryTree_ConnectionBinaryTree__WEBPACK_IMPORTED_MODULE_1__.ConnectionBinaryTree.removeNodeFromTree(id);
10941
- _DataStructures_ConnectionBinaryTree_ConnectionTypeTree__WEBPACK_IMPORTED_MODULE_2__.ConnectionTypeTree.removeTypeConcept(connection.typeId, id);
11013
+ //ConnectionTypeTree.removeTypeConcept(connection.typeId,id);
10942
11014
  });
10943
11015
  }
10944
11016
 
@@ -11273,8 +11345,8 @@ function GetCompositionFromMemory(id) {
11273
11345
  var _a, _b;
11274
11346
  let connectionList = [];
11275
11347
  let returnOutput = {};
11276
- connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfConcept(id);
11277
- //connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);
11348
+ //connectionList = await ConnectionData.GetConnectionsOfConcept(id);
11349
+ connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfCompositionLocal(id);
11278
11350
  //connectionList = ConnectionData.GetConnectionsOfComposition(id);
11279
11351
  let compositionList = [];
11280
11352
  for (let i = 0; i < connectionList.length; i++) {
@@ -11306,8 +11378,8 @@ function GetCompositionFromMemoryNormal(id) {
11306
11378
  var _a, _b;
11307
11379
  let connectionList = [];
11308
11380
  let returnOutput = {};
11309
- connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfConcept(id);
11310
- //connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);
11381
+ //connectionList = await ConnectionData.GetConnectionsOfConcept(id);
11382
+ connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfCompositionLocal(id);
11311
11383
  //connectionList = ConnectionData.GetConnectionsOfComposition(id);
11312
11384
  let compositionList = [];
11313
11385
  console.log("this is the connection list that you build", connectionList);
@@ -11339,8 +11411,8 @@ function GetCompositionWithIdFromMemory(id) {
11339
11411
  var _a, _b;
11340
11412
  let connectionList = [];
11341
11413
  let returnOutput = {};
11342
- connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfConcept(id);
11343
- //connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);
11414
+ // connectionList = await ConnectionData.GetConnectionsOfConcept(id);
11415
+ connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfCompositionLocal(id);
11344
11416
  let compositionList = [];
11345
11417
  for (let i = 0; i < connectionList.length; i++) {
11346
11418
  if (!compositionList.includes(connectionList[i].ofTheConceptId)) {
@@ -11376,8 +11448,8 @@ function GetCompositionWithIdFromMemoryNew(id) {
11376
11448
  var _a, _b;
11377
11449
  let connectionList = [];
11378
11450
  let returnOutput = {};
11379
- connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfConcept(id);
11380
- // connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);
11451
+ //connectionList = await ConnectionData.GetConnectionsOfConcept(id);
11452
+ connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfCompositionLocal(id);
11381
11453
  let compositionList = [];
11382
11454
  for (let i = 0; i < connectionList.length; i++) {
11383
11455
  if (!compositionList.includes(connectionList[i].ofTheConceptId)) {
@@ -11415,8 +11487,8 @@ function GetCompositionWithIdAndDateFromMemory(id) {
11415
11487
  var _a, _b;
11416
11488
  let connectionList = [];
11417
11489
  let returnOutput = {};
11418
- //connectionList = await ConnectionData.GetConnectionsOfCompositionLocal(id);
11419
- connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfConcept(id);
11490
+ connectionList = yield _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_3__.ConnectionData.GetConnectionsOfCompositionLocal(id);
11491
+ //connectionList = await ConnectionData.GetConnectionsOfConcept(id);
11420
11492
  let compositionList = [];
11421
11493
  for (let i = 0; i < connectionList.length; i++) {
11422
11494
  if (!compositionList.includes(connectionList[i].ofTheConceptId)) {