@ai-matrx/records 0.98.7 → 0.98.9

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 (92) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{table-kind-CboiMJuE.d.cts → client-9fzhCPD5.d.cts} +2771 -4
  3. package/dist/{table-kind-B4sdlvHf.d.ts → client-DcWZjmg2.d.ts} +2771 -4
  4. package/dist/core/index.cjs +154 -3
  5. package/dist/core/index.cjs.map +1 -1
  6. package/dist/core/index.d.cts +109 -18
  7. package/dist/core/index.d.ts +109 -18
  8. package/dist/core/index.js +154 -3
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/data/index.cjs +52 -0
  11. package/dist/data/index.cjs.map +1 -1
  12. package/dist/data/index.d.cts +11 -12
  13. package/dist/data/index.d.ts +11 -12
  14. package/dist/data/index.js +52 -0
  15. package/dist/data/index.js.map +1 -1
  16. package/dist/{declareTable-BIuPJ3Vj.d.ts → declareTable-B6ic3leL.d.ts} +3 -4
  17. package/dist/{declareTable-d-HxRmF0.d.cts → declareTable-_GwN-ERY.d.cts} +3 -4
  18. package/dist/{doors-Bx3Shs3z.d.cts → doors-Dm5q9H8Y.d.cts} +1 -1
  19. package/dist/{doors-BTifsjNv.d.ts → doors-t-Oc2l9E.d.ts} +1 -1
  20. package/dist/entity/index.d.cts +7 -7
  21. package/dist/entity/index.d.ts +7 -7
  22. package/dist/{field-CJtssH3q.d.ts → field-BIRNApm1.d.ts} +2 -2
  23. package/dist/{field-DoVl2I9K.d.cts → field-BLy8drjM.d.cts} +2 -2
  24. package/dist/forms/index.d.cts +3 -3
  25. package/dist/forms/index.d.ts +3 -3
  26. package/dist/index.cjs +45 -0
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +30 -13
  29. package/dist/index.d.ts +30 -13
  30. package/dist/index.js +45 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/memory/index.d.cts +7 -7
  33. package/dist/memory/index.d.ts +7 -7
  34. package/dist/{objectOrganization-Crk9gJUM.d.ts → objectOrganization-D5Ytjah7.d.ts} +1 -1
  35. package/dist/{objectOrganization-CUa6jjhV.d.cts → objectOrganization-zgpoUAH1.d.cts} +1 -1
  36. package/dist/{port-CRP5g9l9.d.cts → port-B9glCG2h.d.cts} +3 -3
  37. package/dist/{port-CtnELAJQ.d.ts → port-C-p-_lAu.d.ts} +3 -3
  38. package/dist/{portal-DW5NGBT0.d.ts → portal-B9HCNPTc.d.ts} +2 -2
  39. package/dist/{portal-C4N9ByaY.d.cts → portal-C_LgvDeh.d.cts} +2 -2
  40. package/dist/{ports-WwHHNwge.d.ts → ports-BE_5jz-c.d.ts} +2 -2
  41. package/dist/{ports-YIh9jrCZ.d.cts → ports-BIdYUS-C.d.cts} +2 -2
  42. package/dist/questions/index.d.cts +9 -10
  43. package/dist/questions/index.d.ts +9 -10
  44. package/dist/react/index.cjs +97 -0
  45. package/dist/react/index.cjs.map +1 -1
  46. package/dist/react/index.d.cts +86 -1
  47. package/dist/react/index.d.ts +86 -1
  48. package/dist/react/index.js +97 -0
  49. package/dist/react/index.js.map +1 -1
  50. package/dist/realtime/index.d.cts +3 -3
  51. package/dist/realtime/index.d.ts +3 -3
  52. package/dist/{record-CxGK1OEK.d.cts → record-BrJNCmH1.d.cts} +1 -1
  53. package/dist/{record-CxGK1OEK.d.ts → record-BrJNCmH1.d.ts} +1 -1
  54. package/dist/{relation-Dh-lCkkh.d.ts → relation-BxGXLRaG.d.ts} +3 -3
  55. package/dist/{relation-DSGhM3tO.d.cts → relation-R10qQyQU.d.cts} +3 -3
  56. package/dist/{rule-DQpC7WqT.d.cts → rule-BGtYd6Pf.d.cts} +2 -2
  57. package/dist/{rule-xNwJF6Qo.d.ts → rule-BtjrE42J.d.ts} +2 -2
  58. package/dist/scopes/index.d.cts +3 -3
  59. package/dist/scopes/index.d.ts +3 -3
  60. package/dist/search/index.d.cts +1 -1
  61. package/dist/search/index.d.ts +1 -1
  62. package/dist/setup/index.cjs +52 -0
  63. package/dist/setup/index.cjs.map +1 -1
  64. package/dist/setup/index.d.cts +12 -13
  65. package/dist/setup/index.d.ts +12 -13
  66. package/dist/setup/index.js +52 -0
  67. package/dist/setup/index.js.map +1 -1
  68. package/dist/{subscription-BVCn1PVe.d.cts → subscription-BEM4B4dR.d.cts} +3 -3
  69. package/dist/{subscription-DQzPVKBR.d.ts → subscription-Ca15Z7Gu.d.ts} +3 -3
  70. package/dist/templates/index.d.cts +10 -10
  71. package/dist/templates/index.d.ts +10 -10
  72. package/dist/typed-table/index.cjs +52 -0
  73. package/dist/typed-table/index.cjs.map +1 -1
  74. package/dist/typed-table/index.d.cts +10 -11
  75. package/dist/typed-table/index.d.ts +10 -11
  76. package/dist/typed-table/index.js +52 -0
  77. package/dist/typed-table/index.js.map +1 -1
  78. package/dist/{types-3lM5f6b0.d.cts → types-5ql9_q-o.d.cts} +2 -2
  79. package/dist/{types-04kFNi3-.d.ts → types-BALEbMc8.d.ts} +2 -2
  80. package/dist/{types-DKJO83lQ.d.cts → types-BhnjvJ8U.d.cts} +2 -2
  81. package/dist/{types-SUAmeBId.d.ts → types-CURw95qc.d.ts} +2 -2
  82. package/dist/{types-DKeGkHpE.d.cts → types-DRMeL0uW.d.cts} +2 -2
  83. package/dist/{types-DJVccwh0.d.ts → types-_odOqLOe.d.ts} +2 -2
  84. package/dist/use-cases/index.d.cts +5 -5
  85. package/dist/use-cases/index.d.ts +5 -5
  86. package/dist/{validate-BIJtP2KB.d.cts → validate-Cdtk0y18.d.cts} +1 -1
  87. package/dist/{validate--y-pPc-c.d.ts → validate-ChibJPPI.d.ts} +1 -1
  88. package/dist/views/index.d.cts +9 -10
  89. package/dist/views/index.d.ts +9 -10
  90. package/package.json +2 -2
  91. package/dist/client-C1B-MNzb.d.ts +0 -2704
  92. package/dist/client-D2jAgJNn.d.cts +0 -2704
