@ai-matrx/records 0.51.0 → 0.52.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { U as Uuid, g as Timestamp, k as ReadRow, h as RecordDocument, T as TableType, a as TableDisplay, S as StorageMode, ay as TableOrigin, m as StoredRecord, l as Field, a9 as ParityFieldType, ao as RuleUse, an as RuleNodeKind, R as RelationFlavor, O as OnDelete, ak as RelationBinding, f as RelationCardinality, a3 as MergeFieldSource, a2 as MergeFieldSemanticType, a1 as MergeFieldModifier, a6 as OverridePolicy, G as Delivery, V as Freshness, x as Actor, P as PgError } from './field-C6_QKP1G.cjs';
2
- export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DECLARABLE_FIELD_KINDS, B as DELIVERIES, E as DeclarableFieldKind, H as ENTITY_TOKENS, I as EntityToken, J as FIELD_SENSITIVITIES, K as FIELD_SOURCES, L as FRESHNESS, M as FieldBehavior, n as FieldPatch, q as FieldProposal, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, Q as ForbiddenEnvelopeWord, X as HiddenFieldNotice, Y as KERNEL_TABLES, Z as KernelTableName, _ as MERGE_FIELD_MODIFIERS, $ as MERGE_FIELD_SEMANTIC_TYPES, a0 as MERGE_FIELD_SOURCES, N as NewFieldDeclaration, a4 as ON_DELETE, a5 as OVERRIDE_POLICIES, a7 as PARITY_FIELD_TYPES, a8 as PER_VALUE_ACCESS_WORDS, aa as ParityFieldTypeDescriptor, ab as PerValueAccessWord, u as PredictedRefusal, ac as ProvenancePointer, ad as RELATION_BINDINGS, ae as RELATION_CARDINALITIES, af as RELATION_FLAVORS, ag as RETIRED_ACTOR_WORDS, ah as RULE_NODE_KINDS, ai as RULE_USES, p as ReadValue, j as RecordRead, o as RecordRevision, s as RecordsError, aj as RecordsErrorCode, i as RecordsResult, al as RelationDisplay, am as RetiredActorWord, ap as STORAGE_MODES, aq as STORE_DOORS, ar as STORE_KNOBS, as as STORE_REFUSAL_CODES, t as StaleWriteDetail, at as StoreDoorName, au as StoreRefusalCode, av as TABLE_DISPLAYS, aw as TABLE_ORIGINS, ax as TABLE_TYPES, r as TableProposal, az as VALUE_ALTERNATE_KEYS, aA as VALUE_ENVELOPE_KEYS, aB as ValueAlternate, aC as ValueAlternateKey, aD as ValueEnvelope, aE as ValueEnvelopeKey, aF as ValueSource, W as WriteConflict, aG as err, aH as isRecordsErr, aI as ok } from './field-C6_QKP1G.cjs';
1
+ import { U as Uuid, g as Timestamp, k as ReadRow, h as RecordDocument, T as TableType, a as TableDisplay, S as StorageMode, ay as TableOrigin, m as StoredRecord, l as Field, a9 as ParityFieldType, ao as RuleUse, an as RuleNodeKind, R as RelationFlavor, O as OnDelete, ak as RelationBinding, f as RelationCardinality, a3 as MergeFieldSource, a2 as MergeFieldSemanticType, a1 as MergeFieldModifier, a6 as OverridePolicy, G as Delivery, V as Freshness, x as Actor, P as PgError } from './field-xRstzLKK.cjs';
2
+ export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DECLARABLE_FIELD_KINDS, B as DELIVERIES, E as DeclarableFieldKind, H as ENTITY_TOKENS, I as EntityToken, J as FIELD_SENSITIVITIES, K as FIELD_SOURCES, L as FRESHNESS, M as FieldBehavior, n as FieldPatch, q as FieldProposal, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, Q as ForbiddenEnvelopeWord, X as HiddenFieldNotice, Y as KERNEL_TABLES, Z as KernelTableName, _ as MERGE_FIELD_MODIFIERS, $ as MERGE_FIELD_SEMANTIC_TYPES, a0 as MERGE_FIELD_SOURCES, N as NewFieldDeclaration, a4 as ON_DELETE, a5 as OVERRIDE_POLICIES, a7 as PARITY_FIELD_TYPES, a8 as PER_VALUE_ACCESS_WORDS, aa as ParityFieldTypeDescriptor, ab as PerValueAccessWord, u as PredictedRefusal, ac as ProvenancePointer, ad as RELATION_BINDINGS, ae as RELATION_CARDINALITIES, af as RELATION_FLAVORS, ag as RETIRED_ACTOR_WORDS, ah as RULE_NODE_KINDS, ai as RULE_USES, p as ReadValue, j as RecordRead, o as RecordRevision, s as RecordsError, aj as RecordsErrorCode, i as RecordsResult, al as RelationDisplay, am as RetiredActorWord, ap as STORAGE_MODES, aq as STORE_DOORS, ar as STORE_KNOBS, as as STORE_REFUSAL_CODES, t as StaleWriteDetail, at as StoreDoorName, au as StoreRefusalCode, av as TABLE_DISPLAYS, aw as TABLE_ORIGINS, ax as TABLE_TYPES, r as TableProposal, az as VALUE_ALTERNATE_KEYS, aA as VALUE_ENVELOPE_KEYS, aB as ValueAlternate, aC as ValueAlternateKey, aD as ValueEnvelope, aE as ValueEnvelopeKey, aF as ValueSource, W as WriteConflict, aG as err, aH as isRecordsErr, aI as ok } from './field-xRstzLKK.cjs';
3
3
 
