@ai-matrx/records 0.76.17 → 0.77.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/app-table/index.cjs +81 -0
  3. package/dist/app-table/index.cjs.map +1 -1
  4. package/dist/app-table/index.d.cts +7 -7
  5. package/dist/app-table/index.d.ts +7 -7
  6. package/dist/app-table/index.js +81 -0
  7. package/dist/app-table/index.js.map +1 -1
  8. package/dist/{client-kVZ54twD.d.ts → client-BbzLb-sB.d.ts} +53 -5
  9. package/dist/{client-PaKP4Cnd.d.cts → client-BcGGEpNi.d.cts} +53 -5
  10. package/dist/core/index.cjs +93 -6
  11. package/dist/core/index.cjs.map +1 -1
  12. package/dist/core/index.d.cts +21 -11
  13. package/dist/core/index.d.ts +21 -11
  14. package/dist/core/index.js +93 -6
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/data/index.cjs +81 -0
  17. package/dist/data/index.cjs.map +1 -1
  18. package/dist/data/index.d.cts +6 -6
  19. package/dist/data/index.d.ts +6 -6
  20. package/dist/data/index.js +81 -0
  21. package/dist/data/index.js.map +1 -1
  22. package/dist/{declareTable-Bv4V8Bjm.d.cts → declareTable-COEPJpke.d.cts} +4 -4
  23. package/dist/{declareTable-4MK51nXs.d.ts → declareTable-Dxq0Aega.d.ts} +4 -4
  24. package/dist/{field-DkB6Nods.d.cts → field-BTW7h7Wh.d.cts} +1 -1
  25. package/dist/{field-cWRPTM3U.d.ts → field-D7I9yck6.d.ts} +1 -1
  26. package/dist/index.cjs +26 -6
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +7 -7
  29. package/dist/index.d.ts +7 -7
  30. package/dist/index.js +26 -6
  31. package/dist/index.js.map +1 -1
  32. package/dist/memory/index.cjs +31 -0
  33. package/dist/memory/index.cjs.map +1 -1
  34. package/dist/memory/index.d.cts +6 -6
  35. package/dist/memory/index.d.ts +6 -6
  36. package/dist/memory/index.js +31 -0
  37. package/dist/memory/index.js.map +1 -1
  38. package/dist/{ports-C2_pOWrL.d.ts → ports-CaYEF1dG.d.ts} +1 -1
  39. package/dist/{ports-C83nhjoM.d.cts → ports-PpvsH1cQ.d.cts} +1 -1
  40. package/dist/react/index.cjs +93 -6
  41. package/dist/react/index.cjs.map +1 -1
  42. package/dist/react/index.d.cts +325 -15
  43. package/dist/react/index.d.ts +325 -15
  44. package/dist/react/index.js +93 -6
  45. package/dist/react/index.js.map +1 -1
  46. package/dist/realtime/index.d.cts +2 -2
  47. package/dist/realtime/index.d.ts +2 -2
  48. package/dist/{record-DVtXK-6L.d.cts → record-B7iwye2k.d.cts} +75 -13
  49. package/dist/{record-DVtXK-6L.d.ts → record-B7iwye2k.d.ts} +75 -13
  50. package/dist/{subscription-BJgDMerQ.d.cts → subscription-BWaRPLyo.d.ts} +67 -3
  51. package/dist/{subscription-D8OHY3kw.d.ts → subscription-Br30ZwIt.d.cts} +67 -3
  52. package/dist/{table-kind-BtguhnRV.d.cts → table-kind-C5jsmotR.d.ts} +140 -4
  53. package/dist/{table-kind-DzyRtFNa.d.ts → table-kind-DrVhYZbX.d.cts} +140 -4
  54. package/dist/templates/index.cjs +27 -3
  55. package/dist/templates/index.cjs.map +1 -1
  56. package/dist/templates/index.d.cts +11 -11
  57. package/dist/templates/index.d.ts +11 -11
  58. package/dist/templates/index.js +27 -3
  59. package/dist/templates/index.js.map +1 -1
  60. package/dist/{types-C6gdqgsI.d.ts → types-DWZ5_3by.d.ts} +2 -2
  61. package/dist/{types-DWoJFBbr.d.cts → types-DYoWzHwJ.d.cts} +2 -2
  62. package/dist/{types-DqCWKOYh.d.ts → types-DrJLOqVi.d.ts} +2 -2
  63. package/dist/{types-Mx-Wzm_d.d.cts → types-LvxsZ6Zv.d.cts} +2 -2
  64. package/dist/use-cases/index.cjs.map +1 -1
  65. package/dist/use-cases/index.d.cts +5 -5
  66. package/dist/use-cases/index.d.ts +5 -5
  67. package/dist/use-cases/index.js.map +1 -1
  68. package/dist/{validate-CEE0ts9g.d.cts → validate-CRdXE73G.d.cts} +1 -1
  69. package/dist/{validate-d9QMYjBm.d.ts → validate-j0WQoC3C.d.ts} +1 -1
  70. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
- import { m as ReadRow, f as Timestamp, U as Uuid, g as RecordDocument, d as RelationFlavor, O as OnDelete, al as RelationBinding, e as RelationCardinality, h as RecordsResult, q as StoredRecord, v as ParityFieldType, T as TableType, a as TableDisplay, S as StorageMode, aw as TableOrigin, R as RecordsError } from './record-DVtXK-6L.cjs';
2
- import { b as RecordsDataSource } from './ports-C83nhjoM.cjs';
3
- import { b as Field } from './field-DkB6Nods.cjs';
1
+ import { m as ReadRow, f as Timestamp, U as Uuid, g as RecordDocument, d as RelationFlavor, O as OnDelete, al as RelationBinding, e as RelationCardinality, h as RecordsResult, q as StoredRecord, v as ParityFieldType, T as TableType, a as TableDisplay, S as StorageMode, aw as TableOrigin, R as RecordsError } from './record-B7iwye2k.js';
2
+ import { b as RecordsDataSource } from './ports-CaYEF1dG.js';
3
+ import { b as Field } from './field-D7I9yck6.js';
4
4
 
5
5
  /**
6
6
  * THE TWO LANES THE ARCHIVED-ITEMS LAW NAMES (Arman, 2026-09-09) — the same
@@ -3259,6 +3259,142 @@ interface FieldDrift {
3259
3259
  */
3260
3260
  declare function parseFieldDrift(raw: unknown): FieldDrift[] | null;
3261
3261
 
3262
+ /** A value an action writes: a literal, or a reference the store resolves at run time. */
3263
+ type AutomationValue = string | number | boolean | null | {
3264
+ from: Uuid;
3265
+ } | {
3266
+ now: true;
3267
+ } | {
3268
+ me: true;
3269
+ } | {
3270
+ clear: true;
3271
+ } | unknown[] | Record<string, unknown>;
3272
+ /** `{ [field id]: value }` — every key is a live Field of the table the step writes to. */
3273
+ type AutomationValues = Record<Uuid, AutomationValue>;
3274
+ /** A filter in the store's one rule shape; inside an `edit_rows.where`, `{ trigger: <field id> }` means that value on the triggering row. */
3275
+ type AutomationFilter = Record<string, unknown>;
3276
+ type AutomationTrigger = {
3277
+ on: "row_added";
3278
+ } | {
3279
+ on: "property_edited";
3280
+ field: Uuid;
3281
+ to?: unknown;
3282
+ } | {
3283
+ on: "form_answered";
3284
+ };
3285
+ type AutomationAction = {
3286
+ do: "set";
3287
+ values: AutomationValues;
3288
+ } | {
3289
+ do: "add_row";
3290
+ table_id: Uuid;
3291
+ values: AutomationValues;
3292
+ } | {
3293
+ do: "edit_rows";
3294
+ table_id: Uuid;
3295
+ where: AutomationFilter;
3296
+ values: AutomationValues;
3297
+ limit?: number;
3298
+ } | {
3299
+ do: "notify";
3300
+ to: {
3301
+ person: Uuid;
3302
+ } | {
3303
+ field: Uuid;
3304
+ } | {
3305
+ author: true;
3306
+ };
3307
+ text: string;
3308
+ } | {
3309
+ do: "webhook";
3310
+ url: string;
3311
+ } | {
3312
+ do: "agent";
3313
+ prompt: string;
3314
+ };
3315
+ interface AutomationSpec {
3316
+ name: string;
3317
+ trigger: AutomationTrigger;
3318
+ /** An optional filter on the triggering row. */
3319
+ condition?: AutomationFilter | null;
3320
+ actions: AutomationAction[];
3321
+ }
3322
+ /** `custom.automation_declare`: stored, or refused with one sentence per path (`trigger`, `actions.0.values.<field>` …). */
3323
+ type AutomationDeclared = {
3324
+ ok: true;
3325
+ automation_id: Uuid;
3326
+ table_id: Uuid;
3327
+ enabled: boolean;
3328
+ spec: AutomationSpec;
3329
+ } | {
3330
+ ok: false;
3331
+ _errors: Record<string, string>;
3332
+ };
3333
+ type AutomationRunStatus = "ran" | "failed" | "stopped" | "waiting";
3334
+ interface AutomationLastRun {
3335
+ run_id: Uuid;
3336
+ status: AutomationRunStatus;
3337
+ at: string;
3338
+ says: string | null;
3339
+ }
3340
+ interface AutomationItem {
3341
+ id: Uuid;
3342
+ name: string;
3343
+ spec: AutomationSpec;
3344
+ enabled: boolean;
3345
+ archived_at?: string | null;
3346
+ created_by?: Uuid | null;
3347
+ created_at?: string;
3348
+ updated_at?: string;
3349
+ last_run: AutomationLastRun | null;
3350
+ }
3351
+ interface AutomationList {
3352
+ table_id: Uuid;
3353
+ automations: AutomationItem[];
3354
+ }
3355
+ /** archive / restore / set_enabled. */
3356
+ interface AutomationFlipped {
3357
+ ok: true;
3358
+ automation_id: Uuid;
3359
+ table_id: Uuid;
3360
+ enabled: boolean;
3361
+ archived_at: string | null;
3362
+ }
3363
+ interface AutomationStep {
3364
+ n: number;
3365
+ do: AutomationAction["do"];
3366
+ status: "done" | "failed" | "waiting";
3367
+ /** The store's own words. */
3368
+ says: string;
3369
+ hint?: string | null;
3370
+ record_id?: Uuid;
3371
+ edited?: number;
3372
+ prompt?: string;
3373
+ }
3374
+ interface AutomationRun {
3375
+ run_id: Uuid;
3376
+ status: AutomationRunStatus;
3377
+ says: string | null;
3378
+ record_id: Uuid | null;
3379
+ trigger: {
3380
+ on: AutomationTrigger["on"];
3381
+ operation: string;
3382
+ via: string | null;
3383
+ changed_field_ids: Uuid[];
3384
+ } | null;
3385
+ steps: AutomationStep[];
3386
+ started_at: string | null;
3387
+ finished_at: string | null;
3388
+ ran_by: Uuid | null;
3389
+ at: string;
3390
+ }
3391
+ interface AutomationRuns {
3392
+ automation_id: Uuid;
3393
+ runs: AutomationRun[];
3394
+ /** Pass back as `cursor` for the next, older page; null at the end. */
3395
+ next_cursor: string | null;
3396
+ }
3397
+
3262
3398
  /** `custom.decoration_colors()` — the palette, in the order an uncolored choice takes. */
