@algolia/wizard 0.38.0-rc.131.268 → 0.38.0-rc.131.269
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 +18 -40
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -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.269",
|
|
3334
3334
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3335
3335
|
type: "module",
|
|
3336
3336
|
engines: {
|
|
@@ -5619,10 +5619,13 @@ function readValue(raw) {
|
|
|
5619
5619
|
function blockReasonFor(app) {
|
|
5620
5620
|
return app.status !== "active" ? "Paused" : "Missing permissions";
|
|
5621
5621
|
}
|
|
5622
|
-
function secondaryFor(app) {
|
|
5622
|
+
function secondaryFor(app, highlightId) {
|
|
5623
5623
|
if (!canSelectApplication(app)) {
|
|
5624
5624
|
return { kind: "text", value: blockReasonFor(app) };
|
|
5625
5625
|
}
|
|
5626
|
+
if (app.id === highlightId) {
|
|
5627
|
+
return { kind: "badge", value: "[DETECTED]" };
|
|
5628
|
+
}
|
|
5626
5629
|
return app.plan ? { kind: "badge", value: app.plan } : void 0;
|
|
5627
5630
|
}
|
|
5628
5631
|
function labelFor(app) {
|
|
@@ -5642,7 +5645,7 @@ async function selectAndReport(app) {
|
|
|
5642
5645
|
store.setSettingUpApp(null);
|
|
5643
5646
|
}
|
|
5644
5647
|
}
|
|
5645
|
-
async function promptForApplication(
|
|
5648
|
+
async function promptForApplication(highlight) {
|
|
5646
5649
|
const store = useWizard.getState();
|
|
5647
5650
|
const unordered = await listApplications();
|
|
5648
5651
|
if (unordered.length === 0) {
|
|
@@ -5659,14 +5662,22 @@ async function promptForApplication(leadIn = []) {
|
|
|
5659
5662
|
...unordered.filter(canSelectApplication),
|
|
5660
5663
|
...unordered.filter((app) => !canSelectApplication(app))
|
|
5661
5664
|
];
|
|
5662
|
-
const
|
|
5665
|
+
const envApp = highlight ? unordered.find((app) => app.id === highlight.id) : void 0;
|
|
5666
|
+
const highlightIndex = envApp && canSelectApplication(envApp) ? apps.indexOf(envApp) : -1;
|
|
5667
|
+
const messages = [];
|
|
5668
|
+
if (highlight && highlightIndex < 0) {
|
|
5669
|
+
messages.push(
|
|
5670
|
+
envApp ? `Could not use ${highlight.id} from ${highlight.file} \u2014 it\u2019s ${blockReasonFor(envApp).toLowerCase()}. Pick another below.` : `Could not use ${highlight.id} from ${highlight.file} \u2014 it may have been removed, or this account may not have access to it.`
|
|
5671
|
+
);
|
|
5672
|
+
}
|
|
5663
5673
|
for (; ; ) {
|
|
5664
5674
|
const choice = await store.requestUserInput({
|
|
5665
5675
|
prompt: "Which Algolia application should the wizard work in?",
|
|
5666
5676
|
promptType: "multipleChoice",
|
|
5667
5677
|
options: apps.map(labelFor),
|
|
5668
|
-
secondary: apps.map(secondaryFor),
|
|
5678
|
+
secondary: apps.map((app) => secondaryFor(app, highlight?.id)),
|
|
5669
5679
|
disabled: apps.map((app) => !canSelectApplication(app)),
|
|
5680
|
+
...highlightIndex >= 0 ? { defaultSelectedIndex: highlightIndex } : {},
|
|
5670
5681
|
messages
|
|
5671
5682
|
});
|
|
5672
5683
|
const chosen = apps.find((app) => labelFor(app) === choice);
|
|
@@ -5686,36 +5697,6 @@ async function promptForApplication(leadIn = []) {
|
|
|
5686
5697
|
}
|
|
5687
5698
|
}
|
|
5688
5699
|
}
|
|
5689
|
-
async function confirmEnvApplication(env, current) {
|
|
5690
|
-
const useEnv = `Use ${env.id} (from ${env.file})`;
|
|
5691
|
-
const choice = await useWizard.getState().requestUserInput({
|
|
5692
|
-
prompt: "Select an application",
|
|
5693
|
-
promptType: "multipleChoice",
|
|
5694
|
-
options: [
|
|
5695
|
-
useEnv,
|
|
5696
|
-
current ? `Use ${labelFor(current)} (already selected)` : "Pick a different application"
|
|
5697
|
-
],
|
|
5698
|
-
messages: [
|
|
5699
|
-
`${env.file} already sets ${env.name}=${env.id}.`,
|
|
5700
|
-
"Which Algolia application would you like to use?"
|
|
5701
|
-
]
|
|
5702
|
-
});
|
|
5703
|
-
if (choice === useEnv) return selectEnvApplication(env);
|
|
5704
|
-
return current && await isEligible(current) ? selectAndReport(current) : null;
|
|
5705
|
-
}
|
|
5706
|
-
async function selectEnvApplication(env) {
|
|
5707
|
-
try {
|
|
5708
|
-
return await selectAndReport({ id: env.id, name: "" });
|
|
5709
|
-
} catch (err) {
|
|
5710
|
-
logger.warn(
|
|
5711
|
-
{ app: env.id, err: err.message },
|
|
5712
|
-
"could not select the application named in env; falling back to the picker"
|
|
5713
|
-
);
|
|
5714
|
-
return promptForApplication([
|
|
5715
|
-
`Could not select ${env.id} from ${env.file} \u2014 it may have been removed, or this account may not have access to it.`
|
|
5716
|
-
]);
|
|
5717
|
-
}
|
|
5718
|
-
}
|
|
5719
5700
|
async function ensureApplication(isResuming) {
|
|
5720
5701
|
const current = await currentApplication();
|
|
5721
5702
|
if (isResuming) {
|
|
@@ -5723,11 +5704,8 @@ async function ensureApplication(isResuming) {
|
|
|
5723
5704
|
return promptForApplication();
|
|
5724
5705
|
}
|
|
5725
5706
|
const env = await findEnvApplicationId();
|
|
5726
|
-
if (env
|
|
5727
|
-
|
|
5728
|
-
if (chosen) return chosen;
|
|
5729
|
-
}
|
|
5730
|
-
return promptForApplication();
|
|
5707
|
+
if (!env) return promptForApplication();
|
|
5708
|
+
return promptForApplication({ id: env.id, file: env.file });
|
|
5731
5709
|
}
|
|
5732
5710
|
|
|
5733
5711
|
// src/lib/seed.ts
|