Skip to content

Commit

Permalink
Merge pull request #5380 from systeminit/clover/fix-sub-sub-assets
Browse files Browse the repository at this point in the history
fix(clover): Build sub sub assets
  • Loading branch information
sprutton1 authored Jan 29, 2025
2 parents 2eb1f88 + 6e59c3f commit 2d886ea
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
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

0 comments on commit 2d886ea

Please sign in to comment.