busroot-sdk 0.0.8-dev.2797155609 → 0.0.8-dev.2803109172
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/build/index.js +36 -37
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -762,14 +762,14 @@ var require_base_station = __commonJS({
|
|
|
762
762
|
idleCostPerMinute: zod_1.z.number().gte(0).lte(99999).nullish().describe("Idle Cost Per Minute: Cost per minute during idle time in account currency. Used for calculating scheduling losses, planned non-production losses, and downtime losses when SKU doesn't have a specific value."),
|
|
763
763
|
// Downtime Settings
|
|
764
764
|
downtimeDetectionMode: zod_1.z.nativeEnum(enums_1.DOWNTIME_DETECTION_MODE).default(enums_1.DOWNTIME_DETECTION_MODE.UTILISATION).nullish().describe("Downtime Detection Mode: How to detect when the station is down. Options: 'off' (no detection), 'production' (use production cycle data), 'utilisation' (use utilisation signals - most common), 'line_speed' (use line speed monitoring). Default: 'utilisation'"),
|
|
765
|
-
utilisationDowntimeThreshold: zod_1.z.number().int().gte(0).nullish().describe("Utilisation Downtime Threshold: Minimum
|
|
765
|
+
utilisationDowntimeThreshold: zod_1.z.number().int().gte(0).nullish().describe("Utilisation Downtime Threshold: Minimum stop duration in milliseconds before registering downtime \u2014 only stops longer than this are recorded. Example: 120000 (2 minutes), 900000 (15 minutes). The admin UI presents this value in minutes. Defaults to 1 hour when not set; see DEFAULT_UTILISATION_DOWNTIME_THRESHOLD in cache-builder."),
|
|
766
766
|
slowDurationThreshold: zod_1.z.number().int().gte(0).nullish().describe("Slow Duration Threshold: Duration threshold in milliseconds for detecting slow operation"),
|
|
767
767
|
forceAllShiftTimeAsPlannedProduction: zod_1.z.boolean().nullish().describe("Force All Shift Time As Planned Production: Treat all shift time as planned production time"),
|
|
768
768
|
// Productive Settings
|
|
769
769
|
productiveStatusMode: zod_1.z.nativeEnum(enums_1.PRODUCTIVE_STATUS_MODE).default(enums_1.PRODUCTIVE_STATUS_MODE.PRODUCTIVE_SIGNAL).nullish().describe("Productive Status Mode: How to measure when the station is engaged in value-adding activity. Options: 'productive_signal' (use productive signal input), 'electrical_usage' (use electrical consumption), 'line_speed' (use line speed value). Default: 'productive_signal'"),
|
|
770
770
|
electricalUsageStoppedThresholdKw: zod_1.z.number().gte(0).nullish().describe("Electrical Usage Stopped Threshold (kW): Minimum power consumption in kilowatts that indicates the station is active. Below this threshold, Busroot will regard the station as stopped/downtime. Example: 2.0, 1.0, 5.0"),
|
|
771
771
|
lineSpeedStoppedThreshold: zod_1.z.number().gte(0).nullish().describe("Line Speed Stopped Threshold: Minimum speed value that indicates the station is running. Below this threshold, Busroot will regard the station as stopped/downtime. Example: 10, 5, 20"),
|
|
772
|
-
productiveHoldOnTime: zod_1.z.number().int().gte(0).lte(time_1.TimeIntervals["1d"].ms).nullish().describe("Productive Hold On Time: Time in
|
|
772
|
+
productiveHoldOnTime: zod_1.z.number().int().gte(0).lte(time_1.TimeIntervals["1d"].ms).nullish().describe("Productive Hold On Time: Time in milliseconds to keep considering the station active after a productive signal. Each new signal restarts the hold-on timer. Example: 300000 (5 minutes). The admin UI presents this value in minutes."),
|
|
773
773
|
// Feature flags (allowManualProduction, allowQuickScheduleStart,
|
|
774
774
|
// allowScheduleCutShort, allowRejectProduction, allowEditPartsPerCycle, schedulingOnly) are now
|
|
775
775
|
// registry-managed tri-state `enable*` fields, added below via flagSchemaFieldsForLevel("station").
|
|
@@ -1422,40 +1422,39 @@ var require_times = __commonJS({
|
|
|
1422
1422
|
function floorToPlantDayStart(instant, plant) {
|
|
1423
1423
|
return (0, moment_timezone_1.default)(instant).tz(plant.timezone).subtract(plant.dayStartHour, "hours").startOf("day").add(plant.dayStartHour, "hours").valueOf();
|
|
1424
1424
|
}
|
|
1425
|
+
var CUSTOM_RANGE_MINUTE_STEPS = {
|
|
1426
|
+
"5m": 5,
|
|
1427
|
+
"15m": 15,
|
|
1428
|
+
"30m": 30
|
|
1429
|
+
};
|
|
1430
|
+
var CUSTOM_RANGE_CALENDAR_UNITS = {
|
|
1431
|
+
"1h": { startOf: "hour", step: "hour" },
|
|
1432
|
+
"1d": { startOf: "day", step: "day" },
|
|
1433
|
+
"7d": { startOf: "isoWeek", step: "week" }
|
|
1434
|
+
};
|
|
1435
|
+
function snapCustomRangeEdge(timestamp, timezone, aggregateWindow, direction) {
|
|
1436
|
+
if (aggregateWindow == null) {
|
|
1437
|
+
return timestamp;
|
|
1438
|
+
}
|
|
1439
|
+
const edge = (0, moment_timezone_1.default)(timestamp).tz(timezone).startOf("minute");
|
|
1440
|
+
const minuteStep = CUSTOM_RANGE_MINUTE_STEPS[aggregateWindow];
|
|
1441
|
+
if (minuteStep != null) {
|
|
1442
|
+
const offsetFromBoundary = edge.minute() % minuteStep;
|
|
1443
|
+
return direction === "backward" ? edge.subtract(offsetFromBoundary, "minutes").valueOf() : edge.add((minuteStep - offsetFromBoundary) % minuteStep, "minutes").valueOf();
|
|
1444
|
+
}
|
|
1445
|
+
const calendarUnit = CUSTOM_RANGE_CALENDAR_UNITS[aggregateWindow];
|
|
1446
|
+
if (calendarUnit == null) {
|
|
1447
|
+
return timestamp;
|
|
1448
|
+
}
|
|
1449
|
+
const boundary = edge.clone().startOf(calendarUnit.startOf);
|
|
1450
|
+
return direction === "backward" || boundary.valueOf() === edge.valueOf() ? boundary.valueOf() : boundary.add(1, calendarUnit.step).valueOf();
|
|
1451
|
+
}
|
|
1425
1452
|
function getTimeRangeFromRangeCode(range, plant, aggregateWindow, now) {
|
|
1426
1453
|
if (range.custom != null && range.custom.from != null && range.custom.to != null) {
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1431
|
-
const currentFromTimestampMinute = fromTimestampMomentStartOfMinute.minute();
|
|
1432
|
-
const currentToTimestampMinute = toTimestampMomentStartOfMinute.minute();
|
|
1433
|
-
if (aggregateWindow === "5m") {
|
|
1434
|
-
fromTimestamp = fromTimestampMomentStartOfMinute.add((5 - currentFromTimestampMinute % 5) % 5, "minutes").valueOf();
|
|
1435
|
-
toTimestamp = toTimestampMomentStartOfMinute.add((5 - currentToTimestampMinute % 5) % 5, "minutes").valueOf();
|
|
1436
|
-
} else if (aggregateWindow === "15m") {
|
|
1437
|
-
fromTimestamp = fromTimestampMomentStartOfMinute.add((15 - currentFromTimestampMinute % 15) % 15, "minutes").valueOf();
|
|
1438
|
-
toTimestamp = toTimestampMomentStartOfMinute.add((15 - currentToTimestampMinute % 15) % 15, "minutes").valueOf();
|
|
1439
|
-
} else if (aggregateWindow === "30m") {
|
|
1440
|
-
fromTimestamp = fromTimestampMomentStartOfMinute.add((30 - currentFromTimestampMinute % 30) % 30, "minutes").valueOf();
|
|
1441
|
-
toTimestamp = toTimestampMomentStartOfMinute.add((30 - currentToTimestampMinute % 30) % 30, "minutes").valueOf();
|
|
1442
|
-
} else if (aggregateWindow === "1h") {
|
|
1443
|
-
const fromStartOfHour = fromTimestampMomentStartOfMinute.clone().startOf("hour");
|
|
1444
|
-
const toStartOfHour = toTimestampMomentStartOfMinute.clone().startOf("hour");
|
|
1445
|
-
fromTimestamp = fromTimestampMomentStartOfMinute.valueOf() === fromStartOfHour.valueOf() ? fromStartOfHour.valueOf() : fromStartOfHour.add(1, "hour").valueOf();
|
|
1446
|
-
toTimestamp = toTimestampMomentStartOfMinute.valueOf() === toStartOfHour.valueOf() ? toStartOfHour.valueOf() : toStartOfHour.add(1, "hour").valueOf();
|
|
1447
|
-
} else if (aggregateWindow === "1d") {
|
|
1448
|
-
const fromStartOfDay = fromTimestampMomentStartOfMinute.clone().startOf("day");
|
|
1449
|
-
const toStartOfDay = toTimestampMomentStartOfMinute.clone().startOf("day");
|
|
1450
|
-
fromTimestamp = fromTimestampMomentStartOfMinute.valueOf() === fromStartOfDay.valueOf() ? fromStartOfDay.valueOf() : fromStartOfDay.add(1, "day").valueOf();
|
|
1451
|
-
toTimestamp = toTimestampMomentStartOfMinute.valueOf() === toStartOfDay.valueOf() ? toStartOfDay.valueOf() : toStartOfDay.add(1, "day").valueOf();
|
|
1452
|
-
} else if (aggregateWindow === "7d") {
|
|
1453
|
-
const fromStartOfWeek = fromTimestampMomentStartOfMinute.clone().startOf("isoWeek");
|
|
1454
|
-
const toStartOfWeek = toTimestampMomentStartOfMinute.clone().startOf("isoWeek");
|
|
1455
|
-
fromTimestamp = fromTimestampMomentStartOfMinute.valueOf() === fromStartOfWeek.valueOf() ? fromStartOfWeek.valueOf() : fromStartOfWeek.add(1, "week").valueOf();
|
|
1456
|
-
toTimestamp = toTimestampMomentStartOfMinute.valueOf() === toStartOfWeek.valueOf() ? toStartOfWeek.valueOf() : toStartOfWeek.add(1, "week").valueOf();
|
|
1457
|
-
}
|
|
1458
|
-
return timestampsToTimeRange({ from: fromTimestamp, to: toTimestamp });
|
|
1454
|
+
const timezone = plant?.timezone || "UTC";
|
|
1455
|
+
const fromTimestamp = snapCustomRangeEdge(range.custom.from, timezone, aggregateWindow, "forward");
|
|
1456
|
+
const toTimestamp = snapCustomRangeEdge(range.custom.to, timezone, aggregateWindow, "backward");
|
|
1457
|
+
return timestampsToTimeRange({ from: fromTimestamp, to: Math.max(fromTimestamp, toTimestamp) });
|
|
1459
1458
|
}
|
|
1460
1459
|
if (range.code == null) {
|
|
1461
1460
|
throw new Error("Either Range Code or custom Time Range required");
|
|
@@ -2472,7 +2471,7 @@ var require_shared = __commonJS({
|
|
|
2472
2471
|
production_count: zod_1.z.number().optional().describe("Alias for production_count_good."),
|
|
2473
2472
|
production_count_bad: zod_1.z.number().optional().describe("The cumulative number of bad production cycles complete."),
|
|
2474
2473
|
bad_production_count: zod_1.z.number().optional().describe("Alias for production_count_bad."),
|
|
2475
|
-
bad_production_reason: zod_1.z.string().optional().describe("Quality reason code for the bad production reported in this message.
|
|
2474
|
+
bad_production_reason: zod_1.z.string().optional().describe("Quality reason code for the bad production reported in this message. Should match a reason code of type 'quality' configured on the account, but an unrecognised code is still recorded verbatim and displayed as the raw code; a missing code records the bad production with no reason ('Unknown')."),
|
|
2476
2475
|
non_production_reason: zod_1.z.string().optional().describe("Declares that this station is currently in a period of non-production, and gives the reason code for it. The presence of this field is the assertion - there is no separate boolean and no end signal; the sender simply stops sending it. Each message re-asserts non-production for the one-minute window it lands in, so senders must publish at least once per minute for continuous coverage. Should match a reason code of type 'non-production' configured on the account; unknown codes are still honoured and displayed as the raw code."),
|
|
2477
2476
|
productive: zod_1.z.number().optional().describe("An indication that this station is productive. Any number greater than 0 is considered true."),
|
|
2478
2477
|
line_speed: zod_1.z.number().optional().describe("A number indicating the speed of the station. No units are assumed, so could be percentage or speed such as m/s."),
|
|
@@ -10253,14 +10252,14 @@ var require_station4 = __commonJS({
|
|
|
10253
10252
|
if (station.lastStationWindow != null) {
|
|
10254
10253
|
if ((station.lastStationWindow.shiftMs || 0) === 0) {
|
|
10255
10254
|
state = exports2.StationStates.out_of_shift;
|
|
10256
|
-
} else if (!station.lastStationWindow.isAlive) {
|
|
10257
|
-
state = exports2.StationStates.disconnected;
|
|
10258
10255
|
} else if ((station.lastStationWindow.downtimeMs || 0) > 0) {
|
|
10259
10256
|
state = exports2.StationStates.stopped;
|
|
10260
10257
|
} else if (station.activeSchedule?.nonProductionReasonCode != null) {
|
|
10261
10258
|
state = exports2.StationStates.non_production;
|
|
10262
10259
|
} else if ((0, station_windows_1.signalNonProductionReasonCode)(station.lastStationWindow) != null) {
|
|
10263
10260
|
state = exports2.StationStates.non_production;
|
|
10261
|
+
} else if (!station.lastStationWindow.isAlive) {
|
|
10262
|
+
state = exports2.StationStates.disconnected;
|
|
10264
10263
|
} else if (station.activeSchedule?.skuCode != null) {
|
|
10265
10264
|
state = exports2.StationStates.running;
|
|
10266
10265
|
} else {
|
package/package.json
CHANGED