@invect/nestjs 0.0.1
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/LICENSE +21 -0
- package/README.md +269 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.cjs +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.cjs +6 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateMetadata.js +6 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateParam.cjs +8 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/decorateParam.js +8 -0
- package/dist/example.d.ts +4 -0
- package/dist/index.cjs +29 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/invect-nestjs.controller.cjs +1191 -0
- package/dist/invect-nestjs.controller.cjs.map +1 -0
- package/dist/invect-nestjs.controller.d.ts +331 -0
- package/dist/invect-nestjs.controller.js +1186 -0
- package/dist/invect-nestjs.controller.js.map +1 -0
- package/dist/invect-nestjs.module.cjs +52 -0
- package/dist/invect-nestjs.module.cjs.map +1 -0
- package/dist/invect-nestjs.module.d.ts +9 -0
- package/dist/invect-nestjs.module.js +47 -0
- package/dist/invect-nestjs.module.js.map +1 -0
- package/dist/invect-nestjs.service.cjs +29 -0
- package/dist/invect-nestjs.service.cjs.map +1 -0
- package/dist/invect-nestjs.service.d.ts +6 -0
- package/dist/invect-nestjs.service.js +24 -0
- package/dist/invect-nestjs.service.js.map +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invect-nestjs.controller.cjs","names":["NotFoundException","BatchProvider","BadRequestException","GraphNodeType"],"sources":["../src/invect-nestjs.controller.ts"],"sourcesContent":["import {\n Controller,\n Get,\n Post,\n Put,\n Delete,\n Body,\n Param,\n Query,\n Inject,\n Req,\n Res,\n All,\n BadRequestException,\n NotFoundException,\n HttpCode,\n} from '@nestjs/common';\nimport { BatchProvider, Invect, FlowValidationResult } from '@invect/core';\nimport type {\n NodeConfigUpdateEvent,\n NodeConfigUpdateResponse,\n CreateFlowRequest,\n UpdateFlowInput,\n InvectDefinition,\n QueryOptions,\n CreateFlowVersionRequest,\n ExecuteFlowOptions,\n SubmitSQLQueryRequest,\n SubmitPromptRequest,\n Flow,\n FlowVersion,\n FlowRun,\n NodeExecution,\n FlowInputs,\n CreateCredentialInput,\n UpdateCredentialInput,\n CredentialFilters,\n CreateTriggerInput,\n UpdateTriggerInput,\n ChatStreamEvent,\n InvectIdentity,\n} from '@invect/core';\nimport { GraphNodeType } from '@invect/core/types';\nimport type { Request, Response } from 'express';\n\ntype PostgreSqlClientLike = {\n unsafe<T = Record<string, unknown>>(statement: string, params?: unknown[]): Promise<T[]>;\n};\n\ntype SqliteClientLike = {\n prepare(sql: string): {\n all(...params: unknown[]): Record<string, unknown>[];\n run(...params: unknown[]): { changes: number };\n };\n};\n\ntype MysqlClientLike = {\n execute<T = Record<string, unknown>>(\n statement: string,\n params: unknown[],\n ): Promise<[T[] | unknown, unknown]>;\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace Express {\n interface Request {\n invectIdentity?: InvectIdentity | null;\n }\n }\n}\n\nfunction parseParamsFromQuery(value: unknown): Record<string, unknown> {\n if (!value) {\n return {};\n }\n\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch {\n return {};\n }\n }\n\n if (Array.isArray(value)) {\n const last = value[value.length - 1];\n if (typeof last === 'string') {\n try {\n return JSON.parse(last);\n } catch {\n return {};\n }\n }\n return {};\n }\n\n if (typeof value === 'object') {\n return Object.entries(value as Record<string, unknown>).reduce<Record<string, unknown>>(\n (acc, [key, entry]) => {\n acc[key] = Array.isArray(entry) ? entry[entry.length - 1] : entry;\n return acc;\n },\n {},\n );\n }\n\n return {};\n}\n\nfunction createPluginDatabaseApi(invect: Invect) {\n const connection = invect.getDatabaseConnection();\n\n const normalizeSql = (statement: string): string => {\n if (connection.type !== 'postgresql') {\n return statement;\n }\n\n let index = 0;\n return statement.replace(/\\?/g, () => `$${++index}`);\n };\n\n const query = async <T = Record<string, unknown>>(\n statement: string,\n params: unknown[] = [],\n ): Promise<T[]> => {\n switch (connection.type) {\n case 'postgresql': {\n const client = (connection.db as unknown as { $client: PostgreSqlClientLike }).$client;\n return await client.unsafe<T>(normalizeSql(statement), params);\n }\n case 'sqlite': {\n const client = (connection.db as unknown as { $client: SqliteClientLike }).$client;\n return client.prepare(statement).all(...params) as T[];\n }\n case 'mysql': {\n const client = (connection.db as unknown as { $client: MysqlClientLike }).$client;\n const [rows] = await client.execute<T>(statement, params);\n return Array.isArray(rows) ? rows : [];\n }\n }\n\n throw new Error(`Unsupported database type: ${String((connection as { type?: string }).type)}`);\n };\n\n return {\n type: connection.type,\n query,\n async execute(statement: string, params: unknown[] = []): Promise<void> {\n await query(statement, params);\n },\n };\n}\n\nfunction coerceQueryValue(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value[value.length - 1];\n }\n return value ?? undefined;\n}\n\n@Controller()\nexport class InvectController {\n constructor(@Inject('INVECT_CORE') private readonly invect: Invect) {}\n\n // =====================================\n // FLOW MANAGEMENT ROUTES\n // =====================================\n\n /**\n * GET /flows - List flows with optional filtering and pagination\n * Core method: ✅ listFlows(options?: QueryOptions<Flow>)\n */\n @Get('flows')\n async listFlows(@Query() query: Record<string, unknown>) {\n return await this.invect.listFlows(query as QueryOptions<Flow>);\n }\n\n /**\n * GET /flows/list - List flows (Express-compatible alias)\n * POST /flows/list - List flows with body filters (Express-compatible alias)\n */\n @Get('flows/list')\n async listFlowsGetAlias(@Query() query: Record<string, unknown>) {\n return await this.invect.listFlows(query as QueryOptions<Flow>);\n }\n\n @Post('flows/list')\n async listFlowsPostAlias(@Body() body: Record<string, unknown>) {\n return await this.invect.listFlows(body as QueryOptions<Flow>);\n }\n\n /**\n * POST /flows - Create a new flow\n * Core method: ✅ createFlow(flowData: CreateFlowRequest)\n */\n @Post('flows')\n async createFlow(@Body() body: CreateFlowRequest) {\n return await this.invect.createFlow(body);\n }\n\n /**\n * GET /flows/:id - Get flow by ID\n * Core method: ✅ getFlow(flowId: string)\n */\n @Get('flows/:id')\n async getFlow(@Param('id') id: string) {\n return await this.invect.getFlow(id);\n }\n\n /**\n * PUT /flows/:id - Update flow\n * Core method: ✅ updateFlow(flowId: string, updateData: UpdateFlowInput)\n */\n @Put('flows/:id')\n async updateFlow(@Param('id') id: string, @Body() body: UpdateFlowInput) {\n return await this.invect.updateFlow(id, body);\n }\n\n /**\n * DELETE /flows/:id - Delete flow\n * Core method: ✅ deleteFlow(flowId: string)\n */\n @Delete('flows/:id')\n async deleteFlow(@Param('id') id: string) {\n await this.invect.deleteFlow(id);\n // NestJS automatically returns 200 OK for successful DELETE operations\n // If you prefer 204 No Content, you can add @HttpCode(204) decorator\n }\n\n /**\n * POST /validate-flow - Validate flow definition\n * Core method: ✅ validateFlowDefinition(flowId: string, flowDefinition: InvectDefinition)\n */\n @Post('validate-flow')\n async validateFlow(\n @Body() body: { flowId: string; flowDefinition: InvectDefinition },\n ): Promise<FlowValidationResult> {\n const { flowId, flowDefinition } = body;\n return await this.invect.validateFlowDefinition(flowId, flowDefinition);\n }\n\n /**\n * GET /flows/:flowId/react-flow - Get flow data in React Flow format\n * Core method: ✅ renderToReactFlow(flowId, options)\n */\n @Get('flows/:flowId/react-flow')\n async renderToReactFlow(\n @Param('flowId') flowId: string,\n @Query('version') version?: string,\n @Query('flowRunId') flowRunId?: string,\n ) {\n const options: Record<string, unknown> = {};\n if (version) {\n options.version = version;\n }\n if (flowRunId) {\n options.flowRunId = flowRunId;\n }\n return await this.invect.renderToReactFlow(flowId, options);\n }\n\n // =====================================\n // FLOW VERSION MANAGEMENT ROUTES\n // =====================================\n\n /**\n * POST /flows/:id/versions/list - Get flow versions with optional filtering and pagination\n * Core method: ✅ listFlowVersions(flowId, options)\n */\n @Post('flows/:id/versions/list')\n async listFlowVersionsPost(@Param('id') id: string, @Body() body: Record<string, unknown>) {\n return await this.invect.listFlowVersions(id, body as QueryOptions<FlowVersion>);\n }\n\n /**\n * GET /flows/:id/versions - Get flow versions with optional filtering and pagination\n * Core method: ✅ listFlowVersions(flowId: string, options?: QueryOptions<FlowVersion>)\n */\n @Get('flows/:id/versions')\n async getFlowVersions(@Param('id') id: string, @Query() query: Record<string, unknown>) {\n return await this.invect.listFlowVersions(id, query as QueryOptions<FlowVersion>);\n }\n\n /**\n * POST /flows/:id/versions - Create flow version\n * Core method: ✅ createFlowVersion(flowId: string, versionData: CreateFlowVersionRequest)\n */\n @Post('flows/:id/versions')\n async createFlowVersion(@Param('id') id: string, @Body() body: CreateFlowVersionRequest) {\n return await this.invect.createFlowVersion(id, body);\n }\n\n /**\n * GET /flows/:id/versions/:version - Get specific flow version (supports 'latest')\n * Core method: ✅ getFlowVersion(flowId, version)\n */\n @Get('flows/:id/versions/:version')\n async getFlowVersion(@Param('id') id: string, @Param('version') version: string) {\n const result = await this.invect.getFlowVersion(id, version);\n if (!result) {\n throw new NotFoundException(`Version ${version} not found for flow ${id}`);\n }\n return result;\n }\n\n // =====================================\n // FLOW RUN EXECUTION ROUTES\n // =====================================\n\n /**\n * POST /flows/:flowId/run - Start flow execution\n * Core method: ✅ startFlowRunAsync(flowId, inputs, options)\n */\n @Post('flows/:flowId/run')\n async startFlowRun(\n @Param('flowId') flowId: string,\n @Body() body: { inputs?: Record<string, unknown>; options?: ExecuteFlowOptions },\n ) {\n const { inputs = {}, options } = body;\n return await this.invect.startFlowRunAsync(flowId, inputs as FlowInputs, options);\n }\n\n /**\n * POST /flows/:flowId/run-to-node/:nodeId - Execute flow up to a specific node\n * Core method: ✅ executeFlowToNode(flowId, targetNodeId, inputs, options)\n */\n @Post('flows/:flowId/run-to-node/:nodeId')\n async executeFlowToNode(\n @Param('flowId') flowId: string,\n @Param('nodeId') nodeId: string,\n @Body() body: { inputs?: Record<string, unknown>; options?: ExecuteFlowOptions },\n ) {\n const { inputs = {}, options } = body;\n return await this.invect.executeFlowToNode(flowId, nodeId, inputs as FlowInputs, options);\n }\n\n /**\n * POST /flow-runs/list - List flow runs with optional filtering and pagination\n * Core method: ✅ listFlowRuns(options)\n */\n @Post('flow-runs/list')\n async listFlowRunsPost(@Body() body: Record<string, unknown>) {\n return await this.invect.listFlowRuns(body as QueryOptions<FlowRun>);\n }\n\n /**\n * GET /flow-runs - Get all flow runs with optional filtering and pagination\n * Core method: ✅ listFlowRuns(options?: QueryOptions<FlowRun>)\n */\n @Get('flow-runs')\n async listFlowRuns(@Query() query: Record<string, unknown>) {\n return await this.invect.listFlowRuns(query as QueryOptions<FlowRun>);\n }\n\n /**\n * GET /flow-runs/:flowRunId - Get specific flow run by ID\n * Core method: ✅ getFlowRunById(flowRunId: string)\n */\n @Get('flow-runs/:flowRunId')\n async getFlowRun(@Param('flowRunId') flowRunId: string) {\n return await this.invect.getFlowRunById(flowRunId);\n }\n\n /**\n * GET /flows/:flowId/flow-runs - Get flow runs for a specific flow\n * Core method: ✅ listFlowRunsByFlowId(flowId: string)\n */\n @Get('flows/:flowId/flow-runs')\n async getFlowRunsByFlowId(@Param('flowId') flowId: string) {\n return await this.invect.listFlowRunsByFlowId(flowId);\n }\n\n /**\n * POST /flow-runs/:flowRunId/resume - Resume paused flow execution\n * Core method: ✅ resumeExecution(executionId: string)\n */\n @Post('flow-runs/:flowRunId/resume')\n async resumeFlowRun(@Param('flowRunId') flowRunId: string) {\n return await this.invect.resumeExecution(flowRunId);\n }\n\n /**\n * POST /flow-runs/:flowRunId/cancel - Cancel flow execution\n * Core method: ✅ cancelFlowRun(flowRunId: string)\n */\n @Post('flow-runs/:flowRunId/cancel')\n async cancelFlowRun(@Param('flowRunId') flowRunId: string) {\n return await this.invect.cancelFlowRun(flowRunId);\n }\n\n /**\n * POST /flow-runs/:flowRunId/pause - Pause flow execution\n * Core method: ✅ pauseFlowRun(flowRunId: string, reason?: string)\n */\n @Post('flow-runs/:flowRunId/pause')\n async pauseFlowRun(@Param('flowRunId') flowRunId: string, @Body() body?: { reason?: string }) {\n const reason = body?.reason;\n return await this.invect.pauseFlowRun(flowRunId, reason);\n }\n\n // =====================================\n // NODE EXECUTION ROUTES\n // =====================================\n\n /**\n * GET /flow-runs/:flowRunId/node-executions - Get node executions for a flow run\n * Core method: ✅ getNodeExecutionsByRunId(flowRunId: string)\n */\n @Get('flow-runs/:flowRunId/node-executions')\n async getNodeExecutionsByRunId(@Param('flowRunId') flowRunId: string) {\n return await this.invect.getNodeExecutionsByRunId(flowRunId);\n }\n\n /**\n * GET /flow-runs/:flowRunId/stream - SSE stream of execution events\n * Core method: ✅ createFlowRunEventStream(flowRunId: string)\n */\n @Get('flow-runs/:flowRunId/stream')\n async streamFlowRun(@Param('flowRunId') flowRunId: string, @Res() res: Response) {\n res.setHeader('Content-Type', 'text/event-stream');\n res.setHeader('Cache-Control', 'no-cache');\n res.setHeader('Connection', 'keep-alive');\n res.setHeader('X-Accel-Buffering', 'no');\n res.flushHeaders();\n\n try {\n const stream = this.invect.createFlowRunEventStream(flowRunId);\n for await (const event of stream) {\n if (res.destroyed) {\n break;\n }\n const data = JSON.stringify(event);\n res.write(`event: ${event.type}\\ndata: ${data}\\n\\n`);\n }\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Stream failed';\n if (res.headersSent) {\n res.write(`event: error\\ndata: ${JSON.stringify({ type: 'error', message })}\\n\\n`);\n } else {\n return res.status(500).json({ error: 'Internal Server Error', message });\n }\n } finally {\n res.end();\n }\n }\n\n /**\n * GET /node-executions - Get all node executions with optional filtering and pagination\n * Core method: ✅ listNodeExecutions(options?: QueryOptions<NodeExecution>)\n */\n @Get('node-executions')\n async listNodeExecutions(@Query() query: Record<string, unknown>) {\n return await this.invect.listNodeExecutions(query as QueryOptions<NodeExecution>);\n }\n\n /**\n * POST /node-executions/list - List node executions with body filters\n * Core method: ✅ listNodeExecutions(options)\n */\n @Post('node-executions/list')\n async listNodeExecutionsPost(@Body() body: Record<string, unknown>) {\n return await this.invect.listNodeExecutions(body as QueryOptions<NodeExecution>);\n }\n\n // =====================================\n // NODE DATA & TESTING ROUTES\n // =====================================\n\n /**\n * POST /node-data/sql-query - Execute SQL query for testing\n * Core method: ✅ executeSqlQuery(request: SubmitSQLQueryRequest)\n */\n @Post('node-data/sql-query')\n async executeSqlQuery(@Body() body: SubmitSQLQueryRequest) {\n return await this.invect.executeSqlQuery(body);\n }\n\n /**\n * POST /node-data/test-expression - Test a JS expression in the QuickJS sandbox\n * Core method: ✅ testJsExpression({ expression, context })\n */\n @Post('node-data/test-expression')\n async testJsExpression(@Body() body: { expression: string; context: Record<string, unknown> }) {\n return await this.invect.testJsExpression(body);\n }\n\n /**\n * POST /node-data/test-mapper - Test a mapper expression with mode semantics\n * Core method: ✅ testMapper({ expression, incomingData, mode? })\n */\n @Post('node-data/test-mapper')\n async testMapper(\n @Body()\n body: {\n expression: string;\n incomingData: Record<string, unknown>;\n mode?: 'auto' | 'iterate' | 'reshape';\n },\n ) {\n return await this.invect.testMapper(body);\n }\n\n /**\n * POST /node-data/model-query - Test model prompt\n * Core method: ✅ testModelPrompt(request: SubmitPromptRequest)\n */\n @Post('node-data/model-query')\n async testModelPrompt(@Body() body: SubmitPromptRequest) {\n return await this.invect.testModelPrompt(body);\n }\n\n /**\n * GET /node-data/models - Get available AI models\n * Core method: ✅ getAvailableModels()\n */\n @Get('node-data/models')\n async getAvailableModels(\n @Query('credentialId') credentialId?: string,\n @Query('provider') provider?: string,\n ) {\n if (credentialId) {\n return await this.invect.getModelsForCredential(credentialId);\n }\n\n if (provider) {\n const normalized = provider.trim().toUpperCase();\n if (!Object.values(BatchProvider).includes(normalized as BatchProvider)) {\n throw new BadRequestException(\n `Unsupported provider '${provider}'. Expected one of: ${Object.values(BatchProvider).join(', ')}`,\n );\n }\n return await this.invect.getModelsForProvider(normalized as BatchProvider);\n }\n\n return await this.invect.getAvailableModels();\n }\n\n /**\n * GET /node-data/databases - Get available databases\n * Core method: ✅ getAvailableDatabases()\n */\n @Get('node-data/databases')\n async getAvailableDatabases() {\n return this.invect.getAvailableDatabases();\n }\n\n /**\n * POST /node-config/update - Generic node configuration updates\n * Core method: ✅ handleNodeConfigUpdate(event)\n */\n @Post('node-config/update')\n async handleNodeConfigUpdate(\n @Body() body: NodeConfigUpdateEvent,\n ): Promise<NodeConfigUpdateResponse> {\n return await this.invect.handleNodeConfigUpdate(body);\n }\n\n @Get('node-definition/:nodeType')\n async resolveNodeDefinition(\n @Param('nodeType') rawNodeType: string,\n @Query() query: Record<string, unknown>,\n ): Promise<NodeConfigUpdateResponse> {\n // Accept both legacy GraphNodeType enum values (uppercase) and\n // action IDs (e.g. \"core.model\", \"gmail.send_message\").\n const nodeTypeParam = rawNodeType.includes('.')\n ? rawNodeType // action ID — pass through as-is\n : rawNodeType.toUpperCase(); // legacy — uppercase to match enum\n\n const isLegacyEnum = !rawNodeType.includes('.') && nodeTypeParam in GraphNodeType;\n const isActionId = rawNodeType.includes('.');\n\n if (!isLegacyEnum && !isActionId) {\n throw new BadRequestException(`Unknown node type '${rawNodeType}'`);\n }\n\n const params = parseParamsFromQuery(query.params);\n const changeField = typeof query.changeField === 'string' ? query.changeField : undefined;\n const changeValue = coerceQueryValue(query.changeValue);\n const nodeId =\n typeof query.nodeId === 'string' ? query.nodeId : `definition-${nodeTypeParam.toLowerCase()}`;\n const flowId = typeof query.flowId === 'string' ? query.flowId : undefined;\n\n return await this.invect.handleNodeConfigUpdate({\n nodeType: nodeTypeParam as GraphNodeType,\n nodeId,\n flowId,\n params,\n change: changeField ? { field: changeField, value: changeValue } : undefined,\n });\n }\n\n /**\n * GET /nodes - Get available node definitions\n * Core method: ✅ getAvailableNodes()\n */\n @Get('nodes')\n getAvailableNodes() {\n return this.invect.getAvailableNodes();\n }\n\n /**\n * GET /actions/:actionId/fields/:fieldName/options - Load dynamic field options\n * Core method: ✅ resolveFieldOptions(actionId, fieldName, deps)\n */\n @Get('actions/:actionId/fields/:fieldName/options')\n async resolveFieldOptions(\n @Param('actionId') actionId: string,\n @Param('fieldName') fieldName: string,\n @Query('deps') deps?: string,\n ): Promise<unknown> {\n let dependencyValues: Record<string, unknown> = {};\n if (deps) {\n try {\n dependencyValues = JSON.parse(deps);\n } catch {\n throw new BadRequestException('Invalid deps JSON');\n }\n }\n return await this.invect.resolveFieldOptions(actionId, fieldName, dependencyValues);\n }\n\n /**\n * POST /nodes/test - Test/execute a single node in isolation\n * Core method: ✅ testNode(nodeType, params, inputData)\n */\n @Post('nodes/test')\n async testNode(\n @Body()\n body: {\n nodeType: string;\n params: Record<string, unknown>;\n inputData?: Record<string, unknown>;\n },\n ) {\n const { nodeType, params, inputData } = body;\n if (!nodeType || typeof nodeType !== 'string') {\n throw new BadRequestException('nodeType is required and must be a string');\n }\n if (!params || typeof params !== 'object') {\n throw new BadRequestException('params is required and must be an object');\n }\n return await this.invect.testNode(nodeType, params, inputData || {});\n }\n\n // =====================================\n // CREDENTIAL ROUTES\n // =====================================\n\n /**\n * POST /credentials - Create a new credential\n */\n @Post('credentials')\n async createCredential(\n @Body()\n body: {\n name: string;\n type: string;\n authType: string;\n config: Record<string, unknown>;\n description?: string;\n workspaceId?: string;\n isShared?: boolean;\n metadata?: Record<string, unknown>;\n expiresAt?: string;\n },\n ): Promise<unknown> {\n return await this.invect.createCredential(body as CreateCredentialInput);\n }\n\n /**\n * GET /credentials - List credentials\n */\n @Get('credentials')\n async listCredentials(\n @Query('type') type?: string,\n @Query('authType') authType?: string,\n @Query('isActive') isActive?: string,\n ): Promise<unknown> {\n const filters: Record<string, unknown> = {};\n if (type) {\n filters.type = type;\n }\n if (authType) {\n filters.authType = authType;\n }\n if (isActive !== undefined) {\n filters.isActive = isActive === 'true';\n }\n return await this.invect.listCredentials(filters as CredentialFilters);\n }\n\n /**\n * GET /credentials/:id - Get a credential\n */\n @Get('credentials/:id')\n async getCredential(@Param('id') id: string): Promise<unknown> {\n return await this.invect.getCredential(id);\n }\n\n /**\n * PUT /credentials/:id - Update a credential\n */\n @Put('credentials/:id')\n async updateCredential(\n @Param('id') id: string,\n @Body() body: Record<string, unknown>,\n ): Promise<unknown> {\n return await this.invect.updateCredential(id, body as UpdateCredentialInput);\n }\n\n /**\n * DELETE /credentials/:id - Delete a credential\n */\n @Delete('credentials/:id')\n @HttpCode(204)\n async deleteCredential(@Param('id') id: string) {\n await this.invect.deleteCredential(id);\n }\n\n /**\n * POST /credentials/:id/test - Test a credential\n */\n @Post('credentials/:id/test')\n async testCredential(@Param('id') id: string) {\n return await this.invect.testCredential(id);\n }\n\n /**\n * POST /credentials/:id/track-usage - Update credential last used timestamp\n * Core method: ✅ updateCredentialLastUsed(id)\n */\n @Post('credentials/:id/track-usage')\n @HttpCode(204)\n async trackCredentialUsage(@Param('id') id: string) {\n await this.invect.updateCredentialLastUsed(id);\n }\n\n /**\n * GET /credentials/expiring - Get credentials expiring soon\n * Core method: ✅ getExpiringCredentials(daysUntilExpiry?)\n */\n @Get('credentials/expiring')\n async getExpiringCredentials(\n @Query('daysUntilExpiry') daysUntilExpiry?: string,\n ): Promise<unknown> {\n const days = daysUntilExpiry ? parseInt(daysUntilExpiry) : 7;\n return await this.invect.getExpiringCredentials(days);\n }\n\n /**\n * POST /credentials/test-request - Proxy HTTP request to test a credential\n */\n @Post('credentials/test-request')\n async testCredentialRequest(\n @Body()\n body: {\n url: string;\n method?: string;\n headers?: Record<string, string>;\n body?: unknown;\n },\n ) {\n const { url, method = 'GET', headers = {}, body: reqBody } = body;\n if (!url) {\n throw new BadRequestException('URL is required');\n }\n\n const fetchOptions: RequestInit = { method, headers };\n if (reqBody && ['POST', 'PUT', 'PATCH'].includes(method)) {\n fetchOptions.body = typeof reqBody === 'string' ? reqBody : JSON.stringify(reqBody);\n }\n\n const response = await fetch(url, fetchOptions);\n const responseText = await response.text();\n let responseBody: unknown;\n try {\n responseBody = JSON.parse(responseText);\n } catch {\n responseBody = responseText;\n }\n\n return {\n status: response.status,\n statusText: response.statusText,\n ok: response.ok,\n body: responseBody,\n };\n }\n\n // =====================================\n // OAUTH2 ROUTES\n // =====================================\n\n @Get('credentials/oauth2/providers')\n getOAuth2Providers() {\n return this.invect.getOAuth2Providers();\n }\n\n @Get('credentials/oauth2/providers/:providerId')\n getOAuth2Provider(@Param('providerId') providerId: string) {\n const provider = this.invect.getOAuth2Provider(providerId);\n if (!provider) {\n throw new NotFoundException('OAuth2 provider not found');\n }\n return provider;\n }\n\n @Post('credentials/oauth2/start')\n startOAuth2Flow(\n @Body()\n body: {\n providerId: string;\n clientId: string;\n clientSecret: string;\n redirectUri: string;\n scopes?: string[];\n returnUrl?: string;\n credentialName?: string;\n },\n ) {\n const { providerId, clientId, clientSecret, redirectUri, scopes, returnUrl, credentialName } =\n body;\n if (!providerId || !clientId || !clientSecret || !redirectUri) {\n throw new BadRequestException(\n 'Missing required fields: providerId, clientId, clientSecret, redirectUri',\n );\n }\n return this.invect.startOAuth2Flow(\n providerId,\n { clientId, clientSecret, redirectUri },\n { scopes, returnUrl, credentialName },\n );\n }\n\n @Post('credentials/oauth2/callback')\n async handleOAuth2Callback(\n @Body()\n body: {\n code: string;\n state: string;\n clientId: string;\n clientSecret: string;\n redirectUri: string;\n },\n ): Promise<unknown> {\n const { code, state, clientId, clientSecret, redirectUri } = body;\n if (!code || !state || !clientId || !clientSecret || !redirectUri) {\n throw new BadRequestException(\n 'Missing required fields: code, state, clientId, clientSecret, redirectUri',\n );\n }\n return await this.invect.handleOAuth2Callback(code, state, {\n clientId,\n clientSecret,\n redirectUri,\n });\n }\n\n @Post('credentials/:id/refresh')\n async refreshOAuth2Credential(@Param('id') id: string): Promise<unknown> {\n return await this.invect.refreshOAuth2Credential(id);\n }\n\n // =====================================\n // DASHBOARD ROUTES\n // =====================================\n\n @Get('dashboard/stats')\n async getDashboardStats() {\n return await this.invect.getDashboardStats();\n }\n\n // =====================================\n // CREDENTIAL WEBHOOK ROUTES\n // =====================================\n\n // =====================================\n // TRIGGER MANAGEMENT ROUTES\n // =====================================\n\n /**\n * GET /flows/:flowId/triggers - List triggers for a flow\n */\n @Get('flows/:flowId/triggers')\n async listTriggersForFlow(@Param('flowId') flowId: string) {\n return await this.invect.listTriggersForFlow(flowId);\n }\n\n /**\n * POST /flows/:flowId/triggers - Create a trigger\n */\n @Post('flows/:flowId/triggers')\n async createTrigger(@Param('flowId') flowId: string, @Body() body: Record<string, unknown>) {\n return await this.invect.createTrigger({ ...body, flowId } as CreateTriggerInput);\n }\n\n /**\n * POST /flows/:flowId/triggers/sync - Sync triggers from definition\n */\n @Post('flows/:flowId/triggers/sync')\n async syncTriggersForFlow(\n @Param('flowId') flowId: string,\n @Body()\n body: {\n definition: { nodes: Array<{ id: string; type: string; params?: Record<string, unknown> }> };\n },\n ) {\n return await this.invect.syncTriggersForFlow(flowId, body.definition);\n }\n\n /**\n * GET /triggers/:triggerId - Get a trigger\n */\n @Get('triggers/:triggerId')\n async getTrigger(@Param('triggerId') triggerId: string) {\n const trigger = await this.invect.getTrigger(triggerId);\n if (!trigger) {\n throw new NotFoundException(`Trigger ${triggerId} not found`);\n }\n return trigger;\n }\n\n /**\n * PUT /triggers/:triggerId - Update a trigger\n */\n @Put('triggers/:triggerId')\n async updateTrigger(\n @Param('triggerId') triggerId: string,\n @Body() body: Record<string, unknown>,\n ) {\n const trigger = await this.invect.updateTrigger(triggerId, body as UpdateTriggerInput);\n if (!trigger) {\n throw new NotFoundException(`Trigger ${triggerId} not found`);\n }\n return trigger;\n }\n\n /**\n * DELETE /triggers/:triggerId - Delete a trigger\n */\n @Delete('triggers/:triggerId')\n @HttpCode(204)\n async deleteTrigger(@Param('triggerId') triggerId: string) {\n await this.invect.deleteTrigger(triggerId);\n }\n\n // =====================================\n // AGENT TOOLS ROUTES\n // =====================================\n\n /**\n * GET /agent/tools - List all available agent tools\n */\n @Get('agent/tools')\n getAgentTools() {\n return this.invect.getAgentTools();\n }\n\n // =====================================\n // CHAT ASSISTANT ROUTES\n // =====================================\n\n @Get('chat/status')\n getChatStatus() {\n return { enabled: this.invect.isChatEnabled() };\n }\n\n @Post('chat')\n async streamChat(\n @Body() body: { messages: unknown[]; context?: Record<string, unknown> },\n @Req() req: Request,\n @Res() res: Response,\n ) {\n const { messages, context } = body;\n if (!messages || !Array.isArray(messages)) {\n return res.status(400).json({\n error: 'Validation Error',\n message: '\"messages\" must be an array of chat messages',\n });\n }\n\n res.setHeader('Content-Type', 'text/event-stream');\n res.setHeader('Cache-Control', 'no-cache');\n res.setHeader('Connection', 'keep-alive');\n res.setHeader('X-Accel-Buffering', 'no');\n res.flushHeaders();\n\n try {\n const stream = await this.invect.createChatStream({\n messages: messages as Array<{\n role: string;\n content: string;\n toolCalls?: unknown[];\n toolCallId?: string;\n }>,\n context: context || {},\n });\n for await (const event of stream) {\n if (res.destroyed) {\n break;\n }\n const data = JSON.stringify(event);\n res.write(`event: ${(event as ChatStreamEvent).type}\\ndata: ${data}\\n\\n`);\n }\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Chat stream failed';\n if (res.headersSent) {\n res.write(\n `event: error\\ndata: ${JSON.stringify({ type: 'error', message, recoverable: false })}\\n\\n`,\n );\n } else {\n return res.status(500).json({ error: 'Internal Server Error', message });\n }\n } finally {\n res.end();\n }\n }\n\n // =====================================\n // CHAT MESSAGE PERSISTENCE ROUTES\n // =====================================\n\n @Get('chat/messages/:flowId')\n async getChatMessages(@Param('flowId') flowId: string): Promise<unknown> {\n return await this.invect.getChatMessages(flowId);\n }\n\n @Put('chat/messages/:flowId')\n async saveChatMessages(\n @Param('flowId') flowId: string,\n @Body() body: { messages: unknown[] },\n ): Promise<unknown> {\n if (!body.messages || !Array.isArray(body.messages)) {\n throw new BadRequestException('\"messages\" must be an array');\n }\n return await this.invect.saveChatMessages(\n flowId,\n body.messages as Array<{\n role: 'user' | 'assistant' | 'system' | 'tool';\n content: string;\n toolMeta?: Record<string, unknown> | null;\n }>,\n );\n }\n\n @Delete('chat/messages/:flowId')\n async deleteChatMessages(@Param('flowId') flowId: string) {\n await this.invect.deleteChatMessages(flowId);\n return { success: true };\n }\n\n // =====================================\n // PLUGIN ENDPOINTS\n // Catch-all that delegates to plugin-defined routes\n // =====================================\n\n @All('plugins/*')\n async handlePluginEndpoint(@Req() req: Request, @Res() res: Response) {\n const endpoints = this.invect.getPluginEndpoints();\n const pluginPath = (req.path as string).replace(/^.*\\/plugins/, '') || '/';\n const method = req.method.toUpperCase();\n\n const matchedEndpoint = endpoints.find((ep) => {\n if (ep.method !== method) {\n return false;\n }\n const pattern = ep.path.replace(/:([^/]+)/g, '([^/]+)');\n return new RegExp(`^${pattern}$`).test(pluginPath);\n });\n\n if (!matchedEndpoint) {\n return res.status(404).json({\n error: 'Not Found',\n message: `Plugin route ${method} ${pluginPath} not found`,\n });\n }\n\n // Extract path params\n const paramNames: string[] = [];\n const paramPattern = matchedEndpoint.path.replace(/:([^/]+)/g, (_m: string, name: string) => {\n paramNames.push(name);\n return '([^/]+)';\n });\n const paramMatch = new RegExp(`^${paramPattern}$`).exec(pluginPath);\n const params: Record<string, string> = {};\n if (paramMatch) {\n paramNames.forEach((name, i) => {\n params[name] = paramMatch[i + 1] || '';\n });\n }\n\n // Check endpoint-level auth\n if (!matchedEndpoint.isPublic && matchedEndpoint.permission) {\n const identity = req.invectIdentity ?? null;\n if (!this.invect.hasPermission(identity, matchedEndpoint.permission)) {\n return res.status(403).json({\n error: 'Forbidden',\n message: `Missing permission: ${matchedEndpoint.permission}`,\n });\n }\n }\n\n const result = await matchedEndpoint.handler({\n body: req.body || {},\n params,\n query: (req.query || {}) as Record<string, string | undefined>,\n headers: req.headers as Record<string, string | undefined>,\n identity: req.invectIdentity ?? null,\n database: createPluginDatabaseApi(this.invect),\n request: req as unknown as globalThis.Request,\n core: {\n getPermissions: (identity) => this.invect.getPermissions(identity),\n getAvailableRoles: () => this.invect.getAvailableRoles(),\n getResolvedRole: (identity) => this.invect.getAuthService().getResolvedRole(identity),\n isFlowAccessTableEnabled: () => this.invect.isFlowAccessTableEnabled(),\n listFlowAccess: (flowId) => this.invect.listFlowAccess(flowId),\n grantFlowAccess: (input) => this.invect.grantFlowAccess(input),\n revokeFlowAccess: (accessId) => this.invect.revokeFlowAccess(accessId),\n getAccessibleFlowIds: (userId, teamIds) =>\n this.invect.getAccessibleFlowIds(userId, teamIds),\n getFlowPermission: (flowId, userId, teamIds) =>\n this.invect.getFlowPermission(flowId, userId, teamIds),\n authorize: (context) => this.invect.authorize(context),\n },\n });\n\n // Handle raw Response objects\n if (result instanceof Response) {\n const arrayBuf = await result.arrayBuffer();\n res.status(result.status);\n result.headers.forEach((value: string, key: string) => res.setHeader(key, value));\n res.send(Buffer.from(arrayBuf));\n return;\n }\n\n // Handle streaming responses\n if ('stream' in result && result.stream) {\n res.status(result.status || 200);\n res.setHeader('Content-Type', 'text/event-stream');\n const streamResult = result as { status?: number; stream: ReadableStream };\n const reader = streamResult.stream.getReader();\n const pump = async () => {\n const { done, value } = await reader.read();\n if (done) {\n res.end();\n return;\n }\n res.write(value);\n await pump();\n };\n await pump();\n return;\n }\n\n // Standard JSON response\n const jsonResult = result as { status?: number; body: unknown };\n return res.status(jsonResult.status || 200).json(jsonResult.body);\n }\n}\n"],"mappings":";;;;;;;;AAwEA,SAAS,qBAAqB,OAAyC;AACrE,KAAI,CAAC,MACH,QAAO,EAAE;AAGX,KAAI,OAAO,UAAU,SACnB,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;SAClB;AACN,SAAO,EAAE;;AAIb,KAAI,MAAM,QAAQ,MAAM,EAAE;EACxB,MAAM,OAAO,MAAM,MAAM,SAAS;AAClC,MAAI,OAAO,SAAS,SAClB,KAAI;AACF,UAAO,KAAK,MAAM,KAAK;UACjB;AACN,UAAO,EAAE;;AAGb,SAAO,EAAE;;AAGX,KAAI,OAAO,UAAU,SACnB,QAAO,OAAO,QAAQ,MAAiC,CAAC,QACrD,KAAK,CAAC,KAAK,WAAW;AACrB,MAAI,OAAO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I;oEACoB,KAAK,CAAA;;;;;;yBAQlC,uBAAuB;oEAEnB,kBAAkB,CAAA;;;;;;0BASrB,2BAA2B;oEAExB,CAAA;;;;;;yBAuCJ,+BAA+B;;;;;;yBAK/B,2CAA2C;oEACvB,aAAa,CAAA;;;;;;0BAQhC,2BAA2B;oEAExB,CAAA;;;;;;0BAyBH,8BAA8B;oEAE3B,CAAA;;;;;;0BAsBH,0BAA0B;oEACK,KAAK,CAAA;;;;;;yBAQrC,kBAAkB;;;;;;yBAgBlB,yBAAyB;oEACG,SAAS,CAAA;;;;;;0BAOpC,yBAAyB;oEACJ,SAAS,CAAA;oEAAwB,CAAA;;;;;;0BAOtD,8BAA8B;oEAE3B,SAAS,CAAA;oEACT,CAAA;;;;;;yBAWJ,sBAAsB;oEACH,YAAY,CAAA;;;;;;yBAW/B,sBAAsB;oEAElB,YAAY,CAAA;oEACZ,CAAA;;;;;;4BAYD,sBAAsB;8BACpB,IAAI;oEACa,YAAY,CAAA;;;;;;yBAWlC,cAAc;;;;;;yBASd,cAAc;;;;;;0BAKb,OAAO;oEAEJ,CAAA;mEACD,CAAA;mEACA,CAAA;;;;;;;;;;yBAmDH,wBAAwB;oEACA,SAAS,CAAA;;;;;;yBAIjC,wBAAwB;oEAEpB,SAAS,CAAA;oEACT,CAAA;;;;;;4BAeD,wBAAwB;oEACA,SAAS,CAAA;;;;;;yBAUpC,YAAY;mEACgB,CAAA;mEAAqB,CAAA;;;;;;iCAj4B3C;qEAES,cAAc,CAAA"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { Invect, FlowValidationResult } from '@invect/core';
|
|
2
|
+
import type { NodeConfigUpdateEvent, NodeConfigUpdateResponse, CreateFlowRequest, UpdateFlowInput, InvectDefinition, CreateFlowVersionRequest, ExecuteFlowOptions, SubmitSQLQueryRequest, SubmitPromptRequest, Flow, FlowRun, NodeExecution, InvectIdentity } from '@invect/core';
|
|
3
|
+
import type { Request, Response } from 'express';
|
|
4
|
+
declare global {
|
|
5
|
+
namespace Express {
|
|
6
|
+
interface Request {
|
|
7
|
+
invectIdentity?: InvectIdentity | null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare class InvectController {
|
|
12
|
+
private readonly invect;
|
|
13
|
+
constructor(invect: Invect);
|
|
14
|
+
listFlows(query: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<Flow>>;
|
|
15
|
+
listFlowsGetAlias(query: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<Flow>>;
|
|
16
|
+
listFlowsPostAlias(body: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<Flow>>;
|
|
17
|
+
createFlow(body: CreateFlowRequest): Promise<Flow>;
|
|
18
|
+
getFlow(id: string): Promise<Flow>;
|
|
19
|
+
updateFlow(id: string, body: UpdateFlowInput): Promise<Flow>;
|
|
20
|
+
deleteFlow(id: string): Promise<void>;
|
|
21
|
+
validateFlow(body: {
|
|
22
|
+
flowId: string;
|
|
23
|
+
flowDefinition: InvectDefinition;
|
|
24
|
+
}): Promise<FlowValidationResult>;
|
|
25
|
+
renderToReactFlow(flowId: string, version?: string, flowRunId?: string): Promise<import("@invect/core").ReactFlowData>;
|
|
26
|
+
listFlowVersionsPost(id: string, body: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<{
|
|
27
|
+
version: number;
|
|
28
|
+
flowId: string;
|
|
29
|
+
invectDefinition: {
|
|
30
|
+
nodes: {
|
|
31
|
+
id: string;
|
|
32
|
+
type: string;
|
|
33
|
+
params: Record<string, unknown>;
|
|
34
|
+
position?: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} | undefined;
|
|
38
|
+
label?: string | undefined;
|
|
39
|
+
referenceId?: string | undefined;
|
|
40
|
+
_loop?: unknown;
|
|
41
|
+
mapper?: {
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
expression: string;
|
|
44
|
+
mode: "auto" | "iterate" | "reshape";
|
|
45
|
+
outputMode: "object" | "array" | "concat" | "first" | "last";
|
|
46
|
+
concurrency: number;
|
|
47
|
+
onEmpty: "error" | "skip";
|
|
48
|
+
keyField?: string | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}[];
|
|
51
|
+
edges: {
|
|
52
|
+
id: string;
|
|
53
|
+
source: string;
|
|
54
|
+
target: string;
|
|
55
|
+
sourceHandle?: string | undefined;
|
|
56
|
+
targetHandle?: string | undefined;
|
|
57
|
+
metadata?: Record<string, unknown> | undefined;
|
|
58
|
+
}[];
|
|
59
|
+
metadata?: Record<string, unknown> | undefined;
|
|
60
|
+
};
|
|
61
|
+
createdAt: string;
|
|
62
|
+
createdBy: string | null;
|
|
63
|
+
}>>;
|
|
64
|
+
getFlowVersions(id: string, query: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<{
|
|
65
|
+
version: number;
|
|
66
|
+
flowId: string;
|
|
67
|
+
invectDefinition: {
|
|
68
|
+
nodes: {
|
|
69
|
+
id: string;
|
|
70
|
+
type: string;
|
|
71
|
+
params: Record<string, unknown>;
|
|
72
|
+
position?: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
} | undefined;
|
|
76
|
+
label?: string | undefined;
|
|
77
|
+
referenceId?: string | undefined;
|
|
78
|
+
_loop?: unknown;
|
|
79
|
+
mapper?: {
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
expression: string;
|
|
82
|
+
mode: "auto" | "iterate" | "reshape";
|
|
83
|
+
outputMode: "object" | "array" | "concat" | "first" | "last";
|
|
84
|
+
concurrency: number;
|
|
85
|
+
onEmpty: "error" | "skip";
|
|
86
|
+
keyField?: string | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
}[];
|
|
89
|
+
edges: {
|
|
90
|
+
id: string;
|
|
91
|
+
source: string;
|
|
92
|
+
target: string;
|
|
93
|
+
sourceHandle?: string | undefined;
|
|
94
|
+
targetHandle?: string | undefined;
|
|
95
|
+
metadata?: Record<string, unknown> | undefined;
|
|
96
|
+
}[];
|
|
97
|
+
metadata?: Record<string, unknown> | undefined;
|
|
98
|
+
};
|
|
99
|
+
createdAt: string;
|
|
100
|
+
createdBy: string | null;
|
|
101
|
+
}>>;
|
|
102
|
+
createFlowVersion(id: string, body: CreateFlowVersionRequest): Promise<{
|
|
103
|
+
version: number;
|
|
104
|
+
flowId: string;
|
|
105
|
+
invectDefinition: {
|
|
106
|
+
nodes: {
|
|
107
|
+
id: string;
|
|
108
|
+
type: string;
|
|
109
|
+
params: Record<string, unknown>;
|
|
110
|
+
position?: {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
} | undefined;
|
|
114
|
+
label?: string | undefined;
|
|
115
|
+
referenceId?: string | undefined;
|
|
116
|
+
_loop?: unknown;
|
|
117
|
+
mapper?: {
|
|
118
|
+
enabled: boolean;
|
|
119
|
+
expression: string;
|
|
120
|
+
mode: "auto" | "iterate" | "reshape";
|
|
121
|
+
outputMode: "object" | "array" | "concat" | "first" | "last";
|
|
122
|
+
concurrency: number;
|
|
123
|
+
onEmpty: "error" | "skip";
|
|
124
|
+
keyField?: string | undefined;
|
|
125
|
+
} | undefined;
|
|
126
|
+
}[];
|
|
127
|
+
edges: {
|
|
128
|
+
id: string;
|
|
129
|
+
source: string;
|
|
130
|
+
target: string;
|
|
131
|
+
sourceHandle?: string | undefined;
|
|
132
|
+
targetHandle?: string | undefined;
|
|
133
|
+
metadata?: Record<string, unknown> | undefined;
|
|
134
|
+
}[];
|
|
135
|
+
metadata?: Record<string, unknown> | undefined;
|
|
136
|
+
};
|
|
137
|
+
createdAt: string;
|
|
138
|
+
createdBy: string | null;
|
|
139
|
+
}>;
|
|
140
|
+
getFlowVersion(id: string, version: string): Promise<{
|
|
141
|
+
version: number;
|
|
142
|
+
flowId: string;
|
|
143
|
+
invectDefinition: {
|
|
144
|
+
nodes: {
|
|
145
|
+
id: string;
|
|
146
|
+
type: string;
|
|
147
|
+
params: Record<string, unknown>;
|
|
148
|
+
position?: {
|
|
149
|
+
x: number;
|
|
150
|
+
y: number;
|
|
151
|
+
} | undefined;
|
|
152
|
+
label?: string | undefined;
|
|
153
|
+
referenceId?: string | undefined;
|
|
154
|
+
_loop?: unknown;
|
|
155
|
+
mapper?: {
|
|
156
|
+
enabled: boolean;
|
|
157
|
+
expression: string;
|
|
158
|
+
mode: "auto" | "iterate" | "reshape";
|
|
159
|
+
outputMode: "object" | "array" | "concat" | "first" | "last";
|
|
160
|
+
concurrency: number;
|
|
161
|
+
onEmpty: "error" | "skip";
|
|
162
|
+
keyField?: string | undefined;
|
|
163
|
+
} | undefined;
|
|
164
|
+
}[];
|
|
165
|
+
edges: {
|
|
166
|
+
id: string;
|
|
167
|
+
source: string;
|
|
168
|
+
target: string;
|
|
169
|
+
sourceHandle?: string | undefined;
|
|
170
|
+
targetHandle?: string | undefined;
|
|
171
|
+
metadata?: Record<string, unknown> | undefined;
|
|
172
|
+
}[];
|
|
173
|
+
metadata?: Record<string, unknown> | undefined;
|
|
174
|
+
};
|
|
175
|
+
createdAt: string;
|
|
176
|
+
createdBy: string | null;
|
|
177
|
+
}>;
|
|
178
|
+
startFlowRun(flowId: string, body: {
|
|
179
|
+
inputs?: Record<string, unknown>;
|
|
180
|
+
options?: ExecuteFlowOptions;
|
|
181
|
+
}): Promise<import("@invect/core").FlowRunResult>;
|
|
182
|
+
executeFlowToNode(flowId: string, nodeId: string, body: {
|
|
183
|
+
inputs?: Record<string, unknown>;
|
|
184
|
+
options?: ExecuteFlowOptions;
|
|
185
|
+
}): Promise<import("@invect/core").FlowRunResult>;
|
|
186
|
+
listFlowRunsPost(body: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<FlowRun>>;
|
|
187
|
+
listFlowRuns(query: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<FlowRun>>;
|
|
188
|
+
getFlowRun(flowRunId: string): Promise<FlowRun>;
|
|
189
|
+
getFlowRunsByFlowId(flowId: string): Promise<import("@invect/core").PaginatedResponse<FlowRun>>;
|
|
190
|
+
resumeFlowRun(flowRunId: string): Promise<{
|
|
191
|
+
message: string;
|
|
192
|
+
timestamp: string;
|
|
193
|
+
}>;
|
|
194
|
+
cancelFlowRun(flowRunId: string): Promise<{
|
|
195
|
+
message: string;
|
|
196
|
+
timestamp: string;
|
|
197
|
+
}>;
|
|
198
|
+
pauseFlowRun(flowRunId: string, body?: {
|
|
199
|
+
reason?: string;
|
|
200
|
+
}): Promise<{
|
|
201
|
+
message: string;
|
|
202
|
+
timestamp: string;
|
|
203
|
+
}>;
|
|
204
|
+
getNodeExecutionsByRunId(flowRunId: string): Promise<NodeExecution[]>;
|
|
205
|
+
streamFlowRun(flowRunId: string, res: Response): Promise<Response<any, Record<string, any>> | undefined>;
|
|
206
|
+
listNodeExecutions(query: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<NodeExecution>>;
|
|
207
|
+
listNodeExecutionsPost(body: Record<string, unknown>): Promise<import("@invect/core").PaginatedResponse<NodeExecution>>;
|
|
208
|
+
executeSqlQuery(body: SubmitSQLQueryRequest): Promise<import("@invect/core").SQLQueryResult>;
|
|
209
|
+
testJsExpression(body: {
|
|
210
|
+
expression: string;
|
|
211
|
+
context: Record<string, unknown>;
|
|
212
|
+
}): Promise<{
|
|
213
|
+
success: boolean;
|
|
214
|
+
result?: unknown;
|
|
215
|
+
error?: string;
|
|
216
|
+
}>;
|
|
217
|
+
testMapper(body: {
|
|
218
|
+
expression: string;
|
|
219
|
+
incomingData: Record<string, unknown>;
|
|
220
|
+
mode?: 'auto' | 'iterate' | 'reshape';
|
|
221
|
+
}): Promise<{
|
|
222
|
+
success: boolean;
|
|
223
|
+
result?: unknown;
|
|
224
|
+
resultType?: "array" | "object" | "primitive";
|
|
225
|
+
itemCount?: number;
|
|
226
|
+
error?: string;
|
|
227
|
+
}>;
|
|
228
|
+
testModelPrompt(body: SubmitPromptRequest): Promise<unknown>;
|
|
229
|
+
getAvailableModels(credentialId?: string, provider?: string): Promise<unknown>;
|
|
230
|
+
getAvailableDatabases(): Promise<{
|
|
231
|
+
connectionString: string;
|
|
232
|
+
type: "postgresql" | "sqlite" | "mysql";
|
|
233
|
+
id: string;
|
|
234
|
+
name?: string | undefined;
|
|
235
|
+
}[]>;
|
|
236
|
+
handleNodeConfigUpdate(body: NodeConfigUpdateEvent): Promise<NodeConfigUpdateResponse>;
|
|
237
|
+
resolveNodeDefinition(rawNodeType: string, query: Record<string, unknown>): Promise<NodeConfigUpdateResponse>;
|
|
238
|
+
getAvailableNodes(): import("@invect/core").NodeDefinition[];
|
|
239
|
+
resolveFieldOptions(actionId: string, fieldName: string, deps?: string): Promise<unknown>;
|
|
240
|
+
testNode(body: {
|
|
241
|
+
nodeType: string;
|
|
242
|
+
params: Record<string, unknown>;
|
|
243
|
+
inputData?: Record<string, unknown>;
|
|
244
|
+
}): Promise<{
|
|
245
|
+
success: boolean;
|
|
246
|
+
output?: Record<string, unknown>;
|
|
247
|
+
error?: string;
|
|
248
|
+
}>;
|
|
249
|
+
createCredential(body: {
|
|
250
|
+
name: string;
|
|
251
|
+
type: string;
|
|
252
|
+
authType: string;
|
|
253
|
+
config: Record<string, unknown>;
|
|
254
|
+
description?: string;
|
|
255
|
+
workspaceId?: string;
|
|
256
|
+
isShared?: boolean;
|
|
257
|
+
metadata?: Record<string, unknown>;
|
|
258
|
+
expiresAt?: string;
|
|
259
|
+
}): Promise<unknown>;
|
|
260
|
+
listCredentials(type?: string, authType?: string, isActive?: string): Promise<unknown>;
|
|
261
|
+
getCredential(id: string): Promise<unknown>;
|
|
262
|
+
updateCredential(id: string, body: Record<string, unknown>): Promise<unknown>;
|
|
263
|
+
deleteCredential(id: string): Promise<void>;
|
|
264
|
+
testCredential(id: string): Promise<{
|
|
265
|
+
success: boolean;
|
|
266
|
+
error?: string;
|
|
267
|
+
}>;
|
|
268
|
+
trackCredentialUsage(id: string): Promise<void>;
|
|
269
|
+
getExpiringCredentials(daysUntilExpiry?: string): Promise<unknown>;
|
|
270
|
+
testCredentialRequest(body: {
|
|
271
|
+
url: string;
|
|
272
|
+
method?: string;
|
|
273
|
+
headers?: Record<string, string>;
|
|
274
|
+
body?: unknown;
|
|
275
|
+
}): Promise<{
|
|
276
|
+
status: number;
|
|
277
|
+
statusText: string;
|
|
278
|
+
ok: boolean;
|
|
279
|
+
body: unknown;
|
|
280
|
+
}>;
|
|
281
|
+
getOAuth2Providers(): import("@invect/core").OAuth2ProviderDefinition[];
|
|
282
|
+
getOAuth2Provider(providerId: string): import("@invect/core").OAuth2ProviderDefinition;
|
|
283
|
+
startOAuth2Flow(body: {
|
|
284
|
+
providerId: string;
|
|
285
|
+
clientId: string;
|
|
286
|
+
clientSecret: string;
|
|
287
|
+
redirectUri: string;
|
|
288
|
+
scopes?: string[];
|
|
289
|
+
returnUrl?: string;
|
|
290
|
+
credentialName?: string;
|
|
291
|
+
}): import("@invect/core").OAuth2StartResult;
|
|
292
|
+
handleOAuth2Callback(body: {
|
|
293
|
+
code: string;
|
|
294
|
+
state: string;
|
|
295
|
+
clientId: string;
|
|
296
|
+
clientSecret: string;
|
|
297
|
+
redirectUri: string;
|
|
298
|
+
}): Promise<unknown>;
|
|
299
|
+
refreshOAuth2Credential(id: string): Promise<unknown>;
|
|
300
|
+
getDashboardStats(): Promise<import("@invect/core").DashboardStats>;
|
|
301
|
+
listTriggersForFlow(flowId: string): Promise<import("@invect/core").FlowTriggerRegistration[]>;
|
|
302
|
+
createTrigger(flowId: string, body: Record<string, unknown>): Promise<import("@invect/core").FlowTriggerRegistration>;
|
|
303
|
+
syncTriggersForFlow(flowId: string, body: {
|
|
304
|
+
definition: {
|
|
305
|
+
nodes: Array<{
|
|
306
|
+
id: string;
|
|
307
|
+
type: string;
|
|
308
|
+
params?: Record<string, unknown>;
|
|
309
|
+
}>;
|
|
310
|
+
};
|
|
311
|
+
}): Promise<import("@invect/core").FlowTriggerRegistration[]>;
|
|
312
|
+
getTrigger(triggerId: string): Promise<import("@invect/core").FlowTriggerRegistration>;
|
|
313
|
+
updateTrigger(triggerId: string, body: Record<string, unknown>): Promise<import("@invect/core").FlowTriggerRegistration>;
|
|
314
|
+
deleteTrigger(triggerId: string): Promise<void>;
|
|
315
|
+
getAgentTools(): import("@invect/core").AgentToolDefinition[];
|
|
316
|
+
getChatStatus(): {
|
|
317
|
+
enabled: boolean;
|
|
318
|
+
};
|
|
319
|
+
streamChat(body: {
|
|
320
|
+
messages: unknown[];
|
|
321
|
+
context?: Record<string, unknown>;
|
|
322
|
+
}, req: Request, res: Response): Promise<Response<any, Record<string, any>> | undefined>;
|
|
323
|
+
getChatMessages(flowId: string): Promise<unknown>;
|
|
324
|
+
saveChatMessages(flowId: string, body: {
|
|
325
|
+
messages: unknown[];
|
|
326
|
+
}): Promise<unknown>;
|
|
327
|
+
deleteChatMessages(flowId: string): Promise<{
|
|
328
|
+
success: boolean;
|
|
329
|
+
}>;
|
|
330
|
+
handlePluginEndpoint(req: Request, res: Response): Promise<Response<any, Record<string, any>> | undefined>;
|
|
331
|
+
}
|