3263
3399
  type DecorationColor = "slate" | "green" | "amber" | "red" | "blue" | "violet" | "teal" | "orange" | "yellow" | "pink" | "brown" | "gray";
3264
3400
  /** `custom.decoration_rule_ops()` — the tests a color rule may ask. */
@@ -4139,4 +4275,4 @@ declare function tableJsonSchema(facts: TableKindFacts, mode: TableSchemaMode):
4139
4275
  */
4140
4276
  declare function tableRenderSchema(facts: TableKindFacts): TableRenderSchema;
4141
4277
 
4142
- export { type ImportOpened as $, type ArchiveLane as A, type EntityRecordsFound as B, type ChoiceNudge as C, type PipelineColumn as D, type EntityTableFacts as E, type FieldDrift as F, type PipelineVerdict as G, type PipelineMoveResult as H, type PipelineMoveManyItem as I, type PipelineMoveMany as J, type PipelineSpec as K, type PipelineDeclared as L, type MigrationUndone as M, type NewEntityFieldDeclaration as N, type StageRuleOnFail as O, type Pipeline as P, type StageRuleEnforcement as Q, type RelationCoordinate as R, type SourceArchived as S, type TableArchiveProgress as T, type StagePending as U, type StagePendingOnBoard as V, type PipelineGate as W, type PipelineGatePreview as X, type FormLookOptions as Y, type ImportPlan as Z, type ImportPolicy as _, type TableRestoreProgress as a, type WorkGraph as a$, type ImportColumnsDeclared as a0, type ImportBatchResult as a1, type ImportFinished as a2, type ImportReport as a3, type ImportRun as a4, type InboundDeclared as a5, type InboundAddress as a6, type PortalSummary as a7, type PortalArchiveFilter as a8, type PortalArchiveAnswer as a9, type DrillQuestion as aA, type DrillAnswer as aB, type DrillRowsPage as aC, type DocToken as aD, type DocUnresolvedToken as aE, type DocTemplateRow as aF, type DocRenderRow as aG, type DocSignatureRow as aH, type RecordHistoryEntry as aI, type RecordScopeContext as aJ, type ConversationScope as aK, type ConversationScopeContext as aL, type FieldHistoryEntry as aM, type RestorePreview as aN, type RestoreResult as aO, type CommentThreadRead as aP, type CommentWritten as aQ, type AnonTokenBinding as aR, type ChecklistSpec as aS, type ChecklistDeclared as aT, type ChecklistTemplateSummary as aU, type ChecklistTemplateShape as aV, type ChecklistRunStarted as aW, type ChecklistRunStep as aX, type ChecklistRunSummary as aY, type ChecklistStepCompleted as aZ, type WorkState as a_, type FormArchiveAnswer as aa, type ArchivedForm as ab, type ArchivedChecklistTemplate as ac, type TableRowDefaults as ad, type TableRowDefaultsPatch as ae, type RowDefaultsApplied as af, type RecordRowControls as ag, type PortalTableRef as ah, type PortalCard as ai, type PortalConfigInput as aj, type PortalFormSpec as ak, type PortalFormAnswer as al, type PortalInvitation as am, type PortalRevocation as an, type PortalPreviewRow as ao, type CaptureSheetSummary as ap, type CaptureSheetFace as aq, type CaptureFileRef as ar, type CaptureOutcome as as, type EnrichmentSummary as at, type EnrichDeclared as au, type EnrichDueRow as av, type EnrichCell as aw, type EnrichRun as ax, type DrillSource as ay, type DrillDefinition as az, type TableDuplicateProgress as b, DRILL_DESCRIPTION_MAX as b$, type WorkInstantiation as b0, type WorkTurn as b1, type WorkAssignmentField as b2, type WorkSlotHold as b3, type WorkInboxView as b4, type WorkInboxItem as b5, type InboxStateChange as b6, type InboxCounts as b7, type WorkListFlavour as b8, type WorkListItem as b9, type TableSyncResult as bA, type TableRowCount as bB, type RecordHeader as bC, type OutsideShareAnswer as bD, type ViewOrderSet as bE, type EntityRefWithWords as bF, ARCHIVE_LANES as bG, ARCHIVE_LANE_LABEL as bH, ARCHIVE_LANE_MEANS as bI, type ActionRefusal as bJ, type ArchivedDoorRow as bK, BUILT_KIND_WORD as bL, CHOICE_NUDGES as bM, type CaptureField as bN, type CaptureQuestion as bO, type ChecklistRequirement as bP, type ChecklistRequirementKind as bQ, type ChecklistRoleSpec as bR, type ChecklistStepSpec as bS, type ChecklistTrigger as bT, type ChecklistTriggerKind as bU, type ChoiceLike as bV, type ChoiceOption as bW, type CustomFieldTableType as bX, DEFAULT_ARCHIVE_LANE as bY, DEFAULT_PORTAL_ARCHIVE_FILTER as bZ, DRILL_CHART_TOKENS as b_, type WorkAssignment as ba, type WorkRecordState as bb, type WorkApprover as bc, type WorkChange as bd, type WorkApprovalFiled as be, type WorkApprovalDecision as bf, type WorkDecideManyItem as bg, type WorkDecideMany as bh, type ExternalPrincipalCard as bi, type PublishBinding as bj, type ResolvedPublishBinding as bk, type ResolvedPublishBindingKind as bl, type MyLevel as bm, type DecorationPath as bn, type TableDecorations as bo, type GridLayout as bp, type FormulaParse as bq, type RowAction as br, type ActionRunResult as bs, type RecordEvent as bt, type TableWebhookDeclared as bu, type TableWebhook as bv, type IoExportPage as bw, type TableListEntry as bx, type DataHomeTable as by, type TableSyncSpec as bz, type TableDuplicated as c, REVERSE_LINKS_PAGE_MAX as c$, DRILL_DOORS as c0, DRILL_SCHEMA as c1, type DecorationColor as c2, type DecorationRule as c3, type DecorationRuleOp as c4, type DecorationTarget as c5, type DocSignatureCheck as c6, type DrillAdHocOp as c7, type DrillAnswerRow as c8, type DrillChartToken as c9, type Home as cA, type ImportColumnPlan as cB, type ImportOutcome as cC, type ImportProposal as cD, PERMISSION_LEVELS as cE, PIPELINE_RULE_KINDS as cF, PORTAL_ACCENTS as cG, PORTAL_ARCHIVE_FILTERS as cH, type PermissionLevel as cI, type PipelineMissingField as cJ, type PipelineMoveManyResult as cK, type PipelineMoveVerdict as cL, type PipelineRule as cM, type PipelineRuleKind as cN, type PipelineStage as cO, type PortalAccent as cP, type PortalConfig as cQ, type PortalFooterLink as cR, type PortalFormInput as cS, type PortalFormRef as cT, type PortalPrincipal as cU, type PortalStage as cV, type PortalStyle as cW, type PortalStyleInput as cX, type PortalTableExposure as cY, type PublicPicture as cZ, type PublishBindingKind as c_, type DrillDeclaration as ca, type DrillDimension as cb, type DrillFinding as cc, type DrillGrain as cd, type DrillHaving as ce, type DrillLane as cf, type DrillMeasure as cg, type DrillMeasureOp as ch, type DrillMeasureWhereValue as ci, type DrillPath as cj, type DrillRecords as ck, type DrillView as cl, type EnrichAlternate as cm, type EnrichSource as cn, type Enrichment as co, type EntityBackLinkItem as cp, type EntityFieldValue as cq, type EntityRecordMatch as cr, type EntityRef as cs, type EntityReferenceKind as ct, type FieldDriftAspect as cu, type GridLayoutMode as cv, type GridRowHeight as cw, type HistoryActor as cx, type HistoryActorKind as cy, type HistoryChange as cz, type TableCopyInProgress as d, exportPageXlsx as d$, REVERSE_LINKS_RECORDS_PER_CALL as d0, ROW_WEB_NOT_READY as d1, type RecordChangeAction as d2, type RecordComment as d3, type RecordScopeComment as d4, type RecordScopeField as d5, type RecordScopeHistoryEntry as d6, type RecordScopeRelation as d7, type RecordScopeWithheld as d8, type RegisteredTable as d9, type WorkDecideManyResult as dA, type WorkDecideVerdict as dB, type WorkDueState as dC, type WorkInboxKind as dD, type WorkOrigin as dE, type WorkTemplateNode as dF, type WorkTemplateRelation as dG, actionRefusals as dH, archivedByLine as dI, archivedWhen as dJ, asChoiceNudge as dK, asPermissionLevel as dL, atLeast as dM, choiceSlug as dN, choiceValuesOf as dO, choicesOf as dP, decideTypedChoice as dQ, declareDrillDefinition as dR, drillAnswerOf as dS, drillFindingKnob as dT, emptyArchiveLine as dU, emptyPortalArchiveLine as dV, entityReferenceKinds as dW, entityReferenceSearch as dX, entityReferenceWords as dY, entityRefsOf as dZ, entityRefsToWrite as d_, type Relation as da, type RelationCarries as db, type RelationProperties as dc, type RelationTarget as dd, type RetypeBehaviour as de, type RetypePreview as df, type ReverseLink as dg, type RowActionStep as dh, SHOWN_TO_LABEL as di, SHOWN_TO_VALUES as dj, SHOWN_TO_WHO_MAY_CHANGE as dk, STAGE_RULE_ENFORCEMENT as dl, STAGE_RULE_ON_FAIL as dm, type ShownTo as dn, type StageRuleWarning as dp, TABLE_KIND_PREFIX as dq, type TableHomeDestination as dr, type TablePlacement as ds, type TablePlacementFact as dt, type TableRenderSchema as du, type TableSchemaMode as dv, type TableSyncSource as dw, type TypedChoiceDecision as dx, type ViewLayout as dy, type WorkApprovalState as dz, type ArchivedRow as e, fieldKindOf as e0, highestLevel as e1, holdsARetiredChoice as e2, isArchiveLane as e3, isFoundation as e4, isPortalAccent as e5, isPortalArchiveFilter as e6, isShownTo as e7, isTableKind as e8, isTheChosen as e9, rehomeSentence as eA, removedChoicesInUse as eB, ruleThatRefuses as eC, rulesWithTopStar as eD, sameDocument as eE, scopeChip as eF, sheetSyncSpec as eG, sourceArchivedOf as eH, tableIdOf as eI, tableJsonSchema as eJ, tableKindMapping as eK, tableKindSlug as eL, tableRenderSchema as eM, valueConverts as eN, withRowCounts as eO, withTablePlacement as eP, keptGroups as ea, keptOutOfSight as eb, keptTableHref as ec, looksLikeAnId as ed, mayDrag as ee, moveConsequence as ef, moveInOrder as eg, offeredAsContext as eh, optionKey as ei, optionLabel as ej, parseFieldDrift as ek, parseTableCopiesInProgress as el, parseTableDuplicateProgress as em, parseTableDuplicated as en, parseTableHome as eo, parseTableMoved as ep, portalArchiveConsequence as eq, portalConfirmLine as er, portalPath as es, portalTitleTypedBack as et, previewRetype as eu, previewRuleChange as ev, recordChangeTrigger as ew, recordSourceKey as ex, recordSourceTable as ey, recordsUseSentence as ez, type Table as f, type TableHome as g, type TableMoved as h, type ChoiceUsage as i, type ChoiceRehome as j, type ChoiceCellBack as k, type ChoicesRehomed as l, type TableCapacity as m, type FieldRetyped as n, type RecordsMerged as o, type RelationWordsManyArgs as p, type RelationIcons as q, type ReverseColumn as r, type ReverseLinksManyArgs as s, type ReverseLinks as t, type TableKindFacts as u, type EntityFieldsAcross as v, type EntityFieldRights as w, type EntityRecordRead as x, type EntityBackLinks as y, type EntityRowWritten as z };
4278
+ export { type ImportOpened as $, type ArchiveLane as A, type EntityRecordsFound as B, type ChoiceNudge as C, type PipelineColumn as D, type EntityTableFacts as E, type FieldDrift as F, type PipelineVerdict as G, type PipelineMoveResult as H, type PipelineMoveManyItem as I, type PipelineMoveMany as J, type PipelineSpec as K, type PipelineDeclared as L, type MigrationUndone as M, type NewEntityFieldDeclaration as N, type StageRuleOnFail as O, type Pipeline as P, type StageRuleEnforcement as Q, type RelationCoordinate as R, type SourceArchived as S, type TableArchiveProgress as T, type StagePending as U, type StagePendingOnBoard as V, type PipelineGate as W, type PipelineGatePreview as X, type FormLookOptions as Y, type ImportPlan as Z, type ImportPolicy as _, type TableRestoreProgress as a, type WorkGraph as a$, type ImportColumnsDeclared as a0, type ImportBatchResult as a1, type ImportFinished as a2, type ImportReport as a3, type ImportRun as a4, type InboundDeclared as a5, type InboundAddress as a6, type PortalSummary as a7, type PortalArchiveFilter as a8, type PortalArchiveAnswer as a9, type DrillQuestion as aA, type DrillAnswer as aB, type DrillRowsPage as aC, type DocToken as aD, type DocUnresolvedToken as aE, type DocTemplateRow as aF, type DocRenderRow as aG, type DocSignatureRow as aH, type RecordHistoryEntry as aI, type RecordScopeContext as aJ, type ConversationScope as aK, type ConversationScopeContext as aL, type FieldHistoryEntry as aM, type RestorePreview as aN, type RestoreResult as aO, type CommentThreadRead as aP, type CommentWritten as aQ, type AnonTokenBinding as aR, type ChecklistSpec as aS, type ChecklistDeclared as aT, type ChecklistTemplateSummary as aU, type ChecklistTemplateShape as aV, type ChecklistRunStarted as aW, type ChecklistRunStep as aX, type ChecklistRunSummary as aY, type ChecklistStepCompleted as aZ, type WorkState as a_, type FormArchiveAnswer as aa, type ArchivedForm as ab, type ArchivedChecklistTemplate as ac, type TableRowDefaults as ad, type TableRowDefaultsPatch as ae, type RowDefaultsApplied as af, type RecordRowControls as ag, type PortalTableRef as ah, type PortalCard as ai, type PortalConfigInput as aj, type PortalFormSpec as ak, type PortalFormAnswer as al, type PortalInvitation as am, type PortalRevocation as an, type PortalPreviewRow as ao, type CaptureSheetSummary as ap, type CaptureSheetFace as aq, type CaptureFileRef as ar, type CaptureOutcome as as, type EnrichmentSummary as at, type EnrichDeclared as au, type EnrichDueRow as av, type EnrichCell as aw, type EnrichRun as ax, type DrillSource as ay, type DrillDefinition as az, type TableDuplicateProgress as b, CHOICE_NUDGES as b$, type WorkInstantiation as b0, type WorkTurn as b1, type WorkAssignmentField as b2, type WorkSlotHold as b3, type WorkInboxView as b4, type WorkInboxItem as b5, type InboxStateChange as b6, type InboxCounts as b7, type WorkListFlavour as b8, type WorkListItem as b9, type TableWebhook as bA, type IoExportPage as bB, type TableListEntry as bC, type DataHomeTable as bD, type TableSyncSpec as bE, type TableSyncResult as bF, type TableRowCount as bG, type RecordHeader as bH, type OutsideShareAnswer as bI, type ViewOrderSet as bJ, type EntityRefWithWords as bK, ARCHIVE_LANES as bL, ARCHIVE_LANE_LABEL as bM, ARCHIVE_LANE_MEANS as bN, type ActionRefusal as bO, type ArchivedDoorRow as bP, type AutomationAction as bQ, type AutomationFilter as bR, type AutomationItem as bS, type AutomationLastRun as bT, type AutomationRun as bU, type AutomationRunStatus as bV, type AutomationStep as bW, type AutomationTrigger as bX, type AutomationValue as bY, type AutomationValues as bZ, BUILT_KIND_WORD as b_, type WorkAssignment as ba, type WorkRecordState as bb, type WorkApprover as bc, type WorkChange as bd, type WorkApprovalFiled as be, type WorkApprovalDecision as bf, type WorkDecideManyItem as bg, type WorkDecideMany as bh, type ExternalPrincipalCard as bi, type PublishBinding as bj, type ResolvedPublishBinding as bk, type ResolvedPublishBindingKind as bl, type MyLevel as bm, type DecorationPath as bn, type TableDecorations as bo, type GridLayout as bp, type FormulaParse as bq, type RowAction as br, type ActionRunResult as bs, type AutomationSpec as bt, type AutomationDeclared as bu, type AutomationList as bv, type AutomationFlipped as bw, type AutomationRuns as bx, type RecordEvent as by, type TableWebhookDeclared as bz, type TableDuplicated as c, type PipelineRule as c$, type CaptureField as c0, type CaptureQuestion as c1, type ChecklistRequirement as c2, type ChecklistRequirementKind as c3, type ChecklistRoleSpec as c4, type ChecklistStepSpec as c5, type ChecklistTrigger as c6, type ChecklistTriggerKind as c7, type ChoiceLike as c8, type ChoiceOption as c9, type DrillView as cA, type EnrichAlternate as cB, type EnrichSource as cC, type Enrichment as cD, type EntityBackLinkItem as cE, type EntityFieldValue as cF, type EntityRecordMatch as cG, type EntityRef as cH, type EntityReferenceKind as cI, type FieldDriftAspect as cJ, type GridLayoutMode as cK, type GridRowHeight as cL, type HistoryActor as cM, type HistoryActorKind as cN, type HistoryChange as cO, type Home as cP, type ImportColumnPlan as cQ, type ImportOutcome as cR, type ImportProposal as cS, PERMISSION_LEVELS as cT, PIPELINE_RULE_KINDS as cU, PORTAL_ACCENTS as cV, PORTAL_ARCHIVE_FILTERS as cW, type PermissionLevel as cX, type PipelineMissingField as cY, type PipelineMoveManyResult as cZ, type PipelineMoveVerdict as c_, type CustomFieldTableType as ca, DEFAULT_ARCHIVE_LANE as cb, DEFAULT_PORTAL_ARCHIVE_FILTER as cc, DRILL_CHART_TOKENS as cd, DRILL_DESCRIPTION_MAX as ce, DRILL_DOORS as cf, DRILL_SCHEMA as cg, type DecorationColor as ch, type DecorationRule as ci, type DecorationRuleOp as cj, type DecorationTarget as ck, type DocSignatureCheck as cl, type DrillAdHocOp as cm, type DrillAnswerRow as cn, type DrillChartToken as co, type DrillDeclaration as cp, type DrillDimension as cq, type DrillFinding as cr, type DrillGrain as cs, type DrillHaving as ct, type DrillLane as cu, type DrillMeasure as cv, type DrillMeasureOp as cw, type DrillMeasureWhereValue as cx, type DrillPath as cy, type DrillRecords as cz, type TableCopyInProgress as d, atLeast as d$, type PipelineRuleKind as d0, type PipelineStage as d1, type PortalAccent as d2, type PortalConfig as d3, type PortalFooterLink as d4, type PortalFormInput as d5, type PortalFormRef as d6, type PortalPrincipal as d7, type PortalStage as d8, type PortalStyle as d9, SHOWN_TO_WHO_MAY_CHANGE as dA, STAGE_RULE_ENFORCEMENT as dB, STAGE_RULE_ON_FAIL as dC, type ShownTo as dD, type StageRuleWarning as dE, TABLE_KIND_PREFIX as dF, type TableHomeDestination as dG, type TablePlacement as dH, type TablePlacementFact as dI, type TableRenderSchema as dJ, type TableSchemaMode as dK, type TableSyncSource as dL, type TypedChoiceDecision as dM, type ViewLayout as dN, type WorkApprovalState as dO, type WorkDecideManyResult as dP, type WorkDecideVerdict as dQ, type WorkDueState as dR, type WorkInboxKind as dS, type WorkOrigin as dT, type WorkTemplateNode as dU, type WorkTemplateRelation as dV, actionRefusals as dW, archivedByLine as dX, archivedWhen as dY, asChoiceNudge as dZ, asPermissionLevel as d_, type PortalStyleInput as da, type PortalTableExposure as db, type PublicPicture as dc, type PublishBindingKind as dd, REVERSE_LINKS_PAGE_MAX as de, REVERSE_LINKS_RECORDS_PER_CALL as df, ROW_WEB_NOT_READY as dg, type RecordChangeAction as dh, type RecordComment as di, type RecordScopeComment as dj, type RecordScopeField as dk, type RecordScopeHistoryEntry as dl, type RecordScopeRelation as dm, type RecordScopeWithheld as dn, type RegisteredTable as dp, type Relation as dq, type RelationCarries as dr, type RelationProperties as ds, type RelationTarget as dt, type RetypeBehaviour as du, type RetypePreview as dv, type ReverseLink as dw, type RowActionStep as dx, SHOWN_TO_LABEL as dy, SHOWN_TO_VALUES as dz, type ArchivedRow as e, tableRenderSchema as e$, choiceSlug as e0, choiceValuesOf as e1, choicesOf as e2, decideTypedChoice as e3, declareDrillDefinition as e4, drillAnswerOf as e5, drillFindingKnob as e6, emptyArchiveLine as e7, emptyPortalArchiveLine as e8, entityReferenceKinds as e9, parseTableCopiesInProgress as eA, parseTableDuplicateProgress as eB, parseTableDuplicated as eC, parseTableHome as eD, parseTableMoved as eE, portalArchiveConsequence as eF, portalConfirmLine as eG, portalPath as eH, portalTitleTypedBack as eI, previewRetype as eJ, previewRuleChange as eK, recordChangeTrigger as eL, recordSourceKey as eM, recordSourceTable as eN, recordsUseSentence as eO, rehomeSentence as eP, removedChoicesInUse as eQ, ruleThatRefuses as eR, rulesWithTopStar as eS, sameDocument as eT, scopeChip as eU, sheetSyncSpec as eV, sourceArchivedOf as eW, tableIdOf as eX, tableJsonSchema as eY, tableKindMapping as eZ, tableKindSlug as e_, entityReferenceSearch as ea, entityReferenceWords as eb, entityRefsOf as ec, entityRefsToWrite as ed, exportPageXlsx as ee, fieldKindOf as ef, highestLevel as eg, holdsARetiredChoice as eh, isArchiveLane as ei, isFoundation as ej, isPortalAccent as ek, isPortalArchiveFilter as el, isShownTo as em, isTableKind as en, isTheChosen as eo, keptGroups as ep, keptOutOfSight as eq, keptTableHref as er, looksLikeAnId as es, mayDrag as et, moveConsequence as eu, moveInOrder as ev, offeredAsContext as ew, optionKey as ex, optionLabel as ey, parseFieldDrift as ez, type Table as f, valueConverts as f0, withRowCounts as f1, withTablePlacement as f2, type TableHome as g, type TableMoved as h, type ChoiceUsage as i, type ChoiceRehome as j, type ChoiceCellBack as k, type ChoicesRehomed as l, type TableCapacity as m, type FieldRetyped as n, type RecordsMerged as o, type RelationWordsManyArgs as p, type RelationIcons as q, type ReverseColumn as r, type ReverseLinksManyArgs as s, type ReverseLinks as t, type TableKindFacts as u, type EntityFieldsAcross as v, type EntityFieldRights as w, type EntityRecordRead as x, type EntityBackLinks as y, type EntityRowWritten as z };
@@ -1,6 +1,6 @@
1
- import { m as ReadRow, f as Timestamp, U as Uuid, g as RecordDocument, d as RelationFlavor, O as OnDelete, al as RelationBinding, e as RelationCardinality, h as RecordsResult, q as StoredRecord, v as ParityFieldType, T as TableType, a as TableDisplay, S as StorageMode, aw as TableOrigin, R as RecordsError } from './record-DVtXK-6L.js';
2
- import { b as RecordsDataSource } from './ports-C2_pOWrL.js';
3
- import { b as Field } from './field-cWRPTM3U.js';
1
+ import { m as ReadRow, f as Timestamp, U as Uuid, g as RecordDocument, d as RelationFlavor, O as OnDelete, al as RelationBinding, e as RelationCardinality, h as RecordsResult, q as StoredRecord, v as ParityFieldType, T as TableType, a as TableDisplay, S as StorageMode, aw as TableOrigin, R as RecordsError } from './record-B7iwye2k.cjs';
2
+ import { b as RecordsDataSource } from './ports-PpvsH1cQ.cjs';
3
+ import { b as Field } from './field-BTW7h7Wh.cjs';
4
4
 
