Skip to content

Commit 194133a

Browse files
committed
feat(davinci-client): bug fixes, improvements for MultiValueCollectors
1 parent 6fa225e commit 194133a

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

e2e/davinci-app/tsconfig.app.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"moduleResolution": "Bundler"
66
},
77
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
8-
"include": ["./main.ts", "./server-configs.ts", "components/**/*.ts"],
8+
"include": [
9+
"./main.ts",
10+
"./helper.ts",
11+
"./server-configs.ts",
12+
"components/**/*.ts"
13+
],
914
"references": [
1015
{
1116
"path": "../../packages/davinci-client/tsconfig.lib.json"

packages/davinci-client/src/lib/client.store.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,12 @@ export async function davinci({ config }: { config: DaVinciConfig }) {
175175
}
176176

177177
if (
178+
collectorToUpdate.category !== 'MultiValueCollector' &&
178179
collectorToUpdate.category !== 'SingleValueCollector' &&
179180
collectorToUpdate.category !== 'ValidatedSingleValueCollector'
180181
) {
181182
console.error(
182-
'Collector is not a SingleValueCollector or ValidatedSingleValueCollector and cannot be updated',
183+
'Collector is not a MultiValueCollector, SingleValueCollector or ValidatedSingleValueCollector and cannot be updated',
183184
);
184185
return function () {
185186
return {

packages/davinci-client/src/lib/davinci.utils.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ export function transformSubmitRequest(node: ContinueNode): DaVinciRequest {
2727
// Filter out ActionCollectors as they are not used in form submissions
2828
const collectors = node.client?.collectors?.filter(
2929
(collector) =>
30+
collector.category === 'MultiValueCollector' ||
3031
collector.category === 'SingleValueCollector' ||
3132
collector.category === 'ValidatedSingleValueCollector',
3233
);
3334

3435
const formData = collectors?.reduce<{
35-
[key: string]: string | number | boolean;
36+
[key: string]: string | number | boolean | (string | number | boolean)[];
3637
}>((acc, collector) => {
3738
acc[collector.input.key] = collector.input.value;
3839
return acc;

0 commit comments

Comments
 (0)