react-semaphor 0.1.545 → 0.1.546

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 (141) hide show
  1. package/dist/analytics-protocol/index.js +405 -442
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +100 -76
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.js +6 -6
  6. package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
  7. package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
  8. package/dist/chunks/{assistant-chat-D7sWTypJ.js → assistant-chat-BPXhulAx.js} +2826 -2595
  9. package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-C4vetoa0.js} +7 -8
  10. package/dist/chunks/column-catalog-BYnochWQ.js +3363 -0
  11. package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
  12. package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
  13. package/dist/chunks/custom-visual-inputs-CkJW9pBS.js +295 -0
  14. package/dist/chunks/{dashboard-B1tMju0u.js → dashboard-C3CoKbGY.js} +1 -1
  15. package/dist/chunks/dashboard-briefing-launcher-Be4h-7My.js +3734 -0
  16. package/dist/chunks/dashboard-controls-bxPrlSyp.js +2307 -0
  17. package/dist/chunks/{dashboard-json-CoYRPqxx.js → dashboard-json-BrjxIiRt.js} +5 -5
  18. package/dist/chunks/{document-dashboard-inputs-BesAHZvB.js → document-dashboard-inputs-CRVHpIHp.js} +872 -974
  19. package/dist/chunks/{edit-dashboard-visual-JPtNfJRb.js → edit-dashboard-visual-DYYYDjY6.js} +2361 -2447
  20. package/dist/chunks/{filter-value-text-ff7osJr7.js → filter-value-text-Ddf55Ku1.js} +9 -9
  21. package/dist/chunks/global-date-filter-utils-9d6m9-FE.js +11859 -0
  22. package/dist/chunks/index-CtoK1Lgu.js +586 -0
  23. package/dist/chunks/{index-DRWiuqyd.js → index-DkQkMKa1.js} +80 -79
  24. package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
  25. package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
  26. package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
  27. package/dist/chunks/{matrix-formatter-DnCyRXJE.js → matrix-formatter-DWEeC0_c.js} +44 -44
  28. package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
  30. package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
  31. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
  32. package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
  33. package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
  34. package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
  35. package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
  36. package/dist/chunks/{raw-temporal-presentation-C3mUgnEx.js → raw-temporal-presentation-CBzrDOjM.js} +8 -8
  37. package/dist/chunks/{report-preferences-dialog-DUtuUL_5.js → report-preferences-dialog-4QEZWe5U.js} +111 -112
  38. package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
  39. package/dist/chunks/resolve-dashboard-input-context-UpK_LBpL.js +5677 -0
  40. package/dist/chunks/{saved-dashboard-context-LrF_kW0l.js → saved-dashboard-context-D_I3Lxk0.js} +34 -34
  41. package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
  42. package/dist/chunks/{semaphor-ready-indicator-BxF96Yhv.js → semaphor-ready-indicator-4zpRHE-X.js} +45823 -47304
  43. package/dist/chunks/{shelf-drop-preview-context-CNaM_Gmh.js → shelf-drop-preview-context-Cfw7TRAx.js} +84 -84
  44. package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
  45. package/dist/chunks/{switch-uDtPgQlQ.js → switch-CEBOR4n7.js} +3 -3
  46. package/dist/chunks/{table-export-sheet-YzMioA7Y.js → table-export-sheet-4X9mAG3V.js} +1 -1
  47. package/dist/chunks/table-settings-CunhoDUi.js +605 -0
  48. package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
  49. package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-CjB7ig1o.js → use-create-flow-overlay-state-DZBZiiD-.js} +101 -101
  51. package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
  52. package/dist/chunks/{relative-date-label-Bk2j94pA.js → zoned-wall-clock-MulfA26h.js} +64 -21
  53. package/dist/dashboard/index.js +2 -2
  54. package/dist/dashboard-authoring/index.js +1802 -1149
  55. package/dist/data-app-sdk/index.js +6 -6
  56. package/dist/data-app-sdk-adapters/index.js +3 -3
  57. package/dist/data-app-sdk-validation/index.js +14 -14
  58. package/dist/format-utils/index.js +133 -133
  59. package/dist/index.js +192 -186
  60. package/dist/layouts/index.js +5 -242
  61. package/dist/report-runtime-context/index.js +2 -2
  62. package/dist/shared/index.js +4 -5
  63. package/dist/style.css +1 -1
  64. package/dist/surfboard/index.js +2 -2
  65. package/dist/types/components/index.d.ts +2 -0
  66. package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
  67. package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -0
  68. package/dist/types/index.js +6 -6
  69. package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
  70. package/dist/types/lib/charts/types.d.ts +2 -2
  71. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +6 -0
  72. package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +2 -0
  73. package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
  74. package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
  75. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +69 -0
  76. package/dist/types/lib/stores/dashboard-store.d.ts +125 -6
  77. package/dist/types/lib/types/common-types.d.ts +8 -0
  78. package/dist/types/lib/types/explorer-types.d.ts +10 -0
  79. package/dist/types/lib/types/semantic-types.d.ts +84 -0
  80. package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
  81. package/dist/types/lib/utils/card-type-change.d.ts +16 -0
  82. package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
  83. package/dist/types/lib/utils/field-placement.d.ts +96 -0
  84. package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
  85. package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
  86. package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
  87. package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
  88. package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
  89. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
  90. package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
  91. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -1
  92. package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
  93. package/dist/types/shared/assistant-protocol/context.d.ts +21 -21
  94. package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
  95. package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
  96. package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
  97. package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
  98. package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
  99. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
  100. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
  101. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
  102. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +43 -0
  103. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
  104. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +89 -0
  105. package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
  106. package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
  107. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +24 -14
  108. package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
  109. package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +26 -0
  110. package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
  111. package/dist/types/shared/dashboard-authoring/index.d.ts +18 -2
  112. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
  113. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
  114. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +94 -0
  115. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +78 -0
  116. package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
  117. package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
  118. package/dist/types/shared/layouts/engine/index.d.ts +4 -0
  119. package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
  120. package/dist/types/shared/layouts/engine/types.d.ts +125 -0
  121. package/dist/types/shared/layouts/index.d.ts +1 -2
  122. package/package.json +2 -2
  123. package/dist/chunks/apply-dashboard-operations-CZEMsx8E.js +0 -2080
  124. package/dist/chunks/calendar-day-equality-dvoQp1xW.js +0 -410
  125. package/dist/chunks/comparison-window-caption-D4E6IHPD.js +0 -1624
  126. package/dist/chunks/custom-visual-inputs-DLCD9Y5V.js +0 -329
  127. package/dist/chunks/dashboard-briefing-launcher-CePgIu0Z.js +0 -3720
  128. package/dist/chunks/dashboard-controls-Cq05n3e0.js +0 -2315
  129. package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
  130. package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
  131. package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
  132. package/dist/chunks/numeric-presentation-7X_IrD58.js +0 -5226
  133. package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +0 -9415
  134. package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
  135. package/dist/chunks/table-settings-CLZocegs.js +0 -501
  136. package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
  137. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +0 -46
  138. package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
  139. package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
  140. package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
  141. package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Problems and warnings for dashboard changes (MCP dashboard editing SPEC
3
+ * 3.2). One shape for both: a refusal lists problems, a proposal carries
4
+ * warnings. Messages are one sentence a person can read and never name the
5
+ * product; `fix` tells the agent what to do next.
6
+ */
7
+ export type ChangeProblemCode = 'invalid_change' | 'invalid_change_target' | 'copy_required' | 'not_permitted' | 'change_not_allowed_for_credential' | 'dashboard_not_found' | 'card_not_found' | 'filter_not_found' | 'sheet_not_found' | 'sheet_required' | 'sheet_not_a_grid' | 'field_not_found' | 'card_not_editable' | 'type_not_supported' | 'query_form_mismatch' | 'capability_required' | 'handle_unknown' | 'too_many_changes'
8
+ /** filter.update or filter.bind on a filter the outline marks read only. */
9
+ | 'filter_not_editable'
10
+ /** The changed dashboard fails the save's own validation (propose or apply). */
11
+ | 'document_invalid';
12
+ export type ChangeWarningCode =
13
+ /** In-scope cards the filter doesn't reach. */
14
+ 'filter_not_reaching_cards'
15
+ /** The compiled card stores the window as fixed dates. */
16
+ | 'window_saved_as_fixed_dates'
17
+ /** A type change leaves out fields or preferences. */
18
+ | 'type_change_drops'
19
+ /** A column's aggregate or time grain changed and its custom label was kept. */
20
+ | 'label_kept_after_change'
21
+ /** The change makes a library visual's card local to this dashboard. */
22
+ | 'detaches_linked_visual'
23
+ /** The change removes a level or measure a control is bound to: that control stops changing the card. */
24
+ | 'control_binding_dropped'
25
+ /** Apply only: saved, but the version control commit failed. */
26
+ | 'commit_failed'
27
+ /**
28
+ * Propose from the dashboard on screen (analytics agent Plan 1, D7-13): that
29
+ * dashboard already fails the save's own check, so the change wasn't
30
+ * checked against it; the person's Save reports what it finds.
31
+ */
32
+ | 'document_not_checked';
33
+ export type ChangeDiagnostic = {
34
+ code: ChangeProblemCode | ChangeWarningCode;
35
+ /** One sentence, safe to show an end user. */
36
+ message: string;
37
+ /** Where in the request, e.g. `changes[2].query.measures[0]`. */
38
+ path?: string;
39
+ /** What the agent should do next; may name tools. */
40
+ fix?: string;
41
+ /** E.g. `{ sheets }`, `{ available }`, `{ suggestedFields }`. */
42
+ details?: Record<string, unknown>;
43
+ };
@@ -0,0 +1,54 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { RelativeDateFilter } from '../../analytics-protocol/relative-date-filter.js';
3
+ import { CardType } from './card-types.js';
4
+ import { CardQuery, MatrixColumns, TimeWindow } from './dashboard-change.js';
5
+ /**
6
+ * A card's query in the public forms (MCP dashboard editing SPEC 3.5), or why
7
+ * it can't be changed through `card.update`. Conservative: anything the
8
+ * public query can't state, or that compiling the read query wouldn't
9
+ * reproduce, is `not_expressible`, with a short `detail`. `editable` answers
10
+ * only whether the card can be changed; whether it can be analyzed is
11
+ * `semaphor_analyze` `fromCard`'s question (DE-D29).
12
+ */
13
+ export type NotEditableReason = 'text' | 'document_section' | 'custom' | 'needs_sql_access'
14
+ /** A chart type outside the eight. */
15
+ | 'type_not_supported'
16
+ /** The card uses something the public query can't say; `detail` names it. */
17
+ | 'not_expressible';
18
+ export type OutlineCardSource = {
19
+ kind: 'semantic';
20
+ domainId: string;
21
+ datasetName: string;
22
+ } | {
23
+ kind: 'sql';
24
+ connectionId: string;
25
+ } | {
26
+ kind: 'physical';
27
+ connectionId: string;
28
+ tableName: string;
29
+ };
30
+ export type CardQueryRead = {
31
+ editable: true;
32
+ type: CardType;
33
+ query: CardQuery;
34
+ matrix?: MatrixColumns;
35
+ source: OutlineCardSource;
36
+ } | {
37
+ editable: false;
38
+ type: string;
39
+ reason: NotEditableReason;
40
+ message: string;
41
+ detail?: string;
42
+ source?: OutlineCardSource;
43
+ };
44
+ export declare function readCardQuery(card: TCard, viewer: {
45
+ sql: boolean;
46
+ }): CardQueryRead;
47
+ /**
48
+ * Where a card's data comes from, as the outline names it. SQL owns the result
49
+ * whenever the card has it, even beside config left from another mode: the
50
+ * execution owner's rule (`resolveDashboardCardResultOwner`).
51
+ */
52
+ export declare function readCardSource(card: TCard): OutlineCardSource | undefined;
53
+ /** A saved relative date as the public time window it was compiled from, or null when there isn't one. */
54
+ export declare function relativeToTimeWindow(meta: RelativeDateFilter): TimeWindow | null;
@@ -0,0 +1,89 @@
1
+ import { TDashboard } from '../../../lib/types/common-types.js';
2
+ import { DataSource, Field } from '../../../lib/types/explorer-types.js';
3
+ import { TChartType } from '../../../lib/charts/types.js';
4
+ import { CalendarContext } from '../../report-runtime-context/index.js';
5
+ import { DashboardOperation, OperationContext, OperationDescription } from '../operations/apply-dashboard-operations.js';
6
+ import { CardQueryPart } from './card-query-part.js';
7
+ import { FieldRef, MetricCardQuery, RecordsCardQuery } from './dashboard-change.js';
8
+ import { ChangeDiagnostic } from './diagnostics.js';
9
+ /**
10
+ * Public dashboard changes to resolved operations (MCP dashboard editing SPEC
11
+ * 3.7, DE-D48). Every rule the schema can't state lives here; everything that
12
+ * needs app state comes through `services` (S-INV-10). The result carries
13
+ * every id it assigned (DE-D39), proven by a dry run of the reducer
14
+ * (S-INV-11), with each added or changed card checked as saved (DE-D56).
15
+ */
16
+ export type CardSource = {
17
+ /** The catalog `changeCardType` and `buildFilterInputFromField` take. */
18
+ fields: readonly Field[];
19
+ dataSource?: DataSource;
20
+ connectionId: string;
21
+ connectionType?: string;
22
+ };
23
+ export type ChangeServices = {
24
+ /** The caller's capabilities; read only through `need`, which records each one relied on (DE-D60). */
25
+ capabilities: {
26
+ sql: boolean;
27
+ };
28
+ /**
29
+ * The report calendar filter defaults resolve in, with a fixed anchor: the
30
+ * propose instant (DE-D59). The app sets it, so the resolver never reads a
31
+ * clock (S-INV-10).
32
+ */
33
+ calendar: CalendarContext;
34
+ /** A measures or records query compiled into a card's query part (the app wraps `prepareGovernedCard`). */
35
+ compileCardQuery(request: {
36
+ query: MetricCardQuery | RecordsCardQuery;
37
+ chartType: TChartType;
38
+ }): Promise<{
39
+ ok: true;
40
+ part: CardQueryPart;
41
+ warnings: ChangeDiagnostic[];
42
+ } | {
43
+ ok: false;
44
+ problems: ChangeDiagnostic[];
45
+ }>;
46
+ /** A dataset's or connection's fields in the editor's catalog shape, or null when the caller can't use it. */
47
+ loadCardSource(ref: {
48
+ domainId: string;
49
+ datasetName: string;
50
+ } | {
51
+ connectionId: string;
52
+ }): Promise<CardSource | null>;
53
+ /** Fields on `toDataset` that the domain's relationships join to `field` on `fromDataset`. Never guessed from names. */
54
+ findRelationshipFields(input: {
55
+ domainId: string;
56
+ fromDataset: string;
57
+ field: string;
58
+ toDataset: string;
59
+ }): Promise<FieldRef[]>;
60
+ /** A new unique id (a UUID: Matrix ids must be UUIDs, ledger P1-04). */
61
+ newId(): string;
62
+ };
63
+ export type ChangeRef = {
64
+ ref: string;
65
+ kind: 'card' | 'filter';
66
+ id: string;
67
+ title: string;
68
+ changeIndex: number;
69
+ };
70
+ export type ChangeResolution = {
71
+ ok: true;
72
+ operations: DashboardOperation[];
73
+ /** The reducer context the operations were resolved with; stored with the proposal and reused at apply. */
74
+ context: OperationContext;
75
+ /** The dashboard after the operations, from a dry run of `applyDashboardOperations`. */
76
+ dashboard: TDashboard;
77
+ /** Handle or existing id to final id, in change order; a handle-less card.add gets $card_1, $card_2... */
78
+ refs: ChangeRef[];
79
+ descriptions: OperationDescription[];
80
+ /** Cards whose query part or type changed, and added cards, in change order: the preview runs the first five. */
81
+ changedCardIds: string[];
82
+ /** Every capability the resolution relied on (DE-D60). */
83
+ requires: Array<'sql'>;
84
+ warnings: ChangeDiagnostic[];
85
+ } | {
86
+ ok: false;
87
+ problems: ChangeDiagnostic[];
88
+ };
89
+ export declare function resolveDashboardChanges(dashboard: TDashboard, changes: readonly unknown[], services: ChangeServices): Promise<ChangeResolution>;
@@ -0,0 +1,32 @@
1
+ import { TDataColumn } from '../../lib/types/common-types.js';
2
+ import { DatabaseEntityReference, DataModelEntityReference, EntityColumnGroup, Field } from '../../lib/types/explorer-types.js';
3
+ /**
4
+ * The card editor's field catalog, built from the columns API's response
5
+ * (`/api/v1/columns`): one group per source, domain calculated fields first,
6
+ * flattened to `Field[]`. The editor's columns hook, the Matrix card catalog
7
+ * and the server's dashboard change services (MCP dashboard editing SPEC 6.2,
8
+ * `loadCardSource`) all build it here, so a field has the same id, label and
9
+ * metadata wherever it is read.
10
+ */
11
+ export type ColumnCatalogTarget = Pick<DatabaseEntityReference, 'name' | 'type' | 'database' | 'schema'> & Partial<Pick<DataModelEntityReference, 'id' | 'label' | 'description'>>;
12
+ /** One source's columns as `Field`s, in a group named for the source. */
13
+ export declare function buildEntityColumnGroup(target: ColumnCatalogTarget, responseColumns: TDataColumn[]): EntityColumnGroup;
14
+ /** A domain's calculated fields as catalog fields: the stable domain id, domain scope. */
15
+ export declare function domainCalculatedFields(fields: readonly Field[]): Field[];
16
+ /** Groups flattened to the editor's field list, every field labeled and placed in its group. */
17
+ export declare function flattenEntityColumns(entityGroups: EntityColumnGroup[]): Field[];
18
+ /** One columns API response for one source. */
19
+ export type ColumnCatalogEntry = {
20
+ target: ColumnCatalogTarget;
21
+ columns?: TDataColumn[];
22
+ calculatedFields?: Field[];
23
+ };
24
+ /**
25
+ * The editor's whole catalog for a card's sources: a group per source with
26
+ * columns, domain calculated fields (deduplicated by their stable id) in a
27
+ * group of their own first, then every field flattened.
28
+ */
29
+ export declare function buildColumnCatalog(entries: readonly ColumnCatalogEntry[]): {
30
+ columnGroups: EntityColumnGroup[];
31
+ columns: Field[];
32
+ };
@@ -1,11 +1,8 @@
1
1
  import { DashboardInput, DashboardInputScope, DashboardInputValues, TCard, TDashboard, TFilter } from '../../lib/types/index.js';
