@gooddata/sdk-model 11.54.0-alpha.6 → 11.54.0

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.
@@ -0,0 +1,219 @@
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
+ * All semantic kinds a text slot can carry.
191
+ *
192
+ * @alpha
193
+ */
194
+ export declare const BuiltInReportTextSlotKinds: ReportTextSlotKind[];
195
+ /**
196
+ * Type-guard testing whether the provided object is an instance of {@link IReportVisualizationSlot}.
197
+ *
198
+ * @alpha
199
+ */
200
+ export declare function isReportVisualizationSlot(obj: unknown): obj is IReportVisualizationSlot;
201
+ /**
202
+ * Type-guard testing whether the provided object is an instance of {@link IReportTextSlot}.
203
+ *
204
+ * @alpha
205
+ */
206
+ export declare function isReportTextSlot(obj: unknown): obj is IReportTextSlot;
207
+ /**
208
+ * Type-guard testing whether the provided object is an instance of {@link IReportImageSlot}.
209
+ *
210
+ * @alpha
211
+ */
212
+ export declare function isReportImageSlot(obj: unknown): obj is IReportImageSlot;
213
+ /**
214
+ * Type-guard testing whether the provided object is an instance of {@link ReportSlot}.
215
+ *
216
+ * @alpha
217
+ */
218
+ export declare function isReportSlot(obj: unknown): obj is ReportSlot;
219
+ //# sourceMappingURL=slot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/reports/slot.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC7D,IAAI,EAAE,eAAe,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;IAErC;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE9B;;OAEG;IACH,cAAc,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAE7C;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,kBA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,MAAM,UAAU,GAAG,wBAAwB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAEvF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAAuC,CAAC;AAEnF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,kBAAkB,EAQ1D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAEvF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,eAAe,CAErE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,gBAAgB,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,CAE5D"}
@@ -0,0 +1,54 @@
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
+ * All semantic kinds a text slot can carry.
11
+ *
12
+ * @alpha
13
+ */
14
+ export const BuiltInReportTextSlotKinds = [
15
+ "title",
16
+ "subtitle",
17
+ "sectionTitle",
18
+ "description",
19
+ "summary",
20
+ "body",
21
+ "custom",
22
+ ];
23
+ /**
24
+ * Type-guard testing whether the provided object is an instance of {@link IReportVisualizationSlot}.
25
+ *
26
+ * @alpha
27
+ */
28
+ export function isReportVisualizationSlot(obj) {
29
+ return !isEmpty(obj) && obj.type === "visualization";
30
+ }
31
+ /**
32
+ * Type-guard testing whether the provided object is an instance of {@link IReportTextSlot}.
33
+ *
34
+ * @alpha
35
+ */
36
+ export function isReportTextSlot(obj) {
37
+ return !isEmpty(obj) && obj.type === "text";
38
+ }
39
+ /**
40
+ * Type-guard testing whether the provided object is an instance of {@link IReportImageSlot}.
41
+ *
42
+ * @alpha
43
+ */
44
+ export function isReportImageSlot(obj) {
45
+ return !isEmpty(obj) && obj.type === "image";
46
+ }
47
+ /**
48
+ * Type-guard testing whether the provided object is an instance of {@link ReportSlot}.
49
+ *
50
+ * @alpha
51
+ */
52
+ export function isReportSlot(obj) {
53
+ return [isReportVisualizationSlot, isReportTextSlot, isReportImageSlot].some((guard) => guard(obj));
54
+ }
@@ -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
+ }