@flighthq/updater 0.5.1-next.1069.554a2ac → 0.5.1-next.1201.9b49dee

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/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/updater`. The `@flig
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/updater@0.5.1-next.1069.554a2ac](https://github.com/flighthq/flight/tree/554a2acc3fecf189b89b0729308ff890a15c21cc/packages/updater)
17
- - [License](https://github.com/flighthq/flight/blob/554a2acc3fecf189b89b0729308ff890a15c21cc/LICENSE.md)
16
+ - [Source for @flighthq/updater@0.5.1-next.1201.9b49dee](https://github.com/flighthq/flight/tree/9b49dee3f22f6b2838c3d237edcc77bca65734f2/packages/updater)
17
+ - [License](https://github.com/flighthq/flight/blob/9b49dee3f22f6b2838c3d237edcc77bca65734f2/LICENSE.md)
package/dist/updater.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { AppUpdateCheckOutcome, AppUpdateInstallOutcome, DownloadedUpdate, HasUpdaterCommand } from '@flighthq/types/contract';
2
- export declare function checkForAppUpdate(host: HasUpdaterCommand): Promise<AppUpdateCheckOutcome>;
3
- export declare function destroyUpdater(host: HasUpdaterCommand): void;
4
- export declare function installDownloadedUpdate(host: HasUpdaterCommand, update: DownloadedUpdate): Promise<AppUpdateInstallOutcome>;
1
+ import type { AppUpdateCheckOutcome, AppUpdateInstallOutcome, DownloadedUpdate, HostUpdaterCommandProvider } from '@flighthq/types/contract';
2
+ export declare function checkForAppUpdate(hostUpdaterCommand: Readonly<HostUpdaterCommandProvider>): Promise<AppUpdateCheckOutcome>;
3
+ export declare function destroyUpdater(hostUpdaterCommand: Readonly<HostUpdaterCommandProvider>): void;
4
+ export declare function installDownloadedUpdate(hostUpdaterCommand: Readonly<HostUpdaterCommandProvider>, update: DownloadedUpdate): Promise<AppUpdateInstallOutcome>;
5
5
  //# sourceMappingURL=updater.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAQlC,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuB/F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAE5D;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,uBAAuB,CAAC,CAelC"}
1
+ {"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAQlC,wBAAsB,iBAAiB,CACrC,kBAAkB,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GACvD,OAAO,CAAC,qBAAqB,CAAC,CAuBhC;AAED,wBAAgB,cAAc,CAAC,kBAAkB,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAAG,IAAI,CAE7F;AAED,wBAAsB,uBAAuB,CAC3C,kBAAkB,EAAE,QAAQ,CAAC,0BAA0B,CAAC,EACxD,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,uBAAuB,CAAC,CAelC"}
package/dist/updater.js CHANGED
@@ -3,10 +3,10 @@ const NOT_AVAILABLE = Object.freeze({ reason: 'not-available' });
3
3
  const OPERATION_FAILED = Object.freeze({ reason: 'operation-failed' });
4
4
  const INSTALL_OK = Object.freeze({ reason: 'ok' });
5
5
  const _downloadOwners = new WeakMap();
6
- export async function checkForAppUpdate(host) {
7
- const provider = host.updater.command;
6
+ export async function checkForAppUpdate(hostUpdaterCommand) {
7
+ const provider = hostUpdaterCommand;
8
8
  try {
9
- const outcome = await host.updater.command.check();
9
+ const outcome = await hostUpdaterCommand.check();
10
10
  switch (outcome.reason) {
11
11
  case 'check-in-progress':
12
12
  return CHECK_IN_PROGRESS;
@@ -29,17 +29,17 @@ export async function checkForAppUpdate(host) {
29
29
  return OPERATION_FAILED;
30
30
  }
31
31
  }
32
- export function destroyUpdater(host) {
33
- assertSyncVoid(host.updater.command.destroy());
32
+ export function destroyUpdater(hostUpdaterCommand) {
33
+ assertSyncVoid(hostUpdaterCommand.destroy());
34
34
  }
35
- export async function installDownloadedUpdate(host, update) {
35
+ export async function installDownloadedUpdate(hostUpdaterCommand, update) {
36
36
  const origin = _downloadOwners.get(update);
37
37
  if (origin === undefined)
38
38
  throw new TypeError('Downloaded update did not originate from a completed check');
39
39
  try {
40
- // Keep the direct Host capability path visible while still honoring the handle's exact origin after
40
+ // Keep the direct provider path visible while still honoring the handle's exact origin after
41
41
  // provider replacement. A different selected provider never observes the downloaded handle.
42
- const outcome = host.updater.command === origin ? await host.updater.command.install(update) : await origin.install(update);
42
+ const outcome = hostUpdaterCommand === origin ? await hostUpdaterCommand.install(update) : await origin.install(update);
43
43
  if (outcome.reason !== 'ok')
44
44
  return OPERATION_FAILED;
45
45
  _downloadOwners.delete(update);
@@ -1 +1 @@
1
- {"version":3,"file":"updater.js","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":"AAQA,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAA0B,CAAC;AAClG,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,CAA0B,CAAC;AAC1F,MAAM,gBAAgB,GAA6C,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,kBAA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,CAAC;QACH,6FAA6F;QAC7F,4FAA4F;QAC5F,MAAM,OAAO,GACX,kBAAkB,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1G,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO,gBAAgB,CAAC;QACrD,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,UAAU,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,gBAAgB,CAAC;IAC1B,CAAC;AACH,CAAC;AAGD,SAAS,cAAc,CAAI,KAA6E;IACtG,KAAK,KAAK,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/updater",
3
- "version": "0.5.1-next.1069.554a2ac",
3
+ "version": "0.5.1-next.1201.9b49dee",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/types": "0.5.1-next.1069.554a2ac"
41
+ "@flighthq/types": "0.5.1-next.1201.9b49dee"
42
42
  },
43
43
  "devDependencies": {
44
44
  "typescript": "^5.3.0"
@@ -3,15 +3,14 @@ import type {
3
3
  AppUpdateCheckOutcome,
4
4
  AppUpdateInstallOutcome,
5
5
  DownloadedUpdate,
6
- HasUpdaterCommand,
7
- UpdaterCommandBackend,
6
+ HostUpdaterCommandProvider,
8
7
  } from '@flighthq/types/contract';
9
8
 
10
9
  import * as updaterContract from './contract';
11
10
  import * as updaterPublic from './index';
12
11
  import { checkForAppUpdate, destroyUpdater, installDownloadedUpdate } from './updater';
13
12
 
14
- interface FakeBackend extends UpdaterCommandBackend {
13
+ interface FakeBackend extends HostUpdaterCommandProvider {
15
14
  readonly calls: {
16
15
  check: number;
17
16
  destroy: number;
@@ -56,7 +55,9 @@ function fakeBackend(
56
55
  };
57
56
  }
58
57
 
59
- function host(command: UpdaterCommandBackend): HasUpdaterCommand {
58
+ function host(command: HostUpdaterCommandProvider): {
59
+ readonly updater: { readonly command: HostUpdaterCommandProvider };
60
+ } {
60
61
  return { updater: { command } };
61
62
  }
62
63
 
@@ -64,7 +65,7 @@ describe('checkForAppUpdate', () => {
64
65
  it('awaits exactly one explicit Host updater check', async () => {
65
66
  const backend = fakeBackend({ reason: 'not-available' });
66
67
 
67
- await expect(checkForAppUpdate(host(backend))).resolves.toEqual({ reason: 'not-available' });
68
+ await expect(checkForAppUpdate(host(backend).updater.command)).resolves.toEqual({ reason: 'not-available' });
68
69
  expect(backend.calls.check).toBe(1);
69
70
  });
70
71
 
@@ -74,7 +75,7 @@ describe('checkForAppUpdate', () => {
74
75
  throw new Error('native detail must not leak through a portable outcome');
75
76
  };
76
77
 
77
- await expect(checkForAppUpdate(host(backend))).resolves.toEqual({ reason: 'operation-failed' });
78
+ await expect(checkForAppUpdate(host(backend).updater.command)).resolves.toEqual({ reason: 'operation-failed' });
78
79
  });
79
80
  });
80
81
 
@@ -83,7 +84,7 @@ describe('destroyUpdater', () => {
83
84
  const selected = fakeBackend();
84
85
  const other = fakeBackend();
85
86
 
86
- destroyUpdater(host(selected));
87
+ destroyUpdater(host(selected).updater.command);
87
88
 
88
89
  expect(selected.calls.destroy).toBe(1);
89
90
  expect(other.calls.destroy).toBe(0);
@@ -95,16 +96,20 @@ describe('installDownloadedUpdate', () => {
95
96
  const update = downloadedUpdate();
96
97
  const origin = fakeBackend({ reason: 'downloaded', update });
97
98
  const replacement = fakeBackend();
98
- const checked = await checkForAppUpdate(host(origin));
99
+ const checked = await checkForAppUpdate(host(origin).updater.command);
99
100
  if (checked.reason !== 'downloaded') throw new Error('expected downloaded update');
100
101
 
101
- await expect(installDownloadedUpdate(host(replacement), checked.update)).resolves.toEqual({ reason: 'ok' });
102
+ await expect(installDownloadedUpdate(host(replacement).updater.command, checked.update)).resolves.toEqual({
103
+ reason: 'ok',
104
+ });
102
105
  expect(origin.calls.install).toEqual([update]);
103
106
  expect(replacement.calls.install).toEqual([]);
104
107
  });
105
108
 
106
109
  it('rejects an update handle that did not originate from a completed check', async () => {
107
- await expect(installDownloadedUpdate(host(fakeBackend()), downloadedUpdate())).rejects.toThrow(TypeError);
110
+ await expect(installDownloadedUpdate(host(fakeBackend()).updater.command, downloadedUpdate())).rejects.toThrow(
111
+ TypeError,
112
+ );
108
113
  });
109
114
 
110
115
  it('exports only the reduced transaction surface from both entry points', () => {