react-semaphor 0.1.582 → 0.1.584

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/analytics-protocol/index.js +183 -178
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +7 -7
  4. package/dist/briefings/index.js +4 -4
  5. package/dist/chunks/aggregate-measure-field-DsFXETpI.js +22 -0
  6. package/dist/chunks/{assistant-chat-CVtxjVEH.js → assistant-chat-nmycV1Se.js} +12 -12
  7. package/dist/chunks/{bookmark-impact-BDSeeRy7.js → bookmark-impact-CI3gmxi0.js} +2 -2
  8. package/dist/chunks/{bookmark-state-BEl_G9vr.js → bookmark-state-D9-RFkDg.js} +22 -22
  9. package/dist/chunks/{card-filter-builder-CMZ5nwdC.js → card-filter-builder-C7QyPqRy.js} +145 -145
  10. package/dist/chunks/{comparison-window-caption-sRFtnX1q.js → comparison-window-caption-BAnsTI8y.js} +291 -305
  11. package/dist/chunks/{dashboard-briefing-launcher-C9wf8KhD.js → dashboard-briefing-launcher-DXs0XA1O.js} +13 -13
  12. package/dist/chunks/{dashboard-controls-PDb9Gap5.js → dashboard-controls-6Zoo8d8Y.js} +84 -84
  13. package/dist/chunks/{dashboard-BNn7fpDY.js → dashboard-inJy_V78.js} +1 -1
  14. package/dist/chunks/{dashboard-json-CvtVy2UH.js → dashboard-json-D5eJhVA9.js} +4 -4
  15. package/dist/chunks/{dates-B42fboJU.js → dates-B3_GWc_Y.js} +8 -8
  16. package/dist/chunks/{edit-dashboard-visual-Cat0RWPp.js → edit-dashboard-visual-DR03SYeW.js} +17 -17
  17. package/dist/chunks/{filter-reach-copy-C-RH1rVx.js → filter-reach-copy-CZwzrxBp.js} +1403 -1240
  18. package/dist/chunks/{filter-value-text-DXGYypEd.js → filter-value-text-DtOvqcjn.js} +8 -8
  19. package/dist/chunks/{index-JWLo4R_t.js → index-BgT1L0p5.js} +5 -5
  20. package/dist/chunks/{layout-grid-8rR-LPTk.js → layout-grid-9nSS2SL-.js} +1 -1
  21. package/dist/chunks/{list-filter-C1-uTgjR.js → list-filter-CfMPI6v4.js} +1 -1
  22. package/dist/chunks/{matrix-analytical-definition-dkS8szLM.js → matrix-analytical-definition-Cs2v43FM.js} +3 -3
  23. package/dist/chunks/{matrix-member-presentation-DRa-9e6Q.js → matrix-member-presentation-BKDyxJho.js} +1 -1
  24. package/dist/chunks/{matrix-operation-contract-DCVinw1o.js → matrix-operation-contract-BM5TveR3.js} +153 -147
  25. package/dist/chunks/{metric-comparison-n9NsIa-2.js → metric-comparison-Be4uS3Ql.js} +1 -1
  26. package/dist/chunks/{paintbrush-aR17Z3C9.js → paintbrush-LzAje2ff.js} +1 -1
  27. package/dist/chunks/{palette-a5FCZKFI.js → palette-DicJG0TC.js} +1 -1
  28. package/dist/chunks/{pivot-header-presentation-MvvlxtIB.js → pivot-header-presentation-uH06jiZD.js} +1 -1
  29. package/dist/chunks/{pivot-result-contract-expectations-8tuNjRvG.js → pivot-result-contract-expectations-DvZY4eJM.js} +779 -765
  30. package/dist/chunks/{pivot-result-identity-B89X5xjb.js → pivot-result-identity-BZexMfmL.js} +1 -1
  31. package/dist/chunks/{report-preferences-dialog-CwbsD6t6.js → report-preferences-dialog-DWeVe2so.js} +171 -170
  32. package/dist/chunks/{report-runtime-context-BhPzLTbS.js → report-runtime-context-NlOXwyRB.js} +1 -1
  33. package/dist/chunks/{resolve-dashboard-input-context-6FP1-7aU.js → resolve-dashboard-input-context-uATCuOP7.js} +5083 -4973
  34. package/dist/chunks/{save-D985VvYp.js → save-0wu1Z1U7.js} +1 -1
  35. package/dist/chunks/{saved-dashboard-context-D2G0uLji.js → saved-dashboard-context-DSVV9iqW.js} +6 -6
  36. package/dist/chunks/selection-filter-compiler-BReJy-uv.js +92 -0
  37. package/dist/chunks/{semaphor-ready-indicator-UhNS27Gy.js → semaphor-ready-indicator-B9vvRMnJ.js} +46773 -45614
  38. package/dist/chunks/{shelf-drop-preview-context-DPksW68k.js → shelf-drop-preview-context-BHOnp5Bo.js} +5 -5
  39. package/dist/chunks/{stored-dashboard-KpTy4umJ.js → stored-dashboard-xc5iidHL.js} +210 -221
  40. package/dist/chunks/{style-sheet-parts-C7qGZuH1.js → style-sheet-parts-_dGSFzDi.js} +2 -2
  41. package/dist/chunks/{table-export-sheet-wBkk17aa.js → table-export-sheet-Cv_94obr.js} +1 -1
  42. package/dist/chunks/{token-types-iKMplaBL.js → token-types-DEe_FP4l.js} +1 -1
  43. package/dist/chunks/{upload-CiGNKJ_0.js → upload-CtyOkU_B.js} +1 -1
  44. package/dist/chunks/{validators-B8fpdinG.js → validators-CJ8Jh0E8.js} +2 -2
  45. package/dist/chunks/{variable-draft-CP5I66_J.js → variable-draft-C3CjhsJQ.js} +4 -4
  46. package/dist/dashboard/index.js +2 -2
  47. package/dist/dashboard-authoring/index.js +1391 -1364
  48. package/dist/format-utils/index.js +140 -140
  49. package/dist/index.js +234 -231
  50. package/dist/report-runtime-context/index.js +1 -1
  51. package/dist/style.css +1 -1
  52. package/dist/surfboard/index.js +2 -2
  53. package/dist/types/components/ui-custom/date-range-presets.d.ts +7 -0
  54. package/dist/types/components/visual/data-table/types/data-table.d.ts +3 -0
  55. package/dist/types/components/visual/matrix-table/matrix-interaction-actions.d.ts +24 -3
  56. package/dist/types/index.js +5 -5
  57. package/dist/types/lib/hooks/interactions/use-drill-actions.d.ts +1 -1
  58. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +9 -0
  59. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +8 -3
  60. package/dist/types/lib/query-context/compile-selection-filters.d.ts +1 -5
  61. package/dist/types/lib/see-records/click.d.ts +79 -0
  62. package/dist/types/lib/see-records/see-records-offer.d.ts +25 -0
  63. package/dist/types/lib/see-records/use-see-records-offer.d.ts +16 -0
  64. package/dist/types/lib/types/common-types.d.ts +6 -0
  65. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +7 -0
  66. package/dist/types/shared/analytics-protocol/aggregate-measure-field.d.ts +13 -0
  67. package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
  68. package/dist/types/shared/analytics-protocol/selection-filter-compiler.d.ts +3 -0
  69. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +6 -0
  70. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  71. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -1
  72. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -0
  73. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +2 -0
  74. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
  75. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  76. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  77. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +11 -0
  78. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +7 -0
  79. package/dist/types/shared/dashboard-authoring/see-records/availability.d.ts +30 -0
  80. package/dist/types/shared/dashboard-authoring/see-records/click.d.ts +37 -0
  81. package/dist/types/shared/dashboard-authoring/see-records/index.d.ts +12 -0
  82. package/dist/types/shared/dashboard-authoring/see-records/limits.d.ts +18 -0
  83. package/dist/types/shared/dashboard-authoring/see-records/measure-kind.d.ts +46 -0
  84. package/dist/types/shared/dashboard-authoring/see-records/request.d.ts +28 -0
  85. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +61 -0
  86. package/dist/types/shared/usage-events/envelope.d.ts +4 -4
  87. package/package.json +1 -1
  88. package/dist/chunks/selection-filter-compiler-CUDRnUxc.js +0 -80
