@514labs/moose-lib 0.6.265 → 0.6.266-ci-11-g69efdf88

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 (35) hide show
  1. package/dist/{browserCompatible-Bqhjy4pn.d.ts → browserCompatible-CpjUXotI.d.ts} +1 -1
  2. package/dist/{browserCompatible-DTtKuO-Y.d.mts → browserCompatible-fk6xPzoB.d.mts} +1 -1
  3. package/dist/browserCompatible.d.mts +2 -2
  4. package/dist/browserCompatible.d.ts +2 -2
  5. package/dist/browserCompatible.js +22 -10
  6. package/dist/browserCompatible.js.map +1 -1
  7. package/dist/browserCompatible.mjs +22 -10
  8. package/dist/browserCompatible.mjs.map +1 -1
  9. package/dist/compilerPlugin.js +43 -3
  10. package/dist/compilerPlugin.js.map +1 -1
  11. package/dist/compilerPlugin.mjs +43 -3
  12. package/dist/compilerPlugin.mjs.map +1 -1
  13. package/dist/dataModels/toDataModels.js +2 -2
  14. package/dist/dataModels/toDataModels.js.map +1 -1
  15. package/dist/dataModels/toDataModels.mjs +2 -2
  16. package/dist/dataModels/toDataModels.mjs.map +1 -1
  17. package/dist/dmv2/index.d.mts +1 -1
  18. package/dist/dmv2/index.d.ts +1 -1
  19. package/dist/dmv2/index.js +22 -10
  20. package/dist/dmv2/index.js.map +1 -1
  21. package/dist/dmv2/index.mjs +22 -10
  22. package/dist/dmv2/index.mjs.map +1 -1
  23. package/dist/{index-CQB6bk1i.d.mts → index-Dd3ZmpTq.d.mts} +25 -6
  24. package/dist/{index-CQB6bk1i.d.ts → index-Dd3ZmpTq.d.ts} +25 -6
  25. package/dist/index.d.mts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +22 -10
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +22 -10
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/moose-runner.js +2 -1
  32. package/dist/moose-runner.js.map +1 -1
  33. package/dist/moose-runner.mjs +2 -1
  34. package/dist/moose-runner.mjs.map +1 -1
  35. package/package.json +1 -1
@@ -937,8 +937,8 @@ var handleCodec = (t, checker) => {
937
937
  }
938
938
  return codecType.value;
939
939
  };
940
- var toColumns = (t, checker) => {
941
- if (checker.getIndexInfosOfType(t).length !== 0) {
940
+ var toColumns = (t, checker, options) => {
941
+ if (!options?.allowIndexSignatures && checker.getIndexInfosOfType(t).length !== 0) {
942
942
  console.log("[CompilerPlugin]", checker.getIndexInfosOfType(t));
943
943
  throwIndexTypeError(t, checker);
944
944
  }
@@ -1034,11 +1034,37 @@ var typiaTypeGuard = (node) => {
1034
1034
  var transformNewMooseResource = (node, checker) => {
1035
1035
  const typeName = checker.getSymbolAtLocation(node.expression).name;
1036
1036
  const typeNode = node.typeArguments[0];
1037
+ let ingestPipelineHasTable = true;
1038
+ if (typeName === "IngestPipeline" && node.arguments && node.arguments.length >= 2) {
1039
+ const configArg = node.arguments[1];
1040
+ if (import_typescript4.default.isObjectLiteralExpression(configArg)) {
1041
+ const tableProperty = configArg.properties.find(
1042
+ (prop) => import_typescript4.default.isPropertyAssignment(prop) && import_typescript4.default.isIdentifier(prop.name) && prop.name.text === "table"
1043
+ );
1044
+ if (tableProperty) {
1045
+ const tableValue = tableProperty.initializer;
1046
+ ingestPipelineHasTable = tableValue.kind !== import_typescript4.default.SyntaxKind.FalseKeyword;
1047
+ }
1048
+ }
1049
+ }
1050
+ const allowIndexSignatures = ["IngestApi", "Stream"].includes(typeName) || typeName === "IngestPipeline" && !ingestPipelineHasTable;
1051
+ const typeAtLocation = checker.getTypeAtLocation(typeNode);
1052
+ const indexSignatures = checker.getIndexInfosOfType(typeAtLocation);
1053
+ const hasIndexSignature = allowIndexSignatures && indexSignatures.length > 0;
1054
+ if (typeName === "IngestPipeline" && ingestPipelineHasTable && indexSignatures.length > 0) {
1055
+ throw new Error(
1056
+ `IngestPipeline cannot use a type with index signatures when 'table' is configured. Extra fields would be silently dropped when writing to the ClickHouse table. Either:
1057
+ 1. Remove the index signature from your type to use a fixed schema, or
1058
+ 2. Set 'table: false' in your IngestPipeline config if you only need the API and stream`
1059
+ );
1060
+ }
1037
1061
  const internalArguments = typeName === "DeadLetterQueue" ? [typiaTypeGuard(node)] : [
1038
1062
  typiaJsonSchemas(typeNode),
1039
1063
  parseAsAny(
1040
1064
  JSON.stringify(
1041
- toColumns(checker.getTypeAtLocation(typeNode), checker)
1065
+ toColumns(typeAtLocation, checker, {
1066
+ allowIndexSignatures
1067
+ })
1042
1068
  )
1043
1069
  )
1044
1070
  ];
@@ -1069,6 +1095,20 @@ var transformNewMooseResource = (node, checker) => {
1069
1095
  true
1070
1096
  );
1071
1097
  updatedArgs = [...updatedArgs, validatorsObject];
1098
+ if (resourceName === "IngestPipeline") {
1099
+ updatedArgs = [
1100
+ ...updatedArgs,
1101
+ hasIndexSignature ? import_typescript4.factory.createTrue() : import_typescript4.factory.createFalse()
1102
+ ];
1103
+ }
1104
+ }
1105
+ if (resourceName === "IngestApi" || resourceName === "Stream") {
1106
+ updatedArgs = [
1107
+ ...updatedArgs,
1108
+ import_typescript4.factory.createIdentifier("undefined"),
1109
+ // validators (not used for these types)
1110
+ hasIndexSignature ? import_typescript4.factory.createTrue() : import_typescript4.factory.createFalse()
1111
+ ];
1072
1112
  }
1073
1113
  return import_typescript4.default.factory.updateNewExpression(
1074
1114
  node,