busroot-sdk 0.0.8-dev.2888081848 → 0.0.8-dev.2892482846

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 +47 -24
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -1578,8 +1578,8 @@ var require_base_account = __commonJS({
1578
1578
  uploadTransforms: zod_1.z.string().nullish().describe("Upload transformation configuration (system managed)"),
1579
1579
  durationFormat: zod_1.z.enum(times_1.SUPPORTED_DURATION).nullish().describe("Duration display format (e.g., 'months', 'days', 'hours', 'minutes')"),
1580
1580
  appUrls: zod_1.z.string().nullish().describe("Custom application URLs (system managed)"),
1581
- 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."),
1582
- 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."),
1581
+ includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: Adds these reasons, each with all of its child reasons (including ones added later), at this level and below. Once any level sets this, only included reasons are available beneath it. Applied before excludeReasonCodes."),
1582
+ excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: Removes these reasons, each with all of its child reasons (including ones added later), at this level and below. A lower level can include a child back. Applied after includeReasonCodes."),
1583
1583
  // Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
1584
1584
  // parse; nothing reads them and no write path sets them. Use the Task list fields below.
1585
1585
  includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
@@ -1637,8 +1637,8 @@ var require_base_station_group = __commonJS({
1637
1637
  shiftPatternCode: zod_1.z.string().nullish().describe("Shift Pattern: The ID of the shift pattern this group follows"),
1638
1638
  // Feature flags (allowScheduleStationFlexibility, allowQuickScheduleStart) are now registry-managed
1639
1639
  // tri-state `enable*` fields, added below via flagSchemaFieldsForLevel("stationGroup").
1640
- 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."),
1641
- 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."),
1640
+ includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: Adds these reasons, each with all of its child reasons (including ones added later), at this level and below. Once any level sets this, only included reasons are available beneath it. Applied before excludeReasonCodes."),
1641
+ excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: Removes these reasons, each with all of its child reasons (including ones added later), at this level and below. A lower level can include a child back. Applied after includeReasonCodes."),
1642
1642
  // Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
1643
1643
  // parse; nothing reads them and no write path sets them. Use the Task list fields below.
1644
1644
  includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
@@ -2021,8 +2021,8 @@ var require_base_station = __commonJS({
2021
2021
  unitsPerMinute: zod_1.z.number().int().gt(0).nullish().describe("Units Per Minute: Expected production rate in units per minute. Example: 2, 4, 10"),
2022
2022
  unitsPerHour: zod_1.z.number().int().gt(0).nullish().describe("Units Per Hour: Expected production rate in units per hour. Example: 120, 240, 600"),
2023
2023
  lineSpeedTarget: zod_1.z.number().gt(0).lte(99999).nullish().describe("Line Speed Target: Target operating speed for the station. Example: 100, 120, 50"),
2024
- 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."),
2025
- 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."),
2024
+ includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: Adds these reasons, each with all of its child reasons (including ones added later), at this level and below. Once any level sets this, only included reasons are available beneath it. Applied before excludeReasonCodes."),
2025
+ excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: Removes these reasons, each with all of its child reasons (including ones added later), at this level and below. A lower level can include a child back. Applied after includeReasonCodes."),
2026
2026
  // Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
2027
2027
  // parse; nothing reads them and no write path sets them. Use the Task list fields below.
2028
2028
  includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
@@ -2058,8 +2058,8 @@ var require_plant = __commonJS({
2058
2058
  timezone: zod_1.z.string().describe("IANA timezone database name (e.g., 'America/New_York', 'Europe/London', 'Asia/Tokyo'). See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"),
2059
2059
  dayStartHour: zod_1.z.number().int().gte(0).lt(24).describe("Hour when the production day starts in 24-hour format (0-23). Example: 6 = 6:00 AM, 0 = midnight"),
2060
2060
  weekStartDay: zod_1.z.number().int().gte(0).lte(6).default(0).describe("Day the production week starts. 0 = Monday (default, ISO standard), 1 = Tuesday, 2 = Wednesday, 3 = Thursday, 4 = Friday, 5 = Saturday, 6 = Sunday"),
2061
- 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."),
2062
- 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."),
2061
+ includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: Adds these reasons, each with all of its child reasons (including ones added later), at this level and below. Once any level sets this, only included reasons are available beneath it. Applied before excludeReasonCodes."),
2062
+ excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: Removes these reasons, each with all of its child reasons (including ones added later), at this level and below. A lower level can include a child back. Applied after includeReasonCodes."),
2063
2063
  // Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
2064
2064
  // parse; nothing reads them and no write path sets them. Use the Task list fields below.
2065
2065
  includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
@@ -2963,7 +2963,7 @@ var require_station_allowed_list = __commonJS({
2963
2963
  "../../packages/common/build/utils/station-allowed-list.js"(exports2) {
2964
2964
  "use strict";
2965
2965
  Object.defineProperty(exports2, "__esModule", { value: true });
2966
- exports2.getValidSkus = exports2.getValidReasons = exports2.requiredTaskRefs = exports2.requiredTaskListCodes = exports2.resolveTaskListCodes = exports2.resolveReasonCodes = exports2.flattenReasonCodes = void 0;
2966
+ exports2.getValidSkus = exports2.getValidReasons = exports2.requiredTaskRefs = exports2.requiredTaskListCodes = exports2.resolveTaskListCodes = exports2.resolveReasonCodes = exports2.reasonAncestorMap = exports2.reasonSubtreeMap = exports2.flattenReasonCodes = void 0;
2967
2967
  var flattenReasonCodes = (reasons) => {
2968
2968
  const codes = [];
2969
2969
  for (const reason of reasons) {
@@ -2975,25 +2975,49 @@ var require_station_allowed_list = __commonJS({
2975
2975
  return codes;
2976
2976
  };
2977
2977
  exports2.flattenReasonCodes = flattenReasonCodes;
2978
- var resolveReasonCodes = (allCodes, ...levels) => {
2978
+ var reasonSubtreeMap = (reasons) => {
2979
+ const subtrees = /* @__PURE__ */ new Map();
2980
+ const walk = (reason) => {
2981
+ const codes = [reason.code, ...(reason.reasons ?? []).flatMap(walk)];
2982
+ subtrees.set(reason.code, codes);
2983
+ return codes;
2984
+ };
2985
+ reasons.forEach(walk);
2986
+ return subtrees;
2987
+ };
2988
+ exports2.reasonSubtreeMap = reasonSubtreeMap;
2989
+ var reasonAncestorMap = (reasons) => {
2990
+ const ancestors = /* @__PURE__ */ new Map();
2991
+ const walk = (reason, chain) => {
2992
+ ancestors.set(reason.code, chain);
2993
+ for (const child of reason.reasons ?? []) {
2994
+ walk(child, [reason.code, ...chain]);
2995
+ }
2996
+ };
2997
+ reasons.forEach((reason) => walk(reason, []));
2998
+ return ancestors;
2999
+ };
3000
+ exports2.reasonAncestorMap = reasonAncestorMap;
3001
+ var resolveReasonCodes = (reasons, ...levels) => {
3002
+ const subtrees = (0, exports2.reasonSubtreeMap)(reasons);
3003
+ const expand = (listed) => listed.flatMap((code) => subtrees.get(code) ?? []);
2979
3004
  const hasAnyInclude = levels.some((level) => level?.includeReasonCodes?.length);
2980
- const allCodesSet = new Set(allCodes);
2981
- let codes = hasAnyInclude ? [] : [...allCodes];
3005
+ let codes = hasAnyInclude ? [] : (0, exports2.flattenReasonCodes)(reasons);
2982
3006
  for (const level of levels) {
2983
3007
  if (!level) {
2984
3008
  continue;
2985
3009
  }
2986
3010
  if (level.includeReasonCodes?.length) {
2987
- const toAdd = level.includeReasonCodes.filter((code) => allCodesSet.has(code));
2988
3011
  const existing = new Set(codes);
2989
- for (const code of toAdd) {
3012
+ for (const code of expand(level.includeReasonCodes)) {
2990
3013
  if (!existing.has(code)) {
3014
+ existing.add(code);
2991
3015
  codes.push(code);
2992
3016
  }
2993
3017
  }
2994
3018
  }
2995
3019
  if (level.excludeReasonCodes?.length) {
2996
- const excludeSet = new Set(level.excludeReasonCodes);
3020
+ const excludeSet = new Set(expand(level.excludeReasonCodes));
2997
3021
  codes = codes.filter((code) => !excludeSet.has(code));
2998
3022
  }
2999
3023
  }
@@ -3245,8 +3269,7 @@ var require_station2 = __commonJS({
3245
3269
  shiftPattern = (0, shift_1.toShiftPatternViewModel)({ title: manifestShiftPattern.title, code: manifestShiftPattern.code }, manifestShiftPattern.shifts);
3246
3270
  }
3247
3271
  }
3248
- const allReasonCodes = manifest.account.reasons ? (0, station_allowed_list_1.flattenReasonCodes)(manifest.account.reasons) : [];
3249
- const stationResolvedReasonCodes = (0, station_allowed_list_1.resolveReasonCodes)(allReasonCodes, manifest.account, plant, group, station);
3272
+ const stationResolvedReasonCodes = (0, station_allowed_list_1.resolveReasonCodes)(manifest.account.reasons ?? [], manifest.account, plant, group, station);
3250
3273
  const tasksByCode = new Map((manifest.account.tasks ?? []).map((task) => [task.code, task]));
3251
3274
  const requiredTasks = (0, feature_flags_1.resolveFlag)(manifest, "enableTasks") ? (0, station_allowed_list_1.requiredTaskRefs)(manifest, station.code).flatMap((ref) => {
3252
3275
  const task = tasksByCode.get(ref.taskCode);
@@ -3459,8 +3482,8 @@ var require_plant2 = __commonJS({
3459
3482
  ...(0, feature_flags_1.flagSchemaFieldsForLevel)("plant"),
3460
3483
  includeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task List Codes: The Task lists available at this level. No level setting this means no Task lists are available."),
3461
3484
  excludeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task List Codes: These Task list codes are removed at this level."),
3462
- 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."),
3463
- 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."),
3485
+ includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: Adds these reasons, each with all of its child reasons (including ones added later), at this level and below. Once any level sets this, only included reasons are available beneath it. Applied before excludeReasonCodes."),
3486
+ excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: Removes these reasons, each with all of its child reasons (including ones added later), at this level and below. A lower level can include a child back. Applied after includeReasonCodes."),
3464
3487
  totalEnergyStationCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Total Energy Station Codes: When set, this plant's energy (kWh, cost, CO2) is the sum of these stations' energy instead of the additive sum over member stations.")
3465
3488
  });
3466
3489
  exports2.ArchivePlantPostRequest = zod_1.z.object({
@@ -3653,8 +3676,8 @@ var require_station_group2 = __commonJS({
3653
3676
  ...(0, feature_flags_1.flagSchemaFieldsForLevel)("stationGroup"),
3654
3677
  includeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task List Codes: The Task lists available at this level. No level setting this means no Task lists are available."),
3655
3678
  excludeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task List Codes: These Task list codes are removed at this level."),
3656
- 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."),
3657
- 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."),
3679
+ includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: Adds these reasons, each with all of its child reasons (including ones added later), at this level and below. Once any level sets this, only included reasons are available beneath it. Applied before excludeReasonCodes."),
3680
+ excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: Removes these reasons, each with all of its child reasons (including ones added later), at this level and below. A lower level can include a child back. Applied after includeReasonCodes."),
3658
3681
  totalEnergyStationCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Total Energy Station Codes: When set, this group's energy (kWh, cost, CO2) is the sum of these stations' energy instead of the additive sum over member stations.")
3659
3682
  });
3660
3683
  exports2.StationGroupPostRequest = StationGroupSchema;
@@ -6590,8 +6613,8 @@ var require_account2 = __commonJS({
6590
6613
  }, "Invalid yaml").describe("Upload Transforms: This field accepts a JSONata expression (in YAML format) to define how table columns are mapped and transformed."),
6591
6614
  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."),
6592
6615
  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."),
6593
- 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."),
6594
- 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."),
6616
+ includeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Reason Codes: Adds these reasons, each with all of its child reasons (including ones added later), at this level and below. Once any level sets this, only included reasons are available beneath it. Applied before excludeReasonCodes."),
6617
+ excludeReasonCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Reason Codes: Removes these reasons, each with all of its child reasons (including ones added later), at this level and below. A lower level can include a child back. Applied after includeReasonCodes."),
6595
6618
  includeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task List Codes: The Task lists available at this level. No level setting this means no Task lists are available."),
6596
6619
  excludeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task List Codes: These Task list codes are removed at this level. Applied after includeTaskListCodes.")
6597
6620
  });
@@ -11262,7 +11285,7 @@ var methodDefinitions = {
11262
11285
  "Create or update a Task list. The list carries the trigger every Task in it follows and is what the include/exclude cascade assigns to stations; create it before the Tasks that belong to it."
11263
11286
  ),
11264
11287
  "taskList.start": import_zod.z.function().args(TaskListStartParams).returns(import_zod.z.promise(import_zod.z.array(import_task_completion.TaskCompletionViewModel))).describe(
11265
- "Start a Task list at a station now, making every Task in it pending, as the tablet's Start this List button does. Works for a list of any trigger; the Tasks are recorded as On Demand with no deadline. A Task already pending keeps its row, so starting twice is harmless. The list must be assigned to the station. Returns one pending Task completion per Task, in list order."
11288
+ "Start a Task list at a station now, making every Task in it pending, as the tablet's Start List button does. Works for a list of any trigger; the Tasks are recorded as On Demand with no deadline. A Task already pending keeps its row, so starting twice is harmless. The list must be assigned to the station. Returns one pending Task completion per Task, in list order."
11266
11289
  ),
11267
11290
  "task.createUpdate": import_zod.z.function().args(TaskCreateUpdateParams).returns(import_zod.z.promise(import_task.TaskSchema)).describe("Create or update a Task. It must belong to at least one existing Task list, with its display order in each."),
11268
11291
  "task.start": import_zod.z.function().args(TaskStartParams).returns(import_zod.z.promise(import_task_completion.TaskCompletionViewModel)).describe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busroot-sdk",
3
- "version": "0.0.8-dev.2888081848",
3
+ "version": "0.0.8-dev.2892482846",
4
4
  "description": "An SDK for accessing Busroot from output.industries",
5
5
  "homepage": "https://www.output.industries",
6
6
  "main": "./build/index.js",