@bueno-analytics/fleet-command 0.1.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
+ # Changelog
2
+
3
+ ## [0.3.0](https://github.com/copelandsoftware/bueno_js_sdk/compare/@bueno-analytics/fleet-command@0.2.0...@bueno-analytics/fleet-command@0.3.0) (2026-10-20)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * Both packages now require Node.js 24. Upgrade to Node.js 24 before you install this version.
9
+
10
+ ### Features
11
+
12
+ * require Node.js 24 ([ac80c27](https://github.com/copelandsoftware/bueno_js_sdk/commit/ac80c275b9d693fc04c36dad2d588d8a3d7ce247))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **fleet-command:** update zod ([8b2b1d4](https://github.com/copelandsoftware/bueno_js_sdk/commit/8b2b1d4e572958a81e649ba22572502e256a5fa5))
18
+
19
+ ## 0.2.0
20
+
21
+ ### 🚀 Features
22
+
23
+ - **fleet-command:** add an error field to the envelope
24
+
1
25
  ## 0.1.0
2
26
 
3
27
  ### 🚀 Features
4
28
 
5
- - **fleet-command:** add the fleet command message schemas
29
+ - **fleet-command:** add the fleet command message schemas
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # fleet-command
2
2
 
3
- Zod schemas and types for the MQTT command contract between the Bueno fleet
4
- service and the edge gateways.
3
+ Zod schemas and types for the Bueno fleet command message contract.
5
4
 
6
5
  ---
7
6
 
@@ -18,34 +17,3 @@ yarn add @bueno-analytics/fleet-command
18
17
 
19
18
  npm install @bueno-analytics/fleet-command
20
19
  ```
21
-
22
- ## Usage
23
-
24
- Every message on the wire — request, reply or notification — is a
25
- `fleetMessage` envelope. Parse the envelope first, then parse `payload` with
26
- the schema the command names.
27
-
28
- `replyTo` is not a topic: it carries the bare per-pod routing token that the
29
- gateway appends to `v1/gateway/{id}/reply/` when publishing its reply.
30
-
31
- ```ts
32
- import { fleetCommands, fleetMessage } from '@bueno-analytics/fleet-command'
33
-
34
- const message = fleetMessage.parse(JSON.parse(raw))
35
-
36
- if (message.type === 'REQUEST' && message.command === 'list-plugins') {
37
- const request = fleetCommands['list-plugins'].request.parse(message.payload)
38
- }
39
- ```
40
-
41
- `fleetCommands` maps a command name to its `request` and `reply` schema, so a
42
- handler can look the pair up by the `command` field rather than branching on it.
43
-
44
- ## Commands
45
-
46
- | Command | Request | Reply |
47
- | -------------- | ------- | -------------------------------------- |
48
- | `list-plugins` | `{}` | `{ plugins: { id, name, version }[] }` |
49
-
50
- The envelope is shared with the fleet service's Kotlin `FleetMessage`; the two
51
- definitions must be kept in step.
@@ -1,15 +1,25 @@
1
1
  import { z } from 'zod';
2
+ export declare const fleetError: z.ZodObject<{
3
+ code: z.ZodString;
4
+ message: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type FleetError = z.infer<typeof fleetError>;
7
+ export type FleetErrorCode = 'UNKNOWN_COMMAND' | 'INVALID_REQUEST' | 'HANDLER_FAILED';
2
8
  export declare const fleetMessage: z.ZodObject<{
3
9
  messageId: z.ZodString;
4
10
  type: z.ZodEnum<{
5
- REQUEST: "REQUEST";
6
- REPLY: "REPLY";
7
11
  NOTIFICATION: "NOTIFICATION";
12
+ REPLY: "REPLY";
13
+ REQUEST: "REQUEST";
8
14
  }>;
9
15
  correlationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
16
  replyTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
17
  command: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
18
  payload: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
19
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
20
+ code: z.ZodString;
21
+ message: z.ZodString;
22
+ }, z.core.$strip>>>;
13
23
  ts: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
14
24
  }, z.core.$strip>;
15
25
  export type FleetMessage = z.infer<typeof fleetMessage>;
@@ -1,4 +1,9 @@
1
1
  import { z } from 'zod';
2
+ export const fleetError = z.object({
3
+ // Open string, not an enum: a gateway can ship a new code before its readers upgrade.
4
+ code: z.string(),
5
+ message: z.string(),
6
+ });
2
7
  // Envelope shared with forge-fleet's Kotlin `FleetMessage`; keep the two in step.
3
8
  export const fleetMessage = z.object({
4
9
  messageId: z.string(),
@@ -8,6 +13,7 @@ export const fleetMessage = z.object({
8
13
  replyTo: z.string().nullish(),
9
14
  command: z.string().nullish(),
10
15
  payload: z.unknown().nullish(),
16
+ error: fleetError.nullish(),
11
17
  // Null on offline: the LWT is frozen at connect and can't self-timestamp.
12
18
  ts: z.iso.datetime({ offset: true }).nullish(),
13
19
  });
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { type FleetCommandName, fleetCommands } from './fleetCommands.js';
2
- export { type FleetMessage, fleetMessage, type MessageType, } from './fleetMessage.js';
2
+ export { type FleetError, fleetError, type FleetErrorCode, type FleetMessage, fleetMessage, type MessageType, } from './fleetMessage.js';
3
3
  export { type ListPluginsReply, listPluginsReply, type ListPluginsRequest, listPluginsRequest, } from './listPlugins.js';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { fleetCommands } from './fleetCommands.js';
2
- export { fleetMessage, } from './fleetMessage.js';
2
+ export { fleetError, fleetMessage, } from './fleetMessage.js';
3
3
  export { listPluginsReply, listPluginsRequest, } from './listPlugins.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bueno-analytics/fleet-command",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Zod schemas and types for the Bueno fleet command message contract",
5
5
  "keywords": [],
6
6
  "license": "UNLICENSED",
@@ -35,22 +35,23 @@
35
35
  "prepublishOnly": "npm run build"
36
36
  },
37
37
  "dependencies": {
38
- "zod": "^4.4.3"
38
+ "zod": "^4.6.7"
39
39
  },
40
40
  "devDependencies": {
41
- "@tsconfig/node22": "^22.0.2",
42
- "@tsconfig/strictest": "^2.0.5",
43
- "@types/node": "^22.15.32",
44
- "@vitest/coverage-v8": "^4.0.15",
45
- "oxfmt": "^0.59.0",
46
- "oxlint": "^1.74.0",
47
- "oxlint-tsgolint": "^7.0.2001",
48
- "rimraf": "^6.1.2",
49
- "typescript": "^5.8.3",
50
- "vitest": "^4.0.15"
41
+ "@tsconfig/node24": "^24.0.5",
42
+ "@tsconfig/strictest": "^2.0.8",
43
+ "@types/node": "^24.19.2",
44
+ "@vitest/coverage-v8": "^5.0.5",
45
+ "oxfmt": "^0.73.0",
46
+ "oxlint": "^1.88.0",
47
+ "oxlint-tsgolint": "^7.0.2004",
48
+ "rimraf": "^6.1.3",
49
+ "typescript": "^7.0.2",
50
+ "vite": "^8.3.4",
51
+ "vitest": "^5.0.5"
51
52
  },
52
53
  "engines": {
53
- "node": ">=20.19.0 <25.0.0"
54
+ "node": ">=24.0.0"
54
55
  },
55
56
  "engineStrict": true
56
57
  }