@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.
Files changed (280) hide show
  1. package/CHANGELOG.md +1051 -0
  2. package/SCHEMA_EXTRACTION_ANALYSIS.md +494 -0
  3. package/SIMPLE_AST_FEASIBILITY.md +570 -0
  4. package/bin/flink.ts +13 -2
  5. package/cli/build.ts +24 -44
  6. package/cli/clean.ts +13 -25
  7. package/cli/cli-utils.ts +190 -17
  8. package/cli/dev.ts +252 -0
  9. package/cli/loadEnvFiles.ts +116 -0
  10. package/cli/run.ts +45 -62
  11. package/dist/bin/flink.js +61 -2
  12. package/dist/cli/build.js +20 -25
  13. package/dist/cli/clean.js +12 -10
  14. package/dist/cli/cli-utils.d.ts +34 -3
  15. package/dist/cli/cli-utils.js +193 -12
  16. package/dist/cli/dev.d.ts +2 -0
  17. package/dist/cli/dev.js +279 -0
  18. package/dist/cli/loadEnvFiles.d.ts +30 -0
  19. package/dist/cli/loadEnvFiles.js +113 -0
  20. package/dist/cli/run.js +47 -46
  21. package/dist/src/DependencyTracker.d.ts +44 -0
  22. package/dist/src/DependencyTracker.js +239 -0
  23. package/dist/src/FlinkApp.d.ts +163 -10
  24. package/dist/src/FlinkApp.js +847 -184
  25. package/dist/src/FlinkContext.d.ts +41 -0
  26. package/dist/src/FlinkErrors.d.ts +19 -6
  27. package/dist/src/FlinkErrors.js +36 -42
  28. package/dist/src/FlinkHttpHandler.d.ts +219 -26
  29. package/dist/src/FlinkHttpHandler.js +37 -1
  30. package/dist/src/FlinkJob.d.ts +10 -0
  31. package/dist/src/FlinkLog.d.ts +82 -18
  32. package/dist/src/FlinkLog.js +165 -13
  33. package/dist/src/FlinkLogFactory.d.ts +288 -0
  34. package/dist/src/FlinkLogFactory.js +619 -0
  35. package/dist/src/FlinkRepo.d.ts +10 -2
  36. package/dist/src/FlinkRepo.js +11 -1
  37. package/dist/src/FlinkRequestContext.d.ts +63 -0
  38. package/dist/src/FlinkRequestContext.js +74 -0
  39. package/dist/src/FlinkResponse.d.ts +6 -0
  40. package/dist/src/FlinkService.d.ts +38 -0
  41. package/dist/src/FlinkService.js +46 -0
  42. package/dist/src/LeaderElection.d.ts +45 -0
  43. package/dist/src/LeaderElection.js +269 -0
  44. package/dist/src/SchemaCache.d.ts +84 -0
  45. package/dist/src/SchemaCache.js +289 -0
  46. package/dist/src/TypeScriptCompiler.d.ts +161 -51
  47. package/dist/src/TypeScriptCompiler.js +1253 -617
  48. package/dist/src/TypeScriptUtils.js +4 -0
  49. package/dist/src/ai/AgentRunner.d.ts +39 -0
  50. package/dist/src/ai/AgentRunner.js +760 -0
  51. package/dist/src/ai/ConversationAgent.d.ts +279 -0
  52. package/dist/src/ai/ConversationAgent.js +404 -0
  53. package/dist/src/ai/ConversationFlinkAgent.d.ts +278 -0
  54. package/dist/src/ai/ConversationFlinkAgent.js +404 -0
  55. package/dist/src/ai/FlinkAgent.d.ts +690 -0
  56. package/dist/src/ai/FlinkAgent.js +729 -0
  57. package/dist/src/ai/FlinkTool.d.ts +135 -0
  58. package/dist/src/ai/FlinkTool.js +2 -0
  59. package/dist/src/ai/InMemoryConversationAgent.d.ts +121 -0
  60. package/dist/src/ai/InMemoryConversationAgent.js +209 -0
  61. package/dist/src/ai/LLMAdapter.d.ts +148 -0
  62. package/dist/src/ai/LLMAdapter.js +2 -0
  63. package/dist/src/ai/PersistentFlinkAgent.d.ts +278 -0
  64. package/dist/src/ai/PersistentFlinkAgent.js +403 -0
  65. package/dist/src/ai/SubAgentExecutor.d.ts +38 -0
  66. package/dist/src/ai/SubAgentExecutor.js +223 -0
  67. package/dist/src/ai/ToolExecutor.d.ts +64 -0
  68. package/dist/src/ai/ToolExecutor.js +497 -0
  69. package/dist/src/ai/agentInstructions.d.ts +68 -0
  70. package/dist/src/ai/agentInstructions.js +286 -0
  71. package/dist/src/ai/index.d.ts +8 -0
  72. package/dist/src/ai/index.js +26 -0
  73. package/dist/src/ai/instructionFileLoader.d.ts +44 -0
  74. package/dist/src/ai/instructionFileLoader.js +179 -0
  75. package/dist/src/auth/FlinkAuthPlugin.d.ts +1 -1
  76. package/dist/src/handlers/StreamWriterFactory.d.ts +20 -0
  77. package/dist/src/handlers/StreamWriterFactory.js +83 -0
  78. package/dist/src/index.d.ts +14 -0
  79. package/dist/src/index.js +17 -0
  80. package/dist/src/loadPluginSchemas.d.ts +45 -0
  81. package/dist/src/loadPluginSchemas.js +143 -0
  82. package/dist/src/schema-extraction/ComplexTypeDetection.d.ts +40 -0
  83. package/dist/src/schema-extraction/ComplexTypeDetection.js +75 -0
  84. package/dist/src/schema-extraction/TypeScriptSourceParser.d.ts +321 -0
  85. package/dist/src/schema-extraction/TypeScriptSourceParser.js +925 -0
  86. package/dist/src/schema-extraction/TypeScriptSourceParser.spec.d.ts +1 -0
  87. package/dist/src/schema-extraction/TypeScriptSourceParser.spec.js +233 -0
  88. package/dist/src/schema-extraction/TypeScriptTokenizer.d.ts +57 -0
  89. package/dist/src/schema-extraction/TypeScriptTokenizer.js +177 -0
  90. package/dist/src/schema-extraction/index.d.ts +2 -0
  91. package/dist/src/schema-extraction/index.js +20 -0
  92. package/dist/src/schema-extraction/types.d.ts +31 -0
  93. package/dist/src/schema-extraction/types.js +2 -0
  94. package/dist/src/utils/loadFlinkConfig.d.ts +53 -0
  95. package/dist/src/utils/loadFlinkConfig.js +77 -0
  96. package/dist/src/utils.d.ts +30 -0
  97. package/dist/src/utils.js +52 -0
  98. package/dist/src/workers/SchemaGeneratorWorker.d.ts +1 -0
  99. package/dist/src/workers/SchemaGeneratorWorker.js +49 -0
  100. package/dist/src/workers/WorkerPool.d.ts +60 -0
  101. package/dist/src/workers/WorkerPool.js +306 -0
  102. package/examples/logging-hierarchical-example.ts +125 -0
  103. package/package.json +29 -4
  104. package/readme.md +499 -0
  105. package/spec/AgentDescendantDetection.spec.ts +335 -0
  106. package/spec/AgentDuplicateDetection.spec.ts +112 -0
  107. package/spec/AgentObserver.spec.ts +266 -0
  108. package/spec/AgentRunner.spec.ts +1062 -0
  109. package/spec/AsyncLocalStorageContext.spec.ts +223 -0
  110. package/spec/ConversationHooks.spec.ts +257 -0
  111. package/spec/FlinkAgent.spec.ts +681 -0
  112. package/spec/FlinkApp.htmlResponse.spec.ts +260 -0
  113. package/spec/FlinkApp.onError.invocation.spec.ts +151 -0
  114. package/spec/FlinkApp.onError.spec.ts +1 -2
  115. package/spec/FlinkApp.query.spec.ts +107 -0
  116. package/spec/FlinkApp.routeOrdering.spec.ts +61 -0
  117. package/spec/FlinkApp.undefinedResponse.spec.ts +123 -0
  118. package/spec/FlinkApp.validationMode.spec.ts +155 -0
  119. package/spec/FlinkJob.spec.ts +171 -0
  120. package/spec/FlinkLogFactory.spec.ts +337 -0
  121. package/spec/FlinkRepo.spec.ts +1 -1
  122. package/spec/LeaderElection.spec.ts +174 -0
  123. package/spec/StreamingIntegration.spec.ts +139 -0
  124. package/spec/ToolExecutor.spec.ts +465 -0
  125. package/spec/TypeScriptCompiler.spec.ts +1 -1
  126. package/spec/TypeScriptSourceParser.spec.ts +1215 -0
  127. package/spec/TypeScriptTokenizer.spec.ts +366 -0
  128. package/spec/ai/ContextCompaction.spec.ts +405 -0
  129. package/spec/ai/ConversationAgent.spec.ts +520 -0
  130. package/spec/ai/InMemoryConversationAgent.spec.ts +144 -0
  131. package/spec/ai/agentInstructions.spec.ts +358 -0
  132. package/spec/fixtures/agent-instructions/TestAgent.ts +24 -0
  133. package/spec/fixtures/agent-instructions/simple.md +3 -0
  134. package/spec/fixtures/agent-instructions/template.md +18 -0
  135. package/spec/fixtures/agent-instructions/yaml-format.yaml +9 -0
  136. package/spec/mock-project/dist/.tsbuildinfo +1 -0
  137. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCar.js +56 -0
  138. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCar2.js +58 -0
  139. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithArraySchema.js +52 -0
  140. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithArraySchema2.js +52 -0
  141. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithArraySchema3.js +52 -0
  142. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithLiteralSchema.js +54 -0
  143. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithLiteralSchema2.js +54 -0
  144. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithSchemaInFile.js +57 -0
  145. package/spec/mock-project/dist/spec/mock-project/src/handlers/GetCarWithSchemaInFile2.js +57 -0
  146. package/spec/mock-project/dist/spec/mock-project/src/handlers/ManuallyAddedHandler.js +53 -0
  147. package/spec/mock-project/dist/spec/mock-project/src/handlers/ManuallyAddedHandler2.js +55 -0
  148. package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchCar.js +57 -0
  149. package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchOnboardingSession.js +75 -0
  150. package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchOrderWithComplexTypes.js +57 -0
  151. package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchProductWithIntersection.js +58 -0
  152. package/spec/mock-project/dist/spec/mock-project/src/handlers/PatchUserWithUnion.js +58 -0
  153. package/spec/mock-project/dist/spec/mock-project/src/handlers/PostCar.js +54 -0
  154. package/spec/mock-project/dist/spec/mock-project/src/handlers/PostLogin.js +55 -0
  155. package/spec/mock-project/dist/spec/mock-project/src/handlers/PostLogout.js +54 -0
  156. package/spec/mock-project/dist/spec/mock-project/src/handlers/PutCar.js +54 -0
  157. package/spec/mock-project/dist/spec/mock-project/src/index.js +83 -0
  158. package/spec/mock-project/dist/spec/mock-project/src/repos/CarRepo.js +26 -0
  159. package/spec/mock-project/dist/spec/mock-project/src/schemas/Car.js +2 -0
  160. package/spec/mock-project/dist/spec/mock-project/src/schemas/DefaultExportSchema.js +2 -0
  161. package/spec/mock-project/dist/spec/mock-project/src/schemas/FileWithTwoSchemas.js +2 -0
  162. package/spec/mock-project/dist/src/FlinkApp.js +1000 -0
  163. package/spec/mock-project/dist/src/FlinkContext.js +2 -0
  164. package/spec/mock-project/dist/src/FlinkErrors.js +143 -0
  165. package/spec/mock-project/dist/src/FlinkHttpHandler.js +47 -0
  166. package/spec/mock-project/dist/src/FlinkJob.js +2 -0
  167. package/spec/mock-project/dist/src/FlinkLog.js +119 -0
  168. package/spec/mock-project/dist/src/FlinkLogFactory.js +617 -0
  169. package/spec/mock-project/dist/src/FlinkPlugin.js +2 -0
  170. package/spec/mock-project/dist/src/FlinkRepo.js +224 -0
  171. package/spec/mock-project/dist/src/FlinkRequestContext.js +74 -0
  172. package/spec/mock-project/dist/src/FlinkResponse.js +2 -0
  173. package/spec/mock-project/dist/src/ai/AgentExecutor.js +279 -0
  174. package/spec/mock-project/dist/src/ai/AgentRunner.js +632 -0
  175. package/spec/mock-project/dist/src/ai/ConversationAgent.js +402 -0
  176. package/spec/mock-project/dist/src/ai/ConversationFlinkAgent.js +422 -0
  177. package/spec/mock-project/dist/src/ai/FlinkAgent.js +699 -0
  178. package/spec/mock-project/dist/src/ai/FlinkTool.js +2 -0
  179. package/spec/mock-project/dist/src/ai/InMemoryConversationAgent.js +209 -0
  180. package/spec/mock-project/dist/src/ai/LLMAdapter.js +2 -0
  181. package/spec/mock-project/dist/src/ai/SubAgentExecutor.js +223 -0
  182. package/spec/mock-project/dist/src/ai/ToolExecutor.js +412 -0
  183. package/spec/mock-project/dist/src/ai/agentInstructions.js +246 -0
  184. package/spec/mock-project/dist/src/auth/FlinkAuthPlugin.js +2 -0
  185. package/spec/mock-project/dist/src/auth/FlinkAuthUser.js +2 -0
  186. package/spec/mock-project/dist/src/handlers/GetCar.js +26 -52
  187. package/spec/mock-project/dist/src/handlers/GetCar.js.map +1 -0
  188. package/spec/mock-project/dist/src/handlers/GetCar2.js +32 -54
  189. package/spec/mock-project/dist/src/handlers/GetCar2.js.map +1 -0
  190. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema.js +26 -48
  191. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema.js.map +1 -0
  192. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema2.js +28 -48
  193. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema2.js.map +1 -0
  194. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema3.js +29 -48
  195. package/spec/mock-project/dist/src/handlers/GetCarWithArraySchema3.js.map +1 -0
  196. package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema.js +26 -50
  197. package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema.js.map +1 -0
  198. package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema2.js +28 -50
  199. package/spec/mock-project/dist/src/handlers/GetCarWithLiteralSchema2.js.map +1 -0
  200. package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile.js +27 -53
  201. package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile.js.map +1 -0
  202. package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile2.js +29 -53
  203. package/spec/mock-project/dist/src/handlers/GetCarWithSchemaInFile2.js.map +1 -0
  204. package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler.js +16 -49
  205. package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler.js.map +1 -0
  206. package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler2.js +25 -50
  207. package/spec/mock-project/dist/src/handlers/ManuallyAddedHandler2.js.map +1 -0
  208. package/spec/mock-project/dist/src/handlers/PatchCar.js +27 -53
  209. package/spec/mock-project/dist/src/handlers/PatchCar.js.map +1 -0
  210. package/spec/mock-project/dist/src/handlers/PatchOnboardingSession.js +44 -70
  211. package/spec/mock-project/dist/src/handlers/PatchOnboardingSession.js.map +1 -0
  212. package/spec/mock-project/dist/src/handlers/PatchOrderWithComplexTypes.js +27 -53
  213. package/spec/mock-project/dist/src/handlers/PatchOrderWithComplexTypes.js.map +1 -0
  214. package/spec/mock-project/dist/src/handlers/PatchProductWithIntersection.js +28 -54
  215. package/spec/mock-project/dist/src/handlers/PatchProductWithIntersection.js.map +1 -0
  216. package/spec/mock-project/dist/src/handlers/PatchUserWithUnion.js +28 -54
  217. package/spec/mock-project/dist/src/handlers/PatchUserWithUnion.js.map +1 -0
  218. package/spec/mock-project/dist/src/handlers/PostCar.js +24 -50
  219. package/spec/mock-project/dist/src/handlers/PostCar.js.map +1 -0
  220. package/spec/mock-project/dist/src/handlers/PostLogin.js +25 -51
  221. package/spec/mock-project/dist/src/handlers/PostLogin.js.map +1 -0
  222. package/spec/mock-project/dist/src/handlers/PostLogout.js +24 -50
  223. package/spec/mock-project/dist/src/handlers/PostLogout.js.map +1 -0
  224. package/spec/mock-project/dist/src/handlers/PutCar.js +24 -50
  225. package/spec/mock-project/dist/src/handlers/PutCar.js.map +1 -0
  226. package/spec/mock-project/dist/src/handlers/StreamWriterFactory.js +83 -0
  227. package/spec/mock-project/dist/src/index.js +52 -76
  228. package/spec/mock-project/dist/src/index.js.map +1 -0
  229. package/spec/mock-project/dist/src/mock-data-generator.js +9 -0
  230. package/spec/mock-project/dist/src/repos/CarRepo.js +12 -24
  231. package/spec/mock-project/dist/src/repos/CarRepo.js.map +1 -0
  232. package/spec/mock-project/dist/src/schemas/Car.js +3 -1
  233. package/spec/mock-project/dist/src/schemas/Car.js.map +1 -0
  234. package/spec/mock-project/dist/src/schemas/DefaultExportSchema.js +3 -1
  235. package/spec/mock-project/dist/src/schemas/DefaultExportSchema.js.map +1 -0
  236. package/spec/mock-project/dist/src/schemas/FileWithTwoSchemas.js +3 -1
  237. package/spec/mock-project/dist/src/schemas/FileWithTwoSchemas.js.map +1 -0
  238. package/spec/mock-project/dist/src/utils.js +290 -0
  239. package/spec/mock-project/tsconfig.json +6 -1
  240. package/spec/schema-generation-nested-objects.spec.ts +97 -0
  241. package/spec/testHelpers.ts +49 -0
  242. package/spec/utils.caseConversion.spec.ts +78 -0
  243. package/spec/utils.spec.ts +13 -13
  244. package/src/DependencyTracker.ts +166 -0
  245. package/src/FlinkApp.ts +919 -155
  246. package/src/FlinkContext.ts +43 -0
  247. package/src/FlinkErrors.ts +32 -12
  248. package/src/FlinkHttpHandler.ts +246 -28
  249. package/src/FlinkJob.ts +11 -0
  250. package/src/FlinkLog.ts +119 -12
  251. package/src/FlinkLogFactory.ts +699 -0
  252. package/src/FlinkRepo.ts +10 -3
  253. package/src/FlinkRequestContext.ts +95 -0
  254. package/src/FlinkResponse.ts +6 -0
  255. package/src/FlinkService.ts +49 -0
  256. package/src/LeaderElection.ts +203 -0
  257. package/src/SchemaCache.ts +232 -0
  258. package/src/TypeScriptCompiler.ts +1347 -610
  259. package/src/TypeScriptUtils.ts +5 -0
  260. package/src/ai/AgentRunner.ts +646 -0
  261. package/src/ai/ConversationAgent.ts +413 -0
  262. package/src/ai/FlinkAgent.ts +1069 -0
  263. package/src/ai/FlinkTool.ts +165 -0
  264. package/src/ai/InMemoryConversationAgent.ts +149 -0
  265. package/src/ai/LLMAdapter.ts +126 -0
  266. package/src/ai/ToolExecutor.ts +485 -0
  267. package/src/ai/agentInstructions.ts +245 -0
  268. package/src/ai/index.ts +8 -0
  269. package/src/ai/instructionFileLoader.ts +156 -0
  270. package/src/auth/FlinkAuthPlugin.ts +2 -1
  271. package/src/handlers/StreamWriterFactory.ts +84 -0
  272. package/src/index.ts +14 -0
  273. package/src/loadPluginSchemas.ts +141 -0
  274. package/src/schema-extraction/TypeScriptSourceParser.ts +1058 -0
  275. package/src/schema-extraction/TypeScriptTokenizer.ts +205 -0
  276. package/src/schema-extraction/index.ts +2 -0
  277. package/src/schema-extraction/types.ts +34 -0
  278. package/src/utils/loadFlinkConfig.ts +89 -0
  279. package/src/utils.ts +52 -0
  280. package/tsconfig.json +6 -1
