@flighthq/entity 0.5.0-edge.1944.cd6b6e7 → 0.5.1-next.597.ab004dd

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/entity`. The `@fligh
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/entity@0.5.0-edge.1944.cd6b6e7](https://github.com/flighthq/flight/tree/cd6b6e71eb472b3a4249830a7743333f019fa7b7/packages/entity)
17
- - [License](https://github.com/flighthq/flight/blob/cd6b6e71eb472b3a4249830a7743333f019fa7b7/LICENSE.md)
16
+ - [Source for @flighthq/entity@0.5.1-next.597.ab004dd](https://github.com/flighthq/flight/tree/ab004ddc85b350cbd99a944e1e8108a016ae8af0/packages/entity)
17
+ - [License](https://github.com/flighthq/flight/blob/ab004ddc85b350cbd99a944e1e8108a016ae8af0/LICENSE.md)
@@ -3,5 +3,6 @@ export * from './clone';
3
3
  export * from './entity';
4
4
  export * from './enableEntityRuntimeGuards';
5
5
  export * from './guards';
6
+ export * from './host';
6
7
  export * from './runtime';
7
8
  //# sourceMappingURL=contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
package/dist/contract.js CHANGED
@@ -3,5 +3,6 @@ export * from './clone';
3
3
  export * from './entity';
4
4
  export * from './enableEntityRuntimeGuards';
5
5
  export * from './guards';
6
+ export * from './host';
6
7
  export * from './runtime';
7
8
  //# sourceMappingURL=contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { EntityWithoutRuntime, Host } from '@flighthq/types/contract';
2
+ export declare function createHost<Capabilities extends Partial<EntityWithoutRuntime<Host>>>(capabilities?: Readonly<Capabilities>): Host & Capabilities;
3
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAI3E,wBAAgB,UAAU,CAAC,YAAY,SAAS,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,EACjF,YAAY,GAAE,QAAQ,CAAC,YAAY,CAAsB,GACxD,IAAI,GAAG,YAAY,CA8BrB"}
package/dist/host.js ADDED
@@ -0,0 +1,33 @@
1
+ import { createEntity } from './entity';
2
+ export function createHost(capabilities = {}) {
3
+ return createEntity({
4
+ accessibility: {},
5
+ app: {},
6
+ clipboard: {},
7
+ connectivity: {},
8
+ dialog: {},
9
+ graphics: {},
10
+ input: {},
11
+ ipc: {},
12
+ media: {},
13
+ menu: {},
14
+ midi: {},
15
+ net: {},
16
+ notification: {},
17
+ power: {},
18
+ protocol: {},
19
+ screen: {},
20
+ share: {},
21
+ shell: {},
22
+ shortcut: {},
23
+ storage: {},
24
+ system: {},
25
+ text: {},
26
+ tray: {},
27
+ ui: {},
28
+ updater: {},
29
+ window: {},
30
+ ...capabilities,
31
+ });
32
+ }
33
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,UAAU,UAAU,CACxB,eAAuC,EAAkB;IAEzD,OAAO,YAAY,CAAC;QAClB,aAAa,EAAE,EAAE;QACjB,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,EAAE;QAChB,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,EAAE;QACP,YAAY,EAAE,EAAE;QAChB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,EAAE,EAAE,EAAE;QACN,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;QACV,GAAG,YAAY;KAChB,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/entity",
3
- "version": "0.5.0-edge.1944.cd6b6e7",
3
+ "version": "0.5.1-next.597.ab004dd",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/log": "0.5.0-edge.1944.cd6b6e7",
42
- "@flighthq/types": "0.5.0-edge.1944.cd6b6e7"
41
+ "@flighthq/log": "0.5.1-next.597.ab004dd",
42
+ "@flighthq/types": "0.5.1-next.597.ab004dd"
43
43
  },
44
44
  "devDependencies": {
45
45
  "typescript": "^5.3.0"
@@ -0,0 +1,71 @@
1
+ import { EntityRuntimeKey } from '@flighthq/types/contract';
2
+
3
+ import * as entity from './contract';
4
+
5
+ const HOST_GROUPS = [
6
+ 'accessibility',
7
+ 'app',
8
+ 'clipboard',
9
+ 'connectivity',
10
+ 'dialog',
11
+ 'graphics',
12
+ 'input',
13
+ 'ipc',
14
+ 'media',
15
+ 'menu',
16
+ 'midi',
17
+ 'net',
18
+ 'notification',
19
+ 'power',
20
+ 'protocol',
21
+ 'screen',
22
+ 'share',
23
+ 'shell',
24
+ 'shortcut',
25
+ 'storage',
26
+ 'system',
27
+ 'text',
28
+ 'tray',
29
+ 'ui',
30
+ 'updater',
31
+ 'window',
32
+ ] as const;
33
+
34
+ describe('createHost', () => {
35
+ it('creates an Entity immediately while leaving its runtime allocation lazy', () => {
36
+ const host = requiredFunction(entity, 'createHost')();
37
+
38
+ expect(EntityRuntimeKey in host).toBe(true);
39
+ expect(host[EntityRuntimeKey]).toBeUndefined();
40
+ });
41
+
42
+ it('materializes the complete stable Host shape with truthful empty groups', () => {
43
+ const host = requiredFunction(entity, 'createHost')();
44
+
45
+ expect(
46
+ Object.keys(host)
47
+ .filter((key) => key !== String(EntityRuntimeKey))
48
+ .sort(),
49
+ ).toEqual(HOST_GROUPS);
50
+ for (const group of HOST_GROUPS) expect(host[group]).toEqual({});
51
+ });
52
+
53
+ it('preserves supplied capability-group and provider identities without populating another group', () => {
54
+ const provider = {};
55
+ const accessibility = { provider };
56
+ const host = requiredFunction(entity, 'createHost')({ accessibility });
57
+
58
+ expect(host.accessibility).toBe(accessibility);
59
+ expect(host.accessibility.provider).toBe(provider);
60
+ for (const group of HOST_GROUPS) {
61
+ if (group !== 'accessibility') expect(host[group]).toEqual({});
62
+ }
63
+ });
64
+ });
65
+
66
+ function requiredFunction(module: object, name: string): (...args: any[]) => any {
67
+ const value = Reflect.get(module, name);
68
+ expect(value, `${name} export`).toBeTypeOf('function');
69
+ if (typeof value !== 'function') throw new TypeError(`${name} is not exported`);
70
+ return value as (...args: any[]) => any;
71
+ }