@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
@@ -907,8 +907,8 @@ var handleCodec = (t, checker) => {
907
907
  }
908
908
  return codecType.value;
909
909
  };
910
- var toColumns = (t, checker) => {
911
- if (checker.getIndexInfosOfType(t).length !== 0) {
910
+ var toColumns = (t, checker, options) => {
911
+ if (!options?.allowIndexSignatures && checker.getIndexInfosOfType(t).length !== 0) {
912
912
  console.log("[CompilerPlugin]", checker.getIndexInfosOfType(t));
913
913
  throwIndexTypeError(t, checker);
914
914
  }
@@ -1004,11 +1004,37 @@ var typiaTypeGuard = (node) => {
1004
1004
  var transformNewMooseResource = (node, checker) => {
1005
1005
  const typeName = checker.getSymbolAtLocation(node.expression).name;
1006
1006
  const typeNode = node.typeArguments[0];
1007
+ let ingestPipelineHasTable = true;
1008
+ if (typeName === "IngestPipeline" && node.arguments && node.arguments.length >= 2) {
1009
+ const configArg = node.arguments[1];
1010
+ if (ts4.isObjectLiteralExpression(configArg)) {
1011
+ const tableProperty = configArg.properties.find(
1012
+ (prop) => ts4.isPropertyAssignment(prop) && ts4.isIdentifier(prop.name) && prop.name.text === "table"
1013
+ );
1014
+ if (tableProperty) {
1015
+ const tableValue = tableProperty.initializer;
1016
+ ingestPipelineHasTable = tableValue.kind !== ts4.SyntaxKind.FalseKeyword;
1017
+ }
1018
+ }
1019
+ }
1020
+ const allowIndexSignatures = ["IngestApi", "Stream"].includes(typeName) || typeName === "IngestPipeline" && !ingestPipelineHasTable;
1021
+ const typeAtLocation = checker.getTypeAtLocation(typeNode);
1022
+ const indexSignatures = checker.getIndexInfosOfType(typeAtLocation);
1023
+ const hasIndexSignature = allowIndexSignatures && indexSignatures.length > 0;
1024
+ if (typeName === "IngestPipeline" && ingestPipelineHasTable && indexSignatures.length > 0) {
1025
+ throw new Error(
1026
+ `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:
1027
+ 1. Remove the index signature from your type to use a fixed schema, or
1028
+ 2. Set 'table: false' in your IngestPipeline config if you only need the API and stream`
1029
+ );
1030
+ }
1007
1031
  const internalArguments = typeName === "DeadLetterQueue" ? [typiaTypeGuard(node)] : [
1008
1032
  typiaJsonSchemas(typeNode),
1009
1033
  parseAsAny(
1010
1034
  JSON.stringify(
1011
- toColumns(checker.getTypeAtLocation(typeNode), checker)
1035
+ toColumns(typeAtLocation, checker, {
1036
+ allowIndexSignatures
1037
+ })
1012
1038
  )
1013
1039
  )
1014
1040
  ];
@@ -1039,6 +1065,20 @@ var transformNewMooseResource = (node, checker) => {
1039
1065
  true
1040
1066
  );
1041
1067
  updatedArgs = [...updatedArgs, validatorsObject];
1068
+ if (resourceName === "IngestPipeline") {
1069
+ updatedArgs = [
1070
+ ...updatedArgs,
1071
+ hasIndexSignature ? factory2.createTrue() : factory2.createFalse()
1072
+ ];
1073
+ }
1074
+ }
1075
+ if (resourceName === "IngestApi" || resourceName === "Stream") {
1076
+ updatedArgs = [
1077
+ ...updatedArgs,
1078
+ factory2.createIdentifier("undefined"),
1079
+ // validators (not used for these types)
1080
+ hasIndexSignature ? factory2.createTrue() : factory2.createFalse()
1081
+ ];
1042
1082
  }
1043
1083
  return ts4.factory.updateNewExpression(
1044
1084
  node,