@squadbase/vite-server 0.1.17-dev.24af54e → 0.1.17-dev.7408ec4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/cli/index.js +1682 -425
  2. package/dist/connectors/airtable-oauth.js +22 -3
  3. package/dist/connectors/airtable.js +22 -3
  4. package/dist/connectors/amplitude.js +22 -3
  5. package/dist/connectors/asana.js +22 -3
  6. package/dist/connectors/attio.js +22 -3
  7. package/dist/connectors/aws-billing.js +22 -3
  8. package/dist/connectors/azure-sql.js +25 -6
  9. package/dist/connectors/backlog-api-key.js +22 -3
  10. package/dist/connectors/clickup.js +22 -3
  11. package/dist/connectors/cosmosdb.js +22 -3
  12. package/dist/connectors/customerio.js +23 -4
  13. package/dist/connectors/dbt.js +22 -3
  14. package/dist/connectors/freshdesk.js +22 -3
  15. package/dist/connectors/freshsales.js +22 -3
  16. package/dist/connectors/freshservice.js +22 -3
  17. package/dist/connectors/gamma.js +24 -5
  18. package/dist/connectors/github.js +22 -3
  19. package/dist/connectors/gmail-oauth.js +22 -3
  20. package/dist/connectors/gmail.js +22 -3
  21. package/dist/connectors/google-ads.js +22 -3
  22. package/dist/connectors/google-analytics-oauth.js +22 -3
  23. package/dist/connectors/google-analytics.js +222 -68
  24. package/dist/connectors/google-audit-log.js +22 -3
  25. package/dist/connectors/google-calendar-oauth.js +22 -3
  26. package/dist/connectors/google-calendar.js +22 -3
  27. package/dist/connectors/google-docs.js +22 -3
  28. package/dist/connectors/google-drive.js +22 -3
  29. package/dist/connectors/google-search-console-oauth.js +22 -3
  30. package/dist/connectors/google-sheets.js +22 -3
  31. package/dist/connectors/google-slides.js +22 -3
  32. package/dist/connectors/grafana.js +22 -3
  33. package/dist/connectors/hubspot-oauth.js +22 -3
  34. package/dist/connectors/hubspot.js +22 -3
  35. package/dist/connectors/influxdb.js +22 -3
  36. package/dist/connectors/intercom-oauth.js +22 -3
  37. package/dist/connectors/intercom.js +22 -3
  38. package/dist/connectors/jdbc.js +22 -3
  39. package/dist/connectors/jira-api-key.js +22 -3
  40. package/dist/connectors/kintone-api-token.js +22 -3
  41. package/dist/connectors/kintone.js +22 -3
  42. package/dist/connectors/linear.js +22 -3
  43. package/dist/connectors/linkedin-ads.js +22 -3
  44. package/dist/connectors/mailchimp-oauth.js +22 -3
  45. package/dist/connectors/mailchimp.js +22 -3
  46. package/dist/connectors/meta-ads-oauth.js +22 -3
  47. package/dist/connectors/meta-ads.js +22 -3
  48. package/dist/connectors/mixpanel.js +22 -3
  49. package/dist/connectors/monday.js +22 -3
  50. package/dist/connectors/mongodb.js +22 -3
  51. package/dist/connectors/notion-oauth.js +22 -3
  52. package/dist/connectors/notion.js +22 -3
  53. package/dist/connectors/oracle.js +48 -14
  54. package/dist/connectors/outlook-oauth.js +22 -3
  55. package/dist/connectors/powerbi-oauth.js +303 -37
  56. package/dist/connectors/salesforce.js +22 -3
  57. package/dist/connectors/semrush.js +360 -46
  58. package/dist/connectors/sentry.js +22 -3
  59. package/dist/connectors/shopify-oauth.js +22 -3
  60. package/dist/connectors/shopify.js +22 -3
  61. package/dist/connectors/sqlserver.js +25 -6
  62. package/dist/connectors/stripe-api-key.js +22 -3
  63. package/dist/connectors/stripe-oauth.js +22 -3
  64. package/dist/connectors/supabase.js +25 -6
  65. package/dist/connectors/tableau.js +240 -78
  66. package/dist/connectors/tiktok-ads.js +22 -3
  67. package/dist/connectors/wix-store.js +22 -3
  68. package/dist/connectors/zendesk-oauth.js +22 -3
  69. package/dist/connectors/zendesk.js +22 -3
  70. package/dist/index.js +1682 -425
  71. package/dist/main.js +1682 -425
  72. package/dist/vite-plugin.js +1682 -425
  73. package/package.json +1 -1
