@gooddata/sdk-code-convertors 11.59.0-alpha.1 → 11.59.0-alpha.2
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/esm/from/declarativeReportPageToYaml.d.ts +25 -0
- package/esm/from/declarativeReportPageToYaml.d.ts.map +1 -0
- package/esm/from/declarativeReportPageToYaml.js +264 -0
- package/esm/from/declarativeReportToYaml.d.ts +45 -0
- package/esm/from/declarativeReportToYaml.d.ts.map +1 -0
- package/esm/from/declarativeReportToYaml.js +149 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -0
- package/esm/schemas/types.d.ts +7 -1
- package/esm/schemas/types.d.ts.map +1 -1
- package/esm/sdk-code-convertors.d.ts +93 -0
- package/esm/to/yamlDashboardToDeclarative.d.ts +3 -1
- package/esm/to/yamlDashboardToDeclarative.d.ts.map +1 -1
- package/esm/to/yamlDashboardToDeclarative.js +2 -1
- package/esm/to/yamlReportPageToDeclarative.d.ts +25 -0
- package/esm/to/yamlReportPageToDeclarative.d.ts.map +1 -0
- package/esm/to/yamlReportPageToDeclarative.js +215 -0
- package/esm/to/yamlReportToDeclarative.d.ts +25 -0
- package/esm/to/yamlReportToDeclarative.d.ts.map +1 -0
- package/esm/to/yamlReportToDeclarative.js +99 -0
- package/esm/tsdoc-metadata.json +1 -1
- package/esm/utils/reportFilterRefs.d.ts +13 -0
- package/esm/utils/reportFilterRefs.d.ts.map +1 -0
- package/esm/utils/reportFilterRefs.js +69 -0
- package/esm/utils/texts.d.ts +3 -0
- package/esm/utils/texts.d.ts.map +1 -1
- package/esm/utils/texts.js +15 -0
- package/package.json +7 -7
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { YAMLMap } from "yaml";
|
|
2
|
+
import { type FilterContextItem, type IReportContentPage, type IReportPageBody } from "@gooddata/sdk-model";
|
|
3
|
+
/**
|
|
4
|
+
* A report holds its filters the way a dashboard's filter context does, so the same convertor writes
|
|
5
|
+
* them; only the envelope it expects is put around them here.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function filtersToYaml(filters: FilterContextItem[] | undefined): YAMLMap | undefined;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare function mapOf(entries: Array<[string, unknown]>): YAMLMap;
|
|
12
|
+
/**
|
|
13
|
+
* Writes a page out as the single tree it is authored as: the geometry and the slots it places
|
|
14
|
+
* become one, and a slot only a box paints with is written under that box.
|
|
15
|
+
*
|
|
16
|
+
* A slot nothing points at is written nowhere, so it is gone once the document is read back. That
|
|
17
|
+
* is what the page model asks for - every slot is placed - and what the editor does on its own when
|
|
18
|
+
* the box painted with an image is repainted.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function reportPageBodyEntries(body: IReportPageBody): Array<[string, unknown]>;
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare function declarativeReportPageToYaml(body: IReportContentPage): YAMLMap;
|
|
25
|
+
//# sourceMappingURL=declarativeReportPageToYaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarativeReportPageToYaml.d.ts","sourceRoot":"","sources":["../../src/from/declarativeReportPageToYaml.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,OAAO,EAAW,MAAM,MAAM,CAAC;AAG9C,OAAO,EACH,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAevB,MAAM,qBAAqB,CAAC;AAQ7B;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAQ3F;AAoBD,gBAAgB;AAChB,wBAAgB,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAMhE;AAkOD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,eAAe,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAmBrF;AAED,gBAAgB;AAChB,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAE7E"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { Pair, YAMLMap, YAMLSeq } from "yaml";
|
|
3
|
+
import { dashboardFilterReferenceObjRef, isReportImageBackground, isReportImageSlot, isReportLayoutSection, isReportTextSlot, isReportVisualizationSlot, objRefToString, } from "@gooddata/sdk-model";
|
|
4
|
+
import { CoreErrorCode, newError } from "../utils/errors.js";
|
|
5
|
+
import { referencesAsWritten } from "../utils/reportFilterRefs.js";
|
|
6
|
+
import { getIdentifier } from "../utils/yamlUtils.js";
|
|
7
|
+
import { declarativeFilterContextToYaml } from "./declarativeDashboardToYaml.js";
|
|
8
|
+
/**
|
|
9
|
+
* A report holds its filters the way a dashboard's filter context does, so the same convertor writes
|
|
10
|
+
* them; only the envelope it expects is put around them here.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function filtersToYaml(filters) {
|
|
15
|
+
if (!filters?.length) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const { filters: written } = declarativeFilterContextToYaml(undefined, {
|
|
19
|
+
content: { filters: referencesAsWritten(filters), version: "2" },
|
|
20
|
+
});
|
|
21
|
+
return emptyToUndefined(written);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Collapses a mapping that says only one thing down to that thing, the way a bucket with nothing
|
|
25
|
+
* but a `using` is written as the field it uses.
|
|
26
|
+
*/
|
|
27
|
+
function shorten(map, soloKeys) {
|
|
28
|
+
if (map.items.length !== 1) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const [item] = map.items;
|
|
32
|
+
return soloKeys.includes(item.key) ? item.value : undefined;
|
|
33
|
+
}
|
|
34
|
+
function add(map, key, value) {
|
|
35
|
+
if (value !== undefined) {
|
|
36
|
+
map.add(new Pair(key, value));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** @internal */
|
|
40
|
+
export function mapOf(entries) {
|
|
41
|
+
const map = new YAMLMap();
|
|
42
|
+
for (const [key, value] of entries) {
|
|
43
|
+
add(map, key, value);
|
|
44
|
+
}
|
|
45
|
+
return map;
|
|
46
|
+
}
|
|
47
|
+
function emptyToUndefined(map) {
|
|
48
|
+
return map.items.length === 0 ? undefined : map;
|
|
49
|
+
}
|
|
50
|
+
function placeholderToYaml(placeholder) {
|
|
51
|
+
if (placeholder === undefined) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const map = mapOf([
|
|
55
|
+
["hint", placeholder.hint],
|
|
56
|
+
["required", placeholder.required],
|
|
57
|
+
]);
|
|
58
|
+
// A placeholder saying only that it is required is written as `true`, one saying only what to
|
|
59
|
+
// put there as that hint.
|
|
60
|
+
return shorten(map, ["hint", "required"]) ?? emptyToUndefined(map);
|
|
61
|
+
}
|
|
62
|
+
function textToYaml(source) {
|
|
63
|
+
if (source === undefined) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
if (source.type === "static") {
|
|
67
|
+
return source.content;
|
|
68
|
+
}
|
|
69
|
+
return mapOf([
|
|
70
|
+
["prompt", source.prompt],
|
|
71
|
+
["text", source.content],
|
|
72
|
+
["generated_at", source.generatedAt],
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
function textStyleToYaml(style, page) {
|
|
76
|
+
if (style === undefined) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const map = mapOf([
|
|
80
|
+
["type", style.type],
|
|
81
|
+
["color", style.color],
|
|
82
|
+
["horizontal_align", style.horizontalAlign],
|
|
83
|
+
["vertical_align", style.verticalAlign],
|
|
84
|
+
["background", backgroundToYaml(style.background, page)],
|
|
85
|
+
["border_radius", style.borderRadius],
|
|
86
|
+
["padding", style.padding],
|
|
87
|
+
]);
|
|
88
|
+
return shorten(map, ["type"]) ?? emptyToUndefined(map);
|
|
89
|
+
}
|
|
90
|
+
function imageStyleToYaml(style) {
|
|
91
|
+
if (style === undefined) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
return emptyToUndefined(mapOf([
|
|
95
|
+
["horizontal_align", style.horizontalAlign],
|
|
96
|
+
["vertical_align", style.verticalAlign],
|
|
97
|
+
]));
|
|
98
|
+
}
|
|
99
|
+
/** The image itself, without the identity of whatever draws it. */
|
|
100
|
+
function imageContentToYaml(slot) {
|
|
101
|
+
const source = slot.source;
|
|
102
|
+
const map = mapOf([
|
|
103
|
+
["url", source?.type === "url" ? source.url : undefined],
|
|
104
|
+
["asset", source?.type === "asset" ? objRefToString(source.ref) : undefined],
|
|
105
|
+
["alt_text", slot.altText],
|
|
106
|
+
["fit", slot.fit],
|
|
107
|
+
["style", imageStyleToYaml(slot.style)],
|
|
108
|
+
["placeholder", placeholderToYaml(slot.placeholder)],
|
|
109
|
+
]);
|
|
110
|
+
return shorten(map, ["url"]) ?? map;
|
|
111
|
+
}
|
|
112
|
+
function placedSlotIds(node, into) {
|
|
113
|
+
if (isReportLayoutSection(node)) {
|
|
114
|
+
for (const child of node.children) {
|
|
115
|
+
placedSlotIds(child, into);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
into.add(node.slotId);
|
|
120
|
+
}
|
|
121
|
+
return into;
|
|
122
|
+
}
|
|
123
|
+
function backgroundToYaml(background, page) {
|
|
124
|
+
if (background === undefined) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
if (!isReportImageBackground(background)) {
|
|
128
|
+
return background.color;
|
|
129
|
+
}
|
|
130
|
+
const { slotId } = background;
|
|
131
|
+
// A slot the tree also places writes itself there, and one already written under another box
|
|
132
|
+
// stands where it was written: either way this box only names it, so the page holds it once.
|
|
133
|
+
if (page.placedByLayout.has(slotId) || page.writtenBackdrops.has(slotId)) {
|
|
134
|
+
return mapOf([["image", mapOf([["ref", slotId]])]]);
|
|
135
|
+
}
|
|
136
|
+
page.writtenBackdrops.add(slotId);
|
|
137
|
+
const slot = page.slotsById.get(slotId);
|
|
138
|
+
// A backdrop naming a slot the page does not hold paints nothing, and is written as the bare
|
|
139
|
+
// reference it is rather than invented content.
|
|
140
|
+
if (slot === undefined || !isReportImageSlot(slot)) {
|
|
141
|
+
return mapOf([["image", mapOf([["ref", slotId]])]]);
|
|
142
|
+
}
|
|
143
|
+
const content = imageContentToYaml(slot);
|
|
144
|
+
const entries = content instanceof YAMLMap
|
|
145
|
+
? content.items.map((item) => [item.key, item.value])
|
|
146
|
+
: [["url", content]];
|
|
147
|
+
return mapOf([["image", mapOf([["id", slotId], ...entries])]]);
|
|
148
|
+
}
|
|
149
|
+
function boxStyleToYaml(style, page) {
|
|
150
|
+
if (style === undefined) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
return emptyToUndefined(mapOf([
|
|
154
|
+
["background", backgroundToYaml(style.background, page)],
|
|
155
|
+
["border_radius", style.borderRadius],
|
|
156
|
+
["padding", style.padding],
|
|
157
|
+
]));
|
|
158
|
+
}
|
|
159
|
+
function visualizationSlotToYaml(slot, weight) {
|
|
160
|
+
// A hidden title with no text to keep is written as `title: false`, which says both at once;
|
|
161
|
+
// every other combination states the two separately, so neither is lost.
|
|
162
|
+
const hiddenWithNoText = slot.showTitle === false && slot.title === undefined;
|
|
163
|
+
return mapOf([
|
|
164
|
+
["id", slot.localIdentifier],
|
|
165
|
+
["weight", weight],
|
|
166
|
+
["visualization", slot.insight === undefined ? null : objRefToString(slot.insight)],
|
|
167
|
+
["title", hiddenWithNoText ? false : slot.title],
|
|
168
|
+
["show_title", hiddenWithNoText ? undefined : slot.showTitle],
|
|
169
|
+
["properties", slot.properties],
|
|
170
|
+
["date", slot.dateDataSet === undefined ? undefined : objRefToString(slot.dateDataSet)],
|
|
171
|
+
["ignore_report_period", slot.ignoreReportPeriod],
|
|
172
|
+
["filters", filtersToYaml(slot.filters)],
|
|
173
|
+
[
|
|
174
|
+
"ignored_filters",
|
|
175
|
+
slot.ignoredFilters?.length
|
|
176
|
+
? slot.ignoredFilters.map((reference) => getIdentifier(referencesAsWritten(dashboardFilterReferenceObjRef(reference))))
|
|
177
|
+
: undefined,
|
|
178
|
+
],
|
|
179
|
+
["placeholder", placeholderToYaml(slot.placeholder)],
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
function textSlotToYaml(slot, weight, page) {
|
|
183
|
+
return mapOf([
|
|
184
|
+
["id", slot.localIdentifier],
|
|
185
|
+
["weight", weight],
|
|
186
|
+
[slot.type, textToYaml(slot.source) ?? ""],
|
|
187
|
+
["style", textStyleToYaml(slot.style, page)],
|
|
188
|
+
["placeholder", placeholderToYaml(slot.placeholder)],
|
|
189
|
+
]);
|
|
190
|
+
}
|
|
191
|
+
function imageSlotToYaml(slot, weight) {
|
|
192
|
+
return mapOf([
|
|
193
|
+
["id", slot.localIdentifier],
|
|
194
|
+
["weight", weight],
|
|
195
|
+
["image", imageContentToYaml(slot)],
|
|
196
|
+
]);
|
|
197
|
+
}
|
|
198
|
+
function layoutNodeToYaml(node, page) {
|
|
199
|
+
if (isReportLayoutSection(node)) {
|
|
200
|
+
const children = new YAMLSeq();
|
|
201
|
+
for (const child of node.children) {
|
|
202
|
+
children.add(layoutNodeToYaml(child, page));
|
|
203
|
+
}
|
|
204
|
+
return mapOf([
|
|
205
|
+
["weight", node.weight],
|
|
206
|
+
[node.direction, children],
|
|
207
|
+
["style", boxStyleToYaml(node.style, page)],
|
|
208
|
+
]);
|
|
209
|
+
}
|
|
210
|
+
const slot = page.slotsById.get(node.slotId);
|
|
211
|
+
if (slot === undefined) {
|
|
212
|
+
// A leaf naming a slot the page does not hold renders as an empty area, and is written as
|
|
213
|
+
// the empty visualization it behaves like rather than dropped.
|
|
214
|
+
return mapOf([
|
|
215
|
+
["id", node.slotId],
|
|
216
|
+
["weight", node.weight],
|
|
217
|
+
["visualization", null],
|
|
218
|
+
]);
|
|
219
|
+
}
|
|
220
|
+
if (isReportVisualizationSlot(slot)) {
|
|
221
|
+
return visualizationSlotToYaml(slot, node.weight);
|
|
222
|
+
}
|
|
223
|
+
if (isReportTextSlot(slot)) {
|
|
224
|
+
return textSlotToYaml(slot, node.weight, page);
|
|
225
|
+
}
|
|
226
|
+
if (isReportImageSlot(slot)) {
|
|
227
|
+
return imageSlotToYaml(slot, node.weight);
|
|
228
|
+
}
|
|
229
|
+
// A slot of a kind this version does not know cannot be written without saying it is something
|
|
230
|
+
// it is not, so the page is refused rather than quietly rewritten into a shape it never had.
|
|
231
|
+
throw newError(CoreErrorCode.ItemNotSupported, [JSON.stringify({ slot: slot.type })]);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Writes a page out as the single tree it is authored as: the geometry and the slots it places
|
|
235
|
+
* become one, and a slot only a box paints with is written under that box.
|
|
236
|
+
*
|
|
237
|
+
* A slot nothing points at is written nowhere, so it is gone once the document is read back. That
|
|
238
|
+
* is what the page model asks for - every slot is placed - and what the editor does on its own when
|
|
239
|
+
* the box painted with an image is repainted.
|
|
240
|
+
*
|
|
241
|
+
* @internal
|
|
242
|
+
*/
|
|
243
|
+
export function reportPageBodyEntries(body) {
|
|
244
|
+
const page = {
|
|
245
|
+
slotsById: new Map(body.slots.map((slot) => [slot.localIdentifier, slot])),
|
|
246
|
+
placedByLayout: placedSlotIds(body.layout, new Set()),
|
|
247
|
+
writtenBackdrops: new Set(),
|
|
248
|
+
};
|
|
249
|
+
// The page's own paint is written first, so a backdrop it shares with a box inside it is
|
|
250
|
+
// written down at the page and only named further in.
|
|
251
|
+
const style = boxStyleToYaml(body.style, page);
|
|
252
|
+
const layout = layoutNodeToYaml(body.layout, page);
|
|
253
|
+
return [
|
|
254
|
+
["kind", body.kind],
|
|
255
|
+
["format", body.format],
|
|
256
|
+
["style", style],
|
|
257
|
+
["layout", layout],
|
|
258
|
+
["filters", filtersToYaml(body.filters)],
|
|
259
|
+
];
|
|
260
|
+
}
|
|
261
|
+
/** @internal */
|
|
262
|
+
export function declarativeReportPageToYaml(body) {
|
|
263
|
+
return mapOf([["id", body.localIdentifier], ...reportPageBodyEntries(body)]);
|
|
264
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type DeclarativeReport, type DeclarativeReportPageLayout } from "@gooddata/api-client-tiger";
|
|
2
|
+
import type { Report, ReportPageBody, ReportPageLayout, ReportTemplate } from "@gooddata/sdk-code-schemas/v1";
|
|
3
|
+
import { type IReportContentPage, type IReportDefinition, type IReportPageLayout, type IReportPageLayoutDefinition, type IReportTemplate, type IReportTemplateDefinition } from "@gooddata/sdk-model";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export declare function declarativeReportToYaml(report: DeclarativeReport): {
|
|
6
|
+
content: string;
|
|
7
|
+
json: Report;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The same report, written from what the frontend holds: the object reference it is identified by
|
|
11
|
+
* becomes the bare id a document names it with.
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export declare function reportDefinitionToYaml(report: IReportDefinition): {
|
|
16
|
+
content: string;
|
|
17
|
+
json: Report;
|
|
18
|
+
};
|
|
19
|
+
/** @alpha */
|
|
20
|
+
export declare function reportTemplateDefinitionToYaml(template: IReportTemplate | IReportTemplateDefinition): {
|
|
21
|
+
content: string;
|
|
22
|
+
json: ReportTemplate;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A reusable page. Its body is written at the top level, because the object it is already names it -
|
|
26
|
+
* a page written into a report names itself instead.
|
|
27
|
+
*
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export declare function reportPageLayoutDefinitionToYaml(layout: IReportPageLayout | IReportPageLayoutDefinition): {
|
|
31
|
+
content: string;
|
|
32
|
+
json: ReportPageLayout;
|
|
33
|
+
};
|
|
34
|
+
/** @alpha */
|
|
35
|
+
export declare function declarativeReportPageLayoutToYaml(layout: DeclarativeReportPageLayout): {
|
|
36
|
+
content: string;
|
|
37
|
+
json: ReportPageLayout;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* One page of a report or a template, as a document writes it down.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare function reportPageToAacPage(page: IReportContentPage): ReportPageBody;
|
|
45
|
+
//# sourceMappingURL=declarativeReportToYaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarativeReportToYaml.d.ts","sourceRoot":"","sources":["../../src/from/declarativeReportToYaml.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC9G,OAAO,EAEH,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEtB,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAGjC,MAAM,qBAAqB,CAAC;AAsE7B,aAAa;AACb,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAoBpG;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAoBnG;AAED,aAAa;AACb,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,eAAe,GAAG,yBAAyB,GAAG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;CACxB,CAYA;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,iBAAiB,GAAG,2BAA2B,GAAG;IACvG,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;CAC1B,CAYA;AAED,aAAa;AACb,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,2BAA2B,GAAG;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;CAC1B,CAYA;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc,CAE5E"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { Document, Scalar, YAMLSeq } from "yaml";
|
|
3
|
+
import { objRefToString, } from "@gooddata/sdk-model";
|
|
4
|
+
import { REPORT_COMMENT, REPORT_PAGE_LAYOUT_COMMENT, REPORT_TEMPLATE_COMMENT } from "../utils/texts.js";
|
|
5
|
+
import { declarativeReportPageToYaml, filtersToYaml, mapOf, reportPageBodyEntries, } from "./declarativeReportPageToYaml.js";
|
|
6
|
+
/**
|
|
7
|
+
* A date is quoted, so a reader whose YAML dialect knows timestamps hands back the string the
|
|
8
|
+
* schema states rather than a date of its own making.
|
|
9
|
+
*/
|
|
10
|
+
function quotedDate(value) {
|
|
11
|
+
if (value === undefined) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const scalar = new Scalar(value);
|
|
15
|
+
scalar.type = Scalar.QUOTE_DOUBLE;
|
|
16
|
+
return scalar;
|
|
17
|
+
}
|
|
18
|
+
function variablesToYaml(variables) {
|
|
19
|
+
if (!variables?.length) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const seq = new YAMLSeq();
|
|
23
|
+
for (const variable of variables) {
|
|
24
|
+
seq.add(mapOf([
|
|
25
|
+
["name", variable.name],
|
|
26
|
+
["title", variable.title],
|
|
27
|
+
["description", variable.description],
|
|
28
|
+
["default", variable.defaultValue],
|
|
29
|
+
]));
|
|
30
|
+
}
|
|
31
|
+
return seq;
|
|
32
|
+
}
|
|
33
|
+
function pagesToYaml(content) {
|
|
34
|
+
const seq = new YAMLSeq();
|
|
35
|
+
for (const page of content.pages) {
|
|
36
|
+
seq.add(declarativeReportPageToYaml(page));
|
|
37
|
+
}
|
|
38
|
+
return seq;
|
|
39
|
+
}
|
|
40
|
+
function bodyEntries(content) {
|
|
41
|
+
return [
|
|
42
|
+
["pages", pagesToYaml(content)],
|
|
43
|
+
["filters", filtersToYaml(content.filters)],
|
|
44
|
+
["variables", variablesToYaml(content.variables)],
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
function toDocument(entries, comment = REPORT_COMMENT) {
|
|
48
|
+
const doc = new Document(mapOf(entries));
|
|
49
|
+
doc.commentBefore = comment;
|
|
50
|
+
return {
|
|
51
|
+
content: doc.toString({ lineWidth: 0 }),
|
|
52
|
+
json: doc.toJSON(),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** @alpha */
|
|
56
|
+
export function declarativeReportToYaml(report) {
|
|
57
|
+
return toDocument([
|
|
58
|
+
["id", report.id],
|
|
59
|
+
["type", "report"],
|
|
60
|
+
["title", report.title],
|
|
61
|
+
["description", report.description || undefined],
|
|
62
|
+
["tags", report.tags?.length ? report.tags : undefined],
|
|
63
|
+
[
|
|
64
|
+
"period",
|
|
65
|
+
mapOf([
|
|
66
|
+
["start", quotedDate(report.periodStart)],
|
|
67
|
+
["end", quotedDate(report.periodEnd)],
|
|
68
|
+
]),
|
|
69
|
+
],
|
|
70
|
+
...bodyEntries(report.content),
|
|
71
|
+
[
|
|
72
|
+
"variable_values",
|
|
73
|
+
Object.keys(report.variableValues ?? {}).length ? report.variableValues : undefined,
|
|
74
|
+
],
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The same report, written from what the frontend holds: the object reference it is identified by
|
|
79
|
+
* becomes the bare id a document names it with.
|
|
80
|
+
*
|
|
81
|
+
* @alpha
|
|
82
|
+
*/
|
|
83
|
+
export function reportDefinitionToYaml(report) {
|
|
84
|
+
return toDocument([
|
|
85
|
+
["id", report.ref === undefined ? undefined : objRefToString(report.ref)],
|
|
86
|
+
["type", "report"],
|
|
87
|
+
["title", report.title],
|
|
88
|
+
["description", report.description || undefined],
|
|
89
|
+
["tags", report.tags?.length ? report.tags : undefined],
|
|
90
|
+
[
|
|
91
|
+
"period",
|
|
92
|
+
mapOf([
|
|
93
|
+
["start", quotedDate(report.periodStart)],
|
|
94
|
+
["end", quotedDate(report.periodEnd)],
|
|
95
|
+
]),
|
|
96
|
+
],
|
|
97
|
+
...bodyEntries(report.content),
|
|
98
|
+
[
|
|
99
|
+
"variable_values",
|
|
100
|
+
Object.keys(report.variableValues ?? {}).length ? report.variableValues : undefined,
|
|
101
|
+
],
|
|
102
|
+
]);
|
|
103
|
+
}
|
|
104
|
+
/** @alpha */
|
|
105
|
+
export function reportTemplateDefinitionToYaml(template) {
|
|
106
|
+
return toDocument([
|
|
107
|
+
["id", template.ref === undefined ? undefined : objRefToString(template.ref)],
|
|
108
|
+
["type", "report_template"],
|
|
109
|
+
["title", template.title],
|
|
110
|
+
["description", template.description || undefined],
|
|
111
|
+
["tags", template.tags?.length ? template.tags : undefined],
|
|
112
|
+
...bodyEntries(template.content),
|
|
113
|
+
], REPORT_TEMPLATE_COMMENT);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A reusable page. Its body is written at the top level, because the object it is already names it -
|
|
117
|
+
* a page written into a report names itself instead.
|
|
118
|
+
*
|
|
119
|
+
* @alpha
|
|
120
|
+
*/
|
|
121
|
+
export function reportPageLayoutDefinitionToYaml(layout) {
|
|
122
|
+
return toDocument([
|
|
123
|
+
["id", layout.ref === undefined ? undefined : objRefToString(layout.ref)],
|
|
124
|
+
["type", "report_page_layout"],
|
|
125
|
+
["title", layout.title],
|
|
126
|
+
["description", layout.description || undefined],
|
|
127
|
+
["tags", layout.tags?.length ? layout.tags : undefined],
|
|
128
|
+
...reportPageBodyEntries(layout.content),
|
|
129
|
+
], REPORT_PAGE_LAYOUT_COMMENT);
|
|
130
|
+
}
|
|
131
|
+
/** @alpha */
|
|
132
|
+
export function declarativeReportPageLayoutToYaml(layout) {
|
|
133
|
+
return toDocument([
|
|
134
|
+
["id", layout.id],
|
|
135
|
+
["type", "report_page_layout"],
|
|
136
|
+
["title", layout.title],
|
|
137
|
+
["description", layout.description || undefined],
|
|
138
|
+
["tags", layout.tags?.length ? layout.tags : undefined],
|
|
139
|
+
...reportPageBodyEntries(layout.content),
|
|
140
|
+
], REPORT_PAGE_LAYOUT_COMMENT);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* One page of a report or a template, as a document writes it down.
|
|
144
|
+
*
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
export function reportPageToAacPage(page) {
|
|
148
|
+
return declarativeReportPageToYaml(page).toJSON();
|
|
149
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export type { AacAttributeHierarchy, AacComputedAttribute, AacDashboard, AacDashboardFilters, AacDataset, AacDateDataset, AacMetadata, AacMetric, AacParameter, AacPlugin, AacQuery, AacSection, AacVisualisation, AacFilter, } from "./schemas/types.js";
|
|
1
|
+
export type { AacAttributeHierarchy, AacComputedAttribute, AacDashboard, AacDashboardFilters, AacDataset, AacDateDataset, AacMetadata, AacMetric, AacParameter, AacPlugin, AacQuery, AacReport, AacReportPageLayout, AacReportTemplate, AacSection, AacVisualisation, AacFilter, } from "./schemas/types.js";
|
|
2
2
|
export { type DeclarativeEntityData, type EntityData, type ExportEntities, type FromEntities, type Profile, type ToExecutionResults, type DashboardTab, BucketsType, } from "./types.js";
|
|
3
|
+
export { yamlReportDocumentToDeclarative, yamlReportPageLayoutToDeclarative, yamlReportPageLayoutToDefinition, yamlReportToDefinition, yamlReportTemplateToDefinition, } from "./to/yamlReportToDeclarative.js";
|
|
4
|
+
export { declarativeReportPageLayoutToYaml, declarativeReportToYaml, reportDefinitionToYaml, reportPageLayoutDefinitionToYaml, reportPageToAacPage, reportTemplateDefinitionToYaml, } from "./from/declarativeReportToYaml.js";
|
|
3
5
|
export { yamlDatasetToDeclarative, buildAttributeLabels, buildAttributes, buildFacts, buildReferences, } from "./to/yamlDatasetToDeclarative.js";
|
|
4
6
|
export { yamlDateDatesetToDeclarative } from "./to/yamlDateDatasetToDeclarative.js";
|
|
5
7
|
export { yamlMetricToDeclarative } from "./to/yamlMetricToDeclarative.js";
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACR,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,SAAS,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,WAAW,GACd,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACR,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,SAAS,GACZ,MAAM,oBAAoB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AAuB,EACvB,2BAA2B,EAC3B,+BAA+B,EAC/B,eAAe,EACf,gBAAgB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,SAAS,GACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACnB,MAAM,4BAA4B,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
2
|
// Core types
|
|
3
3
|
export { BucketsType, } from "./types.js";
|
|
4
|
+
export { yamlReportDocumentToDeclarative, yamlReportPageLayoutToDeclarative, yamlReportPageLayoutToDefinition, yamlReportToDefinition, yamlReportTemplateToDefinition, } from "./to/yamlReportToDeclarative.js";
|
|
5
|
+
export { declarativeReportPageLayoutToYaml, declarativeReportToYaml, reportDefinitionToYaml, reportPageLayoutDefinitionToYaml, reportPageToAacPage, reportTemplateDefinitionToYaml, } from "./from/declarativeReportToYaml.js";
|
|
4
6
|
// Entity converters: YAML → Declarative API
|
|
5
7
|
export { yamlDatasetToDeclarative, buildAttributeLabels, buildAttributes, buildFacts, buildReferences, } from "./to/yamlDatasetToDeclarative.js";
|
|
6
8
|
export { yamlDateDatesetToDeclarative } from "./to/yamlDateDatasetToDeclarative.js";
|
package/esm/schemas/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* This file isolates api-extractor from the generated metadata.ts internals
|
|
4
4
|
* (which contain anonymous union members like Visualisation1-22, Id4-16, etc.).
|
|
5
5
|
*/
|
|
6
|
-
import type { AttributeHierarchy, ComputedAttribute, Dashboard, DashboardFilters, Dataset, DateDataset, Filter, Metadata, Metric, Parameter, Plugin, Query, Section, Visualisation } from "@gooddata/sdk-code-schemas/v1";
|
|
6
|
+
import type { AttributeHierarchy, ComputedAttribute, Dashboard, DashboardFilters, Dataset, DateDataset, Filter, Metadata, Metric, Parameter, Plugin, Query, Report, ReportPageLayout, ReportTemplate, Section, Visualisation } from "@gooddata/sdk-code-schemas/v1";
|
|
7
7
|
/** @public */
|
|
8
8
|
export type AacAttributeHierarchy = AttributeHierarchy;
|
|
9
9
|
/** @public */
|
|
@@ -26,6 +26,12 @@ export type AacParameter = Parameter;
|
|
|
26
26
|
export type AacPlugin = Plugin;
|
|
27
27
|
/** @public */
|
|
28
28
|
export type AacQuery = Query;
|
|
29
|
+
/** @alpha */
|
|
30
|
+
export type AacReport = Report;
|
|
31
|
+
/** @alpha */
|
|
32
|
+
export type AacReportPageLayout = ReportPageLayout;
|
|
33
|
+
/** @alpha */
|
|
34
|
+
export type AacReportTemplate = ReportTemplate;
|
|
29
35
|
/** @public */
|
|
30
36
|
export type AacSection = Section;
|
|
31
37
|
/** @public */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schemas/types.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,MAAM,EACN,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EACL,OAAO,EACP,aAAa,EAChB,MAAM,+BAA+B,CAAC;AAEvC,cAAc;AACd,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AACvD,cAAc;AACd,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AACrD,cAAc;AACd,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;AACrC,cAAc;AACd,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AACnD,cAAc;AACd,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;AACjC,cAAc;AACd,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AACzC,cAAc;AACd,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AACnC,cAAc;AACd,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,cAAc;AACd,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;AACrC,cAAc;AACd,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,cAAc;AACd,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC;AAC7B,cAAc;AACd,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;AACjC,cAAc;AACd,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAC7C,cAAc;AACd,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schemas/types.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACh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