@glassly/miniapp 0.3.1-beta.551 → 0.3.1-beta.561

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.
@@ -1,15 +1,8 @@
1
- /**
2
- * The vocabulary of `miniapp.json`: what a manifest may declare under
3
- * `permissions` and `hardwareRequirements`. The engine types its manifest
4
- * against these and the CLI validates with them, so an entry added here
5
- * reaches both without a hand-copied list.
6
- */
7
- import { HardwareRequirementLevel, HardwareType } from "./hardware";
8
1
  export declare const MANIFEST_PERMISSION_TYPES: readonly ["MICROPHONE", "CAMERA", "CALENDAR", "LOCATION", "BACKGROUND_LOCATION", "READ_NOTIFICATIONS", "DISPLAY_MIRROR", "POST_NOTIFICATIONS", "API_KEYS", "MEMORY", "AI", "SPEAKERS", "MANAGE_MINIAPPS", "PLATFORM_SETTINGS"];
9
2
  export type ManifestPermissionType = (typeof MANIFEST_PERMISSION_TYPES)[number];
10
3
  /** Every hardware type an author may declare. EXIST is implied by the host. */
11
- export declare const MANIFEST_HARDWARE_TYPES: readonly [HardwareType.CAMERA, HardwareType.DISPLAY, HardwareType.MICROPHONE, HardwareType.SPEAKER, HardwareType.IMU, HardwareType.BUTTON, HardwareType.LIGHT, HardwareType.WIFI];
4
+ export declare const MANIFEST_HARDWARE_TYPES: readonly ["CAMERA", "DISPLAY", "MICROPHONE", "SPEAKER", "IMU", "BUTTON", "LIGHT", "WIFI"];
12
5
  export type ManifestHardwareType = (typeof MANIFEST_HARDWARE_TYPES)[number];
13
- export declare const MANIFEST_HARDWARE_LEVELS: readonly [HardwareRequirementLevel.REQUIRED, HardwareRequirementLevel.OPTIONAL];
6
+ export declare const MANIFEST_HARDWARE_LEVELS: readonly ["REQUIRED", "OPTIONAL"];
14
7
  export type ManifestHardwareLevel = (typeof MANIFEST_HARDWARE_LEVELS)[number];
15
8
  //# sourceMappingURL=manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,wBAAwB,EAAE,YAAY,EAAC,MAAM,YAAY,CAAA;AAEjE,eAAO,MAAM,yBAAyB,gOAe5B,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/E,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,mLAS1B,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,eAAO,MAAM,wBAAwB,iFAAkF,CAAA;AAEvH,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,yBAAyB,gOAe5B,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/E,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,2FAA4F,CAAA;AAEhI,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,eAAO,MAAM,wBAAwB,mCAAoC,CAAA;AAEzE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA"}
package/dist/manifest.js CHANGED
@@ -1,10 +1,3 @@
1
- /**
2
- * The vocabulary of `miniapp.json`: what a manifest may declare under
3
- * `permissions` and `hardwareRequirements`. The engine types its manifest
4
- * against these and the CLI validates with them, so an entry added here
5
- * reaches both without a hand-copied list.
6
- */
7
- import { HardwareRequirementLevel, HardwareType } from "./hardware";
8
1
  export const MANIFEST_PERMISSION_TYPES = [
9
2
  "MICROPHONE",
10
3
  "CAMERA",
@@ -22,15 +15,10 @@ export const MANIFEST_PERMISSION_TYPES = [
22
15
  "PLATFORM_SETTINGS",
23
16
  ];
24
17
  /** Every hardware type an author may declare. EXIST is implied by the host. */
25
- export const MANIFEST_HARDWARE_TYPES = [
26
- HardwareType.CAMERA,
27
- HardwareType.DISPLAY,
28
- HardwareType.MICROPHONE,
29
- HardwareType.SPEAKER,
30
- HardwareType.IMU,
31
- HardwareType.BUTTON,
32
- HardwareType.LIGHT,
33
- HardwareType.WIFI,
34
- ];
35
- export const MANIFEST_HARDWARE_LEVELS = [HardwareRequirementLevel.REQUIRED, HardwareRequirementLevel.OPTIONAL];
18
+ export const MANIFEST_HARDWARE_TYPES = ["CAMERA", "DISPLAY", "MICROPHONE", "SPEAKER", "IMU", "BUTTON", "LIGHT", "WIFI"];
19
+ export const MANIFEST_HARDWARE_LEVELS = ["REQUIRED", "OPTIONAL"];
20
+ const hardwareTypesMatchEnum = true;
21
+ const hardwareLevelsMatchEnum = true;
22
+ void hardwareTypesMatchEnum;
23
+ void hardwareLevelsMatchEnum;
36
24
  //# sourceMappingURL=manifest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,wBAAwB,EAAE,YAAY,EAAC,MAAM,YAAY,CAAA;AAEjE,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,UAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,gBAAgB;IAChB,oBAAoB;IACpB,UAAU;IACV,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,iBAAiB;IACjB,mBAAmB;CACX,CAAA;AAIV,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,YAAY,CAAC,MAAM;IACnB,YAAY,CAAC,OAAO;IACpB,YAAY,CAAC,UAAU;IACvB,YAAY,CAAC,OAAO;IACpB,YAAY,CAAC,GAAG;IAChB,YAAY,CAAC,MAAM;IACnB,YAAY,CAAC,KAAK;IAClB,YAAY,CAAC,IAAI;CACT,CAAA;AAIV,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,wBAAwB,CAAC,QAAQ,EAAE,wBAAwB,CAAC,QAAQ,CAAU,CAAA"}
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,UAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,gBAAgB;IAChB,oBAAoB;IACpB,UAAU;IACV,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,iBAAiB;IACjB,mBAAmB;CACX,CAAA;AAIV,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAU,CAAA;AAIhI,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAAU,EAAE,UAAU,CAAU,CAAA;AAOzE,MAAM,sBAAsB,GAAqE,IAAI,CAAA;AACrG,MAAM,uBAAuB,GAAgE,IAAI,CAAA;AACjG,KAAK,sBAAsB,CAAA;AAC3B,KAAK,uBAAuB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/miniapp",
3
- "version": "0.3.1-beta.551",
3
+ "version": "0.3.1-beta.561",
4
4
  "description": "SDK for building Glassly local miniapps (browser/WebView)",
5
5
  "author": "Glassly Labs",
6
6
  "license": "MIT",
@@ -73,7 +73,7 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "@glassly/cloud-protocol": "0.3.1-beta.551",
76
+ "@glassly/cloud-protocol": "0.3.1-beta.561",
77
77
  "eventemitter3": "^5.0.1"
78
78
  },
