/** * Zod schemas for the dispatch-priority write and read paths. * * These replace hand-rolled coercion and validation. The rules that matter are stated once, * declaratively, instead of being spread across bespoke helpers. * * **Domain assumption.** A `sequenceNumber` is an ERP routing step and a `priority` is an * ordinal rank. Routing steps are small numbers, conventionally multiples of ten so steps * can be inserted between them, with at most a decimal place or two. The bounds below * encode that as sanity checks with plain messages. They are not what correctness rests * on: MM's columns are float32 (`real`), and `dispatch-priorities.ts` compares sequence * numbers and ranks *in float32*, the way MM does, so the SDK and the database agree on * equality by construction whatever the magnitude. */ import { z } from "zod"; /** * Upper bound for a routing step: far above any real one. Sanity, not correctness — the * identity key already compares sequence numbers as MM stores them. */ export declare const MAX_SEQUENCE_NUMBER = 10000000; /** * Smallest nonzero routing step. Generous — a thousandth of a step is finer than any * routing scheme uses — and it makes the bound symmetric: without it a value far below the * bottom of the column's range would store as `0` and name a different operation. */ export declare const MIN_NONZERO_SEQUENCE_NUMBER = 0.001; /** * One row as the caller supplies it, whether hand-built or read back from a cache/JSON row. * `scopeResourceId` may be blank: `replaceDispatchPriorityScope` stamps the scope of the * call, and only rejects a row that names a *different* scope. */ export declare const dispatchPriorityInputSchema: z.ZodObject<{ authorityOperationId: z.ZodEffects, string, string | number>, string, string | number>; scopeResourceId: z.ZodEffects>>, string, string | number | null | undefined>; workOrderId: z.ZodEffects, string, string | number>, string, string | number>; sequenceNumber: z.ZodPipeline, number, string | number>, number, string | number>, z.ZodEffects>; lot: z.ZodEffects>>, string, string | number | null | undefined>; split: z.ZodEffects>>, string, string | number | null | undefined>; sub: z.ZodEffects>>, string, string | number | null | undefined>; /** * An ordinal sort key. There is no domain bound to assert — an authority may rank by a * score of its own devising — but it must at least be a value the column can hold. A value * that overflows would store as `Infinity`, sorting to an extreme and breaking reads of the * whole scope. Values too *small* to survive are left alone: they store as `0`, which is * where they already sorted. * * Magnitude still matters for a reason no per-row rule can see: a `real` column stops * separating neighbouring values well before it overflows, so two distinct ranks can * collapse into one. Such rows are still valid: `replaceDispatchPriorityScope` sends a * scope's rows in rank order, so MM's own tie-break on insert order keeps the authority's * ordering, and reports the collapse (`ranksCollapsedByStorage`) as a warning rather than * rejecting the scope. */ priority: z.ZodEffects, number, string | number>, number, string | number>, number, string | number>; preallocatedMachineResourceId: z.ZodEffects>>, string, string | number | null | undefined>, string | null, string | number | null | undefined>; customFieldsSchemaRef: z.ZodEffects, number, string | number>, number, string | number>, z.ZodNumber>>>, number | null, string | number | null | undefined>; customFields: z.ZodEffects>>, Record | null, Record | null | undefined>; }, "strip", z.ZodTypeAny, { lot: string; sequenceNumber: number; split: string; workOrderId: string; sub: string; customFieldsSchemaRef: number | null; customFields: Record | null; authorityOperationId: string; scopeResourceId: string; preallocatedMachineResourceId: string | null; priority: number; }, { sequenceNumber: string | number; workOrderId: string | number; authorityOperationId: string | number; priority: string | number; lot?: string | number | null | undefined; split?: string | number | null | undefined; sub?: string | number | null | undefined; customFieldsSchemaRef?: string | number | null | undefined; customFields?: Record | null | undefined; scopeResourceId?: string | number | null | undefined; preallocatedMachineResourceId?: string | number | null | undefined; }>; export type DispatchPriorityInput = z.infer; /** * One row as MM's GraphQL returns it. Hasura renders bigint and float as number or string. * * Looser than the write schema on *domain* rules: reads accept whatever MM holds, including * rows another writer created, so the routing-step bounds are not applied here. * * Stricter in one respect. The text columns are taken **verbatim**, not through the write * path's trimming: Postgres compares this text exactly, so a row another writer stored as * `" 0 "` has to read back as `" 0 "`. Trimming it to `"0"` would make a diff-by-scope * believe it matches a row we would write, and a missing column would read as `""` instead * of failing. Likewise `priority` and `sequenceNumber` read back as whatever number the * column holds, non-finite included; only the surrogate key must be a finite number. */ export declare const dispatchPriorityRowSchema: z.ZodObject<{ dispatchPriorityRef: z.ZodEffects, number, string | number>, number, string | number>; companyId: z.ZodString; authorityOperationId: z.ZodEffects>, string | null, string | null | undefined>; scopeResourceId: z.ZodString; workOrderId: z.ZodString; sequenceNumber: z.ZodEffects, number, string | number>; lot: z.ZodString; split: z.ZodString; sub: z.ZodString; preallocatedMachineResourceId: z.ZodEffects>, string | null, string | null | undefined>; priority: z.ZodEffects, number, string | number>; createdAt: z.ZodString; updatedAt: z.ZodString; customFieldsSchemaRef: z.ZodEffects, number, string | number>, number, string | number>>>, number | null, string | number | null | undefined>; customFields: z.ZodEffects>>, Record | null, Record | null | undefined>; }, "strip", z.ZodTypeAny, { createdAt: string; lot: string; sequenceNumber: number; split: string; updatedAt: string; workOrderId: string; sub: string; customFieldsSchemaRef: number | null; customFields: Record | null; companyId: string; dispatchPriorityRef: number; authorityOperationId: string | null; scopeResourceId: string; preallocatedMachineResourceId: string | null; priority: number; }, { createdAt: string; lot: string; sequenceNumber: string | number; split: string; updatedAt: string; workOrderId: string; sub: string; companyId: string; dispatchPriorityRef: string | number; scopeResourceId: string; priority: string | number; customFieldsSchemaRef?: string | number | null | undefined; customFields?: Record | null | undefined; authorityOperationId?: string | null | undefined; preallocatedMachineResourceId?: string | null | undefined; }>; /** `field is required` / `sequenceNumber must be a finite number`, from the first issue. */ export declare function describeZodIssue(error: z.ZodError): string; //# sourceMappingURL=dispatch-priority-schemas.d.ts.map