busroot-sdk 0.0.8-dev.2825123807 → 0.0.8-dev.2825583055

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
@@ -52,6 +52,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
52
52
  electricalPricePerKwh: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
53
53
  electricalCo2PerKwh: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
54
54
  currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ maxProductionCountPerSchedule: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
55
56
  dashboardConfig: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
56
57
  redshiftPassword: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
58
  uploadTransforms: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -117,6 +118,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
117
118
  electricalPricePerKwh: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
118
119
  electricalCo2PerKwh: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
119
120
  currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
+ maxProductionCountPerSchedule: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
120
122
  dashboardConfig: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
121
123
  redshiftPassword: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
124
  uploadTransforms: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -933,6 +935,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
933
935
  electricalCo2PerKwh?: number | null | undefined;
934
936
  dashboardConfig?: Record<string, any> | null | undefined;
935
937
  uploadTransforms?: string | null | undefined;
938
+ maxProductionCountPerSchedule?: number | null | undefined;
936
939
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
937
940
  archivedAt?: string | null | undefined;
938
941
  reasons?: Reason[] | undefined;
@@ -1111,6 +1114,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
1111
1114
  electricalCo2PerKwh?: number | null | undefined;
1112
1115
  dashboardConfig?: Record<string, any> | null | undefined;
1113
1116
  uploadTransforms?: string | null | undefined;
1117
+ maxProductionCountPerSchedule?: number | null | undefined;
1114
1118
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
1115
1119
  archivedAt?: string | null | undefined;
1116
1120
  reasons?: Reason[] | undefined;
@@ -1291,6 +1295,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
1291
1295
  electricalCo2PerKwh?: number | null | undefined;
1292
1296
  dashboardConfig?: Record<string, any> | null | undefined;
1293
1297
  uploadTransforms?: string | null | undefined;
1298
+ maxProductionCountPerSchedule?: number | null | undefined;
1294
1299
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
1295
1300
  archivedAt?: string | null | undefined;
1296
1301
  reasons?: Reason[] | undefined;
@@ -1472,6 +1477,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
1472
1477
  electricalCo2PerKwh?: number | null | undefined;
1473
1478
  dashboardConfig?: Record<string, any> | null | undefined;
1474
1479
  uploadTransforms?: string | null | undefined;
1480
+ maxProductionCountPerSchedule?: number | null | undefined;
1475
1481
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
1476
1482
  archivedAt?: string | null | undefined;
1477
1483
  reasons?: Reason[] | undefined;
@@ -1653,6 +1659,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
1653
1659
  electricalCo2PerKwh?: number | null | undefined;
1654
1660
  dashboardConfig?: Record<string, any> | null | undefined;
1655
1661
  uploadTransforms?: string | null | undefined;
1662
+ maxProductionCountPerSchedule?: number | null | undefined;
1656
1663
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
1657
1664
  archivedAt?: string | null | undefined;
1658
1665
  reasons?: Reason[] | undefined;
@@ -1834,6 +1841,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
1834
1841
  electricalCo2PerKwh?: number | null | undefined;
1835
1842
  dashboardConfig?: Record<string, any> | null | undefined;
1836
1843
  uploadTransforms?: string | null | undefined;
1844
+ maxProductionCountPerSchedule?: number | null | undefined;
1837
1845
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
1838
1846
  archivedAt?: string | null | undefined;
1839
1847
  reasons?: Reason[] | undefined;
@@ -2019,6 +2027,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
2019
2027
  electricalCo2PerKwh?: number | null | undefined;
2020
2028
  dashboardConfig?: Record<string, any> | null | undefined;
2021
2029
  uploadTransforms?: string | null | undefined;
2030
+ maxProductionCountPerSchedule?: number | null | undefined;
2022
2031
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
2023
2032
  archivedAt?: string | null | undefined;
2024
2033
  reasons?: Reason[] | undefined;
@@ -2103,6 +2112,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
2103
2112
  electricalPricePerKwh?: number | null | undefined;
2104
2113
  electricalCo2PerKwh?: number | null | undefined;
2105
2114
  currency?: string | null | undefined;
