@gooddata/sdk-model 11.63.0-alpha.0 → 11.63.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/agentSkill/index.d.ts +1 -1
- package/esm/agentSkill/index.d.ts.map +1 -1
- package/esm/index.d.ts +8 -6
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +6 -4
- package/esm/publisher/aliases.d.ts +33 -33
- package/esm/publisher/aliases.d.ts.map +1 -1
- package/esm/publisher/aliases.js +25 -25
- package/esm/publisher/v1/content.d.ts +2 -2
- package/esm/publisher/v1/content.d.ts.map +1 -1
- package/esm/publisher/v1/defaultPageTemplates.d.ts +45 -0
- package/esm/publisher/v1/defaultPageTemplates.d.ts.map +1 -0
- package/esm/publisher/v1/{builtinPageLayouts.js → defaultPageTemplates.js} +25 -25
- package/esm/publisher/v1/factory.d.ts +5 -5
- package/esm/publisher/v1/factory.d.ts.map +1 -1
- package/esm/publisher/v1/factory.js +4 -4
- package/esm/publisher/v1/layout.d.ts +4 -4
- package/esm/publisher/v1/layout.d.ts.map +1 -1
- package/esm/publisher/v1/pageFormat.d.ts +1 -1
- package/esm/publisher/v1/{pageLayout.d.ts → pageTemplate.d.ts} +19 -19
- package/esm/publisher/v1/pageTemplate.d.ts.map +1 -0
- package/esm/publisher/v1/{pageLayout.js → pageTemplate.js} +7 -7
- package/esm/publisher/v1/slot.d.ts +1 -1
- package/esm/publisher/v2/themeReference.d.ts +17 -0
- package/esm/publisher/v2/themeReference.d.ts.map +1 -0
- package/esm/publisher/v2/themeReference.js +27 -0
- package/esm/publisher/v2/variables.d.ts +31 -0
- package/esm/publisher/v2/variables.d.ts.map +1 -0
- package/esm/publisher/v2/variables.js +59 -0
- package/esm/sdk-model.d.ts +483 -179
- package/esm/settings/settings.d.ts +4 -0
- package/esm/settings/settings.d.ts.map +1 -1
- package/esm/theme/index.d.ts +231 -0
- package/esm/theme/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/esm/publisher/v1/builtinPageLayouts.d.ts +0 -45
- package/esm/publisher/v1/builtinPageLayouts.d.ts.map +0 -1
- package/esm/publisher/v1/pageLayout.d.ts.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type IDashboardAttributeFilterConfig } from "../../dashboard/dashboard.js";
|
|
2
2
|
import { type FilterContextItem } from "../../dashboard/filterContext.js";
|
|
3
|
-
import { type IPublisherPageBodyV1 } from "./
|
|
3
|
+
import { type IPublisherPageBodyV1 } from "./pageTemplate.js";
|
|
4
4
|
import { type IPublisherVariableDefinitionV1 } from "./variables.js";
|
|
5
5
|
/**
|
|
6
6
|
* Page instance embedded in template/document content: a deep clone of a page body
|
|
7
7
|
* plus its own identity.
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
|
-
* Cloning a {@link
|
|
10
|
+
* Cloning a {@link IPublisherPageTemplateV1} into content assigns the localIdentifier and regenerates
|
|
11
11
|
* slot localIdentifiers (with the layout slotIds) so repeated use of one page stays unique.
|
|
12
12
|
* Deliberately carries NO reference back to the source page — later page edits never
|
|
13
13
|
* affect existing templates or documents.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/content.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/content.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IAClE;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG,IAAI,CAChD,+BAA+B,EAC/B,iBAAiB,GAAG,gBAAgB,CACvC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IACxC;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAElC;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE9B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,iCAAiC,EAAE,CAAC;IAE7D;;;OAGG;IACH,SAAS,CAAC,EAAE,8BAA8B,EAAE,CAAC;IAE7C;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,2BAA2B,CAM7F"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type IPublisherPageTemplateV1 } from "./pageTemplate.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default cover page: document title and subtitle.
|
|
4
|
+
*
|
|
5
|
+
* @alpha
|
|
6
|
+
*/
|
|
7
|
+
export declare const DefaultPublisherPageTemplateCoverV1: IPublisherPageTemplateV1;
|
|
8
|
+
/**
|
|
9
|
+
* Default section divider page.
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export declare const DefaultPublisherPageTemplateSectionV1: IPublisherPageTemplateV1;
|
|
14
|
+
/**
|
|
15
|
+
* Default content page with six visualizations and a text column on the left.
|
|
16
|
+
*
|
|
17
|
+
* @alpha
|
|
18
|
+
*/
|
|
19
|
+
export declare const DefaultPublisherPageTemplateViz6TextLeftV1: IPublisherPageTemplateV1;
|
|
20
|
+
/**
|
|
21
|
+
* Default portrait cover page: document title and subtitle.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export declare const DefaultPublisherPageTemplatePortraitCoverV1: IPublisherPageTemplateV1;
|
|
26
|
+
/**
|
|
27
|
+
* Default portrait section divider page.
|
|
28
|
+
*
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export declare const DefaultPublisherPageTemplatePortraitSectionV1: IPublisherPageTemplateV1;
|
|
32
|
+
/**
|
|
33
|
+
* Default portrait page carrying a full-page narrative, with no visualization.
|
|
34
|
+
*
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export declare const DefaultPublisherPageTemplatePortraitSummaryV1: IPublisherPageTemplateV1;
|
|
38
|
+
/**
|
|
39
|
+
* All default page templates served by the SPI. They are read-only: they cannot be
|
|
40
|
+
* edited or deleted, and they are never persisted on the backend.
|
|
41
|
+
*
|
|
42
|
+
* @alpha
|
|
43
|
+
*/
|
|
44
|
+
export declare const DefaultPublisherPageTemplatesV1: readonly IPublisherPageTemplateV1[];
|
|
45
|
+
//# sourceMappingURL=defaultPageTemplates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultPageTemplates.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/defaultPageTemplates.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAqL7F;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,EAAE,wBAkBhD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,EAAE,wBAalD,CAAC;AA2DH;;;;GAIG;AACH,eAAO,MAAM,0CAA0C,EAAE,wBA0BvD,CAAC;AAiDH;;;;GAIG;AACH,eAAO,MAAM,2CAA2C,EAAE,wBAkBxD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,6CAA6C,EAAE,wBAa1D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,6CAA6C,EAAE,wBAc1D,CAAC;AA8CH;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,wBAAwB,EAa7E,CAAC"}
|
|
@@ -99,7 +99,7 @@ const vizIds = (count, perRow) => {
|
|
|
99
99
|
}
|
|
100
100
|
return rows;
|
|
101
101
|
};
|
|
102
|
-
//
|
|
102
|
+
// Default page templates are shared singletons served by every backend implementation;
|
|
103
103
|
// freezing makes accidental mutation by a consumer throw instead of corrupting them.
|
|
104
104
|
function deepFreeze(value) {
|
|
105
105
|
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
@@ -110,21 +110,21 @@ function deepFreeze(value) {
|
|
|
110
110
|
}
|
|
111
111
|
return value;
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const defaultPage = ({ id, title, description, body, }) => deepFreeze({
|
|
114
114
|
type: "reportPageLayout",
|
|
115
115
|
ref: idRef(`builtin.reportPageLayout.${id}`, "reportPageLayout"),
|
|
116
116
|
title,
|
|
117
117
|
description,
|
|
118
118
|
content: { version: "1", ...body },
|
|
119
|
-
|
|
119
|
+
isDefault: true,
|
|
120
120
|
isLocked: true,
|
|
121
121
|
});
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
123
|
+
* Default cover page: document title and subtitle.
|
|
124
124
|
*
|
|
125
125
|
* @alpha
|
|
126
126
|
*/
|
|
127
|
-
export const
|
|
127
|
+
export const DefaultPublisherPageTemplateCoverV1 = defaultPage({
|
|
128
128
|
id: "cover",
|
|
129
129
|
title: "Cover",
|
|
130
130
|
description: "Title page",
|
|
@@ -144,11 +144,11 @@ export const BuiltInPublisherPageLayoutCoverV1 = builtInPage({
|
|
|
144
144
|
},
|
|
145
145
|
});
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
147
|
+
* Default section divider page.
|
|
148
148
|
*
|
|
149
149
|
* @alpha
|
|
150
150
|
*/
|
|
151
|
-
export const
|
|
151
|
+
export const DefaultPublisherPageTemplateSectionV1 = defaultPage({
|
|
152
152
|
id: "section",
|
|
153
153
|
title: "Section",
|
|
154
154
|
description: "Section divider page",
|
|
@@ -218,11 +218,11 @@ const widescreenContentPages = [
|
|
|
218
218
|
],
|
|
219
219
|
];
|
|
220
220
|
/**
|
|
221
|
-
*
|
|
221
|
+
* Default content page with six visualizations and a text column on the left.
|
|
222
222
|
*
|
|
223
223
|
* @alpha
|
|
224
224
|
*/
|
|
225
|
-
export const
|
|
225
|
+
export const DefaultPublisherPageTemplateViz6TextLeftV1 = defaultPage({
|
|
226
226
|
id: "viz6TextLeft",
|
|
227
227
|
title: "6 visualizations + text",
|
|
228
228
|
description: "Two rows of three visualizations with a text column on the left",
|
|
@@ -276,11 +276,11 @@ const portraitContentPage = ({ vizRows, text, summary }) => {
|
|
|
276
276
|
};
|
|
277
277
|
};
|
|
278
278
|
/**
|
|
279
|
-
*
|
|
279
|
+
* Default portrait cover page: document title and subtitle.
|
|
280
280
|
*
|
|
281
281
|
* @alpha
|
|
282
282
|
*/
|
|
283
|
-
export const
|
|
283
|
+
export const DefaultPublisherPageTemplatePortraitCoverV1 = defaultPage({
|
|
284
284
|
id: "portraitCover",
|
|
285
285
|
title: "Cover (portrait)",
|
|
286
286
|
description: "Title page of an upright document",
|
|
@@ -300,11 +300,11 @@ export const BuiltInPublisherPageLayoutPortraitCoverV1 = builtInPage({
|
|
|
300
300
|
},
|
|
301
301
|
});
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
303
|
+
* Default portrait section divider page.
|
|
304
304
|
*
|
|
305
305
|
* @alpha
|
|
306
306
|
*/
|
|
307
|
-
export const
|
|
307
|
+
export const DefaultPublisherPageTemplatePortraitSectionV1 = defaultPage({
|
|
308
308
|
id: "portraitSection",
|
|
309
309
|
title: "Section (portrait)",
|
|
310
310
|
description: "Section divider page of an upright document",
|
|
@@ -319,11 +319,11 @@ export const BuiltInPublisherPageLayoutPortraitSectionV1 = builtInPage({
|
|
|
319
319
|
},
|
|
320
320
|
});
|
|
321
321
|
/**
|
|
322
|
-
*
|
|
322
|
+
* Default portrait page carrying a full-page narrative, with no visualization.
|
|
323
323
|
*
|
|
324
324
|
* @alpha
|
|
325
325
|
*/
|
|
326
|
-
export const
|
|
326
|
+
export const DefaultPublisherPageTemplatePortraitSummaryV1 = defaultPage({
|
|
327
327
|
id: "portraitSummary",
|
|
328
328
|
title: "Summary (portrait)",
|
|
329
329
|
description: "Full-page narrative with no visualization",
|
|
@@ -382,18 +382,18 @@ const portraitContentPages = [
|
|
|
382
382
|
],
|
|
383
383
|
];
|
|
384
384
|
/**
|
|
385
|
-
* All
|
|
385
|
+
* All default page templates served by the SPI. They are read-only: they cannot be
|
|
386
386
|
* edited or deleted, and they are never persisted on the backend.
|
|
387
387
|
*
|
|
388
388
|
* @alpha
|
|
389
389
|
*/
|
|
390
|
-
export const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
...widescreenContentPages.map(([id, title, description, spec]) =>
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
...portraitContentPages.map(([id, title, description, spec]) =>
|
|
390
|
+
export const DefaultPublisherPageTemplatesV1 = Object.freeze([
|
|
391
|
+
DefaultPublisherPageTemplateCoverV1,
|
|
392
|
+
DefaultPublisherPageTemplateSectionV1,
|
|
393
|
+
...widescreenContentPages.map(([id, title, description, spec]) => defaultPage({ id, title, description, body: widescreenContentPage(spec) })),
|
|
394
|
+
DefaultPublisherPageTemplateViz6TextLeftV1,
|
|
395
|
+
DefaultPublisherPageTemplatePortraitCoverV1,
|
|
396
|
+
DefaultPublisherPageTemplatePortraitSectionV1,
|
|
397
|
+
DefaultPublisherPageTemplatePortraitSummaryV1,
|
|
398
|
+
...portraitContentPages.map(([id, title, description, spec]) => defaultPage({ id, title, description, body: portraitContentPage(spec) })),
|
|
399
399
|
]);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type IPublisherDocumentContentV1, type IPublisherDocumentPageV1 } from "./content.js";
|
|
2
2
|
import { type IPublisherDocumentDefinitionV1, type IPublisherDocumentTemplateDefinitionV1, type IPublisherDocumentTemplateV1, type IPublisherDocumentV1 } from "./document.js";
|
|
3
|
-
import { type IPublisherPageBodyV1, type
|
|
3
|
+
import { type IPublisherPageBodyV1, type IPublisherPageTemplateDefinitionV1, type IPublisherPageTemplateV1 } from "./pageTemplate.js";
|
|
4
4
|
import { type PublisherDateStringV1 } from "./variables.js";
|
|
5
5
|
/**
|
|
6
|
-
* Creates a new page
|
|
6
|
+
* Creates a new page template definition.
|
|
7
7
|
*
|
|
8
8
|
* @alpha
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function newPublisherPageTemplateDefinitionV1(title: string, body: IPublisherPageBodyV1, modifications?: Partial<Omit<IPublisherPageTemplateDefinitionV1, "type" | "title" | "content">>): IPublisherPageTemplateDefinitionV1;
|
|
11
11
|
/**
|
|
12
|
-
* Clones a page
|
|
12
|
+
* Clones a page template into a page instance embeddable in template/document content.
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
15
|
* The body is deep-copied and detached from the source page — no reference is kept.
|
|
@@ -18,7 +18,7 @@ export declare function newPublisherPageLayoutDefinitionV1(title: string, body:
|
|
|
18
18
|
*
|
|
19
19
|
* @alpha
|
|
20
20
|
*/
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function newPublisherDocumentPageFromTemplateV1(page: IPublisherPageTemplateV1 | IPublisherPageTemplateDefinitionV1, localIdentifier?: string): IPublisherDocumentPageV1;
|
|
22
22
|
/**
|
|
23
23
|
* Creates document content from page instances.
|
|
24
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,sCAAsC,EAC3C,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,KAAK,oBAAoB,EAEzB,KAAK,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,2BAA2B,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,sCAAsC,EAC3C,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,KAAK,oBAAoB,EAEzB,KAAK,kCAAkC,EACvC,KAAK,wBAAwB,EAChC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAyC5D;;;;GAIG;AACH,wBAAgB,oCAAoC,CAChD,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,oBAAoB,EAC1B,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,kCAAkC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,GAChG,kCAAkC,CAQpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,sCAAsC,CAClD,IAAI,EAAE,wBAAwB,GAAG,kCAAkC,EACnE,eAAe,GAAE,MAAyC,GAC3D,wBAAwB,CAY1B;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,wBAAwB,EAAE,EACjC,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,GAChF,2BAA2B,CAM7B;AAED;;;;GAIG;AACH,wBAAgB,wCAAwC,CACpD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,2BAA2B,EACpC,aAAa,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,GACpG,sCAAsC,CAOxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,4CAA4C,CACxD,QAAQ,EAAE,4BAA4B,GAAG,sCAAsC,EAC/E,OAAO,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,qBAAqB,CAAC;IACnC,SAAS,EAAE,qBAAqB,CAAC;CACpC,EACD,aAAa,CAAC,EAAE,OAAO,CACnB,IAAI,CAAC,8BAA8B,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC,CACnG,GACF,8BAA8B,CAShC;AAED;;;;GAIG;AACH,wBAAgB,qCAAqC,CACjD,OAAO,EAAE;IACL,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,qBAAqB,CAAC;IACnC,SAAS,EAAE,qBAAqB,CAAC;IACjC,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACtC,EACD,aAAa,CAAC,EAAE,OAAO,CACnB,IAAI,CAAC,8BAA8B,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC,CACnG,GACF,8BAA8B,CAShC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACnC,kBAAkB,EACZ,oBAAoB,GACpB,8BAA8B,GAC9B,4BAA4B,GAC5B,sCAAsC,EAC5C,mBAAmB,EAAE,MAAM,GAC5B,wBAAwB,GAAG,SAAS,CAEtC"}
|
|
@@ -33,11 +33,11 @@ function prefixLayoutSlotIds(node, prefix) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Creates a new page
|
|
36
|
+
* Creates a new page template definition.
|
|
37
37
|
*
|
|
38
38
|
* @alpha
|
|
39
39
|
*/
|
|
40
|
-
export function
|
|
40
|
+
export function newPublisherPageTemplateDefinitionV1(title, body, modifications) {
|
|
41
41
|
const content = { version: "1", ...body };
|
|
42
42
|
return {
|
|
43
43
|
type: "reportPageLayout",
|
|
@@ -47,7 +47,7 @@ export function newPublisherPageLayoutDefinitionV1(title, body, modifications) {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Clones a page
|
|
50
|
+
* Clones a page template into a page instance embeddable in template/document content.
|
|
51
51
|
*
|
|
52
52
|
* @remarks
|
|
53
53
|
* The body is deep-copied and detached from the source page — no reference is kept.
|
|
@@ -56,7 +56,7 @@ export function newPublisherPageLayoutDefinitionV1(title, body, modifications) {
|
|
|
56
56
|
*
|
|
57
57
|
* @alpha
|
|
58
58
|
*/
|
|
59
|
-
export function
|
|
59
|
+
export function newPublisherDocumentPageFromTemplateV1(page, localIdentifier = generatePublisherLocalId("page")) {
|
|
60
60
|
const { version: _version, ...body } = deepClone(page.content);
|
|
61
61
|
return {
|
|
62
62
|
...body,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type IPublisherBoxStyleV1 } from "./styling.js";
|
|
2
2
|
/**
|
|
3
|
-
* Node of a page layout: a recursive row/column split tree (flexbox semantics)
|
|
3
|
+
* Node of a page's layout tree: a recursive row/column split tree (flexbox semantics)
|
|
4
4
|
* over a fixed page. Leaves assign their area to slots; the tree carries geometry and
|
|
5
5
|
* box paint, slot content lives in {@link IPublisherPageBodyV1.slots}.
|
|
6
6
|
*
|
|
7
7
|
* @alpha
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type PublisherLayoutNodeV1 = IPublisherLayoutSectionV1 | IPublisherLayoutSlotRefV1;
|
|
10
10
|
/**
|
|
11
|
-
* Fields common to all
|
|
11
|
+
* Fields common to all layout nodes.
|
|
12
12
|
*
|
|
13
13
|
* @alpha
|
|
14
14
|
*/
|
|
@@ -30,7 +30,7 @@ export interface IPublisherLayoutSectionV1 extends IPublisherLayoutNodeBaseV1 {
|
|
|
30
30
|
* "row" lays children out horizontally, "column" vertically.
|
|
31
31
|
*/
|
|
32
32
|
direction: "row" | "column";
|
|
33
|
-
children:
|
|
33
|
+
children: PublisherLayoutNodeV1[];
|
|
34
34
|
/**
|
|
35
35
|
* Paint of this section's box. Never affects how children are laid out.
|
|
36
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,GAAG,yBAAyB,CAAC;AAE1F;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IACzE,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;IAE5B,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAElC;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IACzE,IAAI,EAAE,SAAS,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,yBAAyB,CAEzF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,yBAAyB,CAEzF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type IAuditableDates, type IAuditableUsers } from "../../base/metadata.js";
|
|
2
2
|
import { type FilterContextItem } from "../../dashboard/filterContext.js";
|
|
3
3
|
import { type ObjRef } from "../../objRef/index.js";
|
|
4
|
-
import { type
|
|
4
|
+
import { type PublisherLayoutNodeV1 } from "./layout.js";
|
|
5
5
|
import { type PublisherPageFormatV1 } from "./pageFormat.js";
|
|
6
6
|
import { type PublisherSlotV1 } from "./slot.js";
|
|
7
7
|
import { type IPublisherBoxStyleV1 } from "./styling.js";
|
|
@@ -9,7 +9,7 @@ import { type IPublisherBoxStyleV1 } from "./styling.js";
|
|
|
9
9
|
* Body of a document page: geometry (flex split tree) plus the slots it places.
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
|
-
* This is both the content of the standalone {@link
|
|
12
|
+
* This is both the content of the standalone {@link IPublisherPageTemplateV1} object and the shape
|
|
13
13
|
* embedded in template/document content ({@link IPublisherDocumentPageV1}).
|
|
14
14
|
*
|
|
15
15
|
* There is no header/footer chrome: page title, description, footer, page numbers and
|
|
@@ -34,9 +34,9 @@ export interface IPublisherPageBodyV1 {
|
|
|
34
34
|
*/
|
|
35
35
|
style?: IPublisherBoxStyleV1;
|
|
36
36
|
/**
|
|
37
|
-
* Root of the
|
|
37
|
+
* Root of the layout tree.
|
|
38
38
|
*/
|
|
39
|
-
layout:
|
|
39
|
+
layout: PublisherLayoutNodeV1;
|
|
40
40
|
/**
|
|
41
41
|
* All slots referenced by the layout, flat, keyed by localIdentifier.
|
|
42
42
|
*/
|
|
@@ -52,18 +52,18 @@ export interface IPublisherPageBodyV1 {
|
|
|
52
52
|
*
|
|
53
53
|
* @alpha
|
|
54
54
|
*/
|
|
55
|
-
export interface
|
|
55
|
+
export interface IPublisherPageTemplateContentV1 extends IPublisherPageBodyV1 {
|
|
56
56
|
/**
|
|
57
57
|
* Content model version, for stored-content evolution.
|
|
58
58
|
*/
|
|
59
59
|
version: "1";
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* Payload for creating or updating a page
|
|
62
|
+
* Payload for creating or updating a page template.
|
|
63
63
|
*
|
|
64
64
|
* @alpha
|
|
65
65
|
*/
|
|
66
|
-
export interface
|
|
66
|
+
export interface IPublisherPageTemplateDefinitionV1 {
|
|
67
67
|
type: "reportPageLayout";
|
|
68
68
|
/**
|
|
69
69
|
* Present when updating an existing page.
|
|
@@ -72,14 +72,14 @@ export interface IPublisherPageLayoutDefinitionV1 {
|
|
|
72
72
|
title: string;
|
|
73
73
|
description?: string;
|
|
74
74
|
tags?: string[];
|
|
75
|
-
content:
|
|
75
|
+
content: IPublisherPageTemplateContentV1;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* Reusable page
|
|
78
|
+
* Reusable page template metadata object.
|
|
79
79
|
*
|
|
80
80
|
* @alpha
|
|
81
81
|
*/
|
|
82
|
-
export interface
|
|
82
|
+
export interface IPublisherPageTemplateV1 extends IPublisherPageTemplateDefinitionV1, IAuditableDates, IAuditableUsers {
|
|
83
83
|
ref: ObjRef;
|
|
84
84
|
/**
|
|
85
85
|
* When true, the object comes from a parent workspace and is not editable
|
|
@@ -88,28 +88,28 @@ export interface IPublisherPageLayoutV1 extends IPublisherPageLayoutDefinitionV1
|
|
|
88
88
|
isLocked?: boolean;
|
|
89
89
|
/**
|
|
90
90
|
* Predefined page shipped with the product, populated by the SPI. Never sent to or
|
|
91
|
-
* stored on the backend; UI must disable deletion and editing of
|
|
91
|
+
* stored on the backend; UI must disable deletion and editing of default page templates.
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
isDefault?: boolean;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
96
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageTemplateDefinitionV1}.
|
|
97
97
|
*
|
|
98
98
|
* @alpha
|
|
99
99
|
*/
|
|
100
|
-
export declare function
|
|
100
|
+
export declare function isPublisherPageTemplateDefinitionV1(obj: unknown): obj is IPublisherPageTemplateDefinitionV1;
|
|
101
101
|
/**
|
|
102
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
102
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageTemplateV1}.
|
|
103
103
|
*
|
|
104
104
|
* @alpha
|
|
105
105
|
*/
|
|
106
|
-
export declare function
|
|
106
|
+
export declare function isPublisherPageTemplateV1(obj: unknown): obj is IPublisherPageTemplateV1;
|
|
107
107
|
/**
|
|
108
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
108
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageTemplateContentV1}.
|
|
109
109
|
*
|
|
110
110
|
* @alpha
|
|
111
111
|
*/
|
|
112
|
-
export declare function
|
|
112
|
+
export declare function isPublisherPageTemplateContentV1(obj: unknown): obj is IPublisherPageTemplateContentV1;
|
|
113
113
|
/**
|
|
114
114
|
* Validation issue found in a page body.
|
|
115
115
|
*
|
|
@@ -130,4 +130,4 @@ export interface IPublisherPageBodyValidationIssueV1 {
|
|
|
130
130
|
* @alpha
|
|
131
131
|
*/
|
|
132
132
|
export declare function validatePublisherPageBodyV1(body: IPublisherPageBodyV1): IPublisherPageBodyValidationIssueV1[];
|
|
133
|
-
//# sourceMappingURL=
|
|
133
|
+
//# sourceMappingURL=pageTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageTemplate.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/pageTemplate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EACH,KAAK,qBAAqB,EAG7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,qBAAqB,EAA2B,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,KAAK,eAAe,EAAiD,MAAM,WAAW,CAAC;AAChG,OAAO,EAAE,KAAK,oBAAoB,EAAgC,MAAM,cAAc,CAAC;AAEvF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAEvC;;;OAGG;IACH,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAE/B;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAE7B;;OAEG;IACH,MAAM,EAAE,qBAAqB,CAAC;IAE9B;;OAEG;IACH,KAAK,EAAE,eAAe,EAAE,CAAC;IAEzB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,+BAAgC,SAAQ,oBAAoB;IACzE;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IAC/C,IAAI,EAAE,kBAAkB,CAAC;IAEzB;;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,+BAA+B,CAAC;CAC5C;AAED;;;;GAIG;AACH,MAAM,WAAW,wBACb,SAAQ,kCAAkC,EAAE,eAAe,EAAE,eAAe;IAC5E,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,kCAAkC,CAE3G;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAEvF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,+BAA+B,CAOrG;AAED;;;;GAIG;AACH,MAAM,WAAW,mCAAmC;IAChD,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,oBAAoB,GAC3B,mCAAmC,EAAE,CA+FvC"}
|
|
@@ -6,27 +6,27 @@ import { isPublisherPageFormatV1 } from "./pageFormat.js";
|
|
|
6
6
|
import { isPublisherImageSlotV1, isPublisherTextSlotV1 } from "./slot.js";
|
|
7
7
|
import { isPublisherImageBackgroundV1 } from "./styling.js";
|
|
8
8
|
/**
|
|
9
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
9
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageTemplateDefinitionV1}.
|
|
10
10
|
*
|
|
11
11
|
* @alpha
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function isPublisherPageTemplateDefinitionV1(obj) {
|
|
14
14
|
return !isEmpty(obj) && obj.type === "reportPageLayout";
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
17
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageTemplateV1}.
|
|
18
18
|
*
|
|
19
19
|
* @alpha
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
22
|
-
return
|
|
21
|
+
export function isPublisherPageTemplateV1(obj) {
|
|
22
|
+
return isPublisherPageTemplateDefinitionV1(obj) && isObjRef(obj.ref);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Type-guard testing whether the provided object is an instance of {@link
|
|
25
|
+
* Type-guard testing whether the provided object is an instance of {@link IPublisherPageTemplateContentV1}.
|
|
26
26
|
*
|
|
27
27
|
* @alpha
|
|
28
28
|
*/
|
|
29
|
-
export function
|
|
29
|
+
export function isPublisherPageTemplateContentV1(obj) {
|
|
30
30
|
return (!isEmpty(obj) &&
|
|
31
31
|
obj.version === "1" &&
|
|
32
32
|
!isEmpty(obj.layout) &&
|
|
@@ -3,7 +3,7 @@ import { type VisualizationProperties } from "../../insight/index.js";
|
|
|
3
3
|
import { type ObjRef } from "../../objRef/index.js";
|
|
4
4
|
import { type IPublisherHeadingStyleV1, type IPublisherImageStyleV1, type IPublisherParagraphStyleV1, type PublisherTextTypeV1 } from "./styling.js";
|
|
5
5
|
/**
|
|
6
|
-
* Metadata of a slot that is intentionally left unfilled in a page
|
|
6
|
+
* Metadata of a slot that is intentionally left unfilled in a page template or document template.
|
|
7
7
|
*
|
|
8
8
|
* @alpha
|
|
9
9
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The path of a theme reference such as `{theme.colors.texts.muted}`, as
|
|
3
|
+
* `["colors", "texts", "muted"]`; undefined when the value is not one.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* A theme reference is always the whole value, never part of a longer string.
|
|
7
|
+
*
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPublisherThemeReferencePathV2(value: unknown): string[] | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The theme reference to the path, such as `{theme.assets.images.cover}`.
|
|
13
|
+
*
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export declare function publisherThemeReferenceV2(path: readonly string[]): string;
|
|
17
|
+
//# sourceMappingURL=themeReference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeReference.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/themeReference.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAMrF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEzE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
// Segments follow the validator's theme names, so a color id or a shadow name may hold dashes.
|
|
3
|
+
const themeReferenceRegex = /^\{theme((?:\.[A-Za-z0-9_-]+)+)\}$/;
|
|
4
|
+
/**
|
|
5
|
+
* The path of a theme reference such as `{theme.colors.texts.muted}`, as
|
|
6
|
+
* `["colors", "texts", "muted"]`; undefined when the value is not one.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* A theme reference is always the whole value, never part of a longer string.
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export function getPublisherThemeReferencePathV2(value) {
|
|
14
|
+
if (typeof value !== "string") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const match = themeReferenceRegex.exec(value);
|
|
18
|
+
return match === null ? undefined : match[1].slice(1).split(".");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The theme reference to the path, such as `{theme.assets.images.cover}`.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export function publisherThemeReferenceV2(path) {
|
|
26
|
+
return `{theme.${path.join(".")}}`;
|
|
27
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A variable every document resolves, referenced from text as `{name}`.
|
|
3
|
+
*
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
export type PublisherTextVariableV2 = "documentName" | "documentDescription" | "documentDateRange" | "documentAttributeFilters" | "periodStart" | "periodEnd" | "lastModifiedAt" | "lastModifiedBy" | "exportedAt" | "exportedBy" | "workspaceName" | "workspaceId" | "currentPageNumber" | "totalPages";
|
|
7
|
+
/**
|
|
8
|
+
* All document text variable names.
|
|
9
|
+
*
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export declare const PublisherTextVariablesV2: readonly PublisherTextVariableV2[];
|
|
13
|
+
/**
|
|
14
|
+
* The marker referencing the variable from document text.
|
|
15
|
+
*
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export declare function publisherTextPlaceholderV2(name: PublisherTextVariableV2): string;
|
|
19
|
+
/**
|
|
20
|
+
* Collects the distinct `{variable}` names referenced in the text, in order of first occurrence.
|
|
21
|
+
*
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPublisherTextPlaceholdersV2(text: string): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Replaces `{variable}` markers with values. A marker with no value stays as typed.
|
|
27
|
+
*
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolvePublisherTextPlaceholdersV2(text: string, values: Partial<Record<PublisherTextVariableV2, string>>): string;
|
|
31
|
+
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/variables.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAC7B,cAAc,GACd,qBAAqB,GACrB,mBAAmB,GACnB,0BAA0B,GAC1B,aAAa,GACb,WAAW,GACX,gBAAgB,GAChB,gBAAgB,GAChB,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,aAAa,GACb,mBAAmB,GACnB,YAAY,CAAC;AAEnB;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,uBAAuB,EAetE,CAAC;AAIF;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,uBAAuB,GAAG,MAAM,CAEhF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CASrE;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAC9C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,GACzD,MAAM,CAOR"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/**
|
|
3
|
+
* All document text variable names.
|
|
4
|
+
*
|
|
5
|
+
* @alpha
|
|
6
|
+
*/
|
|
7
|
+
export const PublisherTextVariablesV2 = [
|
|
8
|
+
"documentName",
|
|
9
|
+
"documentDescription",
|
|
10
|
+
"documentDateRange",
|
|
11
|
+
"documentAttributeFilters",
|
|
12
|
+
"periodStart",
|
|
13
|
+
"periodEnd",
|
|
14
|
+
"lastModifiedAt",
|
|
15
|
+
"lastModifiedBy",
|
|
16
|
+
"exportedAt",
|
|
17
|
+
"exportedBy",
|
|
18
|
+
"workspaceName",
|
|
19
|
+
"workspaceId",
|
|
20
|
+
"currentPageNumber",
|
|
21
|
+
"totalPages",
|
|
22
|
+
];
|
|
23
|
+
const placeholderRegex = /\{([a-zA-Z][a-zA-Z0-9_]*)\}/g;
|
|
24
|
+
/**
|
|
25
|
+
* The marker referencing the variable from document text.
|
|
26
|
+
*
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
29
|
+
export function publisherTextPlaceholderV2(name) {
|
|
30
|
+
return `{${name}}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Collects the distinct `{variable}` names referenced in the text, in order of first occurrence.
|
|
34
|
+
*
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export function getPublisherTextPlaceholdersV2(text) {
|
|
38
|
+
const names = [];
|
|
39
|
+
for (const match of text.matchAll(placeholderRegex)) {
|
|
40
|
+
const name = match[1];
|
|
41
|
+
if (!names.includes(name)) {
|
|
42
|
+
names.push(name);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return names;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Replaces `{variable}` markers with values. A marker with no value stays as typed.
|
|
49
|
+
*
|
|
50
|
+
* @alpha
|
|
51
|
+
*/
|
|
52
|
+
export function resolvePublisherTextPlaceholdersV2(text, values) {
|
|
53
|
+
return text.replace(placeholderRegex, (marker, name) => {
|
|
54
|
+
const value = Object.prototype.hasOwnProperty.call(values, name)
|
|
55
|
+
? values[name]
|
|
56
|
+
: undefined;
|
|
57
|
+
return value === undefined ? marker : value;
|
|
58
|
+
});
|
|
59
|
+
}
|