@colabo-knalledge/i-core-services 1.5.2 → 1.6.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/CHANGELOG.md +35 -0
- package/dist/cjs/index.js +94 -58
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +101 -65
- package/dist/esm/index.js.map +3 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib/cf.service.isomorphic.d.ts +1 -1
- package/dist/types/lib/colabo-api-core.service.d.ts +1 -0
- package/dist/types/lib/kContainer-service.d.ts +11 -5
- package/dist/types/lib/kEdge-service-extended.d.ts +1 -1
- package/dist/types/lib/kNode-service-extended.d.ts +2 -2
- package/dist/types/lib/kNode-service.d.ts +3 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
# [@colabo-knalledge/i-core-services-v1.6.0](https://github.com/Cha-OS/colabo/compare/@colabo-knalledge/i-core-services-v1.5.3...@colabo-knalledge/i-core-services-v1.6.0) (2026-06-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **@colabo-knalledge/i-core-services:** :bug: Fixed bug with hardcoded 127.0.0.1 ([dcb6a5f](https://github.com/Cha-OS/colabo/commit/dcb6a5fc84c96e1a605368f9e693275655230a28))
|
|
7
|
+
* **@colabo-knalledge/i-core-services:** :bug: Fixed bug with hardcoded 127.0.0.1 ([13302f5](https://github.com/Cha-OS/colabo/commit/13302f53fb01a1a836a52062ac3c4428ebfdd471))
|
|
8
|
+
* **@colabo-knalledge/i-core-services:** :bug: remove `.json` suffix from kEdge ColaboAPI URL ([1927d88](https://github.com/Cha-OS/colabo/commit/1927d8815be39eb7eb19aab4d1fa99f90a733930))
|
|
9
|
+
* **@colabo-knalledge:** improve diagnostic logging with context and DEBUG guards ([4890981](https://github.com/Cha-OS/colabo/commit/48909811ff1f55ae324d9b0504206d0d57efc187))
|
|
10
|
+
* **@colabo:** :arrow_up: Bumped up versions ([4e7bdd1](https://github.com/Cha-OS/colabo/commit/4e7bdd133e80f09b25ff974f35ee1a8448308333))
|
|
11
|
+
* **@colabo:** :arrow_up: Bumped up versions ([71ea2c4](https://github.com/Cha-OS/colabo/commit/71ea2c49754d2e16c37a0ee0582e9addfa457028))
|
|
12
|
+
* **@colabo:** :arrow_up: Bumped versions ([058d9f1](https://github.com/Cha-OS/colabo/commit/058d9f19ed9e7cb4f5e57489463c61b0bf650a81))
|
|
13
|
+
* **@colabo:** :bug: Fixed support for releasing the current branch ([b672e34](https://github.com/Cha-OS/colabo/commit/b672e340bb959475be6228f69fab19592ce2d893))
|
|
14
|
+
* **@colabo:** :bug: Fixes running backend code in ESM env ([206280d](https://github.com/Cha-OS/colabo/commit/206280d510e7b5b5d619d992667d67a4a432c47c))
|
|
15
|
+
* **@colabo:** :bug: Fixes running backend code in ESM env ([de71e80](https://github.com/Cha-OS/colabo/commit/de71e806e7af084ff60204612324273a73586562))
|
|
16
|
+
* **@colabo:** :bug: Instatiates store on demand instead on "imports" ([b872a8b](https://github.com/Cha-OS/colabo/commit/b872a8b69ff24bcc0c715ef74635ec33fbdcabe7))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **@colabo-flow/f-core:** :sparkles: Initial work toward zustand store and separating store into a service code ([0292bcc](https://github.com/Cha-OS/colabo/commit/0292bcc460d9cd0215f5dc074d8fe2c06f34cde0))
|
|
22
|
+
* **@colabo-flow/i-core:** :sparkles: Adds flow and flowchestrator store, FlowChestrator API (Nest.js => Bun -> Jarn), Extends token with RIMA ([ac50af6](https://github.com/Cha-OS/colabo/commit/ac50af6ecf3dcbfc812204dd647d44461c0fbfdd))
|
|
23
|
+
* **@colabo-flow/sa-flowchestrator:** :sparkles: Adds flow instance features, fixes COARS, returns ServerData results and protects JSONP ([6eb45e8](https://github.com/Cha-OS/colabo/commit/6eb45e8e94cb5d8a6865887efe0065f3da4b5a83))
|
|
24
|
+
* **@colabo-knalledge/i-core-services:** :sparkles: add fields projection to isomorphic kEdge services ([aa2b587](https://github.com/Cha-OS/colabo/commit/aa2b5871208b64c2fd6eb2fbc78f6e0bf41a0d90))
|
|
25
|
+
* **@colabo-knalledge/i-core-services:** :sparkles: add fields projection to isomorphic kNode and kContainer services ([7286a34](https://github.com/Cha-OS/colabo/commit/7286a34a9b2998db1a869f939b8bf02f64405b47))
|
|
26
|
+
* **@colabo-knalledge:** add bulk client methods for batch annotation insertion ([6daf47a](https://github.com/Cha-OS/colabo/commit/6daf47a43b96f9dcee867030ed2ce9ed07d75d84))
|
|
27
|
+
* **KnAllEdge:** ✨ add edgeDataContent support when adding nodes to container ([1bd3b74](https://github.com/Cha-OS/colabo/commit/1bd3b74cfb2d882f4fcdfe0f7471ad058a2dbc72))
|
|
28
|
+
|
|
29
|
+
# [@colabo-knalledge/i-core-services-v1.5.3](https://github.com/Cha-OS/colabo/compare/@colabo-knalledge/i-core-services-v1.5.2...@colabo-knalledge/i-core-services-v1.5.3) (2025-02-28)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **@colabo:** :arrow_up: Bumped up versions ([b5f9e64](https://github.com/Cha-OS/colabo/commit/b5f9e64103f601f9fb1004c9392a3969c86d427f))
|
|
35
|
+
|
|
1
36
|
# [@colabo-knalledge/i-core-services-v1.5.2](https://github.com/Cha-OS/colabo/compare/@colabo-knalledge/i-core-services-v1.5.1...@colabo-knalledge/i-core-services-v1.5.2) (2025-02-27)
|
|
2
37
|
|
|
3
38
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -48,6 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
KnalledgeEdgeService: () => KnalledgeEdgeService,
|
|
49
49
|
KnalledgeEdgeServiceExtended: () => KnalledgeEdgeServiceExtended,
|
|
50
50
|
MODULE_NAME: () => MODULE_NAME,
|
|
51
|
+
addSecurityPrefix: () => addSecurityPrefix,
|
|
51
52
|
removeSecurityPrefix: () => removeSecurityPrefix
|
|
52
53
|
});
|
|
53
54
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -69,7 +70,8 @@ var import_i_core2 = require("@colabo-headless/i-core");
|
|
|
69
70
|
var import_i_notifications = require("@colabo-utils/i-notifications");
|
|
70
71
|
var import_i_notifications2 = require("@colabo-utils/i-notifications");
|
|
71
72
|
var config = __toESM(require("@colabo-utils/i-config"), 1);
|
|
72
|
-
|
|
73
|
+
var DEBUG2 = false;
|
|
74
|
+
if (DEBUG2) console.log("[CFServiceIsomorphic] Injectable: ", import_i_core2.Injectable);
|
|
73
75
|
var HIDE_ERRORS = true;
|
|
74
76
|
var HTTP_OPTIONS_CONST_JSON = {
|
|
75
77
|
headers: {
|
|
@@ -80,6 +82,11 @@ var CFServiceIsomorphic = class {
|
|
|
80
82
|
constructor(utilsNotificationService) {
|
|
81
83
|
this.utilsNotificationService = utilsNotificationService;
|
|
82
84
|
}
|
|
85
|
+
// RESTfull backend API url
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
87
|
+
static get serverAP() {
|
|
88
|
+
return config.GetString("serverUrl");
|
|
89
|
+
}
|
|
83
90
|
/**
|
|
84
91
|
* processes array of VOs received from server to a local/fronted version
|
|
85
92
|
* @param vofS
|
|
@@ -170,9 +177,6 @@ var CFServiceIsomorphic = class {
|
|
|
170
177
|
};
|
|
171
178
|
}
|
|
172
179
|
};
|
|
173
|
-
// RESTfull backend API url
|
|
174
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
175
|
-
CFServiceIsomorphic.serverAP = config.GetGeneral("serverUrl");
|
|
176
180
|
CFServiceIsomorphic = __decorateClass([
|
|
177
181
|
(0, import_i_core2.Injectable)()
|
|
178
182
|
], CFServiceIsomorphic);
|
|
@@ -184,7 +188,7 @@ var import_i_core5 = require("@colabo-headless/i-core");
|
|
|
184
188
|
// lib/colabo-api-core.service.ts
|
|
185
189
|
var import_axios = __toESM(require("axios"), 1);
|
|
186
190
|
var import_i_core3 = require("@colabo-headless/i-core");
|
|
187
|
-
console.log("[ColaboApiCoreService] Initializing");
|
|
191
|
+
if (DEBUG) console.log("[ColaboApiCoreService] Initializing");
|
|
188
192
|
var responseInterceptor = (response) => {
|
|
189
193
|
if (DEBUG_VERBOSE) console.log("[axios::interceptor::colabo-api-core.service] response.data: ", JSON.stringify(response.data, null, 4));
|
|
190
194
|
if (typeof response.data !== "string") {
|
|
@@ -195,6 +199,10 @@ var responseInterceptor = (response) => {
|
|
|
195
199
|
response.data = JSON.parse(removeSecurityPrefix(data));
|
|
196
200
|
return response;
|
|
197
201
|
};
|
|
202
|
+
var addSecurityPrefix = (data) => {
|
|
203
|
+
const dataSecured = ")]}',\n" + JSON.stringify(data);
|
|
204
|
+
return dataSecured;
|
|
205
|
+
};
|
|
198
206
|
var removeSecurityPrefix = (data) => {
|
|
199
207
|
let index = data.indexOf("\r");
|
|
200
208
|
const indexN = data.indexOf("\n");
|
|
@@ -258,7 +266,6 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
|
|
|
258
266
|
this.utilsNotificationService = utilsNotificationService;
|
|
259
267
|
this.defaultAction = "default";
|
|
260
268
|
puzzleConfig = (0, import_i_config.GetPuzzle)(MODULE_NAME);
|
|
261
|
-
ColaboKnAllEdgeContainerService.serverAP = puzzleConfig.serverUrl;
|
|
262
269
|
if (!this.http) {
|
|
263
270
|
if (import_i_core5.currentContext === import_i_core5.CONTEXTS.FRONTEND_ANGULAR) {
|
|
264
271
|
const msg = "[ColaboKnAllEdgeContainerService] DI Problem: There is no provider injected for the service `HttpClient`.";
|
|
@@ -280,29 +287,34 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
|
|
|
280
287
|
console.log("[ColaboKnAllEdgeContainerService] created");
|
|
281
288
|
this.apiUrl = ColaboKnAllEdgeContainerService.serverAP + "/" + import_i_core4.KCONTAINER_API_PARAMS.API_PATH + "/";
|
|
282
289
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Retrieves the kContainer with a given ID. It retrieves only the kContainer kNode, not all the kNodes that are in the kContainer.
|
|
292
|
+
* @param id the id of the kContainer to be retrieved
|
|
293
|
+
* @returns
|
|
294
|
+
*/
|
|
295
|
+
async getById(id, fields) {
|
|
296
|
+
let retrievedKContainer;
|
|
297
|
+
const url = import_i_core4.ColaboApiOperators.appendFieldsParam(this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.INDEX_BY_ID + "/" + id, fields);
|
|
286
298
|
if (DEBUG) console.log("[getByIdPromise] url: ", url);
|
|
287
299
|
try {
|
|
288
300
|
const mResult = await import_axios2.default.get(url);
|
|
289
301
|
const serverData = mResult.data;
|
|
290
|
-
|
|
291
|
-
if (!
|
|
302
|
+
retrievedKContainer = import_i_core4.ColaboApiOperators.extractVoFromServerDataAsArray(serverData);
|
|
303
|
+
if (!retrievedKContainer) {
|
|
292
304
|
return Promise.reject(new Error("Problem with extracting data as an array from serverData"));
|
|
293
305
|
}
|
|
294
|
-
if (import_i_core4.ColaboApiOperators.getParentEntity(
|
|
306
|
+
if (import_i_core4.ColaboApiOperators.getParentEntity(retrievedKContainer).type != import_i_core4.KCONTAINER_API_PARAMS.KCONTAINER_TYPE) {
|
|
295
307
|
return Promise.reject(new Error("Wrong entity type, expected: " + import_i_core4.KCONTAINER_API_PARAMS.KCONTAINER_TYPE));
|
|
296
308
|
}
|
|
297
309
|
} catch (error) {
|
|
298
310
|
console.error(error);
|
|
299
311
|
return Promise.reject(error);
|
|
300
312
|
}
|
|
301
|
-
return
|
|
313
|
+
return retrievedKContainer;
|
|
302
314
|
}
|
|
303
315
|
async create(kContainerWContent) {
|
|
304
316
|
console.log("ColaboKnAllEdgeContainerService.create");
|
|
305
|
-
let
|
|
317
|
+
let createdKContainer;
|
|
306
318
|
const url = this.apiUrl;
|
|
307
319
|
try {
|
|
308
320
|
const requestRoot = {
|
|
@@ -311,8 +323,8 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
|
|
|
311
323
|
};
|
|
312
324
|
const mResult = await import_axios2.default.post(url, requestRoot, HTTP_OPTIONS_CONST_JSON);
|
|
313
325
|
const serverData = mResult.data;
|
|
314
|
-
|
|
315
|
-
return
|
|
326
|
+
createdKContainer = import_i_core4.ColaboApiOperators.extractVoFromServerData(serverData);
|
|
327
|
+
return createdKContainer;
|
|
316
328
|
} catch (error) {
|
|
317
329
|
if (error.response) {
|
|
318
330
|
console.log("[create]", error);
|
|
@@ -370,17 +382,19 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
|
|
|
370
382
|
/**
|
|
371
383
|
* @param containerId The id of the kContainer to which we want to add kNodes
|
|
372
384
|
* @param containedIds The list of ids of the kNodes we want to add to the container
|
|
385
|
+
* @param edgeDataContent Optional dataContent to set on the created edges (e.g. `{ type: "litterra.corpus.document" }`)
|
|
373
386
|
* @description adds kNodes in a kContainer
|
|
374
387
|
* @returns edges created between the container and entities added to the container
|
|
375
388
|
*/
|
|
376
|
-
async updateAddNodes(containerId, containedIds) {
|
|
389
|
+
async updateAddNodes(containerId, containedIds, edgeDataContent) {
|
|
377
390
|
if (DEBUG) console.log("[ColaboKnAllEdgeContainerService::updateAddNodes(containerId, containedIds)", containerId, containedIds);
|
|
378
391
|
let result;
|
|
379
392
|
const idsStr = containedIds.join(",");
|
|
380
393
|
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);
|
|
394
|
+
if (DEBUG) console.log("updateAddNodes called", url);
|
|
382
395
|
try {
|
|
383
|
-
const
|
|
396
|
+
const body = edgeDataContent ? { edgeDataContent } : {};
|
|
397
|
+
const mResult = await import_axios2.default.put(url, body, HTTP_OPTIONS_CONST_JSON);
|
|
384
398
|
const serverData = mResult.data;
|
|
385
399
|
result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
|
|
386
400
|
} catch (error) {
|
|
@@ -414,13 +428,13 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
|
|
|
414
428
|
}
|
|
415
429
|
/**
|
|
416
430
|
*
|
|
417
|
-
* @param id The id of the kContainer which
|
|
431
|
+
* @param id The id of the kContainer which kNodes we want to retrieve
|
|
418
432
|
* @description retrieves kNodes in a kContainer
|
|
419
433
|
*/
|
|
420
|
-
async getInContainer(id) {
|
|
434
|
+
async getInContainer(id, fields) {
|
|
421
435
|
let result;
|
|
436
|
+
const url = import_i_core4.ColaboApiOperators.appendFieldsParam(this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + "/" + id + ".json", fields);
|
|
422
437
|
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
438
|
try {
|
|
425
439
|
const response = await this.http.get(url).toPromise();
|
|
426
440
|
if (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);
|
|
@@ -436,9 +450,9 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
|
|
|
436
450
|
}
|
|
437
451
|
}
|
|
438
452
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
439
|
-
async getVOs(type, upperLayerType) {
|
|
453
|
+
async getVOs(type, upperLayerType, fields) {
|
|
440
454
|
let result;
|
|
441
|
-
const url = `${this.apiUrl}${this.defaultAction}/${import_i_core4.KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? "/" + upperLayerType : ""}.json
|
|
455
|
+
const url = import_i_core4.ColaboApiOperators.appendFieldsParam(`${this.apiUrl}${this.defaultAction}/${import_i_core4.KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? "/" + upperLayerType : ""}.json`, fields);
|
|
442
456
|
const mResult = await import_axios2.default.get(url);
|
|
443
457
|
try {
|
|
444
458
|
const serverData = mResult.data;
|
|
@@ -509,7 +523,9 @@ var import_i_config2 = require("@colabo-utils/i-config");
|
|
|
509
523
|
var import_i_core10 = require("@colabo-knalledge/i-core");
|
|
510
524
|
var import_i_notifications5 = require("@colabo-utils/i-notifications");
|
|
511
525
|
var import_i_core11 = require("@colabo-knalledge/i-core");
|
|
512
|
-
|
|
526
|
+
var DEBUG3 = false;
|
|
527
|
+
var DEBUG_VERBOSE2 = false;
|
|
528
|
+
if (DEBUG3) console.info(`[ColaboKnAllEdgeNodeService] Current context: ${import_i_core9.currentContext}`);
|
|
513
529
|
var class_id = 1;
|
|
514
530
|
var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
515
531
|
/**
|
|
@@ -541,15 +557,15 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
|
541
557
|
}
|
|
542
558
|
} else {
|
|
543
559
|
this.http = new import_i_core7.HttpClient(null);
|
|
544
|
-
console.log(`[ColaboKnAllEdgeNodeService:${this.id}] invited from the isomorphic context. Creating and initializing vanilla HttpClient ...`);
|
|
560
|
+
if (DEBUG3) console.log(`[ColaboKnAllEdgeNodeService:${this.id}] invited from the isomorphic context. Creating and initializing vanilla HttpClient ...`);
|
|
545
561
|
}
|
|
546
562
|
}
|
|
547
|
-
console.log("[ColaboKnAllEdgeNodeService] created");
|
|
563
|
+
if (DEBUG3) console.log("[ColaboKnAllEdgeNodeService] created");
|
|
548
564
|
const puzzleConfig2 = (0, import_i_config2.GetPuzzle)(MODULE_NAME);
|
|
549
565
|
this.serverAP = puzzleConfig2.serverUrl;
|
|
550
|
-
console.log("[ColaboKnAllEdgeNodeService] connecting to backend: ", import_i_core8.chalk.bold.white(this.serverAP));
|
|
566
|
+
if (DEBUG3) console.log("[ColaboKnAllEdgeNodeService] connecting to backend: ", import_i_core8.chalk.bold.white(this.serverAP));
|
|
551
567
|
this.apiUrl = this.serverAP + "/" + import_i_core11.KNODE_API_PARAMS.API_PATH + "/";
|
|
552
|
-
console.log("[ColaboKnAllEdgeNodeService] REST API URL: ", import_i_core8.chalk.bold.white(this.apiUrl));
|
|
568
|
+
if (DEBUG3) console.log("[ColaboKnAllEdgeNodeService] REST API URL: ", import_i_core8.chalk.bold.white(this.apiUrl));
|
|
553
569
|
}
|
|
554
570
|
/**
|
|
555
571
|
* Get a KN Node from the server by its `id`
|
|
@@ -560,10 +576,10 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
|
560
576
|
*/
|
|
561
577
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
562
578
|
// OLD: getById(id: string, callback?: Function): Observable<KNodeFrontend> {
|
|
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}`);
|
|
579
|
+
async getById(id, fields) {
|
|
580
|
+
const url = import_i_core10.ColaboApiOperators.appendFieldsParam(this.apiUrl + "one/" + this.defaultAction + "/" + id, fields);
|
|
581
|
+
if (DEBUG3) console.log(`[ColaboKnAllEdgeNodeService:getById] url: ${url}`);
|
|
582
|
+
if (DEBUG3) console.log(`[ColaboKnAllEdgeNodeService:getById] ${this.id}`);
|
|
567
583
|
try {
|
|
568
584
|
const result = await import_axios3.default.get(url);
|
|
569
585
|
const data = result.data;
|
|
@@ -588,8 +604,8 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
|
588
604
|
request.type = import_i_core10.KNODE_API_TYPE.INDEX_COLABO_API;
|
|
589
605
|
const requestSerialized = import_i_core10.ColaboApiOperators.serializeApiRequest(request);
|
|
590
606
|
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);
|
|
607
|
+
const url = import_i_core10.ColaboApiOperators.appendFieldsParam(this.apiUrl + import_i_core10.KNODE_API_TYPE.INDEX_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json", request.fields);
|
|
608
|
+
if (DEBUG3) console.log("[getVos] url: ", url);
|
|
593
609
|
const mResult = await import_axios3.default.get(url);
|
|
594
610
|
try {
|
|
595
611
|
const serverData = mResult.data;
|
|
@@ -614,7 +630,8 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
|
614
630
|
request.type = import_i_core10.KNODE_API_TYPE.UPDATE_COLABO_API;
|
|
615
631
|
let result;
|
|
616
632
|
const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.UPDATE_COLABO_API + ".json";
|
|
617
|
-
console.log("[
|
|
633
|
+
if (DEBUG3) console.log("[updateWithColaboApi] url: ", url);
|
|
634
|
+
if (DEBUG_VERBOSE2) console.log("[updateWithColaboApi] request: ", JSON.stringify(request, null, 4));
|
|
618
635
|
let mResult;
|
|
619
636
|
try {
|
|
620
637
|
mResult = await import_axios3.default.put(url, request);
|
|
@@ -647,10 +664,24 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
|
647
664
|
const kNodeCreated = kNodesCreated[0];
|
|
648
665
|
return kNodeCreated;
|
|
649
666
|
}
|
|
667
|
+
/** creates multiple KNodes in a single bulk request */
|
|
668
|
+
async createBulk(kNodes) {
|
|
669
|
+
if (DEBUG_VERBOSE2) console.log(`${(0, import_i_core10.contextReportText)(this)} bulk creating ${kNodes.length} nodes`);
|
|
670
|
+
const url = this.apiUrl + "bulk";
|
|
671
|
+
try {
|
|
672
|
+
const mResult = await import_axios3.default.post(url, kNodes, HTTP_OPTIONS_CONST_JSON);
|
|
673
|
+
const created = mResult.data;
|
|
674
|
+
if (DEBUG3) console.log(`${(0, import_i_core10.contextReportText)(this)} bulk created ${created.length} nodes`);
|
|
675
|
+
return created;
|
|
676
|
+
} catch (error) {
|
|
677
|
+
(0, import_i_notifications4.rethrowColaboError)(error);
|
|
678
|
+
throw new Error("This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`");
|
|
679
|
+
}
|
|
680
|
+
}
|
|
650
681
|
/** creates a new Element (VO) */
|
|
651
682
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
|
|
652
683
|
async create(kNode, callback) {
|
|
653
|
-
console.log(`${(0, import_i_core10.contextReportText)()}`);
|
|
684
|
+
if (DEBUG_VERBOSE2) console.log(`${(0, import_i_core10.contextReportText)(this)} creating node: name=${kNode.name}, type=${kNode.type}`);
|
|
654
685
|
let result;
|
|
655
686
|
const request = {
|
|
656
687
|
type: import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API,
|
|
@@ -674,7 +705,7 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
|
674
705
|
request.type = import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API;
|
|
675
706
|
let result;
|
|
676
707
|
const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.CREATE_COLABO_API + ".json";
|
|
677
|
-
console.log("[getVos] url: ", url);
|
|
708
|
+
if (DEBUG3) console.log("[getVos] url: ", url);
|
|
678
709
|
let mResult;
|
|
679
710
|
try {
|
|
680
711
|
mResult = await import_axios3.default.post(url, request);
|
|
@@ -708,7 +739,7 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
|
|
|
708
739
|
const requestSerialized = import_i_core10.ColaboApiOperators.serializeApiRequest(request);
|
|
709
740
|
let result;
|
|
710
741
|
const url = this.apiUrl + import_i_core10.KNODE_API_TYPE.DESTROY_COLABO_API + "/" + this.defaultAction + "/" + requestSerialized + ".json";
|
|
711
|
-
console.log("[getVos] url: ", url);
|
|
742
|
+
if (DEBUG3) console.log("[getVos] url: ", url);
|
|
712
743
|
const mResult = await import_axios3.default.delete(url);
|
|
713
744
|
try {
|
|
714
745
|
const serverData = mResult.data;
|
|
@@ -740,8 +771,9 @@ var import_i_core14 = require("@colabo-knalledge/i-core");
|
|
|
740
771
|
var import_i_notifications6 = require("@colabo-utils/i-notifications");
|
|
741
772
|
var config2 = __toESM(require("@colabo-utils/i-config"), 1);
|
|
742
773
|
var import_i_core15 = require("@colabo-knalledge/i-core");
|
|
743
|
-
|
|
744
|
-
console.log("[ColaboKnAllEdgeNodeServiceExtended]
|
|
774
|
+
var DEBUG4 = false;
|
|
775
|
+
if (DEBUG4) console.log("[ColaboKnAllEdgeNodeServiceExtended] Injectable: ", import_i_core12.Injectable);
|
|
776
|
+
if (DEBUG4) console.log("[ColaboKnAllEdgeNodeServiceExtended] HttpClient: ", import_i_core13.HttpClient);
|
|
745
777
|
var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeService {
|
|
746
778
|
// protected http:HttpClient = null;
|
|
747
779
|
// protected utilsNotificationService: UtilsNotificationService;
|
|
@@ -751,12 +783,16 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
751
783
|
this.knalledgeMapQueue = null;
|
|
752
784
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
753
785
|
this.knAllEdgeRealTimeService = null;
|
|
754
|
-
console.log("[ColaboKnAllEdgeNodeServiceExtended:constructor] constructed");
|
|
786
|
+
if (DEBUG4) console.log("[ColaboKnAllEdgeNodeServiceExtended:constructor] constructed");
|
|
787
|
+
}
|
|
788
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
789
|
+
static get mapId() {
|
|
790
|
+
return config2.GetString("mapId");
|
|
755
791
|
}
|
|
756
|
-
async queryByIds(ids, callback) {
|
|
757
|
-
console.log("queryByIds", ids);
|
|
792
|
+
async queryByIds(ids, fields, callback) {
|
|
793
|
+
if (DEBUG4) console.log("queryByIds", ids);
|
|
758
794
|
const idsStr = ids.join(",");
|
|
759
|
-
const url = this.apiUrl + import_i_core15.KNODE_API_TYPE.INDEX_ID_IN + "/" + this.defaultAction + "/" + idsStr + ".json";
|
|
795
|
+
const url = import_i_core15.ColaboApiOperators.appendFieldsParam(this.apiUrl + import_i_core15.KNODE_API_TYPE.INDEX_ID_IN + "/" + this.defaultAction + "/" + idsStr + ".json", fields);
|
|
760
796
|
try {
|
|
761
797
|
const mResult = await import_axios4.default.get(url);
|
|
762
798
|
const serverData = mResult.data;
|
|
@@ -780,7 +816,7 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
780
816
|
*/
|
|
781
817
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
782
818
|
// async create(kNode: KNodeFrontend, callback?: Function): Promise<KNodeFrontend> {
|
|
783
|
-
// console.log(`[ColaboKnAllEdgeNodeServiceExtended.create] kNode: ${JSON.stringify(kNode, null, 4)}`);
|
|
819
|
+
// if(DEBUG) console.log(`[ColaboKnAllEdgeNodeServiceExtended.create] kNode: ${JSON.stringify(kNode, null, 4)}`);
|
|
784
820
|
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
785
821
|
// let kNodeForServer: any;
|
|
786
822
|
// if (kNode.toServerCopy) kNodeForServer = kNode.toServerCopy();
|
|
@@ -941,7 +977,7 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
941
977
|
// }
|
|
942
978
|
// // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types, @typescript-eslint/explicit-module-boundary-types
|
|
943
979
|
// queryInMapofTypeAndContentData(mapId: string, type: string, contentDataPath: string, data: any, callback?: Function): Observable<KNodeFrontend[] | undefined> {
|
|
944
|
-
// console.log("queryInMapofTypeAndContentData", mapId, type, contentDataPath, data);
|
|
980
|
+
// if(DEBUG) console.log("queryInMapofTypeAndContentData", mapId, type, contentDataPath, data);
|
|
945
981
|
// const result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(
|
|
946
982
|
// this.apiUrl + "in_map_of_type_and_content_data/" + this.defaultAction + "/" + mapId + "/" + type + "/" + contentDataPath + "/" + data + ".json"
|
|
947
983
|
// ).pipe(
|
|
@@ -954,7 +990,7 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
954
990
|
// return result;
|
|
955
991
|
// }
|
|
956
992
|
// queryInMapofTypeForUser(mapId: string, type: string, iAmid: string, callback?: Function): Observable<KNodeFrontend[] | undefined> {
|
|
957
|
-
// console.log("queryInMapofTypeForUser", mapId, type, iAmid);
|
|
993
|
+
// if(DEBUG) console.log("queryInMapofTypeForUser", mapId, type, iAmid);
|
|
958
994
|
// const result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(this.apiUrl + "in_map_of_type_for_user/" + this.defaultAction + "/" + mapId + "/" + type + "/" + iAmid + ".json").pipe(
|
|
959
995
|
// map((nodesFromServer) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),
|
|
960
996
|
// catchError(this.handleErrorForObservable("ColaboKnAllEdgeNodeServiceExtended::queryInMap", undefined))
|
|
@@ -968,7 +1004,7 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
968
1004
|
// destroyByTypeInMap(type: string, mapId: string, callback?: Function): Observable<boolean> {
|
|
969
1005
|
// //TODO:NG2 fix usage of this function to expect boolean
|
|
970
1006
|
// const result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + "by-type-in-map/" + this.defaultAction + "/" + type + "/" + mapId + ".json", HTTP_OPTIONS_CONST_JSON).pipe(
|
|
971
|
-
// tap((_) => console.log(`deleted nodes type=${type} and mapId=${mapId}`)),
|
|
1007
|
+
// tap((_) => if(DEBUG) console.log(`deleted nodes type=${type} and mapId=${mapId}`)),
|
|
972
1008
|
// map((serverData: ServerData) => serverData.success),
|
|
973
1009
|
// catchError(this.handleErrorForObservable<boolean>("destroyByTypeInMap"))
|
|
974
1010
|
// );
|
|
@@ -996,7 +1032,7 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
996
1032
|
// destroyByUser(iAmid: string): Observable<boolean> {
|
|
997
1033
|
// //TODO:NG2 fix usage of this function to expect boolean
|
|
998
1034
|
// const result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + "by-user/" + this.defaultAction + "/" + iAmid + ".json", HTTP_OPTIONS_CONST_JSON).pipe(
|
|
999
|
-
// tap((_: ServerData) => console.log(`deleted nodes: iAmid=${iAmid}`)),
|
|
1035
|
+
// tap((_: ServerData) => if(DEBUG) console.log(`deleted nodes: iAmid=${iAmid}`)),
|
|
1000
1036
|
// map((serverData: ServerData) => serverData.success),
|
|
1001
1037
|
// catchError(this.handleErrorForObservable<boolean>("destroyByUser"))
|
|
1002
1038
|
// );
|
|
@@ -1022,7 +1058,7 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
1022
1058
|
// destroyByTypeByUser(type: string, iAmid: string, callback?: Function): Observable<boolean> {
|
|
1023
1059
|
// //TODO:NG2 fix usage of this function to expect boolean
|
|
1024
1060
|
// const result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + "by-type-n-user/" + this.defaultAction + "/" + type + "/" + iAmid + ".json", HTTP_OPTIONS_CONST_JSON).pipe(
|
|
1025
|
-
// tap((_) => console.log(`deleted nodes type=${type} and iAmid=${iAmid}`)),
|
|
1061
|
+
// tap((_) => if(DEBUG) console.log(`deleted nodes type=${type} and iAmid=${iAmid}`)),
|
|
1026
1062
|
// map((serverData: ServerData) => serverData.success),
|
|
1027
1063
|
// catchError(this.handleErrorForObservable<boolean>("destroyByTypeByUser"))
|
|
1028
1064
|
// );
|
|
@@ -1048,8 +1084,6 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
|
|
|
1048
1084
|
// return result;
|
|
1049
1085
|
// }
|
|
1050
1086
|
};
|
|
1051
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
1052
|
-
ColaboKnAllEdgeNodeServiceExtended.mapId = config2.GetGeneral("mapId");
|
|
1053
1087
|
ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME_FINAL = "UPDATE_NODE_NAME_FINAL";
|
|
1054
1088
|
ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME = "UPDATE_NODE_NAME";
|
|
1055
1089
|
ColaboKnAllEdgeNodeServiceExtended = __decorateClass([
|
|
@@ -1064,6 +1098,8 @@ var import_axios5 = __toESM(require("axios"), 1);
|
|
|
1064
1098
|
var import_i_core19 = require("@colabo-headless/i-core");
|
|
1065
1099
|
var import_i_core20 = require("@colabo-headless/i-core");
|
|
1066
1100
|
var import_i_notifications7 = require("@colabo-utils/i-notifications");
|
|
1101
|
+
var DEBUG5 = false;
|
|
1102
|
+
var DEBUG_VERBOSE3 = false;
|
|
1067
1103
|
var KnalledgeEdgeService = class extends CFServiceIsomorphic {
|
|
1068
1104
|
constructor(http, utilsNotificationService) {
|
|
1069
1105
|
super(utilsNotificationService);
|
|
@@ -1097,7 +1133,7 @@ var KnalledgeEdgeService = class extends CFServiceIsomorphic {
|
|
|
1097
1133
|
console.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);
|
|
1098
1134
|
const requestSerialized = import_i_core18.ColaboApiOperators.serializeApiRequest(request);
|
|
1099
1135
|
let result;
|
|
1100
|
-
const url = this.apiUrl + import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API + "/" + requestSerialized
|
|
1136
|
+
const url = import_i_core18.ColaboApiOperators.appendFieldsParam(this.apiUrl + import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API + "/" + requestSerialized, request.fields);
|
|
1101
1137
|
console.log("[getVos] url: ", url);
|
|
1102
1138
|
const mResult = await import_axios5.default.get(url);
|
|
1103
1139
|
try {
|
|
@@ -1115,7 +1151,7 @@ var KnalledgeEdgeService = class extends CFServiceIsomorphic {
|
|
|
1115
1151
|
/** creates a new Element (VO) */
|
|
1116
1152
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
|
|
1117
1153
|
async createWithPromise(kEdge, callback) {
|
|
1118
|
-
console.log(`${(0, import_i_core18.contextReportText)()}`);
|
|
1154
|
+
if (DEBUG_VERBOSE3) console.log(`${(0, import_i_core18.contextReportText)(this)} creating edge: sourceId=${kEdge.sourceId}, targetId=${kEdge.targetId}, type=${kEdge.type}`);
|
|
1119
1155
|
let result;
|
|
1120
1156
|
const request = {
|
|
1121
1157
|
type: import_i_core18.KEDGE_API_TYPE.CREATE_COLABO_API,
|
|
@@ -1138,7 +1174,7 @@ var KnalledgeEdgeService = class extends CFServiceIsomorphic {
|
|
|
1138
1174
|
/** creates a new Element (VO) */
|
|
1139
1175
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types
|
|
1140
1176
|
async createWithRequest(request) {
|
|
1141
|
-
console.log(`${(0, import_i_core18.contextReportText)()}`);
|
|
1177
|
+
if (DEBUG5) console.log(`${(0, import_i_core18.contextReportText)(this)} request type=${request.type}, activity=${request.activity ?? "default"}`);
|
|
1142
1178
|
let result;
|
|
1143
1179
|
const url = this.apiUrl;
|
|
1144
1180
|
try {
|
|
@@ -1183,9 +1219,9 @@ var KnalledgeEdgeServiceExtended = class extends KnalledgeEdgeService {
|
|
|
1183
1219
|
* @returns {Observable<KEdge>} retrieved edge
|
|
1184
1220
|
*/
|
|
1185
1221
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1186
|
-
async getById(id, callback) {
|
|
1222
|
+
async getById(id, fields, callback) {
|
|
1187
1223
|
console.log("getById(" + id + ")");
|
|
1188
|
-
const url = this.apiUrl + "one/" + id;
|
|
1224
|
+
const url = import_i_core22.ColaboApiOperators.appendFieldsParam(this.apiUrl + "one/" + id, fields);
|
|
1189
1225
|
try {
|
|
1190
1226
|
const mResult = await import_axios6.default.get(url);
|
|
1191
1227
|
const serverData = mResult.data;
|