@@ -1,10 +1,10 @@
1
- import { d as RecordsDataSource, a as RecordsConfig } from '../ports-YIh9jrCZ.cjs';
2
- import { T as TemplateSpec } from '../types-DKeGkHpE.cjs';
3
- import { P as PgError } from '../record-CxGK1OEK.cjs';
4
- import '../field-DoVl2I9K.cjs';
5
- import '../subscription-BVCn1PVe.cjs';
6
- import '../rule-DQpC7WqT.cjs';
7
- import '../types-DKJO83lQ.cjs';
1
+ import { d as RecordsDataSource, a as RecordsConfig } from '../ports-BIdYUS-C.cjs';
2
+ import { T as TemplateSpec } from '../types-DRMeL0uW.cjs';
3
+ import { P as PgError } from '../record-BrJNCmH1.cjs';
4
+ import '../field-BLy8drjM.cjs';
5
+ import '../subscription-BEM4B4dR.cjs';
6
+ import '../rule-BGtYd6Pf.cjs';
7
+ import '../types-BhnjvJ8U.cjs';
8
8
 
9
9
  type Json$1 = Record<string, unknown>;
10
10
  /** One presented column, exactly as `platform.drill_describe(...).api.columns[]` says it. */
@@ -1,10 +1,10 @@
1
- import { d as RecordsDataSource, a as RecordsConfig } from '../ports-WwHHNwge.js';
2
- import { T as TemplateSpec } from '../types-SUAmeBId.js';
3
- import { P as PgError } from '../record-CxGK1OEK.js';
4
- import '../field-CJtssH3q.js';
5
- import '../subscription-DQzPVKBR.js';
6
- import '../rule-xNwJF6Qo.js';
7
- import '../types-DJVccwh0.js';
1
+ import { d as RecordsDataSource, a as RecordsConfig } from '../ports-BE_5jz-c.js';
2
+ import { T as TemplateSpec } from '../types-CURw95qc.js';
3
+ import { P as PgError } from '../record-BrJNCmH1.js';
4
+ import '../field-BIRNApm1.js';
5
+ import '../subscription-Ca15Z7Gu.js';
6
+ import '../rule-BtjrE42J.js';
7
+ import '../types-_odOqLOe.js';
8
8
 
