@ai-matrx/records 0.26.0 → 0.27.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
@@ -3617,9 +3617,21 @@ interface FieldPatch {
3617
3617
  /** …or the one word every other caller reaches for (see `NewFieldDeclaration`). */
3618
3618
  type?: FieldTypeWord;
3619
3619
  /**
3620
- * FLD-2. The shape of the value. The door reads it ONLY inside its behaviour
3621
- * arm, so a patch that moves `multi` alone changes nothing — send the
3622
- * behaviour word with it.
3620
+ * FLD-2. The shape of the value — one, or several.
3621
+ *
3622
+ * This comment used to say that a patch moving `multi` ALONE changed nothing
3623
+ * and that the behaviour word had to be sent with it. That was true, and it
3624
+ * was a description of a silent failure rather than a contract: the door
3625
+ * answered "saved" and the column still held one. `custom.field_update` has
3626
+ * had a real settings arm for it since 2026-09-20 (matrx-frontend
3627
+ * `migrations/campaign/fix7b_field_multi_arm.sql`), which also moves a
3628
+ * relation's `relation_max` beside it — `custom.validate_values` counts links
3629
+ * against that number, so moving `multi` without it would tick a box and
3630
+ * still refuse the second record.
3631
+ *
3632
+ * A CHOICE LIST IS THE ONE EXCEPTION, and it is refused by name rather than
3633
+ * ignored: for `select` / `multi_select`, "one answer or several" IS the
3634
+ * parity type, so send the type instead.
3623
3635
  */
3624
3636
  multi?: boolean;
3625
3637
  /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */
@@ -3793,6 +3805,139 @@ interface EntityFieldRights {
3793
3805
  may_fill_in: boolean;
3794
3806
  }
3795
3807
 
3808
+ /** One stage of a board: the KEY the store keeps, and the LABEL a person reads. */
3809
+ interface PipelineStage {
3810
+ /** The option's stable key — what a cell holds, and what a move is written with. */
3811
+ key: string;
3812
+ /** What the column heading says. Renaming a stage rewrites no record. */
3813
+ label: string;
3814
+ /** A retired choice can still be READ on a record that holds it; it cannot be picked anew. */
3815
+ retired: boolean;
3816
+ }
3817
+ /** What each Rule of a pipeline is about. Closed, and the store is the authority. */
3818
+ declare const PIPELINE_RULE_KINDS: readonly ["moves", "requires", "who", "limit", "entry"];
3819
+ type PipelineRuleKind = (typeof PIPELINE_RULE_KINDS)[number];
3820
+ /**
3821
+ * One transition Rule, as `custom.pipeline_read` hands it back — WITH the sentence it says
3822
+ * when it refuses, because a screen that knows a rule exists but not what it refuses in
3823
+ * cannot warn anybody before they drag.
3824
+ */
3825
+ interface PipelineRule {
3826
+ id: Uuid;
3827
+ name: string;
3828
+ /** The exact words a person is shown when this Rule stops a move. */
3829
+ message: string;
3830
+ kind: PipelineRuleKind | null;
3831
+ /** The stage this Rule is about; `null` on the one Rule about the moves themselves. */
3832
+ stage: string | null;
3833
+ uses: string[];
3834
+ /** What happens when a card ARRIVES in this stage — assign, notify, start a checklist. */
3835
+ on_entry: Record<string, unknown> | null;
3836
+ version: number;
3837
+ }
3838
+ /** The whole board's definition, from `custom.pipeline_read`. */
3839
+ interface Pipeline {
3840
+ is_pipeline: boolean;
3841
+ /** Present, and it says what would make a board exist, when `is_pipeline` is false. */
3842
+ why?: string;
3843
+ table_id?: Uuid;
3844
+ /** The Field KEY that holds the stage — the twin of a Table's `type_field`. */
3845
+ stage_field?: string;
3846
+ field_id?: Uuid;
3847
+ /** What that column is called, e.g. "Stage". */
3848
+ stage_label?: string;
3849
+ /** In the order they were declared, which is the order the board draws them. */
3850
+ stages?: PipelineStage[];
3851
+ rules?: PipelineRule[];
3852
+ }
3853
+ /** One column of the board, with the store's own numbers over what this person may see. */
3854
+ interface PipelineColumn {
3855
+ stage_key: string;
3856
+ stage_label: string;
3857
+ /** 1-based, the declared order. */
3858
+ stage_position: number;
3859
+ cards: number;
3860
+ /** The total of the chosen measure, or null when no measure was asked for. */
3861
+ total: number | null;
3862
+ /** How many cards this column takes at once, or null when it takes any number. */
3863
+ wip_limit: number | null;
3864
+ /** True when the column already holds MORE than its limit — a state a board must show. */
3865
+ over_limit: boolean;
3866
+ }
3867
+ /** One column this stage demands before a card may land in it. */
3868
+ interface PipelineMissingField {
3869
+ field_id: Uuid;
3870
+ key: string;
3871
+ /** What the column is called, so a screen can ASK for it rather than only refuse. */
3872
+ label: string;
3873
+ }
3874
+ /**
3875
+ * Whether a card may go to a column, answered BEFORE the finger lets go — by the same
3876
+ * Rules, through the same evaluator, on the document the move WOULD produce.
3877
+ *
3878
+ * A board greys a column, and snaps a card back, from this. It never decides for itself.
3879
+ */
3880
+ interface PipelineVerdict {
3881
+ allowed: boolean;
3882
+ is_pipeline: boolean;
3883
+ /** The stage key the move was asked about. */
3884
+ to?: string;
3885
+ /** The store's own sentence — shown verbatim, never paraphrased by a screen. */
3886
+ why: string;
3887
+ rule?: string;
3888
+ rule_id?: Uuid;
3889
+ rule_version?: number;
3890
+ kind?: PipelineRuleKind;
3891
+ /**
3892
+ * When a stage demands columns that are empty, exactly which ones — so the screen can
3893
+ * prompt for them on entry instead of sending the person away to find them.
3894
+ */
3895
+ missing?: PipelineMissingField[];
3896
+ }
3897
+ /** What `custom.pipeline_declare` says it made or changed. */
3898
+ interface PipelineDeclared {
3899
+ table_id: Uuid;
3900
+ stage_field: string;
3901
+ field_id: Uuid;
3902
+ stages: string[];
3903
+ rules: Record<string, Uuid>;
3904
+ /** Plain sentences naming each thing this declaration wrote. */
3905
+ said: string[];
3906
+ }
3907
+ /** The declaration a person (or an agent) writes. Everything is optional but the stages. */
3908
+ interface PipelineSpec {
3909
+ stage_field: {
3910
+ key: string;
3911
+ label?: string;
3912
+ options?: string[];
3913
+ sort?: number;
3914
+ };
3915
+ transitions?: {
3916
+ from: string;
3917
+ to: string;
3918
+ }[];
3919
+ /** Stage name → the column keys that must be filled in to land there. */
3920
+ requires?: Record<string, string[]>;
3921
+ /** Stage name → the rung somebody needs on the record to move a card INTO it. */
3922
+ who?: Record<string, "viewer" | "commenter" | "editor" | "admin">;
3923
+ /** Stage name → how many cards may sit there at once. The mover is not counted. */
3924
+ limits?: Record<string, number>;
3925
+ /** Stage name → what happens when a card arrives: assign, notify, start a checklist. */
3926
+ on_entry?: Record<string, Record<string, unknown>>;
3927
+ moves_message?: string;
3928
+ requires_messages?: Record<string, string>;
3929
+ }
3930
+ /**
3931
+ * THE ONE PLACE A SCREEN DECIDES WHETHER A CARD LOOKS DRAGGABLE — and it decides on the
3932
+ * PERSON, not on the rules. Whether a particular move is allowed is
3933
+ * `pipelineTransitionRefusal`, which is the store's answer; whether this person may move
3934
+ * anything at all is their level on the record, which the read door already told us.
3935
+ *
3936
+ * Absent rather than dead: a viewer's card carries no drag handle at all, instead of one
3937
+ * that looks live and snaps back every time.
3938
+ */
3939
+ declare function mayDrag(level: string | null | undefined): boolean;
3940
+
3796
3941
  /**
3797
3942
  * A rule expression as `custom.rule_eval` ACTUALLY evaluates it — read off the
3798
3943
  * door's own body, not invented here. A leaf is the node's name carrying its
@@ -6077,4 +6222,4 @@ interface ConversationScopeContext {
6077
6222
  /** `About: Acme Industrial` — the chip a bound chat wears. */
6078
6223
  declare function scopeChip(scope: ConversationScope): string;
6079
6224
 
6080
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, 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, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, 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, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, memoryStore, mintClientKey, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
6225
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, 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, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineMissingField, 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 PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, 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, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
package/dist/index.d.ts CHANGED
@@ -3617,9 +3617,21 @@ interface FieldPatch {
3617
3617
  /** …or the one word every other caller reaches for (see `NewFieldDeclaration`). */
3618
3618
  type?: FieldTypeWord;
3619
3619
  /**
3620
- * FLD-2. The shape of the value. The door reads it ONLY inside its behaviour
3621
- * arm, so a patch that moves `multi` alone changes nothing — send the
3622
- * behaviour word with it.
3620
+ * FLD-2. The shape of the value — one, or several.
3621
+ *
3622
+ * This comment used to say that a patch moving `multi` ALONE changed nothing
3623
+ * and that the behaviour word had to be sent with it. That was true, and it
3624
+ * was a description of a silent failure rather than a contract: the door
3625
+ * answered "saved" and the column still held one. `custom.field_update` has
3626
+ * had a real settings arm for it since 2026-09-20 (matrx-frontend
3627
+ * `migrations/campaign/fix7b_field_multi_arm.sql`), which also moves a
3628
+ * relation's `relation_max` beside it — `custom.validate_values` counts links
3629
+ * against that number, so moving `multi` without it would tick a box and
3630
+ * still refuse the second record.
3631
+ *
3632
+ * A CHOICE LIST IS THE ONE EXCEPTION, and it is refused by name rather than
3633
+ * ignored: for `select` / `multi_select`, "one answer or several" IS the
3634
+ * parity type, so send the type instead.
3623
3635
  */
3624
3636
  multi?: boolean;
3625
3637
  /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */
@@ -3793,6 +3805,139 @@ interface EntityFieldRights {
3793
3805
  may_fill_in: boolean;
3794
3806
  }
3795
3807
 
3808
+ /** One stage of a board: the KEY the store keeps, and the LABEL a person reads. */
3809
+ interface PipelineStage {
3810
+ /** The option's stable key — what a cell holds, and what a move is written with. */
3811
+ key: string;
3812
+ /** What the column heading says. Renaming a stage rewrites no record. */
3813
+ label: string;
3814
+ /** A retired choice can still be READ on a record that holds it; it cannot be picked anew. */
3815
+ retired: boolean;
3816
+ }
3817
+ /** What each Rule of a pipeline is about. Closed, and the store is the authority. */
3818
+ declare const PIPELINE_RULE_KINDS: readonly ["moves", "requires", "who", "limit", "entry"];
3819
+ type PipelineRuleKind = (typeof PIPELINE_RULE_KINDS)[number];
3820
+ /**
3821
+ * One transition Rule, as `custom.pipeline_read` hands it back — WITH the sentence it says
3822
+ * when it refuses, because a screen that knows a rule exists but not what it refuses in
3823
+ * cannot warn anybody before they drag.
3824
+ */
3825
+ interface PipelineRule {
3826
+ id: Uuid;
3827
+ name: string;
3828
+ /** The exact words a person is shown when this Rule stops a move. */
3829
+ message: string;
3830
+ kind: PipelineRuleKind | null;
3831
+ /** The stage this Rule is about; `null` on the one Rule about the moves themselves. */
3832
+ stage: string | null;
3833
+ uses: string[];
3834
+ /** What happens when a card ARRIVES in this stage — assign, notify, start a checklist. */
3835
+ on_entry: Record<string, unknown> | null;
3836
+ version: number;
3837
+ }
3838
+ /** The whole board's definition, from `custom.pipeline_read`. */
3839
+ interface Pipeline {
3840
+ is_pipeline: boolean;
3841
+ /** Present, and it says what would make a board exist, when `is_pipeline` is false. */
3842
+ why?: string;
3843
+ table_id?: Uuid;
3844
+ /** The Field KEY that holds the stage — the twin of a Table's `type_field`. */
3845
+ stage_field?: string;
3846
+ field_id?: Uuid;
3847
+ /** What that column is called, e.g. "Stage". */
3848
+ stage_label?: string;
3849
+ /** In the order they were declared, which is the order the board draws them. */
3850
+ stages?: PipelineStage[];
3851
+ rules?: PipelineRule[];
3852
+ }
3853
+ /** One column of the board, with the store's own numbers over what this person may see. */
3854
+ interface PipelineColumn {
3855
+ stage_key: string;
3856
+ stage_label: string;
3857
+ /** 1-based, the declared order. */
3858
+ stage_position: number;
3859
+ cards: number;
3860
+ /** The total of the chosen measure, or null when no measure was asked for. */
3861
+ total: number | null;
3862
+ /** How many cards this column takes at once, or null when it takes any number. */
3863
+ wip_limit: number | null;
3864
+ /** True when the column already holds MORE than its limit — a state a board must show. */
3865
+ over_limit: boolean;
3866
+ }
3867
+ /** One column this stage demands before a card may land in it. */
3868
+ interface PipelineMissingField {
3869
+ field_id: Uuid;
3870
+ key: string;
3871
+ /** What the column is called, so a screen can ASK for it rather than only refuse. */
3872
+ label: string;
3873
+ }
3874
+ /**
3875
+ * Whether a card may go to a column, answered BEFORE the finger lets go — by the same
3876
+ * Rules, through the same evaluator, on the document the move WOULD produce.
3877
+ *
3878
+ * A board greys a column, and snaps a card back, from this. It never decides for itself.
3879
+ */
3880
+ interface PipelineVerdict {
3881
+ allowed: boolean;
3882
+ is_pipeline: boolean;
3883
+ /** The stage key the move was asked about. */
3884
+ to?: string;
3885
+ /** The store's own sentence — shown verbatim, never paraphrased by a screen. */
3886
+ why: string;
3887
+ rule?: string;
3888
+ rule_id?: Uuid;
3889
+ rule_version?: number;
3890
+ kind?: PipelineRuleKind;
3891
+ /**
3892
+ * When a stage demands columns that are empty, exactly which ones — so the screen can
3893
+ * prompt for them on entry instead of sending the person away to find them.
3894
+ */
3895
+ missing?: PipelineMissingField[];
3896
+ }
3897
+ /** What `custom.pipeline_declare` says it made or changed. */
3898
+ interface PipelineDeclared {
3899
+ table_id: Uuid;
3900
+ stage_field: string;
3901
+ field_id: Uuid;
3902
+ stages: string[];
3903
+ rules: Record<string, Uuid>;
3904
+ /** Plain sentences naming each thing this declaration wrote. */
3905
+ said: string[];
3906
+ }
3907
+ /** The declaration a person (or an agent) writes. Everything is optional but the stages. */
3908
+ interface PipelineSpec {
3909
+ stage_field: {
3910
+ key: string;
3911
+ label?: string;
3912
+ options?: string[];
3913
+ sort?: number;
3914
+ };
3915
+ transitions?: {
3916
+ from: string;
3917
+ to: string;
3918
+ }[];
3919
+ /** Stage name → the column keys that must be filled in to land there. */
3920
+ requires?: Record<string, string[]>;
3921
+ /** Stage name → the rung somebody needs on the record to move a card INTO it. */
3922
+ who?: Record<string, "viewer" | "commenter" | "editor" | "admin">;
3923
+ /** Stage name → how many cards may sit there at once. The mover is not counted. */
3924
+ limits?: Record<string, number>;
3925
+ /** Stage name → what happens when a card arrives: assign, notify, start a checklist. */
3926
+ on_entry?: Record<string, Record<string, unknown>>;
3927
+ moves_message?: string;
3928
+ requires_messages?: Record<string, string>;
3929
+ }
3930
+ /**
3931
+ * THE ONE PLACE A SCREEN DECIDES WHETHER A CARD LOOKS DRAGGABLE — and it decides on the
3932
+ * PERSON, not on the rules. Whether a particular move is allowed is
3933
+ * `pipelineTransitionRefusal`, which is the store's answer; whether this person may move
3934
+ * anything at all is their level on the record, which the read door already told us.
3935
+ *
3936
+ * Absent rather than dead: a viewer's card carries no drag handle at all, instead of one
3937
+ * that looks live and snaps back every time.
3938
+ */
3939
+ declare function mayDrag(level: string | null | undefined): boolean;
3940
+
3796
3941
  /**
3797
3942
  * A rule expression as `custom.rule_eval` ACTUALLY evaluates it — read off the
3798
3943
  * door's own body, not invented here. A leaf is the node's name carrying its
@@ -6077,4 +6222,4 @@ interface ConversationScopeContext {
6077
6222
  /** `About: Acme Industrial` — the chip a bound chat wears. */
6078
6223
  declare function scopeChip(scope: ConversationScope): string;
6079
6224
 
6080
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, 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, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, 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, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, memoryStore, mintClientKey, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
6225
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, 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, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineMissingField, 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 PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, 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, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, scopeChip };
package/dist/index.js CHANGED
@@ -124,6 +124,12 @@ function looksLikeAnId(value) {
124
124
  return typeof value === "string" && UUID.test(value);
125
125
  }
126
126
 
127
+ // src/pipeline.ts
128
+ var PIPELINE_RULE_KINDS = ["moves", "requires", "who", "limit", "entry"];
129
+ function mayDrag(level) {
130
+ return level === "editor" || level === "admin" || level === "owner";
131
+ }
132
+
127
133
  // src/rule.ts
128
134
  function publicFormPath(formId) {
129
135
  return `/f/${formId}`;
@@ -2121,6 +2127,7 @@ export {
2121
2127
  PARITY_FIELD_TYPES,
2122
2128
  PERMISSION_LEVELS,
2123
2129
  PER_VALUE_ACCESS_WORDS,
2130
+ PIPELINE_RULE_KINDS,
2124
2131
  REFUSALS_WORTH_REPEATING,
2125
2132
  RELATION_BINDINGS,
2126
2133
  RELATION_CARDINALITIES,
@@ -2150,6 +2157,7 @@ export {
2150
2157
  isRecordsErr,
2151
2158
  isTheChosen,
2152
2159
  looksLikeAnId,
2160
+ mayDrag,
2153
2161
  measureKey,
2154
2162
  memoryStore,
2155
2163
  mintClientKey,