react-semaphor 0.1.584 → 0.1.586
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 +474 -435
- package/dist/assistant-context/index.js +1 -1
- package/dist/briefings/index.js +2 -2
- package/dist/chunks/{assistant-chat-nmycV1Se.js → assistant-chat-BU5gchFy.js} +8 -8
- package/dist/chunks/{bookmark-impact-CI3gmxi0.js → bookmark-impact-ZPSGncK6.js} +2 -2
- package/dist/chunks/{bookmark-state-D9-RFkDg.js → bookmark-state-CL4WEpgB.js} +2 -2
- package/dist/chunks/{card-filter-builder-C7QyPqRy.js → card-filter-builder-HELJWA4D.js} +208 -208
- package/dist/chunks/{comparison-window-caption-BAnsTI8y.js → comparison-window-caption-CoART8BC.js} +530 -633
- package/dist/chunks/{dashboard-inJy_V78.js → dashboard-BXP-ZxSY.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DXs0XA1O.js → dashboard-briefing-launcher-BGj42whr.js} +9 -9
- package/dist/chunks/{dashboard-controls-6Zoo8d8Y.js → dashboard-controls-zvbRp6D2.js} +9 -9
- package/dist/chunks/{dashboard-json-D5eJhVA9.js → dashboard-json-CykexgqL.js} +1 -1
- package/dist/chunks/{dates-B3_GWc_Y.js → dates-CaqZtq01.js} +6 -6
- package/dist/chunks/{edit-dashboard-visual-DR03SYeW.js → edit-dashboard-visual-C82JNxbt.js} +2679 -2614
- package/dist/chunks/filter-line-Cu2u1K36.js +131 -0
- package/dist/chunks/{filter-reach-copy-CZwzrxBp.js → filter-reach-copy-ZERaFKsN.js} +1640 -1367
- package/dist/chunks/{filter-value-text-DtOvqcjn.js → filter-value-text-xefXzZlf.js} +10 -10
- package/dist/chunks/{index-BgT1L0p5.js → index-otMIColV.js} +35 -35
- package/dist/chunks/{matrix-analytical-definition-Cs2v43FM.js → matrix-analytical-definition-DOVSFFuf.js} +390 -542
- package/dist/chunks/{metric-comparison-Be4uS3Ql.js → metric-comparison-ZmurmEIs.js} +2 -2
- package/dist/chunks/{pivot-header-presentation-uH06jiZD.js → pivot-header-presentation-CdeTU96P.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-DvZY4eJM.js → pivot-result-contract-expectations-Bx_BCu-7.js} +1010 -1005
- package/dist/chunks/{pivot-result-identity-BZexMfmL.js → pivot-result-identity-Bvs6Uq3v.js} +1 -1
- package/dist/chunks/raw-temporal-value-DH-feMc2.js +322 -0
- package/dist/chunks/{report-preferences-dialog-DWeVe2so.js → report-preferences-dialog-B-CoyS1x.js} +119 -119
- package/dist/chunks/{resolve-dashboard-input-context-uATCuOP7.js → resolve-dashboard-input-context-BTTdKXH0.js} +10273 -10190
- package/dist/chunks/{saved-dashboard-context-DSVV9iqW.js → saved-dashboard-context-B-rosN4W.js} +78 -75
- package/dist/chunks/{semaphor-ready-indicator-B9vvRMnJ.js → semaphor-ready-indicator-Cy1n_04D.js} +28208 -27864
- package/dist/chunks/{shelf-drop-preview-context-BHOnp5Bo.js → shelf-drop-preview-context-Bmz54WYm.js} +2 -2
- package/dist/chunks/{stored-dashboard-xc5iidHL.js → stored-dashboard-rDJ8sw6J.js} +601 -596
- package/dist/chunks/{table-export-sheet-Cv_94obr.js → table-export-sheet-Dmtqi5NV.js} +1 -1
- package/dist/chunks/{variable-draft-C3CjhsJQ.js → variable-draft-DvngkRMl.js} +3 -3
- package/dist/chunks/{visual-choice-JiJ-_3bi.js → visual-choice-BBPizkRo.js} +74 -72
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +699 -688
- package/dist/format-utils/index.js +145 -142
- package/dist/index.js +14 -14
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/index.js +2 -2
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +86 -3
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +49 -27
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +30 -2
- package/dist/types/shared/analytics-protocol/click-reach-filter-id.d.ts +9 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +3 -1
- package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-card-decision.d.ts +102 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +13 -1
- package/dist/types/shared/dashboard-authoring/index.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +191 -0
- package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/see-records/measure-kind.d.ts +5 -2
- package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +37 -4
- package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +13 -0
- package/dist/types/shared/format-utils/semantic-format.d.ts +0 -1
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +20 -0
- package/dist/types/shared/temporal/calendar-periods.d.ts +15 -0
- package/dist/types/shared/temporal/raw-temporal-equality.d.ts +14 -0
- package/package.json +2 -2
- package/dist/chunks/raw-temporal-value-DdT0s47W.js +0 -159
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { MetricComparisonMetadataEntry, ResolvedDateWindow, ComparisonUnavailableReason } from '../analytics-protocol/metric-comparison.js';
|
|
2
|
+
import { TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
|
|
3
|
+
import { RelativeDateWindow } from '../analytics-protocol/relative-date/index.js';
|
|
4
|
+
/** Where the date came from: Trend By, a configured comparison date, the dataset's primary date, the date filter's field. */
|
|
5
|
+
export type KpiDateFieldSource = 'trend_by' | 'comparison_date' | 'primary_date' | 'filter_field';
|
|
6
|
+
/** A date range on the counted date, from the dashboard's filters or the card's own. */
|
|
7
|
+
export type KpiDateWindowFact = {
|
|
8
|
+
source: 'dashboard' | 'card';
|
|
9
|
+
filterId?: string;
|
|
10
|
+
/** A dashboard date that replaced the card's own range on this field (Global Date). */
|
|
11
|
+
governing?: true;
|
|
12
|
+
/**
|
|
13
|
+
* Not applied by the run: the card's own range a governing dashboard date
|
|
14
|
+
* replaced, or any window the period counted doesn't lie inside (a
|
|
15
|
+
* comparison ran another window in its place, or the filter didn't reach
|
|
16
|
+
* the card).
|
|
17
|
+
*/
|
|
18
|
+
replaced?: true;
|
|
19
|
+
/** The range as the database evaluates it. */
|
|
20
|
+
window?: ResolvedDateWindow;
|
|
21
|
+
/** The relative window it was written as, when it is one, as stored. */
|
|
22
|
+
relative?: unknown;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A condition on the counted date that is not a range (an open bound such as
|
|
26
|
+
* "on or after", an exclusion, an empty check) or that sits inside an OR or
|
|
27
|
+
* negated group: it narrows the value without a window. As a filter value,
|
|
28
|
+
* so the filter line words it.
|
|
29
|
+
*/
|
|
30
|
+
export type KpiDateConditionFact = {
|
|
31
|
+
source: 'dashboard' | 'card';
|
|
32
|
+
filterId?: string;
|
|
33
|
+
operation: string;
|
|
34
|
+
values: unknown[];
|
|
35
|
+
valueType?: string;
|
|
36
|
+
relative?: unknown;
|
|
37
|
+
/**
|
|
38
|
+
* Inside an OR or negated group: what it does depends on the group's logic,
|
|
39
|
+
* which is not carried, so it is stated as a condition group, never by its
|
|
40
|
+
* own operator.
|
|
41
|
+
*/
|
|
42
|
+
conditional?: true;
|
|
43
|
+
};
|
|
44
|
+
/** One clicked value, and the stretch of it the number counts. */
|
|
45
|
+
export type KpiDateSelectedValue = {
|
|
46
|
+
value: string | number | null;
|
|
47
|
+
/** The label the click carried. */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** The stretch a clicked bucket names (`temporalBucketPeriod`); a raw date-time has none. */
|
|
50
|
+
bucket?: ResolvedDateWindow;
|
|
51
|
+
/**
|
|
52
|
+
* The part of the bucket inside the period's date windows, when they cut
|
|
53
|
+
* it (a month clicked under "Last 7 days"); `empty` when they share none.
|
|
54
|
+
* Absent when the whole bucket counts.
|
|
55
|
+
*/
|
|
56
|
+
counted?: {
|
|
57
|
+
status: 'window';
|
|
58
|
+
window: ResolvedDateWindow;
|
|
59
|
+
} | {
|
|
60
|
+
status: 'empty';
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* A click on another card that narrows the counted date (comparison under
|
|
65
|
+
* selection CS-D1). Values are ORed; several sources AND.
|
|
66
|
+
*/
|
|
67
|
+
export type KpiDateSelectionFact = {
|
|
68
|
+
sourceCardId: string;
|
|
69
|
+
values: KpiDateSelectedValue[];
|
|
70
|
+
/** The same values moved by the comparison's offset (CS-D3), against the compared period, when the card compares. */
|
|
71
|
+
compared?: KpiDateSelectedValue[];
|
|
72
|
+
temporalBucket?: TemporalBucketMetadata;
|
|
73
|
+
};
|
|
74
|
+
/** What the server reports beside a config KPI's rows (`KpiResultMetadata.dateContext`). */
|
|
75
|
+
export type KpiDateContext = {
|
|
76
|
+
/** Absent when no date is in use: nothing on Trend By, no primary date, no date filter's field. */
|
|
77
|
+
field?: {
|
|
78
|
+
name: string;
|
|
79
|
+
label?: string;
|
|
80
|
+
source: KpiDateFieldSource;
|
|
81
|
+
};
|
|
82
|
+
windows: KpiDateWindowFact[];
|
|
83
|
+
/** Date conditions beside the windows, as the run kept them. */
|
|
84
|
+
conditions?: KpiDateConditionFact[];
|
|
85
|
+
selections?: KpiDateSelectionFact[];
|
|
86
|
+
/** The windows' intersection; `empty` when they share no instant; absent when no window applies. */
|
|
87
|
+
counted?: {
|
|
88
|
+
status: 'window';
|
|
89
|
+
window: ResolvedDateWindow;
|
|
90
|
+
} | {
|
|
91
|
+
status: 'empty';
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export type KpiDateWindowView = {
|
|
95
|
+
source: 'dashboard_filter' | 'governing_date' | 'card';
|
|
96
|
+
applied: boolean;
|
|
97
|
+
window?: ResolvedDateWindow;
|
|
98
|
+
relative?: RelativeDateWindow;
|
|
99
|
+
};
|
|
100
|
+
type PeriodComparisonKind = Exclude<MetricComparisonMetadataEntry['type'], 'target'>;
|
|
101
|
+
export type KpiCountedPeriod = {
|
|
102
|
+
kind: 'window';
|
|
103
|
+
window: ResolvedDateWindow;
|
|
104
|
+
relative?: RelativeDateWindow;
|
|
105
|
+
} | {
|
|
106
|
+
kind: 'empty';
|
|
107
|
+
} | {
|
|
108
|
+
kind: 'all_time';
|
|
109
|
+
} | {
|
|
110
|
+
kind: 'no_date';
|
|
111
|
+
};
|
|
112
|
+
/** The date context as the tile and the editor state it. */
|
|
113
|
+
export type KpiDateContextView = {
|
|
114
|
+
field?: KpiDateContext['field'];
|
|
115
|
+
windows: KpiDateWindowView[];
|
|
116
|
+
/** Date conditions beside the windows: the period is narrower than its dates say. */
|
|
117
|
+
conditions: KpiDateConditionFact[];
|
|
118
|
+
/** Every click narrowing the date, one per source card (ANDed). */
|
|
119
|
+
selections: KpiDateSelectionFact[];
|
|
120
|
+
counted: KpiCountedPeriod;
|
|
121
|
+
/** The compared period, when the comparison ran. */
|
|
122
|
+
compared?: {
|
|
123
|
+
window: ResolvedDateWindow;
|
|
124
|
+
kind: PeriodComparisonKind;
|
|
125
|
+
};
|
|
126
|
+
/** Why the card's period comparison is off, when it is. */
|
|
127
|
+
comparisonOff?: {
|
|
128
|
+
kind: PeriodComparisonKind;
|
|
129
|
+
reason: ComparisonUnavailableReason;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Two applied windows narrow each other, so the number counts only their
|
|
133
|
+
* overlap (KD-D5), named by where the windows come from: the dashboard's
|
|
134
|
+
* and the card's, two of the dashboard's, or two of the card's own.
|
|
135
|
+
*/
|
|
136
|
+
overlap?: 'dashboard_and_card' | 'dashboard' | 'card';
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* The date context from the response: the server's facts and the value's
|
|
140
|
+
* comparison entry (`getComparisonMetadataForMetric`). Undefined for a
|
|
141
|
+
* response without the facts (a SQL KPI, an older response).
|
|
142
|
+
*/
|
|
143
|
+
export declare function readKpiDateContext(context: KpiDateContext | undefined, comparison?: MetricComparisonMetadataEntry): KpiDateContextView | undefined;
|
|
144
|
+
export type KpiDateWordsOptions = {
|
|
145
|
+
/** The title of the card a click came from. */
|
|
146
|
+
cardTitle?: (cardId: string) => string | undefined;
|
|
147
|
+
/** Dates in this year read without it. Defaults to now. */
|
|
148
|
+
now?: Date;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* A window as compact dates, in its own time zone: "Nov 2", "Nov 1 – 3",
|
|
152
|
+
* "Oct 28 – Nov 3", the year added when it isn't this year's; a window
|
|
153
|
+
* ending partway through a day with its end time ("Nov 1 – 3, until 3:00 PM");
|
|
154
|
+
* one starting partway through a day with both times.
|
|
155
|
+
*/
|
|
156
|
+
export declare function describeDateWindow(window: ResolvedDateWindow, now?: Date): string;
|
|
157
|
+
/** The editor's Date section (KD-D4, KD-D5). */
|
|
158
|
+
export type KpiDateSectionWords = {
|
|
159
|
+
field?: {
|
|
160
|
+
name: string;
|
|
161
|
+
from: string;
|
|
162
|
+
};
|
|
163
|
+
windows: Array<{
|
|
164
|
+
text: string;
|
|
165
|
+
from: string;
|
|
166
|
+
applied: boolean;
|
|
167
|
+
}>;
|
|
168
|
+
counts: string;
|
|
169
|
+
compared?: string;
|
|
170
|
+
note?: {
|
|
171
|
+
tone: 'warn' | 'muted';
|
|
172
|
+
text: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
export declare function describeKpiDateSection(view: KpiDateContextView, options?: KpiDateWordsOptions): KpiDateSectionWords;
|
|
176
|
+
/** The tile's lines (KD-D3): the period it counts, and the compared period or why there is none. */
|
|
177
|
+
export type KpiTileDateWords = {
|
|
178
|
+
/** The muted line under the title; absent with no date in use. */
|
|
179
|
+
period?: {
|
|
180
|
+
text: string;
|
|
181
|
+
clicked: boolean;
|
|
182
|
+
};
|
|
183
|
+
/** Ends the comparison line in place of "previous". */
|
|
184
|
+
compared?: string;
|
|
185
|
+
/** Replaces the comparison when it is off. */
|
|
186
|
+
off?: string;
|
|
187
|
+
};
|
|
188
|
+
export declare function describeKpiTileDate(view: KpiDateContextView, options?: Pick<KpiDateWordsOptions, 'now'>): KpiTileDateWords;
|
|
189
|
+
/** The Trend By shelf's hint when it is empty (KD-D6). */
|
|
190
|
+
export declare function kpiTrendByHint(view: KpiDateContextView | undefined): string | undefined;
|
|
191
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { CardConfig, MetricField } from '../../lib/types/explorer-types.js';
|
|
|
3
3
|
import { ComparisonMetadataMap } from '../../lib/types/query-types.js';
|
|
4
4
|
import { MetricComparisonEvaluation, MetricComparisonPolarity } from '../analytics-protocol/index.js';
|
|
5
5
|
import { TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
|
|
6
|
+
import { KpiDateContext } from './kpi-date-context.js';
|
|
6
7
|
type KpiCard = Pick<TCard, 'sql' | 'config' | 'preferences'>;
|
|
7
8
|
/**
|
|
8
9
|
* Which column is the value, by source. The shape reads ids, never formats, so
|
|
@@ -102,6 +103,8 @@ export type KpiResultMetadata = {
|
|
|
102
103
|
comparisonMetadata?: ComparisonMetadataMap;
|
|
103
104
|
/** The trend's grain and calendar, when the response has trend rows (KL-D28). */
|
|
104
105
|
trend?: TemporalBucketMetadata;
|
|
106
|
+
/** Which date it counts, its windows and its compared period (KPI date context KD-D1). */
|
|
107
|
+
dateContext?: KpiDateContext;
|
|
105
108
|
};
|
|
106
109
|
/** The id a row names its measure by (`id`, else `name`): the server writes it, the owner reads it. */
|
|
107
110
|
export declare function kpiSegmentMetricId(metric: Pick<MetricField, 'id' | 'name'>): string;
|
|
@@ -39,8 +39,11 @@ export type SeeRecordsMeasureKind =
|
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
41
|
* A field as a plain column of a list: no aggregate, measure filters or
|
|
42
|
-
* comparison, and the detail role, so a filter on it is a
|
|
43
|
-
* never a measure filter (HAVING), and the list never
|
|
42
|
+
* comparison, not pre-aggregated, and the detail role, so a filter on it is a
|
|
43
|
+
* row filter (WHERE), never a measure filter (HAVING), and the list never
|
|
44
|
+
* compares. A calculated measure's `isPreAggregated` says its expression
|
|
45
|
+
* holds its own aggregate; on the row expression it reads, the filter
|
|
46
|
+
* compiler would take the field for a stored column (ledger P5-06).
|
|
44
47
|
*/
|
|
45
48
|
export declare function seeRecordsRowField(field: Field): Field;
|
|
46
49
|
export declare function seeRecordsMeasureKind(measure: MetricField): SeeRecordsMeasureKind;
|
|
@@ -28,6 +28,28 @@ export type SeeRecordsColumn = {
|
|
|
28
28
|
*/
|
|
29
29
|
rawTemporal?: RawTemporalValueMetadata;
|
|
30
30
|
};
|
|
31
|
+
/** One folder of More columns: a dataset and the fields a list can add from it. */
|
|
32
|
+
export type SeeRecordsColumnFolder = {
|
|
33
|
+
/** As a column ref names it (`SeeRecordsColumnRef.dataset`). */
|
|
34
|
+
dataset: string;
|
|
35
|
+
label: string;
|
|
36
|
+
/** The datasets' labels from the line's dataset to this one; empty for the line's own. */
|
|
37
|
+
path: readonly string[];
|
|
38
|
+
columns: readonly {
|
|
39
|
+
field: string;
|
|
40
|
+
label: string;
|
|
41
|
+
}[];
|
|
42
|
+
/**
|
|
43
|
+
* The folder this one opens from (see-records related columns P2-14): the
|
|
44
|
+
* dataset one step nearer the line on its route, and, when that step joins
|
|
45
|
+
* on one field the parent offers, that field, so the picker nests the
|
|
46
|
+
* folder under it. Absent on the line's own folder.
|
|
47
|
+
*/
|
|
48
|
+
parent?: {
|
|
49
|
+
dataset: string;
|
|
50
|
+
field?: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
31
53
|
export type SeeRecordsResult = {
|
|
32
54
|
shape: SeeRecordsShape;
|
|
33
55
|
/** The listed measure's label, then the click's label when it has one. */
|
|
@@ -52,10 +74,21 @@ export type SeeRecordsResult = {
|
|
|
52
74
|
inputMeasureId: string;
|
|
53
75
|
label: string;
|
|
54
76
|
}[];
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
/**
|
|
78
|
+
* More columns, one folder per dataset a line belongs to: the line's own
|
|
79
|
+
* dataset first, then the datasets the card reaches, then the datasets
|
|
80
|
+
* reached through to-one relationships (see-records related columns SC-D1,
|
|
81
|
+
* SC-D8). Fields with one value per line, not hidden and not shown; a
|
|
82
|
+
* dataset with none has no folder.
|
|
83
|
+
*/
|
|
84
|
+
columnFolders: readonly SeeRecordsColumnFolder[];
|
|
85
|
+
/**
|
|
86
|
+
* The name of the records the list counts: the dataset whose rows the
|
|
87
|
+
* listed measure aggregates, by its label ("Dashboard Requests"). A grouped
|
|
88
|
+
* list's More columns names it in its hint (see-records related columns
|
|
89
|
+
* P2-13).
|
|
90
|
+
*/
|
|
91
|
+
recordsLabel: string;
|
|
59
92
|
/** The instant and anchors this exploration keeps; sent back with every later request. */
|
|
60
93
|
temporalState: OperationTemporalState;
|
|
61
94
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TFilterValue } from '../../components/surfboard/filter/types.js';
|
|
2
2
|
import { TCard } from '../../lib/types/common-types.js';
|
|
3
|
+
import { DashboardCardFilterSourceInventory } from './dashboard-card-source-index.js';
|
|
3
4
|
/**
|
|
4
5
|
* Where relationship filter reach runs (relationship filter reach RF-D18): a
|
|
5
6
|
* card on a semantic domain with no explicit join plan. The join plan is read
|
|
@@ -20,3 +21,15 @@ export declare function filterValueSemanticDataset(value: Pick<TFilterValue, 'fi
|
|
|
20
21
|
domainId: string;
|
|
21
22
|
datasetName: string;
|
|
22
23
|
} | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Row 7r (relationship filter reach): a dataset reaches a card through its
|
|
26
|
+
* domain's relationships when the card is a semantic auto-join config card in
|
|
27
|
+
* that dataset's domain and executes no source of that dataset. The browser
|
|
28
|
+
* only decides to send a value; the server decides the route. A toolbar
|
|
29
|
+
* filter asks it with its value's dataset (`decideDashboardFilterCardTarget`),
|
|
30
|
+
* a click with the clicked field's (click relationship reach CR-D14).
|
|
31
|
+
*/
|
|
32
|
+
export declare function cardReachesDatasetThroughRelationships(card: Parameters<typeof isSemanticAutoJoinCard>[0], dataset: {
|
|
33
|
+
domainId: string;
|
|
34
|
+
datasetName: string;
|
|
35
|
+
} | undefined, sourceIndex: DashboardCardFilterSourceInventory): boolean;
|
|
@@ -35,7 +35,6 @@ export type CanonicalAdapterOptions = {
|
|
|
35
35
|
numericInput?: 'canonical';
|
|
36
36
|
};
|
|
37
37
|
export declare const DEFAULT_LOCALE = "en-US";
|
|
38
|
-
export declare function isHistoricalCodelessCurrencyFormat(format: LegacySemanticFormat): boolean;
|
|
39
38
|
export declare function normalizeLocaleOrCurrency(value: unknown): string | undefined;
|
|
40
39
|
export declare function normalizeNumericFormat(type: NumericCanonicalFormat['type'], format: LegacySemanticFormat, options?: CanonicalAdapterOptions): NumericCanonicalFormat;
|
|
41
40
|
export declare function normalizeDateFormat(format: LegacySemanticFormat): Extract<CanonicalFormatSpec, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExportWallClock } from './exporters/export-cells.js';
|
|
2
2
|
import { SemaphorTimeGrain, TemporalBucketFormat, TemporalBucketMetadata, TemporalBucketPreset } from '../analytics-protocol/contracts.js';
|
|
3
|
+
import { TemporalShift } from '../temporal/calendar-periods.js';
|
|
3
4
|
import { ResolvedTemporalStyleSet } from './raw-temporal.js';
|
|
4
5
|
export type { TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
|
|
5
6
|
export type TemporalBucketValue = string | null;
|
|
@@ -69,6 +70,25 @@ export declare class TemporalBucketContractError extends Error {
|
|
|
69
70
|
constructor(code: TemporalBucketContractError['code'], message: string);
|
|
70
71
|
}
|
|
71
72
|
export declare function parseTemporalBucketValue(value: TemporalBucketValue, metadata: TemporalBucketMetadata): TemporalBucketValueParseResult;
|
|
73
|
+
/**
|
|
74
|
+
* A clicked bucket moved by a shift and snapped to the start of the bucket it
|
|
75
|
+
* lands in, on its own calendar (week start, fiscal year): Nov 2 one month
|
|
76
|
+
* back is Oct 2; the week of Nov 2 one month back is the week holding Oct 2;
|
|
77
|
+
* 01:00 one month back is 01:00, whichever occurrence, since the bucket
|
|
78
|
+
* compiler matches the wall clock. Undefined for a value that isn't canonical.
|
|
79
|
+
*/
|
|
80
|
+
export declare function shiftTemporalBucketValue(value: TemporalBucketValue, metadata: TemporalBucketMetadata, shift: TemporalShift): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The stretch of time a bucket names, on its own calendar: from its start to
|
|
83
|
+
* the next bucket's start (a day, a week from its week start, a fiscal
|
|
84
|
+
* quarter). Read where a clicked bucket is stated as dates (KPI date context
|
|
85
|
+
* KD-D2). Undefined for a value that isn't canonical, or a blank.
|
|
86
|
+
*/
|
|
87
|
+
export declare function temporalBucketPeriod(value: TemporalBucketValue, metadata: TemporalBucketMetadata): {
|
|
88
|
+
startInclusive: string;
|
|
89
|
+
endExclusive: string;
|
|
90
|
+
timezone: string;
|
|
91
|
+
} | undefined;
|
|
72
92
|
/**
|
|
73
93
|
* A bucket's grain and governed calendar in words, for a reader that restates
|
|
74
94
|
* a bucketed condition ("by hour in the America/Chicago calendar; each value
|
|
@@ -16,6 +16,15 @@ export type TemporalPeriod = {
|
|
|
16
16
|
export type WallClockTime = Required<ZonedWallClockTime>;
|
|
17
17
|
/** Units measured as elapsed time rather than on the calendar, in milliseconds. */
|
|
18
18
|
export declare const ELAPSED_UNIT_MILLISECONDS: Partial<Record<TemporalUnit, number>>;
|
|
19
|
+
/**
|
|
20
|
+
* A move along the calendar: whole months (the day clamped to the month's
|
|
21
|
+
* last), whole days, or seconds, as a period comparison moves its window and
|
|
22
|
+
* every selection under it (comparison under selection CS-D4).
|
|
23
|
+
*/
|
|
24
|
+
export type TemporalShift = {
|
|
25
|
+
amount: number;
|
|
26
|
+
unit: 'month' | 'day' | 'second';
|
|
27
|
+
};
|
|
19
28
|
/** The wall clock at an instant, with its milliseconds (offsets are whole seconds). */
|
|
20
29
|
export declare function wallClockAt(instant: Date, tz: string): WallClockTime;
|
|
21
30
|
/** The instant a wall clock names, under the daylight-saving rule (K7). */
|
|
@@ -29,6 +38,12 @@ export declare function daysInMonth(year: number, month: number): number;
|
|
|
29
38
|
export declare function shiftWallClock(wall: WallClockTime, amount: number, unit: TemporalUnit): WallClockTime;
|
|
30
39
|
/** The weekday of a wall date, 0 for Sunday. */
|
|
31
40
|
export declare function wallWeekday(wall: Pick<WallClockTime, 'year' | 'month' | 'day'>): number;
|
|
41
|
+
/**
|
|
42
|
+
* The wall clock where the period containing `wall` starts: the week on the
|
|
43
|
+
* calendar's week start, quarters and years on its fiscal year (calendar
|
|
44
|
+
* quarters and years without one).
|
|
45
|
+
*/
|
|
46
|
+
export declare function startOfPeriodWall(wall: WallClockTime, unit: Exclude<TemporalUnit, 'second' | 'minute' | 'hour'>, calendar: TemporalCalendar): WallClockTime;
|
|
32
47
|
/**
|
|
33
48
|
* The period `offset` periods from the one containing `instant` (0 for that
|
|
34
49
|
* period, -1 for the one before). Calendar periods are found in the wall
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { RawTemporalSelection } from '../analytics-protocol/contracts.js';
|
|
2
|
+
import { TemporalShift } from './calendar-periods.js';
|
|
1
3
|
/** An `=` or `!=` on a raw date-time selection, as the instants its value names. */
|
|
2
4
|
export type RawTemporalEquality = {
|
|
3
5
|
operation: '=' | '!=';
|
|
@@ -17,3 +19,15 @@ export declare function readRawTemporalEquality(predicate: {
|
|
|
17
19
|
values: unknown;
|
|
18
20
|
rawTemporal?: unknown;
|
|
19
21
|
}): RawTemporalEquality | null;
|
|
22
|
+
/**
|
|
23
|
+
* A raw date a viewer clicked, moved by a period comparison's shift
|
|
24
|
+
* (comparison under selection CS-D3), read by the same grammar the selection
|
|
25
|
+
* filter reads it with (`parseRawTemporalValue`), as its kind: a date moves
|
|
26
|
+
* its day; a wall date-time moves its wall clock; an instant moves along the
|
|
27
|
+
* report's calendar and is written in UTC. The fraction after the second is
|
|
28
|
+
* kept digit for digit (a whole-second shift never changes it), so
|
|
29
|
+
* `2026-10-23T13:31:11.981000` stays a six-digit value. Undefined for text
|
|
30
|
+
* the grammar doesn't read as its kind: the selection filter doesn't read it
|
|
31
|
+
* as a raw date either.
|
|
32
|
+
*/
|
|
33
|
+
export declare function shiftRawTemporalSelectionValue(value: string, selection: RawTemporalSelection, shift: TemporalShift): string | undefined;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "support@semaphor.cloud"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.586",
|
|
9
9
|
"description": "Fully interactive and customizable dashboards for your apps.",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"react",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"build": "node scripts/build.mjs",
|
|
118
118
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
119
119
|
"lint:regressions": "node scripts/lint-regressions.mjs",
|
|
120
|
-
"check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs",
|
|
120
|
+
"check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs && node scripts/host-color-variables.mjs",
|
|
121
121
|
"preview": "vite preview",
|
|
122
122
|
"test": "vitest run",
|
|
123
123
|
"test:changed": "vitest run --changed",
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
var y = Object.defineProperty;
|
|
2
|
-
var h = (t, e, a) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
3
|
-
var l = (t, e, a) => h(t, typeof e != "symbol" ? e + "" : e, a);
|
|
4
|
-
import { R } from "./analytics-base-schemas-BaIQrEzX.js";
|
|
5
|
-
const f = /* @__PURE__ */ new Map();
|
|
6
|
-
function _(t, e) {
|
|
7
|
-
let a = f.get(e);
|
|
8
|
-
a || (a = new Intl.DateTimeFormat("en-CA", {
|
|
9
|
-
calendar: "gregory",
|
|
10
|
-
numberingSystem: "latn",
|
|
11
|
-
timeZone: e,
|
|
12
|
-
year: "numeric",
|
|
13
|
-
month: "2-digit",
|
|
14
|
-
day: "2-digit",
|
|
15
|
-
hour: "2-digit",
|
|
16
|
-
minute: "2-digit",
|
|
17
|
-
second: "2-digit",
|
|
18
|
-
hourCycle: "h23"
|
|
19
|
-
}), f.set(e, a));
|
|
20
|
-
const n = a.formatToParts(t), o = (r) => {
|
|
21
|
-
var s;
|
|
22
|
-
return Number((s = n.find((d) => d.type === r)) == null ? void 0 : s.value);
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
year: o("year"),
|
|
26
|
-
month: o("month"),
|
|
27
|
-
day: o("day"),
|
|
28
|
-
hour: o("hour"),
|
|
29
|
-
minute: o("minute"),
|
|
30
|
-
second: o("second")
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function m(t) {
|
|
34
|
-
const e = /* @__PURE__ */ new Date(0);
|
|
35
|
-
return e.setUTCFullYear(t.year, t.month - 1, t.day), e.setUTCHours(t.hour, t.minute, t.second, t.millisecond ?? 0), e.getTime();
|
|
36
|
-
}
|
|
37
|
-
function u(t, e) {
|
|
38
|
-
const a = t - (t % 1e3 + 1e3) % 1e3;
|
|
39
|
-
return m(_(new Date(a), e)) - a;
|
|
40
|
-
}
|
|
41
|
-
const c = 864e5;
|
|
42
|
-
function k(t, e) {
|
|
43
|
-
const a = b(t, e);
|
|
44
|
-
if (a.length) return a[0];
|
|
45
|
-
const n = m(t);
|
|
46
|
-
return new Date(n - u(n - c, e));
|
|
47
|
-
}
|
|
48
|
-
function b(t, e) {
|
|
49
|
-
const a = m(t), n = u(a - c, e), o = u(a + c, e);
|
|
50
|
-
return [.../* @__PURE__ */ new Set([n, o])].map((r) => a - r).filter((r) => u(r, e) === a - r).sort((r, s) => r - s).map((r) => new Date(r));
|
|
51
|
-
}
|
|
52
|
-
class i extends Error {
|
|
53
|
-
constructor(a) {
|
|
54
|
-
super(a);
|
|
55
|
-
l(this, "code");
|
|
56
|
-
this.name = "RawTemporalMetadataContractError", this.code = R.invalidMetadata;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function g(t) {
|
|
60
|
-
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
61
|
-
return !1;
|
|
62
|
-
const e = Object.getPrototypeOf(t);
|
|
63
|
-
return e === null || e === Object.prototype;
|
|
64
|
-
}
|
|
65
|
-
function N(t) {
|
|
66
|
-
if (!g(t))
|
|
67
|
-
throw new i(
|
|
68
|
-
"Raw temporal metadata must be an object."
|
|
69
|
-
);
|
|
70
|
-
const e = Object.keys(t);
|
|
71
|
-
if (e.length !== 2 || !e.includes("kind") || !e.includes("valueKind"))
|
|
72
|
-
throw new i(
|
|
73
|
-
"Raw temporal metadata must contain only kind and valueKind."
|
|
74
|
-
);
|
|
75
|
-
if (t.kind !== "raw_temporal")
|
|
76
|
-
throw new i(
|
|
77
|
-
"Raw temporal metadata kind must be raw_temporal."
|
|
78
|
-
);
|
|
79
|
-
if (t.valueKind !== "date" && t.valueKind !== "wall_datetime" && t.valueKind !== "instant")
|
|
80
|
-
throw new i(
|
|
81
|
-
"Raw temporal valueKind must be date, wall_datetime, or instant."
|
|
82
|
-
);
|
|
83
|
-
return {
|
|
84
|
-
kind: "raw_temporal",
|
|
85
|
-
valueKind: t.valueKind
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function K(t, e) {
|
|
89
|
-
if (!t.rawTemporal) {
|
|
90
|
-
if (e.metadataRequired)
|
|
91
|
-
throw new i(
|
|
92
|
-
"Activated raw temporal result is missing metadata."
|
|
93
|
-
);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (t.temporalBucket)
|
|
97
|
-
throw new i(
|
|
98
|
-
"A result column cannot carry both raw and grouped temporal metadata."
|
|
99
|
-
);
|
|
100
|
-
const a = N(t.rawTemporal), n = a.valueKind === "date" ? "date" : "datetime";
|
|
101
|
-
if (t.dataType !== n)
|
|
102
|
-
throw new i(
|
|
103
|
-
`${a.valueKind} raw temporal values require dataType ${n}.`
|
|
104
|
-
);
|
|
105
|
-
return a;
|
|
106
|
-
}
|
|
107
|
-
const p = /^(\d{4})-(\d{2})-(\d{2})$/, w = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, T = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
108
|
-
function O(t) {
|
|
109
|
-
if (p.test(t)) return "date";
|
|
110
|
-
if (T.test(t)) return "instant";
|
|
111
|
-
if (w.test(t)) return "wall_datetime";
|
|
112
|
-
}
|
|
113
|
-
function A(t) {
|
|
114
|
-
return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
|
|
115
|
-
}
|
|
116
|
-
function C(t, e) {
|
|
117
|
-
return e === 2 ? A(t) ? 29 : 28 : [4, 6, 9, 11].includes(e) ? 30 : 31;
|
|
118
|
-
}
|
|
119
|
-
function v(t) {
|
|
120
|
-
return t.year >= 1 && t.year <= 9999 && t.month >= 1 && t.month <= 12 && t.day >= 1 && t.day <= C(t.year, t.month) && t.hour >= 0 && t.hour <= 23 && t.minute >= 0 && t.minute <= 59 && t.second >= 0 && t.second <= 59;
|
|
121
|
-
}
|
|
122
|
-
function E(t) {
|
|
123
|
-
return {
|
|
124
|
-
year: Number(t[1]),
|
|
125
|
-
month: Number(t[2]),
|
|
126
|
-
day: Number(t[3]),
|
|
127
|
-
hour: Number(t[4] ?? 0),
|
|
128
|
-
minute: Number(t[5] ?? 0),
|
|
129
|
-
second: Number(t[6] ?? 0),
|
|
130
|
-
fraction: t[7] ?? ""
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function I(t, e) {
|
|
134
|
-
const a = e === "date" ? t.match(p) : e === "wall_datetime" ? t.match(w) : t.match(T);
|
|
135
|
-
if (!a) return { status: "invalid_shape" };
|
|
136
|
-
const n = E(a);
|
|
137
|
-
if (!v(n)) return { status: "out_of_range" };
|
|
138
|
-
if (e === "instant") {
|
|
139
|
-
const o = a[8];
|
|
140
|
-
if (o && o !== "Z") {
|
|
141
|
-
const [s, d] = o.slice(1).split(":").map(Number);
|
|
142
|
-
if (s > 23 || d > 59) return { status: "out_of_range" };
|
|
143
|
-
}
|
|
144
|
-
const r = new Date(t.replace(" ", "T"));
|
|
145
|
-
return Number.isNaN(r.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: n, instant: r };
|
|
146
|
-
}
|
|
147
|
-
return { status: "valid", fields: n };
|
|
148
|
-
}
|
|
149
|
-
export {
|
|
150
|
-
i as R,
|
|
151
|
-
I as a,
|
|
152
|
-
_ as b,
|
|
153
|
-
O as c,
|
|
154
|
-
k as d,
|
|
155
|
-
N as p,
|
|
156
|
-
K as v,
|
|
157
|
-
m as w,
|
|
158
|
-
b as z
|
|
159
|
-
};
|