@flink-app/flink 2.0.0-alpha.49 → 2.0.0-alpha.50

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @flink-app/flink
2
2
 
3
+ ## 2.0.0-alpha.50
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix compiler incorrectly treating all files in src/tools/ as tools. The compiler now checks for FlinkToolProps export early and skips utility files, type definitions, and index files that aren't actual tools, preventing false "Missing FlinkToolProps export" errors.
8
+
3
9
  ## 2.0.0-alpha.49
4
10
 
5
11
  ### Patch Changes
@@ -546,7 +546,7 @@ var TypeScriptCompiler = /** @class */ (function () {
546
546
  */
547
547
  TypeScriptCompiler.prototype.parseTools = function () {
548
548
  return __awaiter(this, void 0, void 0, function () {
549
- var generatedFile, toolsArr, imports, i, _i, _a, sf, namespaceImport, toolPropsVar, toolPropsExportName, existingFile;
549
+ var generatedFile, toolsArr, imports, i, _i, _a, sf, toolPropsVar, namespaceImport, toolPropsExportName, existingFile;
550
550
  return __generator(this, function (_b) {
551
551
  switch (_b.label) {
552
552
  case 0:
@@ -559,14 +559,18 @@ var TypeScriptCompiler = /** @class */ (function () {
559
559
  if (!sf.getFilePath().includes("src/tools/")) {
560
560
  continue;
561
561
  }
562
+ toolPropsVar = this.findVariableDeclarationByType(sf, "FlinkToolProps");
563
+ // Skip files that don't export FlinkToolProps (utility files, types, etc.)
564
+ if (!toolPropsVar) {
565
+ continue;
566
+ }
562
567
  console.log("Detected tool ".concat(sf.getBaseName()));
563
568
  namespaceImport = sf.getBaseNameWithoutExtension().replace(/\./g, "_") + "_" + i;
564
569
  imports.push({
565
570
  defaultImport: "* as " + namespaceImport,
566
571
  moduleSpecifier: this.getModuleSpecifier(generatedFile, sf),
567
572
  });
568
- toolPropsVar = this.findVariableDeclarationByType(sf, "FlinkToolProps");
569
- toolPropsExportName = (toolPropsVar === null || toolPropsVar === void 0 ? void 0 : toolPropsVar.getName()) || "Tool";
573
+ toolPropsExportName = toolPropsVar.getName();
570
574
  existingFile = sf.getVariableStatements().filter(function (vs) {
571
575
  var varNames = vs.getDeclarations().map(function (d) { return d.getName(); });
572
576
  return varNames.includes("__file");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/flink",
3
- "version": "2.0.0-alpha.49",
3
+ "version": "2.0.0-alpha.50",
4
4
  "description": "Typescript only framework for creating REST-like APIs on top of Express and mongodb",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "main": "dist/src/index.js",
@@ -516,6 +516,14 @@ autoRegisteredTools.push(...tools);
516
516
  continue;
517
517
  }
518
518
 
519
+ // Find the tool props variable (can have any name, but must be of type FlinkToolProps)
520
+ const toolPropsVar = this.findVariableDeclarationByType(sf, "FlinkToolProps");
521
+
522
+ // Skip files that don't export FlinkToolProps (utility files, types, etc.)
523
+ if (!toolPropsVar) {
524
+ continue;
525
+ }
526
+
519
527
  console.log(`Detected tool ${sf.getBaseName()}`);
520
528
 
521
529
  const namespaceImport = sf.getBaseNameWithoutExtension().replace(/\./g, "_") + "_" + i;
@@ -525,9 +533,7 @@ autoRegisteredTools.push(...tools);
525
533
  moduleSpecifier: this.getModuleSpecifier(generatedFile, sf),
526
534
  });
527
535
 
528
- // Find the tool props variable (can have any name, but must be of type FlinkToolProps)
529
- const toolPropsVar = this.findVariableDeclarationByType(sf, "FlinkToolProps");
530
- const toolPropsExportName = toolPropsVar?.getName() || "Tool";
536
+ const toolPropsExportName = toolPropsVar.getName();
531
537
 
532
538
  // Remove existing __file variable if it exists
533
539
  const existingFile = sf.getVariableStatements().filter((vs) => {