@ai-matrx/records 0.58.0 → 0.58.2

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.
@@ -7104,6 +7104,66 @@ declare function keptTableHref(fact: {
7104
7104
  table: (tableId: Uuid) => string;
7105
7105
  scope: (scopeId: Uuid) => string;
7106
7106
  }): string;
7107
+ /** One of the person's other organizations, and whether the Table can go there. */
7108
+ interface TableHomeDestination {
7109
+ id: Uuid;
7110
+ name: string;
7111
+ /** The person's role there: owner · admin · member. */
7112
+ role: string;
7113
+ /** False when the store says the Table cannot go there; `why` says why, in its words. */
7114
+ ok: boolean;
7115
+ why: string | null;
7116
+ }
7117
+ /** `custom.table_home`'s answer, read. */
7118
+ interface TableHome {
7119
+ table: {
7120
+ id: Uuid;
7121
+ name: string;
7122
+ version: number;
7123
+ };
7124
+ /** Where it lives, from the Table itself. */
7125
+ organization: {
7126
+ id: Uuid;
7127
+ name: string;
7128
+ };
7129
+ /** The Table's maker, or an owner/admin of its organization. */
7130
+ mayMove: boolean;
7131
+ /** When `mayMove` is false: the sentence that says who can. */
7132
+ whyNot: string | null;
7133
+ /** Sentences for what holds it where it is. Empty when nothing does. */
7134
+ heldBy: string[];
7135
+ /** Every other organization this person belongs to. */
7136
+ destinations: TableHomeDestination[];
7137
+ carries: {
7138
+ fields: number;
7139
+ records: number;
7140
+ inTrash: number;
7141
+ choiceLists: number;
7142
+ withIt: number;
7143
+ /** Tables that ride along because they live inside it or inside its rows. */
7144
+ tablesInside: number;
7145
+ /** Links between its rows and rows that stay, which will reach back across the wall. */
7146
+ linksAcross: number;
7147
+ };
7148
+ }
7149
+ /** What `custom.table_move` answered when the move landed. */
7150
+ interface TableMoved {
7151
+ to: {
7152
+ id: Uuid;
7153
+ name: string;
7154
+ };
7155
+ from: {
7156
+ id: Uuid;
7157
+ name: string;
7158
+ };
7159
+ tableName: string;
7160
+ }
7161
+ /** Read the store's answer strictly: an answer this cannot read is `null`, never a guess. */
7162
+ declare function parseTableHome(raw: unknown): TableHome | null;
7163
+ /** Read `custom.table_move`'s answer; `null` when it is not a landed move. */
7164
+ declare function parseTableMoved(raw: unknown): TableMoved | null;
7165
+ /** The consequence of a move, said before it happens (destructive-and-expensive-actions law). */
7166
+ declare function moveConsequence(home: TableHome, to: Pick<TableHomeDestination, "name">): string;
7107
7167
 
7108
7168
  /** The seven shapes a block can take, exactly as `custom.dashboard_kinds()` answers. */
7109
7169
  type DashboardBlockKind = "number" | "bar" | "column" | "line" | "donut" | "table" | "stuck";
