@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
@@ -320,19 +320,28 @@ async function runSetupFlow(flow, params, ctx, config) {
320
320
  };
321
321
  let state = flow.initialState();
322
322
  let answerIdx = 0;
323
+ const pendingParameterUpdates = [];
323
324
  for (const step of flow.steps) {
324
325
  const ans = ctx.answers[answerIdx];
325
326
  if (ans && ans.questionSlug === step.slug) {
326
327
  state = step.applyAnswer(state, ans.answer);
328
+ if (step.toParameterUpdates) {
329
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
330
+ }
327
331
  answerIdx += 1;
328
332
  continue;
329
333
  }
334
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
330
335
  if (step.type === "text") {
331
336
  return {
332
337
  type: "nextQuestion",
333
338
  questionSlug: step.slug,
334
339
  question: step.question[ctx.language],
335
- questionType: "text"
340
+ questionType: "text",
341
+ allowFreeText: resolvedAllowFreeText,
342
+ ...pendingParameterUpdates.length > 0 && {
343
+ parameterUpdates: pendingParameterUpdates
344
+ }
336
345
  };
337
346
  }
338
347
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -344,11 +353,21 @@ async function runSetupFlow(flow, params, ctx, config) {
344
353
  questionSlug: step.slug,
345
354
  question: step.question[ctx.language],
346
355
  questionType: step.type,
347
- options
356
+ options,
357
+ allowFreeText: resolvedAllowFreeText,
358
+ ...pendingParameterUpdates.length > 0 && {
359
+ parameterUpdates: pendingParameterUpdates
360
+ }
348
361
  };
349
362
  }
350
363
  const dataInvestigationResult = await flow.finalize(state, runtime);
351
- return { type: "fulfilled", dataInvestigationResult };
364
+ return {
365
+ type: "fulfilled",
366
+ dataInvestigationResult,
367
+ ...pendingParameterUpdates.length > 0 && {
368
+ parameterUpdates: pendingParameterUpdates
369
+ }
370
+ };
352
371
  }
353
372
  async function resolveSetupSelection(params) {
354
373
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -307,19 +307,28 @@ async function runSetupFlow(flow, params, ctx, config) {
307
307
  };
308
308
  let state = flow.initialState();
309
309
  let answerIdx = 0;
310
+ const pendingParameterUpdates = [];
310
311
  for (const step of flow.steps) {
311
312
  const ans = ctx.answers[answerIdx];
312
313
  if (ans && ans.questionSlug === step.slug) {
313
314
  state = step.applyAnswer(state, ans.answer);
315
+ if (step.toParameterUpdates) {
316
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
317
+ }
314
318
  answerIdx += 1;
315
319
  continue;
316
320
  }
321
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
317
322
  if (step.type === "text") {
318
323
  return {
319
324
  type: "nextQuestion",
320
325
  questionSlug: step.slug,
321
326
  question: step.question[ctx.language],
322
- questionType: "text"
327
+ questionType: "text",
328
+ allowFreeText: resolvedAllowFreeText,
329
+ ...pendingParameterUpdates.length > 0 && {
330
+ parameterUpdates: pendingParameterUpdates
331
+ }
323
332
  };
324
333
  }
325
334
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -331,11 +340,21 @@ async function runSetupFlow(flow, params, ctx, config) {
331
340
  questionSlug: step.slug,
332
341
  question: step.question[ctx.language],
333
342
  questionType: step.type,
334
- options
343
+ options,
344
+ allowFreeText: resolvedAllowFreeText,
345
+ ...pendingParameterUpdates.length > 0 && {
346
+ parameterUpdates: pendingParameterUpdates
347
+ }
335
348
  };
336
349
  }
337
350
  const dataInvestigationResult = await flow.finalize(state, runtime);
338
- return { type: "fulfilled", dataInvestigationResult };
351
+ return {
352
+ type: "fulfilled",
353
+ dataInvestigationResult,
354
+ ...pendingParameterUpdates.length > 0 && {
355
+ parameterUpdates: pendingParameterUpdates
356
+ }
357
+ };
339
358
  }
