mftsccs-browser 1.1.29-beta → 1.1.31-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.
- package/dist/main.bundle.js +194 -78
- package/dist/main.bundle.js.map +1 -1
- package/dist/serviceWorker.bundle.js +196 -81
- package/dist/serviceWorker.bundle.js.map +1 -1
- package/dist/types/Api/Create/CreateTheGhostConceptApi.d.ts +1 -4
- package/dist/types/Widgets/BuilderStatefulWidget.d.ts +1 -1
- package/package.json +1 -1
package/dist/main.bundle.js
CHANGED
|
@@ -475,46 +475,128 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
475
475
|
|
|
476
476
|
function CreateTheGhostConceptApi(conceptData, connectionData) {
|
|
477
477
|
return __awaiter(this, void 0, void 0, function* () {
|
|
478
|
-
let result = {
|
|
479
|
-
"concepts": [],
|
|
480
|
-
"connections": []
|
|
481
|
-
};
|
|
482
478
|
try {
|
|
483
|
-
const
|
|
484
|
-
let
|
|
485
|
-
"concepts":
|
|
486
|
-
"connections":
|
|
479
|
+
const CHUNK_SIZE = 1000;
|
|
480
|
+
let result = {
|
|
481
|
+
"concepts": [],
|
|
482
|
+
"connections": []
|
|
487
483
|
};
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
//
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
484
|
+
// strip data
|
|
485
|
+
const stripedConcept = yield stripTypeFromConceptOrConnection(conceptData);
|
|
486
|
+
const stripedConnection = yield stripTypeFromConceptOrConnection(connectionData);
|
|
487
|
+
// sync all in one request if data is less
|
|
488
|
+
if (conceptData.length + connectionData.length <= (CHUNK_SIZE * 2)) {
|
|
489
|
+
const response = yield syncConceptConnection(stripedConcept, stripedConnection);
|
|
490
|
+
if (Array.isArray(response === null || response === void 0 ? void 0 : response.concepts))
|
|
491
|
+
result.concepts = [...result.concepts, ...response.concepts];
|
|
492
|
+
if (Array.isArray(response === null || response === void 0 ? void 0 : response.connections))
|
|
493
|
+
result.connections = [...result.connections, ...response.connections];
|
|
494
|
+
return result;
|
|
495
|
+
}
|
|
496
|
+
// split data
|
|
497
|
+
const splittedConcepts = chunkArrayByItemCount(stripedConcept, CHUNK_SIZE);
|
|
498
|
+
const splittedConnections = chunkArrayByItemCount(stripedConnection, CHUNK_SIZE);
|
|
499
|
+
const syncConceptPromises = [];
|
|
500
|
+
const syncConnectionPromises = [];
|
|
501
|
+
// sync concept
|
|
502
|
+
for (let i = 0; i < splittedConcepts.length; i++) {
|
|
503
|
+
const concepts = splittedConcepts[i];
|
|
504
|
+
syncConceptPromises.push(syncConceptConnection(concepts, []));
|
|
505
|
+
}
|
|
506
|
+
const conceptResponses = yield Promise.all(syncConceptPromises);
|
|
507
|
+
for (let i = 0; i < conceptResponses.length; i++) {
|
|
508
|
+
const conceptsRes = conceptResponses[i];
|
|
509
|
+
if (Array.isArray(conceptsRes === null || conceptsRes === void 0 ? void 0 : conceptsRes.concepts))
|
|
510
|
+
result.concepts = [...result.concepts, ...conceptsRes.concepts];
|
|
511
|
+
if (Array.isArray(conceptsRes === null || conceptsRes === void 0 ? void 0 : conceptsRes.connections))
|
|
512
|
+
result.connections = [...result.connections, ...conceptsRes.connections];
|
|
513
|
+
}
|
|
514
|
+
// sync connection
|
|
515
|
+
for (let i = 0; i < splittedConnections.length; i++) {
|
|
516
|
+
const connections = splittedConnections[i];
|
|
517
|
+
syncConnectionPromises.push(syncConceptConnection([], connections));
|
|
518
|
+
}
|
|
519
|
+
const connectionResponses = yield Promise.all(syncConnectionPromises);
|
|
520
|
+
for (let i = 0; i < connectionResponses.length; i++) {
|
|
521
|
+
const connectionsRes = connectionResponses[i];
|
|
522
|
+
if (Array.isArray(connectionsRes === null || connectionsRes === void 0 ? void 0 : connectionsRes.concepts))
|
|
523
|
+
result.concepts = [...result.concepts, ...connectionsRes.concepts];
|
|
524
|
+
if (Array.isArray(connectionsRes === null || connectionsRes === void 0 ? void 0 : connectionsRes.connections))
|
|
525
|
+
result.connections = [...result.connections, ...connectionsRes.connections];
|
|
501
526
|
}
|
|
502
|
-
const resultString = yield response.json();
|
|
503
|
-
result.concepts = resultString.concepts;
|
|
504
|
-
result.connections = resultString.connections;
|
|
505
527
|
return result;
|
|
506
528
|
}
|
|
507
529
|
catch (error) {
|
|
508
|
-
|
|
509
|
-
console.log('Create the concept api error message: ', error.message);
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
console.log('Create the concept api unexpected error: ', error);
|
|
513
|
-
}
|
|
530
|
+
console.log(error);
|
|
514
531
|
throw error;
|
|
515
532
|
}
|
|
516
533
|
});
|
|
517
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
*
|
|
537
|
+
* @param concepts Concept[]
|
|
538
|
+
* @param connections Connection[]
|
|
539
|
+
* @returns Promise<{concepts: [], connections: []}>
|
|
540
|
+
*/
|
|
541
|
+
const syncConceptConnection = (concepts, connections) => __awaiter(void 0, void 0, void 0, function* () {
|
|
542
|
+
let result = {
|
|
543
|
+
"concepts": [],
|
|
544
|
+
"connections": []
|
|
545
|
+
};
|
|
546
|
+
try {
|
|
547
|
+
const myHeaders = new Headers();
|
|
548
|
+
let myBody = {
|
|
549
|
+
"concepts": concepts,
|
|
550
|
+
"connections": connections
|
|
551
|
+
};
|
|
552
|
+
myHeaders.set("Content-Type", "application/json");
|
|
553
|
+
myHeaders.set('Authorization', "Bearer " + _DataStructures_Security_TokenStorage__WEBPACK_IMPORTED_MODULE_1__.TokenStorage.BearerAccessToken);
|
|
554
|
+
myHeaders.set('Accept', 'application/json');
|
|
555
|
+
// myHeaders.set('Randomizer', BaseUrl.BASE_RANDOMIZER.toString());
|
|
556
|
+
myHeaders.set('Randomizer', _DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_0__.BaseUrl.getRandomizer().toString());
|
|
557
|
+
const response = yield fetch(_DataStructures_BaseUrl__WEBPACK_IMPORTED_MODULE_0__.BaseUrl.CreateGhostConceptApiUrl(), {
|
|
558
|
+
method: 'POST',
|
|
559
|
+
headers: myHeaders,
|
|
560
|
+
body: JSON.stringify(myBody),
|
|
561
|
+
});
|
|
562
|
+
if (!response.ok) {
|
|
563
|
+
(0,_Services_Common_ErrorPosting__WEBPACK_IMPORTED_MODULE_2__.HandleHttpError)(response);
|
|
564
|
+
throw new Error(`Error! status: ${response.status}`);
|
|
565
|
+
}
|
|
566
|
+
const resultString = yield response.json();
|
|
567
|
+
result.concepts = resultString.concepts;
|
|
568
|
+
result.connections = resultString.connections;
|
|
569
|
+
return result;
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
if (error instanceof Error) {
|
|
573
|
+
console.log('Create the concept api error message: ', error.message);
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
console.log('Create the concept api unexpected error: ', error);
|
|
577
|
+
}
|
|
578
|
+
throw error;
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
// Function to split an array into chunks of 1024 items (500KB per chunk)
|
|
582
|
+
function chunkArrayByItemCount(array, itemsPerChunk) {
|
|
583
|
+
const chunks = [];
|
|
584
|
+
for (let i = 0; i < array.length; i += itemsPerChunk) {
|
|
585
|
+
const chunk = array.slice(i, i + itemsPerChunk); // Slice the array into smaller chunks
|
|
586
|
+
chunks.push(chunk);
|
|
587
|
+
}
|
|
588
|
+
return chunks;
|
|
589
|
+
}
|
|
590
|
+
// method to strip type object from concept or connection
|
|
591
|
+
const stripTypeFromConceptOrConnection = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (items = []) {
|
|
592
|
+
return yield Promise.all(items.map(item => {
|
|
593
|
+
let newItem = JSON.parse(JSON.stringify(item));
|
|
594
|
+
delete newItem.type;
|
|
595
|
+
delete newItem.ofConcept;
|
|
596
|
+
delete newItem.toConcept;
|
|
597
|
+
return newItem;
|
|
598
|
+
}));
|
|
599
|
+
});
|
|
518
600
|
|
|
519
601
|
|
|
520
602
|
/***/ }),
|
|
@@ -9872,7 +9954,7 @@ function storeToDatabase(databaseName, object) {
|
|
|
9872
9954
|
*/
|
|
9873
9955
|
function UpdateToDatabase(databaseName, object) {
|
|
9874
9956
|
return new Promise(function (resolve, reject) {
|
|
9875
|
-
console.log("this is wriring to the database local", object);
|
|
9957
|
+
// console.log("this is wriring to the database local", object);
|
|
9876
9958
|
openDatabase(databaseName).then((db) => {
|
|
9877
9959
|
let transaction = db.transaction(databaseName, "readwrite");
|
|
9878
9960
|
let objStore = transaction.objectStore(databaseName);
|
|
@@ -10126,7 +10208,7 @@ function storeToDatabase(databaseName, object) {
|
|
|
10126
10208
|
*/
|
|
10127
10209
|
function UpdateToDatabase(databaseName, object) {
|
|
10128
10210
|
return new Promise(function (resolve, reject) {
|
|
10129
|
-
console.log("this is wriring to the database", object);
|
|
10211
|
+
// console.log("this is wriring to the database", object);
|
|
10130
10212
|
openDatabase(databaseName).then((db) => {
|
|
10131
10213
|
let transaction = db.transaction(databaseName, "readwrite");
|
|
10132
10214
|
let objStore = transaction.objectStore(databaseName);
|
|
@@ -14364,7 +14446,7 @@ function CreateTheConceptLocal(referent_1, typecharacter_1, userId_1, categoryId
|
|
|
14364
14446
|
}
|
|
14365
14447
|
//let id = -Math.floor(Math.random() * 100000000);
|
|
14366
14448
|
let id = yield _DataStructures_Local_LocalId__WEBPACK_IMPORTED_MODULE_3__.LocalId.getConceptId();
|
|
14367
|
-
console.log("this is the getting id type connection", id);
|
|
14449
|
+
// console.log("this is the getting id type connection", id);
|
|
14368
14450
|
let isNew = true;
|
|
14369
14451
|
let created_on = new Date();
|
|
14370
14452
|
let updated_on = new Date();
|
|
@@ -18390,22 +18472,39 @@ class BuilderStatefulWidget extends _StatefulWidget__WEBPACK_IMPORTED_MODULE_0__
|
|
|
18390
18472
|
* This function will be called after the component mounts.
|
|
18391
18473
|
*/
|
|
18392
18474
|
componentDidMount() {
|
|
18393
|
-
return __awaiter(this,
|
|
18475
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18394
18476
|
//console.log("onmountVal", onmountVal);
|
|
18395
|
-
const
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18477
|
+
const dynamicAsyncFunction = new Function("tsccs", `
|
|
18478
|
+
return (async function() {
|
|
18479
|
+
${this.addEventFunction}
|
|
18480
|
+
}).call(this);
|
|
18481
|
+
`).bind(this);
|
|
18482
|
+
dynamicAsyncFunction(_app__WEBPACK_IMPORTED_MODULE_1__);
|
|
18483
|
+
// dynamicAsyncFunction(tsccs);
|
|
18484
|
+
// const AsyncFunction = Object.getPrototypeOf(
|
|
18485
|
+
// async function () {}
|
|
18486
|
+
// ).constructor;
|
|
18487
|
+
// const renderOnmount = AsyncFunction(
|
|
18488
|
+
// "tsccs",
|
|
18489
|
+
// this.componentDidMountFunction
|
|
18490
|
+
// );
|
|
18491
|
+
// renderOnmount.call(this, tsccs);
|
|
18400
18492
|
});
|
|
18401
18493
|
}
|
|
18402
18494
|
addEvents() {
|
|
18403
18495
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18404
|
-
const AsyncFunction = Object.getPrototypeOf(
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
const
|
|
18408
|
-
|
|
18496
|
+
// const AsyncFunction = Object.getPrototypeOf(
|
|
18497
|
+
// async function () {}
|
|
18498
|
+
// ).constructor;
|
|
18499
|
+
const dynamicAsyncFunction = new Function("tsccs", `
|
|
18500
|
+
return (async function() {
|
|
18501
|
+
${this.addEventFunction}
|
|
18502
|
+
}).call(this);
|
|
18503
|
+
`).bind(this);
|
|
18504
|
+
console.log("This is the async function", dynamicAsyncFunction);
|
|
18505
|
+
dynamicAsyncFunction(_app__WEBPACK_IMPORTED_MODULE_1__);
|
|
18506
|
+
// const renderOnmount = AsyncFunction("tsccs", this.addEventFunction);
|
|
18507
|
+
// renderOnmount.call(this, tsccs);
|
|
18409
18508
|
});
|
|
18410
18509
|
}
|
|
18411
18510
|
getWidgetClassFunction(widgetId) {
|
|
@@ -20171,6 +20270,7 @@ function init() {
|
|
|
20171
20270
|
// else if (enableSW.path && enableSW.path.length > 2 && !enableSW.path.includes('serviceWorker.bundle.js')) serviceWorkerPath = enableSW.path + './serviceWorker.bundle.js'
|
|
20172
20271
|
yield new Promise((resolve, reject) => {
|
|
20173
20272
|
var _a, _b;
|
|
20273
|
+
let success = false;
|
|
20174
20274
|
navigator.serviceWorker
|
|
20175
20275
|
.register((_a = enableSW.pathToSW) !== null && _a !== void 0 ? _a : "./serviceWorker.bundle.js", {
|
|
20176
20276
|
// type: "module",
|
|
@@ -20193,43 +20293,59 @@ function init() {
|
|
|
20193
20293
|
resolve();
|
|
20194
20294
|
}
|
|
20195
20295
|
else {
|
|
20196
|
-
let success = false;
|
|
20197
|
-
// Listen for updates to the service worker
|
|
20198
|
-
console.log("update listen start");
|
|
20199
|
-
registration.onupdatefound = () => {
|
|
20200
|
-
const newWorker = registration.installing;
|
|
20201
|
-
console.log("new worker", newWorker);
|
|
20202
|
-
if (newWorker) {
|
|
20203
|
-
newWorker.onstatechange = () => __awaiter(this, void 0, void 0, function* () {
|
|
20204
|
-
console.log("on state change triggered");
|
|
20205
|
-
// if (newWorker.state === 'activated' && navigator.serviceWorker.controller) {
|
|
20206
|
-
if (newWorker.state === "activated" || newWorker.state === 'redundant') {
|
|
20207
|
-
// && navigator.serviceWorker.controller) {
|
|
20208
|
-
console.log("New Service Worker is active", registration);
|
|
20209
|
-
serviceWorker = newWorker;
|
|
20210
|
-
// serviceWorker = registration.active;
|
|
20211
|
-
// Send init message now that it's active
|
|
20212
|
-
yield sendMessage("init", {
|
|
20213
|
-
url,
|
|
20214
|
-
aiurl,
|
|
20215
|
-
accessToken,
|
|
20216
|
-
nodeUrl,
|
|
20217
|
-
enableAi,
|
|
20218
|
-
applicationName,
|
|
20219
|
-
isTest,
|
|
20220
|
-
});
|
|
20221
|
-
success = true;
|
|
20222
|
-
resolve();
|
|
20223
|
-
}
|
|
20224
|
-
});
|
|
20225
|
-
}
|
|
20226
|
-
};
|
|
20227
20296
|
// Handle if on state change didn't trigger
|
|
20228
20297
|
setTimeout(() => {
|
|
20229
20298
|
if (!success)
|
|
20230
20299
|
reject("Not Completed Initialization");
|
|
20231
|
-
},
|
|
20300
|
+
}, 5000);
|
|
20232
20301
|
}
|
|
20302
|
+
// Listen for updates to the service worker
|
|
20303
|
+
console.log("update listen start");
|
|
20304
|
+
registration.onupdatefound = () => {
|
|
20305
|
+
const newWorker = registration.installing;
|
|
20306
|
+
console.log("new worker", newWorker);
|
|
20307
|
+
if (newWorker) {
|
|
20308
|
+
newWorker.onstatechange = () => __awaiter(this, void 0, void 0, function* () {
|
|
20309
|
+
console.log("on state change triggered");
|
|
20310
|
+
// if (newWorker.state === 'activated' && navigator.serviceWorker.controller) {
|
|
20311
|
+
if ((newWorker.state === "installed" || newWorker.state === "activated" || newWorker.state === 'redundant') && navigator.serviceWorker.controller) {
|
|
20312
|
+
// && navigator.serviceWorker.controller) {
|
|
20313
|
+
console.log("New Service Worker is active", registration);
|
|
20314
|
+
serviceWorker = newWorker;
|
|
20315
|
+
// serviceWorker = registration.active;
|
|
20316
|
+
// Send init message now that it's active
|
|
20317
|
+
yield sendMessage("init", {
|
|
20318
|
+
url,
|
|
20319
|
+
aiurl,
|
|
20320
|
+
accessToken,
|
|
20321
|
+
nodeUrl,
|
|
20322
|
+
enableAi,
|
|
20323
|
+
applicationName,
|
|
20324
|
+
isTest,
|
|
20325
|
+
});
|
|
20326
|
+
success = true;
|
|
20327
|
+
resolve();
|
|
20328
|
+
}
|
|
20329
|
+
});
|
|
20330
|
+
}
|
|
20331
|
+
};
|
|
20332
|
+
// Listen for the activation of the new service worker
|
|
20333
|
+
registration.addEventListener('controllerchange', () => __awaiter(this, void 0, void 0, function* () {
|
|
20334
|
+
if (navigator.serviceWorker.controller) {
|
|
20335
|
+
console.log('Service worker has been activated');
|
|
20336
|
+
yield sendMessage("init", {
|
|
20337
|
+
url,
|
|
20338
|
+
aiurl,
|
|
20339
|
+
accessToken,
|
|
20340
|
+
nodeUrl,
|
|
20341
|
+
enableAi,
|
|
20342
|
+
applicationName,
|
|
20343
|
+
isTest,
|
|
20344
|
+
});
|
|
20345
|
+
// The new service worker is now controlling the page
|
|
20346
|
+
// You can reload the page if necessary or handle the update process here
|
|
20347
|
+
}
|
|
20348
|
+
}));
|
|
20233
20349
|
}))
|
|
20234
20350
|
.catch((error) => __awaiter(this, void 0, void 0, function* () {
|
|
20235
20351
|
yield initConceptConnection();
|
|
@@ -20300,13 +20416,13 @@ function sendMessage(type, payload) {
|
|
|
20300
20416
|
console.log('not ready', type);
|
|
20301
20417
|
reject("Service worker not ready");
|
|
20302
20418
|
}
|
|
20303
|
-
},
|
|
20419
|
+
}, 60000); // 60 seconds
|
|
20304
20420
|
}
|
|
20305
20421
|
// Timeout for waiting for the response (e.g., 5 seconds)
|
|
20306
20422
|
setTimeout(() => {
|
|
20307
20423
|
reject("No response from service worker after timeout");
|
|
20308
20424
|
navigator.serviceWorker.removeEventListener("message", responseHandler);
|
|
20309
|
-
},
|
|
20425
|
+
}, 60000); // 60 sec
|
|
20310
20426
|
// })
|
|
20311
20427
|
// .catch(err => reject(err))
|
|
20312
20428
|
// .finally(() => console.log('finally'))
|