@gooddata/sdk-ui-catalog 11.50.0-alpha.2 → 11.50.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/AnalyticsCatalogDetail.d.ts.map +1 -1
- package/esm/AnalyticsCatalogDetail.js +1 -3
- package/esm/asCode/AsCodeCreateDialog.d.ts +3 -7
- package/esm/asCode/AsCodeCreateDialog.d.ts.map +1 -1
- package/esm/asCode/AsCodeCreateDialog.js +13 -23
- package/esm/asCode/AsCodeDeleteDialog.d.ts +1 -6
- package/esm/asCode/AsCodeDeleteDialog.d.ts.map +1 -1
- package/esm/asCode/AsCodeDeleteDialog.js +11 -20
- package/esm/asCode/AsCodeDetailActions.d.ts +2 -11
- package/esm/asCode/AsCodeDetailActions.d.ts.map +1 -1
- package/esm/asCode/AsCodeDetailActions.js +16 -22
- package/esm/asCode/AsCodeDialog.d.ts +12 -17
- package/esm/asCode/AsCodeDialog.d.ts.map +1 -1
- package/esm/asCode/AsCodeDialog.js +59 -27
- package/esm/asCode/AsCodeEditDialog.d.ts +3 -8
- package/esm/asCode/AsCodeEditDialog.d.ts.map +1 -1
- package/esm/asCode/AsCodeEditDialog.js +4 -21
- package/esm/asCode/descriptor.d.ts +78 -104
- package/esm/asCode/descriptor.d.ts.map +1 -1
- package/esm/asCode/descriptor.js +13 -4
- package/esm/asCode/serverIdentity.d.ts +7 -0
- package/esm/asCode/serverIdentity.d.ts.map +1 -0
- package/esm/asCode/serverIdentity.js +2 -0
- package/esm/asCode/tests/withMutationPort.d.ts +4 -0
- package/esm/asCode/tests/withMutationPort.d.ts.map +1 -0
- package/esm/asCode/tests/withMutationPort.js +5 -0
- package/esm/asCode/useAsCodeBase.d.ts +5 -8
- package/esm/asCode/useAsCodeBase.d.ts.map +1 -1
- package/esm/asCode/useAsCodeBase.js +20 -18
- package/esm/asCode/useAsCodeLoadFailure.d.ts +8 -0
- package/esm/asCode/useAsCodeLoadFailure.d.ts.map +1 -0
- package/esm/asCode/useAsCodeLoadFailure.js +21 -0
- package/esm/asCode/useMutationPort.d.ts +4 -0
- package/esm/asCode/useMutationPort.d.ts.map +1 -0
- package/esm/asCode/useMutationPort.js +9 -0
- package/esm/asCode/validateYaml.d.ts +16 -12
- package/esm/asCode/validateYaml.d.ts.map +1 -1
- package/esm/asCode/validateYaml.js +8 -9
- package/esm/asCodeRegistry.d.ts +5 -14
- package/esm/asCodeRegistry.d.ts.map +1 -1
- package/esm/asCodeRegistry.js +29 -15
- package/esm/catalog/Catalog.d.ts.map +1 -1
- package/esm/catalog/Catalog.js +2 -8
- package/esm/catalogDetail/CatalogDetailActionBar.d.ts.map +1 -1
- package/esm/catalogDetail/CatalogDetailActionBar.js +4 -8
- package/esm/catalogDetail/CatalogDetailActions.d.ts.map +1 -1
- package/esm/catalogDetail/CatalogDetailActions.js +2 -6
- package/esm/catalogDetail/openHandlerEvent.d.ts +6 -0
- package/esm/catalogDetail/openHandlerEvent.d.ts.map +1 -0
- package/esm/catalogDetail/openHandlerEvent.js +10 -0
- package/esm/header/CreateObjectButton.d.ts +1 -3
- package/esm/header/CreateObjectButton.d.ts.map +1 -1
- package/esm/header/CreateObjectButton.js +10 -22
- package/esm/index.d.ts +2 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +5 -0
- package/esm/insight/gate.d.ts +4 -0
- package/esm/insight/gate.d.ts.map +1 -0
- package/esm/insight/gate.js +4 -0
- package/esm/insight/insightCodecContext.d.ts +22 -0
- package/esm/insight/insightCodecContext.d.ts.map +1 -0
- package/esm/insight/insightCodecContext.js +30 -0
- package/esm/insight/insightCopy.d.ts +4 -0
- package/esm/insight/insightCopy.d.ts.map +1 -0
- package/esm/insight/insightCopy.js +25 -0
- package/esm/insight/insightDescriptor.d.ts +7 -0
- package/esm/insight/insightDescriptor.d.ts.map +1 -0
- package/esm/insight/insightDescriptor.js +69 -0
- package/esm/insight/insightMutationPort.d.ts +13 -0
- package/esm/insight/insightMutationPort.d.ts.map +1 -0
- package/esm/insight/insightMutationPort.js +59 -0
- package/esm/localization/bundles/en-US.localization-bundle.d.ts +72 -0
- package/esm/localization/bundles/en-US.localization-bundle.d.ts.map +1 -1
- package/esm/localization/bundles/en-US.localization-bundle.js +72 -0
- package/esm/metric/gate.d.ts +1 -6
- package/esm/metric/gate.d.ts.map +1 -1
- package/esm/metric/gate.js +1 -9
- package/esm/metric/metricConverter.d.ts +8 -17
- package/esm/metric/metricConverter.d.ts.map +1 -1
- package/esm/metric/metricConverter.js +10 -24
- package/esm/metric/metricDescriptor.d.ts.map +1 -1
- package/esm/metric/metricDescriptor.js +19 -8
- package/esm/metric/metricMutationPort.d.ts +5 -3
- package/esm/metric/metricMutationPort.d.ts.map +1 -1
- package/esm/metric/metricMutationPort.js +21 -14
- package/esm/metric/metricValidation.d.ts.map +1 -1
- package/esm/metric/metricValidation.js +7 -4
- package/esm/metric/tests/metricMutationPort.test.utils.d.ts +1 -4
- package/esm/metric/tests/metricMutationPort.test.utils.d.ts.map +1 -1
- package/esm/metric/tests/metricMutationPort.test.utils.js +1 -19
- package/esm/parameter/gate.d.ts +1 -5
- package/esm/parameter/gate.d.ts.map +1 -1
- package/esm/parameter/gate.js +1 -8
- package/esm/parameter/parameterDescriptor.d.ts.map +1 -1
- package/esm/parameter/parameterDescriptor.js +22 -13
- package/esm/parameter/parameterValidation.d.ts.map +1 -1
- package/esm/parameter/parameterValidation.js +11 -23
- package/esm/sdk-ui-catalog.d.ts +49 -0
- package/package.json +15 -15
- package/esm/asCode/AsCodeMutationContext.d.ts +0 -24
- package/esm/asCode/AsCodeMutationContext.d.ts.map +0 -1
- package/esm/asCode/AsCodeMutationContext.js +0 -40
- package/esm/asCode/gate.d.ts +0 -7
- package/esm/asCode/gate.d.ts.map +0 -1
- package/esm/asCode/gate.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameterValidation.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterValidation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parameterValidation.d.ts","sourceRoot":"","sources":["../../src/parameter/parameterValidation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIzD,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,sBAAsB,CAAC;AAElF,MAAM,MAAM,yBAAyB,GAC/B;IACI,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,eAAe,CAAC;CAC9B,GACD;IACI,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,4BAA4B,CAAC;IACxC,IAAI,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAER,MAAM,MAAM,4BAA4B,GAClC,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,aAAa,GACb,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,CAAC;AAEpB,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,CAY3B"}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import {
|
|
2
|
+
import { validateYaml } from "../asCode/validateYaml.js";
|
|
3
3
|
import { buildParameterSchema } from "./parameterSchema.js";
|
|
4
4
|
export function validateParameterYaml(value, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const result = buildParameterSchema(options.enabledTypes).safeParse(parsed);
|
|
16
|
-
if (!result.success) {
|
|
17
|
-
return classifySchemaError(result.error, readDeclaredType(parsed));
|
|
18
|
-
}
|
|
19
|
-
if (options.fixedIdentifier !== undefined && result.data.id !== options.fixedIdentifier) {
|
|
20
|
-
return invalid("idImmutable");
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
isValid: true,
|
|
24
|
-
parameter: result.data,
|
|
25
|
-
};
|
|
5
|
+
const result = validateYaml(value, {
|
|
6
|
+
schema: buildParameterSchema(options.enabledTypes),
|
|
7
|
+
fixedIdentifier: options.fixedIdentifier,
|
|
8
|
+
});
|
|
9
|
+
if (result.ok) {
|
|
10
|
+
return { isValid: true, parameter: result.data };
|
|
11
|
+
}
|
|
12
|
+
return result.kind === "schema"
|
|
13
|
+
? classifySchemaError(result.error, readDeclaredType(result.parsed))
|
|
14
|
+
: invalid(result.kind);
|
|
26
15
|
}
|
|
27
16
|
function classifySchemaError(error, declaredType) {
|
|
28
17
|
for (const issue of error.issues) {
|
|
@@ -47,7 +36,6 @@ function classifySchemaError(error, declaredType) {
|
|
|
47
36
|
}
|
|
48
37
|
return invalid("invalidStructure");
|
|
49
38
|
}
|
|
50
|
-
/** The declared `definition.type`, when it names a known model type; drives the type-specific error copy. */
|
|
51
39
|
function readDeclaredType(parsed) {
|
|
52
40
|
if (!parsed || typeof parsed !== "object") {
|
|
53
41
|
return undefined;
|
package/esm/sdk-ui-catalog.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { CertificationStatus } from '@gooddata/sdk-model';
|
|
2
|
+
import type { CompletionSource } from '@codemirror/autocomplete';
|
|
2
3
|
import type { IAnalyticalBackend } from '@gooddata/sdk-backend-spi';
|
|
3
4
|
import type { IDataSetMetadataObject } from '@gooddata/sdk-model';
|
|
4
5
|
import type { IdentifierRef } from '@gooddata/sdk-model';
|
|
6
|
+
import type { IInsightDefinition } from '@gooddata/sdk-model';
|
|
5
7
|
import type { IParameterDefinition } from '@gooddata/sdk-model';
|
|
6
8
|
import { JSX } from 'react/jsx-runtime';
|
|
7
9
|
import type { MetricType } from '@gooddata/sdk-model';
|
|
8
10
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
9
11
|
import type { ObjectType as ObjectType_2 } from '@gooddata/sdk-model';
|
|
12
|
+
import { PropsWithChildren } from 'react';
|
|
10
13
|
import { ReactNode } from 'react';
|
|
11
14
|
|
|
12
15
|
/**
|
|
@@ -32,6 +35,29 @@ export declare function AnalyticsCatalogDetailContent({ backend, workspace, loca
|
|
|
32
35
|
*/
|
|
33
36
|
export declare function AnalyticsCatalogFilter<T>(props: IAnalyticsCatalogFilterProps<T>): JSX.Element;
|
|
34
37
|
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare type AsCodeValidation<TDef> = {
|
|
40
|
+
isValid: true;
|
|
41
|
+
definition: TDef;
|
|
42
|
+
} | {
|
|
43
|
+
isValid: false;
|
|
44
|
+
error: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Identity rule per flow: `edit` keeps `fixedIdentifier`; `duplicate` accepts and ignores any id (the
|
|
49
|
+
* copy re-derives identity downstream); `create` applies the entity's own id policy.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare type AsCodeValidationContext = {
|
|
53
|
+
intent: "create";
|
|
54
|
+
} | {
|
|
55
|
+
intent: "edit";
|
|
56
|
+
fixedIdentifier: string;
|
|
57
|
+
} | {
|
|
58
|
+
intent: "duplicate";
|
|
59
|
+
};
|
|
60
|
+
|
|
35
61
|
/**
|
|
36
62
|
* Represents the object types that can be created from the Analytics Catalog.
|
|
37
63
|
*
|
|
@@ -193,6 +219,16 @@ export declare interface IAnalyticsCatalogProps {
|
|
|
193
219
|
onCreateObject?: (objectType: CatalogCreateObjectType) => void;
|
|
194
220
|
}
|
|
195
221
|
|
|
222
|
+
/** @internal */
|
|
223
|
+
export declare interface IAsCodeEditing<TDef> {
|
|
224
|
+
completionSource: CompletionSource;
|
|
225
|
+
syntaxErrorMessage: string;
|
|
226
|
+
serialize(definition: TDef): string;
|
|
227
|
+
validate(value: string, context: AsCodeValidationContext): AsCodeValidation<TDef>;
|
|
228
|
+
/** Re-adds content the YAML can't express; applied on every persisting path. Omit if lossless. */
|
|
229
|
+
reconcile?(base: TDef, edited: TDef): TDef;
|
|
230
|
+
}
|
|
231
|
+
|
|
196
232
|
/**
|
|
197
233
|
* @public
|
|
198
234
|
*/
|
|
@@ -369,6 +405,16 @@ export declare interface ICatalogItemRef extends IdentifierRef {
|
|
|
369
405
|
type: ObjectType;
|
|
370
406
|
}
|
|
371
407
|
|
|
408
|
+
/** @internal */
|
|
409
|
+
export declare type IInsightCodec = IAsCodeEditing<IInsightDefinition>;
|
|
410
|
+
|
|
411
|
+
/** Injects the host-built visualization codec, keeping this package free of the Tiger-coupled convertors. @internal */
|
|
412
|
+
export declare function InsightCodecProvider({ codec, requestLoad, isVisualizationTypeEditable, children }: PropsWithChildren<{
|
|
413
|
+
codec?: IInsightCodec;
|
|
414
|
+
requestLoad: () => Promise<void>;
|
|
415
|
+
isVisualizationTypeEditable?: VisualizationTypePredicate;
|
|
416
|
+
}>): JSX.Element;
|
|
417
|
+
|
|
372
418
|
/**
|
|
373
419
|
* @internal
|
|
374
420
|
*/
|
|
@@ -439,4 +485,7 @@ export declare type OpenHandlerEvent = {
|
|
|
439
485
|
*/
|
|
440
486
|
export declare type VisualizationType = "scatter" | "donut" | "area" | "table" | "headline" | "column" | "line" | "treemap" | "pyramid" | "funnel" | "heatmap" | "bubble" | "pie" | "bar" | "combo" | "bullet" | "waterfall" | "dependencywheel" | "sankey" | "pushpin" | "repeater";
|
|
441
487
|
|
|
488
|
+
/** @internal */
|
|
489
|
+
export declare type VisualizationTypePredicate = (visualizationType: string) => boolean;
|
|
490
|
+
|
|
442
491
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-catalog",
|
|
3
|
-
"version": "11.50.0-alpha.
|
|
3
|
+
"version": "11.50.0-alpha.4",
|
|
4
4
|
"description": "GoodData SDK - Analytics Catalog",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"tslib": "2.8.1",
|
|
42
42
|
"yaml": "2.8.3",
|
|
43
43
|
"zod": "4.3.6",
|
|
44
|
-
"@gooddata/sdk-backend-spi": "11.50.0-alpha.
|
|
45
|
-
"@gooddata/sdk-code-schemas": "11.50.0-alpha.
|
|
46
|
-
"@gooddata/sdk-model": "11.50.0-alpha.
|
|
47
|
-
"@gooddata/sdk-ui": "11.50.0-alpha.
|
|
48
|
-
"@gooddata/sdk-ui-ext": "11.50.0-alpha.
|
|
49
|
-
"@gooddata/sdk-ui-
|
|
50
|
-
"@gooddata/sdk-ui-
|
|
51
|
-
"@gooddata/
|
|
52
|
-
"@gooddata/
|
|
44
|
+
"@gooddata/sdk-backend-spi": "11.50.0-alpha.4",
|
|
45
|
+
"@gooddata/sdk-code-schemas": "11.50.0-alpha.4",
|
|
46
|
+
"@gooddata/sdk-model": "11.50.0-alpha.4",
|
|
47
|
+
"@gooddata/sdk-ui": "11.50.0-alpha.4",
|
|
48
|
+
"@gooddata/sdk-ui-ext": "11.50.0-alpha.4",
|
|
49
|
+
"@gooddata/sdk-ui-semantic-search": "11.50.0-alpha.4",
|
|
50
|
+
"@gooddata/sdk-ui-theme-provider": "11.50.0-alpha.4",
|
|
51
|
+
"@gooddata/sdk-ui-kit": "11.50.0-alpha.4",
|
|
52
|
+
"@gooddata/util": "11.50.0-alpha.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@microsoft/api-documenter": "^7.17.0",
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"typescript": "5.9.3",
|
|
90
90
|
"vitest": "4.1.8",
|
|
91
91
|
"vitest-dom": "0.1.1",
|
|
92
|
-
"@gooddata/eslint-config": "11.50.0-alpha.
|
|
93
|
-
"@gooddata/i18n-toolkit": "11.50.0-alpha.
|
|
94
|
-
"@gooddata/oxlint-config": "11.50.0-alpha.
|
|
95
|
-
"@gooddata/
|
|
96
|
-
"@gooddata/
|
|
92
|
+
"@gooddata/eslint-config": "11.50.0-alpha.4",
|
|
93
|
+
"@gooddata/i18n-toolkit": "11.50.0-alpha.4",
|
|
94
|
+
"@gooddata/oxlint-config": "11.50.0-alpha.4",
|
|
95
|
+
"@gooddata/sdk-backend-mockingbird": "11.50.0-alpha.4",
|
|
96
|
+
"@gooddata/stylelint-config": "11.50.0-alpha.4"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type PropsWithChildren } from "react";
|
|
2
|
-
import type { ObjectType } from "../objectType/types.js";
|
|
3
|
-
import type { AsCodeObjectType, IAsCodeDescriptor, IAsCodeMutationPort } from "./descriptor.js";
|
|
4
|
-
type AsCodeMutations = Partial<Record<AsCodeObjectType, IAsCodeMutationPort>>;
|
|
5
|
-
type ProviderProps = PropsWithChildren<{
|
|
6
|
-
/** Descriptors for each as-code capable object type; used to build adapters. */
|
|
7
|
-
descriptors?: Record<AsCodeObjectType, IAsCodeDescriptor>;
|
|
8
|
-
/** Per-type port overrides for tests. */
|
|
9
|
-
ports?: AsCodeMutations;
|
|
10
|
-
}>;
|
|
11
|
-
/**
|
|
12
|
-
* Builds and provides one mutation port per supplied descriptor. Must be placed inside `BackendProvider`
|
|
13
|
-
* and `WorkspaceProvider`.
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare function AsCodeMutationProvider({ children, descriptors, ports }: ProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
/**
|
|
18
|
-
* The mutation port for one as-code type. Throws for a non-as-code type (a caller should only reach
|
|
19
|
-
* this via a resolved descriptor) or when the provider is missing.
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export declare function useAsCodePort(type: ObjectType): IAsCodeMutationPort;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=AsCodeMutationContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsCodeMutationContext.d.ts","sourceRoot":"","sources":["../../src/asCode/AsCodeMutationContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAsC,MAAM,OAAO,CAAC;AAInF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEhG,KAAK,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAI9E,KAAK,aAAa,GAAG,iBAAiB,CAAC;IACnC,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC1D,yCAAyC;IACzC,KAAK,CAAC,EAAE,eAAe,CAAC;CAC3B,CAAC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,aAAa,2CAerF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,mBAAmB,CAUnE"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// (C) 2026 GoodData Corporation
|
|
3
|
-
import { createContext, useContext, useMemo } from "react";
|
|
4
|
-
import { useBackendStrict, useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
5
|
-
const AsCodeMutationContext = createContext(null);
|
|
6
|
-
/**
|
|
7
|
-
* Builds and provides one mutation port per supplied descriptor. Must be placed inside `BackendProvider`
|
|
8
|
-
* and `WorkspaceProvider`.
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export function AsCodeMutationProvider({ children, descriptors, ports }) {
|
|
12
|
-
const backend = useBackendStrict();
|
|
13
|
-
const workspace = useWorkspaceStrict();
|
|
14
|
-
const mutations = useMemo(() => {
|
|
15
|
-
const built = {};
|
|
16
|
-
// Object.entries widens the key to string; the map's own type guarantees it is an AsCodeObjectType.
|
|
17
|
-
const entries = Object.entries(descriptors ?? {});
|
|
18
|
-
for (const [type, descriptor] of entries) {
|
|
19
|
-
built[type] = descriptor.createMutationPort(backend, workspace);
|
|
20
|
-
}
|
|
21
|
-
return { ...built, ...ports };
|
|
22
|
-
}, [backend, workspace, descriptors, ports]);
|
|
23
|
-
return _jsx(AsCodeMutationContext.Provider, { value: mutations, children: children });
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The mutation port for one as-code type. Throws for a non-as-code type (a caller should only reach
|
|
27
|
-
* this via a resolved descriptor) or when the provider is missing.
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
export function useAsCodePort(type) {
|
|
31
|
-
const mutations = useContext(AsCodeMutationContext);
|
|
32
|
-
if (!mutations) {
|
|
33
|
-
throw new Error("useAsCodePort must be used within AsCodeMutationProvider");
|
|
34
|
-
}
|
|
35
|
-
const port = mutations[type];
|
|
36
|
-
if (!port) {
|
|
37
|
-
throw new Error(`No as-code mutation port is registered for object type "${type}".`);
|
|
38
|
-
}
|
|
39
|
-
return port;
|
|
40
|
-
}
|
package/esm/asCode/gate.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useFeatureFlag } from "../permission/PermissionsContext.js";
|
|
2
|
-
/**
|
|
3
|
-
* Whether the current user can manage a catalog as-code object of a type gated by `featureFlag`:
|
|
4
|
-
* the feature flag is on and the user can manage the workspace.
|
|
5
|
-
*/
|
|
6
|
-
export declare function useCanManageAsCode(featureFlag: Parameters<typeof useFeatureFlag>[0]): boolean;
|
|
7
|
-
//# sourceMappingURL=gate.d.ts.map
|
package/esm/asCode/gate.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/asCode/gate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAA0B,MAAM,qCAAqC,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAI7F"}
|
package/esm/asCode/gate.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// (C) 2026 GoodData Corporation
|
|
2
|
-
import { useFeatureFlag, useWorkspacePermission } from "../permission/PermissionsContext.js";
|
|
3
|
-
/**
|
|
4
|
-
* Whether the current user can manage a catalog as-code object of a type gated by `featureFlag`:
|
|
5
|
-
* the feature flag is on and the user can manage the workspace.
|
|
6
|
-
*/
|
|
7
|
-
export function useCanManageAsCode(featureFlag) {
|
|
8
|
-
const isEnabled = useFeatureFlag(featureFlag);
|
|
9
|
-
const canManageProject = useWorkspacePermission("canManageProject");
|
|
10
|
-
return isEnabled && canManageProject;
|
|
11
|
-
}
|