@gooddata/sdk-ui-catalog 11.68.0-alpha.1 → 11.68.0-alpha.11

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 (200) hide show
  1. package/LICENSE +26 -4
  2. package/NOTICE +15673 -0
  3. package/README.md +1 -1
  4. package/esm/asCode/AsCodeDialog.d.ts.map +1 -1
  5. package/esm/asCode/AsCodeDialog.js +7 -5
  6. package/esm/asCode/AsCodeEditorBody.d.ts +6 -6
  7. package/esm/asCode/AsCodeEditorBody.d.ts.map +1 -1
  8. package/esm/asCode/AsCodeEditorBody.js +13 -6
  9. package/esm/asCode/descriptor.d.ts +23 -2
  10. package/esm/asCode/descriptor.d.ts.map +1 -1
  11. package/esm/asCode/descriptor.js +8 -0
  12. package/esm/asCode/keyCompletions.d.ts +12 -0
  13. package/esm/asCode/keyCompletions.d.ts.map +1 -0
  14. package/esm/asCode/keyCompletions.js +58 -0
  15. package/esm/asCode/schemaKeys.d.ts +13 -0
  16. package/esm/asCode/schemaKeys.d.ts.map +1 -0
  17. package/esm/asCode/schemaKeys.js +45 -0
  18. package/esm/asCode/validateYaml.d.ts +28 -25
  19. package/esm/asCode/validateYaml.d.ts.map +1 -1
  20. package/esm/asCode/validateYaml.js +34 -11
  21. package/esm/catalogDetail/CatalogDetailContent.d.ts.map +1 -1
  22. package/esm/catalogDetail/CatalogDetailContent.js +2 -3
  23. package/esm/catalogDetail/hooks/useCatalogItemLoad.d.ts.map +1 -1
  24. package/esm/catalogDetail/hooks/useCatalogItemLoad.js +6 -2
  25. package/esm/catalogDetail/hooks/useCatalogItemUpdate.d.ts.map +1 -1
  26. package/esm/catalogDetail/hooks/useCatalogItemUpdate.js +2 -2
  27. package/esm/catalogItem/catalogBackend.test.utils.d.ts.map +1 -1
  28. package/esm/catalogItem/catalogBackend.test.utils.js +2 -0
  29. package/esm/catalogItem/converter.d.ts +4 -3
  30. package/esm/catalogItem/converter.d.ts.map +1 -1
  31. package/esm/catalogItem/converter.js +24 -1
  32. package/esm/catalogItem/guards.d.ts +5 -1
  33. package/esm/catalogItem/guards.d.ts.map +1 -1
  34. package/esm/catalogItem/guards.js +6 -0
  35. package/esm/catalogItem/permission.d.ts.map +1 -1
  36. package/esm/catalogItem/permission.js +5 -1
  37. package/esm/catalogItem/query.d.ts +10 -1
  38. package/esm/catalogItem/query.d.ts.map +1 -1
  39. package/esm/catalogItem/query.js +60 -0
  40. package/esm/catalogItem/types.d.ts +13 -1
  41. package/esm/catalogItem/types.d.ts.map +1 -1
  42. package/esm/catalogItem/useCatalogEndpoints.d.ts +12 -5
  43. package/esm/catalogItem/useCatalogEndpoints.d.ts.map +1 -1
  44. package/esm/catalogItem/useCatalogEndpoints.js +37 -20
  45. package/esm/catalogItem/useCatalogItemFeed.d.ts +1 -0
  46. package/esm/catalogItem/useCatalogItemFeed.d.ts.map +1 -1
  47. package/esm/catalogItem/useCatalogItemFeed.js +4 -1
  48. package/esm/catalogItem/useCatalogItemSemanticSearch.d.ts.map +1 -1
  49. package/esm/catalogItem/useCatalogItemSemanticSearch.js +18 -6
  50. package/esm/computedAttribute/computedAttributeCompletions.d.ts +1 -7
  51. package/esm/computedAttribute/computedAttributeCompletions.d.ts.map +1 -1
  52. package/esm/computedAttribute/computedAttributeCompletions.js +2 -19
  53. package/esm/computedAttribute/computedAttributeDescriptor.d.ts.map +1 -1
  54. package/esm/computedAttribute/computedAttributeDescriptor.js +2 -2
  55. package/esm/computedAttribute/computedAttributeSchema.d.ts +2 -6
  56. package/esm/computedAttribute/computedAttributeSchema.d.ts.map +1 -1
  57. package/esm/computedAttribute/computedAttributeSchema.js +2 -8
  58. package/esm/computedAttribute/computedAttributeValidation.d.ts +3 -3
  59. package/esm/computedAttribute/computedAttributeValidation.d.ts.map +1 -1
  60. package/esm/computedAttribute/computedAttributeValidation.js +32 -44
  61. package/esm/document/gate.d.ts +6 -0
  62. package/esm/document/gate.d.ts.map +1 -0
  63. package/esm/document/gate.js +13 -0
  64. package/esm/document/scope.d.ts +18 -0
  65. package/esm/document/scope.d.ts.map +1 -0
  66. package/esm/document/scope.js +36 -0
  67. package/esm/filter/FilterContext.d.ts.map +1 -1
  68. package/esm/filter/FilterContext.js +9 -9
  69. package/esm/filter/StaticFilter.js +3 -3
  70. package/esm/header/CreateObjectButton.d.ts.map +1 -1
  71. package/esm/header/CreateObjectButton.js +5 -1
  72. package/esm/index.d.ts +3 -3
  73. package/esm/index.d.ts.map +1 -1
  74. package/esm/index.js +1 -1
  75. package/esm/localization/bundles/de-DE.localization-bundle.d.ts +1 -0
  76. package/esm/localization/bundles/de-DE.localization-bundle.d.ts.map +1 -1
  77. package/esm/localization/bundles/de-DE.localization-bundle.js +6 -5
  78. package/esm/localization/bundles/en-AU.localization-bundle.d.ts +1 -0
  79. package/esm/localization/bundles/en-AU.localization-bundle.d.ts.map +1 -1
  80. package/esm/localization/bundles/en-AU.localization-bundle.js +6 -5
  81. package/esm/localization/bundles/en-GB.localization-bundle.d.ts +1 -0
  82. package/esm/localization/bundles/en-GB.localization-bundle.d.ts.map +1 -1
  83. package/esm/localization/bundles/en-GB.localization-bundle.js +6 -5
  84. package/esm/localization/bundles/en-US.localization-bundle.d.ts +8 -0
  85. package/esm/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
  86. package/esm/localization/bundles/en-US.localization-bundle.js +12 -4
  87. package/esm/localization/bundles/es-419.localization-bundle.d.ts +1 -0
  88. package/esm/localization/bundles/es-419.localization-bundle.d.ts.map +1 -1
  89. package/esm/localization/bundles/es-419.localization-bundle.js +6 -5
  90. package/esm/localization/bundles/es-ES.localization-bundle.d.ts +1 -0
  91. package/esm/localization/bundles/es-ES.localization-bundle.d.ts.map +1 -1
  92. package/esm/localization/bundles/es-ES.localization-bundle.js +6 -5
  93. package/esm/localization/bundles/fi-FI.localization-bundle.d.ts +1 -0
  94. package/esm/localization/bundles/fi-FI.localization-bundle.d.ts.map +1 -1
  95. package/esm/localization/bundles/fi-FI.localization-bundle.js +6 -5
  96. package/esm/localization/bundles/fr-CA.localization-bundle.d.ts +1 -0
  97. package/esm/localization/bundles/fr-CA.localization-bundle.d.ts.map +1 -1
  98. package/esm/localization/bundles/fr-CA.localization-bundle.js +6 -5
  99. package/esm/localization/bundles/fr-FR.localization-bundle.d.ts +1 -0
  100. package/esm/localization/bundles/fr-FR.localization-bundle.d.ts.map +1 -1
  101. package/esm/localization/bundles/fr-FR.localization-bundle.js +6 -5
  102. package/esm/localization/bundles/id-ID.localization-bundle.d.ts +1 -0
  103. package/esm/localization/bundles/id-ID.localization-bundle.d.ts.map +1 -1
  104. package/esm/localization/bundles/id-ID.localization-bundle.js +6 -5
  105. package/esm/localization/bundles/it-IT.localization-bundle.d.ts +1 -0
  106. package/esm/localization/bundles/it-IT.localization-bundle.d.ts.map +1 -1
  107. package/esm/localization/bundles/it-IT.localization-bundle.js +9 -8
  108. package/esm/localization/bundles/ja-JP.localization-bundle.d.ts +1 -0
  109. package/esm/localization/bundles/ja-JP.localization-bundle.d.ts.map +1 -1
  110. package/esm/localization/bundles/ja-JP.localization-bundle.js +6 -5
  111. package/esm/localization/bundles/ko-KR.localization-bundle.d.ts +1 -0
  112. package/esm/localization/bundles/ko-KR.localization-bundle.d.ts.map +1 -1
  113. package/esm/localization/bundles/ko-KR.localization-bundle.js +6 -5
  114. package/esm/localization/bundles/nl-NL.localization-bundle.d.ts +1 -0
  115. package/esm/localization/bundles/nl-NL.localization-bundle.d.ts.map +1 -1
  116. package/esm/localization/bundles/nl-NL.localization-bundle.js +6 -5
  117. package/esm/localization/bundles/pl-PL.localization-bundle.d.ts +1 -0
  118. package/esm/localization/bundles/pl-PL.localization-bundle.d.ts.map +1 -1
  119. package/esm/localization/bundles/pl-PL.localization-bundle.js +6 -5
  120. package/esm/localization/bundles/pt-BR.localization-bundle.d.ts +1 -0
  121. package/esm/localization/bundles/pt-BR.localization-bundle.d.ts.map +1 -1
  122. package/esm/localization/bundles/pt-BR.localization-bundle.js +6 -5
  123. package/esm/localization/bundles/pt-PT.localization-bundle.d.ts +1 -0
  124. package/esm/localization/bundles/pt-PT.localization-bundle.d.ts.map +1 -1
  125. package/esm/localization/bundles/pt-PT.localization-bundle.js +6 -5
  126. package/esm/localization/bundles/ru-RU.localization-bundle.d.ts +1 -0
  127. package/esm/localization/bundles/ru-RU.localization-bundle.d.ts.map +1 -1
  128. package/esm/localization/bundles/ru-RU.localization-bundle.js +6 -5
  129. package/esm/localization/bundles/sl-SI.localization-bundle.d.ts +1 -0
  130. package/esm/localization/bundles/sl-SI.localization-bundle.d.ts.map +1 -1
  131. package/esm/localization/bundles/sl-SI.localization-bundle.js +6 -5
  132. package/esm/localization/bundles/th-TH.localization-bundle.d.ts +1 -0
  133. package/esm/localization/bundles/th-TH.localization-bundle.d.ts.map +1 -1
  134. package/esm/localization/bundles/th-TH.localization-bundle.js +6 -5
  135. package/esm/localization/bundles/tr-TR.localization-bundle.d.ts +1 -0
  136. package/esm/localization/bundles/tr-TR.localization-bundle.d.ts.map +1 -1
  137. package/esm/localization/bundles/tr-TR.localization-bundle.js +6 -5
  138. package/esm/localization/bundles/uk-UA.localization-bundle.d.ts +1 -0
  139. package/esm/localization/bundles/uk-UA.localization-bundle.d.ts.map +1 -1
  140. package/esm/localization/bundles/uk-UA.localization-bundle.js +6 -5
  141. package/esm/localization/bundles/vi-VN.localization-bundle.d.ts +1 -0
  142. package/esm/localization/bundles/vi-VN.localization-bundle.d.ts.map +1 -1
  143. package/esm/localization/bundles/vi-VN.localization-bundle.js +6 -5
  144. package/esm/localization/bundles/zh-HK.localization-bundle.d.ts +1 -0
  145. package/esm/localization/bundles/zh-HK.localization-bundle.d.ts.map +1 -1
  146. package/esm/localization/bundles/zh-HK.localization-bundle.js +6 -5
  147. package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts +1 -0
  148. package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts.map +1 -1
  149. package/esm/localization/bundles/zh-Hans.localization-bundle.js +6 -5
  150. package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts +1 -0
  151. package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts.map +1 -1
  152. package/esm/localization/bundles/zh-Hant.localization-bundle.js +7 -6
  153. package/esm/localization/translations.d.ts.map +1 -1
  154. package/esm/localization/translations.js +3 -4
  155. package/esm/metric/metricCompletions.d.ts +1 -7
  156. package/esm/metric/metricCompletions.d.ts.map +1 -1
  157. package/esm/metric/metricCompletions.js +2 -16
  158. package/esm/metric/metricDescriptor.d.ts.map +1 -1
  159. package/esm/metric/metricDescriptor.js +2 -2
  160. package/esm/metric/metricSchema.d.ts +2 -6
  161. package/esm/metric/metricSchema.d.ts.map +1 -1
  162. package/esm/metric/metricSchema.js +2 -8
  163. package/esm/metric/metricValidation.d.ts +3 -3
  164. package/esm/metric/metricValidation.d.ts.map +1 -1
  165. package/esm/metric/metricValidation.js +12 -18
  166. package/esm/objectType/ObjectTypeIcon.d.ts.map +1 -1
  167. package/esm/objectType/ObjectTypeIcon.js +1 -1
  168. package/esm/objectType/ObjectTypeSelect.d.ts.map +1 -1
  169. package/esm/objectType/ObjectTypeSelect.js +2 -0
  170. package/esm/objectType/constants.d.ts +7 -3
  171. package/esm/objectType/constants.d.ts.map +1 -1
  172. package/esm/objectType/constants.js +3 -1
  173. package/esm/objectType/labels.d.ts.map +1 -1
  174. package/esm/objectType/labels.js +1 -0
  175. package/esm/objectType/types.d.ts +2 -2
  176. package/esm/objectType/types.d.ts.map +1 -1
  177. package/esm/parameter/parameterCompletions.d.ts.map +1 -1
  178. package/esm/parameter/parameterCompletions.js +19 -6
  179. package/esm/parameter/parameterDescriptor.d.ts.map +1 -1
  180. package/esm/parameter/parameterDescriptor.js +5 -8
  181. package/esm/parameter/parameterSchema.d.ts +2 -7
  182. package/esm/parameter/parameterSchema.d.ts.map +1 -1
  183. package/esm/parameter/parameterSchema.js +1 -40
  184. package/esm/parameter/parameterValidation.d.ts +3 -2
  185. package/esm/parameter/parameterValidation.d.ts.map +1 -1
  186. package/esm/parameter/parameterValidation.js +26 -36
  187. package/esm/quality/gate.d.ts +9 -0
  188. package/esm/quality/gate.d.ts.map +1 -1
  189. package/esm/quality/gate.js +18 -0
  190. package/esm/sdk-ui-catalog.d.ts +35 -5
  191. package/esm/tabs/useTrendingItems.js +1 -1
  192. package/package.json +18 -17
  193. package/styles/css/detail.css +3 -0
  194. package/styles/css/detail.css.map +1 -1
  195. package/styles/css/main.css +4 -1
  196. package/styles/css/main.css.map +1 -1
  197. package/styles/css/objectType.css +3 -0
  198. package/styles/css/objectType.css.map +1 -1
  199. package/styles/scss/main.scss +1 -1
  200. package/styles/scss/objectType.scss +4 -0
