busroot-sdk 0.0.8-dev.2835608806 → 0.0.8-dev.2839832531
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 +645 -246
- package/build/index.js +228 -67
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -142,8 +142,7 @@ var require_sku = __commonJS({
|
|
|
142
142
|
allowUseInQuickSchedule: zod_1.z.boolean().nullish().describe("Allow Use In Quick Schedule: Determines if this SKU can be selected when creating ad-hoc schedules from tablets"),
|
|
143
143
|
stationCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Station Codes: Array of station codes allowed to produce this SKU. If specified, only these stations can be scheduled with this SKU. Example: ['STA-01', 'STA-02']"),
|
|
144
144
|
stationGroupCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Station Group Codes: Array of station group codes allowed to produce this SKU. If specified, only stations in these groups can be scheduled with this SKU. Example: ['LINE-01', 'LINE-02']"),
|
|
145
|
-
taskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Task Codes: Array of Task codes linked to this SKU. References Tasks defined at the account level. Example: ['TASK-001', 'QC-CHECK']")
|
|
146
|
-
includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: If set, only these Task codes are available for this SKU.")
|
|
145
|
+
taskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Task Codes: Array of Task codes linked to this SKU. References Tasks defined at the account level. Example: ['TASK-001', 'QC-CHECK']")
|
|
147
146
|
}).strict().describe("A record for an SKU (aka part or component) that is referenced when scheduling production.");
|
|
148
147
|
}
|
|
149
148
|
});
|
|
@@ -153,7 +152,7 @@ var require_task = __commonJS({
|
|
|
153
152
|
"../../packages/common/build/schemas/task.js"(exports2) {
|
|
154
153
|
"use strict";
|
|
155
154
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
156
|
-
exports2.TaskSchema = exports2.TaskListSchema = exports2.TaskDescriptionSchema = exports2.TaskNameSchema = exports2.TaskCodeSchema = exports2.TaskFrequencySchema = exports2.TASK_FREQUENCY_TYPE_ALWAYS = exports2.TASK_FREQUENCY_TYPE_CRON = exports2.TASK_FREQUENCY_TYPE_SCHEDULE = void 0;
|
|
155
|
+
exports2.TaskSchema = exports2.TaskListMembershipsSchema = exports2.TaskListMembershipSchema = exports2.TASK_LIST_ORDER_RANGE_MESSAGE = exports2.TASK_LIST_ORDER_MAX = exports2.TaskListSchema = exports2.TaskDescriptionSchema = exports2.TaskNameSchema = exports2.TaskCodeSchema = exports2.TaskFrequencySchema = exports2.TASK_FREQUENCY_TYPE_ALWAYS = exports2.TASK_FREQUENCY_TYPE_CRON = exports2.TASK_FREQUENCY_TYPE_SCHEDULE = void 0;
|
|
157
156
|
var zod_1 = require("zod");
|
|
158
157
|
exports2.TASK_FREQUENCY_TYPE_SCHEDULE = "schedule";
|
|
159
158
|
exports2.TASK_FREQUENCY_TYPE_CRON = "cron";
|
|
@@ -187,21 +186,41 @@ var require_task = __commonJS({
|
|
|
187
186
|
name: zod_1.z.string().describe("Human-readable name of the Task list (e.g., 'Daily Checks')"),
|
|
188
187
|
// Optional at the schema level so a list saved without one still parses. Lengths and the
|
|
189
188
|
// required-ness of `name`/`code` are enforced on the write path — see `TaskCodeSchema`.
|
|
190
|
-
description: zod_1.z.string().optional().describe("Detailed description of what this Task list groups together")
|
|
189
|
+
description: zod_1.z.string().optional().describe("Detailed description of what this Task list groups together"),
|
|
190
|
+
// Optional at the schema level so lists written before frequency moved here still parse; the
|
|
191
|
+
// write path requires it. A list without one behaves as per-schedule, the pre-move default.
|
|
192
|
+
frequency: exports2.TaskFrequencySchema.optional().describe("How often every Task in this list must be completed. Set on the list, not the Task \u2014 all Tasks in a list share it.")
|
|
191
193
|
}).strict();
|
|
194
|
+
exports2.TASK_LIST_ORDER_MAX = 100;
|
|
195
|
+
exports2.TASK_LIST_ORDER_RANGE_MESSAGE = `Order must be greater than 0 and at most ${exports2.TASK_LIST_ORDER_MAX}`;
|
|
196
|
+
exports2.TaskListMembershipSchema = zod_1.z.object({
|
|
197
|
+
code: zod_1.z.string().min(1).describe("Code of the Task list this Task belongs to"),
|
|
198
|
+
// Optional at the schema level so memberships written before ordering existed still parse —
|
|
199
|
+
// those sort last, in manifest order. The write path requires it.
|
|
200
|
+
order: zod_1.z.number().optional().describe(`Display order of this Task within this list: greater than 0 and at most ${exports2.TASK_LIST_ORDER_MAX}. Decimals are allowed, so a Task can be inserted between two others.`)
|
|
201
|
+
}).strict();
|
|
202
|
+
exports2.TaskListMembershipsSchema = zod_1.z.preprocess((value) => Array.isArray(value) ? value.map((entry) => typeof entry === "string" ? { code: entry } : entry) : value, zod_1.z.array(exports2.TaskListMembershipSchema));
|
|
192
203
|
exports2.TaskSchema = zod_1.z.object({
|
|
193
204
|
code: zod_1.z.string().describe("Unique Task code used to reference this procedure (e.g., 'TASK-001', 'STARTUP-CHECK'). Must be unique within the account."),
|
|
194
205
|
title: zod_1.z.string().describe("Human-readable title of the Task (e.g., 'Machine Startup Checklist', 'Quality Inspection Procedure')"),
|
|
195
206
|
// Optional at the schema level so a Task saved without one still parses. Lengths and the
|
|
196
207
|
// required-ness of `title`/`code` are enforced on the write path — see `TaskCodeSchema`.
|
|
197
208
|
description: zod_1.z.string().optional().describe("Detailed description of the Task and its purpose"),
|
|
198
|
-
|
|
209
|
+
// Legacy: frequency now lives on the Task list, so every Task in a list shares it. Kept here
|
|
210
|
+
// so stored manifests still parse and so Task History can still label a completion whose list
|
|
211
|
+
// has since been deleted — nothing else reads it, and no write path sets it any more.
|
|
212
|
+
//
|
|
213
|
+
// `.optional()`, not `.default()`: a default would put a meaningless per-schedule frequency on
|
|
214
|
+
// every Task the code constructs, and make the field look required to every caller building a
|
|
215
|
+
// Task. Absent is the honest value for a Task written since the move.
|
|
216
|
+
frequency: exports2.TaskFrequencySchema.optional(),
|
|
199
217
|
// Optional at the schema level so pre-existing Tasks (written before this field existed) still
|
|
200
218
|
// parse — absent means notes are not required, the pre-feature behaviour.
|
|
201
219
|
requireNotes: zod_1.z.boolean().optional().describe("When enabled, operators must enter notes before this Task can be confirmed as complete."),
|
|
202
220
|
// Optional at the schema level so pre-existing Tasks (written before Task lists existed)
|
|
203
|
-
// still parse — absent means the Task belongs to no list.
|
|
204
|
-
|
|
221
|
+
// still parse — absent means the Task belongs to no list and is therefore scoped to nothing.
|
|
222
|
+
// The write path requires at least one entry, each with an order.
|
|
223
|
+
taskListCodes: exports2.TaskListMembershipsSchema.optional().describe("The Task lists this Task belongs to, with its display order within each. A Task can belong to several lists and is completed independently in each.")
|
|
205
224
|
}).strict();
|
|
206
225
|
}
|
|
207
226
|
});
|
|
@@ -261,14 +280,14 @@ var require_registry = __commonJS({
|
|
|
261
280
|
enableProductionCorrection: {
|
|
262
281
|
key: "enableProductionCorrection",
|
|
263
282
|
label: "Allow Production Correction",
|
|
264
|
-
description: "Allow operators to
|
|
283
|
+
description: "Allow operators to correct production counting errors during a running schedule from the tablet.",
|
|
265
284
|
allowedLevels: ["account", "plant", "stationGroup", "station"],
|
|
266
285
|
oiManaged: false
|
|
267
286
|
},
|
|
268
287
|
enableHistoricalCorrection: {
|
|
269
288
|
key: "enableHistoricalCorrection",
|
|
270
289
|
label: "Allow Historical Production Correction",
|
|
271
|
-
description: "
|
|
290
|
+
description: "Correct production counts on schedules that have already ended. Available to admins from the action menu on the schedule list and Gantt chart. This is separate from the tablet's live correction feature.",
|
|
272
291
|
allowedLevels: ["account"],
|
|
273
292
|
oiManaged: false
|
|
274
293
|
},
|
|
@@ -411,8 +430,12 @@ var require_base_station_group = __commonJS({
|
|
|
411
430
|
// tri-state `enable*` fields, added below via flagSchemaFieldsForLevel("stationGroup").
|
|
412
431
|
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."),
|
|
413
432
|
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."),
|
|
414
|
-
|
|
415
|
-
|
|
433
|
+
// Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
|
|
434
|
+
// parse; nothing reads them and no write path sets them. Use the Task list fields below.
|
|
435
|
+
includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
|
|
436
|
+
excludeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task Codes: Legacy, no longer applied. Superseded by excludeTaskListCodes."),
|
|
437
|
+
includeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task List Codes: The Task lists available at this level. Unlike reasons, no level setting this means no Task lists are available \u2014 lists must be included explicitly before their Tasks appear on a station."),
|
|
438
|
+
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."),
|
|
416
439
|
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."),
|
|
417
440
|
createdAt: zod_1.z.string().nullish().describe("Group creation timestamp (ISO 8601, system managed)"),
|
|
418
441
|
updatedAt: zod_1.z.string().nullish().describe("Last update timestamp (ISO 8601, system managed)"),
|
|
@@ -791,8 +814,12 @@ var require_base_station = __commonJS({
|
|
|
791
814
|
lineSpeedTarget: zod_1.z.number().gt(0).lte(99999).nullish().describe("Line Speed Target: Target operating speed for the station. Example: 100, 120, 50"),
|
|
792
815
|
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."),
|
|
793
816
|
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."),
|
|
794
|
-
|
|
795
|
-
|
|
817
|
+
// Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
|
|
818
|
+
// parse; nothing reads them and no write path sets them. Use the Task list fields below.
|
|
819
|
+
includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
|
|
820
|
+
excludeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task Codes: Legacy, no longer applied. Superseded by excludeTaskListCodes."),
|
|
821
|
+
includeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task List Codes: The Task lists available at this level. Unlike reasons, no level setting this means no Task lists are available \u2014 lists must be included explicitly before their Tasks appear on a station."),
|
|
822
|
+
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."),
|
|
796
823
|
alertMessage: zod_1.z.string().nullish().describe("Alert Message: Current alert message for the station (system managed)"),
|
|
797
824
|
alertExpiresAt: zod_1.z.string().nullish().describe("Alert Expires At: Timestamp when alert expires (ISO 8601, system managed)"),
|
|
798
825
|
// System info
|
|
@@ -824,8 +851,12 @@ var require_plant = __commonJS({
|
|
|
824
851
|
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"),
|
|
825
852
|
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."),
|
|
826
853
|
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."),
|
|
827
|
-
|
|
828
|
-
|
|
854
|
+
// Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
|
|
855
|
+
// parse; nothing reads them and no write path sets them. Use the Task list fields below.
|
|
856
|
+
includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
|
|
857
|
+
excludeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task Codes: Legacy, no longer applied. Superseded by excludeTaskListCodes."),
|
|
858
|
+
includeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task List Codes: The Task lists available at this level. Unlike reasons, no level setting this means no Task lists are available \u2014 lists must be included explicitly before their Tasks appear on a station."),
|
|
859
|
+
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."),
|
|
829
860
|
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."),
|
|
830
861
|
stationGroups: zod_1.z.array(base_station_group_1.BaseStationGroupSchema.extend({
|
|
831
862
|
stations: zod_1.z.array(base_station_1.BaseStationSchema).describe("Array of stations within this group (minimum 1)")
|
|
@@ -863,7 +894,7 @@ var require_error_key = __commonJS({
|
|
|
863
894
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
864
895
|
exports2.TARGET_STATION_NOT_FOUND = exports2.INVALID_PARTS_PER_CYCLE = 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;
|
|
865
896
|
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 = exports2.STATION_REASSIGN_CROSS_GROUP = void 0;
|
|
866
|
-
exports2.TOO_MANY_ACCESS_CODE_ATTEMPTS = exports2.TOO_MANY_REQUESTS = exports2.HISTORICAL_CORRECTION_CURSOR_RESET_FAILED = exports2.HISTORICAL_CORRECTION_WINDOW_EXPIRED = exports2.SCHEDULE_NOT_CORRECTABLE = exports2.HISTORICAL_CORRECTION_NOT_ALLOWED = 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 = exports2.UNSUPPORTED_API_KEY_OPERATION = void 0;
|
|
897
|
+
exports2.TOO_MANY_ACCESS_CODE_ATTEMPTS = exports2.TOO_MANY_REQUESTS = exports2.HISTORICAL_CORRECTION_LIMIT_REACHED = exports2.HISTORICAL_CORRECTION_CURSOR_RESET_FAILED = exports2.HISTORICAL_CORRECTION_WINDOW_EXPIRED = exports2.SCHEDULE_NOT_CORRECTABLE = exports2.HISTORICAL_CORRECTION_NOT_ALLOWED = 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 = exports2.UNSUPPORTED_API_KEY_OPERATION = void 0;
|
|
867
898
|
exports2.CACHE_NOT_COMPLETE = "cacheNotComplete";
|
|
868
899
|
exports2.INTERNAL_SERVER_ERROR = "internalServerError";
|
|
869
900
|
exports2.INVALID_RANGECODE = "invalidRangeCode";
|
|
@@ -985,6 +1016,7 @@ var require_error_key = __commonJS({
|
|
|
985
1016
|
exports2.SCHEDULE_NOT_CORRECTABLE = "scheduleNotCorrectable";
|
|
986
1017
|
exports2.HISTORICAL_CORRECTION_WINDOW_EXPIRED = "historicalCorrectionWindowExpired";
|
|
987
1018
|
exports2.HISTORICAL_CORRECTION_CURSOR_RESET_FAILED = "historicalCorrectionCursorResetFailed";
|
|
1019
|
+
exports2.HISTORICAL_CORRECTION_LIMIT_REACHED = "historicalCorrectionLimitReached";
|
|
988
1020
|
exports2.TOO_MANY_REQUESTS = "tooManyRequests";
|
|
989
1021
|
exports2.TOO_MANY_ACCESS_CODE_ATTEMPTS = "tooManyAccessCodeAttempts";
|
|
990
1022
|
}
|
|
@@ -1889,8 +1921,12 @@ var require_base_account = __commonJS({
|
|
|
1889
1921
|
appUrls: zod_1.z.string().nullish().describe("Custom application URLs (system managed)"),
|
|
1890
1922
|
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."),
|
|
1891
1923
|
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."),
|
|
1892
|
-
|
|
1893
|
-
|
|
1924
|
+
// Legacy: scoping moved from individual Tasks to Task lists. Kept so stored manifests still
|
|
1925
|
+
// parse; nothing reads them and no write path sets them. Use the Task list fields below.
|
|
1926
|
+
includeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task Codes: Legacy, no longer applied. Superseded by includeTaskListCodes."),
|
|
1927
|
+
excludeTaskCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task Codes: Legacy, no longer applied. Superseded by excludeTaskListCodes."),
|
|
1928
|
+
includeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Include Task List Codes: The Task lists available at this level. Unlike reasons, no level setting this means no Task lists are available \u2014 lists must be included explicitly before their Tasks appear on a station."),
|
|
1929
|
+
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."),
|
|
1894
1930
|
createdAt: zod_1.z.string().nullish().describe("Account creation timestamp (ISO 8601, system managed)"),
|
|
1895
1931
|
updatedAt: zod_1.z.string().nullish().describe("Last update timestamp (ISO 8601, system managed)"),
|
|
1896
1932
|
archivedAt: zod_1.z.string().nullish().describe("Archive timestamp (ISO 8601, system managed). When set, the account is archived and hidden from active lists."),
|
|
@@ -2244,6 +2280,7 @@ var require_manifest = __commonJS({
|
|
|
2244
2280
|
};
|
|
2245
2281
|
const validReasonCodes = new Set(flattenReasonCodes(data.account.reasons ?? []));
|
|
2246
2282
|
const validTaskCodes = new Set((data.account.tasks ?? []).map((s) => s.code));
|
|
2283
|
+
const validTaskListCodes = new Set((data.account.taskLists ?? []).map((l) => l.code));
|
|
2247
2284
|
const validShiftPatternCodes = new Set((data.account.shiftPatterns ?? []).map((sp) => sp.code));
|
|
2248
2285
|
const validateShiftPatternCode = (code, path) => {
|
|
2249
2286
|
if (code && !validShiftPatternCodes.has(code)) {
|
|
@@ -2254,6 +2291,11 @@ var require_manifest = __commonJS({
|
|
|
2254
2291
|
});
|
|
2255
2292
|
}
|
|
2256
2293
|
};
|
|
2294
|
+
const SOURCE_BY_LABEL = {
|
|
2295
|
+
"Reason code": "reasons",
|
|
2296
|
+
"Task code": "tasks",
|
|
2297
|
+
"Task list code": "taskLists"
|
|
2298
|
+
};
|
|
2257
2299
|
const validateCodes = (codes, validSet, label, path) => {
|
|
2258
2300
|
if (!codes) {
|
|
2259
2301
|
return;
|
|
@@ -2262,7 +2304,7 @@ var require_manifest = __commonJS({
|
|
|
2262
2304
|
if (!validSet.has(code)) {
|
|
2263
2305
|
ctx.addIssue({
|
|
2264
2306
|
code: zod_1.z.ZodIssueCode.custom,
|
|
2265
|
-
message: `${label} '${code}' is not defined in manifest.account.${label
|
|
2307
|
+
message: `${label} '${code}' is not defined in manifest.account.${SOURCE_BY_LABEL[label] ?? "tasks"}`,
|
|
2266
2308
|
path
|
|
2267
2309
|
});
|
|
2268
2310
|
}
|
|
@@ -2284,10 +2326,10 @@ var require_manifest = __commonJS({
|
|
|
2284
2326
|
const validateLevel = (level, basePath) => {
|
|
2285
2327
|
validateCodes(level.includeReasonCodes, validReasonCodes, "Reason code", [...basePath, "includeReasonCodes"]);
|
|
2286
2328
|
validateCodes(level.excludeReasonCodes, validReasonCodes, "Reason code", [...basePath, "excludeReasonCodes"]);
|
|
2287
|
-
validateCodes(level.
|
|
2288
|
-
validateCodes(level.
|
|
2329
|
+
validateCodes(level.includeTaskListCodes, validTaskListCodes, "Task list code", [...basePath, "includeTaskListCodes"]);
|
|
2330
|
+
validateCodes(level.excludeTaskListCodes, validTaskListCodes, "Task list code", [...basePath, "excludeTaskListCodes"]);
|
|
2289
2331
|
validateNoOverlap(level.includeReasonCodes, level.excludeReasonCodes, "Reason code", [...basePath, "includeReasonCodes"], [...basePath, "excludeReasonCodes"]);
|
|
2290
|
-
validateNoOverlap(level.
|
|
2332
|
+
validateNoOverlap(level.includeTaskListCodes, level.excludeTaskListCodes, "Task list code", [...basePath, "includeTaskListCodes"], [...basePath, "excludeTaskListCodes"]);
|
|
2291
2333
|
};
|
|
2292
2334
|
validateLevel(data.account, ["account"]);
|
|
2293
2335
|
const validateTotalEnergyStationCodes = (codes, activeStationCodesLower, scopeLabel, path) => {
|
|
@@ -2340,7 +2382,6 @@ var require_manifest = __commonJS({
|
|
|
2340
2382
|
for (const [ki, sku] of (data.account.skus ?? []).entries()) {
|
|
2341
2383
|
const skuPath = ["account", "skus", ki];
|
|
2342
2384
|
validateCodes(sku.taskCodes, validTaskCodes, "Task code", [...skuPath, "taskCodes"]);
|
|
2343
|
-
validateCodes(sku.includeTaskCodes, validTaskCodes, "Task code", [...skuPath, "includeTaskCodes"]);
|
|
2344
2385
|
}
|
|
2345
2386
|
});
|
|
2346
2387
|
exports2.StrictManifestSchema = exports2.ManifestSchema.superRefine((data, ctx) => {
|
|
@@ -2583,6 +2624,11 @@ var require_task_completion = __commonJS({
|
|
|
2583
2624
|
accountId: zod_1.z.string(),
|
|
2584
2625
|
stationCode: zod_1.z.string(),
|
|
2585
2626
|
taskCode: zod_1.z.string(),
|
|
2627
|
+
// The list this completion belongs to. Completion is per (Task, list, station): a Task in two
|
|
2628
|
+
// lists is completed separately in each, so this is part of the row's identity, not a label.
|
|
2629
|
+
// Nullish only because rows written before Task lists became the unit of operation kept their
|
|
2630
|
+
// NULL — see migration 20260909143000. Every write path sets it.
|
|
2631
|
+
taskListCode: zod_1.z.string().nullish(),
|
|
2586
2632
|
scheduleId: zod_1.z.number().nullish(),
|
|
2587
2633
|
periodStartAt: zod_1.z.string().nullish(),
|
|
2588
2634
|
periodEndAt: zod_1.z.string().nullish(),
|
|
@@ -2796,8 +2842,8 @@ var require_plant2 = __commonJS({
|
|
|
2796
2842
|
// Without these the flag values posted by the admin form are stripped by `.parse()` before
|
|
2797
2843
|
// `PlantService.applyPlantFlags` ever sees them.
|
|
2798
2844
|
...(0, feature_flags_1.flagSchemaFieldsForLevel)("plant"),
|
|
2799
|
-
|
|
2800
|
-
|
|
2845
|
+
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."),
|
|
2846
|
+
excludeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task List Codes: These Task list codes are removed at this level."),
|
|
2801
2847
|
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."),
|
|
2802
2848
|
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."),
|
|
2803
2849
|
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.")
|
|
@@ -2990,8 +3036,8 @@ var require_station_group2 = __commonJS({
|
|
|
2990
3036
|
shiftPatternCode: schemas_1.shiftPatternCodeSchema.describe("Shift Pattern: Select which Shift Pattern the group will follow."),
|
|
2991
3037
|
// Group-level feature-flag config fields (tri-state on/off/inherit), generated from the registry.
|
|
2992
3038
|
...(0, feature_flags_1.flagSchemaFieldsForLevel)("stationGroup"),
|
|
2993
|
-
|
|
2994
|
-
|
|
3039
|
+
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."),
|
|
3040
|
+
excludeTaskListCodes: zod_1.z.array(zod_1.z.string()).nullish().describe("Exclude Task List Codes: These Task list codes are removed at this level."),
|
|
2995
3041
|
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."),
|
|
2996
3042
|
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."),
|
|
2997
3043
|
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.")
|
|
@@ -5931,8 +5977,8 @@ var require_account2 = __commonJS({
|
|
|
5931
5977
|
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."),
|
|
5932
5978
|
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."),
|
|
5933
5979
|
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."),
|
|
5934
|
-
|
|
5935
|
-
|
|
5980
|
+
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."),
|
|
5981
|
+
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.")
|
|
5936
5982
|
});
|
|
5937
5983
|
}
|
|
5938
5984
|
});
|
|
@@ -6333,7 +6379,7 @@ var require_production2 = __commonJS({
|
|
|
6333
6379
|
"../../packages/common/build/api-schemas/production.js"(exports2) {
|
|
6334
6380
|
"use strict";
|
|
6335
6381
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6336
|
-
exports2.ProductionAggregateWindowGetRequest = exports2.ProductionHistoricalCorrectionPostRequest = exports2.MAX_HISTORICAL_CORRECTION_QUANTITY = exports2.ProductionManualPostRequest = void 0;
|
|
6382
|
+
exports2.ProductionAggregateWindowGetRequest = exports2.ProductionHistoricalCorrectionPostRequest = exports2.HISTORICAL_CORRECTION_WINDOW_MONTHS = exports2.MAX_HISTORICAL_CORRECTION_QUANTITY = exports2.ProductionManualPostRequest = void 0;
|
|
6337
6383
|
var zod_1 = require("zod");
|
|
6338
6384
|
var schemas_1 = require_schemas();
|
|
6339
6385
|
var ProductionSchema = zod_1.z.object({
|
|
@@ -6354,6 +6400,7 @@ var require_production2 = __commonJS({
|
|
|
6354
6400
|
});
|
|
6355
6401
|
exports2.ProductionManualPostRequest = ProductionSchema.omit({ id: true });
|
|
6356
6402
|
exports2.MAX_HISTORICAL_CORRECTION_QUANTITY = 1e6;
|
|
6403
|
+
exports2.HISTORICAL_CORRECTION_WINDOW_MONTHS = 1;
|
|
6357
6404
|
exports2.ProductionHistoricalCorrectionPostRequest = zod_1.z.object({
|
|
6358
6405
|
scheduleId: schemas_1.ScheduleIdSchema,
|
|
6359
6406
|
operation: zod_1.z.enum(["add", "subtract"]),
|
|
@@ -6585,10 +6632,23 @@ var require_task2 = __commonJS({
|
|
|
6585
6632
|
exports2.TaskDeleteRequest = exports2.TaskPostRequest = void 0;
|
|
6586
6633
|
var zod_1 = require("zod");
|
|
6587
6634
|
var task_1 = require_task();
|
|
6588
|
-
exports2.TaskPostRequest = task_1.TaskSchema.extend({
|
|
6635
|
+
exports2.TaskPostRequest = task_1.TaskSchema.omit({ frequency: true }).extend({
|
|
6589
6636
|
code: task_1.TaskCodeSchema.describe("Unique Task code used to reference this procedure (e.g., 'TASK-001', 'STARTUP-CHECK'). Must be unique within the account."),
|
|
6590
6637
|
title: task_1.TaskNameSchema.describe("Human-readable title of the Task (e.g., 'Machine Startup Checklist', 'Quality Inspection Procedure')"),
|
|
6591
|
-
description: task_1.TaskDescriptionSchema.describe("Detailed description of the Task and its purpose")
|
|
6638
|
+
description: task_1.TaskDescriptionSchema.describe("Detailed description of the Task and its purpose"),
|
|
6639
|
+
// Membership is what scopes a Task to a station and what gives it a frequency, so a Task with no
|
|
6640
|
+
// list would be invisible everywhere — rejected here rather than saved into limbo. The manifest
|
|
6641
|
+
// schema stays permissive so pre-existing listless Tasks keep parsing; only new writes conform.
|
|
6642
|
+
//
|
|
6643
|
+
// `order` is required per entry for the same reason it is optional in the manifest: the display
|
|
6644
|
+
// order has to exist for new Tasks, but back-filling it onto stored ones would be a migration.
|
|
6645
|
+
// It is bounded here and nowhere in the manifest schema, so a stored order outside the bounds
|
|
6646
|
+
// keeps loading and only has to conform when the Task is next saved.
|
|
6647
|
+
// `TaskService.save` fills in the next whole number when a caller omits the whole membership
|
|
6648
|
+
// list entry, which is what makes the SDK path workable.
|
|
6649
|
+
taskListCodes: zod_1.z.array(task_1.TaskListMembershipSchema.required({ order: true }).extend({
|
|
6650
|
+
order: zod_1.z.number().gt(0, task_1.TASK_LIST_ORDER_RANGE_MESSAGE).max(task_1.TASK_LIST_ORDER_MAX, task_1.TASK_LIST_ORDER_RANGE_MESSAGE)
|
|
6651
|
+
})).min(1, "A Task must belong to at least one Task list").describe("The Task lists this Task belongs to, with its display order within each. At least one is required.")
|
|
6592
6652
|
});
|
|
6593
6653
|
exports2.TaskDeleteRequest = zod_1.z.object({
|
|
6594
6654
|
code: zod_1.z.string()
|
|
@@ -6607,7 +6667,11 @@ var require_task_list = __commonJS({
|
|
|
6607
6667
|
exports2.TaskListPostRequest = task_1.TaskListSchema.extend({
|
|
6608
6668
|
code: task_1.TaskCodeSchema.describe("Unique Task list code used to reference this list (e.g., 'DAILY-CHECKS'). Must be unique within the account."),
|
|
6609
6669
|
name: task_1.TaskNameSchema.describe("Human-readable name of the Task list (e.g., 'Daily Checks')"),
|
|
6610
|
-
description: task_1.TaskDescriptionSchema.describe("Detailed description of what this Task list groups together")
|
|
6670
|
+
description: task_1.TaskDescriptionSchema.describe("Detailed description of what this Task list groups together"),
|
|
6671
|
+
// Required here, optional on the manifest schema: every Task in the list follows this, so a list
|
|
6672
|
+
// without one would leave its Tasks with no defined timing. Lists stored before frequency moved
|
|
6673
|
+
// here keep parsing and fall back to per-schedule (see `taskListUtils.taskListFrequency`).
|
|
6674
|
+
frequency: task_1.TaskFrequencySchema.describe("How often every Task in this list must be completed.")
|
|
6611
6675
|
});
|
|
6612
6676
|
exports2.TaskListDeleteRequest = zod_1.z.object({
|
|
6613
6677
|
code: zod_1.z.string()
|
|
@@ -6671,7 +6735,7 @@ var require_api_schemas = __commonJS({
|
|
|
6671
6735
|
"use strict";
|
|
6672
6736
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6673
6737
|
exports2.ScheduleEditPartsPerCycleOverridePostBodyRequest = exports2.ScheduleEditPartsPerCycleOverridePostParamRequest = exports2.ScheduleFutureGetParamRequest = exports2.ScheduleCutShortPostRequest = exports2.ScheduleDeleteRequest = exports2.SchedulePostRequestTransform = exports2.SchedulePostRequestSuperRefine = exports2.SchedulePostRequest = exports2.ScheduleWorkderGetRequest = exports2.ScheduleGetRequest = exports2.ReasonDeleteRequest = exports2.ReasonPostRequest = exports2.ReasonGetRequest = exports2.ReasonBreadcrumb = exports2.NotificationRefferencesRequest = exports2.StationGroupDeleteRquest = exports2.StationGroupGetRquest = exports2.StationGroupPostRequest = exports2.StationGroupCodeSchema = exports2.StationOperatorPostRequest = exports2.StationTargetGetRequest = exports2.StationWindowGetRequest = exports2.StationLogGetRequest = exports2.AdminStationPutBodyRequest = exports2.StationGetRequest = exports2.StationPostRequest = exports2.StationPostRequestTransform = exports2.StationPostRequestSuperRefine = exports2.StationDeleteRequest = exports2.AccountArchivePostRequest = exports2.AccountSettingPostRequest = exports2.SelectAccountPostRequest = exports2.NewAccountPostRequest = exports2.ArchivePlantPostRequest = exports2.PlantPostRequest = exports2.UserGetRequest = exports2.UserPostRequest = exports2.SkuCycleTimeAnalysisGetRequest = exports2.SkuDeleteRequest = exports2.SkuPostBulkRequest = exports2.SkuPostRequestTransform = exports2.SkuPostRequestSuperRefine = exports2.SkuPostRequest = exports2.BooleanTypeSchema = exports2.SortByStandardParam = exports2.BusrootPagingResponse = exports2.StandardRequestSuperRefine = exports2.StandardRequestParams = exports2.RangeCodeSchema = exports2.UNKNOWN_CODE = void 0;
|
|
6674
|
-
exports2.BufferedDauMessageSchema = exports2.DauMessagesGetParams = exports2.AgentRequest = exports2.AgentMessage = exports2.TaskListDeleteRequest = exports2.TaskListPostRequest = exports2.TaskDeleteRequest = exports2.TaskPostRequest = exports2.NotePostRequest = exports2.NoteGetRequest = exports2.DeleteNoteRequest = exports2.DeleteKeyDeleteRequest = exports2.FilterGetRequest = exports2.AccessCodeGetRequest = exports2.DebugMockClearPostRequest = exports2.DebugResetCursorPostRequest = exports2.DebugEmailDowntimeSummaryGetRequest = exports2.EmailTestHarnessPostRequestRefinement = exports2.EmailTestHarnessPostRequest = exports2.LoginPostRequest = exports2.CallBackGetRequest = exports2.DevicePostRequest = exports2.DeviceDeleteRequest = exports2.DashboardGetRquest = exports2.ManualDowntimeEndByStationRequest = exports2.IssueEventPostRequestRefinement = exports2.IssueEventPostRequest = exports2.IssueEventQueryRequest = exports2.IssuePostRequest = exports2.IssueIdGetRequest = exports2.DOWNTIME_NOTE_MAX_LENGTH = exports2.MAX_HISTORICAL_CORRECTION_QUANTITY = exports2.ProductionAggregateWindowGetRequest = exports2.ProductionHistoricalCorrectionPostRequest = exports2.ProductionManualPostRequest = exports2.ShiftPatternDeleteRequest = exports2.ShiftPostRequest = exports2.ScheduleLogGetRequest = void 0;
|
|
6738
|
+
exports2.BufferedDauMessageSchema = exports2.DauMessagesGetParams = exports2.AgentRequest = exports2.AgentMessage = exports2.TaskListDeleteRequest = exports2.TaskListPostRequest = exports2.TaskDeleteRequest = exports2.TaskPostRequest = exports2.NotePostRequest = exports2.NoteGetRequest = exports2.DeleteNoteRequest = exports2.DeleteKeyDeleteRequest = exports2.FilterGetRequest = exports2.AccessCodeGetRequest = exports2.DebugMockClearPostRequest = exports2.DebugResetCursorPostRequest = exports2.DebugEmailDowntimeSummaryGetRequest = exports2.EmailTestHarnessPostRequestRefinement = exports2.EmailTestHarnessPostRequest = exports2.LoginPostRequest = exports2.CallBackGetRequest = exports2.DevicePostRequest = exports2.DeviceDeleteRequest = exports2.DashboardGetRquest = exports2.ManualDowntimeEndByStationRequest = exports2.IssueEventPostRequestRefinement = exports2.IssueEventPostRequest = exports2.IssueEventQueryRequest = exports2.IssuePostRequest = exports2.IssueIdGetRequest = exports2.DOWNTIME_NOTE_MAX_LENGTH = exports2.HISTORICAL_CORRECTION_WINDOW_MONTHS = exports2.MAX_HISTORICAL_CORRECTION_QUANTITY = exports2.ProductionAggregateWindowGetRequest = exports2.ProductionHistoricalCorrectionPostRequest = exports2.ProductionManualPostRequest = exports2.ShiftPatternDeleteRequest = exports2.ShiftPostRequest = exports2.ScheduleLogGetRequest = void 0;
|
|
6675
6739
|
var common_1 = require_common();
|
|
6676
6740
|
Object.defineProperty(exports2, "UNKNOWN_CODE", { enumerable: true, get: function() {
|
|
6677
6741
|
return common_1.UNKNOWN_CODE;
|
|
@@ -6854,6 +6918,9 @@ var require_api_schemas = __commonJS({
|
|
|
6854
6918
|
Object.defineProperty(exports2, "MAX_HISTORICAL_CORRECTION_QUANTITY", { enumerable: true, get: function() {
|
|
6855
6919
|
return production_1.MAX_HISTORICAL_CORRECTION_QUANTITY;
|
|
6856
6920
|
} });
|
|
6921
|
+
Object.defineProperty(exports2, "HISTORICAL_CORRECTION_WINDOW_MONTHS", { enumerable: true, get: function() {
|
|
6922
|
+
return production_1.HISTORICAL_CORRECTION_WINDOW_MONTHS;
|
|
6923
|
+
} });
|
|
6857
6924
|
var issue_1 = require_issue();
|
|
6858
6925
|
Object.defineProperty(exports2, "DOWNTIME_NOTE_MAX_LENGTH", { enumerable: true, get: function() {
|
|
6859
6926
|
return issue_1.DOWNTIME_NOTE_MAX_LENGTH;
|
|
@@ -7187,7 +7254,7 @@ var require_station_allowed_list = __commonJS({
|
|
|
7187
7254
|
"../../packages/common/build/utils/station-allowed-list.js"(exports2) {
|
|
7188
7255
|
"use strict";
|
|
7189
7256
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7190
|
-
exports2.getValidSkus = exports2.getValidReasons = exports2.
|
|
7257
|
+
exports2.getValidSkus = exports2.getValidReasons = exports2.requiredTaskRefs = exports2.requiredTaskListCodes = exports2.resolveTaskListCodes = exports2.resolveReasonCodes = exports2.flattenReasonCodes = void 0;
|
|
7191
7258
|
var flattenReasonCodes = (reasons) => {
|
|
7192
7259
|
const codes = [];
|
|
7193
7260
|
for (const reason of reasons) {
|
|
@@ -7224,16 +7291,15 @@ var require_station_allowed_list = __commonJS({
|
|
|
7224
7291
|
return codes;
|
|
7225
7292
|
};
|
|
7226
7293
|
exports2.resolveReasonCodes = resolveReasonCodes;
|
|
7227
|
-
var
|
|
7228
|
-
const hasAnyInclude = levels.some((level) => level?.includeTaskCodes?.length);
|
|
7294
|
+
var resolveTaskListCodes = (allCodes, ...levels) => {
|
|
7229
7295
|
const allCodesSet = new Set(allCodes);
|
|
7230
|
-
let codes =
|
|
7296
|
+
let codes = [];
|
|
7231
7297
|
for (const level of levels) {
|
|
7232
7298
|
if (!level) {
|
|
7233
7299
|
continue;
|
|
7234
7300
|
}
|
|
7235
|
-
if (level.
|
|
7236
|
-
const toAdd = level.
|
|
7301
|
+
if (level.includeTaskListCodes?.length) {
|
|
7302
|
+
const toAdd = level.includeTaskListCodes.filter((code) => allCodesSet.has(code));
|
|
7237
7303
|
const existing = new Set(codes);
|
|
7238
7304
|
for (const code of toAdd) {
|
|
7239
7305
|
if (!existing.has(code)) {
|
|
@@ -7241,16 +7307,16 @@ var require_station_allowed_list = __commonJS({
|
|
|
7241
7307
|
}
|
|
7242
7308
|
}
|
|
7243
7309
|
}
|
|
7244
|
-
if (level.
|
|
7245
|
-
const excludeSet = new Set(level.
|
|
7310
|
+
if (level.excludeTaskListCodes?.length) {
|
|
7311
|
+
const excludeSet = new Set(level.excludeTaskListCodes);
|
|
7246
7312
|
codes = codes.filter((code) => !excludeSet.has(code));
|
|
7247
7313
|
}
|
|
7248
7314
|
}
|
|
7249
7315
|
return codes;
|
|
7250
7316
|
};
|
|
7251
|
-
exports2.
|
|
7252
|
-
var
|
|
7253
|
-
const
|
|
7317
|
+
exports2.resolveTaskListCodes = resolveTaskListCodes;
|
|
7318
|
+
var requiredTaskListCodes = (manifest, stationCode) => {
|
|
7319
|
+
const allListCodes = (manifest.account.taskLists ?? []).map((list) => list.code);
|
|
7254
7320
|
let plant;
|
|
7255
7321
|
let group;
|
|
7256
7322
|
let station;
|
|
@@ -7269,21 +7335,40 @@ var require_station_allowed_list = __commonJS({
|
|
|
7269
7335
|
if (!station) {
|
|
7270
7336
|
return [];
|
|
7271
7337
|
}
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7338
|
+
return (0, exports2.resolveTaskListCodes)(allListCodes, manifest.account, plant, group, station);
|
|
7339
|
+
};
|
|
7340
|
+
exports2.requiredTaskListCodes = requiredTaskListCodes;
|
|
7341
|
+
var requiredTaskRefs = (manifest, stationCode) => {
|
|
7342
|
+
const listCodes = (0, exports2.requiredTaskListCodes)(manifest, stationCode);
|
|
7343
|
+
if (listCodes.length === 0) {
|
|
7344
|
+
return [];
|
|
7345
|
+
}
|
|
7346
|
+
const tasks = manifest.account.tasks ?? [];
|
|
7347
|
+
const refs = [];
|
|
7348
|
+
for (const listCode of listCodes) {
|
|
7349
|
+
const members = tasks.flatMap((task, position) => {
|
|
7350
|
+
const membership = (task.taskListCodes ?? []).find((entry) => entry.code.toLowerCase() === listCode.toLowerCase());
|
|
7351
|
+
return membership ? [{ taskCode: task.code, order: membership.order, position }] : [];
|
|
7352
|
+
});
|
|
7353
|
+
members.sort((a, b) => {
|
|
7354
|
+
if (a.order == null && b.order == null) {
|
|
7355
|
+
return a.position - b.position;
|
|
7356
|
+
}
|
|
7357
|
+
if (a.order == null) {
|
|
7358
|
+
return 1;
|
|
7359
|
+
}
|
|
7360
|
+
if (b.order == null) {
|
|
7361
|
+
return -1;
|
|
7281
7362
|
}
|
|
7363
|
+
return a.order - b.order;
|
|
7364
|
+
});
|
|
7365
|
+
for (const member of members) {
|
|
7366
|
+
refs.push({ taskCode: member.taskCode, taskListCode: listCode });
|
|
7282
7367
|
}
|
|
7283
7368
|
}
|
|
7284
|
-
return
|
|
7369
|
+
return refs;
|
|
7285
7370
|
};
|
|
7286
|
-
exports2.
|
|
7371
|
+
exports2.requiredTaskRefs = requiredTaskRefs;
|
|
7287
7372
|
var getValidReasons = (reasons, allowedReasonCodes) => {
|
|
7288
7373
|
if (!allowedReasonCodes) {
|
|
7289
7374
|
return reasons;
|
|
@@ -7359,6 +7444,48 @@ var require_feature_flags3 = __commonJS({
|
|
|
7359
7444
|
}
|
|
7360
7445
|
});
|
|
7361
7446
|
|
|
7447
|
+
// ../../packages/common/build/utils/task-list.js
|
|
7448
|
+
var require_task_list2 = __commonJS({
|
|
7449
|
+
"../../packages/common/build/utils/task-list.js"(exports2) {
|
|
7450
|
+
"use strict";
|
|
7451
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7452
|
+
exports2.taskListsFromManifest = taskListsFromManifest;
|
|
7453
|
+
exports2.taskListByCode = taskListByCode;
|
|
7454
|
+
exports2.taskListFrequency = taskListFrequency;
|
|
7455
|
+
exports2.taskListCodesOf = taskListCodesOf;
|
|
7456
|
+
exports2.taskListOrderOf = taskListOrderOf;
|
|
7457
|
+
exports2.isInTaskList = isInTaskList;
|
|
7458
|
+
exports2.nextTaskListOrder = nextTaskListOrder;
|
|
7459
|
+
var task_1 = require_task();
|
|
7460
|
+
function taskListsFromManifest(manifest) {
|
|
7461
|
+
return manifest.account.taskLists ?? [];
|
|
7462
|
+
}
|
|
7463
|
+
function taskListByCode(manifest, code) {
|
|
7464
|
+
return taskListsFromManifest(manifest).find((t) => t.code.toLowerCase() === code.toLowerCase());
|
|
7465
|
+
}
|
|
7466
|
+
function taskListFrequency(manifest, code) {
|
|
7467
|
+
return taskListByCode(manifest, code)?.frequency ?? { type: task_1.TASK_FREQUENCY_TYPE_SCHEDULE };
|
|
7468
|
+
}
|
|
7469
|
+
function taskListCodesOf(task) {
|
|
7470
|
+
return (task.taskListCodes ?? []).map((entry) => entry.code);
|
|
7471
|
+
}
|
|
7472
|
+
function taskListOrderOf(task, listCode) {
|
|
7473
|
+
return (task.taskListCodes ?? []).find((entry) => entry.code.toLowerCase() === listCode.toLowerCase())?.order;
|
|
7474
|
+
}
|
|
7475
|
+
function isInTaskList(task, listCode) {
|
|
7476
|
+
return (task.taskListCodes ?? []).some((entry) => entry.code.toLowerCase() === listCode.toLowerCase());
|
|
7477
|
+
}
|
|
7478
|
+
function nextTaskListOrder(tasks, listCode) {
|
|
7479
|
+
const orders = tasks.flatMap((task) => {
|
|
7480
|
+
const order = taskListOrderOf(task, listCode);
|
|
7481
|
+
return order == null ? [] : [order];
|
|
7482
|
+
});
|
|
7483
|
+
const next = orders.length === 0 ? 1 : Math.floor(Math.max(...orders)) + 1;
|
|
7484
|
+
return Math.min(Math.max(next, 1), task_1.TASK_LIST_ORDER_MAX);
|
|
7485
|
+
}
|
|
7486
|
+
}
|
|
7487
|
+
});
|
|
7488
|
+
|
|
7362
7489
|
// ../../packages/common/build/utils/station.js
|
|
7363
7490
|
var require_station3 = __commonJS({
|
|
7364
7491
|
"../../packages/common/build/utils/station.js"(exports2) {
|
|
@@ -7371,6 +7498,8 @@ var require_station3 = __commonJS({
|
|
|
7371
7498
|
var shift_1 = require_shift3();
|
|
7372
7499
|
var station_allowed_list_1 = require_station_allowed_list();
|
|
7373
7500
|
var feature_flags_1 = require_feature_flags3();
|
|
7501
|
+
var task_list_1 = require_task_list2();
|
|
7502
|
+
var task_1 = require_task();
|
|
7374
7503
|
function stationsFromManifest(manifest, options) {
|
|
7375
7504
|
if (!manifest) {
|
|
7376
7505
|
return [];
|
|
@@ -7409,10 +7538,24 @@ var require_station3 = __commonJS({
|
|
|
7409
7538
|
}
|
|
7410
7539
|
const allReasonCodes = manifest.account.reasons ? (0, station_allowed_list_1.flattenReasonCodes)(manifest.account.reasons) : [];
|
|
7411
7540
|
const stationResolvedReasonCodes = (0, station_allowed_list_1.resolveReasonCodes)(allReasonCodes, manifest.account, plant, group, station);
|
|
7412
|
-
const
|
|
7413
|
-
const
|
|
7414
|
-
|
|
7415
|
-
|
|
7541
|
+
const tasksByCode = new Map((manifest.account.tasks ?? []).map((task) => [task.code, task]));
|
|
7542
|
+
const requiredTasks = (0, feature_flags_1.resolveFlag)(manifest, "enableTasks") ? (0, station_allowed_list_1.requiredTaskRefs)(manifest, station.code).flatMap((ref) => {
|
|
7543
|
+
const task = tasksByCode.get(ref.taskCode);
|
|
7544
|
+
if (!task) {
|
|
7545
|
+
return [];
|
|
7546
|
+
}
|
|
7547
|
+
const list = (0, task_list_1.taskListByCode)(manifest, ref.taskListCode);
|
|
7548
|
+
return [
|
|
7549
|
+
{
|
|
7550
|
+
...task,
|
|
7551
|
+
taskListCode: ref.taskListCode,
|
|
7552
|
+
taskListName: list?.name ?? ref.taskListCode,
|
|
7553
|
+
// Frequency comes from the list, never from the Task's own legacy field.
|
|
7554
|
+
frequency: list?.frequency ?? { type: task_1.TASK_FREQUENCY_TYPE_SCHEDULE },
|
|
7555
|
+
order: (0, task_list_1.taskListOrderOf)(task, ref.taskListCode) ?? null
|
|
7556
|
+
}
|
|
7557
|
+
];
|
|
7558
|
+
}) : [];
|
|
7416
7559
|
const stationResult = {
|
|
7417
7560
|
accountId: manifest.account.id,
|
|
7418
7561
|
code: station.code,
|
|
@@ -8163,11 +8306,13 @@ var require_production3 = __commonJS({
|
|
|
8163
8306
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
8164
8307
|
};
|
|
8165
8308
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
8309
|
+
exports2.MAX_HISTORICAL_CORRECTIONS_PER_SCHEDULE = void 0;
|
|
8166
8310
|
exports2.productionCap = productionCap;
|
|
8167
8311
|
exports2.isAtProductionCap = isAtProductionCap;
|
|
8168
8312
|
exports2.exceedsProductionCap = exceedsProductionCap;
|
|
8169
8313
|
exports2.historicalCorrectionAnchor = historicalCorrectionAnchor;
|
|
8170
8314
|
exports2.isHistoricalCorrectionRow = isHistoricalCorrectionRow;
|
|
8315
|
+
exports2.nextHistoricalCorrectionAnchor = nextHistoricalCorrectionAnchor;
|
|
8171
8316
|
exports2.formatScheduleProductionCount = formatScheduleProductionCount;
|
|
8172
8317
|
exports2.processProduction = processProduction;
|
|
8173
8318
|
exports2.filterBySkuType = filterBySkuType;
|
|
@@ -8196,14 +8341,25 @@ var require_production3 = __commonJS({
|
|
|
8196
8341
|
}
|
|
8197
8342
|
return (quantityTotal ?? 0) + delta > cap;
|
|
8198
8343
|
}
|
|
8199
|
-
|
|
8200
|
-
|
|
8344
|
+
exports2.MAX_HISTORICAL_CORRECTIONS_PER_SCHEDULE = 100;
|
|
8345
|
+
function historicalCorrectionAnchor(actualEndAtTimestamp, sequence = 0) {
|
|
8346
|
+
return actualEndAtTimestamp - time_1.TimeIntervals["1s"].ms + sequence;
|
|
8201
8347
|
}
|
|
8202
8348
|
function isHistoricalCorrectionRow(production, schedule) {
|
|
8203
8349
|
if (schedule.actualEndAtTimestamp == null || production.type !== enums_1.PRODUCTION_TYPE.CORRECTION) {
|
|
8204
8350
|
return false;
|
|
8205
8351
|
}
|
|
8206
|
-
|
|
8352
|
+
const first = historicalCorrectionAnchor(schedule.actualEndAtTimestamp);
|
|
8353
|
+
return production.lastUnitAtTimestamp >= first && production.lastUnitAtTimestamp < first + exports2.MAX_HISTORICAL_CORRECTIONS_PER_SCHEDULE;
|
|
8354
|
+
}
|
|
8355
|
+
function nextHistoricalCorrectionAnchor(corrections, schedule) {
|
|
8356
|
+
const first = historicalCorrectionAnchor(schedule.actualEndAtTimestamp);
|
|
8357
|
+
const taken = corrections.filter((correction) => isHistoricalCorrectionRow(correction, schedule));
|
|
8358
|
+
if (taken.length === 0) {
|
|
8359
|
+
return first;
|
|
8360
|
+
}
|
|
8361
|
+
const next = Math.max(...taken.map((correction) => correction.lastUnitAtTimestamp)) + 1;
|
|
8362
|
+
return next < first + exports2.MAX_HISTORICAL_CORRECTIONS_PER_SCHEDULE ? next : null;
|
|
8207
8363
|
}
|
|
8208
8364
|
function formatScheduleProductionCount(manifest, quantityTotal) {
|
|
8209
8365
|
const formatted = (0, _1.roundTo)(quantityTotal ?? 0, 2).toLocaleString("en-us");
|
|
@@ -10293,8 +10449,8 @@ var require_station4 = __commonJS({
|
|
|
10293
10449
|
exports2.StationViewModel = schemas_1.StationSchema.omit({
|
|
10294
10450
|
includeReasonCodes: true,
|
|
10295
10451
|
excludeReasonCodes: true,
|
|
10296
|
-
|
|
10297
|
-
|
|
10452
|
+
includeTaskListCodes: true,
|
|
10453
|
+
excludeTaskListCodes: true,
|
|
10298
10454
|
createdAt: true,
|
|
10299
10455
|
updatedAt: true,
|
|
10300
10456
|
archivedAt: true,
|
|
@@ -10330,6 +10486,11 @@ var require_station4 = __commonJS({
|
|
|
10330
10486
|
notes: zod_1.z.array(note_1.NoteViewModel).optional().describe("Active notes attached to this station."),
|
|
10331
10487
|
allowedReasonCodes: zod_1.z.array(zod_1.z.string()).optional().describe("The reason codes available for this station after include/exclude filtering."),
|
|
10332
10488
|
requiredTasks: zod_1.z.array(task_1.TaskSchema.extend({
|
|
10489
|
+
taskListCode: zod_1.z.string().describe("The Task list this entry is being viewed through. A Task in two lists assigned to this station appears twice, once per list, each with that list's frequency and its own completion state."),
|
|
10490
|
+
taskListName: zod_1.z.string().nullish().describe("Name of the Task list this entry belongs to, falling back to the code."),
|
|
10491
|
+
taskListDescription: zod_1.z.string().nullish().describe("Description of the Task list this entry belongs to, shown as the subtitle on its tablet button."),
|
|
10492
|
+
frequency: task_1.TaskFrequencySchema.describe("The frequency of the Task list this entry belongs to \u2014 not the Task's own legacy field."),
|
|
10493
|
+
order: zod_1.z.number().nullish().describe("Display order of the Task within this list."),
|
|
10333
10494
|
completedAt: zod_1.z.string().nullish(),
|
|
10334
10495
|
lastCompletedAt: zod_1.z.string().nullish().describe("ISO timestamp of the most recent completion ('always'-frequency Tasks only). Such a Task is available again the instant it is completed, so it is never 'completed' \u2014 this records when it was last done."),
|
|
10335
10496
|
completedOperatorInitials: zod_1.z.string().nullish(),
|
|
@@ -10378,8 +10539,8 @@ var require_station_group3 = __commonJS({
|
|
|
10378
10539
|
exports2.StationGroupViewModel = schemas_1.StationGroupSchema.omit({
|
|
10379
10540
|
includeReasonCodes: true,
|
|
10380
10541
|
excludeReasonCodes: true,
|
|
10381
|
-
|
|
10382
|
-
|
|
10542
|
+
includeTaskListCodes: true,
|
|
10543
|
+
excludeTaskListCodes: true,
|
|
10383
10544
|
createdAt: true,
|
|
10384
10545
|
updatedAt: true,
|
|
10385
10546
|
// Feature-flag config fields are not exposed on the VM — consumers resolve a flag's effective value
|