340
359
  async function resolveSetupSelection(params) {
341
360
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -238,19 +238,28 @@ async function runSetupFlow(flow, params, ctx, config) {
238
238
  };
239
239
  let state = flow.initialState();
240
240
  let answerIdx = 0;
241
+ const pendingParameterUpdates = [];
241
242
  for (const step of flow.steps) {
242
243
  const ans = ctx.answers[answerIdx];
243
244
  if (ans && ans.questionSlug === step.slug) {
244
245
  state = step.applyAnswer(state, ans.answer);
246
+ if (step.toParameterUpdates) {
247
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
248
+ }
245
249
  answerIdx += 1;
246
250
  continue;
247
251
  }
252
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
248
253
  if (step.type === "text") {
249
254
  return {
250
255
  type: "nextQuestion",
251
256
  questionSlug: step.slug,
252
257
  question: step.question[ctx.language],
253
- questionType: "text"
258
+ questionType: "text",
259
+ allowFreeText: resolvedAllowFreeText,
260
+ ...pendingParameterUpdates.length > 0 && {
261
+ parameterUpdates: pendingParameterUpdates
262
+ }
254
263
  };
255
264
  }
256
265
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -262,11 +271,21 @@ async function runSetupFlow(flow, params, ctx, config) {
262
271
  questionSlug: step.slug,
263
272
  question: step.question[ctx.language],
264
273
  questionType: step.type,
265
- options
274
+ options,
275
+ allowFreeText: resolvedAllowFreeText,
276
+ ...pendingParameterUpdates.length > 0 && {
277
+ parameterUpdates: pendingParameterUpdates
278
+ }
266
279
  };
267
280
  }
268
281
  const dataInvestigationResult = await flow.finalize(state, runtime);
269
- return { type: "fulfilled", dataInvestigationResult };
282
+ return {
283
+ type: "fulfilled",
284
+ dataInvestigationResult,
285
+ ...pendingParameterUpdates.length > 0 && {
286
+ parameterUpdates: pendingParameterUpdates
287
+ }
288
+ };
270
289
  }
271
290
  async function resolveSetupSelection(params) {
272
291
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -347,19 +347,28 @@ async function runSetupFlow(flow, params, ctx, config) {
347
347
  };
348
348
  let state = flow.initialState();
349
349
  let answerIdx = 0;
350
+ const pendingParameterUpdates = [];
350
351
  for (const step of flow.steps) {
351
352
  const ans = ctx.answers[answerIdx];
352
353
  if (ans && ans.questionSlug === step.slug) {
353
354
  state = step.applyAnswer(state, ans.answer);
355
+ if (step.toParameterUpdates) {
356
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
357
+ }
354
358
  answerIdx += 1;
355
359
  continue;
356
360
  }
361
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
357
362
  if (step.type === "text") {
358
363
  return {
359
364
  type: "nextQuestion",
360
365
  questionSlug: step.slug,
361
366
  question: step.question[ctx.language],
362
- questionType: "text"
367
+ questionType: "text",
368
+ allowFreeText: resolvedAllowFreeText,
369
+ ...pendingParameterUpdates.length > 0 && {
370
+ parameterUpdates: pendingParameterUpdates
371
+ }
363
372
  };
364
373
  }
365
374
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -371,11 +380,21 @@ async function runSetupFlow(flow, params, ctx, config) {
371
380
  questionSlug: step.slug,
372
381
  question: step.question[ctx.language],
373
382
  questionType: step.type,
374
- options
383
+ options,
384
+ allowFreeText: resolvedAllowFreeText,
385
+ ...pendingParameterUpdates.length > 0 && {
386
+ parameterUpdates: pendingParameterUpdates
387
+ }
375
388
  };
376
389
  }
377
390
  const dataInvestigationResult = await flow.finalize(state, runtime);
378
- return { type: "fulfilled", dataInvestigationResult };
391
+ return {
392
+ type: "fulfilled",
393
+ dataInvestigationResult,
394
+ ...pendingParameterUpdates.length > 0 && {
395
+ parameterUpdates: pendingParameterUpdates
396
+ }
397
+ };
379
398
  }