@@ -326,19 +326,28 @@ async function runSetupFlow(flow, params, ctx, config) {
326
326
  };
327
327
  let state = flow.initialState();
328
328
  let answerIdx = 0;
329
+ const pendingParameterUpdates = [];
329
330
  for (const step of flow.steps) {
330
331
  const ans = ctx.answers[answerIdx];
331
332
  if (ans && ans.questionSlug === step.slug) {
332
333
  state = step.applyAnswer(state, ans.answer);
334
+ if (step.toParameterUpdates) {
335
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
336
+ }
333
337
  answerIdx += 1;
334
338
  continue;
335
339
  }
340
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
336
341
  if (step.type === "text") {
337
342
  return {
338
343
  type: "nextQuestion",
339
344
  questionSlug: step.slug,
340
345
  question: step.question[ctx.language],
341
- questionType: "text"
346
+ questionType: "text",
347
+ allowFreeText: resolvedAllowFreeText,
348
+ ...pendingParameterUpdates.length > 0 && {
349
+ parameterUpdates: pendingParameterUpdates
350
+ }
342
351
  };
343
352
  }
344
353
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -350,11 +359,21 @@ async function runSetupFlow(flow, params, ctx, config) {
350
359
  questionSlug: step.slug,
351
360
  question: step.question[ctx.language],
352
361
  questionType: step.type,
353
- options
362
+ options,
363
+ allowFreeText: resolvedAllowFreeText,
364
+ ...pendingParameterUpdates.length > 0 && {
365
+ parameterUpdates: pendingParameterUpdates
366
+ }
354
367
  };
355
368
  }
356
369
  const dataInvestigationResult = await flow.finalize(state, runtime);
357
- return { type: "fulfilled", dataInvestigationResult };
370
+ return {
371
+ type: "fulfilled",
372
+ dataInvestigationResult,
373
+ ...pendingParameterUpdates.length > 0 && {
374
+ parameterUpdates: pendingParameterUpdates
375
+ }
376
+ };
358
377
  }
359
378
  async function resolveSetupSelection(params) {
360
379
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -332,19 +332,28 @@ async function runSetupFlow(flow, params, ctx, config) {
332
332
  };
333
333
  let state = flow.initialState();
334
334
  let answerIdx = 0;
335
+ const pendingParameterUpdates = [];
335
336
  for (const step of flow.steps) {
336
337
  const ans = ctx.answers[answerIdx];
337
338
  if (ans && ans.questionSlug === step.slug) {
338
339
  state = step.applyAnswer(state, ans.answer);
340
+ if (step.toParameterUpdates) {
341
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
342
+ }
339
343
  answerIdx += 1;
340
344
  continue;
341
345
  }
346
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
342
347
  if (step.type === "text") {
343
348
  return {
344
349
  type: "nextQuestion",
345
350
  questionSlug: step.slug,
346
351
  question: step.question[ctx.language],
347
- questionType: "text"
352
+ questionType: "text",
353
+ allowFreeText: resolvedAllowFreeText,
354
+ ...pendingParameterUpdates.length > 0 && {
355
+ parameterUpdates: pendingParameterUpdates
356
+ }
348
357
  };
349
358
  }
350
359
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -356,11 +365,21 @@ async function runSetupFlow(flow, params, ctx, config) {
356
365
  questionSlug: step.slug,
357
366
  question: step.question[ctx.language],
358
367
  questionType: step.type,
359
- options
368
+ options,
369
+ allowFreeText: resolvedAllowFreeText,
370
+ ...pendingParameterUpdates.length > 0 && {
371
+ parameterUpdates: pendingParameterUpdates
372
+ }
360
373
  };
361
374
  }
362
375
  const dataInvestigationResult = await flow.finalize(state, runtime);
363
- return { type: "fulfilled", dataInvestigationResult };
376
+ return {
377
+ type: "fulfilled",
378
+ dataInvestigationResult,
379
+ ...pendingParameterUpdates.length > 0 && {
380
+ parameterUpdates: pendingParameterUpdates
381
+ }
382
+ };
364
383
  }
