mftsccs-browser 1.1.19-beta → 1.1.20-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.
@@ -1196,6 +1196,7 @@ __webpack_require__.r(__webpack_exports__);
1196
1196
  /* harmony import */ var _DataStructures_ConnectionData__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../DataStructures/ConnectionData */ "./src/DataStructures/ConnectionData.ts");
1197
1197
  /* harmony import */ var _DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../DataStructures/BaseUrl */ "./src/DataStructures/BaseUrl.ts");
1198
1198
  /* harmony import */ var _Services_Common_ErrorPosting__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Services/Common/ErrorPosting */ "./src/Services/Common/ErrorPosting.ts");
1199
+ /* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../app */ "./src/app.ts");
1199
1200
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1200
1201
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1201
1202
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -1208,8 +1209,14 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
1208
1209
 
1209
1210
 
1210
1211
 
1212
+
1211
1213
  function GetCompositionConnectionsBetweenTwoConcepts(ofConceptId, toConcept, mainKey) {
1212
1214
  return __awaiter(this, void 0, void 0, function* () {
1215
+ if (_app__WEBPACK_IMPORTED_MODULE_3__.serviceWorker) {
1216
+ const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_3__.sendMessage)('GetCompositionConnectionsBetweenTwoConcepts', { ofConceptId, toConcept, mainKey });
1217
+ console.log('data received from sw', res);
1218
+ return res.data;
1219
+ }
1213
1220
  var connectionList = [];
1214
1221
  try {
1215
1222
  var formdata = new FormData();
@@ -13201,6 +13208,11 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
13201
13208
  function GetConnectionBetweenTwoConceptsLinker(ofTheConcept_1, toTheConcept_1, linker_1, fullLinker_1) {
13202
13209
  return __awaiter(this, arguments, void 0, function* (ofTheConcept, toTheConcept, linker, fullLinker, forward = true) {
13203
13210
  var _a, _b;
13211
+ if (_app__WEBPACK_IMPORTED_MODULE_1__.serviceWorker) {
13212
+ const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_1__.sendMessage)('GetConnectionBetweenTwoConceptsLinker', { ofTheConcept, toTheConcept, linker, fullLinker, forward });
13213
+ console.log('data received from sw', res);
13214
+ return res.data;
13215
+ }
13204
13216
  let typeConcept = (0,_app__WEBPACK_IMPORTED_MODULE_1__.CreateDefaultConcept)();
13205
13217
  if (linker != "") {
13206
13218
  let typeLinker = "";
@@ -13383,7 +13395,6 @@ function GetLink(id_1, linker_1) {
13383
13395
  return __awaiter(this, arguments, void 0, function* (id, linker, inpage = 10, page = 1) {
13384
13396
  var _a;
13385
13397
  if (_app__WEBPACK_IMPORTED_MODULE_5__.serviceWorker) {
13386
- console.log('data receiving');
13387
13398
  const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_5__.sendMessage)('GetLink', { id, linker, inpage, page });
13388
13399
  console.log('data received from sw', res);
13389
13400
  return res.data;
@@ -15099,13 +15110,19 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
15099
15110
 
15100
15111
 
15101
15112
  // function to update the cache composition
15102
- function UpdateCompositionLocal(patcherStructure) {
15103
- return __awaiter(this, void 0, void 0, function* () {
15113
+ function UpdateCompositionLocal(patcherStructure_1) {
15114
+ return __awaiter(this, arguments, void 0, function* (patcherStructure, actions = { concepts: [], connections: [] }) {
15115
+ var _a, _b, _c, _d;
15104
15116
  if (_app__WEBPACK_IMPORTED_MODULE_7__.serviceWorker) {
15105
15117
  const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_7__.sendMessage)("UpdateCompositionLocal", {
15106
15118
  patcherStructure,
15119
+ actions
15107
15120
  });
15108
15121
  console.log("data received from sw", res);
15122
+ 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)
15123
+ actions.concepts = JSON.parse(JSON.stringify(res.actions.concepts));
15124
+ 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)
15125
+ actions.connections = JSON.parse(JSON.stringify(res.actions.connections));
15109
15126
  return res.data;
15110
15127
  }
15111
15128
  // get all the default userId, sessionId, accessId passed by the patcherStructure
@@ -15163,12 +15180,12 @@ function UpdateCompositionLocal(patcherStructure) {
15163
15180
  localConcept = parentConcept;
15164
15181
  }
15165
15182
  if (Array.isArray(value) || typeof value == "object") {
15166
- insertingConcept = yield (0,_MakeTheInstanceConceptLocal__WEBPACK_IMPORTED_MODULE_6__.MakeTheInstanceConceptLocal)(key, "", true, composition.userId, 4, 999);
15167
- yield (0,_CreateTheCompositionLocal__WEBPACK_IMPORTED_MODULE_5__.CreateTheCompositionLocal)(object[key], insertingConcept.id, insertingConcept.userId, composition.id, composition.userId, 4, 999);
15183
+ insertingConcept = yield (0,_MakeTheInstanceConceptLocal__WEBPACK_IMPORTED_MODULE_6__.MakeTheInstanceConceptLocal)(key, "", true, composition.userId, 4, 999, undefined, actions);
15184
+ yield (0,_CreateTheCompositionLocal__WEBPACK_IMPORTED_MODULE_5__.CreateTheCompositionLocal)(object[key], insertingConcept.id, insertingConcept.userId, composition.id, composition.userId, 4, 999, undefined, actions);
15168
15185
  }
15169
15186
  else {
15170
15187
  // make the new concept in the object
15171
- insertingConcept = yield (0,_MakeTheInstanceConceptLocal__WEBPACK_IMPORTED_MODULE_6__.MakeTheInstanceConceptLocal)(key, value, false, userId, accessId, sessionId);
15188
+ insertingConcept = yield (0,_MakeTheInstanceConceptLocal__WEBPACK_IMPORTED_MODULE_6__.MakeTheInstanceConceptLocal)(key, value, false, userId, accessId, sessionId, undefined, actions);
15172
15189
  }
15173
15190
  // check if the concept exists in the concept list because if it exists then we have to delete old connection
15174
15191
  const ExistingConcepts = (0,_Helpers_CheckIfExists__WEBPACK_IMPORTED_MODULE_1__.CheckIfTypeLConceptsExistsInArray)(conceptList, insertingConcept);
@@ -15181,7 +15198,7 @@ function UpdateCompositionLocal(patcherStructure) {
15181
15198
  }
15182
15199
  }
15183
15200
  // create the connection between the new concept and the old composition
15184
- const connectionString = yield (0,_app__WEBPACK_IMPORTED_MODULE_7__.CreateTheConnectionLocal)(localConcept.id, insertingConcept.id, composition.id, 2);
15201
+ const connectionString = yield (0,_app__WEBPACK_IMPORTED_MODULE_7__.CreateTheConnectionLocal)(localConcept.id, insertingConcept.id, composition.id, 2, undefined, undefined, actions);
15185
15202
  const connection = connectionString;
15186
15203
  conceptList.push(insertingConcept);
15187
15204
  }
@@ -15191,7 +15208,7 @@ function UpdateCompositionLocal(patcherStructure) {
15191
15208
  // delete the connection in the backend
15192
15209
  yield (0,_DeleteConnection__WEBPACK_IMPORTED_MODULE_4__.DeleteConnectionById)(toDeleteConnections[j].id);
15193
15210
  }
15194
- yield _app__WEBPACK_IMPORTED_MODULE_7__.LocalSyncData.SyncDataOnline();
15211
+ yield _app__WEBPACK_IMPORTED_MODULE_7__.LocalSyncData.SyncDataOnline(undefined, actions);
15195
15212
  });
15196
15213
  }
15197
15214
 
@@ -15491,6 +15508,11 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
15491
15508
 
15492
15509
  function MakeTheTimestamp(type_1, referent_1, userId_1) {
15493
15510
  return __awaiter(this, arguments, void 0, function* (type, referent, userId, accessId = 4, sessionInformationId = 999) {
15511
+ if (_app__WEBPACK_IMPORTED_MODULE_0__.serviceWorker) {
15512
+ const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_0__.sendMessage)('MakeTheTimestamp', { type, referent, userId, accessId, sessionInformationId });
15513
+ console.log('data received from sw', res);
15514
+ return res.data;
15515
+ }
15494
15516
  let categoryId = 4;
15495
15517
  let referentId = 0;
15496
15518
  // change this
@@ -16779,6 +16801,7 @@ __webpack_require__.r(__webpack_exports__);
16779
16801
  /* harmony import */ var _DataStructures_Composition_CompositionBinaryTree__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../DataStructures/Composition/CompositionBinaryTree */ "./src/DataStructures/Composition/CompositionBinaryTree.ts");
16780
16802
  /* harmony import */ var _DataStructures_Composition_Composition__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../DataStructures/Composition/Composition */ "./src/DataStructures/Composition/Composition.ts");
16781
16803
  /* harmony import */ var _Composition_CreateCompositionCache__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Composition/CreateCompositionCache */ "./src/Services/Composition/CreateCompositionCache.ts");
16804
+ /* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../app */ "./src/app.ts");
16782
16805
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
16783
16806
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16784
16807
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -16801,9 +16824,17 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
16801
16824
 
16802
16825
 
16803
16826
 
16827
+
16804
16828
  // function to update the cache composition
16805
16829
  function UpdateComposition(patcherStructure) {
16806
16830
  return __awaiter(this, void 0, void 0, function* () {
16831
+ if (_app__WEBPACK_IMPORTED_MODULE_13__.serviceWorker) {
16832
+ const res = yield (0,_app__WEBPACK_IMPORTED_MODULE_13__.sendMessage)("UpdateComposition", {
16833
+ patcherStructure,
16834
+ });
16835
+ console.log("data received from sw", res);
16836
+ return res.data;
16837
+ }
16807
16838
  // get all the default userId, sessionId, accessId passed by the patcherStructure
16808
16839
  const userId = patcherStructure.userId;
16809
16840
  const sessionId = patcherStructure.sessionId;
@@ -16869,7 +16900,7 @@ function UpdateComposition(patcherStructure) {
16869
16900
  if (parentConcept.id > 0) {
16870
16901
  localConcept = parentConcept;
16871
16902
  }
16872
- if (Array.isArray(value) || typeof value == 'object') {
16903
+ if (Array.isArray(value) || typeof value == "object") {
16873
16904
  insertingConcept = yield (0,_MakeTheInstanceConcept__WEBPACK_IMPORTED_MODULE_6__["default"])(key, "", true, composition.userId, 4, 999);
16874
16905
  compositionCache.subcompositions.push(insertingConcept.id);
16875
16906
  // check if the concept exists in the concept list because if it exists then we have to delete old connection
@@ -17621,7 +17652,6 @@ class DependencyObserver {
17621
17652
  * @param id Of the concept id that needs to be listened.
17622
17653
  */
17623
17654
  listenToEvent(id) {
17624
- console.log('listening to id: ', id);
17625
17655
  window.addEventListener(`${id}`, (event) => {
17626
17656
  if (!this.isUpdating) {
17627
17657
  this.isUpdating = true;
@@ -18298,9 +18328,8 @@ class RecursiveSearchObservable extends _app__WEBPACK_IMPORTED_MODULE_0__.Depend
18298
18328
  * @param id Of the concept id that needs to be listened.
18299
18329
  */
18300
18330
  listenToEvent(id) {
18301
- console.log("listening to id: ", id);
18302
18331
  window.addEventListener(`${id}`, (event) => {
18303
- console.log("this is listening after the event is fired", id, event);
18332
+ // console.log("this is listening after the event is fired", id, event);
18304
18333
  if (!this.isUpdating) {
18305
18334
  this.isUpdating = true;
18306
18335
  let that = this;
@@ -18940,6 +18969,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
18940
18969
 
18941
18970
  var serviceWorker;
18942
18971
  const TABID = Date.now().toString(36) + Math.random().toString(36).substring(2);
18972
+ let subscribedListeners = [];
18943
18973
  /**
18944
18974
  * This function lets you update the access token that the package uses. If this is not passed you cannot create, update, view or delete
18945
18975
  * Your concepts using this package.
@@ -19003,11 +19033,15 @@ function init() {
19003
19033
  // // isTest
19004
19034
  // // );
19005
19035
  // } else {
19036
+ // let serviceWorkerPath = enableSW.path ? enableSW.path : './serviceWorker.bundle.js'
19037
+ // if (enableSW.path && enableSW.path.slice(-1) == '/') serviceWorkerPath = enableSW.path + 'serviceWorker.bundle.js'
19038
+ // else if (enableSW.path && enableSW.path.length > 2 && !enableSW.path.includes('serviceWorker.bundle.js')) serviceWorkerPath = enableSW.path + './serviceWorker.bundle.js'
19006
19039
  yield new Promise((resolve, reject) => {
19040
+ var _a, _b;
19007
19041
  navigator.serviceWorker
19008
- .register("./serviceWorker.bundle.js", {
19042
+ .register((_a = enableSW.pathToSW) !== null && _a !== void 0 ? _a : "./serviceWorker.bundle.js", {
19009
19043
  // type: "module",
19010
- scope: enableSW.scope ? enableSW.scope : "/",
19044
+ scope: (_b = enableSW.scope) !== null && _b !== void 0 ? _b : "/",
19011
19045
  })
19012
19046
  .then((registration) => __awaiter(this, void 0, void 0, function* () {
19013
19047
  console.log("Service Worker registered:", registration);
@@ -19135,7 +19169,7 @@ function sendMessage(type, payload) {
19135
19169
  setTimeout(() => {
19136
19170
  reject("No response from service worker after timeout");
19137
19171
  navigator.serviceWorker.removeEventListener("message", responseHandler);
19138
- }, 5000);
19172
+ }, 10000);
19139
19173
  // })
19140
19174
  // .catch(err => reject(err))
19141
19175
  // .finally(() => console.log('finally'))
@@ -19154,7 +19188,16 @@ function dispatchIdEvent(id, data = {}) {
19154
19188
  _Constants_general_const__WEBPACK_IMPORTED_MODULE_100__.broadcastChannel.postMessage({ type: 'dispatchEvent', payload: { id } });
19155
19189
  }
19156
19190
  }
19157
- let subscribedListeners = [];
19191
+ // export function sendMessage(type: string, payload: any) {
19192
+ // return new Promise((resolve) => {
19193
+ // const responseHandler = (event: any) => {
19194
+ // resolve(event.data);
19195
+ // navigator.serviceWorker.removeEventListener("message", responseHandler);
19196
+ // };
19197
+ // navigator.serviceWorker.addEventListener("message", responseHandler);
19198
+ // navigator.serviceWorker.controller?.postMessage({ type, payload });
19199
+ // });
19200
+ // }
19158
19201
  // actions for message received on broadcast channel (specially from service worker)
19159
19202
  const broadcastActions = {
19160
19203
  GetLinkListener: (payload) => __awaiter(void 0, void 0, void 0, function* () {