@gooddata/sdk-model 11.54.0-alpha.5 → 11.54.0-alpha.7

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 (77) hide show
  1. package/esm/dashboard/alerts.test.helpers.d.ts +5 -0
  2. package/esm/dashboard/alerts.test.helpers.d.ts.map +1 -0
  3. package/esm/dashboard/alerts.test.helpers.js +37 -0
  4. package/esm/dashboard/dashboard.d.ts +6 -0
  5. package/esm/dashboard/dashboard.d.ts.map +1 -1
  6. package/esm/dashboard/dashboard.js +21 -2
  7. package/esm/dashboard/drills.test.helpers.d.ts +7 -0
  8. package/esm/dashboard/drills.test.helpers.d.ts.map +1 -0
  9. package/esm/dashboard/drills.test.helpers.js +50 -0
  10. package/esm/dashboard/filterContext.test.helpers.d.ts +9 -0
  11. package/esm/dashboard/filterContext.test.helpers.d.ts.map +1 -0
  12. package/esm/dashboard/filterContext.test.helpers.js +42 -0
  13. package/esm/dashboard/kpi.test.helpers.d.ts +4 -0
  14. package/esm/dashboard/kpi.test.helpers.d.ts.map +1 -0
  15. package/esm/dashboard/kpi.test.helpers.js +11 -0
  16. package/esm/dashboard/parameter.test.helpers.d.ts +5 -0
  17. package/esm/dashboard/parameter.test.helpers.d.ts.map +1 -0
  18. package/esm/dashboard/parameter.test.helpers.js +20 -0
  19. package/esm/dashboard/widgets.test.helpers.d.ts +4 -0
  20. package/esm/dashboard/widgets.test.helpers.d.ts.map +1 -0
  21. package/esm/dashboard/widgets.test.helpers.js +16 -0
  22. package/esm/dateFilterConfig/index.d.ts +12 -0
  23. package/esm/dateFilterConfig/index.d.ts.map +1 -1
  24. package/esm/dateFilterConfig/index.js +11 -0
  25. package/esm/dateFilterConfig/typeGuards.test.helpers.d.ts +9 -0
  26. package/esm/dateFilterConfig/typeGuards.test.helpers.d.ts.map +1 -0
  27. package/esm/dateFilterConfig/typeGuards.test.helpers.js +56 -0
  28. package/esm/exports/csvDelimiter.d.ts +15 -7
  29. package/esm/exports/csvDelimiter.d.ts.map +1 -1
  30. package/esm/exports/csvDelimiter.js +12 -6
  31. package/esm/index.d.ts +11 -1
  32. package/esm/index.d.ts.map +1 -1
  33. package/esm/index.js +11 -1
  34. package/esm/ldm/catalog/computedAttribute/index.d.ts +38 -0
  35. package/esm/ldm/catalog/computedAttribute/index.d.ts.map +1 -0
  36. package/esm/ldm/catalog/computedAttribute/index.js +10 -0
  37. package/esm/ldm/catalog/index.d.ts +4 -3
  38. package/esm/ldm/catalog/index.d.ts.map +1 -1
  39. package/esm/ldm/catalog/index.js +4 -0
  40. package/esm/ldm/catalog/types.d.ts +3 -2
  41. package/esm/ldm/catalog/types.d.ts.map +1 -1
  42. package/esm/ldm/catalog/types.js +1 -1
  43. package/esm/ldm/metadata/computedAttribute/index.d.ts +102 -0
  44. package/esm/ldm/metadata/computedAttribute/index.d.ts.map +1 -0
  45. package/esm/ldm/metadata/computedAttribute/index.js +21 -0
  46. package/esm/ldm/metadata/index.d.ts +2 -1
  47. package/esm/ldm/metadata/index.d.ts.map +1 -1
  48. package/esm/objRef/index.d.ts +1 -1
  49. package/esm/objRef/index.d.ts.map +1 -1
  50. package/esm/reports/builtinPageLayouts.d.ts +27 -0
  51. package/esm/reports/builtinPageLayouts.d.ts.map +1 -0
  52. package/esm/reports/builtinPageLayouts.js +196 -0
  53. package/esm/reports/content.d.ts +54 -0
  54. package/esm/reports/content.d.ts.map +1 -0
  55. package/esm/reports/content.js +12 -0
  56. package/esm/reports/factory.d.ts +65 -0
  57. package/esm/reports/factory.d.ts.map +1 -0
  58. package/esm/reports/factory.js +126 -0
  59. package/esm/reports/layout.d.ts +59 -0
  60. package/esm/reports/layout.d.ts.map +1 -0
  61. package/esm/reports/layout.js +18 -0
  62. package/esm/reports/pageLayout.d.ts +120 -0
  63. package/esm/reports/pageLayout.d.ts.map +1 -0
  64. package/esm/reports/pageLayout.js +83 -0
  65. package/esm/reports/report.d.ts +116 -0
  66. package/esm/reports/report.d.ts.map +1 -0
  67. package/esm/reports/report.js +35 -0
  68. package/esm/reports/slot.d.ts +213 -0
  69. package/esm/reports/slot.d.ts.map +1 -0
  70. package/esm/reports/slot.js +40 -0
  71. package/esm/reports/variables.d.ts +62 -0
  72. package/esm/reports/variables.d.ts.map +1 -0
  73. package/esm/reports/variables.js +41 -0
  74. package/esm/sdk-model.d.ts +1026 -104
  75. package/esm/settings/settings.d.ts +8 -0
  76. package/esm/settings/settings.d.ts.map +1 -1
  77. package/package.json +6 -6