2
2
  import { TChartType } from '../../lib/charts/types.js';
3
3
  import { Field } from '../../lib/types/explorer-types.js';
4
- import { PersistedFrameLayouts } from '../layouts/create-frame-layouts.js';
5
4
  import { SemaphorAnalyticsIntent, SemaphorSourceRef } from '../analytics-protocol/index.js';
6
- export declare const DASHBOARD_AUTHORING_BREAKPOINTS: readonly ["lg", "md", "sm", "xs", "xxs"];
7
5
  export declare const DASHBOARD_AUTHORING_MAX_GENERATED_CARDS = 15;
8
- export type DashboardAuthoringBreakpoint = (typeof DASHBOARD_AUTHORING_BREAKPOINTS)[number];
9
6
  export type DashboardCardSizeIntent = 'kpi' | 'chart' | 'table' | 'text';
10
7
  export type DashboardPlanCard = {
11
8
  id: string;
@@ -103,59 +100,7 @@ export type DashboardAuthoringValidationResult = {
103
100
  errors: DashboardPlanWarning[];
104
101
  warnings: DashboardPlanWarning[];
105
102
  };
106
- export type DashboardChangeOperation = {
107
- kind: 'addCard';
108
- card: DashboardPlanCard;
109
- } | {
110
- kind: 'addFilterInput';
111
- input: DashboardPlanFilterInput;
112
- } | {
113
- kind: 'addCalculatedField';
114
- field: DashboardPlanCalculatedField;
115
- } | {
116
- kind: 'reuseCalculatedField';
117
- fieldId: string;
118
- scope: 'sheet' | 'dashboard' | 'domain';
119
- } | {
120
- kind: 'renameCard';
121
- cardId: string;
122
- title: string;
123
- description?: string;
124
- } | {
125
- kind: 'updateCardSelectionSettings';
126
- cardId: string;
127
- card: Pick<DashboardPlanCard, 'clickToFilter' | 'respondsToSelections'>;
128
- } | {
129
- kind: 'reorderCards';
130
- cardIds: string[];
131
- } | {
132
- kind: 'unsupported';
133
- requestedAction: string;
134
- reason: string;
135
- };
136
- export type DashboardChangePlan = {
137
- version: 1;
138
- id: string;
139
- dashboardId: string;
140
- title?: string;
141
- description?: string;
142
- datasets: SemaphorSourceRef[];
143
- operations: DashboardChangeOperation[];
144
- warnings?: DashboardPlanWarning[];
145
- unresolvedRequests?: string[];
146
- };
147
- export type DashboardChangeCompileResult = {
148
- dashboard: TDashboard;
149
- warnings: DashboardPlanWarning[];
150
- skippedOperations: DashboardPlanWarning[];
151
- };
152
103
  export type CompiledDashboardInputDefaults = {
153
104
  inputs: DashboardInput[];
154
105
  defaultInputValues?: DashboardInputValues;
155
106
  };
156
- export type DashboardLayoutCompileInput = {
157
- frameId: string;
158
- role: DashboardCardSizeIntent;
159
- priority: number;
160
- };
161
- export type DashboardLayoutCompileResult = PersistedFrameLayouts;
@@ -12,6 +12,16 @@ import { ControlBinding, ControlDefinition } from '../../lib/types/common-types.
12
12
  export declare function isPresentationCurrencyBinding(binding: ControlBinding): binding is Extract<ControlBinding, {
13
13
  target: 'presentation_currency';
14
14
  }>;
15
+ /**
16
+ * What a structural control replaces when it runs (the control executor's
17
+ * contract; semaphor-app `config-control-resolution.ts` applies it and its
18
+ * parity test holds it to this): a metric selector the measures, an
19
+ * aggregation every measure's aggregate, a field selector the grouping
20
+ * fields, a grain the grouped date's grain. A change to that part of a card
21
+ * wouldn't take effect.
22
+ */
23
+ export type StructuralControlOverride = 'measures' | 'measureAggregates' | 'groupingFields' | 'timeGrain';
24
+ export declare function structuralControlOverride(binding: ControlBinding): StructuralControlOverride | undefined;
15
25
  /** A binding that changes the query's structure (fields, metrics, aggregation, grain). */
16
26
  export declare function isStructuralControlBinding(binding: ControlBinding): binding is Exclude<ControlBinding, {
17
27
  target: 'sql_param' | 'presentation_currency';
@@ -194,9 +204,9 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
194
204
  showLabel?: boolean | undefined;
195
205
  toolbarWidth?: number | undefined;
196
206
  hidden?: boolean | undefined;
207
+ placement?: "toolbar" | "card_header" | "advanced" | undefined;
197
208
  locked?: boolean | undefined;
198
209
  helpText?: string | undefined;
199
- placement?: "toolbar" | "card_header" | "advanced" | undefined;
200
210
  }, {
201
211
  type: "number" | "boolean" | "date" | "text" | "enum" | "multi_enum" | "field_selector" | "metric_selector" | "aggregation_selector" | "grain_selector";
202
212
  id: string;
@@ -237,9 +247,9 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
237
247
  showLabel?: boolean | undefined;
238
248
  toolbarWidth?: number | undefined;
239
249
  hidden?: boolean | undefined;
250
+ placement?: "toolbar" | "card_header" | "advanced" | undefined;
240
251
  locked?: boolean | undefined;
241
252
  helpText?: string | undefined;
242
- placement?: "toolbar" | "card_header" | "advanced" | undefined;
243
253
  }>, {
244
254
  type: "number" | "boolean" | "date" | "text" | "enum" | "multi_enum" | "field_selector" | "metric_selector" | "aggregation_selector" | "grain_selector";
245
255
  id: string;
@@ -280,9 +290,9 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
280
290
  showLabel?: boolean | undefined;
281
291
  toolbarWidth?: number | undefined;
282
292
  hidden?: boolean | undefined;
293
+ placement?: "toolbar" | "card_header" | "advanced" | undefined;
283
294
  locked?: boolean | undefined;
284
295
  helpText?: string | undefined;
285
- placement?: "toolbar" | "card_header" | "advanced" | undefined;
286
296
  }, {
287
297
  type: "number" | "boolean" | "date" | "text" | "enum" | "multi_enum" | "field_selector" | "metric_selector" | "aggregation_selector" | "grain_selector";
288
298
  id: string;
@@ -323,9 +333,9 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
323
333
  showLabel?: boolean | undefined;
324
334
  toolbarWidth?: number | undefined;
325
335
  hidden?: boolean | undefined;
336
+ placement?: "toolbar" | "card_header" | "advanced" | undefined;
326
337
  locked?: boolean | undefined;
327
338
  helpText?: string | undefined;
328
- placement?: "toolbar" | "card_header" | "advanced" | undefined;
329
339
  }>;
330
340
  export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"target", [z.ZodObject<{
331
341
  controlId: z.ZodString;
@@ -333,12 +343,12 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
333
343
  paramId: z.ZodString;
334
344
  }, "strict", z.ZodTypeAny, {
335
345
  target: "sql_param";
336
- paramId: string;
337
346
  controlId: string;
347
+ paramId: string;
338
348
  }, {
339
349
  target: "sql_param";
340
- paramId: string;
341
350
  controlId: string;
351
+ paramId: string;
342
352
  }>, z.ZodObject<{
343
353
  controlId: z.ZodString;
344
354
  target: z.ZodLiteral<"config_metric_selector">;
@@ -858,6 +868,7 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
858
868
  }>>;
859
869
  }, "strict", z.ZodTypeAny, {
860
870
  target: "config_metric_selector";
871
+ controlId: string;
861
872
  mapping: Record<string, z.objectOutputType<{
862
873
  id: z.ZodString;
863
874
  name: z.ZodString;
@@ -933,10 +944,10 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
933
944
  id: string;
934
945
  kind: "matrix_instance";
935
946
  }>;
936
- controlId: string;
937
947
  matrixTargetId?: string | undefined;
938
948
  }, {
939
949
  target: "config_metric_selector";
950
+ controlId: string;
940
951
  mapping: Record<string, z.objectInputType<{
941
952
  id: z.ZodString;
942
953
  name: z.ZodString;
@@ -1012,7 +1023,6 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
1012
1023
  id: string;
1013
1024
  kind: "matrix_instance";
1014
1025
  }>;
1015
- controlId: string;
1016
1026
  matrixTargetId?: string | undefined;
1017
1027
  }>, z.ZodObject<{
1018
1028
  controlId: z.ZodString;
@@ -1526,6 +1536,7 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
1526
1536
  }>>;
1527
1537
  }, "strict", z.ZodTypeAny, {
1528
1538
  target: "config_field_selector";
1539
+ controlId: string;
1529
1540
  mapping: Record<string, z.objectOutputType<{
1530
1541
  id: z.ZodString;
1531
1542
  name: z.ZodString;
@@ -1600,10 +1611,10 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
1600
1611
  id: string;
1601
1612
  kind: "matrix_instance";
1602
1613
  }>;
1603
- controlId: string;
1604
1614
  matrixTargetId?: string | undefined;
1605
1615
  }, {
1606
1616
  target: "config_field_selector";
1617
+ controlId: string;
1607
1618
  mapping: Record<string, z.objectInputType<{
1608
1619
  id: z.ZodString;
1609
1620
  name: z.ZodString;
@@ -1678,7 +1689,6 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
1678
1689
  id: string;
1679
1690
  kind: "matrix_instance";
1680
1691
  }>;
1681
- controlId: string;
1682
1692
  matrixTargetId?: string | undefined;
1683
1693
  }>, z.ZodObject<{
1684
1694
  controlId: z.ZodString;
@@ -1687,13 +1697,13 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
1687
1697
  mapping: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
1688
1698
  }, "strict", z.ZodTypeAny, {
1689
1699
  target: "config_aggregation";
1690
- mapping: Record<string, string>;
1691
1700
  controlId: string;
1701
+ mapping: Record<string, string>;
1692
1702
  matrixTargetId?: string | undefined;
1693
1703
  }, {
1694
1704
  target: "config_aggregation";
1695
- mapping: Record<string, string>;
1696
1705
  controlId: string;
1706
+ mapping: Record<string, string>;
1697
1707
  matrixTargetId?: string | undefined;
1698
1708
  }>, z.ZodObject<{
1699
1709
  controlId: z.ZodString;
@@ -1702,13 +1712,13 @@ export declare const controlBindingExecutionSchema: z.ZodDiscriminatedUnion<"tar
1702
1712
  mapping: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>;
1703
1713
  }, "strict", z.ZodTypeAny, {
1704
1714
  target: "config_grain";
1705
- mapping: Record<string, string>;
1706
1715
  controlId: string;
1716
+ mapping: Record<string, string>;
1707
1717
  matrixTargetId?: string | undefined;
1708
1718
  }, {
1709
1719
  target: "config_grain";
1710
- mapping: Record<string, string>;
1711
1720
  controlId: string;
1721
+ mapping: Record<string, string>;
1712
1722
  matrixTargetId?: string | undefined;
1713
1723
  }>, z.ZodObject<{
1714
1724
  controlId: z.ZodString;
@@ -1,5 +1,5 @@
1
1
  import { TCard } from '../../lib/types/common-types.js';
2
- import { DataSource, DatabaseEntityReference } from '../../lib/types/explorer-types.js';
2
+ import { DataSource, DatabaseEntityReference, Field } from '../../lib/types/explorer-types.js';
3
3
  import { DashboardFilterTargetSource } from './dashboard-filter-mapping-types.js';
4
4
  export type DashboardCardFilterSourceInventory = {
5
5
  cardId: string;
@@ -24,6 +24,14 @@ export type DashboardSqlPinnedCatalogSource = {
24
24
  /** Physical SQL coordinate declared by the pinned entity, when available. */
25
25
  executionTable?: DashboardSqlExecutionTable;
26
26
  };
27
+ /**
28
+ * The one dataset of a card's data source a field reads, or undefined when it
29
+ * reads none or several: matched by the field's source, its dependencies'
30
+ * stable ids and names, and for physical tables the connection's own path
31
+ * levels. Every reader that places a field on a dataset asks here (the filter
32
+ * source index, the Matrix editor's catalog), whatever the connection.
33
+ */
34
+ export declare function resolveFieldSelectedSource(field: Field, dataSource: DataSource | undefined): DashboardFilterTargetSource | undefined;
27
35
  export declare function resolveDashboardEntitySource(entity: DatabaseEntityReference, dataSource: DataSource | undefined): DashboardFilterTargetSource | undefined;
28
36
  /**
29
37
  * Inventories config sources proven executable by the card and SQL sources
@@ -90,3 +90,29 @@ export declare function rewriteDashboardInputScopeIds(scope: DashboardInputScope
90
90
  export declare function isDashboardInputOwnedBySheet(scope: DashboardInputScope, sheetId: string, cardIds: ReadonlySet<string>): boolean;
91
91
  /** Whether a scope reaches nothing: an empty tab or card list (after ids are removed). */
92
92
  export declare function isDashboardInputScopeEmpty(scope: DashboardInputScope): boolean;
93
+ /** The cards a scope leaves out explicitly ("every card except"), in the order they were left out. */
94
+ export declare function listDashboardInputScopeExceptedCardIds(scope: DashboardInputScope): readonly string[];
95
+ /** The sheets an every-sheet scope leaves out ("all sheets except"); none for any other scope. */
96
+ export declare function listDashboardInputScopeExceptedSheetIds(scope: DashboardInputScope): readonly string[];
97
+ /**
98
+ * The scope with one card taken back in: off the "every card except" list.
99
+ * Unchanged when the scope doesn't leave the card out that way (a card on a
100
+ * sheet the scope leaves out stays out: that is a change of sheets).
101
+ */
102
+ export declare function withCardIncludedInScope(scope: DashboardInputScope, cardId: string): DashboardInputScope;
103
+ /**
104
+ * A new sheet scope with what the stored scope says that a change of sheets
105
+ * doesn't: the cards it leaves out and its Document-sheet reach. The change
106
+ * names only grid sheets, so Document ids must come from the saved scope.
107
+ */
108
+ export declare function withUnstatedScopeParts(stored: DashboardInputScope, next: DashboardInputScope, documentSheetIds: ReadonlySet<string>): DashboardInputScope;
109
+ /** Whether an every-sheet scope also covers Document sheets (no kinds named means every kind). */
110
+ export declare function dashboardInputScopeIncludesDocumentSheets(scope: DashboardInputScope): boolean;
111
+ /**
112
+ * The scope with one card left out: every reached tab except that card (a
113
+ * card added later is still reached), or the card list without it. A
114
+ * Document-section scope names sections, not cards, so it can't leave one
115
+ * out (undefined). Inputs that can't carry card mappings (Global Date) are
116
+ * excluded this way.
117
+ */
118
+ export declare function withCardExcludedFromScope(scope: DashboardInputScope, cardId: string): DashboardInputScope | undefined;
@@ -0,0 +1,75 @@
1
+ import { SemaphorSkippedConstraintReason } from '../analytics-protocol/index.js';
2
+ import { TFilterValue } from '../../components/surfboard/filter/types.js';
3
+ import { TCard } from '../../lib/types/common-types.js';
4
+ import { CardConfig, DataSource } from '../../lib/types/explorer-types.js';
5
+ /**
6
+ * Whether a dashboard filter's value applies to a card: the one rule (MCP
7
+ * dashboard editing ledger V-44). The query builder runs it on every filter
8
+ * value a card receives (semaphor-app build-query); the dashboard's filter
9
+ * mapping decision (`decideDashboardFilterCardTarget`) and every description
10
+ * of reach (the outline, reach warnings, the change resolver's effect check)
11
+ * read it too, so a filter reaches the same cards whether or not it has card
12
+ * mappings. Moved unchanged from semaphor-app
13
+ * `src/lib/analytics/query/filter-applicability.ts`, which re-exports it.
14
+ */
15
+ /** The protocol's skip reasons: evidence reports them as they are (D3b-4). */
16
+ export type FilterSkipReason = SemaphorSkippedConstraintReason;
17
+ export type SkippedFilter = {
18
+ filterId?: string;
19
+ name?: string;
20
+ reason: FilterSkipReason;
21
+ details?: string;
22
+ };
23
+ export declare function formatSkippedFilterWarnings(skipped: ReadonlyArray<{
24
+ filterId?: string;
25
+ name?: string;
26
+ reason: string;
27
+ }>): string[];
28
+ export type FilterApplicabilityResult = {
29
+ applicableFilters: TFilterValue[];
30
+ skippedFilters: SkippedFilter[];
31
+ };
32
+ export type FilterApplicabilityPhase = 'pre_join' | 'post_join';
33
+ export type FilterApplicabilityContext = {
34
+ cardDataSource?: DataSource | null;
35
+ targetQualifiedTableName?: string;
36
+ allowCalculated?: boolean;
37
+ additionalAllowedIdentifiers?: string[];
38
+ phase?: FilterApplicabilityPhase;
39
+ };
40
+ /** The same explicit join sources participate in early and final applicability. */
41
+ export declare function collectJoinPlanIdentifiers(joinPlan: CardConfig['joinPlan'] | null): string[];
42
+ /** Only for physical cards after structural completeness validation. Semantic
43
+ * cards need current catalog dependencies before deciding applicability. Keep
44
+ * unknown or partially overlapping predicates for the authoritative path. */
45
+ export declare function pruneUnrelatedCalculatedFilters(filters: TFilterValue[], context: FilterApplicabilityContext): FilterApplicabilityResult;
46
+ /**
47
+ * How the rule decides one filter value: applied with dataset proof, applied
48
+ * without it (no datasets to check against, a legacy unqualified name, a
49
+ * calculation with unknown dependencies), or skipped with a reason.
50
+ */
51
+ export type FilterApplicabilityDecision = {
52
+ kind: 'apply';
53
+ proven: boolean;
54
+ } | {
55
+ kind: 'skip';
56
+ reason: FilterSkipReason;
57
+ details?: string;
58
+ };
59
+ export declare function applyFilterApplicability(activeFilters: TFilterValue[] | undefined, context: FilterApplicabilityContext): FilterApplicabilityResult;
60
+ /**
61
+ * The applicability context of a card as the query builder runs it: the
62
+ * card's data source, its join plan's entities, and the join phase.
63
+ */
64
+ export declare function filterApplicabilityContextForCard(card: {
65
+ dataSource?: DataSource | null;
66
+ joinPlan?: CardConfig['joinPlan'] | null;
67
+ }): FilterApplicabilityContext;
68
+ /**
69
+ * Whether a filter value reaches a saved card, by the one rule: `reachable`
70
+ * when the card's data (the datasets it selects or joins) proves it takes the
71
+ * value's field, `unreachable` when the rule skips it, `unknown` when the rule
72
+ * keeps it without proof (nothing to check against, a legacy unqualified
73
+ * name, a calculation with unknown dependencies).
74
+ */
75
+ export declare function filterValueReachForCard(filterValue: TFilterValue, card: Pick<TCard, 'dataSource' | 'config'>): 'reachable' | 'unreachable' | 'unknown';
@@ -2,9 +2,7 @@ export * from './contracts.js';
2
2
  export * from './comparison-document-migration.js';
3
3
  export * from './source-matching.js';
4
4
  export * from './validators.js';
5
- export * from './layout-compiler.js';
6
5
  export * from './artifact-compiler.js';
7
- export * from './change-compiler.js';
8
6
  export * from './protocol-adapter.js';
9
7
  export * from './temporal-result-owner.js';
10
8
  export * from './temporal-bucket-authoring.js';
@@ -39,3 +37,21 @@ export { matrixCatalogSources, matrixExecutionSources } from './matrix-control-s
39
37
  export * from './dashboard-option-dependencies.js';
40
38
  export * from './new-card.js';
41
39
  export * from './operations/apply-dashboard-operations.js';
40
+ export * from './changes/card-types.js';
41
+ export * from './changes/diagnostics.js';
42
+ export * from './changes/card-query-part.js';
43
+ export * from './changes/read-card-query.js';
44
+ export * from './changes/dashboard-change.js';
45
+ export * from './changes/resolve-dashboard-changes.js';
46
+ export * from './outline/outline-filters.js';
47
+ export * from './outline/outline-dashboard.js';
48
+ export * from './column-catalog.js';
49
+ export { prepareLoadedDashboard } from '../../lib/dashboard-inputs/prepare-loaded-dashboard.js';
50
+ export { buildFilterInputFromField, buildFilterInputFromDefinition, applyFilterSettingsChange } from '../../lib/dashboard-inputs/filter-settings.js';
51
+ export type { FilterSettingsChange, FilterValueEffect } from '../../lib/dashboard-inputs/filter-settings.js';
52
+ export { describeDashboardFilterCardReach, type DashboardFilterCardReach } from '../../lib/query-context/dashboard-filter-mapping-resolution.js';
53
+ export { changeCardType, sharedCardPreferences, type CardTypeChange, type CardTypeChangeOptions, } from '../../lib/utils/card-type-change.js';
54
+ export { buildSavedEditorCard } from '../../lib/utils/build-saved-editor-card.js';
55
+ export { getCardDefinition, type AuthoredCardFields } from '../../lib/utils/card-definition.js';
56
+ export { changeMatrixEditor, dropMatrixEditorField, matrixEditorCatalogFromFields, } from '../../lib/matrix-table/matrix-editor.js';
57
+ export * from './filter-applicability.js';