@colabo-flow/sa-flowchestra 0.0.0-stage → 1.0.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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/app.controller.ts", "../../src/app.constants.ts", "../../src/store.provider.ts", "../../src/app.service.ts", "../../src/execution/execution.controller.ts", "../../src/execution/execution.service.ts", "../../src/execution/execution.module.ts", "../../src/app.module.ts", "../../src/main.ts", "../../src/bootstrap.nestjs.ts"],
4
+ "sourcesContent": ["import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common';\nimport { AppService } from './app.service';\nimport { ApiTags } from '@nestjs/swagger';\nimport { RIMA_AGENT_TYPE } from '@colabo-rima/i-aaa';\n\nimport { addSecurityPrefix } from \"@colabo-knalledge/i-core-services\";\nimport { ServerData } from '@colabo-knalledge/i-core';\nimport { EFlowExecutionStatus, IFlowInstance } from '@colabo-flow/i-core';\n@ApiTags('flowchestrator')\n@Controller('flowchestrator')\nexport class AppController {\n\tconstructor(private readonly appService: AppService) {}\n\tprotected accessId: number = 0;\n\tprotected getNextAccessId(): number {\n\t\treturn this.accessId++;\n\t};\n\n\t// http://localhost:8008/api\n\n\t// http://localhost:8008/flowchestrator/hello\n\t@Get(\"hello\")\n\tgetHello(): string {\n\t\treturn this.appService.getHello();\n\t}\n\n\t/**\n\t * Instantiates flow with provided input and flow instance details\n\t * @param body Object containing flowInputSerialized and newFlowInstance\n\t * @returns {string} Flow instance id\n\t * \n\t * @example\n\t * POST http://localhost:8008/flowchestrator/instantiateFlow\n\t * Body:\n\t * {\n\t * \"flowInputSerialized\": \"{\\\"key\\\":\\\"value\\\"}\",\n\t * \"newFlowInstance\": { \"id\": \"123\", \"name\": \"Example Flow Instance\" }\n\t * }\n\t */\n\t@Post(\"flows/:flowId/instances\")\n\tasync instantiateFlow(\n\t\t@Param(\"flowId\") flowId: string,\n\t\t@Body() body: { \n\t\t\tflowInput?: any;\n\t\t\tflowInstancePartial?: Partial<IFlowInstance>;\n\t\t}\n\t): Promise<string> {\n\t\tconst { flowInput, flowInstancePartial } = body;\n\t\tconst result = await this.appService.instantiateFlow(flowId, flowInput, flowInstancePartial);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n\n\t@Delete('flowInstances/:flowInstanceId')\n\t\tasync deleteFlowInstance(@Param('flowInstanceId') flowInstanceId: string): Promise<ServerData> {\n\t\tawait this.appService.deleteFlowInstance(flowInstanceId);\n\t\treturn new ServerData(true, `Flow instance ${flowInstanceId} deleted`, this.getNextAccessId());\n\t}\n\n\t/**\n\t * Sets flow instance status\n\t * @param flowInstanceKnodeId Flow instance knode id\n\t * @param status Flow execution status\n\t * @returns Flow instance as JSON\n\t * \n\t * @example\n\t * http://localhost:8008/flowchestrator/flowInstances/<flowInstanceKnodeId>/status\n\t * @example\n\t * http://localhost:8008/flowchestrator/flowInstances/6808063fa5e47546be531761/status\n\t */\n\t@Patch('flowInstances/:flowInstanceKnodeId/status')\n\tasync setFlowInstanceStatus(\n\t\t@Param('flowInstanceKnodeId') flowInstanceKnodeId: string,\n\t\t@Body('status') status: EFlowExecutionStatus,\n\t): Promise<any> {\n\t\tconst result = await this.appService.setFlowInstanceStatus(flowInstanceKnodeId, status);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n \n\t/**\n\t * Retrieves flow instance from the persistent store and loads it into the flow store.\n\t * @param flowInstanceKnodeId Flow instance knode id\n\t * @returns Flow instance as JSON\n\t * \n\t * @example\n\t * http://localhost:8008/flowchestrator/DepersistFlowInstance/flowInstanceKnodeId/<flowInstanceKnodeId>\n\t * @example\n\t * http://localhost:8008/flowchestrator/DepersistFlowInstance/flowInstanceKnodeId/6808063fa5e47546be531761\n\t */\n\t@Get(\"depersistFlowInstance/flowInstanceKnodeId/:flowInstanceKnodeId\")\n\tasync depersistFlowInstance(@Param(\"flowInstanceKnodeId\") flowInstanceKnodeId: string): Promise<any> {\n\t\treturn await this.appService.depersistFlowInstance(flowInstanceKnodeId);\n\t}\n\n\t/**\n\t * Joins flow instance by creating a new token\n\t * @param flowInstanceKnodeId Flow instance id\n\t * @param placeId Place id within the flow instance where the token is created\n\t * @param whoAmI agent id of the agent (represented as token) who is joining the flow instance\n\t * @param agentType agent type (user, group, service) of the agent (represented as token) who is joining the flow instance\n\t * @returns Token kNode id\n\t *\n\t * @example\n\t * http://localhost:8008/flowchestrator/joinAgentToFlowInstance?flowInstanceKnodeId=<flowInstanceKnodeId>&placeId=<placeId>&whoAmI=<whoAmI>&agentType=<agentType>\n\t * @example\n\t * http://localhost:8008/flowchestrator/joinAgentToFlowInstance?flowInstanceKnodeId=680a493284e86a6210ddeb5e&placeId=eventStartId:e8bc6232-0cfb-11f0-a068-ab160b2f15b1&whoAmI=556760847125996dc1a4a24f&agentType=rima.user\n\t */\n\t@Get(\"joinAgentToFlowInstance\")\n\tasync joinAgentToFlowInstance(\n\t\t@Query(\"flowInstanceKnodeId\") flowInstanceKnodeId: string,\n\t\t@Query(\"placeId\") placeId: string,\n\t\t@Query(\"whoAmI\") whoAmI: string,\n\t\t@Query(\"agentType\") agentType: RIMA_AGENT_TYPE,\n\t): Promise<string> {\n\t\tconst result = await this.appService.joinAgentToFlowInstance(flowInstanceKnodeId, placeId, whoAmI, agentType);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n\n\t/**\n\t * Gets agent token for flow instance\n\t * @param flowInstanceKnodeId Flow instance knode id\n\t * @param whoAmI agent id of the agent (represented as token) who is joining the flow instance\n\t * @returns Token as JSON or undefined if not found\n\t * \n\t * @example\n\t * http://localhost:8008/flowchestrator/getAgentTokenForFlowInstance?flowInstanceKnodeId=<flowInstanceKnodeId>&whoAmI=<whoAmI>\n\t * @example\n\t * \"http://localhost:8008/flowchestrator/getAgentTokenForFlowInstance?flowInstanceKnodeId=680a493284e86a6210ddeb5e&whoAmI=619a8fe7f155f13ee58b7252\"\n\t */\n\t@Get(\"getAgentTokenForFlowInstance\")\n\tasync getAgentTokenForFlowInstance(\n\t\t@Query(\"flowInstanceKnodeId\") flowInstanceKnodeId: string,\n\t\t@Query(\"whoAmI\") whoAmI: string,\n\t): Promise<string> {\n\t\tconst result = await this.appService.getAgentTokenForFlowInstance(flowInstanceKnodeId, whoAmI);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n\n\t/**\n\t * \n\t * @param tokenId Token id\n\t * @returns Token as JSON\n\t * \n\t * @example\n\t * http://localhost:8008/flowchestrator/loadToken/tokenId/<tokenId>\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadToken/tokenId/680a845984e86a6210ddeb69\n\t * \n\t * NOTE: Should we return the token knode id or the token id?\n\t */\n\t@Get(\"loadToken/tokenId/:tokenId\")\n\tasync loadToken(@Param(\"tokenId\") tokenId: string): Promise<any> {\n\t\tconst result = await this.appService.loadToken(tokenId);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n\n\t/**\n\t * Gets tokens for a specific flow instance\n\t * @param flowInstanceId Flow instance id which tokens we want to load\n\t * @returns An array of tokens as JSON\n\t * \n\t * @example\n\t * http://localhost:8008/flowchestrator/flowInstances/<flowInstanceId>/tokens\n\t * @example\n\t * http://localhost:8008/flowchestrator/flowInstances/681d3ac3f3609852450125bd/tokens\n\t *\n\t */\n\t@Get('flowInstances/:flowInstanceId/tokens')\n\tasync loadTokens(\n\t\t@Param('flowInstanceId') flowInstanceId: string,\n\t): Promise<any> {\n\t\tconst result = await this.appService.loadTokens( flowInstanceId );\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n\n\t\t/**\n\t * Moves token to a new place\n\t * @param tokenId Token id\n\t * @param movePayload \n\t * @returns \n\t */\n\t@Patch('flowInstances/:flowInstanceId/tokens/move')\n\tasync moveAllTokens(\n\t\t@Param('flowInstanceId') flowInstanceId: string,\n\t\t@Body() body: {\n\t\t\tplaceId: string;\n\t\t\t// placeInstanceId: string;\n\t\t\t// placeInstancePortId?: string;\n\t\t}\n\t): Promise<any> {\n\t\tconst { placeId } = body;\n\t\tconst result = this.appService.moveAllTokens(flowInstanceId, placeId);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n\n\t/**\n\t * Moves token to a new place\n\t * @param tokenId Token id\n\t * @param movePayload \n\t * @returns \n\t */\n\t@Patch('flowInstanceTokens/:tokenId/move')\n\tasync moveToken(\n\t\t@Param('tokenId') tokenId: string,\n\t\t@Body() body: {\n\t\t\tplaceId: string;\n\t\t\t// placeInstanceId: string;\n\t\t\t// placeInstancePortId?: string;\n\t\t}\n\t): Promise<any> {\n\t\tconst { placeId } = body;\n\t\tconst result = this.appService.moveToken(tokenId, placeId);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\n\t}\n\n\t/**\n\t * Loads Flow by ID from the persistent store into the flow store.\n\t * @param flowId Flow id\n\t * @returns Flow as JSON\n\t * \n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlow/flowId/<flowId>\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlow/flowId/67e88d15a5e47546be52fefc\n\t * - returns flow as JSON\n\t */\n\t@Get(\"loadFlow/flowId/:flowId\")\n\tasync loadFlow(@Param(\"flowId\") flowId: string): Promise<any> {\n\t\tconst result = this.appService.loadFlow(flowId);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n\n\t/**\n\t * Gets Flow by ID\n\t * @param flowId Flow id\n\t * @returns Flow as JSON\n\t * \n\t * @example\n\t * http://localhost:8008/flowchestrator/getFlow/flowId/<flowId>\n\t * @example\n\t * http://localhost:8008/flowchestrator/getFlow/flowId/67e88d15a5e47546be52fefc\n\t * - returns flow as JSON\n\t */\n\t@Get(\"getFlow/flowId/:flowId\")\n\tasync getFlow(@Param(\"flowId\") flowId: string): Promise<any> {\n\n\t\treturn await this.appService.getFlow(flowId);\n\t}\n\n\t/**\n\t * Gets list of flows\n\t * @returns List of flows as JSON\n\t *\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlows\n\t */\n\t@Get(\"loadFlows\")\n\tasync loadFlows(): Promise<any> {\n\t\treturn await this.appService.loadFlows();\n\t}\n\n\t/**\n\t * Gets list of flow instances\n\t * @param flowId Flow id (optional)\n\t * If flowId is not provided, all flow instances are loaded.\n\t * @param flowInstanceId Flow instance id (optional), if provided, only the flow instance with this id is loaded, otherwise all flow instances for the flowId (if provided) are loaded.\n\t * @param statuses Flow execution statuses (optional), if provided, only the flow instances with these statuses are loaded.\n\t * @returns List of flow instances as JSON\n\t *\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlowInstances\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlowInstances?flowId=<flowId>\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlowInstances\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlowInstances?flowId=67e88d15a5e47546be52fefc\n\t * @example\n\t * http://localhost:8008/flowchestrator/loadFlowInstances?flowInstanceId=6813e78584e86a6210de0e3f\n\t * - returns flow instances as JSON\n\t */\n\t@Get(\"loadFlowInstances\")\n\tasync loadFlowInstances(\n\t\t@Query(\"flowId\") flowId?: string,\n\t\t@Query(\"flowInstanceId\") flowInstanceId?: string,\n\t\t@Query(\"statuses\") statusesStr?: string,\n\t): Promise<any> {\n\t\tlet statuses: EFlowExecutionStatus[] | undefined = statusesStr?.split(\",\").map((status) => {\n\t\t\treturn EFlowExecutionStatus[status as keyof typeof EFlowExecutionStatus];\n\t\t}) as EFlowExecutionStatus[] | undefined;\n\t\tconst result = await this.appService.loadFlowInstances(flowId, flowInstanceId, statuses);\n\t\tconst resultServer = new ServerData(true, result, this.getNextAccessId());\n\t\tconst resultString = addSecurityPrefix(resultServer);\n\t\treturn resultString;\n\t}\n}\n", "export const APP_TITLE = 'APP_TITLE';\nexport const APP_TITLE_VALUE = 'ColaboFlow.NestApp';", "import { Provider } from '@nestjs/common';\nimport { useGlobalStore, UseGlobalStoreOptions } from '@colabo-flow/s-go';\nimport { ColaboKnAllEdgeNodeServiceExtended } from '@colabo-knalledge/i-core-services';\nimport { HttpClient, UtilsNotificationService } from '@colabo-headless/i-core';\nimport { APP_TITLE_VALUE } from \"./app.constants\";\nexport const GLOBAL_STORE = 'GLOBAL_STORE';\n\nconst kNodeService = new ColaboKnAllEdgeNodeServiceExtended(\n\t(null as unknown) as HttpClient,\n\t(null as unknown) as UtilsNotificationService\n);\n\nconst useGlobalStoreOptions: UseGlobalStoreOptions = {\n\tappNameText: `${APP_TITLE_VALUE}[GlobalStore]`,\n\tkNodeService: kNodeService,\n\tuseDefaultKNodeService: false,\n};\n\nexport const GlobalStoreProvider: Provider = {\n\tprovide: GLOBAL_STORE,\n\tuseValue: useGlobalStore(useGlobalStoreOptions),\n};", "import { EFlowExecutionStatus, IActionPayload_FLOW_INSTANCE_CREATE, IActionPayload_FLOW_INSTANCE_DELETE, IActionPayload_FLOW_INSTANCE_DEPERSIST, IActionPayload_FLOW_INSTANCE_PERSIST, IActionPayload_FLOW_INSTANCE_SET_STATUS, IActionPayload_GetAgentTokenForFlowInstance, IActionPayload_JoinFlowInstance, IActionPayload_LoadTokens, IActionPayload_MoveAllTokensToPlace, IActionPayload_MoveTokenToPlace, IFlow, IFlowInstance, IFlowToken } from '@colabo-flow/i-core';\nimport { Inject, Injectable } from '@nestjs/common';\nimport { GLOBAL_STORE } from './store.provider';\nimport { IGlobalStore } from '@colabo-flow/s-go';\nimport { APP_TITLE } from './app.constants';\nimport { RIMA_AGENT_TYPE } from \"@colabo-rima/i-aaa\";\n\nconst DEBUG = true;\nconst DEBUG_VERBOSE = false;\n@Injectable()\nexport class AppService {\n\tconstructor(\n\t\t@Inject(GLOBAL_STORE) private readonly store: IGlobalStore,\n\t\t@Inject(APP_TITLE) private readonly appTitle: string,\n\t) { }\n\n\tget appNameText(): string {\n\t\treturn `${this.appTitle}[Flowchestrator-API]`;\n\t}\n\n\tgetHello(): string {\n\t\treturn 'Hello From Flowchestra API!';\n\t}\n\n\t/** Instantiates flow from flow (identified by flowId) by creating a flow instance\n\t * and persisting it in the flow store.\n\t * @param {string} flowId Flow id\n\t * @param {any} flowInput Flow input\n\t * @param {Partial<IFlowInstance>} flowInstancePartial Flow instance details\n\t * @returns {string} Flow instance id\n\t */\n\tasync instantiateFlow(flowId: string, flowInput?: any, flowInstancePartial?: Partial<IFlowInstance>): Promise<IFlowInstance> {\n\t\t// const flow: IFlow = await flowInstanceId.loadFlow(flowId);\n\t\tconst flow: IFlow = await this.store.modules.flow.loadFlow(flowId);\n\t\tif(DEBUG_VERBOSE) console.log(`${this.appNameText} flow loaded with flow store: ${JSON.stringify(flow, null, 4)}`);\n\n\t\t// =========================\n\t\t// persisting flow instance\n\t\t// =========================\n\t\tconst payload: IActionPayload_FLOW_INSTANCE_CREATE = {\n\t\t\tflow: flow,\n\t\t\tflowInput: flowInput,\n\t\t\tflowInstancePartial: flowInstancePartial,\n\t\t};\n\t\tconst flowInstance: IFlowInstance = await this.store.modules.flow.modules.flowchestrator.createFlowInstance(payload);\n\t\tconsole.log(`${this.appNameText} flow instance created within flow store (id: ${flowInstance.id}, name: ${flowInstance.name})`);\n\n\t\tconst persistFlowInstancePayload: IActionPayload_FLOW_INSTANCE_PERSIST = {\n\t\t\tflowInstanceId: flowInstance.id,\n\t\t};\n\n\t\tconst flowInstancePersisted: IFlowInstance = await this.store.modules.flow.modules.flowchestrator.persistFlowInstance(persistFlowInstancePayload);\n\t\tconsole.log(`${this.appNameText} flow instance persisted with flow knode ID: ${flowInstancePersisted.id}`);\n\n\t\treturn flowInstancePersisted;\n\t}\n\n\t/**\n\t * Deletes flow instance from the persistent store\n\t * @param flowInstanceId Flow instance id\n\t * @returns Flow instance as JSON\n\t */\n\tasync deleteFlowInstance(flowInstanceId: string): Promise<void> {\n\t\tconst payload: IActionPayload_FLOW_INSTANCE_DELETE = {\n\t\t\tflowInstanceId: flowInstanceId,\n\t\t};\n\t\tawait this.store.modules.flow.modules.flowchestrator.deleteFlowInstance(payload);\n\t}\n\n\t/**\n\t * Sets flow instance status\n\t * @param flowInstanceKnodeId Flow instance knode id\n\t * @param status Flow instance status\n\t * @returns Flow instance as JSON\n\t */\n\tasync setFlowInstanceStatus(flowInstanceKnodeId: string, status: EFlowExecutionStatus): Promise<EFlowExecutionStatus> {\n\t\tconst payload: IActionPayload_FLOW_INSTANCE_SET_STATUS = {\n\t\t\tflowInstanceKnodeId: flowInstanceKnodeId,\n\t\t\tstatus: status,\n\t\t};\n\t\tconst finalStatus: EFlowExecutionStatus = await this.store.modules.flow.modules.flowchestrator.setFlowInstanceStatus(payload);\n\t\tconsole.log(`${this.appNameText} flow instance status set with flow instance ID ${flowInstanceKnodeId}. status: ${finalStatus}`);\n\n\t\treturn finalStatus;\n\t}\n\n\t/**\n\t * Retrieves flow instance from the persistent store and loads it into the flow store.\n\t * @param flowInstanceKnodeId Flow instance knode id\n\t * @returns Flow instance as JSON\n\t */\n\tasync depersistFlowInstance(flowInstanceKnodeId: string): Promise<any> {\n\t\t// const flowInstanceId: string = \"67f7cabaa5e47546be53173c\";\n\t\t// const flowInstanceId: string = \"67f80374a5e47546be531746\";\n\t\t// const flowInstanceId: string = \"67f8043ca5e47546be53174b\";\n\t\tconst depersistFlowInstancePayload: IActionPayload_FLOW_INSTANCE_DEPERSIST = {\n\t\t\tflowInstanceId: flowInstanceKnodeId,\n\t\t};\n\n\t\tconst flowInstance: IFlowInstance = await this.store.modules.flow.modules.flowchestrator.depersistFlowInstance(depersistFlowInstancePayload);\n\t\tconsole.log(`${this.appNameText} flow instance depersisted with flow instance ID ${flowInstanceKnodeId}: ${JSON.stringify(flowInstance, null, 4)}`);\n\t\treturn flowInstance;\n\t}\n\n\t/**\n\t * Joins flow instance by creating a new token\n\t * @param flowInstanceKnodeId Flow instance knode id\n\t * @param placeId Place id within the flow instance where the token is created. If undefined, the token is created in the start place of the flow instance.\n\t * @param whoAmI agent id of the agent (represented as token) who is joining the flow instance\n\t * @param agentType agent type (user, group, service) of the agent (represented as token) who is joining the flow instance\n\t * @returns Token id\n\t * TODO: Should we return the token knode id or the token id?\n\t */\n\tasync joinAgentToFlowInstance(\n\t\tflowInstanceKnodeId: string,\n\t\tplaceId: string | undefined,\n\t\twhoAmI: string,\n\t\tagentType: RIMA_AGENT_TYPE,\n\t): Promise<string> {\n\t\tconst payload: IActionPayload_JoinFlowInstance = {\n\t\t\tflowInstanceKnodeId: flowInstanceKnodeId,\n\t\t\tplaceId: placeId,\n\t\t\twhoAmI: whoAmI,\n\t\t\tagentType: agentType,\n\t\t};\n\t\tconst tokenId: string = await this.store.modules.flow.modules.flowchestrator.joinAgentToFlowInstance(payload);\n\t\treturn tokenId;\n\t}\n\n\t/**\n\t * Gets agent token for flow instance\n\t * @param flowInstanceKnodeId Flow instance knode id\n\t * @param whoAmI agent id of the agent which presence (represented as token) in the flow instance we want to get\n\t * @returns Token as JSON or undefined if not found\n\t */\n\tasync getAgentTokenForFlowInstance(\n\t\tflowInstanceKnodeId: string,\n\t\twhoAmI: string\n\t): Promise<IFlowToken | undefined> {\n\t\tconst payload: IActionPayload_GetAgentTokenForFlowInstance = {\n\t\t\tflowInstanceId: flowInstanceKnodeId,\n\t\t\twhoAmI: whoAmI,\n\t\t};\n\t\tconst token: IFlowToken | undefined = await this.store.modules.flow.modules.flowchestrator.getAgentTokenForFlowInstance(payload);\n\t\treturn token;\n\t}\n\n\t/**\n\t * Loads token by ID from the persistent store into the flow store.\n\t * @param tokenId Token id\n\t * @returns Token as JSON\n\t */\n\tasync loadToken(tokenId: string): Promise<IFlowToken> {\n\t\tconst token: IFlowToken = await this.store.modules.flow.modules.flowchestrator.loadToken(tokenId);\n\t\tconsole.log(`${this.appNameText} token loaded: ${JSON.stringify(token, null, 4)}`);\n\t\n\t\treturn token;\n\t}\n\t\n\t/**\n\t * Loads tokens by flow instance knode id from the persistent store\n\t * @param flowInstanceId Flow instance id\n\t * @returns Array of Tokens\n\t */\n\tasync loadTokens(flowInstanceId: string): Promise<IFlowToken[]> {\n\t\tconst payload: IActionPayload_LoadTokens = {\n\t\t\tflowInstanceKnodeId: flowInstanceId,\n\t\t};\n\t\tconst tokens: IFlowToken[] = await this.store.modules.flow.modules.flowchestrator.loadTokens(payload);\n\t\t// console.log(`${this.appNameText} tokens loaded: ${JSON.stringify(tokens, null, 4)}`);\n\t\n\t\treturn tokens;\n\t}\n\n\t/** Moves token to a new place */\n\tasync moveToken(tokenId: string, placeId: string): Promise<IFlowToken> {\n\t\tconst moveTokenPayload: IActionPayload_MoveTokenToPlace = {\n\t\t\ttokenId: tokenId,\n\t\t\tplaceId: placeId,\n\t\t}; \n\t\treturn this.store.modules.flow.modules.flowchestrator.moveToken(moveTokenPayload);\n\t}\n\n\t/** Moves all the tokens from a flow instance to a new place */\n\tasync moveAllTokens(flowInstanceId: string, placeId: string): Promise<IFlowToken[]> {\n\t\tconst moveAllTokensPayload: IActionPayload_MoveAllTokensToPlace = {\n\t\t\tflowInstanceId: flowInstanceId,\n\t\t\tplaceId: placeId,\n\t\t};\n\t\treturn this.store.modules.flow.modules.flowchestrator.moveAllTokens(moveAllTokensPayload);\n\t}\n\n\t/**\n\t * Loads Flow by ID from the persistent store into the flow store.\n\t * @param flowId Flow id\n\t * @returns Flow as JSON\n\t */\n\tasync loadFlow(flowId: string): Promise<IFlow> {\n\t\tconst flow: IFlow = await this.store.modules.flow.loadFlow(flowId);\n\t\tif(DEBUG_VERBOSE) console.log(`${this.appNameText} flow loaded with flow store: ${JSON.stringify(flow, null, 4)}`);\n\t\treturn flow;\n\t}\n\n\t/**\n\t * Gets Flow by ID\n\t * @param flowId Flow id\n\t * @returns Flow as JSON\n\t */\n\tasync getFlow(flowId: string): Promise<IFlow> {\n\t\tconst flow: IFlow = await this.store.modules.flow.getFlow(flowId);\n\t\tif(DEBUG_VERBOSE) console.log(`${this.appNameText} flow loaded with flow store: ${JSON.stringify(flow, null, 4)}`);\n\t\treturn flow;\n\t}\n\n\t/**\n\t * Loads and gets List of Flows\n\t * @returns List of Flows as JSON\n\t */\n\tasync loadFlows(): Promise<IFlow[]> {\n\t\tconst flows: IFlow[] = await this.store.modules.flow.loadFlows();\n\t\t// MOCKUP: test flow for verifying FlowChestra \u2194 FlowCheStrator\n\t\tflows.push({ id: 'mockup-from-flowchestrator', name: 'Mockup Flow (from FlowCheStrator)', tasksOrder: 'sequential', tasks: [{ id: 'mockup-task-a', name: 'Mockup Task A', placeType: 'TASK', inputPlaces: ['colabo.flow.special:event.start'], executorRef: { id: 'LOCAL_TIER:mockup-task-a', environment: 'ISOMORPHIC' } }, { id: 'mockup-task-b', name: 'Mockup Task B', placeType: 'TASK', executorRef: { id: 'LOCAL_TIER:mockup-task-b', environment: 'ISOMORPHIC' } }] } as any);\n\t\tconst flowNames: string[] = flows.map((flow) => flow.name);\n\t\tconsole.log(`${this.appNameText} flows loaded (${flows.length} incl mockup): ${JSON.stringify(flowNames, null, 4)}`);\n\t\treturn flows;\n\t}\n\n\t/**\n\t * Loads and gets List of Flow Instances\n\t * @param flowId Flow id which instances we want to load\n\t * @param flowInstanceNodeId Flow instance node id which we want to load\n\t * @param statuses Optional status filter for flow instances\n\t * @returns List of Flow Instances as JSON\n\t */\n\tasync loadFlowInstances(flowId?: string, flowInstanceNodeId?: string, statuses?: EFlowExecutionStatus[]): Promise<IFlowInstance[]> {\n\t\tconst flowInstances: IFlowInstance[] = await this.store.modules.flow.modules.flowchestrator.loadFlowInstances(flowId, flowInstanceNodeId, statuses);\n\t\tconst flowInstanceIds: string[] = flowInstances.map((flowInstance) => flowInstance.id);\n\t\tif(!flowId) {\n\t\t\tconsole.log(`${this.appNameText} all flow instances loaded: ${JSON.stringify(flowInstanceIds, null, 4)}`);\n\t\t} else {\n\t\t\tconsole.log(`${this.appNameText} flow instances loaded for flow ID ${flowId}: ${JSON.stringify(flowInstanceIds, null, 4)}`);\n\t\t}\n\t\treturn flowInstances;\n\t}\n}", "import { Controller, Param, Post } from '@nestjs/common';\nimport { ExecutionService } from './execution.service';\n\n@Controller('flowchestra')\nexport class ExecutionController {\n\tconstructor(private readonly executionService: ExecutionService) {}\n\n\t@Post('execute/:flowInstanceId')\n\tasync executeFlowInstance(@Param('flowInstanceId') flowInstanceId: string): Promise<any> {\n\t\treturn this.executionService.executeFlowInstance(flowInstanceId);\n\t}\n}\n", "import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class ExecutionService {\n\tasync executeFlowInstance(flowInstanceId: string, flowInput?: any): Promise<any> {\n\t\tconsole.log(`[ExecutionService] executing: ${flowInstanceId}`);\n\t\t// Dynamic import at call-time, not at module-load time\n\t\tconst cfCore = await import('@colabo-flow/i-core');\n\t\tconst store = (globalThis as any).__flowchestraStore;\n\t\tif (!store) return { status: 'ERROR', message: 'Store not initialized' };\n\t\treturn { status: 'STUB_WITH_STORE', flowInstanceId, storeAvailable: !!store };\n\t}\n}\n", "import { Module } from '@nestjs/common';\nimport { ExecutionController } from './execution.controller';\nimport { ExecutionService } from './execution.service';\n\n@Module({\n\tcontrollers: [ExecutionController],\n\tproviders: [ExecutionService],\n})\nexport class ExecutionModule {}\n", "import { Module } from '@nestjs/common';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { GlobalStoreProvider } from './store.provider';\n// import { RoutesParserModule } from './routes-parser/routes-parser.module';\n// import { ApiModule } from './api/api.module';\n// import { PureModule } from './pure/pure.module';\nimport { APP_TITLE, APP_TITLE_VALUE } from './app.constants';\nimport { ExecutionModule } from './execution/execution.module';\n\n@Module({\n\timports: [\n\t\t// RoutesParserModule, ApiModule, PureModule\n\t\tExecutionModule,\n\t],\n\tcontrollers: [AppController],\n\tproviders: [\n\t\tAppService,\n\t\tGlobalStoreProvider,\n\t\t{ provide: APP_TITLE, useValue: APP_TITLE_VALUE }\n\t],\n})\nexport class AppModule {}\nconsole.log(`[AppModule] Module loaded...`);\n", "import 'reflect-metadata';\nconst MODULE_NAME: string = \"@colabo-apps/b-colabo-space\";\n\nconst DEBUG: boolean = true;\nconst DEBUG_VERBOSE: boolean = false;\n\nimport path from \"path\";\n// Change the CWD to the directory of the script\n// It seems we do not want this anymore, \n// we want to keep the CWD to where the script was started from\n// ESM workaround for the missing `__dirname`:\n// import { fileURLToPath } from \"url\";\n// const __filename = fileURLToPath(import.meta.url);\n// const __dirname = path.dirname(__filename);\n// process.chdir(__dirname);\n\nconsole.log(\"process.argv: %s\", JSON.stringify(process.argv));\nconst portHttp = parseInt(process.argv[2] || process.env.API_LISTEN_PORT || \"8008\");\n// const hostname = undefined;\nconst hostname = process.env.API_LISTEN_HOSTNAME || \"0.0.0.0\";\nconst configFilePath = process.argv[3] || \"./config/global\";\n\nimport chalk from \"chalk\";\nimport { init, IColaboGlobal, IColaboConfig } from \"@colabo-utils/i-config\";\nimport express, { Request, Response } from \"express\";\nimport { bootstrapNestJs } from \"./bootstrap.nestjs\";\n\n// import resource from \"express-resource\";\n// https://stackoverflow.com/questions/41127479/es6-import-for-side-effects-meaning\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#import_a_module_for_its_side_effects_only\nimport \"express-resource\";\n\nimport { assert } from '@colabo-utils/i-verify';\n\nprocess.title = \"ColaboFlow.Go.FlowCheStrator\";\nconst appNameText = `[${chalk.red.bold(\"Colabo\")}${chalk.blue.bold(\"Flow\")}${chalk.green.bold(\".Go\")}${chalk.yellow.bold(\".\")}${chalk.blue.bold(\"Flow\")}${chalk.blueBright.bold(\"Che\")}${chalk.blue.bold(\"Strator\")}]`;\n\nconsole.log(`${appNameText} Starting ...`);\nconsole.log(`${appNameText} Backend API is configuring to listen on (<host>:<port>): ${hostname}:${portHttp}\"`);\n\n// const configFile: any = dynamicRequre(configFilePath);\nlet configFile: IColaboGlobal;\n\n/**\n * An express middleware that enables cross-origin access\n * @param req request express object\n * @param res response express object\n * @param next next express callback to be called when we finished processing\n */\nfunction supportCrossOriginScript(req: Request, res: Response, next: Function) {\n\t// https://developer.mozilla.org/en-US/docs/Glossary/preflight_request\n\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers\n\t// res.header(\"Access-Control-Allow-Headers\", \"Origin\");\n\t// res.header(\"Access-Control-Allow-Headers\", \"Origin, X-Requested-With, Content-Type, Accept\");\n\tlet allowedHeaders: string = \"Content-Type\";\n\tallowedHeaders += \", x-user-id, x-access-token\";\n\t// The value \"*\" only counts as a special wildcard value for requests **without credentials** (requests without HTTP cookies or HTTP authentication information)\n\t// let allowedHeaders:string = \"*\";\n\tres.header(\"Access-Control-Allow-Headers\", allowedHeaders);\n\tconsole.log(\"[supportCrossOriginScript] allowedHeaders: \", allowedHeaders);\n\n\t// res.header(\"Access-Control-Allow-Methods\",\"POST, OPTIONS\");\n\tres.header(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, DELETE, PUT, HEAD\");\n\tres.header(\"Allow\", \"POST, GET, OPTIONS, DELETE, PUT, HEAD\");\n\t// res.header(\"Access-Control-Max-Age\",\"1728000\");\n\n\t// res.header(\"Access-Control-Allow-Origin\", \"*\");\n\t// http://stackoverflow.com/questions/15026016/set-cookie-in-http-header-is-ignored-with-angularjs\n\tconst origin = req.headers.origin; // \"litterra.info\"; // \"litterra.info:8088\"; //req.headers.origin;\n\n\t//console.log(\"Access-Control-Allow-Origin: %s\", origin);\n\n\t//var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;\n\t// console.log(\"Access-Control-Allow-Origin: %s\", ip);\n\tconsole.log(\"[supportCrossOriginScript] Access-Control-Allow-Origin: %s\", origin);\n\n\tres.header(\"Access-Control-Allow-Origin\", origin);\n\tres.header(\"Access-Control-Allow-Credentials\", true.toString());\n\n\tconsole.log(\"[supportCrossOriginScript] setting up headers\");\n\n\tres.status(200);\n\tnext();\n}\n\n/**\n * TBD:\n * @param deepObjectPath \n */\nconst escapeDeepObjectPathIntoEnvVariableName = (deepObjectPath: string): string => {\n\tconst envVariableName = deepObjectPath.split(\".\").join(\"__\");\n\treturn envVariableName;\n}\n\n/**\n * TBD: \n * Parses the environment variable name into a deep object path\n * For example, the environment variable name `colabo_knalledge__b_storage_mongo___dbConfig_user` will be parsed into `@colabo-knalledge/b-storage-mongo:dbConfig.user`\n * @param envVariableName\n * @returns \n */\nconst parseEnvVariableNameIntoDeepObjectPath = (envVariableName: string): string => {\n\tconst envVariableNameParts = envVariableName.split(\"__\");\n\tconst deepObjectPath = envVariableNameParts.join(\".\");\n\treturn deepObjectPath;\n};\n\n/**\n * Injects environment variables into the global configuration object\n * It gets the list of environment variables, parses their escaped names into deep object paths and injects the values into the global configuration object\n * It uses \n * @param globalSet \n */\nconst injectEnvVariablesIntoConfig = (globalSet: IColaboConfig) => {\n\t// KISS for now\n\tif(process.env[\"DB_CONFIG__DB_NAME\"]) globalSet.dbConfig.dbName = process.env[\"DB_CONFIG__DB_NAME\"];\n\tif(process.env[\"DB_CONFIG__DOMAIN\"]) globalSet.dbConfig.domain = process.env[\"DB_CONFIG__DOMAIN\"];\n\tif(process.env[\"DB_CONFIG__PORT\"]) globalSet.dbConfig.port = process.env[\"DB_CONFIG__PORT\"];\n\tif(process.env[\"DB_CONFIG__USER\"]) globalSet.dbConfig.user = process.env[\"DB_CONFIG__USER\"];\n\tif(process.env[\"DB_CONFIG__PASS\"]) globalSet.dbConfig.pass = process.env[\"DB_CONFIG__PASS\"];\n};\n\nconst main = async (): Promise<void> => {\n\t// resolving the absolute path of the config file relative to the current working directory\n\tconst configFilePathAbs = path.resolve(process.cwd(), configFilePath);\n\tconsole.log(`[${appNameText}] is importing (await import) configFilePath from \"${configFilePath}\" (resolved to \"${configFilePathAbs}\")`);\n\t// TODO: fix paths so that relative path is relative to the current folder rather than the script path\n\tconfigFile = await import(configFilePathAbs);\n\tif(DEBUG_VERBOSE) console.log(`[${appNameText}] configFile: \"${JSON.stringify(configFile, null, 4)}\"`);\n\t\n\tconst globalSet: IColaboConfig = configFile.globalSet;\n\tconsole.log(\"[Colabo.Space:index] globalSet.paths: %s\", JSON.stringify(globalSet.paths));\n\tinit(globalSet);\n\t// inject after the global object is initialized\n\tinjectEnvVariablesIntoConfig(globalSet);\n\t\n\tconst expressApp = express();\n\t\t\n\t// expressApp.use(express.json());\n\t\n\texpressApp.set(\"port\", portHttp);\n\t\n\texpressApp.use(supportCrossOriginScript);\n\t// not used anymore in v4.*\n\t// expressApp.use(expressApp.router);\n\n\tawait bootstrapNestJs(expressApp, portHttp, hostname);\n}\nawait main();\nconsole.log(appNameText + \" started ...\");\nconsole.log(`${appNameText} Backend API is configuring to listen on (<host>:<port>): ${hostname}:${portHttp}\"`);\n\nimport { useGlobalStore } from \"@colabo-flow/s-go\";\n\nimport { IActionPayload_FLOW_INSTANCE_CREATE, IActionPayload_FLOW_INSTANCE_DEPERSIST, IActionPayload_FLOW_INSTANCE_PERSIST, IFlow, IFlowInstance } from '@colabo-flow/i-core';\nimport { ColaboKnAllEdgeNodeServiceExtended } from '@colabo-knalledge/i-core-services';\nimport { HttpClient, UtilsNotificationService } from '@colabo-headless/i-core';\nimport { UseGlobalStoreOptions } from '../../puzzles/flow/go/lib/flowchestrator/store';\n\nconst kNodeService = new ColaboKnAllEdgeNodeServiceExtended(\n\t(null as unknown) as HttpClient,\n\t(null as unknown) as UtilsNotificationService\n);\n\nconst useGlobalStoreOptions: UseGlobalStoreOptions = {\n\tappNameText: appNameText,\n\tkNodeService: kNodeService,\n\tuseDefaultKNodeService: false,\n};\n\nconst store = useGlobalStore(useGlobalStoreOptions);\n// Expose store globally for ExecutionModule (avoids ESM import issues with DI)\n(globalThis as any).__flowchestraStore = store;\nconsole.log(`${appNameText} Started`);", "import { INestApplication } from '@nestjs/common';\nimport express, { Request, Response, Express } from \"express\";\nimport { assert } from '@colabo-utils/i-verify';\n\nexport const bootstrapNestJs = async (expressApp: Express, portHttp: number, hostname: string | undefined): Promise<void> => {\n\tconsole.log(\"Top server is NestJS\");\n\t// Dynamically import NestJS modules\n\tconst { NestFactory } = await import(\"@nestjs/core\");\n\tconst { ExpressAdapter } = await import(\"@nestjs/platform-express\");\n\tconst { AppModule } = await import(\"./app.module\");\n\tconst { DocumentBuilder, SwaggerModule } = await import(\"@nestjs/swagger\");\n\t// const type { CorsOptions } = await import(\"@nestjs/common/interfaces/external/cors-options.interface\");\n\t// const type { NestApplicationOptions } = await import(\"@nestjs/common\");\n\n\tconst origins: string[] = [\n\t\t\"http://localhost\",\n\t\t\"https://localhost\",\n\t\t\"https://colabo.space\",\n\t];\n\tconst ports: number[] = [3000, 3001, \n\t\t3050, // FlowChestra\n\t\t3080, // Colabo.Go!\n\t\t5050, 443, 5173, 5174, 8081];\n\n\tconst ORIGIN_PORT_PROD: string = \"https://colabo.space:3000\"; // in prod, only this origin and ports are allowed for security reasons\n\t\n\tconst cors = {\n\t\torigin: (origin, callback) => {\n\t\t const env = process.env.ENV || \"DEV\"; // Default to DEV if not set\n\t\t console.log(\"[app::index.ts] env\", env);\n\t\t let isOriginAllowed: boolean = false;\n\t\t let isPortAllowed: boolean = false;\n\n\t\t if(env === \"PROD\") {\n\t\t\tif(origin === ORIGIN_PORT_PROD) { // in prod, only this origin and ports are allowed for security reasons\n\t\t\t\tisOriginAllowed = isPortAllowed = true;\n\t\t\t}\n\t\t } else {\n\t\t\t// In DEV environment, allow undefined origins (for local testing: undefined is when accessing by posting url to browser)\n\t\t\tif (env === \"DEV\" && !origin) {\n\t\t\t\tconsole.log(`[app::index.ts] CORS-ALLOWED for origin='${origin}': env === \"DEV\" && !origin`);\n\t\t\t\treturn callback(null, true); // Allow undefined origin in DEV environment\n\t\t\t }\n\t\t\t \n\t\t\n\t\t\t // For PROD, ensure the origin is valid and belongs to the allowed list\n\t\t\t if (!origin) {\n\t\t\t\treturn callback(new Error(`Origin 'undefined' Not allowed by CORS`)); // Reject undefined origins in PROD\n\t\t\t }\n\t\t\t // Check if the origin matches any in the list\n\t\t\t \n\t\t\t isOriginAllowed = origins.some(\n\t\t\t\t(allowedOrigin) => origin && origin.startsWith(allowedOrigin),\n\t\t\t );\n\t\t\n\t\t\t // Check if the port is in the allowed ports list\n\t\t\t isPortAllowed = ports.some(\n\t\t\t\t(allowedPort) => origin && origin.includes(`:${allowedPort}`),\n\t\t\t );\n\t\t }\n\t\n\t\t if (isOriginAllowed && isPortAllowed) {\n\t\t\tconsole.log(`[app::index.ts] CORS-ALLOWED for origin='${origin}'`);\n\t\t\tcallback(null, true); // Allow the origin and port\n\t\t } else {\n\t\t\tconsole.log(`[app::index.ts] CORS-NOT-ALLOWED for origin='${origin}': isOriginAllowed=${isOriginAllowed}; isPortAllowed=${isPortAllowed}`);\n\t\t\tcallback(new Error(`Origin '${origin}' Not allowed by CORS`)); // Reject other origins and ports\n\t\t }\n\t\t},\n\t};\n\n\n\t// const nestApplicationOptions: NestApplicationOptions = {\n\tconst nestApplicationOptions = { \n\t\t// TODO: httpsOptions,\n\t\tcors,\n\t };\n\n\tconst nestJsApp: INestApplication<any> = await NestFactory.create(AppModule, new ExpressAdapter(expressApp), nestApplicationOptions);\n\n\t// all routes are prefixed with 'v1' (e.g 'http://localhost:8001/v1/knodes')\n\t// nestJsApp.setGlobalPrefix('v1');\n \n\tconst swaggerConfig = new DocumentBuilder()\n\t.setTitle(\"Colabo\")\n\t.setDescription(\"The Colabo clean-architecture-nestJS API description\")\n\t.setVersion(\"0.1\")\n\t.addTag(\"colabo\")\n\t.build();\n\tconst document = SwaggerModule.createDocument(nestJsApp, swaggerConfig);\n\tSwaggerModule.setup(\"api\", nestJsApp, document);\n\n\t// NestJS starts listening on the same Express server\n\tif (hostname) await nestJsApp.listen(portHttp, hostname);\n\telse await nestJsApp.listen(portHttp);\n};"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,YAAY,QAAQ,KAAK,OAAO,OAAO,MAAM,aAAa;AAEzE,SAAS,eAAe;AAGxB,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,4BAA2C;AAPpD,IAUa;AAVb;AAAA;AAUO,IAAM,gBAAN,MAAoB;AAAA,MAC1B,YAA6B,YAAwB;AAAxB;AAAA,MAAyB;AAAA,MAC5C,WAAmB;AAAA,MACnB,kBAA0B;AACnC,eAAO,KAAK;AAAA,MACb;AAAA,MAMA,WAAmB;AAClB,eAAO,KAAK,WAAW,SAAS;AAAA,MACjC;AAAA,MAgBA,MAAM,gBACY,QACT,MAIU;AAClB,cAAM,EAAE,WAAW,oBAAoB,IAAI;AAC3C,cAAM,SAAS,MAAM,KAAK,WAAW,gBAAgB,QAAQ,WAAW,mBAAmB;AAC3F,cAAM,eAAe,IAAI,WAAW,MAAM,QAAQ,KAAK,gBAAgB,CAAC;AACxE,cAAM,eAAe,kBAAkB,YAAY;AACnD,eAAO;AAAA,MACR;AAAA,MAGC,MAAM,mBAA4C,gBAA6C;AAC/F,cAAM,KAAK,WAAW,mBAAmB,cAAc;AACvD,eAAO,IAAI,WAAW,MAAM,iBAAiB,cAAc,YAAY,KAAK,gBAAgB,CAAC;AAAA,MAC9F;AAAA,MAcA,MAAM,sBACyB,qBACd,QACD;AACf,cAAM,SAAS,MAAM,KAAK,WAAW,sBAAsB,qBAAqB,MAAM;AACtF,cAAM,eAAe,IAAI,WAAW,MAAM,QAAQ,KAAK,gBAAgB,CAAC;AACxE,cAAM,eAAe,kBAAkB,YAAY;AACnD,eAAO;AAAA,MACR;AAAA,MAaA,MAAM,sBAAoD,qBAA2C;A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AAeD,sBAAqB;AAEjD,WAAmB,qBAAqB;AACzC,QAAQ,IAAI,GAAG,WAAW,UAAU;",
6
+ "names": ["store", "Controller", "Param", "Post", "Injectable", "store", "Module", "portHttp", "hostname", "AppModule", "useGlobalStore", "ColaboKnAllEdgeNodeServiceExtended", "DEBUG_VERBOSE", "DEBUG_VERBOSE", "kNodeService", "ColaboKnAllEdgeNodeServiceExtended", "useGlobalStoreOptions", "useGlobalStore"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import { IColaboConfig } from "@colabo-utils/i-config";
2
+ declare let globalSet: IColaboConfig;
3
+ export default globalSet;
@@ -0,0 +1,106 @@
1
+ export namespace globalSet {
2
+ let general: {};
3
+ namespace paths {
4
+ let DATASET_FOLDER: string;
5
+ let FOLDER_OUT: string;
6
+ let FOLDER_CACHE: string;
7
+ }
8
+ namespace dbConfig {
9
+ let newConnect: boolean;
10
+ let dbName: string;
11
+ let domain: string;
12
+ let port: number;
13
+ let user: string;
14
+ let pass: string;
15
+ }
16
+ let puzzles: {
17
+ "@colabo-knalledge/b-core": {
18
+ typesThatNeedHumanId: string[];
19
+ registerModules: {
20
+ name: string;
21
+ description: string;
22
+ consumer: string;
23
+ entryPoints: {
24
+ id: string;
25
+ name: string;
26
+ description: string;
27
+ triggerCondition: any;
28
+ excludeOriginal: boolean;
29
+ importInfo: {
30
+ moduleName: string;
31
+ exportName: string;
32
+ };
33
+ }[];
34
+ }[];
35
+ };
36
+ "@colabo-topichat/b-core": {
37
+ debug: boolean;
38
+ debug_verbose: boolean;
39
+ };
40
+ "@colabo-topichat/b-talk": {
41
+ debug: boolean;
42
+ debug_verbose: boolean;
43
+ saveTalkToMap: boolean;
44
+ emitMessages: boolean;
45
+ mapId: string;
46
+ defaultIAmId: string;
47
+ };
48
+ "@colabo-topichat/b-clients-orchestration": {
49
+ saveTalkToMap: boolean;
50
+ emitMessages: boolean;
51
+ emitMessagesToSender: boolean;
52
+ mapId: string;
53
+ iAmId: string;
54
+ nodeId: string;
55
+ };
56
+ "@colabo-flow/b-audit": {
57
+ limitFindNo: number;
58
+ };
59
+ "@colabo-flow/b-services": {
60
+ debug: boolean;
61
+ url: string;
62
+ cancelCunsumerTags: boolean;
63
+ queue: string;
64
+ shouldRequestResult: boolean;
65
+ noAck: boolean;
66
+ shouldListenOnSeparateResponseQueue: boolean;
67
+ separateResponseQueue: string;
68
+ };
69
+ "@colabo-flow/b-topichat": {
70
+ saveFlowInteractionToMap: boolean;
71
+ mockupQueueAccess: boolean;
72
+ mapId: string;
73
+ };
74
+ "@colabo-media/b-upload": {
75
+ tmpUpload: string;
76
+ mediaTypes: {
77
+ default: {
78
+ type: string;
79
+ destinationFolder: string;
80
+ webPath: string;
81
+ };
82
+ user: {
83
+ type: string;
84
+ mediaFormat: string;
85
+ destinationFolder: string;
86
+ webPath: string;
87
+ };
88
+ playsust: {
89
+ type: string;
90
+ mediaFormat: string;
91
+ destinationFolder: string;
92
+ webPath: string;
93
+ };
94
+ };
95
+ };
96
+ "@colabo-knalledge/i-core-services": {
97
+ debug: boolean;
98
+ iAmId: string;
99
+ voId: string;
100
+ name: string;
101
+ type: string;
102
+ serverUrl: string;
103
+ structureType: string;
104
+ };
105
+ };
106
+ }
@@ -0,0 +1,2 @@
1
+ export declare const APP_TITLE = "APP_TITLE";
2
+ export declare const APP_TITLE_VALUE = "ColaboFlow.NestApp";
@@ -0,0 +1,174 @@
1
+ import { AppService } from './app.service';
2
+ import { RIMA_AGENT_TYPE } from '@colabo-rima/i-aaa';
3
+ import { ServerData } from '@colabo-knalledge/i-core';
4
+ import { EFlowExecutionStatus, IFlowInstance } from '@colabo-flow/i-core';
5
+ export declare class AppController {
6
+ private readonly appService;
7
+ constructor(appService: AppService);
8
+ protected accessId: number;
9
+ protected getNextAccessId(): number;
10
+ getHello(): string;
11
+ /**
12
+ * Instantiates flow with provided input and flow instance details
13
+ * @param body Object containing flowInputSerialized and newFlowInstance
14
+ * @returns {string} Flow instance id
15
+ *
16
+ * @example
17
+ * POST http://localhost:8008/flowchestrator/instantiateFlow
18
+ * Body:
19
+ * {
20
+ * "flowInputSerialized": "{\"key\":\"value\"}",
21
+ * "newFlowInstance": { "id": "123", "name": "Example Flow Instance" }
22
+ * }
23
+ */
24
+ instantiateFlow(flowId: string, body: {
25
+ flowInput?: any;
26
+ flowInstancePartial?: Partial<IFlowInstance>;
27
+ }): Promise<string>;
28
+ deleteFlowInstance(flowInstanceId: string): Promise<ServerData>;
29
+ /**
30
+ * Sets flow instance status
31
+ * @param flowInstanceKnodeId Flow instance knode id
32
+ * @param status Flow execution status
33
+ * @returns Flow instance as JSON
34
+ *
35
+ * @example
36
+ * http://localhost:8008/flowchestrator/flowInstances/<flowInstanceKnodeId>/status
37
+ * @example
38
+ * http://localhost:8008/flowchestrator/flowInstances/6808063fa5e47546be531761/status
39
+ */
40
+ setFlowInstanceStatus(flowInstanceKnodeId: string, status: EFlowExecutionStatus): Promise<any>;
41
+ /**
42
+ * Retrieves flow instance from the persistent store and loads it into the flow store.
43
+ * @param flowInstanceKnodeId Flow instance knode id
44
+ * @returns Flow instance as JSON
45
+ *
46
+ * @example
47
+ * http://localhost:8008/flowchestrator/DepersistFlowInstance/flowInstanceKnodeId/<flowInstanceKnodeId>
48
+ * @example
49
+ * http://localhost:8008/flowchestrator/DepersistFlowInstance/flowInstanceKnodeId/6808063fa5e47546be531761
50
+ */
51
+ depersistFlowInstance(flowInstanceKnodeId: string): Promise<any>;
52
+ /**
53
+ * Joins flow instance by creating a new token
54
+ * @param flowInstanceKnodeId Flow instance id
55
+ * @param placeId Place id within the flow instance where the token is created
56
+ * @param whoAmI agent id of the agent (represented as token) who is joining the flow instance
57
+ * @param agentType agent type (user, group, service) of the agent (represented as token) who is joining the flow instance
58
+ * @returns Token kNode id
59
+ *
60
+ * @example
61
+ * http://localhost:8008/flowchestrator/joinAgentToFlowInstance?flowInstanceKnodeId=<flowInstanceKnodeId>&placeId=<placeId>&whoAmI=<whoAmI>&agentType=<agentType>
62
+ * @example
63
+ * http://localhost:8008/flowchestrator/joinAgentToFlowInstance?flowInstanceKnodeId=680a493284e86a6210ddeb5e&placeId=eventStartId:e8bc6232-0cfb-11f0-a068-ab160b2f15b1&whoAmI=556760847125996dc1a4a24f&agentType=rima.user
64
+ */
65
+ joinAgentToFlowInstance(flowInstanceKnodeId: string, placeId: string, whoAmI: string, agentType: RIMA_AGENT_TYPE): Promise<string>;
66
+ /**
67
+ * Gets agent token for flow instance
68
+ * @param flowInstanceKnodeId Flow instance knode id
69
+ * @param whoAmI agent id of the agent (represented as token) who is joining the flow instance
70
+ * @returns Token as JSON or undefined if not found
71
+ *
72
+ * @example
73
+ * http://localhost:8008/flowchestrator/getAgentTokenForFlowInstance?flowInstanceKnodeId=<flowInstanceKnodeId>&whoAmI=<whoAmI>
74
+ * @example
75
+ * "http://localhost:8008/flowchestrator/getAgentTokenForFlowInstance?flowInstanceKnodeId=680a493284e86a6210ddeb5e&whoAmI=619a8fe7f155f13ee58b7252"
76
+ */
77
+ getAgentTokenForFlowInstance(flowInstanceKnodeId: string, whoAmI: string): Promise<string>;
78
+ /**
79
+ *
80
+ * @param tokenId Token id
81
+ * @returns Token as JSON
82
+ *
83
+ * @example
84
+ * http://localhost:8008/flowchestrator/loadToken/tokenId/<tokenId>
85
+ * @example
86
+ * http://localhost:8008/flowchestrator/loadToken/tokenId/680a845984e86a6210ddeb69
87
+ *
88
+ * NOTE: Should we return the token knode id or the token id?
89
+ */
90
+ loadToken(tokenId: string): Promise<any>;
91
+ /**
92
+ * Gets tokens for a specific flow instance
93
+ * @param flowInstanceId Flow instance id which tokens we want to load
94
+ * @returns An array of tokens as JSON
95
+ *
96
+ * @example
97
+ * http://localhost:8008/flowchestrator/flowInstances/<flowInstanceId>/tokens
98
+ * @example
99
+ * http://localhost:8008/flowchestrator/flowInstances/681d3ac3f3609852450125bd/tokens
100
+ *
101
+ */
102
+ loadTokens(flowInstanceId: string): Promise<any>;
103
+ /**
104
+ * Moves token to a new place
105
+ * @param tokenId Token id
106
+ * @param movePayload
107
+ * @returns
108
+ */
109
+ moveAllTokens(flowInstanceId: string, body: {
110
+ placeId: string;
111
+ }): Promise<any>;
112
+ /**
113
+ * Moves token to a new place
114
+ * @param tokenId Token id
115
+ * @param movePayload
116
+ * @returns
117
+ */
118
+ moveToken(tokenId: string, body: {
119
+ placeId: string;
120
+ }): Promise<any>;
121
+ /**
122
+ * Loads Flow by ID from the persistent store into the flow store.
123
+ * @param flowId Flow id
124
+ * @returns Flow as JSON
125
+ *
126
+ * @example
127
+ * http://localhost:8008/flowchestrator/loadFlow/flowId/<flowId>
128
+ * @example
129
+ * http://localhost:8008/flowchestrator/loadFlow/flowId/67e88d15a5e47546be52fefc
130
+ * - returns flow as JSON
131
+ */
132
+ loadFlow(flowId: string): Promise<any>;
133
+ /**
134
+ * Gets Flow by ID
135
+ * @param flowId Flow id
136
+ * @returns Flow as JSON
137
+ *
138
+ * @example
139
+ * http://localhost:8008/flowchestrator/getFlow/flowId/<flowId>
140
+ * @example
141
+ * http://localhost:8008/flowchestrator/getFlow/flowId/67e88d15a5e47546be52fefc
142
+ * - returns flow as JSON
143
+ */
144
+ getFlow(flowId: string): Promise<any>;
145
+ /**
146
+ * Gets list of flows
147
+ * @returns List of flows as JSON
148
+ *
149
+ * @example
150
+ * http://localhost:8008/flowchestrator/loadFlows
151
+ */
152
+ loadFlows(): Promise<any>;
153
+ /**
154
+ * Gets list of flow instances
155
+ * @param flowId Flow id (optional)
156
+ * If flowId is not provided, all flow instances are loaded.
157
+ * @param flowInstanceId Flow instance id (optional), if provided, only the flow instance with this id is loaded, otherwise all flow instances for the flowId (if provided) are loaded.
158
+ * @param statuses Flow execution statuses (optional), if provided, only the flow instances with these statuses are loaded.
159
+ * @returns List of flow instances as JSON
160
+ *
161
+ * @example
162
+ * http://localhost:8008/flowchestrator/loadFlowInstances
163
+ * @example
164
+ * http://localhost:8008/flowchestrator/loadFlowInstances?flowId=<flowId>
165
+ * @example
166
+ * http://localhost:8008/flowchestrator/loadFlowInstances
167
+ * @example
168
+ * http://localhost:8008/flowchestrator/loadFlowInstances?flowId=67e88d15a5e47546be52fefc
169
+ * @example
170
+ * http://localhost:8008/flowchestrator/loadFlowInstances?flowInstanceId=6813e78584e86a6210de0e3f
171
+ * - returns flow instances as JSON
172
+ */
173
+ loadFlowInstances(flowId?: string, flowInstanceId?: string, statusesStr?: string): Promise<any>;
174
+ }
@@ -0,0 +1,2 @@
1
+ export declare class AppModule {
2
+ }
@@ -0,0 +1,95 @@
1
+ import { EFlowExecutionStatus, IFlow, IFlowInstance, IFlowToken } from '@colabo-flow/i-core';
2
+ import { IGlobalStore } from '@colabo-flow/s-go';
3
+ import { RIMA_AGENT_TYPE } from "@colabo-rima/i-aaa";
4
+ export declare class AppService {
5
+ private readonly store;
6
+ private readonly appTitle;
7
+ constructor(store: IGlobalStore, appTitle: string);
8
+ get appNameText(): string;
9
+ getHello(): string;
10
+ /** Instantiates flow from flow (identified by flowId) by creating a flow instance
11
+ * and persisting it in the flow store.
12
+ * @param {string} flowId Flow id
13
+ * @param {any} flowInput Flow input
14
+ * @param {Partial<IFlowInstance>} flowInstancePartial Flow instance details
15
+ * @returns {string} Flow instance id
16
+ */
17
+ instantiateFlow(flowId: string, flowInput?: any, flowInstancePartial?: Partial<IFlowInstance>): Promise<IFlowInstance>;
18
+ /**
19
+ * Deletes flow instance from the persistent store
20
+ * @param flowInstanceId Flow instance id
21
+ * @returns Flow instance as JSON
22
+ */
23
+ deleteFlowInstance(flowInstanceId: string): Promise<void>;
24
+ /**
25
+ * Sets flow instance status
26
+ * @param flowInstanceKnodeId Flow instance knode id
27
+ * @param status Flow instance status
28
+ * @returns Flow instance as JSON
29
+ */
30
+ setFlowInstanceStatus(flowInstanceKnodeId: string, status: EFlowExecutionStatus): Promise<EFlowExecutionStatus>;
31
+ /**
32
+ * Retrieves flow instance from the persistent store and loads it into the flow store.
33
+ * @param flowInstanceKnodeId Flow instance knode id
34
+ * @returns Flow instance as JSON
35
+ */
36
+ depersistFlowInstance(flowInstanceKnodeId: string): Promise<any>;
37
+ /**
38
+ * Joins flow instance by creating a new token
39
+ * @param flowInstanceKnodeId Flow instance knode id
40
+ * @param placeId Place id within the flow instance where the token is created. If undefined, the token is created in the start place of the flow instance.
41
+ * @param whoAmI agent id of the agent (represented as token) who is joining the flow instance
42
+ * @param agentType agent type (user, group, service) of the agent (represented as token) who is joining the flow instance
43
+ * @returns Token id
44
+ * TODO: Should we return the token knode id or the token id?
45
+ */
46
+ joinAgentToFlowInstance(flowInstanceKnodeId: string, placeId: string | undefined, whoAmI: string, agentType: RIMA_AGENT_TYPE): Promise<string>;
47
+ /**
48
+ * Gets agent token for flow instance
49
+ * @param flowInstanceKnodeId Flow instance knode id
50
+ * @param whoAmI agent id of the agent which presence (represented as token) in the flow instance we want to get
51
+ * @returns Token as JSON or undefined if not found
52
+ */
53
+ getAgentTokenForFlowInstance(flowInstanceKnodeId: string, whoAmI: string): Promise<IFlowToken | undefined>;
54
+ /**
55
+ * Loads token by ID from the persistent store into the flow store.
56
+ * @param tokenId Token id
57
+ * @returns Token as JSON
58
+ */
59
+ loadToken(tokenId: string): Promise<IFlowToken>;
60
+ /**
61
+ * Loads tokens by flow instance knode id from the persistent store
62
+ * @param flowInstanceId Flow instance id
63
+ * @returns Array of Tokens
64
+ */
65
+ loadTokens(flowInstanceId: string): Promise<IFlowToken[]>;
66
+ /** Moves token to a new place */
67
+ moveToken(tokenId: string, placeId: string): Promise<IFlowToken>;
68
+ /** Moves all the tokens from a flow instance to a new place */
69
+ moveAllTokens(flowInstanceId: string, placeId: string): Promise<IFlowToken[]>;
70
+ /**
71
+ * Loads Flow by ID from the persistent store into the flow store.
72
+ * @param flowId Flow id
73
+ * @returns Flow as JSON
74
+ */
75
+ loadFlow(flowId: string): Promise<IFlow>;
76
+ /**
77
+ * Gets Flow by ID
78
+ * @param flowId Flow id
79
+ * @returns Flow as JSON
80
+ */
81
+ getFlow(flowId: string): Promise<IFlow>;
82
+ /**
83
+ * Loads and gets List of Flows
84
+ * @returns List of Flows as JSON
85
+ */
86
+ loadFlows(): Promise<IFlow[]>;
87
+ /**
88
+ * Loads and gets List of Flow Instances
89
+ * @param flowId Flow id which instances we want to load
90
+ * @param flowInstanceNodeId Flow instance node id which we want to load
91
+ * @param statuses Optional status filter for flow instances
92
+ * @returns List of Flow Instances as JSON
93
+ */
94
+ loadFlowInstances(flowId?: string, flowInstanceNodeId?: string, statuses?: EFlowExecutionStatus[]): Promise<IFlowInstance[]>;
95
+ }
@@ -0,0 +1,2 @@
1
+ import { Express } from "express";
2
+ export declare const bootstrapNestJs: (expressApp: Express, portHttp: number, hostname: string | undefined) => Promise<void>;
@@ -0,0 +1,6 @@
1
+ import { ExecutionService } from './execution.service';
2
+ export declare class ExecutionController {
3
+ private readonly executionService;
4
+ constructor(executionService: ExecutionService);
5
+ executeFlowInstance(flowInstanceId: string): Promise<any>;
6
+ }
@@ -0,0 +1,2 @@
1
+ export declare class ExecutionModule {
2
+ }
@@ -0,0 +1,3 @@
1
+ export declare class ExecutionService {
2
+ executeFlowInstance(flowInstanceId: string, flowInput?: any): Promise<any>;
3
+ }
@@ -0,0 +1,2 @@
1
+ import 'reflect-metadata';
2
+ import "express-resource";
@@ -0,0 +1,3 @@
1
+ import { Provider } from '@nestjs/common';
2
+ export declare const GLOBAL_STORE = "GLOBAL_STORE";
3
+ export declare const GlobalStoreProvider: Provider;