@colabo-knalledge/i-core-services 1.1.0 → 1.2.0

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/cjs/index.js CHANGED
@@ -34,26 +34,6 @@ var __decorateClass = (decorators, target, key, kind) => {
34
34
  if (kind && result) __defProp(target, key, result);
35
35
  return result;
36
36
  };
37
- var __async = (__this, __arguments, generator) => {
38
- return new Promise((resolve, reject) => {
39
- var fulfilled = (value) => {
40
- try {
41
- step(generator.next(value));
42
- } catch (e) {
43
- reject(e);
44
- }
45
- };
46
- var rejected = (value) => {
47
- try {
48
- step(generator.throw(value));
49
- } catch (e) {
50
- reject(e);
51
- }
52
- };
53
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
54
- step((generator = generator.apply(__this, __arguments)).next());
55
- });
56
- };
57
37
 
58
38
  // index.ts
59
39
  var index_exports = {};
@@ -229,6 +209,9 @@ var errorInterceptor = (error) => {
229
209
  };
230
210
  if (DEBUG_VERBOSE) console.log("[ColaboApiCoreService] declaring ColaboApiCoreService class");
231
211
  var ColaboApiCoreService = class {
212
+ static {
213
+ this.interceptorsForAxios = /* @__PURE__ */ new Map();
214
+ }
232
215
  // Add a response interceptor to remove JSONP prefix that Colabo.Space is sending
233
216
  // https://docs.angularjs.org/api/ng/service/$http#json-vulnerability-protection
234
217
  // https://stackoverflow.com/questions/33967189/angular-not-removing-json-prefix
@@ -264,7 +247,6 @@ var ColaboApiCoreService = class {
264
247
  }
265
248
  }
266
249
  };
267
- ColaboApiCoreService.interceptorsForAxios = /* @__PURE__ */ new Map();
268
250
  (0, import_i_core3.injectInterceptorService)(ColaboApiCoreService);
269
251
 
270
252
  // lib/kContainer-service.ts
@@ -298,77 +280,71 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
298
280
  console.log("[ColaboKnAllEdgeContainerService] created");
299
281
  this.apiUrl = ColaboKnAllEdgeContainerService.serverAP + "/" + import_i_core4.KCONTAINER_API_PARAMS.API_PATH + "/";
300
282
  }
