@ai-matrx/records 0.44.1 → 0.46.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.
@@ -1,7 +1,7 @@
1
- import { g as Timestamp, U as Uuid, h as RecordDocument, i as RecordsResult, j as RecordRead, k as ReadRow, l as Field, m as StoredRecord, N as NewFieldDeclaration, n as FieldPatch, o as RecordRevision, p as ReadValue, q as FieldProposal, r as TableProposal, s as RecordsError, W as WriteConflict, P as PgError, t as StaleWriteDetail, u as PredictedRefusal } from '../field-D0Rr4Cqb.cjs';
2
- export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, x as Actor, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DELIVERIES, B as Delivery, E as ENTITY_TOKENS, G as EntityToken, H as FIELD_SENSITIVITIES, I as FIELD_SOURCES, J as FRESHNESS, K as FieldBehavior, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, L as ForbiddenEnvelopeWord, M as Freshness, Q as HiddenFieldNotice, V as KERNEL_TABLES, X as KernelTableName, Y as MERGE_FIELD_MODIFIERS, Z as MERGE_FIELD_SEMANTIC_TYPES, _ as MERGE_FIELD_SOURCES, $ as MergeFieldModifier, a0 as MergeFieldSemanticType, a1 as MergeFieldSource, a2 as ON_DELETE, a3 as OVERRIDE_POLICIES, O as OnDelete, a4 as OverridePolicy, a5 as PARITY_FIELD_TYPES, a6 as PER_VALUE_ACCESS_WORDS, a7 as ParityFieldType, a8 as ParityFieldTypeDescriptor, a9 as PerValueAccessWord, aa as ProvenancePointer, ab as RELATION_BINDINGS, ac as RELATION_CARDINALITIES, ad as RELATION_FLAVORS, ae as RETIRED_ACTOR_WORDS, af as RULE_NODE_KINDS, ag as RULE_USES, ah as RecordsErrorCode, ai as RelationBinding, f as RelationCardinality, aj as RelationDisplay, R as RelationFlavor, ak as RetiredActorWord, al as RuleNodeKind, am as RuleUse, an as STORAGE_MODES, ao as STORE_DOORS, ap as STORE_KNOBS, aq as STORE_REFUSAL_CODES, S as StorageMode, ar as StoreDoorName, as as StoreRefusalCode, at as TABLE_DISPLAYS, au as TABLE_ORIGINS, av as TABLE_TYPES, a as TableDisplay, aw as TableOrigin, T as TableType, ax as VALUE_ALTERNATE_KEYS, ay as VALUE_ENVELOPE_KEYS, az as ValueAlternate, aA as ValueAlternateKey, aB as ValueEnvelope, aC as ValueEnvelopeKey, aD as ValueSource, aE as err, aF as isRecordsErr, aG as ok } from '../field-D0Rr4Cqb.cjs';
3
- import { RelationCoordinate, RecordsConfig, Table, TableCapacity, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, Pipeline, PipelineColumn, PipelineVerdict, PipelineMoveResult, PipelineSpec, PipelineDeclared, StageRuleOnFail, StageRuleEnforcement, StagePending, StagePendingOnBoard, PipelineGate, PipelineGatePreview, FormSummary, BookingSummary, BookingAvailability, BookingDeclared, ImportPlan, ImportPolicy, ImportOpened, ImportBatchResult, ImportFinished, ImportReport, ImportRun, InboundDeclared, InboundAddress, PortalSummary, PortalCard, PortalInvitation, PortalRevocation, PortalPreviewRow, DashboardSummary, DashboardBlock, AggregateFilter, DashboardRunResult, StuckRow, CaptureSheetSummary, CaptureSheetFace, CaptureFileRef, CaptureOutcome, EnrichmentSummary, EnrichDeclared, EnrichDueRow, EnrichCell, EnrichRun, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, MySubscription, SubscriptionSpec, DigestPreview, SavedViewRow, SavedViewSpecIn, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordHistoryEntry, RecordScopeContext, ConversationScope, ConversationScopeContext, FieldHistoryEntry, RestorePreview, RestoreResult, CommentThreadRead, CommentWritten, AnonTokenBinding, ChecklistSpec, ChecklistDeclared, ChecklistTemplateSummary, ChecklistTemplateShape, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistStepCompleted, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, MyLevel, RecordsDataSource } from '../index.cjs';
4
- export { AggregateOperation, AggregateWindow, BookingWindow, CaptureField, CaptureQuestion, CaptureQueue, CaptureQueueCounts, CaptureQueueOptions, CaptureQueuePorts, CaptureQueueStore, CaptureSyncReport, ChecklistRequirement, ChecklistRequirementKind, ChecklistRoleSpec, ChecklistStepSpec, ChecklistTrigger, ChecklistTriggerKind, ChoiceOption, CustomFieldTableType, DashboardBlockKind, DashboardBlockResult, DocSignatureCheck, EnrichAlternate, EnrichSource, Enrichment, EntityFieldValue, EntityRecordMatch, HistoryActor, HistoryActorKind, HistoryChange, Home, ImportColumnPlan, ImportOutcome, ImportProposal, MergeField, MergeFieldProvenance, MergeFieldResolution, MergeFieldTransform, MissingBehavior, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, PermissionLevel, PipelineMissingField, PipelineRule, PipelineRuleKind, PipelineStage, PortalPrincipal, PortalTableExposure, QueuedCapture, QueuedCaptureFile, QueuedCaptureState, QuietHours, REFUSALS_WORTH_REPEATING, RecordComment, RecordScopeComment, RecordScopeField, RecordScopeHistoryEntry, RecordScopeRelation, RecordScopeWithheld, RecordsActor, RecordsChangeSink, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationCarries, RelationProperties, RelationTarget, ResolutionTriple, Rule, RuleAnswer, RuleExpression, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, StageRuleWarning, SubscriptionBlock, SubscriptionCadence, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip } from '../index.cjs';
1
+ import { g as Timestamp, U as Uuid, h as RecordDocument, i as RecordsResult, j as RecordRead, k as ReadRow, l as Field, m as StoredRecord, N as NewFieldDeclaration, n as FieldPatch, o as RecordRevision, p as ReadValue, q as FieldProposal, r as TableProposal, s as RecordsError, W as WriteConflict, P as PgError, t as StaleWriteDetail, u as PredictedRefusal } from '../field-N0ExInZA.cjs';
2
+ export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, x as Actor, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DELIVERIES, B as Delivery, E as ENTITY_TOKENS, G as EntityToken, H as FIELD_SENSITIVITIES, I as FIELD_SOURCES, J as FRESHNESS, K as FieldBehavior, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, L as ForbiddenEnvelopeWord, M as Freshness, Q as HiddenFieldNotice, V as KERNEL_TABLES, X as KernelTableName, Y as MERGE_FIELD_MODIFIERS, Z as MERGE_FIELD_SEMANTIC_TYPES, _ as MERGE_FIELD_SOURCES, $ as MergeFieldModifier, a0 as MergeFieldSemanticType, a1 as MergeFieldSource, a2 as ON_DELETE, a3 as OVERRIDE_POLICIES, O as OnDelete, a4 as OverridePolicy, a5 as PARITY_FIELD_TYPES, a6 as PER_VALUE_ACCESS_WORDS, a7 as ParityFieldType, a8 as ParityFieldTypeDescriptor, a9 as PerValueAccessWord, aa as ProvenancePointer, ab as RELATION_BINDINGS, ac as RELATION_CARDINALITIES, ad as RELATION_FLAVORS, ae as RETIRED_ACTOR_WORDS, af as RULE_NODE_KINDS, ag as RULE_USES, ah as RecordsErrorCode, ai as RelationBinding, f as RelationCardinality, aj as RelationDisplay, R as RelationFlavor, ak as RetiredActorWord, al as RuleNodeKind, am as RuleUse, an as STORAGE_MODES, ao as STORE_DOORS, ap as STORE_KNOBS, aq as STORE_REFUSAL_CODES, S as StorageMode, ar as StoreDoorName, as as StoreRefusalCode, at as TABLE_DISPLAYS, au as TABLE_ORIGINS, av as TABLE_TYPES, a as TableDisplay, aw as TableOrigin, T as TableType, ax as VALUE_ALTERNATE_KEYS, ay as VALUE_ENVELOPE_KEYS, az as ValueAlternate, aA as ValueAlternateKey, aB as ValueEnvelope, aC as ValueEnvelopeKey, aD as ValueSource, aE as err, aF as isRecordsErr, aG as ok } from '../field-N0ExInZA.cjs';
3
+ import { RelationCoordinate, RecordsConfig, Table, TableCapacity, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, Pipeline, PipelineColumn, PipelineVerdict, PipelineMoveResult, PipelineSpec, PipelineDeclared, StageRuleOnFail, StageRuleEnforcement, StagePending, StagePendingOnBoard, PipelineGate, PipelineGatePreview, FormSummary, BookingSummary, BookingAvailability, BookingDeclared, ImportPlan, ImportPolicy, ImportOpened, ImportBatchResult, ImportFinished, ImportReport, ImportRun, InboundDeclared, InboundAddress, PortalSummary, PortalTableRef, PortalCard, PortalInvitation, PortalRevocation, PortalPreviewRow, DashboardSummary, DashboardBlock, AggregateFilter, DashboardRunResult, StuckRow, CaptureSheetSummary, CaptureSheetFace, CaptureFileRef, CaptureOutcome, EnrichmentSummary, EnrichDeclared, EnrichDueRow, EnrichCell, EnrichRun, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, MySubscription, SubscriptionSpec, DigestPreview, SavedViewRow, SavedViewSpecIn, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordHistoryEntry, RecordScopeContext, ConversationScope, ConversationScopeContext, FieldHistoryEntry, RestorePreview, RestoreResult, CommentThreadRead, CommentWritten, AnonTokenBinding, ChecklistSpec, ChecklistDeclared, ChecklistTemplateSummary, ChecklistTemplateShape, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistStepCompleted, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, MyLevel, RecordsDataSource } from '../index.cjs';
4
+ export { AggregateOperation, AggregateWindow, BookingWindow, CaptureField, CaptureQuestion, CaptureQueue, CaptureQueueCounts, CaptureQueueOptions, CaptureQueuePorts, CaptureQueueStore, CaptureSyncReport, ChecklistRequirement, ChecklistRequirementKind, ChecklistRoleSpec, ChecklistStepSpec, ChecklistTrigger, ChecklistTriggerKind, ChoiceOption, ChoiceOptions, CoerceOptions, Coerced, CoercedAnswers, CoercibleField, CustomFieldTableType, DashboardBlockKind, DashboardBlockResult, DocSignatureCheck, EnrichAlternate, EnrichSource, Enrichment, EntityFieldValue, EntityRecordMatch, FIELD_KINDS, FieldKind, HistoryActor, HistoryActorKind, HistoryChange, Home, ImportColumnPlan, ImportOutcome, ImportProposal, KernelTargets, MergeField, MergeFieldProvenance, MergeFieldResolution, MergeFieldTransform, MissingBehavior, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, PermissionLevel, PipelineMissingField, PipelineRule, PipelineRuleKind, PipelineStage, PortalPrincipal, PortalTableExposure, QueuedCapture, QueuedCaptureFile, QueuedCaptureState, QuietHours, REFUSALS_WORTH_REPEATING, RecordComment, RecordScopeComment, RecordScopeField, RecordScopeHistoryEntry, RecordScopeRelation, RecordScopeWithheld, RecordsActor, RecordsChangeSink, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationCarries, RelationProperties, RelationTarget, ResolutionTriple, Rule, RuleAnswer, RuleExpression, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, StageRuleWarning, SubscriptionBlock, SubscriptionCadence, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip } from '../index.cjs';
5
5
 
