@bueno-analytics/fleet-command 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,5 @@
1
+ ## 0.1.0
2
+
3
+ ### 🚀 Features
4
+
5
+ - **fleet-command:** add the fleet command message schemas
package/LICENSE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2026 Built Environment Optimisation Pty Ltd. All rights reserved.
package/README.md CHANGED
@@ -1,3 +1,51 @@
1
- # Temporary Holding Version
1
+ # fleet-command
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Zod schemas and types for the MQTT command contract between the Bueno fleet
4
+ service and the edge gateways.
5
+
6
+ ---
7
+
8
+ 🌏 [Bueno Website](https://buenoanalytics.com/) | 📗 [Changelog](./CHANGELOG.md) | 💳 [License](./LICENSE)
9
+
10
+ ## Prerequisites
11
+
12
+ - Node.js >=20.19.x <25
13
+
14
+ ## Install
15
+
16
+ ```shell
17
+ yarn add @bueno-analytics/fleet-command
18
+
19
+ npm install @bueno-analytics/fleet-command
20
+ ```
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.
@@ -0,0 +1,13 @@
1
+ export declare const fleetCommands: {
2
+ readonly 'list-plugins': {
3
+ readonly request: import("zod").ZodObject<{}, import("zod/v4/core").$strip>;
4
+ readonly reply: import("zod").ZodObject<{
5
+ plugins: import("zod").ZodArray<import("zod").ZodObject<{
6
+ id: import("zod").ZodString;
7
+ name: import("zod").ZodString;
8
+ version: import("zod").ZodString;
9
+ }, import("zod/v4/core").$strip>>;
10
+ }, import("zod/v4/core").$strip>;
11
+ };
12
+ };
13
+ export type FleetCommandName = keyof typeof fleetCommands;
@@ -0,0 +1,7 @@
1
+ import { listPluginsReply, listPluginsRequest } from './listPlugins.js';
2
+ export const fleetCommands = {
3
+ 'list-plugins': {
4
+ request: listPluginsRequest,
5
+ reply: listPluginsReply,
6
+ },
7
+ };
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export declare const fleetMessage: z.ZodObject<{
3
+ messageId: z.ZodString;
4
+ type: z.ZodEnum<{
5
+ REQUEST: "REQUEST";
6
+ REPLY: "REPLY";
7
+ NOTIFICATION: "NOTIFICATION";
8
+ }>;
9
+ correlationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
10
+ replyTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ command: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ payload: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
13
+ ts: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
14
+ }, z.core.$strip>;
15
+ export type FleetMessage = z.infer<typeof fleetMessage>;
16
+ export type MessageType = FleetMessage['type'];
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ // Envelope shared with forge-fleet's Kotlin `FleetMessage`; keep the two in step.
3
+ export const fleetMessage = z.object({
4
+ messageId: z.string(),
5
+ type: z.enum(['REQUEST', 'REPLY', 'NOTIFICATION']),
6
+ correlationId: z.string().nullish(),
7
+ // Per-pod routing token, not a topic; gateways append it to v1/gateway/{id}/reply/.
8
+ replyTo: z.string().nullish(),
9
+ command: z.string().nullish(),
10
+ payload: z.unknown().nullish(),
11
+ // Null on offline: the LWT is frozen at connect and can't self-timestamp.
12
+ ts: z.iso.datetime({ offset: true }).nullish(),
13
+ });
@@ -0,0 +1,3 @@
1
+ export { type FleetCommandName, fleetCommands } from './fleetCommands.js';
2
+ export { type FleetMessage, fleetMessage, type MessageType, } from './fleetMessage.js';
3
+ export { type ListPluginsReply, listPluginsReply, type ListPluginsRequest, listPluginsRequest, } from './listPlugins.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { fleetCommands } from './fleetCommands.js';
2
+ export { fleetMessage, } from './fleetMessage.js';
3
+ export { listPluginsReply, listPluginsRequest, } from './listPlugins.js';
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export declare const listPluginsRequest: z.ZodObject<{}, z.core.$strip>;
3
+ export declare const listPluginsReply: z.ZodObject<{
4
+ plugins: z.ZodArray<z.ZodObject<{
5
+ id: z.ZodString;
6
+ name: z.ZodString;
7
+ version: z.ZodString;
8
+ }, z.core.$strip>>;
9
+ }, z.core.$strip>;
10
+ export type ListPluginsRequest = z.infer<typeof listPluginsRequest>;
11
+ export type ListPluginsReply = z.infer<typeof listPluginsReply>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export const listPluginsRequest = z.object({});
3
+ export const listPluginsReply = z.object({
4
+ plugins: z.array(z.object({
5
+ id: z.string(),
6
+ name: z.string(),
7
+ version: z.string(),
8
+ })),
9
+ });
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "@bueno-analytics/fleet-command",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Zod schemas and types for the Bueno fleet command message contract",
5
+ "keywords": [],
6
+ "license": "UNLICENSED",
7
+ "author": "Shriram Devanathan <sdevanathan@buenosystems.com.au>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/copelandsoftware/bueno_js_sdk.git",
11
+ "directory": "packages/fleet-command"
12
+ },
13
+ "files": [
14
+ "dist/*",
15
+ "CHANGELOG.md",
16
+ "LICENSE",
17
+ "README.md"
18
+ ],
19
+ "type": "module",
20
+ "main": "dist/index.js",
21
+ "types": "dist/index.d.ts",
22
+ "exports": {
23
+ ".": "./dist/index.js"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "scripts": {
29
+ "test": "vitest --run",
30
+ "build": "rimraf dist && tsc",
31
+ "dev": "rimraf dist && tsc -w",
32
+ "format": "oxfmt",
33
+ "format:check": "oxfmt --check",
34
+ "lint": "oxlint .",
35
+ "prepublishOnly": "npm run build"
36
+ },
37
+ "dependencies": {
38
+ "zod": "^4.4.3"
39
+ },
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"
51
+ },
52
+ "engines": {
53
+ "node": ">=20.19.0 <25.0.0"
54
+ },
55
+ "engineStrict": true
56
+ }