busroot-sdk 0.0.8-dev.2761048551 → 0.0.8-dev.2774837447

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.d.ts CHANGED
@@ -4152,6 +4152,7 @@ declare const BusrootSignalsPayload: z.ZodObject<{
4152
4152
  production_count_bad: z.ZodOptional<z.ZodNumber>;
4153
4153
  bad_production_count: z.ZodOptional<z.ZodNumber>;
4154
4154
  bad_production_reason: z.ZodOptional<z.ZodString>;
4155
+ non_production_reason: z.ZodOptional<z.ZodString>;
4155
4156
  productive: z.ZodOptional<z.ZodNumber>;
4156
4157
  line_speed: z.ZodOptional<z.ZodNumber>;
4157
4158
  speed: z.ZodOptional<z.ZodNumber>;
@@ -4177,6 +4178,7 @@ declare const BusrootSignalsPayload: z.ZodObject<{
4177
4178
  production_count_bad?: number | undefined;
4178
4179
  bad_production_count?: number | undefined;
4179
4180
  bad_production_reason?: string | undefined;
4181
+ non_production_reason?: string | undefined;
4180
4182
  productive?: number | undefined;
4181
4183
  status_code?: string | undefined;
4182
4184
  electrical_kwh?: number | undefined;
@@ -4200,6 +4202,7 @@ declare const BusrootSignalsPayload: z.ZodObject<{
4200
4202
  production_count_bad?: number | undefined;
4201
4203
  bad_production_count?: number | undefined;
4202
4204
  bad_production_reason?: string | undefined;
4205
+ non_production_reason?: string | undefined;
4203
4206
  productive?: number | undefined;
4204
4207
  status_code?: string | undefined;
4205
4208
  electrical_kwh?: number | undefined;
package/build/index.js CHANGED
@@ -649,6 +649,7 @@ var require_enums = __commonJS({
649
649
  TIMESERIES_MESSAGE_TYPE2["ELECTRICAL_PF"] = "ELECTRICAL_PF";
650
650
  TIMESERIES_MESSAGE_TYPE2["STATUS_CODE"] = "STATUS_CODE";
651
651
  TIMESERIES_MESSAGE_TYPE2["RSSI"] = "RSSI";
652
+ TIMESERIES_MESSAGE_TYPE2["NON_PRODUCTION"] = "NON_PRODUCTION";
652
653
  })(TIMESERIES_MESSAGE_TYPE || (exports2.TIMESERIES_MESSAGE_TYPE = TIMESERIES_MESSAGE_TYPE = {}));
653
654
  var CursorType;
654
655
  (function(CursorType2) {
@@ -2465,6 +2466,7 @@ var require_shared = __commonJS({
2465
2466
  production_count_bad: zod_1.z.number().optional().describe("The cumulative number of bad production cycles complete."),
2466
2467
  bad_production_count: zod_1.z.number().optional().describe("Alias for production_count_bad."),
2467
2468
  bad_production_reason: zod_1.z.string().optional().describe("Quality reason code for the bad production reported in this message. Must match a reason code of type 'quality' configured on the account; unknown or missing codes are recorded as bad production with no reason."),
2469
+ 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."),
2468
2470
  productive: zod_1.z.number().optional().describe("An indication that this station is productive. Any number greater than 0 is considered true."),
2469
2471
  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."),
2470
2472
  speed: zod_1.z.number().optional().describe("Alias for line_speed."),
@@ -8643,7 +8645,7 @@ var require_schedules = __commonJS({
8643
8645
  }
8644
8646
  return startTimestamp - 1 + totalProductionTimeMs;
8645
8647
  }
8646
- function enrichStationWindowsWithSchedules(station, stationWindowSchemas, schedules, now) {
8648
+ function enrichStationWindowsWithSchedules(station, stationWindowSchemas, schedules, now, signalNonProductionReasonByWindowStart) {
8647
8649
  let lastWindowEndAt = -1;
8648
8650
  const stationWindows = [];
8649
8651
  for (const window2 of stationWindowSchemas) {
@@ -8660,12 +8662,18 @@ var require_schedules = __commonJS({
8660
8662
  const productionGoodCount = window2.productionGoodCount || 0;
8661
8663
  const productionBadCount = window2.productionBadCount || 0;
8662
8664
  const isAnyProduction = productionGoodCount + productionBadCount > 0;
8665
+ const signalNonProductionReasonCode = signalNonProductionReasonByWindowStart?.get(window2.windowStartAtTimestamp);
8663
8666
  if (activeNonProductionSchedule) {
8664
8667
  window2.scheduledProductionMs = 0;
8665
8668
  window2.scheduledNonProductionMs = windowSize;
8666
8669
  const scheduleId = activeNonProductionSchedule.id ?? window2.scheduleId;
8667
8670
  window2.scheduleId = scheduleId ? scheduleId : void 0;
8668
8671
  window2.nonProductionReasonCode = activeNonProductionSchedule.nonProductionReasonCode;
8672
+ } else if (signalNonProductionReasonCode) {
8673
+ window2.scheduledProductionMs = 0;
8674
+ window2.scheduledNonProductionMs = windowSize;
8675
+ window2.scheduleId = void 0;
8676
+ window2.nonProductionReasonCode = signalNonProductionReasonCode;
8669
8677
  } else if (activeProductionSchedule) {
8670
8678
  window2.scheduledProductionMs = windowSize;
8671
8679
  window2.scheduledNonProductionMs = 0;
@@ -9140,7 +9148,7 @@ var require_configVars = __commonJS({
9140
9148
  "use strict";
9141
9149
  Object.defineProperty(exports2, "__esModule", { value: true });
9142
9150
  exports2.REDSHIFT_USERNAME = exports2.REDSHIFT_PORT = exports2.REDSHIFT_HOST_PUBLIC = exports2.REDSHIFT_HOST = exports2.SES_CONFIG = exports2.RATE_LIMIT_COUNT = exports2.RATE_LIMIT_WINDOW = exports2.MS_LOGIN_CALLBACK = exports2.MS_LOGIN_CLIENT_SECRET = exports2.MS_LOGIN_CLIENT_ID = exports2.ENABLE_DEMO_MODE = exports2.MQTT_PORT = exports2.MQTT_HOST = exports2.DEFAULT_ACCOUNT_ID = exports2.AUTH_BYPASS_DOMAIN = exports2.KNEX_SEEDS_DIR = exports2.QUEUE_LENGTH = exports2.LOGIN_COOKIE_SECRET = exports2.ENABLE_MS_TEAM_ALERT = exports2.ALERT_SLACK_TOKEN = exports2.ALERT_SLACK_CHANNEL = exports2.ENABLE_SLACK_ALERT = exports2.JWT_SECRET = exports2.AWS_BACKUP_S3_BUCKET = exports2.AWS_REGION = exports2.AWS_SECRET_ACCESS_KEY = exports2.AWS_ACCESS_KEY_ID = exports2.LOGIN_CALL_BACK_URL = exports2.TO_EMAIL_OVERRIDE = exports2.BCC_EMAIL = exports2.FROM_EMAIL = exports2.INFLUX_WRITE_PROTECTED = exports2.INFLUX_BUCKET = exports2.INFLUX_ORG = exports2.INFLUX_TOKEN = exports2.INFLUX_HOST_URL = exports2.PG_DB = exports2.PG_PASS = exports2.PG_USER = exports2.PG_HOST = exports2.BUSROOT_MQTT_FORWARDER_TOPIC = exports2.BUSROOT_MQTT_FORWARDER_PASS = exports2.BUSROOT_MQTT_FORWARDER_USER = exports2.BUSROOT_MQTT_FORWARDER_HOST = exports2.ADMIN_API_KEY = exports2.ADMIN_PASSWORD = exports2.ADMIN_USERNAME = exports2.DOMAIN_NAME = exports2.APP_ENV = exports2.NODE_ENV = void 0;
9143
- exports2.CACHE_BUILDER_ERROR_BACKOFF_MS = exports2.CACHE_BUILDER_ACCOUNT_BUDGET_MS = exports2.CACHE_BUILDER_IDLE_SLEEP_MS = exports2.CACHE_WARMING_LOOKBACK_DAYS = exports2.CACHE_WARMING_THROTTLE_MS = exports2.CACHE_WARMING_STAGGER_MAX_MS = exports2.CACHE_WARMING_CRON = exports2.CACHE_WARMING_ENABLED = exports2.STATION_FANOUT_PAUSE_MS = exports2.STATION_FANOUT_BATCH_SIZE = exports2.DAU_BUFFER_MAX_MESSAGE_BYTES = exports2.DAU_BUFFER_MAX_AGE_MS = exports2.DAU_BUFFER_SIZE = exports2.ENABLE_MQTT_EVENTS = exports2.ANTHROPIC_API_KEY = exports2.REDSHIFT_DB = exports2.REDSHIFT_PASSWORD = void 0;
9151
+ exports2.NON_PRODUCTION_SIGNAL_TIMEOUT_MS = exports2.CACHE_BUILDER_ERROR_BACKOFF_MS = exports2.CACHE_BUILDER_ACCOUNT_BUDGET_MS = exports2.CACHE_BUILDER_IDLE_SLEEP_MS = exports2.CACHE_WARMING_LOOKBACK_DAYS = exports2.CACHE_WARMING_THROTTLE_MS = exports2.CACHE_WARMING_STAGGER_MAX_MS = exports2.CACHE_WARMING_CRON = exports2.CACHE_WARMING_ENABLED = exports2.STATION_FANOUT_PAUSE_MS = exports2.STATION_FANOUT_BATCH_SIZE = exports2.DAU_BUFFER_MAX_MESSAGE_BYTES = exports2.DAU_BUFFER_MAX_AGE_MS = exports2.DAU_BUFFER_SIZE = exports2.ENABLE_MQTT_EVENTS = exports2.ANTHROPIC_API_KEY = exports2.REDSHIFT_DB = exports2.REDSHIFT_PASSWORD = void 0;
9144
9152
  function parsePositiveIntEnv(value, fallback) {
9145
9153
  const parsed = Number(value);
9146
9154
  return Number.isFinite(parsed) && parsed >= 1 ? Math.floor(parsed) : fallback;
@@ -9221,6 +9229,7 @@ var require_configVars = __commonJS({
9221
9229
  exports2.CACHE_BUILDER_IDLE_SLEEP_MS = parseNonNegativeIntEnv(process.env.CACHE_BUILDER_IDLE_SLEEP_MS, 2e3);
9222
9230
  exports2.CACHE_BUILDER_ACCOUNT_BUDGET_MS = parsePositiveIntEnv(process.env.CACHE_BUILDER_ACCOUNT_BUDGET_MS, 6e4);
9223
9231
  exports2.CACHE_BUILDER_ERROR_BACKOFF_MS = parseNonNegativeIntEnv(process.env.CACHE_BUILDER_ERROR_BACKOFF_MS, 5e3);
9232
+ exports2.NON_PRODUCTION_SIGNAL_TIMEOUT_MS = parseNonNegativeIntEnv(process.env.NON_PRODUCTION_SIGNAL_TIMEOUT_MS, 0);
9224
9233
  }
9225
9234
  });
9226
9235
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busroot-sdk",
3
- "version": "0.0.8-dev.2761048551",
3
+ "version": "0.0.8-dev.2774837447",
4
4
  "description": "An SDK for accessing Busroot from output.industries",
5
5
  "homepage": "https://www.output.industries",
6
6
  "main": "./build/index.js",