Skip to content
Open
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
2 changes: 2 additions & 0 deletions packages/agent/src/utils/forest-schema/action-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export default class ForestValueConverter {
data[key] = value;
}
}

data[field.name] = data[key];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makeFormDataFromFields and makeFormDataUnsafe don't need the same ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes maybe they do. It was just a 20 min POC that would need more testing and refining

}

return data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ export type ValueOrHandler<Context = unknown, Result = unknown> =
type BaseDynamicField<Type, Context, Result> = {
type: Type;
label: string;
/**
* the name used to access your value from the context.
* different from the label as it is not shown to the user
* @example
* //in your action field definition:
* {
* label: "Discount percentage"
* name: "percentage"
* ...
* }
*
* //in your execution
* await context.collection.update(context.filter, { percentage: context.formValues.percentage });
*/
name: string;
description?: ValueOrHandler<Context, string>;
isRequired?: ValueOrHandler<Context, boolean>;
isReadOnly?: ValueOrHandler<Context, boolean>;
Expand Down
1 change: 1 addition & 0 deletions packages/datasource-toolkit/src/interfaces/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type File = {
export type ActionFieldBase = {
type: ActionFieldType;
label: string;
name: string;
description?: string;
isRequired?: boolean;
isReadOnly?: boolean;
Expand Down