mftsccs-browser 2.1.88-beta → 2.1.90-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.
@@ -8975,8 +8975,10 @@ class LocalSyncData {
8975
8975
  }
8976
8976
  else if (Array.isArray(actions === null || actions === void 0 ? void 0 : actions.concepts) && Array.isArray(actions === null || actions === void 0 ? void 0 : actions.connections)) {
8977
8977
  // filter concepts from conceptsSyncArray and connectionSyncArray and sync only belonging to this tab
8978
+ console.log("this is the concepts and connections array", actions === null || actions === void 0 ? void 0 : actions.concepts, actions === null || actions === void 0 ? void 0 : actions.connections);
8978
8979
  conceptsArray = actions.concepts.filter(concept => this.conceptsSyncArray.some(con => concept.id == con.id || concept.ghostId == con.ghostId)).slice();
8979
8980
  connectionsArray = actions.connections.filter(connection => this.connectionSyncArray.some(conn => connection.id == conn.id || connection.ghostId == conn.ghostId)).slice();
8981
+ console.log("this is the concepts and connections array", conceptsArray, connectionsArray);
8980
8982
  // remove the concepts and connections from the array that belongs to the actions/tab
8981
8983
  this.conceptsSyncArray = this.conceptsSyncArray.filter(concept => !actions.concepts.some(con => concept.id == con.id || concept.ghostId == con.ghostId));
8982
8984
  this.connectionSyncArray = this.connectionSyncArray.filter(connection => !actions.connections.some(conn => connection.id == conn.id || connection.ghostId == conn.ghostId));
@@ -21800,10 +21802,15 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
21800
21802
  };
21801
21803
 
