@ai-matrx/records 0.92.2 → 0.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/{client-Dzd8gtAo.d.ts → client-DsPuWFp0.d.ts} +8 -8
  3. package/dist/{client-Cn3odIIB.d.cts → client-EyD3rS0T.d.cts} +8 -8
  4. package/dist/core/index.cjs +101 -32
  5. package/dist/core/index.cjs.map +1 -1
  6. package/dist/core/index.d.cts +16 -15
  7. package/dist/core/index.d.ts +16 -15
  8. package/dist/core/index.js +101 -32
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/data/index.cjs +46 -24
  11. package/dist/data/index.cjs.map +1 -1
  12. package/dist/data/index.d.cts +11 -11
  13. package/dist/data/index.d.ts +11 -11
  14. package/dist/data/index.js +46 -24
  15. package/dist/data/index.js.map +1 -1
  16. package/dist/{declareTable-CrL6AZKB.d.cts → declareTable-Bkk_Ewib.d.cts} +4 -4
  17. package/dist/{declareTable-ZRW5EsTQ.d.ts → declareTable-kL5qZoTe.d.ts} +4 -4
  18. package/dist/entity/index.cjs +43 -29
  19. package/dist/entity/index.cjs.map +1 -1
  20. package/dist/entity/index.d.cts +7 -6
  21. package/dist/entity/index.d.ts +7 -6
  22. package/dist/entity/index.js +43 -29
  23. package/dist/entity/index.js.map +1 -1
  24. package/dist/entity/react.cjs +43 -29
  25. package/dist/entity/react.cjs.map +1 -1
  26. package/dist/entity/react.js +43 -29
  27. package/dist/entity/react.js.map +1 -1
  28. package/dist/{field-CCY1rG9l.d.cts → field-6rwt4ejZ.d.cts} +1 -1
  29. package/dist/{field-enufS5ry.d.ts → field-B-WaVZnS.d.ts} +1 -1
  30. package/dist/forms/index.d.cts +3 -3
  31. package/dist/forms/index.d.ts +3 -3
  32. package/dist/index.cjs +92 -25
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +13 -33
  35. package/dist/index.d.ts +13 -33
  36. package/dist/index.js +92 -25
  37. package/dist/index.js.map +1 -1
  38. package/dist/memory/index.d.cts +7 -7
  39. package/dist/memory/index.d.ts +7 -7
  40. package/dist/objectOrganization-BII_K3Gm.d.ts +45 -0
  41. package/dist/objectOrganization-DfjDQtDb.d.cts +45 -0
  42. package/dist/{port-C54ykAOv.d.ts → port--acgmxh5.d.ts} +5 -2
  43. package/dist/{port-Drioh9al.d.cts → port-Cx76dq-X.d.cts} +5 -2
  44. package/dist/{portal-DRdmZ-xv.d.cts → portal-9sRr6cpG.d.cts} +1 -1
  45. package/dist/{portal-or_f7BkT.d.ts → portal-BDAqsGkg.d.ts} +1 -1
  46. package/dist/{ports-s0D2jvqn.d.cts → ports-9BQ3zo2y.d.cts} +108 -2
  47. package/dist/{ports-BeOgjwYl.d.ts → ports-DYWE1ENo.d.ts} +108 -2
  48. package/dist/react/index.cjs +101 -32
  49. package/dist/react/index.cjs.map +1 -1
  50. package/dist/react/index.d.cts +1463 -1363
  51. package/dist/react/index.d.ts +1463 -1363
  52. package/dist/react/index.js +101 -32
  53. package/dist/react/index.js.map +1 -1
  54. package/dist/realtime/index.cjs +43 -13
  55. package/dist/realtime/index.cjs.map +1 -1
  56. package/dist/realtime/index.d.cts +9 -3
  57. package/dist/realtime/index.d.ts +9 -3
  58. package/dist/realtime/index.js +43 -13
  59. package/dist/realtime/index.js.map +1 -1
  60. package/dist/{record-BwCf9wKW.d.cts → record-DmmeuUrC.d.cts} +1 -1
  61. package/dist/{record-BwCf9wKW.d.ts → record-DmmeuUrC.d.ts} +1 -1
  62. package/dist/{relation-eLMgv_dV.d.ts → relation-Op1M67le.d.ts} +2 -2
  63. package/dist/{relation-8vAWCa67.d.cts → relation-qrb2NbHf.d.cts} +2 -2
  64. package/dist/{rule-wHI5B0Ka.d.cts → rule-CeHg1sy1.d.cts} +1 -1
  65. package/dist/{rule-D9yNiorf.d.ts → rule-tN2lxvJ1.d.ts} +1 -1
  66. package/dist/search/index.d.cts +1 -1
  67. package/dist/search/index.d.ts +1 -1
  68. package/dist/setup/index.cjs +117 -42
  69. package/dist/setup/index.cjs.map +1 -1
  70. package/dist/setup/index.d.cts +25 -11
  71. package/dist/setup/index.d.ts +25 -11
  72. package/dist/setup/index.js +117 -42
  73. package/dist/setup/index.js.map +1 -1
  74. package/dist/{subscription-CdoI-UaB.d.cts → subscription-Drbxn-9Z.d.cts} +3 -3
  75. package/dist/{subscription-BynsG1K6.d.ts → subscription-hdTaRrfK.d.ts} +3 -3
  76. package/dist/{table-kind-i3lZJa3f.d.ts → table-kind-BZkvzBgc.d.ts} +4 -29
  77. package/dist/{table-kind-DzctQ7dO.d.cts → table-kind-C-hZxDN7.d.cts} +4 -29
  78. package/dist/templates/index.d.cts +10 -10
  79. package/dist/templates/index.d.ts +10 -10
  80. package/dist/typed-table/index.cjs +46 -24
  81. package/dist/typed-table/index.cjs.map +1 -1
  82. package/dist/typed-table/index.d.cts +10 -10
  83. package/dist/typed-table/index.d.ts +10 -10
  84. package/dist/typed-table/index.js +46 -24
  85. package/dist/typed-table/index.js.map +1 -1
  86. package/dist/{types-BvL_oKFl.d.ts → types-BauAeFW8.d.ts} +2 -2
  87. package/dist/{types-DAFP6XFe.d.cts → types-CBmUdBT0.d.cts} +2 -2
  88. package/dist/{types-BKYEeFt4.d.cts → types-Dek9owBe.d.cts} +2 -2
  89. package/dist/{types-D8qdG3Lg.d.cts → types-DsgXrESm.d.cts} +2 -2
  90. package/dist/{types-cpKY7Pjb.d.ts → types-HVgWcZDY.d.ts} +2 -2
  91. package/dist/{types-DYzXhD7j.d.ts → types-hrw-Eff1.d.ts} +2 -2
  92. package/dist/use-cases/index.d.cts +5 -5
  93. package/dist/use-cases/index.d.ts +5 -5
  94. package/dist/{validate-DfNMxjmU.d.cts → validate-B_iUeyh2.d.cts} +1 -1
  95. package/dist/{validate-DbvAParj.d.ts → validate-w-HGGTf-.d.ts} +1 -1
  96. package/dist/views/index.cjs +438 -0
  97. package/dist/views/index.cjs.map +1 -0
  98. package/dist/views/index.d.cts +401 -0
  99. package/dist/views/index.d.ts +401 -0
  100. package/dist/views/index.js +415 -0
  101. package/dist/views/index.js.map +1 -0
  102. package/package.json +13 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog — @ai-matrx/records