380
399
  async function resolveSetupSelection(params) {
381
400
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -180,19 +180,28 @@ async function runSetupFlow(flow, params, ctx, config) {
180
180
  };
181
181
  let state = flow.initialState();
182
182
  let answerIdx = 0;
183
+ const pendingParameterUpdates = [];
183
184
  for (const step of flow.steps) {
184
185
  const ans = ctx.answers[answerIdx];
185
186
  if (ans && ans.questionSlug === step.slug) {
186
187
  state = step.applyAnswer(state, ans.answer);
188
+ if (step.toParameterUpdates) {
189
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
190
+ }
187
191
  answerIdx += 1;
188
192
  continue;
189
193
  }
194
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
190
195
  if (step.type === "text") {
191
196
  return {
192
197
  type: "nextQuestion",
193
198
  questionSlug: step.slug,
194
199
  question: step.question[ctx.language],
195
- questionType: "text"
200
+ questionType: "text",
201
+ allowFreeText: resolvedAllowFreeText,
202
+ ...pendingParameterUpdates.length > 0 && {
203
+ parameterUpdates: pendingParameterUpdates
204
+ }
196
205
  };
197
206
  }
198
207
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -204,11 +213,21 @@ async function runSetupFlow(flow, params, ctx, config) {
204
213
  questionSlug: step.slug,
205
214
  question: step.question[ctx.language],
206
215
  questionType: step.type,
207
- options
216
+ options,
217
+ allowFreeText: resolvedAllowFreeText,
218
+ ...pendingParameterUpdates.length > 0 && {
219
+ parameterUpdates: pendingParameterUpdates
220
+ }
208
221
  };
209
222
  }
210
223
  const dataInvestigationResult = await flow.finalize(state, runtime);
211
- return { type: "fulfilled", dataInvestigationResult };
224
+ return {
225
+ type: "fulfilled",
226
+ dataInvestigationResult,
227
+ ...pendingParameterUpdates.length > 0 && {
228
+ parameterUpdates: pendingParameterUpdates
229
+ }
230
+ };
212
231
  }
213
232
  async function resolveSetupSelection(params) {
214
233
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -321,19 +321,28 @@ async function runSetupFlow(flow, params, ctx, config) {
321
321
  };
322
322
  let state = flow.initialState();
323
323
  let answerIdx = 0;
324
+ const pendingParameterUpdates = [];
324
325
  for (const step of flow.steps) {
325
326
  const ans = ctx.answers[answerIdx];
326
327
  if (ans && ans.questionSlug === step.slug) {
327
328
  state = step.applyAnswer(state, ans.answer);
329
+ if (step.toParameterUpdates) {
330
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
331
+ }
328
332
  answerIdx += 1;
329
333
  continue;
330
334
  }
335
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
331
336
  if (step.type === "text") {
332
337
  return {
333
338
  type: "nextQuestion",
334
339
  questionSlug: step.slug,
335
340
  question: step.question[ctx.language],
336
- questionType: "text"
341
+ questionType: "text",
342
+ allowFreeText: resolvedAllowFreeText,
343
+ ...pendingParameterUpdates.length > 0 && {
344
+ parameterUpdates: pendingParameterUpdates
345
+ }
337
346
  };
338
347
  }
339
348
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -345,11 +354,21 @@ async function runSetupFlow(flow, params, ctx, config) {
345
354
  questionSlug: step.slug,
346
355
  question: step.question[ctx.language],
347
356
  questionType: step.type,
348
- options
357
+ options,
358
+ allowFreeText: resolvedAllowFreeText,
359
+ ...pendingParameterUpdates.length > 0 && {
360
+ parameterUpdates: pendingParameterUpdates
361
+ }
349
362
  };
350
363
  }
351
364
  const dataInvestigationResult = await flow.finalize(state, runtime);
352
- return { type: "fulfilled", dataInvestigationResult };
365
+ return {
366
+ type: "fulfilled",
367
+ dataInvestigationResult,
368
+ ...pendingParameterUpdates.length > 0 && {
369
+ parameterUpdates: pendingParameterUpdates
370
+ }
371
+ };
353
372
  }
