|
@@ -56,7 +56,7 @@ export function configurableDefinitionToInstance(
|
|
|
* ```
|
|
* ```
|
|
|
* {
|
|
* {
|
|
|
* code: 'my-operation',
|
|
* code: 'my-operation',
|
|
|
- * args: [
|
|
|
|
|
|
|
+ * arguments: [
|
|
|
* { name: 'someProperty', value: 'foo' }
|
|
* { name: 'someProperty', value: 'foo' }
|
|
|
* ]
|
|
* ]
|
|
|
* }
|
|
* }
|
|
@@ -64,16 +64,19 @@ export function configurableDefinitionToInstance(
|
|
|
*/
|
|
*/
|
|
|
export function toConfigurableOperationInput(
|
|
export function toConfigurableOperationInput(
|
|
|
operation: ConfigurableOperation,
|
|
operation: ConfigurableOperation,
|
|
|
- formValueOperations: any,
|
|
|
|
|
|
|
+ formValueOperations: { args: Record<string, any> },
|
|
|
): ConfigurableOperationInput {
|
|
): ConfigurableOperationInput {
|
|
|
return {
|
|
return {
|
|
|
code: operation.code,
|
|
code: operation.code,
|
|
|
- arguments: Object.values<any>(formValueOperations.args || {}).map((value, j) => ({
|
|
|
|
|
- name: operation.args[j].name,
|
|
|
|
|
- value: value?.hasOwnProperty('value')
|
|
|
|
|
- ? encodeConfigArgValue((value as any).value)
|
|
|
|
|
- : encodeConfigArgValue(value),
|
|
|
|
|
- })),
|
|
|
|
|
|
|
+ arguments: operation.args.map(({ name, value }, j) => {
|
|
|
|
|
+ const formValue = formValueOperations.args[name];
|
|
|
|
|
+ return {
|
|
|
|
|
+ name,
|
|
|
|
|
+ value: formValue?.hasOwnProperty('value')
|
|
|
|
|
+ ? encodeConfigArgValue((formValue as any).value)
|
|
|
|
|
+ : encodeConfigArgValue(formValue),
|
|
|
|
|
+ };
|
|
|
|
|
+ }),
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|