9
9
  type Json$1 = Record<string, unknown>;
10
10
  /** One presented column, exactly as `platform.drill_describe(...).api.columns[]` says it. */
@@ -1,4 +1,4 @@
1
- import { d as RecordsDataSource } from './ports-WwHHNwge.js';
1
+ import { d as RecordsDataSource } from './ports-BE_5jz-c.js';
2
2
 
3
3
  /** What kind of object the id is, as `custom.where_id_opens` names it — carried as the door's own word. */
4
4
  type ObjectKind = string;
@@ -1,4 +1,4 @@
1
- import { d as RecordsDataSource } from './ports-YIh9jrCZ.cjs';
1
+ import { d as RecordsDataSource } from './ports-BIdYUS-C.cjs';
2
2
 
3
3
  /** What kind of object the id is, as `custom.where_id_opens` names it — carried as the door's own word. */
4
4
  type ObjectKind = string;
@@ -1,6 +1,6 @@
1
- import { L as Lane, H as HostDataPort, V as Values } from './types-3lM5f6b0.cjs';
2
- import { U as Uuid, R as RecordsResult } from './record-CxGK1OEK.cjs';
3
- import { O as OpLedger } from './ports-YIh9jrCZ.cjs';
1
+ import { L as Lane, H as HostDataPort, V as Values } from './types-5ql9_q-o.cjs';
2
+ import { U as Uuid, R as RecordsResult } from './record-BrJNCmH1.cjs';
3
+ import { O as OpLedger } from './ports-BIdYUS-C.cjs';
4
4
  import * as _ai_matrx_realtime from '@ai-matrx/realtime';
5
5
  import { RealtimeManager, ChannelSpec } from '@ai-matrx/realtime';
6
6
 
@@ -1,6 +1,6 @@
1
- import { L as Lane, H as HostDataPort, V as Values } from './types-04kFNi3-.js';
2
- import { U as Uuid, R as RecordsResult } from './record-CxGK1OEK.js';
3
- import { O as OpLedger } from './ports-WwHHNwge.js';
1
+ import { L as Lane, H as HostDataPort, V as Values } from './types-BALEbMc8.js';
2
+ import { U as Uuid, R as RecordsResult } from './record-BrJNCmH1.js';
3
+ import { O as OpLedger } from './ports-BE_5jz-c.js';
4
4
  import * as _ai_matrx_realtime from '@ai-matrx/realtime';
5
5
  import { RealtimeManager, ChannelSpec } from '@ai-matrx/realtime';
6
6
 
@@ -1,4 +1,4 @@
1
- import { U as Uuid, h as Timestamp } from './record-CxGK1OEK.js';
1
+ import { U as Uuid, h as Timestamp } from './record-BrJNCmH1.js';
2
2
 
3
3
  /** One portal as `custom.portals` reports it to its organization. */
