@gooddata/sdk-ui-catalog 11.68.0-alpha.2 → 11.68.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/en-US.localization-bundle.js +4 -4
- 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,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
2
|
import type { ComputedAttributeDataType, ComputedAttributeValueType, MetricType } 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
|
* The value lists mirror the sdk-model unions the definition is typed with. `satisfies` makes a value
|
|
@@ -71,11 +72,6 @@ export type ComputedAttributeSchemaInput = z.input<typeof computedAttributeSchem
|
|
|
71
72
|
export type ComputedAttributeSchema = z.infer<typeof computedAttributeSchema>;
|
|
72
73
|
/** Fails the build when this schema drifts from the AAC `computed_attribute` document type. */
|
|
73
74
|
export type ComputedAttributeAacParity = AssertAacParity<AacSchemaParity<typeof ObjectTypes.COMPUTED_ATTRIBUTE, ComputedAttributeSchema>>;
|
|
74
|
-
|
|
75
|
-
* Allowed YAML property names keyed by parent mapping, used to power editor autocompletion.
|
|
76
|
-
* The computed attribute schema is flat, so the only entry is the top-level mapping (keyed by `""`),
|
|
77
|
-
* whose value is the object's property names read from zod's public `shape`.
|
|
78
|
-
*/
|
|
79
|
-
export declare const COMPUTED_ATTRIBUTE_SCHEMA_KEYS: Record<string, string[]>;
|
|
75
|
+
export declare const COMPUTED_ATTRIBUTE_SCHEMA_KEYS: SchemaKeys;
|
|
80
76
|
export {};
|
|
81
77
|
//# sourceMappingURL=computedAttributeSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computedAttributeSchema.d.ts","sourceRoot":"","sources":["../../src/computedAttribute/computedAttributeSchema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;GAIG;AACH,QAAA,MAAM,UAAU,8FASyC,CAAC;AAC1D,QAAA,MAAM,WAAW,wHAUyC,CAAC;AAC3D,QAAA,MAAM,YAAY,sCAAuE,CAAC;AAE1F,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAChC,KA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AC;AAEF,eAAO,MAAM,8BAA8B,EAAE,UAAsD,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
|
* The value lists mirror the sdk-model unions the definition is typed with. `satisfies` makes a value
|
|
5
6
|
* the model does not know a compile error, and the reverse check below makes a model value the list
|
|
@@ -57,11 +58,4 @@ export const computedAttributeSchema = z.strictObject({
|
|
|
57
58
|
show_in_ai_results: z.optional(z.boolean()),
|
|
58
59
|
locale: z.optional(z.string().check(z.regex(LOCALE_PATTERN))),
|
|
59
60
|
});
|
|
60
|
-
|
|
61
|
-
* Allowed YAML property names keyed by parent mapping, used to power editor autocompletion.
|
|
62
|
-
* The computed attribute schema is flat, so the only entry is the top-level mapping (keyed by `""`),
|
|
63
|
-
* whose value is the object's property names read from zod's public `shape`.
|
|
64
|
-
*/
|
|
65
|
-
export const COMPUTED_ATTRIBUTE_SCHEMA_KEYS = {
|
|
66
|
-
"": Object.keys(computedAttributeSchema.shape),
|
|
67
|
-
};
|
|
61
|
+
export const COMPUTED_ATTRIBUTE_SCHEMA_KEYS = deriveSchemaKeys(computedAttributeSchema);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IComputedAttributeMetadataObjectDefinition } from "@gooddata/sdk-model";
|
|
2
|
+
import { type YamlValidationFailure } from "../asCode/validateYaml.js";
|
|
2
3
|
export type ComputedAttributeValidationResult = {
|
|
3
4
|
isValid: true;
|
|
4
5
|
computedAttribute: IComputedAttributeMetadataObjectDefinition;
|
|
5
|
-
} | {
|
|
6
|
-
isValid: false;
|
|
6
|
+
} | YamlValidationFailure<{
|
|
7
7
|
errorCode: ComputedAttributeValidationErrorCode;
|
|
8
|
-
}
|
|
8
|
+
}>;
|
|
9
9
|
export type ComputedAttributeValidationErrorCode = "empty" | "syntax" | "invalidStructure" | "idImmutable" | "missingMaql" | "invalidType" | "invalidTags" | "invalidLocale" | "invalidDataType" | "invalidValueType" | "invalidMetricType";
|
|
10
10
|
type ValidateComputedAttributeYamlOptions = {
|
|
11
11
|
fixedIdentifier?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computedAttributeValidation.d.ts","sourceRoot":"","sources":["../../src/computedAttribute/computedAttributeValidation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"computedAttributeValidation.d.ts","sourceRoot":"","sources":["../../src/computedAttribute/computedAttributeValidation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,qBAAqB,CAAC;AAEtF,OAAO,EAAE,KAAK,qBAAqB,EAA+B,MAAM,2BAA2B,CAAC;AAKpG,MAAM,MAAM,iCAAiC,GACvC;IACI,OAAO,EAAE,IAAI,CAAC;IACd,iBAAiB,EAAE,0CAA0C,CAAC;CACjE,GACD,qBAAqB,CAAC;IAAE,SAAS,EAAE,oCAAoC,CAAA;CAAE,CAAC,CAAC;AAEjF,MAAM,MAAM,oCAAoC,GAC1C,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,CAAC;AAE1B,KAAK,oCAAoC,GAAG;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,oCAAyC,GACnD,iCAAiC,CAWnC"}
|
|
@@ -1,56 +1,44 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import { validateYaml } from "../asCode/validateYaml.js";
|
|
2
|
+
import { isMaqlWritten, validateYaml } from "../asCode/validateYaml.js";
|
|
3
3
|
import { computedAttributeYamlToDefinition } from "./computedAttributeConverter.js";
|
|
4
4
|
import { computedAttributeSchema } from "./computedAttributeSchema.js";
|
|
5
5
|
export function validateComputedAttributeYaml(value, options = {}) {
|
|
6
6
|
const result = validateYaml(value, {
|
|
7
7
|
schema: computedAttributeSchema,
|
|
8
8
|
fixedIdentifier: options.fixedIdentifier,
|
|
9
|
+
classifyIssue: classifyComputedAttributeIssue,
|
|
9
10
|
});
|
|
10
|
-
if (result.
|
|
11
|
+
if (result.isValid) {
|
|
11
12
|
return { isValid: true, computedAttribute: computedAttributeYamlToDefinition(result.data) };
|
|
12
13
|
}
|
|
13
|
-
return
|
|
14
|
-
isValid: false,
|
|
15
|
-
errorCode: result.kind === "schema"
|
|
16
|
-
? classifyComputedAttributeError(result.error, result.parsed)
|
|
17
|
-
: result.kind,
|
|
18
|
-
};
|
|
14
|
+
return result;
|
|
19
15
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (path === "value_type") {
|
|
49
|
-
return "invalidValueType";
|
|
50
|
-
}
|
|
51
|
-
if (path === "metric_type") {
|
|
52
|
-
return "invalidMetricType";
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return "invalidStructure";
|
|
16
|
+
function classifyComputedAttributeIssue(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" };
|
|
20
|
+
}
|
|
21
|
+
// A mistyped `type` is easy to make and impossible to spot in a generic structure error,
|
|
22
|
+
// so it gets its own message naming the one value the field accepts.
|
|
23
|
+
if (path === "type") {
|
|
24
|
+
return { errorCode: "invalidType" };
|
|
25
|
+
}
|
|
26
|
+
if (path === "tags" || path.startsWith("tags.")) {
|
|
27
|
+
return { errorCode: "invalidTags" };
|
|
28
|
+
}
|
|
29
|
+
// The value-shaping fields each get a message naming what they accept; a generic structure
|
|
30
|
+
// error would leave the author guessing which of several optional lines is wrong.
|
|
31
|
+
if (path === "locale") {
|
|
32
|
+
return { errorCode: "invalidLocale" };
|
|
33
|
+
}
|
|
34
|
+
if (path === "data_type") {
|
|
35
|
+
return { errorCode: "invalidDataType" };
|
|
36
|
+
}
|
|
37
|
+
if (path === "value_type") {
|
|
38
|
+
return { errorCode: "invalidValueType" };
|
|
39
|
+
}
|
|
40
|
+
if (path === "metric_type") {
|
|
41
|
+
return { errorCode: "invalidMetricType" };
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
56
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterContext.d.ts","sourceRoot":"","sources":["../../src/filter/FilterContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAkD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterContext.d.ts","sourceRoot":"","sources":["../../src/filter/FilterContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAkD,MAAM,OAAO,CAAC;AAE/F,OAAO,EACH,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAEhC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIzD,UAAU,aAAa,CAAC,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,gBAAgB;IACtB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,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ED,wBAAgB,gBAAgB,mBAE/B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAAC,UAAU,EAAE,CAAC,GAAG,SAAS,CAqB1E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2025-2026 GoodData Corporation
|
|
3
3
|
import { createContext, useContext, useMemo, useReducer } from "react";
|
|
4
|
-
import { isEqual } from "lodash-es";
|
|
5
4
|
import { SemanticQualityIssueCodeValues, } from "@gooddata/sdk-model";
|
|
5
|
+
import { _isEqual } from "@gooddata/util";
|
|
6
6
|
import {} from "../objectType/types.js";
|
|
7
7
|
import { useQualityReportState } from "../quality/QualityContext.js";
|
|
8
8
|
import { getQualityIssueIdsByCodes } from "../quality/utils.js";
|
|
@@ -49,7 +49,7 @@ export function FilterProvider({ children }) {
|
|
|
49
49
|
const state = useMemo(() => ({
|
|
50
50
|
...filters,
|
|
51
51
|
// Derived state
|
|
52
|
-
isModified: !
|
|
52
|
+
isModified: !_isEqual(filters, initialState),
|
|
53
53
|
}), [filters]);
|
|
54
54
|
const actions = useMemo(() => ({
|
|
55
55
|
setTypes: (types) => dispatch({ type: "setTypes", payload: types }),
|
|
@@ -68,37 +68,37 @@ function filterReducer(state, action) {
|
|
|
68
68
|
switch (action.type) {
|
|
69
69
|
// Setters
|
|
70
70
|
case "setTypes": {
|
|
71
|
-
if (
|
|
71
|
+
if (_isEqual(state.types, action.payload))
|
|
72
72
|
return state;
|
|
73
73
|
return { ...state, types: action.payload };
|
|
74
74
|
}
|
|
75
75
|
case "setOrigin": {
|
|
76
|
-
if (
|
|
76
|
+
if (_isEqual(state.origin, action.payload))
|
|
77
77
|
return state;
|
|
78
78
|
return { ...state, origin: action.payload };
|
|
79
79
|
}
|
|
80
80
|
case "setCreatedBy": {
|
|
81
|
-
if (
|
|
81
|
+
if (_isEqual(state.createdBy, action.payload))
|
|
82
82
|
return state;
|
|
83
83
|
return { ...state, createdBy: action.payload };
|
|
84
84
|
}
|
|
85
85
|
case "setTags": {
|
|
86
|
-
if (
|
|
86
|
+
if (_isEqual(state.tags, action.payload))
|
|
87
87
|
return state;
|
|
88
88
|
return { ...state, tags: action.payload };
|
|
89
89
|
}
|
|
90
90
|
case "setQualityCodes": {
|
|
91
|
-
if (
|
|
91
|
+
if (_isEqual(state.qualityCodes, action.payload))
|
|
92
92
|
return state;
|
|
93
93
|
return { ...state, qualityCodes: action.payload };
|
|
94
94
|
}
|
|
95
95
|
case "setIsHidden": {
|
|
96
|
-
if (
|
|
96
|
+
if (_isEqual(state.isHidden, action.payload))
|
|
97
97
|
return state;
|
|
98
98
|
return { ...state, isHidden: action.payload };
|
|
99
99
|
}
|
|
100
100
|
case "setCertification": {
|
|
101
|
-
if (
|
|
101
|
+
if (_isEqual(state.certification, action.payload))
|
|
102
102
|
return state;
|
|
103
103
|
return { ...state, certification: action.payload };
|
|
104
104
|
}
|
|
@@ -2,9 +2,9 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
// (C) 2025-2026 GoodData Corporation
|
|
3
3
|
import { useCallback, useId, useMemo, useState, } from "react";
|
|
4
4
|
import cx from "classnames";
|
|
5
|
-
import { isEqual } from "lodash-es";
|
|
6
5
|
import { defineMessages, useIntl } from "react-intl";
|
|
7
6
|
import { Dropdown, InvertableSelect, SeparatorLine, UiButton } from "@gooddata/sdk-ui-kit";
|
|
7
|
+
import { _isEqual } from "@gooddata/util";
|
|
8
8
|
const messages = defineMessages({
|
|
9
9
|
apply: {
|
|
10
10
|
id: "gs.list.apply",
|
|
@@ -39,12 +39,12 @@ export function StaticFilter(props) {
|
|
|
39
39
|
}
|
|
40
40
|
// Reset local state when the parent selection changes
|
|
41
41
|
// https://react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes
|
|
42
|
-
if (!
|
|
42
|
+
if (!_isEqual(prevSelection, selection)) {
|
|
43
43
|
resetLocalState();
|
|
44
44
|
}
|
|
45
45
|
// The search bar should not appear until there are at least 7 items in the list.
|
|
46
46
|
const isSearchBarVisible = options.length >= 7;
|
|
47
|
-
const isSelectionEqual =
|
|
47
|
+
const isSelectionEqual = _isEqual(localSelection, selection) && localIsInverted === isSelectionInverted;
|
|
48
48
|
const isSelectionEmpty = localIsInverted
|
|
49
49
|
? localSelection.length === options.length
|
|
50
50
|
: localSelection.length === 0;
|
package/esm/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { AnalyticsCatalog, type IAnalyticsCatalogProps } from "./AnalyticsCatalo
|
|
|
2
2
|
export { AnalyticsCatalogDetail, type IAnalyticsCatalogDetailProps, AnalyticsCatalogDetailContent, type IAnalyticsCatalogDetailContentProps, } from "./AnalyticsCatalogDetail.js";
|
|
3
3
|
export { AnalyticsCatalogFilter, type IAnalyticsCatalogFilterProps } from "./AnalyticsCatalogFilter.js";
|
|
4
4
|
export { InsightCodecProvider, type IInsightCodec, type VisualizationTypePredicate, } from "./insight/insightCodecContext.js";
|
|
5
|
-
export type { IAsCodeEditing, AsCodeSerialization, AsCodeValidation, AsCodeValidationContext, } from "./asCode/descriptor.js";
|
|
5
|
+
export type { IAsCodeEditing, AsCodeSerialization, AsCodeValidation, AsCodeValidationContext, AsCodeDocumentPath, AsCodeFieldMark, } from "./asCode/descriptor.js";
|
|
6
6
|
export type { ICatalogDetailProps } from "./catalogDetail/CatalogDetail.js";
|
|
7
7
|
export type { EditHandlerEvent, OpenHandlerEvent } from "./catalogDetail/types.js";
|
|
8
8
|
export type { ICatalogDetailContentProps } from "./catalogDetail/CatalogDetailContent.js";
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EACH,sBAAsB,EACtB,KAA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AAmB,EACnB,qBAAqB,EACrB,iBAAiB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,GACzB,MAAM,yBAAyB,CAAC"}
|
|
@@ -698,7 +698,7 @@ export const en_US = {
|
|
|
698
698
|
"crowdinContext": "Section header label above the YAML editor in the parameter dialog."
|
|
699
699
|
},
|
|
700
700
|
"analyticsCatalog.parameter.dialog.sectionHeader.tooltip": {
|
|
701
|
-
"text": "Create a YAML statement that defines a parameter.",
|
|
701
|
+
"text": "Create a YAML statement that defines a parameter. Press {platform, select, apple {⌘I} other {Ctrl+I}} for suggestions.",
|
|
702
702
|
"crowdinContext": "Tooltip shown for the help icon next to the parameter definition section header."
|
|
703
703
|
},
|
|
704
704
|
"analyticsCatalog.parameter.dialog.edit.duplicate": {
|
|
@@ -842,7 +842,7 @@ export const en_US = {
|
|
|
842
842
|
"crowdinContext": "Header above the as-code editor in the computed attribute dialog."
|
|
843
843
|
},
|
|
844
844
|
"analyticsCatalog.computedAttribute.dialog.sectionHeader.tooltip": {
|
|
845
|
-
"text": "Write a MAQL expression that assigns each row a value, using CASE WHEN branches over a metric or a fact.",
|
|
845
|
+
"text": "Write a MAQL expression that assigns each row a value, using CASE WHEN branches over a metric or a fact. Press {platform, select, apple {⌘I} other {Ctrl+I}} for suggestions.",
|
|
846
846
|
"crowdinContext": "Tooltip shown for the help icon next to the computed attribute definition section header."
|
|
847
847
|
},
|
|
848
848
|
"analyticsCatalog.computedAttribute.dialog.help": {
|
|
@@ -954,7 +954,7 @@ export const en_US = {
|
|
|
954
954
|
"crowdinContext": "Header above the as-code editor in the metric dialog."
|
|
955
955
|
},
|
|
956
956
|
"analyticsCatalog.metric.dialog.sectionHeader.tooltip": {
|
|
957
|
-
"text": "Define the metric in YAML, including its MAQL expression and format.",
|
|
957
|
+
"text": "Define the metric in YAML, including its MAQL expression and format. Press {platform, select, apple {⌘I} other {Ctrl+I}} for suggestions.",
|
|
958
958
|
"crowdinContext": "Tooltip explaining the as-code metric editor."
|
|
959
959
|
},
|
|
960
960
|
"analyticsCatalog.metric.actions.openInEditor": {
|
|
@@ -1122,7 +1122,7 @@ export const en_US = {
|
|
|
1122
1122
|
"crowdinContext": "Header above the as-code editor in the visualization dialog."
|
|
1123
1123
|
},
|
|
1124
1124
|
"analyticsCatalog.visualization.dialog.sectionHeader.tooltip": {
|
|
1125
|
-
"text": "Define the visualization in YAML, including its type, query, and configuration.",
|
|
1125
|
+
"text": "Define the visualization in YAML, including its type, query, and configuration. Press {platform, select, apple {⌘I} other {Ctrl+I}} for suggestions.",
|
|
1126
1126
|
"crowdinContext": "Tooltip explaining the as-code visualization editor."
|
|
1127
1127
|
},
|
|
1128
1128
|
"analyticsCatalog.visualization.actions.openInAnalyticalDesigner": {
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Completion source for the metric YAML schema. The metric schema is a flat mapping, so completion
|
|
4
|
-
* only offers the top-level property names, and only at column zero — an indented line sits inside a
|
|
5
|
-
* sequence value (e.g. under `tags:`), where those keys must not be offered.
|
|
6
|
-
*/
|
|
7
|
-
export declare function metricCompletions(context: CompletionContext): CompletionResult | null;
|
|
1
|
+
export declare const metricCompletions: (context: import("@codemirror/autocomplete").CompletionContext) => import("@codemirror/autocomplete").CompletionResult | null;
|
|
8
2
|
//# sourceMappingURL=metricCompletions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metricCompletions.d.ts","sourceRoot":"","sources":["../../src/metric/metricCompletions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metricCompletions.d.ts","sourceRoot":"","sources":["../../src/metric/metricCompletions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,+HAA+D,CAAC"}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { createFlatKeyCompletions } from "../asCode/keyCompletions.js";
|
|
2
3
|
import { METRIC_SCHEMA_KEYS } from "./metricSchema.js";
|
|
3
|
-
const
|
|
4
|
-
/**
|
|
5
|
-
* Completion source for the metric YAML schema. The metric schema is a flat mapping, so completion
|
|
6
|
-
* only offers the top-level property names, and only at column zero — an indented line sits inside a
|
|
7
|
-
* sequence value (e.g. under `tags:`), where those keys must not be offered.
|
|
8
|
-
*/
|
|
9
|
-
export function metricCompletions(context) {
|
|
10
|
-
const line = context.state.doc.lineAt(context.pos);
|
|
11
|
-
const before = line.text.slice(0, context.pos - line.from);
|
|
12
|
-
// Trigger only for a key typed at column zero; any leading whitespace means the cursor is nested.
|
|
13
|
-
const match = before.match(/^([\w-]*)$/);
|
|
14
|
-
if (!match) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return { from: context.pos - match[1].length, options: rootOptions, validFor: /^[\w-]*$/ };
|
|
18
|
-
}
|
|
4
|
+
export const metricCompletions = createFlatKeyCompletions(METRIC_SCHEMA_KEYS[""]?.keys ?? []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metricDescriptor.d.ts","sourceRoot":"","sources":["../../src/metric/metricDescriptor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"metricDescriptor.d.ts","sourceRoot":"","sources":["../../src/metric/metricDescriptor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAS5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AA8EnE;;GAEG;AACH,eAAO,MAAM,gBAAgB,4GA0B5B,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 { METRIC_EDITOR_FEATURE_FLAG, useCanCreateMetric } from "./gate.js";
|
|
7
7
|
import { metricCompletions } from "./metricCompletions.js";
|
|
@@ -59,7 +59,7 @@ function useMetricEditing() {
|
|
|
59
59
|
const result = validateMetricYaml(value, { fixedIdentifier: fixedIdentifierOf(context) });
|
|
60
60
|
return result.isValid
|
|
61
61
|
? { isValid: true, definition: result.measure }
|
|
62
|
-
:
|
|
62
|
+
: toAsCodeFailure(result, intl.formatMessage(errorMessages[result.errorCode]));
|
|
63
63
|
},
|
|
64
64
|
reconcile: reconcileMetricDefinition,
|
|
65
65
|
}), [intl]);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
2
|
import type { AacSchemaParity, AssertAacParity } from "../asCode/aacParity.js";
|
|
3
|
+
import { type SchemaKeys } from "../asCode/schemaKeys.js";
|
|
3
4
|
import type { ObjectTypes } from "../objectType/constants.js";
|
|
4
5
|
/**
|
|
5
6
|
* Zod schema for the analytics-as-code (AAC) metric YAML shape.
|
|
@@ -24,10 +25,5 @@ export type MetricSchemaInput = z.input<typeof metricSchema>;
|
|
|
24
25
|
export type MetricSchema = z.infer<typeof metricSchema>;
|
|
25
26
|
/** Fails the build when this schema drifts from the AAC `metric` document type. */
|
|
26
27
|
export type MetricAacParity = AssertAacParity<AacSchemaParity<typeof ObjectTypes.METRIC, MetricSchema>>;
|
|
27
|
-
|
|
28
|
-
* Allowed YAML property names keyed by parent mapping, used to power editor autocompletion.
|
|
29
|
-
* The metric schema is flat, so the only entry is the top-level mapping (keyed by `""`), whose
|
|
30
|
-
* value is the object's property names read from zod's public `shape`.
|
|
31
|
-
*/
|
|
32
|
-
export declare const METRIC_SCHEMA_KEYS: Record<string, string[]>;
|
|
28
|
+
export declare const METRIC_SCHEMA_KEYS: SchemaKeys;
|
|
33
29
|
//# sourceMappingURL=metricSchema.d.ts.map
|
|
@@ -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
|
}
|