chilly-dream-30512
09/13/2024, 8:22 AMthis.registerOutputs
is called because I can invoke that in the callback?
Like this?
export class Vote extends pulumi.ComponentResource {
constructor(
name: string,
args: VoteArgs,
opts?: pulumi.ComponentResourceOptions,
) {
super("svmkit:index:Vote", name, args, opts);
const parent = this;
const tag = naming(name);
const { endpoint, params } = args;
this.create(endpoint, params)
.catch((err) => {
parent.registerOutputs({});
})
.then(() => {
parent.registerOutputs({});
});
}
}
chilly-dream-30512
09/13/2024, 12:05 PMexport async function constructVote(
name: string,
inputs: pulumi.Inputs,
options: pulumi.ComponentResourceOptions,
): Promise<provider.ConstructResult> {
const signature = await Vote.create(inputs.endpoint, inputs.params);
const vote = new Vote(name, inputs as VoteArgs, signature, options);
return {
urn: vote.urn,
state: {
signature: vote.signature,
},
};
}
I’m calling the async function in the construct function and then updating the call signature of the component.little-cartoon-10569
09/13/2024, 8:46 PMchilly-dream-30512
09/14/2024, 4:52 AMlittle-cartoon-10569
09/14/2024, 5:49 AMchilly-dream-30512
09/14/2024, 1:59 PMchilly-dream-30512
09/14/2024, 4:31 PMlittle-cartoon-10569
09/14/2024, 7:52 PMchilly-dream-30512
09/14/2024, 8:01 PMlittle-cartoon-10569
09/14/2024, 8:16 PM