@@ -1,12 +1,26 @@
1
1
  export * from "./FlinkLog";
2
+ export * from "./FlinkLogFactory";
2
3
  export * from "./FlinkApp";
4
+ export * from "./utils/loadFlinkConfig";
3
5
  export * from "./FlinkHttpHandler";
4
6
  export * from "./FlinkContext";
5
7
  export * from "./FlinkRepo";
6
8
  export * from "./FlinkResponse";
9
+ export * from "./FlinkRequestContext";
7
10
  export * from "./FlinkErrors";
8
11
  export * from "./FlinkPlugin";
9
12
  export * from "./FlinkJob";
13
+ export * from "./FlinkService";
14
+ export { LeaderElection } from "./LeaderElection";
15
+ export type { LeaderElectionOptions } from "./LeaderElection";
10
16
  export * from "./auth/FlinkAuthUser";
11
17
  export * from "./auth/FlinkAuthPlugin";
18
+ export * from "./ai/FlinkTool";
19
+ export * from "./ai/FlinkAgent";
20
+ export * from "./ai/ConversationAgent";
21
+ export * from "./ai/InMemoryConversationAgent";
22
+ export * from "./ai/ToolExecutor";
23
+ export * from "./ai/LLMAdapter";
24
+ export { agentInstructions } from "./ai/agentInstructions";
25
+ export { loadPluginSchemas } from "./loadPluginSchemas";
12
26
  export type { Request as ExpressRequest, Response as ExpressResponse, NextFunction as ExpressNextFunction, RequestHandler as ExpressRequestHandler, ErrorRequestHandler as ExpressErrorRequestHandler, Express, static as expressStatic, } from "express";