301
- getById(id) {
302
- return __async(this, null, function* () {
303
- let result;
304
- const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.INDEX_BY_ID + "/" + id;
305
- if (DEBUG) console.log("[getByIdPromise] url: ", url);
306
- try {
307
- const mResult = yield import_axios2.default.get(url);
308
- const serverData = mResult.data;
309
- result = import_i_core4.ColaboApiOperators.extractVoFromServerDataAsArray(serverData);
310
- if (!result) {
311
- return Promise.reject(new Error("Problem with extracting data as an array from serverData"));
312
- }
313
- if (import_i_core4.ColaboApiOperators.getParentEntity(result).type != import_i_core4.KCONTAINER_API_PARAMS.KCONTAINER_TYPE) {
314
- return Promise.reject(new Error("Wrong entity type, expected: " + import_i_core4.KCONTAINER_API_PARAMS.KCONTAINER_TYPE));
315
- }
316
- } catch (error) {
317
- console.error(error);
318
- return Promise.reject(error);
283
+ async getById(id) {
284
+ let result;
285
+ const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.INDEX_BY_ID + "/" + id;
286
+ if (DEBUG) console.log("[getByIdPromise] url: ", url);
287
+ try {
288
+ const mResult = await import_axios2.default.get(url);
289
+ const serverData = mResult.data;
290
+ result = import_i_core4.ColaboApiOperators.extractVoFromServerDataAsArray(serverData);
291
+ if (!result) {
292
+ return Promise.reject(new Error("Problem with extracting data as an array from serverData"));
319
293
  }
320
- return result;
321
- });
294
+ if (import_i_core4.ColaboApiOperators.getParentEntity(result).type != import_i_core4.KCONTAINER_API_PARAMS.KCONTAINER_TYPE) {
295
+ return Promise.reject(new Error("Wrong entity type, expected: " + import_i_core4.KCONTAINER_API_PARAMS.KCONTAINER_TYPE));
296
+ }
297
+ } catch (error) {
298
+ console.error(error);
299
+ return Promise.reject(error);
300
+ }
301
+ return result;
322
302
  }
323
- create(kContainerWContent) {
324
- return __async(this, null, function* () {
325
- console.log("ColaboKnAllEdgeContainerService.create");
326
- let result;
327
- const url = this.apiUrl;
328
- try {
329
- const requestRoot = {
330
- type: import_i_core4.KCONTAINER_API_TYPE.CREATE_NEW,
331
- data: kContainerWContent
332
- };
333
- const mResult = yield import_axios2.default.post(url, requestRoot, HTTP_OPTIONS_CONST_JSON);
334
- const serverData = mResult.data;
335
- result = import_i_core4.ColaboApiOperators.extractVoFromServerData(serverData);
336
- return result;
337
- } catch (error) {
338
- if (error.response) {
339
- console.log("[create]", error);
340
- console.warn("Response status:", error.response.status);
341
- console.warn("Response data:", error.response.data);
342
- if (error.response.data.code === "EMAIL_EXISTS") {
343
- console.warn("EMAIL_EXISTS");
344
- }
345
- return error.response.data;
346
- } else if (error.request) {
347
- console.error("No response received");
348
- } else {
349
- console.error("[ColaboKnAllEdgeContainerService:create] Error during request setup:", error.message);
303
+ async create(kContainerWContent) {
304
+ console.log("ColaboKnAllEdgeContainerService.create");
305
+ let result;
306
+ const url = this.apiUrl;
307
+ try {
308
+ const requestRoot = {
309
+ type: import_i_core4.KCONTAINER_API_TYPE.CREATE_NEW,
310
+ data: kContainerWContent
311
+ };
312
+ const mResult = await import_axios2.default.post(url, requestRoot, HTTP_OPTIONS_CONST_JSON);
313
+ const serverData = mResult.data;
314
+ result = import_i_core4.ColaboApiOperators.extractVoFromServerData(serverData);
315
+ return result;
316
+ } catch (error) {
317
+ if (error.response) {
318
+ console.log("[create]", error);
319
+ console.warn("Response status:", error.response.status);
320
+ console.warn("Response data:", error.response.data);
321
+ if (error.response.data.code === "EMAIL_EXISTS") {
322
+ console.warn("EMAIL_EXISTS");
350
323
  }
351
- (0, import_i_notifications3.rethrowColaboError)(error);
352
- throw new import_i_notifications3.ColaboErrorUnreachable();
324
+ return error.response.data;
325
+ } else if (error.request) {
326
+ console.error("No response received");
327
+ } else {
328
+ console.error("[ColaboKnAllEdgeContainerService:create] Error during request setup:", error.message);
353
329
  }
354
- });
330
+ (0, import_i_notifications3.rethrowColaboError)(error);
331
+ throw new import_i_notifications3.ColaboErrorUnreachable();
332
+ }
355
333
  }
356
- update(kContainer) {
357
- return __async(this, null, function* () {
358
- console.log("ColaboKnAllEdgeContainerService.update");
359
- let result;
360
- const actionType = import_i_core4.KCONTAINER_API_TYPE.UPDATE_BY_ID;
361
- const url = this.apiUrl + "one/" + actionType + "/" + kContainer._id;
362
- try {
363
- const mResult = yield import_axios2.default.put(url, kContainer, HTTP_OPTIONS_CONST_JSON);
364
- const serverData = mResult.data;
365
- result = import_i_core4.ColaboApiOperators.extractVoFromServerData(serverData);
366
- } catch (error) {
367
- console.error(error);
368
- return Promise.reject(error);
369
- }
370
- return result;
371
- });
334
+ async update(kContainer) {
335
+ console.log("ColaboKnAllEdgeContainerService.update");
336
+ let result;
337
+ const actionType = import_i_core4.KCONTAINER_API_TYPE.UPDATE_BY_ID;
338
+ const url = this.apiUrl + "one/" + actionType + "/" + kContainer._id;
339
+ try {
340
+ const mResult = await import_axios2.default.put(url, kContainer, HTTP_OPTIONS_CONST_JSON);
341
+ const serverData = mResult.data;
342
+ result = import_i_core4.ColaboApiOperators.extractVoFromServerData(serverData);
343
+ } catch (error) {
344
+ console.error(error);
345
+ return Promise.reject(error);
346
+ }
347
+ return result;
372
348
  }
373
349
  /**
374
350
  /**
@@ -379,19 +355,17 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
379
355
  * @return {*} {Promise<boolean>}
380
356
  * @memberof ColaboKnAllEdgeContainerService
381
357
  */
382
- destroy(id) {
383
- return __async(this, null, function* () {
384
- console.log(`[destroy] id=${id}`);
385
- const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.DESTROY_ONE + "/" + id;
386
- try {
387
- const mResult = yield import_axios2.default.delete(url, HTTP_OPTIONS_CONST_JSON);
388
- const serverData = mResult.data;
389
- return serverData.success;
390
- } catch (error) {
391
- (0, import_i_notifications3.rethrowColaboError)(error);
392
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
393
- }
394
- });
358
+ async destroy(id) {
359
+ console.log(`[destroy] id=${id}`);
360
+ const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.DESTROY_ONE + "/" + id;
361
+ try {
362
+ const mResult = await import_axios2.default.delete(url, HTTP_OPTIONS_CONST_JSON);
363
+ const serverData = mResult.data;
364
+ return serverData.success;
365
+ } catch (error) {
366
+ (0, import_i_notifications3.rethrowColaboError)(error);
367
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
368
+ }
395
369
  }
396
370
  /**
397
371
  * @param containerId The id of the kContainer to which we want to add kNodes
@@ -399,23 +373,21 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
399
373
  * @description adds kNodes in a kContainer
400
374
  * @returns edges created between the container and entities added to the container
401
375
  */
402
- updateAddNodes(containerId, containedIds) {
403
- return __async(this, null, function* () {
404
- if (DEBUG) console.log("[ColaboKnAllEdgeContainerService::updateAddNodes(containerId, containedIds)", containerId, containedIds);
405
- let result;
406
- const idsStr = containedIds.join(",");
407
- const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.UPDATE_ADD_KNODE_BY_IDS + "/" + containerId + "/" + idsStr;
408
- console.log("updateAddNodes called", url);
409
- try {
410
- const mResult = yield import_axios2.default.put(url, {}, HTTP_OPTIONS_CONST_JSON);
411
- const serverData = mResult.data;
412
- result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
413
- } catch (error) {
414
- console.error(error);
415
- return Promise.reject(error);
416
- }
417
- return result;
418
- });
376
+ async updateAddNodes(containerId, containedIds) {
377
+ if (DEBUG) console.log("[ColaboKnAllEdgeContainerService::updateAddNodes(containerId, containedIds)", containerId, containedIds);
378
+ let result;
379
+ const idsStr = containedIds.join(",");
380
+ const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.UPDATE_ADD_KNODE_BY_IDS + "/" + containerId + "/" + idsStr;
381
+ console.log("updateAddNodes called", url);
382
+ try {
383
+ const mResult = await import_axios2.default.put(url, {}, HTTP_OPTIONS_CONST_JSON);
384
+ const serverData = mResult.data;
385
+ result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
386
+ } catch (error) {
387
+ console.error(error);
388
+ return Promise.reject(error);
389
+ }
390
+ return result;
419
391
  }
420
392
  /**
421
393
  * removes kNodes from a kContainer
@@ -424,67 +396,61 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
424
396
  * @param ids The list of ids of the kNodes we want to remove from the container
425
397
  * @returns edges created between the container and entities added to the container
426
398
  */
427
- updateRemoveNodes(id, ids) {
428
- return __async(this, null, function* () {
429
- console.log("[ColaboKnAllEdgeContainerService::updateRemoveNodes(id, ids)", id, ids);
430
- let result;
431
- const idsStr = ids.join(",");
432
- const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.UPDATE_REMOVE_KNODE_BY_IDS + "/" + id + "/" + idsStr;
433
- console.log("updateRemoveNodes called", url);
434
- try {
435
- const mResult = yield import_axios2.default.put(url, {}, HTTP_OPTIONS_CONST_JSON);
436
- const serverData = mResult.data;
437
- result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
438
- } catch (error) {
439
- console.error(error);
440
- return Promise.reject(error);
441
- }
442
- return result;
443
- });
399
+ async updateRemoveNodes(id, ids) {
400
+ console.log("[ColaboKnAllEdgeContainerService::updateRemoveNodes(id, ids)", id, ids);
401
+ let result;
402
+ const idsStr = ids.join(",");
403
+ const url = this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.UPDATE_REMOVE_KNODE_BY_IDS + "/" + id + "/" + idsStr;
404
+ console.log("updateRemoveNodes called", url);
405
+ try {
406
+ const mResult = await import_axios2.default.put(url, {}, HTTP_OPTIONS_CONST_JSON);
407
+ const serverData = mResult.data;
408
+ result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
409
+ } catch (error) {
410
+ console.error(error);
411
+ return Promise.reject(error);
412
+ }
413
+ return result;
444
414
  }
445
415
  /**
446
416
  *
447
417
  * @param id The id of the kContainer which knodes we want to retrieve
448
418
  * @description retrieves kNodes in a kContainer
449
419
  */
450
- getInContainer(id) {
451
- return __async(this, null, function* () {
452
- let result;
453
- if (DEBUG) console.log(`this.apiUrl:${this.apiUrl}, this.defaultAction:${this.defaultAction}`);
454
- const url = `http://127.0.0.1:8001/kcontainers/` + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + "/" + id + ".json";
455
- try {
456
- const response = yield this.http.get(url).toPromise();
457
- if (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);
458
- if (!response) {
459
- return [];
460
- }
461
- const processedResponse = CFServiceIsomorphic.processVOs(response, import_i_core4.KNodeFrontend);
462
- if (DEBUG_VERBOSE) console.log("[ColaboKnAllEdgeContainerService::getInContainer] response<KNodeFrontend>: ", JSON.stringify(processedResponse, null, 4));
463
- return processedResponse;
464
- } catch (error) {
465
- (0, import_i_notifications3.rethrowColaboError)(error);
466
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
420
+ async getInContainer(id) {
421
+ let result;
422
+ if (DEBUG) console.log(`this.apiUrl:${this.apiUrl}, this.defaultAction:${this.defaultAction}`);
423
+ const url = `http://127.0.0.1:8001/kcontainers/` + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + "/" + id + ".json";
424
+ try {
425
+ const response = await this.http.get(url).toPromise();
426
+ if (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);
427
+ if (!response) {
428
+ return [];
467
429
  }
468
- });
430
+ const processedResponse = CFServiceIsomorphic.processVOs(response, import_i_core4.KNodeFrontend);
431
+ if (DEBUG_VERBOSE) console.log("[ColaboKnAllEdgeContainerService::getInContainer] response<KNodeFrontend>: ", JSON.stringify(processedResponse, null, 4));
432
+ return processedResponse;
433
+ } catch (error) {
434
+ (0, import_i_notifications3.rethrowColaboError)(error);
435
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
436
+ }
469
437
  }
470
438
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
471
- getVOs(type, upperLayerType) {
472
- return __async(this, null, function* () {
473
- let result;
474
- const url = `${this.apiUrl}${this.defaultAction}/${import_i_core4.KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? "/" + upperLayerType : ""}.json`;
475
- const mResult = yield import_axios2.default.get(url);
476
- try {
477
- const serverData = mResult.data;
478
- result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
479
- if (!result) {
480
- return Promise.reject(new Error("Couldn't extract VOs from the serverData"));
481
- }
482
- } catch (error) {
483
- console.error(error);
484
- return Promise.reject(error);
439
+ async getVOs(type, upperLayerType) {
440
+ let result;
441
+ const url = `${this.apiUrl}${this.defaultAction}/${import_i_core4.KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? "/" + upperLayerType : ""}.json`;
442
+ const mResult = await import_axios2.default.get(url);
443
+ try {
444
+ const serverData = mResult.data;
445
+ result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
446
+ if (!result) {
447
+ return Promise.reject(new Error("Couldn't extract VOs from the serverData"));
485
448
  }
486
- return result;
487
- });
449
+ } catch (error) {
450
+ console.error(error);
451
+ return Promise.reject(error);
452
+ }
453
+ return result;
488
454
  }
489
455
  /**
490
456
  * Extracts upper-layer entity from kContainer and sets it up
@@ -594,188 +560,167 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
594
560
  */
595
561
  // eslint-disable-next-line @typescript-eslint/ban-types
596
562
  // OLD: getById(id: string, callback?: Function): Observable<KNodeFrontend> {
597
- getById(id) {
598
- return __async(this, null, function* () {
599
- const url = this.apiUrl + "one/" + this.defaultAction + "/" + id;
600
- console.log(`[ColaboKnAllEdgeNodeService:getById] url: ${url}`);
601
- console.log(`[ColaboKnAllEdgeNodeService:getById] ${this.id}`);
602
- try {
603
- const result = yield import_axios3.default.get(url);
604
- const data = result.data;
605
- const kNode = this.extractVOFromDataAsArray(data, import_i_core10.KNodeFrontend);
606
- return kNode;
607
- } catch (e) {
608
- if ((0, import_i_notifications4.isColaboError)(e)) {
609
- throw e;
610
- }
611
- const error = e;
612
- if (error.response) {
613
- } else if (error.request) {
614
- (0, import_i_notifications4.throwColaboError)(error.message, import_i_notifications4.EErrorOrigin.SYSTEM, import_i_notifications4.EColaboErrorKind.REQUEST_BAD);
615
- } else {
616
- console.error("[ColaboKnAllEdgeNodeService:getById] Error during request setup:");
617
- (0, import_i_notifications4.throwColaboError)(error.message, import_i_notifications4.EErrorOrigin.SYSTEM, import_i_notifications4.EColaboErrorKind.REQUEST_BAD);
618
- }
619
- throw new Error("This should never be reached, but throwing just because of TS error in diagnosing unreachable end");
563
+ async getById(id) {
564
+ const url = this.apiUrl + "one/" + this.defaultAction + "/" + id;
565
+ console.log(`[ColaboKnAllEdgeNodeService:getById] url: ${url}`);
566
+ console.log(`[ColaboKnAllEdgeNodeService:getById] ${this.id}`);
567
+ try {
568
+ const result = await import_axios3.default.get(url);
569
+ const data = result.data;
570
+ const kNode = this.extractVOFromDataAsArray(data, import_i_core10.KNodeFrontend);
571
+ return kNode;
572
+ } catch (e) {
573
+ if ((0, import_i_notifications4.isColaboError)(e)) {
574
+ throw e;
620
575
  }
621
- });
576
+ const error = e;
577
+ if (error.response) {
578
+ } else if (error.request) {
579
+ (0, import_i_notifications4.throwColaboError)(error.message, import_i_notifications4.EErrorOrigin.SYSTEM, import_i_notifications4.EColaboErrorKind.REQUEST_BAD);
580
+ } else {
581
+ console.error("[ColaboKnAllEdgeNodeService:getById] Error during request setup:");
582
+ (0, import_i_notifications4.throwColaboError)(error.message, import_i_notifications4.EErrorOrigin.SYSTEM, import_i_notifications4.EColaboErrorKind.REQUEST_BAD);
583
+ }
584
+ throw new Error("This should never be reached, but throwing just because of TS error in diagnosing unreachable end");
585
+ }
622
586
  }
623
- getVosWithColaboApi(request) {
624
- return __async(this, null, function* () {
625
- request.type = import_i_core10.KNODE_API_TYPE.INDEX_COLABO_API;
626
- const requestSerialized = import_i_core10.ColaboApiOperators.serializeApiRequest(request);
627
- let result = [];
628
- const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.INDEX_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
629
- console.log("[getVos] url: ", url);
630
- const mResult = yield import_axios3.default.get(url);
631
- try {
632
- const serverData = mResult.data;
633
- if (!serverData) return result;
634
- result = import_i_core10.ColaboApiOperators.extractVosFromServerData(serverData);
635
- if (!result) {
636
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
637
- }
638
- } catch (error) {
639
- console.error(error);
640
- return Promise.reject(error);
587
+ async getVosWithColaboApi(request) {
588
+ request.type = import_i_core10.KNODE_API_TYPE.INDEX_COLABO_API;
589
+ const requestSerialized = import_i_core10.ColaboApiOperators.serializeApiRequest(request);
590
+ let result = [];
591
+ const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.INDEX_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
592
+ console.log("[getVos] url: ", url);
593
+ const mResult = await import_axios3.default.get(url);
594
+ try {
595
+ const serverData = mResult.data;
596
+ if (!serverData) return result;
597
+ result = import_i_core10.ColaboApiOperators.extractVosFromServerData(serverData);
598
+ if (!result) {
599
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
641
600
  }
642
- return result;
643
- });
601
+ } catch (error) {
602
+ console.error(error);
603
+ return Promise.reject(error);
604
+ }
605
+ return result;
644
606
  }
645
- updateSingleWithColaboApi(request) {
646
- return __async(this, null, function* () {
647
- const kNodes = yield this.updateWithColaboApi(request);
648
- if (!kNodes) throw new Error("kNodes is not defined");
649
- if (kNodes.length <= 0) throw new Error("kNodes is empty");
650
- return kNodes[0];
651
- });
607
+ async updateSingleWithColaboApi(request) {
608
+ const kNodes = await this.updateWithColaboApi(request);
609
+ if (!kNodes) throw new Error("kNodes is not defined");
610
+ if (kNodes.length <= 0) throw new Error("kNodes is empty");
611
+ return kNodes[0];
652
612
  }
653
- updateWithColaboApi(request) {
654
- return __async(this, null, function* () {
655
- var _a, _b;
656
- request.type = import_i_core10.KNODE_API_TYPE.UPDATE_COLABO_API;
657
- let result;
658
- const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.UPDATE_COLABO_API + ".json";
659
- console.log("[getVos] url: ", url);
660
- let mResult;
661
- try {
662
- mResult = yield import_axios3.default.put(url, request);
663
- } catch (error) {
664
- console.error(`${import_i_core10.contextReportText}Error updating: ${error}`);
665
- return Promise.reject(error);
613
+ async updateWithColaboApi(request) {
614
+ request.type = import_i_core10.KNODE_API_TYPE.UPDATE_COLABO_API;
615
+ let result;
616
+ const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.UPDATE_COLABO_API + ".json";
617
+ console.log("[getVos] url: ", url);
618
+ let mResult;
619
+ try {
620
+ mResult = await import_axios3.default.put(url, request);
621
+ } catch (error) {
622
+ console.error(`${import_i_core10.contextReportText}Error updating: ${error}`);
623
+ return Promise.reject(error);
624
+ }
625
+ try {
626
+ const serverData = mResult.data;
627
+ if (!serverData.success) {
628
+ console.error(`Error updating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);
629
+ return Promise.reject(serverData);
666
630
  }
667
- try {
668
- const serverData = mResult.data;
669
- if (!serverData.success) {
670
- console.error(`Error updating: [code: ${(_a = serverData.error) == null ? void 0 : _a.kind}] ${(_b = serverData.error) == null ? void 0 : _b.message}`);
671
- return Promise.reject(serverData);
672
- }
673
- result = import_i_core10.ColaboApiOperators.extractVosFromServerData(serverData);
674
- if (!result) {
675
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
676
- }
677
- } catch (error) {
678
- console.error(error);
679
- return Promise.reject(error);
631
+ result = import_i_core10.ColaboApiOperators.extractVosFromServerData(serverData);
632
+ if (!result) {
633
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
680
634
  }
681
- return result;
682
- });
635
+ } catch (error) {
636
+ console.error(error);
637
+ return Promise.reject(error);
638
+ }
639
+ return result;
683
640
  }
684
641
  // getVOs(type:string):Observable<KNodeFrontend[]> {
685
642
  // return this.queryInMapofType(ColaboKnAllEdgeNodeService.mapId,type);
686
643
  // }
687
- createSingle(kNode) {
688
- return __async(this, null, function* () {
689
- const kNodesCreated = yield this.create(kNode);
690
- if (!Array.isArray(kNodesCreated) || kNodesCreated.length <= 0) throw new Error(`${(0, import_i_core10.contextReportText)()} No kNode created`);
691
- const kNodeCreated = kNodesCreated[0];
692
- return kNodeCreated;
693
- });
644
+ async createSingle(kNode) {
645
+ const kNodesCreated = await this.create(kNode);
646
+ if (!Array.isArray(kNodesCreated) || kNodesCreated.length <= 0) throw new Error(`${(0, import_i_core10.contextReportText)()} No kNode created`);
647
+ const kNodeCreated = kNodesCreated[0];
648
+ return kNodeCreated;
694
649
  }
695
650
  /** creates a new Element (VO) */
696
651
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
697
- create(kNode, callback) {
698
- return __async(this, null, function* () {
699
- var _a, _b;
700
- console.log(`${(0, import_i_core10.contextReportText)()}`);
701
- let result;
702
- const request = {
703
- type: import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API,
704
- data: kNode
705
- };
706
- const url = this.apiUrl;
707
- try {
708
- const mResult = yield import_axios3.default.post(url, request, HTTP_OPTIONS_CONST_JSON);
709
- const serverData = mResult.data;
710
- if (!serverData.success) {
711
- throw new Error(`${import_i_core10.contextReportText} Error creating node. [code: ${(_a = serverData.error) == null ? void 0 : _a.kind}] ${(_b = serverData.error) == null ? void 0 : _b.message}`);
712
- }
713
- result = import_i_core10.ColaboApiOperators.extractVoFromServerData(serverData);
714
- } catch (error) {
715
- (0, import_i_notifications4.rethrowColaboError)(error);
716
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
652
+ async create(kNode, callback) {
653
+ console.log(`${(0, import_i_core10.contextReportText)()}`);
654
+ let result;
655
+ const request = {
656
+ type: import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API,
657
+ data: kNode
658
+ };
659
+ const url = this.apiUrl;
660
+ try {
661
+ const mResult = await import_axios3.default.post(url, request, HTTP_OPTIONS_CONST_JSON);
662
+ const serverData = mResult.data;
663
+ if (!serverData.success) {
664
+ throw new Error(`${import_i_core10.contextReportText} Error creating node. [code: ${serverData.error?.kind}] ${serverData.error?.message}`);
717
665
  }
718
- return result;
719
- });
666
+ result = import_i_core10.ColaboApiOperators.extractVoFromServerData(serverData);
667
+ } catch (error) {
668
+ (0, import_i_notifications4.rethrowColaboError)(error);
669
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
670
+ }
671
+ return result;
720
672
  }
721
- createWithColaboApi(request) {
722
- return __async(this, null, function* () {
723
- var _a, _b;
724
- request.type = import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API;
725
- let result;
726
- const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API + ".json";
727
- console.log("[getVos] url: ", url);
728
- let mResult;
729
- try {
730
- mResult = yield import_axios3.default.post(url, request);
731
- } catch (error) {
732
- console.error(`${import_i_core10.contextReportText}Error updating: ${error}`);
733
- return Promise.reject(error);
673
+ async createWithColaboApi(request) {
674
+ request.type = import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API;
675
+ let result;
676
+ const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API + ".json";
677
+ console.log("[getVos] url: ", url);
678
+ let mResult;
679
+ try {
680
+ mResult = await import_axios3.default.post(url, request);
681
+ } catch (error) {
682
+ console.error(`${import_i_core10.contextReportText}Error updating: ${error}`);
683
+ return Promise.reject(error);
684
+ }
685
+ try {
686
+ const serverData = mResult.data;
687
+ if (!serverData.success) {
688
+ console.error(`Error creating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);
689
+ return Promise.reject(serverData);
734
690
  }
735
- try {
736
- const serverData = mResult.data;
737
- if (!serverData.success) {
738
- console.error(`Error creating: [code: ${(_a = serverData.error) == null ? void 0 : _a.kind}] ${(_b = serverData.error) == null ? void 0 : _b.message}`);
739
- return Promise.reject(serverData);
740
- }
741
- result = import_i_core10.ColaboApiOperators.extractVoFromServerData(serverData);
742
- if (!result) {
743
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
744
- }
745
- } catch (error) {
746
- console.error(error);
747
- return Promise.reject(error);
691
+ result = import_i_core10.ColaboApiOperators.extractVoFromServerData(serverData);
692
+ if (!result) {
693
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
748
694
  }
749
- return result;
750
- });
695
+ } catch (error) {
696
+ console.error(error);
697
+ return Promise.reject(error);
698
+ }
699
+ return result;
751
700
  }
752
701
  /** destroys the Element (VO) with the `_id === id` */
753
702
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
754
- destroy(id) {
755
- return __async(this, null, function* () {
756
- return true;
757
- });
703
+ async destroy(id) {
704
+ return true;
758
705
  }
759
- destroyWithColaboApi(request) {
760
- return __async(this, null, function* () {
761
- request.type = import_i_core10.KNODE_API_TYPE.DESTROY_COLABO_API;
762
- const requestSerialized = import_i_core10.ColaboApiOperators.serializeApiRequest(request);
763
- let result;
764
- const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.DESTROY_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
765
- console.log("[getVos] url: ", url);
766
- const mResult = yield import_axios3.default.delete(url);
767
- try {
768
- const serverData = mResult.data;
769
- result = import_i_core10.ColaboApiOperators.extractVosFromServerData(serverData);
770
- if (!result) {
771
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
772
- }
773
- } catch (error) {
774
- console.error(error);
775
- return Promise.reject(error);
706
+ async destroyWithColaboApi(request) {
707
+ request.type = import_i_core10.KNODE_API_TYPE.DESTROY_COLABO_API;
708
+ const requestSerialized = import_i_core10.ColaboApiOperators.serializeApiRequest(request);
709
+ let result;
710
+ const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.DESTROY_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
711
+ console.log("[getVos] url: ", url);
712
+ const mResult = await import_axios3.default.delete(url);
713
+ try {
714
+ const serverData = mResult.data;
715
+ result = import_i_core10.ColaboApiOperators.extractVosFromServerData(serverData);
716
+ if (!result) {
717
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
776
718
  }
777
- return result;
778
- });
719
+ } catch (error) {
720
+ console.error(error);
721
+ return Promise.reject(error);
722
+ }
723
+ return result;
779
724
  }
780
725
  /** gets Elements (VOs) to populate the list */
781
726
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -808,24 +753,22 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
808
753
  this.knAllEdgeRealTimeService = null;
809
754
  console.log("[ColaboKnAllEdgeNodeServiceExtended:constructor] constructed");
810
755
  }
811
- queryByIds(ids, callback) {
812
- return __async(this, null, function* () {
813
- console.log("queryByIds", ids);
814
- const idsStr = ids.join(",");
815
- const url = this.apiUrl + import_i_core15.KNODE_API_TYPE.INDEX_ID_IN + "/" + this.defaultAction + "/" + idsStr + ".json";
816
- try {
817
- const mResult = yield import_axios4.default.get(url);
818
- const serverData = mResult.data;
819
- const result = CFServiceIsomorphic.processVOs(serverData, import_i_core14.KNodeFrontend);
820
- if (callback) {
821
- callback(result);
822
- }
823
- return result;
824
- } catch (error) {
825
- (0, import_i_notifications6.rethrowColaboError)(error);
826
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
756
+ async queryByIds(ids, callback) {
757
+ console.log("queryByIds", ids);
758
+ const idsStr = ids.join(",");
759
+ const url = this.apiUrl + import_i_core15.KNODE_API_TYPE.INDEX_ID_IN + "/" + this.defaultAction + "/" + idsStr + ".json";
760
+ try {
761
+ const mResult = await import_axios4.default.get(url);
762
+ const serverData = mResult.data;
763
+ const result = CFServiceIsomorphic.processVOs(serverData, import_i_core14.KNodeFrontend);
764
+ if (callback) {
765
+ callback(result);
827
766
  }
828
- });
767
+ return result;
768
+ } catch (error) {
769
+ (0, import_i_notifications6.rethrowColaboError)(error);
770
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
771
+ }
829
772
  }
830
773
  /**
831
774
  * BREAKING CHANGE: removed as the code is old, sending raw request to backend instead of `IApiRequest`. The right version is available in the `ColaboKnAllEdgeNodeService` class with the same name
@@ -886,21 +829,19 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
886
829
  * @example URL:http://localhost:8001/knodes/one/default/5a156965d0b7970f365e1a4b.json
887
830
  */
888
831
  // eslint-disable-next-line @typescript-eslint/ban-types
889
- destroy(id, callback) {
890
- return __async(this, null, function* () {
891
- try {
892
- const mResult = yield import_axios4.default.delete(this.apiUrl + "one/" + this.defaultAction + "/" + id, HTTP_OPTIONS_CONST_JSON);
893
- const serverData = mResult.data;
894
- const result = serverData.success;
895
- if (callback) {
896
- callback(result);
897
- }
898
- return result;
899
- } catch (error) {
900
- (0, import_i_notifications6.rethrowColaboError)(error);
901
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
832
+ async destroy(id, callback) {
833
+ try {
834
+ const mResult = await import_axios4.default.delete(this.apiUrl + "one/" + this.defaultAction + "/" + id, HTTP_OPTIONS_CONST_JSON);
835
+ const serverData = mResult.data;
836
+ const result = serverData.success;
837
+ if (callback) {
838
+ callback(result);
902
839
  }
903
- });
840
+ return result;
841
+ } catch (error) {
842
+ (0, import_i_notifications6.rethrowColaboError)(error);
843
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
844
+ }
904
845
  }
905
846
  /**
906
847
  * Updates the provided node on the server and returns its server-updated appearance
@@ -913,34 +854,32 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
913
854
  http://localhost:8001/knodes/one/UPDATE_NODE_NAME_FINAL/5a156935d0b7970f365e1a42.json
914
855
  */
915
856
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
916
- update(kNode, actionType, patch, callback) {
917
- return __async(this, null, function* () {
918
- function updateResponse(nodeFromServer) {
919
- const responseTime = /* @__PURE__ */ new Date();
920
- }
921
- let result;
922
- const id = kNode._id;
923
- const kNodeForServer = patch ? patch : kNode.toServerCopy();
924
- actionType = actionType !== null ? actionType : ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME_FINAL;
925
- if (kNode.state == import_i_core14.VOFrontend.STATE_LOCAL) {
926
- window.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);
927
- result = void 0;
928
- return result;
929
- } else {
930
- try {
931
- const mResult = yield import_axios4.default.put(this.apiUrl + "one/" + actionType + "/" + id, kNodeForServer, HTTP_OPTIONS_CONST_JSON);
932
- const serverData = mResult.data;
933
- const result2 = this.extractVO(serverData, import_i_core14.KNodeFrontend);
934
- if (callback) {
935
- callback(result2);
936
- }
937
- return result2;
938
- } catch (error) {
939
- (0, import_i_notifications6.rethrowColaboError)(error);
940
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
857
+ async update(kNode, actionType, patch, callback) {
858
+ function updateResponse(nodeFromServer) {
859
+ const responseTime = /* @__PURE__ */ new Date();
860
+ }
861
+ let result;
862
+ const id = kNode._id;
863
+ const kNodeForServer = patch ? patch : kNode.toServerCopy();
864
+ actionType = actionType !== null ? actionType : ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME_FINAL;
865
+ if (kNode.state == import_i_core14.VOFrontend.STATE_LOCAL) {
866
+ window.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);
867
+ result = void 0;
868
+ return result;
869
+ } else {
870
+ try {
871
+ const mResult = await import_axios4.default.put(this.apiUrl + "one/" + actionType + "/" + id, kNodeForServer, HTTP_OPTIONS_CONST_JSON);
872
+ const serverData = mResult.data;
873
+ const result2 = this.extractVO(serverData, import_i_core14.KNodeFrontend);
874
+ if (callback) {
875
+ callback(result2);
941
876
  }
877
+ return result2;
878
+ } catch (error) {
879
+ (0, import_i_notifications6.rethrowColaboError)(error);
880
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
942
881
  }
943
- });
882
+ }
944
883
  }
945
884
  // getVOs(type: string): Observable<KNodeFrontend[] | undefined> {
946
885
  // return this.queryInMapofType(ColaboKnAllEdgeNodeServiceExtended.mapId, type);
@@ -1153,75 +1092,67 @@ var KnalledgeEdgeService = class extends CFServiceIsomorphic {
1153
1092
  this.apiUrl = KnalledgeEdgeService.serverAP + "/" + import_i_core18.KEDGE_API_PARAMS.API_PATH + "/";
1154
1093
  console.log("[KnalledgeEdgeService] REST API URL: ", import_i_core19.chalk.bold.white(this.apiUrl));
1155
1094
  }
1156
- getVosWithColaboApi(request) {
1157
- return __async(this, null, function* () {
1158
- request.type = import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API;
1159
- console.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);
1160
- const requestSerialized = import_i_core18.ColaboApiOperators.serializeApiRequest(request);
1161
- let result;
1162
- const url = this.apiUrl + import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API + "/" + requestSerialized + ".json";
1163
- console.log("[getVos] url: ", url);
1164
- const mResult = yield import_axios5.default.get(url);
1165
- try {
1166
- const serverData = mResult.data;
1167
- result = import_i_core18.ColaboApiOperators.extractVosFromServerData(serverData);
1168
- if (!result) {
1169
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
1170
- }
1171
- } catch (error) {
1172
- console.error(error);
1173
- return Promise.reject(error);
1095
+ async getVosWithColaboApi(request) {
1096
+ request.type = import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API;
1097
+ console.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);
1098
+ const requestSerialized = import_i_core18.ColaboApiOperators.serializeApiRequest(request);
1099
+ let result;
1100
+ const url = this.apiUrl + import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API + "/" + requestSerialized + ".json";
1101
+ console.log("[getVos] url: ", url);
1102
+ const mResult = await import_axios5.default.get(url);
1103
+ try {
1104
+ const serverData = mResult.data;
1105
+ result = import_i_core18.ColaboApiOperators.extractVosFromServerData(serverData);
1106
+ if (!result) {
1107
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
1174
1108
  }
1175
- return result;
1176
- });
1109
+ } catch (error) {
1110
+ console.error(error);
1111
+ return Promise.reject(error);
1112
+ }
1113
+ return result;
1177
1114
  }
1178
1115
  /** creates a new Element (VO) */
1179
1116
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
1180
- createWithPromise(kEdge, callback) {
1181
- return __async(this, null, function* () {
1182
- var _a, _b;
1183
- console.log(`${(0, import_i_core18.contextReportText)()}`);
1184
- let result;
1185
- const request = {
1186
- type: import_i_core18.KEDGE_API_TYPE.CREATE_COLABO_API,
1187
- data: kEdge
1188
- };
1189
- const url = this.apiUrl;
1190
- try {
1191
- const mResult = yield import_axios5.default.post(url, request, HTTP_OPTIONS_CONST_JSON);
1192
- const serverData = mResult.data;
1193
- if (!serverData.success) {
1194
- throw new Error(`${import_i_core18.contextReportText} Error creating edge. code: ${(_a = serverData.error) == null ? void 0 : _a.kind}, error msg: ${(_b = serverData.error) == null ? void 0 : _b.message}`);
1195
- }
1196
- result = import_i_core18.ColaboApiOperators.extractVoFromServerData(serverData);
1197
- } catch (error) {
1198
- console.error(error);
1199
- return Promise.reject(error);
1117
+ async createWithPromise(kEdge, callback) {
1118
+ console.log(`${(0, import_i_core18.contextReportText)()}`);
1119
+ let result;
1120
+ const request = {
1121
+ type: import_i_core18.KEDGE_API_TYPE.CREATE_COLABO_API,
1122
+ data: kEdge
1123
+ };
1124
+ const url = this.apiUrl;
1125
+ try {
1126
+ const mResult = await import_axios5.default.post(url, request, HTTP_OPTIONS_CONST_JSON);
1127
+ const serverData = mResult.data;
1128
+ if (!serverData.success) {
1129
+ throw new Error(`${import_i_core18.contextReportText} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);
1200
1130
  }
1201
- return result;
1202
- });
1131
+ result = import_i_core18.ColaboApiOperators.extractVoFromServerData(serverData);
1132
+ } catch (error) {
1133
+ console.error(error);
1134
+ return Promise.reject(error);
1135
+ }
1136
+ return result;
1203
1137
  }
1204
1138
  /** creates a new Element (VO) */
1205
1139
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
1206
- createWithRequest(request) {
1207
- return __async(this, null, function* () {
1208
- var _a, _b;
1209
- console.log(`${(0, import_i_core18.contextReportText)()}`);
1210
- let result;
1211
- const url = this.apiUrl;
1212
- try {
1213
- const mResult = yield import_axios5.default.post(url, request, HTTP_OPTIONS_CONST_JSON);
1214
- const serverData = mResult.data;
1215
- if (!serverData.success) {
1216
- throw new Error(`${import_i_core18.contextReportText} Error creating edge. code: ${(_a = serverData.error) == null ? void 0 : _a.kind}, error msg: ${(_b = serverData.error) == null ? void 0 : _b.message}`);
1217
- }
1218
- result = import_i_core18.ColaboApiOperators.extractVoFromServerData(serverData);
1219
- } catch (error) {
1220
- console.error(error);
1221
- return Promise.reject(error);
1140
+ async createWithRequest(request) {
1141
+ console.log(`${(0, import_i_core18.contextReportText)()}`);
1142
+ let result;
1143
+ const url = this.apiUrl;
1144
+ try {
1145
+ const mResult = await import_axios5.default.post(url, request, HTTP_OPTIONS_CONST_JSON);
1146
+ const serverData = mResult.data;
1147
+ if (!serverData.success) {
1148
+ throw new Error(`${import_i_core18.contextReportText} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);
1222
1149
  }
1223
- return result;
1224
- });
1150
+ result = import_i_core18.ColaboApiOperators.extractVoFromServerData(serverData);
1151
+ } catch (error) {
1152
+ console.error(error);
1153
+ return Promise.reject(error);
1154
+ }
1155
+ return result;
1225
1156
  }
1226
1157
  };
1227
1158
  KnalledgeEdgeService = __decorateClass([
@@ -1252,23 +1183,21 @@ var KnalledgeEdgeServiceExtended = class extends KnalledgeEdgeService {
1252
1183
  * @returns {Observable<KEdge>} retrieved edge
1253
1184
  */
1254
1185
  // eslint-disable-next-line @typescript-eslint/ban-types
1255
- getById(id, callback) {
1256
- return __async(this, null, function* () {
1257
- console.log("getById(" + id + ")");
1258
- const url = this.apiUrl + "one/" + id;
1259
- try {
1260
- const mResult = yield import_axios6.default.get(url);
1261
- const serverData = mResult.data;
1262
- const result = this.extractVO(serverData, import_i_core22.KEdgeFrontend);
1263
- if (callback) {
1264
- callback(result);
1265
- }
1266
- return result;
1267
- } catch (error) {
1268
- (0, import_i_notifications8.rethrowColaboError)(error);
1269
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1186
+ async getById(id, callback) {
1187
+ console.log("getById(" + id + ")");
1188
+ const url = this.apiUrl + "one/" + id;
1189
+ try {
1190
+ const mResult = await import_axios6.default.get(url);
1191
+ const serverData = mResult.data;
1192
+ const result = this.extractVO(serverData, import_i_core22.KEdgeFrontend);
1193
+ if (callback) {
1194
+ callback(result);
1270
1195
  }
1271
- });
1196
+ return result;
1197
+ } catch (error) {
1198
+ (0, import_i_notifications8.rethrowColaboError)(error);
1199
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1200
+ }
1272
1201
  }
1273
1202
  /**
1274
1203
  * Creates the provided edge on the server and returns its server-updated appearance
@@ -1277,29 +1206,27 @@ var KnalledgeEdgeServiceExtended = class extends KnalledgeEdgeService {
1277
1206
  * @returns {Observable<KEdge>} the created edge (now with the id and other specific data allocated to it by server, so the caller should fill the original edge with it)
1278
1207
  @example http://localhost:8001/kedges/in_map/default/579811d88e12abfa556f6b59.json
1279
1208
  */
1280
- create(kEdge, callback) {
1281
- return __async(this, null, function* () {
1282
- let result;
1283
- if (false) {
1284
- } else {
1285
- if (!kEdge.toServerCopy) {
1286
- throw new Error("kEdge.toServerCopy is not defined");
1287
- }
1288
- const kEdgeForServer = kEdge.toServerCopy();
1289
- try {
1290
- const mResult = yield import_axios6.default.post(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON);
1291
- const serverData = mResult.data;
1292
- const result2 = this.extractVO(serverData, import_i_core22.KEdgeFrontend);
1293
- if (callback) {
1294
- callback(result2);
1295
- }
1296
- return result2;
1297
- } catch (error) {
1298
- (0, import_i_notifications8.rethrowColaboError)(error);
1299
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1209
+ async create(kEdge, callback) {
1210
+ let result;
1211
+ if (false) {
1212
+ } else {
1213
+ if (!kEdge.toServerCopy) {
1214
+ throw new Error("kEdge.toServerCopy is not defined");
1215
+ }
1216
+ const kEdgeForServer = kEdge.toServerCopy();
1217
+ try {
1218
+ const mResult = await import_axios6.default.post(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON);
1219
+ const serverData = mResult.data;
1220
+ const result2 = this.extractVO(serverData, import_i_core22.KEdgeFrontend);
1221
+ if (callback) {
1222
+ callback(result2);
1300
1223
  }
1224
+ return result2;
1225
+ } catch (error) {
1226
+ (0, import_i_notifications8.rethrowColaboError)(error);
1227
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1301
1228
  }
1302
- });
1229
+ }
1303
1230
  }
1304
1231
  /**
1305
1232
  * Deletes the KEdge from the server
@@ -1308,21 +1235,19 @@ var KnalledgeEdgeServiceExtended = class extends KnalledgeEdgeService {
1308
1235
  * @param {function} callback Function to be called when the edge is deleted
1309
1236
  * @example URL:http://localhost:8001/kedges/one/default/5a156965d0b7970f365e1a4b.json
1310
1237
  */
1311
- destroy(id, callback) {
1312
- return __async(this, null, function* () {
1313
- try {
1314
- const mResult = yield import_axios6.default.delete(this.apiUrl + "one/" + id, HTTP_OPTIONS_CONST_JSON);
1315
- const serverData = mResult.data;
1316
- const result = serverData.success;
1317
- if (callback) {
1318
- callback(result);
1319
- }
1320
- return result;
1321
- } catch (error) {
1322
- (0, import_i_notifications8.rethrowColaboError)(error);
1323
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1238
+ async destroy(id, callback) {
1239
+ try {
1240
+ const mResult = await import_axios6.default.delete(this.apiUrl + "one/" + id, HTTP_OPTIONS_CONST_JSON);
1241
+ const serverData = mResult.data;
1242
+ const result = serverData.success;
1243
+ if (callback) {
1244
+ callback(result);
1324
1245
  }
1325
- });
1246
+ return result;
1247
+ } catch (error) {
1248
+ (0, import_i_notifications8.rethrowColaboError)(error);
1249
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1250
+ }
1326
1251
  }
1327
1252
  // /*
1328
1253
  // TODO: