@flighthq/host-electron 0.5.1-next.920.da8f530 → 0.6.0

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 (137) hide show
  1. package/README.md +2 -2
  2. package/dist/contract.d.ts +19 -24
  3. package/dist/contract.d.ts.map +1 -1
  4. package/dist/contract.js +18 -24
  5. package/dist/contract.js.map +1 -1
  6. package/dist/electronApp.d.ts +62 -34
  7. package/dist/electronApp.d.ts.map +1 -1
  8. package/dist/electronApp.js +175 -234
  9. package/dist/electronApp.js.map +1 -1
  10. package/dist/electronClipboard.d.ts +7 -5
  11. package/dist/electronClipboard.d.ts.map +1 -1
  12. package/dist/electronClipboard.js +91 -66
  13. package/dist/electronClipboard.js.map +1 -1
  14. package/dist/electronDefaultHostGroups.d.ts +59 -0
  15. package/dist/electronDefaultHostGroups.d.ts.map +1 -0
  16. package/dist/electronDefaultHostGroups.js +109 -0
  17. package/dist/electronDefaultHostGroups.js.map +1 -0
  18. package/dist/electronDialog.d.ts +12 -9
  19. package/dist/electronDialog.d.ts.map +1 -1
  20. package/dist/electronDialog.js +28 -21
  21. package/dist/electronDialog.js.map +1 -1
  22. package/dist/electronIpc.d.ts +13 -11
  23. package/dist/electronIpc.d.ts.map +1 -1
  24. package/dist/electronIpc.js +32 -26
  25. package/dist/electronIpc.js.map +1 -1
  26. package/dist/electronMenu.d.ts +12 -6
  27. package/dist/electronMenu.d.ts.map +1 -1
  28. package/dist/electronMenu.js +41 -30
  29. package/dist/electronMenu.js.map +1 -1
  30. package/dist/electronMenuTemplate.d.ts +2 -1
  31. package/dist/electronMenuTemplate.d.ts.map +1 -1
  32. package/dist/electronMenuTemplate.js.map +1 -1
  33. package/dist/electronNotification.d.ts +25 -7
  34. package/dist/electronNotification.d.ts.map +1 -1
  35. package/dist/electronNotification.js +39 -16
  36. package/dist/electronNotification.js.map +1 -1
  37. package/dist/electronPlatform.d.ts +5 -3
  38. package/dist/electronPlatform.d.ts.map +1 -1
  39. package/dist/electronPlatform.js +9 -7
  40. package/dist/electronPlatform.js.map +1 -1
  41. package/dist/electronPower.d.ts +22 -11
  42. package/dist/electronPower.d.ts.map +1 -1
  43. package/dist/electronPower.js +48 -59
  44. package/dist/electronPower.js.map +1 -1
  45. package/dist/electronProtocol.d.ts +16 -8
  46. package/dist/electronProtocol.d.ts.map +1 -1
  47. package/dist/electronProtocol.js +45 -28
  48. package/dist/electronProtocol.js.map +1 -1
  49. package/dist/electronRegister.d.ts +5 -7
  50. package/dist/electronRegister.d.ts.map +1 -1
  51. package/dist/electronRegister.js +72 -99
  52. package/dist/electronRegister.js.map +1 -1
  53. package/dist/electronScreen.d.ts +7 -6
  54. package/dist/electronScreen.d.ts.map +1 -1
  55. package/dist/electronScreen.js +17 -14
  56. package/dist/electronScreen.js.map +1 -1
  57. package/dist/electronShell.d.ts +16 -8
  58. package/dist/electronShell.d.ts.map +1 -1
  59. package/dist/electronShell.js +50 -43
  60. package/dist/electronShell.js.map +1 -1
  61. package/dist/electronShortcut.d.ts +6 -4
  62. package/dist/electronShortcut.d.ts.map +1 -1
  63. package/dist/electronShortcut.js +16 -10
  64. package/dist/electronShortcut.js.map +1 -1
  65. package/dist/electronStorage.d.ts +5 -3
  66. package/dist/electronStorage.d.ts.map +1 -1
  67. package/dist/electronStorage.js +9 -7
  68. package/dist/electronStorage.js.map +1 -1
  69. package/dist/electronTray.d.ts +38 -21
  70. package/dist/electronTray.d.ts.map +1 -1
  71. package/dist/electronTray.js +110 -76
  72. package/dist/electronTray.js.map +1 -1
  73. package/dist/electronUpdater.d.ts +6 -3
  74. package/dist/electronUpdater.d.ts.map +1 -1
  75. package/dist/electronUpdater.js +10 -7
  76. package/dist/electronUpdater.js.map +1 -1
  77. package/dist/electronWindow.d.ts +23 -7
  78. package/dist/electronWindow.d.ts.map +1 -1
  79. package/dist/electronWindow.js +234 -152
  80. package/dist/electronWindow.js.map +1 -1
  81. package/dist/index.d.ts +19 -1
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +18 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/types/ElectronApi.d.ts +393 -0
  86. package/dist/types/ElectronApi.d.ts.map +1 -0
  87. package/dist/types/ElectronApi.js +20 -0
  88. package/dist/types/ElectronApi.js.map +1 -0
  89. package/dist/types/ElectronAppCapabilitiesFor.d.ts +8 -0
  90. package/dist/types/ElectronAppCapabilitiesFor.d.ts.map +1 -0
  91. package/dist/types/ElectronAppCapabilitiesFor.js +2 -0
  92. package/dist/types/ElectronAppCapabilitiesFor.js.map +1 -0
  93. package/dist/types/ElectronHost.d.ts +43 -0
  94. package/dist/types/ElectronHost.d.ts.map +1 -0
  95. package/dist/types/ElectronHost.js +2 -0
  96. package/dist/types/ElectronHost.js.map +1 -0
  97. package/dist/types/ElectronHostGroups.d.ts +85 -0
  98. package/dist/types/ElectronHostGroups.d.ts.map +1 -0
  99. package/dist/types/ElectronHostGroups.js +2 -0
  100. package/dist/types/ElectronHostGroups.js.map +1 -0
  101. package/dist/types/ElectronHostOptions.d.ts +7 -0
  102. package/dist/types/ElectronHostOptions.d.ts.map +1 -0
  103. package/dist/types/ElectronHostOptions.js +2 -0
  104. package/dist/types/ElectronHostOptions.js.map +1 -0
  105. package/dist/types/ElectronProtocolCapabilities.d.ts +3 -0
  106. package/dist/types/ElectronProtocolCapabilities.d.ts.map +1 -0
  107. package/dist/types/ElectronProtocolCapabilities.js +2 -0
  108. package/dist/types/ElectronProtocolCapabilities.js.map +1 -0
  109. package/dist/types/ElectronTrayCapabilitiesFor.d.ts +7 -0
  110. package/dist/types/ElectronTrayCapabilitiesFor.d.ts.map +1 -0
  111. package/dist/types/ElectronTrayCapabilitiesFor.js +2 -0
  112. package/dist/types/ElectronTrayCapabilitiesFor.js.map +1 -0
  113. package/dist/types/index.d.ts +7 -0
  114. package/dist/types/index.d.ts.map +1 -0
  115. package/dist/types/index.js +7 -0
  116. package/dist/types/index.js.map +1 -0
  117. package/package.json +42 -21
  118. package/src/electronApp.test.ts +158 -131
  119. package/src/electronClipboard.test.ts +40 -13
  120. package/src/electronDefaultHostGroups.test.ts +148 -0
  121. package/src/electronDialog.test.ts +55 -53
  122. package/src/electronHostTreeShaking.test.ts +51 -0
  123. package/src/electronIpc.test.ts +47 -66
  124. package/src/electronMenu.test.ts +61 -47
  125. package/src/electronMenuTemplate.test.ts +1 -1
  126. package/src/electronNotification.test.ts +71 -21
  127. package/src/electronPlatform.test.ts +17 -12
  128. package/src/electronPower.test.ts +112 -88
  129. package/src/electronProtocol.test.ts +68 -35
  130. package/src/electronRegister.test.ts +280 -26
  131. package/src/electronScreen.test.ts +34 -25
  132. package/src/electronShell.test.ts +99 -59
  133. package/src/electronShortcut.test.ts +22 -19
  134. package/src/electronStorage.test.ts +26 -24
  135. package/src/electronTray.test.ts +225 -109
  136. package/src/electronUpdater.test.ts +26 -19
  137. package/src/electronWindow.test.ts +229 -101
