@gooddata/sdk-code-convertors 11.59.0-alpha.0 → 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.
@@ -27,6 +27,8 @@ import { DeclarativeLabel } from '@gooddata/api-client-tiger';
27
27
  import { DeclarativeMetric } from '@gooddata/api-client-tiger';
28
28
  import { DeclarativeParameter } from '@gooddata/api-client-tiger';
29
29
  import { DeclarativeReference } from '@gooddata/api-client-tiger';
30
+ import { DeclarativeReport } from '@gooddata/api-client-tiger';
31
+ import { DeclarativeReportPageLayout } from '@gooddata/api-client-tiger';
30
32
  import { DeclarativeTable } from '@gooddata/api-client-tiger';
31
33
  import { DeclarativeVisualizationObject } from '@gooddata/api-client-tiger';
32
34
  import type { Fields } from '@gooddata/sdk-code-schemas/v1';
@@ -70,6 +72,12 @@ import { IPositiveAttributeFilterBody } from '@gooddata/sdk-model';
70
72
  import { IPreviousPeriodMeasureDefinition } from '@gooddata/sdk-model';
71
73
  import { IRankingFilterBody } from '@gooddata/sdk-model';
72
74
  import { IRelativeDateFilter } from '@gooddata/sdk-model';
75
+ import { IReportContentPage } from '@gooddata/sdk-model';
76
+ import { IReportDefinition } from '@gooddata/sdk-model';
77
+ import { IReportPageLayout } from '@gooddata/sdk-model';
78
+ import { IReportPageLayoutDefinition } from '@gooddata/sdk-model';
79
+ import { IReportTemplate } from '@gooddata/sdk-model';
80
+ import { IReportTemplateDefinition } from '@gooddata/sdk-model';
73
81
  import { ISortItem } from '@gooddata/sdk-model';
74
82
  import { ITotal } from '@gooddata/sdk-model';
75
83
  import { JsonApiVisualizationObjectOut } from '@gooddata/api-client-tiger';
@@ -87,6 +95,10 @@ import type { PoPMetricField } from '@gooddata/sdk-code-schemas/v1';
87
95
  import type { PreviousPeriodMetricField } from '@gooddata/sdk-code-schemas/v1';
88
96
  import type { Query } from '@gooddata/sdk-code-schemas/v1';
89
97
  import type { QueryFilters } from '@gooddata/sdk-code-schemas/v1';
98
+ import type { Report as Report_2 } from '@gooddata/sdk-code-schemas/v1';
99
+ import type { ReportPageBody } from '@gooddata/sdk-code-schemas/v1';
100
+ import type { ReportPageLayout } from '@gooddata/sdk-code-schemas/v1';
101
+ import type { ReportTemplate } from '@gooddata/sdk-code-schemas/v1';
90
102
  import type { RichTextWidget } from '@gooddata/sdk-code-schemas/v1';
91
103
  import { Scalar } from 'yaml';
92
104
  import type { Section } from '@gooddata/sdk-code-schemas/v1';
@@ -137,6 +149,15 @@ export declare type AacPlugin = Plugin_2;
137
149
  /** @public */
138
150
  export declare type AacQuery = Query;
139
151
 
152
+ /** @alpha */
153
+ export declare type AacReport = Report_2;
154
+
155
+ /** @alpha */
156
+ export declare type AacReportPageLayout = ReportPageLayout;
157
+
158
+ /** @alpha */
159
+ export declare type AacReportTemplate = ReportTemplate;
160
+
140
161
  /** @public */
141
162
  export declare type AacSection = Section;
142
163
 
@@ -1474,6 +1495,18 @@ export declare function declarativeRelativeDateFilterToYaml(relativeDateFilter:
1474
1495
  carried: WrittenFilter[];
1475
1496
  };
1476
1497
 
1498
+ /** @alpha */
1499
+ export declare function declarativeReportPageLayoutToYaml(layout: DeclarativeReportPageLayout): {
1500
+ content: string;
1501
+ json: ReportPageLayout;
1502
+ };
1503
+
1504
+ /** @alpha */
1505
+ export declare function declarativeReportToYaml(report: DeclarativeReport): {
1506
+ content: string;
1507
+ json: Report_2;
1508
+ };
1509
+
1477
1510
  /** @internal */
1478
1511
  export declare function declarativeSectionsToYaml(layout?: IDashboardLayout, entities?: FromEntities, errorContext?: IErrorContext): YAMLSeq<unknown> | undefined;
1479
1512
 
@@ -3464,6 +3497,41 @@ export declare function repeaterChartSave(fields: Visualisation["query"]["fields
3464
3497
  } | undefined;
3465
3498
  } | undefined;
3466
3499
 
