react-semaphor 0.1.544 → 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.
- package/dist/analytics-protocol/index.js +405 -441
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +100 -76
- package/dist/brand-studio/index.js +5 -5
- package/dist/briefings/index.js +55 -52
- package/dist/chunks/{class-utils-Df1OVOT1.js → _commonjsHelpers-DimLPMtv.js} +124 -98
- package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
- package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
- package/dist/chunks/{assistant-chat-BNLkCDml.js → assistant-chat-BPXhulAx.js} +2792 -2562
- package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-C4vetoa0.js} +7 -8
- package/dist/chunks/column-catalog-BYnochWQ.js +3363 -0
- package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
- package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
- package/dist/chunks/custom-visual-inputs-CkJW9pBS.js +295 -0
- package/dist/chunks/{dashboard-g5a4DKWq.js → dashboard-C3CoKbGY.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-Be4h-7My.js +3734 -0
- package/dist/chunks/dashboard-controls-bxPrlSyp.js +2307 -0
- package/dist/chunks/{dashboard-json-7qT9jmfL.js → dashboard-json-BrjxIiRt.js} +6 -6
- package/dist/chunks/document-dashboard-inputs-CRVHpIHp.js +3010 -0
- package/dist/chunks/{edit-dashboard-visual-BfJwnRIZ.js → edit-dashboard-visual-DYYYDjY6.js} +5986 -6063
- package/dist/chunks/{filter-value-text-CYsVYPuD.js → filter-value-text-Ddf55Ku1.js} +8 -8
- package/dist/chunks/global-date-filter-utils-9d6m9-FE.js +11859 -0
- package/dist/chunks/index-CtoK1Lgu.js +586 -0
- package/dist/chunks/{index-DkAyQvC6.js → index-DkQkMKa1.js} +385 -339
- package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
- package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
- package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
- package/dist/chunks/{matrix-formatter-CxJLkztA.js → matrix-formatter-DWEeC0_c.js} +55 -55
- package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
- package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
- package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
- package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
- package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-CLiVi90c.js → raw-temporal-presentation-CBzrDOjM.js} +8 -8
- package/dist/chunks/rendered-file-D8xEuVVx.js +108 -0
- package/dist/chunks/{report-preferences-dialog-Df7VpRVW.js → report-preferences-dialog-4QEZWe5U.js} +637 -610
- package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-UpK_LBpL.js +5677 -0
- package/dist/chunks/{saved-dashboard-context-B-mQ--nV.js → saved-dashboard-context-D_I3Lxk0.js} +184 -212
- package/dist/chunks/selection-filter-compiler-BKXmyLrS.js +79 -0
- package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
- package/dist/chunks/{semaphor-ready-indicator-DDAxk8us.js → semaphor-ready-indicator-4zpRHE-X.js} +56832 -59068
- package/dist/chunks/{shelf-drop-preview-context-BSRPwaED.js → shelf-drop-preview-context-Cfw7TRAx.js} +890 -871
- package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
- package/dist/chunks/{switch-C3jLxlG0.js → switch-CEBOR4n7.js} +47 -48
- package/dist/chunks/{table-export-sheet-CPfGAQ9X.js → table-export-sheet-4X9mAG3V.js} +1 -1
- package/dist/chunks/table-settings-CunhoDUi.js +605 -0
- package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
- package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BxzFviM-.js → use-create-flow-overlay-state-DZBZiiD-.js} +83 -83
- package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1800 -1135
- package/dist/data-app-sdk/index.js +6 -6
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +14 -14
- package/dist/format-utils/index.js +198 -187
- package/dist/index.js +359 -325
- package/dist/layouts/index.js +5 -242
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/shared/index.js +4 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +33 -6
- package/dist/types/briefings/index.d.ts +6 -5
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
- package/dist/types/components/surfboard/filter/types.d.ts +0 -14
- package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -0
- package/dist/types/index.js +6 -6
- package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +68 -82
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +0 -8
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +41 -1
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +201 -0
- package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +7 -2
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +1 -1
- package/dist/types/lib/dashboard-viewer/captured-runtime-values.d.ts +40 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +16 -16
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +11 -9
- package/dist/types/lib/download-pdf.d.ts +75 -1
- package/dist/types/lib/hooks/use-date-filter.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +5 -0
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +5 -4
- package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
- package/dist/types/lib/query-context/assemble-card-query.d.ts +158 -0
- package/dist/types/lib/query-context/build-card-query-context.d.ts +3 -3
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +15 -6
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +11 -13
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +22 -12
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +69 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +159 -56
- package/dist/types/lib/stores/editor-store.d.ts +0 -3
- package/dist/types/lib/types/common-types.d.ts +29 -6
- package/dist/types/lib/types/explorer-types.d.ts +10 -0
- package/dist/types/lib/types/semantic-types.d.ts +84 -0
- package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
- package/dist/types/lib/utils/card-type-change.d.ts +16 -0
- package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
- package/dist/types/lib/utils/field-placement.d.ts +96 -0
- package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
- package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -12
- package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +21 -21
- package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
- package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
- package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
- package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
- package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +43 -0
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +89 -0
- package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +16 -6
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +118 -0
- package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
- package/dist/types/shared/dashboard-authoring/filter-model/ad-hoc-filter-values.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +29 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-values.d.ts +58 -0
- package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/filter-model/prototype-document-inputs.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +78 -0
- package/dist/types/shared/dashboard-authoring/filter-model/stored-dashboard.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/filter-model/toolbar-filter-reach.d.ts +23 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +20 -2
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +94 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +78 -0
- package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
- package/dist/types/shared/format-utils/exporters/index.d.ts +2 -0
- package/dist/types/shared/format-utils/exporters/rendered-file.d.ts +106 -0
- package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
- package/dist/types/shared/layouts/engine/index.d.ts +4 -0
- package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
- package/dist/types/shared/layouts/engine/types.d.ts +125 -0
- package/dist/types/shared/layouts/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +0 -28
- package/dist/chunks/apply-dashboard-operations-Bz4n1Lq6.js +0 -2260
- package/dist/chunks/calendar-day-equality-BmJAWduY.js +0 -460
- package/dist/chunks/comparison-window-caption-BTkrN3W4.js +0 -1623
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +0 -323
- package/dist/chunks/dashboard-briefing-launcher-DQ_8O_e2.js +0 -3725
- package/dist/chunks/dashboard-controls-8RyBTQUO.js +0 -2315
- package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
- package/dist/chunks/document-dashboard-inputs-BC6p-ESg.js +0 -8087
- package/dist/chunks/document-sheet-utils-Duo9uLoH.js +0 -3619
- package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
- package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
- package/dist/chunks/numeric-presentation-DESvLiu9.js +0 -5227
- package/dist/chunks/sort-target-MT1WK1vX.js +0 -29
- package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
- package/dist/chunks/table-settings-CLZocegs.js +0 -501
- package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +0 -88
- package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +0 -10
- package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
- package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
- package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
- 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';
|
|
@@ -193,8 +203,8 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
|
|
|
193
203
|
defaultValue?: unknown;
|
|
194
204
|
showLabel?: boolean | undefined;
|
|
195
205
|
toolbarWidth?: number | undefined;
|
|
196
|
-
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
197
206
|
hidden?: boolean | undefined;
|
|
207
|
+
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
198
208
|
locked?: boolean | undefined;
|
|
199
209
|
helpText?: string | undefined;
|
|
200
210
|
}, {
|
|
@@ -236,8 +246,8 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
|
|
|
236
246
|
defaultValue?: unknown;
|
|
237
247
|
showLabel?: boolean | undefined;
|
|
238
248
|
toolbarWidth?: number | undefined;
|
|
239
|
-
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
240
249
|
hidden?: boolean | undefined;
|
|
250
|
+
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
241
251
|
locked?: boolean | undefined;
|
|
242
252
|
helpText?: string | undefined;
|
|
243
253
|
}>, {
|
|
@@ -279,8 +289,8 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
|
|
|
279
289
|
defaultValue?: unknown;
|
|
280
290
|
showLabel?: boolean | undefined;
|
|
281
291
|
toolbarWidth?: number | undefined;
|
|
282
|
-
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
283
292
|
hidden?: boolean | undefined;
|
|
293
|
+
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
284
294
|
locked?: boolean | undefined;
|
|
285
295
|
helpText?: string | undefined;
|
|
286
296
|
}, {
|
|
@@ -322,8 +332,8 @@ export declare const controlDefinitionExecutionSchema: z.ZodEffects<z.ZodObject<
|
|
|
322
332
|
defaultValue?: unknown;
|
|
323
333
|
showLabel?: boolean | undefined;
|
|
324
334
|
toolbarWidth?: number | undefined;
|
|
325
|
-
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
326
335
|
hidden?: boolean | undefined;
|
|
336
|
+
placement?: "toolbar" | "card_header" | "advanced" | undefined;
|
|
327
337
|
locked?: boolean | undefined;
|
|
328
338
|
helpText?: string | undefined;
|
|
329
339
|
}>;
|
|
@@ -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">;
|
|
@@ -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
|
|
@@ -21,6 +21,13 @@ export type NormalizeDashboardInputsResult = {
|
|
|
21
21
|
inputs: NormalizedDashboardInput[];
|
|
22
22
|
issues: DashboardFilterMappingContractIssue[];
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* The one table of allowed scope and runtime-scope combinations (one filter
|
|
26
|
+
* model SPEC 4.2). A per-tab value lives on every tab the input is shown on
|
|
27
|
+
* (`isDashboardInputOnTab`), so a `cards` scope may keep per-tab values.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS: Readonly<Record<DashboardInput['runtimeScope'], ReadonlyArray<DashboardInput['scope']['kind']>>>;
|
|
30
|
+
export declare function isAllowedDashboardInputScopeCombination(runtimeScope: DashboardInput['runtimeScope'], scopeKind: DashboardInput['scope']['kind']): boolean;
|
|
24
31
|
export declare function normalizeDashboardInputs({ inputs, dashboardFilters, cards, validateCardTargets, }: {
|
|
25
32
|
inputs: DashboardInput[] | unknown;
|
|
26
33
|
dashboardFilters: TFilter[] | undefined;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { DashboardInputBase, DashboardInputScope, NormalizedDashboardInput, TDashboard } from '../../lib/types/common-types.js';
|
|
2
|
+
import { DashboardInputRuntimeTarget } from '../../lib/dashboard-inputs/dashboard-input-values.js';
|
|
3
|
+
/**
|
|
4
|
+
* The scope rule (one filter model M2): the one interpreter of
|
|
5
|
+
* `DashboardInputScope`. Filters, controls, click-to-filter targets and
|
|
6
|
+
* carried contexts all decide "does this reach that card" here, on the client
|
|
7
|
+
* and on the server.
|
|
8
|
+
*/
|
|
9
|
+
export type ScopedDashboardInputTarget = DashboardInputRuntimeTarget & {
|
|
10
|
+
sheetKind?: 'dashboard' | 'document';
|
|
11
|
+
};
|
|
12
|
+
/** One tab, for "is this input shown in this tab's filter bar". */
|
|
13
|
+
export type DashboardTabTarget = {
|
|
14
|
+
sheetId: string;
|
|
15
|
+
sheetKind: 'dashboard' | 'document';
|
|
16
|
+
/** Every card on the tab: sheet cards, frame cards, section cards. */
|
|
17
|
+
cardIds: ReadonlySet<string>;
|
|
18
|
+
};
|
|
19
|
+
/** Does the input apply to this card, section or tab? */
|
|
20
|
+
export declare function doesDashboardInputApplyToTarget(input: Pick<DashboardInputBase, 'scope' | 'compatibility'>, target: ScopedDashboardInputTarget): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Is the input shown in this tab's filter bar? True when it applies to the
|
|
23
|
+
* tab itself, or to any card on it (a `cards` scope), or, for a
|
|
24
|
+
* `documentSections` scope, when the tab is that Document tab. "The tabs of
|
|
25
|
+
* a per-tab input" always means the tabs where this holds.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isDashboardInputOnTab(input: Pick<DashboardInputBase, 'scope' | 'compatibility'>, tab: DashboardTabTarget): boolean;
|
|
28
|
+
/** The tab targets of a dashboard, by sheet id, memoized per dashboard object. */
|
|
29
|
+
export declare function listDashboardTabTargets(dashboard: Pick<TDashboard, 'sheets'>): ReadonlyMap<string, DashboardTabTarget>;
|
|
30
|
+
/**
|
|
31
|
+
* Every tab, card and Document section an input reaches, as keys
|
|
32
|
+
* (`sheet:<id>`, `card:<id>`, `section:<id>`). A section card is evaluated
|
|
33
|
+
* with its section, as the runtime resolves it. Two inputs overlap when their
|
|
34
|
+
* keys intersect: the one reach behind the overlap rules of filter settings
|
|
35
|
+
* and of the app's save validation (aliases, backing control ids).
|
|
36
|
+
*/
|
|
37
|
+
export declare function listDashboardInputReachKeys(dashboard: Pick<TDashboard, 'sheets'>, input: Pick<DashboardInputBase, 'scope' | 'compatibility'>): Set<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Whether a filter input still applies when a carried context turns the
|
|
40
|
+
* dashboard's own filters off (`resolveContextAwareFilterPolicy`): a filter
|
|
41
|
+
* scoped to specific cards does, a toolbar filter included, and so do the
|
|
42
|
+
* cards' inline filters, which are scoped to their card (SP-12). A mapping
|
|
43
|
+
* never changes the scope, so attaching one never changes survival. The one
|
|
44
|
+
* rule for the compiler, the mapping resolver, the required check and any
|
|
45
|
+
* reader that says which filters a view applies.
|
|
46
|
+
*/
|
|
47
|
+
export declare function doesDashboardInputSurviveCarriedContext(input: Pick<NormalizedDashboardInput, 'kind' | 'scope'>): boolean;
|
|
48
|
+
export type DashboardInputScopeIdChange = {
|
|
49
|
+
removedSheetIds?: ReadonlySet<string>;
|
|
50
|
+
removedCardIds?: ReadonlySet<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Ids given new ids: a card renamed in place, a library visual's ids on its
|
|
53
|
+
* dashboard instance, an authoring plan's ids on the cards it produced. An
|
|
54
|
+
* id the map does not list stays.
|
|
55
|
+
*/
|
|
56
|
+
renamedSheetIds?: ReadonlyMap<string, string>;
|
|
57
|
+
renamedCardIds?: ReadonlyMap<string, string>;
|
|
58
|
+
renamedSectionIds?: ReadonlyMap<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* `renamedCardIds` lists every card that is kept: a card id it does not
|
|
61
|
+
* list is removed (an authoring plan compiled into cards, some skipped).
|
|
62
|
+
*/
|
|
63
|
+
keepOnlyRenamedCardIds?: boolean;
|
|
64
|
+
copiedTab?: {
|
|
65
|
+
/**
|
|
66
|
+
* 'replace': a filter copied with the tab; every listed id of the copied
|
|
67
|
+
* tab and its cards becomes its copy's id. 'extend': a filter shared with
|
|
68
|
+
* the copy; every listed id stays and its copy's id is added next to it.
|
|
69
|
+
*/
|
|
70
|
+
mode: 'replace' | 'extend';
|
|
71
|
+
sheetIds: ReadonlyMap<string, string>;
|
|
72
|
+
cardIds: ReadonlyMap<string, string>;
|
|
73
|
+
sectionIds: ReadonlyMap<string, string>;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Rewrites the ids a scope names, in the positive lists and both except
|
|
78
|
+
* lists: after tabs or cards are removed, ids are renamed, or a tab is
|
|
79
|
+
* duplicated. The one rewrite of a scope's ids, for inputs and for click to
|
|
80
|
+
* filter targets alike. Lists may become empty; whether an input with an
|
|
81
|
+
* empty scope is kept is the caller's existing rule. Returns the same scope
|
|
82
|
+
* object when nothing changed.
|
|
83
|
+
*/
|
|
84
|
+
export declare function rewriteDashboardInputScopeIds(scope: DashboardInputScope, change: DashboardInputScopeIdChange): DashboardInputScope;
|
|
85
|
+
/**
|
|
86
|
+
* Whether a tab owns an input, so deleting the tab deletes it: its scope
|
|
87
|
+
* names only that tab, only cards on it, or its Document sections. Scope
|
|
88
|
+
* owns an input's lifetime; runtimeScope only owns its value slots.
|
|
89
|
+
*/
|
|
90
|
+
export declare function isDashboardInputOwnedBySheet(scope: DashboardInputScope, sheetId: string, cardIds: ReadonlySet<string>): boolean;
|
|
91
|
+
/** Whether a scope reaches nothing: an empty tab or card list (after ids are removed). */
|
|
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';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TFilterValue } from '../../../components/surfboard/filter/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether an ad-hoc value belongs to a tab: its id ends with the tab id. With
|
|
4
|
+
* no current tab, no ad-hoc value applies. The one owner of this rule (one
|
|
5
|
+
* filter model SPEC 5.8, P4a-02): the compile, the filter option lists, the
|
|
6
|
+
* summary request and the filter value list call it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isAdHocFilterValueOnTab(filterId: string, sheetId: string | null | undefined): boolean;
|
|
9
|
+
/** The ad-hoc values of one tab, in list order. */
|
|
10
|
+
export declare function listAdHocFilterValuesOnTab(adHocFilterValues: readonly TFilterValue[] | undefined, sheetId: string | null | undefined): TFilterValue[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TFilter } from '../../../components/surfboard/filter/types.js';
|
|
2
|
+
import { NormalizedFilterDashboardInput, TDashboard } from '../../../lib/types/common-types.js';
|
|
3
|
+
import { FilterInputEntry } from './read-dashboard-filter-model.js';
|
|
4
|
+
/** One definition per filter input, in model order. The same array for the same dashboard object. */
|
|
5
|
+
export declare function listDashboardFilterDefinitions(dashboard: TDashboard): readonly TFilter[];
|
|
6
|
+
/** The dashboard's Global Date filter, whichever input holds it. */
|
|
7
|
+
export declare function getDashboardGlobalDateFilter(dashboard: TDashboard): TFilter | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* The filter inputs the tab-presence rule places on a tab (M2), in model
|
|
10
|
+
* order: what the tab's filter bar shows. `sheetKind` overrides the tab's
|
|
11
|
+
* own kind. None for an unknown tab.
|
|
12
|
+
*/
|
|
13
|
+
export declare function listDashboardFilterInputsOnTab(dashboard: TDashboard, sheetId: string | null | undefined, sheetKind?: 'dashboard' | 'document'): readonly FilterInputEntry[];
|
|
14
|
+
/**
|
|
15
|
+
* A filter hidden from the toolbar and not attached to a visual: a toolbar
|
|
16
|
+
* filter's `hide`, or an input placed `hidden` (OF-D14). The edit-mode strip
|
|
17
|
+
* of hidden filters lists these.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isHiddenFilterInput(input: NormalizedFilterDashboardInput): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Every filter definition the stored template holds, as stored: toolbar
|
|
22
|
+
* filters, stored inputs' filters and prototype Document inputs' filters,
|
|
23
|
+
* rejected inputs included (the model leaves those out). The objects
|
|
24
|
+
* themselves, so a writer of the stored shape (a migration's remap, a demo
|
|
25
|
+
* copy) rewrites them in place on its own copy, and a reader that must see
|
|
26
|
+
* every stored definition (the connections a migration maps) sees what the
|
|
27
|
+
* remap writes (one filter model P4b-02 (f)).
|
|
28
|
+
*/
|
|
29
|
+
export declare function listStoredFilterDefinitions(dashboard: TDashboard): TFilter[];
|