5
5
  /**
6
6
  * THE TWO LANES THE ARCHIVED-ITEMS LAW NAMES (Arman, 2026-09-09) — the same
@@ -3259,6 +3259,142 @@ interface FieldDrift {
3259
3259
  */
3260
3260
  declare function parseFieldDrift(raw: unknown): FieldDrift[] | null;
3261
3261
 
3262
+ /** A value an action writes: a literal, or a reference the store resolves at run time. */
3263
+ type AutomationValue = string | number | boolean | null | {
3264
+ from: Uuid;
3265
+ } | {
3266
+ now: true;
3267
+ } | {
3268
+ me: true;
3269
+ } | {
3270
+ clear: true;
3271
+ } | unknown[] | Record<string, unknown>;
3272
+ /** `{ [field id]: value }` — every key is a live Field of the table the step writes to. */
3273
+ type AutomationValues = Record<Uuid, AutomationValue>;
3274
+ /** A filter in the store's one rule shape; inside an `edit_rows.where`, `{ trigger: <field id> }` means that value on the triggering row. */
3275
+ type AutomationFilter = Record<string, unknown>;
3276
+ type AutomationTrigger = {
3277
+ on: "row_added";
3278
+ } | {
3279
+ on: "property_edited";
3280
+ field: Uuid;
3281
+ to?: unknown;
3282
+ } | {
3283
+ on: "form_answered";
3284
+ };
3285
+ type AutomationAction = {
3286
+ do: "set";
3287
+ values: AutomationValues;
3288
+ } | {
3289
+ do: "add_row";
3290
+ table_id: Uuid;
3291
+ values: AutomationValues;
3292
+ } | {
3293
+ do: "edit_rows";
3294
+ table_id: Uuid;
3295
+ where: AutomationFilter;
3296
+ values: AutomationValues;
3297
+ limit?: number;
3298
+ } | {
3299
+ do: "notify";
3300
+ to: {
3301
+ person: Uuid;
3302
+ } | {
3303
+ field: Uuid;
3304
+ } | {
3305
+ author: true;
3306
+ };
3307
+ text: string;
3308
+ } | {
3309
+ do: "webhook";
3310
+ url: string;
3311
+ } | {
3312
+ do: "agent";
3313
+ prompt: string;
3314
+ };
3315
+ interface AutomationSpec {
3316
+ name: string;
3317
+ trigger: AutomationTrigger;
3318
+ /** An optional filter on the triggering row. */
3319
+ condition?: AutomationFilter | null;
3320
+ actions: AutomationAction[];
3321
+ }
3322
+ /** `custom.automation_declare`: stored, or refused with one sentence per path (`trigger`, `actions.0.values.<field>` …). */
3323
+ type AutomationDeclared = {
3324
+ ok: true;
3325
+ automation_id: Uuid;
3326
+ table_id: Uuid;
3327
+ enabled: boolean;
3328
+ spec: AutomationSpec;
3329
+ } | {
3330
+ ok: false;
3331
+ _errors: Record<string, string>;
3332
+ };
3333
+ type AutomationRunStatus = "ran" | "failed" | "stopped" | "waiting";
3334
+ interface AutomationLastRun {
3335
+ run_id: Uuid;
3336
+ status: AutomationRunStatus;
3337
+ at: string;
3338
+ says: string | null;
3339
+ }
3340
+ interface AutomationItem {
3341
+ id: Uuid;
3342
+ name: string;
3343
+ spec: AutomationSpec;
3344
+ enabled: boolean;
3345
+ archived_at?: string | null;
3346
+ created_by?: Uuid | null;
3347
+ created_at?: string;
3348
+ updated_at?: string;
3349
+ last_run: AutomationLastRun | null;
3350
+ }
3351
+ interface AutomationList {
3352
+ table_id: Uuid;
3353
+ automations: AutomationItem[];
3354
+ }
3355
+ /** archive / restore / set_enabled. */
3356
+ interface AutomationFlipped {
3357
+ ok: true;
3358
+ automation_id: Uuid;
3359
+ table_id: Uuid;
3360
+ enabled: boolean;
3361
+ archived_at: string | null;
3362
+ }
3363
+ interface AutomationStep {
3364
+ n: number;
3365
+ do: AutomationAction["do"];
3366
+ status: "done" | "failed" | "waiting";
3367
+ /** The store's own words. */
3368
+ says: string;
3369
+ hint?: string | null;
3370
+ record_id?: Uuid;
3371
+ edited?: number;
3372
+ prompt?: string;
3373
+ }
3374
+ interface AutomationRun {
3375
+ run_id: Uuid;
3376
+ status: AutomationRunStatus;
3377
+ says: string | null;
3378
+ record_id: Uuid | null;
3379
+ trigger: {
3380
+ on: AutomationTrigger["on"];
3381
+ operation: string;
3382
+ via: string | null;
3383
+ changed_field_ids: Uuid[];
3384
+ } | null;
3385
+ steps: AutomationStep[];
3386
+ started_at: string | null;
3387
+ finished_at: string | null;
3388
+ ran_by: Uuid | null;
3389
+ at: string;
3390
+ }
3391
+ interface AutomationRuns {
3392
+ automation_id: Uuid;
3393
+ runs: AutomationRun[];
3394
+ /** Pass back as `cursor` for the next, older page; null at the end. */
3395
+ next_cursor: string | null;
3396
+ }
3397
+
3262
3398
  /** `custom.decoration_colors()` — the palette, in the order an uncolored choice takes. */