365
384
  async function resolveSetupSelection(params) {
366
385
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -235,19 +235,28 @@ async function runSetupFlow(flow, params, ctx, config) {
235
235
  };
236
236
  let state = flow.initialState();
237
237
  let answerIdx = 0;
238
+ const pendingParameterUpdates = [];
238
239
  for (const step of flow.steps) {
239
240
  const ans = ctx.answers[answerIdx];
240
241
  if (ans && ans.questionSlug === step.slug) {
241
242
  state = step.applyAnswer(state, ans.answer);
243
+ if (step.toParameterUpdates) {
244
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
245
+ }
242
246
  answerIdx += 1;
243
247
  continue;
244
248
  }
249
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
245
250
  if (step.type === "text") {
246
251
  return {
247
252
  type: "nextQuestion",
248
253
  questionSlug: step.slug,
249
254
  question: step.question[ctx.language],
250
- questionType: "text"
255
+ questionType: "text",
256
+ allowFreeText: resolvedAllowFreeText,
257
+ ...pendingParameterUpdates.length > 0 && {
258
+ parameterUpdates: pendingParameterUpdates
259
+ }
251
260
  };
252
261
  }
253
262
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -259,11 +268,21 @@ async function runSetupFlow(flow, params, ctx, config) {
259
268
  questionSlug: step.slug,
260
269
  question: step.question[ctx.language],
261
270
  questionType: step.type,
262
- options
271
+ options,
272
+ allowFreeText: resolvedAllowFreeText,
273
+ ...pendingParameterUpdates.length > 0 && {
274
+ parameterUpdates: pendingParameterUpdates
275
+ }
263
276
  };
264
277
  }
265
278
  const dataInvestigationResult = await flow.finalize(state, runtime);
266
- return { type: "fulfilled", dataInvestigationResult };
279
+ return {
280
+ type: "fulfilled",
281
+ dataInvestigationResult,
282
+ ...pendingParameterUpdates.length > 0 && {
283
+ parameterUpdates: pendingParameterUpdates
284
+ }
285
+ };
267
286
  }
268
287
  async function resolveSetupSelection(params) {
269
288
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -241,19 +241,28 @@ async function runSetupFlow(flow, params, ctx, config) {
241
241
  };
242
242
  let state = flow.initialState();
243
243
  let answerIdx = 0;
244
+ const pendingParameterUpdates = [];
244
245
  for (const step of flow.steps) {
245
246
  const ans = ctx.answers[answerIdx];
246
247
  if (ans && ans.questionSlug === step.slug) {
247
248
  state = step.applyAnswer(state, ans.answer);
249
+ if (step.toParameterUpdates) {
250
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
251
+ }
248
252
  answerIdx += 1;
249
253
  continue;
250
254
  }
255
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
251
256
  if (step.type === "text") {
252
257
  return {
253
258
  type: "nextQuestion",
254
259
  questionSlug: step.slug,
255
260
  question: step.question[ctx.language],
256
- questionType: "text"
261
+ questionType: "text",
262
+ allowFreeText: resolvedAllowFreeText,
263
+ ...pendingParameterUpdates.length > 0 && {
264
+ parameterUpdates: pendingParameterUpdates
265
+ }
257
266
  };
258
267
  }
259
268
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -265,11 +274,21 @@ async function runSetupFlow(flow, params, ctx, config) {
265
274
  questionSlug: step.slug,
266
275
  question: step.question[ctx.language],
267
276
  questionType: step.type,
268
- options
277
+ options,
278
+ allowFreeText: resolvedAllowFreeText,
279
+ ...pendingParameterUpdates.length > 0 && {
280
+ parameterUpdates: pendingParameterUpdates
281
+ }
269
282
  };
270
283
  }
271
284
  const dataInvestigationResult = await flow.finalize(state, runtime);
272
- return { type: "fulfilled", dataInvestigationResult };
285
+ return {
286
+ type: "fulfilled",
287
+ dataInvestigationResult,
288
+ ...pendingParameterUpdates.length > 0 && {
289
+ parameterUpdates: pendingParameterUpdates
290
+ }
291
+ };
273
292
  }