354
373
  async function resolveSetupSelection(params) {
355
374
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -380,19 +380,28 @@ async function runSetupFlow(flow, params, ctx, config) {
380
380
  };
381
381
  let state = flow.initialState();
382
382
  let answerIdx = 0;
383
+ const pendingParameterUpdates = [];
383
384
  for (const step of flow.steps) {
384
385
  const ans = ctx.answers[answerIdx];
385
386
  if (ans && ans.questionSlug === step.slug) {
386
387
  state = step.applyAnswer(state, ans.answer);
388
+ if (step.toParameterUpdates) {
389
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
390
+ }
387
391
  answerIdx += 1;
388
392
  continue;
389
393
  }
394
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
390
395
  if (step.type === "text") {
391
396
  return {
392
397
  type: "nextQuestion",
393
398
  questionSlug: step.slug,
394
399
  question: step.question[ctx.language],
395
- questionType: "text"
400
+ questionType: "text",
401
+ allowFreeText: resolvedAllowFreeText,
402
+ ...pendingParameterUpdates.length > 0 && {
403
+ parameterUpdates: pendingParameterUpdates
404
+ }
396
405
  };
397
406
  }
398
407
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -404,11 +413,21 @@ async function runSetupFlow(flow, params, ctx, config) {
404
413
  questionSlug: step.slug,
405
414
  question: step.question[ctx.language],
406
415
  questionType: step.type,
407
- options
416
+ options,
417
+ allowFreeText: resolvedAllowFreeText,
418
+ ...pendingParameterUpdates.length > 0 && {
419
+ parameterUpdates: pendingParameterUpdates
420
+ }
408
421
  };
409
422
  }
410
423
  const dataInvestigationResult = await flow.finalize(state, runtime);
411
- return { type: "fulfilled", dataInvestigationResult };
424
+ return {
425
+ type: "fulfilled",
426
+ dataInvestigationResult,
427
+ ...pendingParameterUpdates.length > 0 && {
428
+ parameterUpdates: pendingParameterUpdates
429
+ }
430
+ };
412
431
  }
413
432
  async function resolveSetupSelection(params) {
414
433
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -180,19 +180,28 @@ async function runSetupFlow(flow, params, ctx, config) {
180
180
  };
181
181
  let state = flow.initialState();
182
182
  let answerIdx = 0;
183
+ const pendingParameterUpdates = [];
183
184
  for (const step of flow.steps) {
184
185
  const ans = ctx.answers[answerIdx];
185
186
  if (ans && ans.questionSlug === step.slug) {
186
187
  state = step.applyAnswer(state, ans.answer);
188
+ if (step.toParameterUpdates) {
189
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
190
+ }
187
191
  answerIdx += 1;
188
192
  continue;
189
193
  }
194
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
190
195
  if (step.type === "text") {
191
196
  return {
192
197
  type: "nextQuestion",
193
198
  questionSlug: step.slug,
194
199
  question: step.question[ctx.language],
195
- questionType: "text"
200
+ questionType: "text",
201
+ allowFreeText: resolvedAllowFreeText,
202
+ ...pendingParameterUpdates.length > 0 && {
203
+ parameterUpdates: pendingParameterUpdates
204
+ }
196
205
  };
197
206
  }
198
207
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -204,11 +213,21 @@ async function runSetupFlow(flow, params, ctx, config) {
204
213
  questionSlug: step.slug,
205
214
  question: step.question[ctx.language],
206
215
  questionType: step.type,
207
- options
216
+ options,
217
+ allowFreeText: resolvedAllowFreeText,
218
+ ...pendingParameterUpdates.length > 0 && {
219
+ parameterUpdates: pendingParameterUpdates
220
+ }
208
221
  };
209
222
  }
210
223
  const dataInvestigationResult = await flow.finalize(state, runtime);
211
- return { type: "fulfilled", dataInvestigationResult };
224
+ return {
225
+ type: "fulfilled",
226
+ dataInvestigationResult,
227
+ ...pendingParameterUpdates.length > 0 && {
228
+ parameterUpdates: pendingParameterUpdates
229
+ }
230
+ };
212
231
  }
