@colabo-knalledge/i-core-services 1.5.3 → 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 +28 -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/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../index.ts", "../../lib/params.ts", "../../lib/kContainer-service.ts", "../../lib/cf.service.isomorphic.ts", "../../lib/colabo-api-core.service.ts", "../../lib/kNode-service.ts", "../../lib/kNode-service-extended.ts", "../../lib/kEdge-service.ts", "../../lib/kEdge-service-extended.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Public API Surface of `@colabo-knalledge/i-core-services`\n */\n\n\nexport { ColaboKnAllEdgeContainerService } from \"./lib/kContainer-service\";\nexport { ColaboKnAllEdgeNodeService } from \"./lib/kNode-service\";\nexport { ColaboKnAllEdgeNodeServiceExtended } from \"./lib/kNode-service-extended\";\nexport { KnalledgeEdgeService } from \"./lib/kEdge-service\";\nexport { KnalledgeEdgeServiceExtended } from \"./lib/kEdge-service-extended\";\n\nexport { removeSecurityPrefix } from './lib/colabo-api-core.service';\n\n// TODO: [Should we remove it?](/colabo.space-development-gists/javascript/bundlers/webpack/issues-problems.md#Cross-puzzles-circular-dependencies-through-puzzles'-barrels)\nexport * from \"./common\";\n", "export const MODULE_NAME: string = \"@colabo-knalledge/i-core-services\";\n\n/**\n * Describes puzzle configuration\n */\nexport interface IPuzzleConfig {\n\t/** url to the server (backend) providing the KnAllEdge API */\n\tserverUrl: string;\n}\n\nexport const DEBUG: boolean = false;\nexport const DEBUG_VERBOSE: boolean = false;", "import { DEBUG } from \"./params\";\n\nimport { GetPuzzle } from \"@colabo-utils/i-config\";\n\nimport { ElementServiceIsomorphic } from \"./element.service.isomorphic\";\nimport { ServerData, IKNode } from \"@colabo-knalledge/i-core\";\nimport { NotificationMsg, NotificationMsgType, rethrowColaboError, ColaboErrorUnreachable } from \"@colabo-utils/i-notifications\";\nimport { IKEdge, KCONTAINER_API_PARAMS, KCONTAINER_API_TYPE, KNodeFrontend, IKContainer, IKContainerWContent, IApiRequest, ColaboApiOperators } from \"@colabo-knalledge/i-core\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\nimport { DEBUG_VERBOSE, MODULE_NAME } from \"./params\";\n\n// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosResponse } from \"axios\";\n\nimport { currentContext, CONTEXTS, Injectable, HttpClient, HttpHandler } from \"@colabo-headless/i-core\";\nimport { ColaboApiCoreService } from \"./colabo-api-core.service\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// console.log(\"[ColaboKnAllEdgeContainerService] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\n// console.log(\"[ColaboKnAllEdgeContainerService] Injectable: \", Injectable);\n// console.log(\"[ColaboKnAllEdgeContainerService] HttpClient: \", HttpClient);\n\ninterface IKContainerConfig {\n\tserverUrl: string;\n}\n\nlet puzzleConfig: IKContainerConfig;\n\n// interface IConstructor<T> {\n// new (...args: any[]): T;\n// // TODO: mprinc: Changed the return type from `T` to `VOIsomorphic` as it was complaining in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts and\n// // colabo/src/frontend/demos/kContainer/node_modules/@colabo-knalledge/f-store_core/lib/knalledge-container.service.ts since IKContainer is extended from IKContainer which is extended from VOFrontend, while all others (KNode, KEdge, ...) are (STILL) not extended in this double layer, so there are no problems (yet)\n// factory(obj: any): VOIsomorphic;\n// }\n\ninterface IConstructor<T> {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tnew (...args: any[]): T;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tfactory(payload: any, underlyingEntity: IKContainer): T;\n}\n\n@Injectable()\nexport class ColaboKnAllEdgeContainerService extends CFServiceIsomorphic implements ElementServiceIsomorphic {\n\tprotected apiUrl: string;\n\tprotected defaultAction = \"default\";\n\tconstructor(protected http: HttpClient, protected utilsNotificationService: UtilsNotificationService) {\n\t\tsuper(utilsNotificationService);\n\t\tpuzzleConfig = GetPuzzle(MODULE_NAME);\n\t\tColaboKnAllEdgeContainerService.serverAP = puzzleConfig.serverUrl;\n\t\tif (!this.http) {\n\t\t\tif (currentContext === CONTEXTS.FRONTEND_ANGULAR) {\n\t\t\t\tconst msg = \"[ColaboKnAllEdgeContainerService] DI Problem: There is no provider injected for the service `HttpClient`.\";\n\t\t\t\tconsole.error(msg);\n\t\t\t\tif (this.utilsNotificationService) {\n\t\t\t\t\tconst nMsg: NotificationMsg = {\n\t\t\t\t\t\ttitle: \"DI Problem\",\n\t\t\t\t\t\tmsg: msg,\n\t\t\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\t\t};\n\t\t\t\t\tthis.utilsNotificationService.addNotification(nMsg);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// no DI\n\t\t\t\t// this is the case when we call it from the headless context\n\t\t\t\tconsole.log(\"[ColaboKnAllEdgeContainerService] Invited from the non-DI (non-angular) context. Initializing HttpClient ...\");\n\t\t\t\t// will create a headless HttpClient (based on `Axios` from 'axios-observable')\n\t\t\t\tthis.http = new HttpClient((null as unknown) as HttpHandler);\n\t\t\t}\n\t\t}\n\n\t\t// initialize underlying Colabo API layer, like axios interceptors\n\t\tColaboApiCoreService.initialize(\"ColaboKnAllEdgeContainerService\", axios);\n\n\t\tconsole.log(\"[ColaboKnAllEdgeContainerService] created\");\n\t\t// console.log(\"[ColaboKnAllEdgeContainerService] connecting to backend: \", chalk.bold.white(\"\" + ColaboKnAllEdgeContainerService.serverAP));\n\t\tthis.apiUrl = ColaboKnAllEdgeContainerService.serverAP + \"/\" + KCONTAINER_API_PARAMS.API_PATH + \"/\";\n\t\t// console.log(\"[ColaboKnAllEdgeContainerService] REST API URL: \", chalk.bold.white(this.apiUrl));\n\t}\n\n\tpublic async getById(id: string): Promise<IKContainer> {\n\t\t// console.log('getByIdPromise called');\n\t\tlet result: IKContainer;\n\n\t\tconst url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.INDEX_BY_ID + \"/\" + id;\n\t\tif (DEBUG) console.log(\"[getByIdPromise] url: \", url);\n\t\ttry {\n\t\t\t// Make a request for a kContainer with a given ID\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getByIdPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVoFromServerDataAsArray<IKContainer>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKContainer>(new Error(\"Problem with extracting data as an array from serverData\"));\n\t\t\t}\n\t\t\tif ((ColaboApiOperators.getParentEntity(result) as IKNode).type != KCONTAINER_API_PARAMS.KCONTAINER_TYPE) {\n\t\t\t\treturn Promise.reject<IKContainer>(new Error(\"Wrong entity type, expected: \" + KCONTAINER_API_PARAMS.KCONTAINER_TYPE));\n\t\t\t}\n\n\t\t\t// console.log(\"[getByIdPromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKContainer>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tasync create(kContainerWContent: IKContainerWContent): Promise<IKContainerWContent> {\n\t\t// TODO: kNode.type has to be set properly to `KCONTAINER_API_PARAMS.KCONTAINER_TYPE`\n\t\t// THE QUESTION is WHERE\n\t\tconsole.log(\"ColaboKnAllEdgeContainerService.create\");\n\t\tlet result: IKContainerWContent;\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\tconst requestRoot: IApiRequest = {\n\t\t\t\ttype: KCONTAINER_API_TYPE.CREATE_NEW,\n\t\t\t\tdata: kContainerWContent,\n\t\t\t};\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, requestRoot, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKContainerWContent>(serverData);\n\t\t\treturn result;\n\t\t} catch (error: any) {\n\t\t\t// Handle error, including 400 Bad Request and 500 Internal Server Error\n\t\t\tif (error.response) {\n\t\t\t // The request was made, and the server responded with a status code\n\t\t\t console.log(\"[create]\", error);\n\t\t\t // TODO-ColaboError:\n\t\t\t // const colaboError: ColaboError = colaboErrorFromAPIError(error);\n\t\t\t console.warn('Response status:', error.response.status);\n\t\t\t console.warn('Response data:', error.response.data);\n\t\n\t\t\t if (error.response.data.code === 'EMAIL_EXISTS') {\n\t\t\t\tconsole.warn('EMAIL_EXISTS');\n\t\t\t }\n\t\t\t return error.response.data;\n\t\t\t} else if (error.request) {\n\t\t\t // The request was made, but no response was received\n\t\t\t console.error('No response received');\n\t\t\t} else {\n\t\t\t // Something happened in setting up the request that triggered an Error\n\t\t\t console.error('[ColaboKnAllEdgeContainerService:create] Error during request setup:', error.message);\n\t\t\t}\n\t\t\t// TODO-ColaboError:\n\t\t\trethrowColaboError(error);\n\t\t\t// this fixes problem of not returning a result at the end of the function\n\t\t\t// throw error;\n\t\t\t// return new ServerResponse(ServerResponseCode.ERROR_REQUEST, false);\n\t\t\tthrow new ColaboErrorUnreachable();\n\t\t}\n\t\t// } catch (error) {\n\t\t// \trethrowColaboError(error);\n\t\t// }\n\t}\n\n\tasync update(kContainer: IKContainer): Promise<IKContainer> {\n\t\t// TODO: kNode.type has to be set properly to `KCONTAINER_API_PARAMS.KCONTAINER_TYPE`\n\t\t// THE QUESTION is WHERE\n\t\tconsole.log(\"ColaboKnAllEdgeContainerService.update\");\n\t\tlet result: IKContainer;\n\n\t\tconst actionType = KCONTAINER_API_TYPE.UPDATE_BY_ID;\n\t\tconst url: string = this.apiUrl + \"one/\" + actionType + \"/\" + kContainer._id;\n\n\t\t// Make a request for a user with a given ID\n\n\t\t/* TODO: support cases when an entity is trying to be updated before its creation is finished;\n\t\tVO.state, to know if it is a STATE_LOCAL or SYNCED with server:\n\n\t\tif (kNode.state == VOFrontend.STATE_LOCAL) {\n\t\t\t//TODO: fix it by going through queue\n\t\t\twindow.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);\n\t\t\t//TODO: we should move this UI code out of the service logics\n\t\t\tresult = of(undefined);\n\t\t} else {\n\t\t}\n\t\t*/\n\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(url, kContainer, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[updatePromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKContainer>(serverData);\n\n\t\t\t// console.log(\"[updatePromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKContainer>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t /**\n\t * Deletes the IKContainer on server\n\t * In server's response, the ServerData.data is equal to the _id of the deleted VO. ServerData.data will be equal to null, if there is no data we intended to delete. In both cases `ServerData.success` will be eq `true`\n\t * @example URL:http://localhost:8001/knodes/one/default/5a156965d0b7970f365e1a4b.json\n\t * @param {string} id id of the node to be deleted\n\t * @return {*} {Promise<boolean>}\n\t * @memberof ColaboKnAllEdgeContainerService\n\t */\n\tasync destroy(id: string): Promise<boolean> {\n\t\tconsole.log(`[destroy] id=${id}`)\n\t\tconst url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.DESTROY_ONE + \"/\" + id;\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(url, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\treturn serverData.success;\n\t\t} catch (error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\t/* TODO:NG2\n if(this.knAllEdgeRealTimeService){ // realtime distribution\n //\n // let change = new puzzles.changes.Change();\n // ...\n // this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeDeletedEventName, change);//{'_id':id});\n }*/\n\t}\n\n\t/**\n\t * @param containerId The id of the kContainer to which we want to add kNodes\n\t * @param containedIds The list of ids of the kNodes we want to add to the container\n\t * @description adds kNodes in a kContainer\n\t * @returns edges created between the container and entities added to the container\n\t */\n\tpublic async updateAddNodes(containerId: string, containedIds: string[]): Promise<IKEdge[]> {\n\t\tif(DEBUG) console.log(\"[ColaboKnAllEdgeContainerService::updateAddNodes(containerId, containedIds)\", containerId, containedIds);\n\n\t\tlet result: IKEdge[];\n\t\tconst idsStr: string = containedIds.join(\",\");\n\t\tconst url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.UPDATE_ADD_KNODE_BY_IDS + \"/\" + containerId + \"/\" + idsStr;\n\t\tconsole.log(\"updateAddNodes called\", url);\n\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\t// Make a request for a kContainer with a given type\n\t\t\t// NOTE: we have to send `{}` and not just `null` as the second parameter, as the server expects a JSON object and otherwise it would throw an error:\n\t\t\t// SyntaxError: Unexpected token n in JSON at position 0\n\t\t\t\t// at JSON.parse (<anonymous>)\n\t\t\t\t// at createStrictSyntaxError (/Users/mprinc/data/development/colabo-zontik/colabo/src/backend/node_modules/body-parser/lib/types/json.js:169:10)\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(url, {}, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKEdge>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * removes kNodes from a kContainer\n\t *\n\t * @param id The id of the kContainer from which we want to remove kNodes\n\t * @param ids The list of ids of the kNodes we want to remove from the container\n\t * @returns edges created between the container and entities added to the container\n\t */\n\tpublic async updateRemoveNodes(id: string, ids: string[]): Promise<string[]> {\n\t\tconsole.log(\"[ColaboKnAllEdgeContainerService::updateRemoveNodes(id, ids)\", id, ids);\n\n\t\tlet result: string[];\n\t\tconst idsStr: string = ids.join(\",\");\n\t\tconst url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.UPDATE_REMOVE_KNODE_BY_IDS + \"/\" + id + \"/\" + idsStr;\n\t\tconsole.log(\"updateRemoveNodes called\", url);\n\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\t// Make a request for a kContainer with a given type\n\t\t\t// NOTE: we have to send `{}` and not just `null` as the second parameter, as the server expects a JSON object and otherwise it would throw an error:\n\t\t\t// SyntaxError: Unexpected token n in JSON at position 0\n\t\t\t\t// at JSON.parse (<anonymous>)\n\t\t\t\t// at createStrictSyntaxError (/Users/mprinc/data/development/colabo-zontik/colabo/src/backend/node_modules/body-parser/lib/types/json.js:169:10)\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(url, {}, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<string>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<string[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t *\n\t * @param id The id of the kContainer which knodes we want to retrieve\n\t * @description retrieves kNodes in a kContainer\n\t */\n\tpublic async getInContainer(id: string): Promise<KNodeFrontend[]> {\n\t\tlet result: KNodeFrontend[];\n\t\t// TODO: now we have to add `.json` extension: \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset.json\"\n\t\t// as otherwise the url \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset\"\n\t\t// would get trimmed to \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge\"\n\t\t// and effectively we would search for the type \"test-colabo.knalledge\" instead\n\t\t\n\t\t// TODO: const url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + \"/\" + id + \".json\";\n\t\tif (DEBUG) console.log(`this.apiUrl:${this.apiUrl}, this.defaultAction:${this.defaultAction}`);\n\t\t// const url: string = `http://127.0.0.1:8001/knodes/one/default/65e09fd0ea64b78aeacd671d`;\n\t\tconst url: string = `http://127.0.0.1:8001/kcontainers/` + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + \"/\" + id + \".json\"; // (\"/in-container/5f2b0bc595814d1bb918d31d.json`;)\n\t\t// console.log('getInContainer called',url);\n\t\t// Make a request for a kContainer with a given type\n\t\ttry {\n\t\t\tconst response: ServerData | undefined = await this.http.get<ServerData>(url).toPromise();\n\t\t\tif (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);\n\t\t\tif(!response){\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\t// Process the response:\n\t\t\t// OLD `Observable`: map((response: ServerData) => {return CFServiceIsomorphic.processVOs<KNodeFrontend>(response, KNodeFrontend);}):\n\t\t\tconst processedResponse: KNodeFrontend[] = CFServiceIsomorphic.processVOs<KNodeFrontend>(response, KNodeFrontend);\n\n\t\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboKnAllEdgeContainerService::getInContainer] response<KNodeFrontend>: \", JSON.stringify(processedResponse, null, 4));\n\t\n\t\t\treturn processedResponse;\n\t\t} \n\t\tcatch(error){\n\t\t\t//TODO-ColaboError:\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tpublic async getVOs(type?: string, upperLayerType?: any): Promise<IKContainer[]> {\n\t\tlet result: IKContainer[];\n\t\t// TODO: now we have to add `.json` extension: \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset.json\"\n\t\t// as otherwise the url \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset\"\n\t\t// would get trimmed to \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge\"\n\t\t// and effectively we would search for the type \"test-colabo.knalledge\" instead\n\t\tconst url: string = `${this.apiUrl}${this.defaultAction}/${KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? \"/\" + upperLayerType : \"\"}.json`;\n\n\t\t// Make a request for a kContainer with a given ID\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[ColaboKnAllEdgeContainerService::getVOs] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKContainer>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKContainer[]>(new Error(\"Couldn't extract VOs from the serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[ColaboKnAllEdgeContainerService::getVOs] result: \", JSON.stringify(result, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKContainer[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Extracts upper-layer entity from kContainer and sets it up\n\t * @param kContainer - kContainer holding the upper-layer entity\n\t * @param typeT - type (class) of the expected upper-layer entity\n\t * @returns the extracted upper-layer entity\n\t */\n\tpublic extractEntityFromPayload<T>(kContainer: IKContainer, typeT: IConstructor<T>): T {\n\t\tif (!kContainer.dataContent) {\n\t\t\tconsole.error(\"[ColaboKnAllEdgeContainerService::extractEntityFromPayload] container payload (kContainer.dataContent) is missing\");\n\t\t}\n\n\t\tconst vo: T = typeT.factory(kContainer.dataContent, kContainer);\n\t\treturn vo;\n\t}\n\n\t/**\n\t * Extracts upper-layer entity (`<T>`) from the lower-layer entity (`IKContainer`) and sets it up into the `<T>` entity\n\t * @param kContainer - kContainer containing the payload of the upper-layer entity\n\t * @param factoryOperator - the operator responsible for generating and filling in the data into the upper-layer entity (`<T>`)\n\t * @returns the extracted upper-layer entity\n\t */\n\tpublic extractEntityFromPayloadWithExternalOperators<T>(kContainer: IKContainer, factoryOperator: Function): T {\n\t\tif (!kContainer.dataContent) {\n\t\t\tconsole.error(\"[ColaboKnAllEdgeContainerService::extractEntityFromPayload] container payload (kContainer.dataContent) is missing\");\n\t\t}\n\n\t\tconst vo: T = factoryOperator(kContainer.dataContent, kContainer);\n\t\treturn vo;\n\t}\n\n\t/**\n\t * Extracts upper-layer entities from kContainers and sets them up\n\t * @param kContainers - kContainer holding the upper-layer entity\n\t * @param typeT - type (class) of the expected upper-layer entity\n\t * @returns the extracted upper-layer entities\n\t */\n\tpublic extractEntitiesFromPayload<T>(kContainers: IKContainer[], typeT: IConstructor<T>): T[] {\n\t\tconst vos: T[] = [];\n\t\tif (!Array.isArray(kContainers)) return vos;\n\n\t\tfor (const kContainer of kContainers) {\n\t\t\tvos.push(this.extractEntityFromPayload<T>(kContainer, typeT));\n\t\t}\n\t\treturn vos;\n\t}\n}\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Observable } from \"rxjs\";\nimport { of } from \"rxjs\";\n\nimport { VOIsomorphic, ServerData } from \"@colabo-knalledge/i-core\";\n\nimport { Injectable } from \"@colabo-headless/i-core\";\n\nimport { EErrorOrigin, EColaboErrorKind, throwColaboError, ColaboErrorUnreachable } from \"@colabo-utils/i-notifications\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// console.log(\"[CFServiceIsomorphic] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\nconsole.log(\"[CFServiceIsomorphic] Injectable: \", Injectable);\n\nimport { NotificationMsgType } from \"@colabo-utils/i-notifications\";\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nconst HIDE_ERRORS: boolean = true;\n\n// TODO: removed\n// import {\n// UtilsNotificationService,\n// NotificationMsgType,\n// NotificationMsg\n// } from \"@colabo-utils/f-notifications\";\n\ninterface IConstructor<T> {\n\tnew (...args: unknown[]): T;\n\t// TODO: mprinc: Changed the return type from `T` to `VOIsomorphic` as it was complaining in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts and\n\t// colabo/src/frontend/demos/kContainer/node_modules/@colabo-knalledge/f-store_core/lib/knalledge-container.service.ts since KContainerFrontend is extended from KContainer which is extended from VOFrontend, while all others (KNode, KEdge, ...) are (STILL) not extended in this double layer, so there are no problems (yet)\n\tfactory(obj: unknown): VOIsomorphic;\n}\n\n// interface IConstructor<T> {\n// new (...args: any[]): T;\n// factory(obj: any): T;\n// }\n\nexport const HTTP_OPTIONS_CONST_JSON = {\n\theaders: {\n\t\t\"Content-Type\": \"application/json\",\n\t},\n};\n\nimport * as config from \"@colabo-utils/i-config\";\n\n// TODO: removed\n// export const HTTP_OPTIONS_CONST_JSON = {\n// headers: new HttpHeaders({ \"Content-Type\": \"application/json\" })\n// };\n\n@Injectable()\nexport class CFServiceIsomorphic {\n\t// RESTfull backend API url\n\t// eslint-disable-next-line @typescript-eslint/no-inferrable-types\n\tstatic serverAP: string = config.GetGeneral(\"serverUrl\") as string;\n\n\t/**\n\t * processes array of VOs received from server to a local/fronted version\n\t * @param vofS\n\t * @param typeT\n\t */\n\tstatic processVOs<T extends VOIsomorphic>(vofS: ServerData, typeT: IConstructor<T>): Array<T> {\n\t\t//console.log(\"processVOs\");\n\t\t// console.log('processVOs::vofS.data', vofS.data);\n\t\tconst vos: Array<T> = vofS.data as Array<T>;\n\t\tif (vos) {\n\t\t\tfor (let id = 0; id < vos.length; id++) {\n\t\t\t\t//TODO: will not be needed when/if we get rid of ServerData wrapping needed now, because the response from server will be typed to VO unlike in previous versions\n\t\t\t\t// TODO: mprinc: Added casting <T> as it was complaining in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts and\n\t\t\t\t// colabo/src/frontend/demos/kContainer/node_modules/@colabo-knalledge/f-store_core/lib/knalledge-container.service.ts since KContainerFrontend is extended from KContainer which is extended from VOFrontend, while all others (KNode, KEdge, ...) are (STILL) not extended in this double layer, so there are no problems (yet)\n\t\t\t\tconst vo: T = typeT.factory(vos[id]) as T;\n\t\t\t\tvo.state = VOIsomorphic.STATE_SYNCED;\n\t\t\t\t//console.log(vo);\n\t\t\t\tvos[id] = vo;\n\t\t\t}\n\t\t}\n\t\t// console.log('processVOs::vos', vos);\n\t\treturn vos;\n\t}\n\n\tconstructor(protected utilsNotificationService?: UtilsNotificationService) {}\n\n\t/**\n\t * extracts VO from the server response `ServerData` and sets it up\n\t * @param sd - data received from server\n\t * @param typeT - type (class) of the object expected to be received\n\t */\n\tprotected extractVO<T extends VOIsomorphic>(sd: ServerData, typeT: IConstructor<T>): T {\n\t\t//let vo: T = new typeT();\n\t\t// console.log('extractVO',sd);\n\t\tif (!sd.success) {\n\t\t\tconsole.warn(\"[CFServiceIsomorphic::extractVO] serverData.success = false\");\n\t\t}\n\t\tlet vo: T;\n\t\tif (sd.data) {\n\t\t\tvo = typeT.factory(sd.data) as T;\n\t\t\tvo.state = VOIsomorphic.STATE_SYNCED;\n\t\t\treturn vo;\n\t\t} else {\n\t\t\t// TODO: removed because of the error in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kEdge-service-extended.ts (create method)\n\t\t\t// throw new Error(\"`data` property is missing in the ServerData object\");\n\t\t\treturn {} as unknown as T;\n\t\t}\n\t}\n\n\t/**\n\t * extracts VO from the server response `ServerData` and sets it up\n\t * NOTE: Opposite to the `extractVO` method, this method expects the entity wrapped in an array\n\t * The need and confusion is due to MongoDB difference in `find` method that returns an array,\n\t * and `findById` that returns a single entity\n\t * This method is here to treat uniformly both cases (for backend APIs, like `kContainer` API that wraps `findById` into an array)\n\t * @param sd - data received from server\n\t * @param typeT - type (class) of the object expected to be received\n\t * @throws `ColaboError (DATA_MISSING | DATA_INCORRECT_FORMAT)`\n\t */\n\tprotected extractVOFromDataAsArray<T extends VOIsomorphic>(sd: ServerData, typeT: IConstructor<T>): T {\n\t\t//let vo: T = new typeT();\n\t\t// console.log('extractVO',sd);\n\t\tif (!sd.success) {\n\t\t\tconsole.warn(\"[CFServiceIsomorphic::extractVO] serverData.success = false\");\n\t\t\t// TODO-ColaboError: cover this case\n\t\t}\n\t\tlet vo: T;\n\t\t// we get array of entities even for a single entity\n\t\t// the array should be of length 0\n\t\tif (sd.data && Array.isArray(sd.data) && sd.data.length >= 1) {\n\t\t\t// console.error(\"OK, no error\");\n\t\t\tvo = typeT.factory(sd.data[0]) as T;\n\t\t\tvo.state = VOIsomorphic.STATE_SYNCED;\n\t\t\treturn vo;\n\t\t} else {\n\t\t\tconsole.error(\"OK, there is error\");\n\t\t\tif (!sd.data) {\n\t\t\t\tthrowColaboError(\"`data` property is missing in the ServerData object\", EErrorOrigin.SYSTEM, EColaboErrorKind.DATA_MISSING );\n\t\t\t}\n\t\t\tif (!Array.isArray(sd.data)) {\n\t\t\t\tthrowColaboError(\"`data` property is not an array\", EErrorOrigin.SYSTEM, EColaboErrorKind.DATA_INCORRECT_FORMAT );\n\t\t\t}\n\t\t\t// this should not happen I think (@mprinc)\n\t\t\tthrowColaboError(\"`data` is not in right format\", EErrorOrigin.SYSTEM, EColaboErrorKind.DATA_INCORRECT_FORMAT);\n\t\t\tthrow new ColaboErrorUnreachable();\n\t\t}\n\t}\n\n\tprotected errorNotification(error: unknown): void {\n\t\tif (this.utilsNotificationService && !HIDE_ERRORS) {\n\t\t\tthis.utilsNotificationService.addNotification({\n\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\ttitle: \"CFService Error\",\n\t\t\t\tmsg: JSON.stringify(error),\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected handleError() {\n\t\t\n\t}\n\n\t/**\n\t * Handle Http operation that failed.\n\t * Lets the app continue.\n\t * @param operation - name of the operation that failed\n\t * @param result - optional value to return as the observable result\n\t */\n\tprotected handleErrorForObservable<T>(operation = \"operation\", result?: T): (error: unknown) => Observable<T> {\n\t\treturn (error: unknown): Observable<T> => {\n\t\t\t// TODO: send the error to remote logging infrastructure\n\t\t\tconsole.error(\"[CFServiceIsomorphic:handleError] operation: '%s'. error: \", operation, error); // log to console instead\n\t\t\t// window.alert('error: ' + error);\n\t\t\tthis.errorNotification(error);\n\n\t\t\t// TODO: better job of transforming error for user consumption\n\t\t\t//this.log(`${operation} failed: ${error.message}`);\n\n\t\t\t// Let the app keep running by returning an empty result.\n\t\t\treturn of(result as T);\n\t\t};\n\t}\n}\n", "console.log(\"[ColaboApiCoreService] Initializing\");\n// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosStatic } from \"axios\";\nimport { DEBUG, DEBUG_VERBOSE } from \"./params\";\nimport { injectInterceptorService } from \"@colabo-headless/i-core\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst responseInterceptor = (response: any) => {\n\tif (DEBUG_VERBOSE) console.log(\"[axios::interceptor::colabo-api-core.service] response.data: \", JSON.stringify(response.data, null, 4));\n\tif (typeof response.data !== \"string\") {\n\t\tconsole.error(\"The data are not in expected format. This could mean, either: 1) axios is used for not only colabo api backend (we do not use it as instance, probably we should eventually), 2) colabo interceptor is installed (`ColaboApiCoreService.initialize`) twice\");\n\t\treturn response;\n\t}\n\t// removing the JSONP prefix\n\t// TODO, maybe even add testing for the JSON footprint we add\n\tlet data: string = response.data;\n\t// cut the first line:\n\tresponse.data = JSON.parse(removeSecurityPrefix(data));\n\n\treturn response;\n};\n\nexport const removeSecurityPrefix = (data: string): string => {\n\tlet index: number = data.indexOf(\"\\r\");\n\tconst indexN: number = data.indexOf(\"\\n\");\n\tif (index < 0 || index + 1 == indexN) {\n\t\tindex = indexN;\n\t}\n\tdata = data.substring(index + 1);\n\treturn data\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst errorInterceptor = (error: any) => {\n\t// just passing through\n\treturn Promise.reject(error);\n};\n\ninterface IAxiosImplementation {\n\tcolaboApiInterceptorId: number;\n\tcolaboApiInterceptorNamespace: string;\n}\n\nif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService] declaring ColaboApiCoreService class\");\nexport class ColaboApiCoreService {\n\tpublic static interceptorsForAxios: Map<AxiosStatic, IAxiosImplementation> = new Map<AxiosStatic, IAxiosImplementation>();\n\t// Add a response interceptor to remove JSONP prefix that Colabo.Space is sending\n\t// https://docs.angularjs.org/api/ng/service/$http#json-vulnerability-protection\n\t// https://stackoverflow.com/questions/33967189/angular-not-removing-json-prefix\n\t// [Ejecting an interceptor #2615](https://github.com/axios/axios/issues/2615#issuecomment-567964331)\n\tpublic static initialize(namespace: string, specificAxios: AxiosStatic = axios): number {\n\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Initializing interceptor for the namespace: \", namespace);\n\n\t\t// TODO, understand how to iterate through all of them and not add if already exists\n\t\t// https://github.com/axios/axios/blob/master/lib/core/InterceptorManager.js#L44\n\t\t// [How to iterate through axios interceptors and check if an intercepted is already added](https://stackoverflow.com/questions/64514080/how-to-iterate-through-axios-interceptors-and-check-if-an-intercepted-is-already)\n\n\t\tlet axiosImplementation: IAxiosImplementation | undefined = this.interceptorsForAxios.get(specificAxios);\n\n\t\tif (!axiosImplementation || typeof axiosImplementation.colaboApiInterceptorId === \"undefined\") {\n\t\t\tconst colaboApiInterceptorId = specificAxios.interceptors.response.use(responseInterceptor, errorInterceptor);\n\t\t\tif(!axiosImplementation) {\n\t\t\t\taxiosImplementation = {\n\t\t\t\t\tcolaboApiInterceptorId: colaboApiInterceptorId,\n\t\t\t\t\tcolaboApiInterceptorNamespace: namespace,\n\t\t\t\t}\n\t\t\t\tthis.interceptorsForAxios.set(specificAxios, axiosImplementation);\n\t\t\t} else {\n\t\t\t\taxiosImplementation.colaboApiInterceptorNamespace = namespace;\n\t\t\t\taxiosImplementation.colaboApiInterceptorId = colaboApiInterceptorId;\t\n\t\t\t}\n\n\t\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Initialized interceptor for the namespace: \", namespace);\n\t\t} else {\n\t\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Skipping initialization. The colabo interceptor was already initialized for the namespace: \", axiosImplementation.colaboApiInterceptorNamespace);\n\t\t}\n\t\treturn axiosImplementation.colaboApiInterceptorId;\n\t}\n\n\tpublic static destroy(namespace: string, specificAxios: AxiosStatic = axios): void {\n\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Destroying interceptor for the namespace: \", namespace);\n\n\t\tlet axiosImplementation: IAxiosImplementation | undefined = this.interceptorsForAxios.get(specificAxios);\n\t\tif( axiosImplementation) {\n\t\t\tspecificAxios.interceptors.request.eject( axiosImplementation.colaboApiInterceptorId);\n\t\t} else {\n\t\t\tconsole.log(`[ColaboApiCoreService:initialize] no axiosImplementation found for the provided axios`);\n\t\t}\n\t}\n}\n\ninjectInterceptorService(ColaboApiCoreService);", "/** \n * This is a client for the KnAllEdge KNode backend. It is implemented in an isomorphic manner so it can be used both from frontend (browser) and backend (api, app, services, ...)\n */\nimport { IPuzzleConfig, MODULE_NAME } from \"./params\";\n\n// TODO:EXAMPLE - should we remove it completely\nimport { Observable, of } from \"rxjs\";\nimport { catchError, map } from \"rxjs/operators\";\n// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosError, AxiosResponse } from \"axios\";\n\nimport { ColaboError, EErrorOrigin, EColaboErrorKind, rethrowColaboError, throwColaboError, isColaboError } from \"@colabo-utils/i-notifications\";\n\n// import { Injectable } from '@angular/core';\n// import { HttpClient } from '@angular/common/http';\n// TODO:EXAMPLE - should we remove angular specific support\nimport { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient, HttpHandler } from \"@colabo-headless/i-core\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// console.log(\"[ColaboKnAllEdgeNodeService] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\n// console.log(\"[ColaboKnAllEdgeNodeService] HttpClient: \", HttpClient);\n// console.log(\"[ColaboKnAllEdgeNodeService] Injectable: \", Injectable);\n\nimport { chalk } from \"@colabo-headless/i-core\";\nimport { currentContext, CONTEXTS } from \"@colabo-headless/i-core\";\nconsole.info(`[ColaboKnAllEdgeNodeService] Current context: ${currentContext}`);\n\n// get the configuration data\nimport { GetPuzzle } from \"@colabo-utils/i-config\";\n\nimport { ServerData, KNodeFrontend, KNODE_API_TYPE, ColaboApiOperators, IApiRequest, contextReportText } from \"@colabo-knalledge/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\nimport { IEntity, ElementServiceIsomorphic } from \"./element.service.isomorphic\";\n\nimport { NotificationMsg, NotificationMsgType } from \"@colabo-utils/i-notifications\";\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nimport { KNODE_API_PARAMS, IKNode } from \"@colabo-knalledge/i-core\";\nimport { ColaboApiCoreService } from \"./colabo-api-core.service\";\n\n/** \n * Keeps the next available id for the service instance.\n * This helps to identify and investigate usage scenarios.\n */\nlet class_id: number = 1;\n\n@Injectable()\nexport class ColaboKnAllEdgeNodeService extends CFServiceIsomorphic implements ElementServiceIsomorphic {\n\t/** url of server (including port and folder)\n\t * it is provided from the config data\n\t */\n\tprotected serverAP: string;\n\n\t/** the id of the current service instance */\n\tpublic id: number = class_id++;\n\n\t/** the full url to the service specific url including API path (sub-folder) */\n\tprotected apiUrl: string;\n\n\t/** default API action used for standard (CRUD) calls */\n\tprotected defaultAction: string = \"default\";\n\n\t/**\n\t * Initializes and constructs the service\n\t * In the case of the DI support, it receives http client and notification service\n\t * @param http DI-ed http client (primarily in the angular environment or testing), if missing it will be created internally\n\t * @param utilsNotificationService notification service for reporting errors, info and warnings to user, TODO: if missing, should we create a default `console.*` equivalent?\n\t */\n\tconstructor(protected http: HttpClient, protected utilsNotificationService: UtilsNotificationService) {\n\t\tsuper();\n\n\t\t// https://github.com/Cha-OS/colabo/issues/698\n\t\t// initialize underlying Colabo API layer, like axios interceptors\n\t\tColaboApiCoreService.initialize(\"ColaboKnAllEdgeNodeService\", axios);\n\n\t\t// this is the case when we call it from the headless context\n\t\tif (!this.http) {\n\t\t\t// angular but http is not DI-ed\n\t\t\tif (currentContext == CONTEXTS.FRONTEND_ANGULAR) {\n\t\t\t\tconst msg: string = \"DI Problem: There is no provider injected for the service `HttpClient`.\";\n\t\t\t\tconsole.error(msg);\n\t\t\t\tif (this.utilsNotificationService) {\n\t\t\t\t\tconst nMsg: NotificationMsg = {\n\t\t\t\t\t\ttitle: \"DI Problem\",\n\t\t\t\t\t\tmsg: msg,\n\t\t\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\t\t};\n\t\t\t\t\tthis.utilsNotificationService.addNotification(nMsg);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// https://github.com/Cha-OS/colabo/issues/698\n\t\t\t\t// will create a vanilla HttpClient (based on `Axios` from 'axios-observable')\n\t\t\t\tthis.http = new HttpClient((null as unknown) as HttpHandler);\n\t\t\t\tconsole.log(`[ColaboKnAllEdgeNodeService:${this.id}] invited from the isomorphic context. Creating and initializing vanilla HttpClient ...`);\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\"[ColaboKnAllEdgeNodeService] created\");\n\n\t\tconst puzzleConfig: IPuzzleConfig = GetPuzzle(MODULE_NAME);\n\t\tthis.serverAP = puzzleConfig.serverUrl;\n\t\tconsole.log(\"[ColaboKnAllEdgeNodeService] connecting to backend: \", chalk.bold.white(this.serverAP));\n\t\tthis.apiUrl = this.serverAP + \"/\" + KNODE_API_PARAMS.API_PATH + \"/\";\n\t\tconsole.log(\"[ColaboKnAllEdgeNodeService] REST API URL: \", chalk.bold.white(this.apiUrl));\n\t}\n\n\t/**\n\t * Get a KN Node from the server by its `id`\n\t * @param {string} id id of the node\n\t * @param {function} callback Function to be called when the node is retrieved\n\t * @returns {Promise<KNodeFrontend>} the retrieved node\n\t * @throws `ColaboError (REQUEST_BAD | DATA_MISSING | DATA_INCORRECT_FORMAT)` \n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\t// OLD: getById(id: string, callback?: Function): Observable<KNodeFrontend> {\n\tasync getById(id: string): Promise<KNodeFrontend> {\n\t\t// console.log('getById('+id+')');\n\t\tconst url: string = this.apiUrl + \"one/\" + this.defaultAction + \"/\" + id;\n\t\tconsole.log(`[ColaboKnAllEdgeNodeService:getById] url: ${url}`);\n\t\t// OLD: const result: Observable<KNodeFrontend> = this.http.get<ServerData>(url).pipe(\n\t\tconsole.log(`[ColaboKnAllEdgeNodeService:getById] ${this.id}`);\n\t\t\n\t\ttry {\n\t\t\tconst result: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\t\tconst data: ServerData = result.data;\n\t\t\t// console.log(`[ColaboKnAllEdgeNodeService:getById] result.data: ${JSON.stringify(data, null, 4)}`);\n\t\t\tconst kNode: KNodeFrontend = this.extractVOFromDataAsArray<KNodeFrontend>(data, KNodeFrontend);\n\t\t\t// console.log(`[ColaboKnAllEdgeNodeService:getById] kNode: ${JSON.stringify(kNode, null, 4)}`);\n\t\t\treturn kNode;\n\t\t} catch(e) {\n\t\t\tif(isColaboError(e)) {\n\t\t\t\t// ColaboError (thrown by `extractVOFromDataAsArray`)\n\t\t\t\t// we rethrow it (type guarded as `ColaboError`):\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\t//TODO-ColaboError: check if it really is `AxiosError`\n\t\t\t// Axios error - we pack it into `ColaboError` and throw:\n\t\t\tconst error: AxiosError = e as AxiosError;\n\t\t\tif (error.response) {\n\t\t\t\t// The request was made, and the server responded with a status code\n\t\t\t\t//TODO-ColaboError: we should unpack backend error response into ColaboError, that it contains anyway (if sent by colabo server)\n\t\t\t\t//TODO-ColaboError: we can then check its `EErrorOrigin` and behave accordingly\n\t\t\t\t//TODO-ColaboError: throwColaboError(created from server-one);\n\t\t\t } else if (error.request) { // The request was made, but no response was received\n\t\t\t\t//TODO-ColaboError: integrate original error's `stack` (factory?):\n\t\t\t\tthrowColaboError(error.message, EErrorOrigin.SYSTEM, EColaboErrorKind.REQUEST_BAD );\n\t\t\t } else {\n\t\t\t\t// Something happened in setting up the request that triggered an Error\n\t\t\t\tconsole.error('[ColaboKnAllEdgeNodeService:getById] Error during request setup:',);\n\t\t\t\t//TODO-ColaboError: integrate original error's `stack`:\n\t\t\t\tthrowColaboError( error.message, EErrorOrigin.SYSTEM, EColaboErrorKind.REQUEST_BAD );\n\t\t\t }\n\n\t\t\t// TODO-ColaboError: `handleErrorForObservable` used to manage error by logging it and notifying user. Now we bubble errors to the top. But do we want to do something like that still?\n\t\t\t// TODO-ColaboError: OLD: catchError(this.handleErrorForObservable<KNodeFrontend>(\"ColaboKnAllEdgeNodeService::getById\", undefined))\n\t\t\t//TODO-ColaboError: OLD: return undefined; \n\t\t\tthrow new Error(\"This should never be reached, but throwing just because of TS error in diagnosing unreachable end\");\n\t\t}\n\t\t// OLD - removed:\n\t\t// if (callback) {\n\t\t// \tresult.subscribe((node) => callback(node));\n\t\t// }\n\t}\n\n\tpublic async getVosWithColaboApi(request: IApiRequest): Promise<IKNode[]> {\n\t\trequest.type = KNODE_API_TYPE.INDEX_COLABO_API;\n\t\tconst requestSerialized: string = ColaboApiOperators.serializeApiRequest(request);\n\t\tlet result: IKNode[] = [];\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.INDEX_COLABO_API + \"/\" + this.defaultAction + \"/\" + requestSerialized + \".json\";\n\t\tconsole.log(\"[getVos] url: \", url);\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData) return result;\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKNode>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKNode[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic async updateSingleWithColaboApi(request: IApiRequest): Promise<IKNode> {\n\t\tconst kNodes: IKNode[] = await this.updateWithColaboApi(request);\n\t\tif (!kNodes) throw new Error(\"kNodes is not defined\");\n\t\t// // TODO:EXAMPLE - should this be thrown or just silenced, etc\n\t\tif (kNodes.length <= 0) throw new Error(\"kNodes is empty\");\n\t\treturn kNodes[0];\n\t}\n\n\tpublic async updateWithColaboApi(request: IApiRequest): Promise<IKNode[]> {\n\t\trequest.type = KNODE_API_TYPE.UPDATE_COLABO_API;\n\t\tlet result: IKNode[];\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.UPDATE_COLABO_API + \".json\";\n\t\tconsole.log(\"[getVos] url: \", url);\n\t\tlet mResult: AxiosResponse<ServerData>;\n\t\ttry {\n\t\t\t// update\n\t\t\tmResult = await axios.put<ServerData>(url, request);\n\t\t} catch (error) {\n\t\t\tconsole.error(`${contextReportText}Error updating: ${error}`);\n\t\t\t// TODO:EXAMPLE: here we should expand to have `.cause` added, https://medium.com/with-orus/the-5-commandments-of-clean-error-handling-in-typescript-93a9cbdf1af5\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData.success) {\n\t\t\t\tconsole.error(`Error updating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);\n\t\t\t\treturn Promise.reject<IKNode[]>(serverData);\n\t\t\t}\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKNode>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKNode[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// getVOs(type:string):Observable<KNodeFrontend[]> {\n\t// return this.queryInMapofType(ColaboKnAllEdgeNodeService.mapId,type);\n\t// }\n\n\tasync createSingle(kNode: IKNode): Promise<IKNode> {\n\t\tconst kNodesCreated: IKNode[] = await this.create(kNode);\n\t\tif (!Array.isArray(kNodesCreated) || kNodesCreated.length <= 0) throw new Error(`${contextReportText()} No kNode created`);\n\t\tconst kNodeCreated: IKNode = kNodesCreated[0];\n\t\treturn kNodeCreated;\n\t}\n\n\t/** creates a new Element (VO) */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types\n\tasync create(kNode: IKNode, callback?: Function): Promise<IKNode[]> {\n\t\tconsole.log(`${contextReportText()}`);\n\n\t\tlet result: IKNode[];\n\t\tconst request: IApiRequest = {\n\t\t\ttype: KNODE_API_TYPE.CREATE_COLABO_API,\n\t\t\tdata: kNode,\n\t\t};\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, request, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData.success) {\n\t\t\t\tthrow new Error(`${contextReportText} Error creating node. [code: ${serverData.error?.kind}] ${serverData.error?.message}`);\n\t\t\t}\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKNode[]>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kNode: \", JSON.stringify(kNode, null, 4));\n\t\t} catch (error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic async createWithColaboApi(request: IApiRequest): Promise<IKNode[]> {\n\t\trequest.type = KNODE_API_TYPE.CREATE_COLABO_API;\n\t\tlet result: IKNode[];\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.CREATE_COLABO_API + \".json\";\n\t\tconsole.log(\"[getVos] url: \", url);\n\t\tlet mResult: AxiosResponse<ServerData>;\n\t\ttry {\n\t\t\tmResult = await axios.post<ServerData>(url, request);\n\t\t} catch (error) {\n\t\t\tconsole.error(`${contextReportText}Error updating: ${error}`);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData.success) {\n\t\t\t\tconsole.error(`Error creating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);\n\t\t\t\treturn Promise.reject<IKNode[]>(serverData);\n\t\t\t}\n\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKNode[]>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKNode[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[getVosWithColaboApi] kNode: \", JSON.stringify(kNode, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** destroys the Element (VO) with the `_id === id` */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tasync destroy(id: string): Promise<boolean> {\n\t\treturn true;\n\t}\n\n\tpublic async destroyWithColaboApi(request: IApiRequest): Promise<Partial<IKNode[]>> {\n\t\trequest.type = KNODE_API_TYPE.DESTROY_COLABO_API;\n\t\tconst requestSerialized: string = ColaboApiOperators.serializeApiRequest(request);\n\t\tlet result: Partial<IKNode[]>;\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.DESTROY_COLABO_API + \"/\" + this.defaultAction + \"/\" + requestSerialized + \".json\";\n\t\tconsole.log(\"[getVos] url: \", url);\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(url);\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKNode>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<Partial<IKNode[]>>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<Partial<IKNode[]>>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** gets Elements (VOs) to populate the list */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tgetVOs(type?: string): Observable<IEntity[] | undefined> {\n\t\treturn of([]);\n\t}\n}\n\n//TODO: NG2: migrate here the remaining methods from the old NG1 JS NodeService\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Observable, of } from \"rxjs\";\nimport { catchError, map, tap } from \"rxjs/operators\";\n\nimport { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient } from \"@colabo-headless/i-core\";\n\nimport axios, { AxiosResponse } from \"axios\";\n\n// import { Injectable } from \"@angular/core\";\n// import { HttpClient } from \"@angular/common/http\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// console.log(\"[ColaboKnAllEdgeNodeServiceExtended] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\n\nconsole.log(\"[ColaboKnAllEdgeNodeServiceExtended] Injectable: \", Injectable);\nconsole.log(\"[ColaboKnAllEdgeNodeServiceExtended] HttpClient: \", HttpClient);\n\nimport { ServerData, VOFrontend, KNodeFrontend } from \"@colabo-knalledge/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\nimport { ColaboKnAllEdgeNodeService } from \"./kNode-service\";\n\nimport { rethrowColaboError } from \"@colabo-utils/i-notifications\";\n\nimport * as config from \"@colabo-utils/i-config\";\n\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nimport { KNODE_API_TYPE, IKNode } from \"@colabo-knalledge/i-core\";\n\n@Injectable()\nexport class ColaboKnAllEdgeNodeServiceExtended extends ColaboKnAllEdgeNodeService {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knalledgeMapQueue: any = null;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knAllEdgeRealTimeService: any = null;\n\n\t// eslint-disable-next-line @typescript-eslint/no-inferrable-types\n\tprotected static mapId: string = config.GetGeneral(\"mapId\") as string;\n\tstatic UPDATE_NODE_NAME_FINAL: string = \"UPDATE_NODE_NAME_FINAL\";\n\tstatic UPDATE_NODE_NAME: string = \"UPDATE_NODE_NAME\";\n\t// protected http:HttpClient = null;\n\t// protected utilsNotificationService: UtilsNotificationService;\n\n\tconstructor(http: HttpClient, utilsNotificationService: UtilsNotificationService) {\n\t\tsuper(http, utilsNotificationService);\n\t\tconsole.log(\"[ColaboKnAllEdgeNodeServiceExtended:constructor] constructed\");\n\t}\n\n\tasync queryByIds(ids: string[], callback?: Function): Promise<KNodeFrontend[]> {\n\t\tconsole.log(\"queryByIds\", ids);\n\t\tconst idsStr: string = ids.join(\",\");\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.INDEX_ID_IN + \"/\" + this.defaultAction + \"/\" + idsStr + \".json\";\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: KNodeFrontend[] = CFServiceIsomorphic.processVOs(serverData, KNodeFrontend);\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\t}\n\n\t/**\n\t * 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\n\t * Creates the provided node on the server and returns its server-updated appearance\n\t * @param {KNodeFrontend} kNode the pre-populated node to be created on the server\n\t * @param {function} callback Function to be called when the node is created\n\t * @returns {Observable<KNodeFrontend>} the created node (now with the id and other specific data allocated to it by server, so the caller should fill the original node with it)\n\t @example http://localhost:8001/knodes/in_map/default/579811d88e12abfa556f6b59.json\n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\t// async create(kNode: KNodeFrontend, callback?: Function): Promise<KNodeFrontend> {\n\t// \tconsole.log(`[ColaboKnAllEdgeNodeServiceExtended.create] kNode: ${JSON.stringify(kNode, null, 4)}`);\n\n\t// \t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t// \tlet kNodeForServer: any;\n\t// \tif (kNode.toServerCopy) kNodeForServer = kNode.toServerCopy();\n\t// \telse kNodeForServer = kNode;\n\n\t// \t/*\n\t// \tTODO:NG2: in the line\n\t// \t `result = this.http.post<KNode>(this.apiUrl, kNodeForServer, HTTP_OPTIONS_CONST_JSON)`\n\t// \twe had to replace Generic type setting <KNode> with <ServerData> because it defines the return value\n\t// \t(and probably the posted value), because server returns the `ServerData` object\n\t// \t*/\n\n\t// \ttry {\n\t// \t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(this.apiUrl, kNodeForServer, HTTP_OPTIONS_CONST_JSON);\n\t// \t\tconst serverData: ServerData = mResult.data;\n\t// \t\tconst result: KNodeFrontend = this.extractVO<KNodeFrontend>(serverData, KNodeFrontend);\n\t// \t\tif (callback) {\n\t// \t\t\tcallback(result);\n\t// \t\t}\n\t// \t\treturn result;\n\t// \t} catch(error) {\n\t// \t\trethrowColaboError(error);\n\t// \t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t// \t}\n\n\t// \t/* TODO:NG2 : remain of the NG1 Promise code to be integrated:\n\t// \t\tlet node = this.createPlain({\n\t// \t\t\t//actionType:'default'\n\t// \t\t\t}, kNodeForServer, function(nodeFromServer){\n\t// \t\t\tkNode.$resolved = node.$resolved;\n\t// \t\t\tkNode.overrideFromServer(nodeFromServer);\n\t// \t\t\tif(callback) callback(kNode);\n\t// \t\t});\n\n\t// \t\t//createPlain manages promises for its returning value, in our case 'node', so we need to set its promise to the value we return\n\t// \t\tkNode.$promise = node.$promise;\n\t// \t\tkNode.$resolved = node.$resolved;\n\n\t// \t\tif(node.$resolved){// for the case promise was resolved immediatelly (in synchonous manner) instead synchronously\n\t// \t\t\tkNode.overrideFromServer(node);\n\t// \t\t}\n // */\n\t// \t// }\n\t// \t//we return this value to caller as a dirty one, and then set its value to nodeFromServer when upper callback is called\n\t// }\n\n\t/**\n\t * Deletes the KNode from the server\n\t * In server's response, the ServerData.data is equal to the _id of the deleted VO. ServerData.data will be equal to null, if there is no data we intended to delete. In both cases `ServerData.success` will be eq `true`\n\t * @param {string} id id of the node to be deleted\n\t * @param {function} callback Function to be called when the node is deleted\n\t * @example URL:http://localhost:8001/knodes/one/default/5a156965d0b7970f365e1a4b.json\n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\tasync destroy(id: string, callback?: Function): Promise<boolean> {\n\t\t//TODO:NG2 fix usage of this function to expect boolean\n\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(this.apiUrl + \"one/\" + this.defaultAction + \"/\" + id, HTTP_OPTIONS_CONST_JSON);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: boolean = serverData.success;\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\t/* TODO:NG2\n if(this.knAllEdgeRealTimeService){ // realtime distribution\n //\n\t\t\t// let change = new puzzles.changes.Change();\n\t\t\t// change.value = null;\n\t\t\t// change.valueBeforeChange = null; //TODO\n\t\t\t// change.reference = id;\n\t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n\t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeDeletedEventName;\n\t\t\t// // change.action = null;\n\t\t\t// change.domain = puzzles.changes.Domain.NODE;\n\t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n\t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n //\n\t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeDeletedEventName, change);//{'_id':id});\n\t\t}*/\n\t}\n\n\t\t/**\n\t * Updates the provided node on the server and returns its server-updated appearance\n\t * @param {KNodeFrontend} kNode the pre-populated node to update the content of the existing node on the server\n\t * @param {string} actionType type of the update action (e.g. UPDATE_NODE_NAME_FINAL, UPDATE_NODE_NAME)\n\t * @param {any} patch if we provide null here, the `kNode` param is used, but if we provide here an object, it will be patched 'over' the existing node on the server\n\t * @param {function} callback Function to be called when the node is updated\n\t * @returns {Observable<KNodeFrontend>} the updated node (now with some specific data updated by the server, so the caller should fill the original node with it)\n\t @example URLs: http://localhost:8001/knodes/one/UPDATE_NODE_NAME/5a156935d0b7970f365e1a42.json\n\t http://localhost:8001/knodes/one/UPDATE_NODE_NAME_FINAL/5a156935d0b7970f365e1a42.json\n\t*/\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n\tasync update(kNode: KNodeFrontend, actionType: string, patch?: any, callback?: Function): Promise<KNodeFrontend | undefined> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n\t\tfunction updateResponse(nodeFromServer: any): void {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t\tconst responseTime = new Date();\n\t\t\t/* TODO:NG2:\n\n\t\t\t!! IMPORTANT: this method contains a LOT OF COMMENTED OLD CODE that will be migrated to the new version. You can avoid it in your usage for now\n\n\t\t\t//console.log(\"UPDATE: responseTime - requestTime:\", (responseTime - requestTime));\n\t\t\tChangeService.logRequestResponseTiming(responseTime - requestTime);\n\t\t\t// realtime distribution\n\t\t\tif(this.nAllEdgeRealTimeService){\n\n\t\t\t let change = new puzzles.changes.Change();\n\t\t\t change.value = kNodeForServer;\n\t\t\t change.valueBeforeChange = null; //TODO\n\t\t\t change.reference = nodeFromServer._id;\n\t\t\t change.type = puzzles.changes.ChangeType.STRUCTURAL;\n\t\t\t change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeUpdatedEventName;\n\t\t\t change.action = actionType;\n\t\t\t change.domain = puzzles.changes.Domain.NODE;\n\t\t\t change.visibility = puzzles.changes.ChangeVisibility.ALL;\n\t\t\t change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n\n\t\t\t // let emitObject = {\n\t\t\t // \tid: nodeFromServer._id,\n\t\t\t // \tactionType: actionType,\n\t\t\t // \tdata: nodeFromServer,\n\t\t\t // \tactionTime: nodeFromServer.updatedAt\n\t\t\t // }\n\t\t\t KnAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeUpdatedEventName, change);\n\t\t\t}\n\t\t\tif(callback){callback(nodeFromServer);}\n\t\t\t*/\n\t\t}\n\n\t\tlet result: KNodeFrontend | undefined;\n\t\tconst id = kNode._id;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst kNodeForServer: any = patch ? patch : kNode.toServerCopy();\n\t\tactionType = actionType !== null ? actionType : ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME_FINAL;\n\t\t//console.log(\"ColaboKnAllEdgeNodeServiceExtended.update\");\n\n\t\tif (kNode.state == VOFrontend.STATE_LOCAL) {\n\t\t\t//TODO: fix it by going through queue\n\t\t\twindow.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);\n\t\t\t//TODO: we should move this UI code out of the service logics\n\t\t\tresult = undefined;\n\t\t\treturn result;\n\t\t} else {\n\t\t\t/*\n\t\t\tTODO:NG2: it was: if(Plugins.puzzles.knalledgeMap.config.services.QUEUE && false)\n\n \t\t\tKnalledgeMapQueue.execute({data: kNode, patch: patch, callback:callback, resource_type:resource.RESOURCE_TYPE, method: \"update\"}); //TODO: support 'patch' in Queue\n \t\t\t//updatePlain: {method:'PUT', params:{type:'one', actionType:knalledge.KNode.UPDATE_TYPE_ALL, searchParam:''},\n \t\t\treturn this.updatePlain({searchParam:id, type:'one', actionType:actionType}, kNodeForServer, function(nodeFromServer){\n \t\t\t\t// realtime distribution\n \t\t\t\tif(this.knAllEdgeRealTimeService){\n\n \t\t\t\t\t// let change = new change.Change();\n \t\t\t\t\t// change.value = nodeFromServer;\n \t\t\t\t\t// change.valueBeforeChange = nodeFromServer;\n \t\t\t\t\t// change.reference = nodeFromServer._id;\n \t\t\t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n \t\t\t\t\t// change.action = actionType;\n \t\t\t\t\t// change.domain = puzzles.changes.Domain.NODE;\n \t\t\t\t\t// //TODO:\n \t\t\t\t\t// // change.mapId = null;\n \t\t\t\t\t// // change.iAmId = null;\n \t\t\t\t\t// change.visibility = ChangeVisibility.ALL;\n \t\t\t\t\t// change.phase = ChangePhase.UNDISPLAYED;\n\n \t\t\t\t\tlet emitObject = {\n \t\t\t\t\t\tid: nodeFromServer._id,\n \t\t\t\t\t\tactionType: actionType,\n \t\t\t\t\t\tdata: nodeFromServer,\n \t\t\t\t\t\tactionTime: nodeFromServer.updatedAt\n \t\t\t\t\t}\n \t\t\t\t\tKnAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeUpdatedEventName, emitObject);\n \t\t\t\t\t// let change = new\n \t\t\t\t\t// GlobalEmittersArrayService.get(Plugins.puzzles.knalledgeMap.config.services.structuralChangeEventName).broadcast('KnalledgeMapVOsService', {'change_typ':changes,'event':eventName});\n \t\t\t\t}\n \t\t\t\tif(callback){callback(nodeFromServer);}\n \t\t\t});\n\n\t\t\t}\n\t\t\telse{\n\n\t\t\tlet requestTime:Date = new Date();\n \t\t*/\n\t\t\ttry {\n\t\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(this.apiUrl + \"one/\" + actionType + \"/\" + id, kNodeForServer, HTTP_OPTIONS_CONST_JSON);\n\t\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t\tconst result: KNodeFrontend = this.extractVO<KNodeFrontend>(serverData, KNodeFrontend);\n\t\t\t\tif (callback) {\n\t\t\t\t\tcallback(result);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} catch(error) {\n\t\t\t\trethrowColaboError(error);\n\t\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t\t}\n\t\t\t/* TODO:NG2:\n\t\t\t// function(error){\n\t\t\t\t\t// \t//console.error('NODE: UPDATE: ',error,' for ',id,actionType,kNodeForServer);\n\t\t\t\t\t// \tChangeService.logActionLost({'type:': 'NODE: UPDATE', 'error': error, 'id':id, 'actionType' : actionType, 'kNodeForServer' : kNodeForServer});\n\t\t\t\t\t// }\n\t\t\t\t// );\n\t\t\t}\n \t\t*/\n\t\t}\n\t}\n\n\t// getVOs(type: string): Observable<KNodeFrontend[] | undefined> {\n\t// \treturn this.queryInMapofType(ColaboKnAllEdgeNodeServiceExtended.mapId, type);\n\t// }\n\t// getVOsWithPromise(type: string): Promise<IKNode[]> {\n\t// \treturn this.getVOs(type).toPromise() as Promise<IKNode[]>;\n\t// }\n\n// \t/**\n// \t * Gets from the server all the KN Nodes that are contained in the map\n// \t * @param {string} id id of the map\n// \t * @param {function} callback Function to be called when the nodes are retrieved\n// \t * @returns {Observable<KNodeFrontend[]>} array of the nodes\n// \t @example http://localhost:8001/knodes/in_map/default/579811d88e12abfa556f6b59.json\n// \t */\n// \tqueryInMap(mapId: string, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map/\" + this.defaultAction + \"/\" + mapId).pipe(\n// \t\t\tmap((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"ColaboKnAllEdgeNodeServiceExtended::queryInMap\", undefined))\n// \t\t);\n// \t\t// I get 2 errors for the above lines:\n// \t\t// 1st error:\n// \t\t/*\n// \t\t../../../isomorphic/puzzles/knalledge/core-services/lib/kNode-service-extended.ts:89:9 - error TS2739: Type 'Observable<unknown>' is missing the following properties from type 'Observable<KNodeFrontend[]>': _isScalar, _trySubscribe, _subscribe\n\n// 89 const result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map/\" + this.defaultAction + \"/\" + mapId).pipe(\n// \t*/\n// \t\t//that \"solve with replacing the last `);`\n// \t\t//with `) as unknown as (Observable<KNodeFrontend[] | undefined>);` to enforce return type\n// \t\t// ...\n// \t\t// but I still cannot solve the 2nd error:\n// \t\t/*\n// \t\t../../../isomorphic/puzzles/knalledge/core-services/lib/kNode-service-extended.ts:90:4 - error TS2345: Argument of type 'OperatorFunction<ServerData, KNodeFrontend[]>' is not assignable to parameter of type 'OperatorFunction<ServerData, unknown>'.\n// Types of parameters 'source' and 'source' are incompatible.\n// Type 'Observable<ServerData>' is missing the following properties from type 'Observable<ServerData>': _isScalar, _trySubscribe, _subscribe\n\n// 90 map((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// */\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t/**\n// \t * Gets from the server all the KN Nodes that are contained in the map\n// \t * @param {string} mapId id of the map\n// \t * @param {function} callback Function to be called when the nodes are retrieved\n// \t * @returns {Observable<KNodeFrontend[]>} array of the nodes\n// \t @example http://localhost:8001/knodes/in_map/default/579811d88e12abfa556f6b59.json\n// \t */\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tqueryInMapofType(mapId: string, type: string, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tconst url: string = this.apiUrl + KNODE_API_TYPE.INDEX_IN_MAP_OF_TYPE + \"/\" + this.defaultAction + \"/\" + mapId + \"/\" + type + \".json\";\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(url).pipe(\n// \t\t\tmap((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"ColaboKnAllEdgeNodeServiceExtended::queryInMapofType\", undefined))\n// \t\t);\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types, @typescript-eslint/explicit-module-boundary-types\n// \tqueryInMapofTypeAndContentData(mapId: string, type: string, contentDataPath: string, data: any, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tconsole.log(\"queryInMapofTypeAndContentData\", mapId, type, contentDataPath, data);\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(\n// \t\t\tthis.apiUrl + \"in_map_of_type_and_content_data/\" + this.defaultAction + \"/\" + mapId + \"/\" + type + \"/\" + contentDataPath + \"/\" + data + \".json\"\n// \t\t ).pipe(\n// \t\t\tmap((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable<KNodeFrontend[] | undefined>(\"ColaboKnAllEdgeNodeServiceExtended::queryInMapofTypeAndContentData\", undefined))\n// \t\t );\n\t\t \n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \tqueryInMapofTypeForUser(mapId: string, type: string, iAmid: string, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tconsole.log(\"queryInMapofTypeForUser\", mapId, type, iAmid);\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map_of_type_for_user/\" + this.defaultAction + \"/\" + mapId + \"/\" + type + \"/\" + iAmid + \".json\").pipe(\n// \t\t\tmap((nodesFromServer) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"ColaboKnAllEdgeNodeServiceExtended::queryInMap\", undefined))\n// \t\t);\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tdestroyByTypeInMap(type: string, mapId: string, callback?: Function): Observable<boolean> {\n// \t\t//TODO:NG2 fix usage of this function to expect boolean\n// \t\tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-in-map/\" + this.defaultAction + \"/\" + type + \"/\" + mapId + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t\ttap((_) => console.log(`deleted nodes type=${type} and mapId=${mapId}`)),\n// \t\t\tmap((serverData: ServerData) => serverData.success),\n// \t\t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeInMap\"))\n// \t\t);\n\n// \t\t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t\t// let change = new puzzles.changes.Change();\n// \t\t\t// change.value = null;\n// \t\t\t// change.valueBeforeChange = null; //TODO\n// \t\t\t// change.reference = id;\n// \t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t\t// // change.action = null;\n// \t\t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t\t}*/\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((success) => callback(success));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \tdestroyByUser(iAmid: string): Observable<boolean> {\n// \t\t//TODO:NG2 fix usage of this function to expect boolean\n// \t\tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-user/\" + this.defaultAction + \"/\" + iAmid + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t\ttap((_: ServerData) => console.log(`deleted nodes: iAmid=${iAmid}`)),\n// \t\t\tmap((serverData: ServerData) => serverData.success),\n// \t\t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByUser\"))\n// \t\t);\n\n// \t\t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t\t// let change = new puzzles.changes.Change();\n// \t\t\t// change.value = null;\n// \t\t\t// change.valueBeforeChange = null; //TODO\n// \t\t\t// change.reference = id;\n// \t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t\t// // change.action = null;\n// \t\t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t\t}*/\n// \t\treturn result;\n// \t}\n\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tdestroyByTypeByUser(type: string, iAmid: string, callback?: Function): Observable<boolean> {\n// \t\t//TODO:NG2 fix usage of this function to expect boolean\n// \t\tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-n-user/\" + this.defaultAction + \"/\" + type + \"/\" + iAmid + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t\ttap((_) => console.log(`deleted nodes type=${type} and iAmid=${iAmid}`)),\n// \t\t\tmap((serverData: ServerData) => serverData.success),\n// \t\t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeByUser\"))\n// \t\t);\n\n// \t\t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t\t// let change = new puzzles.changes.Change();\n// \t\t\t// change.value = null;\n// \t\t\t// change.valueBeforeChange = null; //TODO\n// \t\t\t// change.reference = id;\n// \t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t\t// // change.action = null;\n// \t\t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t\t}*/\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((success) => callback(success));\n// \t\t}\n// \t\treturn result;\n// \t}\n}\n\n//TODO: NG2: migrate here the remaining methods from the old NG1 JS NodeService\n", "import { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient, HttpHandler } from \"@colabo-headless/i-core\";\n\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nimport { ServerData, IApiRequest, IKEdge, ColaboApiOperators, KEDGE_API_TYPE, KEDGE_API_PARAMS, contextReportText } from \"@colabo-knalledge/i-core\";\nimport { ColaboApiCoreService } from \"./colabo-api-core.service\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\n// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosResponse } from \"axios\";\nimport { chalk } from \"@colabo-headless/i-core\";\nimport { currentContext, CONTEXTS } from \"@colabo-headless/i-core\";\nimport { NotificationMsg, NotificationMsgType } from \"@colabo-utils/i-notifications\";\n\n@Injectable()\nexport class KnalledgeEdgeService extends CFServiceIsomorphic {\n\t//http://api.colabo.space/kedges/\n\t// \"http://127.0.0.1:888/kedges/\";\n\tprotected apiUrl: string;\n\tprotected defaultAction: string = \"default\";\n\n\tconstructor(\n\t\tprotected http: HttpClient, //@Inject('ENV') private ENV\n\t\tutilsNotificationService: UtilsNotificationService,\n\t) {\n\t\tsuper(utilsNotificationService);\n\n\t\t// initialize underlying Colabo API layer, like axios interceptors\n\t\tColaboApiCoreService.initialize(\"ColaboKnAllEdgeNodeService\", axios);\n\n\t\t// this is the case when we call it from the headless context\n\t\tif (!this.http) {\n\t\t\t// no DI\n\t\t\tif (currentContext == CONTEXTS.FRONTEND_ANGULAR) {\n\t\t\t\tconst msg: string = \"DI Problem: There is no provider injected for the service `HttpClient`.\";\n\t\t\t\tconsole.error(msg);\n\t\t\t\tif (this.utilsNotificationService) {\n\t\t\t\t\tconst nMsg: NotificationMsg = {\n\t\t\t\t\t\ttitle: \"DI Problem\",\n\t\t\t\t\t\tmsg: msg,\n\t\t\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\t\t};\n\t\t\t\t\tthis.utilsNotificationService.addNotification(nMsg);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconsole.log(\"[KnalledgeEdgeService] invited from the isomorphic context. Initializing HttpClient ...\");\n\t\t\t\t// will create a headless HttpClient (based on `Axios` from 'axios-observable')\n\t\t\t\tthis.http = new HttpClient((null as unknown) as HttpHandler);\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\"[KnalledgeEdgeService] created\");\n\t\tconsole.log(\"[KnalledgeEdgeService] connecting to backend: \", chalk.bold.white(KnalledgeEdgeService.serverAP));\n\n\t\tthis.apiUrl = KnalledgeEdgeService.serverAP + \"/\" + KEDGE_API_PARAMS.API_PATH + \"/\";\n\t\tconsole.log(\"[KnalledgeEdgeService] REST API URL: \", chalk.bold.white(this.apiUrl));\n\t}\n\n\tpublic async getVosWithColaboApi(request: IApiRequest): Promise<IKEdge[]> {\n\t\trequest.type = KEDGE_API_TYPE.INDEX_COLABO_API;\n\t\tconsole.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);\n\t\tconst requestSerialized: string = ColaboApiOperators.serializeApiRequest(request);\n\t\tlet result: IKEdge[];\n\n\t\tconst url: string = this.apiUrl + KEDGE_API_TYPE.INDEX_COLABO_API + \"/\" + requestSerialized + \".json\";\n\t\tconsole.log(\"[getVos] url: \", url);\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKEdge>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKEdge[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** creates a new Element (VO) */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types\n\tasync createWithPromise(kEdge: IKEdge, callback?: Function): Promise<IKEdge[]> {\n\t\tconsole.log(`${contextReportText()}`);\n\n\t\tlet result: IKEdge[];\n\n\t\tconst request: IApiRequest = {\n\t\t\ttype: KEDGE_API_TYPE.CREATE_COLABO_API,\n\t\t\tdata: kEdge,\n\t\t}\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, request, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif(!serverData.success){\n\t\t\t\tthrow new Error(`${contextReportText} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);\n\t\t\t}\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKEdge[]>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** creates a new Element (VO) */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types\n\tasync createWithRequest(request: IApiRequest): Promise<IKEdge[]> {\n\t\tconsole.log(`${contextReportText()}`);\n\n\t\tlet result: IKEdge[];\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, request, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif(!serverData.success){\n\t\t\t\tthrow new Error(`${contextReportText} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);\n\t\t\t}\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKEdge[]>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n}\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient } from \"@colabo-headless/i-core\";\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\nimport { catchError, map, tap } from \"rxjs/operators\";\nimport { Observable } from \"rxjs\";\n\nimport { KEdgeFrontend as KEdge } from \"@colabo-knalledge/i-core\";\nimport { ServerData } from \"@colabo-knalledge/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\nimport { KnalledgeEdgeService } from \"./kEdge-service\";\n\nimport axios, { AxiosResponse } from \"axios\";\n\nimport { rethrowColaboError } from \"@colabo-utils/i-notifications\";\n\n@Injectable()\nexport class KnalledgeEdgeServiceExtended extends KnalledgeEdgeService {\n\t//http://api.colabo.space/kedges/\n\t// \"http://127.0.0.1:888/kedges/\";\n\t//private defaultAction:string = 'default'; not used here - only for nodes is used\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knalledgeMapQueue: any = null;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knAllEdgeRealTimeService: any = null;\n\n\tconstructor(\n\t\thttp: HttpClient, //@Inject('ENV') private ENV\n\t\tutilsNotificationService: UtilsNotificationService,\n\t) {\n\t\tsuper(http, utilsNotificationService);\n\t\tconsole.log(\"KnalledgeEdgeServiceExtended:: constructor\");\n\t}\n\n\t/**\n\t * Gets an KN Edge from the server by its id\n\t * @param {string} id id of the edge\n\t * @param {function} callback Function to be called when the edge is retrieved\n\t * @returns {Observable<KEdge>} retrieved edge\n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\tasync getById(id: string, callback?: Function): Promise<KEdge> {\n\t\tconsole.log(\"getById(\" + id + \")\");\n\n\t\tconst url: string = this.apiUrl + \"one/\" + id;\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: KEdge = this.extractVO<KEdge>(serverData, KEdge);\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\t}\n\n\t/**\n * Creates the provided edge on the server and returns its server-updated appearance\n * @param {KEdge} kEdge the pre-populated edge to be created on the server\n * @param {function} callback Function to be called when the edge is created\n * @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)\n @example http://localhost:8001/kedges/in_map/default/579811d88e12abfa556f6b59.json\n */\n\tasync create(kEdge: KEdge, callback?: Function): Promise<KEdge> {\n\t\t//console.log(\"KnalledgeEdgeService.create\");\n\t\tlet result: Observable<KEdge>;\n\n\t\t// eslint-disable-next-line no-constant-condition\n\t\tif (false) {\n\t\t\t// TODO:NG2: if(Plugins.puzzles.knalledgeMap.config.services.QUEUE)\n\t\t\t/*\n kEdge.$promise = null;\n\t\t\tkEdge.$resolved = false;\n\n\t\t\tkEdge.$promise = $q(function(resolve, reject) {\n\t\t\t\tKnalledgeMapQueue.execute({data: kEdge, callback:callback, resource_type:resource.RESOURCE_TYPE, method: \"create\", processing: {\"RESOLVE\":resolve, \"REJECT\":reject, \"EXECUTE\": resource.execute, \"CHECK\": resource.check}});\n\t\t\t});\n */\n\t\t} else {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tif(!kEdge.toServerCopy) {\n\t\t\t\tthrow new Error(\"kEdge.toServerCopy is not defined\");\n\t\t\t}\n\t\t\tconst kEdgeForServer: any = kEdge.toServerCopy();\n\n\t\t\t/*\n\t\t\tTODO:NG2: in the line\n\t\t\t\t`result = this.http.post<KEdge>(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON)`\n\t\t\twe had to replace Generic type string <KEdge> with <ServerData> because it defines the return value\n\t\t\t(and probably the posted value), because server returns the `ServerData` object\n\t\t\t*/\n\n\t\t\ttry {\n\t\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON);\n\t\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t\tconst result: KEdge = this.extractVO<KEdge>(serverData, KEdge);\n\t\t\t\tif (callback) {\n\t\t\t\t\tcallback(result);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} catch(error) {\n\t\t\t\trethrowColaboError(error);\n\t\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t\t}\n\n\t\t\t\t\t/* TODO:NG2 : remain of the NG1 Promise code to be integrated:\n\t\t\t\t\tlet edge = this.createPlain({\n\t\t\t\t\t\t//actionType:'default'\n\t\t\t}, kEdgeForServer, function(edgeFromServer){\n\t\t\t\t\t\tkEdge.$resolved = edge.$resolved;\n\t\t\t\t\t\tkEdge.overrideFromServer(edgeFromServer);\n\t\t\t\t\t\tif(callback) callback(kEdge);\n\t\t\t\t\t});\n\n\t\t\t\t\t//createPlain manages promises for its returning value, in our case 'edge', so we need to set its promise to the value we return\n\t\t\t\t\tkEdge.$promise = edge.$promise;\n\t\t\t\t\tkEdge.$resolved = edge.$resolved;\n\n\t\t\t\t\tif(edge.$resolved){// for the case promise was resolved immediately (in synchronous manner) instead synchronously\n\t\t\t\t\t\tkEdge.overrideFromServer(edge);\n\t\t\t\t\t}\n\t\t\t*/\n\t\t}\n\t}\n\n\t/**\n\t * Deletes the KEdge from the server\n\t * In server's response, the ServerData.data is equal to the _id of the deleted VO. ServerData.data will be equal to null, if there is no data we intended to delete. In both cases `ServerData.success` will be eq `true`\n\t * @param {string} id id of the edge to be deleted\n\t * @param {function} callback Function to be called when the edge is deleted\n\t * @example URL:http://localhost:8001/kedges/one/default/5a156965d0b7970f365e1a4b.json\n\t */\n\tasync destroy(id: string, callback?: Function): Promise<boolean> {\n\t\t//TODO:NG2 fix usage of this function to expect boolean\n\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(this.apiUrl + \"one/\" + id, HTTP_OPTIONS_CONST_JSON);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: boolean = serverData.success;\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\t/* TODO:NG2\n\t\tif(this.knAllEdgeRealTimeService){ // realtime distribution\n\t\t//\n\t\t\t\t// let change = new puzzles.changes.Change();\n\t\t\t\t// change.value = null;\n\t\t\t\t// change.valueBeforeChange = null; //TODO\n\t\t\t\t// change.reference = id;\n\t\t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n\t\t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n\t\t\t\t// // change.action = null;\n\t\t\t\t// change.domain = puzzles.changes.Domain.NODE;\n\t\t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n\t\t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n\t\t//\n\t\t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n\t\t\t}*/\n\t}\n\n// \t/*\n// TODO:\n// When needed, we could develop these functions that are already supported on backend:\n\n// //gets all edges between 2 specific nodes:\n// queryBetween(sourceId:string, targetId:string, callback?:Function)\n// {\n// // return this.queryPlain({ searchParam:id, type:'between' }, callback);\n// }\n\n// //gets all edges connected to the specific node (with the provided id) (both those edges whose it's source node and those whose this is a target node)\n// // @example URL: URL:http://localhost:8001/kedges/connected/5a156965d0b7970f365e1a4b.json\n// queryConnected(id:string, callback?:Function)\n// {\n// // return this.queryPlain({ searchParam:id, type:'connected' }, callback);\n// }\n\n// //destroys all the edges connected to the specific node\n// //destroyConnected(id:string)\n// {\n\n// }\n// */\n\n// \t/**\n// * Gets from the server all the KN Edges that are contained in the map\n// * @param {string} id id of the map\n// * @param {function} callback Function to be called when the edges are retrieved\n// * @returns {Observable<KEdge[]>} array of the edges\n// @example URL: http://localhost:8001/kedges/in_map/579811d88e12abfa556f6b59.json\n// */\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tqueryInMap(id: string, callback?: Function): Observable<KEdge[] | undefined> {\n// \t\tconst result: Observable<KEdge[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map/\" + id).pipe(\n// \t\t\tmap((edgesS: ServerData) => CFServiceIsomorphic.processVOs<KEdge>(edgesS, KEdge)),\n// \t\t\t// map(edgesFromServer => CFServiceIsomorphic.processVOs<KEdge>(edgesFromServer, KEdge)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"KnalledgeEdgeService::queryInMap\", undefined))\n// \t\t);\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((edges) => callback(edges));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t/**\n// * UNSUPPORTED TEMPORARILY #551 (https://github.com/Cha-OS/colabo/issues/551)\n// * Gets from the server all the KN Edges that are contained in the map\n// * @param {string} id id of the map\n// * @param {function} callback Function to be called when the edges are retrieved\n// * @returns {Observable<KEdge[]>} array of the edges\n// @example URL: TBD\n// //\n// queryForMapTypeUserWTargetNodes(mapId:string, type:string, iAmid:string=null): Observable<KEdge[]>\n// {\n// var result:Observable<KEdge[]> = this.http.get<ServerData>(this.apiUrl+'for_map_type_user_w_target_nodes/'+mapId+'/'+type+'/'+iAmid+'.json')\n// .pipe(\n// map(edgesFromServer => CFServiceIsomorphic.processVOs(edgesFromServer, KEdge)),\n// catchError(this.handleError('KnalledgeEdgeService::queryForMapTypeUserWTargetNodes', null))\n// );\n// return result;\n// }\n// */\n\n// \t/**\n// * Gets from the server all the KN Edges that are contained in the map\n// * @param {string} id id of the map\n// * @param {function} callback Function to be called when the edges are retrieved\n// * @returns {Observable<KEdge[]>} array of the edges\n// @example URL: TBD\n// */\n// \tqueryForMapTypeUser(mapId: string, type: string, iAmid: string = \"\"): Observable<KEdge[] | undefined> {\n// \t\tconst result: Observable<KEdge[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"for_map_type_user/\" + mapId + \"/\" + type + \"/\" + iAmid + \".json\").pipe(\n// \t\t\tmap((edgesFromServer: ServerData) => CFServiceIsomorphic.processVOs<KEdge>(edgesFromServer, KEdge)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"KnalledgeEdgeService::queryForMapTypeUser\", undefined))\n// \t\t);\n// \t\treturn result;\n// \t}\n\n\t/**\n * Gets from the server all the KN Edges that are contained in the map\n * @param {string} id id of the map\n * @param {function} callback Function to be called when the edges are retrieved\n * @returns {Observable<KEdge[]>} array of the edges\n @example URL: TBD\n */\n\t// queryFromToForType(from: string | null, to: string, type: string = \"\"): Observable<KEdge[] | undefined> {\n\t// \tconst result: Observable<KEdge[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"from_to_for_type/\" + from + \"/\" + to + \"/\" + type + \".json\").pipe(\n\t// \t\tmap((edgesFromServer: ServerData) => CFServiceIsomorphic.processVOs<KEdge>(edgesFromServer, KEdge)),\n\t// \t\tcatchError(this.handleErrorForObservable(\"KnalledgeEdgeService::queryForMapTypeUser\", undefined))\n\t// \t);\n\t// \treturn result;\n\t// }\n\n\n// public destroyInMap(mapid: string, callback?: Function): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"in-map/\" + mapid, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted edges for mapid=${mapid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroy\"))\n// \t);\n\n// \tif (callback) {\n// \t\tresult.subscribe((success) => callback(success));\n// \t}\n// \treturn result;\n// }\n\n// /**\n// * @description BACKEND NOT FINISHED!\n// */\n// private destroyByTypeInMap(type: string, mapId: string): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-in-map/\" + type + \"/\" + mapId + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted nodes type=${type} and mapId=${mapId}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeInMap\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n// \treturn result;\n// }\n\n// destroyByTypeByUser(type: string, iAmid: string, callback?: Function): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-n-user/\" + type + \"/\" + iAmid, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted edges type=${type} and iAmid=${iAmid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeByUser\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n\n// \tif (callback) {\n// \t\tresult.subscribe((success) => callback(success));\n// \t}\n// \treturn result;\n// }\n\n// destroyByUser(iAmid: string): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-user/\" + iAmid, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted nodes: iAmid=${iAmid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByUser\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n// \treturn result;\n// }\n\n// destroyEdgesToChild(targetId: string): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"edges-to-child/\" + targetId, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t// tap(_ => console.log(`deleted edges type=${type} and iAmid=${iAmid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyEdgeToChild\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n// \treturn result;\n// }\n\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,cAAsB;AAU5B,IAAM,QAAiB;AACvB,IAAM,gBAAyB;;;ACTtC,sBAA0B;AAI1B,IAAAA,0BAAiG;AACjG,IAAAC,iBAAqJ;;;ACLrJ,kBAAmB;AAEnB,oBAAyC;AAEzC,IAAAC,iBAA2B;AAE3B,6BAAyF;AAYzF,IAAAC,0BAAoC;AA8BpC,aAAwB;AAhCxB,QAAQ,IAAI,sCAAsC,yBAAU;AAK5D,IAAM,cAAuB;AAqBtB,IAAM,0BAA0B;AAAA,EACtC,SAAS;AAAA,IACR,gBAAgB;AAAA,EACjB;AACD;AAUO,IAAM,sBAAN,MAA0B;AAAA,EA6BhC,YAAsB,0BAAqD;AAArD;AAAA,EAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAnB5E,OAAO,WAAmC,MAAkB,OAAkC;AAG7F,UAAM,MAAgB,KAAK;AAC3B,QAAI,KAAK;AACR,eAAS,KAAK,GAAG,KAAK,IAAI,QAAQ,MAAM;AAIvC,cAAM,KAAQ,MAAM,QAAQ,IAAI,EAAE,CAAC;AACnC,WAAG,QAAQ,2BAAa;AAExB,YAAI,EAAE,IAAI;AAAA,MACX;AAAA,IACD;AAE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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmOD;AA1Xa,+BAAN;AAAA,MADN,4BAAW;AAAA,GACC;",
|
|
6
|
-
"names": ["import_i_notifications", "import_i_core", "import_i_core", "import_i_notifications", "import_axios", "import_i_core", "import_i_core", "axios", "axios", "import_rxjs", "import_axios", "import_i_notifications", "import_i_core", "import_i_config", "import_i_notifications", "import_i_core", "axios", "puzzleConfig", "import_i_core", "import_axios", "import_i_notifications", "config", "import_i_core", "axios", "result", "import_i_core", "import_axios", "import_i_core", "import_i_notifications", "axios", "import_i_core", "import_axios", "import_i_notifications", "axios", "KEdge", "result"]
|
|
4
|
+
"sourcesContent": ["/*\n * Public API Surface of `@colabo-knalledge/i-core-services`\n */\n\n\nexport { ColaboKnAllEdgeContainerService } from \"./lib/kContainer-service\";\nexport { ColaboKnAllEdgeNodeService } from \"./lib/kNode-service\";\nexport { ColaboKnAllEdgeNodeServiceExtended } from \"./lib/kNode-service-extended\";\nexport { KnalledgeEdgeService } from \"./lib/kEdge-service\";\nexport { KnalledgeEdgeServiceExtended } from \"./lib/kEdge-service-extended\";\n\nexport { addSecurityPrefix, removeSecurityPrefix } from './lib/colabo-api-core.service';\n\n// TODO: [Should we remove it?](/colabo.space-development-gists/javascript/bundlers/webpack/issues-problems.md#Cross-puzzles-circular-dependencies-through-puzzles'-barrels)\nexport * from \"./common\";\n", "export const MODULE_NAME: string = \"@colabo-knalledge/i-core-services\";\n\n/**\n * Describes puzzle configuration\n */\nexport interface IPuzzleConfig {\n\t/** url to the server (backend) providing the KnAllEdge API */\n\tserverUrl: string;\n}\n\nexport const DEBUG: boolean = false;\nexport const DEBUG_VERBOSE: boolean = false;", "import { DEBUG } from \"./params\";\n\nimport { GetPuzzle } from \"@colabo-utils/i-config\";\n\nimport { ElementServiceIsomorphic } from \"./element.service.isomorphic\";\nimport { ServerData, IKNode } from \"@colabo-knalledge/i-core\";\nimport { NotificationMsg, NotificationMsgType, rethrowColaboError, ColaboErrorUnreachable } from \"@colabo-utils/i-notifications\";\nimport { IKEdge, KCONTAINER_API_PARAMS, KCONTAINER_API_TYPE, KNodeFrontend, IKContainer, IKContainerWContent, IApiRequest, ColaboApiOperators } from \"@colabo-knalledge/i-core\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\nimport { DEBUG_VERBOSE, MODULE_NAME } from \"./params\";\n\n// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosResponse } from \"axios\";\n\nimport { currentContext, CONTEXTS, Injectable, HttpClient, HttpHandler } from \"@colabo-headless/i-core\";\nimport { ColaboApiCoreService } from \"./colabo-api-core.service\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// console.log(\"[ColaboKnAllEdgeContainerService] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\n// console.log(\"[ColaboKnAllEdgeContainerService] Injectable: \", Injectable);\n// console.log(\"[ColaboKnAllEdgeContainerService] HttpClient: \", HttpClient);\n\ninterface IKContainerConfig {\n\tserverUrl: string;\n}\n\nlet puzzleConfig: IKContainerConfig;\n\n// interface IConstructor<T> {\n// new (...args: any[]): T;\n// // TODO: mprinc: Changed the return type from `T` to `VOIsomorphic` as it was complaining in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts and\n// // colabo/src/frontend/demos/kContainer/node_modules/@colabo-knalledge/f-store_core/lib/knalledge-container.service.ts since IKContainer is extended from IKContainer which is extended from VOFrontend, while all others (KNode, KEdge, ...) are (STILL) not extended in this double layer, so there are no problems (yet)\n// factory(obj: any): VOIsomorphic;\n// }\n\ninterface IConstructor<T> {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tnew (...args: any[]): T;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tfactory(payload: any, underlyingEntity: IKContainer): T;\n}\n\n@Injectable()\nexport class ColaboKnAllEdgeContainerService extends CFServiceIsomorphic implements ElementServiceIsomorphic {\n\tprotected apiUrl: string;\n\tprotected defaultAction = \"default\";\n\tconstructor(protected http: HttpClient, protected utilsNotificationService: UtilsNotificationService) {\n\t\tsuper(utilsNotificationService);\n\t\tpuzzleConfig = GetPuzzle(MODULE_NAME);\n\t\tif (!this.http) {\n\t\t\tif (currentContext === CONTEXTS.FRONTEND_ANGULAR) {\n\t\t\t\tconst msg = \"[ColaboKnAllEdgeContainerService] DI Problem: There is no provider injected for the service `HttpClient`.\";\n\t\t\t\tconsole.error(msg);\n\t\t\t\tif (this.utilsNotificationService) {\n\t\t\t\t\tconst nMsg: NotificationMsg = {\n\t\t\t\t\t\ttitle: \"DI Problem\",\n\t\t\t\t\t\tmsg: msg,\n\t\t\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\t\t};\n\t\t\t\t\tthis.utilsNotificationService.addNotification(nMsg);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// no DI\n\t\t\t\t// this is the case when we call it from the headless context\n\t\t\t\tconsole.log(\"[ColaboKnAllEdgeContainerService] Invited from the non-DI (non-angular) context. Initializing HttpClient ...\");\n\t\t\t\t// will create a headless HttpClient (based on `Axios` from 'axios-observable')\n\t\t\t\tthis.http = new HttpClient((null as unknown) as HttpHandler);\n\t\t\t}\n\t\t}\n\n\t\t// initialize underlying Colabo API layer, like axios interceptors\n\t\tColaboApiCoreService.initialize(\"ColaboKnAllEdgeContainerService\", axios);\n\n\t\tconsole.log(\"[ColaboKnAllEdgeContainerService] created\");\n\t\t// console.log(\"[ColaboKnAllEdgeContainerService] connecting to backend: \", chalk.bold.white(\"\" + ColaboKnAllEdgeContainerService.serverAP));\n\t\tthis.apiUrl = ColaboKnAllEdgeContainerService.serverAP + \"/\" + KCONTAINER_API_PARAMS.API_PATH + \"/\";\n\t\t// console.log(\"[ColaboKnAllEdgeContainerService] REST API URL: \", chalk.bold.white(this.apiUrl));\n\t}\n\n\t/**\n\t * Retrieves the kContainer with a given ID. It retrieves only the kContainer kNode, not all the kNodes that are in the kContainer.\n\t * @param id the id of the kContainer to be retrieved\n\t * @returns \n\t */\n\tpublic async getById(id: string, fields?: string): Promise<IKContainer> {\n\t\t// console.log('getByIdPromise called');\n\t\tlet retrievedKContainer: IKContainer;\n\n\t\t/**\n\t\t * REST path to the kContainer with a given ID\n\t\t */\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.INDEX_BY_ID + \"/\" + id, fields);\n\t\tif (DEBUG) console.log(\"[getByIdPromise] url: \", url);\n\t\ttry {\n\t\t\t// Make a request for a kContainer with a given ID\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getByIdPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tretrievedKContainer = ColaboApiOperators.extractVoFromServerDataAsArray<IKContainer>(serverData);\n\t\t\tif (!retrievedKContainer) {\n\t\t\t\treturn Promise.reject<IKContainer>(new Error(\"Problem with extracting data as an array from serverData\"));\n\t\t\t}\n\n\t\t\t// check if the retrieved entity is of the expected type\n\t\t\tif ((ColaboApiOperators.getParentEntity(retrievedKContainer) as IKNode).type != KCONTAINER_API_PARAMS.KCONTAINER_TYPE) {\n\t\t\t\treturn Promise.reject<IKContainer>(new Error(\"Wrong entity type, expected: \" + KCONTAINER_API_PARAMS.KCONTAINER_TYPE));\n\t\t\t}\n\n\t\t\t// console.log(\"[getByIdPromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKContainer>(error);\n\t\t}\n\n\t\treturn retrievedKContainer;\n\t}\n\n\tasync create(kContainerWContent: IKContainerWContent): Promise<IKContainerWContent> {\n\t\t// TODO: kNode.type has to be set properly to `KCONTAINER_API_PARAMS.KCONTAINER_TYPE`\n\t\t// THE QUESTION is WHERE\n\t\tconsole.log(\"ColaboKnAllEdgeContainerService.create\");\n\n\t\tlet createdKContainer: IKContainerWContent;\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a container with a given ID\n\t\ttry {\n\t\t\tconst requestRoot: IApiRequest = {\n\t\t\t\ttype: KCONTAINER_API_TYPE.CREATE_NEW,\n\t\t\t\tdata: kContainerWContent,\n\t\t\t};\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, requestRoot, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tcreatedKContainer = ColaboApiOperators.extractVoFromServerData<IKContainerWContent>(serverData);\n\t\t\treturn createdKContainer;\n\t\t} catch (error: any) {\n\t\t\t// Handle error, including 400 Bad Request and 500 Internal Server Error\n\t\t\tif (error.response) {\n\t\t\t // The request was made, and the server responded with a status code\n\t\t\t console.log(\"[create]\", error);\n\t\t\t // TODO-ColaboError:\n\t\t\t // const colaboError: ColaboError = colaboErrorFromAPIError(error);\n\t\t\t console.warn('Response status:', error.response.status);\n\t\t\t console.warn('Response data:', error.response.data);\n\t\n\t\t\t if (error.response.data.code === 'EMAIL_EXISTS') {\n\t\t\t\tconsole.warn('EMAIL_EXISTS');\n\t\t\t }\n\t\t\t return error.response.data;\n\t\t\t} else if (error.request) {\n\t\t\t // The request was made, but no response was received\n\t\t\t console.error('No response received');\n\t\t\t} else {\n\t\t\t // Something happened in setting up the request that triggered an Error\n\t\t\t console.error('[ColaboKnAllEdgeContainerService:create] Error during request setup:', error.message);\n\t\t\t}\n\t\t\t// TODO-ColaboError:\n\t\t\trethrowColaboError(error);\n\t\t\t// this fixes problem of not returning a result at the end of the function\n\t\t\t// throw error;\n\t\t\t// return new ServerResponse(ServerResponseCode.ERROR_REQUEST, false);\n\t\t\tthrow new ColaboErrorUnreachable();\n\t\t}\n\t\t// } catch (error) {\n\t\t// \trethrowColaboError(error);\n\t\t// }\n\t}\n\n\tasync update(kContainer: IKContainer): Promise<IKContainer> {\n\t\t// TODO: kNode.type has to be set properly to `KCONTAINER_API_PARAMS.KCONTAINER_TYPE`\n\t\t// THE QUESTION is WHERE\n\t\tconsole.log(\"ColaboKnAllEdgeContainerService.update\");\n\t\tlet result: IKContainer;\n\n\t\tconst actionType = KCONTAINER_API_TYPE.UPDATE_BY_ID;\n\t\tconst url: string = this.apiUrl + \"one/\" + actionType + \"/\" + kContainer._id;\n\n\t\t// Make a request for a user with a given ID\n\n\t\t/* TODO: support cases when an entity is trying to be updated before its creation is finished;\n\t\tVO.state, to know if it is a STATE_LOCAL or SYNCED with server:\n\n\t\tif (kNode.state == VOFrontend.STATE_LOCAL) {\n\t\t\t//TODO: fix it by going through queue\n\t\t\twindow.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);\n\t\t\t//TODO: we should move this UI code out of the service logics\n\t\t\tresult = of(undefined);\n\t\t} else {\n\t\t}\n\t\t*/\n\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(url, kContainer, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[updatePromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKContainer>(serverData);\n\n\t\t\t// console.log(\"[updatePromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKContainer>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t /**\n\t * Deletes the IKContainer on server\n\t * In server's response, the ServerData.data is equal to the _id of the deleted VO. ServerData.data will be equal to null, if there is no data we intended to delete. In both cases `ServerData.success` will be eq `true`\n\t * @example URL:http://localhost:8001/knodes/one/default/5a156965d0b7970f365e1a4b.json\n\t * @param {string} id id of the node to be deleted\n\t * @return {*} {Promise<boolean>}\n\t * @memberof ColaboKnAllEdgeContainerService\n\t */\n\tasync destroy(id: string): Promise<boolean> {\n\t\tconsole.log(`[destroy] id=${id}`)\n\t\tconst url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.DESTROY_ONE + \"/\" + id;\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(url, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\treturn serverData.success;\n\t\t} catch (error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\t/* TODO:NG2\n if(this.knAllEdgeRealTimeService){ // realtime distribution\n //\n // let change = new puzzles.changes.Change();\n // ...\n // this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeDeletedEventName, change);//{'_id':id});\n }*/\n\t}\n\n\t/**\n\t * @param containerId The id of the kContainer to which we want to add kNodes\n\t * @param containedIds The list of ids of the kNodes we want to add to the container\n\t * @param edgeDataContent Optional dataContent to set on the created edges (e.g. `{ type: \"litterra.corpus.document\" }`)\n\t * @description adds kNodes in a kContainer\n\t * @returns edges created between the container and entities added to the container\n\t */\n\tpublic async updateAddNodes(containerId: string, containedIds: string[], edgeDataContent?: Record<string, unknown>): Promise<IKEdge[]> {\n\t\tif(DEBUG) console.log(\"[ColaboKnAllEdgeContainerService::updateAddNodes(containerId, containedIds)\", containerId, containedIds);\n\n\t\tlet result: IKEdge[];\n\t\tconst idsStr: string = containedIds.join(\",\");\n\t\tconst url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.UPDATE_ADD_KNODE_BY_IDS + \"/\" + containerId + \"/\" + idsStr;\n\t\tif(DEBUG) console.log(\"updateAddNodes called\", url);\n\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\t// Make a request for a kContainer with a given type\n\t\t\t// NOTE: we have to send `{}` and not just `null` as the second parameter, as the server expects a JSON object and otherwise it would throw an error:\n\t\t\t// SyntaxError: Unexpected token n in JSON at position 0\n\t\t\t\t// at JSON.parse (<anonymous>)\n\t\t\t\t// at createStrictSyntaxError (/Users/mprinc/data/development/colabo-zontik/colabo/src/backend/node_modules/body-parser/lib/types/json.js:169:10)\n\t\t\tconst body = edgeDataContent ? { edgeDataContent } : {};\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(url, body, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKEdge>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * removes kNodes from a kContainer\n\t *\n\t * @param id The id of the kContainer from which we want to remove kNodes\n\t * @param ids The list of ids of the kNodes we want to remove from the container\n\t * @returns edges created between the container and entities added to the container\n\t */\n\tpublic async updateRemoveNodes(id: string, ids: string[]): Promise<string[]> {\n\t\tconsole.log(\"[ColaboKnAllEdgeContainerService::updateRemoveNodes(id, ids)\", id, ids);\n\n\t\tlet result: string[];\n\t\tconst idsStr: string = ids.join(\",\");\n\t\tconst url: string = this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.UPDATE_REMOVE_KNODE_BY_IDS + \"/\" + id + \"/\" + idsStr;\n\t\tconsole.log(\"updateRemoveNodes called\", url);\n\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\t// Make a request for a kContainer with a given type\n\t\t\t// NOTE: we have to send `{}` and not just `null` as the second parameter, as the server expects a JSON object and otherwise it would throw an error:\n\t\t\t// SyntaxError: Unexpected token n in JSON at position 0\n\t\t\t\t// at JSON.parse (<anonymous>)\n\t\t\t\t// at createStrictSyntaxError (/Users/mprinc/data/development/colabo-zontik/colabo/src/backend/node_modules/body-parser/lib/types/json.js:169:10)\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(url, {}, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<string>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kContainer: \", JSON.stringify(kContainer, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<string[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t *\n\t * @param id The id of the kContainer which kNodes we want to retrieve\n\t * @description retrieves kNodes in a kContainer\n\t */\n\tpublic async getInContainer(id: string, fields?: string): Promise<KNodeFrontend[]> {\n\t\tlet result: KNodeFrontend[];\n\t\t// TODO: now we have to add `.json` extension: \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset.json\"\n\t\t// as otherwise the url \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset\"\n\t\t// would get trimmed to \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge\"\n\t\t// and effectively we would search for the type \"test-colabo.knalledge\" instead\n\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(this.apiUrl + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + \"/\" + id + \".json\", fields);\n\t\tif (DEBUG) console.log(`this.apiUrl:${this.apiUrl}, this.defaultAction:${this.defaultAction}`);\n\t\t// const url: string = `http://127.0.0.1:8001/knodes/one/default/65e09fd0ea64b78aeacd671d`;\n\t\t// const url: string = `http://127.0.0.1:8001/kcontainers/` + this.defaultAction + \"/\" + KCONTAINER_API_TYPE.INDEX_IN_CONTAINER + \"/\" + id + \".json\"; // (\"/in-container/5f2b0bc595814d1bb918d31d.json`;)\n\t\t// console.log('getInContainer called',url);\n\t\t// Make a request for a kContainer with a given type\n\t\ttry {\n\t\t\tconst response: ServerData | undefined = await this.http.get<ServerData>(url).toPromise();\n\t\t\tif (DEBUG_VERBOSE) console.log(`[ColaboKnAllEdgeContainerService::getInContainer] response`, response);\n\t\t\tif(!response){\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\t// Process the response:\n\t\t\t// OLD `Observable`: map((response: ServerData) => {return CFServiceIsomorphic.processVOs<KNodeFrontend>(response, KNodeFrontend);}):\n\t\t\tconst processedResponse: KNodeFrontend[] = CFServiceIsomorphic.processVOs<KNodeFrontend>(response, KNodeFrontend);\n\n\t\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboKnAllEdgeContainerService::getInContainer] response<KNodeFrontend>: \", JSON.stringify(processedResponse, null, 4));\n\t\n\t\t\treturn processedResponse;\n\t\t} \n\t\tcatch(error){\n\t\t\t//TODO-ColaboError:\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tpublic async getVOs(type?: string, upperLayerType?: any, fields?: string): Promise<IKContainer[]> {\n\t\tlet result: IKContainer[];\n\t\t// TODO: now we have to add `.json` extension: \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset.json\"\n\t\t// as otherwise the url \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge.dataset\"\n\t\t// would get trimmed to \"http://127.0.0.1:8001/kcontainers/default/by-type/test-colabo.knalledge\"\n\t\t// and effectively we would search for the type \"test-colabo.knalledge\" instead\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(`${this.apiUrl}${this.defaultAction}/${KCONTAINER_API_TYPE.INDEX_BY_TYPE}/${type}${upperLayerType ? \"/\" + upperLayerType : \"\"}.json`, fields);\n\n\t\t// Make a request for a kContainer with a given ID\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[ColaboKnAllEdgeContainerService::getVOs] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKContainer>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKContainer[]>(new Error(\"Couldn't extract VOs from the serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[ColaboKnAllEdgeContainerService::getVOs] result: \", JSON.stringify(result, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKContainer[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Extracts upper-layer entity from kContainer and sets it up\n\t * @param kContainer - kContainer holding the upper-layer entity\n\t * @param typeT - type (class) of the expected upper-layer entity\n\t * @returns the extracted upper-layer entity\n\t */\n\tpublic extractEntityFromPayload<T>(kContainer: IKContainer, typeT: IConstructor<T>): T {\n\t\tif (!kContainer.dataContent) {\n\t\t\tconsole.error(\"[ColaboKnAllEdgeContainerService::extractEntityFromPayload] container payload (kContainer.dataContent) is missing\");\n\t\t}\n\n\t\tconst vo: T = typeT.factory(kContainer.dataContent, kContainer);\n\t\treturn vo;\n\t}\n\n\t/**\n\t * Extracts upper-layer entity (`<T>`) from the lower-layer entity (`IKContainer`) and sets it up into the `<T>` entity\n\t * @param kContainer - kContainer containing the payload of the upper-layer entity\n\t * @param factoryOperator - the operator responsible for generating and filling in the data into the upper-layer entity (`<T>`)\n\t * @returns the extracted upper-layer entity\n\t */\n\tpublic extractEntityFromPayloadWithExternalOperators<T>(kContainer: IKContainer, factoryOperator: Function): T {\n\t\tif (!kContainer.dataContent) {\n\t\t\tconsole.error(\"[ColaboKnAllEdgeContainerService::extractEntityFromPayload] container payload (kContainer.dataContent) is missing\");\n\t\t}\n\n\t\tconst vo: T = factoryOperator(kContainer.dataContent, kContainer);\n\t\treturn vo;\n\t}\n\n\t/**\n\t * Extracts upper-layer entities from kContainers and sets them up\n\t * @param kContainers - kContainer holding the upper-layer entity\n\t * @param typeT - type (class) of the expected upper-layer entity\n\t * @returns the extracted upper-layer entities\n\t */\n\tpublic extractEntitiesFromPayload<T>(kContainers: IKContainer[], typeT: IConstructor<T>): T[] {\n\t\tconst vos: T[] = [];\n\t\tif (!Array.isArray(kContainers)) return vos;\n\n\t\tfor (const kContainer of kContainers) {\n\t\t\tvos.push(this.extractEntityFromPayload<T>(kContainer, typeT));\n\t\t}\n\t\treturn vos;\n\t}\n}\n", "const DEBUG: boolean = false;\nconst DEBUG_VERBOSE: boolean = false;\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Observable } from \"rxjs\";\nimport { of } from \"rxjs\";\n\nimport { VOIsomorphic, ServerData } from \"@colabo-knalledge/i-core\";\n\nimport { Injectable } from \"@colabo-headless/i-core\";\n\nimport { EErrorOrigin, EColaboErrorKind, throwColaboError, ColaboErrorUnreachable } from \"@colabo-utils/i-notifications\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// if(DEBUG) console.log(\"[CFServiceIsomorphic] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\nif(DEBUG) console.log(\"[CFServiceIsomorphic] Injectable: \", Injectable);\n\nimport { NotificationMsgType } from \"@colabo-utils/i-notifications\";\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nconst HIDE_ERRORS: boolean = true;\n\n// TODO: removed\n// import {\n// UtilsNotificationService,\n// NotificationMsgType,\n// NotificationMsg\n// } from \"@colabo-utils/f-notifications\";\n\ninterface IConstructor<T> {\n\tnew (...args: unknown[]): T;\n\t// TODO: mprinc: Changed the return type from `T` to `VOIsomorphic` as it was complaining in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts and\n\t// colabo/src/frontend/demos/kContainer/node_modules/@colabo-knalledge/f-store_core/lib/knalledge-container.service.ts since KContainerFrontend is extended from KContainer which is extended from VOFrontend, while all others (KNode, KEdge, ...) are (STILL) not extended in this double layer, so there are no problems (yet)\n\tfactory(obj: unknown): VOIsomorphic;\n}\n\n// interface IConstructor<T> {\n// new (...args: any[]): T;\n// factory(obj: any): T;\n// }\n\nexport const HTTP_OPTIONS_CONST_JSON = {\n\theaders: {\n\t\t\"Content-Type\": \"application/json\",\n\t},\n};\n\nimport * as config from \"@colabo-utils/i-config\";\n\n// TODO: removed\n// export const HTTP_OPTIONS_CONST_JSON = {\n// headers: new HttpHeaders({ \"Content-Type\": \"application/json\" })\n// };\n\n@Injectable()\nexport class CFServiceIsomorphic {\n\t// RESTfull backend API url\n\t// eslint-disable-next-line @typescript-eslint/no-inferrable-types\n\tstatic get serverAP(): string {\n\t\treturn config.GetString(\"serverUrl\");\n\t}\n\n\t/**\n\t * processes array of VOs received from server to a local/fronted version\n\t * @param vofS\n\t * @param typeT\n\t */\n\tstatic processVOs<T extends VOIsomorphic>(vofS: ServerData, typeT: IConstructor<T>): Array<T> {\n\t\t//if(DEBUG) console.log(\"processVOs\");\n\t\t// if(DEBUG) console.log('processVOs::vofS.data', vofS.data);\n\t\tconst vos: Array<T> = vofS.data as Array<T>;\n\t\tif (vos) {\n\t\t\tfor (let id = 0; id < vos.length; id++) {\n\t\t\t\t//TODO: will not be needed when/if we get rid of ServerData wrapping needed now, because the response from server will be typed to VO unlike in previous versions\n\t\t\t\t// TODO: mprinc: Added casting <T> as it was complaining in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts and\n\t\t\t\t// colabo/src/frontend/demos/kContainer/node_modules/@colabo-knalledge/f-store_core/lib/knalledge-container.service.ts since KContainerFrontend is extended from KContainer which is extended from VOFrontend, while all others (KNode, KEdge, ...) are (STILL) not extended in this double layer, so there are no problems (yet)\n\t\t\t\tconst vo: T = typeT.factory(vos[id]) as T;\n\t\t\t\tvo.state = VOIsomorphic.STATE_SYNCED;\n\t\t\t\t//if(DEBUG) console.log(vo);\n\t\t\t\tvos[id] = vo;\n\t\t\t}\n\t\t}\n\t\t// if(DEBUG) console.log('processVOs::vos', vos);\n\t\treturn vos;\n\t}\n\n\tconstructor(protected utilsNotificationService?: UtilsNotificationService) {}\n\n\t/**\n\t * extracts VO from the server response `ServerData` and sets it up\n\t * @param sd - data received from server\n\t * @param typeT - type (class) of the object expected to be received\n\t */\n\tprotected extractVO<T extends VOIsomorphic>(sd: ServerData, typeT: IConstructor<T>): T {\n\t\t//let vo: T = new typeT();\n\t\t// if(DEBUG) console.log('extractVO',sd);\n\t\tif (!sd.success) {\n\t\t\tconsole.warn(\"[CFServiceIsomorphic::extractVO] serverData.success = false\");\n\t\t}\n\t\tlet vo: T;\n\t\tif (sd.data) {\n\t\t\tvo = typeT.factory(sd.data) as T;\n\t\t\tvo.state = VOIsomorphic.STATE_SYNCED;\n\t\t\treturn vo;\n\t\t} else {\n\t\t\t// TODO: removed because of the error in colabo/src/isomorphic/puzzles/knalledge/core-services/lib/kEdge-service-extended.ts (create method)\n\t\t\t// throw new Error(\"`data` property is missing in the ServerData object\");\n\t\t\treturn {} as unknown as T;\n\t\t}\n\t}\n\n\t/**\n\t * extracts VO from the server response `ServerData` and sets it up\n\t * NOTE: Opposite to the `extractVO` method, this method expects the entity wrapped in an array\n\t * The need and confusion is due to MongoDB difference in `find` method that returns an array,\n\t * and `findById` that returns a single entity\n\t * This method is here to treat uniformly both cases (for backend APIs, like `kContainer` API that wraps `findById` into an array)\n\t * @param sd - data received from server\n\t * @param typeT - type (class) of the object expected to be received\n\t * @throws `ColaboError (DATA_MISSING | DATA_INCORRECT_FORMAT)`\n\t */\n\tprotected extractVOFromDataAsArray<T extends VOIsomorphic>(sd: ServerData, typeT: IConstructor<T>): T {\n\t\t//let vo: T = new typeT();\n\t\t// if(DEBUG) console.log('extractVO',sd);\n\t\tif (!sd.success) {\n\t\t\tconsole.warn(\"[CFServiceIsomorphic::extractVO] serverData.success = false\");\n\t\t\t// TODO-ColaboError: cover this case\n\t\t}\n\t\tlet vo: T;\n\t\t// we get array of entities even for a single entity\n\t\t// the array should be of length 0\n\t\tif (sd.data && Array.isArray(sd.data) && sd.data.length >= 1) {\n\t\t\t// console.error(\"OK, no error\");\n\t\t\tvo = typeT.factory(sd.data[0]) as T;\n\t\t\tvo.state = VOIsomorphic.STATE_SYNCED;\n\t\t\treturn vo;\n\t\t} else {\n\t\t\tconsole.error(\"OK, there is error\");\n\t\t\tif (!sd.data) {\n\t\t\t\tthrowColaboError(\"`data` property is missing in the ServerData object\", EErrorOrigin.SYSTEM, EColaboErrorKind.DATA_MISSING );\n\t\t\t}\n\t\t\tif (!Array.isArray(sd.data)) {\n\t\t\t\tthrowColaboError(\"`data` property is not an array\", EErrorOrigin.SYSTEM, EColaboErrorKind.DATA_INCORRECT_FORMAT );\n\t\t\t}\n\t\t\t// this should not happen I think (@mprinc)\n\t\t\tthrowColaboError(\"`data` is not in right format\", EErrorOrigin.SYSTEM, EColaboErrorKind.DATA_INCORRECT_FORMAT);\n\t\t\tthrow new ColaboErrorUnreachable();\n\t\t}\n\t}\n\n\tprotected errorNotification(error: unknown): void {\n\t\tif (this.utilsNotificationService && !HIDE_ERRORS) {\n\t\t\tthis.utilsNotificationService.addNotification({\n\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\ttitle: \"CFService Error\",\n\t\t\t\tmsg: JSON.stringify(error),\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected handleError() {\n\t\t\n\t}\n\n\t/**\n\t * Handle Http operation that failed.\n\t * Lets the app continue.\n\t * @param operation - name of the operation that failed\n\t * @param result - optional value to return as the observable result\n\t */\n\tprotected handleErrorForObservable<T>(operation = \"operation\", result?: T): (error: unknown) => Observable<T> {\n\t\treturn (error: unknown): Observable<T> => {\n\t\t\t// TODO: send the error to remote logging infrastructure\n\t\t\tconsole.error(\"[CFServiceIsomorphic:handleError] operation: '%s'. error: \", operation, error); // log to console instead\n\t\t\t// window.alert('error: ' + error);\n\t\t\tthis.errorNotification(error);\n\n\t\t\t// TODO: better job of transforming error for user consumption\n\t\t\t//this.log(`${operation} failed: ${error.message}`);\n\n\t\t\t// Let the app keep running by returning an empty result.\n\t\t\treturn of(result as T);\n\t\t};\n\t}\n}\n", "// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosStatic } from \"axios\";\nimport { DEBUG, DEBUG_VERBOSE } from \"./params\";\nimport { injectInterceptorService } from \"@colabo-headless/i-core\";\n\nif(DEBUG) console.log(\"[ColaboApiCoreService] Initializing\");\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst responseInterceptor = (response: any) => {\n\tif (DEBUG_VERBOSE) console.log(\"[axios::interceptor::colabo-api-core.service] response.data: \", JSON.stringify(response.data, null, 4));\n\tif (typeof response.data !== \"string\") {\n\t\tconsole.error(\"The data are not in expected format. This could mean, either: 1) axios is used for not only colabo api backend (we do not use it as instance, probably we should eventually), 2) colabo interceptor is installed (`ColaboApiCoreService.initialize`) twice\");\n\t\treturn response;\n\t}\n\t// removing the JSONP prefix\n\t// TODO, maybe even add testing for the JSON footprint we add\n\tlet data: string = response.data;\n\t// cut the first line:\n\tresponse.data = JSON.parse(removeSecurityPrefix(data));\n\n\treturn response;\n};\n\nexport const addSecurityPrefix = (data: any): string => {\n\tconst dataSecured: string = \")]}',\\n\" + JSON.stringify(data);\n\treturn dataSecured;\n}\n\nexport const removeSecurityPrefix = (data: string): string => {\n\tlet index: number = data.indexOf(\"\\r\");\n\tconst indexN: number = data.indexOf(\"\\n\");\n\tif (index < 0 || index + 1 == indexN) {\n\t\tindex = indexN;\n\t}\n\tdata = data.substring(index + 1);\n\treturn data\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst errorInterceptor = (error: any) => {\n\t// just passing through\n\treturn Promise.reject(error);\n};\n\ninterface IAxiosImplementation {\n\tcolaboApiInterceptorId: number;\n\tcolaboApiInterceptorNamespace: string;\n}\n\nif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService] declaring ColaboApiCoreService class\");\nexport class ColaboApiCoreService {\n\tpublic static interceptorsForAxios: Map<AxiosStatic, IAxiosImplementation> = new Map<AxiosStatic, IAxiosImplementation>();\n\t// Add a response interceptor to remove JSONP prefix that Colabo.Space is sending\n\t// https://docs.angularjs.org/api/ng/service/$http#json-vulnerability-protection\n\t// https://stackoverflow.com/questions/33967189/angular-not-removing-json-prefix\n\t// [Ejecting an interceptor #2615](https://github.com/axios/axios/issues/2615#issuecomment-567964331)\n\tpublic static initialize(namespace: string, specificAxios: AxiosStatic = axios): number {\n\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Initializing interceptor for the namespace: \", namespace);\n\n\t\t// TODO, understand how to iterate through all of them and not add if already exists\n\t\t// https://github.com/axios/axios/blob/master/lib/core/InterceptorManager.js#L44\n\t\t// [How to iterate through axios interceptors and check if an intercepted is already added](https://stackoverflow.com/questions/64514080/how-to-iterate-through-axios-interceptors-and-check-if-an-intercepted-is-already)\n\n\t\tlet axiosImplementation: IAxiosImplementation | undefined = this.interceptorsForAxios.get(specificAxios);\n\n\t\tif (!axiosImplementation || typeof axiosImplementation.colaboApiInterceptorId === \"undefined\") {\n\t\t\t// console.log(`[ColaboApiCoreService] specificAxios: ${specificAxios}`);\n\t\t\t// console.log(`[ColaboApiCoreService] specificAxios.interceptors: ${specificAxios.interceptors}`);\n\t\t\tconst colaboApiInterceptorId = specificAxios.interceptors.response.use(responseInterceptor, errorInterceptor);\n\t\t\tif(!axiosImplementation) {\n\t\t\t\taxiosImplementation = {\n\t\t\t\t\tcolaboApiInterceptorId: colaboApiInterceptorId,\n\t\t\t\t\tcolaboApiInterceptorNamespace: namespace,\n\t\t\t\t}\n\t\t\t\tthis.interceptorsForAxios.set(specificAxios, axiosImplementation);\n\t\t\t} else {\n\t\t\t\taxiosImplementation.colaboApiInterceptorNamespace = namespace;\n\t\t\t\taxiosImplementation.colaboApiInterceptorId = colaboApiInterceptorId;\t\n\t\t\t}\n\n\t\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Initialized interceptor for the namespace: \", namespace);\n\t\t} else {\n\t\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Skipping initialization. The colabo interceptor was already initialized for the namespace: \", axiosImplementation.colaboApiInterceptorNamespace);\n\t\t}\n\t\treturn axiosImplementation.colaboApiInterceptorId;\n\t}\n\n\tpublic static destroy(namespace: string, specificAxios: AxiosStatic = axios): void {\n\t\tif (DEBUG_VERBOSE) console.log(\"[ColaboApiCoreService:initialize] Destroying interceptor for the namespace: \", namespace);\n\n\t\tlet axiosImplementation: IAxiosImplementation | undefined = this.interceptorsForAxios.get(specificAxios);\n\t\tif( axiosImplementation) {\n\t\t\tspecificAxios.interceptors.request.eject( axiosImplementation.colaboApiInterceptorId);\n\t\t} else {\n\t\t\tconsole.log(`[ColaboApiCoreService:initialize] no axiosImplementation found for the provided axios`);\n\t\t}\n\t}\n}\n\ninjectInterceptorService(ColaboApiCoreService);", "const DEBUG: boolean = false;\nconst DEBUG_VERBOSE: boolean = false;\n\n/** \n * This is a client for the KnAllEdge KNode backend. It is implemented in an isomorphic manner so it can be used both from frontend (browser) and backend (api, app, services, ...)\n */\nimport { IPuzzleConfig, MODULE_NAME } from \"./params\";\n\n// TODO:EXAMPLE - should we remove it completely\nimport { Observable, of } from \"rxjs\";\nimport { catchError, map } from \"rxjs/operators\";\n// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosError, AxiosResponse } from \"axios\";\n\nimport { ColaboError, EErrorOrigin, EColaboErrorKind, rethrowColaboError, throwColaboError, isColaboError } from \"@colabo-utils/i-notifications\";\n\n// import { Injectable } from '@angular/core';\n// import { HttpClient } from '@angular/common/http';\n// TODO:EXAMPLE - should we remove angular specific support\nimport { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient, HttpHandler } from \"@colabo-headless/i-core\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// if(DEBUG) console.log(\"[ColaboKnAllEdgeNodeService] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\n// if(DEBUG) console.log(\"[ColaboKnAllEdgeNodeService] HttpClient: \", HttpClient);\n// if(DEBUG) console.log(\"[ColaboKnAllEdgeNodeService] Injectable: \", Injectable);\n\nimport { chalk } from \"@colabo-headless/i-core\";\nimport { currentContext, CONTEXTS } from \"@colabo-headless/i-core\";\nif(DEBUG) console.info(`[ColaboKnAllEdgeNodeService] Current context: ${currentContext}`);\n\n// get the configuration data\nimport { GetPuzzle } from \"@colabo-utils/i-config\";\n\nimport { ServerData, KNodeFrontend, KNODE_API_TYPE, ColaboApiOperators, IApiRequest, contextReportText } from \"@colabo-knalledge/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\nimport { IEntity, ElementServiceIsomorphic } from \"./element.service.isomorphic\";\n\nimport { NotificationMsg, NotificationMsgType } from \"@colabo-utils/i-notifications\";\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nimport { KNODE_API_PARAMS, IKNode } from \"@colabo-knalledge/i-core\";\nimport { ColaboApiCoreService } from \"./colabo-api-core.service\";\n\n/** \n * Keeps the next available id for the service instance.\n * This helps to identify and investigate usage scenarios.\n */\nlet class_id: number = 1;\n\n@Injectable()\nexport class ColaboKnAllEdgeNodeService extends CFServiceIsomorphic implements ElementServiceIsomorphic {\n\t/** url of server (including port and folder)\n\t * it is provided from the config data\n\t */\n\tprotected serverAP: string;\n\n\t/** the id of the current service instance */\n\tpublic id: number = class_id++;\n\n\t/** the full url to the service specific url including API path (sub-folder) */\n\tprotected apiUrl: string;\n\n\t/** default API action used for standard (CRUD) calls */\n\tprotected defaultAction: string = \"default\";\n\n\t/**\n\t * Initializes and constructs the service\n\t * In the case of the DI support, it receives http client and notification service\n\t * @param http DI-ed http client (primarily in the angular environment or testing), if missing it will be created internally\n\t * @param utilsNotificationService notification service for reporting errors, info and warnings to user, TODO: if missing, should we create a default `console.*` equivalent?\n\t */\n\tconstructor(protected http: HttpClient, protected utilsNotificationService: UtilsNotificationService) {\n\t\tsuper();\n\n\t\t// https://github.com/Cha-OS/colabo/issues/698\n\t\t// initialize underlying Colabo API layer, like axios interceptors\n\t\tColaboApiCoreService.initialize(\"ColaboKnAllEdgeNodeService\", axios);\n\n\t\t// this is the case when we call it from the headless context\n\t\tif (!this.http) {\n\t\t\t// angular but http is not DI-ed\n\t\t\tif (currentContext == CONTEXTS.FRONTEND_ANGULAR) {\n\t\t\t\tconst msg: string = \"DI Problem: There is no provider injected for the service `HttpClient`.\";\n\t\t\t\tconsole.error(msg);\n\t\t\t\tif (this.utilsNotificationService) {\n\t\t\t\t\tconst nMsg: NotificationMsg = {\n\t\t\t\t\t\ttitle: \"DI Problem\",\n\t\t\t\t\t\tmsg: msg,\n\t\t\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\t\t};\n\t\t\t\t\tthis.utilsNotificationService.addNotification(nMsg);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// https://github.com/Cha-OS/colabo/issues/698\n\t\t\t\t// will create a vanilla HttpClient (based on `Axios` from 'axios-observable')\n\t\t\t\tthis.http = new HttpClient((null as unknown) as HttpHandler);\n\t\t\t\tif(DEBUG) console.log(`[ColaboKnAllEdgeNodeService:${this.id}] invited from the isomorphic context. Creating and initializing vanilla HttpClient ...`);\n\t\t\t}\n\t\t}\n\n\t\tif(DEBUG) console.log(\"[ColaboKnAllEdgeNodeService] created\");\n\n\t\tconst puzzleConfig: IPuzzleConfig = GetPuzzle(MODULE_NAME);\n\t\tthis.serverAP = puzzleConfig.serverUrl;\n\t\tif(DEBUG) console.log(\"[ColaboKnAllEdgeNodeService] connecting to backend: \", chalk.bold.white(this.serverAP));\n\t\tthis.apiUrl = this.serverAP + \"/\" + KNODE_API_PARAMS.API_PATH + \"/\";\n\t\tif(DEBUG) console.log(\"[ColaboKnAllEdgeNodeService] REST API URL: \", chalk.bold.white(this.apiUrl));\n\t}\n\n\t/**\n\t * Get a KN Node from the server by its `id`\n\t * @param {string} id id of the node\n\t * @param {function} callback Function to be called when the node is retrieved\n\t * @returns {Promise<KNodeFrontend>} the retrieved node\n\t * @throws `ColaboError (REQUEST_BAD | DATA_MISSING | DATA_INCORRECT_FORMAT)` \n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\t// OLD: getById(id: string, callback?: Function): Observable<KNodeFrontend> {\n\tasync getById(id: string, fields?: string): Promise<KNodeFrontend> {\n\t\t// if(DEBUG) console.log('getById('+id+')');\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(this.apiUrl + \"one/\" + this.defaultAction + \"/\" + id, fields);\n\t\tif(DEBUG) console.log(`[ColaboKnAllEdgeNodeService:getById] url: ${url}`);\n\t\t// OLD: const result: Observable<KNodeFrontend> = this.http.get<ServerData>(url).pipe(\n\t\tif(DEBUG) console.log(`[ColaboKnAllEdgeNodeService:getById] ${this.id}`);\n\t\t\n\t\ttry {\n\t\t\tconst result: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\t\tconst data: ServerData = result.data;\n\t\t\t// if(DEBUG) console.log(`[ColaboKnAllEdgeNodeService:getById] result.data: ${JSON.stringify(data, null, 4)}`);\n\t\t\tconst kNode: KNodeFrontend = this.extractVOFromDataAsArray<KNodeFrontend>(data, KNodeFrontend);\n\t\t\t// if(DEBUG) console.log(`[ColaboKnAllEdgeNodeService:getById] kNode: ${JSON.stringify(kNode, null, 4)}`);\n\t\t\treturn kNode;\n\t\t} catch(e) {\n\t\t\tif(isColaboError(e)) {\n\t\t\t\t// ColaboError (thrown by `extractVOFromDataAsArray`)\n\t\t\t\t// we rethrow it (type guarded as `ColaboError`):\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\t//TODO-ColaboError: check if it really is `AxiosError`\n\t\t\t// Axios error - we pack it into `ColaboError` and throw:\n\t\t\tconst error: AxiosError = e as AxiosError;\n\t\t\tif (error.response) {\n\t\t\t\t// The request was made, and the server responded with a status code\n\t\t\t\t//TODO-ColaboError: we should unpack backend error response into ColaboError, that it contains anyway (if sent by colabo server)\n\t\t\t\t//TODO-ColaboError: we can then check its `EErrorOrigin` and behave accordingly\n\t\t\t\t//TODO-ColaboError: throwColaboError(created from server-one);\n\t\t\t } else if (error.request) { // The request was made, but no response was received\n\t\t\t\t//TODO-ColaboError: integrate original error's `stack` (factory?):\n\t\t\t\tthrowColaboError(error.message, EErrorOrigin.SYSTEM, EColaboErrorKind.REQUEST_BAD );\n\t\t\t } else {\n\t\t\t\t// Something happened in setting up the request that triggered an Error\n\t\t\t\tconsole.error('[ColaboKnAllEdgeNodeService:getById] Error during request setup:',);\n\t\t\t\t//TODO-ColaboError: integrate original error's `stack`:\n\t\t\t\tthrowColaboError( error.message, EErrorOrigin.SYSTEM, EColaboErrorKind.REQUEST_BAD );\n\t\t\t }\n\n\t\t\t// TODO-ColaboError: `handleErrorForObservable` used to manage error by logging it and notifying user. Now we bubble errors to the top. But do we want to do something like that still?\n\t\t\t// TODO-ColaboError: OLD: catchError(this.handleErrorForObservable<KNodeFrontend>(\"ColaboKnAllEdgeNodeService::getById\", undefined))\n\t\t\t//TODO-ColaboError: OLD: return undefined; \n\t\t\tthrow new Error(\"This should never be reached, but throwing just because of TS error in diagnosing unreachable end\");\n\t\t}\n\t\t// OLD - removed:\n\t\t// if (callback) {\n\t\t// \tresult.subscribe((node) => callback(node));\n\t\t// }\n\t}\n\n\tpublic async getVosWithColaboApi(request: IApiRequest): Promise<IKNode[]> {\n\t\trequest.type = KNODE_API_TYPE.INDEX_COLABO_API;\n\t\tconst requestSerialized: string = ColaboApiOperators.serializeApiRequest(request);\n\t\tlet result: IKNode[] = [];\n\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(this.apiUrl + KNODE_API_TYPE.INDEX_COLABO_API + \"/\" + this.defaultAction + \"/\" + requestSerialized + \".json\", request.fields);\n\t\tif(DEBUG) console.log(\"[getVos] url: \", url);\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData) return result;\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKNode>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKNode[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic async updateSingleWithColaboApi(request: IApiRequest): Promise<IKNode> {\n\t\tconst kNodes: IKNode[] = await this.updateWithColaboApi(request);\n\t\tif (!kNodes) throw new Error(\"kNodes is not defined\");\n\t\t// // TODO:EXAMPLE - should this be thrown or just silenced, etc\n\t\tif (kNodes.length <= 0) throw new Error(\"kNodes is empty\");\n\t\treturn kNodes[0];\n\t}\n\n\tpublic async updateWithColaboApi(request: IApiRequest): Promise<IKNode[]> {\n\t\trequest.type = KNODE_API_TYPE.UPDATE_COLABO_API;\n\t\tlet result: IKNode[];\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.UPDATE_COLABO_API + \".json\";\n\t\tif(DEBUG) console.log(\"[updateWithColaboApi] url: \", url);\n\t\tif(DEBUG_VERBOSE) console.log(\"[updateWithColaboApi] request: \", JSON.stringify(request, null, 4));\n\t\tlet mResult: AxiosResponse<ServerData>;\n\t\ttry {\n\t\t\t// update\n\t\t\tmResult = await axios.put<ServerData>(url, request);\n\t\t} catch (error) {\n\t\t\tconsole.error(`${contextReportText}Error updating: ${error}`);\n\t\t\t// TODO:EXAMPLE: here we should expand to have `.cause` added, https://medium.com/with-orus/the-5-commandments-of-clean-error-handling-in-typescript-93a9cbdf1af5\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData.success) {\n\t\t\t\tconsole.error(`Error updating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);\n\t\t\t\treturn Promise.reject<IKNode[]>(serverData);\n\t\t\t}\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKNode>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKNode[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// getVOs(type:string):Observable<KNodeFrontend[]> {\n\t// return this.queryInMapofType(ColaboKnAllEdgeNodeService.mapId,type);\n\t// }\n\n\tasync createSingle(kNode: IKNode): Promise<IKNode> {\n\t\tconst kNodesCreated: IKNode[] = await this.create(kNode);\n\t\tif (!Array.isArray(kNodesCreated) || kNodesCreated.length <= 0) throw new Error(`${contextReportText()} No kNode created`);\n\t\tconst kNodeCreated: IKNode = kNodesCreated[0];\n\t\treturn kNodeCreated;\n\t}\n\n\t/** creates multiple KNodes in a single bulk request */\n\tasync createBulk(kNodes: IKNode[]): Promise<IKNode[]> {\n\t\tif(DEBUG_VERBOSE) console.log(`${contextReportText(this)} bulk creating ${kNodes.length} nodes`);\n\n\t\tconst url: string = this.apiUrl + \"bulk\";\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<IKNode[]> = await axios.post<IKNode[]>(url, kNodes, HTTP_OPTIONS_CONST_JSON);\n\t\t\tconst created: IKNode[] = mResult.data;\n\t\t\tif(DEBUG) console.log(`${contextReportText(this)} bulk created ${created.length} nodes`);\n\t\t\treturn created;\n\t\t} catch (error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\t}\n\n\t/** creates a new Element (VO) */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types\n\tasync create(kNode: IKNode, callback?: Function): Promise<IKNode[]> {\n\t\tif(DEBUG_VERBOSE) console.log(`${contextReportText(this)} creating node: name=${kNode.name}, type=${kNode.type}`);\n\n\t\tlet result: IKNode[];\n\t\tconst request: IApiRequest = {\n\t\t\ttype: KNODE_API_TYPE.CREATE_COLABO_API,\n\t\t\tdata: kNode,\n\t\t};\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, request, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// if(DEBUG) console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData.success) {\n\t\t\t\tthrow new Error(`${contextReportText} Error creating node. [code: ${serverData.error?.kind}] ${serverData.error?.message}`);\n\t\t\t}\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKNode[]>(serverData);\n\n\t\t\t// if(DEBUG) console.log(\"[createPromise::then] kNode: \", JSON.stringify(kNode, null, 4));\n\t\t} catch (error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic async createWithColaboApi(request: IApiRequest): Promise<IKNode[]> {\n\t\trequest.type = KNODE_API_TYPE.CREATE_COLABO_API;\n\t\tlet result: IKNode[];\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.CREATE_COLABO_API + \".json\";\n\t\tif(DEBUG) console.log(\"[getVos] url: \", url);\n\t\tlet mResult: AxiosResponse<ServerData>;\n\t\ttry {\n\t\t\tmResult = await axios.post<ServerData>(url, request);\n\t\t} catch (error) {\n\t\t\tconsole.error(`${contextReportText}Error updating: ${error}`);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif (!serverData.success) {\n\t\t\t\tconsole.error(`Error creating: [code: ${serverData.error?.kind}] ${serverData.error?.message}`);\n\t\t\t\treturn Promise.reject<IKNode[]>(serverData);\n\t\t\t}\n\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKNode[]>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKNode[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] kNode: \", JSON.stringify(kNode, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKNode[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** destroys the Element (VO) with the `_id === id` */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tasync destroy(id: string): Promise<boolean> {\n\t\treturn true;\n\t}\n\n\tpublic async destroyWithColaboApi(request: IApiRequest): Promise<Partial<IKNode[]>> {\n\t\trequest.type = KNODE_API_TYPE.DESTROY_COLABO_API;\n\t\tconst requestSerialized: string = ColaboApiOperators.serializeApiRequest(request);\n\t\tlet result: Partial<IKNode[]>;\n\n\t\tconst url: string = this.apiUrl + KNODE_API_TYPE.DESTROY_COLABO_API + \"/\" + this.defaultAction + \"/\" + requestSerialized + \".json\";\n\t\tif(DEBUG) console.log(\"[getVos] url: \", url);\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(url);\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKNode>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<Partial<IKNode[]>>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// if(DEBUG) console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<Partial<IKNode[]>>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** gets Elements (VOs) to populate the list */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tgetVOs(type?: string): Observable<IEntity[] | undefined> {\n\t\treturn of([]);\n\t}\n}\n\n//TODO: NG2: migrate here the remaining methods from the old NG1 JS NodeService\n", "const DEBUG: boolean = false;\nconst DEBUG_VERBOSE: boolean = false;\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Observable, of } from \"rxjs\";\nimport { catchError, map, tap } from \"rxjs/operators\";\n\nimport { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient } from \"@colabo-headless/i-core\";\n\nimport axios, { AxiosResponse } from \"axios\";\n\n// import { Injectable } from \"@angular/core\";\n// import { HttpClient } from \"@angular/common/http\";\n\n// removed due to problem with introducing circular dependency\n// Circular dependency detected:\n// ../../puzzles/headless/core-frontend-vanilla/index.ts -> ../../puzzles/headless/core-frontend-vanilla/angular/common/http/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/index.ts -> ../../../isomorphic/puzzles/knalledge/core-services/lib/kContainer-service.ts -> ../../puzzles/headless/core-frontend-vanilla/index.ts\n// import { MODULE_NAME as HEADLESS_MODULE_NAME } from \"@colabo-headless/i-core\";\n\n// used for debugging, to show which of few headless modules the `@colabo-headless/i-core` got resolved into\n// removed due to problem with introducing circular dependency\n// if(DEBUG) console.log(\"[ColaboKnAllEdgeNodeServiceExtended] (@colabo-headless/i-core)-MODULE_NAME: \", HEADLESS_MODULE_NAME);\n\nif(DEBUG) console.log(\"[ColaboKnAllEdgeNodeServiceExtended] Injectable: \", Injectable);\nif(DEBUG) console.log(\"[ColaboKnAllEdgeNodeServiceExtended] HttpClient: \", HttpClient);\n\nimport { ServerData, VOFrontend, KNodeFrontend } from \"@colabo-knalledge/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\nimport { ColaboKnAllEdgeNodeService } from \"./kNode-service\";\n\nimport { rethrowColaboError } from \"@colabo-utils/i-notifications\";\n\nimport * as config from \"@colabo-utils/i-config\";\n\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nimport { KNODE_API_TYPE, IKNode, ColaboApiOperators } from \"@colabo-knalledge/i-core\";\n\n@Injectable()\nexport class ColaboKnAllEdgeNodeServiceExtended extends ColaboKnAllEdgeNodeService {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knalledgeMapQueue: any = null;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knAllEdgeRealTimeService: any = null;\n\n\t// eslint-disable-next-line @typescript-eslint/no-inferrable-types\n\tprotected static get mapId(): string {\n\t\treturn config.GetString(\"mapId\");\n\t}\n\tstatic UPDATE_NODE_NAME_FINAL: string = \"UPDATE_NODE_NAME_FINAL\";\n\tstatic UPDATE_NODE_NAME: string = \"UPDATE_NODE_NAME\";\n\t// protected http:HttpClient = null;\n\t// protected utilsNotificationService: UtilsNotificationService;\n\n\tconstructor(http: HttpClient, utilsNotificationService: UtilsNotificationService) {\n\t\tsuper(http, utilsNotificationService);\n\t\tif(DEBUG) console.log(\"[ColaboKnAllEdgeNodeServiceExtended:constructor] constructed\");\n\t}\n\n\tasync queryByIds(ids: string[], fields?: string, callback?: Function): Promise<KNodeFrontend[]> {\n\t\tif(DEBUG) console.log(\"queryByIds\", ids);\n\t\tconst idsStr: string = ids.join(\",\");\n\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(this.apiUrl + KNODE_API_TYPE.INDEX_ID_IN + \"/\" + this.defaultAction + \"/\" + idsStr + \".json\", fields);\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: KNodeFrontend[] = CFServiceIsomorphic.processVOs(serverData, KNodeFrontend);\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\t}\n\n\t/**\n\t * 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\n\t * Creates the provided node on the server and returns its server-updated appearance\n\t * @param {KNodeFrontend} kNode the pre-populated node to be created on the server\n\t * @param {function} callback Function to be called when the node is created\n\t * @returns {Observable<KNodeFrontend>} the created node (now with the id and other specific data allocated to it by server, so the caller should fill the original node with it)\n\t @example http://localhost:8001/knodes/in_map/default/579811d88e12abfa556f6b59.json\n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\t// async create(kNode: KNodeFrontend, callback?: Function): Promise<KNodeFrontend> {\n\t// \tif(DEBUG) console.log(`[ColaboKnAllEdgeNodeServiceExtended.create] kNode: ${JSON.stringify(kNode, null, 4)}`);\n\n\t// \t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t// \tlet kNodeForServer: any;\n\t// \tif (kNode.toServerCopy) kNodeForServer = kNode.toServerCopy();\n\t// \telse kNodeForServer = kNode;\n\n\t// \t/*\n\t// \tTODO:NG2: in the line\n\t// \t `result = this.http.post<KNode>(this.apiUrl, kNodeForServer, HTTP_OPTIONS_CONST_JSON)`\n\t// \twe had to replace Generic type setting <KNode> with <ServerData> because it defines the return value\n\t// \t(and probably the posted value), because server returns the `ServerData` object\n\t// \t*/\n\n\t// \ttry {\n\t// \t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(this.apiUrl, kNodeForServer, HTTP_OPTIONS_CONST_JSON);\n\t// \t\tconst serverData: ServerData = mResult.data;\n\t// \t\tconst result: KNodeFrontend = this.extractVO<KNodeFrontend>(serverData, KNodeFrontend);\n\t// \t\tif (callback) {\n\t// \t\t\tcallback(result);\n\t// \t\t}\n\t// \t\treturn result;\n\t// \t} catch(error) {\n\t// \t\trethrowColaboError(error);\n\t// \t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t// \t}\n\n\t// \t/* TODO:NG2 : remain of the NG1 Promise code to be integrated:\n\t// \t\tlet node = this.createPlain({\n\t// \t\t\t//actionType:'default'\n\t// \t\t\t}, kNodeForServer, function(nodeFromServer){\n\t// \t\t\tkNode.$resolved = node.$resolved;\n\t// \t\t\tkNode.overrideFromServer(nodeFromServer);\n\t// \t\t\tif(callback) callback(kNode);\n\t// \t\t});\n\n\t// \t\t//createPlain manages promises for its returning value, in our case 'node', so we need to set its promise to the value we return\n\t// \t\tkNode.$promise = node.$promise;\n\t// \t\tkNode.$resolved = node.$resolved;\n\n\t// \t\tif(node.$resolved){// for the case promise was resolved immediatelly (in synchonous manner) instead synchronously\n\t// \t\t\tkNode.overrideFromServer(node);\n\t// \t\t}\n // */\n\t// \t// }\n\t// \t//we return this value to caller as a dirty one, and then set its value to nodeFromServer when upper callback is called\n\t// }\n\n\t/**\n\t * Deletes the KNode from the server\n\t * In server's response, the ServerData.data is equal to the _id of the deleted VO. ServerData.data will be equal to null, if there is no data we intended to delete. In both cases `ServerData.success` will be eq `true`\n\t * @param {string} id id of the node to be deleted\n\t * @param {function} callback Function to be called when the node is deleted\n\t * @example URL:http://localhost:8001/knodes/one/default/5a156965d0b7970f365e1a4b.json\n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\tasync destroy(id: string, callback?: Function): Promise<boolean> {\n\t\t//TODO:NG2 fix usage of this function to expect boolean\n\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(this.apiUrl + \"one/\" + this.defaultAction + \"/\" + id, HTTP_OPTIONS_CONST_JSON);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: boolean = serverData.success;\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\t/* TODO:NG2\n if(this.knAllEdgeRealTimeService){ // realtime distribution\n //\n\t\t\t// let change = new puzzles.changes.Change();\n\t\t\t// change.value = null;\n\t\t\t// change.valueBeforeChange = null; //TODO\n\t\t\t// change.reference = id;\n\t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n\t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeDeletedEventName;\n\t\t\t// // change.action = null;\n\t\t\t// change.domain = puzzles.changes.Domain.NODE;\n\t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n\t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n //\n\t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeDeletedEventName, change);//{'_id':id});\n\t\t}*/\n\t}\n\n\t\t/**\n\t * Updates the provided node on the server and returns its server-updated appearance\n\t * @param {KNodeFrontend} kNode the pre-populated node to update the content of the existing node on the server\n\t * @param {string} actionType type of the update action (e.g. UPDATE_NODE_NAME_FINAL, UPDATE_NODE_NAME)\n\t * @param {any} patch if we provide null here, the `kNode` param is used, but if we provide here an object, it will be patched 'over' the existing node on the server\n\t * @param {function} callback Function to be called when the node is updated\n\t * @returns {Observable<KNodeFrontend>} the updated node (now with some specific data updated by the server, so the caller should fill the original node with it)\n\t @example URLs: http://localhost:8001/knodes/one/UPDATE_NODE_NAME/5a156935d0b7970f365e1a42.json\n\t http://localhost:8001/knodes/one/UPDATE_NODE_NAME_FINAL/5a156935d0b7970f365e1a42.json\n\t*/\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n\tasync update(kNode: KNodeFrontend, actionType: string, patch?: any, callback?: Function): Promise<KNodeFrontend | undefined> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n\t\tfunction updateResponse(nodeFromServer: any): void {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t\tconst responseTime = new Date();\n\t\t\t/* TODO:NG2:\n\n\t\t\t!! IMPORTANT: this method contains a LOT OF COMMENTED OLD CODE that will be migrated to the new version. You can avoid it in your usage for now\n\n\t\t\t//if(DEBUG) console.log(\"UPDATE: responseTime - requestTime:\", (responseTime - requestTime));\n\t\t\tChangeService.logRequestResponseTiming(responseTime - requestTime);\n\t\t\t// realtime distribution\n\t\t\tif(this.nAllEdgeRealTimeService){\n\n\t\t\t let change = new puzzles.changes.Change();\n\t\t\t change.value = kNodeForServer;\n\t\t\t change.valueBeforeChange = null; //TODO\n\t\t\t change.reference = nodeFromServer._id;\n\t\t\t change.type = puzzles.changes.ChangeType.STRUCTURAL;\n\t\t\t change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeUpdatedEventName;\n\t\t\t change.action = actionType;\n\t\t\t change.domain = puzzles.changes.Domain.NODE;\n\t\t\t change.visibility = puzzles.changes.ChangeVisibility.ALL;\n\t\t\t change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n\n\t\t\t // let emitObject = {\n\t\t\t // \tid: nodeFromServer._id,\n\t\t\t // \tactionType: actionType,\n\t\t\t // \tdata: nodeFromServer,\n\t\t\t // \tactionTime: nodeFromServer.updatedAt\n\t\t\t // }\n\t\t\t KnAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeUpdatedEventName, change);\n\t\t\t}\n\t\t\tif(callback){callback(nodeFromServer);}\n\t\t\t*/\n\t\t}\n\n\t\tlet result: KNodeFrontend | undefined;\n\t\tconst id = kNode._id;\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst kNodeForServer: any = patch ? patch : kNode.toServerCopy();\n\t\tactionType = actionType !== null ? actionType : ColaboKnAllEdgeNodeServiceExtended.UPDATE_NODE_NAME_FINAL;\n\t\t//if(DEBUG) console.log(\"ColaboKnAllEdgeNodeServiceExtended.update\");\n\n\t\tif (kNode.state == VOFrontend.STATE_LOCAL) {\n\t\t\t//TODO: fix it by going through queue\n\t\t\twindow.alert(`Please, wait while the entity '${kNode.name}' is being saved, before updating it`);\n\t\t\t//TODO: we should move this UI code out of the service logics\n\t\t\tresult = undefined;\n\t\t\treturn result;\n\t\t} else {\n\t\t\t/*\n\t\t\tTODO:NG2: it was: if(Plugins.puzzles.knalledgeMap.config.services.QUEUE && false)\n\n \t\t\tKnalledgeMapQueue.execute({data: kNode, patch: patch, callback:callback, resource_type:resource.RESOURCE_TYPE, method: \"update\"}); //TODO: support 'patch' in Queue\n \t\t\t//updatePlain: {method:'PUT', params:{type:'one', actionType:knalledge.KNode.UPDATE_TYPE_ALL, searchParam:''},\n \t\t\treturn this.updatePlain({searchParam:id, type:'one', actionType:actionType}, kNodeForServer, function(nodeFromServer){\n \t\t\t\t// realtime distribution\n \t\t\t\tif(this.knAllEdgeRealTimeService){\n\n \t\t\t\t\t// let change = new change.Change();\n \t\t\t\t\t// change.value = nodeFromServer;\n \t\t\t\t\t// change.valueBeforeChange = nodeFromServer;\n \t\t\t\t\t// change.reference = nodeFromServer._id;\n \t\t\t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n \t\t\t\t\t// change.action = actionType;\n \t\t\t\t\t// change.domain = puzzles.changes.Domain.NODE;\n \t\t\t\t\t// //TODO:\n \t\t\t\t\t// // change.mapId = null;\n \t\t\t\t\t// // change.iAmId = null;\n \t\t\t\t\t// change.visibility = ChangeVisibility.ALL;\n \t\t\t\t\t// change.phase = ChangePhase.UNDISPLAYED;\n\n \t\t\t\t\tlet emitObject = {\n \t\t\t\t\t\tid: nodeFromServer._id,\n \t\t\t\t\t\tactionType: actionType,\n \t\t\t\t\t\tdata: nodeFromServer,\n \t\t\t\t\t\tactionTime: nodeFromServer.updatedAt\n \t\t\t\t\t}\n \t\t\t\t\tKnAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeNodeUpdatedEventName, emitObject);\n \t\t\t\t\t// let change = new\n \t\t\t\t\t// GlobalEmittersArrayService.get(Plugins.puzzles.knalledgeMap.config.services.structuralChangeEventName).broadcast('KnalledgeMapVOsService', {'change_typ':changes,'event':eventName});\n \t\t\t\t}\n \t\t\t\tif(callback){callback(nodeFromServer);}\n \t\t\t});\n\n\t\t\t}\n\t\t\telse{\n\n\t\t\tlet requestTime:Date = new Date();\n \t\t*/\n\t\t\ttry {\n\t\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.put<ServerData>(this.apiUrl + \"one/\" + actionType + \"/\" + id, kNodeForServer, HTTP_OPTIONS_CONST_JSON);\n\t\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t\tconst result: KNodeFrontend = this.extractVO<KNodeFrontend>(serverData, KNodeFrontend);\n\t\t\t\tif (callback) {\n\t\t\t\t\tcallback(result);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} catch(error) {\n\t\t\t\trethrowColaboError(error);\n\t\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t\t}\n\t\t\t/* TODO:NG2:\n\t\t\t// function(error){\n\t\t\t\t\t// \t//console.error('NODE: UPDATE: ',error,' for ',id,actionType,kNodeForServer);\n\t\t\t\t\t// \tChangeService.logActionLost({'type:': 'NODE: UPDATE', 'error': error, 'id':id, 'actionType' : actionType, 'kNodeForServer' : kNodeForServer});\n\t\t\t\t\t// }\n\t\t\t\t// );\n\t\t\t}\n \t\t*/\n\t\t}\n\t}\n\n\t// getVOs(type: string): Observable<KNodeFrontend[] | undefined> {\n\t// \treturn this.queryInMapofType(ColaboKnAllEdgeNodeServiceExtended.mapId, type);\n\t// }\n\t// getVOsWithPromise(type: string): Promise<IKNode[]> {\n\t// \treturn this.getVOs(type).toPromise() as Promise<IKNode[]>;\n\t// }\n\n// \t/**\n// \t * Gets from the server all the KN Nodes that are contained in the map\n// \t * @param {string} id id of the map\n// \t * @param {function} callback Function to be called when the nodes are retrieved\n// \t * @returns {Observable<KNodeFrontend[]>} array of the nodes\n// \t @example http://localhost:8001/knodes/in_map/default/579811d88e12abfa556f6b59.json\n// \t */\n// \tqueryInMap(mapId: string, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map/\" + this.defaultAction + \"/\" + mapId).pipe(\n// \t\t\tmap((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"ColaboKnAllEdgeNodeServiceExtended::queryInMap\", undefined))\n// \t\t);\n// \t\t// I get 2 errors for the above lines:\n// \t\t// 1st error:\n// \t\t/*\n// \t\t../../../isomorphic/puzzles/knalledge/core-services/lib/kNode-service-extended.ts:89:9 - error TS2739: Type 'Observable<unknown>' is missing the following properties from type 'Observable<KNodeFrontend[]>': _isScalar, _trySubscribe, _subscribe\n\n// 89 const result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map/\" + this.defaultAction + \"/\" + mapId).pipe(\n// \t*/\n// \t\t//that \"solve with replacing the last `);`\n// \t\t//with `) as unknown as (Observable<KNodeFrontend[] | undefined>);` to enforce return type\n// \t\t// ...\n// \t\t// but I still cannot solve the 2nd error:\n// \t\t/*\n// \t\t../../../isomorphic/puzzles/knalledge/core-services/lib/kNode-service-extended.ts:90:4 - error TS2345: Argument of type 'OperatorFunction<ServerData, KNodeFrontend[]>' is not assignable to parameter of type 'OperatorFunction<ServerData, unknown>'.\n// Types of parameters 'source' and 'source' are incompatible.\n// Type 'Observable<ServerData>' is missing the following properties from type 'Observable<ServerData>': _isScalar, _trySubscribe, _subscribe\n\n// 90 map((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// */\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t/**\n// \t * Gets from the server all the KN Nodes that are contained in the map\n// \t * @param {string} mapId id of the map\n// \t * @param {function} callback Function to be called when the nodes are retrieved\n// \t * @returns {Observable<KNodeFrontend[]>} array of the nodes\n// \t @example http://localhost:8001/knodes/in_map/default/579811d88e12abfa556f6b59.json\n// \t */\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tqueryInMapofType(mapId: string, type: string, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tconst url: string = this.apiUrl + KNODE_API_TYPE.INDEX_IN_MAP_OF_TYPE + \"/\" + this.defaultAction + \"/\" + mapId + \"/\" + type + \".json\";\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(url).pipe(\n// \t\t\tmap((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"ColaboKnAllEdgeNodeServiceExtended::queryInMapofType\", undefined))\n// \t\t);\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types, @typescript-eslint/explicit-module-boundary-types\n// \tqueryInMapofTypeAndContentData(mapId: string, type: string, contentDataPath: string, data: any, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tif(DEBUG) console.log(\"queryInMapofTypeAndContentData\", mapId, type, contentDataPath, data);\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(\n// \t\t\tthis.apiUrl + \"in_map_of_type_and_content_data/\" + this.defaultAction + \"/\" + mapId + \"/\" + type + \"/\" + contentDataPath + \"/\" + data + \".json\"\n// \t\t ).pipe(\n// \t\t\tmap((nodesFromServer: ServerData) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable<KNodeFrontend[] | undefined>(\"ColaboKnAllEdgeNodeServiceExtended::queryInMapofTypeAndContentData\", undefined))\n// \t\t );\n\t\t \n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \tqueryInMapofTypeForUser(mapId: string, type: string, iAmid: string, callback?: Function): Observable<KNodeFrontend[] | undefined> {\n// \t\tif(DEBUG) console.log(\"queryInMapofTypeForUser\", mapId, type, iAmid);\n// \t\tconst result: Observable<KNodeFrontend[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map_of_type_for_user/\" + this.defaultAction + \"/\" + mapId + \"/\" + type + \"/\" + iAmid + \".json\").pipe(\n// \t\t\tmap((nodesFromServer) => CFServiceIsomorphic.processVOs(nodesFromServer, KNodeFrontend)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"ColaboKnAllEdgeNodeServiceExtended::queryInMap\", undefined))\n// \t\t);\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((nodes) => callback(nodes));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tdestroyByTypeInMap(type: string, mapId: string, callback?: Function): Observable<boolean> {\n// \t\t//TODO:NG2 fix usage of this function to expect boolean\n// \t\tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-in-map/\" + this.defaultAction + \"/\" + type + \"/\" + mapId + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t\ttap((_) => if(DEBUG) console.log(`deleted nodes type=${type} and mapId=${mapId}`)),\n// \t\t\tmap((serverData: ServerData) => serverData.success),\n// \t\t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeInMap\"))\n// \t\t);\n\n// \t\t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t\t// let change = new puzzles.changes.Change();\n// \t\t\t// change.value = null;\n// \t\t\t// change.valueBeforeChange = null; //TODO\n// \t\t\t// change.reference = id;\n// \t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t\t// // change.action = null;\n// \t\t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t\t}*/\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((success) => callback(success));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \tdestroyByUser(iAmid: string): Observable<boolean> {\n// \t\t//TODO:NG2 fix usage of this function to expect boolean\n// \t\tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-user/\" + this.defaultAction + \"/\" + iAmid + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t\ttap((_: ServerData) => if(DEBUG) console.log(`deleted nodes: iAmid=${iAmid}`)),\n// \t\t\tmap((serverData: ServerData) => serverData.success),\n// \t\t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByUser\"))\n// \t\t);\n\n// \t\t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t\t// let change = new puzzles.changes.Change();\n// \t\t\t// change.value = null;\n// \t\t\t// change.valueBeforeChange = null; //TODO\n// \t\t\t// change.reference = id;\n// \t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t\t// // change.action = null;\n// \t\t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t\t}*/\n// \t\treturn result;\n// \t}\n\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tdestroyByTypeByUser(type: string, iAmid: string, callback?: Function): Observable<boolean> {\n// \t\t//TODO:NG2 fix usage of this function to expect boolean\n// \t\tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-n-user/\" + this.defaultAction + \"/\" + type + \"/\" + iAmid + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t\ttap((_) => if(DEBUG) console.log(`deleted nodes type=${type} and iAmid=${iAmid}`)),\n// \t\t\tmap((serverData: ServerData) => serverData.success),\n// \t\t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeByUser\"))\n// \t\t);\n\n// \t\t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t\t// let change = new puzzles.changes.Change();\n// \t\t\t// change.value = null;\n// \t\t\t// change.valueBeforeChange = null; //TODO\n// \t\t\t// change.reference = id;\n// \t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t\t// // change.action = null;\n// \t\t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t\t}*/\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((success) => callback(success));\n// \t\t}\n// \t\treturn result;\n// \t}\n}\n\n//TODO: NG2: migrate here the remaining methods from the old NG1 JS NodeService\n", "import { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient, HttpHandler } from \"@colabo-headless/i-core\";\n\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\n\nimport { ServerData, IApiRequest, IKEdge, ColaboApiOperators, KEDGE_API_TYPE, KEDGE_API_PARAMS, contextReportText } from \"@colabo-knalledge/i-core\";\nimport { ColaboApiCoreService } from \"./colabo-api-core.service\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\n// TODO: [#699](https://github.com/Cha-OS/colabo/issues/699)\nimport axios, { AxiosResponse } from \"axios\";\nimport { chalk } from \"@colabo-headless/i-core\";\nimport { currentContext, CONTEXTS } from \"@colabo-headless/i-core\";\nimport { NotificationMsg, NotificationMsgType } from \"@colabo-utils/i-notifications\";\n\nconst DEBUG: boolean = false;\nconst DEBUG_VERBOSE: boolean = false;\n\n@Injectable()\nexport class KnalledgeEdgeService extends CFServiceIsomorphic {\n\t//http://api.colabo.space/kedges/\n\t// \"http://127.0.0.1:888/kedges/\";\n\tprotected apiUrl: string;\n\tprotected defaultAction: string = \"default\";\n\n\tconstructor(\n\t\tprotected http: HttpClient, //@Inject('ENV') private ENV\n\t\tutilsNotificationService: UtilsNotificationService,\n\t) {\n\t\tsuper(utilsNotificationService);\n\n\t\t// initialize underlying Colabo API layer, like axios interceptors\n\t\tColaboApiCoreService.initialize(\"ColaboKnAllEdgeNodeService\", axios);\n\n\t\t// this is the case when we call it from the headless context\n\t\tif (!this.http) {\n\t\t\t// no DI\n\t\t\tif (currentContext == CONTEXTS.FRONTEND_ANGULAR) {\n\t\t\t\tconst msg: string = \"DI Problem: There is no provider injected for the service `HttpClient`.\";\n\t\t\t\tconsole.error(msg);\n\t\t\t\tif (this.utilsNotificationService) {\n\t\t\t\t\tconst nMsg: NotificationMsg = {\n\t\t\t\t\t\ttitle: \"DI Problem\",\n\t\t\t\t\t\tmsg: msg,\n\t\t\t\t\t\ttype: NotificationMsgType.Error,\n\t\t\t\t\t};\n\t\t\t\t\tthis.utilsNotificationService.addNotification(nMsg);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconsole.log(\"[KnalledgeEdgeService] invited from the isomorphic context. Initializing HttpClient ...\");\n\t\t\t\t// will create a headless HttpClient (based on `Axios` from 'axios-observable')\n\t\t\t\tthis.http = new HttpClient((null as unknown) as HttpHandler);\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(\"[KnalledgeEdgeService] created\");\n\t\tconsole.log(\"[KnalledgeEdgeService] connecting to backend: \", chalk.bold.white(KnalledgeEdgeService.serverAP));\n\n\t\tthis.apiUrl = KnalledgeEdgeService.serverAP + \"/\" + KEDGE_API_PARAMS.API_PATH + \"/\";\n\t\tconsole.log(\"[KnalledgeEdgeService] REST API URL: \", chalk.bold.white(this.apiUrl));\n\t}\n\n\tpublic async getVosWithColaboApi(request: IApiRequest): Promise<IKEdge[]> {\n\t\trequest.type = KEDGE_API_TYPE.INDEX_COLABO_API;\n\t\tconsole.log(`[KnalledgeEdgeService.getVosWithColaboApi] request: ${JSON.stringify(request, null, 4)}`);\n\t\tconst requestSerialized: string = ColaboApiOperators.serializeApiRequest(request);\n\t\tlet result: IKEdge[];\n\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(this.apiUrl + KEDGE_API_TYPE.INDEX_COLABO_API + \"/\" + requestSerialized, request.fields);\n\t\tconsole.log(\"[getVos] url: \", url);\n\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\ttry {\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[getVosWithColaboApi] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tresult = ColaboApiOperators.extractVosFromServerData<IKEdge>(serverData);\n\t\t\tif (!result) {\n\t\t\t\treturn Promise.reject<IKEdge[]>(new Error(\"Error with extracting VOs from serverData\"));\n\t\t\t}\n\n\t\t\t// console.log(\"[getVosWithColaboApi] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** creates a new Element (VO) */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types\n\tasync createWithPromise(kEdge: IKEdge, callback?: Function): Promise<IKEdge[]> {\n\t\tif(DEBUG_VERBOSE) console.log(`${contextReportText(this)} creating edge: sourceId=${kEdge.sourceId}, targetId=${kEdge.targetId}, type=${kEdge.type}`);\n\n\t\tlet result: IKEdge[];\n\n\t\tconst request: IApiRequest = {\n\t\t\ttype: KEDGE_API_TYPE.CREATE_COLABO_API,\n\t\t\tdata: kEdge,\n\t\t}\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, request, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif(!serverData.success){\n\t\t\t\tthrow new Error(`${contextReportText} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);\n\t\t\t}\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKEdge[]>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/** creates a new Element (VO) */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/ban-types\n\tasync createWithRequest(request: IApiRequest): Promise<IKEdge[]> {\n\t\tif(DEBUG) console.log(`${contextReportText(this)} request type=${request.type}, activity=${request.activity ?? \"default\"}`);\n\n\t\tlet result: IKEdge[];\n\n\t\tconst url: string = this.apiUrl;\n\t\t// Make a request for a user with a given ID\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(url, request, HTTP_OPTIONS_CONST_JSON);\n\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t// console.log(\"[createPromise::then] serverData: \", JSON.stringify(serverData, null, 4));\n\n\t\t\tif(!serverData.success){\n\t\t\t\tthrow new Error(`${contextReportText} Error creating edge. code: ${serverData.error?.kind}, error msg: ${serverData.error?.message}`);\n\t\t\t}\n\t\t\tresult = ColaboApiOperators.extractVoFromServerData<IKEdge[]>(serverData);\n\n\t\t\t// console.log(\"[createPromise::then] kEdge: \", JSON.stringify(kEdge, null, 4));\n\t\t} catch (error) {\n\t\t\t// TODO: do it more properly\n\t\t\tconsole.error(error);\n\t\t\treturn Promise.reject<IKEdge[]>(error);\n\t\t}\n\n\t\treturn result;\n\t}\n}\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { Injectable } from \"@colabo-headless/i-core\";\nimport { HttpClient } from \"@colabo-headless/i-core\";\nimport { UtilsNotificationService } from \"@colabo-headless/i-core\";\nimport { catchError, map, tap } from \"rxjs/operators\";\nimport { Observable } from \"rxjs\";\n\nimport { KEdgeFrontend as KEdge, ColaboApiOperators } from \"@colabo-knalledge/i-core\";\nimport { ServerData } from \"@colabo-knalledge/i-core\";\nimport { CFServiceIsomorphic, HTTP_OPTIONS_CONST_JSON } from \"./cf.service.isomorphic\";\n\nimport { KnalledgeEdgeService } from \"./kEdge-service\";\n\nimport axios, { AxiosResponse } from \"axios\";\n\nimport { rethrowColaboError } from \"@colabo-utils/i-notifications\";\n\n@Injectable()\nexport class KnalledgeEdgeServiceExtended extends KnalledgeEdgeService {\n\t//http://api.colabo.space/kedges/\n\t// \"http://127.0.0.1:888/kedges/\";\n\t//private defaultAction:string = 'default'; not used here - only for nodes is used\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knalledgeMapQueue: any = null;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate knAllEdgeRealTimeService: any = null;\n\n\tconstructor(\n\t\thttp: HttpClient, //@Inject('ENV') private ENV\n\t\tutilsNotificationService: UtilsNotificationService,\n\t) {\n\t\tsuper(http, utilsNotificationService);\n\t\tconsole.log(\"KnalledgeEdgeServiceExtended:: constructor\");\n\t}\n\n\t/**\n\t * Gets an KN Edge from the server by its id\n\t * @param {string} id id of the edge\n\t * @param {function} callback Function to be called when the edge is retrieved\n\t * @returns {Observable<KEdge>} retrieved edge\n\t */\n\t// eslint-disable-next-line @typescript-eslint/ban-types\n\tasync getById(id: string, fields?: string, callback?: Function): Promise<KEdge> {\n\t\tconsole.log(\"getById(\" + id + \")\");\n\n\t\tconst url: string = ColaboApiOperators.appendFieldsParam(this.apiUrl + \"one/\" + id, fields);\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.get<ServerData>(url);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: KEdge = this.extractVO<KEdge>(serverData, KEdge);\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\t}\n\n\t/**\n * Creates the provided edge on the server and returns its server-updated appearance\n * @param {KEdge} kEdge the pre-populated edge to be created on the server\n * @param {function} callback Function to be called when the edge is created\n * @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)\n @example http://localhost:8001/kedges/in_map/default/579811d88e12abfa556f6b59.json\n */\n\tasync create(kEdge: KEdge, callback?: Function): Promise<KEdge> {\n\t\t//console.log(\"KnalledgeEdgeService.create\");\n\t\tlet result: Observable<KEdge>;\n\n\t\t// eslint-disable-next-line no-constant-condition\n\t\tif (false) {\n\t\t\t// TODO:NG2: if(Plugins.puzzles.knalledgeMap.config.services.QUEUE)\n\t\t\t/*\n kEdge.$promise = null;\n\t\t\tkEdge.$resolved = false;\n\n\t\t\tkEdge.$promise = $q(function(resolve, reject) {\n\t\t\t\tKnalledgeMapQueue.execute({data: kEdge, callback:callback, resource_type:resource.RESOURCE_TYPE, method: \"create\", processing: {\"RESOLVE\":resolve, \"REJECT\":reject, \"EXECUTE\": resource.execute, \"CHECK\": resource.check}});\n\t\t\t});\n */\n\t\t} else {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tif(!kEdge.toServerCopy) {\n\t\t\t\tthrow new Error(\"kEdge.toServerCopy is not defined\");\n\t\t\t}\n\t\t\tconst kEdgeForServer: any = kEdge.toServerCopy();\n\n\t\t\t/*\n\t\t\tTODO:NG2: in the line\n\t\t\t\t`result = this.http.post<KEdge>(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON)`\n\t\t\twe had to replace Generic type string <KEdge> with <ServerData> because it defines the return value\n\t\t\t(and probably the posted value), because server returns the `ServerData` object\n\t\t\t*/\n\n\t\t\ttry {\n\t\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.post<ServerData>(this.apiUrl, kEdgeForServer, HTTP_OPTIONS_CONST_JSON);\n\t\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\t\tconst result: KEdge = this.extractVO<KEdge>(serverData, KEdge);\n\t\t\t\tif (callback) {\n\t\t\t\t\tcallback(result);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} catch(error) {\n\t\t\t\trethrowColaboError(error);\n\t\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t\t}\n\n\t\t\t\t\t/* TODO:NG2 : remain of the NG1 Promise code to be integrated:\n\t\t\t\t\tlet edge = this.createPlain({\n\t\t\t\t\t\t//actionType:'default'\n\t\t\t}, kEdgeForServer, function(edgeFromServer){\n\t\t\t\t\t\tkEdge.$resolved = edge.$resolved;\n\t\t\t\t\t\tkEdge.overrideFromServer(edgeFromServer);\n\t\t\t\t\t\tif(callback) callback(kEdge);\n\t\t\t\t\t});\n\n\t\t\t\t\t//createPlain manages promises for its returning value, in our case 'edge', so we need to set its promise to the value we return\n\t\t\t\t\tkEdge.$promise = edge.$promise;\n\t\t\t\t\tkEdge.$resolved = edge.$resolved;\n\n\t\t\t\t\tif(edge.$resolved){// for the case promise was resolved immediately (in synchronous manner) instead synchronously\n\t\t\t\t\t\tkEdge.overrideFromServer(edge);\n\t\t\t\t\t}\n\t\t\t*/\n\t\t}\n\t}\n\n\t/**\n\t * Deletes the KEdge from the server\n\t * In server's response, the ServerData.data is equal to the _id of the deleted VO. ServerData.data will be equal to null, if there is no data we intended to delete. In both cases `ServerData.success` will be eq `true`\n\t * @param {string} id id of the edge to be deleted\n\t * @param {function} callback Function to be called when the edge is deleted\n\t * @example URL:http://localhost:8001/kedges/one/default/5a156965d0b7970f365e1a4b.json\n\t */\n\tasync destroy(id: string, callback?: Function): Promise<boolean> {\n\t\t//TODO:NG2 fix usage of this function to expect boolean\n\n\t\ttry {\n\t\t\tconst mResult: AxiosResponse<ServerData> = await axios.delete<ServerData>(this.apiUrl + \"one/\" + id, HTTP_OPTIONS_CONST_JSON);\n\t\t\tconst serverData: ServerData = mResult.data;\n\t\t\tconst result: boolean = serverData.success;\n\t\t\tif (callback) {\n\t\t\t\tcallback(result);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch(error) {\n\t\t\trethrowColaboError(error);\n\t\t\tthrow new Error(\"This should never be reached, but throwing because TS misses seeing `rethrowColaboError` as `never`\");\n\t\t}\n\n\t\t/* TODO:NG2\n\t\tif(this.knAllEdgeRealTimeService){ // realtime distribution\n\t\t//\n\t\t\t\t// let change = new puzzles.changes.Change();\n\t\t\t\t// change.value = null;\n\t\t\t\t// change.valueBeforeChange = null; //TODO\n\t\t\t\t// change.reference = id;\n\t\t\t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n\t\t\t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n\t\t\t\t// // change.action = null;\n\t\t\t\t// change.domain = puzzles.changes.Domain.NODE;\n\t\t\t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n\t\t\t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n\t\t//\n\t\t\t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n\t\t\t}*/\n\t}\n\n// \t/*\n// TODO:\n// When needed, we could develop these functions that are already supported on backend:\n\n// //gets all edges between 2 specific nodes:\n// queryBetween(sourceId:string, targetId:string, callback?:Function)\n// {\n// // return this.queryPlain({ searchParam:id, type:'between' }, callback);\n// }\n\n// //gets all edges connected to the specific node (with the provided id) (both those edges whose it's source node and those whose this is a target node)\n// // @example URL: URL:http://localhost:8001/kedges/connected/5a156965d0b7970f365e1a4b.json\n// queryConnected(id:string, callback?:Function)\n// {\n// // return this.queryPlain({ searchParam:id, type:'connected' }, callback);\n// }\n\n// //destroys all the edges connected to the specific node\n// //destroyConnected(id:string)\n// {\n\n// }\n// */\n\n// \t/**\n// * Gets from the server all the KN Edges that are contained in the map\n// * @param {string} id id of the map\n// * @param {function} callback Function to be called when the edges are retrieved\n// * @returns {Observable<KEdge[]>} array of the edges\n// @example URL: http://localhost:8001/kedges/in_map/579811d88e12abfa556f6b59.json\n// */\n// \t// eslint-disable-next-line @typescript-eslint/ban-types\n// \tqueryInMap(id: string, callback?: Function): Observable<KEdge[] | undefined> {\n// \t\tconst result: Observable<KEdge[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"in_map/\" + id).pipe(\n// \t\t\tmap((edgesS: ServerData) => CFServiceIsomorphic.processVOs<KEdge>(edgesS, KEdge)),\n// \t\t\t// map(edgesFromServer => CFServiceIsomorphic.processVOs<KEdge>(edgesFromServer, KEdge)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"KnalledgeEdgeService::queryInMap\", undefined))\n// \t\t);\n\n// \t\tif (callback) {\n// \t\t\tresult.subscribe((edges) => callback(edges));\n// \t\t}\n// \t\treturn result;\n// \t}\n\n// \t/**\n// * UNSUPPORTED TEMPORARILY #551 (https://github.com/Cha-OS/colabo/issues/551)\n// * Gets from the server all the KN Edges that are contained in the map\n// * @param {string} id id of the map\n// * @param {function} callback Function to be called when the edges are retrieved\n// * @returns {Observable<KEdge[]>} array of the edges\n// @example URL: TBD\n// //\n// queryForMapTypeUserWTargetNodes(mapId:string, type:string, iAmid:string=null): Observable<KEdge[]>\n// {\n// var result:Observable<KEdge[]> = this.http.get<ServerData>(this.apiUrl+'for_map_type_user_w_target_nodes/'+mapId+'/'+type+'/'+iAmid+'.json')\n// .pipe(\n// map(edgesFromServer => CFServiceIsomorphic.processVOs(edgesFromServer, KEdge)),\n// catchError(this.handleError('KnalledgeEdgeService::queryForMapTypeUserWTargetNodes', null))\n// );\n// return result;\n// }\n// */\n\n// \t/**\n// * Gets from the server all the KN Edges that are contained in the map\n// * @param {string} id id of the map\n// * @param {function} callback Function to be called when the edges are retrieved\n// * @returns {Observable<KEdge[]>} array of the edges\n// @example URL: TBD\n// */\n// \tqueryForMapTypeUser(mapId: string, type: string, iAmid: string = \"\"): Observable<KEdge[] | undefined> {\n// \t\tconst result: Observable<KEdge[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"for_map_type_user/\" + mapId + \"/\" + type + \"/\" + iAmid + \".json\").pipe(\n// \t\t\tmap((edgesFromServer: ServerData) => CFServiceIsomorphic.processVOs<KEdge>(edgesFromServer, KEdge)),\n// \t\t\tcatchError(this.handleErrorForObservable(\"KnalledgeEdgeService::queryForMapTypeUser\", undefined))\n// \t\t);\n// \t\treturn result;\n// \t}\n\n\t/**\n * Gets from the server all the KN Edges that are contained in the map\n * @param {string} id id of the map\n * @param {function} callback Function to be called when the edges are retrieved\n * @returns {Observable<KEdge[]>} array of the edges\n @example URL: TBD\n */\n\t// queryFromToForType(from: string | null, to: string, type: string = \"\"): Observable<KEdge[] | undefined> {\n\t// \tconst result: Observable<KEdge[] | undefined> = this.http.get<ServerData>(this.apiUrl + \"from_to_for_type/\" + from + \"/\" + to + \"/\" + type + \".json\").pipe(\n\t// \t\tmap((edgesFromServer: ServerData) => CFServiceIsomorphic.processVOs<KEdge>(edgesFromServer, KEdge)),\n\t// \t\tcatchError(this.handleErrorForObservable(\"KnalledgeEdgeService::queryForMapTypeUser\", undefined))\n\t// \t);\n\t// \treturn result;\n\t// }\n\n\n// public destroyInMap(mapid: string, callback?: Function): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"in-map/\" + mapid, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted edges for mapid=${mapid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroy\"))\n// \t);\n\n// \tif (callback) {\n// \t\tresult.subscribe((success) => callback(success));\n// \t}\n// \treturn result;\n// }\n\n// /**\n// * @description BACKEND NOT FINISHED!\n// */\n// private destroyByTypeInMap(type: string, mapId: string): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-in-map/\" + type + \"/\" + mapId + \".json\", HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted nodes type=${type} and mapId=${mapId}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeInMap\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n// \treturn result;\n// }\n\n// destroyByTypeByUser(type: string, iAmid: string, callback?: Function): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-type-n-user/\" + type + \"/\" + iAmid, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted edges type=${type} and iAmid=${iAmid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByTypeByUser\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n\n// \tif (callback) {\n// \t\tresult.subscribe((success) => callback(success));\n// \t}\n// \treturn result;\n// }\n\n// destroyByUser(iAmid: string): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"by-user/\" + iAmid, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\ttap((_) => console.log(`deleted nodes: iAmid=${iAmid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyByUser\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n// \treturn result;\n// }\n\n// destroyEdgesToChild(targetId: string): Observable<boolean> {\n// \t//TODO:NG2 fix usage of this function to expect boolean\n// \tconst result: Observable<boolean> = this.http.delete<ServerData>(this.apiUrl + \"edges-to-child/\" + targetId, HTTP_OPTIONS_CONST_JSON).pipe(\n// \t\t// tap(_ => console.log(`deleted edges type=${type} and iAmid=${iAmid}`)),\n// \t\tmap((serverData) => serverData.success),\n// \t\tcatchError(this.handleErrorForObservable<boolean>(\"destroyEdgeToChild\"))\n// \t);\n\n// \t/* TODO:NG2\n// if(this.knAllEdgeRealTimeService){ // realtime distribution\n// //\n// \t\t// let change = new puzzles.changes.Change();\n// \t\t// change.value = null;\n// \t\t// change.valueBeforeChange = null; //TODO\n// \t\t// change.reference = id;\n// \t\t// change.type = puzzles.changes.ChangeType.STRUCTURAL;\n// \t\t// change.event = Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName;\n// \t\t// // change.action = null;\n// \t\t// change.domain = puzzles.changes.Domain.NODE;\n// \t\t// change.visibility = puzzles.changes.ChangeVisibility.ALL;\n// \t\t// change.phase = puzzles.changes.ChangePhase.UNDISPLAYED;\n// //\n// \t\t// this.knAllEdgeRealTimeService.emit(Plugins.puzzles.knalledgeMap.config.services.KnRealTimeEdgeDeletedEventName, change);//{'_id':id});\n// \t}*/\n// \treturn result;\n// }\n\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,cAAsB;AAU5B,IAAM,QAAiB;AACvB,IAAM,gBAAyB;;;ACTtC,sBAA0B;AAI1B,IAAAA,0BAAiG;AACjG,IAAAC,iBAAqJ;;;ACFrJ,kBAAmB;AAEnB,oBAAyC;AA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmOD;AA1Xa,+BAAN;AAAA,MADN,4BAAW;AAAA,GACC;",
|
|
6
|
+
"names": ["import_i_notifications", "import_i_core", "import_i_core", "import_i_notifications", "DEBUG", "DEBUG", "import_axios", "import_i_core", "import_i_core", "axios", "axios", "import_rxjs", "import_axios", "import_i_notifications", "import_i_core", "import_i_config", "import_i_notifications", "import_i_core", "DEBUG", "DEBUG_VERBOSE", "axios", "puzzleConfig", "import_i_core", "import_axios", "import_i_notifications", "config", "import_i_core", "DEBUG", "DEBUG", "axios", "result", "import_i_core", "import_axios", "import_i_core", "import_i_notifications", "DEBUG", "DEBUG_VERBOSE", "axios", "import_i_core", "import_axios", "import_i_notifications", "axios", "KEdge", "result"]
|
|
7
7
|
}
|