2
2
 
3
+ ## 0.93.0
4
+ ### host ports: record organization, row agent
5
+
6
+ **`createRecords` takes two host ports.** `organizationOf` ("which organization owns this record", read from the
7
+ object through `custom.where_id_opens`; new `RecordOrganizationPort`, `whereIdOpensPort`,
8
+ `resolveObjectOrganization`, `readObjectOrganizationAnswer`, `ObjectOrganizationAnswer` — moved from the website) and
9
+ `rowAgent` ("run an agent on this row"; new `RowAgentPort`, `RowAgentTarget`). The setup answers
10
+ `organizationOf(id)` (default: the store's door) and `runAgentOnRow(target)` (refuses `not_supported` by name when no
11
+ runner is bound).
12
+
13
+ **Consumer action:** none. A host that keeps object-organization answers binds its own `organizationOf`; a host with
14
+ an agent runner passes `rowAgent`.
15
+
16
+ ### saved views, headless
17
+
18
+ **New section `@ai-matrx/records/views`: saved views without any screen.** The view-key registry (`VIEW_KEYS`), the
19
+ one reader (`viewSettings`) and writer (`viewSettingsPatch`), the declarative spec (`SavedViewSpec`, `SavedView`), the
20
+ layouts and page-view words, and the doors that keep a view (`declareView`, `saveViewPatch`, `designateView`,
21
+ `viewFromRow`, `viewDocument`) moved here from `@ai-matrx/records-ui`. A view's look is a port
22
+ (`ViewPresentationCodec`): left out, it stays the plain JSON document the store keeps; records-ui binds its grid look.
23
+ Zero React, zero design-system (section-isolation probe `./views`).
24
+
25
+ **Consumer action:** none. A headless host imports saved views from `@ai-matrx/records/views`; records-ui's own
26
+ exports are unchanged.
27
+
28
+ ### own-write ledger
29
+
30
+ **Two setups in one process hear each other's live writes.** The op ledger (how a client knows a notice is the echo
31
+ of its own write) was one per realm, so setup A's write was "ours" to setup B too and B dropped it. Own-write
32
+ detection is now per client: `createRecords` gives each setup its own ledger and hands it to its client, entity port
33
+ and live port. New `createOpLedger()` / `OpLedger`; `createRecordsClient({ opLedger })`,
34
+ `createRecordsRealtimePort({ ledger })`, `createEntityDataPort({ opLedger })`. Left out, the realm's default ledger
35
+ is used exactly as before (`mintOpId` / `isOwnOp` unchanged).
36
+
37
+ **Consumer action:** none. A host that builds its own client and live port by hand and runs two of them in one
38
+ realm passes the same `createOpLedger()` to each pair.
39
+
3
40
  ## 0.92.2
4
41
 