213
232
  async function resolveSetupSelection(params) {
214
233
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -339,19 +339,28 @@ async function runSetupFlow(flow, params, ctx, config) {
339
339
  };
340
340
  let state = flow.initialState();
341
341
  let answerIdx = 0;
342
+ const pendingParameterUpdates = [];
342
343
  for (const step of flow.steps) {
343
344
  const ans = ctx.answers[answerIdx];
344
345
  if (ans && ans.questionSlug === step.slug) {
345
346
  state = step.applyAnswer(state, ans.answer);
347
+ if (step.toParameterUpdates) {
348
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
349
+ }
346
350
  answerIdx += 1;
347
351
  continue;
348
352
  }
353
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
349
354
  if (step.type === "text") {
350
355
  return {
351
356
  type: "nextQuestion",
352
357
  questionSlug: step.slug,
353
358
  question: step.question[ctx.language],
354
- questionType: "text"
359
+ questionType: "text",
360
+ allowFreeText: resolvedAllowFreeText,
361
+ ...pendingParameterUpdates.length > 0 && {
362
+ parameterUpdates: pendingParameterUpdates
363
+ }
355
364
  };
356
365
  }
357
366
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -363,11 +372,21 @@ async function runSetupFlow(flow, params, ctx, config) {
363
372
  questionSlug: step.slug,
364
373
  question: step.question[ctx.language],
365
374
  questionType: step.type,
366
- options
375
+ options,
376
+ allowFreeText: resolvedAllowFreeText,
377
+ ...pendingParameterUpdates.length > 0 && {
378
+ parameterUpdates: pendingParameterUpdates
379
+ }
367
380
  };
368
381
  }
369
382
  const dataInvestigationResult = await flow.finalize(state, runtime);
370
- return { type: "fulfilled", dataInvestigationResult };
383
+ return {
384
+ type: "fulfilled",
385
+ dataInvestigationResult,
386
+ ...pendingParameterUpdates.length > 0 && {
387
+ parameterUpdates: pendingParameterUpdates
388
+ }
389
+ };
371
390
  }
372
391
  async function resolveSetupSelection(params) {
373
392
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -1087,19 +1087,28 @@ async function runSetupFlow(flow, params, ctx, config) {
1087
1087
  };
1088
1088
  let state = flow.initialState();
1089
1089
  let answerIdx = 0;
1090
+ const pendingParameterUpdates = [];
1090
1091
  for (const step of flow.steps) {
1091
1092
  const ans = ctx.answers[answerIdx];
1092
1093
  if (ans && ans.questionSlug === step.slug) {
1093
1094
  state = step.applyAnswer(state, ans.answer);
1095
+ if (step.toParameterUpdates) {
1096
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
1097
+ }
1094
1098
  answerIdx += 1;
1095
1099
  continue;
1096
1100
  }
1101
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
1097
1102
  if (step.type === "text") {
1098
1103
  return {
1099
1104
  type: "nextQuestion",
1100
1105
  questionSlug: step.slug,
1101
1106
  question: step.question[ctx.language],
1102
- questionType: "text"
1107
+ questionType: "text",
1108
+ allowFreeText: resolvedAllowFreeText,
1109
+ ...pendingParameterUpdates.length > 0 && {
1110
+ parameterUpdates: pendingParameterUpdates
1111
+ }
1103
1112
  };
1104
1113
  }
1105
1114
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -1111,11 +1120,21 @@ async function runSetupFlow(flow, params, ctx, config) {
1111
1120
  questionSlug: step.slug,
1112
1121
  question: step.question[ctx.language],
1113
1122
  questionType: step.type,
1114
- options
1123
+ options,
1124
+ allowFreeText: resolvedAllowFreeText,
1125
+ ...pendingParameterUpdates.length > 0 && {
1126
+ parameterUpdates: pendingParameterUpdates
1127
+ }
1115
1128
  };
1116
1129
  }
1117
1130
  const dataInvestigationResult = await flow.finalize(state, runtime);
1118
- return { type: "fulfilled", dataInvestigationResult };
1131
+ return {
1132
+ type: "fulfilled",
1133
+ dataInvestigationResult,
1134
+ ...pendingParameterUpdates.length > 0 && {
1135
+ parameterUpdates: pendingParameterUpdates
1136
+ }
1137
+ };
1119
1138
  }
