@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.
- package/dist/cli/index.js +1682 -425
- package/dist/connectors/airtable-oauth.js +22 -3
- package/dist/connectors/airtable.js +22 -3
- package/dist/connectors/amplitude.js +22 -3
- package/dist/connectors/asana.js +22 -3
- package/dist/connectors/attio.js +22 -3
- package/dist/connectors/aws-billing.js +22 -3
- package/dist/connectors/azure-sql.js +25 -6
- package/dist/connectors/backlog-api-key.js +22 -3
- package/dist/connectors/clickup.js +22 -3
- package/dist/connectors/cosmosdb.js +22 -3
- package/dist/connectors/customerio.js +23 -4
- package/dist/connectors/dbt.js +22 -3
- package/dist/connectors/freshdesk.js +22 -3
- package/dist/connectors/freshsales.js +22 -3
- package/dist/connectors/freshservice.js +22 -3
- package/dist/connectors/gamma.js +24 -5
- package/dist/connectors/github.js +22 -3
- package/dist/connectors/gmail-oauth.js +22 -3
- package/dist/connectors/gmail.js +22 -3
- package/dist/connectors/google-ads.js +22 -3
- package/dist/connectors/google-analytics-oauth.js +22 -3
- package/dist/connectors/google-analytics.js +222 -68
- package/dist/connectors/google-audit-log.js +22 -3
- package/dist/connectors/google-calendar-oauth.js +22 -3
- package/dist/connectors/google-calendar.js +22 -3
- package/dist/connectors/google-docs.js +22 -3
- package/dist/connectors/google-drive.js +22 -3
- package/dist/connectors/google-search-console-oauth.js +22 -3
- package/dist/connectors/google-sheets.js +22 -3
- package/dist/connectors/google-slides.js +22 -3
- package/dist/connectors/grafana.js +22 -3
- package/dist/connectors/hubspot-oauth.js +22 -3
- package/dist/connectors/hubspot.js +22 -3
- package/dist/connectors/influxdb.js +22 -3
- package/dist/connectors/intercom-oauth.js +22 -3
- package/dist/connectors/intercom.js +22 -3
- package/dist/connectors/jdbc.js +22 -3
- package/dist/connectors/jira-api-key.js +22 -3
- package/dist/connectors/kintone-api-token.js +22 -3
- package/dist/connectors/kintone.js +22 -3
- package/dist/connectors/linear.js +22 -3
- package/dist/connectors/linkedin-ads.js +22 -3
- package/dist/connectors/mailchimp-oauth.js +22 -3
- package/dist/connectors/mailchimp.js +22 -3
- package/dist/connectors/meta-ads-oauth.js +22 -3
- package/dist/connectors/meta-ads.js +22 -3
- package/dist/connectors/mixpanel.js +22 -3
- package/dist/connectors/monday.js +22 -3
- package/dist/connectors/mongodb.js +22 -3
- package/dist/connectors/notion-oauth.js +22 -3
- package/dist/connectors/notion.js +22 -3
- package/dist/connectors/oracle.js +48 -14
- package/dist/connectors/outlook-oauth.js +22 -3
- package/dist/connectors/powerbi-oauth.js +303 -37
- package/dist/connectors/salesforce.js +22 -3
- package/dist/connectors/semrush.js +360 -46
- package/dist/connectors/sentry.js +22 -3
- package/dist/connectors/shopify-oauth.js +22 -3
- package/dist/connectors/shopify.js +22 -3
- package/dist/connectors/sqlserver.js +25 -6
- package/dist/connectors/stripe-api-key.js +22 -3
- package/dist/connectors/stripe-oauth.js +22 -3
- package/dist/connectors/supabase.js +25 -6
- package/dist/connectors/tableau.js +240 -78
- package/dist/connectors/tiktok-ads.js +22 -3
- package/dist/connectors/wix-store.js +22 -3
- package/dist/connectors/zendesk-oauth.js +22 -3
- package/dist/connectors/zendesk.js +22 -3
- package/dist/index.js +1682 -425
- package/dist/main.js +1682 -425
- package/dist/vite-plugin.js +1682 -425
- package/package.json +1 -1
|
@@ -409,19 +409,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
409
409
|
};
|
|
410
410
|
let state = flow.initialState();
|
|
411
411
|
let answerIdx = 0;
|
|
412
|
+
const pendingParameterUpdates = [];
|
|
412
413
|
for (const step of flow.steps) {
|
|
413
414
|
const ans = ctx.answers[answerIdx];
|
|
414
415
|
if (ans && ans.questionSlug === step.slug) {
|
|
415
416
|
state = step.applyAnswer(state, ans.answer);
|
|
417
|
+
if (step.toParameterUpdates) {
|
|
418
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
419
|
+
}
|
|
416
420
|
answerIdx += 1;
|
|
417
421
|
continue;
|
|
418
422
|
}
|
|
423
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
419
424
|
if (step.type === "text") {
|
|
420
425
|
return {
|
|
421
426
|
type: "nextQuestion",
|
|
422
427
|
questionSlug: step.slug,
|
|
423
428
|
question: step.question[ctx.language],
|
|
424
|
-
questionType: "text"
|
|
429
|
+
questionType: "text",
|
|
430
|
+
allowFreeText: resolvedAllowFreeText,
|
|
431
|
+
...pendingParameterUpdates.length > 0 && {
|
|
432
|
+
parameterUpdates: pendingParameterUpdates
|
|
433
|
+
}
|
|
425
434
|
};
|
|
426
435
|
}
|
|
427
436
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -433,11 +442,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
433
442
|
questionSlug: step.slug,
|
|
434
443
|
question: step.question[ctx.language],
|
|
435
444
|
questionType: step.type,
|
|
436
|
-
options
|
|
445
|
+
options,
|
|
446
|
+
allowFreeText: resolvedAllowFreeText,
|
|
447
|
+
...pendingParameterUpdates.length > 0 && {
|
|
448
|
+
parameterUpdates: pendingParameterUpdates
|
|
449
|
+
}
|
|
437
450
|
};
|
|
438
451
|
}
|
|
439
452
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
440
|
-
return {
|
|
453
|
+
return {
|
|
454
|
+
type: "fulfilled",
|
|
455
|
+
dataInvestigationResult,
|
|
456
|
+
...pendingParameterUpdates.length > 0 && {
|
|
457
|
+
parameterUpdates: pendingParameterUpdates
|
|
458
|
+
}
|
|
459
|
+
};
|
|
441
460
|
}
|
|
442
461
|
async function resolveSetupSelection(params) {
|
|
443
462
|
const { selected, allSentinel, fetchAll, limit } = params;
|
|
@@ -424,19 +424,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
424
424
|
};
|
|
425
425
|
let state = flow.initialState();
|
|
426
426
|
let answerIdx = 0;
|
|
427
|
+
const pendingParameterUpdates = [];
|
|
427
428
|
for (const step of flow.steps) {
|
|
428
429
|
const ans = ctx.answers[answerIdx];
|
|
429
430
|
if (ans && ans.questionSlug === step.slug) {
|
|
430
431
|
state = step.applyAnswer(state, ans.answer);
|
|
432
|
+
if (step.toParameterUpdates) {
|
|
433
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
434
|
+
}
|
|
431
435
|
answerIdx += 1;
|
|
432
436
|
continue;
|
|
433
437
|
}
|
|
438
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
434
439
|
if (step.type === "text") {
|
|
435
440
|
return {
|
|
436
441
|
type: "nextQuestion",
|
|
437
442
|
questionSlug: step.slug,
|
|
438
443
|
question: step.question[ctx.language],
|
|
439
|
-
questionType: "text"
|
|
444
|
+
questionType: "text",
|
|
445
|
+
allowFreeText: resolvedAllowFreeText,
|
|
446
|
+
...pendingParameterUpdates.length > 0 && {
|
|
447
|
+
parameterUpdates: pendingParameterUpdates
|
|
448
|
+
}
|
|
440
449
|
};
|
|
441
450
|
}
|
|
442
451
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -448,11 +457,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
448
457
|
questionSlug: step.slug,
|
|
449
458
|
question: step.question[ctx.language],
|
|
450
459
|
questionType: step.type,
|
|
451
|
-
options
|
|
460
|
+
options,
|
|
461
|
+
allowFreeText: resolvedAllowFreeText,
|
|
462
|
+
...pendingParameterUpdates.length > 0 && {
|
|
463
|
+
parameterUpdates: pendingParameterUpdates
|
|
464
|
+
}
|
|
452
465
|
};
|
|
453
466
|
}
|
|
454
467
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
455
|
-
return {
|
|
468
|
+
return {
|
|
469
|
+
type: "fulfilled",
|
|
470
|
+
dataInvestigationResult,
|
|
471
|
+
...pendingParameterUpdates.length > 0 && {
|
|
472
|
+
parameterUpdates: pendingParameterUpdates
|
|
473
|
+
}
|
|
474
|
+
};
|
|
456
475
|
}
|
|
457
476
|
async function resolveSetupSelection(params) {
|
|
458
477
|
const { selected, allSentinel, fetchAll, limit } = params;
|
|
@@ -379,19 +379,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
379
379
|
};
|
|
380
380
|
let state = flow.initialState();
|
|
381
381
|
let answerIdx = 0;
|
|
382
|
+
const pendingParameterUpdates = [];
|
|
382
383
|
for (const step of flow.steps) {
|
|
383
384
|
const ans = ctx.answers[answerIdx];
|
|
384
385
|
if (ans && ans.questionSlug === step.slug) {
|
|
385
386
|
state = step.applyAnswer(state, ans.answer);
|
|
387
|
+
if (step.toParameterUpdates) {
|
|
388
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
389
|
+
}
|
|
386
390
|
answerIdx += 1;
|
|
387
391
|
continue;
|
|
388
392
|
}
|
|
393
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
389
394
|
if (step.type === "text") {
|
|
390
395
|
return {
|
|
391
396
|
type: "nextQuestion",
|
|
392
397
|
questionSlug: step.slug,
|
|
393
398
|
question: step.question[ctx.language],
|
|
394
|
-
questionType: "text"
|
|
399
|
+
questionType: "text",
|
|
400
|
+
allowFreeText: resolvedAllowFreeText,
|
|
401
|
+
...pendingParameterUpdates.length > 0 && {
|
|
402
|
+
parameterUpdates: pendingParameterUpdates
|
|
403
|
+
}
|
|
395
404
|
};
|
|
396
405
|
}
|
|
397
406
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -403,11 +412,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
403
412
|
questionSlug: step.slug,
|
|
404
413
|
question: step.question[ctx.language],
|
|
405
414
|
questionType: step.type,
|
|
406
|
-
options
|
|
415
|
+
options,
|
|
416
|
+
allowFreeText: resolvedAllowFreeText,
|
|
417
|
+
...pendingParameterUpdates.length > 0 && {
|
|
418
|
+
parameterUpdates: pendingParameterUpdates
|
|
419
|
+
}
|
|
407
420
|
};
|
|
408
421
|
}
|
|
409
422
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
410
|
-
return {
|
|
423
|
+
return {
|
|
424
|
+
type: "fulfilled",
|
|
425
|
+
dataInvestigationResult,
|
|
426
|
+
...pendingParameterUpdates.length > 0 && {
|
|
427
|
+
parameterUpdates: pendingParameterUpdates
|
|
428
|
+
}
|
|
429
|
+
};
|
|
411
430
|
}
|
|
412
431
|
async function resolveSetupSelection(params) {
|
|
413
432
|
const { selected, allSentinel, fetchAll, limit } = params;
|
package/dist/connectors/gamma.js
CHANGED
|
@@ -335,19 +335,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
335
335
|
};
|
|
336
336
|
let state = flow.initialState();
|
|
337
337
|
let answerIdx = 0;
|
|
338
|
+
const pendingParameterUpdates = [];
|
|
338
339
|
for (const step of flow.steps) {
|
|
339
340
|
const ans = ctx.answers[answerIdx];
|
|
340
341
|
if (ans && ans.questionSlug === step.slug) {
|
|
341
342
|
state = step.applyAnswer(state, ans.answer);
|
|
343
|
+
if (step.toParameterUpdates) {
|
|
344
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
345
|
+
}
|
|
342
346
|
answerIdx += 1;
|
|
343
347
|
continue;
|
|
344
348
|
}
|
|
349
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
345
350
|
if (step.type === "text") {
|
|
346
351
|
return {
|
|
347
352
|
type: "nextQuestion",
|
|
348
353
|
questionSlug: step.slug,
|
|
349
354
|
question: step.question[ctx.language],
|
|
350
|
-
questionType: "text"
|
|
355
|
+
questionType: "text",
|
|
356
|
+
allowFreeText: resolvedAllowFreeText,
|
|
357
|
+
...pendingParameterUpdates.length > 0 && {
|
|
358
|
+
parameterUpdates: pendingParameterUpdates
|
|
359
|
+
}
|
|
351
360
|
};
|
|
352
361
|
}
|
|
353
362
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -359,11 +368,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
359
368
|
questionSlug: step.slug,
|
|
360
369
|
question: step.question[ctx.language],
|
|
361
370
|
questionType: step.type,
|
|
362
|
-
options
|
|
371
|
+
options,
|
|
372
|
+
allowFreeText: resolvedAllowFreeText,
|
|
373
|
+
...pendingParameterUpdates.length > 0 && {
|
|
374
|
+
parameterUpdates: pendingParameterUpdates
|
|
375
|
+
}
|
|
363
376
|
};
|
|
364
377
|
}
|
|
365
378
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
366
|
-
return {
|
|
379
|
+
return {
|
|
380
|
+
type: "fulfilled",
|
|
381
|
+
dataInvestigationResult,
|
|
382
|
+
...pendingParameterUpdates.length > 0 && {
|
|
383
|
+
parameterUpdates: pendingParameterUpdates
|
|
384
|
+
}
|
|
385
|
+
};
|
|
367
386
|
}
|
|
368
387
|
async function resolveSetupSelection(params) {
|
|
369
388
|
const { selected, allSentinel, fetchAll, limit } = params;
|
|
@@ -410,7 +429,7 @@ function apiFetch(params, path2, init) {
|
|
|
410
429
|
// ../connectors/src/connectors/gamma/setup-flow.ts
|
|
411
430
|
var ALL_FOLDERS = "__ALL_FOLDERS__";
|
|
412
431
|
var GAMMA_SETUP_MAX_FOLDERS = 20;
|
|
413
|
-
var FOLDERS_PAGE_LIMIT =
|
|
432
|
+
var FOLDERS_PAGE_LIMIT = 50;
|
|
414
433
|
async function listAllFolders(params) {
|
|
415
434
|
const results = [];
|
|
416
435
|
let after;
|
|
@@ -431,7 +450,7 @@ async function listAllFolders(params) {
|
|
|
431
450
|
return results;
|
|
432
451
|
}
|
|
433
452
|
async function listThemes(params) {
|
|
434
|
-
const res = await apiFetch(params, "/themes?limit=
|
|
453
|
+
const res = await apiFetch(params, "/themes?limit=50");
|
|
435
454
|
if (!res.ok) {
|
|
436
455
|
return [];
|
|
437
456
|
}
|
|
@@ -468,19 +468,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
468
468
|
};
|
|
469
469
|
let state = flow.initialState();
|
|
470
470
|
let answerIdx = 0;
|
|
471
|
+
const pendingParameterUpdates = [];
|
|
471
472
|
for (const step of flow.steps) {
|
|
472
473
|
const ans = ctx.answers[answerIdx];
|
|
473
474
|
if (ans && ans.questionSlug === step.slug) {
|
|
474
475
|
state = step.applyAnswer(state, ans.answer);
|
|
476
|
+
if (step.toParameterUpdates) {
|
|
477
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
478
|
+
}
|
|
475
479
|
answerIdx += 1;
|
|
476
480
|
continue;
|
|
477
481
|
}
|
|
482
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
478
483
|
if (step.type === "text") {
|
|
479
484
|
return {
|
|
480
485
|
type: "nextQuestion",
|
|
481
486
|
questionSlug: step.slug,
|
|
482
487
|
question: step.question[ctx.language],
|
|
483
|
-
questionType: "text"
|
|
488
|
+
questionType: "text",
|
|
489
|
+
allowFreeText: resolvedAllowFreeText,
|
|
490
|
+
...pendingParameterUpdates.length > 0 && {
|
|
491
|
+
parameterUpdates: pendingParameterUpdates
|
|
492
|
+
}
|
|
484
493
|
};
|
|
485
494
|
}
|
|
486
495
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -492,11 +501,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
492
501
|
questionSlug: step.slug,
|
|
493
502
|
question: step.question[ctx.language],
|
|
494
503
|
questionType: step.type,
|
|
495
|
-
options
|
|
504
|
+
options,
|
|
505
|
+
allowFreeText: resolvedAllowFreeText,
|
|
506
|
+
...pendingParameterUpdates.length > 0 && {
|
|
507
|
+
parameterUpdates: pendingParameterUpdates
|
|
508
|
+
}
|
|
496
509
|
};
|
|
497
510
|
}
|
|
498
511
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
499
|
-
return {
|
|
512
|
+
return {
|
|
513
|
+
type: "fulfilled",
|
|
514
|
+
dataInvestigationResult,
|
|
515
|
+
...pendingParameterUpdates.length > 0 && {
|
|
516
|
+
parameterUpdates: pendingParameterUpdates
|
|
517
|
+
}
|
|
518
|
+
};
|
|
500
519
|
}
|
|
501
520
|
async function resolveSetupSelection(params) {
|
|
502
521
|
const { selected, allSentinel, fetchAll, limit } = params;
|
|
@@ -278,19 +278,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
278
278
|
};
|
|
279
279
|
let state = flow.initialState();
|
|
280
280
|
let answerIdx = 0;
|
|
281
|
+
const pendingParameterUpdates = [];
|
|
281
282
|
for (const step of flow.steps) {
|
|
282
283
|
const ans = ctx.answers[answerIdx];
|
|
283
284
|
if (ans && ans.questionSlug === step.slug) {
|
|
284
285
|
state = step.applyAnswer(state, ans.answer);
|
|
286
|
+
if (step.toParameterUpdates) {
|
|
287
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
288
|
+
}
|
|
285
289
|
answerIdx += 1;
|
|
286
290
|
continue;
|
|
287
291
|
}
|
|
292
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
288
293
|
if (step.type === "text") {
|
|
289
294
|
return {
|
|
290
295
|
type: "nextQuestion",
|
|
291
296
|
questionSlug: step.slug,
|
|
292
297
|
question: step.question[ctx.language],
|
|
293
|
-
questionType: "text"
|
|
298
|
+
questionType: "text",
|
|
299
|
+
allowFreeText: resolvedAllowFreeText,
|
|
300
|
+
...pendingParameterUpdates.length > 0 && {
|
|
301
|
+
parameterUpdates: pendingParameterUpdates
|
|
302
|
+
}
|
|
294
303
|
};
|
|
295
304
|
}
|
|
296
305
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -302,11 +311,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
302
311
|
questionSlug: step.slug,
|
|
303
312
|
question: step.question[ctx.language],
|
|
304
313
|
questionType: step.type,
|
|
305
|
-
options
|
|
314
|
+
options,
|
|
315
|
+
allowFreeText: resolvedAllowFreeText,
|
|
316
|
+
...pendingParameterUpdates.length > 0 && {
|
|
317
|
+
parameterUpdates: pendingParameterUpdates
|
|
318
|
+
}
|
|
306
319
|
};
|
|
307
320
|
}
|
|
308
321
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
309
|
-
return {
|
|
322
|
+
return {
|
|
323
|
+
type: "fulfilled",
|
|
324
|
+
dataInvestigationResult,
|
|
325
|
+
...pendingParameterUpdates.length > 0 && {
|
|
326
|
+
parameterUpdates: pendingParameterUpdates
|
|
327
|
+
}
|
|
328
|
+
};
|
|
310
329
|
}
|
|
311
330
|
async function resolveSetupSelection(params) {
|
|
312
331
|
const { selected, allSentinel, fetchAll, limit } = params;
|
package/dist/connectors/gmail.js
CHANGED
|
@@ -290,19 +290,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
290
290
|
};
|
|
291
291
|
let state = flow.initialState();
|
|
292
292
|
let answerIdx = 0;
|
|
293
|
+
const pendingParameterUpdates = [];
|
|
293
294
|
for (const step of flow.steps) {
|
|
294
295
|
const ans = ctx.answers[answerIdx];
|
|
295
296
|
if (ans && ans.questionSlug === step.slug) {
|
|
296
297
|
state = step.applyAnswer(state, ans.answer);
|
|
298
|
+
if (step.toParameterUpdates) {
|
|
299
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
300
|
+
}
|
|
297
301
|
answerIdx += 1;
|
|
298
302
|
continue;
|
|
299
303
|
}
|
|
304
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
300
305
|
if (step.type === "text") {
|
|
301
306
|
return {
|
|
302
307
|
type: "nextQuestion",
|
|
303
308
|
questionSlug: step.slug,
|
|
304
309
|
question: step.question[ctx.language],
|
|
305
|
-
questionType: "text"
|
|
310
|
+
questionType: "text",
|
|
311
|
+
allowFreeText: resolvedAllowFreeText,
|
|
312
|
+
...pendingParameterUpdates.length > 0 && {
|
|
313
|
+
parameterUpdates: pendingParameterUpdates
|
|
314
|
+
}
|
|
306
315
|
};
|
|
307
316
|
}
|
|
308
317
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -314,11 +323,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
314
323
|
questionSlug: step.slug,
|
|
315
324
|
question: step.question[ctx.language],
|
|
316
325
|
questionType: step.type,
|
|
317
|
-
options
|
|
326
|
+
options,
|
|
327
|
+
allowFreeText: resolvedAllowFreeText,
|
|
328
|
+
...pendingParameterUpdates.length > 0 && {
|
|
329
|
+
parameterUpdates: pendingParameterUpdates
|
|
330
|
+
}
|
|
318
331
|
};
|
|
319
332
|
}
|
|
320
333
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
321
|
-
return {
|
|
334
|
+
return {
|
|
335
|
+
type: "fulfilled",
|
|
336
|
+
dataInvestigationResult,
|
|
337
|
+
...pendingParameterUpdates.length > 0 && {
|
|
338
|
+
parameterUpdates: pendingParameterUpdates
|
|
339
|
+
}
|
|
340
|
+
};
|
|
322
341
|
}
|
|
323
342
|
async function resolveSetupSelection(params) {
|
|
324
343
|
const { selected, allSentinel, fetchAll, limit } = params;
|
|
@@ -338,19 +338,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
338
338
|
};
|
|
339
339
|
let state = flow.initialState();
|
|
340
340
|
let answerIdx = 0;
|
|
341
|
+
const pendingParameterUpdates = [];
|
|
341
342
|
for (const step of flow.steps) {
|
|
342
343
|
const ans = ctx.answers[answerIdx];
|
|
343
344
|
if (ans && ans.questionSlug === step.slug) {
|
|
344
345
|
state = step.applyAnswer(state, ans.answer);
|
|
346
|
+
if (step.toParameterUpdates) {
|
|
347
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
348
|
+
}
|
|
345
349
|
answerIdx += 1;
|
|
346
350
|
continue;
|
|
347
351
|
}
|
|
352
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
348
353
|
if (step.type === "text") {
|
|
349
354
|
return {
|
|
350
355
|
type: "nextQuestion",
|
|
351
356
|
questionSlug: step.slug,
|
|
352
357
|
question: step.question[ctx.language],
|
|
353
|
-
questionType: "text"
|
|
358
|
+
questionType: "text",
|
|
359
|
+
allowFreeText: resolvedAllowFreeText,
|
|
360
|
+
...pendingParameterUpdates.length > 0 && {
|
|
361
|
+
parameterUpdates: pendingParameterUpdates
|
|
362
|
+
}
|
|
354
363
|
};
|
|
355
364
|
}
|
|
356
365
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -362,11 +371,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
362
371
|
questionSlug: step.slug,
|
|
363
372
|
question: step.question[ctx.language],
|
|
364
373
|
questionType: step.type,
|
|
365
|
-
options
|
|
374
|
+
options,
|
|
375
|
+
allowFreeText: resolvedAllowFreeText,
|
|
376
|
+
...pendingParameterUpdates.length > 0 && {
|
|
377
|
+
parameterUpdates: pendingParameterUpdates
|
|
378
|
+
}
|
|
366
379
|
};
|
|
367
380
|
}
|
|
368
381
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
369
|
-
return {
|
|
382
|
+
return {
|
|
383
|
+
type: "fulfilled",
|
|
384
|
+
dataInvestigationResult,
|
|
385
|
+
...pendingParameterUpdates.length > 0 && {
|
|
386
|
+
parameterUpdates: pendingParameterUpdates
|
|
387
|
+
}
|
|
388
|
+
};
|
|
370
389
|
}
|
|
371
390
|
async function resolveSetupSelection(params) {
|
|
372
391
|
const { selected, allSentinel, fetchAll, limit } = params;
|
|
@@ -319,19 +319,28 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
319
319
|
};
|
|
320
320
|
let state = flow.initialState();
|
|
321
321
|
let answerIdx = 0;
|
|
322
|
+
const pendingParameterUpdates = [];
|
|
322
323
|
for (const step of flow.steps) {
|
|
323
324
|
const ans = ctx.answers[answerIdx];
|
|
324
325
|
if (ans && ans.questionSlug === step.slug) {
|
|
325
326
|
state = step.applyAnswer(state, ans.answer);
|
|
327
|
+
if (step.toParameterUpdates) {
|
|
328
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
329
|
+
}
|
|
326
330
|
answerIdx += 1;
|
|
327
331
|
continue;
|
|
328
332
|
}
|
|
333
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
329
334
|
if (step.type === "text") {
|
|
330
335
|
return {
|
|
331
336
|
type: "nextQuestion",
|
|
332
337
|
questionSlug: step.slug,
|
|
333
338
|
question: step.question[ctx.language],
|
|
334
|
-
questionType: "text"
|
|
339
|
+
questionType: "text",
|
|
340
|
+
allowFreeText: resolvedAllowFreeText,
|
|
341
|
+
...pendingParameterUpdates.length > 0 && {
|
|
342
|
+
parameterUpdates: pendingParameterUpdates
|
|
343
|
+
}
|
|
335
344
|
};
|
|
336
345
|
}
|
|
337
346
|
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
@@ -343,11 +352,21 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
343
352
|
questionSlug: step.slug,
|
|
344
353
|
question: step.question[ctx.language],
|
|
345
354
|
questionType: step.type,
|
|
346
|
-
options
|
|
355
|
+
options,
|
|
356
|
+
allowFreeText: resolvedAllowFreeText,
|
|
357
|
+
...pendingParameterUpdates.length > 0 && {
|
|
358
|
+
parameterUpdates: pendingParameterUpdates
|
|
359
|
+
}
|
|
347
360
|
};
|
|
348
361
|
}
|
|
349
362
|
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
350
|
-
return {
|
|
363
|
+
return {
|
|
364
|
+
type: "fulfilled",
|
|
365
|
+
dataInvestigationResult,
|
|
366
|
+
...pendingParameterUpdates.length > 0 && {
|
|
367
|
+
parameterUpdates: pendingParameterUpdates
|
|
368
|
+
}
|
|
369
|
+
};
|
|
351
370
|
}
|
|
352
371
|
async function resolveSetupSelection(params) {
|
|
353
372
|
const { selected, allSentinel, fetchAll, limit } = params;
|