5
42
  Automatic changed-only republish (docs/metadata drift since the last tag — see
@@ -1,11 +1,11 @@
1
- import { C as ChoiceNudge, T as TableArchiveProgress, a as TableRestoreProgress, b as TableDuplicateProgress, c as TableDuplicated, d as TableCopyInProgress, A as ArchiveLane, e as ArchivedRow, f as Table, g as TableHome, h as TableMoved, i as ChoiceUsage, j as ChoiceRehome, k as ChoiceCellBack, l as ChoicesRehomed, m as TableCapacity, F as FieldDrift, n as FieldRetyped, R as RecordsMerged, M as MigrationUndone, o as TableKindFacts, p as TableLevelFacts, q as TableReaderRule, r as TableLevelSet, E as EntityTableFacts, s as EntityFieldsAcross, N as NewEntityFieldDeclaration, t as EntityFieldRights, u as EntityRecordRead, v as EntityBackLinks, w as EntityRowWritten, x as EntityRecordsFound, P as Pipeline, y as PipelineColumn, z as PipelineVerdict, B as PipelineMoveResult, D as PipelineMoveManyItem, G as PipelineMoveMany, H as PipelineSpec, I as PipelineDeclared, S as StageRuleOnFail, J as StageRuleEnforcement, K as StagePending, L as StagePendingOnBoard, O as PipelineGate, Q as PipelineGatePreview, U as ImportPlan, V as ImportPolicy, W as ImportOpened, X as ImportColumnsDeclared, Y as ImportBatchResult, Z as ImportFinished, _ as ImportReport, $ as ImportRun, a0 as InboundDeclared, a1 as InboundAddress, a2 as FormArchiveAnswer, a3 as ArchivedForm, a4 as ArchivedChecklistTemplate, a5 as TableRowDefaults, a6 as TableRowDefaultsPatch, a7 as RowDefaultsApplied, a8 as RecordRowControls, a9 as CaptureSheetSummary, aa as CaptureSheetFace, ab as CaptureFileRef, ac as CaptureOutcome, ad as EnrichmentSummary, ae as EnrichDeclared, af as EnrichDueRow, ag as EnrichCell, ah as EnrichRun, ai as DrillSource, aj as DrillDefinition, ak as DrillQuestion, al as DrillAnswer, am as DrillRowsPage, an as DocToken, ao as DocUnresolvedToken, ap as DocTemplateRow, aq as DocRenderRow, ar as DocSignatureRow, as as RecordHistoryEntry, at as RecordScopeContext, au as ConversationScope, av as ConversationScopeContext, aw as FieldHistoryEntry, ax as RestorePreview, ay as RestoreResult, az as CommentThreadRead, aA as CommentWritten, aB as AnonTokenBinding, aC as ChecklistSpec, aD as ChecklistDeclared, aE as ChecklistTemplateSummary, aF as ChecklistTemplateShape, aG as ChecklistRunStarted, aH as ChecklistRunStep, aI as ChecklistRunSummary, aJ as ChecklistStepCompleted, aK as WorkState, aL as WorkGraph, aM as WorkInstantiation, aN as WorkTurn, aO as WorkAssignmentField, aP as WorkSlotHold, aQ as WorkInboxView, aR as WorkInboxItem, aS as InboxStateChange, aT as InboxCounts, aU as WorkListFlavour, aV as WorkListItem, aW as WorkAssignment, aX as WorkRecordState, aY as WorkApprover, aZ as WorkChange, a_ as WorkApprovalFiled, a$ as WorkApprovalDecision, b0 as WorkDecideManyItem, b1 as WorkDecideMany, b2 as ExternalPrincipalCard, b3 as PublishBinding, b4 as ResolvedPublishBinding, b5 as ResolvedPublishBindingKind, b6 as MyLevel, b7 as DecorationPath, b8 as TableDecorations, b9 as GridLayout, ba as FormulaParse, bb as FormulaPreview, bc as RowAction, bd as ActionRunResult, be as AutomationSpec, bf as AutomationDeclared, bg as AutomationList, bh as AutomationFlipped, bi as AutomationRuns, bj as RecordEvent, bk as TableWebhookDeclared, bl as TableWebhook, bm as IoExportPage, bn as TableListEntry, bo as DataHomeTable, bp as TableSyncSpec, bq as TableSyncResult, br as TableRowCount, bs as RecordHeader, bt as OutsideShareAnswer, bu as ViewOrderSet } from './table-kind-i3lZJa3f.js';
2
- import { d as StoreFilter, e as DashboardSummary, f as DashboardBlock, R as RecordFilter, g as AggregateCompare, c as AggregateBucket, h as DashboardRunResult, i as StuckRow, b as AggregateMeasure, j as AggregateRow, k as Subscription, M as MySubscription, l as SubscriptionSpec, m as DigestPreview, n as SavedViewRow, o as SavedViewSpecIn, p as RowTemplateRow } from './subscription-BynsG1K6.js';
3
- import { R as RelationCoordinate, a as RelationWordsManyArgs, b as RelationIcons, c as ReverseColumn, d as ReverseLinksManyArgs, e as ReverseLinks, f as ReverseLinksFieldsArgs, S as SourceArchived } from './relation-eLMgv_dV.js';
4
- import { b as Field, c as FieldPatch, N as NewFieldDeclaration, R as RelationNamesAnswer, d as FieldDuplicated, e as FieldProposal, T as TableProposal, B as ButtonPressed } from './field-enufS5ry.js';
5
- import { F as FormSummary, B as BookingSummary, a as BookingAvailability, b as BookingDeclared, c as FormRoute, d as FormResults } from './rule-D9yNiorf.js';
6
- import { F as FormLookOptions, P as PortalSummary, a as PortalArchiveFilter, b as PortalArchiveAnswer, c as PortalTableRef, d as PortalCard, e as PortalConfigInput, f as PortalFormSpec, g as PortalFormAnswer, h as PortalInvitation, i as PortalRevocation, j as PortalPreviewRow } from './portal-or_f7BkT.js';
7
- import { T as Timestamp, U as Uuid, k as RecordsErrorCode, l as RecordDocument, R as RecordsResult, m as RecordChange, n as RecordChangeResult, o as RecordGraphWritten, p as RecordRead, q as ReadRow, r as RecordPageSort, s as RecordPage, t as RecordKeysetPage, u as StoredRecord, v as RecordRevision, w as ReadValue, a as RecordsError, W as WriteConflict } from './record-BwCf9wKW.js';
8
- import { a as RecordsConfig } from './ports-BeOgjwYl.js';
1
+ import { C as ChoiceNudge, T as TableArchiveProgress, a as TableRestoreProgress, b as TableDuplicateProgress, c as TableDuplicated, d as TableCopyInProgress, A as ArchiveLane, e as ArchivedRow, f as Table, g as TableHome, h as TableMoved, i as ChoiceUsage, j as ChoiceRehome, k as ChoiceCellBack, l as ChoicesRehomed, m as TableCapacity, F as FieldDrift, n as FieldRetyped, R as RecordsMerged, M as MigrationUndone, o as TableKindFacts, p as TableLevelFacts, q as TableReaderRule, r as TableLevelSet, E as EntityTableFacts, s as EntityFieldsAcross, N as NewEntityFieldDeclaration, t as EntityFieldRights, u as EntityRecordRead, v as EntityBackLinks, w as EntityRowWritten, x as EntityRecordsFound, P as Pipeline, y as PipelineColumn, z as PipelineVerdict, B as PipelineMoveResult, D as PipelineMoveManyItem, G as PipelineMoveMany, H as PipelineSpec, I as PipelineDeclared, S as StageRuleOnFail, J as StageRuleEnforcement, K as StagePending, L as StagePendingOnBoard, O as PipelineGate, Q as PipelineGatePreview, U as ImportPlan, V as ImportPolicy, W as ImportOpened, X as ImportColumnsDeclared, Y as ImportBatchResult, Z as ImportFinished, _ as ImportReport, $ as ImportRun, a0 as InboundDeclared, a1 as InboundAddress, a2 as FormArchiveAnswer, a3 as ArchivedForm, a4 as ArchivedChecklistTemplate, a5 as TableRowDefaults, a6 as TableRowDefaultsPatch, a7 as RowDefaultsApplied, a8 as RecordRowControls, a9 as CaptureSheetSummary, aa as CaptureSheetFace, ab as CaptureFileRef, ac as CaptureOutcome, ad as EnrichmentSummary, ae as EnrichDeclared, af as EnrichDueRow, ag as EnrichCell, ah as EnrichRun, ai as DrillSource, aj as DrillDefinition, ak as DrillQuestion, al as DrillAnswer, am as DrillRowsPage, an as DocToken, ao as DocUnresolvedToken, ap as DocTemplateRow, aq as DocRenderRow, ar as DocSignatureRow, as as RecordHistoryEntry, at as RecordScopeContext, au as ConversationScope, av as ConversationScopeContext, aw as FieldHistoryEntry, ax as RestorePreview, ay as RestoreResult, az as CommentThreadRead, aA as CommentWritten, aB as AnonTokenBinding, aC as ChecklistSpec, aD as ChecklistDeclared, aE as ChecklistTemplateSummary, aF as ChecklistTemplateShape, aG as ChecklistRunStarted, aH as ChecklistRunStep, aI as ChecklistRunSummary, aJ as ChecklistStepCompleted, aK as WorkState, aL as WorkGraph, aM as WorkInstantiation, aN as WorkTurn, aO as WorkAssignmentField, aP as WorkSlotHold, aQ as WorkInboxView, aR as WorkInboxItem, aS as InboxStateChange, aT as InboxCounts, aU as WorkListFlavour, aV as WorkListItem, aW as WorkAssignment, aX as WorkRecordState, aY as WorkApprover, aZ as WorkChange, a_ as WorkApprovalFiled, a$ as WorkApprovalDecision, b0 as WorkDecideManyItem, b1 as WorkDecideMany, b2 as ExternalPrincipalCard, b3 as PublishBinding, b4 as ResolvedPublishBinding, b5 as ResolvedPublishBindingKind, b6 as DecorationPath, b7 as TableDecorations, b8 as GridLayout, b9 as FormulaParse, ba as FormulaPreview, bb as RowAction, bc as ActionRunResult, bd as AutomationSpec, be as AutomationDeclared, bf as AutomationList, bg as AutomationFlipped, bh as AutomationRuns, bi as RecordEvent, bj as TableWebhookDeclared, bk as TableWebhook, bl as IoExportPage, bm as TableListEntry, bn as DataHomeTable, bo as TableSyncSpec, bp as TableSyncResult, bq as TableRowCount, br as RecordHeader, bs as OutsideShareAnswer, bt as ViewOrderSet } from './table-kind-BZkvzBgc.js';
2
+ import { e as StoreFilter, f as DashboardSummary, g as DashboardBlock, R as RecordFilter, h as AggregateCompare, c as AggregateBucket, i as DashboardRunResult, j as StuckRow, b as AggregateMeasure, k as AggregateRow, l as Subscription, M as MySubscription, m as SubscriptionSpec, n as DigestPreview, d as SavedViewRow, o as SavedViewSpecIn, p as RowTemplateRow } from './subscription-hdTaRrfK.js';
3
+ import { R as RelationCoordinate, a as RelationWordsManyArgs, b as RelationIcons, c as ReverseColumn, d as ReverseLinksManyArgs, e as ReverseLinks, f as ReverseLinksFieldsArgs, S as SourceArchived } from './relation-Op1M67le.js';
4
+ import { b as Field, c as FieldPatch, N as NewFieldDeclaration, R as RelationNamesAnswer, d as FieldDuplicated, e as FieldProposal, T as TableProposal, B as ButtonPressed } from './field-B-WaVZnS.js';
5
+ import { F as FormSummary, B as BookingSummary, a as BookingAvailability, b as BookingDeclared, c as FormRoute, d as FormResults } from './rule-tN2lxvJ1.js';
6
+ import { F as FormLookOptions, P as PortalSummary, a as PortalArchiveFilter, b as PortalArchiveAnswer, c as PortalTableRef, d as PortalCard, e as PortalConfigInput, f as PortalFormSpec, g as PortalFormAnswer, h as PortalInvitation, i as PortalRevocation, j as PortalPreviewRow } from './portal-BDAqsGkg.js';
7
+ import { a as RecordsConfig, M as MyLevel } from './ports-DYWE1ENo.js';
8
+ import { h as Timestamp, U as Uuid, k as RecordsErrorCode, l as RecordDocument, R as RecordsResult, m as RecordChange, n as RecordChangeResult, o as RecordGraphWritten, p as RecordRead, q as ReadRow, r as RecordPageSort, s as RecordPage, t as RecordKeysetPage, u as StoredRecord, v as RecordRevision, w as ReadValue, a as RecordsError, W as WriteConflict } from './record-DmmeuUrC.js';
9
9
 
10
10
  /**
11
11
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -1,11 +1,11 @@
1
- import { C as ChoiceNudge, T as TableArchiveProgress, a as TableRestoreProgress, b as TableDuplicateProgress, c as TableDuplicated, d as TableCopyInProgress, A as ArchiveLane, e as ArchivedRow, f as Table, g as TableHome, h as TableMoved, i as ChoiceUsage, j as ChoiceRehome, k as ChoiceCellBack, l as ChoicesRehomed, m as TableCapacity, F as FieldDrift, n as FieldRetyped, R as RecordsMerged, M as MigrationUndone, o as TableKindFacts, p as TableLevelFacts, q as TableReaderRule, r as TableLevelSet, E as EntityTableFacts, s as EntityFieldsAcross, N as NewEntityFieldDeclaration, t as EntityFieldRights, u as EntityRecordRead, v as EntityBackLinks, w as EntityRowWritten, x as EntityRecordsFound, P as Pipeline, y as PipelineColumn, z as PipelineVerdict, B as PipelineMoveResult, D as PipelineMoveManyItem, G as PipelineMoveMany, H as PipelineSpec, I as PipelineDeclared, S as StageRuleOnFail, J as StageRuleEnforcement, K as StagePending, L as StagePendingOnBoard, O as PipelineGate, Q as PipelineGatePreview, U as ImportPlan, V as ImportPolicy, W as ImportOpened, X as ImportColumnsDeclared, Y as ImportBatchResult, Z as ImportFinished, _ as ImportReport, $ as ImportRun, a0 as InboundDeclared, a1 as InboundAddress, a2 as FormArchiveAnswer, a3 as ArchivedForm, a4 as ArchivedChecklistTemplate, a5 as TableRowDefaults, a6 as TableRowDefaultsPatch, a7 as RowDefaultsApplied, a8 as RecordRowControls, a9 as CaptureSheetSummary, aa as CaptureSheetFace, ab as CaptureFileRef, ac as CaptureOutcome, ad as EnrichmentSummary, ae as EnrichDeclared, af as EnrichDueRow, ag as EnrichCell, ah as EnrichRun, ai as DrillSource, aj as DrillDefinition, ak as DrillQuestion, al as DrillAnswer, am as DrillRowsPage, an as DocToken, ao as DocUnresolvedToken, ap as DocTemplateRow, aq as DocRenderRow, ar as DocSignatureRow, as as RecordHistoryEntry, at as RecordScopeContext, au as ConversationScope, av as ConversationScopeContext, aw as FieldHistoryEntry, ax as RestorePreview, ay as RestoreResult, az as CommentThreadRead, aA as CommentWritten, aB as AnonTokenBinding, aC as ChecklistSpec, aD as ChecklistDeclared, aE as ChecklistTemplateSummary, aF as ChecklistTemplateShape, aG as ChecklistRunStarted, aH as ChecklistRunStep, aI as ChecklistRunSummary, aJ as ChecklistStepCompleted, aK as WorkState, aL as WorkGraph, aM as WorkInstantiation, aN as WorkTurn, aO as WorkAssignmentField, aP as WorkSlotHold, aQ as WorkInboxView, aR as WorkInboxItem, aS as InboxStateChange, aT as InboxCounts, aU as WorkListFlavour, aV as WorkListItem, aW as WorkAssignment, aX as WorkRecordState, aY as WorkApprover, aZ as WorkChange, a_ as WorkApprovalFiled, a$ as WorkApprovalDecision, b0 as WorkDecideManyItem, b1 as WorkDecideMany, b2 as ExternalPrincipalCard, b3 as PublishBinding, b4 as ResolvedPublishBinding, b5 as ResolvedPublishBindingKind, b6 as MyLevel, b7 as DecorationPath, b8 as TableDecorations, b9 as GridLayout, ba as FormulaParse, bb as FormulaPreview, bc as RowAction, bd as ActionRunResult, be as AutomationSpec, bf as AutomationDeclared, bg as AutomationList, bh as AutomationFlipped, bi as AutomationRuns, bj as RecordEvent, bk as TableWebhookDeclared, bl as TableWebhook, bm as IoExportPage, bn as TableListEntry, bo as DataHomeTable, bp as TableSyncSpec, bq as TableSyncResult, br as TableRowCount, bs as RecordHeader, bt as OutsideShareAnswer, bu as ViewOrderSet } from './table-kind-DzctQ7dO.cjs';
2
- import { d as StoreFilter, e as DashboardSummary, f as DashboardBlock, R as RecordFilter, g as AggregateCompare, c as AggregateBucket, h as DashboardRunResult, i as StuckRow, b as AggregateMeasure, j as AggregateRow, k as Subscription, M as MySubscription, l as SubscriptionSpec, m as DigestPreview, n as SavedViewRow, o as SavedViewSpecIn, p as RowTemplateRow } from './subscription-CdoI-UaB.cjs';
3
- import { R as RelationCoordinate, a as RelationWordsManyArgs, b as RelationIcons, c as ReverseColumn, d as ReverseLinksManyArgs, e as ReverseLinks, f as ReverseLinksFieldsArgs, S as SourceArchived } from './relation-8vAWCa67.cjs';
4
- import { b as Field, c as FieldPatch, N as NewFieldDeclaration, R as RelationNamesAnswer, d as FieldDuplicated, e as FieldProposal, T as TableProposal, B as ButtonPressed } from './field-CCY1rG9l.cjs';
5
- import { F as FormSummary, B as BookingSummary, a as BookingAvailability, b as BookingDeclared, c as FormRoute, d as FormResults } from './rule-wHI5B0Ka.cjs';
6
- import { F as FormLookOptions, P as PortalSummary, a as PortalArchiveFilter, b as PortalArchiveAnswer, c as PortalTableRef, d as PortalCard, e as PortalConfigInput, f as PortalFormSpec, g as PortalFormAnswer, h as PortalInvitation, i as PortalRevocation, j as PortalPreviewRow } from './portal-DRdmZ-xv.cjs';
7
- import { T as Timestamp, U as Uuid, k as RecordsErrorCode, l as RecordDocument, R as RecordsResult, m as RecordChange, n as RecordChangeResult, o as RecordGraphWritten, p as RecordRead, q as ReadRow, r as RecordPageSort, s as RecordPage, t as RecordKeysetPage, u as StoredRecord, v as RecordRevision, w as ReadValue, a as RecordsError, W as WriteConflict } from './record-BwCf9wKW.cjs';
8
- import { a as RecordsConfig } from './ports-s0D2jvqn.cjs';
1
+ import { C as ChoiceNudge, T as TableArchiveProgress, a as TableRestoreProgress, b as TableDuplicateProgress, c as TableDuplicated, d as TableCopyInProgress, A as ArchiveLane, e as ArchivedRow, f as Table, g as TableHome, h as TableMoved, i as ChoiceUsage, j as ChoiceRehome, k as ChoiceCellBack, l as ChoicesRehomed, m as TableCapacity, F as FieldDrift, n as FieldRetyped, R as RecordsMerged, M as MigrationUndone, o as TableKindFacts, p as TableLevelFacts, q as TableReaderRule, r as TableLevelSet, E as EntityTableFacts, s as EntityFieldsAcross, N as NewEntityFieldDeclaration, t as EntityFieldRights, u as EntityRecordRead, v as EntityBackLinks, w as EntityRowWritten, x as EntityRecordsFound, P as Pipeline, y as PipelineColumn, z as PipelineVerdict, B as PipelineMoveResult, D as PipelineMoveManyItem, G as PipelineMoveMany, H as PipelineSpec, I as PipelineDeclared, S as StageRuleOnFail, J as StageRuleEnforcement, K as StagePending, L as StagePendingOnBoard, O as PipelineGate, Q as PipelineGatePreview, U as ImportPlan, V as ImportPolicy, W as ImportOpened, X as ImportColumnsDeclared, Y as ImportBatchResult, Z as ImportFinished, _ as ImportReport, $ as ImportRun, a0 as InboundDeclared, a1 as InboundAddress, a2 as FormArchiveAnswer, a3 as ArchivedForm, a4 as ArchivedChecklistTemplate, a5 as TableRowDefaults, a6 as TableRowDefaultsPatch, a7 as RowDefaultsApplied, a8 as RecordRowControls, a9 as CaptureSheetSummary, aa as CaptureSheetFace, ab as CaptureFileRef, ac as CaptureOutcome, ad as EnrichmentSummary, ae as EnrichDeclared, af as EnrichDueRow, ag as EnrichCell, ah as EnrichRun, ai as DrillSource, aj as DrillDefinition, ak as DrillQuestion, al as DrillAnswer, am as DrillRowsPage, an as DocToken, ao as DocUnresolvedToken, ap as DocTemplateRow, aq as DocRenderRow, ar as DocSignatureRow, as as RecordHistoryEntry, at as RecordScopeContext, au as ConversationScope, av as ConversationScopeContext, aw as FieldHistoryEntry, ax as RestorePreview, ay as RestoreResult, az as CommentThreadRead, aA as CommentWritten, aB as AnonTokenBinding, aC as ChecklistSpec, aD as ChecklistDeclared, aE as ChecklistTemplateSummary, aF as ChecklistTemplateShape, aG as ChecklistRunStarted, aH as ChecklistRunStep, aI as ChecklistRunSummary, aJ as ChecklistStepCompleted, aK as WorkState, aL as WorkGraph, aM as WorkInstantiation, aN as WorkTurn, aO as WorkAssignmentField, aP as WorkSlotHold, aQ as WorkInboxView, aR as WorkInboxItem, aS as InboxStateChange, aT as InboxCounts, aU as WorkListFlavour, aV as WorkListItem, aW as WorkAssignment, aX as WorkRecordState, aY as WorkApprover, aZ as WorkChange, a_ as WorkApprovalFiled, a$ as WorkApprovalDecision, b0 as WorkDecideManyItem, b1 as WorkDecideMany, b2 as ExternalPrincipalCard, b3 as PublishBinding, b4 as ResolvedPublishBinding, b5 as ResolvedPublishBindingKind, b6 as DecorationPath, b7 as TableDecorations, b8 as GridLayout, b9 as FormulaParse, ba as FormulaPreview, bb as RowAction, bc as ActionRunResult, bd as AutomationSpec, be as AutomationDeclared, bf as AutomationList, bg as AutomationFlipped, bh as AutomationRuns, bi as RecordEvent, bj as TableWebhookDeclared, bk as TableWebhook, bl as IoExportPage, bm as TableListEntry, bn as DataHomeTable, bo as TableSyncSpec, bp as TableSyncResult, bq as TableRowCount, br as RecordHeader, bs as OutsideShareAnswer, bt as ViewOrderSet } from './table-kind-C-hZxDN7.cjs';
2
+ import { e as StoreFilter, f as DashboardSummary, g as DashboardBlock, R as RecordFilter, h as AggregateCompare, c as AggregateBucket, i as DashboardRunResult, j as StuckRow, b as AggregateMeasure, k as AggregateRow, l as Subscription, M as MySubscription, m as SubscriptionSpec, n as DigestPreview, d as SavedViewRow, o as SavedViewSpecIn, p as RowTemplateRow } from './subscription-Drbxn-9Z.cjs';
3
+ import { R as RelationCoordinate, a as RelationWordsManyArgs, b as RelationIcons, c as ReverseColumn, d as ReverseLinksManyArgs, e as ReverseLinks, f as ReverseLinksFieldsArgs, S as SourceArchived } from './relation-qrb2NbHf.cjs';
4
+ import { b as Field, c as FieldPatch, N as NewFieldDeclaration, R as RelationNamesAnswer, d as FieldDuplicated, e as FieldProposal, T as TableProposal, B as ButtonPressed } from './field-6rwt4ejZ.cjs';
5
+ import { F as FormSummary, B as BookingSummary, a as BookingAvailability, b as BookingDeclared, c as FormRoute, d as FormResults } from './rule-CeHg1sy1.cjs';
6
+ import { F as FormLookOptions, P as PortalSummary, a as PortalArchiveFilter, b as PortalArchiveAnswer, c as PortalTableRef, d as PortalCard, e as PortalConfigInput, f as PortalFormSpec, g as PortalFormAnswer, h as PortalInvitation, i as PortalRevocation, j as PortalPreviewRow } from './portal-9sRr6cpG.cjs';
7
+ import { a as RecordsConfig, M as MyLevel } from './ports-9BQ3zo2y.cjs';
8
+ import { h as Timestamp, U as Uuid, k as RecordsErrorCode, l as RecordDocument, R as RecordsResult, m as RecordChange, n as RecordChangeResult, o as RecordGraphWritten, p as RecordRead, q as ReadRow, r as RecordPageSort, s as RecordPage, t as RecordKeysetPage, u as StoredRecord, v as RecordRevision, w as ReadValue, a as RecordsError, W as WriteConflict } from './record-DmmeuUrC.cjs';
9
9
 
10
10
  /**
11
11
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -110,6 +110,7 @@ __export(core_exports, {
110
110
  TABLE_TYPES: () => TABLE_TYPES,
111
111
  VALUE_ALTERNATE_KEYS: () => VALUE_ALTERNATE_KEYS,
112
112
  VALUE_ENVELOPE_KEYS: () => VALUE_ENVELOPE_KEYS,
113
+ WHERE_ID_OPENS_DOOR: () => WHERE_ID_OPENS_DOOR,
113
114
  WHOLE_VALUE_SOURCE_KIND: () => WHOLE_VALUE_SOURCE_KIND,
114
115
  actionRefusals: () => actionRefusals,
115
116
  addFields: () => addFields,
@@ -144,10 +145,12 @@ __export(core_exports, {
144
145
  coerceTypedAnswer: () => coerceTypedAnswer,
145
146
  coerceTypedAnswers: () => coerceTypedAnswers,
146
147
  coercionLabel: () => coercionLabel,
148
+ createOpLedger: () => createOpLedger,
147
149
  createRecordsClient: () => createRecordsClient,
148
150
  decideTypedChoice: () => decideTypedChoice,
149
151
  declareDrillDefinition: () => declareDrillDefinition,
150
152
  declareTable: () => declareTable,
153
+ defaultOpLedger: () => defaultOpLedger,
151
154
  doorAbsent: () => doorAbsent,
152
155
  doorCensus: () => doorCensus,
153
156
  doorExists: () => doorExists,
@@ -258,6 +261,7 @@ __export(core_exports, {
258
261
  publicFormPath: () => publicFormPath,
259
262
  rankTypedMatches: () => rankTypedMatches,
260
263
  ratingMaxOf: () => ratingMaxOf,
264
+ readObjectOrganizationAnswer: () => readObjectOrganizationAnswer,
261
265
  readTypedDate: () => readTypedDate,
262
266
  readTypedDuration: () => readTypedDuration,
263
267
  readTypedNumber: () => readTypedNumber,
@@ -273,6 +277,7 @@ __export(core_exports, {
273
277
  relationNamesIn: () => relationNamesIn,
274
278
  rememberedOpCount: () => rememberedOpCount,
275
279
  removedChoicesInUse: () => removedChoicesInUse,
280
+ resolveObjectOrganization: () => resolveObjectOrganization,
276
281
  richTextPlain: () => richTextPlain,
277
282
  ruleThatRefuses: () => ruleThatRefuses,
278
283
  rulesWithTopStar: () => rulesWithTopStar,
@@ -305,6 +310,7 @@ __export(core_exports, {
305
310
  typedTimeText: () => typedTimeText,
306
311
  valueConverts: () => valueConverts,
307
312
  valuesAreUnconfirmed: () => valuesAreUnconfirmed,
313
+ whereIdOpensPort: () => whereIdOpensPort,
308
314
  wholeValueNotRead: () => wholeValueNotRead,
309
315
  wholeValueOf: () => wholeValueOf,
310
316
  wholeValueOfRead: () => wholeValueOfRead,
@@ -2567,44 +2573,105 @@ function sourceArchivedOf(value) {
2567
2573
  return out;
2568
2574
  }
2569
2575
 
2576
+ // src/objectOrganization.ts
2577
+ var WHERE_ID_OPENS_DOOR = "where_id_opens";
2578
+ function doorIsAbsent(error) {
2579
+ if (error.code === "PGRST202" || error.code === "42883") return true;
2580
+ return /could not find the function/i.test(error.message ?? "");
2581
+ }
2582
+ var DOOR_ABSENT_WHY = "custom.where_id_opens is missing from this database, so this page cannot tell which organization the record lives in and holds instead of guessing. Remedy: the chair applies migrations/campaign/openbyid_one_address_opens_any_id.sql and openbyid_the_resolver_can_be_reached.sql.";
2583
+ async function resolveObjectOrganization(dataSource, id) {
2584
+ let answered;
2585
+ try {
2586
+ answered = await dataSource.rpc(WHERE_ID_OPENS_DOOR, { p_id: id }, { schema: "custom" });
2587
+ } catch (thrown) {
2588
+ return { state: "unavailable", why: thrown instanceof Error ? thrown.message : "The record store did not answer." };
2589
+ }
2590
+ return readObjectOrganizationAnswer(answered, id);
2591
+ }
2592
+ function readObjectOrganizationAnswer(answered, id) {
2593
+ if (answered.error) {
2594
+ if (doorIsAbsent(answered.error)) {
2595
+ console.warn(`[@ai-matrx/records] ${DOOR_ABSENT_WHY}`);
2596
+ return { state: "unavailable", why: DOOR_ABSENT_WHY };
2597
+ }
2598
+ return { state: "unavailable", why: answered.error.message ?? "The record store refused to say where this is." };
2599
+ }
2600
+ const row = answered.data;
2601
+ if (row === null || row === void 0) return { state: "not-given" };
2602
+ if (typeof row !== "object" || typeof row.organization_id !== "string" || typeof row.kind !== "string") {
2603
+ return { state: "unavailable", why: "The record store answered something this page cannot read." };
2604
+ }
2605
+ return {
2606
+ state: "found",
2607
+ organizationId: row.organization_id,
2608
+ kind: row.kind,
2609
+ path: typeof row.path === "string" ? row.path : null,
2610
+ live: row.live !== false,
2611
+ resolvedId: typeof row.resolved_id === "string" ? row.resolved_id : id
2612
+ };
2613
+ }
2614
+ function whereIdOpensPort(dataSource) {
2615
+ return { organizationOf: (id) => resolveObjectOrganization(dataSource, id) };
2616
+ }
2617
+
2570
2618
  // src/ops.ts
2571
2619
  var import_global_slot = require("@ai-matrx/kit/global-slot");
2572
2620
  var REMEMBER_MS = 3e4;
2573
2621
  var REMEMBER_MAX = 500;
2574
- var ours = (0, import_global_slot.globalSlot)("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map());
2575
- function trim(now) {
2576
- for (const [id, at] of ours) {
2577
- if (now - at <= REMEMBER_MS) break;
2578
- ours.delete(id);
2579
- }
2580
- while (ours.size > REMEMBER_MAX) {
2581
- const oldest = ours.keys().next();
2582
- if (oldest.done === true) break;
2583
- ours.delete(oldest.value);
2622
+ function ledgerOver(ours) {
2623
+ function trim(now) {
2624
+ for (const [id, at] of ours) {
2625
+ if (now - at <= REMEMBER_MS) break;
2626
+ ours.delete(id);
2627
+ }
2628
+ while (ours.size > REMEMBER_MAX) {
2629
+ const oldest = ours.keys().next();
2630
+ if (oldest.done === true) break;
2631
+ ours.delete(oldest.value);
2632
+ }
2584
2633
  }
2634
+ return {
2635
+ mint() {
2636
+ const id = crypto.randomUUID();
2637
+ const now = Date.now();
2638
+ ours.set(id, now);
2639
+ trim(now);
2640
+ return id;
2641
+ },
2642
+ isOwn(opId) {
2643
+ if (!opId) return false;
2644
+ const at = ours.get(opId);
2645
+ if (at === void 0) return false;
2646
+ if (Date.now() - at > REMEMBER_MS) {
2647
+ ours.delete(opId);
2648
+ return false;
2649
+ }
2650
+ return true;
2651
+ },
2652
+ clear() {
2653
+ ours.clear();
2654
+ },
2655
+ get size() {
2656
+ return ours.size;
2657
+ }
2658
+ };
2659
+ }
2660
+ function createOpLedger() {
2661
+ return ledgerOver(/* @__PURE__ */ new Map());
2585
2662
  }