@@ -1,14 +1,16 @@
1
- import type { MenuApplicationBackend, MenuPopupBackend, MenuSelectBackend } from '@flighthq/types/contract';
2
- import type { ElectronApi, ElectronMenu, ElectronMenuItemOptions } from '@flighthq/types/contract';
3
- import { EntityRuntimeKey } from '@flighthq/types/contract';
1
+ import type { HostAppMenuCapability, HostMenuPopupCapability, HostMenuSelectCapability } from '@flighthq/menu/contract';
4
2
 
5
3
  import {
6
- createElectronMenuBackends,
7
- initializeElectronMenuCapabilities,
8
- initializeMenuApplicationBackend,
9
- initializeMenuPopupBackend,
10
- initializeMenuSelectBackend,
11
- } from './electronMenu';
4
+ electronHostMenu,
5
+ electronHostAppMenu,
6
+ electronHostMenuPopup,
7
+ electronHostMenuSelect,
8
+ populateElectronHostMenu,
9
+ populateElectronHostAppMenu,
10
+ populateElectronHostMenuPopup,
11
+ populateElectronHostMenuSelect,
12
+ } from './electronMenu.ts';
13
+ import type { ElectronApi, ElectronMenu, ElectronMenuItemOptions } from './types/index.ts';
12
14
 
