@ham2k/extension-tools 0.11.0 → 0.13.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 (2) hide show
  1. package/h2kext.mjs +31 -2
  2. package/package.json +1 -1
package/h2kext.mjs CHANGED
@@ -37,14 +37,29 @@ import yazl from "yazl"
37
37
  /// tuner, passband and antennas, the keying calls, what `readRadio` reports of
38
38
  /// them, and the scene's host-fed `radio` values; 8 adds the Developer
39
39
  /// panel's `target: 'developer'` settings and leaves a settings panel with
40
- /// nothing to show out of the Settings list.
41
- export const H2KEXT_API_VERSION = 8
40
+ /// nothing to show out of the Settings list; 9 hands `ctx.getQsos`'s QSOs
41
+ /// frozen, from the one copy of the log every extension shares, and adds the
42
+ /// `chasing` hook category; 10 adds the DX cluster connection — the
43
+ /// `requiresCluster*` grants, the `host.cluster*` calls and the `cluster`
44
+ /// hook category.
45
+ export const H2KEXT_API_VERSION = 10
42
46
 
43
47
  /// The first API with `host.webSocket`. A manifest declaring `webSockets`
44
48
  /// under an older one is refused: an older app would install it and fail only
45
49
  /// when it tried to connect.
46
50
  export const WEB_SOCKETS_API_VERSION = 2
47
51
 
52
+ /// The first API that calls `chasing` hooks. A manifest promising one under an
53
+ /// older api is refused: an older app would install it and ignore the
54
+ /// program, and for an extension that does nothing else, install a bundle
55
+ /// that silently does nothing.
56
+ export const CHASING_API_VERSION = 9
57
+
58
+ /// The first API with the DX cluster calls. A manifest declaring a
59
+ /// `requiresCluster*` grant or a `cluster` hook under an older one is
60
+ /// refused: an older app would install it and refuse every call it makes.
61
+ export const CLUSTER_API_VERSION = 10
62
+
48
63
  /// The first API with timers. The build points a bundle's bare `setTimeout`
49
64
  /// and friends at the SDK's only from here on: an older app's kernel hands an
50
65
  /// extension no timers, and a bundle declaring less says it runs there.
@@ -147,6 +162,8 @@ SHARED_MODULES_BY_API[5] = SHARED_MODULES_BY_API[4]
147
162
  SHARED_MODULES_BY_API[6] = SHARED_MODULES_BY_API[5]
148
163
  SHARED_MODULES_BY_API[7] = SHARED_MODULES_BY_API[6]
149
164
  SHARED_MODULES_BY_API[8] = SHARED_MODULES_BY_API[7]
165
+ SHARED_MODULES_BY_API[9] = SHARED_MODULES_BY_API[8]
166
+ SHARED_MODULES_BY_API[10] = SHARED_MODULES_BY_API[9]
150
167
 
151
168
  /// What a scaffolded extension declares on day one: the eight modules the SDK
152
169
  /// barrel itself reaches, so a project that has written no code yet still
@@ -336,6 +353,18 @@ export function validateManifest(manifest, { source = MANIFEST_ENTRY, forceName
336
353
  }
337
354
  }
338
355
 
356
+ if (Array.isArray(manifest.hooks) && manifest.hooks.includes("chasing") && Number.isInteger(manifest.api) && manifest.api < CHASING_API_VERSION) {
357
+ say(`'chasing' needs 'api' ${CHASING_API_VERSION} or later — an app older than that would install this and never ask it what a contact claims`)
358
+ }
359
+
360
+ const clusterGrant = ["requiresClusterRead", "requiresClusterSpot", "requiresClusterCommand"].find((grant) => manifest[grant] === true)
361
+ const clusterHook = Array.isArray(manifest.hooks) && manifest.hooks.includes("cluster")
362
+ if ((clusterGrant || clusterHook) && Number.isInteger(manifest.api) && manifest.api < CLUSTER_API_VERSION) {
363
+ say(
364
+ `'${clusterGrant ?? "cluster"}' needs 'api' ${CLUSTER_API_VERSION} or later — an app older than that would install this and refuse every cluster call it makes`,
365
+ )
366
+ }
367
+
339
368
  // An extension with no category is CORE to the host: always enabled, and
340
369
  // never listed in the Extensions panel. That is a status the app grants its
341
370
  // own extensions, not one a distributed bundle may claim for itself — a user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ham2k/extension-tools",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Build and package extensions for the Ham2K Logger",
5
5
  "keywords": [
6
6
  "ham2k",