4
4
  interface PortalSummary {
@@ -328,4 +328,4 @@ declare function portalTitleTypedBack(typed: string, title: string): boolean;
328
328
  */
329
329
  declare function emptyPortalArchiveLine(): string;
330
330
 
331
- export { portalArchiveConsequence as A, portalConfirmLine as B, portalPath as C, DEFAULT_PORTAL_ARCHIVE_FILTER as D, portalTitleTypedBack as E, type FormLookOptions as F, type PortalSummary as P, type PortalArchiveFilter as a, type PortalArchiveAnswer as b, type PortalTableRef as c, type PortalCard as d, type PortalConfigInput as e, type PortalFormSpec as f, type PortalFormAnswer as g, type PortalInvitation as h, type PortalRevocation as i, type PortalPreviewRow as j, type PortalAccent as k, PORTAL_ACCENTS as l, PORTAL_ARCHIVE_FILTERS as m, type PortalConfig as n, type PortalFooterLink as o, type PortalFormInput as p, type PortalFormRef as q, type PortalPrincipal as r, type PortalStage as s, type PortalStyle as t, type PortalStyleInput as u, type PortalTableExposure as v, type PublicPicture as w, emptyPortalArchiveLine as x, isPortalAccent as y, isPortalArchiveFilter as z };
331
+ export { portalArchiveConsequence as A, portalConfirmLine as B, portalPath as C, DEFAULT_PORTAL_ARCHIVE_FILTER as D, portalTitleTypedBack as E, type FormLookOptions as F, type PortalAccent as P, PORTAL_ACCENTS as a, PORTAL_ARCHIVE_FILTERS as b, type PortalArchiveAnswer as c, type PortalArchiveFilter as d, type PortalCard as e, type PortalConfig as f, type PortalConfigInput as g, type PortalFooterLink as h, type PortalFormAnswer as i, type PortalFormInput as j, type PortalFormRef as k, type PortalFormSpec as l, type PortalInvitation as m, type PortalPreviewRow as n, type PortalPrincipal as o, type PortalRevocation as p, type PortalStage as q, type PortalStyle as r, type PortalStyleInput as s, type PortalSummary as t, type PortalTableExposure as u, type PortalTableRef as v, type PublicPicture as w, emptyPortalArchiveLine as x, isPortalAccent as y, isPortalArchiveFilter as z };
@@ -1,4 +1,4 @@
1
- import { U as Uuid, h as Timestamp } from './record-CxGK1OEK.cjs';
1
+ import { U as Uuid, h as Timestamp } from './record-BrJNCmH1.cjs';
2
2
 
3
3
  /** One portal as `custom.portals` reports it to its organization. */
4
4
  interface PortalSummary {
@@ -328,4 +328,4 @@ declare function portalTitleTypedBack(typed: string, title: string): boolean;
328
328
  */
329
329
  declare function emptyPortalArchiveLine(): string;
330
330
 
331
- export { portalArchiveConsequence as A, portalConfirmLine as B, portalPath as C, DEFAULT_PORTAL_ARCHIVE_FILTER as D, portalTitleTypedBack as E, type FormLookOptions as F, type PortalSummary as P, type PortalArchiveFilter as a, type PortalArchiveAnswer as b, type PortalTableRef as c, type PortalCard as d, type PortalConfigInput as e, type PortalFormSpec as f, type PortalFormAnswer as g, type PortalInvitation as h, type PortalRevocation as i, type PortalPreviewRow as j, type PortalAccent as k, PORTAL_ACCENTS as l, PORTAL_ARCHIVE_FILTERS as m, type PortalConfig as n, type PortalFooterLink as o, type PortalFormInput as p, type PortalFormRef as q, type PortalPrincipal as r, type PortalStage as s, type PortalStyle as t, type PortalStyleInput as u, type PortalTableExposure as v, type PublicPicture as w, emptyPortalArchiveLine as x, isPortalAccent as y, isPortalArchiveFilter as z };
331
+ export { portalArchiveConsequence as A, portalConfirmLine as B, portalPath as C, DEFAULT_PORTAL_ARCHIVE_FILTER as D, portalTitleTypedBack as E, type FormLookOptions as F, type PortalAccent as P, PORTAL_ACCENTS as a, PORTAL_ARCHIVE_FILTERS as b, type PortalArchiveAnswer as c, type PortalArchiveFilter as d, type PortalCard as e, type PortalConfig as f, type PortalConfigInput as g, type PortalFooterLink as h, type PortalFormAnswer as i, type PortalFormInput as j, type PortalFormRef as k, type PortalFormSpec as l, type PortalInvitation as m, type PortalPreviewRow as n, type PortalPrincipal as o, type PortalRevocation as p, type PortalStage as q, type PortalStyle as r, type PortalStyleInput as s, type PortalSummary as t, type PortalTableExposure as u, type PortalTableRef as v, type PublicPicture as w, emptyPortalArchiveLine as x, isPortalAccent as y, isPortalArchiveFilter as z };
@@ -1,5 +1,5 @@
1
- import { F as Field } from './field-CJtssH3q.js';
2
- import { U as Uuid, A as Actor, P as PgError, l as RecordDocument } from './record-CxGK1OEK.js';
1
+ import { F as Field } from './field-BIRNApm1.js';
2
+ import { U as Uuid, A as Actor, P as PgError, n as RecordDocument } from './record-BrJNCmH1.js';
3
3
 
4
4
  /** `public.permission_level`, in the store's own order. */
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { F as Field } from './field-DoVl2I9K.cjs';
2
- import { U as Uuid, A as Actor, P as PgError, l as RecordDocument } from './record-CxGK1OEK.cjs';
1
+ import { F as Field } from './field-BLy8drjM.cjs';
2
+ import { U as Uuid, A as Actor, P as PgError, n as RecordDocument } from './record-BrJNCmH1.cjs';
3
3
 
4
4
  /** `public.permission_level`, in the store's own order. */
5
5
  /**
@@ -1,13 +1,12 @@
1
- import { A as AggregateBucket } from '../subscription-BVCn1PVe.cjs';
2
- import { R as RecordsClient } from '../client-D2jAgJNn.cjs';
3
- import { F as Field } from '../field-DoVl2I9K.cjs';
4
- import { H as HiddenFieldNotice, U as Uuid, R as RecordsResult } from '../record-CxGK1OEK.cjs';
5
- import { R as RuleExpression } from '../rule-DQpC7WqT.cjs';
6
- import '../table-kind-CboiMJuE.cjs';
7
- import '../ports-YIh9jrCZ.cjs';
8
- import '../relation-DSGhM3tO.cjs';
9
- import '../doors-Bx3Shs3z.cjs';
10
- import '../portal-C4N9ByaY.cjs';
1
+ import { A as AggregateBucket } from '../subscription-BEM4B4dR.cjs';
2
+ import { R as RecordsClient } from '../client-9fzhCPD5.cjs';
3
+ import { F as Field } from '../field-BLy8drjM.cjs';
4
+ import { H as HiddenFieldNotice, U as Uuid, R as RecordsResult } from '../record-BrJNCmH1.cjs';
5
+ import { R as RuleExpression } from '../rule-BGtYd6Pf.cjs';
6
+ import '../relation-R10qQyQU.cjs';
7
+ import '../ports-BIdYUS-C.cjs';
8
+ import '../doors-Dm5q9H8Y.cjs';
9
+ import '../portal-C_LgvDeh.cjs';
11
10
 
12
11
  type QuestionOp = "count" | "sum" | "avg" | "min" | "max";
13
12
  declare const QUESTION_OPS: readonly QuestionOp[];
@@ -1,13 +1,12 @@
1
- import { A as AggregateBucket } from '../subscription-DQzPVKBR.js';
2
- import { R as RecordsClient } from '../client-C1B-MNzb.js';
3
- import { F as Field } from '../field-CJtssH3q.js';
4
- import { H as HiddenFieldNotice, U as Uuid, R as RecordsResult } from '../record-CxGK1OEK.js';
5
- import { R as RuleExpression } from '../rule-xNwJF6Qo.js';
6
- import '../table-kind-B4sdlvHf.js';
7
- import '../ports-WwHHNwge.js';
8
- import '../relation-Dh-lCkkh.js';
9
- import '../doors-BTifsjNv.js';
10
- import '../portal-DW5NGBT0.js';
1
+ import { A as AggregateBucket } from '../subscription-Ca15Z7Gu.js';
2
+ import { R as RecordsClient } from '../client-DcWZjmg2.js';
3
+ import { F as Field } from '../field-BIRNApm1.js';
4
+ import { H as HiddenFieldNotice, U as Uuid, R as RecordsResult } from '../record-BrJNCmH1.js';
5
+ import { R as RuleExpression } from '../rule-BtjrE42J.js';
6
+ import '../relation-BxGXLRaG.js';
7
+ import '../ports-BE_5jz-c.js';
8
+ import '../doors-t-Oc2l9E.js';
9
+ import '../portal-B9HCNPTc.js';
11
10
 
12
11
  type QuestionOp = "count" | "sum" | "avg" | "min" | "max";
13
12
  declare const QUESTION_OPS: readonly QuestionOp[];
@@ -116,6 +116,7 @@ __export(react_exports, {
116
116
  addressMapUrl: () => addressMapUrl,
117
117
  addressText: () => addressText,
118
118
  allowsOtherValues: () => allowsOtherValues,
119
+ alternatePatch: () => alternatePatch,
119
120
  archiveTableRow: () => archiveTableRow,
120
121
  archiveTypedTableDeliberately: () => archiveTypedTableDeliberately,
121
122
  archivedByLine: () => archivedByLine,
@@ -136,6 +137,7 @@ __export(react_exports, {
136
137
  choiceSlug: () => choiceSlug,
137
138
  choiceValuesOf: () => choiceValuesOf,
138
139
  choicesOf: () => choicesOf,
140
+ chooseAlternate: () => chooseAlternate,
139
141
  coerceTypedAnswer: () => coerceTypedAnswer,
140
142
  coerceTypedAnswers: () => coerceTypedAnswers,
141
143
  coercionLabel: () => coercionLabel,
@@ -4608,6 +4610,14 @@ var DOORS = {
4608
4610
  // archived and aliased), and put any recorded Migration back.
4609
4611
  migrateMerge: "migrate_merge",
4610
4612
  migrateUndo: "migrate_undo",
4613
+ // CORE-VISION (2026-10-10): the structural Migrations a person runs on ONE record from its menu.
4614
+ // Split moves the named values to a new record of the same Table (the original keeps its id);
4615
+ // extract parent copies the named values up into a new record of another Table and puts this
4616
+ // record under it. Both answer a `migration_id` that `migrateUndo` takes. `migrations` lists
4617
+ // the Migration log for one target, newest first.
4618
+ migrateSplit: "migrate_split",
4619
+ migrateExtractParent: "migrate_extract_parent",
4620
+ migrations: "migrations",
4611
4621
  recordValues: "record_values",
4612
4622
  recordValuesVersioned: "record_values_versioned",
4613
4623
  valueRead: "value_read",
@@ -6550,6 +6560,49 @@ function createRecordsClient(given) {
6550
6560
  }
6551
6561
  return result;
6552
6562
  },
6563
+ async migrateSplit({ record_id, moved_keys, note }) {
6564
+ const result = await callDoor(
6565
+ DOORS.migrateSplit,
6566
+ { p_organization_id: org, p_record_id: record_id, p_moved_keys: moved_keys, p_note: note ?? null },
6567
+ "migrateSplit"
6568
+ );
6569
+ if (result.ok) {
6570
+ announceRecordChanged(record_id);
6571
+ announceRecordChanged(result.data.new_record);
6572
+ }
6573
+ return result;
6574
+ },
6575
+ async migrateExtractParent({ record_id, parent_table_id, moved_keys, note }) {
6576
+ const result = await callDoor(
6577
+ DOORS.migrateExtractParent,
6578
+ { p_organization_id: org, p_id: record_id, p_parent_table_id: parent_table_id, p_moved_keys: moved_keys, p_note: note ?? null },
6579
+ "migrateExtractParent"
6580
+ );
6581
+ if (result.ok) {
6582
+ announceRecordChanged(record_id);
6583
+ announceRecordChanged(result.data.parent);
6584
+ }
6585
+ return result;
6586
+ },
6587
+ async migrations({ target_id, limit }) {
6588
+ return callDoor(
6589
+ DOORS.migrations,
6590
+ { p_organization_id: org, p_target_id: target_id ?? null, p_limit: limit ?? 100 },
6591
+ "migrations"
6592
+ );
6593
+ },
6594
+ async recordAsOf({ record_id, recorded_at, world_on }) {
6595
+ return callDoor(
6596
+ DOORS.queryRecordAsOf,
6597
+ {
6598
+ p_organization_id: org,
6599
+ p_record_id: record_id,
6600
+ ...recorded_at ? { p_recorded_at: recorded_at } : {},
6601
+ ...world_on ? { p_world_on: world_on.slice(0, 10) } : {}
6602
+ },
6603
+ "recordAsOf"
6604
+ );
6605
+ },
6553
6606
  async migrateUndo({ migration_id }) {
6554
6607
  const result = await callDoor(
6555
6608
  DOORS.migrateUndo,
@@ -6557,6 +6610,7 @@ function createRecordsClient(given) {
6557
6610
  "migrateUndo"
6558
6611
  );
6559
6612
  if (result.ok && result.data.record_id) announceRecordChanged(result.data.record_id);
6613
+ if (result.ok && result.data.removed) announceRecordChanged(result.data.removed);
6560
6614
  return result;
6561
6615
  },
6562
6616
  async fieldUpdate({ field_id, patch }) {
@@ -13674,4 +13728,47 @@ function tableRenderSchema(facts) {
13674
13728
  }
13675
13729
  return { kind: slug, fields: out };
13676
13730
  }
13731
+
13732
+ // src/alternates.ts
13733
+ function refuse4(code, message, hint) {
13734
+ return { ok: false, error: { code, message, hint, ours: true } };
13735
+ }
13736
+ function alternatePatch(document, field_key, alternate_index) {
13737
+ const block = document._values ?? {};
13738
+ const envelope = block[field_key];
13739
+ const alternates = Array.isArray(envelope?.alternates) ? envelope.alternates : [];
13740
+ const chosen = alternates[alternate_index];
13741
+ if (!envelope || !chosen) return { ok: false, message: "That other value is no longer on this record." };
13742
+ const kept = alternates.filter((_, i) => i !== alternate_index);
13743
+ const current = document[field_key];
13744
+ const next = [...kept];
13745
+ if (current !== null && current !== void 0) {
13746
+ const taken = new Set(kept.map((a) => a.rank));
13747
+ let rank = 1;
13748
+ while (taken.has(rank)) rank += 1;
13749
+ next.push({ value: current, ...envelope.src ? { src: envelope.src } : {}, rank });
13750
+ }
13751
+ const { ver: _ver, actor: _actor, at: _at, on_behalf_of: _on, absent: _absent, alternates: _alts, src: _src, ...rest } = envelope;
13752
+ const changed = { ...rest, ...chosen.src ? { src: chosen.src } : {} };
13753
+ if (next.length > 0) changed["alternates"] = next;
13754
+ return {
13755
+ ok: true,
13756
+ patch: {
13757
+ [field_key]: chosen.value,
13758
+ // THE WHOLE BLOCK — every other field's envelope and alternates travel with it.
13759
+ _values: { ...block, [field_key]: changed }
13760
+ }
13761
+ };
13762
+ }
13763
+ async function chooseAlternate(client, { record_id, field_key, alternate_index }) {
13764
+ const read = await client.recordRead({ record_id, withVersion: true });
13765
+ if (!read.ok) return read;
13766
+ const version = read.data.version;
13767
+ if (version === null || version === void 0) {
13768
+ return refuse4("stale_read", "Nothing was saved: this record's latest changes could not be checked.", "Reload, then try again.");
13769
+ }
13770
+ const built = alternatePatch(read.data.document, field_key, alternate_index);
13771
+ if (!built.ok) return refuse4("not_found", built.message, "Reload, then look again.");
13772
+ return client.recordUpdate({ record_id, patch: built.patch, expectedVersion: version });
13773
+ }
13677
13774
  //# sourceMappingURL=index.cjs.map