@ai-matrx/records 0.55.1 → 0.56.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.
@@ -4259,4 +4259,338 @@ interface FieldPatch {
4259
4259
  expr?: Record<string, unknown>;
4260
4260
  }
4261
4261
 
4262
- export { MERGE_FIELD_MODIFIERS as $, ABSENCE_REASONS as A, CONTEXT_POLICIES as B, type ComputeOn as C, DECLARABLE_FIELD_KINDS as D, DELIVERIES as E, type FieldTypeWord as F, type DeclarableFieldKind as G, type Delivery as H, ENTITY_TOKENS as I, type EntityToken as J, FIELD_SENSITIVITIES as K, FIELD_SOURCES as L, FRESHNESS as M, type NewFieldDeclaration as N, type OnDelete as O, type PgError as P, type FieldBehavior as Q, type RelationFlavor as R, type StorageMode as S, type TableType as T, type Uuid as U, type ForbiddenEnvelopeWord as V, type WriteConflict as W, type Freshness as X, type HiddenFieldNotice as Y, KERNEL_TABLES as Z, type KernelTableName as _, type TableDisplay as a, MERGE_FIELD_SEMANTIC_TYPES as a0, MERGE_FIELD_SOURCES as a1, type MergeFieldModifier as a2, type MergeFieldSemanticType as a3, type MergeFieldSource as a4, ON_DELETE as a5, OVERRIDE_POLICIES as a6, type OverridePolicy as a7, PARITY_FIELD_TYPES as a8, PER_VALUE_ACCESS_WORDS as a9, VALUE_ALTERNATE_KEYS as aA, VALUE_ENVELOPE_KEYS as aB, type ValueAlternate as aC, type ValueAlternateKey as aD, type ValueEnvelope as aE, type ValueEnvelopeKey as aF, type ValueSource as aG, err as aH, isRecordsErr as aI, ok as aJ, type ParityFieldType as aa, type ParityFieldTypeDescriptor as ab, type PerValueAccessWord as ac, type ProvenancePointer as ad, RELATION_BINDINGS as ae, RELATION_CARDINALITIES as af, RELATION_FLAVORS as ag, RETIRED_ACTOR_WORDS as ah, RULE_NODE_KINDS as ai, RULE_USES as aj, type RecordsErrorCode as ak, type RelationBinding as al, type RelationDisplay as am, type RetiredActorWord as an, type RuleNodeKind as ao, type RuleUse as ap, STORAGE_MODES as aq, STORE_DOORS as ar, STORE_KNOBS as as, STORE_REFUSAL_CODES as at, type StoreDoorName as au, type StoreRefusalCode as av, TABLE_DISPLAYS as aw, TABLE_ORIGINS as ax, TABLE_TYPES as ay, type TableOrigin as az, type FieldSource as b, type FieldRule as c, type FieldSensitivity as d, type ContextPolicy as e, type RelationCardinality as f, type Timestamp as g, type RecordDocument as h, type RecordsResult as i, type RecordGraphWritten as j, type RecordRead as k, type ReadRow as l, type Field as m, type StoredRecord as n, type FieldPatch as o, type RecordRevision as p, type ReadValue as q, type FieldProposal as r, type TableProposal as s, type RecordsError as t, type StaleWriteDetail as u, type PredictedRefusal as v, ACTOR_VOCABULARY as w, type AbsenceReason as x, type Actor as y, COMPUTE_ON as z };
4262
+ /**
4263
+ * Who the data belongs to. A test organization is created under this name — the
4264
+ * owner's law #4: every organization, table, record, form, portal, dashboard,
4265
+ * document, checklist, booking page, capture sheet, subscription, pipeline and
4266
+ * enrichment created for a test carries the use case's own name. Cleanup finds
4267
+ * a test organization by `cleanupTag` in its settings, NEVER by a junk name.
4268
+ */
4269
+ interface BusinessIdentity {
4270
+ /** "Harbor Dental Group" — what goes on the organization, the invoice, the screenshot. */
4271
+ name: string;
4272
+ /** "Harbor Dental Group, PLLC" — used on documents that need the legal entity. */
4273
+ legalName?: string;
4274
+ /** One line a stranger would understand: "A six-chair family dental practice." */
4275
+ describes: string;
4276
+ /** Plausible and synthesized. Never a real business's real address. */
4277
+ address: PostalAddress;
4278
+ /** Synthesized, E.164-shaped or the local convention the document uses. */
4279
+ phone: string;
4280
+ /**
4281
+ * Synthesized. NOT a `.example` domain — those read as fake on a screenshot.
4282
+ * Optional, because the law welcomes personal-life use cases and a household
4283
+ * renovation or a family recipe collection genuinely has no website.
4284
+ */
4285
+ website?: string;
4286
+ /** Synthesized mailbox on the same domain: "frontdesk@harbordentalgroup.com". */
4287
+ email: string;
4288
+ /** IANA zone, so dates in the rows make sense together. */
4289
+ timezone: string;
4290
+ }
4291
+ interface PostalAddress {
4292
+ line1: string;
4293
+ line2?: string;
4294
+ city: string;
4295
+ /** State, province or region, in the country's own convention. */
4296
+ region: string;
4297
+ postalCode: string;
4298
+ /** ISO 3166-1 alpha-2. */
4299
+ country: string;
4300
+ }
4301
+ /**
4302
+ * One table of the business, in the words the practitioner uses. `token` is the
4303
+ * slug the store addresses it by; `name` is what a person reads.
4304
+ */
4305
+ interface UseCaseTable {
4306
+ /** snake_case, singular, the practitioner's noun: "patient", "work_order". */
4307
+ token: string;
4308
+ /** "Patients", "Work orders". */
4309
+ name: string;
4310
+ labelSingular: string;
4311
+ labelPlural: string;
4312
+ /** REC-32. One of the seven, closed. Most business tables are `entity`. */
4313
+ type: TableType;
4314
+ display: TableDisplay;
4315
+ /** REC-4. `light` is the whole document; `heavy` is indexed on write. */
4316
+ weight: StorageMode;
4317
+ ordered: boolean;
4318
+ /** A lucide icon name, so the screen is not a wall of identical rows. */
4319
+ icon?: string;
4320
+ /** REC-2. The field key whose value titles a record. Must be a declared field. */
4321
+ titleField: string;
4322
+ /** What this table is FOR, in the practitioner's words. */
4323
+ describes: string;
4324
+ fields: UseCaseField[];
4325
+ /** The seed rows. Enough that the screen looks like a working business. */
4326
+ rows: UseCaseRow[];
4327
+ }
4328
+ /**
4329
+ * One field. `parityType` is the word a person picks in the UI and it must be
4330
+ * one the store resolves — any parity type the store ships, any behaviour they
4331
+ * are made of, or one of the plain synonyms (see `FieldTypeWord`). The set is
4332
+ * `RESOLVABLE_FIELD_TYPE_WORDS`, derived from the registry; never a count or a
4333
+ * list typed out here.
4334
+ */
4335
+ interface UseCaseField {
4336
+ /** snake_case, the practitioner's own name for it: "date_of_birth", "po_number". */
4337
+ key: string;
4338
+ /** "Date of birth", "PO number". Sentence case, the way the form reads. */
4339
+ label: string;
4340
+ parityType: FieldTypeWord;
4341
+ /** FLD-2. The shape of the value, never a second behaviour. */
4342
+ multi?: boolean;
4343
+ /** FLD-2. The values carry their own dates. */
4344
+ dated?: boolean;
4345
+ required?: boolean;
4346
+ /** FLD-N-1. The unit CHANGES THE MEANING and lives on the field: "USD", "lb", "mi". */
4347
+ unit?: string | null;
4348
+ /** "currency", "percent", "email", "phone", "url", "date". Never decoration. */
4349
+ format?: string | null;
4350
+ /** FLD-7. Where the values come from. Defaults to `manual`. */
4351
+ source?: FieldSource;
4352
+ /** FLD-9. A formula says whether it computes on read or on write. */
4353
+ computeOn?: ComputeOn;
4354
+ /** FLD-3. Validation rules the store will enforce. */
4355
+ rules?: FieldRule[];
4356
+ /**
4357
+ * For `select` / `multi_select`: the REAL lifecycle words of this business,
4358
+ * in the order they actually happen. "Scheduled, Confirmed, Seen, No-show" —
4359
+ * never "Option A, Option B".
4360
+ */
4361
+ choices?: string[];
4362
+ /** For a relation field: the `token` of the table it points at. */
4363
+ relationTarget?: string;
4364
+ relationMax?: number;
4365
+ /** AGT-7. The ceiling a merge field's delivery can never widen. */
4366
+ sensitivity: FieldSensitivity;
4367
+ /** FLD-12. Whether an agent may see this field's values at all. */
4368
+ contextPolicy: ContextPolicy;
4369
+ /** What the practitioner would be told about this field, if anything. */
4370
+ help?: string;
4371
+ }
4372
+ /**
4373
+ * One row of seed data.
4374
+ *
4375
+ * `key` is a stable LOCAL id (not a UUID): relationships across tables point at
4376
+ * it, so a template is readable and a seeder can resolve the graph in one pass
4377
+ * without inventing identifiers. Use a meaningful slug — "patient-rivera-m",
4378
+ * not "row-7".
4379
+ */
4380
+ interface UseCaseRow {
4381
+ key: string;
4382
+ /**
4383
+ * Keyed by the table's field keys. A relation field's value is the `key` (or
4384
+ * an array of keys) of rows in the target table.
4385
+ */
4386
+ values: Record<string, unknown>;
4387
+ }
4388
+ /**
4389
+ * REL-1…REL-9. The domain truth, stated once: "an invoice belongs to the job it
4390
+ * bills, and a job belongs to the client who asked for it."
4391
+ *
4392
+ * The field side carries `relationTarget`; this is the declaration a seeder
4393
+ * reads, because it also carries the flavour, the cardinality, what happens to
4394
+ * the far side on delete, and the reverse name.
4395
+ */
4396
+ interface UseCaseRelationship {
4397
+ /** One sentence of domain truth. Not "links A to B". */
4398
+ describes: string;
4399
+ /** The table that HOLDS the relation field. */
4400
+ fromTable: string;
4401
+ /** The field key on `fromTable`. Must be declared and must be a relation. */
4402
+ fromField: string;
4403
+ /** The `token` of the table it points at. */
4404
+ toTable: string;
4405
+ /** REL-1. Ownership is one fact, stored once, read from the field's side. */
4406
+ flavor: RelationFlavor;
4407
+ /** REL-7. */
4408
+ cardinality: RelationCardinality;
4409
+ /** REL-2. What happens to the far side, separate from flavour. */
4410
+ onDelete: OnDelete;
4411
+ /** REL-9. The reverse, visible from both ends, and NOT a second field. */
4412
+ inverseKey: string;
4413
+ }
4414
+ /** Who is allowed to open a form. */
4415
+ type FormAudience = "public" | "member" | "staff";
4416
+ /**
4417
+ * A form a practitioner in this business would actually put in front of someone
4418
+ * — "the Harbor Dental new-patient intake", never "Test Form 1".
4419
+ */
4420
+ interface UseCaseForm {
4421
+ token: string;
4422
+ name: string;
4423
+ /** What it is for, and who fills it in. */
4424
+ describes: string;
4425
+ audience: FormAudience;
4426
+ /** The table a submission becomes a record of. */
4427
+ table: string;
4428
+ fields: UseCaseFormField[];
4429
+ submitLabel: string;
4430
+ /** What the person sees after they submit. Real words, not "Success!". */
4431
+ confirmation: string;
4432
+ }
4433
+ interface UseCaseFormField {
4434
+ /** A field key on the form's table. */
4435
+ fieldKey: string;
4436
+ /** Override the field's own label when the form asks it differently. */
4437
+ label?: string;
4438
+ required?: boolean;
4439
+ /** The helper line under the input, if a practitioner would want one. */
4440
+ help?: string;
4441
+ }
4442
+ /**
4443
+ * The real lifecycle a record moves through in this business, in order. A
4444
+ * pipeline's stages are the words the staff say out loud.
4445
+ */
4446
+ interface UseCasePipeline {
4447
+ token: string;
4448
+ name: string;
4449
+ describes: string;
4450
+ /** The table whose records move through it. */
4451
+ table: string;
4452
+ /** The `select` field that holds the current stage. */
4453
+ stageField: string;
4454
+ stages: UseCasePipelineStage[];
4455
+ }
4456
+ interface UseCasePipelineStage {
4457
+ /** Must appear in the stage field's `choices`. */
4458
+ key: string;
4459
+ label: string;
4460
+ /** What is true of a record sitting here, and what moves it on. */
4461
+ describes: string;
4462
+ /** Roughly how long a record sits here, so a board looks believable. */
4463
+ typicalDurationDays?: number;
4464
+ }
4465
+ /**
4466
+ * The question the owner of this business actually asks a dashboard on Monday
4467
+ * morning — "how much have we invoiced this month that hasn't been paid?" —
4468
+ * plus how it is answered from the tables above.
4469
+ */
4470
+ interface UseCaseDashboardQuestion {
4471
+ /** The question in the practitioner's own words, ending in a question mark. */
4472
+ question: string;
4473
+ /** Why they care. What they DO differently depending on the answer. */
4474
+ whyItMatters: string;
4475
+ table: string;
4476
+ aggregate: "count" | "sum" | "avg" | "min" | "max";
4477
+ /** The field aggregated. Omitted only for `count`. */
4478
+ of?: string;
4479
+ groupBy?: string;
4480
+ /** A plain-language filter: "status is Unpaid and due_date is before today". */
4481
+ filter?: string;
4482
+ /** What the number IS: "USD", "days", "appointments". */
4483
+ answerUnit: string;
4484
+ }
4485
+ /**
4486
+ * A document this business really sends. The body carries merge fields in
4487
+ * `{{double_brace}}` form; every one of them is declared below and resolves to a
4488
+ * field on the document's table (or a stated literal).
4489
+ */
4490
+ interface UseCaseDocumentTemplate {
4491
+ token: string;
4492
+ name: string;
4493
+ describes: string;
4494
+ table: string;
4495
+ /** The subject or title line, merge fields allowed. */
4496
+ title: string;
4497
+ /** The body. Real prose this business would send, merge fields inline. */
4498
+ body: string;
4499
+ mergeFields: UseCaseMergeField[];
4500
+ }
4501
+ interface UseCaseMergeField {
4502
+ /** The token inside `{{ }}` in the body. */
4503
+ key: string;
4504
+ /**
4505
+ * The field key it reads, on the document's table — or, when it is not a
4506
+ * field, the word `business` (from `BusinessIdentity`) or `today`.
4507
+ */
4508
+ from: string;
4509
+ describes: string;
4510
+ }
4511
+ /** How a notification reaches someone. */
4512
+ type NotificationChannel = "email" | "sms" | "in_app";
4513
+ /**
4514
+ * The one automatic message this business would genuinely want — the thing a
4515
+ * practitioner sets up on day one and never turns off.
4516
+ */
4517
+ interface UseCaseNotificationRule {
4518
+ token: string;
4519
+ name: string;
4520
+ describes: string;
4521
+ when: UseCaseNotificationTrigger;
4522
+ /** Who it goes to, in the business's own words: "the assigned hygienist". */
4523
+ audience: string;
4524
+ channel: NotificationChannel;
4525
+ /** The actual message. Merge fields allowed, same convention as documents. */
4526
+ message: string;
4527
+ }
4528
+ interface UseCaseNotificationTrigger {
4529
+ table: string;
4530
+ event: "created" | "updated" | "stage_entered" | "due" | "overdue";
4531
+ /** For `stage_entered`: the stage key. */
4532
+ stage?: string;
4533
+ /** For `due` / `overdue`: the date field watched. */
4534
+ field?: string;
4535
+ /** For `due`: how many days ahead it fires. */
4536
+ daysBefore?: number;
4537
+ }
4538
+ /**
4539
+ * Where the shape and the values came from. `synthesized` means a person wrote
4540
+ * plausible values out of domain knowledge; `public-data` means the numbers or
4541
+ * names were derived from a genuinely public dataset, which is named.
4542
+ *
4543
+ * Either way the law holds: no real person, no real customer, no production row.
4544
+ */
4545
+ interface UseCaseProvenance {
4546
+ kind: "synthesized" | "public-data";
4547
+ /** Named when `kind` is `public-data`. */
4548
+ source?: string;
4549
+ /** Who or what wrote this file, and when. */
4550
+ authoredBy: string;
4551
+ authoredOn: string;
4552
+ /**
4553
+ * The affirmation, carried in the data so a reviewer can see it: every person,
4554
+ * address, phone and mailbox here is invented and belongs to nobody.
4555
+ */
4556
+ noRealPeople: true;
4557
+ }
4558
+ /** One real business, and everything a test, seed, demo or screenshot needs of it. */
4559
+ interface UseCase {
4560
+ /** kebab-case and unique: "harbor-dental-new-patient-intake". */
4561
+ id: string;
4562
+ /**
4563
+ * THE SENTENCE. Who the user is, what business they run, and what job this
4564
+ * exact feature does for them — one sentence, at the top, before anything
4565
+ * else. This is the first thing the law asks for and the validator checks it.
4566
+ */
4567
+ useCase: string;
4568
+ /** The industry, for rotation: "Dentistry", "Property management". */
4569
+ industry: string;
4570
+ business: BusinessIdentity;
4571
+ /**
4572
+ * The tag written into a test organization's settings so cleanup can find it.
4573
+ * Cleanup finds test data by THIS, never by a junk name.
4574
+ */
4575
+ cleanupTag: string;
4576
+ tables: UseCaseTable[];
4577
+ relationships: UseCaseRelationship[];
4578
+ form: UseCaseForm;
4579
+ pipeline: UseCasePipeline;
4580
+ dashboardQuestion: UseCaseDashboardQuestion;
4581
+ documentTemplate: UseCaseDocumentTemplate;
4582
+ notificationRule: UseCaseNotificationRule;
4583
+ provenance: UseCaseProvenance;
4584
+ }
4585
+ /** What the registry lists without loading a use case's rows. */
4586
+ interface UseCaseSummary {
4587
+ id: string;
4588
+ useCase: string;
4589
+ industry: string;
4590
+ businessName: string;
4591
+ /** How many tables and rows the file carries, so a caller can pick by size. */
4592
+ tableCount: number;
4593
+ rowCount: number;
4594
+ }
4595
+
4596
+ export { type EntityToken as $, type TableProposal as A, type BusinessIdentity as B, type RecordsError as C, type PgError as D, type StaleWriteDetail as E, type FormAudience as F, type PredictedRefusal as G, ABSENCE_REASONS as H, ACTOR_VOCABULARY as I, type AbsenceReason as J, type Actor as K, COMPUTE_ON as L, CONTEXT_POLICIES as M, type NotificationChannel as N, type ComputeOn as O, type PostalAddress as P, type ContextPolicy as Q, type RecordDocument as R, type StoredRecord as S, type Timestamp as T, type UseCase as U, DECLARABLE_FIELD_KINDS as V, type WriteConflict as W, DELIVERIES as X, type DeclarableFieldKind as Y, type Delivery as Z, ENTITY_TOKENS as _, type UseCaseSummary as a, err as a$, FIELD_SENSITIVITIES as a0, FIELD_SOURCES as a1, FRESHNESS as a2, type FieldBehavior as a3, type FieldRule as a4, type FieldSensitivity as a5, type FieldSource as a6, type FieldTypeWord as a7, type ForbiddenEnvelopeWord as a8, type Freshness as a9, type RelationBinding as aA, type RelationCardinality as aB, type RelationDisplay as aC, type RelationFlavor as aD, type RetiredActorWord as aE, type RuleNodeKind as aF, type RuleUse as aG, STORAGE_MODES as aH, STORE_DOORS as aI, STORE_KNOBS as aJ, STORE_REFUSAL_CODES as aK, type StorageMode as aL, type StoreDoorName as aM, type StoreRefusalCode as aN, TABLE_DISPLAYS as aO, TABLE_ORIGINS as aP, TABLE_TYPES as aQ, type TableDisplay as aR, type TableOrigin as aS, type TableType as aT, VALUE_ALTERNATE_KEYS as aU, VALUE_ENVELOPE_KEYS as aV, type ValueAlternate as aW, type ValueAlternateKey as aX, type ValueEnvelope as aY, type ValueEnvelopeKey as aZ, type ValueSource as a_, type HiddenFieldNotice as aa, KERNEL_TABLES as ab, type KernelTableName as ac, MERGE_FIELD_MODIFIERS as ad, MERGE_FIELD_SEMANTIC_TYPES as ae, MERGE_FIELD_SOURCES as af, type MergeFieldModifier as ag, type MergeFieldSemanticType as ah, type MergeFieldSource as ai, ON_DELETE as aj, OVERRIDE_POLICIES as ak, type OnDelete as al, type OverridePolicy as am, PARITY_FIELD_TYPES as an, PER_VALUE_ACCESS_WORDS as ao, type ParityFieldType as ap, type ParityFieldTypeDescriptor as aq, type PerValueAccessWord as ar, type ProvenancePointer as as, RELATION_BINDINGS as at, RELATION_CARDINALITIES as au, RELATION_FLAVORS as av, RETIRED_ACTOR_WORDS as aw, RULE_NODE_KINDS as ax, RULE_USES as ay, type RecordsErrorCode as az, type UseCaseDashboardQuestion as b, isRecordsErr as b0, ok as b1, type UseCaseDocumentTemplate as c, type UseCaseField as d, type UseCaseForm as e, type UseCaseFormField as f, type UseCaseMergeField as g, type UseCaseNotificationRule as h, type UseCaseNotificationTrigger as i, type UseCasePipeline as j, type UseCasePipelineStage as k, type UseCaseProvenance as l, type UseCaseRelationship as m, type UseCaseRow as n, type UseCaseTable as o, type Uuid as p, type RecordsResult as q, type RecordGraphWritten as r, type RecordRead as s, type ReadRow as t, type Field as u, type NewFieldDeclaration as v, type FieldPatch as w, type RecordRevision as x, type ReadValue as y, type FieldProposal as z };