1120
1139
  async function resolveSetupSelection(params) {
1121
1140
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -288,19 +288,28 @@ async function runSetupFlow(flow, params, ctx, config) {
288
288
  };
289
289
  let state = flow.initialState();
290
290
  let answerIdx = 0;
291
+ const pendingParameterUpdates = [];
291
292
  for (const step of flow.steps) {
292
293
  const ans = ctx.answers[answerIdx];
293
294
  if (ans && ans.questionSlug === step.slug) {
294
295
  state = step.applyAnswer(state, ans.answer);
296
+ if (step.toParameterUpdates) {
297
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
298
+ }
295
299
  answerIdx += 1;
296
300
  continue;
297
301
  }
302
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
298
303
  if (step.type === "text") {
299
304
  return {
300
305
  type: "nextQuestion",
301
306
  questionSlug: step.slug,
302
307
  question: step.question[ctx.language],
303
- questionType: "text"
308
+ questionType: "text",
309
+ allowFreeText: resolvedAllowFreeText,
310
+ ...pendingParameterUpdates.length > 0 && {
311
+ parameterUpdates: pendingParameterUpdates
312
+ }
304
313
  };
305
314
  }
306
315
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -312,11 +321,21 @@ async function runSetupFlow(flow, params, ctx, config) {
312
321
  questionSlug: step.slug,
313
322
  question: step.question[ctx.language],
314
323
  questionType: step.type,
315
- options
324
+ options,
325
+ allowFreeText: resolvedAllowFreeText,
326
+ ...pendingParameterUpdates.length > 0 && {
327
+ parameterUpdates: pendingParameterUpdates
328
+ }
316
329
  };
317
330
  }
318
331
  const dataInvestigationResult = await flow.finalize(state, runtime);
319
- return { type: "fulfilled", dataInvestigationResult };
332
+ return {
333
+ type: "fulfilled",
334
+ dataInvestigationResult,
335
+ ...pendingParameterUpdates.length > 0 && {
336
+ parameterUpdates: pendingParameterUpdates
337
+ }
338
+ };
320
339
  }
321
340
  async function resolveSetupSelection(params) {
322
341
  const { selected, allSentinel, fetchAll, limit } = params;
@@ -317,19 +317,28 @@ async function runSetupFlow(flow, params, ctx, config) {
317
317
  };
318
318
  let state = flow.initialState();
319
319
  let answerIdx = 0;
320
+ const pendingParameterUpdates = [];
320
321
  for (const step of flow.steps) {
321
322
  const ans = ctx.answers[answerIdx];
322
323
  if (ans && ans.questionSlug === step.slug) {
323
324
  state = step.applyAnswer(state, ans.answer);
325
+ if (step.toParameterUpdates) {
326
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
327
+ }
324
328
  answerIdx += 1;
325
329
  continue;
326
330
  }
331
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
327
332
  if (step.type === "text") {
328
333
  return {
329
334
  type: "nextQuestion",
330
335
  questionSlug: step.slug,
331
336
  question: step.question[ctx.language],
332
- questionType: "text"
337
+ questionType: "text",
338
+ allowFreeText: resolvedAllowFreeText,
339
+ ...pendingParameterUpdates.length > 0 && {
340
+ parameterUpdates: pendingParameterUpdates
341
+ }
333
342
  };
334
343
  }
335
344
  const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
@@ -341,11 +350,21 @@ async function runSetupFlow(flow, params, ctx, config) {
341
350
  questionSlug: step.slug,
342
351
  question: step.question[ctx.language],
343
352
  questionType: step.type,
344
- options
353
+ options,
354
+ allowFreeText: resolvedAllowFreeText,
355
+ ...pendingParameterUpdates.length > 0 && {
356
+ parameterUpdates: pendingParameterUpdates
357
+ }
345
358
  };
346
359
  }
347
360
  const dataInvestigationResult = await flow.finalize(state, runtime);
348
- return { type: "fulfilled", dataInvestigationResult };
361
+ return {
362
+ type: "fulfilled",
363
+ dataInvestigationResult,
364
+ ...pendingParameterUpdates.length > 0 && {
365
+ parameterUpdates: pendingParameterUpdates
366
+ }
367
+ };
349
368
  }
350
369
 
351
370
  // ../connectors/src/auth-types.ts