@adventurelabs/scout-core 1.4.88 → 1.4.89

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.
@@ -107,9 +107,10 @@ export const get_parts_by_status = get_parts_by_lifecycle;
107
107
  * @param newPart - Part data to create
108
108
  */
109
109
  export async function create_part(client, newPart) {
110
- // Validate required fields
111
- if (!newPart.device_id) {
112
- return IWebResponse.error("Device ID is required").to_compatible();
110
+ // part is scoped to exactly one of a device or a herd.
111
+ const scope_count = [newPart.device_id, newPart.herd_id].filter((scope) => scope != null).length;
112
+ if (scope_count !== 1) {
113
+ return IWebResponse.error("exactly one of device_id or herd_id is required").to_compatible();
113
114
  }
114
115
  if (!newPart.serial_number) {
115
116
  return IWebResponse.error("Serial number is required").to_compatible();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adventurelabs/scout-core",
3
- "version": "1.4.88",
3
+ "version": "1.4.89",
4
4
  "description": "Core utilities and helpers for Adventure Labs Scout applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",