@@ -0,0 +1,83 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { isEmpty } from "lodash-es";
3
+ import { isObjRef } from "../objRef/index.js";
4
+ import { isReportLayoutSection, isReportLayoutSlotRef } from "./layout.js";
5
+ /**
6
+ * Type-guard testing whether the provided object is an instance of {@link IReportPageLayoutDefinition}.
7
+ *
8
+ * @alpha
9
+ */
10
+ export function isReportPageLayoutDefinition(obj) {
11
+ return !isEmpty(obj) && obj.type === "reportPageLayout";
12
+ }
13
+ /**
14
+ * Type-guard testing whether the provided object is an instance of {@link IReportPageLayout}.
15
+ *
16
+ * @alpha
17
+ */
18
+ export function isReportPageLayout(obj) {
19
+ return isReportPageLayoutDefinition(obj) && isObjRef(obj.ref);
20
+ }
21
+ /**
22
+ * Type-guard testing whether the provided object is an instance of {@link IReportPageLayoutContent}.
23
+ *
24
+ * @alpha
25
+ */
26
+ export function isReportPageLayoutContentV1(obj) {
27
+ return (!isEmpty(obj) &&
28
+ obj.version === "1" &&
29
+ !isEmpty(obj.layout) &&
30
+ Array.isArray(obj.slots));
31
+ }
32
+ /**
33
+ * Validates the structural invariants of a page body the type system cannot express:
34
+ * slot localIdentifiers are unique, layout weights are positive, every slot is placed
35
+ * by the layout, and every layout slotId resolves (unresolved ones are warnings —
36
+ * they render as empty areas).
37
+ *
38
+ * @alpha
39
+ */
40
+ export function validateReportPageBody(body) {
41
+ const issues = [];
42
+ const slotIds = new Set();
43
+ for (const slot of body.slots) {
44
+ if (slotIds.has(slot.localIdentifier)) {
45
+ issues.push({
46
+ severity: "error",
47
+ message: `Duplicate slot localIdentifier "${slot.localIdentifier}".`,
48
+ });
49
+ }
50
+ slotIds.add(slot.localIdentifier);
51
+ }
52
+ const referencedIds = new Set();
53
+ const visit = (node) => {
54
+ if (node.weight !== undefined && !(node.weight > 0)) {
55
+ issues.push({
56
+ severity: "error",
57
+ message: `Layout node weight must be positive, got ${node.weight}.`,
58
+ });
59
+ }
60
+ if (isReportLayoutSlotRef(node)) {
61
+ referencedIds.add(node.slotId);
62
+ if (!slotIds.has(node.slotId)) {
63
+ issues.push({
64
+ severity: "warning",
65
+ message: `Layout references slot "${node.slotId}" which has no definition; it renders empty.`,
66
+ });
67
+ }
68
+ }
69
+ else if (isReportLayoutSection(node)) {
70
+ node.children.forEach(visit);
71
+ }
72
+ };
73
+ visit(body.layout);
74
+ for (const slotId of slotIds) {
75
+ if (!referencedIds.has(slotId)) {
76
+ issues.push({
77
+ severity: "warning",
78
+ message: `Slot "${slotId}" is not placed by the layout and never renders.`,
79
+ });
80
+ }
81
+ }
82
+ return issues;
83
+ }
@@ -0,0 +1,116 @@
1
+ import { type IAuditableDates, type IAuditableUsers } from "../base/metadata.js";
2
+ import { type ObjRef } from "../objRef/index.js";
3
+ import { type IReportContent } from "./content.js";
4
+ import { type ReportDateString } from "./variables.js";
5
+ /**
6
+ * Payload for creating or updating a report template.
7
+ *
8
+ * @alpha
9
+ */
10
+ export interface IReportTemplateDefinition {
11
+ type: "reportTemplate";
12
+ /**
13
+ * Present when updating an existing template.
14
+ */
15
+ ref?: ObjRef;
16
+ title: string;
17
+ description?: string;
18
+ tags?: string[];
19
+ content: IReportContent;
20
+ }
21
+ /**
22
+ * Report template metadata object.
23
+ *
24
+ * @alpha
25
+ */
26
+ export interface IReportTemplate extends IReportTemplateDefinition, IAuditableDates, IAuditableUsers {
27
+ ref: ObjRef;
28
+ /**
29
+ * When true, the object comes from a parent workspace and is not editable
30
+ * in the current workspace.
31
+ */
32
+ isLocked?: boolean;
33
+ }
34
+ /**
35
+ * Fields shared by report definitions and persisted reports.
36
+ *
37
+ * @alpha
38
+ */
39
+ export interface IReportBase {
40
+ title: string;
41
+ description?: string;
42
+ tags?: string[];
43
+ /**
44
+ * Reported period start, ISO 8601 date (YYYY-MM-DD), inclusive.
45
+ *
46
+ * @remarks
47
+ * At execution time the period materializes as an absolute date filter on each
48
+ * visualization slot's dateDataSet (lowest precedence, per-slot opt-out via
49
+ * ignoreReportPeriod). Also available as `{{periodStart}}` in text.
50
+ */
51
+ periodStart: ReportDateString;
52
+ /**
53
+ * Reported period end, ISO 8601 date (YYYY-MM-DD), inclusive.
54
+ */
55
+ periodEnd: ReportDateString;
56
+ /**
57
+ * Content of the report. When created from a template the content is deep-copied
58
+ * and NO reference to the template is kept — the report stays frozen while pages
59
+ * and templates evolve.
60
+ */
61
+ content: IReportContent;
62
+ /**
63
+ * Values for variables declared in content.variables, keyed by variable name.
64
+ */
65
+ variableValues?: Record<string, string>;
66
+ }
67
+ /**
68
+ * Payload for creating or updating a report.
69
+ *
70
+ * @alpha
71
+ */
72
+ export interface IReportDefinition extends IReportBase {
73
+ type: "report";
74
+ /**
75
+ * Present when updating an existing report.
76
+ */
77
+ ref?: ObjRef;
78
+ }
79
+ /**
80
+ * Report metadata object.
81
+ *
82
+ * @alpha
83
+ */
84
+ export interface IReport extends IReportDefinition, IAuditableDates, IAuditableUsers {
85
+ ref: ObjRef;
86
+ /**
87
+ * When true, the object comes from a parent workspace and is not editable
88
+ * in the current workspace.
89
+ */
90
+ isLocked?: boolean;
91
+ }
92
+ /**
93
+ * Type-guard testing whether the provided object is an instance of {@link IReportTemplateDefinition}.
94
+ *
95
+ * @alpha
96
+ */
97
+ export declare function isReportTemplateDefinition(obj: unknown): obj is IReportTemplateDefinition;
98
+ /**
99
+ * Type-guard testing whether the provided object is an instance of {@link IReportTemplate}.
100
+ *
101
+ * @alpha
102
+ */
103
+ export declare function isReportTemplate(obj: unknown): obj is IReportTemplate;
104
+ /**
105
+ * Type-guard testing whether the provided object is an instance of {@link IReportDefinition}.
106
+ *
107
+ * @alpha
108
+ */
109
+ export declare function isReportDefinition(obj: unknown): obj is IReportDefinition;
110
+ /**
111
+ * Type-guard testing whether the provided object is an instance of {@link IReport}.
112
+ *
113
+ * @alpha
114
+ */
115
+ export declare function isReport(obj: unknown): obj is IReport;
116
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/reports/report.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,gBAAgB,CAAC;IAEvB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,OAAO,EAAE,cAAc,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,yBAAyB,EAAE,eAAe,EAAE,eAAe;IAChG,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IAEd,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;;;;;OAOG;IACH,WAAW,EAAE,gBAAgB,CAAC;IAE9B;;OAEG;IACH,SAAS,EAAE,gBAAgB,CAAC;IAE5B;;;;OAIG;IACH,OAAO,EAAE,cAAc,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IAClD,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAQ,SAAQ,iBAAiB,EAAE,eAAe,EAAE,eAAe;IAChF,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,yBAAyB,CAEzF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,eAAe,CAErE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO,CAErD"}
@@ -0,0 +1,35 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { isEmpty } from "lodash-es";
3
+ import { isObjRef } from "../objRef/index.js";
4
+ /**
5
+ * Type-guard testing whether the provided object is an instance of {@link IReportTemplateDefinition}.
6
+ *
7
+ * @alpha
8
+ */
9
+ export function isReportTemplateDefinition(obj) {
10
+ return !isEmpty(obj) && obj.type === "reportTemplate";
11
+ }
12
+ /**
13
+ * Type-guard testing whether the provided object is an instance of {@link IReportTemplate}.
14
+ *
15
+ * @alpha
16
+ */
17
+ export function isReportTemplate(obj) {
18
+ return isReportTemplateDefinition(obj) && isObjRef(obj.ref);
19
+ }
20
+ /**
21
+ * Type-guard testing whether the provided object is an instance of {@link IReportDefinition}.
22
+ *
23
+ * @alpha
24
+ */
25
+ export function isReportDefinition(obj) {
26
+ return !isEmpty(obj) && obj.type === "report";
27
+ }
28
+ /**
29
+ * Type-guard testing whether the provided object is an instance of {@link IReport}.
30
+ *
31
+ * @alpha
32
+ */
33
+ export function isReport(obj) {
34
+ return isReportDefinition(obj) && isObjRef(obj.ref);
35
+ }
@@ -0,0 +1,213 @@
1
+ import { type FilterContextItem, type IDashboardFilterReference } from "../dashboard/filterContext.js";
2
+ import { type VisualizationProperties } from "../insight/index.js";
3
+ import { type ObjRef } from "../objRef/index.js";
4
+ /**
5
+ * Metadata of a slot that is intentionally left unfilled in a report page or template.
6
+ *
7
+ * @alpha
8
+ */
9
+ export interface IReportSlotPlaceholder {
10
+ /**
11
+ * Authoring hint shown in the empty slot.
12
+ */
13
+ hint?: string;
14
+ /**
15
+ * When true, a report is not considered complete until this slot is filled.
16
+ */
17
+ required?: boolean;
18
+ }
19
+ /**
20
+ * Structural base of every report slot.
21
+ *
22
+ * @remarks
23
+ * Parsers written against this base can skip slot types introduced by a newer
24
+ * content version instead of failing.
25
+ *
26
+ * @alpha
27
+ */
28
+ export interface IReportSlotBase {
29
+ type: string;
30
+ /**
31
+ * Identifier unique within the page body. The layout tree references it, and it is
32
+ * the join key when a report fills a template's slots. Regenerated when a page is
33
+ * cloned into template content so repeated use of one page stays unique.
34
+ */
35
+ localIdentifier: string;
36
+ /**
37
+ * Present when the slot is an unfilled placeholder.
38
+ */
39
+ placeholder?: IReportSlotPlaceholder;
40
+ }
41
+ /**
42
+ * Slot rendering an insight, with its own filter context.
43
+ *
44
+ * @alpha
45
+ */
46
+ export interface IReportVisualizationSlot extends IReportSlotBase {
47
+ type: "visualization";
48
+ /**
49
+ * Insight to render. Undefined = declared-but-empty slot; renderers show a placeholder.
50
+ */
51
+ insight?: ObjRef;
52
+ /**
53
+ * Optional title rendered above the visualization. Supports `{{variables}}`.
54
+ */
55
+ title?: string;
56
+ showTitle?: boolean;
57
+ /**
58
+ * Visualization properties overriding the insight's own.
59
+ */
60
+ properties?: VisualizationProperties;
61
+ /**
62
+ * Slot-level filters, applied on top of the effective content and page filters.
63
+ * A slot filter targeting the same object replaces the inherited one.
64
+ */
65
+ filters?: FilterContextItem[];
66
+ /**
67
+ * Content- and page-level filters this slot ignores (matched by display form / date dataset).
68
+ */
69
+ ignoredFilters?: IDashboardFilterReference[];
70
+ /**
71
+ * Date dataset the report's period (periodStart/periodEnd) is applied to as an
72
+ * absolute date filter at execution time. Undefined = backend date-dataset
73
+ * auto-resolution applies.
74
+ */
75
+ dateDataSet?: ObjRef;
76
+ /**
77
+ * When true, the implicit date filter derived from the report's period is not
78
+ * applied to this slot.
79
+ */
80
+ ignoreReportPeriod?: boolean;
81
+ }
82
+ /**
83
+ * Semantic kind of a text slot. Drives default typography/styling and AI context only —
84
+ * never geometry (geometry always comes from the layout tree).
85
+ *
86
+ * @alpha
87
+ */
88
+ export type ReportTextSlotKind = "title" | "subtitle" | "sectionTitle" | "description" | "summary" | "body" | "custom";
89
+ /**
90
+ * Author-written text.
91
+ *
92
+ * @alpha
93
+ */
94
+ export interface IReportStaticTextSource {
95
+ type: "static";
96
+ /**
97
+ * Markdown content with `{{variable}}` placeholders. Stored raw — placeholders are
98
+ * resolved only at render/export time.
99
+ */
100
+ content: string;
101
+ }
102
+ /**
103
+ * Text generated by AI at report-build time.
104
+ *
105
+ * @alpha
106
+ */
107
+ export interface IReportAiTextSource {
108
+ type: "ai";
109
+ /**
110
+ * Instruction for the generator. Supports `{{variables}}`.
111
+ */
112
+ prompt: string;
113
+ /**
114
+ * Materialized generation result (markdown), stored so the report renders
115
+ * deterministically without re-invoking AI. Absent until first generation.
116
+ */
117
+ content?: string;
118
+ /**
119
+ * ISO 8601 timestamp of the stored generation.
120
+ */
121
+ generatedAt?: string;
122
+ }
123
+ /**
124
+ * Where the text of a text slot comes from.
125
+ *
126
+ * @alpha
127
+ */
128
+ export type ReportTextSource = IReportStaticTextSource | IReportAiTextSource;
129
+ /**
130
+ * Slot rendering text.
131
+ *
132
+ * @alpha
133
+ */
134
+ export interface IReportTextSlot extends IReportSlotBase {
135
+ type: "text";
136
+ kind: ReportTextSlotKind;
137
+ /**
138
+ * Undefined = declared-but-empty slot.
139
+ */
140
+ source?: ReportTextSource;
141
+ }
142
+ /**
143
+ * What an image slot displays.
144
+ *
145
+ * @alpha
146
+ */
147
+ export type ReportImageSource = {
148
+ type: "url";
149
+ /**
150
+ * Image URL. Supports `{{variables}}` — a logo slot uses `{{logo}}`.
151
+ */
152
+ url: string;
153
+ } | {
154
+ type: "asset";
155
+ /**
156
+ * Reference to a backend-managed asset.
157
+ */
158
+ ref: ObjRef;
159
+ };
160
+ /**
161
+ * Slot rendering an image.
162
+ *
163
+ * @alpha
164
+ */
165
+ export interface IReportImageSlot extends IReportSlotBase {
166
+ type: "image";
167
+ /**
168
+ * Undefined = declared-but-empty slot.
169
+ */
170
+ source?: ReportImageSource;
171
+ altText?: string;
172
+ /**
173
+ * How the image fills the slot area. Defaults to "contain".
174
+ */
175
+ fit?: "contain" | "cover" | "fill";
176
+ }
177
+ /**
178
+ * All slot types of report content version 1.
179
+ *
180
+ * @alpha
181
+ */
182
+ export type ReportSlot = IReportVisualizationSlot | IReportTextSlot | IReportImageSlot;
183
+ /**
184
+ * List of built-in report slot type names.
185
+ *
186
+ * @alpha
187
+ */
188
+ export declare const BuiltInReportSlotTypes: string[];
189
+ /**
190
+ * Type-guard testing whether the provided object is an instance of {@link IReportVisualizationSlot}.
191
+ *
192
+ * @alpha
193
+ */
194
+ export declare function isReportVisualizationSlot(obj: unknown): obj is IReportVisualizationSlot;
195
+ /**
196
+ * Type-guard testing whether the provided object is an instance of {@link IReportTextSlot}.
197
+ *
198
+ * @alpha
199
+ */
200
+ export declare function isReportTextSlot(obj: unknown): obj is IReportTextSlot;
201
+ /**
202
+ * Type-guard testing whether the provided object is an instance of {@link IReportImageSlot}.
203
+ *
204
+ * @alpha
205
+ */
206
+ export declare function isReportImageSlot(obj: unknown): obj is IReportImageSlot;
207
+ /**
208
+ * Type-guard testing whether the provided object is an instance of {@link ReportSlot}.
209
+ *
210
+ * @alpha
211
+ */
212
+ export declare function isReportSlot(obj: unknown): obj is ReportSlot;
213
+ //# sourceMappingURL=slot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/reports/slot.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,40 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { isEmpty } from "lodash-es";
3
+ /**
4
+ * List of built-in report slot type names.
5
+ *
6
+ * @alpha
7
+ */
8
+ export const BuiltInReportSlotTypes = ["visualization", "text", "image"];
9
+ /**
10
+ * Type-guard testing whether the provided object is an instance of {@link IReportVisualizationSlot}.
11
+ *
12
+ * @alpha
13
+ */
14
+ export function isReportVisualizationSlot(obj) {
15
+ return !isEmpty(obj) && obj.type === "visualization";
16
+ }
17
+ /**
18
+ * Type-guard testing whether the provided object is an instance of {@link IReportTextSlot}.
19
+ *
20
+ * @alpha
21
+ */
22
+ export function isReportTextSlot(obj) {
23
+ return !isEmpty(obj) && obj.type === "text";
24
+ }
25
+ /**
26
+ * Type-guard testing whether the provided object is an instance of {@link IReportImageSlot}.
27
+ *
28
+ * @alpha
29
+ */
30
+ export function isReportImageSlot(obj) {
31
+ return !isEmpty(obj) && obj.type === "image";
32
+ }
33
+ /**
34
+ * Type-guard testing whether the provided object is an instance of {@link ReportSlot}.
35
+ *
36
+ * @alpha
37
+ */
38
+ export function isReportSlot(obj) {
39
+ return [isReportVisualizationSlot, isReportTextSlot, isReportImageSlot].some((guard) => guard(obj));
40
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * ISO 8601 calendar date (YYYY-MM-DD).
3
+ *
4
+ * @alpha
5
+ */
6
+ export type ReportDateString = string;
7
+ /**
8
+ * Variables resolved by the rendering runtime; they are never declared or stored.
9
+ *
10
+ * @remarks
11
+ * Referenced from report text as `{{name}}`. Custom variable names must not collide with these;
12
+ * on collision the built-in wins.
13
+ *
14
+ * @alpha
15
+ */
16
+ export type ReportBuiltInVariable = "reportTitle" | "periodStart" | "periodEnd" | "workspaceName" | "generatedAt" | "pageNumber" | "totalPages" | "logo";
17
+ /**
18
+ * All built-in report variable names.
19
+ *
20
+ * @alpha
21
+ */
22
+ export declare const ReportBuiltInVariables: ReportBuiltInVariable[];
23
+ /**
24
+ * A custom variable declared by report content and given a value by a report.
25
+ *
26
+ * @remarks
27
+ * Referenced from text as `{{name}}`. Values come from {@link IReportBase.variableValues},
28
+ * falling back to {@link IReportVariableDefinition.defaultValue}.
29
+ *
30
+ * @alpha
31
+ */
32
+ export interface IReportVariableDefinition {
33
+ /**
34
+ * Variable name as used inside the `{{...}}` marker. Must match /^[a-zA-Z][a-zA-Z0-9_]*$/.
35
+ * Built-in names ({@link ReportBuiltInVariable}) are reserved.
36
+ */
37
+ name: string;
38
+ /**
39
+ * Human readable label shown in the editor.
40
+ */
41
+ title?: string;
42
+ description?: string;
43
+ /**
44
+ * Value used when the report does not provide one. May not contain further
45
+ * placeholders — there is no recursive expansion.
46
+ */
47
+ defaultValue?: string;
48
+ }
49
+ /**
50
+ * Collects the distinct `{{variable}}` names referenced in the text, in order of first occurrence.
51
+ *
52
+ * @alpha
53
+ */
54
+ export declare function getReportTextPlaceholders(text: string): string[];
55
+ /**
56
+ * Replaces `{{variable}}` markers with values. Markers with no value are left as-is.
57
+ * Values are inserted verbatim — there is no recursive expansion.
58
+ *
59
+ * @alpha
60
+ */
61
+ export declare function resolveReportTextPlaceholders(text: string, values: Record<string, string>): string;
62
+ //# sourceMappingURL=variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/reports/variables.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAC3B,aAAa,GACb,aAAa,GACb,WAAW,GACX,eAAe,GACf,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,MAAM,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EASzD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAAyB;IACtC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAID;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAShE;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAIlG"}
@@ -0,0 +1,41 @@
1
+ // (C) 2026 GoodData Corporation
2
+ /**
3
+ * All built-in report variable names.
4
+ *
5
+ * @alpha
6
+ */
7
+ export const ReportBuiltInVariables = [
8
+ "reportTitle",
9
+ "periodStart",
10
+ "periodEnd",
11
+ "workspaceName",
12
+ "generatedAt",
13
+ "pageNumber",
14
+ "totalPages",
15
+ "logo",
16
+ ];
17
+ const placeholderRegex = /\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g;
18
+ /**
19
+ * Collects the distinct `{{variable}}` names referenced in the text, in order of first occurrence.
20
+ *
21
+ * @alpha
22
+ */
23
+ export function getReportTextPlaceholders(text) {
24
+ const names = [];
25
+ for (const match of text.matchAll(placeholderRegex)) {
26
+ const name = match[1];
27
+ if (!names.includes(name)) {
28
+ names.push(name);
29
+ }
30
+ }
31
+ return names;
32
+ }
33
+ /**
34
+ * Replaces `{{variable}}` markers with values. Markers with no value are left as-is.
35
+ * Values are inserted verbatim — there is no recursive expansion.
36
+ *
37
+ * @alpha
38
+ */
39
+ export function resolveReportTextPlaceholders(text, values) {
40
+ return text.replace(placeholderRegex, (marker, name) => Object.prototype.hasOwnProperty.call(values, name) ? values[name] : marker);
41
+ }