21802
21804
  function CreateData(json_1) {
21803
- return __awaiter(this, arguments, void 0, function* (json, ofConcept = null, typeConcept = "") {
21805
+ return __awaiter(this, arguments, void 0, function* (json, ofConcept = null, typeConcept = "", actions = { concepts: [], connections: [] }) {
21806
+ var _a, _b, _c, _d;
21804
21807
  if (_app__WEBPACK_IMPORTED_MODULE_0__.serviceWorker) {
21805
21808
  try {
21806
- const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.sendMessage)('CreateData', { json, ofConcept, typeConcept });
21809
+ const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.sendMessage)('CreateData', { json, ofConcept, typeConcept, actions });
21810
+ if ((_b = (_a = res === null || res === void 0 ? void 0 : res.actions) === null || _a === void 0 ? void 0 : _a.concepts) === null || _b === void 0 ? void 0 : _b.length)
21811
+ actions.concepts = JSON.parse(JSON.stringify(res.actions.concepts));
21812
+ if ((_d = (_c = res === null || res === void 0 ? void 0 : res.actions) === null || _c === void 0 ? void 0 : _c.connections) === null || _d === void 0 ? void 0 : _d.length)
21813
+ actions.connections = JSON.parse(JSON.stringify(res.actions.connections));
21807
21814
  return res.data;
21808
21815
  }
21809
21816
  catch (err) {
@@ -21816,50 +21823,44 @@ function CreateData(json_1) {
21816
21823
  let localSessionId = 999;
21817
21824
  let orderId = 1000;
21818
21825
  let MainConcept = (0,_app__WEBPACK_IMPORTED_MODULE_0__.CreateDefaultConcept)();
21819
- console.log("this is the json group 3 ", json);
21820
21826
  for (const key in json) {
21821
21827
  let prefixedKey = addPrefix(key);
21822
21828
  if ((typeof json[key] != 'string' && typeof json[key] != 'number')) {
21823
21829
  if (ofConcept == null || ofConcept.id == 0) {
21824
21830
  // let TypeConcept = await MakeTheTypeConceptLocal(prefixedKey, localSessionId, localUserId, localUserId);
21825
- let conceptString = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheInstanceConceptLocal)(prefixedKey, "", true, localUserId, localAccessId, localSessionId);
21831
+ let conceptString = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheInstanceConceptLocal)(prefixedKey, "", true, localUserId, localAccessId, localSessionId, undefined, actions);
21826
21832
  let concept = conceptString;
21827
21833
  MainConcept = concept;
21828
21834
  if (Array.isArray(json[key])) {
21829
21835
  prefixedKey = addArrayPrefix(prefixedKey);
21830
21836
  }
21831
- console.log("this is the json group 1", json[key], prefixedKey);
21832
- yield CreateData(json[key], MainConcept, prefixedKey);
21837
+ yield CreateData(json[key], MainConcept, prefixedKey, actions);
21833
21838
  }
21834
21839
  else {
21835
21840
  // remove this because we do not want this to be the type of the connection.
21836
21841
  if (Array.isArray(json[key])) {
21837
21842
  prefixedKey = removeArrayPrefix(prefixedKey);
21838
- console.log("this is the prefix", prefixedKey);
21839
21843
  }
21840
21844
  let withoutSKey = removeArrayPrefix(key);
21841
- let conceptString = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheInstanceConceptLocal)(prefixedKey, "", true, localUserId, localAccessId, localSessionId);
21845
+ let conceptString = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheInstanceConceptLocal)(prefixedKey, "", true, localUserId, localAccessId, localSessionId, undefined, actions);
21842
21846
  let concept = conceptString;
21843
21847
  MainConcept = concept;
21844
21848
  let typeConnectionString = createTypeString(typeConcept, withoutSKey);
21845
- let TypeConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheTypeConceptLocal)(typeConnectionString, localSessionId, localUserId, localUserId);
21846
- console.log("this is the type ", TypeConcept);
21847
- yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.CreateTheConnectionLocal)(ofConcept.id, concept.id, TypeConcept.id, orderId, TypeConcept.characterValue, localUserId);
21849
+ let TypeConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheTypeConceptLocal)(typeConnectionString, localSessionId, localUserId, localUserId, actions);
21850
+ yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.CreateTheConnectionLocal)(ofConcept.id, concept.id, TypeConcept.id, orderId, TypeConcept.characterValue, localUserId, actions);
21848
21851
  if (Array.isArray(json[key])) {
21849
21852
  prefixedKey = addArrayPrefix(prefixedKey);
21850
- console.log("this is the prefix after", prefixedKey);
21851
21853
  }
21852
- console.log("this is the json group 2", json[key], prefixedKey);
21853
- yield CreateData(json[key], concept, prefixedKey);
21854
+ yield CreateData(json[key], concept, prefixedKey, actions);
21854
21855
  }
21855
21856
  }
21856
21857
  else {
21857
21858
  let typeConnectionString = createTypeString(typeConcept, key);
21858
- let TypeConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheTypeConceptLocal)(typeConnectionString, localSessionId, localUserId, localUserId);
21859
- let conceptString = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheInstanceConceptLocal)(key, json[key].toString(), false, localUserId, localAccessId, localSessionId);
21859
+ let TypeConcept = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheTypeConceptLocal)(typeConnectionString, localSessionId, localUserId, localUserId, actions);
21860
+ let conceptString = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.MakeTheInstanceConceptLocal)(key, json[key].toString(), false, localUserId, localAccessId, localSessionId, undefined, actions);
21860
21861
  let concept = conceptString;
21861
21862
  if (ofConcept != null) {
21862
- yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.CreateTheConnectionLocal)(ofConcept.id, concept.id, TypeConcept.id, orderId, typeConnectionString, localUserId);
21863
+ yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.CreateTheConnectionLocal)(ofConcept.id, concept.id, TypeConcept.id, orderId, typeConnectionString, localUserId, actions);
21863
21864
  }
21864
21865
  }
21865
21866
  }
