Skip to content

Commit c7f9527

Browse files
committed
fix
1 parent e08b1c3 commit c7f9527

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

packages/ts-moose-lib/src/dmv2/dataModelMetadata.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,38 @@ export const transformNewMooseResource = (
8282

8383
const typeNode = node.typeArguments![0];
8484

85-
// Allow index signatures for IngestApi and Stream types
85+
// For IngestPipeline, check if table is configured in the config object
86+
// Index signatures are only allowed when table is false/not configured
87+
// (because OlapTable requires a fixed schema)
88+
let ingestPipelineHasTable = true; // Default to true (safe: disallows index signatures)
89+
if (
90+
typeName === "IngestPipeline" &&
91+
node.arguments &&
92+
node.arguments.length >= 2
93+
) {
94+
const configArg = node.arguments[1];
95+
if (ts.isObjectLiteralExpression(configArg)) {
96+
const tableProperty = configArg.properties.find(
97+
(prop): prop is ts.PropertyAssignment =>
98+
ts.isPropertyAssignment(prop) &&
99+
ts.isIdentifier(prop.name) &&
100+
prop.name.text === "table",
101+
);
102+
if (tableProperty) {
103+
const tableValue = tableProperty.initializer;
104+
// Check if table value is explicitly false
105+
ingestPipelineHasTable = tableValue.kind !== ts.SyntaxKind.FalseKeyword;
106+
}
107+
// If table property is not found, keep default (true = has table)
108+
// This is the safe default since 'table' is a required property
109+
}
110+
}
111+
112+
// Allow index signatures for IngestApi, Stream, and IngestPipeline (when table is not configured)
86113
// These resources accept arbitrary payload fields that pass through to streaming functions
87-
const allowIndexSignatures = ["IngestApi", "Stream"].includes(typeName);
114+
const allowIndexSignatures =
115+
["IngestApi", "Stream"].includes(typeName) ||
116+
(typeName === "IngestPipeline" && !ingestPipelineHasTable);
88117

89118
// Check if the type actually has an index signature
90119
const typeAtLocation = checker.getTypeAtLocation(typeNode);

0 commit comments

Comments
 (0)