274
293
  async function resolveSetupSelection(params) {
275
294
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -346,19 +346,28 @@ async function runSetupFlow(flow, params, ctx, config) {
346
346
  };
347
347
  let state = flow.initialState();
348
348
  let answerIdx = 0;
349
+ const pendingParameterUpdates = [];
349
350
  for (const step of flow.steps) {
350
351
  const ans = ctx.answers[answerIdx];
351
352
  if (ans && ans.questionSlug === step.slug) {
352
353
  state = step.applyAnswer(state, ans.answer);
354
+ if (step.toParameterUpdates) {
355
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
356
+ }
353
357
  answerIdx += 1;
354
358
  continue;
355
359
  }
360
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
356
361
  if (step.type === "text") {
357
362
  return {
358
363
  type: "nextQuestion",
359
364
  questionSlug: step.slug,
360
365
  question: step.question[ctx.language],
361
- questionType: "text"
366
+ questionType: "text",
367
+ allowFreeText: resolvedAllowFreeText,
368
+ ...pendingParameterUpdates.length > 0 && {
369
+ parameterUpdates: pendingParameterUpdates
370
+ }
362
371
  };
363
372
  }
364
373
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -370,11 +379,21 @@ async function runSetupFlow(flow, params, ctx, config) {
370
379
  questionSlug: step.slug,
371
380
  question: step.question[ctx.language],
372
381
  questionType: step.type,
373
- options
382
+ options,
383
+ allowFreeText: resolvedAllowFreeText,
384
+ ...pendingParameterUpdates.length > 0 && {
385
+ parameterUpdates: pendingParameterUpdates
386
+ }
374
387
  };
375
388
  }
376
389
  const dataInvestigationResult = await flow.finalize(state, runtime);
377
- return { type: "fulfilled", dataInvestigationResult };
390
+ return {
391
+ type: "fulfilled",
392
+ dataInvestigationResult,
393
+ ...pendingParameterUpdates.length > 0 && {
394
+ parameterUpdates: pendingParameterUpdates
395
+ }
396
+ };
378
397
  }
379
398
  async function resolveSetupSelection(params) {
380
399
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -235,19 +235,28 @@ async function runSetupFlow(flow, params, ctx, config) {
235
235
  };
236
236
  let state = flow.initialState();
237
237
  let answerIdx = 0;
238
+ const pendingParameterUpdates = [];
238
239
  for (const step of flow.steps) {
239
240
  const ans = ctx.answers[answerIdx];
240
241
  if (ans && ans.questionSlug === step.slug) {
241
242
  state = step.applyAnswer(state, ans.answer);
243
+ if (step.toParameterUpdates) {
244
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
245
+ }
242
246
  answerIdx += 1;
243
247
  continue;
244
248
  }
249
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
245
250
  if (step.type === "text") {
246
251
  return {
247
252
  type: "nextQuestion",
248
253
  questionSlug: step.slug,
249
254
  question: step.question[ctx.language],
250
- questionType: "text"
255
+ questionType: "text",
256
+ allowFreeText: resolvedAllowFreeText,
257
+ ...pendingParameterUpdates.length > 0 && {
258
+ parameterUpdates: pendingParameterUpdates
259
+ }
251
260
  };
252
261
  }
253
262
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -259,11 +268,21 @@ async function runSetupFlow(flow, params, ctx, config) {
259
268
  questionSlug: step.slug,
260
269
  question: step.question[ctx.language],
261
270
  questionType: step.type,
262
- options
271
+ options,
272
+ allowFreeText: resolvedAllowFreeText,
273
+ ...pendingParameterUpdates.length > 0 && {
274
+ parameterUpdates: pendingParameterUpdates
275
+ }
263
276
  };
264
277
  }
265
278
  const dataInvestigationResult = await flow.finalize(state, runtime);
266
- return { type: "fulfilled", dataInvestigationResult };
279
+ return {
280
+ type: "fulfilled",
281
+ dataInvestigationResult,
282
+ ...pendingParameterUpdates.length > 0 && {
283
+ parameterUpdates: pendingParameterUpdates
284
+ }
285
+ };
267
286
  }
