@algolia/wizard 0.38.0-rc.131.267 → 0.38.0-rc.131.268
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 +17 -11
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1432,9 +1432,9 @@ function reconcileWorkflowState(state, workflow) {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
return state;
|
|
1434
1434
|
}
|
|
1435
|
-
async function
|
|
1435
|
+
async function loadResumableState(workflow) {
|
|
1436
1436
|
const persisted = await loadWorkflowState(workflow.id);
|
|
1437
|
-
return persisted
|
|
1437
|
+
return persisted ? reconcileWorkflowState(persisted, workflow) : null;
|
|
1438
1438
|
}
|
|
1439
1439
|
function initWorkflowState(workflow, now) {
|
|
1440
1440
|
return {
|
|
@@ -1538,11 +1538,11 @@ async function runStep(state, index, step, appId) {
|
|
|
1538
1538
|
durationMs: Date.now() - startedAt
|
|
1539
1539
|
});
|
|
1540
1540
|
}
|
|
1541
|
-
async function runWorkflow(workflow, appId) {
|
|
1541
|
+
async function runWorkflow(workflow, appId, resumableState) {
|
|
1542
1542
|
const store = useWizard.getState();
|
|
1543
1543
|
try {
|
|
1544
|
-
const
|
|
1545
|
-
const state =
|
|
1544
|
+
const resolved2 = resumableState !== void 0 ? resumableState : await loadResumableState(workflow);
|
|
1545
|
+
const state = resolved2 ?? initWorkflowState(workflow, nowIso());
|
|
1546
1546
|
ensureExecutedStepCount(state);
|
|
1547
1547
|
store.startWorkflow(
|
|
1548
1548
|
{
|
|
@@ -3330,7 +3330,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3330
3330
|
// package.json
|
|
3331
3331
|
var package_default = {
|
|
3332
3332
|
name: "@algolia/wizard",
|
|
3333
|
-
version: "0.38.0-rc.131.
|
|
3333
|
+
version: "0.38.0-rc.131.268",
|
|
3334
3334
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3335
3335
|
type: "module",
|
|
3336
3336
|
engines: {
|
|
@@ -5628,6 +5628,11 @@ function secondaryFor(app) {
|
|
|
5628
5628
|
function labelFor(app) {
|
|
5629
5629
|
return app.name.trim() ? `${app.name} \u2014 ${app.id}` : app.id;
|
|
5630
5630
|
}
|
|
5631
|
+
async function isEligible(app) {
|
|
5632
|
+
const apps = await listApplications();
|
|
5633
|
+
const full = apps.find((candidate) => candidate.id === app.id);
|
|
5634
|
+
return full != null && canSelectApplication(full);
|
|
5635
|
+
}
|
|
5631
5636
|
async function selectAndReport(app) {
|
|
5632
5637
|
const store = useWizard.getState();
|
|
5633
5638
|
store.setSettingUpApp(app.id);
|
|
@@ -5696,7 +5701,7 @@ async function confirmEnvApplication(env, current) {
|
|
|
5696
5701
|
]
|
|
5697
5702
|
});
|
|
5698
5703
|
if (choice === useEnv) return selectEnvApplication(env);
|
|
5699
|
-
return current ? selectAndReport(current) : null;
|
|
5704
|
+
return current && await isEligible(current) ? selectAndReport(current) : null;
|
|
5700
5705
|
}
|
|
5701
5706
|
async function selectEnvApplication(env) {
|
|
5702
5707
|
try {
|
|
@@ -5714,7 +5719,8 @@ async function selectEnvApplication(env) {
|
|
|
5714
5719
|
async function ensureApplication(isResuming) {
|
|
5715
5720
|
const current = await currentApplication();
|
|
5716
5721
|
if (isResuming) {
|
|
5717
|
-
|
|
5722
|
+
if (current && await isEligible(current)) return current;
|
|
5723
|
+
return promptForApplication();
|
|
5718
5724
|
}
|
|
5719
5725
|
const env = await findEnvApplicationId();
|
|
5720
5726
|
if (env && env.id !== current?.id) {
|
|
@@ -6085,15 +6091,15 @@ async function run(workflow) {
|
|
|
6085
6091
|
}
|
|
6086
6092
|
store.setUser(user);
|
|
6087
6093
|
let app;
|
|
6094
|
+
const resumableState = await loadResumableState(workflow);
|
|
6088
6095
|
try {
|
|
6089
|
-
|
|
6090
|
-
app = await ensureApplication(resuming);
|
|
6096
|
+
app = await ensureApplication(resumableState != null);
|
|
6091
6097
|
} catch (err) {
|
|
6092
6098
|
store.setError(err instanceof Error ? err.message : String(err));
|
|
6093
6099
|
await instance.waitUntilExit();
|
|
6094
6100
|
process.exit(1);
|
|
6095
6101
|
}
|
|
6096
|
-
runWorkflow(workflow, app.id);
|
|
6102
|
+
runWorkflow(workflow, app.id, resumableState);
|
|
6097
6103
|
}
|
|
6098
6104
|
await requestTerminalSize();
|
|
6099
6105
|
var started = await startup();
|