@ai-matrx/records 0.30.0 → 0.37.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { U as Uuid, T as TableType, a as TableDisplay, S as StorageMode, g as Timestamp, an as TableOrigin, h as RecordDocument, l as StoredRecord, k as Field, a0 as ParityFieldType, ad as RuleUse, ac as RuleNodeKind, R as RelationFlavor, O as OnDelete, aa as RelationBinding, f as RelationCardinality, W as MergeFieldSource, V as MergeFieldSemanticType, Q as MergeFieldModifier, Z as OverridePolicy, w as Delivery, H as Freshness, a2 as PerValueAccessWord, t as Actor } from './field-D08d_e7R.cjs';
2
- export { A as ABSENCE_REASONS, r as ACTOR_VOCABULARY, s as AbsenceReason, u as COMPUTE_ON, v as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DELIVERIES, E as ENTITY_TOKENS, x as EntityToken, y as FIELD_SENSITIVITIES, z as FIELD_SOURCES, B as FRESHNESS, G as FieldBehavior, m as FieldPatch, p as FieldProposal, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, I as HiddenFieldNotice, K as KERNEL_TABLES, J as KernelTableName, M as MERGE_FIELD_MODIFIERS, L as MERGE_FIELD_SEMANTIC_TYPES, P as MERGE_FIELD_SOURCES, N as NewFieldDeclaration, X as ON_DELETE, Y as OVERRIDE_POLICIES, _ as PARITY_FIELD_TYPES, $ as PER_VALUE_ACCESS_WORDS, a1 as ParityFieldTypeDescriptor, a3 as ProvenancePointer, a4 as RELATION_BINDINGS, a5 as RELATION_CARDINALITIES, a6 as RELATION_FLAVORS, a7 as RETIRED_ACTOR_WORDS, a8 as RULE_NODE_KINDS, a9 as RULE_USES, j as ReadRow, o as ReadValue, i as RecordRead, n as RecordRevision, ab as RetiredActorWord, ae as STORAGE_MODES, af as STORE_DOORS, ag as STORE_KNOBS, ah as STORE_REFUSAL_CODES, ai as StoreDoorName, aj as StoreRefusalCode, ak as TABLE_DISPLAYS, al as TABLE_ORIGINS, am as TABLE_TYPES, q as TableProposal, ao as VALUE_ALTERNATE_KEYS, ap as VALUE_ENVELOPE_KEYS, aq as ValueAlternate, ar as ValueAlternateKey, as as ValueEnvelope, at as ValueEnvelopeKey, au as ValueSource } from './field-D08d_e7R.cjs';
1
+ import { U as Uuid, T as TableType, a as TableDisplay, S as StorageMode, g as Timestamp, av as TableOrigin, h as RecordDocument, m as StoredRecord, l as Field, a7 as ParityFieldType, al as RuleUse, ak as RuleNodeKind, R as RelationFlavor, O as OnDelete, ai as RelationBinding, f as RelationCardinality, a1 as MergeFieldSource, a0 as MergeFieldSemanticType, $ as MergeFieldModifier, a4 as OverridePolicy, B as Delivery, M as Freshness, x as Actor, P as PgError } from './field-CWBdZfFv.cjs';
2
+ export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DELIVERIES, E as ENTITY_TOKENS, G as EntityToken, H as FIELD_SENSITIVITIES, I as FIELD_SOURCES, J as FRESHNESS, K as FieldBehavior, n as FieldPatch, q as FieldProposal, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, L as ForbiddenEnvelopeWord, Q as HiddenFieldNotice, V as KERNEL_TABLES, X as KernelTableName, Y as MERGE_FIELD_MODIFIERS, Z as MERGE_FIELD_SEMANTIC_TYPES, _ as MERGE_FIELD_SOURCES, N as NewFieldDeclaration, a2 as ON_DELETE, a3 as OVERRIDE_POLICIES, a5 as PARITY_FIELD_TYPES, a6 as PER_VALUE_ACCESS_WORDS, a8 as ParityFieldTypeDescriptor, a9 as PerValueAccessWord, u as PredictedRefusal, aa as ProvenancePointer, ab as RELATION_BINDINGS, ac as RELATION_CARDINALITIES, ad as RELATION_FLAVORS, ae as RETIRED_ACTOR_WORDS, af as RULE_NODE_KINDS, ag as RULE_USES, k as ReadRow, p as ReadValue, j as RecordRead, o as RecordRevision, s as RecordsError, ah as RecordsErrorCode, i as RecordsResult, aj as RetiredActorWord, am as STORAGE_MODES, an as STORE_DOORS, ao as STORE_KNOBS, ap as STORE_REFUSAL_CODES, t as StaleWriteDetail, aq as StoreDoorName, ar as StoreRefusalCode, as as TABLE_DISPLAYS, at as TABLE_ORIGINS, au as TABLE_TYPES, r as TableProposal, aw as VALUE_ALTERNATE_KEYS, ax as VALUE_ENVELOPE_KEYS, ay as ValueAlternate, az as ValueAlternateKey, aA as ValueEnvelope, aB as ValueEnvelopeKey, aC as ValueSource, W as WriteConflict, aD as err, aE as isRecordsErr, aF as ok } from './field-CWBdZfFv.cjs';
3
3
 
