react-semaphor 0.1.545 → 0.1.547
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 +408 -442
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +100 -76
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.js +6 -6
- 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/applied-constraints-DU-wndZ7.js +47 -0
- package/dist/chunks/{assistant-chat-D7sWTypJ.js → assistant-chat-CK84cPAB.js} +2826 -2595
- package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-Cu-a5ie_.js} +8 -15
- 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-ChL54gGm.js +295 -0
- package/dist/chunks/{dashboard-B1tMju0u.js → dashboard-DCk26-6i.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CePgIu0Z.js → dashboard-briefing-launcher-CQ1eYsGy.js} +1291 -1277
- package/dist/chunks/dashboard-controls-BMeZjF7r.js +2307 -0
- package/dist/chunks/{dashboard-json-CoYRPqxx.js → dashboard-json-BZqCoanC.js} +5 -5
- package/dist/chunks/{document-dashboard-inputs-BesAHZvB.js → document-dashboard-inputs-tYd7ao0o.js} +877 -979
- package/dist/chunks/{edit-dashboard-visual-JPtNfJRb.js → edit-dashboard-visual-Bv3MHM_G.js} +2157 -2243
- package/dist/chunks/filter-reach-copy-CGWsL_ez.js +3480 -0
- package/dist/chunks/{filter-value-text-ff7osJr7.js → filter-value-text-Ddf55Ku1.js} +9 -9
- package/dist/chunks/global-date-filter-utils-BhAu8zIM.js +12137 -0
- package/dist/chunks/index-CtoK1Lgu.js +586 -0
- package/dist/chunks/{index-DRWiuqyd.js → index-DmrLP5Ro.js} +105 -104
- 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-DnCyRXJE.js → matrix-formatter-DWEeC0_c.js} +44 -44
- 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-C3mUgnEx.js → raw-temporal-presentation-DypB7sMX.js} +8 -8
- package/dist/chunks/{report-preferences-dialog-DUtuUL_5.js → report-preferences-dialog-DoVyriYC.js} +154 -155
- package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-D0JDUa4h.js +5576 -0
- package/dist/chunks/{saved-dashboard-context-LrF_kW0l.js → saved-dashboard-context-BfAH5j4L.js} +34 -34
- package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
- package/dist/chunks/{semaphor-ready-indicator-BxF96Yhv.js → semaphor-ready-indicator-CRm17oIP.js} +51771 -52574
- package/dist/chunks/{shelf-drop-preview-context-CNaM_Gmh.js → shelf-drop-preview-context-vy6P9THz.js} +7 -7
- package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
- package/dist/chunks/{switch-uDtPgQlQ.js → switch-CEBOR4n7.js} +3 -3
- package/dist/chunks/{table-export-sheet-YzMioA7Y.js → table-export-sheet-4X9mAG3V.js} +1 -1
- package/dist/chunks/table-settings-WysCBj62.js +614 -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-CjB7ig1o.js → use-create-flow-overlay-state-Csx_Xjsh.js} +101 -101
- package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
- package/dist/chunks/{relative-date-label-Bk2j94pA.js → zoned-wall-clock-MulfA26h.js} +64 -21
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1895 -1163
- 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 +133 -133
- package/dist/index.js +192 -186
- 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/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 +7 -0
- package/dist/types/components/surfboard/screen-size-preview-button.d.ts +10 -0
- package/dist/types/components/visual/matrix-table/matrix-card-view.d.ts +3 -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 +346 -21
- package/dist/types/lib/dashboard-inputs/dashboard-filter-value-identity.d.ts +65 -0
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +6 -0
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +2 -0
- package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +3 -3
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
- package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +9 -1
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +5 -1
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +149 -10
- package/dist/types/lib/stores/dashboard-store.d.ts +137 -6
- package/dist/types/lib/types/common-types.d.ts +8 -0
- 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/applied-constraints.d.ts +57 -1
- 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 +4 -1
- package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +29 -29
- 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 +45 -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 +96 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +3 -3
- 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 +24 -14
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-automatic-target.d.ts +4 -4
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +3 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-types.d.ts +27 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-value-compatibility.d.ts +12 -3
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +26 -0
- package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-preview.d.ts +97 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +22 -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 +101 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +100 -0
- package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +22 -0
- package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
- 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/apply-dashboard-operations-CZEMsx8E.js +0 -2080
- package/dist/chunks/calendar-day-equality-dvoQp1xW.js +0 -410
- package/dist/chunks/comparison-window-caption-D4E6IHPD.js +0 -1624
- package/dist/chunks/custom-visual-inputs-DLCD9Y5V.js +0 -329
- package/dist/chunks/dashboard-controls-Cq05n3e0.js +0 -2315
- package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
- 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-7X_IrD58.js +0 -5226
- package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +0 -9415
- 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/chunks/zoned-wall-clock-BkxV9jS2.js +0 -46
- 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,45 @@
|
|
|
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
|
+
/** In-scope cards on another dataset of the filter's domain: decided when each card runs, through the relationships. */
|
|
16
|
+
| 'filter_reach_through_relationships'
|
|
17
|
+
/** The compiled card stores the window as fixed dates. */
|
|
18
|
+
| 'window_saved_as_fixed_dates'
|
|
19
|
+
/** A type change leaves out fields or preferences. */
|
|
20
|
+
| 'type_change_drops'
|
|
21
|
+
/** A column's aggregate or time grain changed and its custom label was kept. */
|
|
22
|
+
| 'label_kept_after_change'
|
|
23
|
+
/** The change makes a library visual's card local to this dashboard. */
|
|
24
|
+
| 'detaches_linked_visual'
|
|
25
|
+
/** The change removes a level or measure a control is bound to: that control stops changing the card. */
|
|
26
|
+
| 'control_binding_dropped'
|
|
27
|
+
/** Apply only: saved, but the version control commit failed. */
|
|
28
|
+
| 'commit_failed'
|
|
29
|
+
/**
|
|
30
|
+
* Propose from the dashboard on screen (analytics agent Plan 1, D7-13): that
|
|
31
|
+
* dashboard already fails the save's own check, so the change wasn't
|
|
32
|
+
* checked against it; the person's Save reports what it finds.
|
|
33
|
+
*/
|
|
34
|
+
| 'document_not_checked';
|
|
35
|
+
export type ChangeDiagnostic = {
|
|
36
|
+
code: ChangeProblemCode | ChangeWarningCode;
|
|
37
|
+
/** One sentence, safe to show an end user. */
|
|
38
|
+
message: string;
|
|
39
|
+
/** Where in the request, e.g. `changes[2].query.measures[0]`. */
|
|
40
|
+
path?: string;
|
|
41
|
+
/** What the agent should do next; may name tools. */
|
|
42
|
+
fix?: string;
|
|
43
|
+
/** E.g. `{ sheets }`, `{ available }`, `{ suggestedFields }`. */
|
|
44
|
+
details?: Record<string, unknown>;
|
|
45
|
+
};
|
|
@@ -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,96 @@
|
|
|
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 { DashboardRelationshipReachResolver } from '../../../lib/query-context/dashboard-filter-mapping-resolution.js';
|
|
6
|
+
import { DashboardOperation, OperationContext, OperationDescription } from '../operations/apply-dashboard-operations.js';
|
|
7
|
+
import { CardQueryPart } from './card-query-part.js';
|
|
8
|
+
import { FieldRef, MetricCardQuery, RecordsCardQuery } from './dashboard-change.js';
|
|
9
|
+
import { ChangeDiagnostic } from './diagnostics.js';
|
|
10
|
+
/**
|
|
11
|
+
* Public dashboard changes to resolved operations (MCP dashboard editing SPEC
|
|
12
|
+
* 3.7, DE-D48). Every rule the schema can't state lives here; everything that
|
|
13
|
+
* needs app state comes through `services` (S-INV-10). The result carries
|
|
14
|
+
* every id it assigned (DE-D39), proven by a dry run of the reducer
|
|
15
|
+
* (S-INV-11), with each added or changed card checked as saved (DE-D56).
|
|
16
|
+
*/
|
|
17
|
+
export type CardSource = {
|
|
18
|
+
/** The catalog `changeCardType` and `buildFilterInputFromField` take. */
|
|
19
|
+
fields: readonly Field[];
|
|
20
|
+
dataSource?: DataSource;
|
|
21
|
+
connectionId: string;
|
|
22
|
+
connectionType?: string;
|
|
23
|
+
};
|
|
24
|
+
export type ChangeServices = {
|
|
25
|
+
/** The caller's capabilities; read only through `need`, which records each one relied on (DE-D60). */
|
|
26
|
+
capabilities: {
|
|
27
|
+
sql: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The report calendar filter defaults resolve in, with a fixed anchor: the
|
|
31
|
+
* propose instant (DE-D59). The app sets it, so the resolver never reads a
|
|
32
|
+
* clock (S-INV-10).
|
|
33
|
+
*/
|
|
34
|
+
calendar: CalendarContext;
|
|
35
|
+
/** A measures or records query compiled into a card's query part (the app wraps `prepareGovernedCard`). */
|
|
36
|
+
compileCardQuery(request: {
|
|
37
|
+
query: MetricCardQuery | RecordsCardQuery;
|
|
38
|
+
chartType: TChartType;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
ok: true;
|
|
41
|
+
part: CardQueryPart;
|
|
42
|
+
warnings: ChangeDiagnostic[];
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
problems: ChangeDiagnostic[];
|
|
46
|
+
}>;
|
|
47
|
+
/** A dataset's or connection's fields in the editor's catalog shape, or null when the caller can't use it. */
|
|
48
|
+
loadCardSource(ref: {
|
|
49
|
+
domainId: string;
|
|
50
|
+
datasetName: string;
|
|
51
|
+
} | {
|
|
52
|
+
connectionId: string;
|
|
53
|
+
}): Promise<CardSource | null>;
|
|
54
|
+
/** Fields on `toDataset` that the domain's relationships join to `field` on `fromDataset`. Never guessed from names. */
|
|
55
|
+
findRelationshipFields(input: {
|
|
56
|
+
domainId: string;
|
|
57
|
+
fromDataset: string;
|
|
58
|
+
field: string;
|
|
59
|
+
toDataset: string;
|
|
60
|
+
}): Promise<FieldRef[]>;
|
|
61
|
+
/** A new unique id (a UUID: Matrix ids must be UUIDs, ledger P1-04). */
|
|
62
|
+
newId(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Server side only: resolves relationship reach the way the card query
|
|
65
|
+
* does, with each card's domain preloaded (relationship filter reach
|
|
66
|
+
* RF-D15). Without one, those cards read as decided when they run.
|
|
67
|
+
*/
|
|
68
|
+
relationshipReach?: DashboardRelationshipReachResolver;
|
|
69
|
+
};
|
|
70
|
+
export type ChangeRef = {
|
|
71
|
+
ref: string;
|
|
72
|
+
kind: 'card' | 'filter';
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
changeIndex: number;
|
|
76
|
+
};
|
|
77
|
+
export type ChangeResolution = {
|
|
78
|
+
ok: true;
|
|
79
|
+
operations: DashboardOperation[];
|
|
80
|
+
/** The reducer context the operations were resolved with; stored with the proposal and reused at apply. */
|
|
81
|
+
context: OperationContext;
|
|
82
|
+
/** The dashboard after the operations, from a dry run of `applyDashboardOperations`. */
|
|
83
|
+
dashboard: TDashboard;
|
|
84
|
+
/** Handle or existing id to final id, in change order; a handle-less card.add gets $card_1, $card_2... */
|
|
85
|
+
refs: ChangeRef[];
|
|
86
|
+
descriptions: OperationDescription[];
|
|
87
|
+
/** Cards whose query part or type changed, and added cards, in change order: the preview runs the first five. */
|
|
88
|
+
changedCardIds: string[];
|
|
89
|
+
/** Every capability the resolution relied on (DE-D60). */
|
|
90
|
+
requires: Array<'sql'>;
|
|
91
|
+
warnings: ChangeDiagnostic[];
|
|
92
|
+
} | {
|
|
93
|
+
ok: false;
|
|
94
|
+
problems: ChangeDiagnostic[];
|
|
95
|
+
};
|
|
96
|
+
export declare function resolveDashboardChanges(dashboard: TDashboard, changes: readonly unknown[], services: ChangeServices): Promise<ChangeResolution>;
|
|
@@ -3,7 +3,7 @@ import { SelectionField } from '../analytics-protocol/selection-contract.js';
|
|
|
3
3
|
import { DashboardInputScope, TCard } from '../../lib/types/common-types.js';
|
|
4
4
|
import { Field } from '../../lib/types/explorer-types.js';
|
|
5
5
|
import { buildDashboardCardSourceIndex, DashboardCardFilterSourceInventory } from './dashboard-card-source-index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { DashboardFilterFieldTarget } from './dashboard-filter-mapping-types.js';
|
|
7
7
|
/** Which fields a click on this card carries. */
|
|
8
8
|
export type ClickToFilterFieldsRule =
|
|
9
9
|
/** Table: every dimension column on the row. Matrix: the full path. Chart: every dimension of the clicked mark. */
|
|
@@ -31,8 +31,8 @@ export type ClickToFilterCardMapping = {
|
|
|
31
31
|
/** Target card. */
|
|
32
32
|
cardId: string;
|
|
33
33
|
clickedFieldKey: string;
|
|
34
|
-
/**
|
|
35
|
-
target:
|
|
34
|
+
/** A field of the target card: a click applies its value to a field the card executes (ledger R-11). */
|
|
35
|
+
target: DashboardFilterFieldTarget;
|
|
36
36
|
}
|
|
37
37
|
/** "Not applied": this target never receives this source's clicks. */
|
|
38
38
|
| {
|
|
@@ -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
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DashboardFilterTarget, DashboardFilterTargetField } from './dashboard-filter-mapping-types.js';
|
|
1
|
+
import { DashboardFilterFieldTarget, DashboardFilterTarget, DashboardFilterTargetField } from './dashboard-filter-mapping-types.js';
|
|
2
2
|
export type DashboardFilterLogicalValueField = Pick<DashboardFilterTargetField, 'name' | 'sourceField'> & {
|
|
3
3
|
dataType: DashboardFilterTargetField['dataType'];
|
|
4
4
|
};
|
|
5
5
|
export type DashboardFilterAutomaticTargetResolution = {
|
|
6
6
|
status: 'matched';
|
|
7
|
-
target:
|
|
7
|
+
target: DashboardFilterFieldTarget;
|
|
8
8
|
} | {
|
|
9
9
|
status: 'ambiguous';
|
|
10
10
|
} | {
|
|
@@ -22,7 +22,7 @@ export declare function dashboardFilterTargetMatchesLogicalValue(target: Dashboa
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function resolveDashboardFilterAutomaticTarget(params: {
|
|
24
24
|
logicalValueField: DashboardFilterLogicalValueField;
|
|
25
|
-
candidates:
|
|
25
|
+
candidates: DashboardFilterFieldTarget[];
|
|
26
26
|
}): DashboardFilterAutomaticTargetResolution;
|
|
27
27
|
/**
|
|
28
28
|
* Reuses an accepted, source-qualified target as the default for later config
|
|
@@ -33,5 +33,5 @@ export declare function resolveDashboardFilterAutomaticTarget(params: {
|
|
|
33
33
|
*/
|
|
34
34
|
export declare function resolveDashboardFilterInheritedTarget(params: {
|
|
35
35
|
logicalValueField: DashboardFilterLogicalValueField;
|
|
36
|
-
acceptedTargets:
|
|
36
|
+
acceptedTargets: DashboardFilterFieldTarget[];
|
|
37
37
|
}): DashboardFilterAutomaticTargetResolution;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { DashboardInput, NormalizedDashboardInput, TCard } from '../../lib/types/common-types.js';
|
|
2
2
|
import { TFilter } from '../../components/surfboard/filter/types.js';
|
|
3
|
-
export type DashboardFilterMappingContractIssueCode = 'invalid_input' | 'both_filter_definitions' | 'missing_filter_definition' | 'orphaned_filter_reference' | 'invalid_filter_reference' | 'duplicate_filter_reference' | 'global_date_reference' | 'unsupported_mapped_scope' | 'invalid_application' | 'duplicate_card_application' | 'unknown_card' | 'invalid_binding_id' | 'unsupported_target' | 'invalid_target_field' | 'unknown_target_data_type' | 'unavailable_card_source'
|
|
3
|
+
export type DashboardFilterMappingContractIssueCode = 'invalid_input' | 'both_filter_definitions' | 'missing_filter_definition' | 'orphaned_filter_reference' | 'invalid_filter_reference' | 'duplicate_filter_reference' | 'global_date_reference' | 'unsupported_mapped_scope' | 'invalid_application' | 'duplicate_card_application' | 'unknown_card' | 'invalid_binding_id' | 'unsupported_target' | 'invalid_target_field' | 'unknown_target_data_type' | 'unavailable_card_source'
|
|
4
|
+
/** A relationship target's ids are empty, not strings, or repeat (RF-D10). */
|
|
5
|
+
| 'invalid_relationship_route' | 'invalid_option_source' | 'invalid_option_dependencies' | 'invalid_option_population';
|
|
4
6
|
export type DashboardFilterMappingContractIssue = {
|
|
5
7
|
code: DashboardFilterMappingContractIssueCode;
|
|
6
8
|
path: string;
|
|
@@ -20,10 +20,36 @@ export type DashboardFilterTargetField = {
|
|
|
20
20
|
/** Catalog-grounded physical column used when it differs from the semantic name. */
|
|
21
21
|
sourceField?: string;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* An author-chosen route to a card through the domain's relationships
|
|
25
|
+
* (relationship filter reach RF-D10), for a filter whose value's dataset the
|
|
26
|
+
* card doesn't use and reaches by more than one equally preferred path. The
|
|
27
|
+
* card sends the value as it is with these ids; the server resolves exactly
|
|
28
|
+
* them, or blocks the card while the value is set (P-1).
|
|
29
|
+
*/
|
|
30
|
+
export type DashboardFilterRelationshipTarget = {
|
|
31
|
+
kind: 'relationship';
|
|
32
|
+
/** The value's field on its own dataset (the filter's own field). */
|
|
33
|
+
field: DashboardFilterTargetField;
|
|
34
|
+
/** Ordered from the card's base dataset to `field.source`'s dataset; non-empty, no repeats. */
|
|
35
|
+
relationshipIds: string[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A field of the card the filter's value applies to directly. Field-only
|
|
39
|
+
* code (card field catalogs, automatic targeting, click-to-filter, compiling
|
|
40
|
+
* a card condition) takes this type, so a new target kind never reaches it
|
|
41
|
+
* unchecked (relationship filter reach hotspot H-05).
|
|
42
|
+
*/
|
|
43
|
+
export type DashboardFilterFieldTarget = {
|
|
24
44
|
kind: 'field';
|
|
25
45
|
field: DashboardFilterTargetField;
|
|
26
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Every target a filter mapping persists. Code that takes both kinds handles
|
|
49
|
+
* each one explicitly (an exhaustive `switch`), so the compiler names it when
|
|
50
|
+
* a kind is added; both kinds carry `field`, so reading it never proves which.
|
|
51
|
+
*/
|
|
52
|
+
export type DashboardFilterTarget = DashboardFilterFieldTarget | DashboardFilterRelationshipTarget;
|
|
27
53
|
export type DashboardFilterBoundCardApplication = {
|
|
28
54
|
kind: 'bound';
|
|
29
55
|
cardId: string;
|
|
@@ -10,9 +10,18 @@ export declare function isDashboardFilterOperationCompatible(dataType: unknown,
|
|
|
10
10
|
export declare const DASHBOARD_FILTER_OPERATIONS: ReadonlySet<string>;
|
|
11
11
|
export type DashboardFilterScalarType = keyof typeof OPERATIONS_BY_DATA_TYPE;
|
|
12
12
|
/**
|
|
13
|
-
* The values a filter operation takes: how many, and of which scalar type.
|
|
14
13
|
* The one rule for stored filter values, in authored defaults and in saved
|
|
15
|
-
* bookmarks
|
|
14
|
+
* bookmarks: the values a filter operation takes (how many, and of which
|
|
15
|
+
* scalar type), and a date window that runs to now. A dashboard filter's
|
|
16
|
+
* dates never count back from the latest data (relationship filter reach
|
|
17
|
+
* RF-INV-13): the Cards tab previews reach without a value, and a route can't
|
|
18
|
+
* carry a data anchor (P-6, ledger R-15). MCP edits already refuse such a
|
|
19
|
+
* default. Appends a message naming `location` (the stored value) for the
|
|
20
|
+
* first problem.
|
|
16
21
|
*/
|
|
17
|
-
export declare function validateDashboardFilterValues(
|
|
22
|
+
export declare function validateDashboardFilterValues(value: {
|
|
23
|
+
operation: unknown;
|
|
24
|
+
values: readonly unknown[];
|
|
25
|
+
relativeMeta?: unknown;
|
|
26
|
+
}, valueType: DashboardFilterScalarType | undefined, location: string, errors: string[]): void;
|
|
18
27
|
export {};
|
|
@@ -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;
|