2115
+ maxProductionCountPerSchedule?: number | null | undefined;
2106
2116
  dashboardConfig?: Record<string, any> | null | undefined;
2107
2117
  uploadTransforms?: string | null | undefined;
2108
2118
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
@@ -2233,6 +2243,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
2233
2243
  electricalCo2PerKwh?: number | null | undefined;
2234
2244
  dashboardConfig?: Record<string, any> | null | undefined;
2235
2245
  uploadTransforms?: string | null | undefined;
2246
+ maxProductionCountPerSchedule?: number | null | undefined;
2236
2247
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
2237
2248
  archivedAt?: string | null | undefined;
2238
2249
  reasons?: Reason[] | undefined;
@@ -2317,6 +2328,7 @@ declare const PublicAccountViewModel: z.ZodObject<Omit<{
2317
2328
  electricalPricePerKwh?: number | null | undefined;
2318
2329
  electricalCo2PerKwh?: number | null | undefined;
2319
2330
  currency?: string | null | undefined;
2331
+ maxProductionCountPerSchedule?: number | null | undefined;
2320
2332
  dashboardConfig?: Record<string, any> | null | undefined;
2321
2333
  uploadTransforms?: string | null | undefined;
2322
2334
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
@@ -2600,6 +2612,7 @@ declare class BusrootClient {
2600
2612
  electricalCo2PerKwh?: number | null | undefined;
2601
2613
  dashboardConfig?: Record<string, any> | null | undefined;
2602
2614
  uploadTransforms?: string | null | undefined;
2615
+ maxProductionCountPerSchedule?: number | null | undefined;
2603
2616
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
2604
2617
  archivedAt?: string | null | undefined;
2605
2618
  reasons?: Reason[] | undefined;
@@ -2684,6 +2697,7 @@ declare class BusrootClient {
2684
2697
  electricalPricePerKwh?: number | null | undefined;
2685
2698
  electricalCo2PerKwh?: number | null | undefined;
2686
2699
  currency?: string | null | undefined;
2700
+ maxProductionCountPerSchedule?: number | null | undefined;
2687
2701
  dashboardConfig?: Record<string, any> | null | undefined;
2688
2702
  uploadTransforms?: string | null | undefined;
2689
2703
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
@@ -2820,6 +2834,7 @@ declare class BusrootClient {
2820
2834
  electricalCo2PerKwh?: number | null | undefined;
2821
2835
  dashboardConfig?: Record<string, any> | null | undefined;
2822
2836
  uploadTransforms?: string | null | undefined;
2837
+ maxProductionCountPerSchedule?: number | null | undefined;
2823
2838
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
2824
2839
  archivedAt?: string | null | undefined;
2825
2840
  reasons?: Reason[] | undefined;
@@ -2904,6 +2919,7 @@ declare class BusrootClient {
2904
2919
  electricalPricePerKwh?: number | null | undefined;
2905
2920
  electricalCo2PerKwh?: number | null | undefined;
2906
2921
  currency?: string | null | undefined;
2922
+ maxProductionCountPerSchedule?: number | null | undefined;
2907
2923
  dashboardConfig?: Record<string, any> | null | undefined;
2908
2924
  uploadTransforms?: string | null | undefined;
2909
2925
  durationFormat?: "months" | "days" | "hours" | "minutes" | null | undefined;
package/build/index.js CHANGED
@@ -856,7 +856,7 @@ var require_error_key = __commonJS({
856
856
  Object.defineProperty(exports2, "__esModule", { value: true });
857
857
  exports2.STATION_REASSIGN_CROSS_GROUP = exports2.TARGET_STATION_NOT_FOUND = exports2.PARTS_PER_CYCLE_NOT_ALLOWED_FOR_STATION = exports2.SCHEDULE_CANNOT_STOP_FUTURE = exports2.SCHEDULE_NON_PROD_OR_ENDED = exports2.SCHEDULE_CANNOT_CUT_SHORT = exports2.SCHEDULE_AUTO_ENDED_BY_QUANTITY = exports2.SCHEDULE_NOT_STARTED_OR_ENDED = exports2.ACTUAL_START_IN_PAST = exports2.PLANNED_START_IN_PAST = exports2.SCHEDULE_CANNOT_CHANGE_PROD_TO_NON_PROD = exports2.SCHEDULE_CANNOT_CHANGE_NON_PROD_TO_PROD = exports2.SCHEDULE_CANNOT_SET_PRIORITY_AFTER_START = exports2.SCHEDULE_ALREADY_STARTED_CANNOT_EDIT_START = exports2.SCHEDULE_ALREADY_ENDED = exports2.UNSUPPORTED_SCHEDULE_OPERATION = exports2.INVALID_RESOLUTION_MODE = exports2.EXISTED_EVENT = exports2.INVALID_SEARCH_TEXT = exports2.INVALID_SKIP = exports2.INVALID_LIMIT = exports2.INVALID_WINDOW_TIME = exports2.INVALID_NOTIFICATION_PREFERENCE = exports2.OVERLAPPED_SHIFT = exports2.INVALID_SHIFT_NAME = exports2.INVALID_WEEK_DAY = exports2.INVALID_FILE_TYPE = exports2.INVALID_HEADER_FIELDS = exports2.DELETE_LAST_SHIFT_PATTERN = exports2.INVALID_ACTUAL_START_AT_STATE = exports2.INVALID_DOMAIN = exports2.SKU_NOT_FOUND = exports2.STATION_GROUP_NOT_FOUND = exports2.WORK_ORDER_ENDED = exports2.SCHEDULE_NOT_FOUND = exports2.INVALID_SKU = exports2.INVALID_SCHEDULE = exports2.EXPIRED_TOKEN = exports2.UNAUTHORIZED_USER = exports2.UNAUTHENTICATED_USER = exports2.SHIFT_PATTERN_NOT_FOUND = exports2.INVALID_SHIFT_PATTERN_TITLE = exports2.INVALID_SHIFT_PATTERN_ID = exports2.INVALID_DELETE_SHIFTS = exports2.UNSUPPORTED_SHIFT_OVER_MID_NIGHT = exports2.INVALID_SHIFTS = exports2.INVALID_PLANTCODE = exports2.INVALID_RANGECODE = exports2.INTERNAL_SERVER_ERROR = exports2.CACHE_NOT_COMPLETE = void 0;
858
858
  exports2.UNSUPPORTED_API_KEY_OPERATION = exports2.ACCOUNT_ARCHIVED = exports2.ACCOUNT_DENIED = exports2.ACCOUNT_NOT_FOUND = exports2.ACCOUNT_MISMATCH = exports2.USER_ACCOUNT_IS_BLOCKED = exports2.ACCOUNT_NOT_SELECTED = exports2.INVALID_USER_ACCOUNT = exports2.NO_ACCOUNT_AVAILABLE = exports2.EXPIRED_USER = exports2.USER_IS_BLOCKED = exports2.INVALID_USER = exports2.USER_NOT_FOUND = exports2.MULTIPLE_ACCOUNT_ASSOCIATED = exports2.UNSUPPORTED_USER_OPERATION = exports2.EMAIL_TYPE_NOT_FOUND = exports2.INVALID_STATION_CODE = exports2.DUPLICATED_STATION_CODE = exports2.DUPLICATED_STATION_GROUP_CODE = exports2.INVALID_INPUT = exports2.DUPLICATED_SKU_CODE = exports2.INVALID_SKU_CODE = exports2.TOO_LARGE = exports2.BUSINESS_CONFLICT = exports2.FORBIDDEN = exports2.INVALID_ACCESS_CODE = exports2.EXPIRED_API_KEY = exports2.UNSUPPORTED_ARCHIVE_LAST_PLANT = exports2.PLANT_NOT_EXISTS = exports2.NOT_EMPTY_STATION_GROUP = exports2.INVALID_AGGREGATE_WINDOW = exports2.DUPLICATED_SCHEDULE = exports2.INVALID_SCHEDULE_ORDER_TYPE = exports2.INVALID_SKU_GROUP_NAME = exports2.SKU_GROUP_NOT_FOUND = exports2.INVALID_SKU_GROUP = exports2.INVALID_DOWNTIMNE_DURATION_THRESHOLD_MULTIPLIER = exports2.REASON_NOT_DOWNTIME_TYPE = exports2.MANUAL_DOWNTIME_NO_ACTIVE_SCHEDULE = exports2.MANUAL_DOWNTIME_ALREADY_ONGOING = exports2.CACHE_WARMING_DISABLED = exports2.MANUAL_DOWNTIME_DISABLED = exports2.DOWNTIME_NOT_MANUAL = exports2.DOWNTIME_NOT_FOUND = exports2.STATION_NOT_FOUND = exports2.TASK_LIST_NOT_FOUND = exports2.REASON_NOTE_REQUIRED = exports2.REASON_NOT_ALLOWED_FOR_STATION = exports2.REASON_NOT_FOUND = exports2.SKU_REQUIRED = void 0;
859
- exports2.TOO_MANY_ACCESS_CODE_ATTEMPTS = exports2.TOO_MANY_REQUESTS = exports2.PRODUCTION_BLOCKED_BY_MANUAL_DOWNTIME = exports2.PRODUCTION_CORRECTION_NOT_ALLOWED = exports2.PRODUCTION_QUANTITY_BELOW_ZERO = exports2.INVALID_PRODUCTION_ID = exports2.RESET_EXCEED_30_DAYS = exports2.INVALID_REASON_CODE = exports2.SELF_REFERENCING_CODE = exports2.PARENT_CODE_IN_USE = exports2.DUPLICATED_REASON_CODE = exports2.DATABASE_ERROR_MESSAGE = exports2.INVALID_API_KEY = void 0;
859
+ exports2.TOO_MANY_ACCESS_CODE_ATTEMPTS = exports2.TOO_MANY_REQUESTS = exports2.PRODUCTION_EXCEEDS_MAX_COUNT = exports2.PRODUCTION_BLOCKED_BY_MANUAL_DOWNTIME = exports2.PRODUCTION_CORRECTION_NOT_ALLOWED = exports2.PRODUCTION_QUANTITY_BELOW_ZERO = exports2.INVALID_PRODUCTION_ID = exports2.RESET_EXCEED_30_DAYS = exports2.INVALID_REASON_CODE = exports2.SELF_REFERENCING_CODE = exports2.PARENT_CODE_IN_USE = exports2.DUPLICATED_REASON_CODE = exports2.DATABASE_ERROR_MESSAGE = exports2.INVALID_API_KEY = void 0;
860
860
  exports2.CACHE_NOT_COMPLETE = "cacheNotComplete";
861
861
  exports2.INTERNAL_SERVER_ERROR = "internalServerError";
862
862
  exports2.INVALID_RANGECODE = "invalidRangeCode";
@@ -972,6 +972,7 @@ var require_error_key = __commonJS({
972
972
  exports2.PRODUCTION_QUANTITY_BELOW_ZERO = "productionQuantityBelowZero";
973
973
  exports2.PRODUCTION_CORRECTION_NOT_ALLOWED = "productionCorrectionNotAllowed";
974
974
  exports2.PRODUCTION_BLOCKED_BY_MANUAL_DOWNTIME = "productionBlockedByManualDowntime";
975
+ exports2.PRODUCTION_EXCEEDS_MAX_COUNT = "productionExceedsMaxCount";
975
976
  exports2.TOO_MANY_REQUESTS = "tooManyRequests";
976
977
  exports2.TOO_MANY_ACCESS_CODE_ATTEMPTS = "tooManyAccessCodeAttempts";
977
978
  }
@@ -1865,6 +1866,7 @@ var require_base_account = __commonJS({
1865
1866
  electricalPricePerKwh: zod_1.z.number().gte(0).nullish().describe("Cost per kilowatt-hour for electrical consumption (e.g., 0.15)"),
1866
1867
  electricalCo2PerKwh: zod_1.z.number().gte(0).nullish().describe("CO2 emissions per kilowatt-hour (e.g., 0.233)"),
1867
1868
  currency: zod_1.z.string().nullish().describe("ISO 4217 currency code (e.g., 'USD', 'EUR', 'GBP')"),
1869
+ maxProductionCountPerSchedule: zod_1.z.number().int().gt(0).lte(9999999).nullish().describe("Maximum production units a single schedule may record before recording stops. Null/absent means no limit."),
1868
1870
  // Feature flags (enableLostProductionCost, enableTasks, enableCycleTimeAnalysis, enableManualDowntime,
1869
1871
  // enableAutoEndOnQuantityComplete, enableProductionCorrection, enableDragBetweenStationsOnGantt) are now
1870
1872
  // registry-managed tri-state `enable*` fields, added below via flagSchemaFieldsForLevel("account").
@@ -5912,6 +5914,7 @@ var require_account2 = __commonJS({
5912
5914
  return false;
5913
5915
  }
5914
5916
  }, "Invalid yaml").describe("Upload Transforms: This field accepts a JSONata expression (in YAML format) to define how table columns are mapped and transformed."),
5917
+ maxProductionCountPerSchedule: zod_1.z.number().int().gt(0).lte(9999999).nullish().describe("Maximum Production Count per Schedule: Sets the maximum limit of production units for a single schedule to prevent large errors."),
5915
5918
  durationFormat: zod_1.z.enum(times_1.SUPPORTED_DURATION).default("months").describe("Duration Format: Select the format to display durations, for example a downtime period or length of a schedule."),
5916
5919
  includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: If set, only these reason codes are available at this level. Applied before excludeReasonCodes."),
5917
5920
  excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: These reason codes are removed at this level. Applied after includeReasonCodes."),
@@ -8135,6 +8138,10 @@ var require_production3 = __commonJS({
8135
8138
  return mod && mod.__esModule ? mod : { "default": mod };
8136
8139
  };
8137
8140
  Object.defineProperty(exports2, "__esModule", { value: true });
8141
+ exports2.productionCap = productionCap;
8142
+ exports2.isAtProductionCap = isAtProductionCap;
8143
+ exports2.exceedsProductionCap = exceedsProductionCap;
8144
+ exports2.formatScheduleProductionCount = formatScheduleProductionCount;
8138
8145
  exports2.processProduction = processProduction;
8139
8146
  exports2.filterBySkuType = filterBySkuType;
8140
8147
  exports2.groupProductionByStation = groupProductionByStation;
@@ -8147,6 +8154,25 @@ var require_production3 = __commonJS({
8147
8154
  var enums_1 = require_enums();
8148
8155
  var time_1 = require_time();
8149
8156
  var _1 = require_utils();
8157
+ function productionCap(manifest) {
8158
+ const cap = manifest.account.maxProductionCountPerSchedule;
8159
+ return cap != null && cap > 0 ? cap : null;
8160
+ }
8161
+ function isAtProductionCap(manifest, quantityTotal) {
8162
+ const cap = productionCap(manifest);
8163
+ return cap != null && (quantityTotal ?? 0) >= cap;
8164
+ }
8165
+ function exceedsProductionCap(manifest, quantityTotal, delta) {
8166
+ const cap = productionCap(manifest);
8167
+ if (cap == null || delta <= 0) {
8168
+ return false;
8169
+ }
8170
+ return (quantityTotal ?? 0) + delta > cap;
8171
+ }
8172
+ function formatScheduleProductionCount(manifest, quantityTotal) {
8173
+ const formatted = (0, _1.roundTo)(quantityTotal ?? 0, 2).toLocaleString("en-us");
8174
+ return isAtProductionCap(manifest, quantityTotal) ? `${formatted} (limit)` : formatted;
8175
+ }
8150
8176
  function processProduction(accountId, stationCode, schedule, timestamp, quantityGood = 0, quantityBad = 0, type, existedProduction, badReasonCode) {
8151
8177
  const nowIso = (0, moment_timezone_1.default)().toISOString();
8152
8178
  const momentIsoString = (0, moment_timezone_1.default)(timestamp).toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busroot-sdk",
3
- "version": "0.0.8-dev.2825123807",
3
+ "version": "0.0.8-dev.2825583055",
4
4
  "description": "An SDK for accessing Busroot from output.industries",
5
5
  "homepage": "https://www.output.industries",
6
6
  "main": "./build/index.js",