dsh-nextsteps 1.4.3 → 1.4.4
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/client.js +19 -5
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -563,17 +563,31 @@ window.__ModuleLoader__.load({
|
|
|
563
563
|
const install = async () => {
|
|
564
564
|
const { info } = update;
|
|
565
565
|
let pluginManager;
|
|
566
|
-
try {
|
|
567
|
-
|
|
566
|
+
try {
|
|
567
|
+
pluginManager = ctx.remote?.pluginManager ?? ctx.get?.('remote')?.pluginManager;
|
|
568
|
+
} catch { pluginManager = undefined; }
|
|
569
|
+
if (info === undefined) return;
|
|
570
|
+
if (pluginManager === undefined || typeof pluginManager.installBundle !== 'function') {
|
|
571
|
+
setUpdate({ status: 'error', info, error: 'the plugin manager is not available in this install' });
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
568
574
|
setUpdate({ status: 'installing', info });
|
|
569
575
|
try {
|
|
576
|
+
const requestId = NS + '-update-' + info.latest + '-' + Date.now();
|
|
570
577
|
const attempt = async (spec) => {
|
|
571
|
-
const reply = await pluginManager.installBundle(spec, {
|
|
578
|
+
const reply = await pluginManager.installBundle(spec, { enabled: true, requestId });
|
|
572
579
|
if (reply === null || typeof reply !== 'object' || reply.ok !== true) throw new Error(reply?.error?.message ?? 'plugin manager did not answer');
|
|
573
580
|
return reply.value;
|
|
574
581
|
};
|
|
575
|
-
let result
|
|
576
|
-
if (
|
|
582
|
+
let result;
|
|
583
|
+
if (typeof pluginManager.updateBundle === 'function') {
|
|
584
|
+
const reply = await pluginManager.updateBundle(NPM_NAME, info.latest, { requestId });
|
|
585
|
+
if (reply === null || typeof reply !== 'object' || reply.ok !== true) throw new Error(reply?.error?.message ?? 'plugin manager did not answer');
|
|
586
|
+
result = reply.value;
|
|
587
|
+
} else {
|
|
588
|
+
result = await attempt(NPM_NAME + '@' + info.latest);
|
|
589
|
+
if (result !== null && typeof result === 'object' && result.error?.code === 'already-installed') result = await attempt('https://registry.npmjs.org/' + NPM_NAME + '/-/' + NPM_NAME + '-' + info.latest + '.tgz');
|
|
590
|
+
}
|
|
577
591
|
const applied = result !== null && typeof result === 'object' && (result.application === 'applied' || result.application === 'restart-required' || result.version === info.latest);
|
|
578
592
|
if (!applied) {
|
|
579
593
|
const diagnostic = typeof result?.error?.diagnostic === 'string' ? result.error.diagnostic.split('\n').find((entry) => entry.trim() !== '') : undefined;
|