Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clover): Build sub sub assets #5380

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/clover/src/cfDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ export async function loadCfDatabase(
const typeName: string = data.typeName;

if (
false &&
// false &&
![
"AWS::QBusiness::DataSource",
"AWS::ECS::TaskDefinition",
].includes(typeName)
) continue;

Expand Down
12 changes: 9 additions & 3 deletions bin/clover/src/pipeline-steps/createInputSocketsAcrossAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ export function createInputSocketsBasedOnOutputSockets(

for (const prop of domain.entries) {
if (foundOutputSockets.has(prop.name)) {
schemaVariant.sockets.push(
createInputSocketFromProp(prop as ExpandedPropSpec),
);
let found = false;
for (const socket of schemaVariant.sockets) {
if (socket.name == prop.name) found = true;
}
if (!found) {
schemaVariant.sockets.push(
createInputSocketFromProp(prop as ExpandedPropSpec),
);
}
}
}

Expand Down
15 changes: 7 additions & 8 deletions bin/clover/src/pipeline-steps/generateSubAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export function generateSubAssets(incomingSpecs: PkgSpec[]): PkgSpec[] {

for (const prop of domain.entries) {
if (prop.kind === "array" && prop.typeProp.kind === "object") {
const objName = prop.name.endsWith("s")
? prop.name.slice(0, -1)
: prop.name;
const objName = prop.name;

logger.debug(`Generating subasset ${objName} for ${spec.name}`);

Expand Down Expand Up @@ -169,12 +167,13 @@ export function generateSubAssets(incomingSpecs: PkgSpec[]): PkgSpec[] {
for (const name of names) {
const nameTokens = name.split("::");
// TODO check naming for sub sub assets
// if (nameTokens.length !== 4) {
// throw new Error(`Could not parse subAsset name: ${name}`);
// }
if (nameTokens.length < 4) {
throw new Error(`Could not parse subAsset name: ${name}`);
}

const [_aws, awsCategory, parent, objName] = nameTokens;
finalObjName = objName;
const awsCategory = nameTokens[1];
const parent = nameTokens[nameTokens.length - 2];
finalObjName = nameTokens[nameTokens.length - 1];

// For categories and parents, set to null if not all of them are the same
if (finalAwsCategory === undefined) {
Expand Down
4 changes: 2 additions & 2 deletions bin/clover/src/spec/sockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createOutputSocketFromProp(
const socket = createSocket(prop.name, "output", arity);
if (socket.data) {
socket.data.funcUniqueId = getSiFuncId("si:identity");
socket.inputs.push(attrFuncInputSpecFromProp(prop));
socket.inputs = [attrFuncInputSpecFromProp(prop)];
}
return socket;
}
Expand All @@ -26,7 +26,7 @@ export function createInputSocketFromProp(
): SocketSpec {
const socket = createSocket(prop.name, "input", arity);
if (socket.data) {
prop.data.inputs?.push(attrFuncInputSpecFromSocket(socket));
prop.data.inputs = [attrFuncInputSpecFromSocket(socket)];
prop.data.funcUniqueId = getSiFuncId("si:identity");
}
return socket;
Expand Down