package/README.md CHANGED
@@ -90,4 +90,4 @@ export function App() {
90
90
 
91
91
  (C) 2025 GoodData Corporation
92
92
 
93
- This project is licensed under the MIT License. See [LICENSE](./LICENSE).
93
+ This project is licensed under the GoodData commercial license. See [LICENSE](./LICENSE).
@@ -1 +1 @@
1
- {"version":3,"file":"AsCodeDialog.d.ts","sourceRoot":"","sources":["../../src/asCode/AsCodeDialog.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAGR,iBAAiB,EAGpB,MAAM,iBAAiB,CAAC;AA8BzB,KAAK,UAAU,GAAG;IACd,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,KAAK,KAAK,GAAG;IACT,UAAU,EAAE,iBAAiB,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,GAAG,CACE,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,eAAe,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,UAAU,CAAC,GAC9D,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC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KAAK,EAAE,KAAK,2CA4OxC"}
@@ -3,7 +3,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
3
3
  import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { FormattedMessage, defineMessages, useIntl } from "react-intl";
5
5
  import { LoadingComponent } from "@gooddata/sdk-ui";
6
- import { ConfirmDialog, UiButton, UiIcon, UiLink, UiTooltip } from "@gooddata/sdk-ui-kit";
6
+ import { ConfirmDialog, UiButton, UiIcon, UiLink, UiTooltip, isApplePlatform } from "@gooddata/sdk-ui-kit";
7
7
  import { useIsWhiteLabeled } from "../permission/PermissionsContext.js";
8
8
  import { extractBackendErrorDetail } from "../utils/backendError.js";
9
9
  import { useAsCodeLoadFailure } from "./useAsCodeLoadFailure.js";
@@ -80,6 +80,7 @@ export function AsCodeDialog(props) {
80
80
  onClose();
81
81
  }
82
82
  }, [isSubmitting, onClose]);
