busroot-sdk 0.0.8-dev.2736448973 → 0.0.8-dev.2756254166

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/build/index.js +16 -8
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -2028,7 +2028,7 @@ var require_base_reason = __commonJS({
2028
2028
  require_extend();
2029
2029
  var enums_1 = require_enums();
2030
2030
  exports2.ReasonCodeSchema = zod_1.z.string().trim().min(1).max(50).refine((value) => value === value.toLowerCase()).describe("Unique reason code used to reference this reason (e.g., 'MAINTENANCE', 'BREAKDOWN', 'PLANNED-PM'). Must be unique within the account.");
2031
- var REQUIRE_NOTES_DESCRIPTION = "Require Notes: When enabled, operators must enter notes before the reason can be confirmed. Only applies when the reason is assigned to a downtime.";
2031
+ var REQUIRE_NOTES_DESCRIPTION = "Require Notes: When enabled, operators must enter notes before the reason can be confirmed. Only applies when the reason is assigned to a downtime. Omit the field to inherit the nearest ancestor reason's setting; set false to explicitly opt out of an inherited true.";
2032
2032
  exports2.BaseReasonSchema = zod_1.z.object({
2033
2033
  code: exports2.ReasonCodeSchema,
2034
2034
  description: zod_1.z.string().describe("Human-readable description of this reason (e.g., 'Planned maintenance', 'Equipment breakdown', 'Material shortage')"),
@@ -6920,7 +6920,12 @@ var require_reason3 = __commonJS({
6920
6920
  description: zod_1.z.string(),
6921
6921
  parentReasonCode: zod_1.z.string().nullish(),
6922
6922
  type: zod_1.z.array(zod_1.z.nativeEnum(enums_1.REASON_TYPE)),
6923
- requireNotes: zod_1.z.boolean().optional()
6923
+ // The value stored on this reason alone — undefined means "inherit from the parent reason".
6924
+ // Enforcement must read `effectiveRequireNotes`; this field is for the admin form.
6925
+ requireNotes: zod_1.z.boolean().optional(),
6926
+ // `requireNotes` resolved down the reason tree (nearest-defined-wins). Always populated by
6927
+ // `reasonUtils.reasonsFromManifest`; optional only so hand-built reason objects still typecheck.
6928
+ effectiveRequireNotes: zod_1.z.boolean().optional()
6924
6929
  });
6925
6930
  function toReasonViewModel(schemas) {
6926
6931
  return schemas.map((s) => ({
@@ -6928,7 +6933,8 @@ var require_reason3 = __commonJS({
6928
6933
  description: s.description,
6929
6934
  type: s.type,
6930
6935
  parentReasonCode: s.parentReasonCode,
6931
- requireNotes: s.requireNotes
6936
+ requireNotes: s.requireNotes,
6937
+ effectiveRequireNotes: s.effectiveRequireNotes ?? s.requireNotes ?? false
6932
6938
  }));
6933
6939
  }
6934
6940
  }
@@ -7766,18 +7772,20 @@ var require_reason4 = __commonJS({
7766
7772
  exports2.reasonBreadcrumb = reasonBreadcrumb;
7767
7773
  exports2.withAncestorReasons = withAncestorReasons;
7768
7774
  var reason_1 = require_reason3();
7769
- function flattenReasons(reasons, parentReasonCode) {
7775
+ function flattenReasons(reasons, parentReasonCode, inheritedRequireNotes) {
7770
7776
  const result = [];
7771
7777
  for (const reason of reasons) {
7778
+ const effectiveRequireNotes = reason.requireNotes ?? inheritedRequireNotes ?? false;
7772
7779
  result.push({
7773
7780
  code: reason.code,
7774
7781
  description: reason.description,
7775
7782
  type: reason.type,
7776
7783
  parentReasonCode: parentReasonCode ?? null,
7777
- requireNotes: reason.requireNotes
7784
+ requireNotes: reason.requireNotes,
7785
+ effectiveRequireNotes
7778
7786
  });
7779
7787
  if (reason.reasons?.length) {
7780
- result.push(...flattenReasons(reason.reasons, reason.code));
7788
+ result.push(...flattenReasons(reason.reasons, reason.code, reason.requireNotes ?? inheritedRequireNotes));
7781
7789
  }
7782
7790
  }
7783
7791
  return result;
@@ -8993,10 +9001,10 @@ var require_station4 = __commonJS({
8993
9001
  if (station.lastStationWindow != null) {
8994
9002
  if ((station.lastStationWindow.shiftMs || 0) === 0) {
8995
9003
  state = exports2.StationStates.out_of_shift;
8996
- } else if ((station.lastStationWindow.downtimeMs || 0) > 0) {
8997
- state = exports2.StationStates.stopped;
8998
9004
  } else if (!station.lastStationWindow.isAlive) {
8999
9005
  state = exports2.StationStates.disconnected;
9006
+ } else if ((station.lastStationWindow.downtimeMs || 0) > 0) {
9007
+ state = exports2.StationStates.stopped;
9000
9008
  } else if (station.activeSchedule?.nonProductionReasonCode != null) {
9001
9009
  state = exports2.StationStates.non_production;
9002
9010
  } else if (station.activeSchedule?.skuCode != null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busroot-sdk",
3
- "version": "0.0.8-dev.2736448973",
3
+ "version": "0.0.8-dev.2756254166",
4
4
  "description": "An SDK for accessing Busroot from output.industries",
5
5
  "homepage": "https://www.output.industries",
6
6
  "main": "./build/index.js",