@flink-app/flink 0.14.3 → 2.0.0-alpha.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1051 -0
- package/SCHEMA_EXTRACTION_ANALYSIS.md +494 -0
- package/SIMPLE_AST_FEASIBILITY.md +570 -0
- package/bin/flink.ts +13 -2
- package/cli/build.ts +24 -44
- package/cli/clean.ts +13 -25
- package/cli/cli-utils.ts +190 -17
- package/cli/dev.ts +252 -0
- package/cli/loadEnvFiles.ts +116 -0
- package/cli/run.ts +45 -62
- package/dist/bin/flink.js +61 -2
- package/dist/cli/build.js +20 -25
- package/dist/cli/clean.js +12 -10
- package/dist/cli/cli-utils.d.ts +34 -3
- package/dist/cli/cli-utils.js +193 -12
- package/dist/cli/dev.d.ts +2 -0
- package/dist/cli/dev.js +279 -0
- package/dist/cli/loadEnvFiles.d.ts +30 -0
- package/dist/cli/loadEnvFiles.js +113 -0
- package/dist/cli/run.js +47 -46
- package/dist/src/DependencyTracker.d.ts +44 -0
- package/dist/src/DependencyTracker.js +239 -0
- package/dist/src/FlinkApp.d.ts +163 -10
- package/dist/src/FlinkApp.js +847 -184
- package/dist/src/FlinkContext.d.ts +41 -0
- package/dist/src/FlinkErrors.d.ts +19 -6
- package/dist/src/FlinkErrors.js +36 -42
- package/dist/src/FlinkHttpHandler.d.ts +219 -26
- package/dist/src/FlinkHttpHandler.js +37 -1
- package/dist/src/FlinkJob.d.ts +10 -0
- package/dist/src/FlinkLog.d.ts +82 -18
- package/dist/src/FlinkLog.js +165 -13
- package/dist/src/FlinkLogFactory.d.ts +288 -0
- package/dist/src/FlinkLogFactory.js +619 -0
- package/dist/src/FlinkRepo.d.ts +10 -2
- package/dist/src/FlinkRepo.js +11 -1
- package/dist/src/FlinkRequestContext.d.ts +63 -0
- package/dist/src/FlinkRequestContext.js +74 -0
- package/dist/src/FlinkResponse.d.ts +6 -0
- package/dist/src/FlinkService.d.ts +38 -0
- package/dist/src/FlinkService.js +46 -0
- package/dist/src/LeaderElection.d.ts +45 -0
- package/dist/src/LeaderElection.js +269 -0
- package/dist/src/SchemaCache.d.ts +84 -0
- package/dist/src/SchemaCache.js +289 -0
- package/dist/src/TypeScriptCompiler.d.ts +161 -51
- package/dist/src/TypeScriptCompiler.js +1253 -617
- package/dist/src/TypeScriptUtils.js +4 -0
- package/dist/src/ai/AgentRunner.d.ts +39 -0
- package/dist/src/ai/AgentRunner.js +760 -0
- package/dist/src/ai/ConversationAgent.d.ts +279 -0
- package/dist/src/ai/ConversationAgent.js +404 -0
- package/dist/src/ai/ConversationFlinkAgent.d.ts +278 -0
- package/dist/src/ai/ConversationFlinkAgent.js +404 -0
- package/dist/src/ai/FlinkAgent.d.ts +690 -0
- package/dist/src/ai/FlinkAgent.js +729 -0
- package/dist/src/ai/FlinkTool.d.ts +135 -0
- package/dist/src/ai/FlinkTool.js +2 -0
- package/dist/src/ai/InMemoryConversationAgent.d.ts +121 -0
- package/dist/src/ai/InMemoryConversationAgent.js +209 -0
- package/dist/src/ai/LLMAdapter.d.ts +148 -0
- package/dist/src/ai/LLMAdapter.js +2 -0
- package/dist/src/ai/PersistentFlinkAgent.d.ts +278 -0
- package/dist/src/ai/PersistentFlinkAgent.js +403 -0
- package/dist/src/ai/SubAgentExecutor.d.ts +38 -0
- package/dist/src/ai/SubAgentExecutor.js +223 -0
- package/dist/src/ai/ToolExecutor.d.ts +64 -0
- package/dist/src/ai/ToolExecutor.js +497 -0
- package/dist/src/ai/agentInstructions.d.ts +68 -0
- package/dist/src/ai/agentInstructions.js +286 -0
- package/dist/src/ai/index.d.ts +8 -0
- package/dist/src/ai/index.js +26 -0
- package/dist/src/ai/instructionFileLoader.d.ts +44 -0
- package/dist/src/ai/instructionFileLoader.js +179 -0
- package/dist/src/auth/FlinkAuthPlugin.d.ts +1 -1
- package/dist/src/handlers/StreamWriterFactory.d.ts +20 -0
- package/dist/src/handlers/StreamWriterFactory.js +83 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +17 -0
- package/dist/src/loadPluginSchemas.d.ts +45 -0
- package/dist/src/loadPluginSchemas.js +143 -0
- package/dist/src/schema-extraction/ComplexTypeDetection.d.ts +40 -0
- package/dist/src/schema-extraction/ComplexTypeDetection.js +75 -0
- package/dist/src/schema-extraction/TypeScriptSourceParser.d.ts +321 -0
- package/dist/src/schema-extraction/TypeScriptSourceParser.js +925 -0
- package/dist/src/schema-extraction/TypeScriptSourceParser.spec.d.ts +1 -0
- package/dist/src/schema-extraction/TypeScriptSourceParser.spec.js +233 -0
- package/dist/src/schema-extraction/TypeScriptTokenizer.d.ts +57 -0
- package/dist/src/schema-extraction/TypeScriptTokenizer.js +177 -0
- package/dist/src/schema-extraction/index.d.ts +2 -0
- package/dist/src/schema-extraction/index.js +20 -0
- package/dist/src/schema-extraction/types.d.ts +31 -0
- package/dist/src/schema-extraction/types.js +2 -0
- package/dist/src/utils/loadFlinkConfig.d.ts +53 -0
- package/dist/src/utils/loadFlinkConfig.js +77 -0
- package/dist/src/utils.d.ts +30 -0
- package/dist/src/utils.js +52 -0
- package/dist/src/workers/SchemaGeneratorWorker.d.ts +1 -0
- package/dist/src/workers/SchemaGeneratorWorker.js +49 -0
- package/dist/src/workers/WorkerPool.d.ts +60 -0
- package/dist/src/workers/WorkerPool.js +306 -0
- package/examples/logging-hierarchical-example.ts +125 -0
- package/package.json +29 -4
- package/readme.md +499 -0
- package/spec/AgentDescendantDetection.spec.ts +335 -0
- package/spec/AgentDuplicateDetection.spec.ts +112 -0
- package/spec/AgentObserver.spec.ts +266 -0
- package/spec/AgentRunner.spec.ts +1062 -0
- package/spec/AsyncLocalStorageContext.spec.ts +223 -0
- package/spec/ConversationHooks.spec.ts +257 -0
- package/spec/FlinkAgent.spec.ts +681 -0
- package/spec/FlinkApp.htmlResponse.spec.ts +260 -0
- package/spec/FlinkApp.onError.invocation.spec.ts +151 -0
- package/spec/FlinkApp.onError.spec.ts +1 -2
- package/spec/FlinkApp.query.spec.ts +107 -0
- package/spec/FlinkApp.routeOrdering.spec.ts +61 -0
- package/spec/FlinkApp.undefinedResponse.spec.ts +123 -0
- package/spec/FlinkApp.validationMode.spec.ts +155 -0
- package/spec/FlinkJob.spec.ts +171 -0
- package/spec/FlinkLogFactory.spec.ts +337 -0
- package/spec/FlinkRepo.spec.ts +1 -1
- package/spec/LeaderElection.spec.ts +174 -0
- package/spec/StreamingIntegration.spec.ts +139 -0
- package/spec/ToolExecutor.spec.ts +465 -0
- package/spec/TypeScriptCompiler.spec.ts +1 -1
- package/spec/TypeScriptSourceParser.spec.ts +1215 -0
- package/spec/TypeScriptTokenizer.spec.ts +366 -0
- package/spec/ai/ContextCompaction.spec.ts +405 -0
- package/spec/ai/ConversationAgent.spec.ts +520 -0
- package/spec/ai/InMemoryConversationAgent.spec.ts +144 -0
- package/spec/ai/agentInstructions.spec.ts +358 -0
- package/spec/fixtures/agent-instructions/TestAgent.ts +24 -0
- package/spec/fixtures/agent-instructions/simple.md +3 -0
- package/spec/fixtures/agent-instructions/template.md +18 -0
- package/spec/fixtures/agent-instructions/yaml-format.yaml +9 -0
- package/spec/mock-project/dist/.tsbuildinfo +1 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCar.js +56 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCar2.js +58 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithArraySchema.js +52 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithArraySchema2.js +52 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithArraySchema3.js +52 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithLiteralSchema.js +54 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithLiteralSchema2.js +54 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithSchemaInFile.js +57 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithSchemaInFile2.js +57 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/ManuallyAddedHandler.js +53 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/ManuallyAddedHandler2.js +55 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchCar.js +57 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchOnboardingSession.js +75 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchOrderWithComplexTypes.js +57 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchProductWithIntersection.js +58 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchUserWithUnion.js +58 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PostCar.js +54 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PostLogin.js +55 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PostLogout.js +54 -0
- package/spec/mock-project/dist/spec/mock-project/src/handlers/PutCar.js +54 -0
- package/spec/mock-project/dist/spec/mock-project/src/index.js +83 -0
- package/spec/mock-project/dist/spec/mock-project/src/repos/CarRepo.js +26 -0
- package/spec/mock-project/dist/spec/mock-project/src/schemas/Car.js +2 -0
- package/spec/mock-project/dist/spec/mock-project/src/schemas/DefaultExportSchema.js +2 -0
- package/spec/mock-project/dist/spec/mock-project/src/schemas/FileWithTwoSchemas.js +2 -0
- package/spec/mock-project/dist/src/FlinkApp.js +1000 -0
- package/spec/mock-project/dist/src/FlinkContext.js +2 -0
- package/spec/mock-project/dist/src/FlinkErrors.js +143 -0
- package/spec/mock-project/dist/src/FlinkHttpHandler.js +47 -0
- package/spec/mock-project/dist/src/FlinkJob.js +2 -0
- package/spec/mock-project/dist/src/FlinkLog.js +119 -0
- package/spec/mock-project/dist/src/FlinkLogFactory.js +617 -0
- package/spec/mock-project/dist/src/FlinkPlugin.js +2 -0
- package/spec/mock-project/dist/src/FlinkRepo.js +224 -0
- package/spec/mock-project/dist/src/FlinkRequestContext.js +74 -0
- package/spec/mock-project/dist/src/FlinkResponse.js +2 -0
- package/spec/mock-project/dist/src/ai/AgentExecutor.js +279 -0
- package/spec/mock-project/dist/src/ai/AgentRunner.js +632 -0
- package/spec/mock-project/dist/src/ai/ConversationAgent.js +402 -0
- package/spec/mock-project/dist/src/ai/ConversationFlinkAgent.js +422 -0
- package/spec/mock-project/dist/src/ai/FlinkAgent.js +699 -0
- package/spec/mock-project/dist/src/ai/FlinkTool.js +2 -0
- package/spec/mock-project/dist/src/ai/InMemoryConversationAgent.js +209 -0
- package/spec/mock-project/dist/src/ai/LLMAdapter.js +2 -0
- package/spec/mock-project/dist/src/ai/SubAgentExecutor.js +223 -0
- package/spec/mock-project/dist/src/ai/ToolExecutor.js +412 -0
- package/spec/mock-project/dist/src/ai/agentInstructions.js +246 -0
- package/spec/mock-project/dist/src/auth/FlinkAuthPlugin.js +2 -0
- package/spec/mock-project/dist/src/auth/FlinkAuthUser.js +2 -0
- package/spec/mock-project/dist/src/handlers/GetCar.js +26 -52
- package/spec/mock-project/dist/src/handlers/GetCar.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCar2.js +32 -54
- package/spec/mock-project/dist/src/handlers/GetCar2.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema.js +26 -48
- package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema2.js +28 -48
- package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema2.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema3.js +29 -48
- package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema3.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema.js +26 -50
- package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema2.js +28 -50
- package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema2.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile.js +27 -53
- package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile2.js +29 -53
- package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile2.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler.js +16 -49
- package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler2.js +25 -50
- package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler2.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PatchCar.js +27 -53
- package/spec/mock-project/dist/src/handlers/PatchCar.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PatchOnboardingSession.js +44 -70
- package/spec/mock-project/dist/src/handlers/PatchOnboardingSession.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PatchOrderWithComplexTypes.js +27 -53
- package/spec/mock-project/dist/src/handlers/PatchOrderWithComplexTypes.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PatchProductWithIntersection.js +28 -54
- package/spec/mock-project/dist/src/handlers/PatchProductWithIntersection.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PatchUserWithUnion.js +28 -54
- package/spec/mock-project/dist/src/handlers/PatchUserWithUnion.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PostCar.js +24 -50
- package/spec/mock-project/dist/src/handlers/PostCar.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PostLogin.js +25 -51
- package/spec/mock-project/dist/src/handlers/PostLogin.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PostLogout.js +24 -50
- package/spec/mock-project/dist/src/handlers/PostLogout.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/PutCar.js +24 -50
- package/spec/mock-project/dist/src/handlers/PutCar.js.map +1 -0
- package/spec/mock-project/dist/src/handlers/StreamWriterFactory.js +83 -0
- package/spec/mock-project/dist/src/index.js +52 -76
- package/spec/mock-project/dist/src/index.js.map +1 -0
- package/spec/mock-project/dist/src/mock-data-generator.js +9 -0
- package/spec/mock-project/dist/src/repos/CarRepo.js +12 -24
- package/spec/mock-project/dist/src/repos/CarRepo.js.map +1 -0
- package/spec/mock-project/dist/src/schemas/Car.js +3 -1
- package/spec/mock-project/dist/src/schemas/Car.js.map +1 -0
- package/spec/mock-project/dist/src/schemas/DefaultExportSchema.js +3 -1
- package/spec/mock-project/dist/src/schemas/DefaultExportSchema.js.map +1 -0
- package/spec/mock-project/dist/src/schemas/FileWithTwoSchemas.js +3 -1
- package/spec/mock-project/dist/src/schemas/FileWithTwoSchemas.js.map +1 -0
- package/spec/mock-project/dist/src/utils.js +290 -0
- package/spec/mock-project/tsconfig.json +6 -1
- package/spec/schema-generation-nested-objects.spec.ts +97 -0
- package/spec/testHelpers.ts +49 -0
- package/spec/utils.caseConversion.spec.ts +78 -0
- package/spec/utils.spec.ts +13 -13
- package/src/DependencyTracker.ts +166 -0
- package/src/FlinkApp.ts +919 -155
- package/src/FlinkContext.ts +43 -0
- package/src/FlinkErrors.ts +32 -12
- package/src/FlinkHttpHandler.ts +246 -28
- package/src/FlinkJob.ts +11 -0
- package/src/FlinkLog.ts +119 -12
- package/src/FlinkLogFactory.ts +699 -0
- package/src/FlinkRepo.ts +10 -3
- package/src/FlinkRequestContext.ts +95 -0
- package/src/FlinkResponse.ts +6 -0
- package/src/FlinkService.ts +49 -0
- package/src/LeaderElection.ts +203 -0
- package/src/SchemaCache.ts +232 -0
- package/src/TypeScriptCompiler.ts +1347 -610
- package/src/TypeScriptUtils.ts +5 -0
- package/src/ai/AgentRunner.ts +646 -0
- package/src/ai/ConversationAgent.ts +413 -0
- package/src/ai/FlinkAgent.ts +1069 -0
- package/src/ai/FlinkTool.ts +165 -0
- package/src/ai/InMemoryConversationAgent.ts +149 -0
- package/src/ai/LLMAdapter.ts +126 -0
- package/src/ai/ToolExecutor.ts +485 -0
- package/src/ai/agentInstructions.ts +245 -0
- package/src/ai/index.ts +8 -0
- package/src/ai/instructionFileLoader.ts +156 -0
- package/src/auth/FlinkAuthPlugin.ts +2 -1
- package/src/handlers/StreamWriterFactory.ts +84 -0
- package/src/index.ts +14 -0
- package/src/loadPluginSchemas.ts +141 -0
- package/src/schema-extraction/TypeScriptSourceParser.ts +1058 -0
- package/src/schema-extraction/TypeScriptTokenizer.ts +205 -0
- package/src/schema-extraction/index.ts +2 -0
- package/src/schema-extraction/types.ts +34 -0
- package/src/utils/loadFlinkConfig.ts +89 -0
- package/src/utils.ts +52 -0
- package/tsconfig.json +6 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
36
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.DependencyTracker = void 0;
|
|
63
|
+
var path = __importStar(require("path"));
|
|
64
|
+
var minimatch_1 = require("minimatch");
|
|
65
|
+
var SchemaCache_1 = require("./SchemaCache");
|
|
66
|
+
/**
|
|
67
|
+
* Tracks dependencies and computes content hashes for schema files
|
|
68
|
+
*/
|
|
69
|
+
var DependencyTracker = /** @class */ (function () {
|
|
70
|
+
function DependencyTracker(projectRoot, config) {
|
|
71
|
+
var _a;
|
|
72
|
+
this.projectRoot = projectRoot;
|
|
73
|
+
this.dependencyCache = new Map();
|
|
74
|
+
this.config = {
|
|
75
|
+
excludeNodeModules: (_a = config === null || config === void 0 ? void 0 : config.excludeNodeModules) !== null && _a !== void 0 ? _a : true,
|
|
76
|
+
includePatterns: (config === null || config === void 0 ? void 0 : config.includePatterns) || [],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Check if a file path should be tracked in the cache
|
|
81
|
+
*/
|
|
82
|
+
DependencyTracker.prototype.shouldTrackFile = function (filePath) {
|
|
83
|
+
var isNodeModules = filePath.includes('node_modules');
|
|
84
|
+
// If not in node_modules, always track
|
|
85
|
+
if (!isNodeModules) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
// If excludeNodeModules is false, track all node_modules
|
|
89
|
+
if (!this.config.excludeNodeModules) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
// Check if path matches any include pattern
|
|
93
|
+
if (this.config.includePatterns && this.config.includePatterns.length > 0) {
|
|
94
|
+
var relativePath = path.relative(this.projectRoot, filePath);
|
|
95
|
+
for (var _i = 0, _a = this.config.includePatterns; _i < _a.length; _i++) {
|
|
96
|
+
var pattern = _a[_i];
|
|
97
|
+
if ((0, minimatch_1.minimatch)(relativePath, pattern) || (0, minimatch_1.minimatch)(filePath, pattern)) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Exclude by default
|
|
103
|
+
return false;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Build dependency graph for a schema file
|
|
107
|
+
* Returns map of absolute file paths to their content hashes
|
|
108
|
+
*/
|
|
109
|
+
DependencyTracker.prototype.buildDependencyGraph = function (schemaFile, resolveImports) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
var dependencies, visited;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
dependencies = new Map();
|
|
116
|
+
visited = new Set();
|
|
117
|
+
// Recursively collect all dependencies
|
|
118
|
+
return [4 /*yield*/, this.collectDependencies(schemaFile, resolveImports, visited, dependencies)];
|
|
119
|
+
case 1:
|
|
120
|
+
// Recursively collect all dependencies
|
|
121
|
+
_a.sent();
|
|
122
|
+
return [2 /*return*/, dependencies];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Recursively collect dependencies and compute hashes
|
|
129
|
+
*/
|
|
130
|
+
DependencyTracker.prototype.collectDependencies = function (filePath, resolveImports, visited, dependencies) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
132
|
+
var hash, imports;
|
|
133
|
+
var _this = this;
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
136
|
+
case 0:
|
|
137
|
+
// Skip if already visited
|
|
138
|
+
if (visited.has(filePath)) {
|
|
139
|
+
return [2 /*return*/];
|
|
140
|
+
}
|
|
141
|
+
visited.add(filePath);
|
|
142
|
+
// Check if file should be tracked based on config
|
|
143
|
+
if (!this.shouldTrackFile(filePath)) {
|
|
144
|
+
return [2 /*return*/];
|
|
145
|
+
}
|
|
146
|
+
return [4 /*yield*/, SchemaCache_1.SchemaCache.hashFile(filePath)];
|
|
147
|
+
case 1:
|
|
148
|
+
hash = _a.sent();
|
|
149
|
+
if (hash) {
|
|
150
|
+
dependencies.set(filePath, hash);
|
|
151
|
+
}
|
|
152
|
+
imports = resolveImports(filePath);
|
|
153
|
+
// Recursively process imports
|
|
154
|
+
return [4 /*yield*/, Promise.all(imports.map(function (importPath) {
|
|
155
|
+
return _this.collectDependencies(importPath, resolveImports, visited, dependencies);
|
|
156
|
+
}))];
|
|
157
|
+
case 2:
|
|
158
|
+
// Recursively process imports
|
|
159
|
+
_a.sent();
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Batch compute hashes for multiple files
|
|
167
|
+
* Returns map of file paths to hashes
|
|
168
|
+
*/
|
|
169
|
+
DependencyTracker.prototype.batchHashFiles = function (filePaths) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
+
var hashes, results, _i, results_1, _a, filePath, hash;
|
|
172
|
+
var _this = this;
|
|
173
|
+
return __generator(this, function (_b) {
|
|
174
|
+
switch (_b.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
hashes = new Map();
|
|
177
|
+
return [4 /*yield*/, Promise.all(filePaths.map(function (filePath) { return __awaiter(_this, void 0, void 0, function () {
|
|
178
|
+
var _a;
|
|
179
|
+
return __generator(this, function (_b) {
|
|
180
|
+
switch (_b.label) {
|
|
181
|
+
case 0:
|
|
182
|
+
_a = {
|
|
183
|
+
filePath: filePath
|
|
184
|
+
};
|
|
185
|
+
return [4 /*yield*/, SchemaCache_1.SchemaCache.hashFile(filePath)];
|
|
186
|
+
case 1: return [2 /*return*/, (_a.hash = _b.sent(),
|
|
187
|
+
_a)];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}); }))];
|
|
191
|
+
case 1:
|
|
192
|
+
results = _b.sent();
|
|
193
|
+
// Build map
|
|
194
|
+
for (_i = 0, results_1 = results; _i < results_1.length; _i++) {
|
|
195
|
+
_a = results_1[_i], filePath = _a.filePath, hash = _a.hash;
|
|
196
|
+
if (hash) {
|
|
197
|
+
hashes.set(filePath, hash);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return [2 /*return*/, hashes];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Check if any dependencies changed
|
|
207
|
+
* Returns list of changed file paths
|
|
208
|
+
*/
|
|
209
|
+
DependencyTracker.prototype.findChangedDependencies = function (dependencies, cachedHashes) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
211
|
+
var changed, _i, _a, _b, filePath, currentHash, cachedHash;
|
|
212
|
+
return __generator(this, function (_c) {
|
|
213
|
+
changed = [];
|
|
214
|
+
for (_i = 0, _a = Array.from(dependencies.entries()); _i < _a.length; _i++) {
|
|
215
|
+
_b = _a[_i], filePath = _b[0], currentHash = _b[1];
|
|
216
|
+
cachedHash = cachedHashes[filePath];
|
|
217
|
+
if (cachedHash !== currentHash) {
|
|
218
|
+
changed.push(filePath);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return [2 /*return*/, changed];
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Get relative path for display purposes
|
|
227
|
+
*/
|
|
228
|
+
DependencyTracker.prototype.getRelativePath = function (filePath) {
|
|
229
|
+
return path.relative(this.projectRoot, filePath);
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Clear dependency cache
|
|
233
|
+
*/
|
|
234
|
+
DependencyTracker.prototype.clearCache = function () {
|
|
235
|
+
this.dependencyCache.clear();
|
|
236
|
+
};
|
|
237
|
+
return DependencyTracker;
|
|
238
|
+
}());
|
|
239
|
+
exports.DependencyTracker = DependencyTracker;
|
package/dist/src/FlinkApp.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
1
2
|
import { OptionsJson } from "body-parser";
|
|
2
3
|
import express, { Express } from "express";
|
|
3
4
|
import { JSONSchema7 } from "json-schema";
|
|
4
5
|
import { Db, MongoClient } from "mongodb";
|
|
5
6
|
import { ToadScheduler } from "toad-scheduler";
|
|
7
|
+
import { FlinkAgentFile } from "./ai/FlinkAgent";
|
|
8
|
+
import { FlinkToolFile } from "./ai/FlinkTool";
|
|
9
|
+
import { AgentObserver } from "./ai/FlinkAgent";
|
|
10
|
+
import { LLMAdapter } from "./ai/LLMAdapter";
|
|
6
11
|
import { FlinkAuthPlugin } from "./auth/FlinkAuthPlugin";
|
|
7
12
|
import { FlinkContext } from "./FlinkContext";
|
|
8
13
|
import { FlinkError } from "./FlinkErrors";
|
|
9
14
|
import { FlinkRequest, HandlerFile, HttpMethod, QueryParamMetadata, RouteProps } from "./FlinkHttpHandler";
|
|
10
15
|
import { FlinkJobFile } from "./FlinkJob";
|
|
16
|
+
import { LeaderElectionOptions } from "./LeaderElection";
|
|
11
17
|
import { FlinkPlugin } from "./FlinkPlugin";
|
|
12
18
|
import { FlinkRepo } from "./FlinkRepo";
|
|
13
19
|
import { FlinkResponse } from "./FlinkResponse";
|
|
@@ -24,6 +30,7 @@ export declare const expressFn: typeof express;
|
|
|
24
30
|
export declare const autoRegisteredHandlers: {
|
|
25
31
|
handler: HandlerFile;
|
|
26
32
|
assumedHttpMethod: HttpMethod;
|
|
33
|
+
__file?: string;
|
|
27
34
|
}[];
|
|
28
35
|
/**
|
|
29
36
|
* This will be populated at compile time when the apps repos
|
|
@@ -39,7 +46,25 @@ export declare const autoRegisteredRepos: {
|
|
|
39
46
|
* are picked up by TypeScript compiler
|
|
40
47
|
*/
|
|
41
48
|
export declare const autoRegisteredJobs: FlinkJobFile[];
|
|
42
|
-
|
|
49
|
+
/**
|
|
50
|
+
* This will be populated at compile time when the apps tools
|
|
51
|
+
* are picked up by TypeScript compiler
|
|
52
|
+
*/
|
|
53
|
+
export declare const autoRegisteredTools: FlinkToolFile[];
|
|
54
|
+
/**
|
|
55
|
+
* This will be populated at compile time when the apps agents
|
|
56
|
+
* are picked up by TypeScript compiler
|
|
57
|
+
*/
|
|
58
|
+
export declare const autoRegisteredAgents: FlinkAgentFile<any, any>[];
|
|
59
|
+
/**
|
|
60
|
+
* This will be populated at compile time when the apps services
|
|
61
|
+
* are picked up by TypeScript compiler
|
|
62
|
+
*/
|
|
63
|
+
export declare const autoRegisteredServices: {
|
|
64
|
+
serviceInstanceName: string;
|
|
65
|
+
Service: any;
|
|
66
|
+
}[];
|
|
67
|
+
export interface FlinkOptions<C extends FlinkContext = FlinkContext> {
|
|
43
68
|
/**
|
|
44
69
|
* Name of application, will only show in logs and in HTTP header.
|
|
45
70
|
*/
|
|
@@ -117,10 +142,61 @@ export interface FlinkOptions {
|
|
|
117
142
|
* Defaults to true.
|
|
118
143
|
*/
|
|
119
144
|
enabled?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Enable leader election for horizontally scaled deployments.
|
|
147
|
+
*
|
|
148
|
+
* When enabled, only one instance (the leader) will run scheduled jobs.
|
|
149
|
+
* If the leader goes down, another instance automatically takes over.
|
|
150
|
+
*
|
|
151
|
+
* Requires a database connection (`db` option) since leader election
|
|
152
|
+
* state is persisted in MongoDB. If no database is configured, a warning
|
|
153
|
+
* will be logged and jobs will run on all instances (no leader election).
|
|
154
|
+
*
|
|
155
|
+
* Set to `true` for default settings, or pass an options object to customize.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* // Use defaults (15s lease, 5s heartbeat)
|
|
160
|
+
* scheduling: { leaderElection: true }
|
|
161
|
+
*
|
|
162
|
+
* // Custom settings
|
|
163
|
+
* scheduling: {
|
|
164
|
+
* leaderElection: {
|
|
165
|
+
* leaseDurationMs: 30000,
|
|
166
|
+
* heartbeatIntervalMs: 10000,
|
|
167
|
+
* }
|
|
168
|
+
* }
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
leaderElection?: boolean | LeaderElectionOptions;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* AI configuration for agents and tools
|
|
175
|
+
* Register LLM adapters with custom IDs (e.g., "anthropic", "openai", "anthropic-eu", etc.)
|
|
176
|
+
* This allows multiple adapters of the same type with different configurations
|
|
177
|
+
*/
|
|
178
|
+
ai?: {
|
|
179
|
+
llms?: {
|
|
180
|
+
[id: string]: LLMAdapter;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Global agent observer for app-level tracing, APM, cost accounting, dev tools, etc.
|
|
184
|
+
*
|
|
185
|
+
* Fires for every agent execution in the app. Observer callbacks are invoked
|
|
186
|
+
* fire-and-forget — they may return a Promise but the framework does not await
|
|
187
|
+
* them, and any thrown/rejected errors are caught and logged without affecting
|
|
188
|
+
* agent execution.
|
|
189
|
+
*
|
|
190
|
+
* Events: `onRun` (pre-loop), `onLlmCall` (per step, pre-adapter call),
|
|
191
|
+
* `onStep` (per step end), `onFinish` (post-loop, including error path).
|
|
192
|
+
*
|
|
193
|
+
* For agent-local business logic (conversation persistence, guardrails) use the
|
|
194
|
+
* per-agent `beforeRun` / `onStep` / `afterRun` hooks on `FlinkAgent` instead.
|
|
195
|
+
*/
|
|
196
|
+
observer?: AgentObserver;
|
|
120
197
|
};
|
|
121
198
|
/**
|
|
122
199
|
* If true, the HTTP server will be disabled.
|
|
123
|
-
* Only useful when starting a Flink app for testing purposes.
|
|
124
200
|
*/
|
|
125
201
|
disableHttpServer?: boolean;
|
|
126
202
|
/**
|
|
@@ -139,17 +215,26 @@ export interface FlinkOptions {
|
|
|
139
215
|
format?: string;
|
|
140
216
|
};
|
|
141
217
|
/**
|
|
142
|
-
* Optional callback invoked when an error occurs
|
|
218
|
+
* Optional callback invoked when an error occurs while serving a request.
|
|
143
219
|
* The error response and request context are passed for custom
|
|
144
220
|
* error logging or monitoring. This is a side-effect only and
|
|
145
221
|
* will not modify the response flow.
|
|
146
222
|
*
|
|
223
|
+
* Invoked for:
|
|
224
|
+
* - Handler-thrown errors (FlinkErrors and unhandled exceptions)
|
|
225
|
+
* - Request validation failures (400 Bad request)
|
|
226
|
+
* - Response validation failures (500 Bad response)
|
|
227
|
+
*
|
|
228
|
+
* Not invoked for errors in streaming (SSE/NDJSON) handlers, which are
|
|
229
|
+
* delivered to the client via `stream.error()` instead.
|
|
230
|
+
*
|
|
147
231
|
* Supports both synchronous and asynchronous callbacks. Any errors
|
|
148
232
|
* thrown or rejected by the callback will be caught and logged
|
|
149
|
-
* without affecting the error response to the client.
|
|
233
|
+
* without affecting the error response to the client. Async callbacks
|
|
234
|
+
* are fire-and-forget — they are not awaited before the response is sent.
|
|
150
235
|
*
|
|
151
236
|
* @param error - The error response with status and error details
|
|
152
|
-
* @param context - Request context including method, path, and
|
|
237
|
+
* @param context - Request context including method, path, request ID and the app context
|
|
153
238
|
*
|
|
154
239
|
* @example
|
|
155
240
|
* ```ts
|
|
@@ -165,12 +250,14 @@ export interface FlinkOptions {
|
|
|
165
250
|
* }
|
|
166
251
|
* }
|
|
167
252
|
*
|
|
168
|
-
* // Asynchronous callback
|
|
253
|
+
* // Asynchronous callback using the app context
|
|
169
254
|
* onError: async (error, context) => {
|
|
170
255
|
* if (error.status >= 500) {
|
|
171
|
-
* await
|
|
172
|
-
* error,
|
|
173
|
-
*
|
|
256
|
+
* await context.ctx.repos.errorLogRepo.create({
|
|
257
|
+
* status: error.status,
|
|
258
|
+
* detail: error.error?.detail,
|
|
259
|
+
* route: `${context.method} ${context.path}`,
|
|
260
|
+
* reqId: context.reqId,
|
|
174
261
|
* });
|
|
175
262
|
* }
|
|
176
263
|
* }
|
|
@@ -181,6 +268,7 @@ export interface FlinkOptions {
|
|
|
181
268
|
method: HttpMethod;
|
|
182
269
|
path: string;
|
|
183
270
|
reqId: string;
|
|
271
|
+
ctx: C;
|
|
184
272
|
}) => void | Promise<void>;
|
|
185
273
|
}
|
|
186
274
|
export interface HandlerConfig {
|
|
@@ -213,6 +301,8 @@ export declare class FlinkApp<C extends FlinkContext> {
|
|
|
213
301
|
started: boolean;
|
|
214
302
|
private _ctx?;
|
|
215
303
|
private dbOpts?;
|
|
304
|
+
private schemaManifest?;
|
|
305
|
+
private schemaAjv?;
|
|
216
306
|
private debug;
|
|
217
307
|
private onDbConnection?;
|
|
218
308
|
private plugins;
|
|
@@ -226,13 +316,20 @@ export declare class FlinkApp<C extends FlinkContext> {
|
|
|
226
316
|
private expressServer;
|
|
227
317
|
private onError?;
|
|
228
318
|
private repos;
|
|
319
|
+
private services;
|
|
320
|
+
private llmAdapters;
|
|
321
|
+
private agentObserver?;
|
|
322
|
+
private tools;
|
|
323
|
+
private agents;
|
|
229
324
|
/**
|
|
230
325
|
* Internal cache used to track registered handlers and potentially any overlapping routes
|
|
231
326
|
*/
|
|
232
327
|
private handlerRouteCache;
|
|
233
328
|
scheduler?: ToadScheduler;
|
|
329
|
+
private allInstanceScheduler?;
|
|
330
|
+
private leaderElection?;
|
|
234
331
|
private accessLog;
|
|
235
|
-
constructor(opts: FlinkOptions);
|
|
332
|
+
constructor(opts: FlinkOptions<C>);
|
|
236
333
|
get ctx(): C;
|
|
237
334
|
start(): Promise<this>;
|
|
238
335
|
stop(): Promise<void>;
|
|
@@ -244,6 +341,47 @@ export declare class FlinkApp<C extends FlinkContext> {
|
|
|
244
341
|
*/
|
|
245
342
|
addHandler(handler: HandlerFile, routePropsOverride?: Partial<HandlerConfig["routeProps"]>): void;
|
|
246
343
|
private registerHandler;
|
|
344
|
+
/**
|
|
345
|
+
* Load schema manifest from .flink directory.
|
|
346
|
+
* Returns empty structure if manifest doesn't exist (dev mode without build).
|
|
347
|
+
*
|
|
348
|
+
* The manifest contains:
|
|
349
|
+
* - definitions: ALL JSON Schema type definitions (supports $ref resolution)
|
|
350
|
+
* - handlers: Handler metadata with schema names (references to definitions)
|
|
351
|
+
* - tools: Tool metadata with schema names (references to definitions)
|
|
352
|
+
*/
|
|
353
|
+
private loadSchemaManifest;
|
|
354
|
+
/**
|
|
355
|
+
* Get the AJV instance for validation (v2.0 manifests).
|
|
356
|
+
* Returns undefined for v1.0 manifests.
|
|
357
|
+
*/
|
|
358
|
+
getSchemaAjv(): Ajv | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Register plugin schemas into the app's AJV instance.
|
|
361
|
+
* Schema $id values are prefixed with `pluginId::` to avoid collisions
|
|
362
|
+
* with the app's own schemas or other plugins.
|
|
363
|
+
*
|
|
364
|
+
* @param pluginId Unique identifier for the plugin (used as namespace prefix)
|
|
365
|
+
* @param schemas Record of schema name to JSON Schema object (already prefixed)
|
|
366
|
+
*/
|
|
367
|
+
registerSchemas(pluginId: string, schemas: Record<string, any>): void;
|
|
368
|
+
/**
|
|
369
|
+
* Check if a schema has unresolved generic type parameter references.
|
|
370
|
+
* Generic type parameters like T, U, V are single uppercase letters.
|
|
371
|
+
*
|
|
372
|
+
* @param schema JSON schema object
|
|
373
|
+
* @param registeredSchemaIds List of schema IDs in the manifest
|
|
374
|
+
* @returns true if schema references generic type params that don't exist
|
|
375
|
+
*/
|
|
376
|
+
private hasUnresolvedTypeParams;
|
|
377
|
+
/**
|
|
378
|
+
* Resolve schema by name from manifest.
|
|
379
|
+
* Works with both v1.0 (definitions) and v2.0 (schema universe) formats.
|
|
380
|
+
*
|
|
381
|
+
* @param schemaName Schema name or $id
|
|
382
|
+
* @returns JSON schema object or undefined
|
|
383
|
+
*/
|
|
384
|
+
private resolveSchema;
|
|
247
385
|
/**
|
|
248
386
|
* Register handlers found within the `/src/handlers`
|
|
249
387
|
* directory in Flink App.
|
|
@@ -253,11 +391,18 @@ export declare class FlinkApp<C extends FlinkContext> {
|
|
|
253
391
|
private registerAutoRegisterableHandlers;
|
|
254
392
|
private registerAutoRegisterableJobs;
|
|
255
393
|
addRepo(instanceName: string, repoInstance: FlinkRepo<C, any>): void;
|
|
394
|
+
private registerAutoRegisterableTools;
|
|
395
|
+
private registerAutoRegisterableAgents;
|
|
256
396
|
/**
|
|
257
397
|
* Constructs the app context. Will inject context in all components
|
|
258
398
|
* except for handlers which are handled in later stage.
|
|
259
399
|
*/
|
|
260
400
|
private buildContext;
|
|
401
|
+
/**
|
|
402
|
+
* Initialize agents after they've been registered and context is ready
|
|
403
|
+
* Must be called after registerAutoRegisterableAgents()
|
|
404
|
+
*/
|
|
405
|
+
private initializeAgents;
|
|
261
406
|
/**
|
|
262
407
|
* Connects to database.
|
|
263
408
|
*/
|
|
@@ -267,7 +412,15 @@ export declare class FlinkApp<C extends FlinkContext> {
|
|
|
267
412
|
*/
|
|
268
413
|
private initPluginDb;
|
|
269
414
|
private authenticate;
|
|
415
|
+
/**
|
|
416
|
+
* Invokes the optional onError callback in a fire-and-forget manner.
|
|
417
|
+
* Any error thrown or rejected by the callback is caught and logged so
|
|
418
|
+
* it never affects the error response sent to the client.
|
|
419
|
+
*/
|
|
420
|
+
private invokeOnError;
|
|
270
421
|
getRegisteredRoutes(): string[];
|
|
271
422
|
private get isSchedulingEnabled();
|
|
423
|
+
private get leaderElectionConfig();
|
|
424
|
+
private startLeaderElection;
|
|
272
425
|
private getMongoConnectionOptions;
|
|
273
426
|
}
|