6
6
  /**
7
7
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -529,6 +529,14 @@ interface RecordsClient {
529
529
  }>>;
530
530
  /** Every portal over this organization the caller may know about, with its numbers. */
531
531
  portals(): Promise<RecordsResult<PortalSummary[]>>;
532
+ /**
533
+ * Which Tables each portal of this organization exposes.
534
+ *
535
+ * The one question a TABLE-scoped Portals rail has to ask: "is the table I
536
+ * am standing on in any portal?" Same wall and same visibility gate as
537
+ * `portals`, so a pair here is always a portal `portals` also returned.
538
+ */
539
+ portalTables(): Promise<RecordsResult<PortalTableRef[]>>;
532
540
  /** ONE portal in full: what it shows, and who it was opened to. */
533
541
  portalCard(args: {
534
542
  portal_id: Uuid;
@@ -1440,6 +1448,7 @@ declare const DOORS: {
1440
1448
  readonly inboundAddresses: "inbound_addresses";
1441
1449
  readonly inboundSet: "inbound_set";
1442
1450
  readonly portals: "portals";
1451
+ readonly portalTables: "portal_tables";
1443
1452
  readonly portalCard: "portal_card";
1444
1453
  readonly portalDeclare: "portal_declare";
1445
1454
  readonly portalInvite: "portal_invite";
@@ -1675,4 +1684,4 @@ declare function parseCsv(text: string): string[][];
1675
1684
  declare function importCsv(text: string): ParsedImport;
1676
1685
  declare function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
1677
1686
 
1678
- export { AggregateBucket, AggregateFilter, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, BookingAvailability, BookingDeclared, BookingSummary, CaptureFileRef, CaptureOutcome, CaptureSheetFace, CaptureSheetSummary, ChecklistDeclared, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistSpec, ChecklistStepCompleted, ChecklistTemplateShape, ChecklistTemplateSummary, CommentThreadRead, CommentWritten, ConversationScope, ConversationScopeContext, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DashboardBlock, DashboardRunResult, DashboardSummary, DigestPreview, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, EnrichCell, EnrichDeclared, EnrichDueRow, EnrichRun, EnrichmentSummary, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldHistoryEntry, FieldPatch, FieldProposal, FormSummary, ImportBatchResult, ImportFinished, ImportOpened, ImportPlan, ImportPolicy, ImportReport, ImportRun, InboundAddress, InboundDeclared, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, MySubscription, NewEntityFieldDeclaration, NewFieldDeclaration, type ParsedImport, PgError, Pipeline, PipelineColumn, PipelineDeclared, PipelineGate, PipelineGatePreview, PipelineMoveResult, PipelineSpec, PipelineVerdict, PortalCard, PortalInvitation, PortalPreviewRow, PortalRevocation, PortalSummary, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, RecordHistoryEntry, type RecordQuery, RecordRead, RecordRevision, RecordScopeContext, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, RestorePreview, RestoreResult, SavedViewRow, SavedViewSpecIn, StagePending, StagePendingOnBoard, StageRuleEnforcement, StageRuleOnFail, StaleWriteDetail, StoredRecord, StuckRow, Subscription, SubscriptionSpec, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
1687
+ export { AggregateBucket, AggregateFilter, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, BookingAvailability, BookingDeclared, BookingSummary, CaptureFileRef, CaptureOutcome, CaptureSheetFace, CaptureSheetSummary, ChecklistDeclared, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistSpec, ChecklistStepCompleted, ChecklistTemplateShape, ChecklistTemplateSummary, CommentThreadRead, CommentWritten, ConversationScope, ConversationScopeContext, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DashboardBlock, DashboardRunResult, DashboardSummary, DigestPreview, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, EnrichCell, EnrichDeclared, EnrichDueRow, EnrichRun, EnrichmentSummary, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldHistoryEntry, FieldPatch, FieldProposal, FormSummary, ImportBatchResult, ImportFinished, ImportOpened, ImportPlan, ImportPolicy, ImportReport, ImportRun, InboundAddress, InboundDeclared, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, MySubscription, NewEntityFieldDeclaration, NewFieldDeclaration, type ParsedImport, PgError, Pipeline, PipelineColumn, PipelineDeclared, PipelineGate, PipelineGatePreview, PipelineMoveResult, PipelineSpec, PipelineVerdict, PortalCard, PortalInvitation, PortalPreviewRow, PortalRevocation, PortalSummary, PortalTableRef, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, RecordHistoryEntry, type RecordQuery, RecordRead, RecordRevision, RecordScopeContext, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, RestorePreview, RestoreResult, SavedViewRow, SavedViewSpecIn, StagePending, StagePendingOnBoard, StageRuleEnforcement, StageRuleOnFail, StaleWriteDetail, StoredRecord, StuckRow, Subscription, SubscriptionSpec, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
@@ -1,7 +1,7 @@
1
- import { g as Timestamp, U as Uuid, h as RecordDocument, i as RecordsResult, j as RecordRead, k as ReadRow, l as Field, m as StoredRecord, N as NewFieldDeclaration, n as FieldPatch, o as RecordRevision, p as ReadValue, q as FieldProposal, r as TableProposal, s as RecordsError, W as WriteConflict, P as PgError, t as StaleWriteDetail, u as PredictedRefusal } from '../field-D0Rr4Cqb.js';
2
- export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, x as Actor, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DELIVERIES, B as Delivery, E as ENTITY_TOKENS, G as EntityToken, H as FIELD_SENSITIVITIES, I as FIELD_SOURCES, J as FRESHNESS, K as FieldBehavior, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, L as ForbiddenEnvelopeWord, M as Freshness, Q as HiddenFieldNotice, V as KERNEL_TABLES, X as KernelTableName, Y as MERGE_FIELD_MODIFIERS, Z as MERGE_FIELD_SEMANTIC_TYPES, _ as MERGE_FIELD_SOURCES, $ as MergeFieldModifier, a0 as MergeFieldSemanticType, a1 as MergeFieldSource, a2 as ON_DELETE, a3 as OVERRIDE_POLICIES, O as OnDelete, a4 as OverridePolicy, a5 as PARITY_FIELD_TYPES, a6 as PER_VALUE_ACCESS_WORDS, a7 as ParityFieldType, a8 as ParityFieldTypeDescriptor, a9 as PerValueAccessWord, aa as ProvenancePointer, ab as RELATION_BINDINGS, ac as RELATION_CARDINALITIES, ad as RELATION_FLAVORS, ae as RETIRED_ACTOR_WORDS, af as RULE_NODE_KINDS, ag as RULE_USES, ah as RecordsErrorCode, ai as RelationBinding, f as RelationCardinality, aj as RelationDisplay, R as RelationFlavor, ak as RetiredActorWord, al as RuleNodeKind, am as RuleUse, an as STORAGE_MODES, ao as STORE_DOORS, ap as STORE_KNOBS, aq as STORE_REFUSAL_CODES, S as StorageMode, ar as StoreDoorName, as as StoreRefusalCode, at as TABLE_DISPLAYS, au as TABLE_ORIGINS, av as TABLE_TYPES, a as TableDisplay, aw as TableOrigin, T as TableType, ax as VALUE_ALTERNATE_KEYS, ay as VALUE_ENVELOPE_KEYS, az as ValueAlternate, aA as ValueAlternateKey, aB as ValueEnvelope, aC as ValueEnvelopeKey, aD as ValueSource, aE as err, aF as isRecordsErr, aG as ok } from '../field-D0Rr4Cqb.js';
3
- import { RelationCoordinate, RecordsConfig, Table, TableCapacity, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, Pipeline, PipelineColumn, PipelineVerdict, PipelineMoveResult, PipelineSpec, PipelineDeclared, StageRuleOnFail, StageRuleEnforcement, StagePending, StagePendingOnBoard, PipelineGate, PipelineGatePreview, FormSummary, BookingSummary, BookingAvailability, BookingDeclared, ImportPlan, ImportPolicy, ImportOpened, ImportBatchResult, ImportFinished, ImportReport, ImportRun, InboundDeclared, InboundAddress, PortalSummary, PortalCard, PortalInvitation, PortalRevocation, PortalPreviewRow, DashboardSummary, DashboardBlock, AggregateFilter, DashboardRunResult, StuckRow, CaptureSheetSummary, CaptureSheetFace, CaptureFileRef, CaptureOutcome, EnrichmentSummary, EnrichDeclared, EnrichDueRow, EnrichCell, EnrichRun, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, MySubscription, SubscriptionSpec, DigestPreview, SavedViewRow, SavedViewSpecIn, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordHistoryEntry, RecordScopeContext, ConversationScope, ConversationScopeContext, FieldHistoryEntry, RestorePreview, RestoreResult, CommentThreadRead, CommentWritten, AnonTokenBinding, ChecklistSpec, ChecklistDeclared, ChecklistTemplateSummary, ChecklistTemplateShape, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistStepCompleted, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, MyLevel, RecordsDataSource } from '../index.js';
4
- export { AggregateOperation, AggregateWindow, BookingWindow, CaptureField, CaptureQuestion, CaptureQueue, CaptureQueueCounts, CaptureQueueOptions, CaptureQueuePorts, CaptureQueueStore, CaptureSyncReport, ChecklistRequirement, ChecklistRequirementKind, ChecklistRoleSpec, ChecklistStepSpec, ChecklistTrigger, ChecklistTriggerKind, ChoiceOption, CustomFieldTableType, DashboardBlockKind, DashboardBlockResult, DocSignatureCheck, EnrichAlternate, EnrichSource, Enrichment, EntityFieldValue, EntityRecordMatch, HistoryActor, HistoryActorKind, HistoryChange, Home, ImportColumnPlan, ImportOutcome, ImportProposal, MergeField, MergeFieldProvenance, MergeFieldResolution, MergeFieldTransform, MissingBehavior, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, PermissionLevel, PipelineMissingField, PipelineRule, PipelineRuleKind, PipelineStage, PortalPrincipal, PortalTableExposure, QueuedCapture, QueuedCaptureFile, QueuedCaptureState, QuietHours, REFUSALS_WORTH_REPEATING, RecordComment, RecordScopeComment, RecordScopeField, RecordScopeHistoryEntry, RecordScopeRelation, RecordScopeWithheld, RecordsActor, RecordsChangeSink, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationCarries, RelationProperties, RelationTarget, ResolutionTriple, Rule, RuleAnswer, RuleExpression, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, StageRuleWarning, SubscriptionBlock, SubscriptionCadence, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip } from '../index.js';
1
+ import { g as Timestamp, U as Uuid, h as RecordDocument, i as RecordsResult, j as RecordRead, k as ReadRow, l as Field, m as StoredRecord, N as NewFieldDeclaration, n as FieldPatch, o as RecordRevision, p as ReadValue, q as FieldProposal, r as TableProposal, s as RecordsError, W as WriteConflict, P as PgError, t as StaleWriteDetail, u as PredictedRefusal } from '../field-N0ExInZA.js';
2
+ export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, x as Actor, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DELIVERIES, B as Delivery, E as ENTITY_TOKENS, G as EntityToken, H as FIELD_SENSITIVITIES, I as FIELD_SOURCES, J as FRESHNESS, K as FieldBehavior, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, L as ForbiddenEnvelopeWord, M as Freshness, Q as HiddenFieldNotice, V as KERNEL_TABLES, X as KernelTableName, Y as MERGE_FIELD_MODIFIERS, Z as MERGE_FIELD_SEMANTIC_TYPES, _ as MERGE_FIELD_SOURCES, $ as MergeFieldModifier, a0 as MergeFieldSemanticType, a1 as MergeFieldSource, a2 as ON_DELETE, a3 as OVERRIDE_POLICIES, O as OnDelete, a4 as OverridePolicy, a5 as PARITY_FIELD_TYPES, a6 as PER_VALUE_ACCESS_WORDS, a7 as ParityFieldType, a8 as ParityFieldTypeDescriptor, a9 as PerValueAccessWord, aa as ProvenancePointer, ab as RELATION_BINDINGS, ac as RELATION_CARDINALITIES, ad as RELATION_FLAVORS, ae as RETIRED_ACTOR_WORDS, af as RULE_NODE_KINDS, ag as RULE_USES, ah as RecordsErrorCode, ai as RelationBinding, f as RelationCardinality, aj as RelationDisplay, R as RelationFlavor, ak as RetiredActorWord, al as RuleNodeKind, am as RuleUse, an as STORAGE_MODES, ao as STORE_DOORS, ap as STORE_KNOBS, aq as STORE_REFUSAL_CODES, S as StorageMode, ar as StoreDoorName, as as StoreRefusalCode, at as TABLE_DISPLAYS, au as TABLE_ORIGINS, av as TABLE_TYPES, a as TableDisplay, aw as TableOrigin, T as TableType, ax as VALUE_ALTERNATE_KEYS, ay as VALUE_ENVELOPE_KEYS, az as ValueAlternate, aA as ValueAlternateKey, aB as ValueEnvelope, aC as ValueEnvelopeKey, aD as ValueSource, aE as err, aF as isRecordsErr, aG as ok } from '../field-N0ExInZA.js';
3
+ import { RelationCoordinate, RecordsConfig, Table, TableCapacity, EntityTableFacts, NewEntityFieldDeclaration, EntityFieldRights, EntityRecordRead, EntityRecordsFound, Pipeline, PipelineColumn, PipelineVerdict, PipelineMoveResult, PipelineSpec, PipelineDeclared, StageRuleOnFail, StageRuleEnforcement, StagePending, StagePendingOnBoard, PipelineGate, PipelineGatePreview, FormSummary, BookingSummary, BookingAvailability, BookingDeclared, ImportPlan, ImportPolicy, ImportOpened, ImportBatchResult, ImportFinished, ImportReport, ImportRun, InboundDeclared, InboundAddress, PortalSummary, PortalTableRef, PortalCard, PortalInvitation, PortalRevocation, PortalPreviewRow, DashboardSummary, DashboardBlock, AggregateFilter, DashboardRunResult, StuckRow, CaptureSheetSummary, CaptureSheetFace, CaptureFileRef, CaptureOutcome, EnrichmentSummary, EnrichDeclared, EnrichDueRow, EnrichCell, EnrichRun, AggregateMeasure, AggregateBucket, AggregateRow, Subscription, MySubscription, SubscriptionSpec, DigestPreview, SavedViewRow, SavedViewSpecIn, DocToken, DocUnresolvedToken, DocTemplateRow, DocRenderRow, DocSignatureRow, RecordHistoryEntry, RecordScopeContext, ConversationScope, ConversationScopeContext, FieldHistoryEntry, RestorePreview, RestoreResult, CommentThreadRead, CommentWritten, AnonTokenBinding, ChecklistSpec, ChecklistDeclared, ChecklistTemplateSummary, ChecklistTemplateShape, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistStepCompleted, WorkState, WorkGraph, WorkInstantiation, WorkTurn, WorkAssignmentField, WorkSlotHold, WorkInboxItem, WorkListFlavour, WorkListItem, WorkAssignment, WorkRecordState, WorkApprover, WorkChange, WorkApprovalFiled, WorkApprovalDecision, ExternalPrincipalCard, PublishBinding, ResolvedPublishBinding, MyLevel, RecordsDataSource } from '../index.js';
4
+ export { AggregateOperation, AggregateWindow, BookingWindow, CaptureField, CaptureQuestion, CaptureQueue, CaptureQueueCounts, CaptureQueueOptions, CaptureQueuePorts, CaptureQueueStore, CaptureSyncReport, ChecklistRequirement, ChecklistRequirementKind, ChecklistRoleSpec, ChecklistStepSpec, ChecklistTrigger, ChecklistTriggerKind, ChoiceOption, ChoiceOptions, CoerceOptions, Coerced, CoercedAnswers, CoercibleField, CustomFieldTableType, DashboardBlockKind, DashboardBlockResult, DocSignatureCheck, EnrichAlternate, EnrichSource, Enrichment, EntityFieldValue, EntityRecordMatch, FIELD_KINDS, FieldKind, HistoryActor, HistoryActorKind, HistoryChange, Home, ImportColumnPlan, ImportOutcome, ImportProposal, KernelTargets, MergeField, MergeFieldProvenance, MergeFieldResolution, MergeFieldTransform, MissingBehavior, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, PermissionLevel, PipelineMissingField, PipelineRule, PipelineRuleKind, PipelineStage, PortalPrincipal, PortalTableExposure, QueuedCapture, QueuedCaptureFile, QueuedCaptureState, QuietHours, REFUSALS_WORTH_REPEATING, RecordComment, RecordScopeComment, RecordScopeField, RecordScopeHistoryEntry, RecordScopeRelation, RecordScopeWithheld, RecordsActor, RecordsChangeSink, RecordsErrorSink, RecordsFilter, RecordsRealtimePort, RecordsResolverPort, RecordsResponse, RecordsTableQuery, RegisteredTable, Relation, RelationCarries, RelationProperties, RelationTarget, ResolutionTriple, Rule, RuleAnswer, RuleExpression, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, StageRuleWarning, SubscriptionBlock, SubscriptionCadence, WorkDueState, WorkInboxKind, WorkOrigin, WorkTemplateNode, WorkTemplateRelation, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip } from '../index.js';
5
5
 
6
6
  /**
7
7
  * DOOR-8. As-of on EITHER clock, and they are different questions:
@@ -529,6 +529,14 @@ interface RecordsClient {
529
529
  }>>;
530
530
  /** Every portal over this organization the caller may know about, with its numbers. */
531
531
  portals(): Promise<RecordsResult<PortalSummary[]>>;
532
+ /**
533
+ * Which Tables each portal of this organization exposes.
534
+ *
535
+ * The one question a TABLE-scoped Portals rail has to ask: "is the table I
536
+ * am standing on in any portal?" Same wall and same visibility gate as
537
+ * `portals`, so a pair here is always a portal `portals` also returned.
538
+ */
539
+ portalTables(): Promise<RecordsResult<PortalTableRef[]>>;
532
540
  /** ONE portal in full: what it shows, and who it was opened to. */
533
541
  portalCard(args: {
534
542
  portal_id: Uuid;
@@ -1440,6 +1448,7 @@ declare const DOORS: {
1440
1448
  readonly inboundAddresses: "inbound_addresses";
1441
1449
  readonly inboundSet: "inbound_set";
1442
1450
  readonly portals: "portals";
1451
+ readonly portalTables: "portal_tables";
1443
1452
  readonly portalCard: "portal_card";
1444
1453
  readonly portalDeclare: "portal_declare";
1445
1454
  readonly portalInvite: "portal_invite";
@@ -1675,4 +1684,4 @@ declare function parseCsv(text: string): string[][];
1675
1684
  declare function importCsv(text: string): ParsedImport;
1676
1685
  declare function importXlsx(bytes: ArrayBuffer | Uint8Array): Promise<ParsedImport>;
1677
1686
 
1678
- export { AggregateBucket, AggregateFilter, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, BookingAvailability, BookingDeclared, BookingSummary, CaptureFileRef, CaptureOutcome, CaptureSheetFace, CaptureSheetSummary, ChecklistDeclared, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistSpec, ChecklistStepCompleted, ChecklistTemplateShape, ChecklistTemplateSummary, CommentThreadRead, CommentWritten, ConversationScope, ConversationScopeContext, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DashboardBlock, DashboardRunResult, DashboardSummary, DigestPreview, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, EnrichCell, EnrichDeclared, EnrichDueRow, EnrichRun, EnrichmentSummary, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldHistoryEntry, FieldPatch, FieldProposal, FormSummary, ImportBatchResult, ImportFinished, ImportOpened, ImportPlan, ImportPolicy, ImportReport, ImportRun, InboundAddress, InboundDeclared, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, MySubscription, NewEntityFieldDeclaration, NewFieldDeclaration, type ParsedImport, PgError, Pipeline, PipelineColumn, PipelineDeclared, PipelineGate, PipelineGatePreview, PipelineMoveResult, PipelineSpec, PipelineVerdict, PortalCard, PortalInvitation, PortalPreviewRow, PortalRevocation, PortalSummary, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, RecordHistoryEntry, type RecordQuery, RecordRead, RecordRevision, RecordScopeContext, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, RestorePreview, RestoreResult, SavedViewRow, SavedViewSpecIn, StagePending, StagePendingOnBoard, StageRuleEnforcement, StageRuleOnFail, StaleWriteDetail, StoredRecord, StuckRow, Subscription, SubscriptionSpec, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
1687
+ export { AggregateBucket, AggregateFilter, AggregateMeasure, AggregateRow, AnonTokenBinding, type AsOf, BookingAvailability, BookingDeclared, BookingSummary, CaptureFileRef, CaptureOutcome, CaptureSheetFace, CaptureSheetSummary, ChecklistDeclared, ChecklistRunStarted, ChecklistRunStep, ChecklistRunSummary, ChecklistSpec, ChecklistStepCompleted, ChecklistTemplateShape, ChecklistTemplateSummary, CommentThreadRead, CommentWritten, ConversationScope, ConversationScopeContext, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_PAGE_SIZE, DEFAULT_VALUE_MAX_BYTES, DOORS, DashboardBlock, DashboardRunResult, DashboardSummary, DigestPreview, DocRenderRow, DocSignatureRow, DocTemplateRow, DocToken, DocUnresolvedToken, type DoorKey, EnrichCell, EnrichDeclared, EnrichDueRow, EnrichRun, EnrichmentSummary, EntityFieldRights, EntityRecordRead, EntityRecordsFound, EntityTableFacts, type ExportRow, ExternalPrincipalCard, Field, FieldHistoryEntry, FieldPatch, FieldProposal, FormSummary, ImportBatchResult, ImportFinished, ImportOpened, ImportPlan, ImportPolicy, ImportReport, ImportRun, InboundAddress, InboundDeclared, MAPPED_SQLSTATES, type MirrorLimits, MyLevel, MySubscription, NewEntityFieldDeclaration, NewFieldDeclaration, type ParsedImport, PgError, Pipeline, PipelineColumn, PipelineDeclared, PipelineGate, PipelineGatePreview, PipelineMoveResult, PipelineSpec, PipelineVerdict, PortalCard, PortalInvitation, PortalPreviewRow, PortalRevocation, PortalSummary, PortalTableRef, PredictedRefusal, type PromotedPredicate, PublishBinding, type QueryPlan, ReadRow, ReadValue, RecordDocument, RecordHistoryEntry, type RecordQuery, RecordRead, RecordRevision, RecordScopeContext, type RecordsClient, RecordsConfig, RecordsDataSource, RecordsError, RecordsResult, RelationCoordinate, ResolvedPublishBinding, RestorePreview, RestoreResult, SavedViewRow, SavedViewSpecIn, StagePending, StagePendingOnBoard, StageRuleEnforcement, StageRuleOnFail, StaleWriteDetail, StoredRecord, StuckRow, Subscription, SubscriptionSpec, type SupabaseLike, Table, TableCapacity, TableProposal, Timestamp, Uuid, WorkApprovalDecision, WorkApprovalFiled, WorkApprover, WorkAssignment, WorkAssignmentField, WorkChange, WorkGraph, WorkInboxItem, WorkInstantiation, WorkListFlavour, WorkListItem, WorkRecordState, WorkSlotHold, WorkState, WorkTurn, WriteConflict, asWriteConflict, cellText, createRecordsClient, doorAbsent, doorCensus, doorExists, exportCsv, exportXlsx, importCsv, importXlsx, intersectIds, mapPgError, parseCsv, planQuery, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, staleWriteDetail, supabaseDataSource, toAoa };
@@ -124,6 +124,209 @@ function looksLikeAnId(value) {
124
124
  return typeof value === "string" && UUID.test(value);
125
125
  }
126
126
 
127
+ // src/coerce.ts
128
+ var FIELD_KINDS = [
129
+ "attachment",
130
+ "checkbox",
131
+ "currency",
132
+ "datetime",
133
+ "email",
134
+ "formula",
135
+ "json",
136
+ "long_text",
137
+ "lookup",
138
+ "member",
139
+ "multi_select",
140
+ "number",
141
+ "percent",
142
+ "phone",
143
+ "relation",
144
+ "rollup",
145
+ "select",
146
+ "text",
147
+ "url"
148
+ ];
149
+ function fieldKindFor(field, kernel) {
150
+ const format = (field.format ?? "").toLowerCase();
151
+ const config = field.config ?? {};
152
+ switch (field.type) {
153
+ case "boolean":
154
+ return "checkbox";
155
+ case "text":
156
+ if (format === "email") return "email";
157
+ if (format === "phone") return "phone";
158
+ if (format === "url") return "url";
159
+ if (format === "json" || config["json"] === true) return "json";
160
+ if (format === "long" || config["multiline"] === true) return "long_text";
161
+ return "text";
162
+ case "range": {
163
+ const kind = String(config["kind"] ?? "number");
164
+ if (kind === "date" || kind === "datetime") return "datetime";
165
+ if (format === "currency") return "currency";
166
+ if (format === "percent" || field.unit === "%") return "percent";
167
+ return "number";
168
+ }
169
+ case "list":
170
+ return field.multi ? "multi_select" : "select";
171
+ case "relation": {
172
+ const parity = String(config["parity"] ?? "");
173
+ if (parity === "attachment" || parity === "member") return parity;
174
+ if (kernel?.file && field.relation_target === kernel.file) return "attachment";
175
+ if (kernel?.person && field.relation_target === kernel.person) return "member";
176
+ return "relation";
177
+ }
178
+ case "formula": {
179
+ const via = config["via"];
180
+ if (via && config["agg"]) return "rollup";
181
+ if (via) return "lookup";
182
+ return "formula";
183
+ }
184
+ default:
185
+ return "text";
186
+ }
187
+ }
188
+ var TRUE_WORDS = /* @__PURE__ */ new Set(["true", "yes", "y", "1", "\u2713", "x", "checked", "on"]);
189
+ var FALSE_WORDS = /* @__PURE__ */ new Set(["false", "no", "n", "0", "", "unchecked", "off"]);
190
+ function coercionLabel(field) {
191
+ const label = (field.label ?? "").trim();
192
+ if (label !== "") return label;
193
+ const name = (field.name ?? "").trim();
194
+ if (name !== "") return name;
195
+ return field.key.replace(/[_-]+/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()).trim();
196
+ }
197
+ function coerceTypedAnswer(field, raw, opts = {}) {
198
+ const label = opts.label ?? coercionLabel(field);
199
+ const text = raw.trim();
200
+ const kind = fieldKindFor(field, opts.kernel);
201
+ if (text === "" && kind !== "checkbox") return { value: null };
202
+ switch (kind) {
203
+ case "checkbox": {
204
+ const word = text.toLowerCase();
205
+ if (TRUE_WORDS.has(word)) return { value: true };
206
+ if (FALSE_WORDS.has(word)) return { value: word === "" ? null : false };
207
+ return {
208
+ refusal: `${label} is a tick box, so it takes yes or no \u2014 \u201C${raw}\u201D is neither. Write TRUE/FALSE, yes/no or 1/0.`
209
+ };
210
+ }
211
+ case "number":
212
+ case "currency":
213
+ case "percent": {
214
+ const negative = /^\(.*\)$/.test(text);
215
+ const bare = text.replace(/^\(|\)$/g, "").replace(/[\s,]/g, "").replace(/^[^\d.\-+]+/, "").replace(/[^\d.\-+eE]+$/, "");
216
+ const n = Number(bare);
217
+ if (bare === "" || Number.isNaN(n)) {
218
+ return {
219
+ refusal: `${label} holds a number, and \u201C${raw}\u201D is not one. Write digits \u2014 a currency symbol, a percent sign, commas and brackets for a negative are all fine.`
220
+ };
221
+ }
222
+ return { value: negative ? -n : n };
223
+ }
224
+ case "datetime": {
225
+ const wantsTime = String(field.config?.["kind"] ?? "date") === "datetime";
226
+ const plainDay = /^\s*(\d{4})-(\d{2})-(\d{2})\s*$/.exec(raw);
227
+ if (!wantsTime && plainDay) return { value: `${plainDay[1]}-${plainDay[2]}-${plainDay[3]}` };
228
+ const at = Date.parse(text);
229
+ if (Number.isNaN(at)) {
230
+ return {
231
+ refusal: `${label} holds a date, and \u201C${raw}\u201D is not one this can read. Write it as 2026-09-21, or the way your spreadsheet writes dates.`
232
+ };
233
+ }
234
+ const parsed = new Date(at);
235
+ if (wantsTime) return { value: parsed.toISOString() };
236
+ const y = parsed.getFullYear();
237
+ const m = String(parsed.getMonth() + 1).padStart(2, "0");
238
+ const d = String(parsed.getDate()).padStart(2, "0");
239
+ return { value: `${y}-${m}-${d}` };
240
+ }
241
+ case "json": {
242
+ try {
243
+ return { value: JSON.parse(text) };
244
+ } catch {
245
+ return {
246
+ refusal: `${label} holds a document, and \u201C${raw}\u201D is not valid JSON. Write the whole object, braces and all.`
247
+ };
248
+ }
249
+ }
250
+ case "select":
251
+ case "multi_select": {
252
+ if (!opts.options) {
253
+ return {
254
+ refusal: `${label} is a list and its options have not been read yet, so nothing can be matched to \u201C${raw}\u201D. Try again once the column's choices have loaded.`
255
+ };
256
+ }
257
+ const wanted = kind === "multi_select" ? text.split(/[,;]/).map((w) => w.trim()).filter((w) => w.length > 0) : [text];
258
+ if (wanted.length === 0) return { value: kind === "multi_select" ? [] : null };
259
+ const matched = [];
260
+ const unmatched = [];
261
+ for (const word of wanted) {
262
+ const hit = opts.options.byWord.get(word.toLowerCase());
263
+ if (hit === void 0) unmatched.push(word);
264
+ else matched.push(hit);
265
+ }
266
+ if (unmatched.length > 0) {
267
+ const offered = opts.options.labels.length > 0 ? opts.options.labels.join(", ") : "it has none yet";
268
+ return {
269
+ refusal: `${label} does not have ${unmatched.map((w) => `\u201C${w}\u201D`).join(" or ")} among its options. It offers: ${offered}.`,
270
+ unmatched
271
+ };
272
+ }
273
+ return { value: kind === "multi_select" ? matched : matched[0] };
274
+ }
275
+ // AN IDENTITY IS NOT A WORD. Writing the word would put a string where an
276
+ // id belongs, and every filter, colour and rollup built on that column
277
+ // would stop agreeing with it. So it is refused and the person is told
278
+ // which control does hold it.
279
+ case "member":
280
+ return {
281
+ refusal: `${label} names a person in this organization, so it is chosen rather than typed. Open it and pick them.`
282
+ };
283
+ case "attachment":
284
+ return {
285
+ refusal: `${label} holds a file, which cannot arrive as typed-in text. Open it and attach the file.`
286
+ };
287
+ case "relation":
288
+ return {
289
+ refusal: `${label} points at another record, so it is chosen rather than typed. Open it and pick the record.`
290
+ };
291
+ case "formula":
292
+ case "lookup":
293
+ case "rollup":
294
+ return {
295
+ refusal: `${label} is worked out by the system, so nothing can be written into it.`
296
+ };
297
+ default:
298
+ return { value: raw };
299
+ }
300
+ }
301
+ function coerceTypedAnswers(fields, answers, opts = {}) {
302
+ const byKey = new Map(fields.map((f) => [f.key, f]));
303
+ const values = {};
304
+ const refusals = {};
305
+ const unknownKeys = [];
306
+ for (const [key, given] of Object.entries(answers)) {
307
+ const field = byKey.get(key);
308
+ if (!field) {
309
+ unknownKeys.push(key);
310
+ values[key] = given;
311
+ continue;
312
+ }
313
+ if (typeof given !== "string") {
314
+ values[key] = given;
315
+ continue;
316
+ }
317
+ const opt = {};
318
+ const choices = opts.options?.get(key);
319
+ if (choices) opt.options = choices;
320
+ if (opts.kernel) opt.kernel = opts.kernel;
321
+ const label = opts.labels?.[key];
322
+ if (label) opt.label = label;
323
+ const answered = coerceTypedAnswer(field, given, opt);
324
+ if ("refusal" in answered) refusals[key] = answered.refusal;
325
+ else values[key] = answered.value;
326
+ }
327
+ return { values, refusals, unknownKeys };
328
+ }
329
+
127
330
  // src/pipeline.ts
128
331
  var PIPELINE_RULE_KINDS = ["moves", "requires", "who", "limit", "entry"];
129
332
  var STAGE_RULE_ON_FAIL = ["refuse", "require_approval"];
@@ -853,6 +1056,9 @@ var STORE_DOORS = [
853
1056
  { name: "parity_values", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, parity_type text, behavior text, unit text, format text, value jsonb, value_version integer, actor text, written_at timestamp with time zone)", security: "invoker" },
854
1057
  { name: "per_value_access_words", args: "", returns: "text[]", security: "invoker" },
855
1058
  { name: "person_kernel_id", args: "", returns: "uuid", security: "invoker" },
1059
+ { name: "phone_canonical", args: "p_text text", returns: "text", security: "invoker" },
1060
+ { name: "phone_display", args: "p_text text", returns: "text", security: "invoker" },
1061
+ { name: "phone_pattern", args: "", returns: "text", security: "invoker" },
856
1062
  { name: "pin_agent_cells", args: "p_new jsonb, p_old jsonb, p_agent_keys text[]", returns: "jsonb", security: "invoker" },
857
1063
  { name: "pipeline_board", args: "p_organization_id uuid, p_table_id uuid, p_measure text DEFAULT NULL::text", returns: "TABLE(stage_key text, stage_label text, stage_position integer, cards bigint, total numeric, wip_limit integer, over_limit boolean)", security: "definer" },
858
1064
  { name: "pipeline_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
@@ -874,6 +1080,7 @@ var STORE_DOORS = [
874
1080
  { name: "portal_record_title", args: "p_organization_id uuid, p_record_id uuid", returns: "text", security: "definer" },
875
1081
  { name: "portal_revoke", args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid", returns: "jsonb", security: "definer" },
876
1082
  { name: "portal_slug", args: "p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid", returns: "text", security: "definer" },
1083
+ { name: "portal_tables", args: "p_organization_id uuid", returns: "TABLE(portal_id uuid, table_id uuid, name text)", security: "definer" },
877
1084
  { name: "portals", args: "p_organization_id uuid", returns: "TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)", security: "definer" },
878
1085
  { name: "presentation_kernel_id", args: "", returns: "uuid", security: "invoker" },
879
1086
  { name: "promote_field", args: "p_organization_id uuid, p_table_id uuid, p_field_id uuid", returns: "jsonb", security: "invoker" },
@@ -1152,7 +1359,7 @@ var STORE_REFUSAL_CODES = [
1152
1359
  { code: "22004", raised_by: "_entity_custom_fields_guard,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
1153
1360
  { code: "22007", raised_by: "dashboard_window_sql" },
1154
1361
  { code: "22012", raised_by: "rule_eval" },
1155
- { code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
1362
+ { code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,field_update,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
1156
1363
  { code: "23503", raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate" },
1157
1364
  { code: "23505", raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,share_grant,sign_request_cancel,sign_request_create,table_share_outside_invite,table_share_outside_resend,work_approval_decide,work_slot_hold" },
1158
1365
  { code: "23514", raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
@@ -2052,6 +2259,7 @@ var ENTITY_TOKENS = [
2052
2259
  "template_context_items",
2053
2260
  "template_scope_types",
2054
2261
  "templates",
2262
+ "test_handset_inbox",
2055
2263
  "thread",
2056
2264
  "tool",
2057
2265
  "tool_binding",
@@ -2421,6 +2629,14 @@ var DOORS = {
2421
2629
  // pair (`custom.portal_public`, `custom.portal_invitation`, `custom.portal_me`)
2422
2630
  // is deliberately absent here: those belong to the outsider's own shell.
2423
2631
  portals: "portals",
2632
+ // WHICH TABLES EACH PORTAL SHOWS (TAILS-3). The Portals RAIL lives on a
2633
+ // Table's page beside Forms, Bookings and Dashboards, all of which are
2634
+ // table-scoped; `custom.portals` takes no table, so an organization with one
2635
+ // portal over Jobs saw that portal's cards on its Parts table, the empty
2636
+ // state never rendered, and the whole build/ask offer was unreachable
2637
+ // everywhere in that organization. This is the one question the rail has to
2638
+ // ask, under the same wall and visibility gate as `portals` itself.
2639
+ portalTables: "portal_tables",
2424
2640
  portalCard: "portal_card",
2425
2641
  portalDeclare: "portal_declare",
2426
2642
  portalInvite: "portal_invite",
@@ -3486,6 +3702,9 @@ function createRecordsClient(config) {
3486
3702
  async portals() {
3487
3703
  return callDoor(DOORS.portals, { p_organization_id: org }, "portals");
3488
3704
  },
3705
+ async portalTables() {
3706
+ return callDoor(DOORS.portalTables, { p_organization_id: org }, "portalTables");
3707
+ },
3489
3708
  async portalCard({ portal_id }) {
3490
3709
  return callDoor(
3491
3710
  DOORS.portalCard,
@@ -5082,6 +5301,7 @@ export {
5082
5301
  DELIVERIES,
5083
5302
  DOORS,
5084
5303
  ENTITY_TOKENS,
5304
+ FIELD_KINDS,
5085
5305
  FIELD_SENSITIVITIES,
5086
5306
  FIELD_SOURCES,
5087
5307
  FRESHNESS,
@@ -5122,6 +5342,9 @@ export {
5122
5342
  choiceSlug,
5123
5343
  choiceValuesOf,
5124
5344
  choicesOf,
5345
+ coerceTypedAnswer,
5346
+ coerceTypedAnswers,
5347
+ coercionLabel,
5125
5348
  createRecordsClient,
5126
5349
  doorAbsent,
5127
5350
  doorCensus,
@@ -5129,6 +5352,7 @@ export {
5129
5352
  err,
5130
5353
  exportCsv,
5131
5354
  exportXlsx,
5355
+ fieldKindFor,
5132
5356
  forgetAllOps,
5133
5357
  highestLevel,
5134
5358
  holdsARetiredChoice,