268
287
  async function resolveSetupSelection(params) {
269
288
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -306,19 +306,28 @@ async function runSetupFlow(flow, params, ctx, config) {
306
306
  };
307
307
  let state = flow.initialState();
308
308
  let answerIdx = 0;
309
+ const pendingParameterUpdates = [];
309
310
  for (const step of flow.steps) {
310
311
  const ans = ctx.answers[answerIdx];
311
312
  if (ans && ans.questionSlug === step.slug) {
312
313
  state = step.applyAnswer(state, ans.answer);
314
+ if (step.toParameterUpdates) {
315
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
316
+ }
313
317
  answerIdx += 1;
314
318
  continue;
315
319
  }
320
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
316
321
  if (step.type === "text") {
317
322
  return {
318
323
  type: "nextQuestion",
319
324
  questionSlug: step.slug,
320
325
  question: step.question[ctx.language],
321
- questionType: "text"
326
+ questionType: "text",
327
+ allowFreeText: resolvedAllowFreeText,
328
+ ...pendingParameterUpdates.length > 0 && {
329
+ parameterUpdates: pendingParameterUpdates
330
+ }
322
331
  };
323
332
  }
324
333
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -330,11 +339,21 @@ async function runSetupFlow(flow, params, ctx, config) {
330
339
  questionSlug: step.slug,
331
340
  question: step.question[ctx.language],
332
341
  questionType: step.type,
333
- options
342
+ options,
343
+ allowFreeText: resolvedAllowFreeText,
344
+ ...pendingParameterUpdates.length > 0 && {
345
+ parameterUpdates: pendingParameterUpdates
346
+ }
334
347
  };
335
348
  }
336
349
  const dataInvestigationResult = await flow.finalize(state, runtime);
337
- return { type: "fulfilled", dataInvestigationResult };
350
+ return {
351
+ type: "fulfilled",
352
+ dataInvestigationResult,
353
+ ...pendingParameterUpdates.length > 0 && {
354
+ parameterUpdates: pendingParameterUpdates
355
+ }
356
+ };
338
357
  }
339
358
  async function resolveSetupSelection(params) {
340
359
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -398,19 +398,28 @@ async function runSetupFlow(flow, params, ctx, config) {
398
398
  };
399
399
  let state = flow.initialState();
400
400
  let answerIdx = 0;
401
+ const pendingParameterUpdates = [];
401
402
  for (const step of flow.steps) {
402
403
  const ans = ctx.answers[answerIdx];
403
404
  if (ans && ans.questionSlug === step.slug) {
404
405
  state = step.applyAnswer(state, ans.answer);
406
+ if (step.toParameterUpdates) {
407
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
408
+ }
405
409
  answerIdx += 1;
406
410
  continue;
407
411
  }
412
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
408
413
  if (step.type === "text") {
409
414
  return {
410
415
  type: "nextQuestion",
411
416
  questionSlug: step.slug,
412
417
  question: step.question[ctx.language],
413
- questionType: "text"
418
+ questionType: "text",
419
+ allowFreeText: resolvedAllowFreeText,
420
+ ...pendingParameterUpdates.length > 0 && {
421
+ parameterUpdates: pendingParameterUpdates
422
+ }
414
423
  };
415
424
  }
416
425
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -422,11 +431,21 @@ async function runSetupFlow(flow, params, ctx, config) {
422
431
  questionSlug: step.slug,
423
432
  question: step.question[ctx.language],
424
433
  questionType: step.type,
425
- options
434
+ options,
435
+ allowFreeText: resolvedAllowFreeText,
436
+ ...pendingParameterUpdates.length > 0 && {
437
+ parameterUpdates: pendingParameterUpdates
438
+ }
426
439
  };
427
440
  }
428
441
  const dataInvestigationResult = await flow.finalize(state, runtime);
429
- return { type: "fulfilled", dataInvestigationResult };
442
+ return {
443
+ type: "fulfilled",
444
+ dataInvestigationResult,
445
+ ...pendingParameterUpdates.length > 0 && {
446
+ parameterUpdates: pendingParameterUpdates
447
+ }
448
+ };
430
449
  }