@@ -0,0 +1,37 @@
1
+ import { ClickFilterCondition } from '../../../lib/types/interaction-types.js';
2
+ /**
3
+ * The clicked measure, by the id the card's result gave it (ED-15): a KPI
4
+ * segment's `metricId` (`kpiSegmentMetricId`), a chart's `semaphorMetricId`,
5
+ * the column key map's metric entry for a table column, a Matrix `measureId`.
6
+ */
7
+ export type SeeRecordsMeasureRef = {
8
+ kind: 'metric';
9
+ resultId: string;
10
+ } | {
11
+ kind: 'matrix';
12
+ measureId: string;
13
+ };
14
+ /** Which part of a card was clicked. Numbers only (SR-D27). */
15
+ export type SeeRecordsClickKind = 'cell' | 'subtotal' | 'grandTotal' | 'kpi';
16
+ export type SeeRecordsClick = {
17
+ sourceCardId: string;
18
+ kind: SeeRecordsClickKind;
19
+ /** Every header, category, series and pivot member the value sits under, AND-ed. Empty for a KPI and a grand total. */
20
+ conditions: readonly ClickFilterCondition[];
21
+ measure: SeeRecordsMeasureRef;
22
+ /** A table totals cell: the column's total kind (`TableColumnTotal`). */
23
+ totalKind?: 'overall' | 'sumOfRows';
24
+ /** The clicked column is a comparison (previous period, change), not the measure itself. */
25
+ comparison?: true;
26
+ /** The number on screen; for the count check only, never to filter. */
27
+ shownValue?: number;
28
+ /** What the viewer clicked, in their words, for the title. Empty for a KPI or a grand total. */
29
+ label: string;
30
+ /**
31
+ * A Matrix number: the levels its row and column paths state, by level id.
32
+ * A total states fewer; one above a measure-filtered level is not listed (SR-D17).
33
+ */
34
+ matrixLevelIds?: readonly string[];
35
+ };
36
+ /** The id a click names its measure by. */
37
+ export declare function seeRecordsMeasureId(measure: SeeRecordsMeasureRef): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * See records: click a number, see the records behind it
3
+ * (semaphor-app docs/implementation-plans/see-records). The shared contract
4
+ * the browser and the server both use: limits, the click, what a measure
5
+ * lists, availability and its words, the request and the result.
6
+ */
7
+ export * from './limits.js';
8
+ export * from './click.js';
9
+ export * from './measure-kind.js';
10
+ export * from './availability.js';
11
+ export * from './request.js';
12
+ export * from './result.js';
@@ -0,0 +1,18 @@
1
+ export declare const SEE_RECORDS_LIMITS: {
2
+ readonly pageSize: 100;
3
+ /** Rows the sheet shows (SR-D9). */
4
+ readonly maxRows: 500;
5
+ /** Rows a download carries: the direct CSV ceiling (SR-D29). */
6
+ readonly maxDownloadRows: 10000;
7
+ /** Columns a list starts with before the viewer adds more. */
8
+ readonly maxInferredColumns: 12;
9
+ /** Steps and added columns one request may carry. */
10
+ readonly maxSteps: 20;
11
+ readonly maxAddedColumns: 20;
12
+ };
13
+ /** The last page a list shows: maxRows / pageSize. */
14
+ export declare const SEE_RECORDS_MAX_PAGE: number;
15
+ /** Card types that offer See records in this plan (SR-D14, SR-D20). */
16
+ export declare const SEE_RECORDS_CARD_TYPES: readonly ["table", "matrixTable", "kpi", "bar", "horizontalBar", "stackedBar", "line", "stackedLine", "area", "stackedArea", "combo", "pie", "doughnut", "funnel"];
17
+ export type SeeRecordsCardType = (typeof SEE_RECORDS_CARD_TYPES)[number];
18
+ export declare function isSeeRecordsCardType(type: unknown): type is SeeRecordsCardType;
@@ -0,0 +1,46 @@
1
+ import { Field, MetricField } from '../../../lib/types/explorer-types.js';
2
+ export type SeeRecordsRowAggregate = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'median';
3
+ /**
4
+ * `valueIsTheAggregate`: the number the card shows is the aggregate call
5
+ * itself, nothing computed around it. `COUNT({x})` is; `COUNT({x}) + 1` and
6
+ * `{orders} * 2` are not. Only then can a list's count be checked against the
7
+ * number shown (SR-INV-2, ledger P1-11).
8
+ */
9
+ export type SeeRecordsMeasureKind =
10
+ /** COUNT(*): one line per grain row; no field to test for null. */
11
+ {
12
+ kind: 'rowCount';
13
+ valueIsTheAggregate: boolean;
14
+ }
15
+ /**
16
+ * One aggregate call over row values: one line per grain row. `rowField` is
17
+ * what the call reads per row: the one input field, or the row expression
18
+ * over several (`{field_0} * {field_1}` for SUM({a} * {b})).
19
+ */
20
+ | {
21
+ kind: 'rows';
22
+ aggregate: SeeRecordsRowAggregate;
23
+ rowField: Field;
24
+ valueIsTheAggregate: boolean;
25
+ }
26
+ /** COUNT(DISTINCT field): one line per distinct value of `rowField`. */
27
+ | {
28
+ kind: 'distinct';
29
+ rowField: Field;
30
+ valueIsTheAggregate: boolean;
31
+ }
32
+ /** More than one aggregate call: the viewer lists one input at a time. */
33
+ | {
34
+ kind: 'calculation';
35
+ inputs: readonly MetricField[];
36
+ } | {
37
+ kind: 'unlistable';
38
+ reason: 'table_calculation' | 'measure_not_listable';
39
+ };
40
+ /**
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 row filter (WHERE),
43
+ * never a measure filter (HAVING), and the list never compares.
44
+ */
45
+ export declare function seeRecordsRowField(field: Field): Field;
46
+ export declare function seeRecordsMeasureKind(measure: MetricField): SeeRecordsMeasureKind;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { SeeRecordsClick } from './click.js';
3
+ /** A field of a reached dataset: `dataset` named as the join-safety owners name it, `field` the field's `name`. */
4
+ export type SeeRecordsColumnRef = {
5
+ dataset: string;
6
+ field: string;
7
+ };
8
+ /** Steps name a list column; the server binds the field and builds the condition. */
9
+ export type SeeRecordsStep = {
10
+ kind: 'only';
11
+ column: SeeRecordsColumnRef;
12
+ value: string | number | boolean | null;
13
+ } | {
14
+ kind: 'groupBy';
15
+ column: SeeRecordsColumnRef;
16
+ };
17
+ export type SeeRecordsRequest = {
18
+ click: SeeRecordsClick;
19
+ /** For a calculation: which input to list. Absent: the first listable input. */
20
+ inputMeasureId?: string;
21
+ steps: readonly SeeRecordsStep[];
22
+ addedColumns: readonly SeeRecordsColumnRef[];
23
+ /** 1-based; 1 to maxRows / pageSize. */
24
+ page: number;
25
+ /** One page of up to maxDownloadRows, for the file (SR-D29). `page` must be 1. */
26
+ download?: true;
27
+ };
28
+ export declare const seeRecordsRequestSchema: z.ZodType<SeeRecordsRequest>;
@@ -0,0 +1,61 @@
1
+ import { OperationTemporalState } from '../../analytics-protocol/operation-temporal-state.js';
2
+ import { RawTemporalValueMetadata, SemaphorResultColumn } from '../../analytics-protocol/contracts.js';
3
+ import { SeeRecordsColumnRef } from './request.js';
4
+ /** One line per record of the grain dataset, or one line per value of a group column. */
5
+ export type SeeRecordsShape = 'rows' | 'groups';
6
+ /**
7
+ * Why a column is in the list: `date` the grain's primary date (rows lists
8
+ * only); `display` a dataset's display field; `card` one of the
9
+ * card's dimensions; `measureField` the measure's row field; `group` the
10
+ * group column; `added` from More columns; `count` the line's record count;
11
+ * `measure` the clicked measure per group.
12
+ */
13
+ export type SeeRecordsColumnRole = 'date' | 'display' | 'card' | 'measureField' | 'group' | 'added' | 'count' | 'measure';
14
+ export type SeeRecordsColumn = {
15
+ /** The key of this column's value in each row. */
16
+ key: string;
17
+ label: string;
18
+ /** Absent for `count` and `measure`. */
19
+ ref?: SeeRecordsColumnRef;
20
+ role: SeeRecordsColumnRole;
21
+ dataType: SemaphorResultColumn['dataType'];
22
+ /** Offers Only this and Group by. False for `count`, `measure`, and date and time columns. */
23
+ narrowable: boolean;
24
+ /**
25
+ * A date the run returned raw, in the report timezone, and the kind it is:
26
+ * the run's own result-column metadata, so the dialog draws it as a Detail
27
+ * table draws the same column. Absent on any other column.
28
+ */
29
+ rawTemporal?: RawTemporalValueMetadata;
30
+ };
31
+ export type SeeRecordsResult = {
32
+ shape: SeeRecordsShape;
33
+ /** The listed measure's label, then the click's label when it has one. */
34
+ title: string;
35
+ columns: readonly SeeRecordsColumn[];
36
+ rows: readonly Record<string, unknown>[];
37
+ /** The list's own count. Paging and Download read this, never the shown number. */
38
+ totalCount: number | null;
39
+ page: number;
40
+ hasMore: boolean;
41
+ /** totalCount > maxRows. */
42
+ capped: boolean;
43
+ /** Download is refused above maxDownloadRows, and when totalCount is null (SR-D29). */
44
+ downloadable: boolean;
45
+ /** Only on a level whose count must equal the clicked number (SR-INV-2). */
46
+ countMismatch?: {
47
+ shown: number;
48
+ listed: number;
49
+ };
50
+ /** A calculation's other listable inputs; empty otherwise. */
51
+ inputAlternatives: readonly {
52
+ inputMeasureId: string;
53
+ label: string;
54
+ }[];
55
+ /** More columns: fields with one value per line, of datasets the card already reaches, not hidden and not shown. */
56
+ addableColumns: readonly (SeeRecordsColumnRef & {
57
+ label: string;
58
+ })[];
59
+ /** The instant and anchors this exploration keeps; sent back with every later request. */
60
+ temporalState: OperationTemporalState;
61
+ };
@@ -91,10 +91,10 @@ export declare const usageEventEnvelopeSchema: z.ZodObject<{
91
91
  message: string;
92
92
  } | null;