4
4
  /** `public.permission_level`, in the store's own order. */
5
5
  type PermissionLevel = "viewer" | "commenter" | "editor" | "admin";
@@ -274,7 +274,25 @@ interface PipelineStage {
274
274
  }
275
275
  /** What each Rule of a pipeline is about. Closed, and the store is the authority. */
276
276
  declare const PIPELINE_RULE_KINDS: readonly ["moves", "requires", "who", "limit", "entry"];
277
- type PipelineRuleKind = (typeof PIPELINE_RULE_KINDS)[number];
277
+ /**
278
+ * A GATE is the general form under `requires`, `who` and `limit`, and the store spells it
279
+ * `gate:1`, `gate:2` … so several gates can sit on one stage without one overwriting the
280
+ * next. It is matched as a prefix rather than listed, because the number is open.
281
+ */
282
+ type PipelineRuleKind = (typeof PIPELINE_RULE_KINDS)[number] | `gate:${number}`;
283
+ /**
284
+ * WHAT A GATE DOES WHEN IT SAYS NO. The closed list `custom.stage_rule_on_fail_kinds()`
285
+ * answers — a screen offering a third answer would be offering something no Rule can carry.
286
+ */
287
+ declare const STAGE_RULE_ON_FAIL: readonly ["refuse", "require_approval"];
288
+ type StageRuleOnFail = (typeof STAGE_RULE_ON_FAIL)[number];
289
+ /**
290
+ * THE ORGANIZATION'S ONE KNOB (`custom/stage_rule_enforcement`). `refuse` is the default and
291
+ * what a gate is for; `warn` lets the move through and hands the same sentence back. It never
292
+ * softens `require_approval` — "ask somebody" and "carry on with a note" are different answers.
293
+ */
294
+ declare const STAGE_RULE_ENFORCEMENT: readonly ["refuse", "warn"];
295
+ type StageRuleEnforcement = (typeof STAGE_RULE_ENFORCEMENT)[number];
278
296
  /**
279
297
  * One transition Rule, as `custom.pipeline_read` hands it back — WITH the sentence it says
280
298
  * when it refuses, because a screen that knows a rule exists but not what it refuses in
@@ -291,8 +309,64 @@ interface PipelineRule {
291
309
  uses: string[];
292
310
  /** What happens when a card ARRIVES in this stage — assign, notify, start a checklist. */
293
311
  on_entry: Record<string, unknown> | null;
