@ham2k/extension-tools 0.12.0 → 0.14.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 +28 -2
  2. package/package.json +1 -1
package/h2kext.mjs CHANGED
@@ -39,8 +39,11 @@ import yazl from "yazl"
39
39
  /// panel's `target: 'developer'` settings and leaves a settings panel with
40
40
  /// nothing to show out of the Settings list; 9 hands `ctx.getQsos`'s QSOs
41
41
  /// frozen, from the one copy of the log every extension shares, and adds the
42
- /// `chasing` hook category.
43
- export const H2KEXT_API_VERSION = 9
42
+ /// `chasing` hook category; 10 adds the DX cluster connection — the
43
+ /// `requiresCluster*` grants, the `host.cluster*` calls and the `cluster`
44
+ /// hook category; 11 adds `n1mm-history:` data-file urls, and
45
+ /// `host.sendRadioRaw` with its `requiresRadioRaw` grant.
46
+ export const H2KEXT_API_VERSION = 11
44
47
 
45
48
  /// The first API with `host.webSocket`. A manifest declaring `webSockets`
46
49
  /// under an older one is refused: an older app would install it and fail only
@@ -53,6 +56,16 @@ export const WEB_SOCKETS_API_VERSION = 2
53
56
  /// that silently does nothing.
54
57
  export const CHASING_API_VERSION = 9
55
58
 
59
+ /// The first API with the DX cluster calls. A manifest declaring a
60
+ /// `requiresCluster*` grant or a `cluster` hook under an older one is
61
+ /// refused: an older app would install it and refuse every call it makes.
62
+ export const CLUSTER_API_VERSION = 10
63
+
64
+ /// The first API with `host.sendRadioRaw`. A manifest declaring
65
+ /// `requiresRadioRaw` under an older one is refused: an older app would
66
+ /// install it and refuse every raw command it sends.
67
+ export const RADIO_RAW_API_VERSION = 11
68
+
56
69
  /// The first API with timers. The build points a bundle's bare `setTimeout`
57
70
  /// and friends at the SDK's only from here on: an older app's kernel hands an
58
71
  /// extension no timers, and a bundle declaring less says it runs there.
@@ -156,6 +169,8 @@ SHARED_MODULES_BY_API[6] = SHARED_MODULES_BY_API[5]
156
169
  SHARED_MODULES_BY_API[7] = SHARED_MODULES_BY_API[6]
157
170
  SHARED_MODULES_BY_API[8] = SHARED_MODULES_BY_API[7]
158
171
  SHARED_MODULES_BY_API[9] = SHARED_MODULES_BY_API[8]
172
+ SHARED_MODULES_BY_API[10] = SHARED_MODULES_BY_API[9]
173
+ SHARED_MODULES_BY_API[11] = SHARED_MODULES_BY_API[10]
159
174
 
160
175
  /// What a scaffolded extension declares on day one: the eight modules the SDK
161
176
  /// barrel itself reaches, so a project that has written no code yet still
@@ -349,6 +364,17 @@ export function validateManifest(manifest, { source = MANIFEST_ENTRY, forceName
349
364
  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`)
350
365
  }
351
366
 
367
+ const clusterGrant = ["requiresClusterRead", "requiresClusterSpot", "requiresClusterCommand"].find((grant) => manifest[grant] === true)
368
+ const clusterHook = Array.isArray(manifest.hooks) && manifest.hooks.includes("cluster")
369
+ if ((clusterGrant || clusterHook) && Number.isInteger(manifest.api) && manifest.api < CLUSTER_API_VERSION) {
370
+ say(
371
+ `'${clusterGrant ?? "cluster"}' needs 'api' ${CLUSTER_API_VERSION} or later — an app older than that would install this and refuse every cluster call it makes`,
372
+ )
373
+ }
374
+ if (manifest.requiresRadioRaw === true && Number.isInteger(manifest.api) && manifest.api < RADIO_RAW_API_VERSION) {
375
+ say(`'requiresRadioRaw' needs 'api' ${RADIO_RAW_API_VERSION} or later — an app older than that would install this and refuse every raw command it sends`)
376
+ }
377
+
352
378
  // An extension with no category is CORE to the host: always enabled, and
353
379
  // never listed in the Extensions panel. That is a status the app grants its
354
380
  // 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.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Build and package extensions for the Ham2K Logger",
5
5
  "keywords": [
6
6
  "ham2k",