83
+ const validationContext = useMemo(() => (mode === "edit" ? { intent: "edit", fixedIdentifier } : { intent: "create" }), [mode, fixedIdentifier]);
83
84
  const handleChange = useCallback((nextValue) => {
84
85
  yamlValue.current = nextValue;
85
86
  setIsDirty(true);
@@ -94,8 +95,7 @@ export function AsCodeDialog(props) {
94
95
  if (!editing || initialYaml === null || !onSubmit) {
95
96
  return;
96
97
  }
97
- const context = mode === "edit" ? { intent: "edit", fixedIdentifier } : { intent: "create" };
98
- const result = editing.validate(yamlValue.current ?? initialYaml, context);
98
+ const result = editing.validate(yamlValue.current ?? initialYaml, validationContext);
99
99
  if (!result.isValid) {
100
100
  setValidationError(result.error);
101
101
  return;
@@ -112,7 +112,7 @@ export function AsCodeDialog(props) {
112
112
  finally {
113
113
  setIsSubmitting(false);
114
114
  }
115
- }, [descriptor, editing, fixedIdentifier, initialYaml, intl, mode, onSubmit, reconcileWithBase]);
115
+ }, [descriptor, editing, initialYaml, intl, onSubmit, reconcileWithBase, validationContext]);
116
116
  const handleDuplicate = useCallback(() => {
117
117
  if (!onDuplicate || !editing || initialYaml === null) {
118
118
  return;
@@ -141,5 +141,7 @@ export function AsCodeDialog(props) {
141
141
  return (_jsx(ConfirmDialog, { className: "gd-ascode-dialog", containerClassName: "gd-ascode-dialog-overlay", headline: headlineMessage, cancelButtonText: cancelMessage, submitButtonText: submitMessage, isPositive: true, hideSubmitButton: isView, isSubmitDisabled: isSubmitting || loading || isBaseUnrepresentable || (isEdit && !isDirty), isCancelDisabled: isSubmitting, shouldCloseOnEscape: !isSubmitting,
142
142
  // The body is a multi-line code editor, so Enter inserts a line break there. Without this
143
143
  // the dialog treats the editor's contenteditable as a text input and saves on Enter.
144
- submitOnEnterKey: false, onCancel: handleClose, onClose: handleClose, onSubmit: handleSubmit, displayCloseButton: !isSubmitting, footerLeftRenderer: isView ? undefined : footerLeftRenderer, children: _jsx("div", { className: "gd-ascode-dialog-content", children: _jsx(Suspense, { fallback: bodySpinner, children: loading ? (bodySpinner) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "gd-ascode-dialog-section-header", children: [intl.formatMessage(descriptor.messages.sectionHeader), _jsx(UiTooltip, { arrowPlacement: "top", optimalPlacement: true, triggerBy: ["hover", "click", "focus"], anchor: _jsx(UiIcon, { type: "question", size: 14, color: "complementary-6" }), content: intl.formatMessage(descriptor.messages.sectionHeaderTooltip) })] }), isBaseUnrepresentable ? (_jsx("div", { className: "gd-ascode-dialog-notice", children: intl.formatMessage(messages.unrepresentable) })) : null, _jsx("div", { className: "gd-ascode-dialog-editor", children: _jsx(AsCodeEditorBody, { readOnly: isView, initialValue: initialYaml, label: intl.formatMessage(descriptor.messages.sectionHeader), onChange: handleChange, disabled: isSubmitting || isBaseUnrepresentable, completionSource: editing.completionSource, syntaxErrorMessage: editing.syntaxErrorMessage }) }), validationError || submitError ? (_jsxs("div", { className: "gd-ascode-dialog-error", children: [_jsx("span", { className: "gd-ascode-dialog-error-label", children: _jsx(FormattedMessage, { id: "analyticsCatalog.dialog.error.label" }) }), " ", validationError ?? submitError] })) : null] })) }) }) }));
144
+ submitOnEnterKey: false, onCancel: handleClose, onClose: handleClose, onSubmit: handleSubmit, displayCloseButton: !isSubmitting, footerLeftRenderer: isView ? undefined : footerLeftRenderer, children: _jsx("div", { className: "gd-ascode-dialog-content", children: _jsx(Suspense, { fallback: bodySpinner, children: loading ? (bodySpinner) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "gd-ascode-dialog-section-header", children: [intl.formatMessage(descriptor.messages.sectionHeader), _jsx(UiTooltip, { arrowPlacement: "top", optimalPlacement: true, triggerBy: ["hover", "click", "focus"], anchor: _jsx(UiIcon, { type: "question", size: 14, color: "complementary-6" }), content: intl.formatMessage(descriptor.messages.sectionHeaderTooltip, {
145
+ platform: isApplePlatform() ? "apple" : "other",
146
+ }) })] }), isBaseUnrepresentable ? (_jsx("div", { className: "gd-ascode-dialog-notice", children: intl.formatMessage(messages.unrepresentable) })) : null, _jsx("div", { className: "gd-ascode-dialog-editor", children: _jsx(AsCodeEditorBody, { readOnly: isView, initialValue: initialYaml, label: intl.formatMessage(descriptor.messages.sectionHeader), onChange: handleChange, disabled: isSubmitting || isBaseUnrepresentable, editing: editing, validationContext: validationContext }) }), validationError || submitError ? (_jsxs("div", { className: "gd-ascode-dialog-error", children: [_jsx("span", { className: "gd-ascode-dialog-error-label", children: _jsx(FormattedMessage, { id: "analyticsCatalog.dialog.error.label" }) }), " ", validationError ?? submitError] })) : null] })) }) }) }));
145
147
  }
@@ -1,24 +1,24 @@
1
- import { type YamlCompletionSource } from "@gooddata/sdk-ui-kit";
1
+ import type { AsCodeValidationContext, IAsCodeEditing } from "./descriptor.js";
2
2
  type Props = {
3
3
  initialValue: string;
4
4
  onChange: (value: string) => void;
5
5
  disabled: boolean;
6
6
  readOnly?: boolean;
7
- completionSource: YamlCompletionSource;
8
- syntaxErrorMessage: string;
7
+ editing: IAsCodeEditing<unknown>;
8
+ validationContext: AsCodeValidationContext;
9
9
  /** Accessible name for the editor; the dialog derives it from the entity's section header. */
10
10
  label: string;
11
11
  };
12
12
  /**
13
13
  * The editor half of {@link AsCodeDialog}, split into its own module so the dialog can `lazy()`-load
14
- * it: this keeps CodeMirror out of the eager catalog bundle. The completion source and syntax-error
15
- * copy come from the entity's descriptor, so this stays entity-agnostic.
14
+ * it: this keeps CodeMirror out of the eager catalog bundle. The completion source,
15
+ * validation and syntax-error copy come from the entity's descriptor, so this stays entity-agnostic.
16
16
  *
17
17
  * YAML is both the only language on offer and the primary one, so the kit editor never converts
18
18
  * anything: the text the user sees — comments, formatting and all — is exactly what `onChange`
19
19
  * reports. The dialog reads the current value from `onChange` and never drives the value back in,
20
20
  * which the local state here preserves.
21
21
  */
22
- export declare function AsCodeEditorBody({ initialValue, onChange, disabled, readOnly, completionSource, syntaxErrorMessage, label, }: Props): import("react/jsx-runtime").JSX.Element;
22
+ export declare function AsCodeEditorBody({ initialValue, onChange, disabled, readOnly, editing, validationContext, label, }: Props): import("react/jsx-runtime").JSX.Element;
23
23
  export {};
24
24
  //# sourceMappingURL=AsCodeEditorBody.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AsCodeEditorBody.d.ts","sourceRoot":"","sources":["../../src/asCode/AsCodeEditorBody.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAMjF,KAAK,KAAK,GAAG;IACT,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GACR,EAAE,KAAK,2CAuBP"}
1
+ {"version":3,"file":"AsCodeEditorBody.d.ts","sourceRoot":"","sources":["../../src/asCode/AsCodeEditorBody.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAoB,uBAAuB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjG,KAAK,KAAK,GAAG;IACT,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACjC,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,KAAK,GACR,EAAE,KAAK,2CA6BP"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // (C) 2026 GoodData Corporation
3
- import { useState } from "react";
3
+ import { useMemo, useState } from "react";
4
4
  import { defineMessages, useIntl } from "react-intl";
5
5
  import { UiConfigEditor } from "@gooddata/sdk-ui-kit";
6
6
  const messages = defineMessages({
@@ -8,22 +8,29 @@ const messages = defineMessages({
8
8
  });
9
9
  /**
10
10
  * The editor half of {@link AsCodeDialog}, split into its own module so the dialog can `lazy()`-load
11
- * it: this keeps CodeMirror out of the eager catalog bundle. The completion source and syntax-error
12
- * copy come from the entity's descriptor, so this stays entity-agnostic.
11
+ * it: this keeps CodeMirror out of the eager catalog bundle. The completion source,
12
+ * validation and syntax-error copy come from the entity's descriptor, so this stays entity-agnostic.
13
13
  *
14
14
  * YAML is both the only language on offer and the primary one, so the kit editor never converts
15
15
  * anything: the text the user sees — comments, formatting and all — is exactly what `onChange`
16
16
  * reports. The dialog reads the current value from `onChange` and never drives the value back in,
17
17
  * which the local state here preserves.
18
18
  */
19
- export function AsCodeEditorBody({ initialValue, onChange, disabled, readOnly, completionSource, syntaxErrorMessage, label, }) {
19
+ export function AsCodeEditorBody({ initialValue, onChange, disabled, readOnly, editing, validationContext, label, }) {
20
20
  const intl = useIntl();
21
21
  const [value, setValue] = useState(initialValue);
22
+ // A read-only view has no typing to guide, and its document may predate a narrower feature gate.
23
+ const diagnostics = useMemo(() => (readOnly ? [] : inlineDiagnostics(editing.validate(value, validationContext))), [editing, readOnly, validationContext, value]);
22
24
  return (_jsx(UiConfigEditor, { value: value, onChange: (next) => {
23
25
  setValue(next);
24
26
  onChange(next);
25
- }, primaryLanguage: "yaml", languages: ["yaml"], completionSource: completionSource, label: label, disabled: disabled, readOnly: readOnly, labels: {
27
+ }, primaryLanguage: "yaml", languages: ["yaml"], completionSource: editing.completionSource, diagnostics: diagnostics, label: label, disabled: disabled, readOnly: readOnly, labels: {
26
28
  autoFormat: intl.formatMessage(messages.autoFormat),
27
- syntaxError: syntaxErrorMessage,
29
+ syntaxError: editing.syntaxErrorMessage,
28
30
  } }));
29
31
  }
32
+ function inlineDiagnostics(result) {
33
+ return result.isValid || result.path === undefined
34
+ ? []
35
+ : [{ path: result.path, target: result.target, severity: "error", message: result.error }];
36
+ }
@@ -6,6 +6,11 @@ import type { ICatalogItem, ICatalogItemRef } from "../catalogItem/types.js";
6
6
  import type { ObjectTypes } from "../objectType/constants.js";
7
7
  import type { ObjectType } from "../objectType/types.js";
8
8
  import type { useFeatureFlag } from "../permission/PermissionsContext.js";
9
+ /**
10
+ * Where a value sits in the document, as object keys and array indexes.
11
+ * @internal
12
+ */
13
+ export type AsCodeDocumentPath = ReadonlyArray<string | number>;
9
14
  export type AsCodeFeatureFlag = Parameters<typeof useFeatureFlag>[0];
10
15
  export type AsCodeObjectType = typeof ObjectTypes.METRIC | typeof ObjectTypes.PARAMETER | typeof ObjectTypes.COMPUTED_ATTRIBUTE | typeof ObjectTypes.VISUALIZATION;
11
16
  export interface IAsCodeMessages {
@@ -26,14 +31,24 @@ export interface IAsCodeMessages {
26
31
  deleteSuccess: MessageDescriptor;
27
32
  deleteError: MessageDescriptor;
28
33
  }
34
+ /**
35
+ * The field a failure marks in the editor: the value at `path`, or with `target: "key"` the key that
36
+ * names it, as for an unknown key. A failure without a path (empty or malformed document) has nothing
37
+ * to mark and shows only as a banner.
38
+ * @internal
39
+ */
40
+ export type AsCodeFieldMark = {
41
+ path?: AsCodeDocumentPath;
42
+ target?: "key";
43
+ };
29
44
  /** @internal */
30
45
  export type AsCodeValidation<TDef> = {
31
46
  isValid: true;
32
47
  definition: TDef;
33
- } | {
48
+ } | ({
34
49
  isValid: false;
35
50
  error: string;
36
- };
51
+ } & AsCodeFieldMark);
37
52
  /**
38
53
  * Identity rule per flow: `edit` keeps `fixedIdentifier`; `duplicate` accepts and ignores any id (the
39
54
  * copy re-derives identity downstream); `create` applies the entity's own id policy.
@@ -47,6 +62,12 @@ export type AsCodeValidationContext = {
47
62
  } | {
48
63
  intent: "duplicate";
49
64
  };
65
+ /**
66
+ * The failure of {@link IAsCodeEditing.validate} for a failed per-type validation and its localized
67
+ * message.
68
+ * @internal
69
+ */
70
+ export declare function toAsCodeFailure(failure: AsCodeFieldMark, error: string): AsCodeValidation<never>;
50
71
  /** @internal */
51
72
  export declare function fixedIdentifierOf(context: AsCodeValidationContext): string | undefined;
52
73
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../src/asCode/descriptor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,q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AE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;IAE1B,4DAA4D;IAC5D,UAAU,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1C;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,iBAAiB,CAAC,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IACzC,yFAAyF;IACzF,aAAa,CAAC,IAAI,OAAO,CAAC;IAC1B,kBAAkB,CACd,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,SAAS,GAAG,SAAS,GAChC,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEpC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAED,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,KAAK,SAAS,YAAY,EACnE,UAAU,EAAE,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,GAC3C,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAEhC"}
@@ -1,4 +1,12 @@
1
1
  // (C) 2026 GoodData Corporation
2
+ /**
3
+ * The failure of {@link IAsCodeEditing.validate} for a failed per-type validation and its localized
4
+ * message.
5
+ * @internal
6
+ */
7
+ export function toAsCodeFailure(failure, error) {
8
+ return { isValid: false, error, path: failure.path, target: failure.target };
9
+ }
2
10
  /** @internal */
3
11
  export function fixedIdentifierOf(context) {
4
12
  return context.intent === "edit" ? context.fixedIdentifier : undefined;
@@ -0,0 +1,12 @@
1
+ import { type Completion, type CompletionContext, type CompletionResult } from "@codemirror/autocomplete";
2
+ /**
3
+ * A completion source for a flat mapping: it offers the keys at column zero only, since an indented
4
+ * line sits inside a sequence value (e.g. under `tags:`), where those keys must not be offered.
5
+ */
6
+ export declare function createFlatKeyCompletions(keys: string[]): (context: CompletionContext) => CompletionResult | null;
7
+ /**
8
+ * The result's own `to` stays at the caret because the popup filters options by the text between
9
+ * `from` and `to`.
10
+ */
11
+ export declare function replacingKey(option: Completion): Completion;
12
+ //# sourceMappingURL=keyCompletions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyCompletions.d.ts","sourceRoot":"","sources":["../../src/asCode/keyCompletions.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAExB,MAAM,0BAA0B,CAAC;AAGlC;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,aAGV,iBAAiB,KAAG,gBAAgB,GAAG,IAAI,CAavF;AAgBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAc3D"}
@@ -0,0 +1,58 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { insertCompletionText, } from "@codemirror/autocomplete";
3
+ /**
4
+ * A completion source for a flat mapping: it offers the keys at column zero only, since an indented
5
+ * line sits inside a sequence value (e.g. under `tags:`), where those keys must not be offered.
6
+ */
7
+ export function createFlatKeyCompletions(keys) {
8
+ const options = keys.map((label) => replacingKey({ label, type: "property", apply: `${label}: ` }));
9
+ return function completeFlatKey(context) {
10
+ const line = context.state.doc.lineAt(context.pos);
11
+ const before = line.text.slice(0, context.pos - line.from);
12
+ const match = before.match(/^(\w*)$/);
13
+ if (!match) {
14
+ return null;
15
+ }
16
+ const present = presentTopLevelKeys(context.state.doc, line.number);
17
+ return {
18
+ from: context.pos - match[1].length,
19
+ options: options.filter((option) => !present.has(option.label)),
20
+ };
21
+ };
22
+ }
23
+ function presentTopLevelKeys(doc, exceptLine) {
24
+ const keys = new Set();
25
+ for (let number = 1; number <= doc.lines; number++) {
26
+ if (number === exceptLine) {
27
+ continue;
28
+ }
29
+ const key = /^(\w+):/.exec(doc.line(number).text)?.[1];
30
+ if (key !== undefined) {
31
+ keys.add(key);
32
+ }
33
+ }
34
+ return keys;
35
+ }
36
+ /**
37
+ * The result's own `to` stays at the caret because the popup filters options by the text between
38
+ * `from` and `to`.
39
+ */
40
+ export function replacingKey(option) {
41
+ return {
42
+ ...option,
43
+ apply(view, completion, from, to) {
44
+ const end = keyReplacementEnd(view.state, to);
45
+ const apply = view.state.sliceDoc(end, end + 1) === ":" ? option.label : (option.apply ?? option.label);
46
+ if (typeof apply === "string") {
47
+ view.dispatch(view.state.update(insertCompletionText(view.state, apply, from, end)));
48
+ }
49
+ else {
50
+ apply(view, completion, from, end);
51
+ }
52
+ },
53
+ };
54
+ }
55
+ function keyReplacementEnd(state, pos) {
56
+ const line = state.doc.lineAt(pos);
57
+ return pos + (/^\w*/.exec(line.text.slice(pos - line.from))?.[0].length ?? 0);
58
+ }
@@ -0,0 +1,13 @@
1
+ import type * as z from "zod/mini";
2
+ /**
3
+ * Child keys reachable under a parent key: directly in its mapping, or inside each item of its
4
+ * sequence. A sequence of scalars has no keys.
5
+ */
6
+ export type SchemaKeysEntry = {
7
+ kind: "mapping" | "sequence";
8
+ keys: string[];
9
+ };
10
+ /** Parent key → child-key entry, the root mapping keyed by `""`; powers YAML editor autocompletion. */
11
+ export type SchemaKeys = Record<string, SchemaKeysEntry>;
12
+ export declare function deriveSchemaKeys(schema: z.core.$ZodType): SchemaKeys;
13
+ //# sourceMappingURL=schemaKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaKeys.d.ts","sourceRoot":"","sources":["../../src/asCode/schemaKeys.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,uGAAuG;AACvG,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEzD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAEpE"}
@@ -0,0 +1,45 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { union } from "lodash-es";
3
+ export function deriveSchemaKeys(schema) {
4
+ return collectSchemaKeys(schema, "", "mapping", {});
5
+ }
6
+ function collectSchemaKeys(schema, parentKey, kind, result) {
7
+ for (const object of objectSchemasOf(schema)) {
8
+ const { shape } = object._zod.def;
9
+ result[parentKey] = { kind, keys: union(result[parentKey]?.keys, Object.keys(shape)) };
10
+ for (const [key, child] of Object.entries(shape)) {
11
+ const inner = unwrap(child);
12
+ if (inner._zod.def.type === "array") {
13
+ // A sequence is a block even when its items are scalars and add no keys.
14
+ result[key] ??= { kind: "sequence", keys: [] };
15
+ const element = unwrap(inner._zod.def.element);
16
+ collectSchemaKeys(element, key, "sequence", result);
17
+ }
18
+ else {
19
+ collectSchemaKeys(inner, key, "mapping", result);
20
+ }
21
+ }
22
+ }
23
+ return result;
24
+ }
25
+ /** Object schemas reachable from `schema`, flattening a discriminated union into its arms. */
26
+ function objectSchemasOf(schema) {
27
+ const { def } = schema._zod;
28
+ if (def.type === "object") {
29
+ return [schema];
30
+ }
31
+ if (def.type === "union") {
32
+ return def.options.flatMap((option) => objectSchemasOf(unwrap(option)));
33
+ }
34
+ return [];
35
+ }
36
+ function unwrap(schema) {
37
+ const { type } = schema._zod.def;
38
+ if (type === "optional" || type === "default") {
39
+ return unwrap(schema._zod.def.innerType);
40
+ }
41
+ if (type === "pipe") {
42
+ return unwrap(schema._zod.def.in);
43
+ }
44
+ return schema;
45
+ }
@@ -1,22 +1,5 @@
1
1
  import type * as z from "zod/mini";
2
- /**
3
- * Neutral result of the shared YAML validation skeleton, before a type shapes it into its own result.
4
- * `data` is the parsed-and-schema-validated value; the caller converts it to a definition. A `schema`
5
- * failure hands the caller the `error` and the `parsed` value to classify against its own error codes;
6
- * the other kinds are already the codes every as-code type shares.
7
- */
8
- export type YamlValidation<TData> = {
9
- ok: true;
10
- data: TData;
11
- } | {
12
- ok: false;
13
- kind: "empty" | "syntax" | "idImmutable";
14
- } | {
15
- ok: false;
16
- kind: "schema";
17
- error: z.core.$ZodError;
18
- parsed: unknown;
19
- };
2
+ import type { AsCodeFieldMark } from "./descriptor.js";
20
3
  type SafeParseSchema<TData> = {
21
4
  safeParse(value: unknown): {
22
5
  success: true;
@@ -26,18 +9,38 @@ type SafeParseSchema<TData> = {
26
9
  error: z.core.$ZodError;
27
10
  };
28
11
  };
29
- type ValidateYamlOptions<TData> = {
12
+ type YamlErrorCode = "empty" | "syntax" | "invalidStructure" | "idImmutable";
13
+ type SharedYamlFailure<TFailure> = {
14
+ errorCode: YamlErrorCode;
15
+ } & {
16
+ [TKey in Exclude<keyof TFailure, "errorCode">]?: undefined;
17
+ };
18
+ export type YamlValidationFailure<TFailure extends {
19
+ errorCode: string;
20
+ }> = {
21
+ isValid: false;
22
+ } & AsCodeFieldMark & (TFailure | SharedYamlFailure<TFailure>);
23
+ export type YamlValidation<TData, TFailure extends {
24
+ errorCode: string;
25
+ }> = {
26
+ isValid: true;
27
+ data: TData;
28
+ } | YamlValidationFailure<TFailure>;
29
+ type ValidateYamlOptions<TData, TFailure> = {
30
30
  schema: SafeParseSchema<TData>;
31
31
  /** When set, the parsed `id` must match it, else `idImmutable` (identity is fixed while editing). */
32
32
  fixedIdentifier?: string;
33
+ classifyIssue: (dottedPath: string, parsed: unknown, issue: z.core.$ZodIssue) => TFailure | undefined;
33
34
  };
34
- /**
35
- * Runs the steps every as-code YAML shares: reject empty input, parse (strict) YAML, drop a blank
36
- * identity, validate against the schema, and enforce identity immutability. The schema itself and the
37
- * conversion of validated data into a definition are the caller's.
38
- */
39
35
  export declare function validateYaml<TData extends {
40
36
  id?: string;
41
- }>(value: string, { schema, fixedIdentifier }: ValidateYamlOptions<TData>): YamlValidation<TData>;
37
+ }, TFailure extends {
38
+ errorCode: string;
39
+ }>(value: string, { schema, fixedIdentifier, classifyIssue }: ValidateYamlOptions<TData, TFailure>): YamlValidation<TData, TFailure>;
40
+ /**
41
+ * A blank `maql:` / `maql: ` line parses to null - the seeded template's state - and counts as
42
+ * unwritten, not as a value of the wrong type.
43
+ */
44
+ export declare function isMaqlWritten(parsed: unknown): boolean;
42
45
  export {};
43
46
  //# sourceMappingURL=validateYaml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateYaml.d.ts","sourceRoot":"","sources":["../../src/asCode/validateYaml.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,IAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACzB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,CAAA;CAAE,GACvD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9E,KAAK,eAAe,CAAC,KAAK,IAAI;IAC1B,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,KAAK,CAAA;KAAE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AAC,QAAQ,SAAS;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,IAAI;IACxE,OAAO,EAAE,KAAK,CAAC;CAClB,GAAG,eAAe,GACf,CAAC,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE7C,MAAM,MAAM,cAAc,CAAC,KAAK,EAAE,QAAQ,SAAS;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,IAClE;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GAC9B,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAEtC,KAAK,mBAAmB,CAAC,KAAK,EAAE,QAAQ,IAAI;IACxC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/B,qGAAqG;IACrG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,GAAG,SAAS,CAAC;CACzG,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,SAAS;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,SAAS;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC9F,KAAK,EAAE,MAAM,EACb,EAAE,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,GACjF,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CA6BjC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAEtD"}
@@ -1,30 +1,38 @@
1
1
  // (C) 2026 GoodData Corporation
2
2
  import { parse as parseYaml } from "yaml";
3
- /**
4
- * Runs the steps every as-code YAML shares: reject empty input, parse (strict) YAML, drop a blank
5
- * identity, validate against the schema, and enforce identity immutability. The schema itself and the
6
- * conversion of validated data into a definition are the caller's.
7
- */
8
- export function validateYaml(value, { schema, fixedIdentifier }) {
3
+ export function validateYaml(value, { schema, fixedIdentifier, classifyIssue }) {
9
4
  if (value.trim() === "") {
10
- return { ok: false, kind: "empty" };
5
+ return { isValid: false, errorCode: "empty" };
11
6
  }
12
7
  let parsed;
13
8
  try {
14
9
  parsed = parseYaml(value, { strict: true });
15
10
  }
16
11
  catch {
17
- return { ok: false, kind: "syntax" };
12
+ return { isValid: false, errorCode: "syntax" };
18
13
  }
19
14
  const document = withoutBlankIdentity(parsed);
20
15
  const result = schema.safeParse(document);
21
16
  if (!result.success) {
22
- return { ok: false, kind: "schema", error: result.error, parsed: document };
17
+ for (const issue of result.error.issues) {
18
+ const failure = classifyIssue(issue.path.map(String).join("."), document, issue);
19
+ if (failure) {
20
+ return { isValid: false, ...failure, ...markedField(issue) };
21
+ }
22
+ }
23
+ return { isValid: false, errorCode: "invalidStructure", ...markedField(result.error.issues[0]) };
23
24
  }
24
25
  if (fixedIdentifier !== undefined && result.data.id !== fixedIdentifier) {
25
- return { ok: false, kind: "idImmutable" };
26
+ return { isValid: false, errorCode: "idImmutable", path: ["id"] };
26
27
  }
27
- return { ok: true, data: result.data };
28
+ return { isValid: true, data: result.data };
29
+ }
30
+ /**
31
+ * A blank `maql:` / `maql: ` line parses to null - the seeded template's state - and counts as
32
+ * unwritten, not as a value of the wrong type.
33
+ */
34
+ export function isMaqlWritten(parsed) {
35
+ return parsed !== null && typeof parsed === "object" && "maql" in parsed && parsed.maql != null;
28
36
  }
29
37
  /**
30
38
  * Drops an `id` the author left blank, so the template can offer the key without forcing a value.
@@ -41,3 +49,18 @@ function withoutBlankIdentity(parsed) {
41
49
  const { id, ...rest } = parsed;
42
50
  return id === null || (typeof id === "string" && id.trim() === "") ? rest : parsed;
43
51
  }
52
+ /**
53
+ * The field to mark for an issue. Symbols cannot name a YAML node, so they are dropped, and an empty
54
+ * path names no field. Zod reports an unknown key on its parent object, so the first unknown key is
55
+ * appended and marked by its key.
56
+ */
57
+ function markedField(issue) {
58
+ if (issue.code === "unrecognized_keys") {
59
+ return { path: [...issue.path.filter(isDocumentKey), issue.keys[0]], target: "key" };
60
+ }
61
+ const keys = issue.path.filter(isDocumentKey);
62
+ return { path: keys.length > 0 ? keys : undefined };
63
+ }
64
+ function isDocumentKey(key) {
65
+ return typeof key !== "symbol";
66
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"CatalogDetailContent.d.ts","sourceRoot":"","sources":["../../src/catalogDetail/CatalogDetailContent.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAgC,MAAM,OAAO,CAAC;AAUtE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGlF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAkBzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,gBAAgB,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC;IACzD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5E;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;OAEG;IACH,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5E;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,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AE,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5E;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IACrD;;OAEG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACrD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GAC1B,EAAE,0BAA0B,2CA4N5B"}
@@ -12,7 +12,7 @@ import { useIsCertificationAllowed } from "../certification/gate.js";
12
12
  import { useIsLineageEnabled } from "../lineage/gate.js";
13
13
  import {} from "../objectType/types.js";
14
14
  import { usePermissionsState } from "../permission/PermissionsContext.js";
15
- import { useIsCatalogDescriptionGenerationEnabled, useIsCatalogQualityEnabled } from "../quality/gate.js";
15
+ import { useIsCatalogDescriptionGenerationEnabled, useIsCatalogQualityAllowed } from "../quality/gate.js";
16
16
  import { useQualityIssuesById, useQualityReportState } from "../quality/QualityContext.js";
17
17
  import { CatalogDetailActions } from "./CatalogDetailActions.js";
18
18
  import { CatalogDetailHeader } from "./CatalogDetailHeader.js";
@@ -63,8 +63,7 @@ export function CatalogDetailContent({ objectId, objectType, objectDefinition, o
63
63
  const isDescriptionGenerationEnabled = useIsCatalogDescriptionGenerationEnabled();
64
64
  // Quality
65
65
  const { status: qualityStatus } = useQualityReportState();
66
- const isQualityEnabled = useIsCatalogQualityEnabled();
67
- const isQualityVisible = isQualityEnabled && qualityStatus !== "error";
66
+ const isQualityVisible = useIsCatalogQualityAllowed(item?.type) && qualityStatus !== "error";
68
67
  const isQualityLoading = qualityStatus === "loading" || qualityStatus === "pending";
69
68
  const issues = useQualityIssuesById(item?.identifier ?? "") ?? [];
70
69
  const issueCount = issues.length > 0 ? `(${issues.length})` : "";
@@ -1 +1 @@
1
- {"version":3,"file":"useCatalogItemLoad.d.ts","sourceRoot":"","sources":["../../../src/catalogDetail/hooks/useCatalogItemLoad.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC;CAC5D;AAED,wBAAgB,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,GAAG;IACjG,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACpD,IAAI,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB,CA2DA"}
1
+ {"version":3,"file":"useCatalogItemLoad.d.ts","sourceRoot":"","sources":["../../../src/catalogDetail/hooks/useCatalogItemLoad.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC;CAC5D;AAED,wBAAgB,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,GAAG;IACjG,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACpD,IAAI,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB,CAyDA"}
@@ -2,6 +2,7 @@
2
2
  import { convertError, isNotFound, useBackendStrict, useCancelablePromise, useWorkspaceStrict, } from "@gooddata/sdk-ui";
3
3
  import { convertAttributeToCatalogItem, convertComputedAttributeToCatalogItem, convertDashboardToCatalogItem, convertDataSetToCatalogItem, convertFactToCatalogItem, convertInsightToCatalogItem, convertMeasureToCatalogItem, convertParameterToCatalogItem, } from "../../catalogItem/converter.js";
4
4
  import { isCatalogItemAttribute, isCatalogItemLoaded, isCatalogItemWithPermissions, } from "../../catalogItem/guards.js";
5
+ import { getDocumentCatalogItem } from "../../catalogItem/query.js";
5
6
  import {} from "../../catalogItem/types.js";
6
7
  import {} from "../../objectType/types.js";
7
8
  import { useFeatureFlag } from "../../permission/PermissionsContext.js";
@@ -29,7 +30,7 @@ export function useCatalogItemLoad({ objectDefinition, objectId, objectType }) {
29
30
  // A 404 must reach CatalogDetailStatus as a NotFoundSdkError so isNotFound() shows
30
31
  // the not-found page; convertError maps it. Other errors are rethrown untouched so
31
32
  // their original status/message survives in the generic error description.
32
- return loadObjectDefinition(backend.workspace(workspace), id, type, loadPermissions).catch((e) => {
33
+ return loadObjectDefinition(backend, workspace, id, type, loadPermissions).catch((e) => {
33
34
  const converted = convertError(e);
34
35
  throw isNotFound(converted) ? converted : e;
35
36
  });
@@ -74,7 +75,8 @@ function awaitsPermissions(item, loadPermissions) {
74
75
  function awaitsLabels(item) {
75
76
  return isCatalogItemAttribute(item) && item.labels === undefined;
76
77
  }
77
- async function loadObjectDefinition(workspace, id, type, loadPermissions) {
78
+ async function loadObjectDefinition(backend, workspaceId, id, type, loadPermissions) {
79
+ const workspace = backend.workspace(workspaceId);
78
80
  switch (type) {
79
81
  case "attribute":
80
82
  return workspace
@@ -157,6 +159,8 @@ async function loadObjectDefinition(workspace, id, type, loadPermissions) {
157
159
  include: ["dataset"],
158
160
  })
159
161
  .then(convertFactToCatalogItem);
162
+ case "document":
163
+ return getDocumentCatalogItem(backend, workspaceId, id);
160
164
  default:
161
165
  throw new Error("Unsupported object type");
162
166
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useCatalogItemUpdate.d.ts","sourceRoot":"","sources":["../../../src/catalogDetail/hooks/useCatalogItemUpdate.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,MAAM,EAEd,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAAC;IACzD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACpC;AAID,wBAAgB,oBAA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