2663
+ var defaultOpLedger = ledgerOver((0, import_global_slot.globalSlot)("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map()));
2586
2664
  function mintOpId() {
2587
- const id = crypto.randomUUID();
2588
- const now = Date.now();
2589
- ours.set(id, now);
2590
- trim(now);
2591
- return id;
2665
+ return defaultOpLedger.mint();
2592
2666
  }
2593
2667
  function isOwnOp(opId) {
2594
- if (!opId) return false;
2595
- const at = ours.get(opId);
2596
- if (at === void 0) return false;
2597
- if (Date.now() - at > REMEMBER_MS) {
2598
- ours.delete(opId);
2599
- return false;
2600
- }
2601
- return true;
2668
+ return defaultOpLedger.isOwn(opId);
2602
2669
  }
2603
2670
  function forgetAllOps() {
2604
- ours.clear();
2671
+ defaultOpLedger.clear();
2605
2672
  }
2606
2673
  function rememberedOpCount() {
2607
- return ours.size;
2674
+ return defaultOpLedger.size;
2608
2675
  }
2609
2676
 
2610
2677
  // src/store.generated.ts
@@ -6324,6 +6391,8 @@ function createRecordsClient(given) {
6324
6391
  const config = { ...given, dataSource: asRecordsDataSource(given.dataSource) };
6325
6392
  const schema = config.schema ?? DEFAULT_SCHEMA;
6326
6393
  const org = config.organizationId;
6394
+ const ledger = config.opLedger ?? defaultOpLedger;
6395
+ const mintOp = () => ledger.mint();
6327
6396
  const scream = sink(config);
6328
6397
  const BUNDLE_TTL_MS = 1e4;
6329
6398
  const BUNDLE_OPENERS = /* @__PURE__ */ new Set(["applicable_fields", "views", "view_look_read", "table_decorations", "row_actions", "reverse_columns", "record_change_actions", "grid_layout", "io_imports"]);
@@ -6710,14 +6779,14 @@ function createRecordsClient(given) {
6710
6779
  async recordWrite({ table_id, data }) {
6711
6780
  const result = await callDoor(
6712
6781
  DOORS.recordWrite,
6713
- { p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id: mintOpId() } },
6782
+ { p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id: mintOp() } },
6714
6783
  "recordWrite"
6715
6784
  );
6716
6785
  if (result.ok && typeof result.data === "string") announceRecordChanged(result.data);
6717
6786
  return result;
6718
6787
  },
6719
6788
  async recordWriteMany({ table_id, rows: rows2, ids }) {
6720
- const opId = mintOpId();
6789
+ const opId = mintOp();
6721
6790
  return callDoor(
6722
6791
  DOORS.recordWriteMany,
6723
6792
  {
@@ -6730,7 +6799,7 @@ function createRecordsClient(given) {
6730
6799
  );
6731
6800
  },
6732
6801
  async recordChangeMany({ table_id, changes }) {
6733
- const opId = mintOpId();
6802
+ const opId = mintOp();
6734
6803
  const result = await callDoor(
6735
6804
  DOORS.recordChangeMany,
6736
6805
  {
@@ -6753,7 +6822,7 @@ function createRecordsClient(given) {
6753
6822
  return result;
6754
6823
  },
6755
6824
  async recordWriteGraph({ table_id, parent, children, edges }) {
6756
- const opId = mintOpId();
6825
+ const opId = mintOp();
6757
6826
  return callDoor(
6758
6827
  DOORS.recordWriteGraph,
6759
6828
  {
@@ -6777,7 +6846,7 @@ function createRecordsClient(given) {
6777
6846
  {
6778
6847
  p_organization_id: org,
6779
6848
  p_record_id: record_id,
6780
- p_patch: { ...patch, _op_id: mintOpId() },
6849
+ p_patch: { ...patch, _op_id: mintOp() },
6781
6850
  ...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
6782
6851
  },
6783
6852
  "recordUpdate"
@@ -6791,7 +6860,7 @@ function createRecordsClient(given) {
6791
6860
  {
6792
6861
  p_organization_id: org,
6793
6862
  p_record_id: record_id,
6794
- p_patch: { ...patch, _op_id: mintOpId() },
6863
+ p_patch: { ...patch, _op_id: mintOp() },
6795
6864
  p_add: add,
6796
6865
  ...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
6797
6866
  },
@@ -7816,7 +7885,7 @@ function createRecordsClient(given) {
7816
7885
  p_table_id: table_id,
7817
7886
  p_key: keys,
7818
7887
  // The op id rides the envelope, as `recordWrite` / `recordUpdate` send it; each door takes it off.
7819
- p_data: { ...data, _op_id: mintOpId() },
7888
+ p_data: { ...data, _op_id: mintOp() },
7820
7889
  ...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
7821
7890
  },
7822
7891
  "recordUpsert"