@@ -25335,6 +25336,7 @@ function init() {
25335
25336
  console.warn("Service Worker not supported in this browser.");
25336
25337
  return;
25337
25338
  }
25339
+ yield initializeCacheServer();
25338
25340
  listenPostMessagaes();
25339
25341
  listenBroadCastMessages();
25340
25342
  // check if manual service worker was activated
@@ -25936,44 +25938,48 @@ function checkIfExecutingProcess(messageId, type) {
25936
25938
  }
25937
25939
  });
25938
25940
  }
25939
- const myCacheServer = sessionStorage.getItem("myCacheServer");
25940
- function getCacheServer(data) {
25941
+ function initializeCacheServer() {
25941
25942
  return __awaiter(this, void 0, void 0, function* () {
25942
- try {
25943
- const response = yield fetch(_DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_99__.BaseUrl.getMyCacheServer(), {
25944
- method: "POST",
25945
- headers: {
25946
- "Content-Type": "application/json",
25947
- },
25948
- body: JSON.stringify({
25949
- "my-coords": data ? data.coords : "location denied",
25950
- }),
25943
+ const myCacheServer = sessionStorage.getItem("myCacheServer");
25944
+ function getCacheServer(data) {
25945
+ return __awaiter(this, void 0, void 0, function* () {
25946
+ try {
25947
+ const response = yield fetch(_DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_99__.BaseUrl.getMyCacheServer(), {
25948
+ method: "POST",
25949
+ headers: {
25950
+ "Content-Type": "application/json",
25951
+ },
25952
+ body: JSON.stringify({
25953
+ "my-coords": data ? data.coords : "location denied",
25954
+ }),
25955
+ });
25956
+ if (!response.ok) {
25957
+ throw new Error("Failed to sync data to the server.");
25958
+ }
25959
+ const cacheRes = yield response.json();
25960
+ if (cacheRes.success) {
25961
+ sessionStorage.setItem("myCacheServer", cacheRes.nearestServer);
25962
+ _DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_99__.BaseUrl.NODE_CACHE_URL = cacheRes.nearestServer;
25963
+ }
25964
+ }
25965
+ catch (error) {
25966
+ console.error("error getting cache server", error.message);
25967
+ }
25951
25968
  });
25952
- if (!response.ok) {
25953
- throw new Error("Failed to sync data to the server.");
25954
- }
25955
- const cacheRes = yield response.json();
25956
- if (cacheRes.success) {
25957
- sessionStorage.setItem("myCacheServer", cacheRes.nearestServer);
25958
- _DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_99__.BaseUrl.NODE_CACHE_URL = cacheRes.nearestServer;
25959
- }
25960
25969
  }
25961
- catch (error) {
25962
- console.error("error getting cache server", error.message);
25970
+ if (!myCacheServer) {
25971
+ navigator.geolocation.getCurrentPosition((data) => __awaiter(this, void 0, void 0, function* () {
25972
+ yield getCacheServer(data);
25973
+ }), (error) => __awaiter(this, void 0, void 0, function* () {
25974
+ if (error.code === error.PERMISSION_DENIED) {
25975
+ yield getCacheServer();
25976
+ }
25977
+ }));
25963
25978
  }
25964
- });
25965
- }
25966
- if (!myCacheServer) {
25967
- navigator.geolocation.getCurrentPosition((data) => __awaiter(void 0, void 0, void 0, function* () {
25968
- yield getCacheServer(data);
25969
- }), (error) => __awaiter(void 0, void 0, void 0, function* () {
25970
- if (error.code === error.PERMISSION_DENIED) {
25971
- yield getCacheServer();
25979
+ else {
25980
+ _DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_99__.BaseUrl.NODE_CACHE_URL = myCacheServer;
25972
25981
  }
25973
- }));
25974
- }
25975
- else {
25976
- _DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_99__.BaseUrl.NODE_CACHE_URL = myCacheServer;
25982
+ });
25977
25983
  }
25978
25984
 
25979
25985