@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,289 @@
|
|
|
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.SchemaCache = void 0;
|
|
63
|
+
var crypto_1 = require("crypto");
|
|
64
|
+
var fs_1 = require("fs");
|
|
65
|
+
var path = __importStar(require("path"));
|
|
66
|
+
/**
|
|
67
|
+
* Manages persistent caching of generated JSON schemas
|
|
68
|
+
*/
|
|
69
|
+
var SchemaCache = /** @class */ (function () {
|
|
70
|
+
function SchemaCache(projectRoot) {
|
|
71
|
+
this.projectRoot = projectRoot;
|
|
72
|
+
this.entries = new Map();
|
|
73
|
+
this.dirty = false;
|
|
74
|
+
this.cacheFile = path.join(projectRoot, '.flink', 'schema-cache.json');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Compute SHA-256 hash of file content
|
|
78
|
+
*/
|
|
79
|
+
SchemaCache.hashFile = function (filePath) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
var content, error_1;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
switch (_a.label) {
|
|
84
|
+
case 0:
|
|
85
|
+
_a.trys.push([0, 2, , 3]);
|
|
86
|
+
return [4 /*yield*/, fs_1.promises.readFile(filePath, 'utf-8')];
|
|
87
|
+
case 1:
|
|
88
|
+
content = _a.sent();
|
|
89
|
+
return [2 /*return*/, SchemaCache.hashContent(content)];
|
|
90
|
+
case 2:
|
|
91
|
+
error_1 = _a.sent();
|
|
92
|
+
// File doesn't exist or can't be read
|
|
93
|
+
return [2 /*return*/, ''];
|
|
94
|
+
case 3: return [2 /*return*/];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Compute SHA-256 hash of string content
|
|
101
|
+
*/
|
|
102
|
+
SchemaCache.hashContent = function (content) {
|
|
103
|
+
return (0, crypto_1.createHash)('sha256').update(content, 'utf-8').digest('hex');
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Load cache from disk
|
|
107
|
+
*/
|
|
108
|
+
SchemaCache.prototype.load = function () {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var flinkDir, data, cache, currentTsVersion, error_2;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0:
|
|
114
|
+
_a.trys.push([0, 3, , 4]);
|
|
115
|
+
flinkDir = path.dirname(this.cacheFile);
|
|
116
|
+
return [4 /*yield*/, fs_1.promises.mkdir(flinkDir, { recursive: true })];
|
|
117
|
+
case 1:
|
|
118
|
+
_a.sent();
|
|
119
|
+
return [4 /*yield*/, fs_1.promises.readFile(this.cacheFile, 'utf-8')];
|
|
120
|
+
case 2:
|
|
121
|
+
data = _a.sent();
|
|
122
|
+
cache = JSON.parse(data);
|
|
123
|
+
// Validate cache version
|
|
124
|
+
if (cache.version !== SchemaCache.CACHE_VERSION) {
|
|
125
|
+
console.log('[SchemaCache] Cache version mismatch, invalidating cache');
|
|
126
|
+
this.entries.clear();
|
|
127
|
+
return [2 /*return*/];
|
|
128
|
+
}
|
|
129
|
+
currentTsVersion = this.getTsVersion();
|
|
130
|
+
if (cache.tsVersion !== currentTsVersion) {
|
|
131
|
+
console.log('[SchemaCache] TypeScript version changed, invalidating cache');
|
|
132
|
+
this.entries.clear();
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
// Load entries
|
|
136
|
+
this.entries = new Map(Object.entries(cache.entries));
|
|
137
|
+
console.log("[SchemaCache] Loaded ".concat(this.entries.size, " cached schemas"));
|
|
138
|
+
return [3 /*break*/, 4];
|
|
139
|
+
case 3:
|
|
140
|
+
error_2 = _a.sent();
|
|
141
|
+
if (error_2.code !== 'ENOENT') {
|
|
142
|
+
console.warn('[SchemaCache] Failed to load cache:', error_2);
|
|
143
|
+
}
|
|
144
|
+
this.entries.clear();
|
|
145
|
+
return [3 /*break*/, 4];
|
|
146
|
+
case 4: return [2 /*return*/];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Save cache to disk
|
|
153
|
+
*/
|
|
154
|
+
SchemaCache.prototype.save = function () {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
+
var cache, flinkDir, error_3;
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
switch (_a.label) {
|
|
159
|
+
case 0:
|
|
160
|
+
if (!this.dirty) {
|
|
161
|
+
return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
_a.label = 1;
|
|
164
|
+
case 1:
|
|
165
|
+
_a.trys.push([1, 4, , 5]);
|
|
166
|
+
cache = {
|
|
167
|
+
version: SchemaCache.CACHE_VERSION,
|
|
168
|
+
tsVersion: this.getTsVersion(),
|
|
169
|
+
generated: new Date().toISOString(),
|
|
170
|
+
entries: Object.fromEntries(this.entries),
|
|
171
|
+
};
|
|
172
|
+
flinkDir = path.dirname(this.cacheFile);
|
|
173
|
+
return [4 /*yield*/, fs_1.promises.mkdir(flinkDir, { recursive: true })];
|
|
174
|
+
case 2:
|
|
175
|
+
_a.sent();
|
|
176
|
+
return [4 /*yield*/, fs_1.promises.writeFile(this.cacheFile, JSON.stringify(cache, null, 2), 'utf-8')];
|
|
177
|
+
case 3:
|
|
178
|
+
_a.sent();
|
|
179
|
+
console.log("[SchemaCache] Saved ".concat(this.entries.size, " schemas to cache"));
|
|
180
|
+
this.dirty = false;
|
|
181
|
+
return [3 /*break*/, 5];
|
|
182
|
+
case 4:
|
|
183
|
+
error_3 = _a.sent();
|
|
184
|
+
console.warn('[SchemaCache] Failed to save cache:', error_3);
|
|
185
|
+
return [3 /*break*/, 5];
|
|
186
|
+
case 5: return [2 /*return*/];
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Get cached entry for schema
|
|
193
|
+
*/
|
|
194
|
+
SchemaCache.prototype.get = function (schemaName) {
|
|
195
|
+
return this.entries.get(schemaName);
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Add or update cache entry
|
|
199
|
+
*/
|
|
200
|
+
SchemaCache.prototype.set = function (entry) {
|
|
201
|
+
this.entries.set(entry.schemaName, entry);
|
|
202
|
+
this.dirty = true;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Remove cache entry
|
|
206
|
+
*/
|
|
207
|
+
SchemaCache.prototype.delete = function (schemaName) {
|
|
208
|
+
if (this.entries.delete(schemaName)) {
|
|
209
|
+
this.dirty = true;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Clear all cache entries
|
|
214
|
+
*/
|
|
215
|
+
SchemaCache.prototype.clear = function () {
|
|
216
|
+
this.entries.clear();
|
|
217
|
+
this.dirty = true;
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Check if schema needs regeneration
|
|
221
|
+
* Returns { needed: boolean, reason?: string }
|
|
222
|
+
*/
|
|
223
|
+
SchemaCache.prototype.needsRegeneration = function (schemaName, schemaFile, dependencies) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
225
|
+
var cached, currentHash, cachedDeps, currentDeps, _i, _a, _b, depPath, depHash, cachedHash;
|
|
226
|
+
return __generator(this, function (_c) {
|
|
227
|
+
switch (_c.label) {
|
|
228
|
+
case 0:
|
|
229
|
+
cached = this.entries.get(schemaName);
|
|
230
|
+
// No cache entry
|
|
231
|
+
if (!cached) {
|
|
232
|
+
return [2 /*return*/, { needed: true, reason: 'no cache entry' }];
|
|
233
|
+
}
|
|
234
|
+
return [4 /*yield*/, SchemaCache.hashFile(schemaFile)];
|
|
235
|
+
case 1:
|
|
236
|
+
currentHash = _c.sent();
|
|
237
|
+
if (cached.contentHash !== currentHash) {
|
|
238
|
+
return [2 /*return*/, { needed: true, reason: 'schema file changed' }];
|
|
239
|
+
}
|
|
240
|
+
cachedDeps = Object.keys(cached.dependencyHashes).sort();
|
|
241
|
+
currentDeps = Array.from(dependencies.keys()).sort();
|
|
242
|
+
if (JSON.stringify(cachedDeps) !== JSON.stringify(currentDeps)) {
|
|
243
|
+
return [2 /*return*/, { needed: true, reason: 'dependency set changed' }];
|
|
244
|
+
}
|
|
245
|
+
// Check each dependency hash
|
|
246
|
+
for (_i = 0, _a = Array.from(dependencies.entries()); _i < _a.length; _i++) {
|
|
247
|
+
_b = _a[_i], depPath = _b[0], depHash = _b[1];
|
|
248
|
+
cachedHash = cached.dependencyHashes[depPath];
|
|
249
|
+
if (cachedHash !== depHash) {
|
|
250
|
+
return [2 /*return*/, { needed: true, reason: "dependency changed: ".concat(depPath) }];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// Cache is valid
|
|
254
|
+
return [2 /*return*/, { needed: false }];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Get TypeScript version (major.minor)
|
|
261
|
+
*/
|
|
262
|
+
SchemaCache.prototype.getTsVersion = function () {
|
|
263
|
+
try {
|
|
264
|
+
var tsPackageJson = require('typescript/package.json');
|
|
265
|
+
var _a = tsPackageJson.version.split('.'), major = _a[0], minor = _a[1];
|
|
266
|
+
return "".concat(major, ".").concat(minor);
|
|
267
|
+
}
|
|
268
|
+
catch (_b) {
|
|
269
|
+
return 'unknown';
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Get cache statistics
|
|
274
|
+
*/
|
|
275
|
+
SchemaCache.prototype.getStats = function () {
|
|
276
|
+
if (this.entries.size === 0) {
|
|
277
|
+
return { totalEntries: 0 };
|
|
278
|
+
}
|
|
279
|
+
var timestamps = Array.from(this.entries.values()).map(function (e) { return new Date(e.generatedAt).getTime(); });
|
|
280
|
+
return {
|
|
281
|
+
totalEntries: this.entries.size,
|
|
282
|
+
oldestEntry: new Date(Math.min.apply(Math, timestamps)).toISOString(),
|
|
283
|
+
newestEntry: new Date(Math.max.apply(Math, timestamps)).toISOString(),
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
SchemaCache.CACHE_VERSION = '1.0.0';
|
|
287
|
+
return SchemaCache;
|
|
288
|
+
}());
|
|
289
|
+
exports.SchemaCache = SchemaCache;
|
|
@@ -1,23 +1,106 @@
|
|
|
1
1
|
import { SourceFile } from "ts-morph";
|
|
2
|
+
import { FlinkCompilerPlugin } from "./utils/loadFlinkConfig";
|
|
2
3
|
declare class TypeScriptCompiler {
|
|
3
4
|
private cwd;
|
|
4
5
|
private project;
|
|
5
|
-
private schemaGenerator?;
|
|
6
6
|
private isEsm;
|
|
7
|
+
private schemaGenerator?;
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
* Handler schemas collected during parseHandlers, to be generated later
|
|
10
|
+
*/
|
|
11
|
+
private handlerSchemasToGenerate;
|
|
12
|
+
/**
|
|
13
|
+
* Tool schemas collected during parseTools, to be generated later
|
|
14
|
+
*/
|
|
15
|
+
private toolSchemasToGenerate;
|
|
16
|
+
/**
|
|
17
|
+
* Pre-segmented source files by type (cached for performance)
|
|
12
18
|
*/
|
|
13
|
-
private
|
|
19
|
+
private handlerFiles;
|
|
20
|
+
private repoFiles;
|
|
21
|
+
private toolFiles;
|
|
22
|
+
private agentFiles;
|
|
23
|
+
private jobFiles;
|
|
24
|
+
private serviceFiles;
|
|
14
25
|
/**
|
|
15
|
-
*
|
|
26
|
+
* Tool ID registry for agent validation (built during segmentation)
|
|
27
|
+
*/
|
|
28
|
+
private toolIdRegistry;
|
|
29
|
+
/**
|
|
30
|
+
* Compiler plugins loaded from flink.config.js
|
|
31
|
+
*/
|
|
32
|
+
private compilerPlugins;
|
|
33
|
+
private disableServices;
|
|
34
|
+
/**
|
|
35
|
+
* Extension files collected during segmentation, keyed by generatedFile name
|
|
36
|
+
*/
|
|
37
|
+
private extensionFiles;
|
|
38
|
+
/**
|
|
39
|
+
* Generates a schema $id from a file path and type name using the same algorithm
|
|
40
|
+
* as the schema generator's defineId callback.
|
|
16
41
|
*
|
|
17
|
-
*
|
|
42
|
+
* Examples:
|
|
43
|
+
* - src/schemas/Car.ts, "Car" → "Car"
|
|
44
|
+
* - src/schemas/wrappers/PartialLoginReq.ts, "PartialLoginReq" → "wrappers.PartialLoginReq"
|
|
45
|
+
* - src/schemas/PatchCarSchemas.ts, "PatchCarReq" → "PatchCarSchemas.PatchCarReq"
|
|
46
|
+
*/
|
|
47
|
+
private filePathToSchemaId;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves a type name to its schema $id by looking up its import path.
|
|
50
|
+
* Returns undefined if the type is not imported from src/schemas/.
|
|
18
51
|
*/
|
|
19
|
-
private
|
|
52
|
+
private resolveTypeNameToSchemaId;
|
|
20
53
|
constructor(cwd: string);
|
|
54
|
+
/**
|
|
55
|
+
* Loads additional source paths from tsconfig.json's flink configuration.
|
|
56
|
+
* Allows projects to specify extra directories to include in compilation.
|
|
57
|
+
*
|
|
58
|
+
* Example tsconfig.json:
|
|
59
|
+
* {
|
|
60
|
+
* "flink": {
|
|
61
|
+
* "sourcePaths": ["src/custom-types/**\/*.ts", "src/utils/**\/*.ts"]
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
*/
|
|
65
|
+
private getFlinkSourcePaths;
|
|
66
|
+
/**
|
|
67
|
+
* Initializes the schema generator.
|
|
68
|
+
*
|
|
69
|
+
* Note: ts-source-to-json-schema is ESM-only while @flink-app/flink is CommonJS.
|
|
70
|
+
* We use new Function() to preserve the actual import() in compiled output.
|
|
71
|
+
* Without this, TypeScript converts import() to require() which can't load ESM.
|
|
72
|
+
*/
|
|
73
|
+
private initSchemaGenerator;
|
|
74
|
+
/**
|
|
75
|
+
* Recursively resolves and adds imported files to the project.
|
|
76
|
+
* This ensures that files imported by handlers, schemas, etc. are available for type resolution.
|
|
77
|
+
*
|
|
78
|
+
* Handles three types of imports:
|
|
79
|
+
* 1. Relative imports (./foo, ../bar) - always resolved
|
|
80
|
+
* 2. Workspace package imports (@mycompany/shared) - resolved if symlinked outside node_modules
|
|
81
|
+
* 3. External packages (lodash, express) - skipped to avoid loading entire dependency trees
|
|
82
|
+
*/
|
|
83
|
+
private resolveImportedFiles;
|
|
84
|
+
/**
|
|
85
|
+
* Gets the workspace scope from package.json (e.g., "@mycompany" from "@mycompany/my-app")
|
|
86
|
+
* Returns empty string if not a scoped package.
|
|
87
|
+
*/
|
|
88
|
+
private getWorkspaceScope;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if an import is likely to be a workspace package.
|
|
91
|
+
* This is a heuristic - we check for common workspace patterns but can't be 100% sure
|
|
92
|
+
* without actually resolving. This is a performance optimization to avoid resolving
|
|
93
|
+
* obvious external packages like "express", "lodash", etc.
|
|
94
|
+
*/
|
|
95
|
+
private isLikelyWorkspaceImport;
|
|
96
|
+
/**
|
|
97
|
+
* Segments source files by type for efficient processing.
|
|
98
|
+
* Performs all path checks and AST inspections in a single pass.
|
|
99
|
+
*
|
|
100
|
+
* This runs once during construction and caches results to avoid
|
|
101
|
+
* multiple full-file iterations during parse methods.
|
|
102
|
+
*/
|
|
103
|
+
private segmentSourceFiles;
|
|
21
104
|
/**
|
|
22
105
|
* Detects if the project is using ESM (ECMAScript Modules)
|
|
23
106
|
* by checking type in package.json.
|
|
@@ -25,6 +108,8 @@ declare class TypeScriptCompiler {
|
|
|
25
108
|
private isEsmProject;
|
|
26
109
|
/**
|
|
27
110
|
* Gets the module specifier for imports, adding .js extension for ESM
|
|
111
|
+
* Uses fast path calculation instead of ts-morph's getRelativePathAsModuleSpecifierTo
|
|
112
|
+
* which triggers expensive language service initialization
|
|
28
113
|
*/
|
|
29
114
|
private getModuleSpecifier;
|
|
30
115
|
/**
|
|
@@ -33,9 +118,22 @@ declare class TypeScriptCompiler {
|
|
|
33
118
|
*/
|
|
34
119
|
static clean(cwd: string): Promise<string>;
|
|
35
120
|
/**
|
|
36
|
-
*
|
|
121
|
+
* Saves all modified source files in a single batch operation.
|
|
122
|
+
* Call this before emit() to persist all changes to disk.
|
|
123
|
+
*/
|
|
124
|
+
saveAllModifiedFiles(): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Emits compiled javascript source to dist folder using swc (20-50x faster than tsc)
|
|
127
|
+
*/
|
|
128
|
+
emitWithSwc(): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Emits compiled javascript source to dist folder (defaults to swc for speed, falls back to tsc)
|
|
131
|
+
*/
|
|
132
|
+
emit(): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Emits compiled javascript source to dist folder using TypeScript compiler (slower, kept for fallback)
|
|
37
135
|
*/
|
|
38
|
-
|
|
136
|
+
emitWithTsc(): void;
|
|
39
137
|
/**
|
|
40
138
|
* Catch any compilation errors. Will return false if any Errors
|
|
41
139
|
* exists. Warnings will be passed thru but logged.
|
|
@@ -49,12 +147,26 @@ declare class TypeScriptCompiler {
|
|
|
49
147
|
* Also extract handlers request and response schemas from Handler
|
|
50
148
|
* type arguments.
|
|
51
149
|
*/
|
|
52
|
-
parseHandlers(
|
|
150
|
+
parseHandlers(): Promise<SourceFile>;
|
|
53
151
|
/**
|
|
54
152
|
* Scan `/src/handlers/*.ts` for handler files and register those.
|
|
55
153
|
*/
|
|
56
154
|
private parseHandlerDir;
|
|
57
155
|
parseRepos(): Promise<SourceFile>;
|
|
156
|
+
/**
|
|
157
|
+
* Scans project for tools and adds those to Flink
|
|
158
|
+
* "singleton" property `autoRegisteredTools` so they can
|
|
159
|
+
* be registered during start.
|
|
160
|
+
*
|
|
161
|
+
* Also extracts input and output schemas from FlinkTool type arguments
|
|
162
|
+
* when manual schemas are not provided.
|
|
163
|
+
*/
|
|
164
|
+
parseTools(): Promise<SourceFile>;
|
|
165
|
+
/**
|
|
166
|
+
* Scans project for agents and validates tool references.
|
|
167
|
+
* Agents are classes extending FlinkAgent exported as default.
|
|
168
|
+
*/
|
|
169
|
+
parseAgents(): Promise<SourceFile>;
|
|
58
170
|
/**
|
|
59
171
|
* Generates a start script that will import references to handlers, repos and the
|
|
60
172
|
* actual Flink app to start.
|
|
@@ -65,44 +177,15 @@ declare class TypeScriptCompiler {
|
|
|
65
177
|
generateStartScript(appEntryScript?: string): Promise<SourceFile>;
|
|
66
178
|
private createSourceFile;
|
|
67
179
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* There are multiple ways of defining schema types as valid ts and this
|
|
72
|
-
* implementation aims to support all of these.
|
|
73
|
-
*
|
|
74
|
-
* Some examples of different cases (check spec/mock-project/src/handlers for more):
|
|
75
|
-
*
|
|
76
|
-
* ```
|
|
77
|
-
* // Interface reference
|
|
78
|
-
* Handler<Ctx, Car>
|
|
79
|
-
* // Inline type definition with reference to interface
|
|
80
|
-
* Handler<Ctx, {car: Car}>
|
|
81
|
-
* // Inline type definition with literal values
|
|
82
|
-
* Handler<Ctx, {car: {model: string}}>
|
|
83
|
-
* // Array
|
|
84
|
-
* Handler<Ctx, Car[]>
|
|
85
|
-
* // Array with inline type definition
|
|
86
|
-
* Handler<Ctx, {car: Car}[]>
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* Return names of req and/or res schema types.
|
|
90
|
-
*/
|
|
91
|
-
private extractSchemasFromHandlerSourceFile;
|
|
92
|
-
/**
|
|
93
|
-
* Recursively copies an interface and all its dependencies from the same file
|
|
180
|
+
* Extracts schema information from a tool file using text-based parsing.
|
|
181
|
+
* Resolves type names to schema $ids from the schema universe.
|
|
94
182
|
*/
|
|
95
|
-
private
|
|
96
|
-
private saveIntermediateTsSchema;
|
|
97
|
-
private initJsonSchemaGenerator;
|
|
98
|
-
private generateAndSaveJsonSchemas;
|
|
99
|
-
private generateJsonSchema;
|
|
100
|
-
private extractSchemaTypeFromHandler;
|
|
183
|
+
private extractSchemasFromToolFast;
|
|
101
184
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
185
|
+
* Extracts schema information from a handler file using text-based parsing.
|
|
186
|
+
* Resolves type names to schema $ids from the schema universe.
|
|
104
187
|
*/
|
|
105
|
-
private
|
|
188
|
+
private extractSchemasFromHandlerFast;
|
|
106
189
|
/**
|
|
107
190
|
* Check if handler source file is up for auto registration by inspecting
|
|
108
191
|
* the Route.
|
|
@@ -112,15 +195,42 @@ declare class TypeScriptCompiler {
|
|
|
112
195
|
*/
|
|
113
196
|
private isAutoRegisterableHandler;
|
|
114
197
|
/**
|
|
115
|
-
*
|
|
198
|
+
* Generates JSON schemas for all handlers and tools.
|
|
199
|
+
* Should be called after parseHandlers() and parseTools() have completed.
|
|
116
200
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
201
|
+
* NEW SIMPLIFIED APPROACH:
|
|
202
|
+
* 1. Generate schema universe from src/schemas/**\/*.ts (includes wrappers/)
|
|
203
|
+
* 2. Handlers/tools reference schemas by $id
|
|
204
|
+
* 3. Create manifest with schema universe and references
|
|
205
|
+
*/
|
|
206
|
+
generateAllSchemas(): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Computes relative path from project root for a source file.
|
|
209
|
+
* This is used consistently for manifest keys and __file exports.
|
|
210
|
+
*/
|
|
211
|
+
private getRelativePath;
|
|
212
|
+
/**
|
|
213
|
+
* Generates schema manifest with schema universe and handler/tool references.
|
|
119
214
|
*/
|
|
120
|
-
private
|
|
215
|
+
private generateSchemaManifest;
|
|
121
216
|
/**
|
|
122
217
|
* Scans project for jobs so they can be registered during start.
|
|
123
218
|
*/
|
|
124
219
|
parseJobs(): Promise<SourceFile>;
|
|
220
|
+
/**
|
|
221
|
+
* Scans project for services so they can be registered during start.
|
|
222
|
+
*/
|
|
223
|
+
parseServices(): Promise<SourceFile>;
|
|
224
|
+
/**
|
|
225
|
+
* Generates a .flink/generatedXxx.ts file for a single compiler plugin extension.
|
|
226
|
+
* Mirrors the same namespace-import + spread pattern used by parseJobs.
|
|
227
|
+
*/
|
|
228
|
+
parseExtensionDir(ext: FlinkCompilerPlugin): Promise<SourceFile>;
|
|
229
|
+
/**
|
|
230
|
+
* Iterates all compilerPlugins from flink.config.js and generates
|
|
231
|
+
* a .flink/generatedXxx.ts file for each one.
|
|
232
|
+
* Call this after parseJobs() and before generateStartScript().
|
|
233
|
+
*/
|
|
234
|
+
parseAllExtensionDirs(): Promise<void>;
|
|
125
235
|
}
|
|
126
236
|
export default TypeScriptCompiler;
|