@ham2k/extension-tools 0.12.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 +18 -2
  2. package/package.json +1 -1
package/h2kext.mjs CHANGED
@@ -39,8 +39,10 @@ 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.
45
+ export const H2KEXT_API_VERSION = 10
44
46
 
45
47
  /// The first API with `host.webSocket`. A manifest declaring `webSockets`
46
48
  /// under an older one is refused: an older app would install it and fail only
@@ -53,6 +55,11 @@ export const WEB_SOCKETS_API_VERSION = 2
53
55
  /// that silently does nothing.
54
56
  export const CHASING_API_VERSION = 9
55
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
+
56
63
  /// The first API with timers. The build points a bundle's bare `setTimeout`
57
64
  /// and friends at the SDK's only from here on: an older app's kernel hands an
58
65
  /// extension no timers, and a bundle declaring less says it runs there.
@@ -156,6 +163,7 @@ SHARED_MODULES_BY_API[6] = SHARED_MODULES_BY_API[5]
156
163
  SHARED_MODULES_BY_API[7] = SHARED_MODULES_BY_API[6]
157
164
  SHARED_MODULES_BY_API[8] = SHARED_MODULES_BY_API[7]
158
165
  SHARED_MODULES_BY_API[9] = SHARED_MODULES_BY_API[8]
166
+ SHARED_MODULES_BY_API[10] = SHARED_MODULES_BY_API[9]
159
167
 
160
168
  /// What a scaffolded extension declares on day one: the eight modules the SDK
161
169
  /// barrel itself reaches, so a project that has written no code yet still
@@ -349,6 +357,14 @@ export function validateManifest(manifest, { source = MANIFEST_ENTRY, forceName
349
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`)
350
358
  }
351
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
+
352
368
  // An extension with no category is CORE to the host: always enabled, and
353
369
  // never listed in the Extensions panel. That is a status the app grants its
354
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.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Build and package extensions for the Ham2K Logger",
5
5
  "keywords": [
6
6
  "ham2k",