431
450
 
432
451
  // ../connectors/src/auth-types.ts
@@ -428,19 +428,28 @@ async function runSetupFlow(flow, params, ctx, config) {
428
428
  };
429
429
  let state = flow.initialState();
430
430
  let answerIdx = 0;
431
+ const pendingParameterUpdates = [];
431
432
  for (const step of flow.steps) {
432
433
  const ans = ctx.answers[answerIdx];
433
434
  if (ans && ans.questionSlug === step.slug) {
434
435
  state = step.applyAnswer(state, ans.answer);
436
+ if (step.toParameterUpdates) {
437
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
438
+ }
435
439
  answerIdx += 1;
436
440
  continue;
437
441
  }
442
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
438
443
  if (step.type === "text") {
439
444
  return {
440
445
  type: "nextQuestion",
441
446
  questionSlug: step.slug,
442
447
  question: step.question[ctx.language],
443
- questionType: "text"
448
+ questionType: "text",
449
+ allowFreeText: resolvedAllowFreeText,
450
+ ...pendingParameterUpdates.length > 0 && {
451
+ parameterUpdates: pendingParameterUpdates
452
+ }
444
453
  };
445
454
  }
446
455
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -452,11 +461,21 @@ async function runSetupFlow(flow, params, ctx, config) {
452
461
  questionSlug: step.slug,
453
462
  question: step.question[ctx.language],
454
463
  questionType: step.type,
455
- options
464
+ options,
465
+ allowFreeText: resolvedAllowFreeText,
466
+ ...pendingParameterUpdates.length > 0 && {
467
+ parameterUpdates: pendingParameterUpdates
468
+ }
456
469
  };
457
470
  }
458
471
  const dataInvestigationResult = await flow.finalize(state, runtime);
459
- return { type: "fulfilled", dataInvestigationResult };
472
+ return {
473
+ type: "fulfilled",
474
+ dataInvestigationResult,
475
+ ...pendingParameterUpdates.length > 0 && {
476
+ parameterUpdates: pendingParameterUpdates
477
+ }
478
+ };
460
479
  }
461
480
  async function resolveSetupSelection(params) {
462
481
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -333,19 +333,28 @@ async function runSetupFlow(flow, params, ctx, config) {
333
333
  };
334
334
  let state = flow.initialState();
335
335
  let answerIdx = 0;
336
+ const pendingParameterUpdates = [];
336
337
  for (const step of flow.steps) {
337
338
  const ans = ctx.answers[answerIdx];
338
339
  if (ans && ans.questionSlug === step.slug) {
339
340
  state = step.applyAnswer(state, ans.answer);
341
+ if (step.toParameterUpdates) {
342
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
343
+ }
340
344
  answerIdx += 1;
341
345
  continue;
342
346
  }
347
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
343
348
  if (step.type === "text") {
344
349
  return {
345
350
  type: "nextQuestion",
346
351
  questionSlug: step.slug,
347
352
  question: step.question[ctx.language],
348
- questionType: "text"
353
+ questionType: "text",
354
+ allowFreeText: resolvedAllowFreeText,
355
+ ...pendingParameterUpdates.length > 0 && {
356
+ parameterUpdates: pendingParameterUpdates
357
+ }
349
358
  };
350
359
  }
351
360
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -357,11 +366,21 @@ async function runSetupFlow(flow, params, ctx, config) {
357
366
  questionSlug: step.slug,
358
367
  question: step.question[ctx.language],
359
368
  questionType: step.type,
360
- options
369
+ options,
370
+ allowFreeText: resolvedAllowFreeText,
371
+ ...pendingParameterUpdates.length > 0 && {
372
+ parameterUpdates: pendingParameterUpdates
373
+ }
361
374
  };
362
375
  }
363
376
  const dataInvestigationResult = await flow.finalize(state, runtime);
364
- return { type: "fulfilled", dataInvestigationResult };
377
+ return {
378
+ type: "fulfilled",
379
+ dataInvestigationResult,
380
+ ...pendingParameterUpdates.length > 0 && {
381
+ parameterUpdates: pendingParameterUpdates
382
+ }
383
+ };
365
384
  }
