@colabo-knalledge/i-core-services 1.0.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/esm/index.js CHANGED
@@ -8,26 +8,6 @@ var __decorateClass = (decorators, target, key, kind) => {
8
8
  if (kind && result) __defProp(target, key, result);
9
9
  return result;
10
10
  };
11
- var __async = (__this, __arguments, generator) => {
12
- return new Promise((resolve, reject) => {
13
- var fulfilled = (value) => {
14
- try {
15
- step(generator.next(value));
16
- } catch (e) {
17
- reject(e);
18
- }
19
- };
20
- var rejected = (value) => {
21
- try {
22
- step(generator.throw(value));
23
- } catch (e) {
24
- reject(e);
25
- }
26
- };
27
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
28
- step((generator = generator.apply(__this, __arguments)).next());
29
- });
30
- };
31
11
 
32
12
  // lib/params.ts
33
13
  var MODULE_NAME = "@colabo-knalledge/i-core-services";
@@ -185,25 +165,43 @@ var errorInterceptor = (error) => {
185
165
  return Promise.reject(error);
186
166
  };
187
167
  if (DEBUG_VERBOSE) console.log("[ColaboApiCoreService] declaring ColaboApiCoreService class");
188
- var ColaboApiCoreService = class _ColaboApiCoreService {
168
+ var ColaboApiCoreService = class {
169
+ static {
170
+ this.interceptorsForAxios = /* @__PURE__ */ new Map();
171
+ }
189
172
  // Add a response interceptor to remove JSONP prefix that Colabo.Space is sending
190
173
  // https://docs.angularjs.org/api/ng/service/$http#json-vulnerability-protection
191
174
  // https://stackoverflow.com/questions/33967189/angular-not-removing-json-prefix
192
175
  // [Ejecting an interceptor #2615](https://github.com/axios/axios/issues/2615#issuecomment-567964331)
193
176
  static initialize(namespace, specificAxios = axios) {
194
177
  if (DEBUG_VERBOSE) console.log("[ColaboApiCoreService:initialize] Initializing interceptor for the namespace: ", namespace);
195
- if (typeof _ColaboApiCoreService.colaboApiInterceptorId === "undefined") {
196
- _ColaboApiCoreService.colaboApiInterceptorNamespace = namespace;
197
- _ColaboApiCoreService.colaboApiInterceptorId = specificAxios.interceptors.response.use(responseInterceptor, errorInterceptor);
178
+ let axiosImplementation = this.interceptorsForAxios.get(specificAxios);
179
+ if (!axiosImplementation || typeof axiosImplementation.colaboApiInterceptorId === "undefined") {
180
+ const colaboApiInterceptorId = specificAxios.interceptors.response.use(responseInterceptor, errorInterceptor);
181
+ if (!axiosImplementation) {
182
+ axiosImplementation = {
183
+ colaboApiInterceptorId,
184
+ colaboApiInterceptorNamespace: namespace
185
+ };
186
+ this.interceptorsForAxios.set(specificAxios, axiosImplementation);
187
+ } else {
188
+ axiosImplementation.colaboApiInterceptorNamespace = namespace;
189
+ axiosImplementation.colaboApiInterceptorId = colaboApiInterceptorId;
190
+ }
198
191
  if (DEBUG_VERBOSE) console.log("[ColaboApiCoreService:initialize] Initialized interceptor for the namespace: ", namespace);
199
192
  } else {
200
- if (DEBUG_VERBOSE) console.log("[ColaboApiCoreService:initialize] Skipping initialization. The colabo interceptor was already initialized for the namespace: ", _ColaboApiCoreService.colaboApiInterceptorNamespace);
193
+ if (DEBUG_VERBOSE) console.log("[ColaboApiCoreService:initialize] Skipping initialization. The colabo interceptor was already initialized for the namespace: ", axiosImplementation.colaboApiInterceptorNamespace);
201
194
  }
202
- return _ColaboApiCoreService.colaboApiInterceptorId;
195
+ return axiosImplementation.colaboApiInterceptorId;
203
196
  }
204
197
  static destroy(namespace, specificAxios = axios) {
205
198
  if (DEBUG_VERBOSE) console.log("[ColaboApiCoreService:initialize] Destroying interceptor for the namespace: ", namespace);
206
- specificAxios.interceptors.request.eject(_ColaboApiCoreService.colaboApiInterceptorId);
199
+ let axiosImplementation = this.interceptorsForAxios.get(specificAxios);
200
+ if (axiosImplementation) {
201
+ specificAxios.interceptors.request.eject(axiosImplementation.colaboApiInterceptorId);
202
+ } else {
203
+ console.log(`[ColaboApiCoreService:initialize] no axiosImplementation found for the provided axios`);
204
+ }
207
205
  }
208
206
  };
209
207
  injectInterceptorService(ColaboApiCoreService);
@@ -239,77 +237,71 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
239
237
  console.log("[ColaboKnAllEdgeContainerService] created");
240
238
  this.apiUrl = ColaboKnAllEdgeContainerService.serverAP + "/" + KCONTAINER_API_PARAMS.API_PATH + "/";
241
239
  }
242
- getById(id) {
243
- return __async(this, null, function* () {
244
- let result;
245
- const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.INDEX_BY_ID + "/" + id;
246
- if (DEBUG) console.log("[getByIdPromise] url: ", url);
247
- try {
248
- const mResult = yield axios2.get(url);
249
- const serverData = mResult.data;
250
- result = ColaboApiOperators.extractVoFromServerDataAsArray(serverData);
251
- if (!result) {
252
- return Promise.reject(new Error("Problem with extracting data as an array from serverData"));
253
- }
254
- if (ColaboApiOperators.getParentEntity(result).type != KCONTAINER_API_PARAMS.KCONTAINER_TYPE) {
255
- return Promise.reject(new Error("Wrong entity type, expected: " + KCONTAINER_API_PARAMS.KCONTAINER_TYPE));
256
- }
257
- } catch (error) {
258
- console.error(error);
259
- return Promise.reject(error);
240
+ async getById(id) {
241
+ let result;
242
+ const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.INDEX_BY_ID + "/" + id;
243
+ if (DEBUG) console.log("[getByIdPromise] url: ", url);
244
+ try {
245
+ const mResult = await axios2.get(url);
246
+ const serverData = mResult.data;
247
+ result = ColaboApiOperators.extractVoFromServerDataAsArray(serverData);
248
+ if (!result) {
249
+ return Promise.reject(new Error("Problem with extracting data as an array from serverData"));
260
250
  }
261
- return result;
262
- });
251
+ if (ColaboApiOperators.getParentEntity(result).type != KCONTAINER_API_PARAMS.KCONTAINER_TYPE) {
252
+ return Promise.reject(new Error("Wrong entity type, expected: " + KCONTAINER_API_PARAMS.KCONTAINER_TYPE));
253
+ }
254
+ } catch (error) {
255
+ console.error(error);
256
+ return Promise.reject(error);
257
+ }
258
+ return result;
263
259
  }
264
- create(kContainerWContent) {
265
- return __async(this, null, function* () {
266
- console.log("ColaboKnAllEdgeContainerService.create");
267
- let result;
268
- const url = this.apiUrl;
269
- try {
270
- const requestRoot = {
271
- type: KCONTAINER_API_TYPE.CREATE_NEW,
272
- data: kContainerWContent
273
- };
274
- const mResult = yield axios2.post(url, requestRoot, HTTP_OPTIONS_CONST_JSON);
275
- const serverData = mResult.data;
276
- result = ColaboApiOperators.extractVoFromServerData(serverData);
277
- return result;
278
- } catch (error) {
279
- if (error.response) {
280
- console.log("[create]", error);
281
- console.warn("Response status:", error.response.status);
282
- console.warn("Response data:", error.response.data);
283
- if (error.response.data.code === "EMAIL_EXISTS") {
284
- console.warn("EMAIL_EXISTS");
285
- }
286
- return error.response.data;
287
- } else if (error.request) {
288
- console.error("No response received");
289
- } else {
290
- console.error("[ColaboKnAllEdgeContainerService:create] Error during request setup:", error.message);
260
+ async create(kContainerWContent) {
261
+ console.log("ColaboKnAllEdgeContainerService.create");
262
+ let result;
263
+ const url = this.apiUrl;
264
+ try {
265
+ const requestRoot = {
266
+ type: KCONTAINER_API_TYPE.CREATE_NEW,
267
+ data: kContainerWContent
268
+ };
269
+ const mResult = await axios2.post(url, requestRoot, HTTP_OPTIONS_CONST_JSON);
270
+ const serverData = mResult.data;
271
+ result = ColaboApiOperators.extractVoFromServerData(serverData);
272
+ return result;
273
+ } catch (error) {
274
+ if (error.response) {
275
+ console.log("[create]", error);
276
+ console.warn("Response status:", error.response.status);
277
+ console.warn("Response data:", error.response.data);
278
+ if (error.response.data.code === "EMAIL_EXISTS") {
279
+ console.warn("EMAIL_EXISTS");
291
280
  }
292
- rethrowColaboError(error);
293
- throw new ColaboErrorUnreachable2();
281
+ return error.response.data;
282
+ } else if (error.request) {
283
+ console.error("No response received");
284
+ } else {
285
+ console.error("[ColaboKnAllEdgeContainerService:create] Error during request setup:", error.message);
294
286
  }
295
- });
287
+ rethrowColaboError(error);
288
+ throw new ColaboErrorUnreachable2();
289
+ }
296
290
  }
297
- update(kContainer) {
298
- return __async(this, null, function* () {
299
- console.log("ColaboKnAllEdgeContainerService.update");
300
- let result;
301
- const actionType = KCONTAINER_API_TYPE.UPDATE_BY_ID;
302
- const url = this.apiUrl + "one/" + actionType + "/" + kContainer._id;
303
- try {
304
- const mResult = yield axios2.put(url, kContainer, HTTP_OPTIONS_CONST_JSON);
305
- const serverData = mResult.data;
306
- result = ColaboApiOperators.extractVoFromServerData(serverData);
307
- } catch (error) {
308
- console.error(error);
309
- return Promise.reject(error);
310
- }
311
- return result;
312
- });
291
+ async update(kContainer) {
292
+ console.log("ColaboKnAllEdgeContainerService.update");
293
+ let result;
294
+ const actionType = KCONTAINER_API_TYPE.UPDATE_BY_ID;
295
+ const url = this.apiUrl + "one/" + actionType + "/" + kContainer._id;
296
+ try {
297
+ const mResult = await axios2.put(url, kContainer, HTTP_OPTIONS_CONST_JSON);
298
+ const serverData = mResult.data;
299
+ result = ColaboApiOperators.extractVoFromServerData(serverData);
300
+ } catch (error) {
301
+ console.error(error);
302
+ return Promise.reject(error);
303
+ }
304
+ return result;
313
305
  }
314
306
  /**
315
307
  /**
@@ -320,19 +312,17 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
320
312
  * @return {*} {Promise<boolean>}
321
313
  * @memberof ColaboKnAllEdgeContainerService
322
314
  */
323
- destroy(id) {
324
- return __async(this, null, function* () {
325
- console.log(`[destroy] id=${id}`);
326
- const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.DESTROY_ONE + "/" + id;
327
- try {
328
- const mResult = yield axios2.delete(url, HTTP_OPTIONS_CONST_JSON);
329
- const serverData = mResult.data;
330
- return serverData.success;
331
- } catch (error) {
332
- rethrowColaboError(error);
333
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
334
- }
335
- });
315
+ async destroy(id) {
316
+ console.log(`[destroy] id=${id}`);
317
+ const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.DESTROY_ONE + "/" + id;
318
+ try {
319
+ const mResult = await axios2.delete(url, HTTP_OPTIONS_CONST_JSON);
320
+ const serverData = mResult.data;
321
+ return serverData.success;
322
+ } catch (error) {
323
+ rethrowColaboError(error);
324
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
325
+ }
336
326
  }
337
327
  /**
338
328
  * @param containerId The id of the kContainer to which we want to add kNodes
@@ -340,23 +330,21 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
340
330
  * @description adds kNodes in a kContainer
341
331
  * @returns edges created between the container and entities added to the container
342
332
  */
343
- updateAddNodes(containerId, containedIds) {
344
- return __async(this, null, function* () {
345
- if (DEBUG) console.log("[ColaboKnAllEdgeContainerService::updateAddNodes(containerId, containedIds)", containerId, containedIds);
346
- let result;
347
- const idsStr = containedIds.join(",");
348
- const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.UPDATE_ADD_KNODE_BY_IDS + "/" + containerId + "/" + idsStr;
349
- console.log("updateAddNodes called", url);
350
- try {
351
- const mResult = yield axios2.put(url, {}, HTTP_OPTIONS_CONST_JSON);
352
- const serverData = mResult.data;
353
- result = ColaboApiOperators.extractVosFromServerData(serverData);
354
- } catch (error) {
355
- console.error(error);
356
- return Promise.reject(error);
357
- }
358
- return result;
359
- });
333
+ async updateAddNodes(containerId, containedIds) {
334
+ if (DEBUG) console.log("[ColaboKnAllEdgeContainerService::updateAddNodes(containerId, containedIds)", containerId, containedIds);
335
+ let result;
336
+ const idsStr = containedIds.join(",");
337
+ const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.UPDATE_ADD_KNODE_BY_IDS + "/" + containerId + "/" + idsStr;
338
+ console.log("updateAddNodes called", url);
339
+ try {
340
+ const mResult = await axios2.put(url, {}, HTTP_OPTIONS_CONST_JSON);
341
+ const serverData = mResult.data;
342
+ result = ColaboApiOperators.extractVosFromServerData(serverData);
343
+ } catch (error) {
344
+ console.error(error);
345
+ return Promise.reject(error);
346
+ }
347
+ return result;
360
348
  }
361
349
  /**
362
350
  * removes kNodes from a kContainer
@@ -365,67 +353,61 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
365
353
  * @param ids The list of ids of the kNodes we want to remove from the container
366
354
  * @returns edges created between the container and entities added to the container
367
355
  */
368
- updateRemoveNodes(id, ids) {
369
- return __async(this, null, function* () {
370
- console.log("[ColaboKnAllEdgeContainerService::updateRemoveNodes(id, ids)", id, ids);
371
- let result;
372
- const idsStr = ids.join(",");
373
- const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.UPDATE_REMOVE_KNODE_BY_IDS + "/" + id + "/" + idsStr;
374
- console.log("updateRemoveNodes called", url);
375
- try {
376
- const mResult = yield axios2.put(url, {}, HTTP_OPTIONS_CONST_JSON);
377
- const serverData = mResult.data;
378
- result = ColaboApiOperators.extractVosFromServerData(serverData);
379
- } catch (error) {
380
- console.error(error);
381
- return Promise.reject(error);
382
- }
383
- return result;
384
- });
356
+ async updateRemoveNodes(id, ids) {
357
+ console.log("[ColaboKnAllEdgeContainerService::updateRemoveNodes(id, ids)", id, ids);
358
+ let result;
359
+ const idsStr = ids.join(",");
360
+ const url = this.apiUrl + this.defaultAction + "/" + KCONTAINER_API_TYPE.UPDATE_REMOVE_KNODE_BY_IDS + "/" + id + "/" + idsStr;
361
+ console.log("updateRemoveNodes called", url);
362
+ try {
363
+ const mResult = await axios2.put(url, {}, HTTP_OPTIONS_CONST_JSON);
364
+ const serverData = mResult.data;
365
+ result = ColaboApiOperators.extractVosFromServerData(serverData);
366
+ } catch (error) {
367
+ console.error(error);
368
+ return Promise.reject(error);
369
+ }
370
+ return result;
385
371
  }
386
372
  /**
387
373
  *
388
374
  * @param id The id of the kContainer which knodes we want to retrieve
389
375
  * @description retrieves kNodes in a kContainer
390
376
  */
391
- getInContainer(id) {
392
- return __async(this, null, function* () {
393
- let result;
394
- if (DEBUG) console.log(`this.apiUrl:${this.apiUrl}, this.defaultAction:${this.defaultAction}`);
395
- const url = `http://127.0.0.1:8001/kcontainers/` + this.defaultAction + "/" + KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + "/" + id + ".json";
396
- try {
397
- const response = yield this.http.get(url).toPromise();
398
- if (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);
399
- if (!response) {
400
- return [];
401
- }
402
- const processedResponse = CFServiceIsomorphic.processVOs(response, KNodeFrontend);
403
- if (DEBUG_VERBOSE) console.log("[ColaboKnAllEdgeContainerService::getInContainer] response<KNodeFrontend>: ", JSON.stringify(processedResponse, null, 4));
404
- return processedResponse;
405
- } catch (error) {
406
- rethrowColaboError(error);
407
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
377
+ async getInContainer(id) {
378
+ let result;
379
+ if (DEBUG) console.log(`this.apiUrl:${this.apiUrl}, this.defaultAction:${this.defaultAction}`);
380
+ const url = `http://127.0.0.1:8001/kcontainers/` + this.defaultAction + "/" + KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + "/" + id + ".json";
381
+ try {
382
+ const response = await this.http.get(url).toPromise();
383
+ if (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);
384
+ if (!response) {
385
+ return [];
408
386
  }
409
- });
387
+ const processedResponse = CFServiceIsomorphic.processVOs(response, KNodeFrontend);
388
+ if (DEBUG_VERBOSE) console.log("[ColaboKnAllEdgeContainerService::getInContainer] response<KNodeFrontend>: ", JSON.stringify(processedResponse, null, 4));
389
+ return processedResponse;
390
+ } catch (error) {
391
+ rethrowColaboError(error);
392
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
393
+ }
410
394
  }
411
395
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
412
- getVOs(type, upperLayerType) {
413
- return __async(this, null, function* () {
414
- let result;
415
- const url = `${this.apiUrl}${this.defaultAction}/${KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? "/" + upperLayerType : ""}.json`;
416
- const mResult = yield axios2.get(url);
417
- try {
418
- const serverData = mResult.data;
419
- result = ColaboApiOperators.extractVosFromServerData(serverData);
420
- if (!result) {
421
- return Promise.reject(new Error("Couldn't extract VOs from the serverData"));
422
- }
423
- } catch (error) {
424
- console.error(error);
425
- return Promise.reject(error);
396
+ async getVOs(type, upperLayerType) {
397
+ let result;
398
+ const url = `${this.apiUrl}${this.defaultAction}/${KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? "/" + upperLayerType : ""}.json`;
399
+ const mResult = await axios2.get(url);
400
+ try {
401
+ const serverData = mResult.data;
402
+ result = ColaboApiOperators.extractVosFromServerData(serverData);
403
+ if (!result) {
404
+ return Promise.reject(new Error("Couldn't extract VOs from the serverData"));
426
405
  }
427
- return result;
428
- });
406
+ } catch (error) {
407
+ console.error(error);
408
+ return Promise.reject(error);
409
+ }
410
+ return result;
429
411
  }
430
412
  /**
431
413
  * Extracts upper-layer entity from kContainer and sets it up
@@ -535,188 +517,167 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
535
517
  */
536
518
  // eslint-disable-next-line @typescript-eslint/ban-types
537
519
  // OLD: getById(id: string, callback?: Function): Observable<KNodeFrontend> {
538
- getById(id) {
539
- return __async(this, null, function* () {
540
- const url = this.apiUrl + "one/" + this.defaultAction + "/" + id;
541
- console.log(`[ColaboKnAllEdgeNodeService:getById] url: ${url}`);
542
- console.log(`[ColaboKnAllEdgeNodeService:getById] ${this.id}`);
543
- try {
544
- const result = yield axios3.get(url);
545
- const data = result.data;
546
- const kNode = this.extractVOFromDataAsArray(data, KNodeFrontend2);
547
- return kNode;
548
- } catch (e) {
549
- if (isColaboError(e)) {
550
- throw e;
551
- }
552
- const error = e;
553
- if (error.response) {
554
- } else if (error.request) {
555
- throwColaboError2(error.message, EErrorOrigin2.SYSTEM, EColaboErrorKind2.REQUEST_BAD);
556
- } else {
557
- console.error("[ColaboKnAllEdgeNodeService:getById] Error during request setup:");
558
- throwColaboError2(error.message, EErrorOrigin2.SYSTEM, EColaboErrorKind2.REQUEST_BAD);
559
- }
560
- throw new Error("This should never be reached, but throwing just because of TS error in diagnosing unreachable end");
520
+ async getById(id) {
521
+ const url = this.apiUrl + "one/" + this.defaultAction + "/" + id;
522
+ console.log(`[ColaboKnAllEdgeNodeService:getById] url: ${url}`);
523
+ console.log(`[ColaboKnAllEdgeNodeService:getById] ${this.id}`);
524
+ try {
525
+ const result = await axios3.get(url);
526
+ const data = result.data;
527
+ const kNode = this.extractVOFromDataAsArray(data, KNodeFrontend2);
528
+ return kNode;
529
+ } catch (e) {
530
+ if (isColaboError(e)) {
531
+ throw e;
532
+ }
533
+ const error = e;
534
+ if (error.response) {
535
+ } else if (error.request) {
536
+ throwColaboError2(error.message, EErrorOrigin2.SYSTEM, EColaboErrorKind2.REQUEST_BAD);
537
+ } else {
538
+ console.error("[ColaboKnAllEdgeNodeService:getById] Error during request setup:");
539
+ throwColaboError2(error.message, EErrorOrigin2.SYSTEM, EColaboErrorKind2.REQUEST_BAD);
561
540
  }
562
- });
541
+ throw new Error("This should never be reached, but throwing just because of TS error in diagnosing unreachable end");
542
+ }
563
543
  }
564
- getVosWithColaboApi(request) {
565
- return __async(this, null, function* () {
566
- request.type = KNODE_API_TYPE.INDEX_COLABO_API;
567
- const requestSerialized = ColaboApiOperators2.serializeApiRequest(request);
568
- let result = [];
569
- const url = this.apiUrl + KNODE_API_TYPE.INDEX_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
570
- console.log("[getVos] url: ", url);
571
- const mResult = yield axios3.get(url);
572
- try {
573
- const serverData = mResult.data;
574
- if (!serverData) return result;
575
- result = ColaboApiOperators2.extractVosFromServerData(serverData);
576
- if (!result) {
577
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
578
- }
579
- } catch (error) {
580
- console.error(error);
581
- return Promise.reject(error);
544
+ async getVosWithColaboApi(request) {
545
+ request.type = KNODE_API_TYPE.INDEX_COLABO_API;
546
+ const requestSerialized = ColaboApiOperators2.serializeApiRequest(request);
547
+ let result = [];
548
+ const url = this.apiUrl + KNODE_API_TYPE.INDEX_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
549
+ console.log("[getVos] url: ", url);
550
+ const mResult = await axios3.get(url);
551
+ try {
552
+ const serverData = mResult.data;
553
+ if (!serverData) return result;
554
+ result = ColaboApiOperators2.extractVosFromServerData(serverData);
555
+ if (!result) {
556
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
582
557
  }
583
- return result;
584
- });
558
+ } catch (error) {
559
+ console.error(error);
560
+ return Promise.reject(error);
561
+ }
562
+ return result;
585
563
  }
586
- updateSingleWithColaboApi(request) {
587
- return __async(this, null, function* () {
588
- const kNodes = yield this.updateWithColaboApi(request);
589
- if (!kNodes) throw new Error("kNodes is not defined");
590
- if (kNodes.length <= 0) throw new Error("kNodes is empty");
591
- return kNodes[0];
592
- });
564
+ async updateSingleWithColaboApi(request) {
565
+ const kNodes = await this.updateWithColaboApi(request);
566
+ if (!kNodes) throw new Error("kNodes is not defined");
567
+ if (kNodes.length <= 0) throw new Error("kNodes is empty");
568
+ return kNodes[0];
593
569
  }
594
- updateWithColaboApi(request) {
595
- return __async(this, null, function* () {
596
- var _a, _b;
597
- request.type = KNODE_API_TYPE.UPDATE_COLABO_API;
598
- let result;
599
- const url = this.apiUrl + KNODE_API_TYPE.UPDATE_COLABO_API + ".json";
600
- console.log("[getVos] url: ", url);
601
- let mResult;
602
- try {
603
- mResult = yield axios3.put(url, request);
604
- } catch (error) {
605
- console.error(`${contextReportText}Error updating: ${error}`);
606
- return Promise.reject(error);
570
+ async updateWithColaboApi(request) {
571
+ request.type = KNODE_API_TYPE.UPDATE_COLABO_API;
572
+ let result;
573
+ const url = this.apiUrl + KNODE_API_TYPE.UPDATE_COLABO_API + ".json";
574
+ console.log("[getVos] url: ", url);
575
+ let mResult;
576
+ try {
577
+ mResult = await axios3.put(url, request);
578
+ } catch (error) {
579
+ console.error(`${contextReportText}Error updating: ${error}`);
580
+ return Promise.reject(error);
581
+ }
582
+ try {
583
+ const serverData = mResult.data;
584
+ if (!serverData.success) {
585
+ console.error(`Error updating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);
586
+ return Promise.reject(serverData);
607
587
  }
608
- try {
609
- const serverData = mResult.data;
610
- if (!serverData.success) {
611
- console.error(`Error updating: [code: ${(_a = serverData.error) == null ? void 0 : _a.kind}] ${(_b = serverData.error) == null ? void 0 : _b.message}`);
612
- return Promise.reject(serverData);
613
- }
614
- result = ColaboApiOperators2.extractVosFromServerData(serverData);
615
- if (!result) {
616
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
617
- }
618
- } catch (error) {
619
- console.error(error);
620
- return Promise.reject(error);
588
+ result = ColaboApiOperators2.extractVosFromServerData(serverData);
589
+ if (!result) {
590
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
621
591
  }
622
- return result;
623
- });
592
+ } catch (error) {
593
+ console.error(error);
594
+ return Promise.reject(error);
595
+ }
596
+ return result;
624
597
  }
625
598
  // getVOs(type:string):Observable<KNodeFrontend[]> {
626
599
  // return this.queryInMapofType(ColaboKnAllEdgeNodeService.mapId,type);
627
600
  // }
628
- createSingle(kNode) {
629
- return __async(this, null, function* () {
630
- const kNodesCreated = yield this.create(kNode);
631
- if (!Array.isArray(kNodesCreated) || kNodesCreated.length <= 0) throw new Error(`${contextReportText()} No kNode created`);
632
- const kNodeCreated = kNodesCreated[0];
633
- return kNodeCreated;
634
- });
601
+ async createSingle(kNode) {
602
+ const kNodesCreated = await this.create(kNode);
603
+ if (!Array.isArray(kNodesCreated) || kNodesCreated.length <= 0) throw new Error(`${contextReportText()} No kNode created`);
604
+ const kNodeCreated = kNodesCreated[0];
605
+ return kNodeCreated;
635
606
  }
636
607
  /** creates a new Element (VO) */
637
608
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
638
- create(kNode, callback) {
639
- return __async(this, null, function* () {
640
- var _a, _b;
641
- console.log(`${contextReportText()}`);
642
- let result;
643
- const request = {
644
- type: KNODE_API_TYPE.CREATE_COLABO_API,
645
- data: kNode
646
- };
647
- const url = this.apiUrl;
648
- try {
649
- const mResult = yield axios3.post(url, request, HTTP_OPTIONS_CONST_JSON);
650
- const serverData = mResult.data;
651
- if (!serverData.success) {
652
- throw new Error(`${contextReportText} Error creating node. [code: ${(_a = serverData.error) == null ? void 0 : _a.kind}] ${(_b = serverData.error) == null ? void 0 : _b.message}`);
653
- }
654
- result = ColaboApiOperators2.extractVoFromServerData(serverData);
655
- } catch (error) {
656
- rethrowColaboError2(error);
657
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
609
+ async create(kNode, callback) {
610
+ console.log(`${contextReportText()}`);
611
+ let result;
612
+ const request = {
613
+ type: KNODE_API_TYPE.CREATE_COLABO_API,
614
+ data: kNode
615
+ };
616
+ const url = this.apiUrl;
617
+ try {
618
+ const mResult = await axios3.post(url, request, HTTP_OPTIONS_CONST_JSON);
619
+ const serverData = mResult.data;
620
+ if (!serverData.success) {
621
+ throw new Error(`${contextReportText} Error creating node. [code: ${serverData.error?.kind}] ${serverData.error?.message}`);
658
622
  }
659
- return result;
660
- });
623
+ result = ColaboApiOperators2.extractVoFromServerData(serverData);
624
+ } catch (error) {
625
+ rethrowColaboError2(error);
626
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
627
+ }
628
+ return result;
661
629
  }
662
- createWithColaboApi(request) {
663
- return __async(this, null, function* () {
664
- var _a, _b;
665
- request.type = KNODE_API_TYPE.CREATE_COLABO_API;
666
- let result;
667
- const url = this.apiUrl + KNODE_API_TYPE.CREATE_COLABO_API + ".json";
668
- console.log("[getVos] url: ", url);
669
- let mResult;
670
- try {
671
- mResult = yield axios3.post(url, request);
672
- } catch (error) {
673
- console.error(`${contextReportText}Error updating: ${error}`);
674
- return Promise.reject(error);
630
+ async createWithColaboApi(request) {
631
+ request.type = KNODE_API_TYPE.CREATE_COLABO_API;
632
+ let result;
633
+ const url = this.apiUrl + KNODE_API_TYPE.CREATE_COLABO_API + ".json";
634
+ console.log("[getVos] url: ", url);
635
+ let mResult;
636
+ try {
637
+ mResult = await axios3.post(url, request);
638
+ } catch (error) {
639
+ console.error(`${contextReportText}Error updating: ${error}`);
640
+ return Promise.reject(error);
641
+ }
642
+ try {
643
+ const serverData = mResult.data;
644
+ if (!serverData.success) {
645
+ console.error(`Error creating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);
646
+ return Promise.reject(serverData);
675
647
  }
676
- try {
677
- const serverData = mResult.data;
678
- if (!serverData.success) {
679
- console.error(`Error creating: [code: ${(_a = serverData.error) == null ? void 0 : _a.kind}] ${(_b = serverData.error) == null ? void 0 : _b.message}`);
680
- return Promise.reject(serverData);
681
- }
682
- result = ColaboApiOperators2.extractVoFromServerData(serverData);
683
- if (!result) {
684
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
685
- }
686
- } catch (error) {
687
- console.error(error);
688
- return Promise.reject(error);
648
+ result = ColaboApiOperators2.extractVoFromServerData(serverData);
649
+ if (!result) {
650
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
689
651
  }
690
- return result;
691
- });
652
+ } catch (error) {
653
+ console.error(error);
654
+ return Promise.reject(error);
655
+ }
656
+ return result;
692
657
  }
693
658
  /** destroys the Element (VO) with the `_id === id` */
694
659
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
695
- destroy(id) {
696
- return __async(this, null, function* () {
697
- return true;
698
- });
660
+ async destroy(id) {
661
+ return true;
699
662
  }
700
- destroyWithColaboApi(request) {
701
- return __async(this, null, function* () {
702
- request.type = KNODE_API_TYPE.DESTROY_COLABO_API;
703
- const requestSerialized = ColaboApiOperators2.serializeApiRequest(request);
704
- let result;
705
- const url = this.apiUrl + KNODE_API_TYPE.DESTROY_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
706
- console.log("[getVos] url: ", url);
707
- const mResult = yield axios3.delete(url);
708
- try {
709
- const serverData = mResult.data;
710
- result = ColaboApiOperators2.extractVosFromServerData(serverData);
711
- if (!result) {
712
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
713
- }
714
- } catch (error) {
715
- console.error(error);
716
- return Promise.reject(error);
663
+ async destroyWithColaboApi(request) {
664
+ request.type = KNODE_API_TYPE.DESTROY_COLABO_API;
665
+ const requestSerialized = ColaboApiOperators2.serializeApiRequest(request);
666
+ let result;
667
+ const url = this.apiUrl + KNODE_API_TYPE.DESTROY_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
668
+ console.log("[getVos] url: ", url);
669
+ const mResult = await axios3.delete(url);
670
+ try {
671
+ const serverData = mResult.data;
672
+ result = ColaboApiOperators2.extractVosFromServerData(serverData);
673
+ if (!result) {
674
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
717
675
  }
718
- return result;
719
- });
676
+ } catch (error) {
677
+ console.error(error);
678
+ return Promise.reject(error);
679
+ }
680
+ return result;
720
681
  }
721
682
  /** gets Elements (VOs) to populate the list */
722
683
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -749,24 +710,22 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
749
710
  this.knAllEdgeRealTimeService = null;
750
711
  console.log("[ColaboKnAllEdgeNodeServiceExtended:constructor] constructed");
751
712
  }
752
- queryByIds(ids, callback) {
753
- return __async(this, null, function* () {
754
- console.log("queryByIds", ids);
755
- const idsStr = ids.join(",");
756
- const url = this.apiUrl + KNODE_API_TYPE2.INDEX_ID_IN + "/" + this.defaultAction + "/" + idsStr + ".json";
757
- try {
758
- const mResult = yield axios4.get(url);
759
- const serverData = mResult.data;
760
- const result = CFServiceIsomorphic.processVOs(serverData, KNodeFrontend3);
761
- if (callback) {
762
- callback(result);
763
- }
764
- return result;
765
- } catch (error) {
766
- rethrowColaboError3(error);
767
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
713
+ async queryByIds(ids, callback) {
714
+ console.log("queryByIds", ids);
715
+ const idsStr = ids.join(",");
716
+ const url = this.apiUrl + KNODE_API_TYPE2.INDEX_ID_IN + "/" + this.defaultAction + "/" + idsStr + ".json";
717
+ try {
718
+ const mResult = await axios4.get(url);
719
+ const serverData = mResult.data;
720
+ const result = CFServiceIsomorphic.processVOs(serverData, KNodeFrontend3);
721
+ if (callback) {
722
+ callback(result);
768
723
  }
769
- });
724
+ return result;
725
+ } catch (error) {
726
+ rethrowColaboError3(error);
727
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
728
+ }
770
729
  }
771
730
  /**
772
731
  * 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
@@ -827,21 +786,19 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
827
786
  * @example URL:http://localhost:8001/knodes/one/default/5a156965d0b7970f365e1a4b.json
828
787
  */
829
788
  // eslint-disable-next-line @typescript-eslint/ban-types
830
- destroy(id, callback) {
831
- return __async(this, null, function* () {
832
- try {
833
- const mResult = yield axios4.delete(this.apiUrl + "one/" + this.defaultAction + "/" + id, HTTP_OPTIONS_CONST_JSON);
834
- const serverData = mResult.data;
835
- const result = serverData.success;
836
- if (callback) {
837
- callback(result);
838
- }
839
- return result;
840
- } catch (error) {
841
- rethrowColaboError3(error);
842
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
789
+ async destroy(id, callback) {
790
+ try {
791
+ const mResult = await axios4.delete(this.apiUrl + "one/" + this.defaultAction + "/" + id, HTTP_OPTIONS_CONST_JSON);
792
+ const serverData = mResult.data;
793
+ const result = serverData.success;
794
+ if (callback) {
795
+ callback(result);
843
796
  }
844
- });
797
+ return result;
798
+ } catch (error) {
799
+ rethrowColaboError3(error);
800
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
801
+ }
845
802
  }
846
803
  /**
847
804
  * Updates the provided node on the server and returns its server-updated appearance
@@ -854,34 +811,32 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
854
811
  http://localhost:8001/knodes/one/UPDATE_NODE_NAME_FINAL/5a156935d0b7970f365e1a42.json
855
812
  */
856
813
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
857
- update(kNode, actionType, patch, callback) {
858
- return __async(this, null, function* () {
859
- function updateResponse(nodeFromServer) {
860
- const responseTime = /* @__PURE__ */ new Date();
861
- }
862
- let result;
863
- const id = kNode._id;
864
- const kNodeForServer = patch ? patch : kNode.toServerCopy();
865
- actionType = actionType !== null ? actionType : ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME_FINAL;
866
- if (kNode.state == VOFrontend.STATE_LOCAL) {
867
- window.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);
868
- result = void 0;
869
- return result;
870
- } else {
871
- try {
872
- const mResult = yield axios4.put(this.apiUrl + "one/" + actionType + "/" + id, kNodeForServer, HTTP_OPTIONS_CONST_JSON);
873
- const serverData = mResult.data;
874
- const result2 = this.extractVO(serverData, KNodeFrontend3);
875
- if (callback) {
876
- callback(result2);
877
- }
878
- return result2;
879
- } catch (error) {
880
- rethrowColaboError3(error);
881
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
814
+ async update(kNode, actionType, patch, callback) {
815
+ function updateResponse(nodeFromServer) {
816
+ const responseTime = /* @__PURE__ */ new Date();
817
+ }
818
+ let result;
819
+ const id = kNode._id;
820
+ const kNodeForServer = patch ? patch : kNode.toServerCopy();
821
+ actionType = actionType !== null ? actionType : ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME_FINAL;
822
+ if (kNode.state == VOFrontend.STATE_LOCAL) {
823
+ window.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);
824
+ result = void 0;
825
+ return result;
826
+ } else {
827
+ try {
828
+ const mResult = await axios4.put(this.apiUrl + "one/" + actionType + "/" + id, kNodeForServer, HTTP_OPTIONS_CONST_JSON);
829
+ const serverData = mResult.data;
830
+ const result2 = this.extractVO(serverData, KNodeFrontend3);
831
+ if (callback) {
832
+ callback(result2);
882
833
  }
834
+ return result2;
835
+ } catch (error) {
836
+ rethrowColaboError3(error);
837
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
883
838
  }
884
- });
839
+ }
885
840
  }
886
841
  // getVOs(type: string): Observable<KNodeFrontend[] | undefined> {
887
842
  // return this.queryInMapofType(ColaboKnAllEdgeNodeServiceExtended.mapId, type);
@@ -1094,75 +1049,67 @@ var KnalledgeEdgeService = class extends CFServiceIsomorphic {
1094
1049
  this.apiUrl = KnalledgeEdgeService.serverAP + "/" + KEDGE_API_PARAMS.API_PATH + "/";
1095
1050
  console.log("[KnalledgeEdgeService] REST API URL: ", chalk2.bold.white(this.apiUrl));
1096
1051
  }
1097
- getVosWithColaboApi(request) {
1098
- return __async(this, null, function* () {
1099
- request.type = KEDGE_API_TYPE.INDEX_COLABO_API;
1100
- console.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);
1101
- const requestSerialized = ColaboApiOperators3.serializeApiRequest(request);
1102
- let result;
1103
- const url = this.apiUrl + KEDGE_API_TYPE.INDEX_COLABO_API + "/" + requestSerialized + ".json";
1104
- console.log("[getVos] url: ", url);
1105
- const mResult = yield axios5.get(url);
1106
- try {
1107
- const serverData = mResult.data;
1108
- result = ColaboApiOperators3.extractVosFromServerData(serverData);
1109
- if (!result) {
1110
- return Promise.reject(new Error("Error with extracting VOs from serverData"));
1111
- }
1112
- } catch (error) {
1113
- console.error(error);
1114
- return Promise.reject(error);
1052
+ async getVosWithColaboApi(request) {
1053
+ request.type = KEDGE_API_TYPE.INDEX_COLABO_API;
1054
+ console.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);
1055
+ const requestSerialized = ColaboApiOperators3.serializeApiRequest(request);
1056
+ let result;
1057
+ const url = this.apiUrl + KEDGE_API_TYPE.INDEX_COLABO_API + "/" + requestSerialized + ".json";
1058
+ console.log("[getVos] url: ", url);
1059
+ const mResult = await axios5.get(url);
1060
+ try {
1061
+ const serverData = mResult.data;
1062
+ result = ColaboApiOperators3.extractVosFromServerData(serverData);
1063
+ if (!result) {
1064
+ return Promise.reject(new Error("Error with extracting VOs from serverData"));
1115
1065
  }
1116
- return result;
1117
- });
1066
+ } catch (error) {
1067
+ console.error(error);
1068
+ return Promise.reject(error);
1069
+ }
1070
+ return result;
1118
1071
  }
1119
1072
  /** creates a new Element (VO) */
1120
1073
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
1121
- createWithPromise(kEdge, callback) {
1122
- return __async(this, null, function* () {
1123
- var _a, _b;
1124
- console.log(`${contextReportText2()}`);
1125
- let result;
1126
- const request = {
1127
- type: KEDGE_API_TYPE.CREATE_COLABO_API,
1128
- data: kEdge
1129
- };
1130
- const url = this.apiUrl;
1131
- try {
1132
- const mResult = yield axios5.post(url, request, HTTP_OPTIONS_CONST_JSON);
1133
- const serverData = mResult.data;
1134
- if (!serverData.success) {
1135
- throw new Error(`${contextReportText2} Error creating edge. code: ${(_a = serverData.error) == null ? void 0 : _a.kind}, error msg: ${(_b = serverData.error) == null ? void 0 : _b.message}`);
1136
- }
1137
- result = ColaboApiOperators3.extractVoFromServerData(serverData);
1138
- } catch (error) {
1139
- console.error(error);
1140
- return Promise.reject(error);
1074
+ async createWithPromise(kEdge, callback) {
1075
+ console.log(`${contextReportText2()}`);
1076
+ let result;
1077
+ const request = {
1078
+ type: KEDGE_API_TYPE.CREATE_COLABO_API,
1079
+ data: kEdge
1080
+ };
1081
+ const url = this.apiUrl;
1082
+ try {
1083
+ const mResult = await axios5.post(url, request, HTTP_OPTIONS_CONST_JSON);
1084
+ const serverData = mResult.data;
1085
+ if (!serverData.success) {
1086
+ throw new Error(`${contextReportText2} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);
1141
1087
  }
1142
- return result;
1143
- });
1088
+ result = ColaboApiOperators3.extractVoFromServerData(serverData);
1089
+ } catch (error) {
1090
+ console.error(error);
1091
+ return Promise.reject(error);
1092
+ }
1093
+ return result;
1144
1094
  }
1145
1095
  /** creates a new Element (VO) */
1146
1096
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
1147
- createWithRequest(request) {
1148
- return __async(this, null, function* () {
1149
- var _a, _b;
1150
- console.log(`${contextReportText2()}`);
1151
- let result;
1152
- const url = this.apiUrl;
1153
- try {
1154
- const mResult = yield axios5.post(url, request, HTTP_OPTIONS_CONST_JSON);
1155
- const serverData = mResult.data;
1156
- if (!serverData.success) {
1157
- throw new Error(`${contextReportText2} Error creating edge. code: ${(_a = serverData.error) == null ? void 0 : _a.kind}, error msg: ${(_b = serverData.error) == null ? void 0 : _b.message}`);
1158
- }
1159
- result = ColaboApiOperators3.extractVoFromServerData(serverData);
1160
- } catch (error) {
1161
- console.error(error);
1162
- return Promise.reject(error);
1097
+ async createWithRequest(request) {
1098
+ console.log(`${contextReportText2()}`);
1099
+ let result;
1100
+ const url = this.apiUrl;
1101
+ try {
1102
+ const mResult = await axios5.post(url, request, HTTP_OPTIONS_CONST_JSON);
1103
+ const serverData = mResult.data;
1104
+ if (!serverData.success) {
1105
+ throw new Error(`${contextReportText2} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);
1163
1106
  }
1164
- return result;
1165
- });
1107
+ result = ColaboApiOperators3.extractVoFromServerData(serverData);
1108
+ } catch (error) {
1109
+ console.error(error);
1110
+ return Promise.reject(error);
1111
+ }
1112
+ return result;
1166
1113
  }
1167
1114
  };
1168
1115
  KnalledgeEdgeService = __decorateClass([
@@ -1193,23 +1140,21 @@ var KnalledgeEdgeServiceExtended = class extends KnalledgeEdgeService {
1193
1140
  * @returns {Observable<KEdge>} retrieved edge
1194
1141
  */
1195
1142
  // eslint-disable-next-line @typescript-eslint/ban-types
1196
- getById(id, callback) {
1197
- return __async(this, null, function* () {
1198
- console.log("getById(" + id + ")");
1199
- const url = this.apiUrl + "one/" + id;
1200
- try {
1201
- const mResult = yield axios6.get(url);
1202
- const serverData = mResult.data;
1203
- const result = this.extractVO(serverData, KEdge);
1204
- if (callback) {
1205
- callback(result);
1206
- }
1207
- return result;
1208
- } catch (error) {
1209
- rethrowColaboError4(error);
1210
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1143
+ async getById(id, callback) {
1144
+ console.log("getById(" + id + ")");
1145
+ const url = this.apiUrl + "one/" + id;
1146
+ try {
1147
+ const mResult = await axios6.get(url);
1148
+ const serverData = mResult.data;
1149
+ const result = this.extractVO(serverData, KEdge);
1150
+ if (callback) {
1151
+ callback(result);
1211
1152
  }
1212
- });
1153
+ return result;
1154
+ } catch (error) {
1155
+ rethrowColaboError4(error);
1156
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1157
+ }
1213
1158
  }
1214
1159
  /**
1215
1160
  * Creates the provided edge on the server and returns its server-updated appearance
@@ -1218,29 +1163,27 @@ var KnalledgeEdgeServiceExtended = class extends KnalledgeEdgeService {
1218
1163
  * @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)
1219
1164
  @example http://localhost:8001/kedges/in_map/default/579811d88e12abfa556f6b59.json
1220
1165
  */
1221
- create(kEdge, callback) {
1222
- return __async(this, null, function* () {
1223
- let result;
1224
- if (false) {
1225
- } else {
1226
- if (!kEdge.toServerCopy) {
1227
- throw new Error("kEdge.toServerCopy is not defined");
1228
- }
1229
- const kEdgeForServer = kEdge.toServerCopy();
1230
- try {
1231
- const mResult = yield axios6.post(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON);
1232
- const serverData = mResult.data;
1233
- const result2 = this.extractVO(serverData, KEdge);
1234
- if (callback) {
1235
- callback(result2);
1236
- }
1237
- return result2;
1238
- } catch (error) {
1239
- rethrowColaboError4(error);
1240
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1166
+ async create(kEdge, callback) {
1167
+ let result;
1168
+ if (false) {
1169
+ } else {
1170
+ if (!kEdge.toServerCopy) {
1171
+ throw new Error("kEdge.toServerCopy is not defined");
1172
+ }
1173
+ const kEdgeForServer = kEdge.toServerCopy();
1174
+ try {
1175
+ const mResult = await axios6.post(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON);
1176
+ const serverData = mResult.data;
1177
+ const result2 = this.extractVO(serverData, KEdge);
1178
+ if (callback) {
1179
+ callback(result2);
1241
1180
  }
1181
+ return result2;
1182
+ } catch (error) {
1183
+ rethrowColaboError4(error);
1184
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1242
1185
  }
1243
- });
1186
+ }
1244
1187
  }
1245
1188
  /**
1246
1189
  * Deletes the KEdge from the server
@@ -1249,21 +1192,19 @@ var KnalledgeEdgeServiceExtended = class extends KnalledgeEdgeService {
1249
1192
  * @param {function} callback Function to be called when the edge is deleted
1250
1193
  * @example URL:http://localhost:8001/kedges/one/default/5a156965d0b7970f365e1a4b.json
1251
1194
  */
1252
- destroy(id, callback) {
1253
- return __async(this, null, function* () {
1254
- try {
1255
- const mResult = yield axios6.delete(this.apiUrl + "one/" + id, HTTP_OPTIONS_CONST_JSON);
1256
- const serverData = mResult.data;
1257
- const result = serverData.success;
1258
- if (callback) {
1259
- callback(result);
1260
- }
1261
- return result;
1262
- } catch (error) {
1263
- rethrowColaboError4(error);
1264
- throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1195
+ async destroy(id, callback) {
1196
+ try {
1197
+ const mResult = await axios6.delete(this.apiUrl + "one/" + id, HTTP_OPTIONS_CONST_JSON);
1198
+ const serverData = mResult.data;
1199
+ const result = serverData.success;
1200
+ if (callback) {
1201
+ callback(result);
1265
1202
  }
1266
- });
1203
+ return result;
1204
+ } catch (error) {
1205
+ rethrowColaboError4(error);
1206
+ throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
1207
+ }
1267
1208
  }
1268
1209
  // /*
1269
1210
  // TODO: