@igoruehara/canvas-flow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +152 -0
- package/bin/canvas-flow.js +1132 -0
- package/package.json +68 -0
- package/public/assets/index-PCQkqMUe.css +1 -0
- package/public/assets/index-qV8twxcq.js +767 -0
- package/public/index.html +13 -0
- package/server/api-key/api-key-connect-provider.d.ts +104 -0
- package/server/api-key/api-key-connect-provider.js +14 -0
- package/server/api-key/api-key-connect-provider.js.map +1 -0
- package/server/api-key/api-key-constants-model.d.ts +2 -0
- package/server/api-key/api-key-constants-model.js +6 -0
- package/server/api-key/api-key-constants-model.js.map +1 -0
- package/server/api-key/api-key-controller.d.ts +12 -0
- package/server/api-key/api-key-controller.js +86 -0
- package/server/api-key/api-key-controller.js.map +1 -0
- package/server/api-key/api-key-module.d.ts +2 -0
- package/server/api-key/api-key-module.js +27 -0
- package/server/api-key/api-key-module.js.map +1 -0
- package/server/api-key/api-key-schema.d.ts +72 -0
- package/server/api-key/api-key-schema.js +98 -0
- package/server/api-key/api-key-schema.js.map +1 -0
- package/server/api-key/api-key-service.d.ts +45 -0
- package/server/api-key/api-key-service.js +151 -0
- package/server/api-key/api-key-service.js.map +1 -0
- package/server/api-key/dto/create-api-key.dto.d.ts +8 -0
- package/server/api-key/dto/create-api-key.dto.js +7 -0
- package/server/api-key/dto/create-api-key.dto.js.map +1 -0
- package/server/app.module.d.ts +2 -0
- package/server/app.module.js +53 -0
- package/server/app.module.js.map +1 -0
- package/server/auth/auth-connect-provider.d.ts +140 -0
- package/server/auth/auth-connect-provider.js +20 -0
- package/server/auth/auth-connect-provider.js.map +1 -0
- package/server/auth/auth-constants-model.d.ts +4 -0
- package/server/auth/auth-constants-model.js +8 -0
- package/server/auth/auth-constants-model.js.map +1 -0
- package/server/auth/auth-controller.d.ts +25 -0
- package/server/auth/auth-controller.js +96 -0
- package/server/auth/auth-controller.js.map +1 -0
- package/server/auth/auth-module.d.ts +2 -0
- package/server/auth/auth-module.js +26 -0
- package/server/auth/auth-module.js.map +1 -0
- package/server/auth/auth-organization-schema.d.ts +44 -0
- package/server/auth/auth-organization-schema.js +62 -0
- package/server/auth/auth-organization-schema.js.map +1 -0
- package/server/auth/auth-schema.d.ts +56 -0
- package/server/auth/auth-schema.js +77 -0
- package/server/auth/auth-schema.js.map +1 -0
- package/server/auth/auth-service.d.ts +64 -0
- package/server/auth/auth-service.js +343 -0
- package/server/auth/auth-service.js.map +1 -0
- package/server/canvas-flow/canvas-flow-connect-provider.d.ts +278 -0
- package/server/canvas-flow/canvas-flow-connect-provider.js +24 -0
- package/server/canvas-flow/canvas-flow-connect-provider.js.map +1 -0
- package/server/canvas-flow/canvas-flow-constants-model.d.ts +6 -0
- package/server/canvas-flow/canvas-flow-constants-model.js +10 -0
- package/server/canvas-flow/canvas-flow-constants-model.js.map +1 -0
- package/server/canvas-flow/canvas-flow-controller.d.ts +98 -0
- package/server/canvas-flow/canvas-flow-controller.js +423 -0
- package/server/canvas-flow/canvas-flow-controller.js.map +1 -0
- package/server/canvas-flow/canvas-flow-module.d.ts +2 -0
- package/server/canvas-flow/canvas-flow-module.js +27 -0
- package/server/canvas-flow/canvas-flow-module.js.map +1 -0
- package/server/canvas-flow/canvas-flow-schema.d.ts +192 -0
- package/server/canvas-flow/canvas-flow-schema.js +239 -0
- package/server/canvas-flow/canvas-flow-schema.js.map +1 -0
- package/server/canvas-flow/canvas-flow-service.d.ts +250 -0
- package/server/canvas-flow/canvas-flow-service.js +1681 -0
- package/server/canvas-flow/canvas-flow-service.js.map +1 -0
- package/server/canvas-flow/dto/create-canvas-flow.dto.d.ts +11 -0
- package/server/canvas-flow/dto/create-canvas-flow.dto.js +61 -0
- package/server/canvas-flow/dto/create-canvas-flow.dto.js.map +1 -0
- package/server/canvas-flow/dto/update-canvas-flow.dto.d.ts +10 -0
- package/server/canvas-flow/dto/update-canvas-flow.dto.js +56 -0
- package/server/canvas-flow/dto/update-canvas-flow.dto.js.map +1 -0
- package/server/constants-global.d.ts +1 -0
- package/server/constants-global.js +5 -0
- package/server/constants-global.js.map +1 -0
- package/server/database/database.module.d.ts +2 -0
- package/server/database/database.module.js +23 -0
- package/server/database/database.module.js.map +1 -0
- package/server/database/database.providers.d.ts +7 -0
- package/server/database/database.providers.js +26 -0
- package/server/database/database.providers.js.map +1 -0
- package/server/documents/documents-connect-provider.d.ts +140 -0
- package/server/documents/documents-connect-provider.js +14 -0
- package/server/documents/documents-connect-provider.js.map +1 -0
- package/server/documents/documents-constants-model.d.ts +2 -0
- package/server/documents/documents-constants-model.js +6 -0
- package/server/documents/documents-constants-model.js.map +1 -0
- package/server/documents/documents-controller.d.ts +16 -0
- package/server/documents/documents-controller.js +117 -0
- package/server/documents/documents-controller.js.map +1 -0
- package/server/documents/documents-module.d.ts +2 -0
- package/server/documents/documents-module.js +27 -0
- package/server/documents/documents-module.js.map +1 -0
- package/server/documents/documents-schema.d.ts +96 -0
- package/server/documents/documents-schema.js +38 -0
- package/server/documents/documents-schema.js.map +1 -0
- package/server/documents/documents-service.d.ts +164 -0
- package/server/documents/documents-service.js +1417 -0
- package/server/documents/documents-service.js.map +1 -0
- package/server/flow-tag/flow-tag-connect-provider.d.ts +146 -0
- package/server/flow-tag/flow-tag-connect-provider.js +14 -0
- package/server/flow-tag/flow-tag-connect-provider.js.map +1 -0
- package/server/flow-tag/flow-tag-constants-model.d.ts +2 -0
- package/server/flow-tag/flow-tag-constants-model.js +6 -0
- package/server/flow-tag/flow-tag-constants-model.js.map +1 -0
- package/server/flow-tag/flow-tag-module.d.ts +2 -0
- package/server/flow-tag/flow-tag-module.js +24 -0
- package/server/flow-tag/flow-tag-module.js.map +1 -0
- package/server/flow-tag/flow-tag-schema.d.ts +100 -0
- package/server/flow-tag/flow-tag-schema.js +131 -0
- package/server/flow-tag/flow-tag-schema.js.map +1 -0
- package/server/flow-tag/flow-tag-service.d.ts +77 -0
- package/server/flow-tag/flow-tag-service.js +156 -0
- package/server/flow-tag/flow-tag-service.js.map +1 -0
- package/server/health.controller.d.ts +7 -0
- package/server/health.controller.js +33 -0
- package/server/health.controller.js.map +1 -0
- package/server/http-batch/http-batch-controller.d.ts +345 -0
- package/server/http-batch/http-batch-controller.js +40 -0
- package/server/http-batch/http-batch-controller.js.map +1 -0
- package/server/http-batch/http-batch-module.d.ts +2 -0
- package/server/http-batch/http-batch-module.js +25 -0
- package/server/http-batch/http-batch-module.js.map +1 -0
- package/server/http-batch/http-batch-service.d.ts +381 -0
- package/server/http-batch/http-batch-service.js +268 -0
- package/server/http-batch/http-batch-service.js.map +1 -0
- package/server/lambda.d.ts +2 -0
- package/server/lambda.js +115 -0
- package/server/lambda.js.map +1 -0
- package/server/llm/openai-provider.d.ts +8 -0
- package/server/llm/openai-provider.js +256 -0
- package/server/llm/openai-provider.js.map +1 -0
- package/server/main.d.ts +1 -0
- package/server/main.js +80 -0
- package/server/main.js.map +1 -0
- package/server/mcp-oauth/mcp-oauth-connect-provider.d.ts +164 -0
- package/server/mcp-oauth/mcp-oauth-connect-provider.js +14 -0
- package/server/mcp-oauth/mcp-oauth-connect-provider.js.map +1 -0
- package/server/mcp-oauth/mcp-oauth-constants-model.d.ts +2 -0
- package/server/mcp-oauth/mcp-oauth-constants-model.js +6 -0
- package/server/mcp-oauth/mcp-oauth-constants-model.js.map +1 -0
- package/server/mcp-oauth/mcp-oauth-controller.d.ts +66 -0
- package/server/mcp-oauth/mcp-oauth-controller.js +166 -0
- package/server/mcp-oauth/mcp-oauth-controller.js.map +1 -0
- package/server/mcp-oauth/mcp-oauth-module.d.ts +2 -0
- package/server/mcp-oauth/mcp-oauth-module.js +27 -0
- package/server/mcp-oauth/mcp-oauth-module.js.map +1 -0
- package/server/mcp-oauth/mcp-oauth-schema.d.ts +112 -0
- package/server/mcp-oauth/mcp-oauth-schema.js +148 -0
- package/server/mcp-oauth/mcp-oauth-schema.js.map +1 -0
- package/server/mcp-oauth/mcp-oauth-service.d.ts +189 -0
- package/server/mcp-oauth/mcp-oauth-service.js +545 -0
- package/server/mcp-oauth/mcp-oauth-service.js.map +1 -0
- package/server/memory/memory-connect-provider.d.ts +200 -0
- package/server/memory/memory-connect-provider.js +26 -0
- package/server/memory/memory-connect-provider.js.map +1 -0
- package/server/memory/memory-constants-model.d.ts +6 -0
- package/server/memory/memory-constants-model.js +10 -0
- package/server/memory/memory-constants-model.js.map +1 -0
- package/server/memory/memory-controller.d.ts +15 -0
- package/server/memory/memory-controller.js +53 -0
- package/server/memory/memory-controller.js.map +1 -0
- package/server/memory/memory-history-schema.d.ts +48 -0
- package/server/memory/memory-history-schema.js +62 -0
- package/server/memory/memory-history-schema.js.map +1 -0
- package/server/memory/memory-module.d.ts +2 -0
- package/server/memory/memory-module.js +26 -0
- package/server/memory/memory-module.js.map +1 -0
- package/server/memory/memory-schema.d.ts +48 -0
- package/server/memory/memory-schema.js +62 -0
- package/server/memory/memory-schema.js.map +1 -0
- package/server/memory/memory-service.d.ts +134 -0
- package/server/memory/memory-service.js +317 -0
- package/server/memory/memory-service.js.map +1 -0
- package/server/memory/memory-trace-history-schema.d.ts +48 -0
- package/server/memory/memory-trace-history-schema.js +62 -0
- package/server/memory/memory-trace-history-schema.js.map +1 -0
- package/server/observability/observability.d.ts +3 -0
- package/server/observability/observability.js +62 -0
- package/server/observability/observability.js.map +1 -0
- package/server/production-guard.d.ts +9 -0
- package/server/production-guard.js +105 -0
- package/server/production-guard.js.map +1 -0
- package/server/provider-config/provider-config-connect-provider.d.ts +44 -0
- package/server/provider-config/provider-config-connect-provider.js +14 -0
- package/server/provider-config/provider-config-connect-provider.js.map +1 -0
- package/server/provider-config/provider-config-constants-model.d.ts +3 -0
- package/server/provider-config/provider-config-constants-model.js +7 -0
- package/server/provider-config/provider-config-constants-model.js.map +1 -0
- package/server/provider-config/provider-config-controller.d.ts +23 -0
- package/server/provider-config/provider-config-controller.js +80 -0
- package/server/provider-config/provider-config-controller.js.map +1 -0
- package/server/provider-config/provider-config-module.d.ts +2 -0
- package/server/provider-config/provider-config-module.js +27 -0
- package/server/provider-config/provider-config-module.js.map +1 -0
- package/server/provider-config/provider-config-schema.d.ts +32 -0
- package/server/provider-config/provider-config-schema.js +46 -0
- package/server/provider-config/provider-config-schema.js.map +1 -0
- package/server/provider-config/provider-config-service.d.ts +178 -0
- package/server/provider-config/provider-config-service.js +689 -0
- package/server/provider-config/provider-config-service.js.map +1 -0
- package/server/queue/queue-job-connect-provider.d.ts +128 -0
- package/server/queue/queue-job-connect-provider.js +14 -0
- package/server/queue/queue-job-connect-provider.js.map +1 -0
- package/server/queue/queue-job-constants-model.d.ts +2 -0
- package/server/queue/queue-job-constants-model.js +6 -0
- package/server/queue/queue-job-constants-model.js.map +1 -0
- package/server/queue/queue-job-schema.d.ts +88 -0
- package/server/queue/queue-job-schema.js +119 -0
- package/server/queue/queue-job-schema.js.map +1 -0
- package/server/queue/queue-lock-connect-provider.d.ts +44 -0
- package/server/queue/queue-lock-connect-provider.js +14 -0
- package/server/queue/queue-lock-connect-provider.js.map +1 -0
- package/server/queue/queue-lock-constants-model.d.ts +2 -0
- package/server/queue/queue-lock-constants-model.js +6 -0
- package/server/queue/queue-lock-constants-model.js.map +1 -0
- package/server/queue/queue-lock-schema.d.ts +32 -0
- package/server/queue/queue-lock-schema.js +47 -0
- package/server/queue/queue-lock-schema.js.map +1 -0
- package/server/queue/queue-message-dedupe-connect-provider.d.ts +116 -0
- package/server/queue/queue-message-dedupe-connect-provider.js +14 -0
- package/server/queue/queue-message-dedupe-connect-provider.js.map +1 -0
- package/server/queue/queue-message-dedupe-constants-model.d.ts +2 -0
- package/server/queue/queue-message-dedupe-constants-model.js +6 -0
- package/server/queue/queue-message-dedupe-constants-model.js.map +1 -0
- package/server/queue/queue-message-dedupe-schema.d.ts +80 -0
- package/server/queue/queue-message-dedupe-schema.js +108 -0
- package/server/queue/queue-message-dedupe-schema.js.map +1 -0
- package/server/queue/queue-module.d.ts +2 -0
- package/server/queue/queue-module.js +33 -0
- package/server/queue/queue-module.js.map +1 -0
- package/server/queue/queue-rate-limit-connect-provider.d.ts +56 -0
- package/server/queue/queue-rate-limit-connect-provider.js +14 -0
- package/server/queue/queue-rate-limit-connect-provider.js.map +1 -0
- package/server/queue/queue-rate-limit-constants-model.d.ts +2 -0
- package/server/queue/queue-rate-limit-constants-model.js +6 -0
- package/server/queue/queue-rate-limit-constants-model.js.map +1 -0
- package/server/queue/queue-rate-limit-schema.d.ts +40 -0
- package/server/queue/queue-rate-limit-schema.js +57 -0
- package/server/queue/queue-rate-limit-schema.js.map +1 -0
- package/server/queue/sqs-transition-service.d.ts +123 -0
- package/server/queue/sqs-transition-service.js +442 -0
- package/server/queue/sqs-transition-service.js.map +1 -0
- package/server/rag/rag-controller.d.ts +167 -0
- package/server/rag/rag-controller.js +232 -0
- package/server/rag/rag-controller.js.map +1 -0
- package/server/rag/rag-module.d.ts +2 -0
- package/server/rag/rag-module.js +30 -0
- package/server/rag/rag-module.js.map +1 -0
- package/server/rag/rag-service.d.ts +361 -0
- package/server/rag/rag-service.js +2864 -0
- package/server/rag/rag-service.js.map +1 -0
- package/server/runner/flow-templates.d.ts +55 -0
- package/server/runner/flow-templates.js +388 -0
- package/server/runner/flow-templates.js.map +1 -0
- package/server/runner/langgraph-runtime.service.d.ts +77 -0
- package/server/runner/langgraph-runtime.service.js +221 -0
- package/server/runner/langgraph-runtime.service.js.map +1 -0
- package/server/runner/runner-controller.d.ts +1044 -0
- package/server/runner/runner-controller.js +751 -0
- package/server/runner/runner-controller.js.map +1 -0
- package/server/runner/runner-module.d.ts +2 -0
- package/server/runner/runner-module.js +37 -0
- package/server/runner/runner-module.js.map +1 -0
- package/server/runner/runner-queue-processor.d.ts +29 -0
- package/server/runner/runner-queue-processor.js +259 -0
- package/server/runner/runner-queue-processor.js.map +1 -0
- package/server/runner/runner-service.d.ts +1761 -0
- package/server/runner/runner-service.js +14256 -0
- package/server/runner/runner-service.js.map +1 -0
- package/server/scripts/migrate-canvas-flow-versions.d.ts +1 -0
- package/server/scripts/migrate-canvas-flow-versions.js +72 -0
- package/server/scripts/migrate-canvas-flow-versions.js.map +1 -0
- package/server/scripts/migrate-mcp-oauth-user-scope.d.ts +1 -0
- package/server/scripts/migrate-mcp-oauth-user-scope.js +95 -0
- package/server/scripts/migrate-mcp-oauth-user-scope.js.map +1 -0
- package/templates/config.example.json +204 -0
- package/templates/config.production.example.json +206 -0
- package/templates/docker-compose.yml +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const common_1 = require("@nestjs/common");
|
|
10
|
+
const config_1 = require("@nestjs/config");
|
|
11
|
+
const core_1 = require("@nestjs/core");
|
|
12
|
+
const mongoose = require("mongoose");
|
|
13
|
+
const canvas_flow_module_1 = require("../canvas-flow/canvas-flow-module");
|
|
14
|
+
const canvas_flow_service_1 = require("../canvas-flow/canvas-flow-service");
|
|
15
|
+
let CanvasFlowVersionMigrationModule = class CanvasFlowVersionMigrationModule {
|
|
16
|
+
};
|
|
17
|
+
CanvasFlowVersionMigrationModule = __decorate([
|
|
18
|
+
(0, common_1.Module)({
|
|
19
|
+
imports: [
|
|
20
|
+
config_1.ConfigModule.forRoot({
|
|
21
|
+
isGlobal: true,
|
|
22
|
+
envFilePath: ['.env', 'backend/.env'],
|
|
23
|
+
}),
|
|
24
|
+
canvas_flow_module_1.CanvasFlowModule,
|
|
25
|
+
],
|
|
26
|
+
})
|
|
27
|
+
], CanvasFlowVersionMigrationModule);
|
|
28
|
+
function argValue(name) {
|
|
29
|
+
const prefix = `${name}=`;
|
|
30
|
+
const inline = process.argv.find((arg) => arg.startsWith(prefix));
|
|
31
|
+
if (inline)
|
|
32
|
+
return inline.slice(prefix.length);
|
|
33
|
+
const index = process.argv.indexOf(name);
|
|
34
|
+
if (index >= 0)
|
|
35
|
+
return process.argv[index + 1];
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
function hasFlag(name) {
|
|
39
|
+
return process.argv.includes(name);
|
|
40
|
+
}
|
|
41
|
+
function positiveInt(value) {
|
|
42
|
+
const number = Number(value);
|
|
43
|
+
return Number.isFinite(number) && number > 0 ? Math.floor(number) : undefined;
|
|
44
|
+
}
|
|
45
|
+
async function main() {
|
|
46
|
+
const dryRun = hasFlag('--dry-run');
|
|
47
|
+
const app = await core_1.NestFactory.createApplicationContext(CanvasFlowVersionMigrationModule, {
|
|
48
|
+
logger: ['log', 'warn', 'error'],
|
|
49
|
+
});
|
|
50
|
+
try {
|
|
51
|
+
const service = app.get(canvas_flow_service_1.CanvasFlowService);
|
|
52
|
+
const summary = await service.migrateEmbeddedFlowVersions({
|
|
53
|
+
dryRun,
|
|
54
|
+
keepLegacy: dryRun || hasFlag('--keep-legacy'),
|
|
55
|
+
organizationId: argValue('--organization-id'),
|
|
56
|
+
limit: positiveInt(argValue('--limit')),
|
|
57
|
+
});
|
|
58
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
59
|
+
if (summary.failedFlows > 0) {
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
await app.close();
|
|
65
|
+
await mongoose.disconnect().catch(() => undefined);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
void main().catch((error) => {
|
|
69
|
+
console.error(error?.stack || error?.message || error);
|
|
70
|
+
process.exitCode = 1;
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=migrate-canvas-flow-versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-canvas-flow-versions.js","sourceRoot":"","sources":["../../src/scripts/migrate-canvas-flow-versions.ts"],"names":[],"mappings":";;;;;;;;AAAA,2CAAwC;AACxC,2CAA8C;AAC9C,uCAA2C;AAC3C,qCAAqC;AACrC,0EAAqE;AACrE,4EAAuE;AAWvE,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;CAAG,CAAA;AAAnC,gCAAgC;IATrC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;aACtC,CAAC;YACF,qCAAgB;SACjB;KACF,CAAC;GACI,gCAAgC,CAAG;AAEzC,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;IAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,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AC;AACH,CAAC;AAED,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1B,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC;IACvD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const common_1 = require("@nestjs/common");
|
|
10
|
+
const config_1 = require("@nestjs/config");
|
|
11
|
+
const core_1 = require("@nestjs/core");
|
|
12
|
+
const mongoose = require("mongoose");
|
|
13
|
+
const mcp_oauth_constants_model_1 = require("../mcp-oauth/mcp-oauth-constants-model");
|
|
14
|
+
let McpOAuthUserScopeMigrationModule = class McpOAuthUserScopeMigrationModule {
|
|
15
|
+
};
|
|
16
|
+
McpOAuthUserScopeMigrationModule = __decorate([
|
|
17
|
+
(0, common_1.Module)({
|
|
18
|
+
imports: [
|
|
19
|
+
config_1.ConfigModule.forRoot({
|
|
20
|
+
isGlobal: true,
|
|
21
|
+
envFilePath: ['.env', 'backend/.env'],
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
], McpOAuthUserScopeMigrationModule);
|
|
26
|
+
function hasFlag(name) {
|
|
27
|
+
return process.argv.includes(name);
|
|
28
|
+
}
|
|
29
|
+
function isLegacyUniqueIndex(index) {
|
|
30
|
+
const keys = index?.key || {};
|
|
31
|
+
return index?.unique === true
|
|
32
|
+
&& Object.keys(keys).length === 3
|
|
33
|
+
&& keys.organizationId === 1
|
|
34
|
+
&& keys.agentId === 1
|
|
35
|
+
&& keys.serverUrlHash === 1;
|
|
36
|
+
}
|
|
37
|
+
async function main() {
|
|
38
|
+
const dryRun = hasFlag('--dry-run');
|
|
39
|
+
const app = await core_1.NestFactory.createApplicationContext(McpOAuthUserScopeMigrationModule, {
|
|
40
|
+
logger: ['log', 'warn', 'error'],
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
const config = app.get(config_1.ConfigService);
|
|
44
|
+
const uri = String(config.get('MONGO_DB_CONNECTION_STRING') || '').trim();
|
|
45
|
+
if (!uri)
|
|
46
|
+
throw new Error('MONGO_DB_CONNECTION_STRING nao configurada.');
|
|
47
|
+
await mongoose.connect(uri);
|
|
48
|
+
const collectionExists = await mongoose.connection.db
|
|
49
|
+
?.listCollections({ name: mcp_oauth_constants_model_1.COLLECTION_NAME }, { nameOnly: true })
|
|
50
|
+
.hasNext();
|
|
51
|
+
if (!collectionExists) {
|
|
52
|
+
console.log(JSON.stringify({
|
|
53
|
+
dryRun,
|
|
54
|
+
collection: mcp_oauth_constants_model_1.COLLECTION_NAME,
|
|
55
|
+
collectionExists: false,
|
|
56
|
+
message: 'Colecao ainda nao existe; nenhuma migracao necessaria.',
|
|
57
|
+
}, null, 2));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const collection = mongoose.connection.collection(mcp_oauth_constants_model_1.COLLECTION_NAME);
|
|
61
|
+
const indexes = await collection.indexes();
|
|
62
|
+
const legacyIndexes = indexes.filter(isLegacyUniqueIndex);
|
|
63
|
+
const legacyRows = await collection.countDocuments({ connectionScope: { $exists: false } });
|
|
64
|
+
const summary = {
|
|
65
|
+
dryRun,
|
|
66
|
+
collection: mcp_oauth_constants_model_1.COLLECTION_NAME,
|
|
67
|
+
legacyIndexes: legacyIndexes.map((index) => index.name),
|
|
68
|
+
legacyRows,
|
|
69
|
+
droppedIndexes: [],
|
|
70
|
+
backfilledRows: 0,
|
|
71
|
+
lookupIndex: 'mcp_oauth_scope_lookup',
|
|
72
|
+
};
|
|
73
|
+
if (!dryRun) {
|
|
74
|
+
for (const index of legacyIndexes) {
|
|
75
|
+
if (!index.name)
|
|
76
|
+
continue;
|
|
77
|
+
await collection.dropIndex(index.name);
|
|
78
|
+
summary.droppedIndexes.push(index.name);
|
|
79
|
+
}
|
|
80
|
+
const backfill = await collection.updateMany({ connectionScope: { $exists: false } }, { $set: { connectionScope: 'agent' } });
|
|
81
|
+
summary.backfilledRows = backfill.modifiedCount;
|
|
82
|
+
await collection.createIndex({ organizationId: 1, agentId: 1, connectionScope: 1, oauthUserId: 1, serverUrlHash: 1 }, { name: 'mcp_oauth_scope_lookup' });
|
|
83
|
+
}
|
|
84
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
await mongoose.disconnect().catch(() => undefined);
|
|
88
|
+
await app.close();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
void main().catch((error) => {
|
|
92
|
+
console.error(error?.stack || error?.message || error);
|
|
93
|
+
process.exitCode = 1;
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=migrate-mcp-oauth-user-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-mcp-oauth-user-scope.js","sourceRoot":"","sources":["../../src/scripts/migrate-mcp-oauth-user-scope.ts"],"names":[],"mappings":";;;;;;;;AAAA,2CAAwC;AACxC,2CAA6D;AAC7D,uCAA2C;AAC3C,qCAAqC;AACrC,sFAAyE;AAUzE,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;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|
+
"corsOrigins": [],
|
|
8
|
+
"openBrowser": false
|
|
9
|
+
},
|
|
10
|
+
"runtime": {
|
|
11
|
+
"nodeEnv": "production",
|
|
12
|
+
"timezone": "America/Sao_Paulo",
|
|
13
|
+
"logIsLambda": false,
|
|
14
|
+
"ssmPrefix": "",
|
|
15
|
+
"cronAutorun": true,
|
|
16
|
+
"cronScanMs": 30000,
|
|
17
|
+
"strictProduction": false,
|
|
18
|
+
"langGraphCheckpointNamespace": "canvas-flow-runtime-v1",
|
|
19
|
+
"langGraphCheckpointCollection": "canvas_langgraph_checkpoints",
|
|
20
|
+
"langGraphWritesCollection": "canvas_langgraph_checkpoint_writes",
|
|
21
|
+
"langGraphCheckpointTtlHours": 720,
|
|
22
|
+
"langGraphCheckpointIndexRetryAttempts": 3,
|
|
23
|
+
"langGraphCheckpointIndexRetryDelayMs": 250,
|
|
24
|
+
"maxParallelNodes": 50,
|
|
25
|
+
"maxStepVisits": 10,
|
|
26
|
+
"providerCacheMs": 10000
|
|
27
|
+
},
|
|
28
|
+
"aws": {
|
|
29
|
+
"region": "us-east-1",
|
|
30
|
+
"mcpTargetRegion": "",
|
|
31
|
+
"mcpSigningRegion": "",
|
|
32
|
+
"mcpSigningService": ""
|
|
33
|
+
},
|
|
34
|
+
"database": {
|
|
35
|
+
"mongoUrl": "mongodb://127.0.0.1:27017/canvas_flow",
|
|
36
|
+
"mongoServerSelectionTimeoutMs": 8000,
|
|
37
|
+
"mongoConnectTimeoutMs": 8000
|
|
38
|
+
},
|
|
39
|
+
"auth": {
|
|
40
|
+
"login": false,
|
|
41
|
+
"loginTtlHours": 24,
|
|
42
|
+
"loginThrottleWindowMs": 600000,
|
|
43
|
+
"loginMaxAttempts": 8,
|
|
44
|
+
"apiToken": "generated-by-canvas-flow-init",
|
|
45
|
+
"jwtSecret": "generated-by-canvas-flow-init",
|
|
46
|
+
"mediaProxySecret": "generated-by-canvas-flow-init",
|
|
47
|
+
"mediaProxyTtlSeconds": 86400
|
|
48
|
+
},
|
|
49
|
+
"files": {
|
|
50
|
+
"storage": "local",
|
|
51
|
+
"localDir": "./tmp/canvas-flow-documents",
|
|
52
|
+
"s3Bucket": "",
|
|
53
|
+
"s3Region": "us-east-1",
|
|
54
|
+
"downloadTtlSeconds": 900
|
|
55
|
+
},
|
|
56
|
+
"providers": {
|
|
57
|
+
"openai": {
|
|
58
|
+
"provider": "openai",
|
|
59
|
+
"llmProvider": "",
|
|
60
|
+
"apiKey": "",
|
|
61
|
+
"chatModel": "gpt-4o",
|
|
62
|
+
"embeddingModel": "text-embedding-3-large",
|
|
63
|
+
"embeddingDimensions": 3072,
|
|
64
|
+
"ocrModel": "gpt-4o"
|
|
65
|
+
},
|
|
66
|
+
"gemini": {
|
|
67
|
+
"apiKey": "",
|
|
68
|
+
"googleAiApiKey": "",
|
|
69
|
+
"chatModel": "gemini-3.5-flash"
|
|
70
|
+
},
|
|
71
|
+
"claude": {
|
|
72
|
+
"apiKey": "",
|
|
73
|
+
"chatModel": "claude-sonnet-4-6"
|
|
74
|
+
},
|
|
75
|
+
"grok": {
|
|
76
|
+
"apiKey": "",
|
|
77
|
+
"baseUrl": "https://api.x.ai/v1",
|
|
78
|
+
"chatModel": "grok-2-latest"
|
|
79
|
+
},
|
|
80
|
+
"bedrock": {
|
|
81
|
+
"apiKey": "",
|
|
82
|
+
"baseUrl": "",
|
|
83
|
+
"region": "us-east-1",
|
|
84
|
+
"chatModel": "anthropic.claude-sonnet-4-6"
|
|
85
|
+
},
|
|
86
|
+
"azureOpenAI": {
|
|
87
|
+
"enabled": false,
|
|
88
|
+
"apiKey": "",
|
|
89
|
+
"endpoint": "",
|
|
90
|
+
"apiBasePath": "",
|
|
91
|
+
"apiVersion": "2024-02-15-preview",
|
|
92
|
+
"chatDeploymentName": "",
|
|
93
|
+
"chatModelName": "",
|
|
94
|
+
"deployment": "",
|
|
95
|
+
"modelName": "",
|
|
96
|
+
"embeddingDeploymentName": "",
|
|
97
|
+
"modelNameEmb": "",
|
|
98
|
+
"ocrDeploymentName": "",
|
|
99
|
+
"embeddingDimensions": 3072
|
|
100
|
+
},
|
|
101
|
+
"milvus": {
|
|
102
|
+
"address": "",
|
|
103
|
+
"token": "",
|
|
104
|
+
"username": "",
|
|
105
|
+
"password": "",
|
|
106
|
+
"collectionName": "canvas_flow_docs",
|
|
107
|
+
"vectorProvider": "milvus"
|
|
108
|
+
},
|
|
109
|
+
"azureBlob": {
|
|
110
|
+
"connectionString": "",
|
|
111
|
+
"containerName": ""
|
|
112
|
+
},
|
|
113
|
+
"azureSearch": {
|
|
114
|
+
"endpoint": "",
|
|
115
|
+
"apiKey": "",
|
|
116
|
+
"indexName": "",
|
|
117
|
+
"apiVersion": "2024-07-01"
|
|
118
|
+
},
|
|
119
|
+
"mongoComponent": {
|
|
120
|
+
"connectionString": "",
|
|
121
|
+
"databaseName": ""
|
|
122
|
+
},
|
|
123
|
+
"figmaOAuth": {
|
|
124
|
+
"clientId": "",
|
|
125
|
+
"clientSecret": "",
|
|
126
|
+
"tokenAuthMethod": "client_secret_post"
|
|
127
|
+
},
|
|
128
|
+
"canvasMcpOAuth": {
|
|
129
|
+
"clientId": "",
|
|
130
|
+
"clientSecret": "",
|
|
131
|
+
"tokenAuthMethod": "client_secret_post"
|
|
132
|
+
},
|
|
133
|
+
"webWidget": {
|
|
134
|
+
"primaryColor": "#0f6bff",
|
|
135
|
+
"accentColor": "#00b37e",
|
|
136
|
+
"assistantName": "Assistente IA",
|
|
137
|
+
"subtitle": "Online agora",
|
|
138
|
+
"welcomeMessage": "Ola! Como posso ajudar?",
|
|
139
|
+
"placeholder": "Digite sua mensagem",
|
|
140
|
+
"bubbleLabel": "Precisa de ajuda?",
|
|
141
|
+
"avatarText": "IA",
|
|
142
|
+
"openByDefault": false,
|
|
143
|
+
"position": "right"
|
|
144
|
+
},
|
|
145
|
+
"whatsapp": {
|
|
146
|
+
"provider": "meta",
|
|
147
|
+
"deliveryMode": "provider",
|
|
148
|
+
"autoReply": true,
|
|
149
|
+
"verifyToken": "",
|
|
150
|
+
"accessToken": "",
|
|
151
|
+
"businessAccountId": "",
|
|
152
|
+
"wabaId": "",
|
|
153
|
+
"phoneNumberId": "",
|
|
154
|
+
"graphApiVersion": "v20.0",
|
|
155
|
+
"blipContractId": "",
|
|
156
|
+
"blipAuthorizationKey": "",
|
|
157
|
+
"sinchProjectId": "",
|
|
158
|
+
"sinchAppId": "",
|
|
159
|
+
"sinchRegion": "us",
|
|
160
|
+
"sinchAccessToken": "",
|
|
161
|
+
"sinchChannel": "WHATSAPP",
|
|
162
|
+
"sinchApiMode": "conversation",
|
|
163
|
+
"sinchServiceNumber": "",
|
|
164
|
+
"sinchServiceUsername": "",
|
|
165
|
+
"sinchServiceToken": ""
|
|
166
|
+
},
|
|
167
|
+
"sinch": {
|
|
168
|
+
"apiUrl": "https://api-messaging.wavy.global/v1/whatsapp/send",
|
|
169
|
+
"canvasFlowApiUrl": ""
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"sqs": {
|
|
173
|
+
"enabled": false,
|
|
174
|
+
"queueUrl": "",
|
|
175
|
+
"queueArn": "",
|
|
176
|
+
"region": "us-east-1",
|
|
177
|
+
"triggerEnabled": true,
|
|
178
|
+
"batchSize": 10,
|
|
179
|
+
"batchWindowSeconds": 2,
|
|
180
|
+
"jobTtlHours": 24,
|
|
181
|
+
"consumerConcurrency": 10,
|
|
182
|
+
"conversationLockTtlMs": 900000
|
|
183
|
+
},
|
|
184
|
+
"rateLimit": {
|
|
185
|
+
"enabled": true,
|
|
186
|
+
"windowMs": 60000,
|
|
187
|
+
"perMinute": 600,
|
|
188
|
+
"webwidgetPerMinute": 300,
|
|
189
|
+
"whatsappPerMinute": 600,
|
|
190
|
+
"apiPerMinute": 600,
|
|
191
|
+
"messageDedupeTtlHours": 24
|
|
192
|
+
},
|
|
193
|
+
"httpBatch": {
|
|
194
|
+
"timeoutMs": 120000,
|
|
195
|
+
"maxRequests": 10,
|
|
196
|
+
"pollingMaxAttempts": 20,
|
|
197
|
+
"pollingMaxIntervalSeconds": 60,
|
|
198
|
+
"pollingHistoryLimit": 8
|
|
199
|
+
},
|
|
200
|
+
"agentOps": {
|
|
201
|
+
"defaultHistoryLimit": 80,
|
|
202
|
+
"defaultTraceLimit": 600
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
{
|
|
2
|
+
"server": {
|
|
3
|
+
"port": 3333,
|
|
4
|
+
"publicUrl": "https://api.canvas-flow.example.com",
|
|
5
|
+
"enableSwagger": false,
|
|
6
|
+
"requestBodyLimit": "2mb",
|
|
7
|
+
"corsOrigins": [
|
|
8
|
+
"https://canvas-flow.example.com"
|
|
9
|
+
],
|
|
10
|
+
"openBrowser": false
|
|
11
|
+
},
|
|
12
|
+
"runtime": {
|
|
13
|
+
"nodeEnv": "production",
|
|
14
|
+
"timezone": "America/Sao_Paulo",
|
|
15
|
+
"logIsLambda": false,
|
|
16
|
+
"ssmPrefix": "",
|
|
17
|
+
"cronAutorun": false,
|
|
18
|
+
"cronScanMs": 30000,
|
|
19
|
+
"strictProduction": true,
|
|
20
|
+
"langGraphCheckpointNamespace": "canvas-flow-runtime-v1",
|
|
21
|
+
"langGraphCheckpointCollection": "canvas_langgraph_checkpoints",
|
|
22
|
+
"langGraphWritesCollection": "canvas_langgraph_checkpoint_writes",
|
|
23
|
+
"langGraphCheckpointTtlHours": 720,
|
|
24
|
+
"langGraphCheckpointIndexRetryAttempts": 3,
|
|
25
|
+
"langGraphCheckpointIndexRetryDelayMs": 250,
|
|
26
|
+
"maxParallelNodes": 50,
|
|
27
|
+
"maxStepVisits": 10,
|
|
28
|
+
"providerCacheMs": 10000
|
|
29
|
+
},
|
|
30
|
+
"aws": {
|
|
31
|
+
"region": "us-east-1",
|
|
32
|
+
"mcpTargetRegion": "",
|
|
33
|
+
"mcpSigningRegion": "",
|
|
34
|
+
"mcpSigningService": ""
|
|
35
|
+
},
|
|
36
|
+
"database": {
|
|
37
|
+
"mongoUrl": "mongodb+srv://<user>:<password>@<cluster>/<db>?retryWrites=true&w=majority",
|
|
38
|
+
"mongoServerSelectionTimeoutMs": 8000,
|
|
39
|
+
"mongoConnectTimeoutMs": 8000
|
|
40
|
+
},
|
|
41
|
+
"auth": {
|
|
42
|
+
"login": true,
|
|
43
|
+
"loginTtlHours": 12,
|
|
44
|
+
"loginThrottleWindowMs": 600000,
|
|
45
|
+
"loginMaxAttempts": 8,
|
|
46
|
+
"apiToken": "<64+_random_chars>",
|
|
47
|
+
"jwtSecret": "<64+_random_chars>",
|
|
48
|
+
"mediaProxySecret": "<64+_random_chars>",
|
|
49
|
+
"mediaProxyTtlSeconds": 86400
|
|
50
|
+
},
|
|
51
|
+
"files": {
|
|
52
|
+
"storage": "s3",
|
|
53
|
+
"localDir": "./tmp/canvas-flow-documents",
|
|
54
|
+
"s3Bucket": "<private_s3_bucket>",
|
|
55
|
+
"s3Region": "us-east-1",
|
|
56
|
+
"downloadTtlSeconds": 900
|
|
57
|
+
},
|
|
58
|
+
"providers": {
|
|
59
|
+
"openai": {
|
|
60
|
+
"provider": "openai",
|
|
61
|
+
"llmProvider": "",
|
|
62
|
+
"apiKey": "<openai_api_key>",
|
|
63
|
+
"chatModel": "gpt-4o",
|
|
64
|
+
"embeddingModel": "text-embedding-3-large",
|
|
65
|
+
"embeddingDimensions": 3072,
|
|
66
|
+
"ocrModel": "gpt-4o"
|
|
67
|
+
},
|
|
68
|
+
"gemini": {
|
|
69
|
+
"apiKey": "",
|
|
70
|
+
"googleAiApiKey": "",
|
|
71
|
+
"chatModel": "gemini-3.5-flash"
|
|
72
|
+
},
|
|
73
|
+
"claude": {
|
|
74
|
+
"apiKey": "",
|
|
75
|
+
"chatModel": "claude-sonnet-4-6"
|
|
76
|
+
},
|
|
77
|
+
"grok": {
|
|
78
|
+
"apiKey": "",
|
|
79
|
+
"baseUrl": "https://api.x.ai/v1",
|
|
80
|
+
"chatModel": "grok-2-latest"
|
|
81
|
+
},
|
|
82
|
+
"bedrock": {
|
|
83
|
+
"apiKey": "",
|
|
84
|
+
"baseUrl": "",
|
|
85
|
+
"region": "us-east-1",
|
|
86
|
+
"chatModel": "anthropic.claude-sonnet-4-6"
|
|
87
|
+
},
|
|
88
|
+
"azureOpenAI": {
|
|
89
|
+
"enabled": false,
|
|
90
|
+
"apiKey": "",
|
|
91
|
+
"endpoint": "",
|
|
92
|
+
"apiBasePath": "",
|
|
93
|
+
"apiVersion": "2024-02-15-preview",
|
|
94
|
+
"chatDeploymentName": "",
|
|
95
|
+
"chatModelName": "",
|
|
96
|
+
"deployment": "",
|
|
97
|
+
"modelName": "",
|
|
98
|
+
"embeddingDeploymentName": "",
|
|
99
|
+
"modelNameEmb": "",
|
|
100
|
+
"ocrDeploymentName": "",
|
|
101
|
+
"embeddingDimensions": 3072
|
|
102
|
+
},
|
|
103
|
+
"milvus": {
|
|
104
|
+
"address": "<zilliz_or_milvus_host>",
|
|
105
|
+
"token": "<milvus_token>",
|
|
106
|
+
"username": "",
|
|
107
|
+
"password": "",
|
|
108
|
+
"collectionName": "canvas_flow_docs",
|
|
109
|
+
"vectorProvider": "milvus"
|
|
110
|
+
},
|
|
111
|
+
"azureBlob": {
|
|
112
|
+
"connectionString": "",
|
|
113
|
+
"containerName": ""
|
|
114
|
+
},
|
|
115
|
+
"azureSearch": {
|
|
116
|
+
"endpoint": "",
|
|
117
|
+
"apiKey": "",
|
|
118
|
+
"indexName": "",
|
|
119
|
+
"apiVersion": "2024-07-01"
|
|
120
|
+
},
|
|
121
|
+
"mongoComponent": {
|
|
122
|
+
"connectionString": "",
|
|
123
|
+
"databaseName": ""
|
|
124
|
+
},
|
|
125
|
+
"figmaOAuth": {
|
|
126
|
+
"clientId": "",
|
|
127
|
+
"clientSecret": "",
|
|
128
|
+
"tokenAuthMethod": "client_secret_post"
|
|
129
|
+
},
|
|
130
|
+
"canvasMcpOAuth": {
|
|
131
|
+
"clientId": "",
|
|
132
|
+
"clientSecret": "",
|
|
133
|
+
"tokenAuthMethod": "client_secret_post"
|
|
134
|
+
},
|
|
135
|
+
"webWidget": {
|
|
136
|
+
"primaryColor": "#0f6bff",
|
|
137
|
+
"accentColor": "#00b37e",
|
|
138
|
+
"assistantName": "Assistente IA",
|
|
139
|
+
"subtitle": "Online agora",
|
|
140
|
+
"welcomeMessage": "Ola! Como posso ajudar?",
|
|
141
|
+
"placeholder": "Digite sua mensagem",
|
|
142
|
+
"bubbleLabel": "Precisa de ajuda?",
|
|
143
|
+
"avatarText": "IA",
|
|
144
|
+
"openByDefault": false,
|
|
145
|
+
"position": "right"
|
|
146
|
+
},
|
|
147
|
+
"whatsapp": {
|
|
148
|
+
"provider": "meta",
|
|
149
|
+
"deliveryMode": "provider",
|
|
150
|
+
"autoReply": true,
|
|
151
|
+
"verifyToken": "",
|
|
152
|
+
"accessToken": "",
|
|
153
|
+
"businessAccountId": "",
|
|
154
|
+
"wabaId": "",
|
|
155
|
+
"phoneNumberId": "",
|
|
156
|
+
"graphApiVersion": "v20.0",
|
|
157
|
+
"blipContractId": "",
|
|
158
|
+
"blipAuthorizationKey": "",
|
|
159
|
+
"sinchProjectId": "",
|
|
160
|
+
"sinchAppId": "",
|
|
161
|
+
"sinchRegion": "us",
|
|
162
|
+
"sinchAccessToken": "",
|
|
163
|
+
"sinchChannel": "WHATSAPP",
|
|
164
|
+
"sinchApiMode": "conversation",
|
|
165
|
+
"sinchServiceNumber": "",
|
|
166
|
+
"sinchServiceUsername": "",
|
|
167
|
+
"sinchServiceToken": ""
|
|
168
|
+
},
|
|
169
|
+
"sinch": {
|
|
170
|
+
"apiUrl": "https://api-messaging.wavy.global/v1/whatsapp/send",
|
|
171
|
+
"canvasFlowApiUrl": ""
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"sqs": {
|
|
175
|
+
"enabled": true,
|
|
176
|
+
"queueUrl": "<sqs_queue_url>",
|
|
177
|
+
"queueArn": "",
|
|
178
|
+
"region": "us-east-1",
|
|
179
|
+
"triggerEnabled": true,
|
|
180
|
+
"batchSize": 10,
|
|
181
|
+
"batchWindowSeconds": 2,
|
|
182
|
+
"jobTtlHours": 24,
|
|
183
|
+
"consumerConcurrency": 10,
|
|
184
|
+
"conversationLockTtlMs": 900000
|
|
185
|
+
},
|
|
186
|
+
"rateLimit": {
|
|
187
|
+
"enabled": true,
|
|
188
|
+
"windowMs": 60000,
|
|
189
|
+
"perMinute": 600,
|
|
190
|
+
"webwidgetPerMinute": 300,
|
|
191
|
+
"whatsappPerMinute": 600,
|
|
192
|
+
"apiPerMinute": 600,
|
|
193
|
+
"messageDedupeTtlHours": 24
|
|
194
|
+
},
|
|
195
|
+
"httpBatch": {
|
|
196
|
+
"timeoutMs": 120000,
|
|
197
|
+
"maxRequests": 10,
|
|
198
|
+
"pollingMaxAttempts": 20,
|
|
199
|
+
"pollingMaxIntervalSeconds": 60,
|
|
200
|
+
"pollingHistoryLimit": 8
|
|
201
|
+
},
|
|
202
|
+
"agentOps": {
|
|
203
|
+
"defaultHistoryLimit": 80,
|
|
204
|
+
"defaultTraceLimit": 600
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
services:
|
|
2
|
+
mongo:
|
|
3
|
+
image: mongo:7
|
|
4
|
+
ports:
|
|
5
|
+
- "27017:27017"
|
|
6
|
+
volumes:
|
|
7
|
+
- canvas_flow_mongo:/data/db
|
|
8
|
+
healthcheck:
|
|
9
|
+
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
|
|
10
|
+
interval: 10s
|
|
11
|
+
timeout: 5s
|
|
12
|
+
retries: 6
|
|
13
|
+
start_period: 15s
|
|
14
|
+
|
|
15
|
+
etcd:
|
|
16
|
+
image: quay.io/coreos/etcd:v3.5.5
|
|
17
|
+
environment:
|
|
18
|
+
ETCD_AUTO_COMPACTION_MODE: revision
|
|
19
|
+
ETCD_AUTO_COMPACTION_RETENTION: "1000"
|
|
20
|
+
ETCD_QUOTA_BACKEND_BYTES: "4294967296"
|
|
21
|
+
command: >
|
|
22
|
+
etcd
|
|
23
|
+
-advertise-client-urls=http://127.0.0.1:2379
|
|
24
|
+
-listen-client-urls=http://0.0.0.0:2379
|
|
25
|
+
--data-dir=/etcd
|
|
26
|
+
volumes:
|
|
27
|
+
- canvas_flow_etcd:/etcd
|
|
28
|
+
|
|
29
|
+
minio:
|
|
30
|
+
image: minio/minio:latest
|
|
31
|
+
environment:
|
|
32
|
+
MINIO_ROOT_USER: minioadmin
|
|
33
|
+
MINIO_ROOT_PASSWORD: minioadmin
|
|
34
|
+
command: minio server /minio_data --console-address ":9001"
|
|
35
|
+
ports:
|
|
36
|
+
- "9000:9000"
|
|
37
|
+
- "9001:9001"
|
|
38
|
+
volumes:
|
|
39
|
+
- canvas_flow_minio:/minio_data
|
|
40
|
+
|
|
41
|
+
milvus:
|
|
42
|
+
image: milvusdb/milvus:latest
|
|
43
|
+
command: ["milvus", "run", "standalone"]
|
|
44
|
+
environment:
|
|
45
|
+
ETCD_ENDPOINTS: etcd:2379
|
|
46
|
+
MINIO_ADDRESS: minio:9000
|
|
47
|
+
ports:
|
|
48
|
+
- "19530:19530"
|
|
49
|
+
- "9091:9091"
|
|
50
|
+
depends_on:
|
|
51
|
+
- etcd
|
|
52
|
+
- minio
|
|
53
|
+
volumes:
|
|
54
|
+
- canvas_flow_milvus:/var/lib/milvus
|
|
55
|
+
|
|
56
|
+
volumes:
|
|
57
|
+
canvas_flow_mongo:
|
|
58
|
+
canvas_flow_etcd:
|
|
59
|
+
canvas_flow_minio:
|
|
60
|
+
canvas_flow_milvus:
|