@gooddata/code-cli 0.59.0-alpha.1 → 0.59.0-alpha.3

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.
Files changed (2) hide show
  1. package/dist/index.js +3066 -1155
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { spawn, spawnSync } from "child_process";
5
5
  import * as path$3 from "path";
6
6
  import { resolve } from "path";
7
7
  import { readFileSync, unlinkSync, writeFileSync } from "fs";
8
- import crypto, { randomFillSync, randomUUID } from "crypto";
8
+ import crypto$1, { randomFillSync, randomUUID } from "crypto";
9
9
  import tty from "node:tty";
10
10
  import process$1 from "node:process";
11
11
  import assert from "node:assert";
@@ -2349,7 +2349,7 @@ var require_main$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2349
2349
  const fs$3 = __require("fs");
2350
2350
  const path$7 = __require("path");
2351
2351
  const os$6 = __require("os");
2352
- const crypto$2 = __require("crypto");
2352
+ const crypto$3 = __require("crypto");
2353
2353
  const version = require_package().version;
2354
2354
  const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
2355
2355
  function parse(src) {
@@ -2507,7 +2507,7 @@ var require_main$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2507
2507
  const authTag = ciphertext.subarray(-16);
2508
2508
  ciphertext = ciphertext.subarray(12, -16);
2509
2509
  try {
2510
- const aesgcm = crypto$2.createDecipheriv("aes-256-gcm", key, nonce);
2510
+ const aesgcm = crypto$3.createDecipheriv("aes-256-gcm", key, nonce);
2511
2511
  aesgcm.setAuthTag(authTag);
2512
2512
  return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
2513
2513
  } catch (error) {
@@ -37370,7 +37370,7 @@ function isPromise(value) {
37370
37370
  //#endregion
37371
37371
  //#region package.json
37372
37372
  var name$1 = "@gooddata/code-cli";
37373
- var version$1 = "0.59.0-alpha.1";
37373
+ var version$1 = "0.59.0-alpha.3";
37374
37374
  //#endregion
37375
37375
  //#region ../../../common/temp/aac/node_modules/.pnpm/vscode-languageserver@8.1.0/node_modules/vscode-languageserver/lib/common/utils/is.js
37376
37376
  var require_is$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -75693,7 +75693,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlain
75693
75693
  * @param {Object} [object] The object to query keys on.
75694
75694
  * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
75695
75695
  */
75696
- function isKey(value, object) {
75696
+ function isKey$1(value, object) {
75697
75697
  if (isArray$2(value)) return false;
75698
75698
  var type = typeof value;
75699
75699
  if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
@@ -76205,7 +76205,7 @@ function toString$1(value) {
76205
76205
  */
76206
76206
  function castPath(value, object) {
76207
76207
  if (isArray$2(value)) return value;
76208
- return isKey(value, object) ? [value] : stringToPath(toString$1(value));
76208
+ return isKey$1(value, object) ? [value] : stringToPath(toString$1(value));
76209
76209
  }
76210
76210
  //#endregion
76211
76211
  //#region ../../../common/temp/aac/node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js
@@ -77040,7 +77040,7 @@ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
77040
77040
  * @returns {Function} Returns the new spec function.
77041
77041
  */
77042
77042
  function baseMatchesProperty(path, srcValue) {
77043
- if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
77043
+ if (isKey$1(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
77044
77044
  return function(object) {
77045
77045
  var objValue = get$1(object, path);
77046
77046
  return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
@@ -77099,7 +77099,7 @@ function basePropertyDeep(path) {
77099
77099
  * // => [1, 2]
77100
77100
  */
77101
77101
  function property(path) {
77102
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
77102
+ return isKey$1(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
77103
77103
  }
77104
77104
  //#endregion
77105
77105
  //#region ../../../common/temp/aac/node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js
@@ -103511,6 +103511,9 @@ var SpecificCoreErrorCode;
103511
103511
  SpecificCoreErrorCode["UniquenessReportsId"] = "core.uniqueness.reports.id";
103512
103512
  SpecificCoreErrorCode["UniquenessReportTemplatesId"] = "core.uniqueness.reportTemplates.id";
103513
103513
  SpecificCoreErrorCode["UniquenessReportPageLayoutsId"] = "core.uniqueness.reportPageLayouts.id";
103514
+ SpecificCoreErrorCode["UniquenessDocumentsId"] = "core.uniqueness.documents.id";
103515
+ SpecificCoreErrorCode["UniquenessDocumentTemplatesId"] = "core.uniqueness.documentTemplates.id";
103516
+ SpecificCoreErrorCode["UniquenessPageTemplatesId"] = "core.uniqueness.pageTemplates.id";
103514
103517
  SpecificCoreErrorCode["UniquenessDashboardWidgetLocalId"] = "core.uniqueness.dashboard.widget.localId";
103515
103518
  SpecificCoreErrorCode["ReferenceTableId"] = "core.reference.table.id";
103516
103519
  SpecificCoreErrorCode["ReferenceDatasetId"] = "core.reference.dataset.id";
@@ -103674,6 +103677,9 @@ const CoreErrorMessages$1 = {
103674
103677
  [SpecificCoreErrorCode.UniquenessReportsId]: `There are more documents with id "{0}". Use unique names for documents.`,
103675
103678
  [SpecificCoreErrorCode.UniquenessReportTemplatesId]: `There are more document templates with id "{0}". Use unique names for document templates.`,
103676
103679
  [SpecificCoreErrorCode.UniquenessReportPageLayoutsId]: `There are more page layouts with id "{0}". Use unique names for page layouts.`,
103680
+ [SpecificCoreErrorCode.UniquenessDocumentsId]: `There are more documents with id "{0}". Use unique names for documents.`,
103681
+ [SpecificCoreErrorCode.UniquenessDocumentTemplatesId]: `There are more document templates with id "{0}". Use unique names for document templates.`,
103682
+ [SpecificCoreErrorCode.UniquenessPageTemplatesId]: `There are more page templates with id "{0}". Use unique names for page templates.`,
103677
103683
  [SpecificCoreErrorCode.UniquenessDashboardWidgetLocalId]: `There are more widgets with same id "{0}". Use unique names for widgets on same dashboard.`,
103678
103684
  [SpecificCoreErrorCode.UniquenessDatasetField]: `There are more dataset fields with id "{0}". Use unique names for fields across datasets.`,
103679
103685
  [SpecificCoreErrorCode.ReferenceTableId]: `Table "{0}" not found in datasource. Possible tables for use are "{1}".`,
@@ -103764,6 +103770,9 @@ const CoreErrorTypes$1 = {
103764
103770
  [SpecificCoreErrorCode.UniquenessReportsId]: "UniquenessReportsId",
103765
103771
  [SpecificCoreErrorCode.UniquenessReportTemplatesId]: "UniquenessReportTemplatesId",
103766
103772
  [SpecificCoreErrorCode.UniquenessReportPageLayoutsId]: "UniquenessReportPageLayoutsId",
103773
+ [SpecificCoreErrorCode.UniquenessDocumentsId]: "UniquenessDocumentsId",
103774
+ [SpecificCoreErrorCode.UniquenessDocumentTemplatesId]: "UniquenessDocumentTemplatesId",
103775
+ [SpecificCoreErrorCode.UniquenessPageTemplatesId]: "UniquenessPageTemplatesId",
103767
103776
  [SpecificCoreErrorCode.UniquenessDatasetField]: "UniquenessDatasetField",
103768
103777
  [SpecificCoreErrorCode.ReferenceTableId]: "ReferenceTableId",
103769
103778
  [SpecificCoreErrorCode.ReferenceDatasetId]: "ReferenceDatasetId",
@@ -107365,6 +107374,9 @@ const AttributeHierarchyTypes$1 = ["attribute_hierarchy"];
107365
107374
  const ReportTypes = ["report"];
107366
107375
  const ReportTemplateTypes = ["report_template"];
107367
107376
  const ReportPageLayoutTypes = ["report_page_layout"];
107377
+ const DocumentTypes = ["document"];
107378
+ const DocumentTemplateTypes = ["document_template"];
107379
+ const PageTemplateTypes = ["page_template"];
107368
107380
  const VisualisationType = ["visualisation"];
107369
107381
  function allReferenceTypes(a) {
107370
107382
  return a;
@@ -107403,7 +107415,10 @@ const TypesAll = allReferenceTypes([
107403
107415
  "attribute_hierarchy",
107404
107416
  "report",
107405
107417
  "report_template",
107406
- "report_page_layout"
107418
+ "report_page_layout",
107419
+ "document",
107420
+ "document_template",
107421
+ "page_template"
107407
107422
  ]);
107408
107423
  function isDataset$1(obj) {
107409
107424
  if (typeof obj === "object" && obj && "id" in obj && "type" in obj) return DatasetTypes$2.includes(obj.type);
@@ -107560,6 +107575,18 @@ function isReportPageLayout(obj) {
107560
107575
  if (typeof obj === "object" && obj && "id" in obj && "type" in obj) return ReportPageLayoutTypes.includes(obj.type);
107561
107576
  return false;
107562
107577
  }
107578
+ function isDocument(obj) {
107579
+ if (typeof obj === "object" && obj && "id" in obj && "type" in obj) return DocumentTypes.includes(obj.type);
107580
+ return false;
107581
+ }
107582
+ function isDocumentTemplate(obj) {
107583
+ if (typeof obj === "object" && obj && "id" in obj && "type" in obj) return DocumentTemplateTypes.includes(obj.type);
107584
+ return false;
107585
+ }
107586
+ function isPageTemplate(obj) {
107587
+ if (typeof obj === "object" && obj && "id" in obj && "type" in obj) return PageTemplateTypes.includes(obj.type);
107588
+ return false;
107589
+ }
107563
107590
  function isDashboard(obj) {
107564
107591
  if (typeof obj === "object" && obj && "id" in obj && "type" in obj) return DashboardTypes$1.includes(obj.type);
107565
107592
  return false;
@@ -109624,7 +109651,7 @@ var nodeIsMap = nodeUtil && nodeUtil.isMap;
109624
109651
  * _.isMap(new WeakMap);
109625
109652
  * // => false
109626
109653
  */
109627
- var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
109654
+ var isMap$1 = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
109628
109655
  //#endregion
109629
109656
  //#region ../../../common/temp/sdk/node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js
109630
109657
  /** `Object#toString` result references. */
@@ -109714,7 +109741,7 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
109714
109741
  if (isSet$1(value)) value.forEach(function(subValue) {
109715
109742
  result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
109716
109743
  });
109717
- else if (isMap(value)) value.forEach(function(subValue, key) {
109744
+ else if (isMap$1(value)) value.forEach(function(subValue, key) {
109718
109745
  result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
109719
109746
  });
109720
109747
  var props = isArr ? void 0 : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
@@ -112479,463 +112506,43 @@ function isValidDashboardTimezoneId$1(timezoneId) {
112479
112506
  return isBrowserDetectedTimezone$1(timezoneId) || isValidIanaTimezoneId$1(timezoneId);
112480
112507
  }
112481
112508
  //#endregion
112482
- //#region ../../../sdk/libs/sdk-code-convertors/src/utils/sharedUtils.ts
112483
- /** @public */
112484
- function assertUnreachable(x) {
112485
- throw new Error(`Didn't expect to get here. Invalid value is "${JSON.stringify(x, null, 2)}".`);
112486
- }
112487
- function parsePath(path) {
112488
- if (Array.isArray(path)) return path;
112489
- if (path === "") return [];
112490
- return path.split("/");
112491
- }
112492
- function getTableRootId$1(profile, item) {
112493
- return `${item?.data_source ?? profile?.data_source ?? "default"}`;
112494
- }
112495
- /**
112496
- * Convert IDs into a human-readable strings to be used as titles
112497
- * E.g. "someId" or "some-id" or "some_id" or "some.id" will become "Some Id".
112498
- */
112499
- function convertIdToTitle$1(id = "") {
112500
- return (id || "").replace(/([A-Z])/g, " $1").replace(/([_.-])+/g, " ").split(" ").map((w) => w.charAt(0).toLocaleUpperCase() + w.slice(1)).join(" ");
112501
- }
112502
- /**
112503
- * Convert title into an id
112504
- */
112505
- function convertTitleToId(title = "") {
112506
- return (title || "").normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\W/g, "_").toLowerCase();
112507
- }
112508
- const UUID4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
112509
- function convertIdOrTitleToId(id, title) {
112510
- if (id.match(UUID4_REGEX) && title) return convertTitleToId(title);
112511
- return id;
112512
- }
112513
- function getFullField$1(field) {
112514
- if (typeof field === "string") return { using: field };
112515
- return field;
112516
- }
112517
- function getFullBucket(bucket) {
112518
- if (typeof bucket === "string") return { field: bucket };
112519
- return bucket;
112520
- }
112521
- function collectFieldLevelFilters(visualisation) {
112522
- const fields = visualisation?.query?.fields;
112523
- if (!fields) return;
112524
- const result = {};
112525
- for (const field of Object.values(fields)) if (typeof field === "object" && field !== null && "filter_by" in field && field.filter_by) Object.assign(result, field.filter_by);
112526
- return Object.keys(result).length > 0 ? result : void 0;
112527
- }
112528
- //#endregion
112529
- //#region ../../../sdk/libs/sdk-code-convertors/src/utils/errors.ts
112509
+ //#region ../../../sdk/libs/sdk-model/esm/publisher/v2/factory.js
112530
112510
  /**
112531
- * @public
112532
- */
112533
- const CoreErrorMessages = {
112534
- ["core.bucketItemTypeNotSupported"]: "Report item type is not supported. Item: {0}",
112535
- ["core.filterItemTypeNotSupported"]: "Filter item type is not supported. Item: {0}",
112536
- ["core.referenceTypeNotSupported"]: "Reference type is not supported. Item: {0}",
112537
- ["core.itemNotSupported"]: "Item is not supported. Item: {0}",
112538
- ["core.visualizationNotSupported"]: "Visualisation is not supported. Url: {0}",
112539
- ["core.layerTypeNotSupported"]: "Layer type is not supported. Type: {0}",
112540
- ["core.multipleDateDataSets"]: "Multiple date datasets are not supported. Item: {0}",
112541
- ["core.onlyOneDateDatasetAllowed"]: `Dashboard filters contains more filters with same date dataset "{0}".`,
112542
- ["core.onlyOneAttributeItemAllowed"]: `Dashboard filters contains more filters with same attribute or label "{0}".`,
112543
- ["core.multipleCommonDateFilters"]: `Multiple usage of common date filters in dashboard. Define exactly one date filter that has no date dataset defined.`,
112544
- ["core.duplicateFilterLocalIdentifier"]: `Duplicate filter local identifier "{0}". Each filter must have a unique local identifier across a dashboard tab, including filters in groups.`,
112545
- ["core.duplicateFieldName"]: `Duplicate field name "{0}". Each field a query declares must have a unique name.`,
112546
- ["core.duplicateFilterName"]: `Duplicate filter name "{0}". Each filter in a query must have a unique name, including the filters a date filter carries.`,
112547
- ["core.duplicateLayerIdentifier"]: `Duplicate layer id "{0}". Each layer of a visualisation must have a unique id.`,
112548
- ["core.duplicateTabIdentifier"]: `Duplicate tab identifier "{0}". Each tab must have a unique identifier within the dashboard.`,
112549
- ["core.tabsAndRootContentMutuallyExclusive"]: `Dashboard "{0}" defines both "tabs" and root-level "sections" or "filters". These are mutually exclusive — keep all content inside tabs or at the root, not both.`,
112550
- ["core.invalidIanaTimezoneId"]: `"{0}" is not a valid IANA timezone ID. Use a real timezone such as Europe/Prague or $browserDetected.`
112551
- };
112552
- /**
112553
- * @public
112554
- */
112555
- const CoreErrorTypes = {
112556
- ["core.bucketItemTypeNotSupported"]: "BucketItemTypeNotSupported",
112557
- ["core.filterItemTypeNotSupported"]: "FilterItemTypeNotSupported",
112558
- ["core.referenceTypeNotSupported"]: "ReferenceTypeNotSupported",
112559
- ["core.itemNotSupported"]: "ItemNotSupported",
112560
- ["core.visualizationNotSupported"]: "VisualizationNotSupported",
112561
- ["core.layerTypeNotSupported"]: "LayerTypeNotSupported",
112562
- ["core.multipleDateDataSets"]: "MultipleDateDataSets",
112563
- ["core.onlyOneDateDatasetAllowed"]: "OnlyOneDateDatasetAllowed",
112564
- ["core.onlyOneAttributeItemAllowed"]: "OnlyOneAttributeItemAllowed",
112565
- ["core.multipleCommonDateFilters"]: "MultipleCommonDateFilters",
112566
- ["core.duplicateFilterLocalIdentifier"]: "DuplicateFilterLocalIdentifier",
112567
- ["core.duplicateFieldName"]: "DuplicateFieldName",
112568
- ["core.duplicateFilterName"]: "DuplicateFilterName",
112569
- ["core.duplicateLayerIdentifier"]: "DuplicateLayerIdentifier",
112570
- ["core.duplicateTabIdentifier"]: "DuplicateTabIdentifier",
112571
- ["core.tabsAndRootContentMutuallyExclusive"]: "TabsAndRootContentMutuallyExclusive",
112572
- ["core.invalidIanaTimezoneId"]: "InvalidIanaTimezoneId"
112573
- };
112574
- /**
112575
- * Update error context with new values
112511
+ * Generates an id such as `widget_7f3a91c4`.
112512
+ *
112513
+ * @remarks
112514
+ * For a valid id, the prefix uses only `[A-Za-z0-9_.-]`, has at most 55 characters and does not
112515
+ * start with `default.`.
112516
+ *
112517
+ * @alpha
112576
112518
  */
112577
- function updateErrorContext(context, props) {
112578
- if (context) return {
112579
- ...context,
112580
- ...props,
112581
- path: [...context.path ?? [], ...props.path ?? []]
112582
- };
112583
- return {
112584
- type: props.type ?? "unknown",
112585
- path: props.path ?? [],
112586
- data: props.data ?? {}
112587
- };
112588
- }
112589
- function newError(code, params = [], context) {
112590
- const err = new Error(buildMessage(CoreErrorMessages[code], params, context));
112591
- err.type = CoreErrorTypes[code];
112592
- err.code = code;
112593
- err.context = context;
112594
- return err;
112595
- }
112596
- function buildMessage(message, params, context) {
112597
- const m = params.reduce((msg, param, index) => msg.replace(new RegExp(`\\{${index}}`, "gi"), param), message);
112598
- if (context?.path) return `${m} in: ${context.path.join("/")}`;
112599
- return m;
112600
- }
112601
- //#endregion
112602
- //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js
112603
- const byteToHex = [];
112604
- for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
112605
- function unsafeStringify(arr, offset = 0) {
112606
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
112607
- }
112608
- //#endregion
112609
- //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js
112610
- const rnds8Pool = new Uint8Array(256);
112611
- let poolPtr = rnds8Pool.length;
112612
- function rng() {
112613
- if (poolPtr > rnds8Pool.length - 16) {
112614
- randomFillSync(rnds8Pool);
112615
- poolPtr = 0;
112616
- }
112617
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
112618
- }
112619
- //#endregion
112620
- //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js
112621
- var native_default = { randomUUID };
112622
- //#endregion
112623
- //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js
112624
- function v4(options, buf, offset) {
112625
- if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
112626
- options = options || {};
112627
- const rnds = options.random ?? options.rng?.() ?? rng();
112628
- if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
112629
- rnds[6] = rnds[6] & 15 | 64;
112630
- rnds[8] = rnds[8] & 63 | 128;
112631
- if (buf) {
112632
- offset = offset || 0;
112633
- if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
112634
- for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
112635
- return buf;
112636
- }
112637
- return unsafeStringify(rnds);
112519
+ function newPublisherIdV2(prefix) {
112520
+ const bytes = crypto.getRandomValues(new Uint8Array(4));
112521
+ return `${prefix}_${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
112638
112522
  }
112639
- //#endregion
112640
- //#region ../../../sdk/libs/sdk-code-convertors/src/conts.ts
112641
- /** @internal */
112642
- const DatasetTypes$1 = ["dataset"];
112643
- /** @internal */
112644
- const DateDatasetTypes$1 = ["date"];
112645
- /** @internal */
112646
- const MetricTypes = ["metric"];
112647
- /** @internal */
112648
- const ParameterTypes = ["parameter"];
112649
- /** @internal */
112650
- const ComputedAttributeTypes = ["computed_attribute"];
112651
- /** @internal */
112652
- const DashboardTypes = ["dashboard"];
112653
- /** @internal */
112654
- const PluginTypes = ["plugin"];
112655
- /** @internal */
112656
- const AttributeHierarchyTypes = ["attribute_hierarchy"];
112657
- /** @internal */
112658
- const VisualisationsTypes = [
112659
- "table",
112660
- "bar_chart",
112661
- "column_chart",
112662
- "line_chart",
112663
- "area_chart",
112664
- "scatter_chart",
112665
- "bubble_chart",
112666
- "pie_chart",
112667
- "donut_chart",
112668
- "treemap_chart",
112669
- "pyramid_chart",
112670
- "funnel_chart",
112671
- "heatmap_chart",
112672
- "bullet_chart",
112673
- "waterfall_chart",
112674
- "dependency_wheel_chart",
112675
- "sankey_chart",
112676
- "headline_chart",
112677
- "combo_chart",
112678
- "geo_chart",
112679
- "geo_area_chart",
112680
- "repeater_chart",
112681
- "radar_chart"
112682
- ];
112683
- /** @internal */
112684
- const AllTypes = [
112685
- ...DatasetTypes$1,
112686
- ...DateDatasetTypes$1,
112687
- ...MetricTypes,
112688
- ...ParameterTypes,
112689
- ...ComputedAttributeTypes,
112690
- ...DashboardTypes,
112691
- ...PluginTypes,
112692
- ...VisualisationsTypes,
112693
- ...AttributeHierarchyTypes
112694
- ];
112695
- //#endregion
112696
- //#region ../../../sdk/libs/sdk-code-convertors/src/utils/typeGuards.ts
112697
- const SupportedReferenceTypes = [
112698
- "fact",
112699
- "label",
112700
- "computed_attribute",
112701
- "metric",
112702
- "dataset",
112703
- "attribute"
112704
- ];
112705
112523
  /**
112706
- * Reference prefixes that stand for an attribute-like object a query field, an attribute filter
112707
- * or a drill can use. A computed attribute behaves as a label with computed values.
112524
+ * Generates a page id such as `page_7f3a91c4`.
112525
+ *
112526
+ * @alpha
112708
112527
  */
112709
- const AttributeLikeReferenceTypes = [
112710
- "attribute",
112711
- "label",
112712
- "computed_attribute"
112713
- ];
112714
- function parseReferenceObject(obj) {
112715
- const [t, identifier] = obj?.split("/") ?? [];
112716
- const type = t;
112717
- if (Boolean(type && identifier) && SupportedReferenceTypes.includes(type)) return {
112718
- identifier,
112719
- type
112720
- };
112721
- return null;
112722
- }
112723
- const AttrTypes = ["attribute"];
112724
- function isAttribute$1(obj) {
112725
- if (typeof obj === "object" && obj && "type" in obj) return AttrTypes.includes(obj.type);
112726
- return false;
112727
- }
112728
- function isAttributeField(obj) {
112729
- if (typeof obj === "object" && obj && "using" in obj && typeof obj.using === "string" && !("aggregation" in obj)) {
112730
- const id = parseReferenceObject(obj.using);
112731
- return Boolean(id && [...AttributeLikeReferenceTypes, "fact"].includes(id.type));
112732
- }
112733
- return false;
112528
+ function newPublisherPageIdV2() {
112529
+ return newPublisherIdV2("page");
112734
112530
  }
112735
112531
  /**
112736
- * Whether the reference names a computed attribute (`computed_attribute/{id}`).
112532
+ * Generates a section id such as `section_7f3a91c4`.
112533
+ *
112534
+ * @alpha
112737
112535
  */
112738
- function isComputedAttributeReference(reference) {
112739
- return parseReferenceObject(reference)?.type === "computed_attribute";
112740
- }
112741
- function isInlineMetricField(obj) {
112742
- return typeof obj === "object" && obj !== null && "maql" in obj && typeof obj.maql === "string";
112743
- }
112744
- function isMetricField(obj) {
112745
- if (typeof obj === "object" && obj && "using" in obj && typeof obj.using === "string") {
112746
- const id = parseReferenceObject(obj.using);
112747
- return Boolean(id && ["metric"].includes(id.type));
112748
- }
112749
- return false;
112750
- }
112751
- function isCalculatedMetricField(obj) {
112752
- if (typeof obj === "object" && obj && "using" in obj && typeof obj.using === "string" && "aggregation" in obj && obj.aggregation) {
112753
- const id = parseReferenceObject(obj.using);
112754
- return Boolean(id && [
112755
- "attribute",
112756
- "label",
112757
- "fact"
112758
- ].includes(id.type));
112759
- }
112760
- return false;
112761
- }
112762
- function isArithmeticMetricField(obj) {
112763
- if (typeof obj === "object" && obj && "using" in obj && "operator" in obj && obj.operator) return Array.isArray(obj.using);
112764
- return false;
112765
- }
112766
- function isPoPMetricField(obj) {
112767
- return typeof obj === "object" && obj !== null && "using" in obj && "date_filter" in obj && "type" in obj && obj.type === "PREVIOUS_YEAR";
112768
- }
112769
- function isPreviousPeriodField(obj) {
112770
- return typeof obj === "object" && obj !== null && "using" in obj && "date_filter" in obj && "type" in obj && obj.type === "PREVIOUS_PERIOD";
112771
- }
112772
- function isDateFilter(obj) {
112773
- return typeof obj === "object" && obj !== null && "using" in obj && "type" in obj && obj.type === "date_filter";
112774
- }
112775
- function isAbsoluteDateFilter(obj) {
112776
- return isDateFilter(obj) && typeof obj.from === "string" && typeof obj.to === "string" && !obj.granularity;
112777
- }
112778
- function isRelativeDateFilter(obj) {
112779
- if (isDateFilter(obj) && typeof obj.from === "number" && typeof obj.to === "number" && obj.granularity) return true;
112780
- return isAllTimeDateFilter(obj);
112781
- }
112782
- function isAllTimeDateFilter(obj) {
112783
- return isDateFilter(obj) && typeof obj.from === "undefined" && typeof obj.to === "undefined";
112784
- }
112785
- function isAttributeFilter(obj) {
112786
- if (typeof obj === "object" && obj && "using" in obj && "type" in obj && obj.type === "attribute_filter") {
112787
- const id = parseReferenceObject(obj.using);
112788
- return Boolean(id && AttributeLikeReferenceTypes.includes(id.type));
112789
- }
112790
- return false;
112791
- }
112792
- function isTextFilter(obj) {
112793
- return typeof obj === "object" && obj !== null && "using" in obj && "type" in obj && obj.type === "text_filter";
112794
- }
112795
- const arbitraryTextFilterConditions = new Set(["is", "isNot"]);
112796
- const matchTextFilterConditions = new Set([
112797
- "contains",
112798
- "doesNotContain",
112799
- "startsWith",
112800
- "doesNotStartWith",
112801
- "endsWith",
112802
- "doesNotEndWith"
112803
- ]);
112804
- function isArbitraryTextFilter(obj) {
112805
- return isTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && arbitraryTextFilterConditions.has(obj["condition"]);
112806
- }
112807
- function isMatchTextFilter(obj) {
112808
- return isTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && matchTextFilterConditions.has(obj["condition"]);
112809
- }
112810
- function isPositiveAttributeFilter(obj) {
112811
- if (isAttributeFilter(obj)) return Boolean(obj.state?.include);
112812
- return false;
112813
- }
112814
- function isNegativeAttributeFilter(obj) {
112815
- return Boolean(typeof obj === "object" && obj && "type" in obj && obj.type === "attribute_filter" && !isPositiveAttributeFilter(obj));
112816
- }
112817
- function isMetricValueFilter(obj) {
112818
- if (typeof obj === "object" && obj && "using" in obj && "type" in obj && obj.type === "metric_value_filter") {
112819
- const id = parseReferenceObject(obj.using);
112820
- if (id) return ["metric"].includes(id.type);
112821
- return true;
112822
- }
112823
- return false;
112824
- }
112825
- function isMetricValueFilterWithConditions(obj) {
112826
- return isMetricValueFilter(obj) && Array.isArray(obj.conditions);
112827
- }
112828
- function isMetricRangeValueFilter(obj) {
112829
- if (isMetricValueFilterWithConditions(obj)) return false;
112830
- if (isMetricValueFilter(obj)) {
112831
- const condition = obj.condition;
112832
- return typeof condition === "string" && ["BETWEEN", "NOT_BETWEEN"].includes(condition);
112833
- }
112834
- return false;
112835
- }
112836
- function isMetricComparisonValueFilter(obj) {
112837
- if (isMetricValueFilterWithConditions(obj)) return false;
112838
- if (!isMetricValueFilter(obj)) return false;
112839
- const condition = obj.condition;
112840
- if (typeof condition !== "string") return false;
112841
- return [
112842
- "GREATER_THAN",
112843
- "GREATER_THAN_OR_EQUAL_TO",
112844
- "LESS_THAN",
112845
- "LESS_THAN_OR_EQUAL_TO",
112846
- "EQUAL_TO",
112847
- "NOT_EQUAL_TO"
112848
- ].includes(condition);
112536
+ function newPublisherSectionIdV2() {
112537
+ return newPublisherIdV2("section");
112849
112538
  }
112850
112539
  /**
112851
- * MVF with operator "All" can be represented without a condition.
112852
- * In that case it is a no-op at execution time, but may be preserved in persisted insight definition.
112540
+ * Generates a widget id such as `widget_7f3a91c4`.
112541
+ *
112542
+ * @alpha
112853
112543
  */
112854
- function isMetricAllValueFilter(obj) {
112855
- if (!isMetricValueFilter(obj)) return false;
112856
- if (isMetricValueFilterWithConditions(obj)) {
112857
- const conditions = obj.conditions;
112858
- return conditions.length > 0 && conditions.every((c) => c && typeof c === "object" && c.condition == null);
112859
- }
112860
- const condition = obj.condition;
112861
- return condition === void 0 || condition === null;
112862
- }
112863
- function isRankingFilter$1(obj) {
112864
- return typeof obj === "object" && obj !== null && "using" in obj && "type" in obj && obj.type === "ranking_filter";
112865
- }
112866
- function isAttributeSort(obj) {
112867
- return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "attribute_sort" && "by" in obj;
112868
- }
112869
- function isMetricSort(obj) {
112870
- if (obj && typeof obj === "object" && "type" in obj && obj.type === "metric_sort" && "metrics" in obj) return Array.isArray(obj.metrics);
112871
- return false;
112872
- }
112873
- function isSimpleMetricSort(obj) {
112874
- if (isMetricSort(obj)) return obj.metrics.every((m) => typeof m === "string");
112875
- return false;
112876
- }
112877
- function isDashboardDateFilter(obj) {
112878
- return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "date_filter";
112879
- }
112880
- function isDashboardAbsoluteDateFilter(obj) {
112881
- return isDashboardDateFilter(obj) && typeof obj["from"] === "string" && typeof obj["to"] === "string";
112882
- }
112883
- function isDashboardEmptyDateFilter(obj) {
112884
- return isDashboardDateFilter(obj) && typeof obj["from"] === "undefined" && typeof obj["to"] === "undefined" && typeof obj["granularity"] === "undefined" && typeof obj["date"] === "undefined";
112885
- }
112886
- function isDashboardNoopDateFilter(obj) {
112887
- return isDashboardEmptyDateFilter(obj) && typeof obj.empty_values === "undefined";
112888
- }
112889
- function isDashboardRelativeDateFilter(obj) {
112890
- if (isDashboardDateFilter(obj)) {
112891
- const fromType = typeof obj["from"];
112892
- const toType = typeof obj["to"];
112893
- return ["number", "undefined"].includes(fromType) && ["number", "undefined"].includes(toType);
112894
- }
112895
- return false;
112896
- }
112897
- function isDashboardAttributeFilter(obj) {
112898
- return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "attribute_filter" && "using" in obj;
112899
- }
112900
- function isDashboardTextFilter(obj) {
112901
- return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "text_filter" && "using" in obj;
112902
- }
112903
- function isDashboardArbitraryTextFilter(obj) {
112904
- return isDashboardTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && arbitraryTextFilterConditions.has(obj["condition"]);
112905
- }
112906
- function isDashboardMatchTextFilter(obj) {
112907
- return isDashboardTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && matchTextFilterConditions.has(obj["condition"]);
112908
- }
112909
- function isDashboardMetricValueFilter(obj) {
112910
- return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "metric_value_filter" && "using" in obj;
112911
- }
112912
- function isInsightWidget(obj) {
112913
- return Boolean(typeof obj === "object" && obj && "visualization" in obj);
112914
- }
112915
- function isRichTextWidget(obj) {
112916
- return Boolean(typeof obj === "object" && obj && "content" in obj);
112917
- }
112918
- function isVisualizationSwitcherWidget(obj) {
112919
- return Boolean(typeof obj === "object" && obj && "visualizations" in obj);
112920
- }
112921
- function isContainerWidget(obj) {
112922
- return Boolean(typeof obj === "object" && obj && "sections" in obj);
112923
- }
112924
- const DatasetTypes = ["dataset"];
112925
- const DateDatasetTypes = ["date"];
112926
- const MetricEntityTypes = ["metric"];
112927
- const FactTypes = ["fact"];
112928
- function isDataset(obj) {
112929
- return Boolean(typeof obj === "object" && obj && "id" in obj && "type" in obj && DatasetTypes.includes(obj.type));
112930
- }
112931
- function isDateDataset(obj) {
112932
- return Boolean(typeof obj === "object" && obj && "id" in obj && "type" in obj && DateDatasetTypes.includes(obj.type));
112933
- }
112934
- function isFact$1(obj) {
112935
- return Boolean(typeof obj === "object" && obj && "type" in obj && FactTypes.includes(obj.type));
112936
- }
112937
- function isMetricEntity(obj) {
112938
- return Boolean(typeof obj === "object" && obj && "id" in obj && "type" in obj && MetricEntityTypes.includes(obj.type));
112544
+ function newPublisherWidgetIdV2() {
112545
+ return newPublisherIdV2("widget");
112939
112546
  }
112940
112547
  //#endregion
112941
112548
  //#region ../../../common/temp/sdk/node_modules/.pnpm/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js
@@ -119534,6 +119141,307 @@ var require_dist$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
119534
119141
  exports.visitAsync = visit.visitAsync;
119535
119142
  }));
119536
119143
  //#endregion
119144
+ //#region ../../../sdk/libs/sdk-code-convertors/src/conts.ts
119145
+ /** @internal */
119146
+ const DatasetTypes$1 = ["dataset"];
119147
+ /** @internal */
119148
+ const DateDatasetTypes$1 = ["date"];
119149
+ /** @internal */
119150
+ const MetricTypes = ["metric"];
119151
+ /** @internal */
119152
+ const ParameterTypes = ["parameter"];
119153
+ /** @internal */
119154
+ const ComputedAttributeTypes = ["computed_attribute"];
119155
+ /** @internal */
119156
+ const DashboardTypes = ["dashboard"];
119157
+ /** @internal */
119158
+ const PluginTypes = ["plugin"];
119159
+ /** @internal */
119160
+ const AttributeHierarchyTypes = ["attribute_hierarchy"];
119161
+ /** @internal */
119162
+ const VisualisationsTypes = [
119163
+ "table",
119164
+ "bar_chart",
119165
+ "column_chart",
119166
+ "line_chart",
119167
+ "area_chart",
119168
+ "scatter_chart",
119169
+ "bubble_chart",
119170
+ "pie_chart",
119171
+ "donut_chart",
119172
+ "treemap_chart",
119173
+ "pyramid_chart",
119174
+ "funnel_chart",
119175
+ "heatmap_chart",
119176
+ "bullet_chart",
119177
+ "waterfall_chart",
119178
+ "dependency_wheel_chart",
119179
+ "sankey_chart",
119180
+ "headline_chart",
119181
+ "combo_chart",
119182
+ "geo_chart",
119183
+ "geo_area_chart",
119184
+ "repeater_chart",
119185
+ "radar_chart"
119186
+ ];
119187
+ /** @internal */
119188
+ const AllTypes = [
119189
+ ...DatasetTypes$1,
119190
+ ...DateDatasetTypes$1,
119191
+ ...MetricTypes,
119192
+ ...ParameterTypes,
119193
+ ...ComputedAttributeTypes,
119194
+ ...DashboardTypes,
119195
+ ...PluginTypes,
119196
+ ...VisualisationsTypes,
119197
+ ...AttributeHierarchyTypes
119198
+ ];
119199
+ //#endregion
119200
+ //#region ../../../sdk/libs/sdk-code-convertors/src/utils/typeGuards.ts
119201
+ const SupportedReferenceTypes = [
119202
+ "fact",
119203
+ "label",
119204
+ "computed_attribute",
119205
+ "metric",
119206
+ "dataset",
119207
+ "attribute"
119208
+ ];
119209
+ /**
119210
+ * Reference prefixes that stand for an attribute-like object a query field, an attribute filter
119211
+ * or a drill can use. A computed attribute behaves as a label with computed values.
119212
+ */
119213
+ const AttributeLikeReferenceTypes = [
119214
+ "attribute",
119215
+ "label",
119216
+ "computed_attribute"
119217
+ ];
119218
+ function parseReferenceObject(obj) {
119219
+ const [t, identifier] = obj?.split("/") ?? [];
119220
+ const type = t;
119221
+ if (Boolean(type && identifier) && SupportedReferenceTypes.includes(type)) return {
119222
+ identifier,
119223
+ type
119224
+ };
119225
+ return null;
119226
+ }
119227
+ const AttrTypes = ["attribute"];
119228
+ function isAttribute$1(obj) {
119229
+ if (typeof obj === "object" && obj && "type" in obj) return AttrTypes.includes(obj.type);
119230
+ return false;
119231
+ }
119232
+ function isAttributeField(obj) {
119233
+ if (typeof obj === "object" && obj && "using" in obj && typeof obj.using === "string" && !("aggregation" in obj)) {
119234
+ const id = parseReferenceObject(obj.using);
119235
+ return Boolean(id && [...AttributeLikeReferenceTypes, "fact"].includes(id.type));
119236
+ }
119237
+ return false;
119238
+ }
119239
+ /**
119240
+ * Whether the reference names a computed attribute (`computed_attribute/{id}`).
119241
+ */
119242
+ function isComputedAttributeReference(reference) {
119243
+ return parseReferenceObject(reference)?.type === "computed_attribute";
119244
+ }
119245
+ function isInlineMetricField(obj) {
119246
+ return typeof obj === "object" && obj !== null && "maql" in obj && typeof obj.maql === "string";
119247
+ }
119248
+ function isMetricField(obj) {
119249
+ if (typeof obj === "object" && obj && "using" in obj && typeof obj.using === "string") {
119250
+ const id = parseReferenceObject(obj.using);
119251
+ return Boolean(id && ["metric"].includes(id.type));
119252
+ }
119253
+ return false;
119254
+ }
119255
+ function isCalculatedMetricField(obj) {
119256
+ if (typeof obj === "object" && obj && "using" in obj && typeof obj.using === "string" && "aggregation" in obj && obj.aggregation) {
119257
+ const id = parseReferenceObject(obj.using);
119258
+ return Boolean(id && [
119259
+ "attribute",
119260
+ "label",
119261
+ "fact"
119262
+ ].includes(id.type));
119263
+ }
119264
+ return false;
119265
+ }
119266
+ function isArithmeticMetricField(obj) {
119267
+ if (typeof obj === "object" && obj && "using" in obj && "operator" in obj && obj.operator) return Array.isArray(obj.using);
119268
+ return false;
119269
+ }
119270
+ function isPoPMetricField(obj) {
119271
+ return typeof obj === "object" && obj !== null && "using" in obj && "date_filter" in obj && "type" in obj && obj.type === "PREVIOUS_YEAR";
119272
+ }
119273
+ function isPreviousPeriodField(obj) {
119274
+ return typeof obj === "object" && obj !== null && "using" in obj && "date_filter" in obj && "type" in obj && obj.type === "PREVIOUS_PERIOD";
119275
+ }
119276
+ function isDateFilter(obj) {
119277
+ return typeof obj === "object" && obj !== null && "using" in obj && "type" in obj && obj.type === "date_filter";
119278
+ }
119279
+ function isAbsoluteDateFilter(obj) {
119280
+ return isDateFilter(obj) && typeof obj.from === "string" && typeof obj.to === "string" && !obj.granularity;
119281
+ }
119282
+ function isRelativeDateFilter(obj) {
119283
+ if (isDateFilter(obj) && typeof obj.from === "number" && typeof obj.to === "number" && obj.granularity) return true;
119284
+ return isAllTimeDateFilter(obj);
119285
+ }
119286
+ function isAllTimeDateFilter(obj) {
119287
+ return isDateFilter(obj) && typeof obj.from === "undefined" && typeof obj.to === "undefined";
119288
+ }
119289
+ function isAttributeFilter(obj) {
119290
+ if (typeof obj === "object" && obj && "using" in obj && "type" in obj && obj.type === "attribute_filter") {
119291
+ const id = parseReferenceObject(obj.using);
119292
+ return Boolean(id && AttributeLikeReferenceTypes.includes(id.type));
119293
+ }
119294
+ return false;
119295
+ }
119296
+ function isTextFilter(obj) {
119297
+ return typeof obj === "object" && obj !== null && "using" in obj && "type" in obj && obj.type === "text_filter";
119298
+ }
119299
+ const arbitraryTextFilterConditions = new Set(["is", "isNot"]);
119300
+ const matchTextFilterConditions = new Set([
119301
+ "contains",
119302
+ "doesNotContain",
119303
+ "startsWith",
119304
+ "doesNotStartWith",
119305
+ "endsWith",
119306
+ "doesNotEndWith"
119307
+ ]);
119308
+ function isArbitraryTextFilter(obj) {
119309
+ return isTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && arbitraryTextFilterConditions.has(obj["condition"]);
119310
+ }
119311
+ function isMatchTextFilter(obj) {
119312
+ return isTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && matchTextFilterConditions.has(obj["condition"]);
119313
+ }
119314
+ function isPositiveAttributeFilter(obj) {
119315
+ if (isAttributeFilter(obj)) return Boolean(obj.state?.include);
119316
+ return false;
119317
+ }
119318
+ function isNegativeAttributeFilter(obj) {
119319
+ return Boolean(typeof obj === "object" && obj && "type" in obj && obj.type === "attribute_filter" && !isPositiveAttributeFilter(obj));
119320
+ }
119321
+ function isMetricValueFilter(obj) {
119322
+ if (typeof obj === "object" && obj && "using" in obj && "type" in obj && obj.type === "metric_value_filter") {
119323
+ const id = parseReferenceObject(obj.using);
119324
+ if (id) return ["metric"].includes(id.type);
119325
+ return true;
119326
+ }
119327
+ return false;
119328
+ }
119329
+ function isMetricValueFilterWithConditions(obj) {
119330
+ return isMetricValueFilter(obj) && Array.isArray(obj.conditions);
119331
+ }
119332
+ function isMetricRangeValueFilter(obj) {
119333
+ if (isMetricValueFilterWithConditions(obj)) return false;
119334
+ if (isMetricValueFilter(obj)) {
119335
+ const condition = obj.condition;
119336
+ return typeof condition === "string" && ["BETWEEN", "NOT_BETWEEN"].includes(condition);
119337
+ }
119338
+ return false;
119339
+ }
119340
+ function isMetricComparisonValueFilter(obj) {
119341
+ if (isMetricValueFilterWithConditions(obj)) return false;
119342
+ if (!isMetricValueFilter(obj)) return false;
119343
+ const condition = obj.condition;
119344
+ if (typeof condition !== "string") return false;
119345
+ return [
119346
+ "GREATER_THAN",
119347
+ "GREATER_THAN_OR_EQUAL_TO",
119348
+ "LESS_THAN",
119349
+ "LESS_THAN_OR_EQUAL_TO",
119350
+ "EQUAL_TO",
119351
+ "NOT_EQUAL_TO"
119352
+ ].includes(condition);
119353
+ }
119354
+ /**
119355
+ * MVF with operator "All" can be represented without a condition.
119356
+ * In that case it is a no-op at execution time, but may be preserved in persisted insight definition.
119357
+ */
119358
+ function isMetricAllValueFilter(obj) {
119359
+ if (!isMetricValueFilter(obj)) return false;
119360
+ if (isMetricValueFilterWithConditions(obj)) {
119361
+ const conditions = obj.conditions;
119362
+ return conditions.length > 0 && conditions.every((c) => c && typeof c === "object" && c.condition == null);
119363
+ }
119364
+ const condition = obj.condition;
119365
+ return condition === void 0 || condition === null;
119366
+ }
119367
+ function isRankingFilter$1(obj) {
119368
+ return typeof obj === "object" && obj !== null && "using" in obj && "type" in obj && obj.type === "ranking_filter";
119369
+ }
119370
+ function isAttributeSort(obj) {
119371
+ return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "attribute_sort" && "by" in obj;
119372
+ }
119373
+ function isMetricSort(obj) {
119374
+ if (obj && typeof obj === "object" && "type" in obj && obj.type === "metric_sort" && "metrics" in obj) return Array.isArray(obj.metrics);
119375
+ return false;
119376
+ }
119377
+ function isSimpleMetricSort(obj) {
119378
+ if (isMetricSort(obj)) return obj.metrics.every((m) => typeof m === "string");
119379
+ return false;
119380
+ }
119381
+ function isDashboardDateFilter(obj) {
119382
+ return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "date_filter";
119383
+ }
119384
+ function isDashboardAbsoluteDateFilter(obj) {
119385
+ return isDashboardDateFilter(obj) && typeof obj["from"] === "string" && typeof obj["to"] === "string";
119386
+ }
119387
+ function isDashboardEmptyDateFilter(obj) {
119388
+ return isDashboardDateFilter(obj) && typeof obj["from"] === "undefined" && typeof obj["to"] === "undefined" && typeof obj["granularity"] === "undefined" && typeof obj["date"] === "undefined";
119389
+ }
119390
+ function isDashboardNoopDateFilter(obj) {
119391
+ return isDashboardEmptyDateFilter(obj) && typeof obj.empty_values === "undefined";
119392
+ }
119393
+ function isDashboardRelativeDateFilter(obj) {
119394
+ if (isDashboardDateFilter(obj)) {
119395
+ const fromType = typeof obj["from"];
119396
+ const toType = typeof obj["to"];
119397
+ return ["number", "undefined"].includes(fromType) && ["number", "undefined"].includes(toType);
119398
+ }
119399
+ return false;
119400
+ }
119401
+ function isDashboardAttributeFilter(obj) {
119402
+ return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "attribute_filter" && "using" in obj;
119403
+ }
119404
+ function isDashboardTextFilter(obj) {
119405
+ return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "text_filter" && "using" in obj;
119406
+ }
119407
+ function isDashboardArbitraryTextFilter(obj) {
119408
+ return isDashboardTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && arbitraryTextFilterConditions.has(obj["condition"]);
119409
+ }
119410
+ function isDashboardMatchTextFilter(obj) {
119411
+ return isDashboardTextFilter(obj) && "condition" in obj && typeof obj["condition"] === "string" && matchTextFilterConditions.has(obj["condition"]);
119412
+ }
119413
+ function isDashboardMetricValueFilter(obj) {
119414
+ return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "metric_value_filter" && "using" in obj;
119415
+ }
119416
+ function isInsightWidget(obj) {
119417
+ return Boolean(typeof obj === "object" && obj && "visualization" in obj);
119418
+ }
119419
+ function isRichTextWidget(obj) {
119420
+ return Boolean(typeof obj === "object" && obj && "content" in obj);
119421
+ }
119422
+ function isVisualizationSwitcherWidget(obj) {
119423
+ return Boolean(typeof obj === "object" && obj && "visualizations" in obj);
119424
+ }
119425
+ function isContainerWidget(obj) {
119426
+ return Boolean(typeof obj === "object" && obj && "sections" in obj);
119427
+ }
119428
+ const DatasetTypes = ["dataset"];
119429
+ const DateDatasetTypes = ["date"];
119430
+ const MetricEntityTypes = ["metric"];
119431
+ const FactTypes = ["fact"];
119432
+ function isDataset(obj) {
119433
+ return Boolean(typeof obj === "object" && obj && "id" in obj && "type" in obj && DatasetTypes.includes(obj.type));
119434
+ }
119435
+ function isDateDataset(obj) {
119436
+ return Boolean(typeof obj === "object" && obj && "id" in obj && "type" in obj && DateDatasetTypes.includes(obj.type));
119437
+ }
119438
+ function isFact$1(obj) {
119439
+ return Boolean(typeof obj === "object" && obj && "type" in obj && FactTypes.includes(obj.type));
119440
+ }
119441
+ function isMetricEntity(obj) {
119442
+ return Boolean(typeof obj === "object" && obj && "id" in obj && "type" in obj && MetricEntityTypes.includes(obj.type));
119443
+ }
119444
+ //#endregion
119537
119445
  //#region ../../../common/temp/sdk/node_modules/.pnpm/axios@1.20.0/node_modules/axios/lib/helpers/bind.js
119538
119446
  /**
119539
119447
  * Create a bound version of a function with a specified `this` context
@@ -128609,7 +128517,7 @@ var FormData_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin((
128609
128517
  var parseUrl$1 = __require("url").parse;
128610
128518
  var fs = __require("fs");
128611
128519
  var Stream = __require("stream").Stream;
128612
- var crypto$1 = __require("crypto");
128520
+ var crypto$2 = __require("crypto");
128613
128521
  var mime = require_mime_types();
128614
128522
  var asynckit = require_asynckit();
128615
128523
  var setToStringTag = require_es_set_tostringtag();
@@ -128760,7 +128668,7 @@ var FormData_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin((
128760
128668
  return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
128761
128669
  };
128762
128670
  FormData.prototype._generateBoundary = function() {
128763
- this._boundary = "--------------------------" + crypto$1.randomBytes(12).toString("hex");
128671
+ this._boundary = "--------------------------" + crypto$2.randomBytes(12).toString("hex");
128764
128672
  };
128765
128673
  FormData.prototype.getLengthSync = function() {
128766
128674
  var knownLength = this._overheadLength + this._valueLength;
@@ -129247,7 +129155,7 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
129247
129155
  let str = "";
129248
129156
  const { length } = alphabet;
129249
129157
  const randomValues = new Uint32Array(size);
129250
- crypto.randomFillSync(randomValues);
129158
+ crypto$1.randomFillSync(randomValues);
129251
129159
  for (let i = 0; i < size; i++) str += alphabet[randomValues[i] % length];
129252
129160
  return str;
129253
129161
  };
@@ -135402,6 +135310,136 @@ const isAfmObjectIdentifier$1 = (value) => {
135402
135310
  return !!(value?.identifier?.id && value?.identifier?.type);
135403
135311
  };
135404
135312
  //#endregion
135313
+ //#region ../../../sdk/libs/sdk-code-convertors/src/utils/errors.ts
135314
+ /**
135315
+ * @public
135316
+ */
135317
+ const CoreErrorMessages = {
135318
+ ["core.bucketItemTypeNotSupported"]: "Report item type is not supported. Item: {0}",
135319
+ ["core.filterItemTypeNotSupported"]: "Filter item type is not supported. Item: {0}",
135320
+ ["core.referenceTypeNotSupported"]: "Reference type is not supported. Item: {0}",
135321
+ ["core.itemNotSupported"]: "Item is not supported. Item: {0}",
135322
+ ["core.visualizationNotSupported"]: "Visualisation is not supported. Url: {0}",
135323
+ ["core.layerTypeNotSupported"]: "Layer type is not supported. Type: {0}",
135324
+ ["core.multipleDateDataSets"]: "Multiple date datasets are not supported. Item: {0}",
135325
+ ["core.onlyOneDateDatasetAllowed"]: `Dashboard filters contains more filters with same date dataset "{0}".`,
135326
+ ["core.onlyOneAttributeItemAllowed"]: `Dashboard filters contains more filters with same attribute or label "{0}".`,
135327
+ ["core.multipleCommonDateFilters"]: `Multiple usage of common date filters in dashboard. Define exactly one date filter that has no date dataset defined.`,
135328
+ ["core.duplicateFilterLocalIdentifier"]: `Duplicate filter local identifier "{0}". Each filter must have a unique local identifier across a dashboard tab, including filters in groups.`,
135329
+ ["core.duplicateFieldName"]: `Duplicate field name "{0}". Each field a query declares must have a unique name.`,
135330
+ ["core.duplicateFilterName"]: `Duplicate filter name "{0}". Each filter in a query must have a unique name, including the filters a date filter carries.`,
135331
+ ["core.duplicateLayerIdentifier"]: `Duplicate layer id "{0}". Each layer of a visualisation must have a unique id.`,
135332
+ ["core.duplicateTabIdentifier"]: `Duplicate tab identifier "{0}". Each tab must have a unique identifier within the dashboard.`,
135333
+ ["core.tabsAndRootContentMutuallyExclusive"]: `Dashboard "{0}" defines both "tabs" and root-level "sections" or "filters". These are mutually exclusive — keep all content inside tabs or at the root, not both.`,
135334
+ ["core.invalidIanaTimezoneId"]: `"{0}" is not a valid IANA timezone ID. Use a real timezone such as Europe/Prague or $browserDetected.`,
135335
+ ["core.unsupportedContentVersion"]: `Content version "{0}" is not supported. Supported version: "{1}".`,
135336
+ ["core.dateFilterWithoutDataSet"]: `Date filter "{0}" names no date dataset. A document date filter must name the date dataset it applies to.`,
135337
+ ["core.filterSettingNotStorable"]: `Filter "{0}" sets "{1}", which a {2} cannot store.`,
135338
+ ["core.pagesAndSectionsMutuallyExclusive"]: `Content defines both "pages" and "sections". Keep the pages at the top level or inside sections, not both.`,
135339
+ ["core.pagesOrSectionsRequired"]: `Content defines neither "pages" nor "sections". Add one of them; an empty document has "pages: []".`
135340
+ };
135341
+ /**
135342
+ * @public
135343
+ */
135344
+ const CoreErrorTypes = {
135345
+ ["core.bucketItemTypeNotSupported"]: "BucketItemTypeNotSupported",
135346
+ ["core.filterItemTypeNotSupported"]: "FilterItemTypeNotSupported",
135347
+ ["core.referenceTypeNotSupported"]: "ReferenceTypeNotSupported",
135348
+ ["core.itemNotSupported"]: "ItemNotSupported",
135349
+ ["core.visualizationNotSupported"]: "VisualizationNotSupported",
135350
+ ["core.layerTypeNotSupported"]: "LayerTypeNotSupported",
135351
+ ["core.multipleDateDataSets"]: "MultipleDateDataSets",
135352
+ ["core.onlyOneDateDatasetAllowed"]: "OnlyOneDateDatasetAllowed",
135353
+ ["core.onlyOneAttributeItemAllowed"]: "OnlyOneAttributeItemAllowed",
135354
+ ["core.multipleCommonDateFilters"]: "MultipleCommonDateFilters",
135355
+ ["core.duplicateFilterLocalIdentifier"]: "DuplicateFilterLocalIdentifier",
135356
+ ["core.duplicateFieldName"]: "DuplicateFieldName",
135357
+ ["core.duplicateFilterName"]: "DuplicateFilterName",
135358
+ ["core.duplicateLayerIdentifier"]: "DuplicateLayerIdentifier",
135359
+ ["core.duplicateTabIdentifier"]: "DuplicateTabIdentifier",
135360
+ ["core.tabsAndRootContentMutuallyExclusive"]: "TabsAndRootContentMutuallyExclusive",
135361
+ ["core.invalidIanaTimezoneId"]: "InvalidIanaTimezoneId",
135362
+ ["core.unsupportedContentVersion"]: "UnsupportedContentVersion",
135363
+ ["core.dateFilterWithoutDataSet"]: "DateFilterWithoutDataSet",
135364
+ ["core.filterSettingNotStorable"]: "FilterSettingNotStorable",
135365
+ ["core.pagesAndSectionsMutuallyExclusive"]: "PagesAndSectionsMutuallyExclusive",
135366
+ ["core.pagesOrSectionsRequired"]: "PagesOrSectionsRequired"
135367
+ };
135368
+ /**
135369
+ * Update error context with new values
135370
+ */
135371
+ function updateErrorContext(context, props) {
135372
+ if (context) return {
135373
+ ...context,
135374
+ ...props,
135375
+ path: [...context.path ?? [], ...props.path ?? []]
135376
+ };
135377
+ return {
135378
+ type: props.type ?? "unknown",
135379
+ path: props.path ?? [],
135380
+ data: props.data ?? {}
135381
+ };
135382
+ }
135383
+ function newError(code, params = [], context) {
135384
+ const err = new Error(buildMessage(CoreErrorMessages[code], params, context));
135385
+ err.type = CoreErrorTypes[code];
135386
+ err.code = code;
135387
+ err.context = context;
135388
+ return err;
135389
+ }
135390
+ function buildMessage(message, params, context) {
135391
+ const m = params.reduce((msg, param, index) => msg.replace(new RegExp(`\\{${index}}`, "gi"), param), message);
135392
+ if (context?.path) return `${m} in: ${context.path.join("/")}`;
135393
+ return m;
135394
+ }
135395
+ //#endregion
135396
+ //#region ../../../sdk/libs/sdk-code-convertors/src/utils/sharedUtils.ts
135397
+ /** @public */
135398
+ function assertUnreachable(x) {
135399
+ throw new Error(`Didn't expect to get here. Invalid value is "${JSON.stringify(x, null, 2)}".`);
135400
+ }
135401
+ function parsePath(path) {
135402
+ if (Array.isArray(path)) return path;
135403
+ if (path === "") return [];
135404
+ return path.split("/");
135405
+ }
135406
+ function getTableRootId$1(profile, item) {
135407
+ return `${item?.data_source ?? profile?.data_source ?? "default"}`;
135408
+ }
135409
+ /**
135410
+ * Convert IDs into a human-readable strings to be used as titles
135411
+ * E.g. "someId" or "some-id" or "some_id" or "some.id" will become "Some Id".
135412
+ */
135413
+ function convertIdToTitle$1(id = "") {
135414
+ return (id || "").replace(/([A-Z])/g, " $1").replace(/([_.-])+/g, " ").split(" ").map((w) => w.charAt(0).toLocaleUpperCase() + w.slice(1)).join(" ");
135415
+ }
135416
+ /**
135417
+ * Convert title into an id
135418
+ */
135419
+ function convertTitleToId(title = "") {
135420
+ return (title || "").normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\W/g, "_").toLowerCase();
135421
+ }
135422
+ const UUID4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
135423
+ function convertIdOrTitleToId(id, title) {
135424
+ if (id.match(UUID4_REGEX) && title) return convertTitleToId(title);
135425
+ return id;
135426
+ }
135427
+ function getFullField$1(field) {
135428
+ if (typeof field === "string") return { using: field };
135429
+ return field;
135430
+ }
135431
+ function getFullBucket(bucket) {
135432
+ if (typeof bucket === "string") return { field: bucket };
135433
+ return bucket;
135434
+ }
135435
+ function collectFieldLevelFilters(visualisation) {
135436
+ const fields = visualisation?.query?.fields;
135437
+ if (!fields) return;
135438
+ const result = {};
135439
+ for (const field of Object.values(fields)) if (typeof field === "object" && field !== null && "filter_by" in field && field.filter_by) Object.assign(result, field.filter_by);
135440
+ return Object.keys(result).length > 0 ? result : void 0;
135441
+ }
135442
+ //#endregion
135405
135443
  //#region ../../../sdk/libs/sdk-code-convertors/src/utils/granularityUtils.ts
135406
135444
  const CF_YAML_TO_GDC_GRANULARITY = {
135407
135445
  minute: "GDC.time.minute",
@@ -137009,6 +137047,748 @@ const toDeclarativePermissions = (permissions) => {
137009
137047
  return [ownPermissions, hierarchicalPermissions];
137010
137048
  };
137011
137049
  //#endregion
137050
+ //#region ../../../sdk/libs/sdk-code-convertors/src/utils/texts.ts
137051
+ const DATASET_COMMENT = [
137052
+ " A dataset is a logical object that represents a set of related facts, attributes, and attribute labels.",
137053
+ " Datasets are basic organization units of a logical data model.",
137054
+ " Read more about Datasets:",
137055
+ " https://www.gooddata.com/developers/cloud-native/doc/cloud/model-data/concepts/dataset/"
137056
+ ].join("\n");
137057
+ const DATE_INSTANCE_COMMENT = [
137058
+ " A Date dataset is a dataset in the logical data model(LDM)",
137059
+ " that represents DATE / TIMESTAMP columns in your database.",
137060
+ " Read more about date instances:",
137061
+ " https://www.gooddata.com/developers/cloud-native/doc/cloud/model-data/concepts/dataset/#date-datasets"
137062
+ ].join("\n");
137063
+ const COMPUTED_ATTRIBUTE_COMMENT = [
137064
+ " A computed attribute turns numbers into named groups, for example \"Small\", \"Medium\", \"Large\".",
137065
+ " Write the break points in MAQL - the first matching branch wins - and use it like any attribute.",
137066
+ " Read more about MAQL:",
137067
+ " https://www.gooddata.com/developers/cloud-native/doc/cloud/create-metrics/maql/"
137068
+ ].join("\n");
137069
+ const METRIC_COMMENT = [
137070
+ " A metric is a computational expression of numerical data (facts or other metrics).",
137071
+ " Use MAQL to create reusable multidimensional queries that combine multiple facts and attributes.",
137072
+ " Read more about MAQL:",
137073
+ " https://www.gooddata.com/developers/cloud-native/doc/cloud/create-metrics/maql/"
137074
+ ].join("\n");
137075
+ const PARAMETER_COMMENT = [
137076
+ " A parameter is a named, typed value that metrics reference instead of hardcoding a literal.",
137077
+ " Changing the parameter's default changes every metric that references it, without editing their MAQL.",
137078
+ " Read more about parameters:",
137079
+ " https://www.gooddata.ai/docs/cloud/experimental-features/numeric-parameters/"
137080
+ ].join("\n");
137081
+ const VISUALISATION_COMMENT = [
137082
+ " A visualization is a visual representation of a user's analytical view of the data.",
137083
+ " You build visualizations from metrics, attributes, and optionally filters that are combined in a way to visualize a particular aspect of your data.",
137084
+ " The visualizations are executed over and over as fresh data gets loaded.",
137085
+ " Interpreting the content of a visualization is up to the user (the consumer of the visualization).",
137086
+ " Read more about visualisations:",
137087
+ " https://www.gooddata.com/developers/cloud-native/doc/cloud/create-visualizations/concepts/visualization/"
137088
+ ].join("\n");
137089
+ const DASHBOARD_COMMENT = [
137090
+ " A dashboard is a collection of visualizations that are organized into sections.",
137091
+ " Because they allow filtering and other adjustments, they function as a dynamic presentation layer for your data analytics.",
137092
+ " Read more about dashboards:",
137093
+ " https://www.gooddata.com/docs/cloud/create-dashboards/concepts/dashboard/"
137094
+ ].join("\n");
137095
+ const ATTRIBUTE_HIERARCHY_COMMENT = [
137096
+ " The attribute hierarchy is a user-defined list of attributes. This list determines the order ",
137097
+ " in which subsequent attributes are revealed in a visualization during the drill-down process. ",
137098
+ " Attributes lower in this hierarchy are automatically filtered based on the values selected from the higher-level attributes.",
137099
+ " Read more about attribute hierarchies:",
137100
+ " https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/"
137101
+ ].join("\n");
137102
+ const PLUGIN_COMMENT = [
137103
+ " Dashboard plugins allow developers to create and integrate custom code into the Dashboard component.",
137104
+ " With the plugins, you as a developer can customize and enhance the default dashboard experience available to the dashboard consumers.",
137105
+ " Read more about dashboard plugins:",
137106
+ " https://www.gooddata.com/docs/gooddata-ui/latest/references/dashboard_component/dashboard_plugins/"
137107
+ ].join("\n");
137108
+ [
137109
+ " A document presents a finished period as pages of visualizations and text.",
137110
+ " Its period becomes a date filter on every visualization that does not opt out,",
137111
+ " and a page places what it draws in a tree of rows and columns."
137112
+ ].join("\n");
137113
+ [
137114
+ " A document template is the pages a document starts from.",
137115
+ " A document made from it copies them and keeps no reference back,",
137116
+ " so the document stays as it was made while the template moves on."
137117
+ ].join("\n");
137118
+ [
137119
+ " A page layout is a page a template or a document can be built from.",
137120
+ " It places what it draws in a tree of rows and columns, and a slot left",
137121
+ " empty here is one whatever uses the page is expected to fill."
137122
+ ].join("\n");
137123
+ [
137124
+ " A page template is one page a document or a document template can copy.",
137125
+ " It places widgets in a tree of rows and columns, and a widget left empty",
137126
+ " here is one the document is expected to fill."
137127
+ ].join("\n");
137128
+ //#endregion
137129
+ //#region ../../../sdk/libs/sdk-code-convertors/src/from/declarativeDashboardToYaml.ts
137130
+ /** @public */
137131
+ function declarativeDashboardToYaml(entities, dashboard, filterContexts, context) {
137132
+ const errorContext = updateErrorContext(context, {
137133
+ type: "dashboard",
137134
+ path: ["dashboard", dashboard.id],
137135
+ data: {}
137136
+ });
137137
+ const content = dashboard.content;
137138
+ const doc = new import_dist.Document({
137139
+ type: "dashboard",
137140
+ id: dashboard.id
137141
+ });
137142
+ doc.commentBefore = DASHBOARD_COMMENT;
137143
+ const hasContentTabs = (content.tabs?.length ?? 0) > 0;
137144
+ const hasRootContent = Boolean(content.layout || content.dateFilterConfig || content.dateFilterConfigs && content.dateFilterConfigs.length > 0 || content.attributeFilterConfigs && content.attributeFilterConfigs.length > 0 || content.measureValueFilterConfigs && content.measureValueFilterConfigs.length > 0 || content.parameters && content.parameters.length > 0);
137145
+ const yamlVersion = hasContentTabs && !hasRootContent ? "3" : "2";
137146
+ doc.add(entryWithSpace("version", yamlVersion));
137147
+ fillOptionalMetaFields(doc, dashboard);
137148
+ if (content.disableCrossFiltering) doc.add(entryWithSpace("cross_filtering", false));
137149
+ if (content.disableUserFilterReset) doc.add(entryWithSpace("user_filters_reset", false));
137150
+ if (content.disableUserFilterSave) doc.add(entryWithSpace("user_filters_save", false));
137151
+ if (content.disableFilterViews) doc.add(entryWithSpace("filter_views", false));
137152
+ if (content.disablePersistentFiltersAcrossTabs) doc.add(entryWithSpace("persistent_filters_across_tabs", false));
137153
+ if (content.timezoneConfig) doc.add(entryWithSpace("timezone_config", declarativeTimezoneConfigToYaml(content.timezoneConfig)));
137154
+ const hasMultipleTabs = content.tabs && content.tabs.length > 1;
137155
+ const hasSingleTabWithTitle = content.tabs?.length === 1 && content.tabs[0].title;
137156
+ const shouldUseTabs = hasMultipleTabs || hasSingleTabWithTitle;
137157
+ if (content.tabs && shouldUseTabs) {
137158
+ if (content.tabs[0].layout?.configuration?.sections?.enableHeader) doc.add(entryWithSpace("enable_section_headers", content.tabs[0].layout?.configuration?.sections?.enableHeader));
137159
+ const tabs = declarativeTabsToYaml(content.tabs, filterContexts, entities, updateErrorContext(errorContext, { path: ["tabs"] }));
137160
+ if (tabs) doc.add(entryWithSpace("tabs", tabs));
137161
+ } else if (content.tabs?.length === 1) {
137162
+ if (content.tabs[0].layout?.configuration?.sections?.enableHeader) doc.add(entryWithSpace("enable_section_headers", content.tabs[0].layout?.configuration?.sections?.enableHeader));
137163
+ const tab = content.tabs[0];
137164
+ const section = declarativeSectionsToYaml(tab.layout, entities, updateErrorContext(errorContext, { path: ["tabs", "0"] }));
137165
+ if (section) doc.add(entryWithSpace("sections", section));
137166
+ const filterContextId = tab.filterContextRef ? getIdentifier(tab.filterContextRef, true, updateErrorContext(errorContext, { path: ["filterContext"] })) : void 0;
137167
+ const { filters, filtersMap } = declarativeFilterContextToYaml(tab.dateFilterConfig, filterContexts?.find((fc) => fc.id === filterContextId), updateErrorContext(errorContext, { path: ["dateFilterConfig"] }));
137168
+ declarativeFiltersConfigToYaml$1(filtersMap, tab.dateFilterConfig, tab.dateFilterConfigs, tab.attributeFilterConfigs, tab.measureValueFilterConfigs, errorContext);
137169
+ const groupedFilters = declarativeFilterGroupsToYaml(filters, tab.filterGroupsConfig);
137170
+ if (groupedFilters.items.length > 0) doc.add(entryWithSpace("filters", groupedFilters));
137171
+ } else {
137172
+ if (content.layout?.configuration?.sections?.enableHeader) doc.add(entryWithSpace("enable_section_headers", content.layout?.configuration?.sections?.enableHeader));
137173
+ const section = declarativeSectionsToYaml(content.layout, entities, updateErrorContext(errorContext, { path: ["layout"] }));
137174
+ if (section) doc.add(entryWithSpace("sections", section));
137175
+ const filterContextId = content.filterContextRef ? getIdentifier(content.filterContextRef, true, updateErrorContext(errorContext, { path: ["filterContext"] })) : void 0;
137176
+ const { filters, filtersMap } = declarativeFilterContextToYaml(content.dateFilterConfig, filterContexts?.find((fc) => fc.id === filterContextId), updateErrorContext(errorContext, { path: ["dateFilterConfig"] }));
137177
+ declarativeFiltersConfigToYaml$1(filtersMap, content.dateFilterConfig, content.dateFilterConfigs, content.attributeFilterConfigs, content.measureValueFilterConfigs, errorContext);
137178
+ if (filters.items.length > 0) doc.add(entryWithSpace("filters", filters));
137179
+ }
137180
+ const plugins = declarativePluginsToYaml(content, updateErrorContext(errorContext, { path: ["plugins"] }));
137181
+ if (plugins) doc.add(entryWithSpace("plugins", plugins));
137182
+ const permissions = declarativePermissionsToYaml(doc, dashboard);
137183
+ if (permissions) doc.add(entryWithSpace("permissions", permissions));
137184
+ return {
137185
+ content: doc.toString({ lineWidth: 0 }),
137186
+ json: doc.toJSON()
137187
+ };
137188
+ }
137189
+ /** @internal */
137190
+ function declarativeTabsToYaml(tabs, filterContexts, entities, errorContext) {
137191
+ if (!tabs || tabs.length === 0) return;
137192
+ const yamlTabs = new import_dist.YAMLSeq();
137193
+ tabs.forEach((tab, ti) => {
137194
+ const yamlTab = new import_dist.YAMLMap();
137195
+ const tabErrorContext = updateErrorContext(errorContext, { path: [ti.toString()] });
137196
+ yamlTab.add(new import_dist.Pair("id", tab.localIdentifier));
137197
+ yamlTab.add(new import_dist.Pair("title", tab.title));
137198
+ let filterContext;
137199
+ if (tab.filterContextRef && filterContexts?.length) {
137200
+ const filterContextId = getIdentifier(tab.filterContextRef, true, tabErrorContext);
137201
+ filterContext = filterContexts.find((fc) => fc.id === filterContextId);
137202
+ }
137203
+ if (filterContext) {
137204
+ const { filters, filtersMap } = declarativeFilterContextToYaml(tab.dateFilterConfig, filterContext, updateErrorContext(tabErrorContext, { path: ["dateFilterConfig"] }));
137205
+ declarativeFiltersConfigToYaml$1(filtersMap, tab.dateFilterConfig, tab.dateFilterConfigs, tab.attributeFilterConfigs, tab.measureValueFilterConfigs, tabErrorContext);
137206
+ const groupedFilters = declarativeFilterGroupsToYaml(filters, tab.filterGroupsConfig);
137207
+ if (groupedFilters.items.length > 0) yamlTab.add(new import_dist.Pair("filters", groupedFilters));
137208
+ }
137209
+ if (tab.layout) {
137210
+ const sections = declarativeSectionsToYaml({ layout: tab.layout }.layout, entities, updateErrorContext(tabErrorContext, { path: ["layout"] }));
137211
+ if (sections) yamlTab.add(new import_dist.Pair("sections", sections));
137212
+ }
137213
+ yamlTabs.add(yamlTab);
137214
+ });
137215
+ return yamlTabs;
137216
+ }
137217
+ /** @internal */
137218
+ function declarativeSectionsToYaml(layout, entities, errorContext) {
137219
+ if (!layout?.sections?.length) return;
137220
+ const sections = new import_dist.YAMLSeq();
137221
+ layout.sections.forEach((section, si) => {
137222
+ const yamlSection = new import_dist.YAMLMap();
137223
+ const sectionErrorContext = updateErrorContext(errorContext, { path: ["sections", si.toString()] });
137224
+ if (section.header?.title) yamlSection.add(new import_dist.Pair("title", section.header.title));
137225
+ if (section.header?.description) yamlSection.add(new import_dist.Pair("description", section.header.description));
137226
+ if (section.items?.length) {
137227
+ const items = new import_dist.YAMLSeq();
137228
+ section.items.forEach((item, i) => {
137229
+ const widget = declarativeWidgetToYaml(item.widget, item.size, entities, updateErrorContext(sectionErrorContext, { path: ["items", i.toString()] }));
137230
+ if (widget) items.add(widget);
137231
+ });
137232
+ yamlSection.add(new import_dist.Pair("widgets", items));
137233
+ }
137234
+ sections.add(yamlSection);
137235
+ });
137236
+ return sections;
137237
+ }
137238
+ /** @internal */
137239
+ function declarativeWidgetToYaml(widget, size, entities, errorContext) {
137240
+ if (!widget) return;
137241
+ switch (widget?.type) {
137242
+ case "insight": return declarativeInsightWidgetToYaml(widget, size, entities, updateErrorContext(errorContext, { path: ["insight"] }));
137243
+ case "richText": return declarativeRichTextWidgetToYaml(widget, size);
137244
+ case "visualizationSwitcher": return declarativeVisualizationSwitcherWidgetToYaml(widget, size, entities, updateErrorContext(errorContext, { path: ["visualizationSwitcher"] }));
137245
+ case "IDashboardLayout": return declarativeContainerWidgetToYaml(widget, size, entities, updateErrorContext(errorContext, { path: ["layout"] }));
137246
+ default: throw newError("core.referenceTypeNotSupported", [String(widget?.type)], errorContext);
137247
+ }
137248
+ }
137249
+ function declarativeInsightWidgetToYaml(widget, size, entities, errorContext) {
137250
+ const yamlWidget = new import_dist.YAMLMap();
137251
+ if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("id", widget.localIdentifier));
137252
+ yamlWidget.add(new import_dist.Pair("visualization", getIdentifier(widget.insight, true, updateErrorContext(errorContext, { path: ["visualisation"] }))));
137253
+ if (widget.configuration?.hideTitle) yamlWidget.add(new import_dist.Pair("title", false));
137254
+ else if (widget.title) yamlWidget.add(new import_dist.Pair("title", widget.title));
137255
+ if (widget.configuration?.description?.visible === false) yamlWidget.add(new import_dist.Pair("description", false));
137256
+ else if (widget.configuration?.description?.source === "insight") {} else if (widget.description) yamlWidget.add(new import_dist.Pair("description", widget.description));
137257
+ if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137258
+ if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137259
+ if (widget.dateDataSet) yamlWidget.add(new import_dist.Pair("date", getIdentifier(widget.dateDataSet, true, updateErrorContext(errorContext, { path: ["date"] }))));
137260
+ if (widget.ignoreDashboardFilters?.length) yamlWidget.add(new import_dist.Pair("ignored_filters", widget.ignoreDashboardFilters.map((df, i) => {
137261
+ return getIdentifier(dashboardFilterReferenceObjRef(df), void 0, updateErrorContext(errorContext, { path: ["ignoreDashboardFilters", i.toString()] }));
137262
+ })));
137263
+ if (widget.properties?.["controls"]?.zoomInsight) yamlWidget.add(new import_dist.Pair("zoom_data", true));
137264
+ if (widget.drills?.length) {
137265
+ const drills = new import_dist.YAMLSeq();
137266
+ const sourceVisualizationId = getIdentifier(widget.insight, true, updateErrorContext(errorContext, { path: ["insight"] }));
137267
+ widget.drills.forEach((drill, id) => {
137268
+ drills.add(declarativeDrillToYaml(drill, entities, sourceVisualizationId, updateErrorContext(errorContext, { path: ["drills", id.toString()] })));
137269
+ });
137270
+ yamlWidget.add(new import_dist.Pair("interactions", drills));
137271
+ }
137272
+ if (widget.ignoredDrillDownHierarchies?.length) {
137273
+ const ignores = widget.ignoredDrillDownHierarchies.map((hierarchy, hi) => declarativeIgnoreDrillDownHierarchyToYaml(hierarchy, updateErrorContext(errorContext, { path: ["ignoredDrillDownHierarchies", hi.toString()] })));
137274
+ yamlWidget.add(new import_dist.Pair("ignored_drill_downs", ignores));
137275
+ }
137276
+ if (widget.drillDownIntersectionIgnoredAttributes?.length) {
137277
+ const ignores = widget.drillDownIntersectionIgnoredAttributes.map((hierarchy, hi) => declarativeDrillDownIntersectionIgnoredAttributesToYaml(hierarchy, updateErrorContext(errorContext, { path: ["drillDownIntersectionIgnoredAttributes", hi.toString()] }))).filter(Boolean);
137278
+ yamlWidget.add(new import_dist.Pair("ignored_drill_downs_intersections", ignores));
137279
+ }
137280
+ if (widget.ignoreCrossFiltering) yamlWidget.add(new import_dist.Pair("ignored_cross_filtering", true));
137281
+ return yamlWidget;
137282
+ }
137283
+ function declarativeIgnoreDrillDownHierarchyToYaml(hierarchy, errorContext) {
137284
+ if (isAttributeHierarchyReference(hierarchy)) return {
137285
+ hierarchy: hierarchy.attributeHierarchy,
137286
+ on: getIdentifier(hierarchy.attribute, void 0, updateErrorContext(errorContext, { path: ["attribute"] }))
137287
+ };
137288
+ return {
137289
+ template: hierarchy.dateHierarchyTemplate,
137290
+ on: getIdentifier(hierarchy.dateDatasetAttribute, void 0, updateErrorContext(errorContext, { path: ["dateDatasetAttribute"] }))
137291
+ };
137292
+ }
137293
+ function declarativeDrillDownIntersectionIgnoredAttributesToYaml(hierarchy, errorContext) {
137294
+ if (hierarchy.ignoredAttributes.length === 0) return null;
137295
+ return {
137296
+ attributes: hierarchy.ignoredAttributes,
137297
+ hierarchy: declarativeIgnoreDrillDownHierarchyToYaml(hierarchy.drillDownReference, updateErrorContext(errorContext, { path: ["drillDownReference"] }))
137298
+ };
137299
+ }
137300
+ function declarativeRichTextWidgetToYaml(widget, size) {
137301
+ const yamlWidget = new import_dist.YAMLMap();
137302
+ if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("id", widget.localIdentifier));
137303
+ yamlWidget.add(new import_dist.Pair("content", widget.content));
137304
+ if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137305
+ if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137306
+ return yamlWidget;
137307
+ }
137308
+ function declarativeTimezoneConfigToYaml(config) {
137309
+ return {
137310
+ ...config.timezoneId ? { timezone_id: config.timezoneId } : {},
137311
+ ...config.showTimezoneInfo ? { show_timezone_info: config.showTimezoneInfo } : { show_timezone_info: false },
137312
+ ...config.allowUserOverrideInViewMode ? { allow_user_override_in_view_mode: config.allowUserOverrideInViewMode } : { allow_user_override_in_view_mode: false }
137313
+ };
137314
+ }
137315
+ function declarativeVisualizationSwitcherWidgetToYaml(widget, size, entities, errorContext) {
137316
+ const yamlWidget = new import_dist.YAMLMap();
137317
+ if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("id", widget.localIdentifier));
137318
+ yamlWidget.add(new import_dist.Pair("visualizations", widget.visualizations.map((vis, vi) => declarativeInsightWidgetToYaml(vis, void 0, entities, updateErrorContext(errorContext, { path: ["visualizations", vi.toString()] })))));
137319
+ if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137320
+ if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137321
+ return yamlWidget;
137322
+ }
137323
+ function declarativeContainerWidgetToYaml(widget, size, entities, errorContext) {
137324
+ const yamlWidget = new import_dist.YAMLMap();
137325
+ if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("container", widget.localIdentifier));
137326
+ if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137327
+ if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137328
+ if (widget.configuration?.direction) yamlWidget.add(new import_dist.Pair("layout_direction", widget.configuration?.direction));
137329
+ if (widget.configuration?.sections) yamlWidget.add(new import_dist.Pair("enable_section_headers", widget.configuration.sections.enableHeader));
137330
+ if (widget.sections?.length) {
137331
+ const nestedSections = new import_dist.YAMLSeq();
137332
+ widget.sections.forEach((section, si) => {
137333
+ const yamlSection = new import_dist.YAMLMap();
137334
+ if (section.header?.title) yamlSection.add(new import_dist.Pair("title", section.header.title));
137335
+ if (section.header?.description) yamlSection.add(new import_dist.Pair("description", section.header.description));
137336
+ if (section.items?.length) {
137337
+ const widgets = new import_dist.YAMLSeq();
137338
+ section.items.forEach((item, ii) => {
137339
+ const yamlNestedWidget = declarativeWidgetToYaml(item.widget, item.size, entities, updateErrorContext(errorContext, { path: [
137340
+ "sections",
137341
+ si.toString(),
137342
+ "items",
137343
+ ii.toString()
137344
+ ] }));
137345
+ if (yamlNestedWidget) widgets.add(yamlNestedWidget);
137346
+ });
137347
+ yamlSection.add(new import_dist.Pair("widgets", widgets));
137348
+ }
137349
+ nestedSections.add(yamlSection);
137350
+ });
137351
+ yamlWidget.add(new import_dist.Pair("sections", nestedSections));
137352
+ }
137353
+ return yamlWidget;
137354
+ }
137355
+ /** @internal */
137356
+ function declarativeDrillToYaml(drill, entities, sourceVisualizationId, errorContext) {
137357
+ const drillYaml = new import_dist.YAMLMap();
137358
+ const originIdentifier = drill.origin.type === "drillFromMeasure" ? drill.origin.measure : drill.origin.attribute;
137359
+ const originPath = drill.origin.type === "drillFromMeasure" ? "measure" : "attribute";
137360
+ drillYaml.add(new import_dist.Pair("click_on", getIdentifier(originIdentifier, void 0, updateErrorContext(errorContext, { path: ["origin", originPath] }))));
137361
+ if (isDrillToInsight(drill)) {
137362
+ drillYaml.add(new import_dist.Pair("open_visualization", getIdentifier(drill.target, true, updateErrorContext(errorContext, { path: ["target"] }))));
137363
+ const filters = drillFiltersToYaml(drill, entities, sourceVisualizationId, errorContext);
137364
+ if (filters) drillYaml.add(new import_dist.Pair("filters", filters));
137365
+ return drillYaml;
137366
+ }
137367
+ if (isDrillToDashboard(drill) && drill.target) {
137368
+ const dashboardDrill = drill;
137369
+ drillYaml.add(new import_dist.Pair("open_dashboard", getIdentifier(drill.target, true, updateErrorContext(errorContext, { path: ["target"] }))));
137370
+ if (drill.targetTabLocalIdentifier) drillYaml.add(new import_dist.Pair("open_dashboard_tab", drill.targetTabLocalIdentifier));
137371
+ const filters = drillFiltersToYaml(dashboardDrill, entities, sourceVisualizationId, errorContext);
137372
+ if (filters) drillYaml.add(new import_dist.Pair("filters", filters));
137373
+ return drillYaml;
137374
+ }
137375
+ if (isDrillToCustomUrl(drill)) {
137376
+ if (drill.drillIntersectionIgnoredAttributes?.length) {
137377
+ const attrs = new import_dist.YAMLSeq();
137378
+ drill.drillIntersectionIgnoredAttributes.forEach((attr) => attrs.add(attr));
137379
+ drillYaml.add(new import_dist.Pair("ignored_intersection_attributes", attrs));
137380
+ }
137381
+ drillYaml.add(new import_dist.Pair("open_url", serializeUrlTarget(drill.target.url)));
137382
+ return drillYaml;
137383
+ }
137384
+ if (isDrillToAttributeUrl(drill)) {
137385
+ if (drill.drillIntersectionIgnoredAttributes?.length) {
137386
+ const attrs = new import_dist.YAMLSeq();
137387
+ drill.drillIntersectionIgnoredAttributes.forEach((attr) => attrs.add(attr));
137388
+ drillYaml.add(new import_dist.Pair("ignored_intersection_attributes", attrs));
137389
+ }
137390
+ drillYaml.add(new import_dist.Pair("open_url", {
137391
+ label: getIdentifier(drill.target.displayForm, void 0, updateErrorContext(errorContext, { path: ["target", "displayForm"] })),
137392
+ href: getIdentifier(drill.target.hyperlinkDisplayForm, void 0, updateErrorContext(errorContext, { path: ["target", "hyperlinkDisplayForm"] }))
137393
+ }));
137394
+ return drillYaml;
137395
+ }
137396
+ return drillYaml;
137397
+ }
137398
+ function drillFiltersToYaml(drill, entities, sourceVisualizationId, errorContext) {
137399
+ const filtersYaml = new import_dist.YAMLMap();
137400
+ const excludeYaml = new import_dist.YAMLMap();
137401
+ const includeYaml = new import_dist.YAMLMap();
137402
+ if (drill.drillIntersectionIgnoredAttributes?.length) {
137403
+ const attrs = new import_dist.YAMLSeq();
137404
+ drill.drillIntersectionIgnoredAttributes.forEach((attr) => attrs.add(attr));
137405
+ excludeYaml.add(new import_dist.Pair("drilled_datapoint", attrs));
137406
+ }
137407
+ if (drill.ignoredDashboardFilters?.length) {
137408
+ const filters = new import_dist.YAMLSeq();
137409
+ drill.ignoredDashboardFilters.forEach((filter) => filters.add(filter));
137410
+ excludeYaml.add(new import_dist.Pair("dashboard_filters", filters));
137411
+ }
137412
+ if (drill.includedSourceInsightFiltersObjRefs?.length) includeYaml.add(new import_dist.Pair("visualization_filters", filterRefsToYaml(drill.includedSourceInsightFiltersObjRefs, entities, sourceVisualizationId, updateErrorContext(errorContext, { path: ["includedSourceInsightFiltersObjRefs"] }))));
137413
+ if (drill.includedSourceMeasureFiltersObjRefs?.length) includeYaml.add(new import_dist.Pair("metric_filters", sourceMeasureFilterRefsToYaml(drill.includedSourceMeasureFiltersObjRefs, entities, sourceVisualizationId, updateErrorContext(errorContext, { path: ["includedSourceMeasureFiltersObjRefs"] }))));
137414
+ if (excludeYaml.items.length) filtersYaml.add(new import_dist.Pair("exclude", excludeYaml));
137415
+ if (includeYaml.items.length) filtersYaml.add(new import_dist.Pair("include", includeYaml));
137416
+ return filtersYaml.items.length ? filtersYaml : null;
137417
+ }
137418
+ function filterRefsToYaml(refs, entities, sourceVisualizationId, errorContext) {
137419
+ const filters = (entities?.find((entity) => VisualisationsTypes.includes(entity.type) && entity.id === sourceVisualizationId)?.data)?.query?.filter_by;
137420
+ return refs.map((ref) => findSourceInsightFilterId(filters, ref, errorContext) ?? sourceInsightFilterRefFallbackId(ref, errorContext)).filter(Boolean);
137421
+ }
137422
+ function findSourceInsightFilterId(filters, ref, errorContext) {
137423
+ if (!filters) return;
137424
+ return Object.entries(filters).find(([_, filter]) => matchesSourceInsightFilterRef(filter, ref, errorContext))?.[0];
137425
+ }
137426
+ function matchesSourceInsightFilterRef(filter, ref, errorContext) {
137427
+ switch (ref.type) {
137428
+ case "attributeFilter": return filter.type === "attribute_filter" && filter.using === getIdentifier(ref["label"], void 0, updateErrorContext(errorContext, { path: ["attributeFilter"] }));
137429
+ case "dateFilter": return filter.type === "date_filter" && filter.using === getIdentifier(ref["dataSet"], true, updateErrorContext(errorContext, { path: ["dateFilter"] }));
137430
+ case "measureValueFilter": return filter.type === "metric_value_filter" && filter.using === getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["measureValueFilter"] }));
137431
+ case "rankingFilter": return filter.type === "ranking_filter" && filter.using === getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["rankingFilter"] }));
137432
+ default: return false;
137433
+ }
137434
+ }
137435
+ function sourceInsightFilterRefFallbackId(ref, errorContext) {
137436
+ switch (ref.type) {
137437
+ case "attributeFilter": return getIdentifier(ref["label"], void 0, updateErrorContext(errorContext, { path: ["attributeFilter"] }));
137438
+ case "dateFilter": return getIdentifier(ref["dataSet"], true, updateErrorContext(errorContext, { path: ["dateFilter"] }));
137439
+ case "measureValueFilter": return getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["measureValueFilter"] }));
137440
+ case "rankingFilter": return getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["rankingFilter"] }));
137441
+ default: return null;
137442
+ }
137443
+ }
137444
+ function sourceMeasureFilterRefsToYaml(refs, entities, sourceVisualizationId, errorContext) {
137445
+ const visualisation = entities?.find((entity) => VisualisationsTypes.includes(entity.type) && entity.id === sourceVisualizationId)?.data;
137446
+ const fieldFilters = collectFieldLevelFilters(visualisation);
137447
+ return refs.map((ref) => findSourceInsightFilterId(fieldFilters, ref, errorContext) ?? sourceInsightFilterRefFallbackId(ref, errorContext)).filter(Boolean);
137448
+ }
137449
+ function getDateFilterEmptyValueHandling(filter) {
137450
+ const value = filter.dateFilter.emptyValueHandling;
137451
+ if (value === "include" || value === "exclude" || value === "only") return value;
137452
+ }
137453
+ /** @internal */
137454
+ function declarativeFilterContextToYaml(dateFilterConfig, filterContext, errorContext) {
137455
+ const filters = [];
137456
+ const filtersMap = {};
137457
+ const declarativeFilters = (filterContext ? filterContext.content : void 0)?.filters ?? [];
137458
+ declarativeFilters.forEach((filter) => {
137459
+ if (isDashboardCommonDateFilter(filter) && isNoopAllTimeDashboardDateFilter(filter)) return;
137460
+ const key = createFilterContextItemKeyName(filter, "date", updateErrorContext(errorContext, { path: ["date"] }));
137461
+ if (isDashboardDateFilter$1(filter)) {
137462
+ const def = declarativeDateFilterToYaml(filter, errorContext);
137463
+ filters.push(new import_dist.Pair(key, def));
137464
+ filtersMap[key] = {
137465
+ yaml: def,
137466
+ filter
137467
+ };
137468
+ }
137469
+ if (isDashboardAttributeFilter$1(filter)) {
137470
+ const def = declarativeAttributeFilterToYaml(filter, errorContext);
137471
+ filters.push(new import_dist.Pair(key, def));
137472
+ filtersMap[key] = {
137473
+ yaml: def,
137474
+ filter
137475
+ };
137476
+ }
137477
+ if (isDashboardArbitraryAttributeFilter(filter)) {
137478
+ const def = declarativeArbitraryTextFilterToYaml(filter, errorContext);
137479
+ filters.push(new import_dist.Pair(key, def));
137480
+ filtersMap[key] = {
137481
+ yaml: def,
137482
+ filter
137483
+ };
137484
+ }
137485
+ if (isDashboardMatchAttributeFilter(filter)) {
137486
+ const def = declarativeMatchTextFilterToYaml(filter, errorContext);
137487
+ filters.push(new import_dist.Pair(key, def));
137488
+ filtersMap[key] = {
137489
+ yaml: def,
137490
+ filter
137491
+ };
137492
+ }
137493
+ if (isDashboardMeasureValueFilter(filter)) {
137494
+ const def = declarativeMeasureValueFilterToYaml$1(filter, errorContext);
137495
+ filters.push(new import_dist.Pair(key, def));
137496
+ filtersMap[key] = {
137497
+ yaml: def,
137498
+ filter
137499
+ };
137500
+ }
137501
+ });
137502
+ if (!declarativeFilters.find(isDashboardCommonDateFilter) && dateFilterConfig) {
137503
+ const filter = { dateFilter: {
137504
+ granularity: "GDC.time.date",
137505
+ type: "absolute"
137506
+ } };
137507
+ const key = createFilterContextItemKeyName(filter, "common", updateErrorContext(errorContext, { path: ["common"] }));
137508
+ const def = declarativeDateFilterToYaml(filter, errorContext);
137509
+ filters.unshift(new import_dist.Pair(key, def));
137510
+ filtersMap[key] = {
137511
+ yaml: def,
137512
+ filter
137513
+ };
137514
+ }
137515
+ Object.values(filtersMap).forEach(({ filter, yaml }) => {
137516
+ if (isDashboardAttributeFilter$1(filter) || isDashboardArbitraryAttributeFilter(filter)) {
137517
+ const filterBody = isDashboardAttributeFilter$1(filter) ? filter.attributeFilter : filter.arbitraryAttributeFilter;
137518
+ const attrsIds = filterBody.filterElementsBy?.map((element) => {
137519
+ return element.filterLocalIdentifier ?? null;
137520
+ }).filter(Boolean);
137521
+ const datesIds = filterBody.filterElementsByDate?.map((element) => {
137522
+ if (!element.isCommonDate && element.filterLocalIdentifier) return {
137523
+ using: element.filterLocalIdentifier,
137524
+ common: element.isCommonDate
137525
+ };
137526
+ if (element.isCommonDate && element.dataSet) return {
137527
+ using: element.filterLocalIdentifier,
137528
+ common: true,
137529
+ date: getIdentifier(element.dataSet, true, errorContext)
137530
+ };
137531
+ return element.filterLocalIdentifier ?? null;
137532
+ }).filter(Boolean);
137533
+ const ids = [...attrsIds ?? [], ...datesIds ?? []];
137534
+ if (ids?.length) yaml.add(new import_dist.Pair("parents", ids));
137535
+ const metricsIds = filterBody.validateElementsBy?.map((element, i) => getIdentifier(element, void 0, updateErrorContext(errorContext, { path: ["validateElementsBy", i.toString()] }))).filter(Boolean);
137536
+ if (metricsIds?.length) yaml.add(new import_dist.Pair("metric_filters", metricsIds));
137537
+ }
137538
+ });
137539
+ return {
137540
+ filters: filters.reduce((map, filter) => {
137541
+ map.add(filter);
137542
+ return map;
137543
+ }, new import_dist.YAMLMap()),
137544
+ filtersMap
137545
+ };
137546
+ }
137547
+ function declarativeDateFilterToYaml(filter, errorContext) {
137548
+ const dateFilter = new import_dist.YAMLMap();
137549
+ dateFilter.add(new import_dist.Pair("type", "date_filter"));
137550
+ const gran = parseGranularity(filter.dateFilter.granularity ?? "GDC.time.date");
137551
+ if (gran !== "DAY") dateFilter.add(new import_dist.Pair("granularity", gran));
137552
+ if (filter.dateFilter.dataSet) dateFilter.add(new import_dist.Pair("date", getIdentifier(filter.dateFilter.dataSet, true, updateErrorContext(errorContext, { path: ["date"] }))));
137553
+ if (isRelativeDashboardDateFilter(filter)) {
137554
+ if (typeof filter.dateFilter.from === "number" && typeof filter.dateFilter.to === "number") {
137555
+ dateFilter.add(new import_dist.Pair("from", parseInt(String(filter.dateFilter.from), 10)));
137556
+ dateFilter.add(new import_dist.Pair("to", parseInt(String(filter.dateFilter.to), 10)));
137557
+ }
137558
+ } else {
137559
+ if (filter.dateFilter.from) dateFilter.add(new import_dist.Pair("from", filter.dateFilter.from));
137560
+ if (filter.dateFilter.to) dateFilter.add(new import_dist.Pair("to", filter.dateFilter.to));
137561
+ }
137562
+ const emptyValueHandling = getDateFilterEmptyValueHandling(filter);
137563
+ if (emptyValueHandling) dateFilter.add(new import_dist.Pair("empty_values", emptyValueHandling));
137564
+ return dateFilter;
137565
+ }
137566
+ function declarativeAttributeFilterToYaml(filter, errorContext) {
137567
+ const attributeFilter = new import_dist.YAMLMap();
137568
+ attributeFilter.add(new import_dist.Pair("type", "attribute_filter"));
137569
+ if (filter.attributeFilter.title) attributeFilter.add(new import_dist.Pair("title", filter.attributeFilter.title));
137570
+ const attributeId = getIdentifier(filter.attributeFilter.displayForm, void 0, updateErrorContext(errorContext, { path: ["attributeFilter", "displayForm"] }));
137571
+ attributeFilter.add(new import_dist.Pair("using", attributeId));
137572
+ if (filter.attributeFilter.selectionMode === "single") attributeFilter.add(new import_dist.Pair("multiselect", false));
137573
+ let values = [];
137574
+ if (isAttributeElementsByValue(filter.attributeFilter.attributeElements)) values = filter.attributeFilter.attributeElements.values;
137575
+ if (isAttributeElementsByRef(filter.attributeFilter.attributeElements)) values = filter.attributeFilter.attributeElements.uris;
137576
+ if (!filter.attributeFilter.negativeSelection) {
137577
+ const state = new import_dist.YAMLMap();
137578
+ state.add(new import_dist.Pair("include", values));
137579
+ attributeFilter.add(new import_dist.Pair("state", state));
137580
+ }
137581
+ if (filter.attributeFilter.negativeSelection && values.length) {
137582
+ const state = new import_dist.YAMLMap();
137583
+ state.add(new import_dist.Pair("exclude", values));
137584
+ attributeFilter.add(new import_dist.Pair("state", state));
137585
+ }
137586
+ return attributeFilter;
137587
+ }
137588
+ function declarativeArbitraryTextFilterToYaml(filter, errorContext) {
137589
+ const textFilter = new import_dist.YAMLMap();
137590
+ textFilter.add(new import_dist.Pair("type", "text_filter"));
137591
+ if (filter.arbitraryAttributeFilter.title) textFilter.add(new import_dist.Pair("title", filter.arbitraryAttributeFilter.title));
137592
+ textFilter.add(new import_dist.Pair("using", getIdentifier(filter.arbitraryAttributeFilter.displayForm, void 0, updateErrorContext(errorContext, { path: ["arbitraryAttributeFilter", "displayForm"] }))));
137593
+ textFilter.add(new import_dist.Pair("condition", filter.arbitraryAttributeFilter.negativeSelection ? "isNot" : "is"));
137594
+ textFilter.add(new import_dist.Pair("values", filter.arbitraryAttributeFilter.values));
137595
+ return textFilter;
137596
+ }
137597
+ function declarativeMatchTextFilterToYaml(filter, errorContext) {
137598
+ const textFilter = new import_dist.YAMLMap();
137599
+ textFilter.add(new import_dist.Pair("type", "text_filter"));
137600
+ if (filter.matchAttributeFilter.title) textFilter.add(new import_dist.Pair("title", filter.matchAttributeFilter.title));
137601
+ textFilter.add(new import_dist.Pair("using", getIdentifier(filter.matchAttributeFilter.displayForm, void 0, updateErrorContext(errorContext, { path: ["matchAttributeFilter", "displayForm"] }))));
137602
+ textFilter.add(new import_dist.Pair("condition", matchConditionToYaml(filter.matchAttributeFilter.operator, filter.matchAttributeFilter.negativeSelection)));
137603
+ textFilter.add(new import_dist.Pair("value", filter.matchAttributeFilter.literal));
137604
+ if (filter.matchAttributeFilter.caseSensitive !== void 0) textFilter.add(new import_dist.Pair("case_sensitive", filter.matchAttributeFilter.caseSensitive));
137605
+ return textFilter;
137606
+ }
137607
+ function measureValueConditionToYaml(condition) {
137608
+ const yamlCondition = new import_dist.YAMLMap();
137609
+ if (isComparisonCondition(condition)) {
137610
+ yamlCondition.add(new import_dist.Pair("condition", condition.comparison.operator));
137611
+ yamlCondition.add(new import_dist.Pair("value", condition.comparison.value));
137612
+ } else if (isRangeCondition(condition)) {
137613
+ yamlCondition.add(new import_dist.Pair("condition", condition.range.operator));
137614
+ yamlCondition.add(new import_dist.Pair("from", condition.range.from));
137615
+ yamlCondition.add(new import_dist.Pair("to", condition.range.to));
137616
+ }
137617
+ return yamlCondition;
137618
+ }
137619
+ function conditionHasTreatNullValuesAs(condition) {
137620
+ if (isComparisonCondition(condition)) return condition.comparison.treatNullValuesAs !== void 0;
137621
+ if (isRangeCondition(condition)) return condition.range.treatNullValuesAs !== void 0;
137622
+ return false;
137623
+ }
137624
+ function declarativeMeasureValueFilterToYaml$1(filter, errorContext) {
137625
+ const measureValueFilter = new import_dist.YAMLMap();
137626
+ measureValueFilter.add(new import_dist.Pair("type", "metric_value_filter"));
137627
+ if (filter.dashboardMeasureValueFilter.title) measureValueFilter.add(new import_dist.Pair("title", filter.dashboardMeasureValueFilter.title));
137628
+ measureValueFilter.add(new import_dist.Pair("using", getIdentifier(filter.dashboardMeasureValueFilter.measure, void 0, updateErrorContext(errorContext, { path: ["dashboardMeasureValueFilter", "measure"] }))));
137629
+ const conditions = filter.dashboardMeasureValueFilter.conditions ?? [];
137630
+ if (conditions.length > 0) {
137631
+ const conditionsSeq = new import_dist.YAMLSeq();
137632
+ conditions.forEach((c) => conditionsSeq.add(measureValueConditionToYaml(c)));
137633
+ measureValueFilter.add(new import_dist.Pair("conditions", conditionsSeq));
137634
+ }
137635
+ if (filter.dashboardMeasureValueFilter.dimensionality?.length) {
137636
+ const dimensionalitySeq = new import_dist.YAMLSeq();
137637
+ filter.dashboardMeasureValueFilter.dimensionality.forEach((item, i) => {
137638
+ dimensionalitySeq.add(getIdentifier(item, void 0, updateErrorContext(errorContext, { path: [
137639
+ "dashboardMeasureValueFilter",
137640
+ "dimensionality",
137641
+ i.toString()
137642
+ ] })));
137643
+ });
137644
+ measureValueFilter.add(new import_dist.Pair("dimensionality", dimensionalitySeq));
137645
+ }
137646
+ if (conditions.some(conditionHasTreatNullValuesAs)) measureValueFilter.add(new import_dist.Pair("null_values_as_zero", true));
137647
+ return measureValueFilter;
137648
+ }
137649
+ /** @internal */
137650
+ function declarativeFiltersConfigToYaml$1(filtersMap, dateFilterConfig, dateFilterConfigs, attributeFilterConfigs, measureValueFilterConfigs, errorContext) {
137651
+ attributeFilterConfigs?.forEach((filterSettings, i) => {
137652
+ const filter = filtersMap[filterSettings.localIdentifier];
137653
+ if (filter) {
137654
+ if (filterSettings.mode && filterSettings.mode !== "active") filter.yaml.add(new import_dist.Pair("mode", filterSettings.mode));
137655
+ if (filterSettings.displayAsLabel) filter.yaml.add(new import_dist.Pair("display_as", getIdentifier(filterSettings.displayAsLabel, void 0, updateErrorContext(errorContext, { path: [
137656
+ "attributeFilterConfig",
137657
+ i.toString(),
137658
+ "displayAsLabel"
137659
+ ] }))));
137660
+ if (filterSettings.selectionType) filter.yaml.add(new import_dist.Pair("selection_type", filterSettings.selectionType));
137661
+ }
137662
+ });
137663
+ dateFilterConfigs?.forEach((filterSettings, i) => {
137664
+ const filter = Object.values(filtersMap).find((filter) => filter.yaml.get("date") === getIdentifier(filterSettings.dateDataSet, true, updateErrorContext(errorContext, { path: [
137665
+ "dateFilterConfig",
137666
+ i.toString(),
137667
+ "dateDataSet"
137668
+ ] })));
137669
+ fillDateFilterConfig$1(filterSettings.config, filter);
137670
+ });
137671
+ if (dateFilterConfig) fillDateFilterConfig$1(dateFilterConfig, Object.values(filtersMap).find((filter) => filter.yaml.get("type") === "date_filter" && !filter.yaml.get("date")));
137672
+ measureValueFilterConfigs?.forEach((filterSettings) => {
137673
+ const filter = filtersMap[filterSettings.localIdentifier];
137674
+ if (filter && filterSettings.mode && filterSettings.mode !== "active") filter.yaml.add(new import_dist.Pair("mode", filterSettings.mode));
137675
+ });
137676
+ }
137677
+ function fillDateFilterConfig$1(config, filter) {
137678
+ if (!filter || !config) return;
137679
+ if (config.mode !== "active") filter.yaml.add(new import_dist.Pair("mode", config.mode));
137680
+ if (config.filterName) filter.yaml.add(new import_dist.Pair("title", config.filterName));
137681
+ }
137682
+ function declarativeFilterGroupsToYaml(filters, filterGroupsConfig) {
137683
+ if (!filterGroupsConfig) return filters;
137684
+ const sanitizedGroupIds = sanitizeGroupIds(filterGroupsConfig.groups.map((group) => [group, getFilterGroupIdBase(group)]));
137685
+ const groupedFilters = new import_dist.YAMLMap();
137686
+ filters.items.forEach((filter) => {
137687
+ const groupConfig = filterGroupsConfig.groups.find((group) => group.filters.some(({ filterLocalIdentifier }) => filterLocalIdentifier === filter.key));
137688
+ if (!groupConfig) {
137689
+ groupedFilters.add(filter);
137690
+ return;
137691
+ }
137692
+ const groupWithId = sanitizedGroupIds.find(([group]) => group === groupConfig);
137693
+ if (!groupWithId) throw new Error(`Failed to generate id for filter group ${groupConfig.title}`);
137694
+ const [_, groupId] = groupWithId;
137695
+ const existingGroup = groupedFilters.get(groupId);
137696
+ if (existingGroup) existingGroup.get("filters").add(filter);
137697
+ else {
137698
+ const newGroup = new import_dist.YAMLMap();
137699
+ newGroup.add(new import_dist.Pair("type", "filter_group"));
137700
+ newGroup.add(new import_dist.Pair("title", groupConfig.title));
137701
+ const filtersInGroup = new import_dist.YAMLMap();
137702
+ filtersInGroup.add(filter);
137703
+ newGroup.add(new import_dist.Pair("filters", filtersInGroup));
137704
+ groupedFilters.add(new import_dist.Pair(groupId, newGroup));
137705
+ }
137706
+ });
137707
+ return groupedFilters;
137708
+ }
137709
+ function sanitizeGroupIds(filterGroupIds) {
137710
+ const equalClusters = {};
137711
+ filterGroupIds.forEach(([_, thisId]) => {
137712
+ const cluster = filterGroupIds.filter(([_, id]) => thisId === id).map(([filterGroup]) => filterGroup);
137713
+ if (cluster.length > 1) equalClusters[thisId] = cluster;
137714
+ });
137715
+ if (Object.keys(equalClusters).length === 0) return filterGroupIds;
137716
+ return sanitizeGroupIds(filterGroupIds.map(([filterGroup, oldId]) => {
137717
+ if (filterGroup.localIdentifier) return [filterGroup, filterGroup.localIdentifier];
137718
+ const cluster = equalClusters[oldId];
137719
+ if (!cluster?.length) return [filterGroup, oldId];
137720
+ return [filterGroup, `${oldId}_${cluster.filter((group) => !group.localIdentifier).findIndex((group) => group === filterGroup) + 1}`];
137721
+ }));
137722
+ }
137723
+ function getFilterGroupIdBase({ title, localIdentifier }) {
137724
+ if (localIdentifier) return localIdentifier;
137725
+ return title.normalize().replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
137726
+ }
137727
+ /** @internal */
137728
+ function declarativePluginsToYaml(dashboard, errorContext) {
137729
+ if (!dashboard.plugins?.length) return;
137730
+ const plugins = new import_dist.YAMLSeq();
137731
+ dashboard.plugins.forEach((plugin, i) => {
137732
+ const pluginId = getIdentifier(plugin.plugin, true, updateErrorContext(errorContext, { path: [i.toString(), "plugin"] }));
137733
+ if (plugin.parameters?.length) plugins.add({
137734
+ id: pluginId,
137735
+ parameters: parseParameters(plugin.parameters)
137736
+ });
137737
+ else plugins.add(pluginId);
137738
+ });
137739
+ return plugins;
137740
+ }
137741
+ function declarativePermissionsToYaml(doc, dashboard) {
137742
+ const permissions = fromDeclarativePermissions(dashboard.permissions);
137743
+ if (!permissions) return;
137744
+ return doc.createNode(permissions);
137745
+ }
137746
+ function parseParameters(params) {
137747
+ try {
137748
+ return JSON.parse(params);
137749
+ } catch {
137750
+ return params;
137751
+ }
137752
+ }
137753
+ //#endregion
137754
+ //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js
137755
+ const byteToHex = [];
137756
+ for (let i = 0; i < 256; ++i) byteToHex.push((i + 256).toString(16).slice(1));
137757
+ function unsafeStringify(arr, offset = 0) {
137758
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
137759
+ }
137760
+ //#endregion
137761
+ //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js
137762
+ const rnds8Pool = new Uint8Array(256);
137763
+ let poolPtr = rnds8Pool.length;
137764
+ function rng() {
137765
+ if (poolPtr > rnds8Pool.length - 16) {
137766
+ randomFillSync(rnds8Pool);
137767
+ poolPtr = 0;
137768
+ }
137769
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
137770
+ }
137771
+ //#endregion
137772
+ //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js
137773
+ var native_default = { randomUUID };
137774
+ //#endregion
137775
+ //#region ../../../common/temp/sdk/node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js
137776
+ function v4(options, buf, offset) {
137777
+ if (native_default.randomUUID && !buf && !options) return native_default.randomUUID();
137778
+ options = options || {};
137779
+ const rnds = options.random ?? options.rng?.() ?? rng();
137780
+ if (rnds.length < 16) throw new Error("Random bytes length must be >= 16");
137781
+ rnds[6] = rnds[6] & 15 | 64;
137782
+ rnds[8] = rnds[8] & 63 | 128;
137783
+ if (buf) {
137784
+ offset = offset || 0;
137785
+ if (offset < 0 || offset + 16 > buf.length) throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
137786
+ for (let i = 0; i < 16; ++i) buf[offset + i] = rnds[i];
137787
+ return buf;
137788
+ }
137789
+ return unsafeStringify(rnds);
137790
+ }
137791
+ //#endregion
137012
137792
  //#region ../../../sdk/libs/sdk-code-convertors/src/to/yamlDashboardToDeclarative.ts
137013
137793
  function extractDashboardEmptyValueHandling(filter) {
137014
137794
  const value = filter.empty_values;
@@ -137544,11 +138324,11 @@ function yamlFilterContextToDeclarative(baseId, yamlFilters) {
137544
138324
  if (filter["date"]) {
137545
138325
  const dateFilterConf = {
137546
138326
  dateDataSet: createIdentifier(filter["date"], { forceType: "dataset" }),
137547
- config: fillDateFilterConfig$1(filter)
138327
+ config: fillDateFilterConfig(filter)
137548
138328
  };
137549
138329
  dateFilterConfigs.push(dateFilterConf);
137550
138330
  } else {
137551
- fillDateFilterConfig$1(filter, dateFilterConfig);
138331
+ fillDateFilterConfig(filter, dateFilterConfig);
137552
138332
  if (isDashboardNoopDateFilter(filter)) return null;
137553
138333
  }
137554
138334
  return { dateFilter: {
@@ -137656,7 +138436,7 @@ function extractFilterGroupsConfig(yamlFilters) {
137656
138436
  }
137657
138437
  return groups.length > 0 ? { groups } : void 0;
137658
138438
  }
137659
- function fillDateFilterConfig$1(filter, config) {
138439
+ function fillDateFilterConfig(filter, config) {
137660
138440
  const current = config ?? {
137661
138441
  mode: "active",
137662
138442
  filterName: ""
@@ -137691,704 +138471,134 @@ function normalizeLocalDateFilter(item) {
137691
138471
  };
137692
138472
  }
137693
138473
  //#endregion
137694
- //#region ../../../sdk/libs/sdk-code-convertors/src/utils/texts.ts
137695
- const DATASET_COMMENT = [
137696
- " A dataset is a logical object that represents a set of related facts, attributes, and attribute labels.",
137697
- " Datasets are basic organization units of a logical data model.",
137698
- " Read more about Datasets:",
137699
- " https://www.gooddata.com/developers/cloud-native/doc/cloud/model-data/concepts/dataset/"
137700
- ].join("\n");
137701
- const DATE_INSTANCE_COMMENT = [
137702
- " A Date dataset is a dataset in the logical data model(LDM)",
137703
- " that represents DATE / TIMESTAMP columns in your database.",
137704
- " Read more about date instances:",
137705
- " https://www.gooddata.com/developers/cloud-native/doc/cloud/model-data/concepts/dataset/#date-datasets"
137706
- ].join("\n");
137707
- const COMPUTED_ATTRIBUTE_COMMENT = [
137708
- " A computed attribute turns numbers into named groups, for example \"Small\", \"Medium\", \"Large\".",
137709
- " Write the break points in MAQL - the first matching branch wins - and use it like any attribute.",
137710
- " Read more about MAQL:",
137711
- " https://www.gooddata.com/developers/cloud-native/doc/cloud/create-metrics/maql/"
137712
- ].join("\n");
137713
- const METRIC_COMMENT = [
137714
- " A metric is a computational expression of numerical data (facts or other metrics).",
137715
- " Use MAQL to create reusable multidimensional queries that combine multiple facts and attributes.",
137716
- " Read more about MAQL:",
137717
- " https://www.gooddata.com/developers/cloud-native/doc/cloud/create-metrics/maql/"
137718
- ].join("\n");
137719
- const PARAMETER_COMMENT = [
137720
- " A parameter is a named, typed value that metrics reference instead of hardcoding a literal.",
137721
- " Changing the parameter's default changes every metric that references it, without editing their MAQL.",
137722
- " Read more about parameters:",
137723
- " https://www.gooddata.ai/docs/cloud/experimental-features/numeric-parameters/"
137724
- ].join("\n");
137725
- const VISUALISATION_COMMENT = [
137726
- " A visualization is a visual representation of a user's analytical view of the data.",
137727
- " You build visualizations from metrics, attributes, and optionally filters that are combined in a way to visualize a particular aspect of your data.",
137728
- " The visualizations are executed over and over as fresh data gets loaded.",
137729
- " Interpreting the content of a visualization is up to the user (the consumer of the visualization).",
137730
- " Read more about visualisations:",
137731
- " https://www.gooddata.com/developers/cloud-native/doc/cloud/create-visualizations/concepts/visualization/"
137732
- ].join("\n");
137733
- const DASHBOARD_COMMENT = [
137734
- " A dashboard is a collection of visualizations that are organized into sections.",
137735
- " Because they allow filtering and other adjustments, they function as a dynamic presentation layer for your data analytics.",
137736
- " Read more about dashboards:",
137737
- " https://www.gooddata.com/docs/cloud/create-dashboards/concepts/dashboard/"
137738
- ].join("\n");
137739
- const ATTRIBUTE_HIERARCHY_COMMENT = [
137740
- " The attribute hierarchy is a user-defined list of attributes. This list determines the order ",
137741
- " in which subsequent attributes are revealed in a visualization during the drill-down process. ",
137742
- " Attributes lower in this hierarchy are automatically filtered based on the values selected from the higher-level attributes.",
137743
- " Read more about attribute hierarchies:",
137744
- " https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/"
137745
- ].join("\n");
137746
- const PLUGIN_COMMENT = [
137747
- " Dashboard plugins allow developers to create and integrate custom code into the Dashboard component.",
137748
- " With the plugins, you as a developer can customize and enhance the default dashboard experience available to the dashboard consumers.",
137749
- " Read more about dashboard plugins:",
137750
- " https://www.gooddata.com/docs/gooddata-ui/latest/references/dashboard_component/dashboard_plugins/"
137751
- ].join("\n");
137752
- [
137753
- " A document presents a finished period as pages of visualizations and text.",
137754
- " Its period becomes a date filter on every visualization that does not opt out,",
137755
- " and a page places what it draws in a tree of rows and columns."
137756
- ].join("\n");
137757
- [
137758
- " A document template is the pages a document starts from.",
137759
- " A document made from it copies them and keeps no reference back,",
137760
- " so the document stays as it was made while the template moves on."
137761
- ].join("\n");
137762
- [
137763
- " A page layout is a page a template or a document can be built from.",
137764
- " It places what it draws in a tree of rows and columns, and a slot left",
137765
- " empty here is one whatever uses the page is expected to fill."
137766
- ].join("\n");
137767
- //#endregion
137768
- //#region ../../../sdk/libs/sdk-code-convertors/src/from/declarativeDashboardToYaml.ts
137769
- /** @public */
137770
- function declarativeDashboardToYaml(entities, dashboard, filterContexts, context) {
137771
- const errorContext = updateErrorContext(context, {
137772
- type: "dashboard",
137773
- path: ["dashboard", dashboard.id],
137774
- data: {}
137775
- });
137776
- const content = dashboard.content;
137777
- const doc = new import_dist.Document({
137778
- type: "dashboard",
137779
- id: dashboard.id
137780
- });
137781
- doc.commentBefore = DASHBOARD_COMMENT;
137782
- const hasContentTabs = (content.tabs?.length ?? 0) > 0;
137783
- const hasRootContent = Boolean(content.layout || content.dateFilterConfig || content.dateFilterConfigs && content.dateFilterConfigs.length > 0 || content.attributeFilterConfigs && content.attributeFilterConfigs.length > 0 || content.measureValueFilterConfigs && content.measureValueFilterConfigs.length > 0 || content.parameters && content.parameters.length > 0);
137784
- const yamlVersion = hasContentTabs && !hasRootContent ? "3" : "2";
137785
- doc.add(entryWithSpace("version", yamlVersion));
137786
- fillOptionalMetaFields(doc, dashboard);
137787
- if (content.disableCrossFiltering) doc.add(entryWithSpace("cross_filtering", false));
137788
- if (content.disableUserFilterReset) doc.add(entryWithSpace("user_filters_reset", false));
137789
- if (content.disableUserFilterSave) doc.add(entryWithSpace("user_filters_save", false));
137790
- if (content.disableFilterViews) doc.add(entryWithSpace("filter_views", false));
137791
- if (content.disablePersistentFiltersAcrossTabs) doc.add(entryWithSpace("persistent_filters_across_tabs", false));
137792
- if (content.timezoneConfig) doc.add(entryWithSpace("timezone_config", declarativeTimezoneConfigToYaml(content.timezoneConfig)));
137793
- const hasMultipleTabs = content.tabs && content.tabs.length > 1;
137794
- const hasSingleTabWithTitle = content.tabs?.length === 1 && content.tabs[0].title;
137795
- const shouldUseTabs = hasMultipleTabs || hasSingleTabWithTitle;
137796
- if (content.tabs && shouldUseTabs) {
137797
- if (content.tabs[0].layout?.configuration?.sections?.enableHeader) doc.add(entryWithSpace("enable_section_headers", content.tabs[0].layout?.configuration?.sections?.enableHeader));
137798
- const tabs = declarativeTabsToYaml(content.tabs, filterContexts, entities, updateErrorContext(errorContext, { path: ["tabs"] }));
137799
- if (tabs) doc.add(entryWithSpace("tabs", tabs));
137800
- } else if (content.tabs?.length === 1) {
137801
- if (content.tabs[0].layout?.configuration?.sections?.enableHeader) doc.add(entryWithSpace("enable_section_headers", content.tabs[0].layout?.configuration?.sections?.enableHeader));
137802
- const tab = content.tabs[0];
137803
- const section = declarativeSectionsToYaml(tab.layout, entities, updateErrorContext(errorContext, { path: ["tabs", "0"] }));
137804
- if (section) doc.add(entryWithSpace("sections", section));
137805
- const filterContextId = tab.filterContextRef ? getIdentifier(tab.filterContextRef, true, updateErrorContext(errorContext, { path: ["filterContext"] })) : void 0;
137806
- const { filters, filtersMap } = declarativeFilterContextToYaml(tab.dateFilterConfig, filterContexts?.find((fc) => fc.id === filterContextId), updateErrorContext(errorContext, { path: ["dateFilterConfig"] }));
137807
- declarativeFiltersConfigToYaml$1(filtersMap, tab.dateFilterConfig, tab.dateFilterConfigs, tab.attributeFilterConfigs, tab.measureValueFilterConfigs, errorContext);
137808
- const groupedFilters = declarativeFilterGroupsToYaml(filters, tab.filterGroupsConfig);
137809
- if (groupedFilters.items.length > 0) doc.add(entryWithSpace("filters", groupedFilters));
137810
- } else {
137811
- if (content.layout?.configuration?.sections?.enableHeader) doc.add(entryWithSpace("enable_section_headers", content.layout?.configuration?.sections?.enableHeader));
137812
- const section = declarativeSectionsToYaml(content.layout, entities, updateErrorContext(errorContext, { path: ["layout"] }));
137813
- if (section) doc.add(entryWithSpace("sections", section));
137814
- const filterContextId = content.filterContextRef ? getIdentifier(content.filterContextRef, true, updateErrorContext(errorContext, { path: ["filterContext"] })) : void 0;
137815
- const { filters, filtersMap } = declarativeFilterContextToYaml(content.dateFilterConfig, filterContexts?.find((fc) => fc.id === filterContextId), updateErrorContext(errorContext, { path: ["dateFilterConfig"] }));
137816
- declarativeFiltersConfigToYaml$1(filtersMap, content.dateFilterConfig, content.dateFilterConfigs, content.attributeFilterConfigs, content.measureValueFilterConfigs, errorContext);
137817
- if (filters.items.length > 0) doc.add(entryWithSpace("filters", filters));
137818
- }
137819
- const plugins = declarativePluginsToYaml(content, updateErrorContext(errorContext, { path: ["plugins"] }));
137820
- if (plugins) doc.add(entryWithSpace("plugins", plugins));
137821
- const permissions = declarativePermissionsToYaml(doc, dashboard);
137822
- if (permissions) doc.add(entryWithSpace("permissions", permissions));
137823
- return {
137824
- content: doc.toString({ lineWidth: 0 }),
137825
- json: doc.toJSON()
137826
- };
138474
+ //#region ../../../sdk/libs/sdk-code-convertors/src/fillPublisherIdsV2.ts
138475
+ function isKey(pair, key) {
138476
+ return (0, import_dist.isScalar)(pair.key) ? pair.key.value === key : pair.key === key;
137827
138477
  }
137828
- /** @internal */
137829
- function declarativeTabsToYaml(tabs, filterContexts, entities, errorContext) {
137830
- if (!tabs || tabs.length === 0) return;
137831
- const yamlTabs = new import_dist.YAMLSeq();
137832
- tabs.forEach((tab, ti) => {
137833
- const yamlTab = new import_dist.YAMLMap();
137834
- const tabErrorContext = updateErrorContext(errorContext, { path: [ti.toString()] });
137835
- yamlTab.add(new import_dist.Pair("id", tab.localIdentifier));
137836
- yamlTab.add(new import_dist.Pair("title", tab.title));
137837
- let filterContext;
137838
- if (tab.filterContextRef && filterContexts?.length) {
137839
- const filterContextId = getIdentifier(tab.filterContextRef, true, tabErrorContext);
137840
- filterContext = filterContexts.find((fc) => fc.id === filterContextId);
137841
- }
137842
- if (filterContext) {
137843
- const { filters, filtersMap } = declarativeFilterContextToYaml(tab.dateFilterConfig, filterContext, updateErrorContext(tabErrorContext, { path: ["dateFilterConfig"] }));
137844
- declarativeFiltersConfigToYaml$1(filtersMap, tab.dateFilterConfig, tab.dateFilterConfigs, tab.attributeFilterConfigs, tab.measureValueFilterConfigs, tabErrorContext);
137845
- const groupedFilters = declarativeFilterGroupsToYaml(filters, tab.filterGroupsConfig);
137846
- if (groupedFilters.items.length > 0) yamlTab.add(new import_dist.Pair("filters", groupedFilters));
137847
- }
137848
- if (tab.layout) {
137849
- const sections = declarativeSectionsToYaml({ layout: tab.layout }.layout, entities, updateErrorContext(tabErrorContext, { path: ["layout"] }));
137850
- if (sections) yamlTab.add(new import_dist.Pair("sections", sections));
137851
- }
137852
- yamlTabs.add(yamlTab);
137853
- });
137854
- return yamlTabs;
138478
+ function isMissingId(node) {
138479
+ const id = node.get("id");
138480
+ return id === void 0 || id === null || id === "";
137855
138481
  }
137856
- /** @internal */
137857
- function declarativeSectionsToYaml(layout, entities, errorContext) {
137858
- if (!layout?.sections?.length) return;
137859
- const sections = new import_dist.YAMLSeq();
137860
- layout.sections.forEach((section, si) => {
137861
- const yamlSection = new import_dist.YAMLMap();
137862
- const sectionErrorContext = updateErrorContext(errorContext, { path: ["sections", si.toString()] });
137863
- if (section.header?.title) yamlSection.add(new import_dist.Pair("title", section.header.title));
137864
- if (section.header?.description) yamlSection.add(new import_dist.Pair("description", section.header.description));
137865
- if (section.items?.length) {
137866
- const items = new import_dist.YAMLSeq();
137867
- section.items.forEach((item, i) => {
137868
- const widget = declarativeWidgetToYaml(item.widget, item.size, entities, updateErrorContext(sectionErrorContext, { path: ["items", i.toString()] }));
137869
- if (widget) items.add(widget);
137870
- });
137871
- yamlSection.add(new import_dist.Pair("widgets", items));
137872
- }
137873
- sections.add(yamlSection);
137874
- });
137875
- return sections;
138482
+ function takenIds(nodes) {
138483
+ return new Set(nodes.filter((node) => !isMissingId(node)).map((node) => String(node.get("id"))));
137876
138484
  }
137877
- /** @internal */
137878
- function declarativeWidgetToYaml(widget, size, entities, errorContext) {
137879
- if (!widget) return;
137880
- switch (widget?.type) {
137881
- case "insight": return declarativeInsightWidgetToYaml(widget, size, entities, updateErrorContext(errorContext, { path: ["insight"] }));
137882
- case "richText": return declarativeRichTextWidgetToYaml(widget, size);
137883
- case "visualizationSwitcher": return declarativeVisualizationSwitcherWidgetToYaml(widget, size, entities, updateErrorContext(errorContext, { path: ["visualizationSwitcher"] }));
137884
- case "IDashboardLayout": return declarativeContainerWidgetToYaml(widget, size, entities, updateErrorContext(errorContext, { path: ["layout"] }));
137885
- default: throw newError("core.referenceTypeNotSupported", [String(widget?.type)], errorContext);
137886
- }
138485
+ function drawId(generate, taken) {
138486
+ let id = generate();
138487
+ while (taken.has(id)) id = generate();
138488
+ taken.add(id);
138489
+ return id;
137887
138490
  }
137888
- function declarativeInsightWidgetToYaml(widget, size, entities, errorContext) {
137889
- const yamlWidget = new import_dist.YAMLMap();
137890
- if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("id", widget.localIdentifier));
137891
- yamlWidget.add(new import_dist.Pair("visualization", getIdentifier(widget.insight, true, updateErrorContext(errorContext, { path: ["visualisation"] }))));
137892
- if (widget.configuration?.hideTitle) yamlWidget.add(new import_dist.Pair("title", false));
137893
- else if (widget.title) yamlWidget.add(new import_dist.Pair("title", widget.title));
137894
- if (widget.configuration?.description?.visible === false) yamlWidget.add(new import_dist.Pair("description", false));
137895
- else if (widget.configuration?.description?.source === "insight") {} else if (widget.description) yamlWidget.add(new import_dist.Pair("description", widget.description));
137896
- if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137897
- if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137898
- if (widget.dateDataSet) yamlWidget.add(new import_dist.Pair("date", getIdentifier(widget.dateDataSet, true, updateErrorContext(errorContext, { path: ["date"] }))));
137899
- if (widget.ignoreDashboardFilters?.length) yamlWidget.add(new import_dist.Pair("ignored_filters", widget.ignoreDashboardFilters.map((df, i) => {
137900
- return getIdentifier(dashboardFilterReferenceObjRef(df), void 0, updateErrorContext(errorContext, { path: ["ignoreDashboardFilters", i.toString()] }));
137901
- })));
137902
- if (widget.properties?.["controls"]?.zoomInsight) yamlWidget.add(new import_dist.Pair("zoom_data", true));
137903
- if (widget.drills?.length) {
137904
- const drills = new import_dist.YAMLSeq();
137905
- const sourceVisualizationId = getIdentifier(widget.insight, true, updateErrorContext(errorContext, { path: ["insight"] }));
137906
- widget.drills.forEach((drill, id) => {
137907
- drills.add(declarativeDrillToYaml(drill, entities, sourceVisualizationId, updateErrorContext(errorContext, { path: ["drills", id.toString()] })));
137908
- });
137909
- yamlWidget.add(new import_dist.Pair("interactions", drills));
137910
- }
137911
- if (widget.ignoredDrillDownHierarchies?.length) {
137912
- const ignores = widget.ignoredDrillDownHierarchies.map((hierarchy, hi) => declarativeIgnoreDrillDownHierarchyToYaml(hierarchy, updateErrorContext(errorContext, { path: ["ignoredDrillDownHierarchies", hi.toString()] })));
137913
- yamlWidget.add(new import_dist.Pair("ignored_drill_downs", ignores));
137914
- }
137915
- if (widget.drillDownIntersectionIgnoredAttributes?.length) {
137916
- const ignores = widget.drillDownIntersectionIgnoredAttributes.map((hierarchy, hi) => declarativeDrillDownIntersectionIgnoredAttributesToYaml(hierarchy, updateErrorContext(errorContext, { path: ["drillDownIntersectionIgnoredAttributes", hi.toString()] }))).filter(Boolean);
137917
- yamlWidget.add(new import_dist.Pair("ignored_drill_downs_intersections", ignores));
138491
+ /** An `id` key already written keeps its place and its comment; a new one goes after `after`, or first. */
138492
+ function placeId(node, id, after) {
138493
+ const written = node.items.find((item) => isKey(item, "id"));
138494
+ if (written !== void 0 && (0, import_dist.isScalar)(written.value)) {
138495
+ written.value.value = id;
138496
+ written.value.type = import_dist.Scalar.PLAIN;
138497
+ return;
137918
138498
  }
137919
- if (widget.ignoreCrossFiltering) yamlWidget.add(new import_dist.Pair("ignored_cross_filtering", true));
137920
- return yamlWidget;
137921
- }
137922
- function declarativeIgnoreDrillDownHierarchyToYaml(hierarchy, errorContext) {
137923
- if (isAttributeHierarchyReference(hierarchy)) return {
137924
- hierarchy: hierarchy.attributeHierarchy,
137925
- on: getIdentifier(hierarchy.attribute, void 0, updateErrorContext(errorContext, { path: ["attribute"] }))
137926
- };
137927
- return {
137928
- template: hierarchy.dateHierarchyTemplate,
137929
- on: getIdentifier(hierarchy.dateDatasetAttribute, void 0, updateErrorContext(errorContext, { path: ["dateDatasetAttribute"] }))
137930
- };
137931
- }
137932
- function declarativeDrillDownIntersectionIgnoredAttributesToYaml(hierarchy, errorContext) {
137933
- if (hierarchy.ignoredAttributes.length === 0) return null;
137934
- return {
137935
- attributes: hierarchy.ignoredAttributes,
137936
- hierarchy: declarativeIgnoreDrillDownHierarchyToYaml(hierarchy.drillDownReference, updateErrorContext(errorContext, { path: ["drillDownReference"] }))
137937
- };
137938
- }
137939
- function declarativeRichTextWidgetToYaml(widget, size) {
137940
- const yamlWidget = new import_dist.YAMLMap();
137941
- if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("id", widget.localIdentifier));
137942
- yamlWidget.add(new import_dist.Pair("content", widget.content));
137943
- if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137944
- if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137945
- return yamlWidget;
137946
- }
137947
- function declarativeTimezoneConfigToYaml(config) {
137948
- return {
137949
- ...config.timezoneId ? { timezone_id: config.timezoneId } : {},
137950
- ...config.showTimezoneInfo ? { show_timezone_info: config.showTimezoneInfo } : { show_timezone_info: false },
137951
- ...config.allowUserOverrideInViewMode ? { allow_user_override_in_view_mode: config.allowUserOverrideInViewMode } : { allow_user_override_in_view_mode: false }
137952
- };
137953
- }
137954
- function declarativeVisualizationSwitcherWidgetToYaml(widget, size, entities, errorContext) {
137955
- const yamlWidget = new import_dist.YAMLMap();
137956
- if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("id", widget.localIdentifier));
137957
- yamlWidget.add(new import_dist.Pair("visualizations", widget.visualizations.map((vis, vi) => declarativeInsightWidgetToYaml(vis, void 0, entities, updateErrorContext(errorContext, { path: ["visualizations", vi.toString()] })))));
137958
- if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137959
- if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137960
- return yamlWidget;
137961
- }
137962
- function declarativeContainerWidgetToYaml(widget, size, entities, errorContext) {
137963
- const yamlWidget = new import_dist.YAMLMap();
137964
- if (widget.localIdentifier) yamlWidget.add(new import_dist.Pair("container", widget.localIdentifier));
137965
- if (size?.xl?.gridWidth) yamlWidget.add(new import_dist.Pair("columns", size.xl.gridWidth));
137966
- if (size?.xl?.gridHeight) yamlWidget.add(new import_dist.Pair("rows", size.xl.gridHeight));
137967
- if (widget.configuration?.direction) yamlWidget.add(new import_dist.Pair("layout_direction", widget.configuration?.direction));
137968
- if (widget.configuration?.sections) yamlWidget.add(new import_dist.Pair("enable_section_headers", widget.configuration.sections.enableHeader));
137969
- if (widget.sections?.length) {
137970
- const nestedSections = new import_dist.YAMLSeq();
137971
- widget.sections.forEach((section, si) => {
137972
- const yamlSection = new import_dist.YAMLMap();
137973
- if (section.header?.title) yamlSection.add(new import_dist.Pair("title", section.header.title));
137974
- if (section.header?.description) yamlSection.add(new import_dist.Pair("description", section.header.description));
137975
- if (section.items?.length) {
137976
- const widgets = new import_dist.YAMLSeq();
137977
- section.items.forEach((item, ii) => {
137978
- const yamlNestedWidget = declarativeWidgetToYaml(item.widget, item.size, entities, updateErrorContext(errorContext, { path: [
137979
- "sections",
137980
- si.toString(),
137981
- "items",
137982
- ii.toString()
137983
- ] }));
137984
- if (yamlNestedWidget) widgets.add(yamlNestedWidget);
137985
- });
137986
- yamlSection.add(new import_dist.Pair("widgets", widgets));
137987
- }
137988
- nestedSections.add(yamlSection);
137989
- });
137990
- yamlWidget.add(new import_dist.Pair("sections", nestedSections));
138499
+ if (written !== void 0) {
138500
+ written.value = new import_dist.Scalar(id);
138501
+ return;
137991
138502
  }
137992
- return yamlWidget;
138503
+ const position = after === void 0 ? 0 : node.items.findIndex((item) => isKey(item, after)) + 1;
138504
+ node.items.splice(position, 0, new import_dist.Pair(new import_dist.Scalar("id"), new import_dist.Scalar(id)));
138505
+ }
138506
+ function maps(value) {
138507
+ return (0, import_dist.isSeq)(value) ? value.items.filter((item) => (0, import_dist.isMap)(item)) : [];
138508
+ }
138509
+ function layoutNodes(node) {
138510
+ if (!(0, import_dist.isMap)(node)) return [];
138511
+ const type = node.get("type");
138512
+ return type === "row" || type === "column" ? maps(node.get("children")).flatMap(layoutNodes) : [node];
138513
+ }
138514
+ function fillMissing(nodes, { generate, taken, after }) {
138515
+ const missing = nodes.filter(isMissingId);
138516
+ for (const node of missing) placeId(node, drawId(generate, taken), after);
138517
+ return missing.length > 0;
138518
+ }
138519
+ function fillWidgetIds(layout) {
138520
+ const widgets = layoutNodes(layout);
138521
+ return fillMissing(widgets, {
138522
+ generate: newPublisherWidgetIdV2,
138523
+ taken: takenIds(widgets),
138524
+ after: "type"
138525
+ });
138526
+ }
138527
+ function fillContentIds(type, content) {
138528
+ if (!(0, import_dist.isMap)(content)) return false;
138529
+ if (type === "page_template") return fillWidgetIds(content.get("layout"));
138530
+ if (type !== "document" && type !== "document_template") return false;
138531
+ const sections = maps(content.get("sections"));
138532
+ const pages = [...maps(content.get("pages")), ...sections.flatMap((section) => maps(section.get("pages")))];
138533
+ const taken = takenIds([...sections, ...pages]);
138534
+ const filledSections = fillMissing(sections, {
138535
+ generate: newPublisherSectionIdV2,
138536
+ taken
138537
+ });
138538
+ const filledPages = fillMissing(pages, {
138539
+ generate: newPublisherPageIdV2,
138540
+ taken
138541
+ });
138542
+ const filledWidgets = pages.map((page) => fillWidgetIds(page.get("layout"))).some(Boolean);
138543
+ return filledSections || filledPages || filledWidgets;
138544
+ }
138545
+ /** The indent width the source uses: how far a block map's keys sit right of their parent key. */
138546
+ function indentOf(document, lineCounter) {
138547
+ let indent;
138548
+ (0, import_dist.visit)(document, { Pair(_, pair) {
138549
+ const [first] = (0, import_dist.isMap)(pair.value) && !pair.value.flow ? pair.value.items : [];
138550
+ if (indent === void 0 && (0, import_dist.isScalar)(pair.key) && pair.key.range && (0, import_dist.isScalar)(first?.key) && first.key.range) indent = lineCounter.linePos(first.key.range[0]).col - lineCounter.linePos(pair.key.range[0]).col;
138551
+ } });
138552
+ return indent !== void 0 && indent > 0 ? indent : 2;
137993
138553
  }
137994
- /** @internal */
137995
- function declarativeDrillToYaml(drill, entities, sourceVisualizationId, errorContext) {
137996
- const drillYaml = new import_dist.YAMLMap();
137997
- const originIdentifier = drill.origin.type === "drillFromMeasure" ? drill.origin.measure : drill.origin.attribute;
137998
- const originPath = drill.origin.type === "drillFromMeasure" ? "measure" : "attribute";
137999
- drillYaml.add(new import_dist.Pair("click_on", getIdentifier(originIdentifier, void 0, updateErrorContext(errorContext, { path: ["origin", originPath] }))));
138000
- if (isDrillToInsight(drill)) {
138001
- drillYaml.add(new import_dist.Pair("open_visualization", getIdentifier(drill.target, true, updateErrorContext(errorContext, { path: ["target"] }))));
138002
- const filters = drillFiltersToYaml(drill, entities, sourceVisualizationId, errorContext);
138003
- if (filters) drillYaml.add(new import_dist.Pair("filters", filters));
138004
- return drillYaml;
138005
- }
138006
- if (isDrillToDashboard(drill) && drill.target) {
138007
- const dashboardDrill = drill;
138008
- drillYaml.add(new import_dist.Pair("open_dashboard", getIdentifier(drill.target, true, updateErrorContext(errorContext, { path: ["target"] }))));
138009
- if (drill.targetTabLocalIdentifier) drillYaml.add(new import_dist.Pair("open_dashboard_tab", drill.targetTabLocalIdentifier));
138010
- const filters = drillFiltersToYaml(dashboardDrill, entities, sourceVisualizationId, errorContext);
138011
- if (filters) drillYaml.add(new import_dist.Pair("filters", filters));
138012
- return drillYaml;
138013
- }
138014
- if (isDrillToCustomUrl(drill)) {
138015
- if (drill.drillIntersectionIgnoredAttributes?.length) {
138016
- const attrs = new import_dist.YAMLSeq();
138017
- drill.drillIntersectionIgnoredAttributes.forEach((attr) => attrs.add(attr));
138018
- drillYaml.add(new import_dist.Pair("ignored_intersection_attributes", attrs));
138019
- }
138020
- drillYaml.add(new import_dist.Pair("open_url", serializeUrlTarget(drill.target.url)));
138021
- return drillYaml;
138022
- }
138023
- if (isDrillToAttributeUrl(drill)) {
138024
- if (drill.drillIntersectionIgnoredAttributes?.length) {
138025
- const attrs = new import_dist.YAMLSeq();
138026
- drill.drillIntersectionIgnoredAttributes.forEach((attr) => attrs.add(attr));
138027
- drillYaml.add(new import_dist.Pair("ignored_intersection_attributes", attrs));
138554
+ /** True when block sequence items are written at their parent key's column (`key:` then `- item`). */
138555
+ function hasUnindentedSequences(document, lineCounter) {
138556
+ let unindented = false;
138557
+ (0, import_dist.visit)(document, { Pair(_, pair) {
138558
+ if ((0, import_dist.isScalar)(pair.key) && (0, import_dist.isSeq)(pair.value) && !pair.value.flow && pair.key.range && pair.value.range) {
138559
+ const keyColumn = lineCounter.linePos(pair.key.range[0]).col;
138560
+ unindented ||= keyColumn === lineCounter.linePos(pair.value.range[0]).col;
138028
138561
  }
138029
- drillYaml.add(new import_dist.Pair("open_url", {
138030
- label: getIdentifier(drill.target.displayForm, void 0, updateErrorContext(errorContext, { path: ["target", "displayForm"] })),
138031
- href: getIdentifier(drill.target.hyperlinkDisplayForm, void 0, updateErrorContext(errorContext, { path: ["target", "hyperlinkDisplayForm"] }))
138032
- }));
138033
- return drillYaml;
138034
- }
138035
- return drillYaml;
138036
- }
138037
- function drillFiltersToYaml(drill, entities, sourceVisualizationId, errorContext) {
138038
- const filtersYaml = new import_dist.YAMLMap();
138039
- const excludeYaml = new import_dist.YAMLMap();
138040
- const includeYaml = new import_dist.YAMLMap();
138041
- if (drill.drillIntersectionIgnoredAttributes?.length) {
138042
- const attrs = new import_dist.YAMLSeq();
138043
- drill.drillIntersectionIgnoredAttributes.forEach((attr) => attrs.add(attr));
138044
- excludeYaml.add(new import_dist.Pair("drilled_datapoint", attrs));
138045
- }
138046
- if (drill.ignoredDashboardFilters?.length) {
138047
- const filters = new import_dist.YAMLSeq();
138048
- drill.ignoredDashboardFilters.forEach((filter) => filters.add(filter));
138049
- excludeYaml.add(new import_dist.Pair("dashboard_filters", filters));
138050
- }
138051
- if (drill.includedSourceInsightFiltersObjRefs?.length) includeYaml.add(new import_dist.Pair("visualization_filters", filterRefsToYaml(drill.includedSourceInsightFiltersObjRefs, entities, sourceVisualizationId, updateErrorContext(errorContext, { path: ["includedSourceInsightFiltersObjRefs"] }))));
138052
- if (drill.includedSourceMeasureFiltersObjRefs?.length) includeYaml.add(new import_dist.Pair("metric_filters", sourceMeasureFilterRefsToYaml(drill.includedSourceMeasureFiltersObjRefs, entities, sourceVisualizationId, updateErrorContext(errorContext, { path: ["includedSourceMeasureFiltersObjRefs"] }))));
138053
- if (excludeYaml.items.length) filtersYaml.add(new import_dist.Pair("exclude", excludeYaml));
138054
- if (includeYaml.items.length) filtersYaml.add(new import_dist.Pair("include", includeYaml));
138055
- return filtersYaml.items.length ? filtersYaml : null;
138056
- }
138057
- function filterRefsToYaml(refs, entities, sourceVisualizationId, errorContext) {
138058
- const filters = (entities?.find((entity) => VisualisationsTypes.includes(entity.type) && entity.id === sourceVisualizationId)?.data)?.query?.filter_by;
138059
- return refs.map((ref) => findSourceInsightFilterId(filters, ref, errorContext) ?? sourceInsightFilterRefFallbackId(ref, errorContext)).filter(Boolean);
138060
- }
138061
- function findSourceInsightFilterId(filters, ref, errorContext) {
138062
- if (!filters) return;
138063
- return Object.entries(filters).find(([_, filter]) => matchesSourceInsightFilterRef(filter, ref, errorContext))?.[0];
138064
- }
138065
- function matchesSourceInsightFilterRef(filter, ref, errorContext) {
138066
- switch (ref.type) {
138067
- case "attributeFilter": return filter.type === "attribute_filter" && filter.using === getIdentifier(ref["label"], void 0, updateErrorContext(errorContext, { path: ["attributeFilter"] }));
138068
- case "dateFilter": return filter.type === "date_filter" && filter.using === getIdentifier(ref["dataSet"], true, updateErrorContext(errorContext, { path: ["dateFilter"] }));
138069
- case "measureValueFilter": return filter.type === "metric_value_filter" && filter.using === getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["measureValueFilter"] }));
138070
- case "rankingFilter": return filter.type === "ranking_filter" && filter.using === getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["rankingFilter"] }));
138071
- default: return false;
138072
- }
138073
- }
138074
- function sourceInsightFilterRefFallbackId(ref, errorContext) {
138075
- switch (ref.type) {
138076
- case "attributeFilter": return getIdentifier(ref["label"], void 0, updateErrorContext(errorContext, { path: ["attributeFilter"] }));
138077
- case "dateFilter": return getIdentifier(ref["dataSet"], true, updateErrorContext(errorContext, { path: ["dateFilter"] }));
138078
- case "measureValueFilter": return getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["measureValueFilter"] }));
138079
- case "rankingFilter": return getIdentifier(ref["measure"], void 0, updateErrorContext(errorContext, { path: ["rankingFilter"] }));
138080
- default: return null;
138081
- }
138082
- }
138083
- function sourceMeasureFilterRefsToYaml(refs, entities, sourceVisualizationId, errorContext) {
138084
- const visualisation = entities?.find((entity) => VisualisationsTypes.includes(entity.type) && entity.id === sourceVisualizationId)?.data;
138085
- const fieldFilters = collectFieldLevelFilters(visualisation);
138086
- return refs.map((ref) => findSourceInsightFilterId(fieldFilters, ref, errorContext) ?? sourceInsightFilterRefFallbackId(ref, errorContext)).filter(Boolean);
138562
+ } });
138563
+ return unindented;
138087
138564
  }
138088
- function getDateFilterEmptyValueHandling(filter) {
138089
- const value = filter.dateFilter.emptyValueHandling;
138090
- if (value === "include" || value === "exclude" || value === "only") return value;
138565
+ /** The first line break decides which one the whole output uses. */
138566
+ function usesCrlf(content) {
138567
+ const firstBreak = content.indexOf("\n");
138568
+ return firstBreak > 0 && content[firstBreak - 1] === "\r";
138091
138569
  }
138092
- /** @internal */
138093
- function declarativeFilterContextToYaml(dateFilterConfig, filterContext, errorContext) {
138094
- const filters = [];
138095
- const filtersMap = {};
138096
- const declarativeFilters = (filterContext ? filterContext.content : void 0)?.filters ?? [];
138097
- declarativeFilters.forEach((filter) => {
138098
- if (isDashboardCommonDateFilter(filter) && isNoopAllTimeDashboardDateFilter(filter)) return;
138099
- const key = createFilterContextItemKeyName(filter, "date", updateErrorContext(errorContext, { path: ["date"] }));
138100
- if (isDashboardDateFilter$1(filter)) {
138101
- const def = declarativeDateFilterToYaml(filter, errorContext);
138102
- filters.push(new import_dist.Pair(key, def));
138103
- filtersMap[key] = {
138104
- yaml: def,
138105
- filter
138106
- };
138107
- }
138108
- if (isDashboardAttributeFilter$1(filter)) {
138109
- const def = declarativeAttributeFilterToYaml(filter, errorContext);
138110
- filters.push(new import_dist.Pair(key, def));
138111
- filtersMap[key] = {
138112
- yaml: def,
138113
- filter
138114
- };
138115
- }
138116
- if (isDashboardArbitraryAttributeFilter(filter)) {
138117
- const def = declarativeArbitraryTextFilterToYaml(filter, errorContext);
138118
- filters.push(new import_dist.Pair(key, def));
138119
- filtersMap[key] = {
138120
- yaml: def,
138121
- filter
138122
- };
138123
- }
138124
- if (isDashboardMatchAttributeFilter(filter)) {
138125
- const def = declarativeMatchTextFilterToYaml(filter, errorContext);
138126
- filters.push(new import_dist.Pair(key, def));
138127
- filtersMap[key] = {
138128
- yaml: def,
138129
- filter
138130
- };
138131
- }
138132
- if (isDashboardMeasureValueFilter(filter)) {
138133
- const def = declarativeMeasureValueFilterToYaml$1(filter, errorContext);
138134
- filters.push(new import_dist.Pair(key, def));
138135
- filtersMap[key] = {
138136
- yaml: def,
138137
- filter
138138
- };
138139
- }
138140
- });
138141
- if (!declarativeFilters.find(isDashboardCommonDateFilter) && dateFilterConfig) {
138142
- const filter = { dateFilter: {
138143
- granularity: "GDC.time.date",
138144
- type: "absolute"
138145
- } };
138146
- const key = createFilterContextItemKeyName(filter, "common", updateErrorContext(errorContext, { path: ["common"] }));
138147
- const def = declarativeDateFilterToYaml(filter, errorContext);
138148
- filters.unshift(new import_dist.Pair(key, def));
138149
- filtersMap[key] = {
138150
- yaml: def,
138151
- filter
138152
- };
138153
- }
138154
- Object.values(filtersMap).forEach(({ filter, yaml }) => {
138155
- if (isDashboardAttributeFilter$1(filter) || isDashboardArbitraryAttributeFilter(filter)) {
138156
- const filterBody = isDashboardAttributeFilter$1(filter) ? filter.attributeFilter : filter.arbitraryAttributeFilter;
138157
- const attrsIds = filterBody.filterElementsBy?.map((element) => {
138158
- return element.filterLocalIdentifier ?? null;
138159
- }).filter(Boolean);
138160
- const datesIds = filterBody.filterElementsByDate?.map((element) => {
138161
- if (!element.isCommonDate && element.filterLocalIdentifier) return {
138162
- using: element.filterLocalIdentifier,
138163
- common: element.isCommonDate
138164
- };
138165
- if (element.isCommonDate && element.dataSet) return {
138166
- using: element.filterLocalIdentifier,
138167
- common: true,
138168
- date: getIdentifier(element.dataSet, true, errorContext)
138169
- };
138170
- return element.filterLocalIdentifier ?? null;
138171
- }).filter(Boolean);
138172
- const ids = [...attrsIds ?? [], ...datesIds ?? []];
138173
- if (ids?.length) yaml.add(new import_dist.Pair("parents", ids));
138174
- const metricsIds = filterBody.validateElementsBy?.map((element, i) => getIdentifier(element, void 0, updateErrorContext(errorContext, { path: ["validateElementsBy", i.toString()] }))).filter(Boolean);
138175
- if (metricsIds?.length) yaml.add(new import_dist.Pair("metric_filters", metricsIds));
138176
- }
138570
+ /**
138571
+ * Adds the section, page and widget ids a v2 document, document template or page template as code
138572
+ * leaves out, so the YAML written by hand states the ids the stored entity keeps. An id counts as
138573
+ * missing when it is absent, null or empty. Comments and the indent width survive, the line break of
138574
+ * the first line is applied to the whole file, and the sequence style survives too, except that
138575
+ * unindented sequences are kept only at a 2-space indent and the compact `- ` style is not kept.
138576
+ * Block scalars take the indent width of the maps. Content that needs no id, or does not parse,
138577
+ * comes back unchanged.
138578
+ *
138579
+ * @alpha
138580
+ */
138581
+ function fillPublisherIdsV2(content) {
138582
+ const lineCounter = new import_dist.LineCounter();
138583
+ const document = (0, import_dist.parseDocument)(content, { lineCounter });
138584
+ if (document.errors.length > 0 || !(0, import_dist.isMap)(document.contents)) return {
138585
+ content,
138586
+ changed: false
138587
+ };
138588
+ if (!fillContentIds(document.contents.get("type"), document.contents.get("content"))) return {
138589
+ content,
138590
+ changed: false
138591
+ };
138592
+ const written = document.toString({
138593
+ indent: indentOf(document, lineCounter),
138594
+ indentSeq: !hasUnindentedSequences(document, lineCounter),
138595
+ lineWidth: 0
138177
138596
  });
138178
138597
  return {
138179
- filters: filters.reduce((map, filter) => {
138180
- map.add(filter);
138181
- return map;
138182
- }, new import_dist.YAMLMap()),
138183
- filtersMap
138598
+ content: usesCrlf(content) ? written.replace(/\n/g, "\r\n") : written,
138599
+ changed: true
138184
138600
  };
138185
138601
  }
138186
- function declarativeDateFilterToYaml(filter, errorContext) {
138187
- const dateFilter = new import_dist.YAMLMap();
138188
- dateFilter.add(new import_dist.Pair("type", "date_filter"));
138189
- const gran = parseGranularity(filter.dateFilter.granularity ?? "GDC.time.date");
138190
- if (gran !== "DAY") dateFilter.add(new import_dist.Pair("granularity", gran));
138191
- if (filter.dateFilter.dataSet) dateFilter.add(new import_dist.Pair("date", getIdentifier(filter.dateFilter.dataSet, true, updateErrorContext(errorContext, { path: ["date"] }))));
138192
- if (isRelativeDashboardDateFilter(filter)) {
138193
- if (typeof filter.dateFilter.from === "number" && typeof filter.dateFilter.to === "number") {
138194
- dateFilter.add(new import_dist.Pair("from", parseInt(String(filter.dateFilter.from), 10)));
138195
- dateFilter.add(new import_dist.Pair("to", parseInt(String(filter.dateFilter.to), 10)));
138196
- }
138197
- } else {
138198
- if (filter.dateFilter.from) dateFilter.add(new import_dist.Pair("from", filter.dateFilter.from));
138199
- if (filter.dateFilter.to) dateFilter.add(new import_dist.Pair("to", filter.dateFilter.to));
138200
- }
138201
- const emptyValueHandling = getDateFilterEmptyValueHandling(filter);
138202
- if (emptyValueHandling) dateFilter.add(new import_dist.Pair("empty_values", emptyValueHandling));
138203
- return dateFilter;
138204
- }
138205
- function declarativeAttributeFilterToYaml(filter, errorContext) {
138206
- const attributeFilter = new import_dist.YAMLMap();
138207
- attributeFilter.add(new import_dist.Pair("type", "attribute_filter"));
138208
- if (filter.attributeFilter.title) attributeFilter.add(new import_dist.Pair("title", filter.attributeFilter.title));
138209
- const attributeId = getIdentifier(filter.attributeFilter.displayForm, void 0, updateErrorContext(errorContext, { path: ["attributeFilter", "displayForm"] }));
138210
- attributeFilter.add(new import_dist.Pair("using", attributeId));
138211
- if (filter.attributeFilter.selectionMode === "single") attributeFilter.add(new import_dist.Pair("multiselect", false));
138212
- let values = [];
138213
- if (isAttributeElementsByValue(filter.attributeFilter.attributeElements)) values = filter.attributeFilter.attributeElements.values;
138214
- if (isAttributeElementsByRef(filter.attributeFilter.attributeElements)) values = filter.attributeFilter.attributeElements.uris;
138215
- if (!filter.attributeFilter.negativeSelection) {
138216
- const state = new import_dist.YAMLMap();
138217
- state.add(new import_dist.Pair("include", values));
138218
- attributeFilter.add(new import_dist.Pair("state", state));
138219
- }
138220
- if (filter.attributeFilter.negativeSelection && values.length) {
138221
- const state = new import_dist.YAMLMap();
138222
- state.add(new import_dist.Pair("exclude", values));
138223
- attributeFilter.add(new import_dist.Pair("state", state));
138224
- }
138225
- return attributeFilter;
138226
- }
138227
- function declarativeArbitraryTextFilterToYaml(filter, errorContext) {
138228
- const textFilter = new import_dist.YAMLMap();
138229
- textFilter.add(new import_dist.Pair("type", "text_filter"));
138230
- if (filter.arbitraryAttributeFilter.title) textFilter.add(new import_dist.Pair("title", filter.arbitraryAttributeFilter.title));
138231
- textFilter.add(new import_dist.Pair("using", getIdentifier(filter.arbitraryAttributeFilter.displayForm, void 0, updateErrorContext(errorContext, { path: ["arbitraryAttributeFilter", "displayForm"] }))));
138232
- textFilter.add(new import_dist.Pair("condition", filter.arbitraryAttributeFilter.negativeSelection ? "isNot" : "is"));
138233
- textFilter.add(new import_dist.Pair("values", filter.arbitraryAttributeFilter.values));
138234
- return textFilter;
138235
- }
138236
- function declarativeMatchTextFilterToYaml(filter, errorContext) {
138237
- const textFilter = new import_dist.YAMLMap();
138238
- textFilter.add(new import_dist.Pair("type", "text_filter"));
138239
- if (filter.matchAttributeFilter.title) textFilter.add(new import_dist.Pair("title", filter.matchAttributeFilter.title));
138240
- textFilter.add(new import_dist.Pair("using", getIdentifier(filter.matchAttributeFilter.displayForm, void 0, updateErrorContext(errorContext, { path: ["matchAttributeFilter", "displayForm"] }))));
138241
- textFilter.add(new import_dist.Pair("condition", matchConditionToYaml(filter.matchAttributeFilter.operator, filter.matchAttributeFilter.negativeSelection)));
138242
- textFilter.add(new import_dist.Pair("value", filter.matchAttributeFilter.literal));
138243
- if (filter.matchAttributeFilter.caseSensitive !== void 0) textFilter.add(new import_dist.Pair("case_sensitive", filter.matchAttributeFilter.caseSensitive));
138244
- return textFilter;
138245
- }
138246
- function measureValueConditionToYaml(condition) {
138247
- const yamlCondition = new import_dist.YAMLMap();
138248
- if (isComparisonCondition(condition)) {
138249
- yamlCondition.add(new import_dist.Pair("condition", condition.comparison.operator));
138250
- yamlCondition.add(new import_dist.Pair("value", condition.comparison.value));
138251
- } else if (isRangeCondition(condition)) {
138252
- yamlCondition.add(new import_dist.Pair("condition", condition.range.operator));
138253
- yamlCondition.add(new import_dist.Pair("from", condition.range.from));
138254
- yamlCondition.add(new import_dist.Pair("to", condition.range.to));
138255
- }
138256
- return yamlCondition;
138257
- }
138258
- function conditionHasTreatNullValuesAs(condition) {
138259
- if (isComparisonCondition(condition)) return condition.comparison.treatNullValuesAs !== void 0;
138260
- if (isRangeCondition(condition)) return condition.range.treatNullValuesAs !== void 0;
138261
- return false;
138262
- }
138263
- function declarativeMeasureValueFilterToYaml$1(filter, errorContext) {
138264
- const measureValueFilter = new import_dist.YAMLMap();
138265
- measureValueFilter.add(new import_dist.Pair("type", "metric_value_filter"));
138266
- if (filter.dashboardMeasureValueFilter.title) measureValueFilter.add(new import_dist.Pair("title", filter.dashboardMeasureValueFilter.title));
138267
- measureValueFilter.add(new import_dist.Pair("using", getIdentifier(filter.dashboardMeasureValueFilter.measure, void 0, updateErrorContext(errorContext, { path: ["dashboardMeasureValueFilter", "measure"] }))));
138268
- const conditions = filter.dashboardMeasureValueFilter.conditions ?? [];
138269
- if (conditions.length > 0) {
138270
- const conditionsSeq = new import_dist.YAMLSeq();
138271
- conditions.forEach((c) => conditionsSeq.add(measureValueConditionToYaml(c)));
138272
- measureValueFilter.add(new import_dist.Pair("conditions", conditionsSeq));
138273
- }
138274
- if (filter.dashboardMeasureValueFilter.dimensionality?.length) {
138275
- const dimensionalitySeq = new import_dist.YAMLSeq();
138276
- filter.dashboardMeasureValueFilter.dimensionality.forEach((item, i) => {
138277
- dimensionalitySeq.add(getIdentifier(item, void 0, updateErrorContext(errorContext, { path: [
138278
- "dashboardMeasureValueFilter",
138279
- "dimensionality",
138280
- i.toString()
138281
- ] })));
138282
- });
138283
- measureValueFilter.add(new import_dist.Pair("dimensionality", dimensionalitySeq));
138284
- }
138285
- if (conditions.some(conditionHasTreatNullValuesAs)) measureValueFilter.add(new import_dist.Pair("null_values_as_zero", true));
138286
- return measureValueFilter;
138287
- }
138288
- /** @internal */
138289
- function declarativeFiltersConfigToYaml$1(filtersMap, dateFilterConfig, dateFilterConfigs, attributeFilterConfigs, measureValueFilterConfigs, errorContext) {
138290
- attributeFilterConfigs?.forEach((filterSettings, i) => {
138291
- const filter = filtersMap[filterSettings.localIdentifier];
138292
- if (filter) {
138293
- if (filterSettings.mode && filterSettings.mode !== "active") filter.yaml.add(new import_dist.Pair("mode", filterSettings.mode));
138294
- if (filterSettings.displayAsLabel) filter.yaml.add(new import_dist.Pair("display_as", getIdentifier(filterSettings.displayAsLabel, void 0, updateErrorContext(errorContext, { path: [
138295
- "attributeFilterConfig",
138296
- i.toString(),
138297
- "displayAsLabel"
138298
- ] }))));
138299
- if (filterSettings.selectionType) filter.yaml.add(new import_dist.Pair("selection_type", filterSettings.selectionType));
138300
- }
138301
- });
138302
- dateFilterConfigs?.forEach((filterSettings, i) => {
138303
- const filter = Object.values(filtersMap).find((filter) => filter.yaml.get("date") === getIdentifier(filterSettings.dateDataSet, true, updateErrorContext(errorContext, { path: [
138304
- "dateFilterConfig",
138305
- i.toString(),
138306
- "dateDataSet"
138307
- ] })));
138308
- fillDateFilterConfig(filterSettings.config, filter);
138309
- });
138310
- if (dateFilterConfig) fillDateFilterConfig(dateFilterConfig, Object.values(filtersMap).find((filter) => filter.yaml.get("type") === "date_filter" && !filter.yaml.get("date")));
138311
- measureValueFilterConfigs?.forEach((filterSettings) => {
138312
- const filter = filtersMap[filterSettings.localIdentifier];
138313
- if (filter && filterSettings.mode && filterSettings.mode !== "active") filter.yaml.add(new import_dist.Pair("mode", filterSettings.mode));
138314
- });
138315
- }
138316
- function fillDateFilterConfig(config, filter) {
138317
- if (!filter || !config) return;
138318
- if (config.mode !== "active") filter.yaml.add(new import_dist.Pair("mode", config.mode));
138319
- if (config.filterName) filter.yaml.add(new import_dist.Pair("title", config.filterName));
138320
- }
138321
- function declarativeFilterGroupsToYaml(filters, filterGroupsConfig) {
138322
- if (!filterGroupsConfig) return filters;
138323
- const sanitizedGroupIds = sanitizeGroupIds(filterGroupsConfig.groups.map((group) => [group, getFilterGroupIdBase(group)]));
138324
- const groupedFilters = new import_dist.YAMLMap();
138325
- filters.items.forEach((filter) => {
138326
- const groupConfig = filterGroupsConfig.groups.find((group) => group.filters.some(({ filterLocalIdentifier }) => filterLocalIdentifier === filter.key));
138327
- if (!groupConfig) {
138328
- groupedFilters.add(filter);
138329
- return;
138330
- }
138331
- const groupWithId = sanitizedGroupIds.find(([group]) => group === groupConfig);
138332
- if (!groupWithId) throw new Error(`Failed to generate id for filter group ${groupConfig.title}`);
138333
- const [_, groupId] = groupWithId;
138334
- const existingGroup = groupedFilters.get(groupId);
138335
- if (existingGroup) existingGroup.get("filters").add(filter);
138336
- else {
138337
- const newGroup = new import_dist.YAMLMap();
138338
- newGroup.add(new import_dist.Pair("type", "filter_group"));
138339
- newGroup.add(new import_dist.Pair("title", groupConfig.title));
138340
- const filtersInGroup = new import_dist.YAMLMap();
138341
- filtersInGroup.add(filter);
138342
- newGroup.add(new import_dist.Pair("filters", filtersInGroup));
138343
- groupedFilters.add(new import_dist.Pair(groupId, newGroup));
138344
- }
138345
- });
138346
- return groupedFilters;
138347
- }
138348
- function sanitizeGroupIds(filterGroupIds) {
138349
- const equalClusters = {};
138350
- filterGroupIds.forEach(([_, thisId]) => {
138351
- const cluster = filterGroupIds.filter(([_, id]) => thisId === id).map(([filterGroup]) => filterGroup);
138352
- if (cluster.length > 1) equalClusters[thisId] = cluster;
138353
- });
138354
- if (Object.keys(equalClusters).length === 0) return filterGroupIds;
138355
- return sanitizeGroupIds(filterGroupIds.map(([filterGroup, oldId]) => {
138356
- if (filterGroup.localIdentifier) return [filterGroup, filterGroup.localIdentifier];
138357
- const cluster = equalClusters[oldId];
138358
- if (!cluster?.length) return [filterGroup, oldId];
138359
- return [filterGroup, `${oldId}_${cluster.filter((group) => !group.localIdentifier).findIndex((group) => group === filterGroup) + 1}`];
138360
- }));
138361
- }
138362
- function getFilterGroupIdBase({ title, localIdentifier }) {
138363
- if (localIdentifier) return localIdentifier;
138364
- return title.normalize().replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
138365
- }
138366
- /** @internal */
138367
- function declarativePluginsToYaml(dashboard, errorContext) {
138368
- if (!dashboard.plugins?.length) return;
138369
- const plugins = new import_dist.YAMLSeq();
138370
- dashboard.plugins.forEach((plugin, i) => {
138371
- const pluginId = getIdentifier(plugin.plugin, true, updateErrorContext(errorContext, { path: [i.toString(), "plugin"] }));
138372
- if (plugin.parameters?.length) plugins.add({
138373
- id: pluginId,
138374
- parameters: parseParameters(plugin.parameters)
138375
- });
138376
- else plugins.add(pluginId);
138377
- });
138378
- return plugins;
138379
- }
138380
- function declarativePermissionsToYaml(doc, dashboard) {
138381
- const permissions = fromDeclarativePermissions(dashboard.permissions);
138382
- if (!permissions) return;
138383
- return doc.createNode(permissions);
138384
- }
138385
- function parseParameters(params) {
138386
- try {
138387
- return JSON.parse(params);
138388
- } catch {
138389
- return params;
138390
- }
138391
- }
138392
138602
  //#endregion
138393
138603
  //#region ../../../sdk/libs/sdk-code-convertors/src/to/yamlDatasetToDeclarative.ts
138394
138604
  /**
@@ -145449,7 +145659,10 @@ function collectItemReferences(item) {
145449
145659
  case "attribute_hierarchy": return resolveAttributeHierarchyReferences(item);
145450
145660
  case "report":
145451
145661
  case "report_template":
145452
- case "report_page_layout": return [];
145662
+ case "report_page_layout":
145663
+ case "document":
145664
+ case "document_template":
145665
+ case "page_template": return [];
145453
145666
  case void 0: return [];
145454
145667
  default: assertUnreachable$1(item);
145455
145668
  }
@@ -147155,7 +147368,10 @@ function getTableIds(references, dataset) {
147155
147368
  const REPORT_DOCUMENT_TYPES = {
147156
147369
  "report.id": "report",
147157
147370
  "reportTemplate.id": "report_template",
147158
- "reportPageLayout.id": "report_page_layout"
147371
+ "reportPageLayout.id": "report_page_layout",
147372
+ "document.id": "document",
147373
+ "documentTemplate.id": "document_template",
147374
+ "pageTemplate.id": "page_template"
147159
147375
  };
147160
147376
  function resolveReferences(references, source, opts) {
147161
147377
  return (Array.isArray(source) ? source : [source]).reduce((prev, source) => {
@@ -147363,7 +147579,10 @@ function resolveReferencesByObjectSource(references, source, opts) {
147363
147579
  }
147364
147580
  case "report.id":
147365
147581
  case "reportTemplate.id":
147366
- case "reportPageLayout.id": {
147582
+ case "reportPageLayout.id":
147583
+ case "document.id":
147584
+ case "documentTemplate.id":
147585
+ case "pageTemplate.id": {
147367
147586
  const [available, diagnostics] = resolveReferencesIds(references, [REPORT_DOCUMENT_TYPES[source]]);
147368
147587
  return {
147369
147588
  available,
@@ -148245,6 +148464,27 @@ const metadata_v1 = {
148245
148464
  },
148246
148465
  "then": { "$ref": "#/$global/gaac/report_page_layout" }
148247
148466
  },
148467
+ {
148468
+ "if": {
148469
+ "properties": { "type": { "const": "document" } },
148470
+ "required": ["type"]
148471
+ },
148472
+ "then": { "$ref": "#/$global/gaac/publisherDocumentV2" }
148473
+ },
148474
+ {
148475
+ "if": {
148476
+ "properties": { "type": { "const": "document_template" } },
148477
+ "required": ["type"]
148478
+ },
148479
+ "then": { "$ref": "#/$global/gaac/publisherDocumentTemplateV2" }
148480
+ },
148481
+ {
148482
+ "if": {
148483
+ "properties": { "type": { "const": "page_template" } },
148484
+ "required": ["type"]
148485
+ },
148486
+ "then": { "$ref": "#/$global/gaac/publisherPageTemplateV2" }
148487
+ },
148248
148488
  {
148249
148489
  "if": { "not": {
148250
148490
  "properties": { "type": { "type": "string" } },
@@ -148286,7 +148526,10 @@ const metadata_v1 = {
148286
148526
  "parameter",
148287
148527
  "report",
148288
148528
  "report_template",
148289
- "report_page_layout"
148529
+ "report_page_layout",
148530
+ "document",
148531
+ "document_template",
148532
+ "page_template"
148290
148533
  ]
148291
148534
  } }
148292
148535
  }
@@ -148327,7 +148570,10 @@ const metadata_v1 = {
148327
148570
  "parameter",
148328
148571
  "report",
148329
148572
  "report_template",
148330
- "report_page_layout"
148573
+ "report_page_layout",
148574
+ "document",
148575
+ "document_template",
148576
+ "page_template"
148331
148577
  ]
148332
148578
  } },
148333
148579
  required: ["type"],
@@ -151183,6 +151429,157 @@ const metadata_v1 = {
151183
151429
  ],
151184
151430
  "description": "A reusable page. Its content fields are the same page body a document and a document template carry inline, so a field added to /gaac/reportPageBody belongs here too: JSON Schema cannot compose the two, because the page body closes itself to the entity's own id, title and tags."
151185
151431
  },
151432
+ "publisherDocumentV2": {
151433
+ "title": "Publisher Document V2",
151434
+ "type": "object",
151435
+ "additionalProperties": false,
151436
+ "properties": {
151437
+ "id": {
151438
+ "type": "string",
151439
+ "pattern": "^(?!default\\.)(?!\\.)[.A-Za-z0-9_-]{1,255}$",
151440
+ "description": "A unique identifier of the document. Ids starting with default. are reserved.",
151441
+ "$semantic": [{
151442
+ "type": "uniqueness",
151443
+ "source": "document.id",
151444
+ "code": "core.uniqueness.documents.id"
151445
+ }, {
151446
+ "type": "definition",
151447
+ "source": "document.id"
151448
+ }]
151449
+ },
151450
+ "type": {
151451
+ "type": "string",
151452
+ "enum": ["document"]
151453
+ },
151454
+ "version": {
151455
+ "type": "string",
151456
+ "enum": ["2"],
151457
+ "description": "Version of the content format."
151458
+ },
151459
+ "title": { "$ref": "#/$global/gaac/publisherEntityTitleV2" },
151460
+ "description": { "$ref": "#/$global/gaac/publisherEntityDescriptionV2" },
151461
+ "tags": { "$ref": "#/$global/gaac/publisherEntityTagsV2" },
151462
+ "period": { "$ref": "#/$global/gaac/publisherPeriodV2" },
151463
+ "content": { "$ref": "#/$global/gaac/publisherDocumentContentV2" }
151464
+ },
151465
+ "required": [
151466
+ "id",
151467
+ "type",
151468
+ "version",
151469
+ "title",
151470
+ "period",
151471
+ "content"
151472
+ ],
151473
+ "$semantic": {
151474
+ "type": "snippet",
151475
+ "snippets": ["document"]
151476
+ },
151477
+ "not": {
151478
+ "$comment": "Only a document template sets content.defaults.period. Each level states type: object, because a value that is not an object satisfies required and properties, so the rule would also fire on it.",
151479
+ "type": "object",
151480
+ "required": ["content"],
151481
+ "properties": { "content": {
151482
+ "type": "object",
151483
+ "required": ["defaults"],
151484
+ "properties": { "defaults": {
151485
+ "type": "object",
151486
+ "required": ["period"]
151487
+ } }
151488
+ } }
151489
+ }
151490
+ },
151491
+ "publisherDocumentTemplateV2": {
151492
+ "title": "Publisher Document Template V2",
151493
+ "description": "A document created from the template gets a deep copy of its content and keeps no reference back.",
151494
+ "type": "object",
151495
+ "additionalProperties": false,
151496
+ "properties": {
151497
+ "id": {
151498
+ "type": "string",
151499
+ "pattern": "^(?!default\\.)(?!\\.)[.A-Za-z0-9_-]{1,255}$",
151500
+ "description": "A unique identifier of the document template. Ids starting with default. are reserved.",
151501
+ "$semantic": [{
151502
+ "type": "uniqueness",
151503
+ "source": "documentTemplate.id",
151504
+ "code": "core.uniqueness.documentTemplates.id"
151505
+ }, {
151506
+ "type": "definition",
151507
+ "source": "documentTemplate.id"
151508
+ }]
151509
+ },
151510
+ "type": {
151511
+ "type": "string",
151512
+ "enum": ["document_template"]
151513
+ },
151514
+ "version": {
151515
+ "type": "string",
151516
+ "enum": ["2"],
151517
+ "description": "Version of the content format."
151518
+ },
151519
+ "title": { "$ref": "#/$global/gaac/publisherEntityTitleV2" },
151520
+ "description": { "$ref": "#/$global/gaac/publisherEntityDescriptionV2" },
151521
+ "tags": { "$ref": "#/$global/gaac/publisherEntityTagsV2" },
151522
+ "content": { "$ref": "#/$global/gaac/publisherDocumentContentV2" }
151523
+ },
151524
+ "required": [
151525
+ "id",
151526
+ "type",
151527
+ "version",
151528
+ "title",
151529
+ "content"
151530
+ ],
151531
+ "$semantic": {
151532
+ "type": "snippet",
151533
+ "snippets": ["document_template"]
151534
+ }
151535
+ },
151536
+ "publisherPageTemplateV2": {
151537
+ "title": "Publisher Page Template V2",
151538
+ "type": "object",
151539
+ "additionalProperties": false,
151540
+ "properties": {
151541
+ "id": {
151542
+ "type": "string",
151543
+ "pattern": "^(?!default\\.)(?!\\.)[.A-Za-z0-9_-]{1,255}$",
151544
+ "description": "A unique identifier of the page template. Ids starting with default. are reserved.",
151545
+ "$semantic": [{
151546
+ "type": "uniqueness",
151547
+ "source": "pageTemplate.id",
151548
+ "code": "core.uniqueness.pageTemplates.id"
151549
+ }, {
151550
+ "type": "definition",
151551
+ "source": "pageTemplate.id"
151552
+ }]
151553
+ },
151554
+ "type": {
151555
+ "type": "string",
151556
+ "enum": ["page_template"]
151557
+ },
151558
+ "version": {
151559
+ "type": "string",
151560
+ "enum": ["2"],
151561
+ "description": "Version of the content format."
151562
+ },
151563
+ "title": { "$ref": "#/$global/gaac/publisherEntityTitleV2" },
151564
+ "description": { "$ref": "#/$global/gaac/publisherEntityDescriptionV2" },
151565
+ "tags": { "$ref": "#/$global/gaac/publisherEntityTagsV2" },
151566
+ "content": {
151567
+ "$ref": "#/$global/gaac/publisherPageBodyV2",
151568
+ "description": "Copied into a document, with a page id added, when the template is used."
151569
+ }
151570
+ },
151571
+ "required": [
151572
+ "id",
151573
+ "type",
151574
+ "version",
151575
+ "title",
151576
+ "content"
151577
+ ],
151578
+ "$semantic": {
151579
+ "type": "snippet",
151580
+ "snippets": ["page_template"]
151581
+ }
151582
+ },
151186
151583
  "identifier": {
151187
151584
  "title": "Id",
151188
151585
  "type": "string",
@@ -151309,6 +151706,938 @@ const metadata_v1 = {
151309
151706
  "typePrefix": true
151310
151707
  }
151311
151708
  },
151709
+ "publisherEntityTitleV2": {
151710
+ "title": "Publisher Entity Title V2",
151711
+ "description": "A human readable title.",
151712
+ "type": "string",
151713
+ "minLength": 1,
151714
+ "maxLength": 255
151715
+ },
151716
+ "publisherEntityDescriptionV2": {
151717
+ "title": "Publisher Entity Description V2",
151718
+ "description": "An optional description.",
151719
+ "type": "string",
151720
+ "minLength": 1,
151721
+ "maxLength": 1e4
151722
+ },
151723
+ "publisherEntityTagsV2": {
151724
+ "title": "Publisher Entity Tags V2",
151725
+ "description": "A list of strings - metadata tags.",
151726
+ "type": "array",
151727
+ "uniqueItems": true,
151728
+ "items": {
151729
+ "type": "string",
151730
+ "minLength": 1
151731
+ }
151732
+ },
151733
+ "publisherPeriodV2": {
151734
+ "title": "Publisher Period V2",
151735
+ "description": "The period the document reports on, in the date filter grammar without a dataset. Numbers for from and to make it relative; dates make it absolute. Both ends are inclusive.",
151736
+ "oneOf": [{
151737
+ "title": "Publisher Relative Period V2",
151738
+ "type": "object",
151739
+ "additionalProperties": false,
151740
+ "properties": {
151741
+ "granularity": {
151742
+ "type": "string",
151743
+ "enum": [
151744
+ "SECOND",
151745
+ "MINUTE",
151746
+ "HOUR",
151747
+ "DAY",
151748
+ "WEEK_US",
151749
+ "MONTH",
151750
+ "QUARTER",
151751
+ "YEAR",
151752
+ "FISCAL_YEAR",
151753
+ "FISCAL_QUARTER",
151754
+ "FISCAL_MONTH"
151755
+ ]
151756
+ },
151757
+ "from": {
151758
+ "type": "integer",
151759
+ "description": "Offset from the current period, for example -1."
151760
+ },
151761
+ "to": {
151762
+ "type": "integer",
151763
+ "description": "Offset from the current period, for example -1."
151764
+ }
151765
+ },
151766
+ "required": [
151767
+ "granularity",
151768
+ "from",
151769
+ "to"
151770
+ ]
151771
+ }, {
151772
+ "title": "Publisher Absolute Period V2",
151773
+ "type": "object",
151774
+ "additionalProperties": false,
151775
+ "properties": {
151776
+ "from": {
151777
+ "type": "string",
151778
+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
151779
+ "description": "YYYY-MM-DD."
151780
+ },
151781
+ "to": {
151782
+ "type": "string",
151783
+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$",
151784
+ "description": "YYYY-MM-DD."
151785
+ }
151786
+ },
151787
+ "required": ["from", "to"]
151788
+ }]
151789
+ },
151790
+ "publisherDocumentContentV2": {
151791
+ "title": "Publisher Document Content V2",
151792
+ "type": "object",
151793
+ "additionalProperties": false,
151794
+ "description": "Holds exactly one of pages and sections.",
151795
+ "properties": {
151796
+ "defaults": { "$ref": "#/$global/gaac/publisherDocumentDefaultsV2" },
151797
+ "filters": {
151798
+ "$ref": "#/$global/gaac/dashboardFilters",
151799
+ "description": "Document filters. Date filters name their date dataset. At most one filter per attribute or date dataset."
151800
+ },
151801
+ "style": { "$ref": "#/$global/gaac/publisherDocumentStyleV2" },
151802
+ "locale": {
151803
+ "$ref": "#/$global/gaac/locale",
151804
+ "description": "Overrides the workspace locale for this document."
151805
+ },
151806
+ "format_locale": {
151807
+ "$ref": "#/$global/gaac/locale",
151808
+ "description": "Overrides the workspace format locale used for dates."
151809
+ },
151810
+ "pages": {
151811
+ "type": "array",
151812
+ "items": { "$ref": "#/$global/gaac/publisherDocumentPageV2" }
151813
+ },
151814
+ "sections": {
151815
+ "type": "array",
151816
+ "items": { "$ref": "#/$global/gaac/publisherSectionV2" }
151817
+ }
151818
+ },
151819
+ "not": {
151820
+ "$comment": "Rejects both and neither. type: object, because a value that is not an object satisfies required, so the rule would also fire on it.",
151821
+ "type": "object",
151822
+ "anyOf": [{ "required": ["pages", "sections"] }, { "not": { "anyOf": [{ "required": ["pages"] }, { "required": ["sections"] }] } }]
151823
+ }
151824
+ },
151825
+ "publisherPageNodeIdV2": {
151826
+ "title": "Publisher Page Node Id V2",
151827
+ "type": "string",
151828
+ "pattern": "^[A-Za-z0-9_.-]{1,64}$"
151829
+ },
151830
+ "publisherPageSizeV2": {
151831
+ "title": "Publisher Page Size V2",
151832
+ "type": "string",
151833
+ "enum": ["widescreen"],
151834
+ "description": "The widescreen design canvas is 1920 x 1080 px."
151835
+ },
151836
+ "publisherPageStyleV2": {
151837
+ "title": "Publisher Page Style V2",
151838
+ "type": "object",
151839
+ "additionalProperties": false,
151840
+ "properties": {
151841
+ "background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
151842
+ "background_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
151843
+ "background_image": { "$ref": "#/$global/gaac/publisherImageSourceV2" },
151844
+ "background_image_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
151845
+ "background_fit": {
151846
+ "type": "string",
151847
+ "enum": [
151848
+ "cover",
151849
+ "contain",
151850
+ "fill",
151851
+ "tile"
151852
+ ]
151853
+ },
151854
+ "background_horizontal_align": { "$ref": "#/$global/gaac/publisherHorizontalAlignV2" },
151855
+ "background_vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
151856
+ "background_offset": { "$ref": "#/$global/gaac/publisherPxV2" },
151857
+ "background_offset_top": { "$ref": "#/$global/gaac/publisherPxV2" },
151858
+ "background_offset_right": { "$ref": "#/$global/gaac/publisherPxV2" },
151859
+ "background_offset_bottom": { "$ref": "#/$global/gaac/publisherPxV2" },
151860
+ "background_offset_left": { "$ref": "#/$global/gaac/publisherPxV2" },
151861
+ "padding": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
151862
+ "padding_top": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
151863
+ "padding_right": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
151864
+ "padding_bottom": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
151865
+ "padding_left": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
151866
+ "text_style": { "$ref": "#/$global/gaac/publisherTextStyleNameV2" },
151867
+ "text_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
151868
+ "horizontal_align": {
151869
+ "type": "string",
151870
+ "enum": [
151871
+ "left",
151872
+ "center",
151873
+ "right",
151874
+ "justify"
151875
+ ]
151876
+ },
151877
+ "vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
151878
+ "gap": { "$ref": "#/$global/gaac/publisherGapValueV2" }
151879
+ }
151880
+ },
151881
+ "publisherLayoutNodeV2": {
151882
+ "title": "Publisher Layout Node V2",
151883
+ "description": "A row or column container, or a widget.",
151884
+ "type": "object",
151885
+ "properties": { "type": {
151886
+ "type": "string",
151887
+ "enum": [
151888
+ "row",
151889
+ "column",
151890
+ "title",
151891
+ "heading",
151892
+ "text",
151893
+ "image",
151894
+ "visualization",
151895
+ "takeaway"
151896
+ ]
151897
+ } },
151898
+ "required": ["type"],
151899
+ "allOf": [
151900
+ {
151901
+ "if": {
151902
+ "properties": { "type": { "enum": ["row", "column"] } },
151903
+ "required": ["type"]
151904
+ },
151905
+ "then": { "$ref": "#/$defs/publisherContainerV2" }
151906
+ },
151907
+ {
151908
+ "if": {
151909
+ "properties": { "type": { "const": "title" } },
151910
+ "required": ["type"]
151911
+ },
151912
+ "then": { "$ref": "#/$defs/publisherTitleWidgetV2" }
151913
+ },
151914
+ {
151915
+ "if": {
151916
+ "properties": { "type": { "const": "heading" } },
151917
+ "required": ["type"]
151918
+ },
151919
+ "then": { "$ref": "#/$defs/publisherHeadingWidgetV2" }
151920
+ },
151921
+ {
151922
+ "if": {
151923
+ "properties": { "type": { "const": "text" } },
151924
+ "required": ["type"]
151925
+ },
151926
+ "then": { "$ref": "#/$defs/publisherTextWidgetV2" }
151927
+ },
151928
+ {
151929
+ "if": {
151930
+ "properties": { "type": { "const": "image" } },
151931
+ "required": ["type"]
151932
+ },
151933
+ "then": { "$ref": "#/$defs/publisherImageWidgetV2" }
151934
+ },
151935
+ {
151936
+ "if": {
151937
+ "properties": { "type": { "const": "visualization" } },
151938
+ "required": ["type"]
151939
+ },
151940
+ "then": { "$ref": "#/$defs/publisherVisualizationWidgetV2" }
151941
+ },
151942
+ {
151943
+ "if": {
151944
+ "properties": { "type": { "const": "takeaway" } },
151945
+ "required": ["type"]
151946
+ },
151947
+ "then": { "$ref": "#/$defs/publisherTakeawayWidgetV2" }
151948
+ }
151949
+ ]
151950
+ },
151951
+ "publisherDocumentPageV2": {
151952
+ "title": "Publisher Document Page V2",
151953
+ "type": "object",
151954
+ "additionalProperties": false,
151955
+ "description": "A page of a document.",
151956
+ "properties": {
151957
+ "id": {
151958
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
151959
+ "description": "Unique within the document."
151960
+ },
151961
+ "visible": {
151962
+ "type": "boolean",
151963
+ "description": "Defaults to true. A hidden page is left out of the viewer, exports and page numbers."
151964
+ },
151965
+ "kind": {
151966
+ "type": "string",
151967
+ "enum": [
151968
+ "cover",
151969
+ "section",
151970
+ "content"
151971
+ ],
151972
+ "description": "Editor hint. It does not change how the page renders."
151973
+ },
151974
+ "page_size": { "$ref": "#/$global/gaac/publisherPageSizeV2" },
151975
+ "notes": {
151976
+ "type": "string",
151977
+ "minLength": 1,
151978
+ "description": "Markdown speaker notes, never drawn on the page."
151979
+ },
151980
+ "style": { "$ref": "#/$global/gaac/publisherPageStyleV2" },
151981
+ "layout": {
151982
+ "$ref": "#/$global/gaac/publisherLayoutNodeV2",
151983
+ "description": "Root of the page layout tree."
151984
+ },
151985
+ "filters": {
151986
+ "$ref": "#/$global/gaac/dashboardFilters",
151987
+ "description": "Page filters, applied on top of the document filters."
151988
+ }
151989
+ },
151990
+ "required": ["id", "layout"],
151991
+ "$comment": "The keys are a page body's plus id and visible. JSON Schema cannot extend the closed /gaac/publisherPageBodyV2, so a key added there belongs here too."
151992
+ },
151993
+ "publisherTakeawayGenerationV2": {
151994
+ "title": "Publisher Takeaway Generation V2",
151995
+ "type": "object",
151996
+ "additionalProperties": false,
151997
+ "properties": {
151998
+ "instructions": {
151999
+ "type": "string",
152000
+ "minLength": 1,
152001
+ "description": "Instructions the takeaway is generated with."
152002
+ },
152003
+ "context": {
152004
+ "title": "Publisher Takeaway Context V2",
152005
+ "type": "object",
152006
+ "additionalProperties": false,
152007
+ "properties": {
152008
+ "widgets": {
152009
+ "type": "array",
152010
+ "description": "Ids of the widgets on this page the takeaway is generated from.",
152011
+ "items": { "$ref": "#/$global/gaac/publisherPageNodeIdV2" }
152012
+ },
152013
+ "page_title": { "type": "boolean" },
152014
+ "filters": { "type": "boolean" },
152015
+ "other_pages": { "type": "boolean" }
152016
+ }
152017
+ }
152018
+ }
152019
+ },
152020
+ "publisherColorValueV2": {
152021
+ "title": "Publisher Color Value V2",
152022
+ "type": "string",
152023
+ "pattern": "^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*(,\\s*\\d*\\.?\\d+\\s*)?\\)|\\{theme\\.(colors\\.(backgrounds|texts|lines)\\.[A-Za-z0-9_-]+|palette\\.(primary|success|error|warning))\\})$",
152024
+ "description": "A theme color reference such as {theme.palette.primary}, or #rgb, #rrggbb, #rrggbbaa, or rgb() with 3 or 4 arguments."
152025
+ },
152026
+ "publisherOpacityV2": {
152027
+ "title": "Publisher Opacity V2",
152028
+ "type": "number",
152029
+ "minimum": 0,
152030
+ "maximum": 1
152031
+ },
152032
+ "publisherImageSourceV2": {
152033
+ "title": "Publisher Image Source V2",
152034
+ "type": "string",
152035
+ "pattern": "^(\\{theme\\.(logo|coverImage|assets\\.(logos|images)\\.[A-Za-z0-9_-]+)\\}|https://\\S+)$",
152036
+ "description": "A theme image reference such as {theme.logo}, or an https URL, which may contain text variables."
152037
+ },
152038
+ "publisherHorizontalAlignV2": {
152039
+ "title": "Publisher Horizontal Align V2",
152040
+ "type": "string",
152041
+ "enum": [
152042
+ "left",
152043
+ "center",
152044
+ "right"
152045
+ ]
152046
+ },
152047
+ "publisherVerticalAlignV2": {
152048
+ "title": "Publisher Vertical Align V2",
152049
+ "type": "string",
152050
+ "enum": [
152051
+ "top",
152052
+ "center",
152053
+ "bottom"
152054
+ ]
152055
+ },
152056
+ "publisherPxV2": {
152057
+ "title": "Publisher Px V2",
152058
+ "type": "number",
152059
+ "minimum": 0,
152060
+ "description": "Pixels on the page's design canvas (1920 x 1080 for widescreen)."
152061
+ },
152062
+ "publisherGapValueV2": {
152063
+ "title": "Publisher Gap Value V2",
152064
+ "description": "Space between children, in pixels or as a theme spacing reference.",
152065
+ "oneOf": [{
152066
+ "type": "number",
152067
+ "minimum": 0
152068
+ }, {
152069
+ "type": "string",
152070
+ "enum": [
152071
+ "{theme.spacing.gap.compact}",
152072
+ "{theme.spacing.gap.normal}",
152073
+ "{theme.spacing.gap.spacious}"
152074
+ ]
152075
+ }]
152076
+ },
152077
+ "publisherDocumentDefaultsV2": {
152078
+ "title": "Publisher Document Defaults V2",
152079
+ "type": "object",
152080
+ "additionalProperties": false,
152081
+ "properties": {
152082
+ "page_size": {
152083
+ "$ref": "#/$global/gaac/publisherPageSizeV2",
152084
+ "description": "Applies to every page without its own page_size."
152085
+ },
152086
+ "takeaway": {
152087
+ "title": "Publisher Document Takeaway Defaults V2",
152088
+ "type": "object",
152089
+ "additionalProperties": false,
152090
+ "properties": { "generation": {
152091
+ "$ref": "#/$global/gaac/publisherTakeawayGenerationV2",
152092
+ "description": "Combined with each takeaway widget's own generation."
152093
+ } }
152094
+ },
152095
+ "period": {
152096
+ "$ref": "#/$global/gaac/publisherPeriodV2",
152097
+ "description": "Document templates only: the period a document created from the template starts with."
152098
+ }
152099
+ }
152100
+ },
152101
+ "publisherDocumentStyleV2": {
152102
+ "title": "Publisher Document Style V2",
152103
+ "type": "object",
152104
+ "additionalProperties": false,
152105
+ "description": "Style of the area behind the pages. Exports ignore it.",
152106
+ "properties": {
152107
+ "background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152108
+ "background_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152109
+ "background_image": { "$ref": "#/$global/gaac/publisherImageSourceV2" },
152110
+ "background_image_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152111
+ "background_fit": {
152112
+ "type": "string",
152113
+ "enum": [
152114
+ "cover",
152115
+ "contain",
152116
+ "fill",
152117
+ "tile"
152118
+ ]
152119
+ },
152120
+ "background_horizontal_align": { "$ref": "#/$global/gaac/publisherHorizontalAlignV2" },
152121
+ "background_vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152122
+ "background_offset": { "$ref": "#/$global/gaac/publisherPxV2" },
152123
+ "background_offset_top": { "$ref": "#/$global/gaac/publisherPxV2" },
152124
+ "background_offset_right": { "$ref": "#/$global/gaac/publisherPxV2" },
152125
+ "background_offset_bottom": { "$ref": "#/$global/gaac/publisherPxV2" },
152126
+ "background_offset_left": { "$ref": "#/$global/gaac/publisherPxV2" },
152127
+ "gap": {
152128
+ "$ref": "#/$global/gaac/publisherGapValueV2",
152129
+ "description": "Space between pages in the viewer and the editor."
152130
+ }
152131
+ }
152132
+ },
152133
+ "publisherSectionV2": {
152134
+ "title": "Publisher Section V2",
152135
+ "type": "object",
152136
+ "additionalProperties": false,
152137
+ "description": "A named group of pages.",
152138
+ "properties": {
152139
+ "id": {
152140
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
152141
+ "description": "Unique within the document."
152142
+ },
152143
+ "title": {
152144
+ "type": "string",
152145
+ "minLength": 1
152146
+ },
152147
+ "description": {
152148
+ "type": "string",
152149
+ "minLength": 1
152150
+ },
152151
+ "pages": {
152152
+ "type": "array",
152153
+ "items": { "$ref": "#/$global/gaac/publisherDocumentPageV2" }
152154
+ }
152155
+ },
152156
+ "required": ["id", "pages"]
152157
+ },
152158
+ "publisherPaddingValueV2": {
152159
+ "title": "Publisher Padding Value V2",
152160
+ "description": "Inner spacing, in pixels or as a theme spacing reference.",
152161
+ "oneOf": [{
152162
+ "type": "number",
152163
+ "minimum": 0
152164
+ }, {
152165
+ "type": "string",
152166
+ "enum": [
152167
+ "{theme.spacing.padding.compact}",
152168
+ "{theme.spacing.padding.normal}",
152169
+ "{theme.spacing.padding.spacious}"
152170
+ ]
152171
+ }]
152172
+ },
152173
+ "publisherTextStyleNameV2": {
152174
+ "title": "Publisher Text Style Name V2",
152175
+ "type": "string",
152176
+ "enum": [
152177
+ "title",
152178
+ "h1",
152179
+ "h2",
152180
+ "h3",
152181
+ "h4",
152182
+ "h5",
152183
+ "h6",
152184
+ "largeText",
152185
+ "normalText",
152186
+ "smallText"
152187
+ ],
152188
+ "description": "Named text style from the theme."
152189
+ },
152190
+ "publisherBorderLineStyleV2": {
152191
+ "title": "Publisher Border Line Style V2",
152192
+ "type": "string",
152193
+ "enum": [
152194
+ "solid",
152195
+ "dashed",
152196
+ "dotted",
152197
+ "none"
152198
+ ]
152199
+ },
152200
+ "publisherRadiusValueV2": {
152201
+ "title": "Publisher Radius Value V2",
152202
+ "description": "Corner radius, in pixels or as a theme corner reference.",
152203
+ "oneOf": [{
152204
+ "type": "number",
152205
+ "minimum": 0
152206
+ }, {
152207
+ "type": "string",
152208
+ "enum": [
152209
+ "{theme.corners.small}",
152210
+ "{theme.corners.medium}",
152211
+ "{theme.corners.large}",
152212
+ "{theme.corners.full}"
152213
+ ]
152214
+ }]
152215
+ },
152216
+ "publisherShadowValueV2": {
152217
+ "title": "Publisher Shadow Value V2",
152218
+ "type": "string",
152219
+ "pattern": "^(none|\\{theme\\.shadows\\.[A-Za-z0-9_-]+\\})$",
152220
+ "description": "\"none\" or a {theme.shadows.<name>} reference."
152221
+ },
152222
+ "publisherTextStyleV2": {
152223
+ "title": "Publisher Text Style V2",
152224
+ "type": "object",
152225
+ "additionalProperties": false,
152226
+ "properties": {
152227
+ "text_style": { "$ref": "#/$global/gaac/publisherTextStyleNameV2" },
152228
+ "text_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152229
+ "horizontal_align": {
152230
+ "type": "string",
152231
+ "enum": [
152232
+ "left",
152233
+ "center",
152234
+ "right",
152235
+ "justify"
152236
+ ]
152237
+ },
152238
+ "vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152239
+ "font_size": { "$ref": "#/$global/gaac/publisherPxV2" },
152240
+ "font_weight": {
152241
+ "type": "number",
152242
+ "minimum": 1,
152243
+ "maximum": 1e3
152244
+ },
152245
+ "font_style": {
152246
+ "type": "string",
152247
+ "enum": ["normal", "italic"]
152248
+ },
152249
+ "line_height": { "type": "number" },
152250
+ "letter_spacing": { "type": "number" },
152251
+ "text_transform": {
152252
+ "type": "string",
152253
+ "enum": [
152254
+ "none",
152255
+ "uppercase",
152256
+ "lowercase",
152257
+ "capitalize"
152258
+ ]
152259
+ },
152260
+ "text_overflow": {
152261
+ "type": "string",
152262
+ "enum": [
152263
+ "shrink",
152264
+ "clip",
152265
+ "ellipsis"
152266
+ ]
152267
+ }
152268
+ }
152269
+ },
152270
+ "publisherPageProportionV2": {
152271
+ "title": "Publisher Page Proportion V2",
152272
+ "type": "number",
152273
+ "exclusiveMinimum": 0,
152274
+ "description": "Share of the parent container this node takes, relative to its siblings. Defaults to 1."
152275
+ },
152276
+ "publisherWidgetPlaceholderV2": {
152277
+ "title": "Publisher Widget Placeholder V2",
152278
+ "type": "object",
152279
+ "additionalProperties": false,
152280
+ "properties": {
152281
+ "hint": {
152282
+ "type": "string",
152283
+ "minLength": 1,
152284
+ "description": "Authoring hint shown in the empty widget."
152285
+ },
152286
+ "required": { "type": "boolean" }
152287
+ }
152288
+ },
152289
+ "publisherTextWidgetStyleV2": {
152290
+ "title": "Publisher Text Widget Style V2",
152291
+ "type": "object",
152292
+ "additionalProperties": false,
152293
+ "properties": {
152294
+ "background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152295
+ "background_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152296
+ "background_image": { "$ref": "#/$global/gaac/publisherImageSourceV2" },
152297
+ "background_image_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152298
+ "background_fit": {
152299
+ "type": "string",
152300
+ "enum": [
152301
+ "cover",
152302
+ "contain",
152303
+ "fill",
152304
+ "tile"
152305
+ ]
152306
+ },
152307
+ "background_horizontal_align": { "$ref": "#/$global/gaac/publisherHorizontalAlignV2" },
152308
+ "background_vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152309
+ "background_offset": { "$ref": "#/$global/gaac/publisherPxV2" },
152310
+ "background_offset_top": { "$ref": "#/$global/gaac/publisherPxV2" },
152311
+ "background_offset_right": { "$ref": "#/$global/gaac/publisherPxV2" },
152312
+ "background_offset_bottom": { "$ref": "#/$global/gaac/publisherPxV2" },
152313
+ "background_offset_left": { "$ref": "#/$global/gaac/publisherPxV2" },
152314
+ "padding": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152315
+ "padding_top": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152316
+ "padding_right": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152317
+ "padding_bottom": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152318
+ "padding_left": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152319
+ "border_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152320
+ "border_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152321
+ "border_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152322
+ "border_top_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152323
+ "border_top_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152324
+ "border_top_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152325
+ "border_right_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152326
+ "border_right_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152327
+ "border_right_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152328
+ "border_bottom_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152329
+ "border_bottom_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152330
+ "border_bottom_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152331
+ "border_left_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152332
+ "border_left_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152333
+ "border_left_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152334
+ "border_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152335
+ "border_top_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152336
+ "border_top_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152337
+ "border_bottom_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152338
+ "border_bottom_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152339
+ "shadow": { "$ref": "#/$global/gaac/publisherShadowValueV2" },
152340
+ "shadow_x": { "type": "number" },
152341
+ "shadow_y": { "type": "number" },
152342
+ "shadow_blur": { "$ref": "#/$global/gaac/publisherPxV2" },
152343
+ "shadow_spread": { "type": "number" },
152344
+ "shadow_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152345
+ "shadow_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152346
+ "opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152347
+ "text_style": { "$ref": "#/$global/gaac/publisherTextStyleNameV2" },
152348
+ "text_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152349
+ "horizontal_align": {
152350
+ "type": "string",
152351
+ "enum": [
152352
+ "left",
152353
+ "center",
152354
+ "right",
152355
+ "justify"
152356
+ ]
152357
+ },
152358
+ "vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152359
+ "font_size": { "$ref": "#/$global/gaac/publisherPxV2" },
152360
+ "font_weight": {
152361
+ "type": "number",
152362
+ "minimum": 1,
152363
+ "maximum": 1e3
152364
+ },
152365
+ "font_style": {
152366
+ "type": "string",
152367
+ "enum": ["normal", "italic"]
152368
+ },
152369
+ "line_height": { "type": "number" },
152370
+ "letter_spacing": { "type": "number" },
152371
+ "text_transform": {
152372
+ "type": "string",
152373
+ "enum": [
152374
+ "none",
152375
+ "uppercase",
152376
+ "lowercase",
152377
+ "capitalize"
152378
+ ]
152379
+ },
152380
+ "text_overflow": {
152381
+ "type": "string",
152382
+ "enum": [
152383
+ "shrink",
152384
+ "clip",
152385
+ "ellipsis"
152386
+ ]
152387
+ }
152388
+ }
152389
+ },
152390
+ "publisherImageWidgetStyleV2": {
152391
+ "title": "Publisher Image Widget Style V2",
152392
+ "type": "object",
152393
+ "additionalProperties": false,
152394
+ "properties": {
152395
+ "background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152396
+ "background_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152397
+ "background_image": { "$ref": "#/$global/gaac/publisherImageSourceV2" },
152398
+ "background_image_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152399
+ "background_fit": {
152400
+ "type": "string",
152401
+ "enum": [
152402
+ "cover",
152403
+ "contain",
152404
+ "fill",
152405
+ "tile"
152406
+ ]
152407
+ },
152408
+ "background_horizontal_align": { "$ref": "#/$global/gaac/publisherHorizontalAlignV2" },
152409
+ "background_vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152410
+ "background_offset": { "$ref": "#/$global/gaac/publisherPxV2" },
152411
+ "background_offset_top": { "$ref": "#/$global/gaac/publisherPxV2" },
152412
+ "background_offset_right": { "$ref": "#/$global/gaac/publisherPxV2" },
152413
+ "background_offset_bottom": { "$ref": "#/$global/gaac/publisherPxV2" },
152414
+ "background_offset_left": { "$ref": "#/$global/gaac/publisherPxV2" },
152415
+ "padding": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152416
+ "padding_top": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152417
+ "padding_right": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152418
+ "padding_bottom": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152419
+ "padding_left": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152420
+ "border_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152421
+ "border_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152422
+ "border_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152423
+ "border_top_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152424
+ "border_top_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152425
+ "border_top_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152426
+ "border_right_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152427
+ "border_right_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152428
+ "border_right_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152429
+ "border_bottom_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152430
+ "border_bottom_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152431
+ "border_bottom_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152432
+ "border_left_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152433
+ "border_left_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152434
+ "border_left_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152435
+ "border_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152436
+ "border_top_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152437
+ "border_top_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152438
+ "border_bottom_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152439
+ "border_bottom_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152440
+ "shadow": { "$ref": "#/$global/gaac/publisherShadowValueV2" },
152441
+ "shadow_x": { "type": "number" },
152442
+ "shadow_y": { "type": "number" },
152443
+ "shadow_blur": { "$ref": "#/$global/gaac/publisherPxV2" },
152444
+ "shadow_spread": { "type": "number" },
152445
+ "shadow_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152446
+ "shadow_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152447
+ "opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152448
+ "fit": {
152449
+ "type": "string",
152450
+ "enum": [
152451
+ "contain",
152452
+ "cover",
152453
+ "fill"
152454
+ ]
152455
+ },
152456
+ "horizontal_align": { "$ref": "#/$global/gaac/publisherHorizontalAlignV2" },
152457
+ "vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" }
152458
+ }
152459
+ },
152460
+ "publisherWidgetTitleV2": {
152461
+ "title": "Publisher Widget Title V2",
152462
+ "type": "object",
152463
+ "additionalProperties": false,
152464
+ "properties": {
152465
+ "visible": { "type": "boolean" },
152466
+ "text": {
152467
+ "type": "string",
152468
+ "minLength": 1
152469
+ },
152470
+ "style": { "$ref": "#/$global/gaac/publisherTextStyleV2" }
152471
+ }
152472
+ },
152473
+ "publisherVisualizationStyleV2": {
152474
+ "title": "Publisher Visualization Style V2",
152475
+ "type": "object",
152476
+ "additionalProperties": false,
152477
+ "properties": {
152478
+ "background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152479
+ "background_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152480
+ "background_image": { "$ref": "#/$global/gaac/publisherImageSourceV2" },
152481
+ "background_image_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152482
+ "background_fit": {
152483
+ "type": "string",
152484
+ "enum": [
152485
+ "cover",
152486
+ "contain",
152487
+ "fill",
152488
+ "tile"
152489
+ ]
152490
+ },
152491
+ "background_horizontal_align": { "$ref": "#/$global/gaac/publisherHorizontalAlignV2" },
152492
+ "background_vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152493
+ "background_offset": { "$ref": "#/$global/gaac/publisherPxV2" },
152494
+ "background_offset_top": { "$ref": "#/$global/gaac/publisherPxV2" },
152495
+ "background_offset_right": { "$ref": "#/$global/gaac/publisherPxV2" },
152496
+ "background_offset_bottom": { "$ref": "#/$global/gaac/publisherPxV2" },
152497
+ "background_offset_left": { "$ref": "#/$global/gaac/publisherPxV2" },
152498
+ "padding": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152499
+ "padding_top": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152500
+ "padding_right": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152501
+ "padding_bottom": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152502
+ "padding_left": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152503
+ "border_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152504
+ "border_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152505
+ "border_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152506
+ "border_top_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152507
+ "border_top_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152508
+ "border_top_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152509
+ "border_right_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152510
+ "border_right_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152511
+ "border_right_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152512
+ "border_bottom_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152513
+ "border_bottom_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152514
+ "border_bottom_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152515
+ "border_left_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152516
+ "border_left_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152517
+ "border_left_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152518
+ "border_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152519
+ "border_top_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152520
+ "border_top_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152521
+ "border_bottom_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152522
+ "border_bottom_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152523
+ "shadow": { "$ref": "#/$global/gaac/publisherShadowValueV2" },
152524
+ "shadow_x": { "type": "number" },
152525
+ "shadow_y": { "type": "number" },
152526
+ "shadow_blur": { "$ref": "#/$global/gaac/publisherPxV2" },
152527
+ "shadow_spread": { "type": "number" },
152528
+ "shadow_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152529
+ "shadow_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152530
+ "opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152531
+ "chart": { "$ref": "#/$defs/publisherChartStyleV2" },
152532
+ "table": { "$ref": "#/$defs/publisherTableStyleV2" },
152533
+ "headline": { "$ref": "#/$defs/publisherHeadlineStyleV2" }
152534
+ }
152535
+ },
152536
+ "publisherContainerStyleV2": {
152537
+ "title": "Publisher Container Style V2",
152538
+ "type": "object",
152539
+ "additionalProperties": false,
152540
+ "properties": {
152541
+ "background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152542
+ "background_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152543
+ "background_image": { "$ref": "#/$global/gaac/publisherImageSourceV2" },
152544
+ "background_image_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152545
+ "background_fit": {
152546
+ "type": "string",
152547
+ "enum": [
152548
+ "cover",
152549
+ "contain",
152550
+ "fill",
152551
+ "tile"
152552
+ ]
152553
+ },
152554
+ "background_horizontal_align": { "$ref": "#/$global/gaac/publisherHorizontalAlignV2" },
152555
+ "background_vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152556
+ "background_offset": { "$ref": "#/$global/gaac/publisherPxV2" },
152557
+ "background_offset_top": { "$ref": "#/$global/gaac/publisherPxV2" },
152558
+ "background_offset_right": { "$ref": "#/$global/gaac/publisherPxV2" },
152559
+ "background_offset_bottom": { "$ref": "#/$global/gaac/publisherPxV2" },
152560
+ "background_offset_left": { "$ref": "#/$global/gaac/publisherPxV2" },
152561
+ "padding": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152562
+ "padding_top": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152563
+ "padding_right": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152564
+ "padding_bottom": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152565
+ "padding_left": { "$ref": "#/$global/gaac/publisherPaddingValueV2" },
152566
+ "border_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152567
+ "border_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152568
+ "border_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152569
+ "border_top_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152570
+ "border_top_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152571
+ "border_top_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152572
+ "border_right_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152573
+ "border_right_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152574
+ "border_right_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152575
+ "border_bottom_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152576
+ "border_bottom_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152577
+ "border_bottom_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152578
+ "border_left_width": { "$ref": "#/$global/gaac/publisherPxV2" },
152579
+ "border_left_style": { "$ref": "#/$global/gaac/publisherBorderLineStyleV2" },
152580
+ "border_left_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152581
+ "border_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152582
+ "border_top_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152583
+ "border_top_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152584
+ "border_bottom_right_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152585
+ "border_bottom_left_radius": { "$ref": "#/$global/gaac/publisherRadiusValueV2" },
152586
+ "shadow": { "$ref": "#/$global/gaac/publisherShadowValueV2" },
152587
+ "shadow_x": { "type": "number" },
152588
+ "shadow_y": { "type": "number" },
152589
+ "shadow_blur": { "$ref": "#/$global/gaac/publisherPxV2" },
152590
+ "shadow_spread": { "type": "number" },
152591
+ "shadow_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152592
+ "shadow_opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152593
+ "opacity": { "$ref": "#/$global/gaac/publisherOpacityV2" },
152594
+ "text_style": { "$ref": "#/$global/gaac/publisherTextStyleNameV2" },
152595
+ "text_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
152596
+ "horizontal_align": {
152597
+ "type": "string",
152598
+ "enum": [
152599
+ "left",
152600
+ "center",
152601
+ "right",
152602
+ "justify"
152603
+ ]
152604
+ },
152605
+ "vertical_align": { "$ref": "#/$global/gaac/publisherVerticalAlignV2" },
152606
+ "gap": { "$ref": "#/$global/gaac/publisherGapValueV2" }
152607
+ }
152608
+ },
152609
+ "publisherPageBodyV2": {
152610
+ "title": "Publisher Page Body V2",
152611
+ "type": "object",
152612
+ "additionalProperties": false,
152613
+ "properties": {
152614
+ "kind": {
152615
+ "type": "string",
152616
+ "enum": [
152617
+ "cover",
152618
+ "section",
152619
+ "content"
152620
+ ],
152621
+ "description": "Editor hint. It does not change how the page renders."
152622
+ },
152623
+ "page_size": { "$ref": "#/$global/gaac/publisherPageSizeV2" },
152624
+ "notes": {
152625
+ "type": "string",
152626
+ "minLength": 1,
152627
+ "description": "Markdown speaker notes, never drawn on the page."
152628
+ },
152629
+ "style": { "$ref": "#/$global/gaac/publisherPageStyleV2" },
152630
+ "layout": {
152631
+ "$ref": "#/$global/gaac/publisherLayoutNodeV2",
152632
+ "description": "Root of the page layout tree."
152633
+ },
152634
+ "filters": {
152635
+ "$ref": "#/$global/gaac/dashboardFilters",
152636
+ "description": "Page filters, applied on top of the document filters."
152637
+ }
152638
+ },
152639
+ "required": ["layout"]
152640
+ },
151312
152641
  "queryFilters": {
151313
152642
  "title": "Query Filters",
151314
152643
  "type": "object",
@@ -156138,6 +157467,110 @@ const metadata_v1 = {
156138
157467
  "target"
156139
157468
  ]
156140
157469
  },
157470
+ "publisherDocumentV2": {
157471
+ "title": "Publisher Document V2",
157472
+ "type": "object",
157473
+ "additionalProperties": false,
157474
+ "properties": {
157475
+ "id": {
157476
+ "type": "string",
157477
+ "pattern": "^(?!default\\.)(?!\\.)[.A-Za-z0-9_-]{1,255}$",
157478
+ "description": "A unique identifier of the document. Ids starting with default. are reserved.",
157479
+ "$semantic": [{
157480
+ "type": "uniqueness",
157481
+ "source": "document.id",
157482
+ "code": "core.uniqueness.documents.id"
157483
+ }, {
157484
+ "type": "definition",
157485
+ "source": "document.id"
157486
+ }]
157487
+ },
157488
+ "type": {
157489
+ "type": "string",
157490
+ "enum": ["document"]
157491
+ },
157492
+ "version": {
157493
+ "type": "string",
157494
+ "enum": ["2"],
157495
+ "description": "Version of the content format."
157496
+ },
157497
+ "title": { "$ref": "#/$global/gaac/publisherEntityTitleV2" },
157498
+ "description": { "$ref": "#/$global/gaac/publisherEntityDescriptionV2" },
157499
+ "tags": { "$ref": "#/$global/gaac/publisherEntityTagsV2" },
157500
+ "period": { "$ref": "#/$global/gaac/publisherPeriodV2" },
157501
+ "content": { "$ref": "#/$global/gaac/publisherDocumentContentV2" }
157502
+ },
157503
+ "required": [
157504
+ "id",
157505
+ "type",
157506
+ "version",
157507
+ "title",
157508
+ "period",
157509
+ "content"
157510
+ ],
157511
+ "$semantic": {
157512
+ "type": "snippet",
157513
+ "snippets": ["document"]
157514
+ },
157515
+ "not": {
157516
+ "$comment": "Only a document template sets content.defaults.period. Each level states type: object, because a value that is not an object satisfies required and properties, so the rule would also fire on it.",
157517
+ "type": "object",
157518
+ "required": ["content"],
157519
+ "properties": { "content": {
157520
+ "type": "object",
157521
+ "required": ["defaults"],
157522
+ "properties": { "defaults": {
157523
+ "type": "object",
157524
+ "required": ["period"]
157525
+ } }
157526
+ } }
157527
+ }
157528
+ },
157529
+ "publisherDocumentTemplateV2": {
157530
+ "title": "Publisher Document Template V2",
157531
+ "description": "A document created from the template gets a deep copy of its content and keeps no reference back.",
157532
+ "type": "object",
157533
+ "additionalProperties": false,
157534
+ "properties": {
157535
+ "id": {
157536
+ "type": "string",
157537
+ "pattern": "^(?!default\\.)(?!\\.)[.A-Za-z0-9_-]{1,255}$",
157538
+ "description": "A unique identifier of the document template. Ids starting with default. are reserved.",
157539
+ "$semantic": [{
157540
+ "type": "uniqueness",
157541
+ "source": "documentTemplate.id",
157542
+ "code": "core.uniqueness.documentTemplates.id"
157543
+ }, {
157544
+ "type": "definition",
157545
+ "source": "documentTemplate.id"
157546
+ }]
157547
+ },
157548
+ "type": {
157549
+ "type": "string",
157550
+ "enum": ["document_template"]
157551
+ },
157552
+ "version": {
157553
+ "type": "string",
157554
+ "enum": ["2"],
157555
+ "description": "Version of the content format."
157556
+ },
157557
+ "title": { "$ref": "#/$global/gaac/publisherEntityTitleV2" },
157558
+ "description": { "$ref": "#/$global/gaac/publisherEntityDescriptionV2" },
157559
+ "tags": { "$ref": "#/$global/gaac/publisherEntityTagsV2" },
157560
+ "content": { "$ref": "#/$global/gaac/publisherDocumentContentV2" }
157561
+ },
157562
+ "required": [
157563
+ "id",
157564
+ "type",
157565
+ "version",
157566
+ "title",
157567
+ "content"
157568
+ ],
157569
+ "$semantic": {
157570
+ "type": "snippet",
157571
+ "snippets": ["document_template"]
157572
+ }
157573
+ },
156141
157574
  "metric": {
156142
157575
  "title": "Metric",
156143
157576
  "type": "object",
@@ -156200,6 +157633,433 @@ const metadata_v1 = {
156200
157633
  "maql"
156201
157634
  ]
156202
157635
  },
157636
+ "publisherChartStyleV2": {
157637
+ "title": "Publisher Chart Style V2",
157638
+ "type": "object",
157639
+ "additionalProperties": false,
157640
+ "properties": {
157641
+ "font_size": { "$ref": "#/$global/gaac/publisherPxV2" },
157642
+ "text_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157643
+ "axis_line_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157644
+ "axis_name_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157645
+ "axis_name_size": { "$ref": "#/$global/gaac/publisherPxV2" },
157646
+ "axis_value_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157647
+ "axis_value_size": { "$ref": "#/$global/gaac/publisherPxV2" },
157648
+ "grid_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157649
+ "plot_line_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157650
+ "legend_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157651
+ "legend_size": { "$ref": "#/$global/gaac/publisherPxV2" },
157652
+ "data_label_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157653
+ "data_label_size": { "$ref": "#/$global/gaac/publisherPxV2" }
157654
+ }
157655
+ },
157656
+ "publisherTableStyleV2": {
157657
+ "title": "Publisher Table Style V2",
157658
+ "type": "object",
157659
+ "additionalProperties": false,
157660
+ "properties": {
157661
+ "font_size": { "$ref": "#/$global/gaac/publisherPxV2" },
157662
+ "row_height": { "$ref": "#/$global/gaac/publisherPxV2" },
157663
+ "grid_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157664
+ "value_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157665
+ "null_value_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157666
+ "header_label_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157667
+ "header_background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157668
+ "total_value_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157669
+ "total_background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157670
+ "subtotal_background_color": { "$ref": "#/$global/gaac/publisherColorValueV2" }
157671
+ }
157672
+ },
157673
+ "publisherHeadlineStyleV2": {
157674
+ "title": "Publisher Headline Style V2",
157675
+ "type": "object",
157676
+ "additionalProperties": false,
157677
+ "properties": {
157678
+ "primary_value_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157679
+ "primary_value_size": { "$ref": "#/$global/gaac/publisherPxV2" },
157680
+ "secondary_value_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157681
+ "secondary_value_size": { "$ref": "#/$global/gaac/publisherPxV2" },
157682
+ "positive_color": { "$ref": "#/$global/gaac/publisherColorValueV2" },
157683
+ "negative_color": { "$ref": "#/$global/gaac/publisherColorValueV2" }
157684
+ }
157685
+ },
157686
+ "publisherAxisDisplayV2": {
157687
+ "title": "Publisher Axis Display V2",
157688
+ "type": "object",
157689
+ "additionalProperties": false,
157690
+ "properties": {
157691
+ "visible": { "type": "boolean" },
157692
+ "name": {
157693
+ "title": "Publisher Axis Name Display V2",
157694
+ "type": "object",
157695
+ "additionalProperties": false,
157696
+ "properties": {
157697
+ "visible": { "type": "boolean" },
157698
+ "position": {
157699
+ "type": "string",
157700
+ "enum": [
157701
+ "low",
157702
+ "middle",
157703
+ "high"
157704
+ ]
157705
+ }
157706
+ }
157707
+ },
157708
+ "values": {
157709
+ "title": "Publisher Axis Values Display V2",
157710
+ "type": "object",
157711
+ "additionalProperties": false,
157712
+ "properties": {
157713
+ "visible": { "type": "boolean" },
157714
+ "rotation": {
157715
+ "type": "number",
157716
+ "minimum": -90,
157717
+ "maximum": 90
157718
+ }
157719
+ }
157720
+ },
157721
+ "min": { "type": "number" },
157722
+ "max": { "type": "number" }
157723
+ }
157724
+ },
157725
+ "publisherVisualizationDisplayV2": {
157726
+ "title": "Publisher Visualization Display V2",
157727
+ "type": "object",
157728
+ "additionalProperties": false,
157729
+ "properties": {
157730
+ "legend": {
157731
+ "title": "Publisher Legend Display V2",
157732
+ "type": "object",
157733
+ "additionalProperties": false,
157734
+ "properties": {
157735
+ "visible": { "type": "boolean" },
157736
+ "position": {
157737
+ "type": "string",
157738
+ "enum": [
157739
+ "auto",
157740
+ "top",
157741
+ "bottom",
157742
+ "left",
157743
+ "right"
157744
+ ]
157745
+ }
157746
+ }
157747
+ },
157748
+ "x_axis": { "$ref": "#/$defs/publisherAxisDisplayV2" },
157749
+ "y_axis": { "$ref": "#/$defs/publisherAxisDisplayV2" },
157750
+ "secondary_y_axis": { "$ref": "#/$defs/publisherAxisDisplayV2" },
157751
+ "gridlines": {
157752
+ "title": "Publisher Visibility V2",
157753
+ "type": "object",
157754
+ "additionalProperties": false,
157755
+ "properties": { "visible": { "type": "boolean" } }
157756
+ },
157757
+ "data_labels": {
157758
+ "title": "Publisher Auto Visibility V2",
157759
+ "type": "object",
157760
+ "additionalProperties": false,
157761
+ "properties": { "visible": { "oneOf": [{ "type": "boolean" }, {
157762
+ "type": "string",
157763
+ "enum": ["auto"]
157764
+ }] } }
157765
+ },
157766
+ "data_points": {
157767
+ "title": "Publisher Auto Visibility V2",
157768
+ "type": "object",
157769
+ "additionalProperties": false,
157770
+ "properties": { "visible": { "oneOf": [{ "type": "boolean" }, {
157771
+ "type": "string",
157772
+ "enum": ["auto"]
157773
+ }] } }
157774
+ }
157775
+ }
157776
+ },
157777
+ "publisherContainerV2": {
157778
+ "title": "Publisher Container V2",
157779
+ "type": "object",
157780
+ "additionalProperties": false,
157781
+ "properties": {
157782
+ "type": {
157783
+ "type": "string",
157784
+ "enum": ["row", "column"]
157785
+ },
157786
+ "id": { "$ref": "#/$global/gaac/publisherPageNodeIdV2" },
157787
+ "children": {
157788
+ "type": "array",
157789
+ "description": "Nodes laid out along the container's direction. An empty list renders as a spacer.",
157790
+ "items": { "$ref": "#/$global/gaac/publisherLayoutNodeV2" }
157791
+ },
157792
+ "proportion": { "$ref": "#/$global/gaac/publisherPageProportionV2" },
157793
+ "locked": { "type": "boolean" },
157794
+ "style": { "$ref": "#/$global/gaac/publisherContainerStyleV2" }
157795
+ },
157796
+ "required": ["type", "children"]
157797
+ },
157798
+ "publisherTitleWidgetV2": {
157799
+ "title": "Publisher Title Widget V2",
157800
+ "type": "object",
157801
+ "additionalProperties": false,
157802
+ "description": "The page title. At most one per page.",
157803
+ "properties": {
157804
+ "type": {
157805
+ "type": "string",
157806
+ "enum": ["title"]
157807
+ },
157808
+ "id": {
157809
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
157810
+ "description": "Unique within the page."
157811
+ },
157812
+ "proportion": { "$ref": "#/$global/gaac/publisherPageProportionV2" },
157813
+ "placeholder": { "$ref": "#/$global/gaac/publisherWidgetPlaceholderV2" },
157814
+ "locked": { "type": "boolean" },
157815
+ "markdown": {
157816
+ "type": "string",
157817
+ "minLength": 1,
157818
+ "description": "Inline markdown only: strong, emphasis, highlight, strike, links and line breaks."
157819
+ },
157820
+ "style": { "$ref": "#/$global/gaac/publisherTextWidgetStyleV2" }
157821
+ },
157822
+ "required": ["type", "id"]
157823
+ },
157824
+ "publisherHeadingWidgetV2": {
157825
+ "title": "Publisher Heading Widget V2",
157826
+ "type": "object",
157827
+ "additionalProperties": false,
157828
+ "properties": {
157829
+ "type": {
157830
+ "type": "string",
157831
+ "enum": ["heading"]
157832
+ },
157833
+ "id": {
157834
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
157835
+ "description": "Unique within the page."
157836
+ },
157837
+ "proportion": { "$ref": "#/$global/gaac/publisherPageProportionV2" },
157838
+ "placeholder": { "$ref": "#/$global/gaac/publisherWidgetPlaceholderV2" },
157839
+ "locked": { "type": "boolean" },
157840
+ "markdown": {
157841
+ "type": "string",
157842
+ "minLength": 1,
157843
+ "description": "Inline markdown only."
157844
+ },
157845
+ "level": {
157846
+ "type": "integer",
157847
+ "enum": [
157848
+ 1,
157849
+ 2,
157850
+ 3,
157851
+ 4,
157852
+ 5,
157853
+ 6
157854
+ ],
157855
+ "description": "Defaults to 1."
157856
+ },
157857
+ "style": { "$ref": "#/$global/gaac/publisherTextWidgetStyleV2" }
157858
+ },
157859
+ "required": ["type", "id"]
157860
+ },
157861
+ "publisherTextWidgetV2": {
157862
+ "title": "Publisher Text Widget V2",
157863
+ "type": "object",
157864
+ "additionalProperties": false,
157865
+ "properties": {
157866
+ "type": {
157867
+ "type": "string",
157868
+ "enum": ["text"]
157869
+ },
157870
+ "id": {
157871
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
157872
+ "description": "Unique within the page."
157873
+ },
157874
+ "proportion": { "$ref": "#/$global/gaac/publisherPageProportionV2" },
157875
+ "placeholder": { "$ref": "#/$global/gaac/publisherWidgetPlaceholderV2" },
157876
+ "locked": { "type": "boolean" },
157877
+ "markdown": {
157878
+ "type": "string",
157879
+ "minLength": 1,
157880
+ "description": "Full markdown: paragraphs, lists, quotes and headings."
157881
+ },
157882
+ "decorative": {
157883
+ "type": "boolean",
157884
+ "description": "Page furniture such as page numbers: kept out of the accessibility tree, PDF tags and AI context."
157885
+ },
157886
+ "style": { "$ref": "#/$global/gaac/publisherTextWidgetStyleV2" }
157887
+ },
157888
+ "required": ["type", "id"]
157889
+ },
157890
+ "publisherImageWidgetV2": {
157891
+ "title": "Publisher Image Widget V2",
157892
+ "type": "object",
157893
+ "additionalProperties": false,
157894
+ "properties": {
157895
+ "type": {
157896
+ "type": "string",
157897
+ "enum": ["image"]
157898
+ },
157899
+ "id": {
157900
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
157901
+ "description": "Unique within the page."
157902
+ },
157903
+ "proportion": { "$ref": "#/$global/gaac/publisherPageProportionV2" },
157904
+ "placeholder": { "$ref": "#/$global/gaac/publisherWidgetPlaceholderV2" },
157905
+ "locked": { "type": "boolean" },
157906
+ "source": { "$ref": "#/$global/gaac/publisherImageSourceV2" },
157907
+ "alt_text": {
157908
+ "type": "string",
157909
+ "minLength": 1
157910
+ },
157911
+ "decorative": {
157912
+ "type": "boolean",
157913
+ "description": "A decorative image needs no alt text."
157914
+ },
157915
+ "style": { "$ref": "#/$global/gaac/publisherImageWidgetStyleV2" }
157916
+ },
157917
+ "required": ["type", "id"]
157918
+ },
157919
+ "publisherVisualizationWidgetV2": {
157920
+ "title": "Publisher Visualization Widget V2",
157921
+ "type": "object",
157922
+ "additionalProperties": false,
157923
+ "properties": {
157924
+ "type": {
157925
+ "type": "string",
157926
+ "enum": ["visualization"]
157927
+ },
157928
+ "id": {
157929
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
157930
+ "description": "Unique within the page."
157931
+ },
157932
+ "proportion": { "$ref": "#/$global/gaac/publisherPageProportionV2" },
157933
+ "placeholder": { "$ref": "#/$global/gaac/publisherWidgetPlaceholderV2" },
157934
+ "locked": { "type": "boolean" },
157935
+ "visualization": {
157936
+ "$ref": "#/$global/gaac/identifier",
157937
+ "description": "An id of the visualization rendered here.",
157938
+ "$semantic": {
157939
+ "type": "reference",
157940
+ "source": "visualisation.id"
157941
+ }
157942
+ },
157943
+ "title": { "$ref": "#/$global/gaac/publisherWidgetTitleV2" },
157944
+ "alt_text": {
157945
+ "type": "string",
157946
+ "minLength": 1
157947
+ },
157948
+ "date": {
157949
+ "$ref": "#/$global/gaac/identifier",
157950
+ "description": "An id of the date dataset the document period applies to.",
157951
+ "$semantic": {
157952
+ "type": "reference",
157953
+ "source": "dateDataset.id"
157954
+ }
157955
+ },
157956
+ "ignore_document_period": {
157957
+ "type": "boolean",
157958
+ "description": "When true, the document period does not apply here."
157959
+ },
157960
+ "filters": {
157961
+ "$ref": "#/$global/gaac/dashboardFilters",
157962
+ "description": "Filters applied on top of the page and document filters."
157963
+ },
157964
+ "ignored_filters": {
157965
+ "type": "array",
157966
+ "description": "Document filters ignored here.",
157967
+ "items": {
157968
+ "type": "string",
157969
+ "pattern": "^(label|computed_attribute|dataset|metric)/(?!\\.)[.A-Za-z0-9_-]{1,255}$",
157970
+ "description": "A type-prefixed id, for example label/region.name, dataset/order_date or metric/revenue.",
157971
+ "$semantic": {
157972
+ "type": "reference",
157973
+ "sources": [
157974
+ "label.id",
157975
+ "computedAttribute.id",
157976
+ "dateDataset.id",
157977
+ "metric.id"
157978
+ ],
157979
+ "typePrefix": true
157980
+ }
157981
+ }
157982
+ },
157983
+ "display": { "$ref": "#/$defs/publisherVisualizationDisplayV2" },
157984
+ "style": { "$ref": "#/$global/gaac/publisherVisualizationStyleV2" }
157985
+ },
157986
+ "required": ["type", "id"]
157987
+ },
157988
+ "publisherTakeawayWidgetV2": {
157989
+ "title": "Publisher Takeaway Widget V2",
157990
+ "type": "object",
157991
+ "additionalProperties": false,
157992
+ "description": "Generated or written text about the page.",
157993
+ "properties": {
157994
+ "type": {
157995
+ "type": "string",
157996
+ "enum": ["takeaway"]
157997
+ },
157998
+ "id": {
157999
+ "$ref": "#/$global/gaac/publisherPageNodeIdV2",
158000
+ "description": "Unique within the page."
158001
+ },
158002
+ "proportion": { "$ref": "#/$global/gaac/publisherPageProportionV2" },
158003
+ "placeholder": { "$ref": "#/$global/gaac/publisherWidgetPlaceholderV2" },
158004
+ "locked": { "type": "boolean" },
158005
+ "title": { "$ref": "#/$global/gaac/publisherWidgetTitleV2" },
158006
+ "markdown": {
158007
+ "type": "string",
158008
+ "minLength": 1,
158009
+ "description": "The generated or written text."
158010
+ },
158011
+ "generation": { "$ref": "#/$global/gaac/publisherTakeawayGenerationV2" },
158012
+ "style": { "$ref": "#/$global/gaac/publisherTextWidgetStyleV2" }
158013
+ },
158014
+ "required": ["type", "id"]
158015
+ },
158016
+ "publisherPageTemplateV2": {
158017
+ "title": "Publisher Page Template V2",
158018
+ "type": "object",
158019
+ "additionalProperties": false,
158020
+ "properties": {
158021
+ "id": {
158022
+ "type": "string",
158023
+ "pattern": "^(?!default\\.)(?!\\.)[.A-Za-z0-9_-]{1,255}$",
158024
+ "description": "A unique identifier of the page template. Ids starting with default. are reserved.",
158025
+ "$semantic": [{
158026
+ "type": "uniqueness",
158027
+ "source": "pageTemplate.id",
158028
+ "code": "core.uniqueness.pageTemplates.id"
158029
+ }, {
158030
+ "type": "definition",
158031
+ "source": "pageTemplate.id"
158032
+ }]
158033
+ },
158034
+ "type": {
158035
+ "type": "string",
158036
+ "enum": ["page_template"]
158037
+ },
158038
+ "version": {
158039
+ "type": "string",
158040
+ "enum": ["2"],
158041
+ "description": "Version of the content format."
158042
+ },
158043
+ "title": { "$ref": "#/$global/gaac/publisherEntityTitleV2" },
158044
+ "description": { "$ref": "#/$global/gaac/publisherEntityDescriptionV2" },
158045
+ "tags": { "$ref": "#/$global/gaac/publisherEntityTagsV2" },
158046
+ "content": {
158047
+ "$ref": "#/$global/gaac/publisherPageBodyV2",
158048
+ "description": "Copied into a document, with a page id added, when the template is used."
158049
+ }
158050
+ },
158051
+ "required": [
158052
+ "id",
158053
+ "type",
158054
+ "version",
158055
+ "title",
158056
+ "content"
158057
+ ],
158058
+ "$semantic": {
158059
+ "type": "snippet",
158060
+ "snippets": ["page_template"]
158061
+ }
158062
+ },
156203
158063
  "parameter": {
156204
158064
  "title": "Parameter",
156205
158065
  "type": "object",
@@ -160578,12 +162438,48 @@ function addSql$1(root, codeActions, node, prop, diagnostics, inside) {
160578
162438
  }
160579
162439
  }
160580
162440
  //#endregion
162441
+ //#region ../code/esm/features/codeActions/codeActions/languages/yaml/publisherIds.js
162442
+ function isBefore(one, other) {
162443
+ return one.line < other.line || one.line === other.line && one.column < other.column;
162444
+ }
162445
+ function isMissingIdInRange(diagnostic, { start, end }) {
162446
+ const { position } = diagnostic;
162447
+ return diagnostic.code === SchemaErrorCodes.MissingRequiredProperty && diagnostic.parameters[0] === "id" && position !== void 0 && !isBefore(position.end, start) && !isBefore(end, position.start);
162448
+ }
162449
+ function startsAt(diagnostic, offset) {
162450
+ return offset !== void 0 && diagnostic.position?.start.offset === offset;
162451
+ }
162452
+ /**
162453
+ * Offers to add the section, page and widget ids a v2 Publisher entity leaves out, on a missing `id`
162454
+ * the requested range touches.
162455
+ */
162456
+ function getPublisherIdCodeActions(input) {
162457
+ const inRange = input.diagnostics.filter((diagnostic) => isMissingIdInRange(diagnostic, input));
162458
+ if (inRange.length === 0) return [];
162459
+ const entityStart = (0, import_dist$6.parseDocument)(input.content).contents?.range?.[0];
162460
+ const missingIds = inRange.filter((diagnostic) => !startsAt(diagnostic, entityStart));
162461
+ if (missingIds.length === 0) return [];
162462
+ const filled = fillPublisherIdsV2(input.content);
162463
+ return filled.changed ? [{
162464
+ kind: CodeActionsKind.QuickFix,
162465
+ title: "Add missing ids",
162466
+ diagnostics: missingIds,
162467
+ preferred: true,
162468
+ edit: { content: filled.content }
162469
+ }] : [];
162470
+ }
162471
+ //#endregion
160581
162472
  //#region ../code/esm/features/codeActions/codeActions/languages/yaml/index.js
160582
162473
  async function codeActionsYaml(state, file, node, start, end) {
160583
162474
  const textDocument = findTextDocument(file.node)?.textDocument;
160584
162475
  if (file.language === LanguageId.Yaml && textDocument) {
160585
162476
  const diagnostics = await diagnosticsFileNode(file.node);
160586
- if (selectSchemaSchemasStore(state, await resolve$4(state, file))) return findAllCodeActions(diagnostics, node, start, end);
162477
+ if (selectSchemaSchemasStore(state, await resolve$4(state, file))) return [...findAllCodeActions(diagnostics, node, start, end), ...getPublisherIdCodeActions({
162478
+ diagnostics,
162479
+ content: textDocument.getText(),
162480
+ start,
162481
+ end
162482
+ })];
160587
162483
  }
160588
162484
  return [];
160589
162485
  }
@@ -162777,6 +164673,9 @@ function referencesFindYamlForReferences(references, nodeItem, semanticItem, typ
162777
164673
  case "report.id":
162778
164674
  case "reportTemplate.id":
162779
164675
  case "reportPageLayout.id":
164676
+ case "document.id":
164677
+ case "documentTemplate.id":
164678
+ case "pageTemplate.id":
162780
164679
  case "current.manifest.profiles":
162781
164680
  case "current.dataset.attributes":
162782
164681
  case "table/column.dataType":
@@ -162845,6 +164744,15 @@ function referencesFindYamlForDefinition(references, parents, nodeItem, semantic
162845
164744
  case "reportPageLayout.id":
162846
164745
  prev.push(...createDefinitionForMainType(references, isReportPageLayout, value, "report_page_layout"));
162847
164746
  break;
164747
+ case "document.id":
164748
+ prev.push(...createDefinitionForMainType(references, isDocument, value, "document"));
164749
+ break;
164750
+ case "documentTemplate.id":
164751
+ prev.push(...createDefinitionForMainType(references, isDocumentTemplate, value, "document_template"));
164752
+ break;
164753
+ case "pageTemplate.id":
164754
+ prev.push(...createDefinitionForMainType(references, isPageTemplate, value, "page_template"));
164755
+ break;
162848
164756
  case "attribute.id":
162849
164757
  prev.push(...createDefinitionForPropertyElement(parents, nodeItem, semanticItem, isAttribute$3, value, ["attribute", "label"]));
162850
164758
  prev.push(...createDefinitionFoDateDatesetElements(references, semanticItem, value, ["attribute", "label"]));
@@ -163357,6 +165265,9 @@ function createTextEdit(item, name) {
163357
165265
  case "report":
163358
165266
  case "report_template":
163359
165267
  case "report_page_layout":
165268
+ case "document":
165269
+ case "document_template":
165270
+ case "page_template":
163360
165271
  case "label": {
163361
165272
  const prefix = `${item.type}/`;
163362
165273
  if (item.content.startsWith(prefix)) return {
@@ -163811,7 +165722,7 @@ async function open(state, emitter, file) {
163811
165722
  //#endregion
163812
165723
  //#region ../code/package.json
163813
165724
  var name = "@gooddata/code";
163814
- var version = "0.59.0-alpha.1";
165725
+ var version = "0.59.0-alpha.3";
163815
165726
  //#endregion
163816
165727
  //#region ../../../sdk/libs/api-client-tiger/src/axios.ts
163817
165728
  /**
@@ -163833,7 +165744,7 @@ const _CONFIG = {
163833
165744
  common: {
163834
165745
  "X-Requested-With": "XMLHttpRequest",
163835
165746
  "X-GDC-JS-PACKAGE": "@gooddata/api-client-tiger",
163836
- "X-GDC-JS-PACKAGE-VERSION": "11.63.0-alpha.1"
165747
+ "X-GDC-JS-PACKAGE-VERSION": "11.63.0-alpha.3"
163837
165748
  },
163838
165749
  post: { "Content-Type": "application/json;charset=utf8" },
163839
165750
  put: { "Content-Type": "application/json;charset=utf8" }