@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,7 +1,6 @@
1
- import { R as RecordsClient } from './client-C1B-MNzb.js';
2
- import { a as FieldTypeWord, N as NewFieldDeclaration } from './field-CJtssH3q.js';
3
- import { U as Uuid, a as RecordsError } from './record-CxGK1OEK.js';
4
- import { F as FieldDrift } from './table-kind-B4sdlvHf.js';
1
+ import { F as FieldDrift, R as RecordsClient } from './client-DcWZjmg2.js';
2
+ import { a as FieldTypeWord, N as NewFieldDeclaration } from './field-BIRNApm1.js';
3
+ import { U as Uuid, a as RecordsError } from './record-BrJNCmH1.js';
5
4
 
6
5
  /** One Field a person asked for, in the words a person uses (FLD-1 / FLD-11). */
7
6
  interface NewFieldSpec {
@@ -1,7 +1,6 @@
1
- import { R as RecordsClient } from './client-D2jAgJNn.cjs';
2
- import { a as FieldTypeWord, N as NewFieldDeclaration } from './field-DoVl2I9K.cjs';
3
- import { U as Uuid, a as RecordsError } from './record-CxGK1OEK.cjs';
4
- import { F as FieldDrift } from './table-kind-CboiMJuE.cjs';
1
+ import { F as FieldDrift, R as RecordsClient } from './client-9fzhCPD5.cjs';
2
+ import { a as FieldTypeWord, N as NewFieldDeclaration } from './field-BLy8drjM.cjs';
3
+ import { U as Uuid, a as RecordsError } from './record-BrJNCmH1.cjs';
5
4
 
6
5
  /** One Field a person asked for, in the words a person uses (FLD-1 / FLD-11). */
7
6
  interface NewFieldSpec {
@@ -1,4 +1,4 @@
1
- import { U as Uuid, R as RecordsResult } from './record-CxGK1OEK.cjs';
1
+ import { U as Uuid, R as RecordsResult } from './record-BrJNCmH1.cjs';
2
2
 
3
3
  /**
4
4
  * What a context field holds, as a person thinks of it — derived from the Field's behaviour, `multi`,
@@ -1,4 +1,4 @@
1
- import { U as Uuid, R as RecordsResult } from './record-CxGK1OEK.js';
1
+ import { U as Uuid, R as RecordsResult } from './record-BrJNCmH1.js';
2
2
 
3
3
  /**
4
4
  * What a context field holds, as a person thinks of it — derived from the Field's behaviour, `multi`,
@@ -1,11 +1,11 @@
1
- import { a as EntityWireQuery, b as EntityColumnWire, c as EntityWireRow } from '../port-CRP5g9l9.cjs';
2
- export { d as CreateEntityClientOptions, C as CreateEntityDataPortOptions, e as CreateEntityRealtimeOptions, D as DEFAULT_BATCH_MS, f as DEFAULT_MAX_ORG_TOPICS, g as DEFAULT_MAX_WAIT_MS, h as ENTITY_DOOR_SCHEMA, i as ENTITY_NOTICE_EVENT, j as EntityAlias, k as EntityClient, l as EntityColumnsAnswer, E as EntityDataPort, m as EntityGetAnswer, n as EntityListAnswer, o as EntityListRequest, p as EntityNotice, q as EntityNoticeSink, r as EntityRealtime, s as EntitySortApplied, t as EntityTypeFacts, u as EntityWirePredicate, v as EntityWireRef, w as EntityWireSort, x as EntityWriteAnswer, y as EntityWriteOptions, O as OP_ID_HEADER, z as createEntityClient, A as createEntityDataPort, B as createEntityRealtime, F as createSeedPort, G as entityNoticeKey, H as entityOrgChannel, I as entityOrgChannelSpec, J as entityOrgTopic, K as orderOrganizationTopics, L as readEntityRealtimeKnobs, M as toWireValue, N as toWireValues } from '../port-CRP5g9l9.cjs';
3
- import { k as RecordsErrorCode, P as PgError, a as RecordsError } from '../record-CxGK1OEK.cjs';
4
- import { Q as Query, C as Column, f as EntityRef, R as Row } from '../types-3lM5f6b0.cjs';
5
- import '../ports-YIh9jrCZ.cjs';
6
- import '../field-DoVl2I9K.cjs';
1
+ import { a as EntityWireQuery, b as EntityColumnWire, c as EntityWireRow } from '../port-B9glCG2h.cjs';
2
+ export { d as CreateEntityClientOptions, C as CreateEntityDataPortOptions, e as CreateEntityRealtimeOptions, D as DEFAULT_BATCH_MS, f as DEFAULT_MAX_ORG_TOPICS, g as DEFAULT_MAX_WAIT_MS, h as ENTITY_DOOR_SCHEMA, i as ENTITY_NOTICE_EVENT, j as EntityAlias, k as EntityClient, l as EntityColumnsAnswer, E as EntityDataPort, m as EntityGetAnswer, n as EntityListAnswer, o as EntityListRequest, p as EntityNotice, q as EntityNoticeSink, r as EntityRealtime, s as EntitySortApplied, t as EntityTypeFacts, u as EntityWirePredicate, v as EntityWireRef, w as EntityWireSort, x as EntityWriteAnswer, y as EntityWriteOptions, O as OP_ID_HEADER, z as createEntityClient, A as createEntityDataPort, B as createEntityRealtime, F as createSeedPort, G as entityNoticeKey, H as entityOrgChannel, I as entityOrgChannelSpec, J as entityOrgTopic, K as orderOrganizationTopics, L as readEntityRealtimeKnobs, M as toWireValue, N as toWireValues } from '../port-B9glCG2h.cjs';
3
+ import { m as RecordsErrorCode, P as PgError, a as RecordsError } from '../record-BrJNCmH1.cjs';
4
+ import { Q as Query, C as Column, f as EntityRef, R as Row } from '../types-5ql9_q-o.cjs';
5
+ import '../ports-BIdYUS-C.cjs';
6
+ import '../field-BLy8drjM.cjs';
7
7
  import '@ai-matrx/realtime';
8
- import '../relation-DSGhM3tO.cjs';
8
+ import '../relation-R10qQyQU.cjs';
9
9
 
10
10
  /**
11
11
  * Every MX code a read door raises, and the engine code a screen branches on. A code the doors learn
@@ -1,11 +1,11 @@
1
- import { a as EntityWireQuery, b as EntityColumnWire, c as EntityWireRow } from '../port-CtnELAJQ.js';
2
- export { d as CreateEntityClientOptions, C as CreateEntityDataPortOptions, e as CreateEntityRealtimeOptions, D as DEFAULT_BATCH_MS, f as DEFAULT_MAX_ORG_TOPICS, g as DEFAULT_MAX_WAIT_MS, h as ENTITY_DOOR_SCHEMA, i as ENTITY_NOTICE_EVENT, j as EntityAlias, k as EntityClient, l as EntityColumnsAnswer, E as EntityDataPort, m as EntityGetAnswer, n as EntityListAnswer, o as EntityListRequest, p as EntityNotice, q as EntityNoticeSink, r as EntityRealtime, s as EntitySortApplied, t as EntityTypeFacts, u as EntityWirePredicate, v as EntityWireRef, w as EntityWireSort, x as EntityWriteAnswer, y as EntityWriteOptions, O as OP_ID_HEADER, z as createEntityClient, A as createEntityDataPort, B as createEntityRealtime, F as createSeedPort, G as entityNoticeKey, H as entityOrgChannel, I as entityOrgChannelSpec, J as entityOrgTopic, K as orderOrganizationTopics, L as readEntityRealtimeKnobs, M as toWireValue, N as toWireValues } from '../port-CtnELAJQ.js';
3
- import { k as RecordsErrorCode, P as PgError, a as RecordsError } from '../record-CxGK1OEK.js';
4
- import { Q as Query, C as Column, f as EntityRef, R as Row } from '../types-04kFNi3-.js';
5
- import '../ports-WwHHNwge.js';
6
- import '../field-CJtssH3q.js';
1
+ import { a as EntityWireQuery, b as EntityColumnWire, c as EntityWireRow } from '../port-C-p-_lAu.js';
2
+ export { d as CreateEntityClientOptions, C as CreateEntityDataPortOptions, e as CreateEntityRealtimeOptions, D as DEFAULT_BATCH_MS, f as DEFAULT_MAX_ORG_TOPICS, g as DEFAULT_MAX_WAIT_MS, h as ENTITY_DOOR_SCHEMA, i as ENTITY_NOTICE_EVENT, j as EntityAlias, k as EntityClient, l as EntityColumnsAnswer, E as EntityDataPort, m as EntityGetAnswer, n as EntityListAnswer, o as EntityListRequest, p as EntityNotice, q as EntityNoticeSink, r as EntityRealtime, s as EntitySortApplied, t as EntityTypeFacts, u as EntityWirePredicate, v as EntityWireRef, w as EntityWireSort, x as EntityWriteAnswer, y as EntityWriteOptions, O as OP_ID_HEADER, z as createEntityClient, A as createEntityDataPort, B as createEntityRealtime, F as createSeedPort, G as entityNoticeKey, H as entityOrgChannel, I as entityOrgChannelSpec, J as entityOrgTopic, K as orderOrganizationTopics, L as readEntityRealtimeKnobs, M as toWireValue, N as toWireValues } from '../port-C-p-_lAu.js';
3
+ import { m as RecordsErrorCode, P as PgError, a as RecordsError } from '../record-BrJNCmH1.js';
4
+ import { Q as Query, C as Column, f as EntityRef, R as Row } from '../types-BALEbMc8.js';
5
+ import '../ports-BE_5jz-c.js';
6
+ import '../field-BIRNApm1.js';
7
7
  import '@ai-matrx/realtime';
8
- import '../relation-Dh-lCkkh.js';
8
+ import '../relation-BxGXLRaG.js';
9
9
 
10
10
  /**
11
11
  * Every MX code a read door raises, and the engine code a screen branches on. A code the doors learn
@@ -1,4 +1,4 @@
1
- import { U as Uuid, D as DeclarableFieldKind, x as FieldBehavior, y as ParityFieldType, c as FieldSensitivity, d as ContextPolicy, C as ComputeOn, O as OnDelete, F as FieldSource, h as Timestamp } from './record-CxGK1OEK.js';
1
+ import { U as Uuid, D as DeclarableFieldKind, o as FieldBehavior, p as ParityFieldType, c as FieldSensitivity, d as ContextPolicy, C as ComputeOn, O as OnDelete, F as FieldSource, h as Timestamp } from './record-BrJNCmH1.js';
2
2
 
3
3
  /**
4
4
  * EVERYTHING THIS FILE NEEDS TO KNOW ABOUT A FIELD, AND NOTHING ELSE.
@@ -738,4 +738,4 @@ interface FieldDuplicated {
738
738
  values: "copied" | "not_a_value";
739
739
  }
740
740
 
741
- export { isButtonField as $, ADDRESS_PARTS as A, type ButtonPressed as B, type ChoiceOptions as C, STATUS_GROUP_WORDS as D, SYSTEM_WRITER_WORDS as E, type Field as F, type StatusGroup as G, addressFromText as H, addressMapUrl as I, addressText as J, type KernelTargets as K, allowsOtherValues as L, buttonNeeds as M, type NewFieldDeclaration as N, buttonOf as O, type ParityFieldTypeDescriptor as P, buttonUrlPlaceholders as Q, type RelationNamesAnswer as R, STATUS_GROUPS as S, type TableProposal as T, coerceTypedAnswer as U, coerceTypedAnswers as V, coercionLabel as W, durationText as X, entityReferenceKindsOf as Y, fieldKindFor as Z, isAddressValue as _, type FieldTypeWord as a, isEntityReferenceConfig as a0, isPersonStamp as a1, newerKindExportWords as a2, newerKindOf as a3, newerKindWords as a4, personStampText as a5, ratingMaxOf as a6, readTypedDuration as a7, relationNameIndexOf as a8, relationNameKey as a9, relationNamesIn as aa, richTextPlain as ab, safeLinkHref as ac, splitListCell as ad, statusGroupOf as ae, type FieldRule as b, type FieldPatch as c, type FieldDuplicated as d, type FieldProposal as e, AGENT_WRITER_WORDS as f, type AddressPart as g, type AddressValue as h, BARCODE_SYMBOLOGIES as i, BUTTON_DOES as j, type ButtonDoes as k, type ButtonSettings as l, type CoerceOptions as m, type Coerced as n, type CoercedAnswers as o, type CoercibleField as p, FIELD_KINDS as q, type FieldKind as r, type FieldOptionEdit as s, NEWER_FIELD_KINDS as t, NOT_A_MEMBER_WORDS as u, type NewerFieldKind as v, type PersonStamp as w, type RelationDisplay as x, type RelationNameIndex as y, type RelationNameMatch as z };
741
+ export { isButtonField as $, ADDRESS_PARTS as A, BARCODE_SYMBOLOGIES as B, type ChoiceOptions as C, STATUS_GROUP_WORDS as D, SYSTEM_WRITER_WORDS as E, type Field as F, type StatusGroup as G, addressFromText as H, addressMapUrl as I, addressText as J, type KernelTargets as K, allowsOtherValues as L, buttonNeeds as M, type NewFieldDeclaration as N, buttonOf as O, type ParityFieldTypeDescriptor as P, buttonUrlPlaceholders as Q, type RelationDisplay as R, STATUS_GROUPS as S, type TableProposal as T, coerceTypedAnswer as U, coerceTypedAnswers as V, coercionLabel as W, durationText as X, entityReferenceKindsOf as Y, fieldKindFor as Z, isAddressValue as _, type FieldTypeWord as a, isEntityReferenceConfig as a0, isPersonStamp as a1, newerKindExportWords as a2, newerKindOf as a3, newerKindWords as a4, personStampText as a5, ratingMaxOf as a6, readTypedDuration as a7, relationNameIndexOf as a8, relationNameKey as a9, relationNamesIn as aa, richTextPlain as ab, safeLinkHref as ac, splitListCell as ad, statusGroupOf as ae, type FieldRule as b, AGENT_WRITER_WORDS as c, type AddressPart as d, type AddressValue as e, BUTTON_DOES as f, type ButtonDoes as g, type ButtonPressed as h, type ButtonSettings as i, type CoerceOptions as j, type Coerced as k, type CoercedAnswers as l, type CoercibleField as m, FIELD_KINDS as n, type FieldDuplicated as o, type FieldKind as p, type FieldOptionEdit as q, type FieldPatch as r, type FieldProposal as s, NEWER_FIELD_KINDS as t, NOT_A_MEMBER_WORDS as u, type NewerFieldKind as v, type PersonStamp as w, type RelationNameIndex as x, type RelationNameMatch as y, type RelationNamesAnswer as z };
@@ -1,4 +1,4 @@
1
- import { U as Uuid, D as DeclarableFieldKind, x as FieldBehavior, y as ParityFieldType, c as FieldSensitivity, d as ContextPolicy, C as ComputeOn, O as OnDelete, F as FieldSource, h as Timestamp } from './record-CxGK1OEK.cjs';
1
+ import { U as Uuid, D as DeclarableFieldKind, o as FieldBehavior, p as ParityFieldType, c as FieldSensitivity, d as ContextPolicy, C as ComputeOn, O as OnDelete, F as FieldSource, h as Timestamp } from './record-BrJNCmH1.cjs';
2
2
 
3
3
  /**
4
4
  * EVERYTHING THIS FILE NEEDS TO KNOW ABOUT A FIELD, AND NOTHING ELSE.
@@ -738,4 +738,4 @@ interface FieldDuplicated {
738
738
  values: "copied" | "not_a_value";
739
739
  }
740
740
 
741
- export { isButtonField as $, ADDRESS_PARTS as A, type ButtonPressed as B, type ChoiceOptions as C, STATUS_GROUP_WORDS as D, SYSTEM_WRITER_WORDS as E, type Field as F, type StatusGroup as G, addressFromText as H, addressMapUrl as I, addressText as J, type KernelTargets as K, allowsOtherValues as L, buttonNeeds as M, type NewFieldDeclaration as N, buttonOf as O, type ParityFieldTypeDescriptor as P, buttonUrlPlaceholders as Q, type RelationNamesAnswer as R, STATUS_GROUPS as S, type TableProposal as T, coerceTypedAnswer as U, coerceTypedAnswers as V, coercionLabel as W, durationText as X, entityReferenceKindsOf as Y, fieldKindFor as Z, isAddressValue as _, type FieldTypeWord as a, isEntityReferenceConfig as a0, isPersonStamp as a1, newerKindExportWords as a2, newerKindOf as a3, newerKindWords as a4, personStampText as a5, ratingMaxOf as a6, readTypedDuration as a7, relationNameIndexOf as a8, relationNameKey as a9, relationNamesIn as aa, richTextPlain as ab, safeLinkHref as ac, splitListCell as ad, statusGroupOf as ae, type FieldRule as b, type FieldPatch as c, type FieldDuplicated as d, type FieldProposal as e, AGENT_WRITER_WORDS as f, type AddressPart as g, type AddressValue as h, BARCODE_SYMBOLOGIES as i, BUTTON_DOES as j, type ButtonDoes as k, type ButtonSettings as l, type CoerceOptions as m, type Coerced as n, type CoercedAnswers as o, type CoercibleField as p, FIELD_KINDS as q, type FieldKind as r, type FieldOptionEdit as s, NEWER_FIELD_KINDS as t, NOT_A_MEMBER_WORDS as u, type NewerFieldKind as v, type PersonStamp as w, type RelationDisplay as x, type RelationNameIndex as y, type RelationNameMatch as z };
741
+ export { isButtonField as $, ADDRESS_PARTS as A, BARCODE_SYMBOLOGIES as B, type ChoiceOptions as C, STATUS_GROUP_WORDS as D, SYSTEM_WRITER_WORDS as E, type Field as F, type StatusGroup as G, addressFromText as H, addressMapUrl as I, addressText as J, type KernelTargets as K, allowsOtherValues as L, buttonNeeds as M, type NewFieldDeclaration as N, buttonOf as O, type ParityFieldTypeDescriptor as P, buttonUrlPlaceholders as Q, type RelationDisplay as R, STATUS_GROUPS as S, type TableProposal as T, coerceTypedAnswer as U, coerceTypedAnswers as V, coercionLabel as W, durationText as X, entityReferenceKindsOf as Y, fieldKindFor as Z, isAddressValue as _, type FieldTypeWord as a, isEntityReferenceConfig as a0, isPersonStamp as a1, newerKindExportWords as a2, newerKindOf as a3, newerKindWords as a4, personStampText as a5, ratingMaxOf as a6, readTypedDuration as a7, relationNameIndexOf as a8, relationNameKey as a9, relationNamesIn as aa, richTextPlain as ab, safeLinkHref as ac, splitListCell as ad, statusGroupOf as ae, type FieldRule as b, AGENT_WRITER_WORDS as c, type AddressPart as d, type AddressValue as e, BUTTON_DOES as f, type ButtonDoes as g, type ButtonPressed as h, type ButtonSettings as i, type CoerceOptions as j, type Coerced as k, type CoercedAnswers as l, type CoercibleField as m, FIELD_KINDS as n, type FieldDuplicated as o, type FieldKind as p, type FieldOptionEdit as q, type FieldPatch as r, type FieldProposal as s, NEWER_FIELD_KINDS as t, NOT_A_MEMBER_WORDS as u, type NewerFieldKind as v, type PersonStamp as w, type RelationNameIndex as x, type RelationNameMatch as y, type RelationNamesAnswer as z };
@@ -1,6 +1,6 @@
1
- import { k as PortalAccent } from '../portal-C4N9ByaY.cjs';
2
- import { F as FormSummary, R as RuleExpression } from '../rule-DQpC7WqT.cjs';
3
- import { U as Uuid } from '../record-CxGK1OEK.cjs';
1
+ import { P as PortalAccent } from '../portal-C_LgvDeh.cjs';
2
+ import { F as FormSummary, R as RuleExpression } from '../rule-BGtYd6Pf.cjs';
3
+ import { U as Uuid } from '../record-BrJNCmH1.cjs';
4
4
 
5
5
  /**
6
6
  * THE WORDS FOR EACH STATE, SAID ONCE, FOR EVERY SCREEN THAT SHOWS A FORM.
@@ -1,6 +1,6 @@
1
- import { k as PortalAccent } from '../portal-DW5NGBT0.js';
2
- import { F as FormSummary, R as RuleExpression } from '../rule-xNwJF6Qo.js';
3
- import { U as Uuid } from '../record-CxGK1OEK.js';
1
+ import { P as PortalAccent } from '../portal-B9HCNPTc.js';
2
+ import { F as FormSummary, R as RuleExpression } from '../rule-BtjrE42J.js';
3
+ import { U as Uuid } from '../record-BrJNCmH1.js';
4
4
 
5
5
  /**
6
6
  * THE WORDS FOR EACH STATE, SAID ONCE, FOR EVERY SCREEN THAT SHOWS A FORM.
package/dist/index.cjs CHANGED
@@ -104,6 +104,7 @@ __export(src_exports, {
104
104
  addressMapUrl: () => addressMapUrl,
105
105
  addressText: () => addressText,
106
106
  allowsOtherValues: () => allowsOtherValues,
107
+ alternatePatch: () => alternatePatch,
107
108
  archivedByLine: () => archivedByLine,
108
109
  archivedWhen: () => archivedWhen,
109
110
  asChoiceNudge: () => asChoiceNudge,
@@ -121,6 +122,7 @@ __export(src_exports, {
121
122
  choiceSlug: () => choiceSlug,
122
123
  choiceValuesOf: () => choiceValuesOf,
123
124
  choicesOf: () => choicesOf,
125
+ chooseAlternate: () => chooseAlternate,
124
126
  coerceTypedAnswer: () => coerceTypedAnswer,
125
127
  coerceTypedAnswers: () => coerceTypedAnswers,
126
128
  coercionLabel: () => coercionLabel,
@@ -5345,4 +5347,47 @@ function tableRenderSchema(facts) {
5345
5347
  }
5346
5348
  return { kind: slug, fields: out };
5347
5349
  }
5350
+
5351
+ // src/alternates.ts
5352
+ function refuse(code, message, hint) {
5353
+ return { ok: false, error: { code, message, hint, ours: true } };
5354
+ }
5355
+ function alternatePatch(document, field_key, alternate_index) {
5356
+ const block = document._values ?? {};
5357
+ const envelope = block[field_key];
5358
+ const alternates = Array.isArray(envelope?.alternates) ? envelope.alternates : [];
5359
+ const chosen = alternates[alternate_index];
5360
+ if (!envelope || !chosen) return { ok: false, message: "That other value is no longer on this record." };
5361
+ const kept = alternates.filter((_, i) => i !== alternate_index);
5362
+ const current = document[field_key];
5363
+ const next = [...kept];
5364
+ if (current !== null && current !== void 0) {
5365
+ const taken = new Set(kept.map((a) => a.rank));
5366
+ let rank = 1;
5367
+ while (taken.has(rank)) rank += 1;
5368
+ next.push({ value: current, ...envelope.src ? { src: envelope.src } : {}, rank });
5369
+ }
5370
+ const { ver: _ver, actor: _actor, at: _at, on_behalf_of: _on, absent: _absent, alternates: _alts, src: _src, ...rest } = envelope;
5371
+ const changed = { ...rest, ...chosen.src ? { src: chosen.src } : {} };
5372
+ if (next.length > 0) changed["alternates"] = next;
5373
+ return {
5374
+ ok: true,
5375
+ patch: {
5376
+ [field_key]: chosen.value,
5377
+ // THE WHOLE BLOCK — every other field's envelope and alternates travel with it.
5378
+ _values: { ...block, [field_key]: changed }
5379
+ }
5380
+ };
5381
+ }
5382
+ async function chooseAlternate(client, { record_id, field_key, alternate_index }) {
5383
+ const read = await client.recordRead({ record_id, withVersion: true });
5384
+ if (!read.ok) return read;
5385
+ const version = read.data.version;
5386
+ if (version === null || version === void 0) {
5387
+ return refuse("stale_read", "Nothing was saved: this record's latest changes could not be checked.", "Reload, then try again.");
5388
+ }
5389
+ const built = alternatePatch(read.data.document, field_key, alternate_index);
5390
+ if (!built.ok) return refuse("not_found", built.message, "Reload, then look again.");
5391
+ return client.recordUpdate({ record_id, patch: built.patch, expectedVersion: version });
5392
+ }
5348
5393
  //# sourceMappingURL=index.cjs.map