package/dist/src/index.js CHANGED
@@ -14,14 +14,31 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.loadPluginSchemas = exports.agentInstructions = exports.LeaderElection = void 0;
17
18
  __exportStar(require("./FlinkLog"), exports);
19
+ __exportStar(require("./FlinkLogFactory"), exports);
18
20
  __exportStar(require("./FlinkApp"), exports);
21
+ __exportStar(require("./utils/loadFlinkConfig"), exports);
19
22
  __exportStar(require("./FlinkHttpHandler"), exports);
20
23
  __exportStar(require("./FlinkContext"), exports);
21
24
  __exportStar(require("./FlinkRepo"), exports);
22
25
  __exportStar(require("./FlinkResponse"), exports);
26
+ __exportStar(require("./FlinkRequestContext"), exports);
23
27
  __exportStar(require("./FlinkErrors"), exports);
24
28
  __exportStar(require("./FlinkPlugin"), exports);
25
29
  __exportStar(require("./FlinkJob"), exports);
30
+ __exportStar(require("./FlinkService"), exports);
31
+ var LeaderElection_1 = require("./LeaderElection");
32
+ Object.defineProperty(exports, "LeaderElection", { enumerable: true, get: function () { return LeaderElection_1.LeaderElection; } });
26
33
  __exportStar(require("./auth/FlinkAuthUser"), exports);