366
385
  async function resolveSetupSelection(params) {
367
386
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -184,19 +184,28 @@ async function runSetupFlow(flow, params, ctx, config) {
184
184
  };
185
185
  let state = flow.initialState();
186
186
  let answerIdx = 0;
187
+ const pendingParameterUpdates = [];
187
188
  for (const step of flow.steps) {
188
189
  const ans = ctx.answers[answerIdx];
189
190
  if (ans && ans.questionSlug === step.slug) {
190
191
  state = step.applyAnswer(state, ans.answer);
192
+ if (step.toParameterUpdates) {
193
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
194
+ }
191
195
  answerIdx += 1;
192
196
  continue;
193
197
  }
198
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
194
199
  if (step.type === "text") {
195
200
  return {
196
201
  type: "nextQuestion",
197
202
  questionSlug: step.slug,
198
203
  question: step.question[ctx.language],
199
- questionType: "text"
204
+ questionType: "text",
205
+ allowFreeText: resolvedAllowFreeText,
206
+ ...pendingParameterUpdates.length > 0 && {
207
+ parameterUpdates: pendingParameterUpdates
208
+ }
200
209
  };
201
210
  }
202
211
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -208,11 +217,21 @@ async function runSetupFlow(flow, params, ctx, config) {
208
217
  questionSlug: step.slug,
209
218
  question: step.question[ctx.language],
210
219
  questionType: step.type,
211
- options
220
+ options,
221
+ allowFreeText: resolvedAllowFreeText,
222
+ ...pendingParameterUpdates.length > 0 && {
223
+ parameterUpdates: pendingParameterUpdates
224
+ }
212
225
  };
213
226
  }
214
227
  const dataInvestigationResult = await flow.finalize(state, runtime);
215
- return { type: "fulfilled", dataInvestigationResult };
228
+ return {
229
+ type: "fulfilled",
230
+ dataInvestigationResult,
231
+ ...pendingParameterUpdates.length > 0 && {
232
+ parameterUpdates: pendingParameterUpdates
233
+ }
234
+ };
216
235
  }
217
236
  async function resolveSetupSelection(params) {
218
237
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -348,19 +348,28 @@ async function runSetupFlow(flow, params, ctx, config) {
348
348
  };
349
349
  let state = flow.initialState();
350
350
  let answerIdx = 0;
351
+ const pendingParameterUpdates = [];
351
352
  for (const step of flow.steps) {
352
353
  const ans = ctx.answers[answerIdx];
353
354
  if (ans && ans.questionSlug === step.slug) {
354
355
  state = step.applyAnswer(state, ans.answer);
356
+ if (step.toParameterUpdates) {
357
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
358
+ }
355
359
  answerIdx += 1;
356
360
  continue;
357
361
  }
362
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
358
363
  if (step.type === "text") {
359
364
  return {
360
365
  type: "nextQuestion",
361
366
  questionSlug: step.slug,
362
367
  question: step.question[ctx.language],
363
- questionType: "text"
368
+ questionType: "text",
369
+ allowFreeText: resolvedAllowFreeText,
370
+ ...pendingParameterUpdates.length > 0 && {
371
+ parameterUpdates: pendingParameterUpdates
372
+ }
364
373
  };
365
374
  }
366
375
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -372,11 +381,21 @@ async function runSetupFlow(flow, params, ctx, config) {
372
381
  questionSlug: step.slug,
373
382
  question: step.question[ctx.language],
374
383
  questionType: step.type,
375
- options
384
+ options,
385
+ allowFreeText: resolvedAllowFreeText,
386
+ ...pendingParameterUpdates.length > 0 && {
387
+ parameterUpdates: pendingParameterUpdates
388
+ }
376
389
  };
377
390
  }
378
391
  const dataInvestigationResult = await flow.finalize(state, runtime);
379
- return { type: "fulfilled", dataInvestigationResult };
392
+ return {
393
+ type: "fulfilled",
394
+ dataInvestigationResult,
395
+ ...pendingParameterUpdates.length > 0 && {
396
+ parameterUpdates: pendingParameterUpdates
397
+ }
398
+ };
380
399
  }
381
400
  async function resolveSetupSelection(params) {
382
401
  const { selected, allSentinel, fetchAll, limit } = params;