@assemblyline/al-orc 0.6.0 → 0.7.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
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.0] - 2026-12-03
11
+
12
+ ### Changed
13
+ - `stations pull` writes a station's config as `"config": { … }`. A local file that still has
14
+ `steps` (a factory not yet on lib-factory 0.41's `defineStation`) keeps `steps` instead.
15
+ `stations push` sends whichever the file has; the orchestrator keeps the two in step.
16
+ - `stations run --set` sends `config_overrides` (the orchestrator's new name for
17
+ `step_overrides`).
18
+
10
19
  ## [0.6.0] - 2026-12-02
11
20
 
12
21
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assemblyline/al-orc",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Assembly Line Orchestrator client + al-orc CLI (2-in-1): push lines and stations, run them, read work records.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,7 +2,7 @@
2
2
  import { clientFor } from '../_helpers.js';
3
3
 
4
4
  /**
5
- * Turn `--set key=value` flags into per-run step overrides, shallow-merged into every step's
5
+ * Turn `--set key=value` flags into per-run config overrides, shallow-merged into the station's
6
6
  * config by the orchestrator. The value is read as JSON (`true`, `2`, `"x"`, `[1,2]`) and,
7
7
  * when it isn't JSON, kept as text. A later flag for the same key wins. The same spelling as
8
8
  * lib-factory's `factory steps run --set`.
@@ -53,11 +53,22 @@ export function findStationFile(identifier) {
53
53
  }
54
54
 
55
55
  /**
56
- * The station as its local file holds it: a station with no conveyor has no `conveyor` key,
57
- * rather than `"conveyor": null` in every file.
56
+ * The station as its local file holds it:
57
+ * - a station with no conveyor has no `conveyor` key, rather than `"conveyor": null`;
58
+ * - its config as `config`, unless the file it replaces still has `steps` (a factory not yet
59
+ * on lib-factory 0.41's `defineStation`), which keeps `steps` instead. The orchestrator sends
60
+ * both and keeps them in step.
61
+ *
62
+ * @param {any} station - As the API returns it
63
+ * @param {any} [previous] - The local file it replaces
58
64
  */
59
- function forLocalFile(station) {
65
+ function forLocalFile(station, previous) {
60
66
  if (station.conveyor == null) delete station.conveyor;
67
+ if (previous?.steps !== undefined && previous?.config === undefined) {
68
+ delete station.config;
69
+ } else if (station.config !== undefined) {
70
+ delete station.steps;
71
+ }
61
72
  return station;
62
73
  }
63
74
 
@@ -70,12 +81,20 @@ export function saveStation(station) {
70
81
  const existingByCode = findStationFile(station.short_code);
71
82
  if (existingByCode) toRemove.add(existingByCode);
72
83
  }
73
- for (const f of toRemove) fs.unlinkSync(f);
84
+ let previous;
85
+ for (const f of toRemove) {
86
+ try {
87
+ previous ??= JSON.parse(fs.readFileSync(f, 'utf8'));
88
+ } catch {
89
+ // a malformed file is replaced
90
+ }
91
+ fs.unlinkSync(f);
92
+ }
74
93
 
75
94
  if (!fs.existsSync(STATIONS_DIR)) fs.mkdirSync(STATIONS_DIR, { recursive: true });
76
95
 
77
96
  const filepath = path.join(STATIONS_DIR, buildFilename(station));
78
- fs.writeFileSync(filepath, JSON.stringify(forLocalFile(station), null, 2));
97
+ fs.writeFileSync(filepath, JSON.stringify(forLocalFile(station, previous), null, 2));
79
98
  return filepath;
80
99
  }
81
100
 
@@ -72,12 +72,12 @@ export function buildStations(ctx) {
72
72
  unarchive: (id) => ctx.post(`/api/v1/stations/${enc(id)}/unarchive`).then(unwrap),
73
73
 
74
74
  /**
75
- * Trigger a station run. `overrides` are shallow-merged into every step's
76
- * config server-side. Returns `{ work_record_id }`.
75
+ * Trigger a station run. `overrides` are shallow-merged into the station's config
76
+ * server-side. Returns `{ work_record_id }`.
77
77
  */
78
78
  run: (id, { overrides } = {}) => {
79
79
  const body = {};
80
- if (overrides && Object.keys(overrides).length > 0) body.step_overrides = overrides;
80
+ if (overrides && Object.keys(overrides).length > 0) body.config_overrides = overrides;
81
81
  return ctx.post(`/api/v1/stations/${enc(id)}/run`, body).then(unwrap);
82
82
  },
83
83