dsh-nextsteps 1.4.4 → 1.4.5

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.
Files changed (2) hide show
  1. package/client.js +15 -2
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -574,6 +574,14 @@ window.__ModuleLoader__.load({
574
574
  setUpdate({ status: 'installing', info });
575
575
  try {
576
576
  const requestId = NS + '-update-' + info.latest + '-' + Date.now();
577
+ const recoverInstall = async (manager, id) => {
578
+ if (typeof manager.waitForInstall !== 'function') return undefined;
579
+ try {
580
+ const reply = await manager.waitForInstall(id);
581
+ if (reply === null || typeof reply !== 'object' || reply.ok !== true) return undefined;
582
+ return reply.value ?? undefined;
583
+ } catch { return undefined; }
584
+ };
577
585
  const attempt = async (spec) => {
578
586
  const reply = await pluginManager.installBundle(spec, { enabled: true, requestId });
579
587
  if (reply === null || typeof reply !== 'object' || reply.ok !== true) throw new Error(reply?.error?.message ?? 'plugin manager did not answer');
@@ -582,8 +590,13 @@ window.__ModuleLoader__.load({
582
590
  let result;
583
591
  if (typeof pluginManager.updateBundle === 'function') {
584
592
  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;
593
+ if (reply === null || typeof reply !== 'object' || reply.ok !== true) {
594
+ const recovered = await recoverInstall(pluginManager, requestId);
595
+ if (recovered === undefined) throw new Error(reply?.error?.message ?? 'plugin manager did not answer');
596
+ result = recovered;
597
+ } else {
598
+ result = reply.value;
599
+ }
587
600
  } else {
588
601
  result = await attempt(NPM_NAME + '@' + info.latest);
589
602
  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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-nextsteps",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",