@gooddata/sdk-model 11.62.0-alpha.2 → 11.62.0-alpha.4
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/dashboard/filterContext.d.ts +1 -1
- package/esm/dashboard/filterContext.d.ts.map +1 -1
- package/esm/dashboard/filterContext.js +2 -2
- package/esm/dashboard/filterConverters.d.ts.map +1 -1
- package/esm/dashboard/filterConverters.js +10 -2
- package/esm/execution/filter/factory.d.ts +35 -0
- package/esm/execution/filter/factory.d.ts.map +1 -1
- package/esm/execution/filter/factory.js +5 -11
- package/esm/execution/filter/index.d.ts +13 -0
- package/esm/execution/filter/index.d.ts.map +1 -1
- package/esm/execution/filter/index.js +2 -0
- package/esm/execution/objectFactoryNotation/index.d.ts.map +1 -1
- package/esm/execution/objectFactoryNotation/index.js +16 -5
- package/esm/genAI/chat.d.ts +3 -2
- package/esm/genAI/chat.d.ts.map +1 -1
- package/esm/index.d.ts +23 -12
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +20 -10
- package/esm/publisher/aliases.d.ts +580 -0
- package/esm/publisher/aliases.d.ts.map +1 -0
- package/esm/publisher/aliases.js +304 -0
- package/esm/publisher/v1/builtinPageLayouts.d.ts +45 -0
- package/esm/publisher/v1/builtinPageLayouts.d.ts.map +1 -0
- package/esm/publisher/{builtinPageLayouts.js → v1/builtinPageLayouts.js} +14 -14
- package/esm/publisher/{content.d.ts → v1/content.d.ts} +14 -14
- package/esm/publisher/v1/content.d.ts.map +1 -0
- package/esm/publisher/{content.js → v1/content.js} +1 -1
- package/esm/publisher/{document.d.ts → v1/document.d.ts} +21 -21
- package/esm/publisher/v1/document.d.ts.map +1 -0
- package/esm/publisher/v1/document.js +35 -0
- package/esm/publisher/v1/factory.d.ts +65 -0
- package/esm/publisher/v1/factory.d.ts.map +1 -0
- package/esm/publisher/{factory.js → v1/factory.js} +12 -12
- package/esm/publisher/{layout.d.ts → v1/layout.d.ts} +13 -13
- package/esm/publisher/v1/layout.d.ts.map +1 -0
- package/esm/publisher/{layout.js → v1/layout.js} +4 -4
- package/esm/publisher/{pageFormat.d.ts → v1/pageFormat.d.ts} +6 -6
- package/esm/publisher/v1/pageFormat.d.ts.map +1 -0
- package/esm/publisher/{pageFormat.js → v1/pageFormat.js} +6 -6
- package/esm/publisher/{pageLayout.d.ts → v1/pageLayout.d.ts} +27 -27
- package/esm/publisher/v1/pageLayout.d.ts.map +1 -0
- package/esm/publisher/{pageLayout.js → v1/pageLayout.js} +18 -18
- package/esm/publisher/{slot.d.ts → v1/slot.d.ts} +41 -41
- package/esm/publisher/v1/slot.d.ts.map +1 -0
- package/esm/publisher/v1/slot.js +90 -0
- package/esm/publisher/{styling.d.ts → v1/styling.d.ts} +36 -36
- package/esm/publisher/v1/styling.d.ts.map +1 -0
- package/esm/publisher/{styling.js → v1/styling.js} +14 -14
- package/esm/publisher/{variables.d.ts → v1/variables.d.ts} +10 -10
- package/esm/publisher/v1/variables.d.ts.map +1 -0
- package/esm/publisher/{variables.js → v1/variables.js} +4 -4
- package/esm/publisher/v2/checks.d.ts +58 -0
- package/esm/publisher/v2/checks.d.ts.map +1 -0
- package/esm/publisher/v2/checks.js +100 -0
- package/esm/publisher/v2/content.d.ts +154 -0
- package/esm/publisher/v2/content.d.ts.map +1 -0
- package/esm/publisher/v2/content.js +34 -0
- package/esm/publisher/v2/document.d.ts +116 -0
- package/esm/publisher/v2/document.d.ts.map +1 -0
- package/esm/publisher/v2/document.js +47 -0
- package/esm/publisher/v2/factory.d.ts +69 -0
- package/esm/publisher/v2/factory.d.ts.map +1 -0
- package/esm/publisher/v2/factory.js +80 -0
- package/esm/publisher/v2/layout.d.ts +48 -0
- package/esm/publisher/v2/layout.d.ts.map +1 -0
- package/esm/publisher/v2/layout.js +20 -0
- package/esm/publisher/v2/page.d.ts +67 -0
- package/esm/publisher/v2/page.d.ts.map +1 -0
- package/esm/publisher/v2/page.js +34 -0
- package/esm/publisher/v2/sections.d.ts +34 -0
- package/esm/publisher/v2/sections.d.ts.map +1 -0
- package/esm/publisher/v2/sections.js +40 -0
- package/esm/publisher/v2/structure.d.ts +5 -0
- package/esm/publisher/v2/structure.d.ts.map +1 -0
- package/esm/publisher/v2/structure.js +533 -0
- package/esm/publisher/v2/style.d.ts +323 -0
- package/esm/publisher/v2/style.d.ts.map +1 -0
- package/esm/publisher/v2/style.js +22 -0
- package/esm/publisher/v2/validation.d.ts +26 -0
- package/esm/publisher/v2/validation.d.ts.map +1 -0
- package/esm/publisher/v2/validation.js +157 -0
- package/esm/publisher/v2/widget.d.ts +295 -0
- package/esm/publisher/v2/widget.d.ts.map +1 -0
- package/esm/publisher/v2/widget.js +79 -0
- package/esm/sdk-model.d.ts +2426 -453
- package/esm/settings/settings.d.ts +31 -1
- package/esm/settings/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/esm/publisher/builtinPageLayouts.d.ts +0 -45
- package/esm/publisher/builtinPageLayouts.d.ts.map +0 -1
- package/esm/publisher/content.d.ts.map +0 -1
- package/esm/publisher/document.d.ts.map +0 -1
- package/esm/publisher/document.js +0 -35
- package/esm/publisher/factory.d.ts +0 -65
- package/esm/publisher/factory.d.ts.map +0 -1
- package/esm/publisher/layout.d.ts.map +0 -1
- package/esm/publisher/pageFormat.d.ts.map +0 -1
- package/esm/publisher/pageLayout.d.ts.map +0 -1
- package/esm/publisher/slot.d.ts.map +0 -1
- package/esm/publisher/slot.js +0 -87
- package/esm/publisher/styling.d.ts.map +0 -1
- package/esm/publisher/variables.d.ts.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @alpha
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type PublisherDateStringV1 = string;
|
|
7
7
|
/**
|
|
8
8
|
* Variables resolved by the rendering runtime; they are never declared or stored.
|
|
9
9
|
*
|
|
@@ -13,26 +13,26 @@ export type PublisherDateString = string;
|
|
|
13
13
|
*
|
|
14
14
|
* @alpha
|
|
15
15
|
*/
|
|
16
|
-
export type
|
|
16
|
+
export type PublisherBuiltInVariableV1 = "reportName" | "reportDescription" | "periodStart" | "periodEnd" | "reportDateRange" | "reportAttributeFilters" | "exportedAt" | "exportedBy" | "lastModifiedAt" | "lastModifiedBy" | "workspaceName" | "workspaceId" | "totalPages" | "currentPageNumber" | "logo";
|
|
17
17
|
/**
|
|
18
18
|
* All built-in document variable names.
|
|
19
19
|
*
|
|
20
20
|
* @alpha
|
|
21
21
|
*/
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const PublisherBuiltInVariablesV1: PublisherBuiltInVariableV1[];
|
|
23
23
|
/**
|
|
24
24
|
* A custom variable declared by document content and given a value by a document.
|
|
25
25
|
*
|
|
26
26
|
* @remarks
|
|
27
|
-
* Referenced from text as `{name}`. Values come from {@link
|
|
28
|
-
* falling back to {@link
|
|
27
|
+
* Referenced from text as `{name}`. Values come from {@link IPublisherDocumentBaseV1.variableValues},
|
|
28
|
+
* falling back to {@link IPublisherVariableDefinitionV1.defaultValue}.
|
|
29
29
|
*
|
|
30
30
|
* @alpha
|
|
31
31
|
*/
|
|
32
|
-
export interface
|
|
32
|
+
export interface IPublisherVariableDefinitionV1 {
|
|
33
33
|
/**
|
|
34
34
|
* Variable name as used inside the `{...}` marker. Must match /^[a-zA-Z][a-zA-Z0-9_]*$/.
|
|
35
|
-
* Built-in names ({@link
|
|
35
|
+
* Built-in names ({@link PublisherBuiltInVariableV1}) are reserved.
|
|
36
36
|
*/
|
|
37
37
|
name: string;
|
|
38
38
|
/**
|
|
@@ -51,13 +51,13 @@ export interface IPublisherVariableDefinition {
|
|
|
51
51
|
*
|
|
52
52
|
* @alpha
|
|
53
53
|
*/
|
|
54
|
-
export declare function
|
|
54
|
+
export declare function publisherTextPlaceholderV1(name: string): string;
|
|
55
55
|
/**
|
|
56
56
|
* Collects the distinct `{variable}` names referenced in the text, in order of first occurrence.
|
|
57
57
|
*
|
|
58
58
|
* @alpha
|
|
59
59
|
*/
|
|
60
|
-
export declare function
|
|
60
|
+
export declare function getPublisherTextPlaceholdersV1(text: string): string[];
|
|
61
61
|
/**
|
|
62
62
|
* Replaces `{variable}` markers with values. Markers with no value are left as-is.
|
|
63
63
|
* Values are inserted verbatim — there is no recursive expansion.
|
|
@@ -68,5 +68,5 @@ export declare function getPublisherTextPlaceholders(text: string): string[];
|
|
|
68
68
|
*
|
|
69
69
|
* @alpha
|
|
70
70
|
*/
|
|
71
|
-
export declare function
|
|
71
|
+
export declare function resolvePublisherTextPlaceholdersV1(text: string, values: Record<string, string>): string;
|
|
72
72
|
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/publisher/v1/variables.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAChC,YAAY,GACZ,mBAAmB,GACnB,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,wBAAwB,GACxB,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,aAAa,GACb,YAAY,GACZ,mBAAmB,GACnB,MAAM,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,0BAA0B,EAgBnE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,WAAW,8BAA8B;IAC3C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAID;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CASrE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAIvG"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @alpha
|
|
6
6
|
*/
|
|
7
|
-
export const
|
|
7
|
+
export const PublisherBuiltInVariablesV1 = [
|
|
8
8
|
"reportName",
|
|
9
9
|
"reportDescription",
|
|
10
10
|
"periodStart",
|
|
@@ -27,7 +27,7 @@ const placeholderRegex = /\{([a-zA-Z][a-zA-Z0-9_]*)\}/g;
|
|
|
27
27
|
*
|
|
28
28
|
* @alpha
|
|
29
29
|
*/
|
|
30
|
-
export function
|
|
30
|
+
export function publisherTextPlaceholderV1(name) {
|
|
31
31
|
return `{${name}}`;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -35,7 +35,7 @@ export function publisherTextPlaceholder(name) {
|
|
|
35
35
|
*
|
|
36
36
|
* @alpha
|
|
37
37
|
*/
|
|
38
|
-
export function
|
|
38
|
+
export function getPublisherTextPlaceholdersV1(text) {
|
|
39
39
|
const names = [];
|
|
40
40
|
for (const match of text.matchAll(placeholderRegex)) {
|
|
41
41
|
const name = match[1];
|
|
@@ -55,6 +55,6 @@ export function getPublisherTextPlaceholders(text) {
|
|
|
55
55
|
*
|
|
56
56
|
* @alpha
|
|
57
57
|
*/
|
|
58
|
-
export function
|
|
58
|
+
export function resolvePublisherTextPlaceholdersV1(text, values) {
|
|
59
59
|
return text.replace(placeholderRegex, (marker, name) => Object.prototype.hasOwnProperty.call(values, name) ? values[name] : marker);
|
|
60
60
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @alpha
|
|
3
|
+
*/
|
|
4
|
+
export interface IPublisherValidationIssueV2 {
|
|
5
|
+
/**
|
|
6
|
+
* Where the problem is, for example `content.sections[1].pages[0].layout.children[2].id`.
|
|
7
|
+
* Empty for the validated value itself.
|
|
8
|
+
*/
|
|
9
|
+
path: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
export type Issues = IPublisherValidationIssueV2[];
|
|
13
|
+
export type Check = (value: unknown, path: string, issues: Issues) => void;
|
|
14
|
+
interface IField {
|
|
15
|
+
check: Check;
|
|
16
|
+
required: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface IOptionalField extends IField {
|
|
19
|
+
required: false;
|
|
20
|
+
}
|
|
21
|
+
interface IRequiredField extends IField {
|
|
22
|
+
required: true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One field per key of `T`, required exactly where `T` requires the key. With `satisfies`, a key added
|
|
26
|
+
* to or removed from `T` without the same change here is a compile error.
|
|
27
|
+
*/
|
|
28
|
+
export type KeyTable<T> = {
|
|
29
|
+
[K in keyof Required<T>]: undefined extends T[K] ? IOptionalField : IRequiredField;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Also rejects keys that `T` lacks. A key spread in from another table skips the excess property check.
|
|
33
|
+
*/
|
|
34
|
+
type ExactKeyTable<T, Table> = Table & Record<Exclude<keyof Table, keyof Required<T>>, never>;
|
|
35
|
+
export declare function optional(check: Check): IOptionalField;
|
|
36
|
+
export declare function required(check: Check): IRequiredField;
|
|
37
|
+
export declare function joinPath(path: string, segment: string | number): string;
|
|
38
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
39
|
+
export declare function describeValue(value: unknown): string;
|
|
40
|
+
export declare function objectOf<T>(): <Table extends KeyTable<T>>(table: ExactKeyTable<T, Table>) => Check;
|
|
41
|
+
export declare function arrayOf(item: Check): Check;
|
|
42
|
+
export declare function satisfying(predicate: (value: unknown) => boolean, expected: string): Check;
|
|
43
|
+
export declare function isFiniteNumber(value: unknown): value is number;
|
|
44
|
+
export declare function isNonEmptyString(value: unknown): value is string;
|
|
45
|
+
export declare function isLength(value: unknown): value is number;
|
|
46
|
+
export declare function oneOf(values: readonly unknown[]): Check;
|
|
47
|
+
export declare function matching(pattern: RegExp, expected: string): Check;
|
|
48
|
+
export declare function numberIn(min: number, max: number): Check;
|
|
49
|
+
export declare const nonEmptyString: Check;
|
|
50
|
+
export declare const trueOrFalse: Check;
|
|
51
|
+
export declare const finiteNumber: Check;
|
|
52
|
+
export declare const px: Check;
|
|
53
|
+
export declare const opacity: Check;
|
|
54
|
+
export declare const positive: Check;
|
|
55
|
+
export declare const objRef: Check;
|
|
56
|
+
export declare const id: Check;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/checks.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,MAAM,GAAG,2BAA2B,EAAE,CAAC;AAEnD,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAE3E,UAAU,MAAM;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,cAAe,SAAQ,MAAM;IACnC,QAAQ,EAAE,KAAK,CAAC;CACnB;AAED,UAAU,cAAe,SAAQ,MAAM;IACnC,QAAQ,EAAE,IAAI,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KACrB,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,cAAc;CACrF,CAAC;AAEF;;GAEG;AACH,KAAK,aAAa,CAAC,CA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E,MAAM,GAAG,KAAK,CAEjE;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAKxD;AAED,eAAO,MAAM,cAAc,OAAqD,CAAC;AACjF,eAAO,MAAM,WAAW,OAAqE,CAAC;AAC9F,eAAO,MAAM,YAAY,OAAgD,CAAC;AAC1E,eAAO,MAAM,EAAE,OAAgD,CAAC;AAChE,eAAO,MAAM,OAAO,OAAiB,CAAC;AACtC,eAAO,MAAM,QAAQ,OAAuF,CAAC;AAC7G,eAAO,MAAM,MAAM,OAA8C,CAAC;AAClE,eAAO,MAAM,EAAE,OAA4E,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isObjRef } from "../../objRef/index.js";
|
|
3
|
+
export function optional(check) {
|
|
4
|
+
return { check, required: false };
|
|
5
|
+
}
|
|
6
|
+
export function required(check) {
|
|
7
|
+
return { check, required: true };
|
|
8
|
+
}
|
|
9
|
+
export function joinPath(path, segment) {
|
|
10
|
+
if (typeof segment === "number") {
|
|
11
|
+
return `${path}[${segment}]`;
|
|
12
|
+
}
|
|
13
|
+
return path === "" ? segment : `${path}.${segment}`;
|
|
14
|
+
}
|
|
15
|
+
export function isPlainObject(value) {
|
|
16
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
|
+
}
|
|
18
|
+
const maxDescriptionLength = 80;
|
|
19
|
+
export function describeValue(value) {
|
|
20
|
+
const description = value === null ? "null" : Array.isArray(value) ? "an array" : (JSON.stringify(value) ?? typeof value);
|
|
21
|
+
return description.length > maxDescriptionLength
|
|
22
|
+
? `${description.slice(0, maxDescriptionLength - 1)}…`
|
|
23
|
+
: description;
|
|
24
|
+
}
|
|
25
|
+
export function objectOf() {
|
|
26
|
+
return (table) => {
|
|
27
|
+
const fields = table;
|
|
28
|
+
return (value, path, issues) => {
|
|
29
|
+
if (!isPlainObject(value)) {
|
|
30
|
+
issues.push({ path, message: `Expected an object, got ${describeValue(value)}.` });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
for (const [key, fieldValue] of Object.entries(value)) {
|
|
34
|
+
const keyPath = joinPath(path, key);
|
|
35
|
+
const field = Object.hasOwn(fields, key) ? fields[key] : undefined;
|
|
36
|
+
if (field === undefined) {
|
|
37
|
+
issues.push({ path: keyPath, message: `Unknown key "${key}".` });
|
|
38
|
+
}
|
|
39
|
+
else if (fieldValue === null || fieldValue === "") {
|
|
40
|
+
issues.push({
|
|
41
|
+
path: keyPath,
|
|
42
|
+
message: field.required
|
|
43
|
+
? `Expected a value, got ${describeValue(fieldValue)}.`
|
|
44
|
+
: "Leave the key out instead of an empty value.",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else if (fieldValue !== undefined) {
|
|
48
|
+
field.check(fieldValue, keyPath, issues);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
52
|
+
if (field.required && value[key] === undefined) {
|
|
53
|
+
issues.push({ path: joinPath(path, key), message: `Missing required key "${key}".` });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function arrayOf(item) {
|
|
60
|
+
return (value, path, issues) => {
|
|
61
|
+
if (!Array.isArray(value)) {
|
|
62
|
+
issues.push({ path, message: `Expected an array, got ${describeValue(value)}.` });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
value.forEach((element, i) => item(element, joinPath(path, i), issues));
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function satisfying(predicate, expected) {
|
|
69
|
+
return (value, path, issues) => {
|
|
70
|
+
if (!predicate(value)) {
|
|
71
|
+
issues.push({ path, message: `Expected ${expected}, got ${describeValue(value)}.` });
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export function isFiniteNumber(value) {
|
|
76
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
77
|
+
}
|
|
78
|
+
export function isNonEmptyString(value) {
|
|
79
|
+
return typeof value === "string" && value !== "";
|
|
80
|
+
}
|
|
81
|
+
export function isLength(value) {
|
|
82
|
+
return isFiniteNumber(value) && value >= 0;
|
|
83
|
+
}
|
|
84
|
+
export function oneOf(values) {
|
|
85
|
+
return satisfying((value) => values.includes(value), values.map((v) => JSON.stringify(v)).join(", "));
|
|
86
|
+
}
|
|
87
|
+
export function matching(pattern, expected) {
|
|
88
|
+
return satisfying((value) => isNonEmptyString(value) && pattern.test(value), expected);
|
|
89
|
+
}
|
|
90
|
+
export function numberIn(min, max) {
|
|
91
|
+
return satisfying((value) => isFiniteNumber(value) && value >= min && value <= max, `a number from ${min} to ${max}`);
|
|
92
|
+
}
|
|
93
|
+
export const nonEmptyString = satisfying(isNonEmptyString, "a non-empty string");
|
|
94
|
+
export const trueOrFalse = satisfying((value) => typeof value === "boolean", "true or false");
|
|
95
|
+
export const finiteNumber = satisfying(isFiniteNumber, "a finite number");
|
|
96
|
+
export const px = satisfying(isLength, "a length of 0 or more");
|
|
97
|
+
export const opacity = numberIn(0, 1);
|
|
98
|
+
export const positive = satisfying((value) => isFiniteNumber(value) && value > 0, "a number greater than 0");
|
|
99
|
+
export const objRef = satisfying(isObjRef, "an object reference");
|
|
100
|
+
export const id = matching(/^[A-Za-z0-9_.-]{1,64}$/, "an id matching [A-Za-z0-9_.-]{1,64}");
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { type IDashboardAttributeFilterConfig } from "../../dashboard/dashboard.js";
|
|
2
|
+
import { type FilterContextItem } from "../../dashboard/filterContext.js";
|
|
3
|
+
import { type DateFilterGranularity } from "../../dateFilterConfig/index.js";
|
|
4
|
+
import { type IPublisherDocumentPageV2, type PublisherPageSizeV2 } from "./page.js";
|
|
5
|
+
import { type IPublisherBackgroundStyleV2, type PublisherGapValueV2 } from "./style.js";
|
|
6
|
+
import { type IPublisherTakeawayGenerationV2 } from "./widget.js";
|
|
7
|
+
/**
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export type PublisherContentVersionV2 = "2";
|
|
11
|
+
/**
|
|
12
|
+
* Both ends are inclusive.
|
|
13
|
+
*
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export interface IPublisherAbsolutePeriodV2 {
|
|
17
|
+
type: "absolute";
|
|
18
|
+
granularity: "GDC.time.date";
|
|
19
|
+
/**
|
|
20
|
+
* `YYYY-MM-DD`.
|
|
21
|
+
*/
|
|
22
|
+
from: string;
|
|
23
|
+
/**
|
|
24
|
+
* `YYYY-MM-DD`.
|
|
25
|
+
*/
|
|
26
|
+
to: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Both ends are inclusive.
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export interface IPublisherRelativePeriodV2 {
|
|
34
|
+
type: "relative";
|
|
35
|
+
granularity: DateFilterGranularity;
|
|
36
|
+
/**
|
|
37
|
+
* Offset in `granularity` units from the current one, for example `-1`.
|
|
38
|
+
*/
|
|
39
|
+
from: number;
|
|
40
|
+
to: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Reported period, in the dashboard date filter grammar without a dataset.
|
|
44
|
+
*
|
|
45
|
+
* @alpha
|
|
46
|
+
*/
|
|
47
|
+
export type PublisherPeriodV2 = IPublisherAbsolutePeriodV2 | IPublisherRelativePeriodV2;
|
|
48
|
+
/**
|
|
49
|
+
* @alpha
|
|
50
|
+
*/
|
|
51
|
+
export declare function isPublisherAbsolutePeriodV2(obj: unknown): obj is IPublisherAbsolutePeriodV2;
|
|
52
|
+
/**
|
|
53
|
+
* @alpha
|
|
54
|
+
*/
|
|
55
|
+
export declare function isPublisherRelativePeriodV2(obj: unknown): obj is IPublisherRelativePeriodV2;
|
|
56
|
+
/**
|
|
57
|
+
* @alpha
|
|
58
|
+
*/
|
|
59
|
+
export interface IPublisherDocumentDefaultsV2 {
|
|
60
|
+
/**
|
|
61
|
+
* Applies to every page without its own `pageSize`.
|
|
62
|
+
*/
|
|
63
|
+
pageSize?: PublisherPageSizeV2;
|
|
64
|
+
takeaway?: {
|
|
65
|
+
/**
|
|
66
|
+
* Combined with each takeaway widget's own `generation`.
|
|
67
|
+
*/
|
|
68
|
+
generation?: IPublisherTakeawayGenerationV2;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Document templates only. A document stores its period on the entity.
|
|
72
|
+
*/
|
|
73
|
+
period?: PublisherPeriodV2;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Style of the area behind the pages. Exports ignore it.
|
|
77
|
+
*
|
|
78
|
+
* @alpha
|
|
79
|
+
*/
|
|
80
|
+
export interface IPublisherDocumentStyleV2 extends IPublisherBackgroundStyleV2 {
|
|
81
|
+
/**
|
|
82
|
+
* Space between pages in the viewer and the editor.
|
|
83
|
+
*/
|
|
84
|
+
gap?: PublisherGapValueV2;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Named group of pages.
|
|
88
|
+
*
|
|
89
|
+
* @alpha
|
|
90
|
+
*/
|
|
91
|
+
export interface IPublisherSectionV2 {
|
|
92
|
+
/**
|
|
93
|
+
* Unique in the document. Matches `[A-Za-z0-9_.-]{1,64}`.
|
|
94
|
+
*/
|
|
95
|
+
id: string;
|
|
96
|
+
title?: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
pages: IPublisherDocumentPageV2[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Keys shared by both shapes of document content.
|
|
102
|
+
*
|
|
103
|
+
* @alpha
|
|
104
|
+
*/
|
|
105
|
+
export interface IPublisherDocumentContentBaseV2 {
|
|
106
|
+
defaults?: IPublisherDocumentDefaultsV2;
|
|
107
|
+
/**
|
|
108
|
+
* Date filters name their `dataSet`. At most one filter per attribute or date dataset.
|
|
109
|
+
*/
|
|
110
|
+
filters?: FilterContextItem[];
|
|
111
|
+
attributeFilterConfigs?: IDashboardAttributeFilterConfig[];
|
|
112
|
+
style?: IPublisherDocumentStyleV2;
|
|
113
|
+
/**
|
|
114
|
+
* Overrides the workspace locale for this document, for example `de-DE`.
|
|
115
|
+
*/
|
|
116
|
+
locale?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Overrides the workspace format locale used for dates, for example `de-DE`.
|
|
119
|
+
*/
|
|
120
|
+
formatLocale?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Document content stored as a flat list of pages.
|
|
124
|
+
*
|
|
125
|
+
* @alpha
|
|
126
|
+
*/
|
|
127
|
+
export interface IPublisherDocumentPagesContentV2 extends IPublisherDocumentContentBaseV2 {
|
|
128
|
+
pages: IPublisherDocumentPageV2[];
|
|
129
|
+
sections?: never;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Document content stored as sections of pages.
|
|
133
|
+
*
|
|
134
|
+
* @alpha
|
|
135
|
+
*/
|
|
136
|
+
export interface IPublisherDocumentSectionsContentV2 extends IPublisherDocumentContentBaseV2 {
|
|
137
|
+
sections: IPublisherSectionV2[];
|
|
138
|
+
pages?: never;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Content of a document or a document template. It holds `pages` or `sections`, never both.
|
|
142
|
+
*
|
|
143
|
+
* @alpha
|
|
144
|
+
*/
|
|
145
|
+
export type PublisherDocumentContentV2 = IPublisherDocumentPagesContentV2 | IPublisherDocumentSectionsContentV2;
|
|
146
|
+
/**
|
|
147
|
+
* @alpha
|
|
148
|
+
*/
|
|
149
|
+
export declare function isPublisherDocumentPagesContentV2(obj: unknown): obj is IPublisherDocumentPagesContentV2;
|
|
150
|
+
/**
|
|
151
|
+
* @alpha
|
|
152
|
+
*/
|
|
153
|
+
export declare function isPublisherDocumentSectionsContentV2(obj: unknown): obj is IPublisherDocumentSectionsContentV2;
|
|
154
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,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AAI,gCAAgC,CAMvG;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAChD,GAAG,EAAE,OAAO,GACb,GAAG,IAAI,mCAAmC,CAM5C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isEmpty } from "lodash-es";
|
|
3
|
+
/**
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
export function isPublisherAbsolutePeriodV2(obj) {
|
|
7
|
+
return !isEmpty(obj) && obj.type === "absolute";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export function isPublisherRelativePeriodV2(obj) {
|
|
13
|
+
return !isEmpty(obj) && obj.type === "relative";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function isPublisherDocumentPagesContentV2(obj) {
|
|
19
|
+
if (isEmpty(obj)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const { pages, sections } = obj;
|
|
23
|
+
return Array.isArray(pages) && sections === undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export function isPublisherDocumentSectionsContentV2(obj) {
|
|
29
|
+
if (isEmpty(obj)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const { sections, pages } = obj;
|
|
33
|
+
return Array.isArray(sections) && pages === undefined;
|
|
34
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type IAuditableDates, type IAuditableUsers } from "../../base/metadata.js";
|
|
2
|
+
import { type ObjRef } from "../../objRef/index.js";
|
|
3
|
+
import { type PublisherContentVersionV2, type PublisherDocumentContentV2, type PublisherPeriodV2 } from "./content.js";
|
|
4
|
+
import { type IPublisherPageBodyV2 } from "./page.js";
|
|
5
|
+
/**
|
|
6
|
+
* Fields shared by the definitions of all Publisher entities.
|
|
7
|
+
*
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export interface IPublisherEntityDefinitionBaseV2 {
|
|
11
|
+
/**
|
|
12
|
+
* Present when updating an existing entity.
|
|
13
|
+
*/
|
|
14
|
+
ref?: ObjRef;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
tags?: string[];
|
|
18
|
+
version: PublisherContentVersionV2;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Fields shared by all persisted Publisher entities.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export interface IPublisherEntityMetadataV2 extends IAuditableDates, IAuditableUsers {
|
|
26
|
+
ref: ObjRef;
|
|
27
|
+
/**
|
|
28
|
+
* When true, the object comes from a parent workspace and is not editable
|
|
29
|
+
* in the current workspace.
|
|
30
|
+
*/
|
|
31
|
+
isLocked?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Payload for creating or updating a document.
|
|
35
|
+
*
|
|
36
|
+
* @alpha
|
|
37
|
+
*/
|
|
38
|
+
export interface IPublisherDocumentDefinitionV2 extends IPublisherEntityDefinitionBaseV2 {
|
|
39
|
+
type: "document";
|
|
40
|
+
period: PublisherPeriodV2;
|
|
41
|
+
/**
|
|
42
|
+
* A document created from a template gets a deep copy of its content and keeps no reference to it.
|
|
43
|
+
*/
|
|
44
|
+
content: PublisherDocumentContentV2;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Document metadata object.
|
|
48
|
+
*
|
|
49
|
+
* @alpha
|
|
50
|
+
*/
|
|
51
|
+
export interface IPublisherDocumentV2 extends IPublisherDocumentDefinitionV2, IPublisherEntityMetadataV2 {
|
|
52
|
+
ref: ObjRef;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Payload for creating or updating a document template.
|
|
56
|
+
*
|
|
57
|
+
* @alpha
|
|
58
|
+
*/
|
|
59
|
+
export interface IPublisherDocumentTemplateDefinitionV2 extends IPublisherEntityDefinitionBaseV2 {
|
|
60
|
+
type: "documentTemplate";
|
|
61
|
+
content: PublisherDocumentContentV2;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Document template metadata object.
|
|
65
|
+
*
|
|
66
|
+
* @alpha
|
|
67
|
+
*/
|
|
68
|
+
export interface IPublisherDocumentTemplateV2 extends IPublisherDocumentTemplateDefinitionV2, IPublisherEntityMetadataV2 {
|
|
69
|
+
ref: ObjRef;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Payload for creating or updating a page template.
|
|
73
|
+
*
|
|
74
|
+
* @alpha
|
|
75
|
+
*/
|
|
76
|
+
export interface IPublisherPageTemplateDefinitionV2 extends IPublisherEntityDefinitionBaseV2 {
|
|
77
|
+
type: "pageTemplate";
|
|
78
|
+
content: IPublisherPageBodyV2;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Page template metadata object.
|
|
82
|
+
*
|
|
83
|
+
* @alpha
|
|
84
|
+
*/
|
|
85
|
+
export interface IPublisherPageTemplateV2 extends IPublisherPageTemplateDefinitionV2, IPublisherEntityMetadataV2 {
|
|
86
|
+
ref: ObjRef;
|
|
87
|
+
/**
|
|
88
|
+
* True for the default page templates the backend serves. Their ids start with `default.`.
|
|
89
|
+
*/
|
|
90
|
+
isDefault?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @alpha
|
|
94
|
+
*/
|
|
95
|
+
export declare function isPublisherDocumentDefinitionV2(obj: unknown): obj is IPublisherDocumentDefinitionV2;
|
|
96
|
+
/**
|
|
97
|
+
* @alpha
|
|
98
|
+
*/
|
|
99
|
+
export declare function isPublisherDocumentV2(obj: unknown): obj is IPublisherDocumentV2;
|
|
100
|
+
/**
|
|
101
|
+
* @alpha
|
|
102
|
+
*/
|
|
103
|
+
export declare function isPublisherDocumentTemplateDefinitionV2(obj: unknown): obj is IPublisherDocumentTemplateDefinitionV2;
|
|
104
|
+
/**
|
|
105
|
+
* @alpha
|
|
106
|
+
*/
|
|
107
|
+
export declare function isPublisherDocumentTemplateV2(obj: unknown): obj is IPublisherDocumentTemplateV2;
|
|
108
|
+
/**
|
|
109
|
+
* @alpha
|
|
110
|
+
*/
|
|
111
|
+
export declare function isPublisherPageTemplateDefinitionV2(obj: unknown): obj is IPublisherPageTemplateDefinitionV2;
|
|
112
|
+
/**
|
|
113
|
+
* @alpha
|
|
114
|
+
*/
|
|
115
|
+
export declare function isPublisherPageTemplateV2(obj: unknown): obj is IPublisherPageTemplateV2;
|
|
116
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/publisher/v2/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC7C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,yBAAyB,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA2B,SAAQ,eAAe,EAAE,eAAe;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAA+B,SAAQ,g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G,EAAE,OAAO,GAAG,GAAG,IAAI,wBAAwB,CAEvF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { isEmpty } from "lodash-es";
|
|
3
|
+
import { isObjRef } from "../../objRef/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* @alpha
|
|
6
|
+
*/
|
|
7
|
+
export function isPublisherDocumentDefinitionV2(obj) {
|
|
8
|
+
return isPublisherEntityDefinitionV2(obj, "document");
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export function isPublisherDocumentV2(obj) {
|
|
14
|
+
return isPublisherDocumentDefinitionV2(obj) && isObjRef(obj.ref);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @alpha
|
|
18
|
+
*/
|
|
19
|
+
export function isPublisherDocumentTemplateDefinitionV2(obj) {
|
|
20
|
+
return isPublisherEntityDefinitionV2(obj, "documentTemplate");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export function isPublisherDocumentTemplateV2(obj) {
|
|
26
|
+
return isPublisherDocumentTemplateDefinitionV2(obj) && isObjRef(obj.ref);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export function isPublisherPageTemplateDefinitionV2(obj) {
|
|
32
|
+
return isPublisherEntityDefinitionV2(obj, "pageTemplate");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export function isPublisherPageTemplateV2(obj) {
|
|
38
|
+
return isPublisherPageTemplateDefinitionV2(obj) && isObjRef(obj.ref);
|
|
39
|
+
}
|
|
40
|
+
const contentVersion = "2";
|
|
41
|
+
function isPublisherEntityDefinitionV2(obj, type) {
|
|
42
|
+
if (isEmpty(obj)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const entity = obj;
|
|
46
|
+
return entity.type === type && entity.version === contentVersion;
|
|
47
|
+
}
|