27
34
  __exportStar(require("./auth/FlinkAuthPlugin"), exports);
35
+ __exportStar(require("./ai/FlinkTool"), exports);
36
+ __exportStar(require("./ai/FlinkAgent"), exports);
37
+ __exportStar(require("./ai/ConversationAgent"), exports);
38
+ __exportStar(require("./ai/InMemoryConversationAgent"), exports);
39
+ __exportStar(require("./ai/ToolExecutor"), exports);
40
+ __exportStar(require("./ai/LLMAdapter"), exports);
41
+ var agentInstructions_1 = require("./ai/agentInstructions");
42
+ Object.defineProperty(exports, "agentInstructions", { enumerable: true, get: function () { return agentInstructions_1.agentInstructions; } });
43
+ var loadPluginSchemas_1 = require("./loadPluginSchemas");
44
+ Object.defineProperty(exports, "loadPluginSchemas", { enumerable: true, get: function () { return loadPluginSchemas_1.loadPluginSchemas; } });
@@ -0,0 +1,45 @@
1
+ interface SchemaManifest {
2
+ version?: string;
3
+ schemas?: Record<string, any>;
4
+ definitions?: Record<string, any>;
5
+ handlers: Record<string, {
6
+ reqSchemaName?: string;
7
+ resSchemaName?: string;
8
+ queryMetadata?: any[];
9
+ paramsMetadata?: any[];
10
+ assumedMethod?: string;
11
+ }>;
12
+ tools: Record<string, any>;
13
+ }
14
+ /**
15
+ * Load a plugin's schema manifest and provide helpers for getting
16
+ * namespaced schemas suitable for use with `app.registerSchemas()` and `addHandler()`.
17
+ *
18
+ * @param packageName The npm package name (e.g., "@flink-app/generic-auth-plugin").
19
+ * The package's `dist/.flink/schema-manifest.json` will be loaded.
20
+ * @returns Object with helper methods for retrieving prefixed schemas.
21
+ */
22
+ export declare function loadPluginSchemas(packageName: string): {
23
+ /**
24
+ * Get prefixed req/res schemas for a specific handler file path.
25
+ *
26
+ * @param pluginId Plugin instance ID used as namespace prefix
27
+ * @param filePath Handler file path as it appears in the manifest (e.g., "src/handlers/UserLogin.ts")
28
+ */
29
+ getHandlerSchemas(pluginId: string, filePath: string): {
30
+ reqSchema?: object;
31
+ resSchema?: object;
32
+ };
33
+ /**
34
+ * Get all schemas from the plugin's manifest, prefixed with the plugin namespace.
35
+ * Pass the result to `app.registerSchemas()` for $ref resolution.
36
+ *
37
+ * @param pluginId Plugin instance ID used as namespace prefix
38
+ */
39
+ getAllSchemas(pluginId: string): Record<string, any>;
40
+ /**
41
+ * Get the raw manifest (for inspection/debugging).
42
+ */
43
+ getManifest(): SchemaManifest;
44
+ };
45
+ export {};
@@ -0,0 +1,143 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.loadPluginSchemas = loadPluginSchemas;
27
+ var fs = __importStar(require("fs"));
28
+ var path = __importStar(require("path"));
29
+ /**
30
+ * Prefix a schema $id or $ref value with the plugin namespace.
31
+ */
32
+ function prefixId(pluginId, id) {
33
+ return "".concat(pluginId, "::").concat(id);
34
+ }
35
+ /**
36
+ * Deep-clone a schema and prefix all $id and $ref values with the plugin namespace.
37
+ * Only prefixes $ref values that refer to schemas within this plugin's universe.
38
+ */
39
+ function prefixSchema(pluginId, schema, knownIds) {
40
+ if (!schema || typeof schema !== "object")
41
+ return schema;
42
+ if (Array.isArray(schema)) {
43
+ return schema.map(function (item) { return prefixSchema(pluginId, item, knownIds); });
44
+ }
45
+ var result = {};
46
+ for (var _i = 0, _a = Object.entries(schema); _i < _a.length; _i++) {
47
+ var _b = _a[_i], key = _b[0], value = _b[1];
48
+ if (key === "$id" && typeof value === "string") {
49
+ result[key] = prefixId(pluginId, value);
50
+ }
51
+ else if (key === "$ref" && typeof value === "string") {
52
+ // Only prefix refs that point to known plugin schemas
53
+ if (knownIds.has(value)) {
54
+ result[key] = prefixId(pluginId, value);
55
+ }
56
+ else {
57
+ result[key] = value;
58
+ }
59
+ }
60
+ else if (typeof value === "object") {
61
+ result[key] = prefixSchema(pluginId, value, knownIds);
62
+ }
63
+ else {
64
+ result[key] = value;
65
+ }
66
+ }
67
+ return result;
68
+ }
69
+ /**
70
+ * Load a plugin's schema manifest and provide helpers for getting
71
+ * namespaced schemas suitable for use with `app.registerSchemas()` and `addHandler()`.
72
+ *
73
+ * @param packageName The npm package name (e.g., "@flink-app/generic-auth-plugin").
74
+ * The package's `dist/.flink/schema-manifest.json` will be loaded.
75
+ * @returns Object with helper methods for retrieving prefixed schemas.
76
+ */
77
+ function loadPluginSchemas(packageName) {
78
+ var manifest;
79
+ // Resolve the package directory
80
+ var packageDir = path.dirname(require.resolve(path.join(packageName, "package.json")));
81
+ var manifestPath = path.join(packageDir, "dist/.flink/schema-manifest.json");
82
+ if (!fs.existsSync(manifestPath)) {
83
+ // No manifest — return empty helpers
84
+ manifest = { handlers: {}, tools: {} };
85
+ }
86
+ else {
87
+ manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
88
+ }
89
+ // Collect all known schema $ids for ref resolution
90
+ var schemas = manifest.schemas || manifest.definitions || {};
91
+ var knownIds = new Set();
92
+ for (var _i = 0, _a = Object.values(schemas); _i < _a.length; _i++) {
93
+ var schema = _a[_i];
94
+ if (schema && typeof schema === "object" && schema.$id) {
95
+ knownIds.add(schema.$id);
96
+ }
97
+ }
98
+ return {
99
+ /**
100
+ * Get prefixed req/res schemas for a specific handler file path.
101
+ *
102
+ * @param pluginId Plugin instance ID used as namespace prefix
103
+ * @param filePath Handler file path as it appears in the manifest (e.g., "src/handlers/UserLogin.ts")
104
+ */
105
+ getHandlerSchemas: function (pluginId, filePath) {
106
+ var metadata = manifest.handlers[filePath];
107
+ if (!metadata)
108
+ return {};
109
+ var result = {};
110
+ if (metadata.reqSchemaName && schemas[metadata.reqSchemaName]) {
111
+ result.reqSchema = prefixSchema(pluginId, schemas[metadata.reqSchemaName], knownIds);
112
+ }
113
+ if (metadata.resSchemaName && schemas[metadata.resSchemaName]) {
114
+ result.resSchema = prefixSchema(pluginId, schemas[metadata.resSchemaName], knownIds);
115
+ }
116
+ return result;
117
+ },
118
+ /**
119
+ * Get all schemas from the plugin's manifest, prefixed with the plugin namespace.
120
+ * Pass the result to `app.registerSchemas()` for $ref resolution.
121
+ *
122
+ * @param pluginId Plugin instance ID used as namespace prefix
123
+ */
124
+ getAllSchemas: function (pluginId) {
125
+ var prefixed = {};
126
+ for (var _i = 0, _a = Object.entries(schemas); _i < _a.length; _i++) {
127
+ var _b = _a[_i], name = _b[0], schema = _b[1];
128
+ if (schema && typeof schema === "object") {
129
+ var prefixedSchema = prefixSchema(pluginId, schema, knownIds);
130
+ var prefixedName = prefixId(pluginId, name);
131
+ prefixed[prefixedName] = prefixedSchema;
132
+ }
133
+ }
134
+ return prefixed;
135
+ },
136
+ /**
137
+ * Get the raw manifest (for inspection/debugging).
138
+ */
139
+ getManifest: function () {
140
+ return manifest;
141
+ },
142
+ };
143
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Detection utilities for complex TypeScript features that are difficult
3
+ * to parse with text-based extraction.
4
+ *
5
+ * These functions identify TypeScript features that should use ts-morph
6
+ * fallback for safety and correctness.
7
+ */
8
+ /**
9
+ * Detect template literal types.
10
+ * Example: type Route = `/${string}`;
11
+ */
12
+ export declare function hasTemplateLiteralType(text: string): boolean;
13
+ /**
14
+ * Detect conditional types.
15
+ * Example: type Extract<T> = T extends string ? T : never;
16
+ */
17
+ export declare function hasConditionalType(text: string): boolean;
18
+ /**
19
+ * Detect mapped types.
20
+ * Example: type Readonly<T> = { readonly [P in keyof T]: T[P] };
21
+ */
22
+ export declare function hasMappedType(text: string): boolean;
23
+ /**
24
+ * Detect string literals with brackets that might confuse parser.
25
+ * Example: interface Config { pattern: "{user:id}"; }
26
+ *
27
+ * Note: With enhanced tokenizer (Phase 1), this is now handled correctly.
28
+ * This detection is kept for monitoring and potential special handling.
29
+ */
30
+ export declare function hasComplexStringLiterals(text: string): boolean;
31
+ /**
32
+ * Check if text contains any complex TypeScript features that require
33
+ * ts-morph fallback for safe extraction.
34
+ */
35
+ export declare function hasComplexTypeFeatures(text: string): boolean;
36
+ /**
37
+ * Get a human-readable description of which complex features were detected.
38
+ * Useful for logging and debugging.
39
+ */
40
+ export declare function describeComplexFeatures(text: string): string[];
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ /**
3
+ * Detection utilities for complex TypeScript features that are difficult
4
+ * to parse with text-based extraction.
5
+ *
6
+ * These functions identify TypeScript features that should use ts-morph
7
+ * fallback for safety and correctness.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.hasTemplateLiteralType = hasTemplateLiteralType;
11
+ exports.hasConditionalType = hasConditionalType;
12
+ exports.hasMappedType = hasMappedType;
13
+ exports.hasComplexStringLiterals = hasComplexStringLiterals;
14
+ exports.hasComplexTypeFeatures = hasComplexTypeFeatures;
15
+ exports.describeComplexFeatures = describeComplexFeatures;
16
+ /**
17
+ * Detect template literal types.
18
+ * Example: type Route = `/${string}`;
19
+ */
20
+ function hasTemplateLiteralType(text) {
21
+ // Match: type Name = `...`
22
+ return /type\s+\w+\s*=\s*`/.test(text);
23
+ }
24
+ /**
25
+ * Detect conditional types.
26
+ * Example: type Extract<T> = T extends string ? T : never;
27
+ */
28
+ function hasConditionalType(text) {
29
+ // Match: T extends U ? A : B pattern
30
+ // Look for extends keyword followed by ? and : (conditional type pattern)
31
+ return /\bextends\b.*?\?.*?:/.test(text);
32
+ }
33
+ /**
34
+ * Detect mapped types.
35
+ * Example: type Readonly<T> = { readonly [P in keyof T]: T[P] };
36
+ */
37
+ function hasMappedType(text) {
38
+ // Match: [K in keyof T] pattern
39
+ return /\[\s*\w+\s+in\s+keyof\s+/.test(text);
40
+ }
41
+ /**
42
+ * Detect string literals with brackets that might confuse parser.
43
+ * Example: interface Config { pattern: "{user:id}"; }
44
+ *
45
+ * Note: With enhanced tokenizer (Phase 1), this is now handled correctly.
46
+ * This detection is kept for monitoring and potential special handling.
47
+ */
48
+ function hasComplexStringLiterals(text) {
49
+ // Match: quotes containing bracket characters
50
+ return /["'`].*?[{}<>].*?["'`]/.test(text);
51
+ }
52
+ /**
53
+ * Check if text contains any complex TypeScript features that require
54
+ * ts-morph fallback for safe extraction.
55
+ */
56
+ function hasComplexTypeFeatures(text) {
57
+ return hasTemplateLiteralType(text) || hasConditionalType(text) || hasMappedType(text);
58
+ }
59
+ /**
60
+ * Get a human-readable description of which complex features were detected.
61
+ * Useful for logging and debugging.
62
+ */
63
+ function describeComplexFeatures(text) {
64
+ var features = [];
65
+ if (hasTemplateLiteralType(text)) {
66
+ features.push("template literal types");
67
+ }
68
+ if (hasConditionalType(text)) {
69
+ features.push("conditional types");
70
+ }
71
+ if (hasMappedType(text)) {
72
+ features.push("mapped types");
73
+ }
74
+ return features;
75
+ }
@@ -0,0 +1,321 @@
1
+ import { FlinkToolTypeArgs, PropertyMetadata, SchemaTypeDetection, TypeDefinition } from "./types";
2
+ /**
3
+ * Pure utility class for parsing TypeScript source code as text.
4
+ * All methods are static and side-effect free for easy testing.
5
+ *
6
+ * This class provides fast, regex-based parsing without using ts-morph
7
+ * or the TypeScript compiler, making it suitable for performance-critical
8
+ * schema extraction.
9
+ */
10
+ export declare class TypeScriptSourceParser {
11
+ /**
12
+ * Remove comments from source code to avoid false positives in schema detection.
13
+ * Handles both single-line (//) and multi-line (/* *\/) comments.
14
+ */
15
+ private static removeComments;
16
+ /**
17
+ * Detect if a tool source file uses Zod or JSON schemas.
18
+ * If true, TypeScript schema extraction should be skipped.
19
+ *
20
+ * Note: Strips comments first to avoid false positives from commented-out schemas.
21
+ */
22
+ static detectSchemaType(sourceText: string): SchemaTypeDetection;
23
+ /**
24
+ * Extract type arguments from Handler<Ctx, Req, Res, Params, Query> declaration.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * parseHandlerTypeArgs('const handler: Handler<AppCtx, LoginReq, LoginRes>')
29
+ * // Returns: { contextType: 'AppCtx', reqType: 'LoginReq', resType: 'LoginRes' }
30
+ * ```
31
+ */
32
+ static parseHandlerTypeArgs(sourceText: string): {
33
+ contextType: string;
34
+ reqType?: string;
35
+ resType?: string;
36
+ paramsType?: string;
37
+ queryType?: string;
38
+ } | null;
39
+ /**
40
+ * Extract type arguments from FlinkTool<Ctx, Input, Output> declaration.
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * parseFlinkToolTypeArgs('const handler: FlinkTool<Ctx, CreateDocInput, ToolResult<DocOutput>>')
45
+ * // Returns: { contextType: 'Ctx', inputType: 'CreateDocInput', outputType: 'ToolResult<DocOutput>' }
46
+ * ```
47
+ */
48
+ static parseFlinkToolTypeArgs(sourceText: string): FlinkToolTypeArgs | null;
49
+ /**
50
+ * Split a string by commas, but only at the top level (not inside angle brackets).
51
+ * Helper for parsing generic type arguments like "Ctx, Input, ToolResult<Output>"
52
+ */
53
+ private static splitTopLevelCommas;
54
+ /**
55
+ * Check if a type should generate a schema.
56
+ * Returns false for primitives and special types, true for named types and inline objects.
57
+ */
58
+ static shouldGenerateSchema(typeName: string): boolean;
59
+ /**
60
+ * Check if a type is a built-in TypeScript type.
61
+ */
62
+ static isBuiltInType(typeName: string): boolean;
63
+ /**
64
+ * Extract T from ToolResult<T> type name.
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * unwrapToolResultType('ToolResult<DocOutput>') // Returns: 'DocOutput'
69
+ * unwrapToolResultType('DocOutput') // Returns: 'DocOutput'
70
+ * ```
71
+ */
72
+ static unwrapToolResultType(typeName: string): string;
73
+ /**
74
+ * Convert inline object type to interface definition.
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * convertInlineObjectToInterface('{}', 'MyInput')
79
+ * // Returns: 'export interface MyInput {}'
80
+ *
81
+ * convertInlineObjectToInterface('{ foo: string }', 'MyInput')
82
+ * // Returns: 'export interface MyInput {\n foo: string;\n}'
83
+ * ```
84
+ */
85
+ static convertInlineObjectToInterface(inlineType: string, interfaceName: string): string;
86
+ /**
87
+ * Find an interface or type definition in source text.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const source = `
92
+ * interface User {
93
+ * name: string;
94
+ * }
95
+ * `;
96
+ * findTypeDefinition(source, 'User')
97
+ * // Returns: { name: 'User', definition: 'interface User { ... }', kind: 'interface' }
98
+ * ```
99
+ */
100
+ static findTypeDefinition(sourceText: string, typeName: string): TypeDefinition | null;
101
+ /**
102
+ * Peek at the next non-whitespace, non-comment character starting at `fromPos`.
103
+ * Returns the character, or undefined if only whitespace/comments remain.
104
+ */
105
+ private static peekNextSignificantChar;
106
+ /**
107
+ * Determine whether a type expression continues after `fromPos`, i.e. whether
108
+ * the character that follows is a type-combinator/continuation operator
109
+ * (`|`, `&`, `[`, `.`, etc.) rather than the start of an unrelated statement.
110
+ *
111
+ * Used to decide if a top-level closing bracket terminates a semicolon-free
112
+ * type alias or whether the alias keeps going (e.g. a union of object types).
113
+ */
114
+ private static typeContinuesAfter;
115
+ /**
116
+ * Rename an interface or type definition.
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * renameTypeDefinition('interface User { name: string }', 'User', 'Person')
121
+ * // Returns: 'export interface Person { name: string }'
122
+ * ```
123
+ */
124
+ static renameTypeDefinition(definition: string, oldName: string, newName: string, exportIt?: boolean): string;
125
+ /**
126
+ * Extract all type names referenced in a type definition.
127
+ * Excludes JSDoc comments and string literals.
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * extractReferencedTypes('interface Doc { author: User; tags: Tag[] }')
132
+ * // Returns: ['User', 'Tag']
133
+ * extractReferencedTypes('PaginatedResponse<Car>')
134
+ * // Returns: ['PaginatedResponse', 'Car']
135
+ * ```
136
+ */
137
+ static extractReferencedTypes(typeDefinition: string): string[];
138
+ /**
139
+ * Check if a type name is an inline object type.
140
+ */
141
+ static isInlineObjectType(typeName: string): boolean;
142
+ /**
143
+ * Parse JSDoc comment text to extract description.
144
+ * Strips JSDoc comment markers and leading asterisks.
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * parseJsDocDescription('/** Max cars to retrieve *\/')
149
+ * // Returns: "Max cars to retrieve"
150
+ *
151
+ * parseJsDocDescription('/**\n * Max cars to retrieve\n * from the database\n *\/')
152
+ * // Returns: "Max cars to retrieve from the database"
153
+ *
154
+ * parseJsDocDescription('')
155
+ * // Returns: ""
156
+ * ```
157
+ */
158
+ static parseJsDocDescription(jsDocText: string): string;
159
+ /**
160
+ * Extract property metadata from an object type body.
161
+ * Parses properties with optional JSDoc comments.
162
+ * Only extracts top-level properties (not nested object properties).
163
+ *
164
+ * @param objectBody The content between { and } in an object type
165
+ * @returns Array of property metadata (name + description)
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * const body = `
170
+ * /** Max cars to retrieve *\/
171
+ * limit: string;
172
+ * page?: number;
173
+ * `;
174
+ * extractPropertiesFromObjectType(body)
175
+ * // Returns: [
176
+ * // { name: "limit", description: "Max cars to retrieve" },
177
+ * // { name: "page", description: "" }
178
+ * // ]
179
+ * ```
180
+ */
181
+ static extractPropertiesFromObjectType(objectBody: string): PropertyMetadata[];
182
+ /**
183
+ * Copy a type definition and recursively find all its dependencies.
184
+ * Returns structured data without side effects.
185
+ *
186
+ * @param sourceText Full source file text to search for types
187
+ * @param typeName Name of the type to copy
188
+ * @param newName New name for the type (use same name for dependencies)
189
+ * @param copiedTypes Set of already-copied type names to avoid duplication
190
+ * @returns Object containing the main definition, dependency definitions, and import statements
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * const source = `
195
+ * import { Address } from './Address';
196
+ * interface User {
197
+ * profile: Profile;
198
+ * address: Address;
199
+ * }
200
+ * interface Profile {
201
+ * name: string;
202
+ * }
203
+ * `;
204
+ * const result = copyTypeWithDependencies(source, 'User', 'UserSchema', new Set());
205
+ * // Returns: {
206
+ * // mainDefinition: 'export interface UserSchema { profile: Profile; address: Address; }',
207
+ * // dependencies: ['export interface Profile { name: string; }'],
208
+ * // imports: ['import { Address } from "./Address"'],
209
+ * // copiedTypes: Set(['User', 'Profile'])
210
+ * // }
211
+ * ```
212
+ */
213
+ static copyTypeWithDependencies(sourceText: string, typeName: string, newName: string, copiedTypes: Set<string>): {
214
+ mainDefinition: string | null;
215
+ dependencies: string[];
216
+ imports: string[];
217
+ copiedTypes: Set<string>;
218
+ };
219
+ /**
220
+ * Extract import statement for a specific type from source text.
221
+ *
222
+ * @param sourceText Full source file text
223
+ * @param typeName Name of the type to find import for
224
+ * @returns Import statement or null if not found
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * const source = `
229
+ * import { User } from '../schemas/User';
230
+ * import type { Profile } from '../schemas/Profile';
231
+ * import Foo from '../schemas/Foo';
232
+ * `;
233
+ * extractImportForType(source, 'User')
234
+ * // Returns: "import { User } from '../schemas/User'"
235
+ *
236
+ * extractImportForType(source, 'Profile')
237
+ * // Returns: "import type { Profile } from '../schemas/Profile'"
238
+ *
239
+ * extractImportForType(source, 'Foo')
240
+ * // Returns: "import Foo from '../schemas/Foo'"
241
+ * ```
242
+ */
243
+ static extractImportForType(sourceText: string, typeName: string): string | null;
244
+ /**
245
+ * Extract all imports from a source file.
246
+ * Used to get transitive dependencies when importing a type.
247
+ *
248
+ * @param sourceText Source code to extract imports from
249
+ * @returns Array of import statements
250
+ */
251
+ static extractAllImports(sourceText: string): string[];
252
+ /**
253
+ * Adjust import path to be relative to .flink/schemas/ directory.
254
+ *
255
+ * @param importStatement Original import statement
256
+ * @returns Adjusted import statement with corrected path
257
+ *
258
+ * @example
259
+ * ```typescript
260
+ * adjustImportPathForSchemas('import { User } from "../schemas/User"')
261
+ * // Returns: 'import { User } from "../../src/schemas/User"'
262
+ *
263
+ * adjustImportPathForSchemas('import Profile from "../../schemas/Profile"')
264
+ * // Returns: 'import Profile from "../../src/schemas/Profile"'
265
+ *
266
+ * adjustImportPathForSchemas('import { Req } from "../clients/SupermetricsClient"')
267
+ * // Returns: 'import { Req } from "../../src/clients/SupermetricsClient"'
268
+ *
269
+ * adjustImportPathForSchemas('import { Foo } from "@company/shared"')
270
+ * // Returns: 'import { Foo } from "@company/shared"' (unchanged - not relative)
271
+ * ```
272
+ */
273
+ static adjustImportPathForSchemas(importStatement: string): string;
274
+ /**
275
+ * Extract property metadata from a named type definition.
276
+ * Searches for the type definition and parses its properties.
277
+ *
278
+ * @param sourceText Full source file text
279
+ * @param typeName Name of the type to extract properties from
280
+ * @returns Array of property metadata, or null if type not found
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * const source = `
285
+ * interface Query {
286
+ * /** Max items *\/
287
+ * limit: string;
288
+ * page?: number;
289
+ * }
290
+ * `;
291
+ * extractPropertyMetadata(source, 'Query')
292
+ * // Returns: [
293
+ * // { name: "limit", description: "Max items" },
294
+ * // { name: "page", description: "" }
295
+ * // ]
296
+ * ```
297
+ */
298
+ static extractPropertyMetadata(sourceText: string, typeName: string): PropertyMetadata[] | null;
299
+ /**
300
+ * Consolidates duplicate imports from the same module.
301
+ * Merges named imports and preserves default imports.
302
+ *
303
+ * @param imports Array of import statements
304
+ * @returns Consolidated import statements with duplicates merged
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * const imports = [
309
+ * 'import { Ad } from "../../src/schemas/Ad"',
310
+ * 'import { AdStatus } from "../../src/schemas/Ad"',
311
+ * 'import { User } from "../../src/schemas/User"'
312
+ * ];
313
+ * consolidateImports(imports)
314
+ * // Returns: [
315
+ * // 'import { Ad, AdStatus } from "../../src/schemas/Ad"',
316
+ * // 'import { User } from "../../src/schemas/User"'
317
+ * // ]
318
+ * ```
319
+ */
320
+ static consolidateImports(imports: string[]): string[];
321
+ }