93
93
  surface: "api" | "embed" | "console" | "mcp" | "public_link" | "scheduler" | "pdf_renderer";
94
- category: "usage" | "runtime" | "delivery" | "agent";
95
- connection_id: string | null;
96
94
  card_id: string | null;
97
95
  sheet_id: string | null;
96
+ category: "runtime" | "usage" | "delivery" | "agent";
97
+ connection_id: string | null;
98
98
  outcome: "cancelled" | "failed" | "timed_out" | "succeeded" | null;
99
99
  domain_id: string | null;
100
100
  project_id: string | null;
@@ -120,10 +120,10 @@ export declare const usageEventEnvelopeSchema: z.ZodObject<{
120
120
  message: string;
121
121
  } | null;
122
122
  surface: "api" | "embed" | "console" | "mcp" | "public_link" | "scheduler" | "pdf_renderer";
123
- category: "usage" | "runtime" | "delivery" | "agent";
124
- connection_id: string | null;
125
123
  card_id: string | null;
126
124
  sheet_id: string | null;
125
+ category: "runtime" | "usage" | "delivery" | "agent";
126
+ connection_id: string | null;
127
127
  outcome: "cancelled" | "failed" | "timed_out" | "succeeded" | null;
128
128
  domain_id: string | null;
129
129
  project_id: string | null;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.582",
