@htilabs/platform-common-models 0.85.0 → 0.87.0

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 (64) hide show
  1. package/README.md +30 -0
  2. package/dist/{index-XWSYon40.d.cts → index-1pWiqEBC.d.cts} +1 -1
  3. package/dist/{index-Bh1zO_Vu.d.ts → index-uz57Fic9.d.ts} +1 -1
  4. package/dist/index.cjs +12 -1
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +3 -3
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +12 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/models/index.d.cts +2 -2
  11. package/dist/models/index.d.ts +2 -2
  12. package/dist/org-directory/index.cjs +8 -2
  13. package/dist/org-directory/index.cjs.map +1 -1
  14. package/dist/org-directory/index.d.cts +11 -2
  15. package/dist/org-directory/index.d.ts +11 -2
  16. package/dist/org-directory/index.js +8 -2
  17. package/dist/org-directory/index.js.map +1 -1
  18. package/dist/org-merge/index.cjs +8 -2
  19. package/dist/org-merge/index.cjs.map +1 -1
  20. package/dist/org-merge/index.js +8 -2
  21. package/dist/org-merge/index.js.map +1 -1
  22. package/dist/points-of-contact/index.cjs +229 -24
  23. package/dist/points-of-contact/index.cjs.map +1 -1
  24. package/dist/points-of-contact/index.d.cts +50 -5
  25. package/dist/points-of-contact/index.d.ts +50 -5
  26. package/dist/points-of-contact/index.js +226 -23
  27. package/dist/points-of-contact/index.js.map +1 -1
  28. package/dist/reader-BmhzOis-.d.ts +273 -0
  29. package/dist/reader-DfQtdw6n.d.cts +273 -0
  30. package/dist/schemas/index.cjs +12 -1
  31. package/dist/schemas/index.cjs.map +1 -1
  32. package/dist/schemas/index.d.cts +57 -27
  33. package/dist/schemas/index.d.ts +57 -27
  34. package/dist/schemas/index.js +12 -1
  35. package/dist/schemas/index.js.map +1 -1
  36. package/dist/seat-logs/index.cjs +815 -0
  37. package/dist/seat-logs/index.cjs.map +1 -0
  38. package/dist/seat-logs/index.d.cts +274 -0
  39. package/dist/seat-logs/index.d.ts +274 -0
  40. package/dist/seat-logs/index.js +742 -0
  41. package/dist/seat-logs/index.js.map +1 -0
  42. package/dist/validation/index.d.cts +1 -1
  43. package/dist/validation/index.d.ts +1 -1
  44. package/package.json +6 -1
  45. package/src/orgDirectory/__tests__/programDetails.test.ts +2 -1
  46. package/src/orgDirectory/__tests__/programTeamLink.test.ts +107 -0
  47. package/src/orgDirectory/schemas.ts +8 -1
  48. package/src/pointsOfContact/__tests__/seatContactLog.test.ts +170 -0
  49. package/src/pointsOfContact/readRules.ts +22 -4
  50. package/src/pointsOfContact/reader.ts +95 -1
  51. package/src/pointsOfContact/schemas.ts +4 -3
  52. package/src/schemas/organization-program.ts +25 -2
  53. package/src/seatLogs/__tests__/seatLogs.review.test.ts +222 -0
  54. package/src/seatLogs/__tests__/seatLogs.test.ts +335 -0
  55. package/src/seatLogs/index.ts +15 -0
  56. package/src/seatLogs/log.ts +700 -0
  57. package/src/seatLogs/personId.ts +100 -0
  58. package/src/seatLogs/personSlugWordlists.ts +40 -0
  59. package/src/seatLogs/reader.ts +143 -0
  60. package/src/seatLogs/schemas.ts +118 -0
  61. package/dist/{agency-CnVTwLeV.d.ts → agency-BHv54o79.d.ts} +4 -4
  62. package/dist/{agency-8ufZJJDH.d.cts → agency-Djp57S71.d.cts} +4 -4
  63. package/dist/{cvcEntry-D787utvP.d.cts → cvcEntry-DAuhe0cd.d.cts} +8 -8
  64. package/dist/{cvcEntry-D787utvP.d.ts → cvcEntry-DAuhe0cd.d.ts} +8 -8
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The Person id: `per-<first>-<second>`, name-free (Person § "The id carries no
3
+ * name": "Display names carry identity; ids are stable and name-free").
4
+ *
5
+ * Canon: platform-prototype `src/screens.jsx` @ 398fb24 `mintPersonId`
6
+ * (L24354-L24363), drawing from the directory's `person_slug_wordlists`
7
+ * (`first`, `second`), which the records repo's directory generator
8
+ * (`tools/build_platform_directory.py`) emits.
9
+ *
10
+ * The wordlists default to the vendored copy of the records monolith's
11
+ * `PERSON_FIRST` / `PERSON_SECOND` (`./personSlugWordlists.ts`); a caller may
12
+ * still pass a directory build's `person_slug_wordlists` instead.
13
+ */
14
+
15
+ import { PERSON_SLUG_WORDLISTS } from "./personSlugWordlists.js";
16
+
17
+ /** The directory build's slug wordlists. */
18
+ export interface PersonSlugWordlists {
19
+ first: readonly string[];
20
+ second: readonly string[];
21
+ }
22
+
23
+ /** `per-` then two lowercase words, optionally a numeric suffix (`-<n>`) when the pair pool was full. */
24
+ export const PERSON_ID_PATTERN = /^per-[a-z0-9]+-[a-z0-9]+(?:-\d+)?$/;
25
+
26
+ /** True for a string shaped like a Person id. */
27
+ export function isPersonId(v: unknown): v is string {
28
+ return typeof v === "string" && PERSON_ID_PATTERN.test(v);
29
+ }
30
+
31
+ /** A draw from `random` as an index into a list of `n`, clamped to `[0, n)`. */
32
+ function indexOf(r: number, n: number): number {
33
+ if (!Number.isFinite(r)) return 0;
34
+ return Math.min(n - 1, Math.max(0, Math.floor(r * n)));
35
+ }
36
+
37
+ /**
38
+ * Mint a Person id not in `taken`. `null` only when there are no wordlists
39
+ * (empty or `null`) — refuse rather than invent a shape.
40
+ *
41
+ * As the prototype (`mintPersonId`, screens.jsx L24352-L24363): up to 200
42
+ * random draws of `per-<first>-<second>`. If all 200 are taken, the whole
43
+ * two-word space is scanned in list order for a free pair. When every pair is
44
+ * taken (45 × 45 = 2,025 with the vendored lists), the records generator's
45
+ * full-pool rule applies (`generatePersonSlug`, records monolith: after its
46
+ * random tries fail it returns `<first>-<second>-<number 0-999>`): up to 200
47
+ * random `per-<first>-<second>-<0-999>`, then a deterministic scan over the
48
+ * pairs and suffixes 0, 1, 2, … until one is free, so a mint always ends.
49
+ *
50
+ * `taken` is a snapshot (every person id already held by a seat or a registry
51
+ * person; the caller supplies it), so two concurrent mints can return the
52
+ * same id: the store needs a UNIQUE index on the person id, and a caller
53
+ * retries the mint on a duplicate-key error. `random` must return `[0, 1)`;
54
+ * an out-of-range value is clamped. `wordlists` left `undefined` uses the
55
+ * vendored lists ({@link PERSON_SLUG_WORDLISTS}).
56
+ */
57
+ export function mintPersonId(
58
+ wordlists: PersonSlugWordlists | null | undefined = PERSON_SLUG_WORDLISTS,
59
+ taken: Iterable<string | null | undefined> = [],
60
+ random: () => number = Math.random,
61
+ ): string | null {
62
+ const F = wordlists?.first ?? [];
63
+ const S = wordlists?.second ?? [];
64
+ if (!F.length || !S.length) return null;
65
+ const used = new Set<string>();
66
+ for (const t of taken) if (t) used.add(t);
67
+ const pick = (list: readonly string[]) => list[indexOf(random(), list.length)];
68
+ for (let i = 0; i < 200; i++) {
69
+ const slug = "per-" + pick(F) + "-" + pick(S);
70
+ if (!used.has(slug)) return slug;
71
+ }
72
+ for (const f of F) {
73
+ for (const t of S) {
74
+ const slug = "per-" + f + "-" + t;
75
+ if (!used.has(slug)) return slug;
76
+ }
77
+ }
78
+ // Every pair is taken: the records generator's numeric suffix.
79
+ for (let i = 0; i < 200; i++) {
80
+ const slug = "per-" + pick(F) + "-" + pick(S) + "-" + indexOf(random(), 1000);
81
+ if (!used.has(slug)) return slug;
82
+ }
83
+ // `used` is finite, so this ends.
84
+ for (let num = 0; ; num++) {
85
+ for (const f of F) {
86
+ for (const t of S) {
87
+ const slug = "per-" + f + "-" + t + "-" + num;
88
+ if (!used.has(slug)) return slug;
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ /** Mint a Person id from the vendored wordlists, not in `taken` (or `null`). */
95
+ export function mintNewPersonId(
96
+ taken: Iterable<string | null | undefined> = [],
97
+ random: () => number = Math.random,
98
+ ): string | null {
99
+ return mintPersonId(PERSON_SLUG_WORDLISTS, taken, random);
100
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The Person id wordlists, vendored.
3
+ *
4
+ * Source: the records repo (htilabstech/prototype) @ 1be43ed5, the monolith
5
+ * `HTI-LEADS-PAVE-Thread-prototype.html` consts `PERSON_FIRST` and
6
+ * `PERSON_SECOND`, copied unchanged. The same lists reach the Platform
7
+ * prototype as the directory build's `person_slug_wordlists`
8
+ * (records `tools/build_platform_directory.py` → platform-prototype
9
+ * `src/data.js` `HTI_DIRECTORY.person_slug_wordlists`; equal at 398fb24).
10
+ *
11
+ * Do not hand-edit. A word added or removed in the records monolith is
12
+ * re-copied here; an id already minted keeps its words either way (ids are
13
+ * never re-derived from these lists).
14
+ */
15
+
16
+ import type { PersonSlugWordlists } from "./personId.js";
17
+
18
+ /** `PERSON_FIRST` (45 words). */
19
+ export const PERSON_SLUG_FIRST: readonly string[] = Object.freeze([
20
+ "agate", "alabaster", "amber", "amethyst", "azure", "basalt", "beryl", "bronze", "carnelian",
21
+ "cedar", "chrome", "cinnabar", "citrine", "copper", "coral", "crystal", "ember", "feldspar",
22
+ "flint", "garnet", "granite", "graphite", "hematite", "indigo", "iron", "ivory", "jade",
23
+ "jasper", "lapis", "malachite", "marble", "obsidian", "onyx", "opal", "pearl", "pewter",
24
+ "pyrite", "quartz", "sable", "silver", "slate", "sterling", "tin", "topaz", "tungsten",
25
+ ]);
26
+
27
+ /** `PERSON_SECOND` (45 words). */
28
+ export const PERSON_SLUG_SECOND: readonly string[] = Object.freeze([
29
+ "augur", "beacon", "cairn", "cipher", "compass", "crest", "crown", "ember", "envoy", "flame",
30
+ "glyph", "harbor", "herald", "keep", "ledger", "lighthouse", "lyre", "mantle", "monolith",
31
+ "oracle", "pillar", "plume", "quill", "relic", "rune", "scribe", "scroll", "seal", "sentinel",
32
+ "sigil", "sojourner", "spire", "standard", "tablet", "talisman", "thread", "torch", "totem",
33
+ "tower", "verse", "vessel", "warden", "watch", "witness", "wreath",
34
+ ]);
35
+
36
+ /** The vendored wordlists, the default for `mintPersonId`. */
37
+ export const PERSON_SLUG_WORDLISTS: PersonSlugWordlists = Object.freeze({
38
+ first: PERSON_SLUG_FIRST,
39
+ second: PERSON_SLUG_SECOND,
40
+ });
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Raw-driver reads of the seat logs (no mongoose, no driver import), typed
3
+ * structurally like the points-of-contact reads: a `mongodb` `Db` or a
4
+ * mongoose connection's `.db` both fit. Ids are the string form, so no
5
+ * ObjectId is needed. A stored row that does not match the entry shape
6
+ * throws by default (an unreadable log never reads as empty); a read that
7
+ * must go on past one bad row passes `{ invalid: "skip" }`.
8
+ */
9
+
10
+ import {
11
+ SEAT_CONTACTS_COLLECTION,
12
+ SEAT_NAMES_COLLECTION,
13
+ SeatContactEntrySchema,
14
+ SeatNameEntrySchema,
15
+ type SeatContactEntry,
16
+ type SeatLogSubjectType,
17
+ type SeatNameEntry,
18
+ } from "./schemas.js";
19
+
20
+ /** The slice of a driver `Db` the reads use. */
21
+ export interface SeatLogDbLike {
22
+ collection(name: string): {
23
+ find(filter: Record<string, unknown>): { toArray(): Promise<unknown[]> };
24
+ };
25
+ }
26
+
27
+ /** A stored entry that does not match the contract. */
28
+ export class SeatLogShapeError extends Error {
29
+ constructor(readonly entryId: string | null, readonly issues: string[]) {
30
+ super(`seat-logs: stored entry ${entryId ?? "(no id)"} does not match the contract: ${issues.join("; ")}`);
31
+ this.name = "SeatLogShapeError";
32
+ }
33
+ }
34
+
35
+ function strip(r: unknown): Record<string, unknown> {
36
+ if (r === null || typeof r !== "object") return {};
37
+ const { _id: _ignored, ...rest } = r as Record<string, unknown>;
38
+ return rest;
39
+ }
40
+
41
+ type ParseResult<T> =
42
+ | { success: true; data: T }
43
+ | { success: false; error: { issues: { path: (string | number)[]; message: string }[] } };
44
+
45
+ function parseWith<T>(schema: { safeParse(v: unknown): ParseResult<T> }, raw: unknown): T {
46
+ const row = strip(raw);
47
+ const p = schema.safeParse(row);
48
+ if (p.success) return p.data;
49
+ throw new SeatLogShapeError(
50
+ typeof row.entry_id === "string" ? row.entry_id : null,
51
+ p.error.issues.map((i) => `${i.path.join(".") || "(row)"}: ${i.message}`),
52
+ );
53
+ }
54
+
55
+ /** How a read treats a stored row that does not match the entry shape. */
56
+ export interface SeatLogReadOptions {
57
+ /**
58
+ * `throw` (default): the read fails with {@link SeatLogShapeError} — for a
59
+ * write path, which must not act on a log it cannot fully read.
60
+ * `skip`: the row is left out of its subject's log and reported to
61
+ * `onInvalidRow`; the rest of the read goes on.
62
+ */
63
+ invalid?: "throw" | "skip";
64
+ onInvalidRow?: (error: SeatLogShapeError) => void;
65
+ }
66
+
67
+ /**
68
+ * The id forms a subject id is matched in: as asked and lower-cased. A seat's
69
+ * log is stored under `String(users._id)` (24 lower-case hex); the base seat
70
+ * resolvers match `users._id` case-insensitively, so this does too.
71
+ */
72
+ const idForms = (id: string) => [...new Set([id, id.toLowerCase()])];
73
+
74
+ const byEntryId = (a: { entry_id: string }, b: { entry_id: string }) =>
75
+ a.entry_id < b.entry_id ? -1 : a.entry_id > b.entry_id ? 1 : 0;
76
+
77
+ async function readLogs<T extends { subject_id: string; entry_id: string }>(
78
+ db: SeatLogDbLike,
79
+ collection: string,
80
+ subjectType: SeatLogSubjectType,
81
+ subjectIds: readonly string[],
82
+ parse: (raw: unknown) => T,
83
+ opts: SeatLogReadOptions,
84
+ ): Promise<Map<string, T[]>> {
85
+ const ids = [...new Set(subjectIds.filter((s) => typeof s === "string" && s))];
86
+ const out = new Map<string, T[]>();
87
+ if (!ids.length) return out;
88
+ const askedByKey = new Map<string, string[]>();
89
+ for (const id of ids) {
90
+ const k = id.toLowerCase();
91
+ askedByKey.set(k, [...(askedByKey.get(k) ?? []), id]);
92
+ }
93
+ const raw = await db.collection(collection)
94
+ .find({ subject_type: subjectType, subject_id: { $in: ids.flatMap(idForms) } }).toArray();
95
+ for (const r of raw) {
96
+ let e: T;
97
+ try {
98
+ e = parse(r);
99
+ } catch (err) {
100
+ if (opts.invalid !== "skip" || !(err instanceof SeatLogShapeError)) throw err;
101
+ opts.onInvalidRow?.(err);
102
+ continue;
103
+ }
104
+ for (const asked of askedByKey.get(e.subject_id.toLowerCase()) ?? []) {
105
+ const list = out.get(asked) ?? [];
106
+ list.push(e);
107
+ out.set(asked, list);
108
+ }
109
+ }
110
+ // The prototype store lists a subject's entries in entry_id order
111
+ // (objectStore.js `entries`: Object.keys(...).sort()); "the first live
112
+ // entry" fallbacks depend on it.
113
+ for (const list of out.values()) list.sort(byEntryId);
114
+ return out;
115
+ }
116
+
117
+ /**
118
+ * Each subject's name entries (live and retired), in entry_id order, keyed by
119
+ * the subject id as asked (matched case-insensitively). Absent ids have no log.
120
+ */
121
+ export function readSeatNameLogs(
122
+ db: SeatLogDbLike,
123
+ subjectIds: readonly string[],
124
+ subjectType: SeatLogSubjectType = "user",
125
+ opts: SeatLogReadOptions = {},
126
+ ): Promise<Map<string, SeatNameEntry[]>> {
127
+ return readLogs(db, SEAT_NAMES_COLLECTION, subjectType, subjectIds,
128
+ (r) => parseWith<SeatNameEntry>(SeatNameEntrySchema, r), opts);
129
+ }
130
+
131
+ /**
132
+ * Each subject's contact entries (live and retired), in entry_id order, keyed
133
+ * by the subject id as asked (matched case-insensitively). Absent ids have no log.
134
+ */
135
+ export function readSeatContactLogs(
136
+ db: SeatLogDbLike,
137
+ subjectIds: readonly string[],
138
+ subjectType: SeatLogSubjectType = "user",
139
+ opts: SeatLogReadOptions = {},
140
+ ): Promise<Map<string, SeatContactEntry[]>> {
141
+ return readLogs(db, SEAT_CONTACTS_COLLECTION, subjectType, subjectIds,
142
+ (r) => parseWith<SeatContactEntry>(SeatContactEntrySchema, r), opts);
143
+ }
@@ -0,0 +1,118 @@
1
+ /**
2
+ * A seat's NAME log and CONTACT log: the stored entry shapes.
3
+ *
4
+ * Canon: platform-prototype `src/screens.jsx` @ 398fb24 `SeatNamesLedger`
5
+ * (L25149-L25288) and `SeatMethodsLedger` (L24981-L25137), over the object
6
+ * store `src/objectStore.js` (`addEntry` / `act`, L660-L740) and the spine
7
+ * cascade `src/objectStructuresEngine.generated.js` (`HTI_OBJECT_SPINE`,
8
+ * L942-L1049).
9
+ *
10
+ * The record (Person Data Object, step 6c, Crysta 2026-10-11): "a seat's name
11
+ * and contact rails stay keyed by the seat". So an entry's subject is the seat
12
+ * (`subject_type: "user"`, `subject_id` = the platform-db `users._id`, string
13
+ * form). A registry person's name rides the same log with
14
+ * `subject_type: "person"` (Person decision B).
15
+ *
16
+ * Names, contact details and addresses are not fields of a Person; each is
17
+ * its own log that points at the subject, so every entry carries its own
18
+ * source and dates (Person § 3). An entry is never edited in place: a
19
+ * correction inserts a new entry and archives the old one (`period_end`), and
20
+ * a retired entry stays in the log with its dates.
21
+ *
22
+ * Field shapes are the prototype's as stored: open dates are the empty string
23
+ * `""` (not null), a closed entry carries `period_end` `YYYY-MM-DD`; the store
24
+ * stamps an `events[]` audit trail (`{ act, at, actor }`) and a phone's
25
+ * `digits` key.
26
+ */
27
+
28
+ import { z } from "zod";
29
+
30
+ import { NameTypeKeys } from "../generated/cvc-enums.js";
31
+
32
+ /** Platform-db collection holding name entries (all subjects). */
33
+ export const SEAT_NAMES_COLLECTION = "seat_names";
34
+ /** Platform-db collection holding contact entries (all subjects). */
35
+ export const SEAT_CONTACTS_COLLECTION = "seat_contacts";
36
+
37
+ /** Whose log: a seat (`users._id`) or a registry person (`per-…` id). */
38
+ export const SEAT_LOG_SUBJECT_TYPES = ["user", "person"] as const;
39
+ export type SeatLogSubjectType = (typeof SEAT_LOG_SUBJECT_TYPES)[number];
40
+
41
+ /** The two contact types the seat ledger carries (prototype Email / Phone chips). */
42
+ export const SEAT_CONTACT_TYPES = ["email", "phone"] as const;
43
+ export type SeatContactType = (typeof SEAT_CONTACT_TYPES)[number];
44
+
45
+ /** CVC-1 `name_type` keys (the prototype stores `alias` / `legal`). */
46
+ export const SEAT_NAME_TYPES = Object.keys(NameTypeKeys) as [
47
+ keyof typeof NameTypeKeys,
48
+ ...(keyof typeof NameTypeKeys)[],
49
+ ];
50
+ export type SeatNameType = keyof typeof NameTypeKeys;
51
+
52
+ /** The name types the profile's add row offers, in its chip order. */
53
+ export const SEAT_NAME_ADD_TYPES = [
54
+ { name_type: "alias", label: "Also known as" },
55
+ { name_type: "legal", label: "Legal name" },
56
+ ] as const satisfies readonly { name_type: SeatNameType; label: string }[];
57
+
58
+ /** One audit event the store stamps on an entry. */
59
+ export const SeatLogEventSchema = z.object({
60
+ /** `add`, `set_display`, `set_preferred`, `archive`, or `cascade` (a sibling's flag moved). */
61
+ act: z.string().min(1),
62
+ /** ISO instant. */
63
+ at: z.string().min(1),
64
+ /** The acting seat's id. */
65
+ actor: z.string(),
66
+ });
67
+ export type SeatLogEvent = z.infer<typeof SeatLogEventSchema>;
68
+
69
+ /** `""` (open) or a `YYYY-MM-DD` day. */
70
+ const DayOrEmpty = z.union([z.literal(""), z.string().regex(/^\d{4}-\d{2}-\d{2}$/)]);
71
+
72
+ const subjectShape = {
73
+ entry_id: z.string().min(1),
74
+ subject_id: z.string().min(1),
75
+ subject_type: z.enum(SEAT_LOG_SUBJECT_TYPES),
76
+ period_start: DayOrEmpty,
77
+ period_end: DayOrEmpty,
78
+ /** Where the entry came from (`admin_hub` on the profile). */
79
+ source: z.string(),
80
+ /** How it was captured (`direct_entry` on the profile). */
81
+ method: z.string(),
82
+ notes: z.string(),
83
+ events: z.array(SeatLogEventSchema).optional(),
84
+ };
85
+
86
+ /** One name in a seat's (or registry person's) name log. */
87
+ export const SeatNameEntrySchema = z.object({
88
+ ...subjectShape,
89
+ name_type: z.enum(SEAT_NAME_TYPES),
90
+ /** The name as written. */
91
+ raw: z.string().min(1),
92
+ /** The display name: one live entry per subject carries it. */
93
+ is_display: z.boolean(),
94
+ /** Set with the display mark on the profile (prototype acts both together). */
95
+ is_preferred: z.boolean(),
96
+ });
97
+ export type SeatNameEntry = z.infer<typeof SeatNameEntrySchema>;
98
+
99
+ /** One email or phone in a seat's contact log. */
100
+ export const SeatContactEntrySchema = z.object({
101
+ ...subjectShape,
102
+ contact_type: z.enum(SEAT_CONTACT_TYPES),
103
+ /** Email trimmed; phone in the store's canonical display form ({@link canonSeatContactValue}). */
104
+ value: z.string().min(1),
105
+ use: z.string(),
106
+ /** The preferred entry of its type: one live entry per subject and type carries it. */
107
+ is_preferred: z.boolean(),
108
+ safety_status: z.string(),
109
+ /** Phone only: the identity key ({@link seatContactKey}), stamped by the store. */
110
+ digits: z.string().optional(),
111
+ });
112
+ export type SeatContactEntry = z.infer<typeof SeatContactEntrySchema>;
113
+
114
+ /** The subject an operation acts on. */
115
+ export interface SeatLogSubject {
116
+ subject_type: SeatLogSubjectType;
117
+ subject_id: string;
118
+ }
@@ -199,6 +199,8 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
199
199
  definition: z.ZodNullable<z.ZodString>;
200
200
  }, z.ZodTypeAny, "passthrough">>, "many">;
201
201
  }, "strip", z.ZodTypeAny, {
202
+ name: string;
203
+ version: string;
202
204
  entries: z.objectOutputType<{
203
205
  code: z.ZodString;
204
206
  key: z.ZodString;
@@ -208,11 +210,11 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
208
210
  childCodes: z.ZodArray<z.ZodString, "many">;
209
211
  definition: z.ZodNullable<z.ZodString>;
210
212
  }, z.ZodTypeAny, "passthrough">[];
211
- name: string;
212
- version: string;
213
213
  domain: string;
214
214
  levels: Record<string, string>;
215
215
  }, {
216
+ name: string;
217
+ version: string;
216
218
  entries: z.objectInputType<{
217
219
  code: z.ZodString;
218
220
  key: z.ZodString;
@@ -222,8 +224,6 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
222
224
  childCodes: z.ZodArray<z.ZodString, "many">;
223
225
  definition: z.ZodNullable<z.ZodString>;
224
226
  }, z.ZodTypeAny, "passthrough">[];
225
- name: string;
226
- version: string;
227
227
  domain: string;
228
228
  levels: Record<string, string>;
229
229
  }>;
@@ -199,6 +199,8 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
199
199
  definition: z.ZodNullable<z.ZodString>;
200
200
  }, z.ZodTypeAny, "passthrough">>, "many">;
201
201
  }, "strip", z.ZodTypeAny, {
202
+ name: string;
203
+ version: string;
202
204
  entries: z.objectOutputType<{
203
205
  code: z.ZodString;
204
206
  key: z.ZodString;
@@ -208,11 +210,11 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
208
210
  childCodes: z.ZodArray<z.ZodString, "many">;
209
211
  definition: z.ZodNullable<z.ZodString>;
210
212
  }, z.ZodTypeAny, "passthrough">[];
211
- name: string;
212
- version: string;
213
213
  domain: string;
214
214
  levels: Record<string, string>;
215
215
  }, {
216
+ name: string;
217
+ version: string;
216
218
  entries: z.objectInputType<{
217
219
  code: z.ZodString;
218
220
  key: z.ZodString;
@@ -222,8 +224,6 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
222
224
  childCodes: z.ZodArray<z.ZodString, "many">;
223
225
  definition: z.ZodNullable<z.ZodString>;
224
226
  }, z.ZodTypeAny, "passthrough">[];
225
- name: string;
226
- version: string;
227
227
  domain: string;
228
228
  levels: Record<string, string>;
229
229
  }>;
@@ -199,20 +199,20 @@ type Form = InferRawDocType<typeof _formSchema>;
199
199
  declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
200
200
  _id: false;
201
201
  }, {
202
- questionId: string;
203
202
  index: number;
203
+ questionId: string;
204
204
  questionVersion: string;
205
205
  }, mongoose.Document<unknown, {}, {
206
- questionId: string;
207
206
  index: number;
207
+ questionId: string;
208
208
  questionVersion: string;
209
209
  }, {
210
210
  id: string;
211
211
  }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
212
212
  _id: false;
213
213
  }>> & Omit<{
214
- questionId: string;
215
214
  index: number;
215
+ questionId: string;
216
216
  questionVersion: string;
217
217
  } & {
218
218
  _id: mongoose.Types.ObjectId;
@@ -221,8 +221,8 @@ declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any
221
221
  }, "id"> & {
222
222
  id: string;
223
223
  }, unknown, {
224
- questionId: string;
225
224
  index: number;
225
+ questionId: string;
226
226
  questionVersion: string;
227
227
  } & {
228
228
  _id: mongoose.Types.ObjectId;
@@ -326,20 +326,20 @@ declare const sectionSchemaDefinition: {
326
326
  type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
327
327
  _id: false;
328
328
  }, {
329
- questionId: string;
330
329
  index: number;
330
+ questionId: string;
331
331
  questionVersion: string;
332
332
  }, mongoose.Document<unknown, {}, {
333
- questionId: string;
334
333
  index: number;
334
+ questionId: string;
335
335
  questionVersion: string;
336
336
  }, {
337
337
  id: string;
338
338
  }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
339
339
  _id: false;
340
340
  }>> & Omit<{
341
- questionId: string;
342
341
  index: number;
342
+ questionId: string;
343
343
  questionVersion: string;
344
344
  } & {
345
345
  _id: mongoose.Types.ObjectId;
@@ -348,8 +348,8 @@ declare const sectionSchemaDefinition: {
348
348
  }, "id"> & {
349
349
  id: string;
350
350
  }, unknown, {
351
- questionId: string;
352
351
  index: number;
352
+ questionId: string;
353
353
  questionVersion: string;
354
354
  } & {
355
355
  _id: mongoose.Types.ObjectId;
@@ -199,20 +199,20 @@ type Form = InferRawDocType<typeof _formSchema>;
199
199
  declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
200
200
  _id: false;
201
201
  }, {
202
- questionId: string;
203
202
  index: number;
203
+ questionId: string;
204
204
  questionVersion: string;
205
205
  }, mongoose.Document<unknown, {}, {
206
- questionId: string;
207
206
  index: number;
207
+ questionId: string;
208
208
  questionVersion: string;
209
209
  }, {
210
210
  id: string;
211
211
  }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
212
212
  _id: false;
213
213
  }>> & Omit<{
214
- questionId: string;
215
214
  index: number;
215
+ questionId: string;
216
216
  questionVersion: string;
217
217
  } & {
218
218
  _id: mongoose.Types.ObjectId;
@@ -221,8 +221,8 @@ declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any
221
221
  }, "id"> & {
222
222
  id: string;
223
223
  }, unknown, {
224
- questionId: string;
225
224
  index: number;
225
+ questionId: string;
226
226
  questionVersion: string;
227
227
  } & {
228
228
  _id: mongoose.Types.ObjectId;
@@ -326,20 +326,20 @@ declare const sectionSchemaDefinition: {
326
326
  type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
327
327
  _id: false;
328
328
  }, {
329
- questionId: string;
330
329
  index: number;
330
+ questionId: string;
331
331
  questionVersion: string;
332
332
  }, mongoose.Document<unknown, {}, {
333
- questionId: string;
334
333
  index: number;
334
+ questionId: string;
335
335
  questionVersion: string;
336
336
  }, {
337
337
  id: string;
338
338
  }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
339
339
  _id: false;
340
340
  }>> & Omit<{
341
- questionId: string;
342
341
  index: number;
342
+ questionId: string;
343
343
  questionVersion: string;
344
344
  } & {
345
345
  _id: mongoose.Types.ObjectId;
@@ -348,8 +348,8 @@ declare const sectionSchemaDefinition: {
348
348
  }, "id"> & {
349
349
  id: string;
350
350
  }, unknown, {
351
- questionId: string;
352
351
  index: number;
352
+ questionId: string;
353
353
  questionVersion: string;
354
354
  } & {
355
355
  _id: mongoose.Types.ObjectId;