@colabo-knalledge/i-core-services 1.6.0 → 1.7.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [@colabo-knalledge/i-core-services-v1.7.0](https://github.com/Cha-OS/colabo/compare/@colabo-knalledge/i-core-services-v1.6.0...@colabo-knalledge/i-core-services-v1.7.0) (2026-06-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * **knalledge:** add fetchFn injection to all GET service methods for worker-based fetch ([275eb46](https://github.com/Cha-OS/colabo/commit/275eb462595cd57b5bc4ad28bdb7bc8bff4ebe34))
7
+
1
8
  # [@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
9
 
3
10
 
package/dist/cjs/index.js CHANGED
@@ -431,11 +431,13 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
431
431
  * @param id The id of the kContainer which kNodes we want to retrieve
432
432
  * @description retrieves kNodes in a kContainer
433
433
  */
434
- async getInContainer(id, fields) {
435
- let result;
434
+ async getInContainer(id, fields, fetchFn) {
436
435
  const url = import_i_core4.ColaboApiOperators.appendFieldsParam(this.apiUrl + this.defaultAction + "/" + import_i_core4.KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + "/" + id + ".json", fields);
437
436
  if (DEBUG) console.log(`this.apiUrl:${this.apiUrl}, this.defaultAction:${this.defaultAction}`);
438
437
  try {
438
+ if (fetchFn) {
439
+ return await fetchFn(url);
440
+ }
439
441
  const response = await this.http.get(url).toPromise();
440
442
  if (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);
441
443
  if (!response) {
@@ -450,11 +452,14 @@ var ColaboKnAllEdgeContainerService = class extends CFServiceIsomorphic {
450
452
  }
451
453
  }
452
454
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
453
- async getVOs(type, upperLayerType, fields) {
455
+ async getVOs(type, upperLayerType, fields, fetchFn) {
454
456
  let result;
455
457
  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);
456
- const mResult = await import_axios2.default.get(url);
457
458
  try {
459
+ if (fetchFn) {
460
+ return await fetchFn(url);
461
+ }
462
+ const mResult = await import_axios2.default.get(url);
458
463
  const serverData = mResult.data;
459
464
  result = import_i_core4.ColaboApiOperators.extractVosFromServerData(serverData);
460
465
  if (!result) {
@@ -600,14 +605,17 @@ var ColaboKnAllEdgeNodeService = class extends CFServiceIsomorphic {
600
605
  throw new Error("This should never be reached, but throwing just because of TS error in diagnosing unreachable end");
601
606
  }
602
607
  }
603
- async getVosWithColaboApi(request) {
608
+ async getVosWithColaboApi(request, fetchFn) {
604
609
  request.type = import_i_core10.KNODE_API_TYPE.INDEX_COLABO_API;
605
610
  const requestSerialized = import_i_core10.ColaboApiOperators.serializeApiRequest(request);
606
611
  let result = [];
607
612
  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
613
  if (DEBUG3) console.log("[getVos] url: ", url);
609
- const mResult = await import_axios3.default.get(url);
610
614
  try {
615
+ if (fetchFn) {
616
+ return await fetchFn(url);
617
+ }
618
+ const mResult = await import_axios3.default.get(url);
611
619
  const serverData = mResult.data;
612
620
  if (!serverData) return result;
613
621
  result = import_i_core10.ColaboApiOperators.extractVosFromServerData(serverData);
@@ -789,11 +797,16 @@ var ColaboKnAllEdgeNodeServiceExtended = class extends ColaboKnAllEdgeNodeServic
789
797
  static get mapId() {
790
798
  return config2.GetString("mapId");
791
799
  }
792
- async queryByIds(ids, fields, callback) {
800
+ async queryByIds(ids, fields, callback, fetchFn) {
793
801
  if (DEBUG4) console.log("queryByIds", ids);
794
802
  const idsStr = ids.join(",");
795
803
  const url = import_i_core15.ColaboApiOperators.appendFieldsParam(this.apiUrl + import_i_core15.KNODE_API_TYPE.INDEX_ID_IN + "/" + this.defaultAction + "/" + idsStr + ".json", fields);
796
804
  try {
805
+ if (fetchFn) {
806
+ const rawNodes = await fetchFn(url);
807
+ if (callback) callback(rawNodes);
808
+ return rawNodes;
809
+ }
797
810
  const mResult = await import_axios4.default.get(url);
798
811
  const serverData = mResult.data;
799
812
  const result = CFServiceIsomorphic.processVOs(serverData, import_i_core14.KNodeFrontend);
@@ -1128,15 +1141,18 @@ var KnalledgeEdgeService = class extends CFServiceIsomorphic {
1128
1141
  this.apiUrl = KnalledgeEdgeService.serverAP + "/" + import_i_core18.KEDGE_API_PARAMS.API_PATH + "/";
1129
1142
  console.log("[KnalledgeEdgeService] REST API URL: ", import_i_core19.chalk.bold.white(this.apiUrl));
1130
1143
  }
1131
- async getVosWithColaboApi(request) {
1144
+ async getVosWithColaboApi(request, fetchFn) {
1132
1145
  request.type = import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API;
1133
1146
  console.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);
1134
1147
  const requestSerialized = import_i_core18.ColaboApiOperators.serializeApiRequest(request);
1135
1148
  let result;
1136
1149
  const url = import_i_core18.ColaboApiOperators.appendFieldsParam(this.apiUrl + import_i_core18.KEDGE_API_TYPE.INDEX_COLABO_API + "/" + requestSerialized, request.fields);
1137
1150
  console.log("[getVos] url: ", url);
1138
- const mResult = await import_axios5.default.get(url);
1139
1151
  try {
1152
+ if (fetchFn) {
1153
+ return await fetchFn(url);
1154
+ }
1155
+ const mResult = await import_axios5.default.get(url);
1140
1156
  const serverData = mResult.data;
1141
1157
  result = import_i_core18.ColaboApiOperators.extractVosFromServerData(serverData);
1142
1158
  if (!result) {