13
15
  function fakeElectron(): {
14
16
  electron: ElectronApi;
@@ -54,20 +56,36 @@ function clickItem(built: ElectronMenuItemOptions[][], id: string): void {
54
56
  item?.click?.();
55
57
  }
56
58
 
57
- describe('createElectronMenuBackends', () => {
58
- it('returns an Entity-composed capability bundle and providers', () => {
59
- const capabilities = createElectronMenuBackends(fakeElectron().electron);
60
- expect(EntityRuntimeKey in capabilities).toBe(true);
61
- for (const provider of Object.values(capabilities)) expect(EntityRuntimeKey in provider).toBe(true);
59
+ describe('electronHostAppMenu', () => {
60
+ it('constructs an app menu provider', () => {
61
+ expect(electronHostAppMenu(fakeElectron().electron)).toBeDefined();
62
62
  });
63
+ });
64
+ // The merged MenuBackend is gone; these tests exercise the three slots that replaced it. This helper
65
+ // recomposes the old surface so each assertion still names the operation it is really testing.
66
+ function _slots(api: ElectronApi): {
67
+ destroy?: () => void;
68
+ popupContextMenu: HostMenuPopupCapability['popup'];
69
+ setAppMenu: HostAppMenuCapability['setAppMenu'];
70
+ subscribeSelect: HostMenuSelectCapability['subscribe'];
71
+ } {
72
+ const { app, popup, select } = electronHostMenu(api);
73
+ return {
74
+ destroy: app.destroy?.bind(app),
75
+ popupContextMenu: popup.popup,
76
+ setAppMenu: app.setAppMenu,
77
+ subscribeSelect: select.subscribe,
78
+ };
79
+ }
63
80
 
81
+ describe('electronHostMenu', () => {
64
82
  it('builds and applies the application menu and reports clicks via subscribeSelect', () => {
65
83
  const { electron, built, applied } = fakeElectron();
66
84
  const backend = _slots(electron);
67
85
  const seen: string[] = [];
68
86
  backend.subscribeSelect((id: string) => seen.push(id));
69
87
  expect(
70
- backend.setApplicationMenu([
88
+ backend.setAppMenu([
71
89
  { id: 'open', label: 'Open' },
72
90
  { label: 'Edit', submenu: [{ id: 'copy', label: 'Copy' }] },
73
91
  ]),
@@ -83,7 +101,7 @@ describe('createElectronMenuBackends', () => {
83
101
  const backend = _slots(electron);
84
102
  const seen: string[] = [];
85
103
  const unsubscribe = backend.subscribeSelect((id: string) => seen.push(id));
86
- backend.setApplicationMenu([{ id: 'a', label: 'A' }]);
104
+ backend.setAppMenu([{ id: 'a', label: 'A' }]);
87
105
  unsubscribe();
88
106
  clickItem(built, 'a');
89
107
  expect(seen).toEqual([]);
@@ -92,7 +110,7 @@ describe('createElectronMenuBackends', () => {
92
110
  it('clears the native application menu on destroy', () => {
93
111
  const { electron, applied } = fakeElectron();
94
112
  const backend = _slots(electron);
95
- backend.setApplicationMenu([{ id: 'a', label: 'A' }]);
113
+ backend.setAppMenu([{ id: 'a', label: 'A' }]);
96
114
  expect(applied.length).toBe(1);
97
115
  backend.destroy?.();
98
116
  expect(applied.length).toBe(2);
@@ -102,7 +120,7 @@ describe('createElectronMenuBackends', () => {
102
120
  it('clears the native application menu exactly once on double destroy', () => {
103
121
  const { electron, applied } = fakeElectron();
104
122
  const backend = _slots(electron);
105
- backend.setApplicationMenu([{ id: 'a', label: 'A' }]);
123
+ backend.setAppMenu([{ id: 'a', label: 'A' }]);
106
124
  expect(applied.length).toBe(1);
107
125
  backend.destroy?.();
108
126
  backend.destroy?.();
@@ -118,7 +136,7 @@ describe('createElectronMenuBackends', () => {
118
136
  const backend = _slots(electron);
119
137
  const seen: string[] = [];
120
138
  const unsubscribe = backend.subscribeSelect((id: string) => seen.push(id));
121
- backend.setApplicationMenu([{ id: 'a', label: 'A' }]);
139
+ backend.setAppMenu([{ id: 'a', label: 'A' }]);
122
140
  backend.destroy?.();
123
141
  clickItem(built, 'a');
124
142
  expect(seen).toEqual(['a']);
@@ -139,42 +157,38 @@ describe('createElectronMenuBackends', () => {
139
157
  });
140
158
  });
141
159
 
142
- // The merged MenuBackend is gone; these tests exercise the three slots that replaced it. This helper
143
- // recomposes the old surface so each assertion still names the operation it is really testing.
144
- function _slots(api: ElectronApi): {
145
- destroy?: () => void;
146
- popupContextMenu: MenuPopupBackend['popup'];
147
- setApplicationMenu: MenuApplicationBackend['setApplicationMenu'];
148
- subscribeSelect: MenuSelectBackend['subscribe'];
149
- } {
150
- const { application, popup, select } = createElectronMenuBackends(api);
151
- return {
152
- destroy: application.destroy?.bind(application),
153
- popupContextMenu: popup.popup,
154
- setApplicationMenu: application.setApplicationMenu,
155
- subscribeSelect: select.subscribe,
156
- };
157
- }
158
- describe('initializeElectronMenuCapabilities', () => {
159
- it('is the construction initializer of createElectronMenuCapabilities', () => {
160
- expect(typeof initializeElectronMenuCapabilities).toBe('function');
160
+ describe('electronHostMenuPopup', () => {
161
+ it('constructs a menu popup provider', () => {
162
+ expect(electronHostMenuPopup(fakeElectron().electron)).toBeDefined();
163
+ });
164
+ });
165
+
166
+ describe('electronHostMenuSelect', () => {
167
+ it('constructs a menu select provider', () => {
168
+ expect(electronHostMenuSelect()).toBeDefined();
169
+ });
170
+ });
171
+
172
+ describe('populateElectronHostAppMenu', () => {
173
+ it('is the construction initializer of electronHostMenuApplication', () => {
174
+ expect(typeof populateElectronHostAppMenu).toBe('function');
161
175
  });
162
176
  });
163
177
 
164
- describe('initializeMenuApplicationBackend', () => {
165
- it('is the construction initializer of createMenuApplicationBackend', () => {
166
- expect(typeof initializeMenuApplicationBackend).toBe('function');
178
+ describe('populateElectronHostMenu', () => {
179
+ it('is the construction initializer of electronHostMenu', () => {
180
+ expect(typeof populateElectronHostMenu).toBe('function');
167
181
  });
168
182
  });
169
183
 
170
- describe('initializeMenuPopupBackend', () => {
171
- it('is the construction initializer of createMenuPopupBackend', () => {
172
- expect(typeof initializeMenuPopupBackend).toBe('function');
184
+ describe('populateElectronHostMenuPopup', () => {
185
+ it('is the construction initializer of electronHostMenuPopup', () => {
186
+ expect(typeof populateElectronHostMenuPopup).toBe('function');
173
187
  });
174
188
  });
175
189
 
176
- describe('initializeMenuSelectBackend', () => {
177
- it('is the construction initializer of createMenuSelectBackend', () => {
178
- expect(typeof initializeMenuSelectBackend).toBe('function');
190
+ describe('populateElectronHostMenuSelect', () => {
191
+ it('is the construction initializer of electronHostMenuSelect', () => {
192
+ expect(typeof populateElectronHostMenuSelect).toBe('function');
179
193
  });
180
194
  });
@@ -1,4 +1,4 @@
1
- import { toElectronTemplate } from './electronMenuTemplate';
1
+ import { toElectronTemplate } from './electronMenuTemplate.ts';
2
2
 
3
3
  describe('toElectronTemplate', () => {
4
4
  it('maps Flight roles and omits unsupported custom roles', () => {
@@ -1,12 +1,20 @@
1
+ import { EntityRuntimeKey } from '@flighthq/entity/contract';
1
2
  import { closeNotification } from '@flighthq/notification/contract';
2
- import { EntityRuntimeKey } from '@flighthq/types/contract';
3
- import type { ElectronApi, ElectronNotificationOptions } from '@flighthq/types/contract';
4
3
 
5
4
  import {
6
- createElectronNotificationCapabilities,
7
- initializeElectronMacosNotificationCapabilities,
8
- initializeElectronNotificationCapabilities,
9
- } from './electronNotification';
5
+ electronHostNotification,
6
+ electronHostNotificationAction,
7
+ electronHostNotificationClick,
8
+ electronHostNotificationClose,
9
+ electronHostNotificationDelivery,
10
+ electronHostNotificationDismiss,
11
+ electronHostNotificationLifecycle,
12
+ electronHostNotificationReceived,
13
+ electronHostNotificationReply,
14
+ populateElectronHostNotificationMacos,
15
+ populateElectronHostNotificationCommon,
16
+ } from './electronNotification.ts';
17
+ import type { ElectronApi, ElectronNotificationOptions } from './types/index.ts';
10
18
 
11
19
  interface FakeNotification {
12
20
  close(): void;
@@ -38,20 +46,29 @@ function fakeElectron(supported = true) {
38
46
  return { electron, notifications };
39
47
  }
40
48
 
41
- describe('createElectronNotificationCapabilities', () => {
49
+ function notificationLeaf(factory: () => object): () => void {
50
+ return () => {
51
+ it('constructs a plain frozen notification provider without Entity', () => {
52
+ expect(EntityRuntimeKey in factory()).toBe(false);
53
+ });
54
+ };
55
+ }
56
+
57
+ describe('electronHostNotification', () => {
42
58
  it.each([
43
59
  ['macos', ['action', 'click', 'close', 'delivery', 'dismiss', 'lifecycle', 'received', 'reply']],
44
60
  ['windows', ['click', 'close', 'delivery', 'dismiss', 'lifecycle', 'received']],
45
61
  ['linux', ['click', 'close', 'delivery', 'dismiss', 'lifecycle', 'received']],
46
62
  ] as const)('constructs the exact %s profile', (platform, expected) => {
47
- const capabilities = createElectronNotificationCapabilities(fakeElectron().electron, { platform });
48
- expect(EntityRuntimeKey in capabilities).toBe(true);
63
+ const capabilities = electronHostNotification(fakeElectron().electron, { platform });
64
+ expect(EntityRuntimeKey in capabilities).toBe(false);
49
65
  expect(Object.keys(capabilities).sort()).toEqual(expected);
66
+ for (const provider of Object.values(capabilities)) expect(EntityRuntimeKey in provider).toBe(false);
50
67
  expect('permission' in capabilities).toBe(false);
51
68
  });
52
69
 
53
70
  it('rejects Darwin-only actions on Windows instead of dropping them', async () => {
54
- const capabilities = createElectronNotificationCapabilities(fakeElectron().electron, { platform: 'windows' });
71
+ const capabilities = electronHostNotification(fakeElectron().electron, { platform: 'windows' });
55
72
  await expect(
56
73
  capabilities.delivery.notify({
57
74
  actions: [{ id: 'open', title: 'Open' }],
@@ -62,7 +79,7 @@ describe('createElectronNotificationCapabilities', () => {
62
79
 
63
80
  it('publishes only after the native show event', async () => {
64
81
  const { electron, notifications } = fakeElectron();
65
- const capabilities = createElectronNotificationCapabilities(electron, {
82
+ const capabilities = electronHostNotification(electron, {
66
83
  platform: 'linux',
67
84
  });
68
85
  let show: (() => void) | null = null;
@@ -103,7 +120,7 @@ describe('createElectronNotificationCapabilities', () => {
103
120
  },
104
121
  { isSupported: () => true },
105
122
  ) as unknown as ElectronApi['Notification'];
106
- const capabilities = createElectronNotificationCapabilities(electron, {
123
+ const capabilities = electronHostNotification(electron, {
107
124
  platform: 'linux',
108
125
  });
109
126
  await expect(capabilities.delivery.notify({ id: 'ghost', title: 'Ghost' })).resolves.toEqual({
@@ -119,7 +136,7 @@ describe('createElectronNotificationCapabilities', () => {
119
136
 
120
137
  it('maps Darwin action/reply and all-platform click/dismiss/received to one Entity', async () => {
121
138
  const { electron, notifications } = fakeElectron();
122
- const capabilities = createElectronNotificationCapabilities(electron, {
139
+ const capabilities = electronHostNotification(electron, {
123
140
  platform: 'macos',
124
141
  });
125
142
  const seen: string[] = [];
@@ -145,7 +162,7 @@ describe('createElectronNotificationCapabilities', () => {
145
162
 
146
163
  it('pins close to the returned Entity', async () => {
147
164
  const { electron, notifications } = fakeElectron();
148
- const capabilities = createElectronNotificationCapabilities(electron, {
165
+ const capabilities = electronHostNotification(electron, {
149
166
  platform: 'linux',
150
167
  });
151
168
  const delivered = await capabilities.delivery.notify({
@@ -168,7 +185,7 @@ describe('createElectronNotificationCapabilities', () => {
168
185
 
169
186
  it('attempts all live closes and retries only failures', async () => {
170
187
  const { electron, notifications } = fakeElectron();
171
- const capabilities = createElectronNotificationCapabilities(electron, {
188
+ const capabilities = electronHostNotification(electron, {
172
189
  platform: 'linux',
173
190
  });
174
191
  await capabilities.delivery.notify({ id: 'first', title: 'First' });
@@ -190,14 +207,47 @@ describe('createElectronNotificationCapabilities', () => {
190
207
  expect(secondCloses).toBe(2);
191
208
  });
192
209
  });
193
- describe('initializeElectronMacosNotificationCapabilities', () => {
194
- it('is the construction initializer of createElectronMacosNotificationCapabilities', () => {
195
- expect(typeof initializeElectronMacosNotificationCapabilities).toBe('function');
210
+ const notificationAction = notificationLeaf(() =>
211
+ electronHostNotificationAction(fakeElectron().electron, { platform: 'macos' }),
212
+ );
213
+ const notificationClick = notificationLeaf(() =>
214
+ electronHostNotificationClick(fakeElectron().electron, { platform: 'linux' }),
215
+ );
216
+ const notificationClose = notificationLeaf(() =>
217
+ electronHostNotificationClose(fakeElectron().electron, { platform: 'linux' }),
218
+ );
219
+ const notificationDelivery = notificationLeaf(() =>
220
+ electronHostNotificationDelivery(fakeElectron().electron, { platform: 'linux' }),
221
+ );
222
+ const notificationDismiss = notificationLeaf(() =>
223
+ electronHostNotificationDismiss(fakeElectron().electron, { platform: 'linux' }),
224
+ );
225
+ const notificationLifecycle = notificationLeaf(() =>
226
+ electronHostNotificationLifecycle(fakeElectron().electron, { platform: 'linux' }),
227
+ );
228
+ const notificationReceived = notificationLeaf(() =>
229
+ electronHostNotificationReceived(fakeElectron().electron, { platform: 'linux' }),
230
+ );
231
+ const notificationReply = notificationLeaf(() =>
232
+ electronHostNotificationReply(fakeElectron().electron, { platform: 'macos' }),
233
+ );
234
+
235
+ describe('electronHostNotificationAction', notificationAction);
236
+ describe('electronHostNotificationClick', notificationClick);
237
+ describe('electronHostNotificationClose', notificationClose);
238
+ describe('electronHostNotificationDelivery', notificationDelivery);
239
+ describe('electronHostNotificationDismiss', notificationDismiss);
240
+ describe('electronHostNotificationLifecycle', notificationLifecycle);
241
+ describe('electronHostNotificationReceived', notificationReceived);
242
+ describe('electronHostNotificationReply', notificationReply);
243
+ describe('populateElectronHostNotificationCommon', () => {
244
+ it('is the construction initializer of electronHostNotification', () => {
245
+ expect(typeof populateElectronHostNotificationCommon).toBe('function');
196
246
  });
197
247
  });
198
248
 
199
- describe('initializeElectronNotificationCapabilities', () => {
200
- it('is the construction initializer of createElectronNotificationCapabilities', () => {
201
- expect(typeof initializeElectronNotificationCapabilities).toBe('function');
249
+ describe('populateElectronHostNotificationMacos', () => {
250
+ it('is the construction initializer of electronHostNotification', () => {
251
+ expect(typeof populateElectronHostNotificationMacos).toBe('function');
202
252
  });
203
253
  });
@@ -1,7 +1,7 @@
1
- import type { PlatformInfo, ElectronApi } from '@flighthq/types/contract';
2
- import { EntityRuntimeKey } from '@flighthq/types/contract';
1
+ import type { PlatformInfo } from '@flighthq/platform/contract';
3
2
 
4
- import { createElectronPlatformBackend, initializeElectronPlatformBackend } from './electronPlatform';
3
+ import { electronHostPlatform, electronHostPlatformGroup, populateElectronHostPlatform } from './electronPlatform.ts';
4
+ import type { ElectronApi } from './types/index.ts';
5
5
 
6
6
  function fakeElectron(): ElectronApi {
7
7
  return {
@@ -11,13 +11,9 @@ function fakeElectron(): ElectronApi {
11
11
  } as unknown as ElectronApi;
12
12
  }
13
13
 
14
- describe('createElectronPlatformBackend', () => {
15
- it('returns an Entity', () => {
16
- expect(EntityRuntimeKey in createElectronPlatformBackend(fakeElectron())).toBe(true);
17
- });
18
-
14
+ describe('electronHostPlatform', () => {
19
15
  it('fills platform info from process and electron locale', () => {
20
- const backend = createElectronPlatformBackend(fakeElectron());
16
+ const backend = electronHostPlatform(fakeElectron());
21
17
  const out = {} as PlatformInfo;
22
18
  const result = backend.getInfo(out);
23
19
  expect(result).toBe(out);
@@ -30,8 +26,17 @@ describe('createElectronPlatformBackend', () => {
30
26
  expect(typeof out.version).toBe('string');
31
27
  });
32
28
  });
33
- describe('initializeElectronPlatformBackend', () => {
34
- it('is the construction initializer of createElectronPlatformBackend', () => {
35
- expect(typeof initializeElectronPlatformBackend).toBe('function');
29
+
30
+ describe('electronHostPlatformGroup', () => {
31
+ it('constructs the platform info slot', () => {
32
+ const platform = electronHostPlatformGroup(fakeElectron());
33
+ expect(Object.keys(platform)).toEqual(['info']);
34
+ expect(platform.info.getInfo).toBeTypeOf('function');
35
+ });
36
+ });
37
+
38
+ describe('populateElectronHostPlatform', () => {
39
+ it('is the construction initializer of electronHostPlatform', () => {
40
+ expect(typeof populateElectronHostPlatform).toBe('function');
36
41
  });
37
42
  });