@@ -9337,6 +9397,27 @@ interface RecordsClient {
9337
9397
  * answer is `null` — nothing asked, nothing invented.
9338
9398
  */
9339
9399
  tableFacts(): Promise<RecordsResult<TableFact[] | null>>;
9400
+ /**
9401
+ * WHICH ORGANIZATION A TABLE LIVES IN, BY NAME, AND WHERE IT MAY GO — `custom.table_home`
9402
+ * (SC-1' / SC-1-TAILS). Read FROM THE TABLE, never from the organization the client is bound
9403
+ * to, so it answers for a table shared from outside too. `null` = not given to this person,
9404
+ * or not there (the store says the same for both, on purpose). A store without the door
9405
+ * refuses `door_absent` — never a guessed organization.
9406
+ */
9407
+ tableHome(args: {
9408
+ table_id: Uuid;
9409
+ }): Promise<RecordsResult<TableHome | null>>;
9410
+ /**
9411
+ * MOVE A TABLE into another organization the caller belongs to — `custom.table_move`. It
9412
+ * carries every Table inside it or its rows and writes the change events; refused, NOTHING
9413
+ * moved and the refusal carries the store's one sentence. `expected_version` is the Table's
9414
+ * version the caller decided on (a concurrent change refuses with "look again").
9415
+ */
9416
+ tableMove(args: {
9417
+ table_id: Uuid;
9418
+ to_organization_id: Uuid;
9419
+ expected_version?: number | null;
9420
+ }): Promise<RecordsResult<TableMoved>>;
9340
9421
  fields(args: {
9341
9422
  table_id: Uuid;
9342
9423
  recordType?: string;
@@ -11170,4 +11251,4 @@ declare function useEntityReferenceKinds(): EntityReferenceRead<EntityReferenceK
11170
11251
  /** The words of each reference, read for THIS person (withheld where they may not open it). */
11171
11252
  declare function useEntityReferenceWords(refs: readonly EntityRef[]): EntityReferenceRead<EntityRefWithWords[]>;
11172
11253
 
11173
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateCompare, type AggregateCompareKind, type AggregateCompareWindows, type AggregateDelta, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DashboardTarget, type DashboardTargetBase, type DashboardTargetOp, type DashboardTargetResult, type DashboardTotals, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, 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 EntityRef, type EntityRefWithWords, type EntityReferenceKind, type EntityReferenceRead, type EntityTableFacts, type EntityToken, type ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OutsideShareAnswer, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, PORTAL_ACCENTS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveMany, type PipelineMoveManyItem, type PipelineMoveManyResult, type PipelineMoveResult, type PipelineMoveVerdict, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalAccent, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalConfig, type PortalConfigInput, type PortalFooterLink, type PortalFormAnswer, type PortalFormInput, type PortalFormRef, type PortalFormSpec, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalStage, type PortalStyle, type PortalStyleInput, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHeader, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreFilter, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableListEntry, type TableOrigin, type TablePlacement, type TablePlacementFact, type TableProposal, type TableRowCount, type TableSyncResult, type TableSyncSource, type TableSyncSpec, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, type ViewOrderSet, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDecideMany, type WorkDecideManyItem, type WorkDecideManyResult, type WorkDecideVerdict, 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, actionRefusals, allowsOtherValues, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, entityReferenceKinds, entityReferenceKindsOf, entityReferenceWords, entityRefsOf, entityRefsToWrite, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isEntityReferenceConfig, isOwnOp, isPortalAccent, isPortalArchiveFilter, isRecordsErr, isRuleFilter, isTheChosen, keptGroups, keptOutOfSight, keptTableHref, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, moveInOrder, offeredAsContext, ok, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, sheetSyncSpec, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityReferenceKinds, useEntityReferenceWords, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordChangeRevision, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables, withRowCounts, withTablePlacement };
11254
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateCompare, type AggregateCompareKind, type AggregateCompareWindows, type AggregateDelta, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DashboardTarget, type DashboardTargetBase, type DashboardTargetOp, type DashboardTargetResult, type DashboardTotals, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, 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 EntityRef, type EntityRefWithWords, type EntityReferenceKind, type EntityReferenceRead, type EntityTableFacts, type EntityToken, type ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OutsideShareAnswer, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, PORTAL_ACCENTS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveMany, type PipelineMoveManyItem, type PipelineMoveManyResult, type PipelineMoveResult, type PipelineMoveVerdict, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalAccent, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalConfig, type PortalConfigInput, type PortalFooterLink, type PortalFormAnswer, type PortalFormInput, type PortalFormRef, type PortalFormSpec, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalStage, type PortalStyle, type PortalStyleInput, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHeader, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreFilter, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableHome, type TableHomeDestination, type TableListEntry, type TableMoved, type TableOrigin, type TablePlacement, type TablePlacementFact, type TableProposal, type TableRowCount, type TableSyncResult, type TableSyncSource, type TableSyncSpec, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, type ViewOrderSet, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDecideMany, type WorkDecideManyItem, type WorkDecideManyResult, type WorkDecideVerdict, 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, actionRefusals, allowsOtherValues, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, entityReferenceKinds, entityReferenceKindsOf, entityReferenceWords, entityRefsOf, entityRefsToWrite, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isEntityReferenceConfig, isOwnOp, isPortalAccent, isPortalArchiveFilter, isRecordsErr, isRuleFilter, isTheChosen, keptGroups, keptOutOfSight, keptTableHref, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, moveConsequence, moveInOrder, offeredAsContext, ok, openCaptureQueue, optionKey, optionLabel, parseTableHome, parseTableMoved, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, sheetSyncSpec, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityReferenceKinds, useEntityReferenceWords, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordChangeRevision, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables, withRowCounts, withTablePlacement };
@@ -7104,6 +7104,66 @@ declare function keptTableHref(fact: {
7104
7104
  table: (tableId: Uuid) => string;
7105
7105
  scope: (scopeId: Uuid) => string;
7106
7106
  }): string;
7107
+ /** One of the person's other organizations, and whether the Table can go there. */
7108
+ interface TableHomeDestination {
7109
+ id: Uuid;
7110
+ name: string;
7111
+ /** The person's role there: owner · admin · member. */
7112
+ role: string;
7113
+ /** False when the store says the Table cannot go there; `why` says why, in its words. */
7114
+ ok: boolean;
7115
+ why: string | null;
7116
+ }
7117
+ /** `custom.table_home`'s answer, read. */
7118
+ interface TableHome {
7119
+ table: {
7120
+ id: Uuid;
7121
+ name: string;
7122
+ version: number;
7123
+ };
7124
+ /** Where it lives, from the Table itself. */
7125
+ organization: {
7126
+ id: Uuid;
7127
+ name: string;
7128
+ };
7129
+ /** The Table's maker, or an owner/admin of its organization. */
7130
+ mayMove: boolean;
7131
+ /** When `mayMove` is false: the sentence that says who can. */
7132
+ whyNot: string | null;
7133
+ /** Sentences for what holds it where it is. Empty when nothing does. */
7134
+ heldBy: string[];
7135
+ /** Every other organization this person belongs to. */
7136
+ destinations: TableHomeDestination[];
7137
+ carries: {
7138
+ fields: number;
7139
+ records: number;
7140
+ inTrash: number;
7141
+ choiceLists: number;
7142
+ withIt: number;
7143
+ /** Tables that ride along because they live inside it or inside its rows. */
7144
+ tablesInside: number;
7145
+ /** Links between its rows and rows that stay, which will reach back across the wall. */
7146
+ linksAcross: number;
7147
+ };
7148
+ }
7149
+ /** What `custom.table_move` answered when the move landed. */
7150
+ interface TableMoved {
7151
+ to: {
7152
+ id: Uuid;
7153
+ name: string;
7154
+ };
7155
+ from: {
7156
+ id: Uuid;
7157
+ name: string;
7158
+ };
7159
+ tableName: string;
7160
+ }
7161
+ /** Read the store's answer strictly: an answer this cannot read is `null`, never a guess. */
7162
+ declare function parseTableHome(raw: unknown): TableHome | null;
7163
+ /** Read `custom.table_move`'s answer; `null` when it is not a landed move. */
7164
+ declare function parseTableMoved(raw: unknown): TableMoved | null;
7165
+ /** The consequence of a move, said before it happens (destructive-and-expensive-actions law). */
7166
+ declare function moveConsequence(home: TableHome, to: Pick<TableHomeDestination, "name">): string;
7107
7167
 
7108
7168
  /** The seven shapes a block can take, exactly as `custom.dashboard_kinds()` answers. */
7109
7169
  type DashboardBlockKind = "number" | "bar" | "column" | "line" | "donut" | "table" | "stuck";
@@ -9337,6 +9397,27 @@ interface RecordsClient {
9337
9397
  * answer is `null` — nothing asked, nothing invented.
9338
9398
  */
9339
9399
  tableFacts(): Promise<RecordsResult<TableFact[] | null>>;
9400
+ /**
9401
+ * WHICH ORGANIZATION A TABLE LIVES IN, BY NAME, AND WHERE IT MAY GO — `custom.table_home`
9402
+ * (SC-1' / SC-1-TAILS). Read FROM THE TABLE, never from the organization the client is bound
9403
+ * to, so it answers for a table shared from outside too. `null` = not given to this person,
9404
+ * or not there (the store says the same for both, on purpose). A store without the door
9405
+ * refuses `door_absent` — never a guessed organization.
9406
+ */
9407
+ tableHome(args: {
9408
+ table_id: Uuid;
9409
+ }): Promise<RecordsResult<TableHome | null>>;
9410
+ /**
9411
+ * MOVE A TABLE into another organization the caller belongs to — `custom.table_move`. It
9412
+ * carries every Table inside it or its rows and writes the change events; refused, NOTHING
9413
+ * moved and the refusal carries the store's one sentence. `expected_version` is the Table's
9414
+ * version the caller decided on (a concurrent change refuses with "look again").
9415
+ */
9416
+ tableMove(args: {
9417
+ table_id: Uuid;
9418
+ to_organization_id: Uuid;
9419
+ expected_version?: number | null;
9420
+ }): Promise<RecordsResult<TableMoved>>;
9340
9421
  fields(args: {
9341
9422
  table_id: Uuid;
9342
9423
  recordType?: string;
@@ -11170,4 +11251,4 @@ declare function useEntityReferenceKinds(): EntityReferenceRead<EntityReferenceK
11170
11251
  /** The words of each reference, read for THIS person (withheld where they may not open it). */
11171
11252
  declare function useEntityReferenceWords(refs: readonly EntityRef[]): EntityReferenceRead<EntityRefWithWords[]>;
11172
11253
 
11173
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateCompare, type AggregateCompareKind, type AggregateCompareWindows, type AggregateDelta, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DashboardTarget, type DashboardTargetBase, type DashboardTargetOp, type DashboardTargetResult, type DashboardTotals, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, 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 EntityRef, type EntityRefWithWords, type EntityReferenceKind, type EntityReferenceRead, type EntityTableFacts, type EntityToken, type ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OutsideShareAnswer, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, PORTAL_ACCENTS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveMany, type PipelineMoveManyItem, type PipelineMoveManyResult, type PipelineMoveResult, type PipelineMoveVerdict, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalAccent, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalConfig, type PortalConfigInput, type PortalFooterLink, type PortalFormAnswer, type PortalFormInput, type PortalFormRef, type PortalFormSpec, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalStage, type PortalStyle, type PortalStyleInput, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHeader, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreFilter, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableListEntry, type TableOrigin, type TablePlacement, type TablePlacementFact, type TableProposal, type TableRowCount, type TableSyncResult, type TableSyncSource, type TableSyncSpec, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, type ViewOrderSet, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDecideMany, type WorkDecideManyItem, type WorkDecideManyResult, type WorkDecideVerdict, 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, actionRefusals, allowsOtherValues, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, entityReferenceKinds, entityReferenceKindsOf, entityReferenceWords, entityRefsOf, entityRefsToWrite, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isEntityReferenceConfig, isOwnOp, isPortalAccent, isPortalArchiveFilter, isRecordsErr, isRuleFilter, isTheChosen, keptGroups, keptOutOfSight, keptTableHref, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, moveInOrder, offeredAsContext, ok, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, sheetSyncSpec, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityReferenceKinds, useEntityReferenceWords, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordChangeRevision, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables, withRowCounts, withTablePlacement };
11254
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, type AbsenceReason, type ActionRefusal, type ActionRunResult, type Actor, type AggregateBucket, type AggregateCompare, type AggregateCompareKind, type AggregateCompareWindows, type AggregateDelta, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type ArchiveLane, type ArchivedDoorRow, type ArchivedRow, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, 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 ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DECLARABLE_FIELD_KINDS, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type DashboardTarget, type DashboardTargetBase, type DashboardTargetOp, type DashboardTargetResult, type DashboardTotals, type DeclarableFieldKind, type DecorationColor, type DecorationPath, type DecorationRule, type DecorationRuleOp, type DecorationTarget, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, 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 EntityRef, type EntityRefWithWords, type EntityReferenceKind, type EntityReferenceRead, type EntityTableFacts, type EntityToken, type ExampleBuilt, type ExampleSpec, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type FormulaParse, type Freshness, type GridLayout, type GridLayoutMode, type GridRowHeight, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportColumnsDeclared, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type IoExportPage, KERNEL_TABLES, type KernelTableName, type KernelTargets, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OutsideShareAnswer, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, PORTAL_ACCENTS, PORTAL_ARCHIVE_FILTERS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveMany, type PipelineMoveManyItem, type PipelineMoveManyResult, type PipelineMoveResult, type PipelineMoveVerdict, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalAccent, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalConfig, type PortalConfigInput, type PortalFooterLink, type PortalFormAnswer, type PortalFormInput, type PortalFormRef, type PortalFormSpec, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalStage, type PortalStyle, type PortalStyleInput, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordChangeAction, type RecordComment, type RecordDocument, type RecordEvent, type RecordFilter, type RecordGraphWritten, type RecordHeader, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationDisplay, type RelationDisplaySpec, type RelationFlavor, type RelationProperties, type RelationStore, type RelationTarget, type RelationWordsManyArgs, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type RowAction, type RowActionStep, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreFilter, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableArchiveProgress, type TableCapacity, type TableDecorations, type TableDisplay, type TableHome, type TableHomeDestination, type TableListEntry, type TableMoved, type TableOrigin, type TablePlacement, type TablePlacementFact, type TableProposal, type TableRowCount, type TableSyncResult, type TableSyncSource, type TableSyncSpec, type TableType, type TableWebhook, type TableWebhookDeclared, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type UseTableArchive, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type ViewLayout, type ViewOrderSet, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDecideMany, type WorkDecideManyItem, type WorkDecideManyResult, type WorkDecideVerdict, 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, actionRefusals, allowsOtherValues, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, entityReferenceKinds, entityReferenceKindsOf, entityReferenceWords, entityRefsOf, entityRefsToWrite, err, exampleSpec, exportPageXlsx, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isEntityReferenceConfig, isOwnOp, isPortalAccent, isPortalArchiveFilter, isRecordsErr, isRuleFilter, isTheChosen, keptGroups, keptOutOfSight, keptTableHref, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, moveConsequence, moveInOrder, offeredAsContext, ok, openCaptureQueue, optionKey, optionLabel, parseTableHome, parseTableMoved, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, recordChangeTrigger, rememberedOpCount, sameDocument, scopeChip, sheetSyncSpec, stableFilterKey, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityReferenceKinds, useEntityReferenceWords, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordChangeRevision, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTableArchive, useTables, withRowCounts, withTablePlacement };
@@ -2283,6 +2283,116 @@ function rememberedOpCount() {
2283
2283
  return ours.size;
2284
2284
  }
2285
2285
 
2286
+ // src/placement.ts
2287
+ function keptOutOfSight(placement) {
2288
+ return placement?.kept_by_the_app === true;
2289
+ }
2290
+ function offeredAsContext(placement) {
2291
+ return placement?.offered_as_context === true;
2292
+ }
2293
+ function withTablePlacement(tables, facts) {
2294
+ if (!facts) return [...tables];
2295
+ const byId = new Map(facts.map((f) => [f.table_id, f]));
2296
+ return tables.map((table) => {
2297
+ const fact = byId.get(table.id);
2298
+ if (!fact || fact.kept_by_the_app === void 0) return table;
2299
+ return {
2300
+ ...table,
2301
+ kept_by_the_app: fact.kept_by_the_app,
2302
+ kept_for: fact.kept_for ?? null,
2303
+ offered_as_context: fact.offered_as_context ?? false,
2304
+ keeper_group: fact.keeper_group ?? null,
2305
+ keeper_says: fact.keeper_says ?? null,
2306
+ used_in_kind: fact.used_in_kind ?? null,
2307
+ used_in_id: fact.used_in_id ?? null,
2308
+ used_in_table_id: fact.used_in_table_id ?? null
2309
+ };
2310
+ });
2311
+ }
2312
+ function keptGroups(tables) {
2313
+ const out = [];
2314
+ const at = /* @__PURE__ */ new Map();
2315
+ for (const table of tables) {
2316
+ if (!keptOutOfSight(table)) continue;
2317
+ const group = table.keeper_group?.trim() || "Kept by the app";
2318
+ let i = at.get(group);
2319
+ if (i === void 0) {
2320
+ i = out.length;
2321
+ at.set(group, i);
2322
+ out.push({ group, tables: [] });
2323
+ }
2324
+ out[i].tables.push(table);
2325
+ }
2326
+ return out;
2327
+ }
2328
+ function keptTableHref(fact, hrefs) {
2329
+ if (fact.used_in_kind === "scope" && fact.used_in_id) return hrefs.scope(fact.used_in_id);
2330
+ if (fact.used_in_kind === "table" && (fact.used_in_table_id || fact.used_in_id)) {
2331
+ return hrefs.table(fact.used_in_table_id || fact.used_in_id);
2332
+ }
2333
+ return hrefs.table(fact.table_id);
2334
+ }
2335
+ function countOf(value) {
2336
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
2337
+ }
2338
+ function wordsOf(value) {
2339
+ return typeof value === "string" && value.length > 0 ? value : null;
2340
+ }
2341
+ function parseTableHome(raw) {
2342
+ if (!raw || typeof raw !== "object") return null;
2343
+ const row = raw;
2344
+ const table = row.table;
2345
+ const org = row.organization;
2346
+ if (!table || !org || !wordsOf(table.id) || !wordsOf(org.id) || !wordsOf(org.name)) return null;
2347
+ const carries = row.carries ?? {};
2348
+ const destinations = Array.isArray(row.destinations) ? row.destinations : [];
2349
+ return {
2350
+ table: { id: String(table.id), name: wordsOf(table.name) ?? "This table", version: countOf(table.version) },
2351
+ organization: { id: String(org.id), name: String(org.name) },
2352
+ mayMove: row.may_move === true,
2353
+ whyNot: wordsOf(row.why_not),
2354
+ heldBy: Array.isArray(row.held_by) ? row.held_by.filter((s) => typeof s === "string") : [],
2355
+ destinations: destinations.filter((d) => !!d && typeof d === "object" && !!wordsOf(d.id)).map((d) => ({
2356
+ id: String(d.id),
2357
+ name: wordsOf(d.name) ?? "An organization",
2358
+ role: wordsOf(d.role) ?? "member",
2359
+ ok: d.ok === true,
2360
+ why: wordsOf(d.why)
2361
+ })),
2362
+ carries: {
2363
+ fields: countOf(carries.fields),
2364
+ records: countOf(carries.records),
2365
+ inTrash: countOf(carries.in_trash),
2366
+ choiceLists: countOf(carries.choice_lists),
2367
+ withIt: countOf(carries.with_it),
2368
+ tablesInside: countOf(carries.tables_inside),
2369
+ linksAcross: countOf(carries.links_across)
2370
+ }
2371
+ };
2372
+ }
2373
+ function parseTableMoved(raw) {
2374
+ const row = raw ?? {};
2375
+ const to = row.to ?? {};
2376
+ const from = row.from ?? {};
2377
+ const table = row.table ?? {};
2378
+ if (row.moved !== true || !wordsOf(to.id)) return null;
2379
+ return {
2380
+ to: { id: String(to.id), name: wordsOf(to.name) ?? "the new organization" },
2381
+ from: { id: wordsOf(from.id) ?? "", name: wordsOf(from.name) ?? "its old organization" },
2382
+ tableName: wordsOf(table.name) ?? "The table"
2383
+ };
2384
+ }
2385
+ function plural(n, one, many) {
2386
+ return `${n} ${n === 1 ? one : many}`;
2387
+ }
2388
+ function moveConsequence(home, to) {
2389
+ const c = home.carries;
2390
+ const parts = [plural(c.fields, "column", "columns"), plural(c.records, "row", "rows")];
2391
+ if (c.inTrash > 0) parts.push(`${c.inTrash} in the trash`);
2392
+ const extra = c.choiceLists + c.withIt;
2393
+ return `${home.table.name} moves to ${to.name} with its ${parts.join(", ")}` + (c.tablesInside > 0 ? `, the ${plural(c.tablesInside, "table", "tables")} that live${c.tablesInside === 1 ? "s" : ""} inside it or its rows (with their own rows)` : "") + (extra > 0 ? `, and ${plural(extra, "thing", "things")} built only on it (choice lists, rules, dashboards, templates)` : "") + `, its comments, forms, saved views and history. ` + (c.linksAcross > 0 ? `${plural(c.linksAcross, "link", "links")} to rows that stay in ${home.organization.name} keep${c.linksAcross === 1 ? "s" : ""} pointing there, across the two organizations. ` : "") + `People who see it only because they are in ${home.organization.name} stop seeing it; people it was shared with by name keep it. You can move it back from the same place.`;
2394
+ }
2395
+
2286
2396
  // src/level.ts
2287
2397
  var PERMISSION_LEVELS = [
2288
2398
  "viewer",
@@ -4291,6 +4401,8 @@ var ENTITY_TOKENS = [
4291
4401
 
4292
4402
  // src/core/doors.ts
4293
4403
  var OWED_BY = {
4404
+ table_home: "SC-1' \u2014 matrx-frontend migrations/campaign/sc1p_a_table_says_where_it_lives_and_its_owner_can_move_it.sql (and its grant file), applied by the chair",
4405
+ table_move: "SC-1' / SC-1-TAILS \u2014 sc1p_a_table_says_where_it_lives_and_its_owner_can_move_it.sql, then sc1t_a_table_moves_with_the_tables_inside_it.sql, applied by the chair",
4294
4406
  metadata_search: "W5-SRV / W5-AGENT \u2014 the agent surface's eight verbs",
4295
4407
  record_aggregate: "W5-SRV / W5-AGENT \u2014 `record_aggregate` is one of the eight verbs",
4296
4408
  field_propose: "W5-AGENT \u2014 AGT-4/AGT-8, the proposal and its approvers",
@@ -4616,6 +4728,12 @@ var DOORS = {
4616
4728
  // ask, under the same wall and visibility gate as `portals` itself.
4617
4729
  portalTables: "portal_tables",
4618
4730
  tableFacts: "table_facts",
4731
+ // WHERE A TABLE LIVES, AND MOVING IT (SC-1' / SC-1-TAILS). `table_home` answers only when the
4732
+ // caller may open the Table (custom.where_id_opens) and names its organization FROM THE TABLE;
4733
+ // `table_move` moves it into another organization the caller belongs to, with every Table
4734
+ // inside it, or refuses with one sentence.
4735
+ tableHome: "table_home",
4736
+ tableMove: "table_move",
4619
4737
  portalCard: "portal_card",
4620
4738
  portalDeclare: "portal_declare",
4621
4739
  portalInvite: "portal_invite",
@@ -5259,6 +5377,40 @@ function createRecordsClient(config) {
5259
5377
  if (!doorExists(DOORS.tableFacts)) return ok(null);
5260
5378
  return callDoor(DOORS.tableFacts, { p_organization_id: org }, "tableFacts");
5261
5379
  },
5380
+ async tableHome({ table_id }) {
5381
+ const answered = await callDoor(DOORS.tableHome, { p_table_id: table_id }, "tableHome");
5382
+ if (!answered.ok) return answered;
5383
+ if (answered.data === null || answered.data === void 0) return ok(null);
5384
+ const home = parseTableHome(answered.data);
5385
+ if (!home) {
5386
+ const refusal = {
5387
+ code: "not_supported",
5388
+ message: "The record store answered where this table lives in a shape this client cannot read, so nothing is claimed about it.",
5389
+ hint: "Regenerate @ai-matrx/records against the store (pnpm records:generate) \u2014 the door and this client disagree."
5390
+ };
5391
+ scream({ code: refusal.code, message: refusal.message, ...refusal.hint ? { hint: refusal.hint } : {}, where: "tableHome" });
5392
+ return err(refusal);
5393
+ }
5394
+ return ok(home);
5395
+ },
5396
+ async tableMove({ table_id, to_organization_id, expected_version }) {
5397
+ const answered = await callDoor(
5398
+ DOORS.tableMove,
5399
+ { p_table_id: table_id, p_to_organization_id: to_organization_id, p_expected_version: expected_version ?? null },
5400
+ "tableMove"
5401
+ );
5402
+ if (!answered.ok) return answered;
5403
+ const moved = parseTableMoved(answered.data);
5404
+ if (!moved) {
5405
+ const refusal = {
5406
+ code: "not_supported",
5407
+ message: "The record store answered the move in a shape this client cannot read. Look where the table lives before trying again."
5408
+ };
5409
+ scream({ code: refusal.code, message: refusal.message, where: "tableMove" });
5410
+ return err(refusal);
5411
+ }
5412
+ return ok(moved);
5413
+ },
5262
5414
  async tableArchived({ table_id }) {
5263
5415
  const kernel = await callDoor(DOORS.tableKernelId, {}, "tableArchived.kernel");
5264
5416
  if (!kernel.ok) return err(kernel.error);
@@ -8282,56 +8434,6 @@ function emptyPortalArchiveLine() {
8282
8434
  return "No portal of this organization has been archived. A portal you put away waits here until somebody restores it, and nothing is ever destroyed.";
8283
8435
  }
8284
8436
 
8285
- // src/placement.ts
8286
- function keptOutOfSight(placement) {
8287
- return placement?.kept_by_the_app === true;
8288
- }
8289
- function offeredAsContext(placement) {
8290
- return placement?.offered_as_context === true;
8291
- }
8292
- function withTablePlacement(tables, facts) {
8293
- if (!facts) return [...tables];
8294
- const byId = new Map(facts.map((f) => [f.table_id, f]));
8295
- return tables.map((table) => {
8296
- const fact = byId.get(table.id);
8297
- if (!fact || fact.kept_by_the_app === void 0) return table;
8298
- return {
8299
- ...table,
8300
- kept_by_the_app: fact.kept_by_the_app,
8301
- kept_for: fact.kept_for ?? null,
8302
- offered_as_context: fact.offered_as_context ?? false,
8303
- keeper_group: fact.keeper_group ?? null,
8304
- keeper_says: fact.keeper_says ?? null,
8305
- used_in_kind: fact.used_in_kind ?? null,
8306
- used_in_id: fact.used_in_id ?? null,
8307
- used_in_table_id: fact.used_in_table_id ?? null
8308
- };
8309
- });
8310
- }
8311
- function keptGroups(tables) {
8312
- const out = [];
8313
- const at = /* @__PURE__ */ new Map();
8314
- for (const table of tables) {
8315
- if (!keptOutOfSight(table)) continue;
8316
- const group = table.keeper_group?.trim() || "Kept by the app";
8317
- let i = at.get(group);
8318
- if (i === void 0) {
8319
- i = out.length;
8320
- at.set(group, i);
8321
- out.push({ group, tables: [] });
8322
- }
8323
- out[i].tables.push(table);
8324
- }
8325
- return out;
8326
- }
8327
- function keptTableHref(fact, hrefs) {
8328
- if (fact.used_in_kind === "scope" && fact.used_in_id) return hrefs.scope(fact.used_in_id);
8329
- if (fact.used_in_kind === "table" && (fact.used_in_table_id || fact.used_in_id)) {
8330
- return hrefs.table(fact.used_in_table_id || fact.used_in_id);
8331
- }
8332
- return hrefs.table(fact.table_id);
8333
- }
8334
-
8335
8437
  // src/capture-queue.ts
8336
8438
  var DB_NAME = "matrx-capture";
8337
8439
  var DB_VERSION = 1;
@@ -8400,7 +8502,7 @@ function memoryStore() {
8400
8502
  setMeta: async (key, value) => void meta.set(key, value)
8401
8503
  };
8402
8504
  }
8403
- function countOf(items) {
8505
+ function countOf2(items) {
8404
8506
  const c = { waiting: 0, sending: 0, refused: 0, landed: 0 };
8405
8507
  for (const i of items) c[i.state] += 1;
8406
8508
  return c;
@@ -8417,7 +8519,7 @@ function openCaptureQueue(opts) {
8417
8519
  const announce = async () => {
8418
8520
  if (!opts.onChange) return;
8419
8521
  const items = await store.all();
8420
- opts.onChange(countOf(items), items);
8522
+ opts.onChange(countOf2(items), items);
8421
8523
  };
8422
8524
  const oldestFirst = (items) => items.slice().sort((a, b) => a.captured_at.localeCompare(b.captured_at));
8423
8525
  const queue = {
@@ -8446,7 +8548,7 @@ function openCaptureQueue(opts) {
8446
8548
  return key;
8447
8549
  },
8448
8550
  list: () => store.all().then(oldestFirst),
8449
- counts: () => store.all().then(countOf),
8551
+ counts: () => store.all().then(countOf2),
8450
8552
  async sync() {
8451
8553
  if (syncing) return syncing;
8452
8554
  syncing = (async () => {
@@ -8709,12 +8811,15 @@ export {
8709
8811
  memoryStore,
8710
8812
  mintClientKey,
8711
8813
  mintOpId,
8814
+ moveConsequence,
8712
8815
  moveInOrder,
8713
8816
  offeredAsContext,
8714
8817
  ok,
8715
8818
  openCaptureQueue,
8716
8819
  optionKey,
8717
8820
  optionLabel,
8821
+ parseTableHome,
8822
+ parseTableMoved,
8718
8823
  portalArchiveConsequence,
8719
8824
  portalConfirmLine,
8720
8825
  portalPath,