@algolia/wizard 0.74.0 → 0.76.0
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/main.js +451 -23
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2234,6 +2234,7 @@ async function promptForApplication(highlight) {
|
|
|
2234
2234
|
}
|
|
2235
2235
|
async function promptToChangeApplication(currentId) {
|
|
2236
2236
|
const store = useWizard.getState();
|
|
2237
|
+
store.clearNotices();
|
|
2237
2238
|
store.setLoadingMessage("Loading applications\u2026");
|
|
2238
2239
|
try {
|
|
2239
2240
|
const env = await findEnvApplicationId();
|
|
@@ -2260,7 +2261,7 @@ async function ensureApplication(resumeAppId) {
|
|
|
2260
2261
|
// package.json
|
|
2261
2262
|
var package_default = {
|
|
2262
2263
|
name: "@algolia/wizard",
|
|
2263
|
-
version: "0.
|
|
2264
|
+
version: "0.76.0",
|
|
2264
2265
|
description: "Magically implement Algolia functionality in your codebase",
|
|
2265
2266
|
type: "module",
|
|
2266
2267
|
engines: {
|
|
@@ -6314,6 +6315,9 @@ var defaultWorkflow = {
|
|
|
6314
6315
|
]
|
|
6315
6316
|
};
|
|
6316
6317
|
|
|
6318
|
+
// src/workflows/playbook.ts
|
|
6319
|
+
import "zod";
|
|
6320
|
+
|
|
6317
6321
|
// src/actions/playbookSteps/selectPlaybook.ts
|
|
6318
6322
|
import { z as z32 } from "zod";
|
|
6319
6323
|
|
|
@@ -6333,6 +6337,16 @@ var DashboardApiError = class extends Error {
|
|
|
6333
6337
|
return isRecord(this.body) ? this.body : void 0;
|
|
6334
6338
|
}
|
|
6335
6339
|
};
|
|
6340
|
+
async function retryOnDashboardError(call, recover) {
|
|
6341
|
+
for (; ; ) {
|
|
6342
|
+
try {
|
|
6343
|
+
return await call();
|
|
6344
|
+
} catch (err) {
|
|
6345
|
+
if (!(err instanceof DashboardApiError)) throw err;
|
|
6346
|
+
await recover(err);
|
|
6347
|
+
}
|
|
6348
|
+
}
|
|
6349
|
+
}
|
|
6336
6350
|
function isRecord(value) {
|
|
6337
6351
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
6338
6352
|
}
|
|
@@ -6435,6 +6449,43 @@ async function getPlaybooks() {
|
|
|
6435
6449
|
);
|
|
6436
6450
|
return data;
|
|
6437
6451
|
}
|
|
6452
|
+
async function createPlaybookExecution(appId, slug, indexName, options) {
|
|
6453
|
+
const { data } = await dashboardRequest(
|
|
6454
|
+
`/api/1/playbook-integrations/applications/${appId}/playbooks/${slug}/executions`,
|
|
6455
|
+
playbookExecutionCreateResponseSchema,
|
|
6456
|
+
{
|
|
6457
|
+
method: "POST",
|
|
6458
|
+
headers: { "content-type": "application/json" },
|
|
6459
|
+
body: JSON.stringify({
|
|
6460
|
+
index_name: indexName,
|
|
6461
|
+
force_new: options?.forceNew ?? false
|
|
6462
|
+
})
|
|
6463
|
+
}
|
|
6464
|
+
);
|
|
6465
|
+
return data;
|
|
6466
|
+
}
|
|
6467
|
+
async function createSampleIndex(appId, playbookSlug) {
|
|
6468
|
+
const { data } = await dashboardRequest(
|
|
6469
|
+
`/api/1/playbook-integrations/applications/${appId}/playbooks/${playbookSlug}/sample_index`,
|
|
6470
|
+
playbookExecutionSchema,
|
|
6471
|
+
{ method: "POST" }
|
|
6472
|
+
);
|
|
6473
|
+
return data;
|
|
6474
|
+
}
|
|
6475
|
+
async function getPlaybookExecution(uuid) {
|
|
6476
|
+
const { data } = await dashboardRequest(
|
|
6477
|
+
`/api/1/playbook-integrations/playbooks/executions/${uuid}`,
|
|
6478
|
+
playbookExecutionSchema
|
|
6479
|
+
);
|
|
6480
|
+
return data;
|
|
6481
|
+
}
|
|
6482
|
+
async function assessPlaybookExecution(uuid) {
|
|
6483
|
+
await dashboardRequest(
|
|
6484
|
+
`/api/1/playbook-integrations/playbooks/executions/${uuid}/assess`,
|
|
6485
|
+
messageResponseSchema,
|
|
6486
|
+
{ method: "POST" }
|
|
6487
|
+
);
|
|
6488
|
+
}
|
|
6438
6489
|
|
|
6439
6490
|
// src/actions/playbookSteps/selectPlaybook.ts
|
|
6440
6491
|
var selectPlaybookSchema = z32.object({
|
|
@@ -6469,34 +6520,372 @@ async function selectPlaybookStep(ctx, requestedSlug) {
|
|
|
6469
6520
|
return persistSlug(ctx, selection);
|
|
6470
6521
|
}
|
|
6471
6522
|
|
|
6472
|
-
// src/actions/playbookSteps/
|
|
6523
|
+
// src/actions/playbookSteps/selectIndex.ts
|
|
6473
6524
|
import { z as z33 } from "zod";
|
|
6474
|
-
var
|
|
6475
|
-
|
|
6476
|
-
|
|
6525
|
+
var selectIndexSchema = z33.object({
|
|
6526
|
+
indexName: z33.string(),
|
|
6527
|
+
sampleIndex: z33.boolean()
|
|
6528
|
+
});
|
|
6529
|
+
var CREATE_SAMPLE_INDEX = "Create a sample index";
|
|
6530
|
+
var GO_BACK_OPTION = "Go back to playbook selection";
|
|
6477
6531
|
var SELECT_APP_OPTION = "Select app";
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6532
|
+
var MIN_ENTRIES_FOR_SELECTION = 1;
|
|
6533
|
+
function formatIndexOption(index) {
|
|
6534
|
+
if (index.entries < MIN_ENTRIES_FOR_SELECTION) {
|
|
6535
|
+
return `${index.name} (empty index)`;
|
|
6536
|
+
}
|
|
6537
|
+
return `${index.name} (${index.entries.toLocaleString()} records)`;
|
|
6538
|
+
}
|
|
6539
|
+
function isIndexSelectable(index) {
|
|
6540
|
+
return index.entries >= MIN_ENTRIES_FOR_SELECTION;
|
|
6541
|
+
}
|
|
6542
|
+
async function selectIndexStep2(ctx) {
|
|
6543
|
+
let indices = ctx.getUserInput("fetchedIndices");
|
|
6544
|
+
!indices && ctx.notify({
|
|
6545
|
+
messages: ["Fetching indices from your Algolia application\u2026"]
|
|
6546
|
+
});
|
|
6547
|
+
const app = await requireApplication();
|
|
6548
|
+
if (!indices) {
|
|
6549
|
+
indices = await listIndices();
|
|
6550
|
+
ctx.setUserInput("fetchedIndices", indices);
|
|
6551
|
+
}
|
|
6552
|
+
const hasIndices = indices.length > 0;
|
|
6553
|
+
const indexOptions = hasIndices ? indices.map(formatIndexOption) : [];
|
|
6554
|
+
const options = [
|
|
6555
|
+
...indexOptions,
|
|
6556
|
+
CREATE_SAMPLE_INDEX,
|
|
6557
|
+
GO_BACK_OPTION,
|
|
6558
|
+
SELECT_APP_OPTION
|
|
6559
|
+
];
|
|
6560
|
+
const disabled = hasIndices ? [
|
|
6561
|
+
...indices.map((idx) => !isIndexSelectable(idx)),
|
|
6562
|
+
false,
|
|
6563
|
+
// CREATE_SAMPLE_INDEX is selectable
|
|
6564
|
+
false,
|
|
6565
|
+
// GO_BACK_OPTION is selectable
|
|
6566
|
+
false
|
|
6567
|
+
// SELECT_APP_OPTION is selectable
|
|
6568
|
+
] : void 0;
|
|
6569
|
+
const prompt = hasIndices ? "Select an index:" : `${app.name} doesn't have any indices yet. Start from a sample data set
|
|
6570
|
+
you can explore or switch to another application`;
|
|
6571
|
+
let error;
|
|
6572
|
+
let result;
|
|
6573
|
+
while (result === void 0) {
|
|
6481
6574
|
const selection = await ctx.requestUserInput({
|
|
6482
|
-
prompt
|
|
6575
|
+
prompt,
|
|
6483
6576
|
promptType: "multipleChoice",
|
|
6484
|
-
options
|
|
6485
|
-
|
|
6486
|
-
|
|
6577
|
+
options,
|
|
6578
|
+
error,
|
|
6579
|
+
disabled,
|
|
6580
|
+
helpText: hasIndices ? "Choose an existing index with data, or create a new index from sample data." : void 0
|
|
6487
6581
|
});
|
|
6488
6582
|
if (typeof selection !== "string") {
|
|
6489
|
-
throw new Error(
|
|
6583
|
+
throw new Error(
|
|
6584
|
+
"selectIndex received an unexpected non-text result"
|
|
6585
|
+
);
|
|
6586
|
+
}
|
|
6587
|
+
if (selection === GO_BACK_OPTION) {
|
|
6588
|
+
ctx.setUserInput("fetchedIndices", void 0);
|
|
6589
|
+
return ctx.returnToStep("select-playbook");
|
|
6490
6590
|
}
|
|
6491
6591
|
if (selection === SELECT_APP_OPTION) {
|
|
6492
6592
|
await ctx.changeApplication();
|
|
6493
6593
|
continue;
|
|
6494
6594
|
}
|
|
6495
|
-
if (selection ===
|
|
6496
|
-
|
|
6595
|
+
if (selection === CREATE_SAMPLE_INDEX) {
|
|
6596
|
+
result = {
|
|
6597
|
+
indexName: "",
|
|
6598
|
+
sampleIndex: true
|
|
6599
|
+
};
|
|
6600
|
+
break;
|
|
6497
6601
|
}
|
|
6602
|
+
const selectedIndex = indices.find(
|
|
6603
|
+
(idx) => formatIndexOption(idx) === selection
|
|
6604
|
+
);
|
|
6605
|
+
if (!selectedIndex) {
|
|
6606
|
+
error = "Invalid selection. Please try again.";
|
|
6607
|
+
continue;
|
|
6608
|
+
}
|
|
6609
|
+
result = {
|
|
6610
|
+
indexName: selectedIndex.name,
|
|
6611
|
+
sampleIndex: false
|
|
6612
|
+
};
|
|
6613
|
+
}
|
|
6614
|
+
return result;
|
|
6615
|
+
}
|
|
6616
|
+
|
|
6617
|
+
// src/actions/playbookSteps/confirmIndex.ts
|
|
6618
|
+
import "zod";
|
|
6619
|
+
var confirmIndexSchema = playbookExecutionSchema.nullable();
|
|
6620
|
+
var CONTINUE_OPTION = "Looks good, continue";
|
|
6621
|
+
var GO_BACK_OPTION2 = "Go back";
|
|
6622
|
+
async function confirmIndexStep(ctx) {
|
|
6623
|
+
const { sampleIndex } = ctx.getStepOutput("select-index");
|
|
6624
|
+
if (!sampleIndex) {
|
|
6625
|
+
return null;
|
|
6626
|
+
}
|
|
6627
|
+
const { slug } = ctx.getStepOutput("select-playbook");
|
|
6628
|
+
const selection = await ctx.requestUserInput({
|
|
6629
|
+
prompt: "Ready to create sample index?",
|
|
6630
|
+
promptType: "multipleChoice",
|
|
6631
|
+
options: [CONTINUE_OPTION, GO_BACK_OPTION2],
|
|
6632
|
+
messages: [
|
|
6633
|
+
`A new index called "algolia_playbooks_${slug}_sample_index" will be created with sample ${slug} data.`
|
|
6634
|
+
],
|
|
6635
|
+
helpText: "Going back lets you choose a different index."
|
|
6636
|
+
});
|
|
6637
|
+
if (typeof selection !== "string") {
|
|
6638
|
+
throw new Error("confirm-index received an unexpected result");
|
|
6639
|
+
}
|
|
6640
|
+
if (selection === GO_BACK_OPTION2) {
|
|
6641
|
+
return ctx.returnToStep("select-index");
|
|
6642
|
+
}
|
|
6643
|
+
ctx.notify({
|
|
6644
|
+
messages: ["Creating sample index and playbook execution\u2026"]
|
|
6645
|
+
});
|
|
6646
|
+
const app = await requireApplication();
|
|
6647
|
+
const playbookSlug = ctx.getUserInput("playbookSlug");
|
|
6648
|
+
if (!playbookSlug) {
|
|
6649
|
+
throw new Error("No playbook slug found in context");
|
|
6650
|
+
}
|
|
6651
|
+
try {
|
|
6652
|
+
const execution = await createSampleIndex(app.id, playbookSlug);
|
|
6653
|
+
ctx.setUserInput("fetchedIndices", void 0);
|
|
6654
|
+
ctx.clearNotices();
|
|
6655
|
+
ctx.notify({
|
|
6656
|
+
messages: [
|
|
6657
|
+
`Sample index "${execution.source_index_name}" created successfully!`
|
|
6658
|
+
]
|
|
6659
|
+
});
|
|
6660
|
+
return execution;
|
|
6661
|
+
} catch (error) {
|
|
6662
|
+
ctx.clearNotices();
|
|
6663
|
+
ctx.notify({
|
|
6664
|
+
messages: ["Failed to create sample index. Please try again."]
|
|
6665
|
+
});
|
|
6666
|
+
throw error;
|
|
6667
|
+
}
|
|
6668
|
+
}
|
|
6669
|
+
|
|
6670
|
+
// src/actions/playbookSteps/dataAssessment.ts
|
|
6671
|
+
var CONTINUE_EXECUTION_OPTION = "Continue";
|
|
6672
|
+
var RESTART_OPTION = "Restart";
|
|
6673
|
+
var GO_BACK_OPTION3 = "Go back";
|
|
6674
|
+
var SWITCH_APPLICATION_OPTION = "Switch application";
|
|
6675
|
+
var SWITCH_INDEX_OPTION = "Switch index";
|
|
6676
|
+
var RETRY_OPTION = "Retry";
|
|
6677
|
+
var POLL_INTERVAL_MS = 5e3;
|
|
6678
|
+
var POLL_TIMEOUT_MS = 6e4;
|
|
6679
|
+
var ASSESSING_NOTICE_HOLD_MS = 2e4;
|
|
6680
|
+
var CREATING_EXECUTION_NOTICE = "creating playbook execution\u2026";
|
|
6681
|
+
var POLL_NOTICES = [
|
|
6682
|
+
{ message: "created playbook execution", holdMs: POLL_INTERVAL_MS },
|
|
6683
|
+
{ message: "sampled records", holdMs: POLL_INTERVAL_MS },
|
|
6684
|
+
{
|
|
6685
|
+
message: "assessing schema and readiness \u2014 this usually takes ~20s for indices under 1M records.",
|
|
6686
|
+
holdMs: ASSESSING_NOTICE_HOLD_MS
|
|
6687
|
+
},
|
|
6688
|
+
{ message: "detecting required fields\u2026" }
|
|
6689
|
+
];
|
|
6690
|
+
async function dataAssessmentStep(ctx) {
|
|
6691
|
+
const { slug } = ctx.getStepOutput("select-playbook");
|
|
6692
|
+
const { indexName, existingExecution } = indexForAssessment(ctx);
|
|
6693
|
+
if (existingExecution) return existingExecution;
|
|
6694
|
+
try {
|
|
6695
|
+
showNotice(ctx, CREATING_EXECUTION_NOTICE);
|
|
6696
|
+
const { id: appId } = await requireApplication();
|
|
6697
|
+
const execution = await resolveExecution(ctx, appId, slug, indexName);
|
|
6698
|
+
return await runAssessment(ctx, execution, indexName);
|
|
6699
|
+
} finally {
|
|
6700
|
+
ctx.clearNotices();
|
|
6701
|
+
}
|
|
6702
|
+
}
|
|
6703
|
+
function indexForAssessment(ctx) {
|
|
6704
|
+
const selected = ctx.getStepOutput("select-index");
|
|
6705
|
+
if (!selected.sampleIndex) {
|
|
6706
|
+
return { indexName: selected.indexName, existingExecution: null };
|
|
6707
|
+
}
|
|
6708
|
+
const created = ctx.getStepOutput("confirm-index");
|
|
6709
|
+
if (!created) {
|
|
6710
|
+
throw new Error(
|
|
6711
|
+
"data-assessment expected confirm-index to create a sample index"
|
|
6712
|
+
);
|
|
6713
|
+
}
|
|
6714
|
+
return {
|
|
6715
|
+
indexName: created.source_index_name,
|
|
6716
|
+
existingExecution: created
|
|
6717
|
+
};
|
|
6718
|
+
}
|
|
6719
|
+
function showNotice(ctx, message) {
|
|
6720
|
+
ctx.clearNotices();
|
|
6721
|
+
ctx.notify({ messages: [message] });
|
|
6722
|
+
}
|
|
6723
|
+
function startPollNotices(ctx) {
|
|
6724
|
+
let index = 0;
|
|
6725
|
+
let timer;
|
|
6726
|
+
const showCurrent = () => {
|
|
6727
|
+
const notice = POLL_NOTICES[index];
|
|
6728
|
+
showNotice(ctx, notice.message);
|
|
6729
|
+
if (notice.holdMs == null) return;
|
|
6730
|
+
timer = setTimeout(() => {
|
|
6731
|
+
index += 1;
|
|
6732
|
+
showCurrent();
|
|
6733
|
+
}, notice.holdMs);
|
|
6734
|
+
};
|
|
6735
|
+
showCurrent();
|
|
6736
|
+
return () => clearTimeout(timer);
|
|
6737
|
+
}
|
|
6738
|
+
async function runAssessment(ctx, execution, indexName) {
|
|
6739
|
+
if (execution.step_status === "done") {
|
|
6740
|
+
return execution;
|
|
6741
|
+
}
|
|
6742
|
+
if (execution.step_status === "not_started" || execution.step_status === "error") {
|
|
6743
|
+
await assessExecution(ctx, execution.uuid, indexName);
|
|
6744
|
+
} else if (execution.step_status !== "in_progress") {
|
|
6745
|
+
throw unexpectedAssessmentStatus(execution.step_status);
|
|
6746
|
+
}
|
|
6747
|
+
for (; ; ) {
|
|
6748
|
+
const assessed = await pollUntilAssessed(ctx, execution.uuid, indexName);
|
|
6749
|
+
if (assessed.step_status === "done") {
|
|
6750
|
+
return assessed;
|
|
6751
|
+
}
|
|
6752
|
+
if (assessed.step_status !== "error") {
|
|
6753
|
+
throw unexpectedAssessmentStatus(assessed.step_status);
|
|
6754
|
+
}
|
|
6755
|
+
await promptAssessmentRecovery(
|
|
6756
|
+
ctx,
|
|
6757
|
+
assessmentFailureMessage(assessed),
|
|
6758
|
+
assessed.status_reason === "index_empty"
|
|
6759
|
+
);
|
|
6760
|
+
await assessExecution(ctx, execution.uuid, indexName);
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
function unexpectedAssessmentStatus(status) {
|
|
6764
|
+
return new Error(
|
|
6765
|
+
`data-assessment received an unexpected assessment status: ${status}`
|
|
6766
|
+
);
|
|
6767
|
+
}
|
|
6768
|
+
async function resolveExecution(ctx, appId, slug, indexName) {
|
|
6769
|
+
const created = await createWithRecovery(ctx, appId, slug, indexName);
|
|
6770
|
+
if (!created.resumed) return created;
|
|
6771
|
+
const choice = await ctx.requestUserInput({
|
|
6772
|
+
prompt: `${indexName} has a playbook in progress.`,
|
|
6773
|
+
promptType: "multipleChoice",
|
|
6774
|
+
options: [CONTINUE_EXECUTION_OPTION, RESTART_OPTION, GO_BACK_OPTION3],
|
|
6775
|
+
secondary: [{ kind: "text", value: "resume Assessment" }]
|
|
6776
|
+
});
|
|
6777
|
+
if (choice === CONTINUE_EXECUTION_OPTION) return created;
|
|
6778
|
+
if (choice === RESTART_OPTION) {
|
|
6779
|
+
return createWithRecovery(ctx, appId, slug, indexName, { forceNew: true });
|
|
6780
|
+
}
|
|
6781
|
+
if (choice === GO_BACK_OPTION3) {
|
|
6782
|
+
return ctx.returnToStep("select-index");
|
|
6783
|
+
}
|
|
6784
|
+
throw new Error("data-assessment received an unexpected execution choice");
|
|
6785
|
+
}
|
|
6786
|
+
async function createWithRecovery(ctx, appId, slug, indexName, options) {
|
|
6787
|
+
return retryOnDashboardError(
|
|
6788
|
+
() => {
|
|
6789
|
+
showNotice(ctx, CREATING_EXECUTION_NOTICE);
|
|
6790
|
+
return createPlaybookExecution(appId, slug, indexName, options);
|
|
6791
|
+
},
|
|
6792
|
+
onRequestFailure(ctx, indexName)
|
|
6793
|
+
);
|
|
6794
|
+
}
|
|
6795
|
+
function onRequestFailure(ctx, indexName) {
|
|
6796
|
+
return async (err) => {
|
|
6797
|
+
await promptAssessmentRecovery(
|
|
6798
|
+
ctx,
|
|
6799
|
+
requestFailureMessage(indexName, err),
|
|
6800
|
+
isEmptyIndexError(err)
|
|
6801
|
+
);
|
|
6802
|
+
};
|
|
6803
|
+
}
|
|
6804
|
+
function requestFailureMessage(indexName, err) {
|
|
6805
|
+
if (isEmptyIndexError(err)) {
|
|
6806
|
+
return `Index "${indexName}" has no records to assess.`;
|
|
6807
|
+
}
|
|
6808
|
+
const message = err.errorBody()?.message;
|
|
6809
|
+
if (typeof message === "string" && message.trim()) return message;
|
|
6810
|
+
return "Couldn't complete the request.";
|
|
6811
|
+
}
|
|
6812
|
+
function isEmptyIndexError(err) {
|
|
6813
|
+
const body = err.errorBody();
|
|
6814
|
+
return body?.status_reason === "index_empty" || body?.message === "index_empty";
|
|
6815
|
+
}
|
|
6816
|
+
async function pollUntilAssessed(ctx, uuid, indexName) {
|
|
6817
|
+
const logId = ctx.logStart("Assessing index data");
|
|
6818
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
6819
|
+
let logStatus = "error";
|
|
6820
|
+
let stopNotices = startPollNotices(ctx);
|
|
6821
|
+
try {
|
|
6822
|
+
for (; ; ) {
|
|
6823
|
+
const execution = await retryOnDashboardError(
|
|
6824
|
+
() => getPlaybookExecution(uuid),
|
|
6825
|
+
async (err) => {
|
|
6826
|
+
stopNotices();
|
|
6827
|
+
ctx.clearNotices();
|
|
6828
|
+
await promptAssessmentRecovery(
|
|
6829
|
+
ctx,
|
|
6830
|
+
requestFailureMessage(indexName, err),
|
|
6831
|
+
isEmptyIndexError(err)
|
|
6832
|
+
);
|
|
6833
|
+
stopNotices = startPollNotices(ctx);
|
|
6834
|
+
}
|
|
6835
|
+
);
|
|
6836
|
+
if (execution.step_status === "done") {
|
|
6837
|
+
logStatus = "success";
|
|
6838
|
+
return execution;
|
|
6839
|
+
}
|
|
6840
|
+
if (execution.step_status === "error") {
|
|
6841
|
+
ctx.clearNotices();
|
|
6842
|
+
return execution;
|
|
6843
|
+
}
|
|
6844
|
+
if (Date.now() >= deadline) {
|
|
6845
|
+
throw new Error("Timed out waiting for the data assessment to finish.");
|
|
6846
|
+
}
|
|
6847
|
+
await sleep(POLL_INTERVAL_MS);
|
|
6848
|
+
}
|
|
6849
|
+
} catch (err) {
|
|
6850
|
+
ctx.clearNotices();
|
|
6851
|
+
throw err;
|
|
6852
|
+
} finally {
|
|
6853
|
+
stopNotices();
|
|
6854
|
+
ctx.logEnd(logId, logStatus);
|
|
6855
|
+
}
|
|
6856
|
+
}
|
|
6857
|
+
var sleep = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
6858
|
+
async function assessExecution(ctx, uuid, indexName) {
|
|
6859
|
+
await retryOnDashboardError(
|
|
6860
|
+
() => assessPlaybookExecution(uuid),
|
|
6861
|
+
onRequestFailure(ctx, indexName)
|
|
6862
|
+
);
|
|
6863
|
+
}
|
|
6864
|
+
async function promptAssessmentRecovery(ctx, message, retryDisabled) {
|
|
6865
|
+
const choice = await ctx.requestUserInput({
|
|
6866
|
+
prompt: "Data assessment failed.",
|
|
6867
|
+
promptType: "multipleChoice",
|
|
6868
|
+
options: [SWITCH_APPLICATION_OPTION, SWITCH_INDEX_OPTION, RETRY_OPTION],
|
|
6869
|
+
messages: [message],
|
|
6870
|
+
disabled: [false, false, retryDisabled],
|
|
6871
|
+
helpText: "Retry re-runs assessment on this index. Switch index or application to pick a different target."
|
|
6872
|
+
});
|
|
6873
|
+
if (choice === SWITCH_APPLICATION_OPTION) {
|
|
6874
|
+
return ctx.changeApplication();
|
|
6875
|
+
}
|
|
6876
|
+
if (choice === SWITCH_INDEX_OPTION) {
|
|
6877
|
+
return ctx.returnToStep("select-index");
|
|
6878
|
+
}
|
|
6879
|
+
if (choice === RETRY_OPTION) {
|
|
6498
6880
|
return;
|
|
6499
6881
|
}
|
|
6882
|
+
throw new Error("data-assessment received an unexpected recovery choice");
|
|
6883
|
+
}
|
|
6884
|
+
function assessmentFailureMessage(execution) {
|
|
6885
|
+
if (execution.status_reason === "index_empty") {
|
|
6886
|
+
return `Index "${execution.source_index_name}" has no records to assess.`;
|
|
6887
|
+
}
|
|
6888
|
+
return execution.status_reason ?? "Data assessment failed.";
|
|
6500
6889
|
}
|
|
6501
6890
|
|
|
6502
6891
|
// src/lib/cli.ts
|
|
@@ -6567,11 +6956,25 @@ var playbookWorkflow = {
|
|
|
6567
6956
|
run: (ctx) => selectPlaybookStep(ctx, getPlaybookSlugArg())
|
|
6568
6957
|
}),
|
|
6569
6958
|
defineStep({
|
|
6570
|
-
id: "
|
|
6571
|
-
title: "
|
|
6572
|
-
outputSchema:
|
|
6959
|
+
id: "select-index",
|
|
6960
|
+
title: "Select index",
|
|
6961
|
+
outputSchema: selectIndexSchema,
|
|
6962
|
+
tips: ["apps-and-indices", "records-are-json", "speed"],
|
|
6963
|
+
run: (ctx) => selectIndexStep2(ctx)
|
|
6964
|
+
}),
|
|
6965
|
+
defineStep({
|
|
6966
|
+
id: "confirm-index",
|
|
6967
|
+
title: "Confirm sample index creation",
|
|
6968
|
+
outputSchema: confirmIndexSchema,
|
|
6573
6969
|
visible: false,
|
|
6574
|
-
|
|
6970
|
+
tips: ["apps-and-indices", "records-are-json", "speed"],
|
|
6971
|
+
run: (ctx) => confirmIndexStep(ctx)
|
|
6972
|
+
}),
|
|
6973
|
+
defineStep({
|
|
6974
|
+
id: "data-assessment",
|
|
6975
|
+
title: "Assess index data",
|
|
6976
|
+
outputSchema: playbookExecutionSchema,
|
|
6977
|
+
run: (ctx) => dataAssessmentStep(ctx)
|
|
6575
6978
|
})
|
|
6576
6979
|
]
|
|
6577
6980
|
};
|
|
@@ -7467,7 +7870,7 @@ function App() {
|
|
|
7467
7870
|
const isCommandApprovalPrompt = isAwaitingUserInput && inputReq?.promptType === "commandApproval";
|
|
7468
7871
|
const promptPending = isAwaitingUserInput && !isCommandApprovalPrompt;
|
|
7469
7872
|
const holdForTip = stepHasTips && promptPending && tipState === "revealing";
|
|
7470
|
-
const showTips = stepHasTips && (phase === "running" && currentStep?.status === "running"
|
|
7873
|
+
const showTips = stepHasTips && (phase === "running" && currentStep?.status === "running" && !loadingMessage && !settingUpAppId || isCommandApprovalPrompt);
|
|
7471
7874
|
const showNoticesInMain = !stepHasTips;
|
|
7472
7875
|
const showNotices = (!isAwaitingUserInput || holdForTip) && !review2;
|
|
7473
7876
|
useInput9(
|
|
@@ -7652,6 +8055,27 @@ var search = {
|
|
|
7652
8055
|
var selectPlaybook = {
|
|
7653
8056
|
slug: "orders"
|
|
7654
8057
|
};
|
|
8058
|
+
var selectPlaybookIndex = {
|
|
8059
|
+
indexName: "wizard_seed_orders",
|
|
8060
|
+
sampleIndex: false
|
|
8061
|
+
};
|
|
8062
|
+
var dataAssessment = {
|
|
8063
|
+
uuid: "seed-exec-uuid",
|
|
8064
|
+
playbook_slug: selectPlaybook.slug,
|
|
8065
|
+
application_id: "SEEDAPPID",
|
|
8066
|
+
source_index_name: selectPlaybookIndex.indexName,
|
|
8067
|
+
current_step: "assessment",
|
|
8068
|
+
step_status: "done",
|
|
8069
|
+
status_reason: null,
|
|
8070
|
+
completed: true,
|
|
8071
|
+
assessment_result: {
|
|
8072
|
+
ready: true,
|
|
8073
|
+
schema_comparison: [],
|
|
8074
|
+
settings_recommendation: {}
|
|
8075
|
+
},
|
|
8076
|
+
settings_snapshot: null,
|
|
8077
|
+
created_at: "2026-09-22T09:00:00.000Z"
|
|
8078
|
+
};
|
|
7655
8079
|
var review = {
|
|
7656
8080
|
summaryPoints: [
|
|
7657
8081
|
"Ingested 25 generated Product records into wizard_seed_products.",
|
|
@@ -7673,7 +8097,9 @@ var SEEDS = {
|
|
|
7673
8097
|
},
|
|
7674
8098
|
playbook: {
|
|
7675
8099
|
"select-playbook": selectPlaybook,
|
|
7676
|
-
"
|
|
8100
|
+
"select-index": selectPlaybookIndex,
|
|
8101
|
+
"confirm-index": null,
|
|
8102
|
+
"data-assessment": dataAssessment
|
|
7677
8103
|
}
|
|
7678
8104
|
};
|
|
7679
8105
|
var SEED_ALGOLIA_STATE = {
|
|
@@ -7687,7 +8113,9 @@ var SEED_USER_INPUTS = {
|
|
|
7687
8113
|
implementation: "success"
|
|
7688
8114
|
},
|
|
7689
8115
|
playbook: {
|
|
7690
|
-
playbookSlug: selectPlaybook.slug
|
|
8116
|
+
playbookSlug: selectPlaybook.slug,
|
|
8117
|
+
playbookIndexName: selectPlaybookIndex.indexName,
|
|
8118
|
+
playbookSampleIndex: selectPlaybookIndex.sampleIndex
|
|
7691
8119
|
}
|
|
7692
8120
|
};
|
|
7693
8121
|
function formatStepList(workflow, startIndex) {
|
|
@@ -7842,7 +8270,7 @@ function delay(ms) {
|
|
|
7842
8270
|
// package.json with { type: 'json' }
|
|
7843
8271
|
var package_default2 = {
|
|
7844
8272
|
name: "@algolia/wizard",
|
|
7845
|
-
version: "0.
|
|
8273
|
+
version: "0.76.0",
|
|
7846
8274
|
description: "Magically implement Algolia functionality in your codebase",
|
|
7847
8275
|
type: "module",
|
|
7848
8276
|
engines: {
|