3500
+ /**
3501
+ * The same report, written from what the frontend holds: the object reference it is identified by
3502
+ * becomes the bare id a document names it with.
3503
+ *
3504
+ * @alpha
3505
+ */
3506
+ export declare function reportDefinitionToYaml(report: IReportDefinition): {
3507
+ content: string;
3508
+ json: Report_2;
3509
+ };
3510
+
3511
+ /**
3512
+ * A reusable page. Its body is written at the top level, because the object it is already names it -
3513
+ * a page written into a report names itself instead.
3514
+ *
3515
+ * @alpha
3516
+ */
3517
+ export declare function reportPageLayoutDefinitionToYaml(layout: IReportPageLayout | IReportPageLayoutDefinition): {
3518
+ content: string;
3519
+ json: ReportPageLayout;
3520
+ };
3521
+
3522
+ /**
3523
+ * One page of a report or a template, as a document writes it down.
3524
+ *
3525
+ * @internal
3526
+ */
3527
+ export declare function reportPageToAacPage(page: IReportContentPage): ReportPageBody;
3528
+
3529
+ /** @alpha */
3530
+ export declare function reportTemplateDefinitionToYaml(template: IReportTemplate | IReportTemplateDefinition): {
3531
+ content: string;
3532
+ json: ReportTemplate;
3533
+ };
3534
+
3467
3535
  /** @public */
3468
3536
  export declare function resolveIdFromFileName(fileName: FilePath): string;
3469
3537
 
@@ -4356,6 +4424,23 @@ export declare type YamlPostProcessors = {
4356
4424
  }>;
4357
4425
  };
4358
4426
 
4427
+ /**
4428
+ * Named for the document it reads, because a visualisation's query convertor already owns the
4429
+ * shorter name.
4430
+ *
4431
+ * @alpha
4432
+ */
4433
+ export declare function yamlReportDocumentToDeclarative(input: Report_2, errorContext?: IErrorContext): DeclarativeReport;
4434
+
4435
+ /** @alpha */
4436
+ export declare function yamlReportPageLayoutToDeclarative(input: ReportPageLayout, errorContext?: IErrorContext): DeclarativeReportPageLayout;
4437
+
4438
+ /** @alpha */
4439
+ export declare function yamlReportPageLayoutToDefinition(input: ReportPageLayout, errorContext?: IErrorContext): IReportPageLayoutDefinition;
4440
+
4441
+ /** @alpha */
4442
+ export declare function yamlReportTemplateToDefinition(input: ReportTemplate, errorContext?: IErrorContext): IReportTemplateDefinition;
4443
+
4359
4444
  /** @internal */