79
79
  "devDependencies": {
package/src/manifest.ts CHANGED
@@ -3,8 +3,13 @@
3
3
  * `permissions` and `hardwareRequirements`. The engine types its manifest
4
4
  * against these and the CLI validates with them, so an entry added here
5
5
  * reaches both without a hand-copied list.
6
+ *
7
+ * Plain string literals, not enum members: manifests are JSON, and the CLI
8
+ * compares against what authors typed. The assertions at the bottom keep the
9
+ * hardware lists equal to the `HardwareType` and `HardwareRequirementLevel`
10
+ * enums at compile time.
6
11
  */
7
- import {HardwareRequirementLevel, HardwareType} from "./hardware"
12
+ import type {HardwareRequirementLevel, HardwareType} from "./hardware"
8
13
 
9
14
  export const MANIFEST_PERMISSION_TYPES = [
10
15
  "MICROPHONE",
@@ -26,19 +31,18 @@ export const MANIFEST_PERMISSION_TYPES = [
26
31
  export type ManifestPermissionType = (typeof MANIFEST_PERMISSION_TYPES)[number]
27
32
 
28
33
  /** Every hardware type an author may declare. EXIST is implied by the host. */
29
- export const MANIFEST_HARDWARE_TYPES = [
30
- HardwareType.CAMERA,
31
- HardwareType.DISPLAY,
32
- HardwareType.MICROPHONE,
33
- HardwareType.SPEAKER,
34
- HardwareType.IMU,
35
- HardwareType.BUTTON,
36
- HardwareType.LIGHT,
37
- HardwareType.WIFI,
38
- ] as const
34
+ export const MANIFEST_HARDWARE_TYPES = ["CAMERA", "DISPLAY", "MICROPHONE", "SPEAKER", "IMU", "BUTTON", "LIGHT", "WIFI"] as const
39
35
 
40
36
  export type ManifestHardwareType = (typeof MANIFEST_HARDWARE_TYPES)[number]
41
37
 
42
- export const MANIFEST_HARDWARE_LEVELS = [HardwareRequirementLevel.REQUIRED, HardwareRequirementLevel.OPTIONAL] as const
38
+ export const MANIFEST_HARDWARE_LEVELS = ["REQUIRED", "OPTIONAL"] as const
43
39
 
44
40
  export type ManifestHardwareLevel = (typeof MANIFEST_HARDWARE_LEVELS)[number]
41
+
42
+ // Compile-time equality with the enums (string enums widen to their values in
43
+ // a template literal type). A mismatch in either direction fails the build.
44
+ type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : never) : never
45
+ const hardwareTypesMatchEnum: Equal<ManifestHardwareType, Exclude<`${HardwareType}`, "EXIST">> = true
46
+ const hardwareLevelsMatchEnum: Equal<ManifestHardwareLevel, `${HardwareRequirementLevel}`> = true
47
+ void hardwareTypesMatchEnum
48
+ void hardwareLevelsMatchEnum