4
4
  /**
5
5
  * THE TWO LANES THE ARCHIVED-ITEMS LAW NAMES (Arman, 2026-09-09) — the same
@@ -1001,6 +1001,14 @@ interface ImportOpened {
1001
1001
  rows_duplicate: number;
1002
1002
  source_name: string | null;
1003
1003
  opened_at?: Timestamp;
1004
+ /**
1005
+ * IMPORT-2. How many rows to send in the FIRST call. The store owns this
1006
+ * number rather than a screen, because nothing has been measured yet when a
1007
+ * run opens and a batch size written into a wizard is wrong on a busy
1008
+ * afternoon and stale the day the write path gets cheaper. Every call after
1009
+ * the first uses `ImportBatchResult.rows_per_call`, which is measured.
1010
+ */
1011
+ rows_per_call?: number;
1004
1012
  message: string;
1005
1013
  }
1006
1014
  /** One row of the file, and what became of it. */
@@ -1045,6 +1053,36 @@ interface ImportBatchResult {
1045
1053
  rows_refused: number;
1046
1054
  outcomes: ImportOutcome[];
1047
1055
  proposals: ImportProposal[];
1056
+ /**
1057
+ * IMPORT-2. The columns this call had to declare because the run never took
1058
+ * the `importDeclareColumns` step. Normally empty: declaring is its own step.
1059
+ */
1060
+ columns_added?: ImportProposal[];
1061
+ /**
1062
+ * IMPORT-2. FALSE means the batch could not be written as one statement — one
1063
+ * row of it was refused by a guard that refuses the whole statement — so every
1064
+ * row was written on its own instead and the refusals below name the rows that
1065
+ * could not be. The answers are identical either way; this says what it cost.
1066
+ */
1067
+ one_statement?: boolean;
1068
+ /** How long THIS call's writing phase took, and what that was a row. */
1069
+ write_ms?: number;
1070
+ ms_per_row?: number;
1071
+ /**
1072
+ * IMPORT-2. How many rows the NEXT call should carry, measured from this one:
1073
+ * the store aims at two seconds of writing, which leaves a database that gets
1074
+ * 50% busier between two calls still inside the three seconds a person should
1075
+ * wait. Send this many next. Ignoring it costs correctness nothing.
1076
+ */
1077
+ rows_per_call?: number;
1078
+ }
1079
+ /** IMPORT-2. What `importDeclareColumns` made, as its own step of the wizard. */
1080
+ interface ImportColumnsDeclared {
1081
+ table_id: Uuid;
1082
+ columns_added: ImportProposal[];
1083
+ /** Header -> Field key, including the headers that already named a column. */
1084
+ mapping: Record<string, string>;
1085
+ message: string;
1048
1086
  }