312
+ /**
313
+ * What this Rule does when it STOPS a move. `refuse` is the default and what every
314
+ * pipeline Rule did before gates existed; `require_approval` files the change in the
315
+ * approvals queue with this Rule's sentence as the reason and leaves the record alone.
316
+ */
317
+ on_fail?: StageRuleOnFail;
318
+ /**
319
+ * THE GATE AS IT WAS WRITTEN, which is the only thing that makes it EDITABLE.
320
+ *
321
+ * A gate is saved as one Rule whose expression is an `or` of four arms — not this
322
+ * stage, OR not a move, OR the gate is not about this card, OR the demand holds. That
323
+ * compiled form used to be the only copy, so a settings screen could read a gate's name
324
+ * and its sentence and nothing else: it would open every existing rule with a blank
325
+ * condition and overwrite it the first time somebody pressed Save.
326
+ *
327
+ * Absent on the four sugar rules (`moves`, `requires`, `who`, `limit`), which nobody
328
+ * writes in a condition builder, and on any gate declared before the store started
329
+ * keeping them. Absent means "this one was not written here" — never "it has no
330
+ * condition", which is a different and dangerous thing to draw.
331
+ */
332
+ when?: Record<string, unknown> | null;
333
+ /** @see {@link PipelineRule.when} — the condition that has to hold, as it was written. */
334
+ demands?: Record<string, unknown> | null;
294
335
  version: number;
295
336
  }
337
+ /**
338
+ * WHAT A GATE WOULD DO TO THIS BOARD TODAY, from `custom.pipeline_gate_preview`.
339
+ *
340
+ * The one question somebody writing a rule that will refuse their colleagues' work
341
+ * actually has, answered while they are still typing it — the gate is judged as an
342
+ * argument, nothing is saved, and nothing is written. The store compiles it with the
343
+ * SAME compiler `pipeline_declare` uses, so this count and the refusal at the door are
344
+ * the same rule.
345
+ */
346
+ interface PipelineGatePreview {
347
+ is_pipeline: boolean;
348
+ /** Present, and it says what would make a board exist, when `is_pipeline` is false. */
349
+ why?: string;
350
+ /** The stage key the gate was tried against. */
351
+ stage?: string;
352
+ /** Live cards of this board this person may see that are not already in that stage. */
353
+ considered: number;
354
+ /** How many of them this gate would turn away. */
355
+ refused: number;
356
+ /**
357
+ * Up to three of them, BY NAME. A count with no names is a number nobody can check, and
358
+ * checking it is the whole reason to show it before saving.
359
+ */
360
+ examples: {
361
+ record_id: Uuid;
362
+ title: string;
363
+ }[];
364
+ /** True when the board is larger than the preview will walk, so the count is a floor. */
365
+ truncated?: boolean;
366
+ on_fail?: StageRuleOnFail;
367
+ /** The word this board uses for one of its cards — "quote", "deal" — for the sentence. */
368
+ noun?: string;
369
+ }
296
370
  /** The whole board's definition, from `custom.pipeline_read`. */