4360
4445
  export declare function yamlReportToDeclarative(entities: ExportEntities, input: Visualisation): {
4361
4446
  buckets: VisualisationDefinition["buckets"];
@@ -4368,6 +4453,14 @@ export declare function yamlReportToDeclarative(entities: ExportEntities, input:
4368
4453
  attributeFilterConfigs?: IAttributeFilterConfigs;
4369
4454
  };
4370
4455
 
4456
+ /**
4457
+ * The same report, as the frontend holds it: an object reference in place of the bare id the
4458
+ * document names it by.
4459
+ *
4460
+ * @alpha
4461
+ */
4462
+ export declare function yamlReportToDefinition(input: Report_2, errorContext?: IErrorContext): IReportDefinition;
4463
+
4371
4464
  /** @internal */
4372
4465
  export declare function yamlReportTotalToDeclarative(totals: Total[] | undefined, attributeIdentifier: string): ITotal[];
4373
4466
 
@@ -1,6 +1,6 @@
1
1
  import { type DeclarativeAnalyticalDashboard, type DeclarativeFilterContext } from "@gooddata/api-client-tiger";
2
2
  import type { ContainerWidget, Dashboard, DashboardFilters, Interaction, RichTextWidget, VisualisationWidget, VisualizationSwitcherWidget, Widget } from "@gooddata/sdk-code-schemas/v1";
3
- import { type IDashboardAttributeFilterConfig, type IDashboardDateFilter, type IDashboardDateFilterConfig, type IDashboardDateFilterConfigItem, type IDashboardFilterGroupsConfig, type IDashboardMeasureValueFilterConfig, type IDashboardPluginLink, type IDrillToAttributeUrl, type IDrillToCustomUrl, type IDrillToDashboard, type IDrillToInsight, type IFilterContextDefinition } from "@gooddata/sdk-model";
3
+ import { type IDashboardAttributeFilterConfig, type IDashboardDateFilter, type IDashboardDateFilterConfig, type IDashboardDateFilterConfigItem, type IDashboardFilterGroupsConfig, type IDashboardFilterReference, type IDashboardMeasureValueFilterConfig, type IDashboardPluginLink, type IDrillToAttributeUrl, type IDrillToCustomUrl, type IDrillToDashboard, type IDrillToInsight, type IFilterContextDefinition } from "@gooddata/sdk-model";
4
4
  import { type OverrideDashboardDefinition } from "../from/declarativeDashboardToYaml.js";
5
5
  import { type ExportEntities } from "../types.js";
6
6
  /** @internal */
@@ -30,6 +30,8 @@ export declare function yamlWidgetToDeclarative(entities: ExportEntities, input:
30
30
  /** @internal */
31
31
  export declare function yamlInteractionToDeclarative(entities: ExportEntities, visualisation: string, input: Interaction): IDrillToInsight | IDrillToDashboard | IDrillToCustomUrl | IDrillToAttributeUrl | null;
32
32
  /** @internal */
33
+ export declare function yamlIgnoredFilterToDeclarative(input: string): IDashboardFilterReference | null;
34
+ /** @internal */
33
35
  export declare function yamlPluginsToDeclarative(plugins: Dashboard["plugins"]): IDashboardPluginLink[] | undefined;
34
36
  /** @internal */
35
37
  export declare function yamlFilterContextToDeclarative(baseId: string, yamlFilters: DashboardFilters | undefined): {
@@ -1 +1 @@
1
- {"version":3,"file":"yamlDashboardToDeclarative.d.ts","sourceRoot":"","sources":["../../src/to/yamlDashboardToDeclarative.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,8BAA8B,EAGnC,KAAK,wBAAwB,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACR,eAAe,EACf,SAAS,EAGT,gBAAgB,EAMhB,WAAW,EAKX,cAAc,EAId,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,EACT,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIH,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EAEnC,KAAK,4BAA4B,EAEjC,KAAK,kCAAkC,EACvC,KAAK,oBAAoB,EAIzB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAMhC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AA+BrE,gBAAgB;AAChB,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAClC,2BAA2B,EACzB,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,GAChB,uBAAuB,GACvB,uBAAuB,GACvB,wBAAwB,GACxB,oBAAoB,GACpB,oCAAoC,GACpC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AAE,cAAc,EACxB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,WAAW,GACnB,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,IAAI,CA6FvF;AAqJD,gBAAgB;AAChB,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,sCAErE;AA6FD,gBAAgB;AAChB,wBAAgB,8BAA8B,CAC1C,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,gBAAgB,GAAG,SAAS,GAC1C;IACC,aAAa,EAAE,wBAAwB,CAAC;IACxC,gBAAgB,EAAE,0BAA0B,GAAG,SAAS,CAAC;IACzD,iBAAiB,EAAE,8BAA8B,EAAE,GAAG,SAAS,CAAC;IAChE,sBAAsB,EAAE,+BAA+B,EAAE,GAAG,SAAS,CAAC;IACtE,yBAAyB,EAAE,kCAAkC,EAAE,GAAG,SAAS,CAAC;IAC5E,kBAAkB,EAAE,4BAA4B,GAAG,SAAS,CAAC;CAChE,CAuVA"}
1
+ {"version":3,"file":"yamlDashboardToDeclarative.d.ts","sourceRoot":"","sources":["../../src/to/yamlDashboardToDeclarative.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,8BAA8B,EAGnC,KAAK,wBAAwB,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACR,eAAe,EACf,SAAS,EAGT,gBAAgB,EAMhB,WAAW,EAKX,cAAc,EAId,mBAAmB,EACnB,2BAA2B,EAC3B,MAAM,EACT,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIH,KAAK,+BAA+B,EACpC,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EAEnC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,kCAAkC,EACvC,KAAK,oBAAoB,EAIzB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,wBAAw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Q,EAAE,cAAc,EACxB,KAAK,EAAE,MAAM,EACb,oBAAoB,CAAC,EAAE,OAAO,GAC/B,eAAe,GAAG,IAAI,CAaxB;AAsDD,gBAAgB;AAChB,wBAAgB,uBAAuB,CACnC,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,2BAA2B,GAAG,eAAe,EAC3F,oBAAoB,CAAC,EAAE,OAAO,GAC/B,eAAe,CAAC,QAAQ,CAAC,CAyD3B;AAyED,gBAAgB;AAChB,wBAAgB,4BAA4B,CACxC,QAAQ,EAAE,cAAc,EACxB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,WAAW,GACnB,eAAe,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,IAAI,CA6FvF;AA4HD,gBAAgB;AAChB,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,yBAAyB,GAAG,IAAI,CAuB9F;AAED,gBAAgB;AAChB,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,sCAErE;AA6FD,gBAAgB;AAChB,wBAAgB,8BAA8B,CAC1C,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,gBAAgB,GAAG,SAAS,GAC1C;IACC,aAAa,EAAE,wBAAwB,CAAC;IACxC,gBAAgB,EAAE,0BAA0B,GAAG,SAAS,CAAC;IACzD,iBAAiB,EAAE,8BAA8B,EAAE,GAAG,SAAS,CAAC;IAChE,sBAAsB,EAAE,+BAA+B,EAAE,GAAG,SAAS,CAAC;IACtE,yBAAyB,EAAE,kCAAkC,EAAE,GAAG,SAAS,CAAC;IAC5E,kBAAkB,EAAE,4BAA4B,GAAG,SAAS,CAAC;CAChE,CAuVA"}
@@ -568,7 +568,8 @@ function sourceInsightFilterIdToDeclarative(filterId, sourceVisualizationFilters
568
568
  }
569
569
  return null;
570
570
  }
571
- function yamlIgnoredFilterToDeclarative(input) {
571
+ /** @internal */
572
+ export function yamlIgnoredFilterToDeclarative(input) {
572
573
  const ref = parseReferenceObject(input);
573
574
  if (ref?.type === "label" || ref?.type === "computed_attribute") {
574
575
  return {
@@ -0,0 +1,25 @@
1
+ import type { DashboardFilters, ReportPageBody } from "@gooddata/sdk-code-schemas/v1";
2
+ import { type FilterContextItem, type IReportContentPage, type IReportPageBody } from "@gooddata/sdk-model";
3
+ import { type IErrorContext } from "../utils/errors.js";
4
+ /**
5
+ * A report holds its filters the way a dashboard's filter context does, so they are written and read
6
+ * back by the same convertor; only the envelope it expects is put around them here.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare function filtersToDeclarative(filters: DashboardFilters | undefined): FilterContextItem[] | undefined;
11
+ /**
12
+ * Raises a page written as one tree back into the two halves it is stored as: the geometry, and the
13
+ * flat list of slots it and the boxes painted with an image point at.
14
+ *
15
+ * @internal
16
+ */
17
+ export declare function yamlReportPageToDeclarative(body: ReportPageBody, errorContext?: IErrorContext): IReportContentPage;
18
+ /**
19
+ * The body of a page, without the identity of whatever holds it: a page written into a report names
20
+ * itself, a reusable one is named by the object it is.
21
+ *
22
+ * @internal
23
+ */
24
+ export declare function yamlReportPageBodyToDeclarative(body: ReportPageBody, errorContext?: IErrorContext): IReportPageBody;
25
+ //# sourceMappingURL=yamlReportPageToDeclarative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yamlReportPageToDeclarative.d.ts","sourceRoot":"","sources":["../../src/to/yamlReportPageToDeclarative.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,gBAAgB,EAKhB,cAAc,EAIjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,KAAK,iBAAiB,EAItB,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAQvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAiB,KAAK,aAAa,EAAgC,MAAM,oBAAoB,CAAC;AAQrG;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,GAAG,iBAAiB,EAAE,GAAG,SAAS,CAS3G;AAoND;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,cAAc,EACpB,YAAY,CAAC,EAAE,aAAa,GAC7B,kBAAkB,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC3C,IAAI,EAAE,cAAc,EACpB,YAAY,CAAC,EAAE,aAAa,GAC7B,eAAe,CAcjB"}
@@ -0,0 +1,215 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { idRef, } from "@gooddata/sdk-model";
3
+ import { CoreErrorCode, newError, updateErrorContext } from "../utils/errors.js";
4
+ import { referencesAsStored } from "../utils/reportFilterRefs.js";
5
+ import { yamlFilterContextToDeclarative, yamlIgnoredFilterToDeclarative, } from "./yamlDashboardToDeclarative.js";
6
+ /**
7
+ * A report holds its filters the way a dashboard's filter context does, so they are written and read
8
+ * back by the same convertor; only the envelope it expects is put around them here.
9
+ *
10
+ * @internal
11
+ */
12
+ export function filtersToDeclarative(filters) {
13
+ if (filters === undefined) {
14
+ return undefined;
15
+ }
16
+ // The filter context the shared convertor builds around them is thrown away, so what it is
17
+ // named does not matter; only the filters inside it are what a report stores.
18
+ const { filterContext } = yamlFilterContextToDeclarative("report", filters);
19
+ const content = filterContext.content;
20
+ return content?.filters?.length ? referencesAsStored(content.filters) : undefined;
21
+ }
22
+ function placeholderToDeclarative(placeholder) {
23
+ if (placeholder === undefined) {
24
+ return undefined;
25
+ }
26
+ if (typeof placeholder === "boolean") {
27
+ return { required: placeholder };
28
+ }
29
+ if (typeof placeholder === "string") {
30
+ return { hint: placeholder };
31
+ }
32
+ return placeholder;
33
+ }
34
+ function textToDeclarative(text) {
35
+ if (typeof text === "string") {
36
+ // A slot written with no text has none, rather than text that happens to be empty: the key
37
+ // is there because it is what says which kind of slot this is.
38
+ return text === "" ? undefined : { type: "static", content: text };
39
+ }
40
+ if (text.prompt !== undefined) {
41
+ return {
42
+ type: "ai",
43
+ prompt: text.prompt,
44
+ ...(text.text === undefined ? {} : { content: text.text }),
45
+ ...(text.generated_at === undefined ? {} : { generatedAt: text.generated_at }),
46
+ };
47
+ }
48
+ // A mapping with neither a prompt nor any text states a slot that is declared but unwritten.
49
+ return text.text === undefined ? undefined : { type: "static", content: text.text };
50
+ }
51
+ function textStyleToDeclarative(style, page) {
52
+ if (style === undefined) {
53
+ return undefined;
54
+ }
55
+ if (typeof style === "string") {
56
+ return { type: style };
57
+ }
58
+ const { horizontal_align, vertical_align, border_radius, background, ...rest } = style;
59
+ return {
60
+ ...rest,
61
+ ...(horizontal_align === undefined ? {} : { horizontalAlign: horizontal_align }),
62
+ ...(vertical_align === undefined ? {} : { verticalAlign: vertical_align }),
63
+ ...(border_radius === undefined ? {} : { borderRadius: border_radius }),
64
+ ...(background === undefined ? {} : { background: backgroundToDeclarative(background, page) }),
65
+ };
66
+ }
67
+ /** The content of an image, without the identity of whatever draws it. */
68
+ function imageContentToDeclarative(image) {
69
+ if (typeof image === "string") {
70
+ return { type: "image", source: { type: "url", url: image } };
71
+ }
72
+ const { url, asset, alt_text, fit, style, placeholder } = image;
73
+ const declaredPlaceholder = placeholderToDeclarative(placeholder);
74
+ return {
75
+ type: "image",
76
+ ...(url === undefined ? {} : { source: { type: "url", url } }),
77
+ ...(asset === undefined ? {} : { source: { type: "asset", ref: idRef(asset) } }),
78
+ ...(alt_text === undefined ? {} : { altText: alt_text }),
79
+ ...(fit === undefined ? {} : { fit: fit }),
80
+ ...(style === undefined
81
+ ? {}
82
+ : {
83
+ style: {
84
+ ...(style.horizontal_align === undefined
85
+ ? {}
86
+ : { horizontalAlign: style.horizontal_align }),
87
+ ...(style.vertical_align === undefined ? {} : { verticalAlign: style.vertical_align }),
88
+ },
89
+ }),
90
+ ...(declaredPlaceholder === undefined ? {} : { placeholder: declaredPlaceholder }),
91
+ };
92
+ }
93
+ /**
94
+ * A backdrop is drawn from a slot of its own. Writing the image down adds that slot to the page;
95
+ * naming one written down elsewhere - under another box, or by the leaf that places it - only
96
+ * points at it again.
97
+ */
98
+ function backgroundImageToDeclarative(image, page) {
99
+ if ("ref" in image) {
100
+ return image.ref;
101
+ }
102
+ const { id, ...content } = image;
103
+ page.slots.push({ ...imageContentToDeclarative(content), localIdentifier: id });
104
+ return id;
105
+ }
106
+ function backgroundToDeclarative(background, page) {
107
+ if (typeof background === "string") {
108
+ return { type: "color", color: background };
109
+ }
110
+ return { type: "image", slotId: backgroundImageToDeclarative(background.image, page) };
111
+ }
112
+ function boxStyleToDeclarative(style, page) {
113
+ if (style === undefined) {
114
+ return undefined;
115
+ }
116
+ const { background, border_radius, padding } = style;
117
+ return {
118
+ ...(background === undefined ? {} : { background: backgroundToDeclarative(background, page) }),
119
+ ...(border_radius === undefined ? {} : { borderRadius: border_radius }),
120
+ ...(padding === undefined ? {} : { padding }),
121
+ };
122
+ }
123
+ /** A node that draws content becomes a slot of its own and a reference to it in the tree. */
124
+ function layoutNodeToDeclarative(node, page, errorContext) {
125
+ const weight = "weight" in node && node.weight !== undefined ? { weight: node.weight } : {};
126
+ if ("column" in node || "row" in node) {
127
+ const direction = "column" in node ? "column" : "row";
128
+ const children = ("column" in node ? node.column : node.row) ?? [];
129
+ return {
130
+ type: "section",
131
+ direction,
132
+ children: children.map((child) => layoutNodeToDeclarative(child, page, errorContext)),
133
+ ...weight,
134
+ ...(node.style === undefined ? {} : { style: boxStyleToDeclarative(node.style, page) }),
135
+ };
136
+ }
137
+ page.slots.push(slotToDeclarative(node, page, errorContext));
138
+ return { type: "slotRef", slotId: node.id, ...weight };
139
+ }
140
+ function slotToDeclarative(node, page, errorContext) {
141
+ const placeholder = placeholderToDeclarative("placeholder" in node ? node.placeholder : undefined);
142
+ const shared = {
143
+ localIdentifier: node.id,
144
+ ...(placeholder === undefined ? {} : { placeholder }),
145
+ };
146
+ if ("visualization" in node) {
147
+ const { visualization, title, show_title, properties, date, ignore_report_period, filters } = node;
148
+ const declaredFilters = filtersToDeclarative(filters);
149
+ const ignoredFilters = (node.ignored_filters ?? [])
150
+ .map((filterId) => yamlIgnoredFilterToDeclarative(filterId))
151
+ .filter(Boolean)
152
+ .map((reference) => referencesAsStored(reference));
153
+ return {
154
+ ...shared,
155
+ type: "visualization",
156
+ ...(visualization === null || visualization === undefined
157
+ ? {}
158
+ : { insight: idRef(visualization, "insight") }),
159
+ // A title of false hides it and states no text; a title kept but not drawn says so in full.
160
+ ...(title === false ? { showTitle: false } : title === undefined ? {} : { title }),
161
+ ...(show_title === undefined ? {} : { showTitle: show_title }),
162
+ ...(properties === undefined ? {} : { properties }),
163
+ ...(date === undefined ? {} : { dateDataSet: idRef(date, "dataSet") }),
164
+ ...(ignore_report_period === undefined ? {} : { ignoreReportPeriod: ignore_report_period }),
165
+ ...(declaredFilters === undefined ? {} : { filters: declaredFilters }),
166
+ ...(ignoredFilters.length === 0 ? {} : { ignoredFilters }),
167
+ };
168
+ }
169
+ if ("heading" in node || "paragraph" in node) {
170
+ const isHeading = "heading" in node;
171
+ const source = textToDeclarative(isHeading ? node.heading : node.paragraph);
172
+ return {
173
+ ...shared,
174
+ type: isHeading ? "heading" : "paragraph",
175
+ ...(source === undefined ? {} : { source }),
176
+ ...(node.style === undefined ? {} : { style: textStyleToDeclarative(node.style, page) }),
177
+ };
178
+ }
179
+ if (!("image" in node)) {
180
+ // A node says what it draws by the key it carries, so one carrying none of them draws
181
+ // nothing - far more often a key spelled wrong than an area anyone meant to write.
182
+ throw newError(CoreErrorCode.ItemNotSupported, [JSON.stringify({ id: shared.localIdentifier, keys: Object.keys(node) })], updateErrorContext(errorContext, { path: ["layout", shared.localIdentifier] }));
183
+ }
184
+ const image = imageContentToDeclarative(node.image);
185
+ return { ...image, ...shared };
186
+ }
187
+ /**
188
+ * Raises a page written as one tree back into the two halves it is stored as: the geometry, and the
189
+ * flat list of slots it and the boxes painted with an image point at.
190
+ *
191
+ * @internal
192
+ */
193
+ export function yamlReportPageToDeclarative(body, errorContext) {
194
+ return { localIdentifier: body.id, ...yamlReportPageBodyToDeclarative(body, errorContext) };
195
+ }
196
+ /**
197
+ * The body of a page, without the identity of whatever holds it: a page written into a report names
198
+ * itself, a reusable one is named by the object it is.
199
+ *
200
+ * @internal
201
+ */
202
+ export function yamlReportPageBodyToDeclarative(body, errorContext) {
203
+ const page = { slots: [] };
204
+ const style = boxStyleToDeclarative(body.style, page);
205
+ const layout = layoutNodeToDeclarative(body.layout, page, errorContext);
206
+ const filters = filtersToDeclarative(body.filters);
207
+ return {
208
+ ...(body.kind === undefined ? {} : { kind: body.kind }),
209
+ ...(body.format === undefined ? {} : { format: body.format }),
210
+ ...(style === undefined ? {} : { style }),
211
+ layout,
212
+ slots: page.slots,
213
+ ...(filters === undefined ? {} : { filters }),
214
+ };
215
+ }
@@ -0,0 +1,25 @@
1
+ import { type DeclarativeReport, type DeclarativeReportPageLayout } from "@gooddata/api-client-tiger";
2
+ import type { Report, ReportPageLayout, ReportTemplate } from "@gooddata/sdk-code-schemas/v1";
3
+ import { type IReportDefinition, type IReportPageLayoutDefinition, type IReportTemplateDefinition } from "@gooddata/sdk-model";
4
+ import { type IErrorContext } from "../utils/errors.js";
5
+ /**
6
+ * Named for the document it reads, because a visualisation's query convertor already owns the
7
+ * shorter name.
8
+ *
9
+ * @alpha
10
+ */
11
+ export declare function yamlReportDocumentToDeclarative(input: Report, errorContext?: IErrorContext): DeclarativeReport;
12
+ /**
13
+ * The same report, as the frontend holds it: an object reference in place of the bare id the
14
+ * document names it by.
15
+ *
16
+ * @alpha
17
+ */
18
+ export declare function yamlReportToDefinition(input: Report, errorContext?: IErrorContext): IReportDefinition;
19
+ /** @alpha */
20
+ export declare function yamlReportTemplateToDefinition(input: ReportTemplate, errorContext?: IErrorContext): IReportTemplateDefinition;
21
+ /** @alpha */
22
+ export declare function yamlReportPageLayoutToDefinition(input: ReportPageLayout, errorContext?: IErrorContext): IReportPageLayoutDefinition;
23
+ /** @alpha */
24
+ export declare function yamlReportPageLayoutToDeclarative(input: ReportPageLayout, errorContext?: IErrorContext): DeclarativeReportPageLayout;
25
+ //# sourceMappingURL=yamlReportToDeclarative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yamlReportToDeclarative.d.ts","sourceRoot":"","sources":["../../src/to/yamlReportToDeclarative.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,KAAK,EACR,MAAM,EAEN,gBAAgB,EAChB,cAAc,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEH,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAIjC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAuCxD;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC3C,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,aAAa,GAC7B,iBAAiB,CAWnB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,aAAa,GAAG,iBAAiB,CAYrG;AAED,aAAa;AACb,wBAAgB,8BAA8B,CAC1C,KAAK,EAAE,cAAc,EACrB,YAAY,CAAC,EAAE,aAAa,GAC7B,yBAAyB,CAS3B;AAED,aAAa;AACb,wBAAgB,gCAAgC,CAC5C,KAAK,EAAE,gBAAgB,EACvB,YAAY,CAAC,EAAE,aAAa,GAC7B,2BAA2B,CAY7B;AAED,aAAa;AACb,wBAAgB,iCAAiC,CAC7C,KAAK,EAAE,gBAAgB,EACvB,YAAY,CAAC,EAAE,aAAa,GAC7B,2BAA2B,CAW7B"}
@@ -0,0 +1,99 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { idRef, } from "@gooddata/sdk-model";
3
+ import { convertIdToTitle } from "../utils/sharedUtils.js";
4
+ import { filtersToDeclarative, yamlReportPageBodyToDeclarative, yamlReportPageToDeclarative, } from "./yamlReportPageToDeclarative.js";
5
+ function variablesToDeclarative(variables) {
6
+ return variables?.map((variable) => ({
7
+ name: variable.name,
8
+ ...(variable.title === undefined ? {} : { title: variable.title }),
9
+ ...(variable.description === undefined ? {} : { description: variable.description }),
10
+ ...(variable.default === undefined ? {} : { defaultValue: variable.default }),
11
+ }));
12
+ }
13
+ function contentToDeclarative(pages, filters, variables, errorContext) {
14
+ // The stored content states its own version; a document states the schema's instead, so the
15
+ // convertor is what knows which shape it just wrote.
16
+ const declared = filtersToDeclarative(filters);
17
+ const declaredVariables = variablesToDeclarative(variables);
18
+ return {
19
+ version: "1",
20
+ pages: pages?.map((body) => yamlReportPageToDeclarative(body, errorContext)) ?? [],
21
+ ...(declared === undefined ? {} : { filters: declared }),
22
+ ...(declaredVariables === undefined ? {} : { variables: declaredVariables }),
23
+ };
24
+ }
25
+ /**
26
+ * Named for the document it reads, because a visualisation's query convertor already owns the
27
+ * shorter name.
28
+ *
29
+ * @alpha
30
+ */
31
+ export function yamlReportDocumentToDeclarative(input, errorContext) {
32
+ return {
33
+ id: input.id,
34
+ title: input.title ?? convertIdToTitle(input.id ?? ""),
35
+ description: input.description ?? "",
36
+ tags: input.tags ?? [],
37
+ periodStart: input.period.start,
38
+ periodEnd: input.period.end,
39
+ ...(input.variable_values === undefined ? {} : { variableValues: input.variable_values }),
40
+ content: contentToDeclarative(input.pages, input.filters, input.variables, errorContext),
41
+ };
42
+ }
43
+ /**
44
+ * The same report, as the frontend holds it: an object reference in place of the bare id the
45
+ * document names it by.
46
+ *
47
+ * @alpha
48
+ */
49
+ export function yamlReportToDefinition(input, errorContext) {
50
+ return {
51
+ type: "report",
52
+ ...(input.id === undefined ? {} : { ref: idRef(input.id) }),
53
+ title: input.title ?? convertIdToTitle(input.id ?? ""),
54
+ ...(input.description === undefined ? {} : { description: input.description }),
55
+ ...(input.tags === undefined ? {} : { tags: input.tags }),
56
+ periodStart: input.period.start,
57
+ periodEnd: input.period.end,
58
+ ...(input.variable_values === undefined ? {} : { variableValues: input.variable_values }),
59
+ content: contentToDeclarative(input.pages, input.filters, input.variables, errorContext),
60
+ };
61
+ }
62
+ /** @alpha */
63
+ export function yamlReportTemplateToDefinition(input, errorContext) {
64
+ return {
65
+ type: "reportTemplate",
66
+ ...(input.id === undefined ? {} : { ref: idRef(input.id) }),
67
+ title: input.title ?? convertIdToTitle(input.id ?? ""),
68
+ ...(input.description === undefined ? {} : { description: input.description }),
69
+ ...(input.tags === undefined ? {} : { tags: input.tags }),
70
+ content: contentToDeclarative(input.pages, input.filters, input.variables, errorContext),
71
+ };
72
+ }
73
+ /** @alpha */
74
+ export function yamlReportPageLayoutToDefinition(input, errorContext) {
75
+ return {
76
+ type: "reportPageLayout",
77
+ ...(input.id === undefined ? {} : { ref: idRef(input.id) }),
78
+ title: input.title ?? convertIdToTitle(input.id ?? ""),
79
+ ...(input.description === undefined ? {} : { description: input.description }),
80
+ ...(input.tags === undefined ? {} : { tags: input.tags }),
81
+ content: {
82
+ version: "1",
83
+ ...yamlReportPageBodyToDeclarative(input, errorContext),
84
+ },
85
+ };
86
+ }
87
+ /** @alpha */
88
+ export function yamlReportPageLayoutToDeclarative(input, errorContext) {
89
+ return {
90
+ id: input.id,
91
+ title: input.title ?? convertIdToTitle(input.id ?? ""),
92
+ description: input.description ?? "",
93
+ tags: input.tags ?? [],
94
+ content: {
95
+ version: "1",
96
+ ...yamlReportPageBodyToDeclarative(input, errorContext),
97
+ },
98
+ };
99
+ }
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.12"
8
+ "packageVersion": "7.59.2"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Every reference the value holds, named the way the document names the object.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare function referencesAsWritten<T>(value: T): T;
7
+ /**
8
+ * Every reference the value holds, back in the shape and under the type the model stores.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function referencesAsStored<T>(value: T): T;
13
+ //# sourceMappingURL=reportFilterRefs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportFilterRefs.d.ts","sourceRoot":"","sources":["../../src/utils/reportFilterRefs.ts"],"names":[],"mappings":"AAoDA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAQlD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAQjD"}
@@ -0,0 +1,69 @@
1
+ // (C) 2026 GoodData Corporation
2
+ /**
3
+ * A report stores its filters as the model holds them, while the convertor that writes and reads
4
+ * them is the dashboard's, which works on what the declarative API sends. The two agree on every
5
+ * field but one: how an object is referenced. The model names it by a type of its own and carries
6
+ * the id beside it, the API nests the two and names the object as the document's prefixes do.
7
+ *
8
+ * Only the references are translated, so a field added to either shape needs nothing here.
9
+ */
10
+ const documentTypeOfModelType = {
11
+ displayForm: "label",
12
+ dataSet: "dataset",
13
+ measure: "metric",
14
+ };
15
+ const modelTypeOfDocumentType = {
16
+ label: "displayForm",
17
+ dataset: "dataSet",
18
+ metric: "measure",
19
+ };
20
+ /** A reference as the model holds it: the id beside the type. */
21
+ function isModelReference(value) {
22
+ return typeof value.identifier === "string";
23
+ }
24
+ /** A reference as the declarative API sends it: the id and the type nested under the identifier. */
25
+ function isApiReference(value) {
26
+ const { identifier } = value;
27
+ return typeof identifier === "object" && identifier !== null && typeof identifier.id === "string";
28
+ }
29
+ function translate(value, reference) {
30
+ if (Array.isArray(value)) {
31
+ return value.map((item) => translate(item, reference));
32
+ }
33
+ if (value === null || typeof value !== "object") {
34
+ return value;
35
+ }
36
+ const translated = reference(value);
37
+ if (translated !== undefined) {
38
+ return translated;
39
+ }
40
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, translate(item, reference)]));
41
+ }
42
+ /**
43
+ * Every reference the value holds, named the way the document names the object.
44
+ *
45
+ * @internal
46
+ */
47
+ export function referencesAsWritten(value) {
48
+ return translate(value, (node) => {
49
+ if (!isModelReference(node)) {
50
+ return undefined;
51
+ }
52
+ const type = node.type === undefined ? undefined : documentTypeOfModelType[node.type];
53
+ return type === undefined ? undefined : { ...node, type };
54
+ });
55
+ }
56
+ /**
57
+ * Every reference the value holds, back in the shape and under the type the model stores.
58
+ *
59
+ * @internal
60
+ */
61
+ export function referencesAsStored(value) {
62
+ return translate(value, (node) => {
63
+ if (!isApiReference(node)) {
64
+ return undefined;
65
+ }
66
+ const { id, type } = node.identifier;
67
+ return { identifier: id, type: modelTypeOfDocumentType[type] ?? type };
68
+ });
69
+ }