1049
1087
  interface ImportFinished {
1050
1088
  import_id: Uuid;
@@ -1269,6 +1307,49 @@ interface PortalPreviewRow {
1269
1307
  * nothing more. That is why it is readable and why copying it is safe.
1270
1308
  */
1271
1309
  declare function portalPath(slug: string): string;
1310
+ /**
1311
+ * The platform archive filter's own three values, and no fourth. `custom.list_portals`
1312
+ * refuses anything else with `22023` rather than quietly treating it as one of them.
1313
+ */
1314
+ declare const PORTAL_ARCHIVE_FILTERS: readonly ["active", "archived", "all"];
1315
+ type PortalArchiveFilter = (typeof PORTAL_ARCHIVE_FILTERS)[number];
1316
+ /** THE LAW'S DEFAULT IS TO HIDE. A list nobody narrowed is the live things. */
1317
+ declare const DEFAULT_PORTAL_ARCHIVE_FILTER: PortalArchiveFilter;
1318
+ declare function isPortalArchiveFilter(word: unknown): word is PortalArchiveFilter;
1319
+ /** What `custom.portal_archive` and `custom.portal_restore` answer with. */
1320
+ interface PortalArchiveAnswer {
1321
+ /** Where the portal stands NOW — true after an archive, false after a restore. */
1322
+ archived: boolean;
1323
+ /** False when it was already in that state; the sentence says so rather than lying about an act. */
1324
+ changed: boolean;
1325
+ portal_id: Uuid;
1326
+ archived_at?: Timestamp | null;
1327
+ /** The store's own sentence, in plain English. Show it verbatim; never a constraint name. */
1328
+ sentence: string;
1329
+ }
1330
+ /**
1331
+ * THE CONSEQUENCE, SAID BEFORE THE CLICK — never a generic "are you sure?".
1332
+ *
1333
+ * What actually changes is two things: nobody can sign in to it any more, and it
1334
+ * leaves the organization's portal list. What does NOT change is everything
1335
+ * else, and saying so is the difference between an archive somebody dares to
1336
+ * press and one they avoid.
1337
+ */
1338
+ declare function portalArchiveConsequence(title: string, signedIn: number, invited: number): string;
1339
+ /**
1340
+ * WHY THE TITLE HAS TO BE TYPED BACK, in the store's own reasoning. Ten portals
1341
+ * can carry one title, so the title is not what PICKS this one — the portal you
1342
+ * opened is. Typing it back is how you say you meant this one.
1343
+ */
1344
+ declare function portalConfirmLine(title: string): string;
1345
+ /** True when what the person typed is what the door will accept. The door decides; this only spares them a round trip. */
1346
+ declare function portalTitleTypedBack(typed: string, title: string): boolean;
1347
+ /**
1348
+ * WHAT AN EMPTY ARCHIVE LANE SAYS. An empty list is an answer: it says nothing
1349
+ * has been archived, so "none here" can never be read as "the archive is broken"
1350
+ * or as "this organization has no portals at all".
1351
+ */
1352
+ declare function emptyPortalArchiveLine(): string;
1272
1353
 
1273
1354
  /** The measures the store offers. Asked of `custom.agg_operations()` at run time too. */
1274
1355
  type AggregateOperation = "count" | "sum" | "avg" | "min" | "max";
@@ -3150,4 +3231,4 @@ interface ConversationScopeContext {
3150
3231
  /** `About: Acme Industrial` — the chip a bound chat wears. */
3151
3232
  declare function scopeChip(scope: ConversationScope): string;
3152
3233
 
3153
- export { ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, Actor, type AggregateBucket, 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, 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 ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DEFAULT_ARCHIVE_LANE, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, 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 EntityTableFacts, type ExternalPrincipalCard, FIELD_KINDS, Field, type FieldHistoryEntry, type FieldKind, type FormSummary, Freshness, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type KernelTargets, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, OnDelete, OverridePolicy, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, ParityFieldType, type PermissionLevel, PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, ReadRow, type RecordComment, RecordDocument, type RecordFilter, type RecordHistoryEntry, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsTableQuery, type RegisteredTable, type Relation, RelationBinding, RelationCardinality, type RelationCarries, type RelationCoordinate, RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type Rule, type RuleAnswer, type RuleExpression, RuleNodeKind, RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, StorageMode, StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, type Table, type TableCapacity, TableDisplay, TableOrigin, TableType, Timestamp, Uuid, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, 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, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, sameDocument, scopeChip, stableFilterKey };
3234
+ export { ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, Actor, type AggregateBucket, 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, 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 ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, 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 EntityTableFacts, type ExternalPrincipalCard, FIELD_KINDS, Field, type FieldHistoryEntry, type FieldKind, type FormSummary, Freshness, 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 KernelTargets, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, OnDelete, OverridePolicy, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, PORTAL_ARCHIVE_FILTERS, ParityFieldType, type PermissionLevel, PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, ReadRow, type RecordComment, RecordDocument, type RecordFilter, type RecordHistoryEntry, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsTableQuery, type RegisteredTable, type Relation, RelationBinding, RelationCardinality, type RelationCarries, type RelationCoordinate, RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type Rule, type RuleAnswer, type RuleExpression, RuleNodeKind, RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, StorageMode, StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, type Table, type TableCapacity, TableDisplay, TableOrigin, TableType, Timestamp, Uuid, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, 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, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isPortalArchiveFilter, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, rememberedOpCount, sameDocument, scopeChip, stableFilterKey };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { U as Uuid, g as Timestamp, k as ReadRow, h as RecordDocument, T as TableType, a as TableDisplay, S as StorageMode, ay as TableOrigin, m as StoredRecord, l as Field, a9 as ParityFieldType, ao as RuleUse, an as RuleNodeKind, R as RelationFlavor, O as OnDelete, ak as RelationBinding, f as RelationCardinality, a3 as MergeFieldSource, a2 as MergeFieldSemanticType, a1 as MergeFieldModifier, a6 as OverridePolicy, G as Delivery, V as Freshness, x as Actor, P as PgError } from './field-C6_QKP1G.js';
2
- export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DECLARABLE_FIELD_KINDS, B as DELIVERIES, E as DeclarableFieldKind, H as ENTITY_TOKENS, I as EntityToken, J as FIELD_SENSITIVITIES, K as FIELD_SOURCES, L as FRESHNESS, M as FieldBehavior, n as FieldPatch, q as FieldProposal, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, Q as ForbiddenEnvelopeWord, X as HiddenFieldNotice, Y as KERNEL_TABLES, Z as KernelTableName, _ as MERGE_FIELD_MODIFIERS, $ as MERGE_FIELD_SEMANTIC_TYPES, a0 as MERGE_FIELD_SOURCES, N as NewFieldDeclaration, a4 as ON_DELETE, a5 as OVERRIDE_POLICIES, a7 as PARITY_FIELD_TYPES, a8 as PER_VALUE_ACCESS_WORDS, aa as ParityFieldTypeDescriptor, ab as PerValueAccessWord, u as PredictedRefusal, ac as ProvenancePointer, ad as RELATION_BINDINGS, ae as RELATION_CARDINALITIES, af as RELATION_FLAVORS, ag as RETIRED_ACTOR_WORDS, ah as RULE_NODE_KINDS, ai as RULE_USES, p as ReadValue, j as RecordRead, o as RecordRevision, s as RecordsError, aj as RecordsErrorCode, i as RecordsResult, al as RelationDisplay, am as RetiredActorWord, ap as STORAGE_MODES, aq as STORE_DOORS, ar as STORE_KNOBS, as as STORE_REFUSAL_CODES, t as StaleWriteDetail, at as StoreDoorName, au as StoreRefusalCode, av as TABLE_DISPLAYS, aw as TABLE_ORIGINS, ax as TABLE_TYPES, r as TableProposal, az as VALUE_ALTERNATE_KEYS, aA as VALUE_ENVELOPE_KEYS, aB as ValueAlternate, aC as ValueAlternateKey, aD as ValueEnvelope, aE as ValueEnvelopeKey, aF as ValueSource, W as WriteConflict, aG as err, aH as isRecordsErr, aI as ok } from './field-C6_QKP1G.js';
1
+ import { U as Uuid, g as Timestamp, k as ReadRow, h as RecordDocument, T as TableType, a as TableDisplay, S as StorageMode, ay as TableOrigin, m as StoredRecord, l as Field, a9 as ParityFieldType, ao as RuleUse, an as RuleNodeKind, R as RelationFlavor, O as OnDelete, ak as RelationBinding, f as RelationCardinality, a3 as MergeFieldSource, a2 as MergeFieldSemanticType, a1 as MergeFieldModifier, a6 as OverridePolicy, G as Delivery, V as Freshness, x as Actor, P as PgError } from './field-xRstzLKK.js';
2
+ export { A as ABSENCE_REASONS, v as ACTOR_VOCABULARY, w as AbsenceReason, y as COMPUTE_ON, z as CONTEXT_POLICIES, C as ComputeOn, e as ContextPolicy, D as DECLARABLE_FIELD_KINDS, B as DELIVERIES, E as DeclarableFieldKind, H as ENTITY_TOKENS, I as EntityToken, J as FIELD_SENSITIVITIES, K as FIELD_SOURCES, L as FRESHNESS, M as FieldBehavior, n as FieldPatch, q as FieldProposal, c as FieldRule, d as FieldSensitivity, b as FieldSource, F as FieldTypeWord, Q as ForbiddenEnvelopeWord, X as HiddenFieldNotice, Y as KERNEL_TABLES, Z as KernelTableName, _ as MERGE_FIELD_MODIFIERS, $ as MERGE_FIELD_SEMANTIC_TYPES, a0 as MERGE_FIELD_SOURCES, N as NewFieldDeclaration, a4 as ON_DELETE, a5 as OVERRIDE_POLICIES, a7 as PARITY_FIELD_TYPES, a8 as PER_VALUE_ACCESS_WORDS, aa as ParityFieldTypeDescriptor, ab as PerValueAccessWord, u as PredictedRefusal, ac as ProvenancePointer, ad as RELATION_BINDINGS, ae as RELATION_CARDINALITIES, af as RELATION_FLAVORS, ag as RETIRED_ACTOR_WORDS, ah as RULE_NODE_KINDS, ai as RULE_USES, p as ReadValue, j as RecordRead, o as RecordRevision, s as RecordsError, aj as RecordsErrorCode, i as RecordsResult, al as RelationDisplay, am as RetiredActorWord, ap as STORAGE_MODES, aq as STORE_DOORS, ar as STORE_KNOBS, as as STORE_REFUSAL_CODES, t as StaleWriteDetail, at as StoreDoorName, au as StoreRefusalCode, av as TABLE_DISPLAYS, aw as TABLE_ORIGINS, ax as TABLE_TYPES, r as TableProposal, az as VALUE_ALTERNATE_KEYS, aA as VALUE_ENVELOPE_KEYS, aB as ValueAlternate, aC as ValueAlternateKey, aD as ValueEnvelope, aE as ValueEnvelopeKey, aF as ValueSource, W as WriteConflict, aG as err, aH as isRecordsErr, aI as ok } from './field-xRstzLKK.js';
3
3
 
4
4
  /**
5
5
  * THE TWO LANES THE ARCHIVED-ITEMS LAW NAMES (Arman, 2026-09-09) — the same
@@ -1001,6 +1001,14 @@ interface ImportOpened {
1001
1001
  rows_duplicate: number;
1002
1002
  source_name: string | null;
1003
1003
  opened_at?: Timestamp;
1004
+ /**
1005
+ * IMPORT-2. How many rows to send in the FIRST call. The store owns this
1006
+ * number rather than a screen, because nothing has been measured yet when a
1007
+ * run opens and a batch size written into a wizard is wrong on a busy
1008
+ * afternoon and stale the day the write path gets cheaper. Every call after
1009
+ * the first uses `ImportBatchResult.rows_per_call`, which is measured.
1010
+ */
1011
+ rows_per_call?: number;
1004
1012
  message: string;
1005
1013
  }
1006
1014
  /** One row of the file, and what became of it. */
@@ -1045,6 +1053,36 @@ interface ImportBatchResult {
1045
1053
  rows_refused: number;
1046
1054
  outcomes: ImportOutcome[];
1047
1055
  proposals: ImportProposal[];
1056
+ /**
1057
+ * IMPORT-2. The columns this call had to declare because the run never took
1058
+ * the `importDeclareColumns` step. Normally empty: declaring is its own step.
1059
+ */
1060
+ columns_added?: ImportProposal[];
1061
+ /**
1062
+ * IMPORT-2. FALSE means the batch could not be written as one statement — one
1063
+ * row of it was refused by a guard that refuses the whole statement — so every
1064
+ * row was written on its own instead and the refusals below name the rows that
1065
+ * could not be. The answers are identical either way; this says what it cost.
1066
+ */
1067
+ one_statement?: boolean;
1068
+ /** How long THIS call's writing phase took, and what that was a row. */
1069
+ write_ms?: number;
1070
+ ms_per_row?: number;
1071
+ /**
1072
+ * IMPORT-2. How many rows the NEXT call should carry, measured from this one:
1073
+ * the store aims at two seconds of writing, which leaves a database that gets
1074
+ * 50% busier between two calls still inside the three seconds a person should
1075
+ * wait. Send this many next. Ignoring it costs correctness nothing.
1076
+ */
1077
+ rows_per_call?: number;
1078
+ }
1079
+ /** IMPORT-2. What `importDeclareColumns` made, as its own step of the wizard. */
1080
+ interface ImportColumnsDeclared {
1081
+ table_id: Uuid;
1082
+ columns_added: ImportProposal[];
1083
+ /** Header -> Field key, including the headers that already named a column. */
1084
+ mapping: Record<string, string>;
1085
+ message: string;
1048
1086
  }
1049
1087
  interface ImportFinished {
1050
1088
  import_id: Uuid;
@@ -1269,6 +1307,49 @@ interface PortalPreviewRow {
1269
1307
  * nothing more. That is why it is readable and why copying it is safe.
1270
1308
  */
1271
1309
  declare function portalPath(slug: string): string;
1310
+ /**
1311
+ * The platform archive filter's own three values, and no fourth. `custom.list_portals`
1312
+ * refuses anything else with `22023` rather than quietly treating it as one of them.
1313
+ */
1314
+ declare const PORTAL_ARCHIVE_FILTERS: readonly ["active", "archived", "all"];
1315
+ type PortalArchiveFilter = (typeof PORTAL_ARCHIVE_FILTERS)[number];
1316
+ /** THE LAW'S DEFAULT IS TO HIDE. A list nobody narrowed is the live things. */
1317
+ declare const DEFAULT_PORTAL_ARCHIVE_FILTER: PortalArchiveFilter;
1318
+ declare function isPortalArchiveFilter(word: unknown): word is PortalArchiveFilter;
1319
+ /** What `custom.portal_archive` and `custom.portal_restore` answer with. */
1320
+ interface PortalArchiveAnswer {
1321
+ /** Where the portal stands NOW — true after an archive, false after a restore. */
1322
+ archived: boolean;
1323
+ /** False when it was already in that state; the sentence says so rather than lying about an act. */
1324
+ changed: boolean;
1325
+ portal_id: Uuid;
1326
+ archived_at?: Timestamp | null;
1327
+ /** The store's own sentence, in plain English. Show it verbatim; never a constraint name. */
1328
+ sentence: string;
1329
+ }
1330
+ /**
1331
+ * THE CONSEQUENCE, SAID BEFORE THE CLICK — never a generic "are you sure?".
1332
+ *
1333
+ * What actually changes is two things: nobody can sign in to it any more, and it
1334
+ * leaves the organization's portal list. What does NOT change is everything
1335
+ * else, and saying so is the difference between an archive somebody dares to
1336
+ * press and one they avoid.
1337
+ */
1338
+ declare function portalArchiveConsequence(title: string, signedIn: number, invited: number): string;
1339
+ /**
1340
+ * WHY THE TITLE HAS TO BE TYPED BACK, in the store's own reasoning. Ten portals
1341
+ * can carry one title, so the title is not what PICKS this one — the portal you
1342
+ * opened is. Typing it back is how you say you meant this one.
1343
+ */
1344
+ declare function portalConfirmLine(title: string): string;
1345
+ /** True when what the person typed is what the door will accept. The door decides; this only spares them a round trip. */
1346
+ declare function portalTitleTypedBack(typed: string, title: string): boolean;
1347
+ /**
1348
+ * WHAT AN EMPTY ARCHIVE LANE SAYS. An empty list is an answer: it says nothing
1349
+ * has been archived, so "none here" can never be read as "the archive is broken"
1350
+ * or as "this organization has no portals at all".
1351
+ */
1352
+ declare function emptyPortalArchiveLine(): string;
1272
1353
 
1273
1354
  /** The measures the store offers. Asked of `custom.agg_operations()` at run time too. */
1274
1355
  type AggregateOperation = "count" | "sum" | "avg" | "min" | "max";
@@ -3150,4 +3231,4 @@ interface ConversationScopeContext {
3150
3231
  /** `About: Acme Industrial` — the chip a bound chat wears. */
3151
3232
  declare function scopeChip(scope: ConversationScope): string;
3152
3233
 
3153
- export { ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, Actor, type AggregateBucket, 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, 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 ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DEFAULT_ARCHIVE_LANE, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, 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 EntityTableFacts, type ExternalPrincipalCard, FIELD_KINDS, Field, type FieldHistoryEntry, type FieldKind, type FormSummary, Freshness, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, type KernelTargets, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, OnDelete, OverridePolicy, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, ParityFieldType, type PermissionLevel, PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, ReadRow, type RecordComment, RecordDocument, type RecordFilter, type RecordHistoryEntry, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsTableQuery, type RegisteredTable, type Relation, RelationBinding, RelationCardinality, type RelationCarries, type RelationCoordinate, RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type Rule, type RuleAnswer, type RuleExpression, RuleNodeKind, RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, StorageMode, StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, type Table, type TableCapacity, TableDisplay, TableOrigin, TableType, Timestamp, Uuid, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, 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, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, sameDocument, scopeChip, stableFilterKey };
3234
+ export { ARCHIVE_LANES, ARCHIVE_LANE_LABEL, ARCHIVE_LANE_MEANS, Actor, type AggregateBucket, 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, 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 ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DEFAULT_ARCHIVE_LANE, DEFAULT_PORTAL_ARCHIVE_FILTER, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, 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 EntityTableFacts, type ExternalPrincipalCard, FIELD_KINDS, Field, type FieldHistoryEntry, type FieldKind, type FormSummary, Freshness, 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 KernelTargets, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, OnDelete, OverridePolicy, PERMISSION_LEVELS, PIPELINE_RULE_KINDS, PORTAL_ARCHIVE_FILTERS, ParityFieldType, type PermissionLevel, PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalArchiveAnswer, type PortalArchiveFilter, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PortalTableRef, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, ReadRow, type RecordComment, RecordDocument, type RecordFilter, type RecordHistoryEntry, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsTableQuery, type RegisteredTable, type Relation, RelationBinding, RelationCardinality, type RelationCarries, type RelationCoordinate, RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type Rule, type RuleAnswer, type RuleExpression, RuleNodeKind, RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, StorageMode, StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, type Table, type TableCapacity, TableDisplay, TableOrigin, TableType, Timestamp, Uuid, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, 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, archivedByLine, archivedWhen, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, emptyArchiveLine, emptyPortalArchiveLine, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isArchiveLane, isDecided, isOwnOp, isPortalArchiveFilter, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, openCaptureQueue, optionKey, optionLabel, portalArchiveConsequence, portalConfirmLine, portalPath, portalTitleTypedBack, publicFormPath, rememberedOpCount, sameDocument, scopeChip, stableFilterKey };
package/dist/index.js CHANGED
@@ -387,6 +387,24 @@ function publicFormPath(formId) {
387
387
  function portalPath(slug) {
388
388
  return `/portal/c/${slug}`;
389
389
  }
390
+ var PORTAL_ARCHIVE_FILTERS = ["active", "archived", "all"];
391
+ var DEFAULT_PORTAL_ARCHIVE_FILTER = "active";
392
+ function isPortalArchiveFilter(word) {
393
+ return typeof word === "string" && PORTAL_ARCHIVE_FILTERS.includes(word);
394
+ }
395
+ function portalArchiveConsequence(title, signedIn, invited) {
396
+ const people = invited === 0 ? "Nobody is invited to it" : signedIn === 0 ? `The ${invited} ${invited === 1 ? "person" : "people"} invited to it will not be able to sign in` : `The ${signedIn} ${signedIn === 1 ? "person" : "people"} signed in to it, and the ${invited - signedIn} still invited, will not be able to sign in`;
397
+ return `\u201C${title}\u201D will leave your portal list. ${people}, and their invitation links will say this portal was archived and can be restored. Nothing is deleted \u2014 every Table it shows and everyone invited to it is kept exactly as it is, and you can restore it at any time.`;
398
+ }
399
+ function portalConfirmLine(title) {
400
+ return `Type the portal\u2019s title \u2014 ${title} \u2014 to confirm you mean this one.`;
401
+ }
402
+ function portalTitleTypedBack(typed, title) {
403
+ return typed.trim() === (title ?? "").trim();
404
+ }
405
+ function emptyPortalArchiveLine() {
406
+ 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.";
407
+ }
390
408
 
391
409
  // src/aggregate.ts
392
410
  function measureKey(measure) {
@@ -1062,6 +1080,7 @@ var STORE_DOORS = [
1062
1080
  { name: "io_export", args: "p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_required text DEFAULT 'viewer'::text", returns: "jsonb", security: "definer" },
1063
1081
  { name: "io_export_csv", args: "p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_delimiter text DEFAULT chr(44), p_required text DEFAULT 'viewer'::text", returns: "text", security: "definer" },
1064
1082
  { name: "io_import_begin", args: "p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb, p_file_hash text DEFAULT NULL::text, p_policy jsonb DEFAULT '{}'::jsonb, p_dedupe_key text DEFAULT NULL::text, p_file_bytes bigint DEFAULT NULL::bigint, p_force boolean DEFAULT false", returns: "jsonb", security: "definer" },
1083
+ { name: "io_import_declare_columns", args: "p_organization_id uuid, p_table_id uuid, p_rows jsonb, p_mapping jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
1065
1084
  { name: "io_import_finish", args: "p_organization_id uuid, p_import_id uuid, p_unmapped text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
1066
1085
  { name: "io_import_forget", args: "p_organization_id uuid, p_import_id uuid", returns: "boolean", security: "definer" },
1067
1086
  { name: "io_import_open", args: "p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb", returns: "uuid", security: "definer" },
@@ -1095,6 +1114,7 @@ var STORE_DOORS = [
1095
1114
  { name: "levels_raised_by_a_less_specific_rung", args: "", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, member_email text, record_id uuid, addressed_level permission_level, answered_level permission_level)", security: "definer" },
1096
1115
  { name: "list_door_disagreements", args: "p_pretend text DEFAULT NULL::text, p_only_organization uuid DEFAULT NULL::uuid, p_sample integer DEFAULT 200", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)", security: "invoker" },
1097
1116
  { name: "list_door_disagreements", args: "p_pretend text, p_only_organization uuid, p_sample integer, p_exhaustive boolean", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)", security: "invoker" },
1117
+ { name: "list_portals", args: "p_organization_id uuid, p_archived text DEFAULT 'active'::text", 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" },
1098
1118
  { name: "lookup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
1099
1119
  { name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
1100
1120
  { name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb, p_declared_keys text[] DEFAULT NULL::text[]", returns: "jsonb", security: "invoker" },
@@ -1144,6 +1164,7 @@ var STORE_DOORS = [
1144
1164
  { name: "pipeline_read", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
1145
1165
  { name: "pipeline_transition_refusal", args: "p_organization_id uuid, p_record_id uuid, p_to text", returns: "jsonb", security: "definer" },
1146
1166
  { name: "portal_admits", args: "p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "definer" },
1167
+ { name: "portal_archive", args: "p_organization_id uuid, p_portal_id uuid, p_confirm_title text, p_reason text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
1147
1168
  { name: "portal_card", args: "p_organization_id uuid, p_portal_id uuid", returns: "jsonb", security: "definer" },
1148
1169
  { name: "portal_declare", args: "p_organization_id uuid, p_title text, p_client_table_id uuid, p_tables jsonb, p_portal_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text, p_sign_in_method text DEFAULT 'magic_link'::text", returns: "uuid", security: "definer" },
1149
1170
  { name: "portal_field_map", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(field_id uuid, field_key text, field_type text, points_at uuid)", security: "definer" },
@@ -1155,6 +1176,7 @@ var STORE_DOORS = [
1155
1176
  { name: "portal_principal_bind", args: "p_organization_id uuid, p_principal_id uuid, p_user_id uuid", returns: "jsonb", security: "definer" },
1156
1177
  { name: "portal_public", args: "p_slug text", returns: "jsonb", security: "definer" },
1157
1178
  { name: "portal_record_title", args: "p_organization_id uuid, p_record_id uuid", returns: "text", security: "definer" },
1179
+ { name: "portal_restore", args: "p_organization_id uuid, p_portal_id uuid, p_confirm_title text", returns: "jsonb", security: "definer" },
1158
1180
  { name: "portal_revoke", args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid", returns: "jsonb", security: "definer" },
1159
1181
  { name: "portal_slug", args: "p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid", returns: "text", security: "definer" },
1160
1182
  { name: "portal_tables", args: "p_organization_id uuid", returns: "TABLE(portal_id uuid, table_id uuid, name text)", security: "definer" },
@@ -1435,16 +1457,16 @@ var STORE_KNOBS = [
1435
1457
  { key: "world_publish_enabled", value: "false", type: "boolean" }
1436
1458
  ];
1437
1459
  var STORE_REFUSAL_CODES = [
1438
- { code: "02000", raised_by: "_checklist_instantiate,_portal_invite_payload,_share_write_person,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_invite_accept,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_archive,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
1460
+ { code: "02000", raised_by: "_checklist_instantiate,_portal_invite_payload,_share_write_person,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_archive,portal_card,portal_declare,portal_invite,portal_invite_accept,portal_preview,portal_principal_bind,portal_restore,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_archive,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
1439
1461
  { code: "0A000", raised_by: "checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign" },
1440
1462
  { code: "22003", raised_by: "context_resolve" },
1441
1463
  { code: "22004", raised_by: "_entity_custom_fields_guard,_share_write_person,_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_archive,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
1442
1464
  { code: "22007", raised_by: "dashboard_window_sql" },
1443
1465
  { code: "22012", raised_by: "rule_eval" },
1444
- { 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,read_records_archived,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" },
1466
+ { 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,list_portals,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,read_records_archived,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" },
1445
1467
  { code: "23503", raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_field_type_parity_guard,_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" },
1446
1468
  { code: "23505", raised_by: "_share_write_person,_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,sign_request_cancel,sign_request_create,table_share_outside_resend,work_approval_decide,work_slot_hold" },
1447
- { 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_comment_write,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" },
1469
+ { 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_comment_write,io_import_rows,migrate_merge,portal_archive,portal_restore,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" },
1448
1470
  { code: "40001", raised_by: "has_visibility_at" },
1449
1471
  { code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,agent_table_claim,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,doc_sign,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_invite_accept,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_archived,read_records_by_ids,read_records_matching,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
1450
1472
  { code: "42703", raised_by: "entity_table,portal_declare" },
@@ -2495,6 +2517,7 @@ export {
2495
2517
  CONTEXT_POLICIES,
2496
2518
  DECLARABLE_FIELD_KINDS,
2497
2519
  DEFAULT_ARCHIVE_LANE,
2520
+ DEFAULT_PORTAL_ARCHIVE_FILTER,
2498
2521
  DELIVERIES,
2499
2522
  ENTITY_TOKENS,
2500
2523
  FIELD_KINDS,
@@ -2511,6 +2534,7 @@ export {
2511
2534
  PERMISSION_LEVELS,
2512
2535
  PER_VALUE_ACCESS_WORDS,
2513
2536
  PIPELINE_RULE_KINDS,
2537
+ PORTAL_ARCHIVE_FILTERS,
2514
2538
  REFUSALS_WORTH_REPEATING,
2515
2539
  RELATION_BINDINGS,
2516
2540
  RELATION_CARDINALITIES,
@@ -2541,6 +2565,7 @@ export {
2541
2565
  coerceTypedAnswers,
2542
2566
  coercionLabel,
2543
2567
  emptyArchiveLine,
2568
+ emptyPortalArchiveLine,
2544
2569
  err,
2545
2570
  fieldKindFor,
2546
2571
  forgetAllOps,
@@ -2550,6 +2575,7 @@ export {
2550
2575
  isArchiveLane,
2551
2576
  isDecided,
2552
2577
  isOwnOp,
2578
+ isPortalArchiveFilter,
2553
2579
  isRecordsErr,
2554
2580
  isTheChosen,
2555
2581
  looksLikeAnId,
@@ -2562,7 +2588,10 @@ export {
2562
2588
  openCaptureQueue,
2563
2589
  optionKey,
2564
2590
  optionLabel,
2591
+ portalArchiveConsequence,
2592
+ portalConfirmLine,
2565
2593
  portalPath,
2594
+ portalTitleTypedBack,
2566
2595
  publicFormPath,
2567
2596
  rememberedOpCount,
2568
2597
  sameDocument,