8
+ "version": "0.1.584",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,80 +0,0 @@
1
- function u(e) {
2
- var o;
3
- return JSON.stringify([
4
- ((o = e.field) == null ? void 0 : o.id) ?? "",
5
- e.operator,
6
- e.value ?? null,
7
- e.temporalBucket ?? null,
8
- e.rawTemporal ?? null
9
- ]);
10
- }
11
- function p(e) {
12
- return JSON.stringify(e.map(u).sort());
13
- }
14
- function c(e) {
15
- const o = /* @__PURE__ */ new Map();
16
- for (const t of e)
17
- for (const r of t.tuples) {
18
- const n = r.conditions.filter(
19
- (a) => {
20
- var i;
21
- return (i = a.field) == null ? void 0 : i.id;
22
- }
23
- );
24
- if (n.length === 0) continue;
25
- let s = o.get(t.sourceCardId);
26
- s || (s = /* @__PURE__ */ new Map(), o.set(t.sourceCardId, s));
27
- const l = [...n].sort(
28
- (a, i) => u(a).localeCompare(u(i))
29
- );
30
- s.set(p(l), l);
31
- }
32
- return [...o.entries()].sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => ({
33
- sourceCardId: t,
34
- tuples: [...r.entries()].sort(([n], [s]) => n.localeCompare(s)).map(([, n]) => ({ conditions: n }))
35
- }));
36
- }
37
- function d(e) {
38
- const o = c(e);
39
- if (o.length !== 0)
40
- return {
41
- id: "selection",
42
- logicalOperator: "AND",
43
- negate: !1,
44
- conditions: [],
45
- groups: o.map((t) => {
46
- const r = `selection:${t.sourceCardId}`;
47
- return {
48
- id: r,
49
- logicalOperator: "OR",
50
- negate: !1,
51
- conditions: [],
52
- groups: t.tuples.map((n, s) => {
53
- const l = `${r}:${s}`;
54
- return {
55
- id: l,
56
- logicalOperator: "AND",
57
- negate: !1,
58
- conditions: n.conditions.map((a, i) => ({
59
- ...a,
60
- id: `${l}:${i}`
61
- })),
62
- groups: []
63
- };
64
- })
65
- };
66
- })
67
- };
68
- }
69
- function f(e) {
70
- return JSON.stringify(
71
- c(e).map((o) => [
72
- o.sourceCardId,
73
- o.tuples.map((t) => t.conditions.map(u))
74
- ])
75
- );
76
- }
77
- export {
78
- d as c,
79
- f as s
80
- };