3263
3399
  type DecorationColor = "slate" | "green" | "amber" | "red" | "blue" | "violet" | "teal" | "orange" | "yellow" | "pink" | "brown" | "gray";
3264
3400
  /** `custom.decoration_rule_ops()` — the tests a color rule may ask. */
@@ -4139,4 +4275,4 @@ declare function tableJsonSchema(facts: TableKindFacts, mode: TableSchemaMode):
4139
4275
  */
4140
4276
  declare function tableRenderSchema(facts: TableKindFacts): TableRenderSchema;
4141
4277
 
4142
- export { type ImportOpened as $, type ArchiveLane as A, type EntityRecordsFound as B, type ChoiceNudge as C, type PipelineColumn as D, type EntityTableFacts as E, type FieldDrift as F, type PipelineVerdict as G, type PipelineMoveResult as H, type PipelineMoveManyItem as I, type PipelineMoveMany as J, type PipelineSpec as K, type PipelineDeclared as L, type MigrationUndone as M, type NewEntityFieldDeclaration as N, type StageRuleOnFail as O, type Pipeline as P, type StageRuleEnforcement as Q, type RelationCoordinate as R, type SourceArchived as S, type TableArchiveProgress as T, type StagePending as U, type StagePendingOnBoard as V, type PipelineGate as W, type PipelineGatePreview as X, type FormLookOptions as Y, type ImportPlan as Z, type ImportPolicy as _, type TableRestoreProgress as a, type WorkGraph as a$, type ImportColumnsDeclared as a0, type ImportBatchResult as a1, type ImportFinished as a2, type ImportReport as a3, type ImportRun as a4, type InboundDeclared as a5, type InboundAddress as a6, type PortalSummary as a7, type PortalArchiveFilter as a8, type PortalArchiveAnswer as a9, type DrillQuestion as aA, type DrillAnswer as aB, type DrillRowsPage as aC, type DocToken as aD, type DocUnresolvedToken as aE, type DocTemplateRow as aF, type DocRenderRow as aG, type DocSignatureRow as aH, type RecordHistoryEntry as aI, type RecordScopeContext as aJ, type ConversationScope as aK, type ConversationScopeContext as aL, type FieldHistoryEntry as aM, type RestorePreview as aN, type RestoreResult as aO, type CommentThreadRead as aP, type CommentWritten as aQ, type AnonTokenBinding as aR, type ChecklistSpec as aS, type ChecklistDeclared as aT, type ChecklistTemplateSummary as aU, type ChecklistTemplateShape as aV, type ChecklistRunStarted as aW, type ChecklistRunStep as aX, type ChecklistRunSummary as aY, type ChecklistStepCompleted as aZ, type WorkState as a_, type FormArchiveAnswer as aa, type ArchivedForm as ab, type ArchivedChecklistTemplate as ac, type TableRowDefaults as ad, type TableRowDefaultsPatch as ae, type RowDefaultsApplied as af, type RecordRowControls as ag, type PortalTableRef as ah, type PortalCard as ai, type PortalConfigInput as aj, type PortalFormSpec as ak, type PortalFormAnswer as al, type PortalInvitation as am, type PortalRevocation as an, type PortalPreviewRow as ao, type CaptureSheetSummary as ap, type CaptureSheetFace as aq, type CaptureFileRef as ar, type CaptureOutcome as as, type EnrichmentSummary as at, type EnrichDeclared as au, type EnrichDueRow as av, type EnrichCell as aw, type EnrichRun as ax, type DrillSource as ay, type DrillDefinition as az, type TableDuplicateProgress as b, DRILL_DESCRIPTION_MAX as b$, type WorkInstantiation as b0, type WorkTurn as b1, type WorkAssignmentField as b2, type WorkSlotHold as b3, type WorkInboxView as b4, type WorkInboxItem as b5, type InboxStateChange as b6, type InboxCounts as b7, type WorkListFlavour as b8, type WorkListItem as b9, type TableSyncResult as bA, type TableRowCount as bB, type RecordHeader as bC, type OutsideShareAnswer as bD, type ViewOrderSet as bE, type EntityRefWithWords as bF, ARCHIVE_LANES as bG, ARCHIVE_LANE_LABEL as bH, ARCHIVE_LANE_MEANS as bI, type ActionRefusal as bJ, type ArchivedDoorRow as bK, BUILT_KIND_WORD as bL, CHOICE_NUDGES as bM, type CaptureField as bN, type CaptureQuestion as bO, type ChecklistRequirement as bP, type ChecklistRequirementKind as bQ, type ChecklistRoleSpec as bR, type ChecklistStepSpec as bS, type ChecklistTrigger as bT, type ChecklistTriggerKind as bU, type ChoiceLike as bV, type ChoiceOption as bW, type CustomFieldTableType as bX, DEFAULT_ARCHIVE_LANE as bY, DEFAULT_PORTAL_ARCHIVE_FILTER as bZ, DRILL_CHART_TOKENS as b_, type WorkAssignment as ba, type WorkRecordState as bb, type WorkApprover as bc, type WorkChange as bd, type WorkApprovalFiled as be, type WorkApprovalDecision as bf, type WorkDecideManyItem as bg, type WorkDecideMany as bh, type ExternalPrincipalCard as bi, type PublishBinding as bj, type ResolvedPublishBinding as bk, type ResolvedPublishBindingKind as bl, type MyLevel as bm, type DecorationPath as bn, type TableDecorations as bo, type GridLayout as bp, type FormulaParse as bq, type RowAction as br, type ActionRunResult as bs, type RecordEvent as bt, type TableWebhookDeclared as bu, type TableWebhook as bv, type IoExportPage as bw, type TableListEntry as bx, type DataHomeTable as by, type TableSyncSpec as bz, type TableDuplicated as c, REVERSE_LINKS_PAGE_MAX as c$, DRILL_DOORS as c0, DRILL_SCHEMA as c1, type DecorationColor as c2, type DecorationRule as c3, type DecorationRuleOp as c4, type DecorationTarget as c5, type DocSignatureCheck as c6, type DrillAdHocOp as c7, type DrillAnswerRow as c8, type DrillChartToken as c9, type Home as cA, type ImportColumnPlan as cB, type ImportOutcome as cC, type ImportProposal as cD, PERMISSION_LEVELS as cE, PIPELINE_RULE_KINDS as cF, PORTAL_ACCENTS as cG, PORTAL_ARCHIVE_FILTERS as cH, type PermissionLevel as cI, type PipelineMissingField as cJ, type PipelineMoveManyResult as cK, type PipelineMoveVerdict as cL, type PipelineRule as cM, type PipelineRuleKind as cN, type PipelineStage as cO, type PortalAccent as cP, type PortalConfig as cQ, type PortalFooterLink as cR, type PortalFormInput as cS, type PortalFormRef as cT, type PortalPrincipal as cU, type PortalStage as cV, type PortalStyle as cW, type PortalStyleInput as cX, type PortalTableExposure as cY, type PublicPicture as cZ, type PublishBindingKind as c_, type DrillDeclaration as ca, type DrillDimension as cb, type DrillFinding as cc, type DrillGrain as cd, type DrillHaving as ce, type DrillLane as cf, type DrillMeasure as cg, type DrillMeasureOp as ch, type DrillMeasureWhereValue as ci, type DrillPath as cj, type DrillRecords as ck, type DrillView as cl, type EnrichAlternate as cm, type EnrichSource as cn, type Enrichment as co, type EntityBackLinkItem as cp, type EntityFieldValue as cq, type EntityRecordMatch as cr, type EntityRef as cs, type EntityReferenceKind as ct, type FieldDriftAspect as cu, type GridLayoutMode as cv, type GridRowHeight as cw, type HistoryActor as cx, type HistoryActorKind as cy, type HistoryChange as cz, type TableCopyInProgress as d, exportPageXlsx as d$, REVERSE_LINKS_RECORDS_PER_CALL as d0, ROW_WEB_NOT_READY as d1, type RecordChangeAction as d2, type RecordComment as d3, type RecordScopeComment as d4, type RecordScopeField as d5, type RecordScopeHistoryEntry as d6, type RecordScopeRelation as d7, type RecordScopeWithheld as d8, type RegisteredTable as d9, type WorkDecideManyResult as dA, type WorkDecideVerdict as dB, type WorkDueState as dC, type WorkInboxKind as dD, type WorkOrigin as dE, type WorkTemplateNode as dF, type WorkTemplateRelation as dG, actionRefusals as dH, archivedByLine as dI, archivedWhen as dJ, asChoiceNudge as dK, asPermissionLevel as dL, atLeast as dM, choiceSlug as dN, choiceValuesOf as dO, choicesOf as dP, decideTypedChoice as dQ, declareDrillDefinition as dR, drillAnswerOf as dS, drillFindingKnob as dT, emptyArchiveLine as dU, emptyPortalArchiveLine as dV, entityReferenceKinds as dW, entityReferenceSearch as dX, entityReferenceWords as dY, entityRefsOf as dZ, entityRefsToWrite as d_, type Relation as da, type RelationCarries as db, type RelationProperties as dc, type RelationTarget as dd, type RetypeBehaviour as de, type RetypePreview as df, type ReverseLink as dg, type RowActionStep as dh, SHOWN_TO_LABEL as di, SHOWN_TO_VALUES as dj, SHOWN_TO_WHO_MAY_CHANGE as dk, STAGE_RULE_ENFORCEMENT as dl, STAGE_RULE_ON_FAIL as dm, type ShownTo as dn, type StageRuleWarning as dp, TABLE_KIND_PREFIX as dq, type TableHomeDestination as dr, type TablePlacement as ds, type TablePlacementFact as dt, type TableRenderSchema as du, type TableSchemaMode as dv, type TableSyncSource as dw, type TypedChoiceDecision as dx, type ViewLayout as dy, type WorkApprovalState as dz, type ArchivedRow as e, fieldKindOf as e0, highestLevel as e1, holdsARetiredChoice as e2, isArchiveLane as e3, isFoundation as e4, isPortalAccent as e5, isPortalArchiveFilter as e6, isShownTo as e7, isTableKind as e8, isTheChosen as e9, rehomeSentence as eA, removedChoicesInUse as eB, ruleThatRefuses as eC, rulesWithTopStar as eD, sameDocument as eE, scopeChip as eF, sheetSyncSpec as eG, sourceArchivedOf as eH, tableIdOf as eI, tableJsonSchema as eJ, tableKindMapping as eK, tableKindSlug as eL, tableRenderSchema as eM, valueConverts as eN, withRowCounts as eO, withTablePlacement as eP, keptGroups as ea, keptOutOfSight as eb, keptTableHref as ec, looksLikeAnId as ed, mayDrag as ee, moveConsequence as ef, moveInOrder as eg, offeredAsContext as eh, optionKey as ei, optionLabel as ej, parseFieldDrift as ek, parseTableCopiesInProgress as el, parseTableDuplicateProgress as em, parseTableDuplicated as en, parseTableHome as eo, parseTableMoved as ep, portalArchiveConsequence as eq, portalConfirmLine as er, portalPath as es, portalTitleTypedBack as et, previewRetype as eu, previewRuleChange as ev, recordChangeTrigger as ew, recordSourceKey as ex, recordSourceTable as ey, recordsUseSentence as ez, type Table as f, type TableHome as g, type TableMoved as h, type ChoiceUsage as i, type ChoiceRehome as j, type ChoiceCellBack as k, type ChoicesRehomed as l, type TableCapacity as m, type FieldRetyped as n, type RecordsMerged as o, type RelationWordsManyArgs as p, type RelationIcons as q, type ReverseColumn as r, type ReverseLinksManyArgs as s, type ReverseLinks as t, type TableKindFacts as u, type EntityFieldsAcross as v, type EntityFieldRights as w, type EntityRecordRead as x, type EntityBackLinks as y, type EntityRowWritten as z };
4278
+ export { type ImportOpened as $, type ArchiveLane as A, type EntityRecordsFound as B, type ChoiceNudge as C, type PipelineColumn as D, type EntityTableFacts as E, type FieldDrift as F, type PipelineVerdict as G, type PipelineMoveResult as H, type PipelineMoveManyItem as I, type PipelineMoveMany as J, type PipelineSpec as K, type PipelineDeclared as L, type MigrationUndone as M, type NewEntityFieldDeclaration as N, type StageRuleOnFail as O, type Pipeline as P, type StageRuleEnforcement as Q, type RelationCoordinate as R, type SourceArchived as S, type TableArchiveProgress as T, type StagePending as U, type StagePendingOnBoard as V, type PipelineGate as W, type PipelineGatePreview as X, type FormLookOptions as Y, type ImportPlan as Z, type ImportPolicy as _, type TableRestoreProgress as a, type WorkGraph as a$, type ImportColumnsDeclared as a0, type ImportBatchResult as a1, type ImportFinished as a2, type ImportReport as a3, type ImportRun as a4, type InboundDeclared as a5, type InboundAddress as a6, type PortalSummary as a7, type PortalArchiveFilter as a8, type PortalArchiveAnswer as a9, type DrillQuestion as aA, type DrillAnswer as aB, type DrillRowsPage as aC, type DocToken as aD, type DocUnresolvedToken as aE, type DocTemplateRow as aF, type DocRenderRow as aG, type DocSignatureRow as aH, type RecordHistoryEntry as aI, type RecordScopeContext as aJ, type ConversationScope as aK, type ConversationScopeContext as aL, type FieldHistoryEntry as aM, type RestorePreview as aN, type RestoreResult as aO, type CommentThreadRead as aP, type CommentWritten as aQ, type AnonTokenBinding as aR, type ChecklistSpec as aS, type ChecklistDeclared as aT, type ChecklistTemplateSummary as aU, type ChecklistTemplateShape as aV, type ChecklistRunStarted as aW, type ChecklistRunStep as aX, type ChecklistRunSummary as aY, type ChecklistStepCompleted as aZ, type WorkState as a_, type FormArchiveAnswer as aa, type ArchivedForm as ab, type ArchivedChecklistTemplate as ac, type TableRowDefaults as ad, type TableRowDefaultsPatch as ae, type RowDefaultsApplied as af, type RecordRowControls as ag, type PortalTableRef as ah, type PortalCard as ai, type PortalConfigInput as aj, type PortalFormSpec as ak, type PortalFormAnswer as al, type PortalInvitation as am, type PortalRevocation as an, type PortalPreviewRow as ao, type CaptureSheetSummary as ap, type CaptureSheetFace as aq, type CaptureFileRef as ar, type CaptureOutcome as as, type EnrichmentSummary as at, type EnrichDeclared as au, type EnrichDueRow as av, type EnrichCell as aw, type EnrichRun as ax, type DrillSource as ay, type DrillDefinition as az, type TableDuplicateProgress as b, CHOICE_NUDGES as b$, type WorkInstantiation as b0, type WorkTurn as b1, type WorkAssignmentField as b2, type WorkSlotHold as b3, type WorkInboxView as b4, type WorkInboxItem as b5, type InboxStateChange as b6, type InboxCounts as b7, type WorkListFlavour as b8, type WorkListItem as b9, type TableWebhook as bA, type IoExportPage as bB, type TableListEntry as bC, type DataHomeTable as bD, type TableSyncSpec as bE, type TableSyncResult as bF, type TableRowCount as bG, type RecordHeader as bH, type OutsideShareAnswer as bI, type ViewOrderSet as bJ, type EntityRefWithWords as bK, ARCHIVE_LANES as bL, ARCHIVE_LANE_LABEL as bM, ARCHIVE_LANE_MEANS as bN, type ActionRefusal as bO, type ArchivedDoorRow as bP, type AutomationAction as bQ, type AutomationFilter as bR, type AutomationItem as bS, type AutomationLastRun as bT, type AutomationRun as bU, type AutomationRunStatus as bV, type AutomationStep as bW, type AutomationTrigger as bX, type AutomationValue as bY, type AutomationValues as bZ, BUILT_KIND_WORD as b_, type WorkAssignment as ba, type WorkRecordState as bb, type WorkApprover as bc, type WorkChange as bd, type WorkApprovalFiled as be, type WorkApprovalDecision as bf, type WorkDecideManyItem as bg, type WorkDecideMany as bh, type ExternalPrincipalCard as bi, type PublishBinding as bj, type ResolvedPublishBinding as bk, type ResolvedPublishBindingKind as bl, type MyLevel as bm, type DecorationPath as bn, type TableDecorations as bo, type GridLayout as bp, type FormulaParse as bq, type RowAction as br, type ActionRunResult as bs, type AutomationSpec as bt, type AutomationDeclared as bu, type AutomationList as bv, type AutomationFlipped as bw, type AutomationRuns as bx, type RecordEvent as by, type TableWebhookDeclared as bz, type TableDuplicated as c, type PipelineRule as c$, type CaptureField as c0, type CaptureQuestion as c1, type ChecklistRequirement as c2, type ChecklistRequirementKind as c3, type ChecklistRoleSpec as c4, type ChecklistStepSpec as c5, type ChecklistTrigger as c6, type ChecklistTriggerKind as c7, type ChoiceLike as c8, type ChoiceOption as c9, type DrillView as cA, type EnrichAlternate as cB, type EnrichSource as cC, type Enrichment as cD, type EntityBackLinkItem as cE, type EntityFieldValue as cF, type EntityRecordMatch as cG, type EntityRef as cH, type EntityReferenceKind as cI, type FieldDriftAspect as cJ, type GridLayoutMode as cK, type GridRowHeight as cL, type HistoryActor as cM, type HistoryActorKind as cN, type HistoryChange as cO, type Home as cP, type ImportColumnPlan as cQ, type ImportOutcome as cR, type ImportProposal as cS, PERMISSION_LEVELS as cT, PIPELINE_RULE_KINDS as cU, PORTAL_ACCENTS as cV, PORTAL_ARCHIVE_FILTERS as cW, type PermissionLevel as cX, type PipelineMissingField as cY, type PipelineMoveManyResult as cZ, type PipelineMoveVerdict as c_, type CustomFieldTableType as ca, DEFAULT_ARCHIVE_LANE as cb, DEFAULT_PORTAL_ARCHIVE_FILTER as cc, DRILL_CHART_TOKENS as cd, DRILL_DESCRIPTION_MAX as ce, DRILL_DOORS as cf, DRILL_SCHEMA as cg, type DecorationColor as ch, type DecorationRule as ci, type DecorationRuleOp as cj, type DecorationTarget as ck, type DocSignatureCheck as cl, type DrillAdHocOp as cm, type DrillAnswerRow as cn, type DrillChartToken as co, type DrillDeclaration as cp, type DrillDimension as cq, type DrillFinding as cr, type DrillGrain as cs, type DrillHaving as ct, type DrillLane as cu, type DrillMeasure as cv, type DrillMeasureOp as cw, type DrillMeasureWhereValue as cx, type DrillPath as cy, type DrillRecords as cz, type TableCopyInProgress as d, atLeast as d$, type PipelineRuleKind as d0, type PipelineStage as d1, type PortalAccent as d2, type PortalConfig as d3, type PortalFooterLink as d4, type PortalFormInput as d5, type PortalFormRef as d6, type PortalPrincipal as d7, type PortalStage as d8, type PortalStyle as d9, SHOWN_TO_WHO_MAY_CHANGE as dA, STAGE_RULE_ENFORCEMENT as dB, STAGE_RULE_ON_FAIL as dC, type ShownTo as dD, type StageRuleWarning as dE, TABLE_KIND_PREFIX as dF, type TableHomeDestination as dG, type TablePlacement as dH, type TablePlacementFact as dI, type TableRenderSchema as dJ, type TableSchemaMode as dK, type TableSyncSource as dL, type TypedChoiceDecision as dM, type ViewLayout as dN, type WorkApprovalState as dO, type WorkDecideManyResult as dP, type WorkDecideVerdict as dQ, type WorkDueState as dR, type WorkInboxKind as dS, type WorkOrigin as dT, type WorkTemplateNode as dU, type WorkTemplateRelation as dV, actionRefusals as dW, archivedByLine as dX, archivedWhen as dY, asChoiceNudge as dZ, asPermissionLevel as d_, type PortalStyleInput as da, type PortalTableExposure as db, type PublicPicture as dc, type PublishBindingKind as dd, REVERSE_LINKS_PAGE_MAX as de, REVERSE_LINKS_RECORDS_PER_CALL as df, ROW_WEB_NOT_READY as dg, type RecordChangeAction as dh, type RecordComment as di, type RecordScopeComment as dj, type RecordScopeField as dk, type RecordScopeHistoryEntry as dl, type RecordScopeRelation as dm, type RecordScopeWithheld as dn, type RegisteredTable as dp, type Relation as dq, type RelationCarries as dr, type RelationProperties as ds, type RelationTarget as dt, type RetypeBehaviour as du, type RetypePreview as dv, type ReverseLink as dw, type RowActionStep as dx, SHOWN_TO_LABEL as dy, SHOWN_TO_VALUES as dz, type ArchivedRow as e, tableRenderSchema as e$, choiceSlug as e0, choiceValuesOf as e1, choicesOf as e2, decideTypedChoice as e3, declareDrillDefinition as e4, drillAnswerOf as e5, drillFindingKnob as e6, emptyArchiveLine as e7, emptyPortalArchiveLine as e8, entityReferenceKinds as e9, parseTableCopiesInProgress as eA, parseTableDuplicateProgress as eB, parseTableDuplicated as eC, parseTableHome as eD, parseTableMoved as eE, portalArchiveConsequence as eF, portalConfirmLine as eG, portalPath as eH, portalTitleTypedBack as eI, previewRetype as eJ, previewRuleChange as eK, recordChangeTrigger as eL, recordSourceKey as eM, recordSourceTable as eN, recordsUseSentence as eO, rehomeSentence as eP, removedChoicesInUse as eQ, ruleThatRefuses as eR, rulesWithTopStar as eS, sameDocument as eT, scopeChip as eU, sheetSyncSpec as eV, sourceArchivedOf as eW, tableIdOf as eX, tableJsonSchema as eY, tableKindMapping as eZ, tableKindSlug as e_, entityReferenceSearch as ea, entityReferenceWords as eb, entityRefsOf as ec, entityRefsToWrite as ed, exportPageXlsx as ee, fieldKindOf as ef, highestLevel as eg, holdsARetiredChoice as eh, isArchiveLane as ei, isFoundation as ej, isPortalAccent as ek, isPortalArchiveFilter as el, isShownTo as em, isTableKind as en, isTheChosen as eo, keptGroups as ep, keptOutOfSight as eq, keptTableHref as er, looksLikeAnId as es, mayDrag as et, moveConsequence as eu, moveInOrder as ev, offeredAsContext as ew, optionKey as ex, optionLabel as ey, parseFieldDrift as ez, type Table as f, valueConverts as f0, withRowCounts as f1, withTablePlacement as f2, type TableHome as g, type TableMoved as h, type ChoiceUsage as i, type ChoiceRehome as j, type ChoiceCellBack as k, type ChoicesRehomed as l, type TableCapacity as m, type FieldRetyped as n, type RecordsMerged as o, type RelationWordsManyArgs as p, type RelationIcons as q, type ReverseColumn as r, type ReverseLinksManyArgs as s, type ReverseLinks as t, type TableKindFacts as u, type EntityFieldsAcross as v, type EntityFieldRights as w, type EntityRecordRead as x, type EntityBackLinks as y, type EntityRowWritten as z };
@@ -810,6 +810,12 @@ var STORE_DOORS = [
810
810
  { name: "assert_public_reader_names_a_public_table", args: "p_organization_id uuid, p_table_id uuid, p_door text", returns: "void", security: "definer" },
811
811
  { name: "assert_scope_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "definer" },
812
812
  { name: "assert_store_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
813
+ { name: "automation_archive", args: "p_organization_id uuid, p_automation_id uuid", returns: "jsonb", security: "definer" },
814
+ { name: "automation_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb, p_automation_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
815
+ { name: "automation_restore", args: "p_organization_id uuid, p_automation_id uuid", returns: "jsonb", security: "definer" },
816
+ { name: "automation_runs", args: "p_automation_id uuid, p_limit integer DEFAULT 50, p_cursor timestamp with time zone DEFAULT NULL::timestamp with time zone, p_organization_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
817
+ { name: "automation_set_enabled", args: "p_organization_id uuid, p_automation_id uuid, p_enabled boolean", returns: "jsonb", security: "definer" },
818
+ { name: "automations", args: "p_table_id uuid, p_organization_id uuid DEFAULT NULL::uuid, p_include_archived boolean DEFAULT false", returns: "jsonb", security: "definer" },
813
819
  { name: "autonumber_backfill", args: "p_organization_id uuid, p_field_id uuid", returns: "jsonb", security: "definer" },
814
820
  { name: "barcode_symbologies", args: "", returns: "text[]", security: "invoker" },
815
821
  { name: "booking_cancel", args: "p_booking_ref text, p_origin text DEFAULT NULL::text", returns: "TABLE(booking_ref text, record_id uuid, slot_key text, state text, message text)", security: "definer" },
@@ -1056,13 +1062,18 @@ var STORE_DOORS = [
1056
1062
  { name: "form_look_options", args: "p_organization_id uuid, p_presentation jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
1057
1063
  { name: "form_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid", returns: "uuid", security: "invoker" },
1058
1064
  { name: "form_preview_asks", args: "p_organization_id uuid, p_table_id uuid, p_questions jsonb, p_values jsonb", returns: "TABLE(field_key text, asked boolean, decided boolean, said text)", security: "definer" },
1065
+ { name: "form_preview_route", args: "p_organization_id uuid, p_table_id uuid, p_questions jsonb, p_endings jsonb, p_values jsonb", returns: "jsonb", security: "definer" },
1059
1066
  { name: "form_public", args: "p_form_id uuid", returns: "TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, state text, message text)", security: "definer" },
1060
1067
  { name: "form_public_asks", args: "p_form_id uuid, p_values jsonb, p_secret text DEFAULT NULL::text, p_origin text DEFAULT NULL::text", returns: "TABLE(field_key text, asked boolean, decided boolean, said text)", security: "definer" },
1068
+ { name: "form_public_route", args: "p_form_id uuid, p_values jsonb", returns: "jsonb", security: "definer" },
1061
1069
  { name: "form_redirect_domains", args: "p_organization_id uuid", returns: "text[]", security: "invoker" },
1062
1070
  { name: "form_redirect_refusal", args: "p_organization_id uuid, p_url text", returns: "text", security: "invoker" },
1063
1071
  { name: "form_restore", args: "p_organization_id uuid, p_form_id uuid", returns: "jsonb", security: "definer" },
1072
+ { name: "form_results", args: "p_organization_id uuid, p_form_id uuid", returns: "jsonb", security: "definer" },
1064
1073
  { name: "form_slug", args: "p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid", returns: "text", security: "invoker" },
1065
1074
  { name: "form_submit", args: "p_form_id uuid, p_origin text, p_payload jsonb, p_bucket text, p_honeypot text DEFAULT NULL::text, p_client_key text DEFAULT NULL::text", returns: "TABLE(submission_id uuid, record_id uuid, state text, message text)", security: "definer" },
1075
+ { name: "form_theme_options", args: "", returns: "jsonb", security: "invoker" },
1076
+ { name: "form_visit", args: "p_form_id uuid, p_visit text, p_event text, p_field text DEFAULT NULL::text", returns: "text", security: "definer" },
1066
1077
  { name: "forms", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(form_id uuid, table_id uuid, title text, slug text, published_at timestamp with time zone, closed_at timestamp with time zone, submission_cap integer, responses bigint, in_table bigint, held bigint, rejected bigint, state text, quarantine_rule_id uuid, notify_rule_id uuid, presentation jsonb)", security: "definer" },
1067
1078
  { name: "forms_archived", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100", returns: "TABLE(form_id uuid, table_id uuid, table_name text, kind text, title text, slug text, archived_at timestamp with time zone, archived_by uuid, table_archived boolean, can_restore boolean)", security: "definer" },
1068
1079
  { name: "formula_compile_sql", args: "p_organization_id uuid, p_expr jsonb, p_values_sql text", returns: "text", security: "invoker" },
@@ -1393,6 +1404,7 @@ var STORE_DOORS = [
1393
1404
  { name: "rollup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
1394
1405
  { name: "row_actions", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
1395
1406
  { name: "row_sits_in_a_personal_table", args: "p_type text, p_organization_id uuid, p_id uuid", returns: "boolean", security: "invoker" },
1407
+ { name: "row_template_bodies", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(template_id uuid, body jsonb)", security: "definer" },
1396
1408
  { name: "row_template_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
1397
1409
  { name: "row_templates", args: "p_organization_id uuid, p_table_id uuid", returns: 'TABLE(template_id uuid, name text, table_id uuid, "values" jsonb, created_at timestamp with time zone, updated_at timestamp with time zone)', security: "definer" },
1398
1410
  { name: "rule_applies", args: "p_organization_id uuid, p_rule_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
@@ -1519,6 +1531,8 @@ var STORE_DOORS = [
1519
1531
  { name: "table_stage_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
1520
1532
  { name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
1521
1533
  { name: "table_sync", args: "p_organization_id uuid, p_home_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
1534
+ { name: "table_template_declare", args: "p_org_id uuid, p_name text, p_description text, p_fields jsonb", returns: "uuid", security: "invoker" },
1535
+ { name: "table_templates", args: "p_org_id uuid", returns: "jsonb", security: "definer" },
1522
1536
  { name: "table_transfer_owner", args: "p_table_id uuid, p_to_person uuid, p_reason text", returns: "jsonb", security: "definer" },
1523
1537
  { name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
1524
1538
  { name: "table_unique_rule_fields", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "invoker" },
@@ -3079,6 +3093,12 @@ function storeAggregate(rows, measure, filter, timeZone) {
3079
3093
  if (op === "filled") return { ok: true, value: present.length, exact: true };
3080
3094
  if (op === "empty") return { ok: true, value: live.length - present.length, exact: true };
3081
3095
  if (op === "unique") return { ok: true, value: new Set(present).size, exact: true };
3096
+ if (op === "percent_empty" || op === "percent_filled") {
3097
+ if (!live.length) return { ok: true, value: null, exact: true };
3098
+ const share = q(100n * BigInt(op === "percent_filled" ? present.length : live.length - present.length), BigInt(live.length));
3099
+ const pct = qToNumber(share);
3100
+ return pct === null ? { ok: true, value: Number(share.n) / Number(share.d), exact: false } : { ok: true, value: pct, exact: true };
3101
+ }
3082
3102
  const nums = [];
3083
3103
  for (const t of present) {
3084
3104
  const v = parseNumeric(t);
@@ -3092,6 +3112,10 @@ function storeAggregate(rows, measure, filter, timeZone) {
3092
3112
  if (op === "avg") result = q(result.n, result.d * BigInt(nums.length));
3093
3113
  } else if (op === "min" || op === "max") {
3094
3114
  result = nums.reduce((a, b) => (op === "min" ? qCmp(b, a) < 0 : qCmp(b, a) > 0) ? b : a);
3115
+ } else if (op === "range") {
3116
+ const lo = nums.reduce((a, b) => qCmp(b, a) < 0 ? b : a);
3117
+ const hi = nums.reduce((a, b) => qCmp(b, a) > 0 ? b : a);
3118
+ result = qAdd(hi, q(-lo.n, lo.d));
3095
3119
  } else if (op === "median") {
3096
3120
  const s = [...nums].sort(qCmp);
3097
3121
  const mid = Math.floor(s.length / 2);
@@ -3128,7 +3152,7 @@ var TIME_BOUND_STAGE = /\b(?:no[- ]?show|completed?|done|seen|checked[- ]?in|arr
3128
3152
  var TERMINAL_STAGE = /^(?:cancell?ed|no[- ]?show|lost|closed[- ]lost|declined|closed|withdrawn|fell off|rejected|void(?:ed)?|skipped|missed)$/i;
3129
3153
  var CHART_BLOCK_KINDS = /* @__PURE__ */ new Set(["bar", "column", "line", "donut"]);
3130
3154
  var BUCKETS = ["year", "quarter", "month", "week", "day"];
3131
- var AGG_OPERATIONS = ["count", "sum", "avg", "min", "max", "median", "filled", "empty", "unique"];
3155
+ var AGG_OPERATIONS = ["count", "sum", "avg", "min", "max", "median", "filled", "empty", "unique", "percent_empty", "percent_filled", "range"];
3132
3156
  var MEASURE_KEY = /^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/;
3133
3157
  var STORE_LIST_RELATION_MAX = 25;
3134
3158
  function ruleBreak(field2, v) {
@@ -4143,7 +4167,7 @@ function validateTemplate(raw, options = {}) {
4143
4167
  if (!m.op || !AGG_OPERATIONS.includes(m.op) || m.op === "count") say(mat, `The measure "${m.key}" needs one of: ${AGG_OPERATIONS.filter((o) => o !== "count").join(", ")}.`);
4144
4168
  const of = m.of ? fieldOf(dim.table, m.of) : void 0;
4145
4169
  if (!of) say(mat, `The measure "${m.key}" reads "${m.of ?? "(nothing)"}", which is not a column of "${dim.table}".`);
4146
- else if (m.op && ["sum", "avg", "min", "max", "median"].includes(m.op) && !(isNumber(of) && !isComputed(of))) say(mat, isComputed(of) ? `"${m.of}" is worked out, and a dimension totals only a number that is typed in; total the stored columns it is made from.` : `"${m.of}" is not a number, so it cannot be added up or averaged.`);
4170
+ else if (m.op && ["sum", "avg", "min", "max", "median", "range"].includes(m.op) && !(isNumber(of) && !isComputed(of))) say(mat, isComputed(of) ? `"${m.of}" is worked out, and a dimension totals only a number that is typed in; total the stored columns it is made from.` : `"${m.of}" is not a number, so it cannot be added up or averaged.`);
4147
4171
  if (newMeasures.has(m.key)) say(mat, `Two measures are both called "${m.key}".`);
4148
4172
  newMeasures.add(m.key);
4149
4173
  });
@@ -4236,7 +4260,7 @@ function validateTemplate(raw, options = {}) {
4236
4260
  let honest = true;
4237
4261
  for (const m of b.measures ?? []) {
4238
4262
  const f = m.key ? fieldOf(table, m.key) : void 0;
4239
- if (f && ["sum", "avg", "min", "max", "median"].includes(m.op) && !isNumberish(table, f)) {
4263
+ if (f && (["sum", "avg", "min", "max", "median"].includes(m.op) || m.op === "range" && !isDate(f)) && !isNumberish(table, f)) {
4240
4264
  honest = false;
4241
4265
  say(`${at}.blocks[${bi}]`, `"${b.title}" takes the ${m.op} of "${f.label}", which is not a number.`);
4242
4266
  }