react-semaphor 0.1.603 → 0.1.605
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/activity/index.js +1 -73
- package/dist/analytics-protocol/index.js +1 -1491
- package/dist/appearance/index.js +1 -12
- package/dist/appearance-runtime/index.js +1 -5
- package/dist/assistant-context/index.js +1 -11
- package/dist/assistant-protocol/index.js +1 -152
- package/dist/brand-studio/index.js +3 -1598
- package/dist/briefings/index.js +1 -70
- package/dist/chunks/add-to-dashboard-CEmZUf9o.js +12 -0
- package/dist/chunks/analytics-base-schemas-DMFrDqn_.js +1 -0
- package/dist/chunks/appearance-provider-CfoAVQuG.js +608 -0
- package/dist/chunks/appearance-runtime-provider-Bx8H-moR.js +1 -0
- package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
- package/dist/chunks/assistant-chat-DgUaCE9k.js +51 -0
- package/dist/chunks/attachment-filter-line-C_zHMhGh.js +1 -0
- package/dist/chunks/attribution-BEFSsbNn.js +1 -0
- package/dist/chunks/availability-3AIOf6Z-.js +1 -0
- package/dist/chunks/bookmark-impact-BAtemeyK.js +1 -0
- package/dist/chunks/bookmark-state-DScd31KT.js +1 -0
- package/dist/chunks/brand-C9APUFaP.js +1 -0
- package/dist/chunks/card-filter-builder-ClWrXB7P.js +11 -0
- package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
- package/dist/chunks/comparison-window-caption-tguyN24S.js +1 -0
- package/dist/chunks/context-CntvtZwC.js +2 -0
- package/dist/chunks/conversation-JMK2kyTK.js +1 -0
- package/dist/chunks/dashboard-ChIcbVTx.js +1 -0
- package/dist/chunks/dashboard-briefing-launcher-CwMlhkxV.js +42 -0
- package/dist/chunks/dashboard-controls-UCSAFCGA.js +42 -0
- package/dist/chunks/dashboard-json-B120hYDa.js +1 -0
- package/dist/chunks/dashboard-temporal-snapshot-BFJKbp_6.js +1 -0
- package/dist/chunks/edit-dashboard-visual-DvHp03h_.js +73 -0
- package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
- package/dist/chunks/filter-line-WwUV5JzN.js +1 -0
- package/dist/chunks/filter-reach-preview-C5M5_hf_.js +1 -0
- package/dist/chunks/filter-value-text-DqTHe_vu.js +1 -0
- package/dist/chunks/index-DViPGDFj.js +1 -0
- package/dist/chunks/index-bkP6SnYu.js +1 -0
- package/dist/chunks/kpi-trend-rule-B87LNzcz.js +1 -0
- package/dist/chunks/layout-grid-CFzqJ7GC.js +6 -0
- package/dist/chunks/matrix-analytical-definition-5T-2euHZ.js +1 -0
- package/dist/chunks/matrix-member-presentation-vVAv-aqg.js +1 -0
- package/dist/chunks/matrix-operation-contract-CWvcEsQ0.js +1 -0
- package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
- package/dist/chunks/numeric-range-options-C8tr-Bls.js +1 -0
- package/dist/chunks/palette-NvEIuXHN.js +6 -0
- package/dist/chunks/pivot-result-contract-expectations-BNWhS8mv.js +1 -0
- package/dist/chunks/pivot-result-identity-B0eWVMXg.js +1 -0
- package/dist/chunks/raw-temporal-value-BHQ-ldpW.js +1 -0
- package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
- package/dist/chunks/report-preferences-dialog-Bseb2Rlg.js +1 -0
- package/dist/chunks/report-runtime-context-Cd1b5pku.js +1 -0
- package/dist/chunks/resolve-dashboard-input-context-BDY7KwRe.js +8 -0
- package/dist/chunks/resolver-CjsW8Rz0.js +1 -0
- package/dist/chunks/saved-dashboard-context-C3lWc4Dx.js +1 -0
- package/dist/chunks/schema-O1Y3WTGF.js +4 -0
- package/dist/chunks/selection-filter-compiler-kYsRugss.js +1 -0
- package/dist/chunks/semaphor-ready-indicator-BQarSo6S.js +612 -0
- package/dist/chunks/set-6mOnfQeH.js +1 -0
- package/dist/chunks/slider-BPnHdMGq.js +4 -0
- package/dist/chunks/stored-dashboard-DfrxDLhR.js +1 -0
- package/dist/chunks/table-export-sheet-xaczzWZF.js +2 -0
- package/dist/chunks/token-types-1vzMWjI-.js +1 -0
- package/dist/chunks/validators-Dg2kyF4_.js +1 -0
- package/dist/chunks/variable-draft-B4_xqr4Y.js +1 -0
- package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
- package/dist/dashboard/index.js +1 -7
- package/dist/dashboard-authoring/index.js +1 -4614
- package/dist/format-utils/index.js +1 -425
- package/dist/index.js +1 -554
- package/dist/layouts/index.js +1 -7
- package/dist/live-channel/index.js +1 -124
- package/dist/pdf-export-policy/index.js +1 -92
- package/dist/pdf-table-layout/index.js +1 -993
- package/dist/report-runtime-context/index.js +1 -9
- package/dist/shared/index.js +1 -6
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -9
- package/dist/types/brand-studio/brand-studio-draft.d.ts +45 -13
- package/dist/types/brand-studio/brand-studio-editor.d.ts +13 -2
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +17 -6
- package/dist/types/components/visual/data-table/types/data-table.d.ts +52 -42
- package/dist/types/index.js +1 -88
- package/dist/types/lib/appearance/aliases.d.ts +3 -0
- package/dist/types/lib/appearance/index.d.ts +1 -0
- package/dist/types/lib/appearance/table-density.d.ts +18 -0
- package/dist/types/lib/appearance/types.d.ts +39 -1
- package/dist/types/lib/dashboard-viewer/column-header-actions.d.ts +100 -0
- package/dist/types/lib/dashboard-viewer/table-view-edit.d.ts +0 -27
- package/dist/types/lib/dashboard-viewer/table-view.d.ts +26 -2
- package/dist/types/lib/dashboard-viewer/use-table-view.d.ts +2 -0
- package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
- package/dist/types/lib/hooks/use-add-new-frame.d.ts +7 -0
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +4 -0
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +8 -0
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +14 -2
- package/dist/types/lib/stores/explorer-actions.d.ts +7 -10
- package/dist/types/lib/types/common-types.d.ts +1 -2
- package/dist/types/lib/types/semantic-types.d.ts +6 -10
- package/dist/types/lib/utils/card-config-utils.d.ts +13 -0
- package/dist/types/lib/utils/field-placement.d.ts +17 -0
- package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
- package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +21 -1
- package/dist/types/shared/analytics-protocol/field-provenance.d.ts +7 -4
- package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +180 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
- package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +2 -8
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/column-display-values.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-display.d.ts +52 -0
- package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/card-settings/table-viewer-switches.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +132 -3
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +3 -1
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
- package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +10 -1
- package/dist/types/shared/dashboard-authoring/field-aggregations.d.ts +9 -2
- package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +116 -0
- package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +7 -2
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +6 -2
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
- package/dist/types/shared/dashboard-authoring/sheet-kinds.d.ts +36 -0
- package/dist/types/shared/dashboard-authoring/table-sheet-shape.d.ts +140 -0
- package/dist/types/shared/dashboard-viewer/table-column-move.d.ts +15 -0
- package/dist/types/shared/dashboard-viewer/table-settings.d.ts +8 -2
- package/dist/types/shared/format-utils/types/format-types.d.ts +1 -1
- package/dist/usage-events/index.js +1 -285
- package/dist/value-format-preferences/index.js +1 -635
- package/package.json +5 -2
- package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
- package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
- package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
- package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
- package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
- package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
- package/dist/chunks/attribution-BvoKvhcj.js +0 -32
- package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
- package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
- package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
- package/dist/chunks/brand-BoUV0iHF.js +0 -54
- package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
- package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
- package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
- package/dist/chunks/context-UCQ7sere.js +0 -369
- package/dist/chunks/conversation-sQiWYUOb.js +0 -16
- package/dist/chunks/dashboard-BghI99oY.js +0 -14
- package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
- package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
- package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
- package/dist/chunks/dates-BnrXF4bb.js +0 -185
- package/dist/chunks/edit-9df1zOWe.js +0 -226
- package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
- package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
- package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
- package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
- package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
- package/dist/chunks/index-BVKzKl5d.js +0 -90
- package/dist/chunks/index-CV_Kzou0.js +0 -595
- package/dist/chunks/index-D5rxbtS4.js +0 -2795
- package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
- package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
- package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
- package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
- package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
- package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
- package/dist/chunks/palette-Be62Tkoa.js +0 -23
- package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
- package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
- package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
- package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
- package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
- package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
- package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
- package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
- package/dist/chunks/resolver-DG_tfEpt.js +0 -156
- package/dist/chunks/save-C5A0JnEV.js +0 -21
- package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
- package/dist/chunks/schema-C9NPiIru.js +0 -2568
- package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
- package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
- package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
- package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
- package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
- package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
- package/dist/chunks/token-types-XbM6QByy.js +0 -8
- package/dist/chunks/upload-H15d7uHK.js +0 -15
- package/dist/chunks/validators-Baf3VIf5.js +0 -3686
- package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
- package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { DataSource, DatabaseEntityReference, Field, MetricField } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
import { SemaphorSourceRef } from '../../analytics-protocol/index.js';
|
|
4
|
+
type Entity = DatabaseEntityReference;
|
|
5
|
+
/** The base first, then each other entity once, in the order given. */
|
|
6
|
+
export declare function cardSelectedEntities<E extends {
|
|
7
|
+
name: string;
|
|
8
|
+
}>(base: E, reads: readonly E[], same?: (a: E, b: E) => boolean): E[];
|
|
9
|
+
/**
|
|
10
|
+
* The card's base as it is saved (OB-D11, OB-D17): the selected entity
|
|
11
|
+
* `queryBaseSource` names, else its own join plan's base, else the base the
|
|
12
|
+
* server resolved for its last query, else the first selected.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cardBaseEntity(card: Pick<TCard, 'type' | 'config' | 'dataSource'>, resolvedBaseName?: string): Entity | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* A dataset the base reaches, as a selected entity: the base's connection
|
|
17
|
+
* and domain, the dataset's own name, label and table (the joinability
|
|
18
|
+
* response's `datasets`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function reachedDatasetEntity(base: Entity, dataset: {
|
|
21
|
+
name: string;
|
|
22
|
+
label?: string | null;
|
|
23
|
+
table?: string | null;
|
|
24
|
+
schema?: string | null;
|
|
25
|
+
catalog?: string | null;
|
|
26
|
+
type?: string;
|
|
27
|
+
}): Entity;
|
|
28
|
+
/**
|
|
29
|
+
* The domain dataset a saved selection's name stands for (ledger P0-02,
|
|
30
|
+
* P4-08): the name itself, then by case, by label, then a qualified name's
|
|
31
|
+
* last part. The one reader of a selection's spellings; a name no dataset
|
|
32
|
+
* answers comes back as it is.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveDatasetName(name: string, datasets: readonly {
|
|
35
|
+
name: string;
|
|
36
|
+
label?: string | null;
|
|
37
|
+
}[] | undefined): string;
|
|
38
|
+
/** The source reference a base states as `config.queryBaseSource`. */
|
|
39
|
+
export declare function cardBaseSource(base: Entity, dataSource: Pick<DataSource, 'connectionId' | 'connectionType' | 'mode' | 'semanticDomainId'>): SemaphorSourceRef | undefined;
|
|
40
|
+
/** The datasets a field reads, by name (a calculated field's through its inputs). */
|
|
41
|
+
export declare function fieldDatasets(field: Field): string[];
|
|
42
|
+
/**
|
|
43
|
+
* The same source (ledger P7-13): inside a card, datasets and tables go by
|
|
44
|
+
* name, so wherever a source enters the card (a new base, a join's new table)
|
|
45
|
+
* its whole identity is compared here: a dataset's domain and name (never its
|
|
46
|
+
* connection, AGENTS source identity), a table's connection, database, schema
|
|
47
|
+
* and name. A coordinate one side doesn't state doesn't tell them apart.
|
|
48
|
+
*/
|
|
49
|
+
export declare function sameSource(a: Entity | undefined, b: Entity | undefined): boolean;
|
|
50
|
+
/** The same base: the same kind of source and the same identity (`sameSource`). */
|
|
51
|
+
export declare function sameBaseEntity(a: Entity | undefined, b: Entity | undefined): boolean;
|
|
52
|
+
export type CardBaseSwitch = {
|
|
53
|
+
card: TCard;
|
|
54
|
+
/** Placed fields that stayed, as they were placed. */
|
|
55
|
+
kept: Field[];
|
|
56
|
+
/** Placed fields that were removed. */
|
|
57
|
+
removed: Field[];
|
|
58
|
+
/** The card had joins of its own; they were removed with the old base. */
|
|
59
|
+
removedJoins: boolean;
|
|
60
|
+
/** Measures that stayed but lost a table calculation the new base can't run (P9-03). */
|
|
61
|
+
calculations: MetricField[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The card on `nextBase` (OB-D3): a field of the old base stays when the new
|
|
65
|
+
* base has a column of the same name and kind (it takes that column's
|
|
66
|
+
* identity); a field of another dataset stays when the new base is that
|
|
67
|
+
* dataset or reaches it; everything else is removed, from every place. The
|
|
68
|
+
* card's own joins belong to the old base and are removed. The selection is
|
|
69
|
+
* the new base and the datasets the kept fields read; `queryBaseSource`
|
|
70
|
+
* states the new base.
|
|
71
|
+
*/
|
|
72
|
+
export declare function switchCardBase(input: {
|
|
73
|
+
card: TCard;
|
|
74
|
+
/** The old base. */
|
|
75
|
+
base: Entity;
|
|
76
|
+
nextBase: Entity;
|
|
77
|
+
/** The new data source (mode, connection, domain); its selection is rebuilt here. */
|
|
78
|
+
dataSource: DataSource;
|
|
79
|
+
/** The new base's columns. */
|
|
80
|
+
columns: readonly Field[];
|
|
81
|
+
/** Datasets the new base reaches (its folders). */
|
|
82
|
+
reaches: (dataset: string) => boolean;
|
|
83
|
+
/** The selected entity for a dataset the kept fields read. */
|
|
84
|
+
entityOf: (dataset: string) => Entity | undefined;
|
|
85
|
+
}): CardBaseSwitch;
|
|
86
|
+
/**
|
|
87
|
+
* A semantic card's selection with each dataset a write newly made it read
|
|
88
|
+
* (OB-D17): a field placed from a folder adds its dataset after the base, as
|
|
89
|
+
* the MCP's selection lists each dataset a card reads. Only datasets the
|
|
90
|
+
* card didn't read before the write are added, so a sort or format change
|
|
91
|
+
* adds nothing, and nothing is ever removed (OB-INV-1; ledger P4-09). The
|
|
92
|
+
* entity takes the dataset's table coordinates from the field's own catalog
|
|
93
|
+
* identity. Matrix and direct cards (whose joins write their selection) are
|
|
94
|
+
* left as they are. A card is semantic by its base, a dataset, whether or not
|
|
95
|
+
* its source states a mode (a new visual's states none; ledger P7-01).
|
|
96
|
+
*/
|
|
97
|
+
export declare function withReadDatasetsSelected(card: TCard, previous: TCard | undefined,
|
|
98
|
+
/**
|
|
99
|
+
* The domain's datasets, as the joinability response lists them (name,
|
|
100
|
+
* label, type, table, schema, catalog), when the caller has them: each
|
|
101
|
+
* added dataset is built from its entry by the one builder the base switch
|
|
102
|
+
* uses (`reachedDatasetEntity`), so its type and coordinates are the
|
|
103
|
+
* domain's, never parsed from a field's name (ledger P9-04). Without them,
|
|
104
|
+
* the entity carries the identity the server stamped on the field (domain,
|
|
105
|
+
* dataset, label) and no coordinates: the server fills those from the
|
|
106
|
+
* domain (canonicalize-semantic-card).
|
|
107
|
+
*/
|
|
108
|
+
datasets?: readonly ReachedDatasetInfo[]): TCard;
|
|
109
|
+
/** A domain dataset's entry, as the joinability response lists it. */
|
|
110
|
+
export type ReachedDatasetInfo = {
|
|
111
|
+
name: string;
|
|
112
|
+
label?: string | null;
|
|
113
|
+
table?: string | null;
|
|
114
|
+
schema?: string | null;
|
|
115
|
+
catalog?: string | null;
|
|
116
|
+
type?: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* A placed field's words on its chip (OB-D5): a field of another dataset than
|
|
120
|
+
* the base names the folder it was picked from first ("Customer › Segment"
|
|
121
|
+
* from the Customer folder; ledger P7-03). Without a folder for its dataset,
|
|
122
|
+
* the dataset's label stands in.
|
|
123
|
+
*/
|
|
124
|
+
export declare function placedFieldLabel(field: Field, label: string, baseName: string | undefined, folderOf?: (dataset: string) => string | undefined): string;
|
|
125
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Join } from '../../../lib/types/explorer-types.js';
|
|
2
|
+
import { FieldFolder, FieldFolderColumn } from '../field-folders/index.js';
|
|
3
|
+
import { JoinReach } from './join-reach.js';
|
|
4
|
+
export type CardFieldFolderRole =
|
|
5
|
+
/** The card's base. */
|
|
6
|
+
'base'
|
|
7
|
+
/** Reached through the domain's relationships (OB-D6). */
|
|
8
|
+
| 'related'
|
|
9
|
+
/** Joined by the card's own join (OB-D7, OB-D9). */
|
|
10
|
+
| 'join'
|
|
11
|
+
/** Reached only through a relationship that doesn't join automatically (OB-D9). */
|
|
12
|
+
| 'needsSetup'
|
|
13
|
+
/** On the card's saved selection, but neither the base nor reached from it (OB-D18): remove only. */
|
|
14
|
+
| 'alsoOnCard';
|
|
15
|
+
export type CardFieldFolder<C extends FieldFolderColumn = FieldFolderColumn> = FieldFolder<C> & {
|
|
16
|
+
role: CardFieldFolderRole;
|
|
17
|
+
/** A join folder's join. */
|
|
18
|
+
joinId?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A card with joins of its own reads only those: the server skips automatic
|
|
22
|
+
* joining whenever a card states its own plan (auto-join-resolver). So a
|
|
23
|
+
* related dataset its plan doesn't reach needs setup (one step from a table
|
|
24
|
+
* on the card) or isn't reachable, in the folders and in field placement
|
|
25
|
+
* alike (ledger P4-10, P9-02).
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* The folders a filter on the card reaches: its base, Related and joined
|
|
29
|
+
* datasets. A dataset that needs setup, or one the card names but doesn't
|
|
30
|
+
* reach, would never filter it (dashboard filter fields DF-D8).
|
|
31
|
+
*/
|
|
32
|
+
export declare const CARD_FILTER_FOLDER_ROLES: ReadonlySet<CardFieldFolderRole>;
|
|
33
|
+
export declare function cardReadsOnlyOwnJoins(joins: readonly Join[] | undefined): boolean;
|
|
34
|
+
/** The dataset a join entity stands for: its alias, else its name. */
|
|
35
|
+
export declare const joinEntityName: (entity: {
|
|
36
|
+
alias?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
} | undefined) => string;
|
|
39
|
+
export declare function cardFieldFolders<C extends FieldFolderColumn>(input: {
|
|
40
|
+
base: string;
|
|
41
|
+
/** Semantic: what the base reaches (the joinability response's `reach[base]`). */
|
|
42
|
+
reach?: readonly JoinReach[];
|
|
43
|
+
/** The card's authored joins (a direct card's, or a saved semantic card's own). */
|
|
44
|
+
joins?: readonly Join[];
|
|
45
|
+
/** The datasets the card's saved selection names, already resolved to dataset names. */
|
|
46
|
+
selected?: readonly string[];
|
|
47
|
+
columnsOf: (dataset: string) => readonly C[];
|
|
48
|
+
labelOf: (dataset: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Name a semantic folder after its key ("Customer ID" → "Customer") when
|
|
51
|
+
* the key refers to that dataset's rows (`towardKey`). Off for tables,
|
|
52
|
+
* whose folders keep the table's name.
|
|
53
|
+
*/
|
|
54
|
+
keyLabels?: boolean;
|
|
55
|
+
}): CardFieldFolder<C>[];
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { DatabaseEntityReference, Field, Join, JoinPlan, MetricField } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
type Entity = DatabaseEntityReference;
|
|
4
|
+
/** One condition: a column of the table joined from, an operator, a column of the joined table. */
|
|
5
|
+
export type JoinConditionDraft = {
|
|
6
|
+
from: string;
|
|
7
|
+
operator: string;
|
|
8
|
+
to: string;
|
|
9
|
+
};
|
|
10
|
+
/** Conditions that hold together (AND) or any of which holds (OR); sets combine with AND. */
|
|
11
|
+
export type JoinSetDraft = {
|
|
12
|
+
operator: 'AND' | 'OR';
|
|
13
|
+
conditions: JoinConditionDraft[];
|
|
14
|
+
};
|
|
15
|
+
export type JoinMatches = NonNullable<Join['relationshipCardinality']>;
|
|
16
|
+
export type CardJoinDraft = {
|
|
17
|
+
/** The table joined from: the base or a table already joined. */
|
|
18
|
+
from: Entity;
|
|
19
|
+
/** The table joined. */
|
|
20
|
+
to: Entity;
|
|
21
|
+
joinType: Join['joinType'];
|
|
22
|
+
sets: JoinSetDraft[];
|
|
23
|
+
/** Not set until the author states it (OB-D10). */
|
|
24
|
+
matches?: JoinMatches;
|
|
25
|
+
};
|
|
26
|
+
/** A table as the join dialog's selects name it (connection, type, name, database, schema); a dataset whole. */
|
|
27
|
+
export declare function joinTableReference(entity: Entity): Entity;
|
|
28
|
+
/** The join a draft states. */
|
|
29
|
+
export declare function joinFromDraft(draft: CardJoinDraft, at: {
|
|
30
|
+
id: string;
|
|
31
|
+
sequence: number;
|
|
32
|
+
createId: () => string;
|
|
33
|
+
}): Join;
|
|
34
|
+
/** The draft a saved join reads as, for editing. */
|
|
35
|
+
export declare function draftFromJoin(join: Join, entityOf: (name: string) => Entity | undefined): CardJoinDraft;
|
|
36
|
+
/** A join's match count from the table it joins from, a reverse stamp read flipped (ledger P5-06). */
|
|
37
|
+
export declare function joinMatches(join: Pick<Join, 'relationshipCardinality' | 'relationshipTraversalDirection'>): JoinMatches | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* A join today's dialog refuses (ledger P2-10): the base itself, or a table
|
|
40
|
+
* already on the card's joins (one alias per table). The one rule the dialog
|
|
41
|
+
* and any later caller read.
|
|
42
|
+
*/
|
|
43
|
+
export declare function joinTargetRefusal(card: TCard, base: Entity, to: Entity, replacingJoinId?: string): string | undefined;
|
|
44
|
+
/** The card with the draft joined (OB-D8): after its last join; the joined table added to the selection. */
|
|
45
|
+
export declare function addCardJoin(input: {
|
|
46
|
+
card: TCard;
|
|
47
|
+
base: Entity;
|
|
48
|
+
draft: CardJoinDraft;
|
|
49
|
+
catalog: readonly Field[];
|
|
50
|
+
createId: () => string;
|
|
51
|
+
/**
|
|
52
|
+
* The joins a semantic card's query makes today, when it has none of its
|
|
53
|
+
* own: its first join of its own keeps them, so what the card already
|
|
54
|
+
* joins keeps joining (ledger P5-07).
|
|
55
|
+
*/
|
|
56
|
+
resolvedPlan?: JoinPlan;
|
|
57
|
+
}): TCard;
|
|
58
|
+
export type CardJoinRemoval = {
|
|
59
|
+
card: TCard;
|
|
60
|
+
/** The joins removed: the join and every join from the tables it brought. */
|
|
61
|
+
joins: Join[];
|
|
62
|
+
/** Placed fields removed because they read a removed table. */
|
|
63
|
+
removed: Field[];
|
|
64
|
+
/** Measures that stayed but lost a table calculation the card can no longer run (P9-03). */
|
|
65
|
+
calculations?: MetricField[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The card without the join and every join from the tables it brought, and
|
|
69
|
+
* without the fields that read those tables (OB-D7, OB-T-9). The tables leave
|
|
70
|
+
* the selection; no join left means no join plan. A Matrix card's plan is its
|
|
71
|
+
* definition's (`withAuthoredCardJoinPlan`); its measures aren't on the field
|
|
72
|
+
* walk, so they stay for the definition's own check, as the old join manager
|
|
73
|
+
* left them (ledger P5-02).
|
|
74
|
+
*/
|
|
75
|
+
export declare function removeCardJoin(card: TCard, joinId: string): CardJoinRemoval;
|
|
76
|
+
/**
|
|
77
|
+
* Start over (ledger P7-12): the card back to its base alone. Every join goes
|
|
78
|
+
* as Remove join removes it (the fields that read a joined table with it,
|
|
79
|
+
* filters included), then the shelves are emptied as Clear fields empties
|
|
80
|
+
* them. The base, and filters on the base, stay. Not for Matrix, whose
|
|
81
|
+
* fields live in its definition.
|
|
82
|
+
*/
|
|
83
|
+
export declare function startCardOver(card: TCard): {
|
|
84
|
+
card: TCard;
|
|
85
|
+
joins: Join[];
|
|
86
|
+
fields: number;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The card with a join changed. The same joined table keeps its place, its
|
|
90
|
+
* joins and the fields that read it; another table is a new join, so the old
|
|
91
|
+
* one is removed as Remove join removes it.
|
|
92
|
+
*/
|
|
93
|
+
export declare function updateCardJoin(input: {
|
|
94
|
+
card: TCard;
|
|
95
|
+
base: Entity;
|
|
96
|
+
joinId: string;
|
|
97
|
+
draft: CardJoinDraft;
|
|
98
|
+
catalog: readonly Field[];
|
|
99
|
+
createId: () => string;
|
|
100
|
+
}): CardJoinRemoval;
|
|
101
|
+
/**
|
|
102
|
+
* The condition a new join starts from (the author can change it): the
|
|
103
|
+
* joined-from table's `<to>_id` to the joined table's `id`, or the other way
|
|
104
|
+
* round, else a column both tables have (a key-like `_id` one first), else
|
|
105
|
+
* their first columns.
|
|
106
|
+
*/
|
|
107
|
+
export declare function suggestJoinCondition(from: {
|
|
108
|
+
name: string;
|
|
109
|
+
columns: readonly string[];
|
|
110
|
+
}, to: {
|
|
111
|
+
name: string;
|
|
112
|
+
columns: readonly string[];
|
|
113
|
+
}): JoinConditionDraft | undefined;
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { Field, MetricField } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
export type PrunedCard = {
|
|
4
|
+
card: TCard;
|
|
5
|
+
/** Fields removed, as placed: the writer's decisions and the measures whose own condition went. */
|
|
6
|
+
removed: Field[];
|
|
7
|
+
/** Measures that kept their place but lost their table calculation. */
|
|
8
|
+
calculations: MetricField[];
|
|
9
|
+
};
|
|
10
|
+
export declare function pruneCardFields(card: TCard, decide: (field: Field) => Field | null): PrunedCard;
|
|
11
|
+
/** The words a toast adds for table calculations removed with the fields. */
|
|
12
|
+
export declare function calculationsRemovedWords(calculations: readonly MetricField[]): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TDataColumn } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { Field } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
import { FilterFieldFolder } from './filter-field-folders.js';
|
|
4
|
+
/** A dashboard or Document filter, or a card's pinned filter. */
|
|
5
|
+
export type FilterFieldPurpose = 'dashboard' | 'pinned';
|
|
6
|
+
/** One source's `/v1/columns` answer. */
|
|
7
|
+
export type FilterFieldColumnsResponse = {
|
|
8
|
+
columns?: TDataColumn[];
|
|
9
|
+
calculatedFields?: Field[];
|
|
10
|
+
} | undefined;
|
|
11
|
+
export type FilterFieldCatalog = {
|
|
12
|
+
/** Each folder's fields, by folder key. */
|
|
13
|
+
byKey: Map<string, Field[]>;
|
|
14
|
+
/** Calculated fields over several datasets, each with the folder whose source a filter on it stores (its domain's, the first it reads). */
|
|
15
|
+
several: Array<{
|
|
16
|
+
field: Field;
|
|
17
|
+
folderKey?: string;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A calculated field the picker may offer once the server says it reaches a
|
|
22
|
+
* card (DF-D11): its key in the per-card read, the folder it sits in (the one
|
|
23
|
+
* domain dataset it reads, when that dataset has a folder) and the folder
|
|
24
|
+
* whose source a filter on it stores.
|
|
25
|
+
*/
|
|
26
|
+
export type FilterFieldCalculatedCandidate = {
|
|
27
|
+
key: string;
|
|
28
|
+
field: Field;
|
|
29
|
+
folderKey?: string;
|
|
30
|
+
homeKey?: string;
|
|
31
|
+
};
|
|
32
|
+
type CatalogInput = {
|
|
33
|
+
folders: readonly FilterFieldFolder[];
|
|
34
|
+
/** Each folder's columns response, by folder key. */
|
|
35
|
+
responses: ReadonlyMap<string, FilterFieldColumnsResponse>;
|
|
36
|
+
/** The dashboard's calculated fields. */
|
|
37
|
+
dashboardCalculated?: readonly Field[];
|
|
38
|
+
/** A pinned filter's card: its own calculated fields, on its domain. */
|
|
39
|
+
cardCalculated?: {
|
|
40
|
+
fields: readonly Field[];
|
|
41
|
+
domainId?: string;
|
|
42
|
+
};
|
|
43
|
+
purpose: FilterFieldPurpose;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The calculated fields a picker could offer, each placed by source identity
|
|
47
|
+
* (domain plus dataset): a domain's calculations once per domain by the field
|
|
48
|
+
* list's namespace rule, the dashboard's by their inputs, a pinned card's own
|
|
49
|
+
* on its domain. Whether each is offered is the server's decision (DF-D11).
|
|
50
|
+
*/
|
|
51
|
+
export declare function filterFieldCalculatedCandidates(input: CatalogInput): FilterFieldCalculatedCandidate[];
|
|
52
|
+
export declare function filterFieldCatalog(input: CatalogInput & {
|
|
53
|
+
/**
|
|
54
|
+
* The cards each candidate reaches, by key, from the per-card read
|
|
55
|
+
* (DF-D11). A calculated field is offered only when it reaches one of
|
|
56
|
+
* the picker's cards; before the read answers, none is.
|
|
57
|
+
*/
|
|
58
|
+
calculatedReach?: ReadonlyMap<string, readonly string[]>;
|
|
59
|
+
}): FilterFieldCatalog;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
|
+
import { DataSource, DatabaseEntityReference, Field } from '../../../lib/types/explorer-types.js';
|
|
3
|
+
import { CardFieldFolder } from './card-field-folders.js';
|
|
4
|
+
import { JoinReach } from './join-reach.js';
|
|
5
|
+
import { FieldFolderColumn } from '../field-folders/index.js';
|
|
6
|
+
type Entity = DatabaseEntityReference;
|
|
7
|
+
/** How one card is reached from a folder's dataset. */
|
|
8
|
+
export type FilterFolderCard = {
|
|
9
|
+
cardId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
/** The card's base, as the folder list names it. */
|
|
12
|
+
baseLabel: string;
|
|
13
|
+
/** The key fields on the card's side, nearest step first; empty on the base itself. */
|
|
14
|
+
keys: readonly string[];
|
|
15
|
+
/** Reached through one of the card's own joins. */
|
|
16
|
+
throughJoin?: boolean;
|
|
17
|
+
/** The folder's dataset or table is the card's base. */
|
|
18
|
+
onBase?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type FilterFieldFolder = {
|
|
21
|
+
/** Stable identity: the domain and dataset, or the table's connection and qualified name. */
|
|
22
|
+
key: string;
|
|
23
|
+
label: string;
|
|
24
|
+
/** The source the folder's fields are read from and a filter on them stores (DF-D5). */
|
|
25
|
+
source: Entity;
|
|
26
|
+
domainId?: string;
|
|
27
|
+
/** A direct table: no domain relationships. */
|
|
28
|
+
direct: boolean;
|
|
29
|
+
section: 'onSheet' | 'related';
|
|
30
|
+
cards: readonly FilterFolderCard[];
|
|
31
|
+
/** Chosen from Browse all data: listed whether or not it reaches a card (DF-D6). */
|
|
32
|
+
picked?: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** A card as the per-card read takes it: what decides a filter's reach on it, a draft included. */
|
|
35
|
+
export type FilterFieldReachCard = Pick<TCard, 'id' | 'title' | 'type' | 'dataSource' | 'config' | 'sql'>;
|
|
36
|
+
/**
|
|
37
|
+
* A calculated field a filter picker would offer, decided per card by the
|
|
38
|
+
* same decision as a dataset (review P8-01): the field as the catalog has it
|
|
39
|
+
* and the source a filter on it would store.
|
|
40
|
+
*/
|
|
41
|
+
export type FilterFieldReachCandidate = {
|
|
42
|
+
key: string;
|
|
43
|
+
field: Field;
|
|
44
|
+
source: DataSource;
|
|
45
|
+
};
|
|
46
|
+
export type FilterFieldReachRequest = {
|
|
47
|
+
cards: FilterFieldReachCard[];
|
|
48
|
+
fields?: FilterFieldReachCandidate[];
|
|
49
|
+
};
|
|
50
|
+
/** A domain dataset a filter can be on, and each card a filter on it reaches. */
|
|
51
|
+
export type FilterFieldReachDataset = {
|
|
52
|
+
domainId: string;
|
|
53
|
+
name: string;
|
|
54
|
+
label: string;
|
|
55
|
+
type?: string;
|
|
56
|
+
table?: string | null;
|
|
57
|
+
schema?: string | null;
|
|
58
|
+
catalog?: string | null;
|
|
59
|
+
cards: Array<{
|
|
60
|
+
cardId: string;
|
|
61
|
+
/** Reached through a relationship route: the key fields on the card's side, nearest step first (labels). */
|
|
62
|
+
keys?: string[];
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
65
|
+
/** The per-card read's answer (DF-D2): each dataset's cards, and each candidate field's (DF-D11). */
|
|
66
|
+
export type FilterFieldReachResponse = {
|
|
67
|
+
datasets: FilterFieldReachDataset[];
|
|
68
|
+
fields?: Array<{
|
|
69
|
+
key: string;
|
|
70
|
+
cards: string[];
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* A card as the per-card read decides it, with only what decides it: its
|
|
75
|
+
* domain read the one way every surface reads it
|
|
76
|
+
* (`getDataSourceSemanticDomainId`: the source's, else the one its datasets
|
|
77
|
+
* name) and stated on its source, so a new visual whose domain sits on its
|
|
78
|
+
* dataset is decided like any other (review P8-02). The browser builds the
|
|
79
|
+
* request with it and the server reads every card through it again.
|
|
80
|
+
*/
|
|
81
|
+
export declare function filterFieldReachCard(card: FilterFieldReachCard): FilterFieldReachCard;
|
|
82
|
+
/**
|
|
83
|
+
* The cards the per-card read decides: every card with a base. Datasets are
|
|
84
|
+
* decided on a domain's cards; a candidate field on every card (a table
|
|
85
|
+
* card's own calculations included).
|
|
86
|
+
*/
|
|
87
|
+
export declare function filterFieldReachCards(cards: readonly TCard[]): FilterFieldReachCard[];
|
|
88
|
+
/** Reads a `/api/v1/filter-fields/reach` body; anything malformed is no answer. */
|
|
89
|
+
export declare function readFilterFieldReachResponse(body: unknown): FilterFieldReachResponse | undefined;
|
|
90
|
+
export type FilterFieldFoldersInput = {
|
|
91
|
+
/** The cards a filter added here can reach: a sheet's, a Document's, or one card's. */
|
|
92
|
+
cards: readonly TCard[];
|
|
93
|
+
/** The server's per-card decision on the domains' datasets, once it answers; before, no dataset folder. */
|
|
94
|
+
reach: FilterFieldReachResponse | undefined;
|
|
95
|
+
/** The server's decision on each table folder (`filterFieldTables`), by folder key: the cards it reaches. */
|
|
96
|
+
tableReach?: ReadonlyMap<string, readonly string[]>;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* A folder's identity for a source: a domain dataset by its domain and name,
|
|
100
|
+
* a table by its connection and qualified name. The folders and a source
|
|
101
|
+
* picked from Browse all data compare by it (review P6-03).
|
|
102
|
+
*/
|
|
103
|
+
export declare function filterFolderKey(source: Entity): string;
|
|
104
|
+
/** A card with a source a filter can reach: its base. */
|
|
105
|
+
export declare function filterableCards(cards: readonly TCard[]): TCard[];
|
|
106
|
+
/**
|
|
107
|
+
* The tables the cards' table cards read, each once: the table folders a
|
|
108
|
+
* picker may list. Whether each reaches a card is the server's decision
|
|
109
|
+
* (`tableReach`); this only names the candidates and their sources.
|
|
110
|
+
*/
|
|
111
|
+
export declare function filterFieldTables(cards: readonly TCard[]): FilterFieldFolder[];
|
|
112
|
+
/** The folders, On this sheet first, then Related; most cards reached first, then most built on it, then by label. */
|
|
113
|
+
export declare function filterFieldFolders(input: FilterFieldFoldersInput): FilterFieldFolder[];
|
|
114
|
+
/**
|
|
115
|
+
* The data source a filter added from a folder stores (DF-D5): the folder's
|
|
116
|
+
* own dataset on its domain, or its own table; never another card's source.
|
|
117
|
+
*/
|
|
118
|
+
export declare function filterFolderDataSource(folder: Pick<FilterFieldFolder, 'source' | 'domainId' | 'direct'>): DataSource;
|
|
119
|
+
/** "6 cards", or "4 of 6 cards": a folder header's reach (DF-D4). */
|
|
120
|
+
export declare function filterReachCount(folder: Pick<FilterFieldFolder, 'cards'>, total: number): string;
|
|
121
|
+
/**
|
|
122
|
+
* The reach line under the list for a highlighted folder or field (DF-D4):
|
|
123
|
+
* the cards it filters, grouped by base with the keys it goes through, and
|
|
124
|
+
* the cards it leaves unfiltered; for a direct table, how to reach one.
|
|
125
|
+
*/
|
|
126
|
+
export declare function filterReachLine(input: {
|
|
127
|
+
folder: FilterFieldFolder;
|
|
128
|
+
/** Every card a filter here could reach (the sheet's or the Document's). */
|
|
129
|
+
cards: readonly Pick<TCard, 'id' | 'title'>[];
|
|
130
|
+
/** The highlighted field's label, when a field is highlighted. */
|
|
131
|
+
fieldLabel?: string;
|
|
132
|
+
/** A key field's label on the card's base. */
|
|
133
|
+
keyLabel?: (baseLabel: string, field: string) => string;
|
|
134
|
+
}): string;
|
|
135
|
+
/**
|
|
136
|
+
* Which base each related dataset's folder hangs under in a filter picker
|
|
137
|
+
* (filter picker folder tree): each dataset once, under the base that reaches
|
|
138
|
+
* it in the fewest steps, then the first base (bases in the picker's order,
|
|
139
|
+
* most cards first). The editor's field list draws each base's tree
|
|
140
|
+
* (`cardFieldFolders`); this only says which base's tree shows a dataset. A
|
|
141
|
+
* base is never placed under another base. `reachOf` is the domain's reach
|
|
142
|
+
* (the joinability response) from a base. Pure.
|
|
143
|
+
*/
|
|
144
|
+
export declare function filterFolderPlacement(input: {
|
|
145
|
+
/** The datasets the picker's cards are built on, in the picker's order. */
|
|
146
|
+
bases: readonly string[];
|
|
147
|
+
/** The related datasets the server says a filter on reaches a card. */
|
|
148
|
+
datasets: readonly string[];
|
|
149
|
+
reachOf: (base: string) => readonly {
|
|
150
|
+
dataset: string;
|
|
151
|
+
steps: readonly unknown[];
|
|
152
|
+
}[];
|
|
153
|
+
}): Map<string, string>;
|
|
154
|
+
/**
|
|
155
|
+
* A filter picker's folders as trees, already resolved (filter picker folder
|
|
156
|
+
* tree; Astra's follow-up, ledger P8-20): one tree per base, each dataset
|
|
157
|
+
* where its key is (`cardFieldFolders` over the domain's reach, named after
|
|
158
|
+
* the key), showing only what the server offers, each dataset once
|
|
159
|
+
* (`filterFolderPlacement`). No card is involved: which folders a filter can
|
|
160
|
+
* use is the server's answer over every card, so one card's own joins never
|
|
161
|
+
* hide a dataset another card reaches. What no tree draws comes back as
|
|
162
|
+
* `loose`, listed after the trees. Pure.
|
|
163
|
+
*/
|
|
164
|
+
export declare function filterFieldTrees<C extends FieldFolderColumn>(input: {
|
|
165
|
+
/** The datasets the picker's cards are built on, in the picker's order. */
|
|
166
|
+
bases: readonly string[];
|
|
167
|
+
/** Every dataset the server says a filter on reaches a card, bases included. */
|
|
168
|
+
offered: readonly string[];
|
|
169
|
+
/** The domain's reach from a base (the joinability response). */
|
|
170
|
+
reachOf: (base: string) => readonly JoinReach[];
|
|
171
|
+
columnsOf: (dataset: string) => readonly C[];
|
|
172
|
+
labelOf: (dataset: string) => string;
|
|
173
|
+
}): {
|
|
174
|
+
trees: Array<{
|
|
175
|
+
base: string;
|
|
176
|
+
folders: CardFieldFolder<C>[];
|
|
177
|
+
}>;
|
|
178
|
+
loose: string[];
|
|
179
|
+
};
|
|
180
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './join-reach.js';
|
|
2
|
+
export * from './card-field-folders.js';
|
|
3
|
+
export * from './card-base.js';
|
|
4
|
+
export * from './card-joins.js';
|
|
5
|
+
export * from './card-prune.js';
|
|
6
|
+
export * from './filter-field-folders.js';
|
|
7
|
+
export * from './filter-field-catalog.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a semantic dataset reaches, as a card's query would join it (one base
|
|
3
|
+
* per card OB-D15). Served beside the joinability map by
|
|
4
|
+
* GET /api/v1/domains/[domainId]/joinability and built by the app's reach
|
|
5
|
+
* module (`relatedDatasetsFrom`, rule `card`), so the editor has no path
|
|
6
|
+
* finder of its own. The field list puts each reached dataset in a folder at
|
|
7
|
+
* the key its last step joins on (OB-D5).
|
|
8
|
+
*/
|
|
9
|
+
/** One relationship crossed on the way, from the dataset nearer the base to the next. */
|
|
10
|
+
export interface JoinReachStep {
|
|
11
|
+
from: string;
|
|
12
|
+
to: string;
|
|
13
|
+
relationshipId?: string;
|
|
14
|
+
relationshipName?: string;
|
|
15
|
+
/** The relationship's fields on `from`'s side, in key order. One field: the folder stands at it. */
|
|
16
|
+
nearFields: string[];
|
|
17
|
+
/** The relationship's fields on `to`'s side, in the same order (a Needs setup join starts from them). */
|
|
18
|
+
farFields: string[];
|
|
19
|
+
/**
|
|
20
|
+
* The step lands on `to`'s whole primary key, so the near field refers to
|
|
21
|
+
* a `to` row ("Customer ID" → Customer): the folder may take the key's name.
|
|
22
|
+
*/
|
|
23
|
+
towardKey?: true;
|
|
24
|
+
}
|
|
25
|
+
export interface JoinReach {
|
|
26
|
+
dataset: string;
|
|
27
|
+
steps: JoinReachStep[];
|
|
28
|
+
/**
|
|
29
|
+
* Reached only through an active relationship that doesn't join
|
|
30
|
+
* automatically (OB-D9): a Needs setup folder. One step.
|
|
31
|
+
*/
|
|
32
|
+
needsSetup?: true;
|
|
33
|
+
/**
|
|
34
|
+
* Reached in two hops through more than one dataset: which way the query
|
|
35
|
+
* joins it depends on what else the card reads, so its folder stands at
|
|
36
|
+
* the base's top level, after the base's fields, never under one route
|
|
37
|
+
* (ledger P1-05).
|
|
38
|
+
*/
|
|
39
|
+
alternateRoutes?: true;
|
|
40
|
+
}
|
|
41
|
+
/** Per base dataset, the datasets it reaches, nearest first. */
|
|
42
|
+
export type JoinReachMap = Record<string, JoinReach[]>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TCard } from '../../lib/types/common-types.js';
|
|
2
|
+
import { Field } from '../../lib/types/explorer-types.js';
|
|
3
|
+
export declare const CARD_FIELD_SHELVES: readonly ["metricColumns", "groupByColumns", "detailColumns", "sortByColumns", "pivotByColumns"];
|
|
4
|
+
/**
|
|
5
|
+
* The Detail table backup's shelves: the Table shelves a Detail table keeps
|
|
6
|
+
* to restore when it switches back (`table-type-switch.ts`). Its fields are
|
|
7
|
+
* the card's too, so the walk covers them (ledger P8-02).
|
|
8
|
+
*/
|
|
9
|
+
export declare const DETAIL_BACKUP_SHELVES: readonly ["metricColumns", "groupByColumns", "sortByColumns", "pivotByColumns"];
|
|
10
|
+
/**
|
|
11
|
+
* A card config's shelves, emptied, with the Detail table backup: what Clear
|
|
12
|
+
* fields writes (one base per card, ledger P7-12, P8-02). Filters stay.
|
|
13
|
+
*/
|
|
14
|
+
export declare function clearedCardShelves(): Record<(typeof CARD_FIELD_SHELVES)[number], []> & {
|
|
15
|
+
detailTableBackup: undefined;
|
|
16
|
+
};
|
|
17
|
+
export type CardFieldPlace = 'column' | 'filter';
|
|
18
|
+
/**
|
|
19
|
+
* `onRemoved`: the writer removes sources from the card (a base switch,
|
|
20
|
+
* Remove join, Start over): a column one of whose own conditions (an
|
|
21
|
+
* attribute filter) can't be kept goes with it, rather than change meaning
|
|
22
|
+
* quietly, and is reported for the writer to list (ledger P8-07). Without it
|
|
23
|
+
* (calculated field edits, whose own rule drops the condition and keeps the
|
|
24
|
+
* measure), the condition alone goes.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mapCardFieldPlaces(card: TCard, map: (field: Field, place: CardFieldPlace) => Field | null, onRemoved?: (column: Field) => void): TCard;
|
|
27
|
+
/** Each field the card holds, once per place. */
|
|
28
|
+
export declare function cardFieldsInPlaces(card: TCard): Field[];
|
|
@@ -46,19 +46,13 @@ export declare function writeKpiTrendGrain<T extends Pick<TCard, 'config'>>(card
|
|
|
46
46
|
* and each named measure's total, keyed by its result alias. Overall is the
|
|
47
47
|
* default, so a measure set to it is removed, and an emptied map with it;
|
|
48
48
|
* measures the change doesn't name keep their setting. The table settings,
|
|
49
|
-
* Document sections and the MCP write totals here
|
|
50
|
-
*
|
|
49
|
+
* Document sections and the MCP write totals here. The row's look is the
|
|
50
|
+
* theme's (table style TS-D12).
|
|
51
51
|
*/
|
|
52
52
|
export declare function writeTableTotals(preferences: TCardPreferences | undefined, change: {
|
|
53
53
|
row?: boolean;
|
|
54
54
|
measures?: Record<string, TableMeasureTotal>;
|
|
55
55
|
}): TCardPreferences;
|
|
56
|
-
/** The stored totals' measure settings, for a style reset that rebuilds the totals row's look. */
|
|
57
|
-
export declare function keptMeasureTotals(totals: {
|
|
58
|
-
measures?: Record<string, TableMeasureTotal>;
|
|
59
|
-
} | undefined): {
|
|
60
|
-
measures?: Record<string, TableMeasureTotal>;
|
|
61
|
-
};
|
|
62
56
|
/**
|
|
63
57
|
* A chart's data labels shown or hidden, and their own format, onto the
|
|
64
58
|
* stored config filled with the chart's defaults, as the data labels panel
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TCard } from '../../../lib/types/common-types.js';
|
|
2
2
|
import { CardType } from '../changes/card-types.js';
|
|
3
|
-
export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.width' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'trend' | 'trendGrain' | 'seeRecords' | 'columnOrder' | 'columnFilters' | 'tableSearch';
|
|
3
|
+
export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.pinned' | 'columns.width' | 'columns.display' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'trend' | 'trendGrain' | 'seeRecords' | 'columnOrder' | 'columnFilters' | 'tableSearch';
|
|
4
4
|
export declare const SETTINGS_BY_KIND: Readonly<Record<CardType, readonly SettingName[]>>;
|
|
5
5
|
export type CardSettingsKind = {
|
|
6
6
|
type: CardType;
|