297
371
  interface Pipeline {
298
372
  is_pipeline: boolean;
@@ -338,6 +412,20 @@ interface PipelineMissingField {
338
412
  interface PipelineVerdict {
339
413
  allowed: boolean;
340
414
  is_pipeline: boolean;
415
+ /**
416
+ * The THREE answers a board has to draw differently, and the reason `allowed` alone is
417
+ * not enough: a card that is going for approval has not been refused, and a card that
418
+ * moved under `warn` has not been waved through silently.
419
+ */
420
+ outcome?: "allowed" | "refused" | "needs_approval" | "warned";
421
+ /** What this organization's one knob says right now. */
422
+ enforcement?: StageRuleEnforcement;
423
+ /** Set on `needs_approval`: what pressing on will actually do, in plain words. */
424
+ what_happens?: string;
425
+ /** Set on `warned`: the gates this organization asked to be told about, not stopped by. */
426
+ warnings?: StageRuleWarning[];
427
+ /** Approvals already filed against this card's own stage column that nobody has decided. */
428
+ pending?: StagePending[];
341
429
  /** The stage key the move was asked about. */
342
430
  to?: string;
343
431
  /** The store's own sentence — shown verbatim, never paraphrased by a screen. */
@@ -346,6 +434,8 @@ interface PipelineVerdict {
346
434
  rule_id?: Uuid;
347
435
  rule_version?: number;
348
436
  kind?: PipelineRuleKind;
437
+ /** What this Rule does when it stops a move. */
438
+ on_fail?: StageRuleOnFail;
349
439
  /**
350
440
  * When a stage demands columns that are empty, exactly which ones — so the screen can
351
441
  * prompt for them on entry instead of sending the person away to find them.
@@ -382,9 +472,80 @@ interface PipelineSpec {
382
472
  limits?: Record<string, number>;
383
473
  /** Stage name → what happens when a card arrives: assign, notify, start a checklist. */
384
474
  on_entry?: Record<string, Record<string, unknown>>;
475
+ /**
476
+ * Stage name → the gates a card has to get past to land there. The general form under
477
+ * `requires`, `who` and `limits`, and the only one that can say `require_approval`.
478
+ */
479
+ gates?: Record<string, PipelineGate[]>;
385
480
  moves_message?: string;
386
481
  requires_messages?: Record<string, string>;
387
482
  }
483
+ /**
484
+ * A gate the organization's own knob overruled. NOTHING FAILS SILENTLY: the move happened
485
+ * and the sentence comes back WITH it, together with what to do about it.
486
+ */
487
+ interface StageRuleWarning {
488
+ rule_id: Uuid;
489
+ rule: string;
490
+ /** The gate's own sentence, shown verbatim. */
491
+ why: string;
492
+ what_to_do: string;
493
+ }
494
+ /** An approval filed against this card's stage column that nobody has decided yet. */
495
+ interface StagePending {
496
+ approval_id: Uuid;
497
+ /** The stage key the card is waiting to go to. */
498
+ to: string;
499
+ why: string | null;
500
+ requested_at: string;
501
+ state: string;
502
+ }
503
+ /**
504
+ * The same wait, asked for a WHOLE BOARD in one question (`custom.pipeline_pending`), so a
505
+ * board can badge every card that is waiting without a round trip per card — and therefore
506
+ * actually does it, instead of drawing a filed card as if nobody had ever dragged it.
507
+ */
508
+ interface StagePendingOnBoard extends StagePending {
509
+ record_id: Uuid;
510
+ }
511
+ /** What `custom.pipeline_move` answers — an OBJECT on every path, never a bare number. */
512
+ interface PipelineMoveResult {
513
+ applied: boolean;
514
+ moved: boolean;
515
+ outcome: "moved" | "moved_with_warnings" | "needs_approval";
516
+ to: string;
517
+ version: number;
518
+ /** Set on `moved_with_warnings`. */
519
+ warnings?: StageRuleWarning[];
520
+ /** Set on `needs_approval`: the gate's sentence, the wait that was filed, and who has it. */
521
+ why?: string;
522
+ rule?: string;
523
+ rule_id?: Uuid;
524
+ approval_id?: Uuid;
525
+ approvers?: {
526
+ user_id: Uuid;
527
+ name: string | null;
528
+ why: string;
529
+ }[];
530
+ what_happens?: string;
531
+ }
532
+ /**
533
+ * ONE GATE ON A STAGE, as the condition builder on the stage settings screen writes it.
534
+ * `requires`, `who` and `limits` are sugar over this shape; this is the general form, and
535
+ * it speaks the SAME condition language as filters and formulas — never a second one.
536
+ */
537
+ interface PipelineGate {
538
+ /** What the gate is called in the settings list. */
539
+ name?: string;
540
+ /** The sentence a person reads when it stops them. Required: a refusal with no words is a dead end. */
541
+ message: string;
542
+ /** WHEN this gate is about this record at all. Absent means always. */
543
+ when?: Record<string, unknown>;
544
+ /** What has to hold. One condition node of the one Rule language. */
545
+ demands: Record<string, unknown>;
546
+ /** Default `refuse`. */
547
+ on_fail?: StageRuleOnFail;
548
+ }
388
549
  /**
389
550
  * THE ONE PLACE A SCREEN DECIDES WHETHER A CARD LOOKS DRAGGABLE — and it decides on the
390
551
  * PERSON, not on the rules. Whether a particular move is allowed is
@@ -520,6 +681,56 @@ interface BookingSummary {
520
681
  /** draft · open · closed — the store's own word, never derived on a screen. */
521
682
  state: string;
522
683
  }
684
+ /**
685
+ * ONE WINDOW OF AN ORGANIZATION'S WEEK, in the shape `custom._booking_availability`
686
+ * normalises to and `custom._booking_slots` generates from. `weekday` is 0 for Sunday
687
+ * and 6 for Saturday — the database's own numbering, so a picker and the store cannot
688
+ * disagree about which day Monday is. A window may name ONE member, which is the "with
689
+ * whom" of an appointment; naming somebody who is not a member is refused BY NAME.
690
+ */
691
+ interface BookingWindow {
692
+ weekday: number;
693
+ /** "09:00" */
694
+ from: string;
695
+ /** "17:00" — later in the day than `from`, or the store refuses it by name. */
696
+ to: string;
697
+ member_user_id?: string | null;
698
+ }
699
+ /**
700
+ * WHAT IS ON OFFER. Every field is the store's to default: a page declared with an
701
+ * empty availability comes back with the organization's timezone, a 30-minute slot and
702
+ * Monday-to-Friday nine-to-five, because a booking page that offered nothing would look
703
+ * broken rather than unconfigured. A screen shows what came BACK, never what it sent.
704
+ */
705
+ interface BookingAvailability {
706
+ timezone: string;
707
+ slot_minutes: number;
708
+ /** Dead time kept after each appointment, so two never touch. */
709
+ buffer_minutes: number;
710
+ /** How far ahead of now the earliest bookable slot is. */
711
+ lead_minutes: number;
712
+ /** Most appointments in one day, across every window. */
713
+ max_per_day: number;
714
+ /** How many days ahead the page offers. */
715
+ days: number;
716
+ windows: BookingWindow[];
717
+ }
718
+ /**
719
+ * WHAT `custom.booking_declare` ANSWERS. `availability` is the NORMALISED offer —
720
+ * show that, not the draft — and `questions_filled_in` is how many questions the store
721
+ * took over (`slot`, `status`, `booked_with`), which a visitor is never asked.
722
+ *
723
+ * It does NOT publish. `anonPublish` is still the one act that opens the link, exactly
724
+ * as it is for a form, so there is one act and one word for opening a public surface.
725
+ */
726
+ interface BookingDeclared {
727
+ form_id: string;
728
+ slot_table_id: string;
729
+ availability: BookingAvailability;
730
+ questions_asked: number;
731
+ questions_filled_in: number;
732
+ ms: number;
733
+ }
523
734
  /**
524
735
  * THE VISITOR'S OWN LINK to a booking page. The page id IS the capability, exactly
525
736
  * as it is for a form; `custom.anon_submission.booking_ref` is the separate secret
@@ -1691,6 +1902,28 @@ interface DigestPreview {
1691
1902
  */
1692
1903
  incomplete: string | null;
1693
1904
  }
1905
+ /**
1906
+ * ONE SAVED VIEW — `custom.views`. A subscription is written OVER one of these, so
1907
+ * a person with no saved view has nothing to be told about; `viewDeclare` is how a
1908
+ * screen gives them one without leaving the screen they are on.
1909
+ *
1910
+ * `filters` is written in the ONE shape `custom.agg_view_admits` reads, so a view
1911
+ * saved here needs no translation before the notifier can admit records to it.
1912
+ */
1913
+ interface SavedViewRow {
1914
+ view_id: Uuid;
1915
+ name: string;
1916
+ table_id: Uuid | null;
1917
+ filters: Record<string, unknown>;
1918
+ created_at: string;
1919
+ }
1920
+ /** What `custom.view_declare` is asked for. `view_id` re-states rather than doubling. */
1921
+ interface SavedViewSpecIn {
1922
+ name: string;
1923
+ filters?: Record<string, unknown> | null;
1924
+ definition?: Record<string, unknown> | null;
1925
+ view_id?: Uuid | null;
1926
+ }
1694
1927
  /** What `custom.subscription_declare` is asked for. The store refuses the rest BY NAME. */
1695
1928
  interface SubscriptionSpec {
1696
1929
  name: string;
@@ -2347,143 +2580,6 @@ interface ResolvedPublishBinding {
2347
2580
  notice: string;
2348
2581
  }
2349
2582
 
2350
- /**
2351
- * What KIND of refusal it was. The mapping from SQLSTATE to code lives in
2352
- * `/core`, and it is checked against `STORE_REFUSAL_CODES` — the list of every
2353
- * SQLSTATE the store's own bodies raise, generated from the live catalogue. A
2354
- * code the store can raise and this union cannot name is a hole, and the
2355
- * real-door suite fails on it.
2356
- */
2357
- type RecordsErrorCode =
2358
- /** `PT409` — somebody else's write won. The record clock moved under you. */
2359
- "stale_write"
2360
- /** `42501` — a door. Either the schema is revoked, or the store is switched off, or this principal may not pass. */
2361
- | "door"
2362
- /** `23514` — a Rule, a shape guard, or a validation the store enforces refused it. */
2363
- | "refused_by_rule"
2364
- /**
2365
- * `22004` / `22023` / `22P02` — the call itself was malformed: a missing id, a
2366
- * patch that is not an object, or a value that does not fit the type the
2367
- * store holds for that Field. The store's own message names the value and the
2368
- * type it could not be read as.
2369
- */
2370
- | "invalid_argument"
2371
- /** `02000` — the record is not here (deleted, never existed, or another organization's). */
2372
- | "not_found"
2373
- /** `23503` — something it points at is not there. */
2374
- | "missing_reference"
2375
- /** `23505` — that thing is already here. */
2376
- | "already_exists"
2377
- /** `0A000` — the store does not do this yet, and says which part. */
2378
- | "not_supported"
2379
- /** `53400` / `22012` — the store ran out of something, or the arithmetic could not be done. */
2380
- | "store_limit"
2381
- /**
2382
- * `40001` — the visibility snapshot this connection carries is older than a
2383
- * write the reader has already observed, so the store refused to answer at
2384
- * all rather than hand back something they just lost. Retry on a fresh
2385
- * connection; it is the one refusal in this list that is worth repeating.
2386
- */
2387
- | "stale_read"
2388
- /**
2389
- * `57014` — the store cancelled the statement at its own timeout. Nothing was
2390
- * refused on its merits and nothing was written; the same call can succeed on
2391
- * a smaller page or a quieter moment. With `stale_read`, one of the only two
2392
- * refusals in this list worth repeating.
2393
- */
2394
- | "timed_out"
2395
- /**
2396
- * THE DOOR THAT DOES NOT EXIST YET. Not an error condition in the database —
2397
- * this package asked for a door that is not in the live catalogue, so it
2398
- * refused to guess. `door_absent` always names the door and the lane that
2399
- * owns it; it is never a silent no-op and never an empty list.
2400
- */
2401
- | "door_absent"
2402
- /**
2403
- * `PGRST202` / `PGRST205` — PostgREST could not find the function or the
2404
- * schema. The database this client is pointed at is not serving the record
2405
- * store: the schema is not exposed, or the grants are not there.
2406
- */
2407
- | "store_not_served"
2408
- /** Anything the mapper could not place. It still carries the store's own words. */
2409
- | "internal";
2410
- /** A refusal, in the store's own words. */
2411
- interface RecordsError {
2412
- code: RecordsErrorCode;
2413
- /** THE STORE'S message, verbatim. Never paraphrased. */
2414
- message: string;
2415
- /** THE STORE'S hint, verbatim — this is where the remedy is written. */
2416
- hint?: string;
2417
- /** The SQLSTATE, so a caller can be exact when a code is not exact enough. */
2418
- sqlstate?: string;
2419
- /** Whatever the store put in DETAIL, parsed when it was json. */
2420
- detail?: unknown;
2421
- }
2422
- type RecordsResult<T> = {
2423
- ok: true;
2424
- data: T;
2425
- } | {
2426
- ok: false;
2427
- error: RecordsError;
2428
- };
2429
- /** Narrowing helper for hosts compiled without `strictNullChecks`. */
2430
- declare function isRecordsErr<T>(result: RecordsResult<T>): result is {
2431
- ok: false;
2432
- error: RecordsError;
2433
- };
2434
- declare const ok: <T>(data: T) => RecordsResult<T>;
2435
- declare const err: <T>(error: RecordsError) => RecordsResult<T>;
2436
- /**
2437
- * A `stale_write` carries everything the screen needs to show the conflict
2438
- * rather than a toast: which version you wrote against, which one won, and the
2439
- * value of every field you touched as it stands now. The store builds this and
2440
- * this type is its shape — nothing is reconstructed on the client.
2441
- */
2442
- interface StaleWriteDetail {
2443
- expected_version: number;
2444
- current_version: number;
2445
- contested_fields: Record<string, unknown>;
2446
- }
2447
- /** The parsed form of a `stale_write`, for `useRecordMutation`'s conflict state. */
2448
- interface WriteConflict extends StaleWriteDetail {
2449
- record_id: Uuid;
2450
- /** The store's own sentence — what the screen shows. */
2451
- message: string;
2452
- /** The store's own remedy. */
2453
- hint: string;
2454
- }
2455
- /**
2456
- * The structural shape of a PostgREST failure as supabase-js resolves it: a
2457
- * PLAIN OBJECT parsed from the response body, NOT an `Error`. Reading
2458
- * `.message` off `instanceof Error` discards the real database message on every
2459
- * genuine failure.
2460
- */
2461
- interface PgError {
2462
- code?: string | null;
2463
- message: string;
2464
- details?: string | null;
2465
- hint?: string | null;
2466
- }
2467
- /** What the validation mirror answers: the same sentence the trigger would raise. */
2468
- interface PredictedRefusal {
2469
- /** The field key the store would name, when it names one. */
2470
- field_key?: string;
2471
- /** The message the store's own body would raise, word for word. */
2472
- message: string;
2473
- hint?: string;
2474
- sqlstate: string;
2475
- /**
2476
- * Which of the store's bodies would raise it, so a reader can go and check
2477
- * that this mirror still tells the truth.
2478
- */
2479
- predicted_by: string;
2480
- }
2481
- /** VAL-5 / VAL-6, named so a caller can say which word was the problem. */
2482
- interface ForbiddenEnvelopeWord {
2483
- field_key: string;
2484
- word: PerValueAccessWord;
2485
- }
2486
-
2487
2583
  /**
2488
2584
  * The data seam: a structural subset of `SupabaseClient`. The package never
2489
2585
  * opens a database connection of its own and never holds a key — the HOST
@@ -2720,4 +2816,4 @@ interface ConversationScopeContext {
2720
2816
  /** `About: Acme Industrial` — the chip a bound chat wears. */
2721
2817
  declare function scopeChip(scope: ConversationScope): string;
2722
2818
 
2723
- export { Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type BookingSummary, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type ExternalPrincipalCard, Field, type FieldHistoryEntry, type ForbiddenEnvelopeWord, type FormSummary, Freshness, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, OnDelete, OverridePolicy, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, ParityFieldType, PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineMissingField, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, type RecordComment, RecordDocument, type RecordHistoryEntry, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, RelationBinding, RelationCardinality, type RelationCarries, type RelationCoordinate, RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type Rule, type RuleAnswer, type RuleExpression, RuleNodeKind, RuleUse, type StaleWriteDetail, StorageMode, StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, type Table, type TableCapacity, TableDisplay, TableOrigin, TableType, Timestamp, Uuid, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
2819
+ export { Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type ExternalPrincipalCard, Field, type FieldHistoryEntry, type FormSummary, Freshness, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, OnDelete, OverridePolicy, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, ParityFieldType, type PermissionLevel, PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, type RecordComment, RecordDocument, type RecordHistoryEntry, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsTableQuery, type RegisteredTable, type Relation, RelationBinding, RelationCardinality, type RelationCarries, type RelationCoordinate, RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type Rule, type RuleAnswer, type RuleExpression, RuleNodeKind, RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, StorageMode, StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, type Table, type TableCapacity, TableDisplay, TableOrigin, TableType, Timestamp, Uuid, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };