@gooddata/sdk-ui-catalog 11.68.0-alpha.1 → 11.68.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.
- package/LICENSE +26 -4
- package/NOTICE +69386 -0
- package/README.md +1 -1
- package/esm/asCode/AsCodeDialog.d.ts.map +1 -1
- package/esm/asCode/AsCodeDialog.js +7 -5
- package/esm/asCode/AsCodeEditorBody.d.ts +6 -6
- package/esm/asCode/AsCodeEditorBody.d.ts.map +1 -1
- package/esm/asCode/AsCodeEditorBody.js +13 -6
- package/esm/asCode/descriptor.d.ts +23 -2
- package/esm/asCode/descriptor.d.ts.map +1 -1
- package/esm/asCode/descriptor.js +8 -0
- package/esm/asCode/keyCompletions.d.ts +12 -0
- package/esm/asCode/keyCompletions.d.ts.map +1 -0
- package/esm/asCode/keyCompletions.js +58 -0
- package/esm/asCode/schemaKeys.d.ts +13 -0
- package/esm/asCode/schemaKeys.d.ts.map +1 -0
- package/esm/asCode/schemaKeys.js +45 -0
- package/esm/asCode/validateYaml.d.ts +28 -25
- package/esm/asCode/validateYaml.d.ts.map +1 -1
- package/esm/asCode/validateYaml.js +34 -11
- package/esm/catalogDetail/hooks/useCatalogItemUpdate.d.ts.map +1 -1
- package/esm/catalogDetail/hooks/useCatalogItemUpdate.js +2 -2
- package/esm/computedAttribute/computedAttributeCompletions.d.ts +1 -7
- package/esm/computedAttribute/computedAttributeCompletions.d.ts.map +1 -1
- package/esm/computedAttribute/computedAttributeCompletions.js +2 -19
- package/esm/computedAttribute/computedAttributeDescriptor.d.ts.map +1 -1
- package/esm/computedAttribute/computedAttributeDescriptor.js +2 -2
- package/esm/computedAttribute/computedAttributeSchema.d.ts +2 -6
- package/esm/computedAttribute/computedAttributeSchema.d.ts.map +1 -1
- package/esm/computedAttribute/computedAttributeSchema.js +2 -8
- package/esm/computedAttribute/computedAttributeValidation.d.ts +3 -3
- package/esm/computedAttribute/computedAttributeValidation.d.ts.map +1 -1
- package/esm/computedAttribute/computedAttributeValidation.js +32 -44
- package/esm/filter/FilterContext.d.ts.map +1 -1
- package/esm/filter/FilterContext.js +9 -9
- package/esm/filter/StaticFilter.js +3 -3
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/localization/bundles/de-DE.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/de-DE.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/de-DE.localization-bundle.js +2 -1
- package/esm/localization/bundles/en-AU.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/en-AU.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-AU.localization-bundle.js +2 -1
- package/esm/localization/bundles/en-GB.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/en-GB.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-GB.localization-bundle.js +2 -1
- package/esm/localization/bundles/en-US.localization-bundle.js +4 -4
- package/esm/localization/bundles/es-419.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/es-419.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/es-419.localization-bundle.js +2 -1
- package/esm/localization/bundles/es-ES.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/es-ES.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/es-ES.localization-bundle.js +2 -1
- package/esm/localization/bundles/fi-FI.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/fi-FI.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fi-FI.localization-bundle.js +2 -1
- package/esm/localization/bundles/fr-CA.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/fr-CA.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fr-CA.localization-bundle.js +2 -1
- package/esm/localization/bundles/fr-FR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/fr-FR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/fr-FR.localization-bundle.js +2 -1
- package/esm/localization/bundles/id-ID.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/id-ID.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/id-ID.localization-bundle.js +2 -1
- package/esm/localization/bundles/it-IT.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/it-IT.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/it-IT.localization-bundle.js +5 -4
- package/esm/localization/bundles/ja-JP.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/ja-JP.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ja-JP.localization-bundle.js +2 -1
- package/esm/localization/bundles/ko-KR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/ko-KR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ko-KR.localization-bundle.js +2 -1
- package/esm/localization/bundles/nl-NL.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/nl-NL.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/nl-NL.localization-bundle.js +2 -1
- package/esm/localization/bundles/pl-PL.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/pl-PL.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pl-PL.localization-bundle.js +2 -1
- package/esm/localization/bundles/pt-BR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/pt-BR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pt-BR.localization-bundle.js +2 -1
- package/esm/localization/bundles/pt-PT.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/pt-PT.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/pt-PT.localization-bundle.js +2 -1
- package/esm/localization/bundles/ru-RU.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/ru-RU.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/ru-RU.localization-bundle.js +2 -1
- package/esm/localization/bundles/sl-SI.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/sl-SI.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/sl-SI.localization-bundle.js +2 -1
- package/esm/localization/bundles/th-TH.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/th-TH.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/th-TH.localization-bundle.js +2 -1
- package/esm/localization/bundles/tr-TR.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/tr-TR.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/tr-TR.localization-bundle.js +2 -1
- package/esm/localization/bundles/uk-UA.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/uk-UA.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/uk-UA.localization-bundle.js +2 -1
- package/esm/localization/bundles/vi-VN.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/vi-VN.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/vi-VN.localization-bundle.js +2 -1
- package/esm/localization/bundles/zh-HK.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/zh-HK.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-HK.localization-bundle.js +2 -1
- package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/zh-Hans.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-Hans.localization-bundle.js +2 -1
- package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts +1 -0
- package/esm/localization/bundles/zh-Hant.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/zh-Hant.localization-bundle.js +3 -2
- package/esm/metric/metricCompletions.d.ts +1 -7
- package/esm/metric/metricCompletions.d.ts.map +1 -1
- package/esm/metric/metricCompletions.js +2 -16
- package/esm/metric/metricDescriptor.d.ts.map +1 -1
- package/esm/metric/metricDescriptor.js +2 -2
- package/esm/metric/metricSchema.d.ts +2 -6
- package/esm/metric/metricSchema.d.ts.map +1 -1
- package/esm/metric/metricSchema.js +2 -8
- package/esm/metric/metricValidation.d.ts +3 -3
- package/esm/metric/metricValidation.d.ts.map +1 -1
- package/esm/metric/metricValidation.js +12 -18
- package/esm/parameter/parameterCompletions.d.ts.map +1 -1
- package/esm/parameter/parameterCompletions.js +19 -6
- package/esm/parameter/parameterDescriptor.d.ts.map +1 -1
- package/esm/parameter/parameterDescriptor.js +5 -8
- package/esm/parameter/parameterSchema.d.ts +2 -7
- package/esm/parameter/parameterSchema.d.ts.map +1 -1
- package/esm/parameter/parameterSchema.js +1 -40
- package/esm/parameter/parameterValidation.d.ts +3 -2
- package/esm/parameter/parameterValidation.d.ts.map +1 -1
- package/esm/parameter/parameterValidation.js +26 -36
- package/esm/sdk-ui-catalog.d.ts +19 -2
- package/package.json +18 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metricSchema.d.ts","sourceRoot":"","sources":["../../src/metric/metricSchema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;kBAWvB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC,OAAO,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;AAExG
|
|
1
|
+
{"version":3,"file":"metricSchema.d.ts","sourceRoot":"","sources":["../../src/metric/metricSchema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;kBAWvB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC,OAAO,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;AAExG,eAAO,MAAM,kBAAkB,EAAE,UAA2C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import * as z from "zod/mini";
|
|
3
|
+
import { deriveSchemaKeys } from "../asCode/schemaKeys.js";
|
|
3
4
|
/**
|
|
4
5
|
* Zod schema for the analytics-as-code (AAC) metric YAML shape.
|
|
5
6
|
*
|
|
@@ -20,11 +21,4 @@ export const metricSchema = z.strictObject({
|
|
|
20
21
|
// Deprecated predecessor of `show_in_ai_results`; accepted so AAC exports still parse.
|
|
21
22
|
is_hidden: z.optional(z.boolean()),
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
-
* Allowed YAML property names keyed by parent mapping, used to power editor autocompletion.
|
|
25
|
-
* The metric schema is flat, so the only entry is the top-level mapping (keyed by `""`), whose
|
|
26
|
-
* value is the object's property names read from zod's public `shape`.
|
|
27
|
-
*/
|
|
28
|
-
export const METRIC_SCHEMA_KEYS = {
|
|
29
|
-
"": Object.keys(metricSchema.shape),
|
|
30
|
-
};
|
|
24
|
+
export const METRIC_SCHEMA_KEYS = deriveSchemaKeys(metricSchema);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IMeasureMetadataObjectDefinition } from "@gooddata/sdk-model";
|
|
2
|
+
import { type YamlValidationFailure } from "../asCode/validateYaml.js";
|
|
2
3
|
export type MetricValidationResult = {
|
|
3
4
|
isValid: true;
|
|
4
5
|
measure: IMeasureMetadataObjectDefinition;
|
|
5
|
-
} | {
|
|
6
|
-
isValid: false;
|
|
6
|
+
} | YamlValidationFailure<{
|
|
7
7
|
errorCode: MetricValidationErrorCode;
|
|
8
|
-
}
|
|
8
|
+
}>;
|
|
9
9
|
export type MetricValidationErrorCode = "empty" | "syntax" | "invalidStructure" | "idImmutable" | "missingMaql" | "invalidTags";
|
|
10
10
|
type ValidateMetricYamlOptions = {
|
|
11
11
|
fixedIdentifier?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metricValidation.d.ts","sourceRoot":"","sources":["../../src/metric/metricValidation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metricValidation.d.ts","sourceRoot":"","sources":["../../src/metric/metricValidation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,KAAK,qBAAqB,EAA+B,MAAM,2BAA2B,CAAC;AAKpG,MAAM,MAAM,sBAAsB,GAC5B;IACI,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,gCAAgC,CAAC;CAC7C,GACD,qBAAqB,CAAC;IAAE,SAAS,EAAE,yBAAyB,CAAA;CAAE,CAAC,CAAC;AAEtE,MAAM,MAAM,yBAAyB,GAC/B,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAEpB,KAAK,yBAAyB,GAAG;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,yBAA8B,GACxC,sBAAsB,CAWxB"}
|
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import { validateYaml } from "../asCode/validateYaml.js";
|
|
2
|
+
import { isMaqlWritten, validateYaml } from "../asCode/validateYaml.js";
|
|
3
3
|
import { metricYamlToDefinition } from "./metricConverter.js";
|
|
4
4
|
import { metricSchema } from "./metricSchema.js";
|
|
5
5
|
export function validateMetricYaml(value, options = {}) {
|
|
6
6
|
const result = validateYaml(value, {
|
|
7
7
|
schema: metricSchema,
|
|
8
8
|
fixedIdentifier: options.fixedIdentifier,
|
|
9
|
+
classifyIssue: classifyMetricIssue,
|
|
9
10
|
});
|
|
10
|
-
if (result.
|
|
11
|
+
if (result.isValid) {
|
|
11
12
|
return { isValid: true, measure: metricYamlToDefinition(result.data) };
|
|
12
13
|
}
|
|
13
|
-
return
|
|
14
|
-
isValid: false,
|
|
15
|
-
errorCode: result.kind === "schema" ? classifyMetricError(result.error, result.parsed) : result.kind,
|
|
16
|
-
};
|
|
14
|
+
return result;
|
|
17
15
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (path === "maql") {
|
|
23
|
-
// A present-but-wrong-typed maql is a structural error, not a missing field.
|
|
24
|
-
return maqlProvided ? "invalidStructure" : "missingMaql";
|
|
25
|
-
}
|
|
26
|
-
if (path === "tags" || path.startsWith("tags.")) {
|
|
27
|
-
return "invalidTags";
|
|
28
|
-
}
|
|
16
|
+
function classifyMetricIssue(path, parsed) {
|
|
17
|
+
if (path === "maql") {
|
|
18
|
+
// A present-but-wrong-typed maql is a structural error, not a missing field.
|
|
19
|
+
return { errorCode: isMaqlWritten(parsed) ? "invalidStructure" : "missingMaql" };
|
|
29
20
|
}
|
|
30
|
-
|
|
21
|
+
if (path === "tags" || path.startsWith("tags.")) {
|
|
22
|
+
return { errorCode: "invalidTags" };
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
31
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameterCompletions.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterCompletions.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"parameterCompletions.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterCompletions.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOzD;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,aAAa,EAAE,aAUzB,iBAAiB,KAAG,gBAAgB,GAAG,IAAI,CAoDzF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { snippet, snippetCompletion, } from "@codemirror/autocomplete";
|
|
3
|
+
import { replacingKey } from "../asCode/keyCompletions.js";
|
|
3
4
|
import { parameterSchemaKeys } from "./parameterSchema.js";
|
|
4
5
|
/**
|
|
5
6
|
* Creates a CodeMirror completion source that suggests allowed YAML property
|
|
@@ -45,7 +46,13 @@ export function createParameterCompletions(enabledTypes) {
|
|
|
45
46
|
const entry = vocabulary[parent.key];
|
|
46
47
|
// A sequence's keys are valid only inside a `- ` item; a mapping's keys only outside one.
|
|
47
48
|
const inItem = itemMatch !== null || parent.itemIndent !== undefined;
|
|
48
|
-
if (!entry
|
|
49
|
+
if (!entry) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (entry.kind === "sequence" && !inItem) {
|
|
53
|
+
return word === "" ? { from, options: [toNewItemOption(entry.options[0].label, from)] } : null;
|
|
54
|
+
}
|
|
55
|
+
if (entry.kind === "mapping" && inItem) {
|
|
49
56
|
return null;
|
|
50
57
|
}
|
|
51
58
|
const siblings = getSiblingKeys(context.state.doc, line.number, from - line.from);
|
|
@@ -59,20 +66,26 @@ export function createParameterCompletions(enabledTypes) {
|
|
|
59
66
|
};
|
|
60
67
|
}
|
|
61
68
|
function toVocabulary(schemaKeys) {
|
|
62
|
-
|
|
69
|
+
// A sequence of scalars has no keys to offer, so it gets no entry: every entry has a first option.
|
|
70
|
+
return Object.fromEntries(Object.entries(schemaKeys)
|
|
71
|
+
.filter(([, { keys }]) => keys.length > 0)
|
|
72
|
+
.map(([parent, { kind, keys }]) => [
|
|
63
73
|
parent,
|
|
64
|
-
{ kind, options: keys.map((key) => toKeyOption(key, schemaKeys)) },
|
|
74
|
+
{ kind, options: keys.map((key) => replacingKey(toKeyOption(key, schemaKeys))) },
|
|
65
75
|
]));
|
|
66
76
|
}
|
|
67
77
|
function toKeyOption(label, schemaKeys) {
|
|
68
78
|
const child = schemaKeys[label];
|
|
69
79
|
if (child?.kind === "sequence") {
|
|
70
|
-
return snippetCompletion(`${label}:\n\t${toItemTemplate(child.keys
|
|
80
|
+
return snippetCompletion(`${label}:\n\t${toItemTemplate(child.keys.at(0))}`, {
|
|
71
81
|
label,
|
|
72
82
|
type: "property",
|
|
73
83
|
});
|
|
74
84
|
}
|
|
75
|
-
|
|
85
|
+
if (child?.kind === "mapping") {
|
|
86
|
+
return snippetCompletion(`${label}:\n\t\${}`, { label, type: "property" });
|
|
87
|
+
}
|
|
88
|
+
return { label, type: "property", apply: `${label}: ` };
|
|
76
89
|
}
|
|
77
90
|
function toNewItemOption(firstKey, itemFrom) {
|
|
78
91
|
const insertItem = snippet(toItemTemplate(firstKey));
|
|
@@ -84,7 +97,7 @@ function toNewItemOption(firstKey, itemFrom) {
|
|
|
84
97
|
};
|
|
85
98
|
}
|
|
86
99
|
function toItemTemplate(firstKey) {
|
|
87
|
-
return `- ${firstKey}: \${}`;
|
|
100
|
+
return firstKey === undefined ? "- ${}" : `- ${firstKey}: \${}`;
|
|
88
101
|
}
|
|
89
102
|
/**
|
|
90
103
|
* The key whose block a new entry at column `indent` would join: the nearest less-indented `key:` line
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameterDescriptor.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterDescriptor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"parameterDescriptor.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterDescriptor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAS9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AA2FrE;;GAEG;AACH,eAAO,MAAM,mBAAmB,gHAwC9B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { defineMessages, useIntl } from "react-intl";
|
|
4
|
-
import { defineAsCodeDescriptor, fixedIdentifierOf, } from "../asCode/descriptor.js";
|
|
4
|
+
import { defineAsCodeDescriptor, fixedIdentifierOf, toAsCodeFailure, } from "../asCode/descriptor.js";
|
|
5
5
|
import { ObjectTypes } from "../objectType/constants.js";
|
|
6
6
|
import { PARAMETER_FEATURE_FLAG, useEnabledParameterTypes } from "./gate.js";
|
|
7
7
|
import { createParameterCompletions } from "./parameterCompletions.js";
|
|
@@ -72,13 +72,10 @@ function useParameterEditing() {
|
|
|
72
72
|
});
|
|
73
73
|
return result.isValid
|
|
74
74
|
? { isValid: true, definition: result.parameter }
|
|
75
|
-
: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
enabledTypes: intl.formatList(enabledTypes, { type: "conjunction" }),
|
|
80
|
-
}),
|
|
81
|
-
};
|
|
75
|
+
: toAsCodeFailure(result, intl.formatMessage(errorMessages[result.errorCode], {
|
|
76
|
+
type: result.type,
|
|
77
|
+
enabledTypes: intl.formatList(enabledTypes, { type: "conjunction" }),
|
|
78
|
+
}));
|
|
82
79
|
},
|
|
83
80
|
}), [completionSource, enabledTypes, intl]);
|
|
84
81
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
2
|
import type { ParameterType } from "@gooddata/sdk-model";
|
|
3
3
|
import type { AacSchemaParity, AssertAacParity } from "../asCode/aacParity.js";
|
|
4
|
+
import { type SchemaKeys } from "../asCode/schemaKeys.js";
|
|
4
5
|
import type { ObjectTypes } from "../objectType/constants.js";
|
|
5
6
|
/**
|
|
6
7
|
* Codes carried by schema issues via `issue.message`; `classifySchemaError` routes each to the
|
|
@@ -12,14 +13,8 @@ export type ParameterSchemaInput = z.input<typeof parameterSchema>;
|
|
|
12
13
|
export type ParameterSchema = z.infer<typeof parameterSchema>;
|
|
13
14
|
/** Fails the build when this schema drifts from the AAC `parameter` document type. */
|
|
14
15
|
export type ParameterAacParity = AssertAacParity<AacSchemaParity<typeof ObjectTypes.PARAMETER, ParameterSchema>>;
|
|
15
|
-
export type ParameterSchemaKeys = Record<string, SchemaKeysEntry>;
|
|
16
|
-
/** Child keys reachable under a parent key: directly in its mapping, or inside each item of its sequence. */
|
|
17
|
-
export type SchemaKeysEntry = {
|
|
18
|
-
kind: "mapping" | "sequence";
|
|
19
|
-
keys: string[];
|
|
20
|
-
};
|
|
21
16
|
/** Parent key → child-key entry for the schema restricted to `enabledTypes`; powers YAML editor autocompletion. */
|
|
22
|
-
export declare function parameterSchemaKeys(enabledTypes: ParameterType[]):
|
|
17
|
+
export declare function parameterSchemaKeys(enabledTypes: ParameterType[]): SchemaKeys;
|
|
23
18
|
/** Runtime validation schema restricted to the enabled types; the static types stay the full union. */
|
|
24
19
|
export declare function buildParameterSchema(enabledTypes: ParameterType[]): z.ZodMiniObject<{
|
|
25
20
|
definition: z.ZodMiniDiscriminatedUnion<readonly [z.core.$ZodTypeDiscriminable<string>, ...z.core.$ZodTypeDiscriminable<string>[]], "type">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameterSchema.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterSchema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parameterSchema.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterSchema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,yBAAyB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,YACzB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,mCAAmC,EACnC,wBAAwB,EACxB,qBAAqB,CACf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACnE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,sFAAsF;AACtF,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAC5C,eAAe,CAAC,OAAO,WAAW,CAAC,SAAS,EAAE,eAAe,CAAC,CACjE,CAAC;AAEF,mHAAmH;AACnH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,aAAa,EAAE,GAAG,UAAU,CAE7E;AAED,uGAAuG;AACvG,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,aAAa,EAAE;;;;;;;mBAMjE;AAuFD,kHAAkH;AAClH,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAOnB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import { union } from "lodash-es";
|
|
3
2
|
import * as z from "zod/mini";
|
|
3
|
+
import { deriveSchemaKeys } from "../asCode/schemaKeys.js";
|
|
4
4
|
/**
|
|
5
5
|
* Codes carried by schema issues via `issue.message`; `classifySchemaError` routes each to the
|
|
6
6
|
* equally named validation error code, so every entry needs a localized message wired up.
|
|
@@ -82,42 +82,3 @@ function rule(code, predicate, path) {
|
|
|
82
82
|
function allUnique(items) {
|
|
83
83
|
return new Set(items).size === items.length;
|
|
84
84
|
}
|
|
85
|
-
/** Map of parent key → child-key entry; an array-of-objects child is recorded as a `sequence` entry. */
|
|
86
|
-
function deriveSchemaKeys(schema, parentKey = "", kind = "mapping", result = {}) {
|
|
87
|
-
for (const object of objectSchemasOf(schema)) {
|
|
88
|
-
const { shape } = object._zod.def;
|
|
89
|
-
result[parentKey] = { kind, keys: union(result[parentKey]?.keys, Object.keys(shape)) };
|
|
90
|
-
for (const [key, child] of Object.entries(shape)) {
|
|
91
|
-
const inner = unwrap(child);
|
|
92
|
-
if (inner._zod.def.type === "array") {
|
|
93
|
-
const element = unwrap(inner._zod.def.element);
|
|
94
|
-
deriveSchemaKeys(element, key, "sequence", result);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
deriveSchemaKeys(inner, key, "mapping", result);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
/** Object schemas reachable from `schema`, flattening a discriminated union into its arms. */
|
|
104
|
-
function objectSchemasOf(schema) {
|
|
105
|
-
const { def } = schema._zod;
|
|
106
|
-
if (def.type === "object") {
|
|
107
|
-
return [schema];
|
|
108
|
-
}
|
|
109
|
-
if (def.type === "union") {
|
|
110
|
-
return def.options.flatMap((option) => objectSchemasOf(unwrap(option)));
|
|
111
|
-
}
|
|
112
|
-
return [];
|
|
113
|
-
}
|
|
114
|
-
function unwrap(schema) {
|
|
115
|
-
const { type } = schema._zod.def;
|
|
116
|
-
if (type === "optional" || type === "default") {
|
|
117
|
-
return unwrap(schema._zod.def.innerType);
|
|
118
|
-
}
|
|
119
|
-
if (type === "pipe") {
|
|
120
|
-
return unwrap(schema._zod.def.in);
|
|
121
|
-
}
|
|
122
|
-
return schema;
|
|
123
|
-
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ParameterType } from "@gooddata/sdk-model";
|
|
2
|
+
import { type YamlValidationFailure } from "../asCode/validateYaml.js";
|
|
2
3
|
import { type ParameterSchema, type SchemaErrorCode } from "./parameterSchema.js";
|
|
3
4
|
export type ParameterValidationResult = {
|
|
4
5
|
isValid: true;
|
|
5
6
|
parameter: ParameterSchema;
|
|
6
|
-
} |
|
|
7
|
-
|
|
7
|
+
} | YamlValidationFailure<ParameterFailure>;
|
|
8
|
+
type ParameterFailure = {
|
|
8
9
|
errorCode: ParameterValidationErrorCode;
|
|
9
10
|
type?: ParameterType;
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameterValidation.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterValidation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"parameterValidation.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterValidation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,KAAK,qBAAqB,EAAgB,MAAM,2BAA2B,CAAC;AAErF,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,eAAe,EAGvB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,yBAAyB,GAC/B;IACI,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,eAAe,CAAC;CAC9B,GACD,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AAE9C,KAAK,gBAAgB,GAAG;IAAE,SAAS,EAAE,4BAA4B,CAAC;IAAC,IAAI,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC;AAE1F,MAAM,MAAM,4BAA4B,GAClC,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,aAAa,GACb,eAAe,CAAC;AAEtB,KAAK,4BAA4B,GAAG;IAChC,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,4BAA4B,GACtC,yBAAyB,CAW3B"}
|
|
@@ -5,40 +5,37 @@ export function validateParameterYaml(value, options) {
|
|
|
5
5
|
const result = validateYaml(value, {
|
|
6
6
|
schema: buildParameterSchema(options.enabledTypes),
|
|
7
7
|
fixedIdentifier: options.fixedIdentifier,
|
|
8
|
+
classifyIssue: classifyParameterIssue,
|
|
8
9
|
});
|
|
9
|
-
if (result.
|
|
10
|
+
if (result.isValid) {
|
|
10
11
|
return { isValid: true, parameter: result.data };
|
|
11
12
|
}
|
|
12
|
-
return result
|
|
13
|
-
? classifySchemaError(result.error, readDeclaredType(result.parsed))
|
|
14
|
-
: invalid(result.kind);
|
|
13
|
+
return result;
|
|
15
14
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return invalid(issue.message, declaredType);
|
|
21
|
-
}
|
|
22
|
-
// The object's own `type`, not the model type inside `definition`. A mistyped one is easy to
|
|
23
|
-
// make and impossible to spot in a generic structure error, so it gets its own message naming
|
|
24
|
-
// the one value the field accepts.
|
|
25
|
-
if (path === "type") {
|
|
26
|
-
return invalid("invalidType");
|
|
27
|
-
}
|
|
28
|
-
if (path === "definition.type") {
|
|
29
|
-
return invalid("unsupportedType");
|
|
30
|
-
}
|
|
31
|
-
if (path === "definition.defaultValue") {
|
|
32
|
-
return invalid("invalidDefaultValue", declaredType);
|
|
33
|
-
}
|
|
34
|
-
if (path.startsWith("definition.constraints")) {
|
|
35
|
-
return invalid("invalidConstraints", declaredType);
|
|
36
|
-
}
|
|
37
|
-
if (path === "tags" || path.startsWith("tags.")) {
|
|
38
|
-
return invalid("invalidTags");
|
|
39
|
-
}
|
|
15
|
+
function classifyParameterIssue(path, parsed, issue) {
|
|
16
|
+
const declaredType = readDeclaredType(parsed);
|
|
17
|
+
if (isSchemaErrorCode(issue.message)) {
|
|
18
|
+
return { errorCode: issue.message, type: declaredType };
|
|
40
19
|
}
|
|
41
|
-
|
|
20
|
+
// The object's own `type`, not the model type inside `definition`. A mistyped one is easy to
|
|
21
|
+
// make and impossible to spot in a generic structure error, so it gets its own message naming
|
|
22
|
+
// the one value the field accepts.
|
|
23
|
+
if (path === "type") {
|
|
24
|
+
return { errorCode: "invalidType" };
|
|
25
|
+
}
|
|
26
|
+
if (path === "definition.type") {
|
|
27
|
+
return { errorCode: "unsupportedType" };
|
|
28
|
+
}
|
|
29
|
+
if (path === "definition.defaultValue") {
|
|
30
|
+
return { errorCode: "invalidDefaultValue", type: declaredType };
|
|
31
|
+
}
|
|
32
|
+
if (path.startsWith("definition.constraints")) {
|
|
33
|
+
return { errorCode: "invalidConstraints", type: declaredType };
|
|
34
|
+
}
|
|
35
|
+
if (path === "tags" || path.startsWith("tags.")) {
|
|
36
|
+
return { errorCode: "invalidTags" };
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
42
39
|
}
|
|
43
40
|
const schemaErrorCodeSet = new Set(schemaErrorCodes);
|
|
44
41
|
function isSchemaErrorCode(message) {
|
|
@@ -55,10 +52,3 @@ function readDeclaredType(parsed) {
|
|
|
55
52
|
const { type } = definition;
|
|
56
53
|
return type === "NUMBER" || type === "STRING" ? type : undefined;
|
|
57
54
|
}
|
|
58
|
-
function invalid(code, type) {
|
|
59
|
-
return {
|
|
60
|
-
isValid: false,
|
|
61
|
-
errorCode: code,
|
|
62
|
-
type,
|
|
63
|
-
};
|
|
64
|
-
}
|
package/esm/sdk-ui-catalog.d.ts
CHANGED
|
@@ -38,6 +38,23 @@ export declare function AnalyticsCatalogDetailContent({ backend, workspace, loca
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function AnalyticsCatalogFilter<T>(props: IAnalyticsCatalogFilterProps<T>): JSX.Element;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Where a value sits in the document, as object keys and array indexes.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare type AsCodeDocumentPath = ReadonlyArray<string | number>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The field a failure marks in the editor: the value at `path`, or with `target: "key"` the key that
|
|
49
|
+
* names it, as for an unknown key. A failure without a path (empty or malformed document) has nothing
|
|
50
|
+
* to mark and shows only as a banner.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare type AsCodeFieldMark = {
|
|
54
|
+
path?: AsCodeDocumentPath;
|
|
55
|
+
target?: "key";
|
|
56
|
+
};
|
|
57
|
+
|
|
41
58
|
/** @internal */
|
|
42
59
|
export declare type AsCodeSerialization = {
|
|
43
60
|
yaml: string;
|
|
@@ -52,10 +69,10 @@ export declare type AsCodeSerialization = {
|
|
|
52
69
|
export declare type AsCodeValidation<TDef> = {
|
|
53
70
|
isValid: true;
|
|
54
71
|
definition: TDef;
|
|
55
|
-
} | {
|
|
72
|
+
} | ({
|
|
56
73
|
isValid: false;
|
|
57
74
|
error: string;
|
|
58
|
-
};
|
|
75
|
+
} & AsCodeFieldMark);
|
|
59
76
|
|
|
60
77
|
/**
|
|
61
78
|
* Identity rule per flow: `edit` keeps `fixedIdentifier`; `duplicate` accepts and ignores any id (the
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-catalog",
|
|
3
|
-
"version": "11.68.0-alpha.
|
|
3
|
+
"version": "11.68.0-alpha.3",
|
|
4
4
|
"description": "GoodData SDK - Analytics Catalog",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "LicenseRef-LICENSE",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"esm/**/*.d.ts",
|
|
16
16
|
"esm/**/*.map",
|
|
17
17
|
"esm/**/*.svg",
|
|
18
|
-
"styles"
|
|
18
|
+
"styles",
|
|
19
|
+
"NOTICE"
|
|
19
20
|
],
|
|
20
21
|
"type": "module",
|
|
21
22
|
"sideEffects": [
|
|
@@ -40,15 +41,15 @@
|
|
|
40
41
|
"tslib": "2.8.1",
|
|
41
42
|
"yaml": "2.9.1",
|
|
42
43
|
"zod": "4.6.7",
|
|
43
|
-
"@gooddata/sdk-backend-spi": "11.68.0-alpha.
|
|
44
|
-
"@gooddata/sdk-
|
|
45
|
-
"@gooddata/sdk-
|
|
46
|
-
"@gooddata/sdk-ui": "11.68.0-alpha.
|
|
47
|
-
"@gooddata/sdk-ui-
|
|
48
|
-
"@gooddata/sdk-
|
|
49
|
-
"@gooddata/sdk-ui-theme-provider": "11.68.0-alpha.
|
|
50
|
-
"@gooddata/sdk-ui-
|
|
51
|
-
"@gooddata/util": "11.68.0-alpha.
|
|
44
|
+
"@gooddata/sdk-backend-spi": "11.68.0-alpha.3",
|
|
45
|
+
"@gooddata/sdk-ui": "11.68.0-alpha.3",
|
|
46
|
+
"@gooddata/sdk-model": "11.68.0-alpha.3",
|
|
47
|
+
"@gooddata/sdk-ui-ext": "11.68.0-alpha.3",
|
|
48
|
+
"@gooddata/sdk-ui-semantic-search": "11.68.0-alpha.3",
|
|
49
|
+
"@gooddata/sdk-code-schemas": "11.68.0-alpha.3",
|
|
50
|
+
"@gooddata/sdk-ui-theme-provider": "11.68.0-alpha.3",
|
|
51
|
+
"@gooddata/sdk-ui-kit": "11.68.0-alpha.3",
|
|
52
|
+
"@gooddata/util": "11.68.0-alpha.3"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@microsoft/api-documenter": "7.30.20",
|
|
@@ -84,11 +85,11 @@
|
|
|
84
85
|
"stylelint": "16.26.1",
|
|
85
86
|
"typescript": "7.0.2",
|
|
86
87
|
"vitest": "5.0.4",
|
|
87
|
-
"@gooddata/eslint-config": "11.68.0-alpha.
|
|
88
|
-
"@gooddata/
|
|
89
|
-
"@gooddata/
|
|
90
|
-
"@gooddata/stylelint-config": "11.68.0-alpha.
|
|
91
|
-
"@gooddata/
|
|
88
|
+
"@gooddata/eslint-config": "11.68.0-alpha.3",
|
|
89
|
+
"@gooddata/i18n-toolkit": "11.68.0-alpha.3",
|
|
90
|
+
"@gooddata/sdk-backend-mockingbird": "11.68.0-alpha.3",
|
|
91
|
+
"@gooddata/stylelint-config": "11.68.0-alpha.3",
|
|
92
|
+
"@gooddata/oxlint-config": "11.68.0-alpha.3"
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
95
|
"react": "^18.0.0 || ^19.0.0",
|