Skip to content

Commit

Permalink
fix(framework): Ensure missing schemas return unknown record type (#6912
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rifont authored Nov 11, 2024
1 parent f5af1d4 commit b9185ed
Show file tree
Hide file tree
Showing 61 changed files with 981 additions and 544 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ChannelStep,
DelayOutput,
DigestOutput,
JsonSchema,
Step,
StepOptions,
StepOutput,
Expand Down Expand Up @@ -41,10 +42,10 @@ export class ConstructFrameworkWorkflow {
}
}

return this.constructFrameworkWorkflow(dbWorkflow, command.action);
return this.constructFrameworkWorkflow(dbWorkflow);
}

private constructFrameworkWorkflow(newWorkflow, action) {
private constructFrameworkWorkflow(newWorkflow: NotificationTemplateEntity) {
return workflow(
newWorkflow.triggers[0].identifier,
async ({ step, payload, subscriber }) => {
Expand Down Expand Up @@ -178,7 +179,8 @@ export class ConstructFrameworkWorkflow {

private constructCommonStepOptions(staticStep: NotificationStepEntity): Required<StepOptions> {
return {
controlSchema: staticStep.template!.controls!.schema,
// TODO: fix the `JSONSchemaDto` type to enforce a non-primitive schema type.
controlSchema: staticStep.template!.controls!.schema as JsonSchema,
/*
* TODO: add conditions
* Used to construct conditions defined with https://react-querybuilder.js.org/ or similar
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"next",
"nuxt",
"remix",
"sveltekit",
"sveltekit",
"README.md"
],
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export class Client {
throw new Error(`Invalid component: '${component}'`);
}
} else {
return result.data;
return result.data as T;
}
}

Expand Down
Loading

0 comments on commit b9185ed

Please sign in to comment.