@gooddata/sdk-code-convertors 11.64.0-alpha.4 → 11.64.0
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/declarativePublisherTypesV2.d.ts +21 -11
- package/esm/declarativePublisherTypesV2.d.ts.map +1 -1
- package/esm/fillPublisherIdsV2.d.ts +11 -0
- package/esm/fillPublisherIdsV2.d.ts.map +1 -1
- package/esm/fillPublisherIdsV2.js +19 -2
- package/esm/from/declarativePublisherEntityToYamlV2.d.ts.map +1 -1
- package/esm/index.d.ts +4 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -1
- package/esm/schemas/types.d.ts +6 -0
- package/esm/schemas/types.d.ts.map +1 -1
- package/esm/sdk-code-convertors.d.ts +63 -11
- package/esm/to/publisherIssueToCodeV2.d.ts +14 -0
- package/esm/to/publisherIssueToCodeV2.d.ts.map +1 -0
- package/esm/to/publisherIssueToCodeV2.js +92 -0
- package/esm/to/yamlPublisherEntityToDeclarativeV2.d.ts.map +1 -1
- package/esm/to/yamlPublisherEntityToDeclarativeV2.js +3 -6
- package/esm/utils/keyCase.d.ts +2 -0
- package/esm/utils/keyCase.d.ts.map +1 -1
- package/esm/utils/keyCase.js +6 -2
- package/esm/validateDeclarativePublisherEntityV2.d.ts +13 -1
- package/esm/validateDeclarativePublisherEntityV2.d.ts.map +1 -1
- package/esm/validateDeclarativePublisherEntityV2.js +131 -17
- package/package.json +6 -6
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type DeclarativePublisherDocument, type DeclarativePublisherDocumentPageTemplate, type DeclarativePublisherDocumentTemplate } from "@gooddata/api-client-tiger";
|
|
2
|
+
import { type IPublisherPageBodyV2, type PublisherContentVersionV2, type PublisherDocumentContentV2 } from "@gooddata/sdk-model";
|
|
2
3
|
/**
|
|
3
|
-
* A document as the declarative API stores it
|
|
4
|
+
* A v2 document as the declarative API stores it, with typed version and content.
|
|
4
5
|
*
|
|
5
6
|
* @alpha
|
|
6
7
|
*/
|
|
7
|
-
export type DeclarativePublisherDocumentV2 = Omit<
|
|
8
|
-
|
|
8
|
+
export type DeclarativePublisherDocumentV2 = Omit<DeclarativePublisherDocument, "content" | "version"> & {
|
|
9
|
+
version: PublisherContentVersionV2;
|
|
10
|
+
content: PublisherDocumentContentV2;
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
11
|
-
* A document template as the declarative API stores it.
|
|
13
|
+
* A v2 document template as the declarative API stores it, with typed version and content.
|
|
12
14
|
*
|
|
13
15
|
* @alpha
|
|
14
16
|
*/
|
|
15
|
-
export type DeclarativePublisherDocumentTemplateV2 = Omit<
|
|
16
|
-
|
|
17
|
+
export type DeclarativePublisherDocumentTemplateV2 = Omit<DeclarativePublisherDocumentTemplate, "content" | "version"> & {
|
|
18
|
+
version: PublisherContentVersionV2;
|
|
19
|
+
content: PublisherDocumentContentV2;
|
|
17
20
|
};
|
|
18
21
|
/**
|
|
19
|
-
* A page template as the declarative API stores it
|
|
20
|
-
* part of the declarative layout.
|
|
22
|
+
* A v2 page template as the declarative API stores it, with typed version and content.
|
|
21
23
|
*
|
|
22
24
|
* @alpha
|
|
23
25
|
*/
|
|
24
|
-
export type DeclarativePublisherPageTemplateV2 = Omit<
|
|
25
|
-
|
|
26
|
+
export type DeclarativePublisherPageTemplateV2 = Omit<DeclarativePublisherDocumentPageTemplate, "content" | "version"> & {
|
|
27
|
+
version: PublisherContentVersionV2;
|
|
28
|
+
content: IPublisherPageBodyV2;
|
|
26
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* The kind of a stored v2 Publisher entity. The declarative API stores no `type` key, so the kind is
|
|
32
|
+
* passed next to the entity.
|
|
33
|
+
*
|
|
34
|
+
* @alpha
|
|
35
|
+
*/
|
|
36
|
+
export type DeclarativePublisherEntityKindV2 = "document" | "documentTemplate" | "pageTemplate";
|
|
27
37
|
//# sourceMappingURL=declarativePublisherTypesV2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarativePublisherTypesV2.d.ts","sourceRoot":"","sources":["../src/declarativePublisherTypesV2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarativePublisherTypesV2.d.ts","sourceRoot":"","sources":["../src/declarativePublisherTypesV2.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,4BAA4B,EACjC,KAAK,wCAAwC,EAC7C,KAAK,oCAAoC,EAC5C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAClC,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAAC,4BAA4B,EAAE,SAAS,GAAG,SAAS,CAAC,GAAG;IACrG,OAAO,EAAE,yBAAyB,CAAC;IACnC,OAAO,EAAE,0BAA0B,CAAC;CACvC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sCAAsC,GAAG,IAAI,CACrD,oCAAoC,EACpC,SAAS,GAAG,SAAS,CACxB,GAAG;IACA,OAAO,EAAE,yBAAyB,CAAC;IACnC,OAAO,EAAE,0BAA0B,CAAC;CACvC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,GAAG,IAAI,CACjD,wCAAwC,EACxC,SAAS,GAAG,SAAS,CACxB,GAAG;IACA,OAAO,EAAE,yBAAyB,CAAC;IACnC,OAAO,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAAG,UAAU,GAAG,kBAAkB,GAAG,cAAc,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AacPublisherEntityWithOptionalIdUnionV2 } from "./schemas/types.js";
|
|
1
2
|
/**
|
|
2
3
|
* Adds the section, page and widget ids a v2 document, document template or page template as code
|
|
3
4
|
* leaves out, so the YAML written by hand states the ids the stored entity keeps. An id counts as
|
|
@@ -13,4 +14,14 @@ export declare function fillPublisherIdsV2(content: string): {
|
|
|
13
14
|
content: string;
|
|
14
15
|
changed: boolean;
|
|
15
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* {@link fillPublisherIdsV2} for an entity already parsed: adds the same section, page and widget ids
|
|
19
|
+
* by the same rules, and returns a new entity. The entity passed in is not changed.
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export declare function fillPublisherIdsInEntityV2<T extends AacPublisherEntityWithOptionalIdUnionV2>(entity: T): {
|
|
24
|
+
entity: T;
|
|
25
|
+
changed: boolean;
|
|
26
|
+
};
|
|
16
27
|
//# sourceMappingURL=fillPublisherIdsV2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fillPublisherIdsV2.d.ts","sourceRoot":"","sources":["../src/fillPublisherIdsV2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fillPublisherIdsV2.d.ts","sourceRoot":"","sources":["../src/fillPublisherIdsV2.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,uCAAuC,EAAE,MAAM,oBAAoB,CAAC;AAoJlF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAezF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,uCAAuC,EACxF,MAAM,EAAE,CAAC,GACV;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAOjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import { LineCounter, Pair, Scalar, isMap, isScalar, isSeq, parseDocument, visit, } from "yaml";
|
|
2
|
+
import { Document, LineCounter, Pair, Scalar, isMap, isScalar, isSeq, parseDocument, visit, } from "yaml";
|
|
3
3
|
import { newPublisherPageIdV2, newPublisherSectionIdV2, newPublisherWidgetIdV2 } from "@gooddata/sdk-model";
|
|
4
4
|
function isKey(pair, key) {
|
|
5
5
|
return isScalar(pair.key) ? pair.key.value === key : pair.key === key;
|
|
@@ -59,6 +59,9 @@ function fillWidgetIds(layout) {
|
|
|
59
59
|
after: "type",
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
+
function fillEntityIds(entity) {
|
|
63
|
+
return isMap(entity) && fillContentIds(entity.get("type"), entity.get("content"));
|
|
64
|
+
}
|
|
62
65
|
function fillContentIds(type, content) {
|
|
63
66
|
if (!isMap(content)) {
|
|
64
67
|
return false;
|
|
@@ -137,7 +140,7 @@ export function fillPublisherIdsV2(content) {
|
|
|
137
140
|
if (document.errors.length > 0 || !isMap(document.contents)) {
|
|
138
141
|
return { content, changed: false };
|
|
139
142
|
}
|
|
140
|
-
if (!
|
|
143
|
+
if (!fillEntityIds(document.contents)) {
|
|
141
144
|
return { content, changed: false };
|
|
142
145
|
}
|
|
143
146
|
const written = document.toString({
|
|
@@ -147,3 +150,17 @@ export function fillPublisherIdsV2(content) {
|
|
|
147
150
|
});
|
|
148
151
|
return { content: usesCrlf(content) ? written.replace(/\n/g, "\r\n") : written, changed: true };
|
|
149
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* {@link fillPublisherIdsV2} for an entity already parsed: adds the same section, page and widget ids
|
|
155
|
+
* by the same rules, and returns a new entity. The entity passed in is not changed.
|
|
156
|
+
*
|
|
157
|
+
* @alpha
|
|
158
|
+
*/
|
|
159
|
+
export function fillPublisherIdsInEntityV2(entity) {
|
|
160
|
+
const document = new Document(entity, { aliasDuplicateObjects: false });
|
|
161
|
+
if (!fillEntityIds(document.contents)) {
|
|
162
|
+
return { entity, changed: false };
|
|
163
|
+
}
|
|
164
|
+
// Sound: the fill only adds or replaces id strings, so the entity keeps its shape.
|
|
165
|
+
return { entity: document.toJS(), changed: true };
|
|
166
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarativePublisherEntityToYamlV2.d.ts","sourceRoot":"","sources":["../../src/from/declarativePublisherEntityToYamlV2.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,KAAK,8BAA8B,EAEnC,KAAK,sCAAsC,EAE3C,KAAK,kCAAkC,EAO1C,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,KAAK,sCAAsC,EAC3C,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EAC1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"declarativePublisherEntityToYamlV2.d.ts","sourceRoot":"","sources":["../../src/from/declarativePublisherEntityToYamlV2.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,KAAK,8BAA8B,EAEnC,KAAK,sCAAsC,EAE3C,KAAK,kCAAkC,EAO1C,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,KAAK,sCAAsC,EAC3C,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EAC1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,oBAAoB,CAAC;AA0O5E;;;;GAIG;AACH,wBAAgB,oCAAoC,CAChD,QAAQ,EAAE,8BAA8B,EACxC,YAAY,CAAC,EAAE,aAAa,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,sBAAsB,CAAA;CAAE,CAGnD;AAED;;;;GAIG;AACH,wBAAgB,4CAA4C,CACxD,QAAQ,EAAE,sCAAsC,EAChD,YAAY,CAAC,EAAE,aAAa,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,8BAA8B,CAAA;CAAE,CAG3D;AAED;;;;GAIG;AACH,wBAAgB,wCAAwC,CACpD,QAAQ,EAAE,kCAAkC,EAC5C,YAAY,CAAC,EAAE,aAAa,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,0BAA0B,CAAA;CAAE,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAC/C,QAAQ,EAAE,8BAA8B,EACxC,YAAY,CAAC,EAAE,aAAa,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kCAAkC,CAAC,sBAAsB,CAAC,CAAA;CAAE,CAGvF;AAED,aAAa;AACb,wBAAgB,2CAA2C,CACvD,QAAQ,EAAE,sCAAsC,EAChD,YAAY,CAAC,EAAE,aAAa,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kCAAkC,CAAC,8BAA8B,CAAC,CAAA;CAAE,CAM/F;AAED,aAAa;AACb,wBAAgB,uCAAuC,CACnD,QAAQ,EAAE,kCAAkC,EAC5C,YAAY,CAAC,EAAE,aAAa,GAC7B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kCAAkC,CAAC,0BAA0B,CAAC,CAAA;CAAE,CAM3F"}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export type { AacAttributeHierarchy, AacComputedAttribute, AacDashboard, AacDashboardFilters, AacDataset, AacDateDataset, AacMetadata, AacMetric, AacParameter, AacPlugin, AacQuery, AacPublisherDocument, AacPublisherPageLayout, AacPublisherDocumentTemplate, AacPublisherDocumentV2, AacPublisherDocumentTemplateV2, AacPublisherPageTemplateV2, AacPublisherEntityWithOptionalIdV2, AacSection, AacVisualisation, AacFilter, } from "./schemas/types.js";
|
|
1
|
+
export type { AacAttributeHierarchy, AacComputedAttribute, AacDashboard, AacDashboardFilters, AacDataset, AacDateDataset, AacMetadata, AacMetric, AacParameter, AacPlugin, AacQuery, AacPublisherDocument, AacPublisherPageLayout, AacPublisherDocumentTemplate, AacPublisherDocumentV2, AacPublisherDocumentTemplateV2, AacPublisherPageTemplateV2, AacPublisherEntityWithOptionalIdV2, AacPublisherEntityWithOptionalIdUnionV2, AacSection, AacVisualisation, AacFilter, } from "./schemas/types.js";
|
|
2
2
|
export { type DeclarativeEntityData, type EntityData, type ExportEntities, type FromEntities, type Profile, type ToExecutionResults, type DashboardTab, BucketsType, } from "./types.js";
|
|
3
3
|
export { yamlPublisherDocumentToDeclarative, yamlPublisherPageLayoutToDeclarative, yamlPublisherPageLayoutToDefinition, yamlPublisherDocumentToDefinition, yamlPublisherDocumentTemplateToDefinition, } from "./to/yamlPublisherDocumentToDeclarative.js";
|
|
4
4
|
export { declarativePublisherPageLayoutToYaml, declarativePublisherDocumentToYaml, publisherDocumentDefinitionToYaml, publisherPageLayoutDefinitionToYaml, publisherDocumentPageToAacPage, publisherDocumentTemplateDefinitionToYaml, } from "./from/declarativePublisherDocumentToYaml.js";
|
|
5
5
|
export { yamlPublisherDocumentToDeclarativeV2, yamlPublisherDocumentTemplateToDeclarativeV2, yamlPublisherPageTemplateToDeclarativeV2, yamlPublisherDocumentToDefinitionV2, yamlPublisherDocumentTemplateToDefinitionV2, yamlPublisherPageTemplateToDefinitionV2, } from "./to/yamlPublisherEntityToDeclarativeV2.js";
|
|
6
|
+
export type { DeclarativePublisherDocumentV2, DeclarativePublisherDocumentTemplateV2, DeclarativePublisherPageTemplateV2, DeclarativePublisherEntityKindV2, } from "./declarativePublisherTypesV2.js";
|
|
6
7
|
export { declarativePublisherDocumentToYamlV2, declarativePublisherDocumentTemplateToYamlV2, declarativePublisherPageTemplateToYamlV2, publisherDocumentDefinitionToYamlV2, publisherDocumentTemplateDefinitionToYamlV2, publisherPageTemplateDefinitionToYamlV2, } from "./from/declarativePublisherEntityToYamlV2.js";
|
|
8
|
+
export { publisherIssueToCodeV2 } from "./to/publisherIssueToCodeV2.js";
|
|
7
9
|
export { validateDeclarativePublisherEntityV2 } from "./validateDeclarativePublisherEntityV2.js";
|
|
8
|
-
export { fillPublisherIdsV2 } from "./fillPublisherIdsV2.js";
|
|
9
|
-
export type { DeclarativePublisherDocumentV2, DeclarativePublisherDocumentTemplateV2, DeclarativePublisherPageTemplateV2, } from "./declarativePublisherTypesV2.js";
|
|
10
|
+
export { fillPublisherIdsV2, fillPublisherIdsInEntityV2 } from "./fillPublisherIdsV2.js";
|
|
10
11
|
export { yamlDatasetToDeclarative, buildAttributeLabels, buildAttributes, buildFacts, buildReferences, } from "./to/yamlDatasetToDeclarative.js";
|
|
11
12
|
export { yamlDateDatesetToDeclarative } from "./to/yamlDateDatasetToDeclarative.js";
|
|
12
13
|
export { yamlMetricToDeclarative } from "./to/yamlMetricToDeclarative.js";
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACR,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,oBAAoB,EACpB,sBAAsB,EACtB,4BAA4B,EAC5B,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,kCAAkC,EAClC,UAAU,EACV,gBAAgB,EAChB,SAAS,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,WAAW,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,kCAAkC,EAClC,oCAAoC,EACpC,mCAAmC,EACnC,iCAAiC,EACjC,yCAAyC,GAC5C,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACH,oCAAoC,EACpC,kCAAkC,EAClC,iCAAiC,EACjC,mCAAmC,EACnC,8BAA8B,EAC9B,yCAAyC,GAC5C,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACH,oCAAoC,EACpC,4CAA4C,EAC5C,wCAAwC,EACxC,mCAAmC,EACnC,2CAA2C,EAC3C,uCAAuC,GAC1C,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACH,oCAAoC,EACpC,4CAA4C,EAC5C,wCAAwC,EACxC,mCAAmC,EACnC,2CAA2C,EAC3C,uCAAuC,GAC1C,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACR,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,oBAAoB,EACpB,sBAAsB,EACtB,4BAA4B,EAC5B,sBAAsB,EACtB,8BAA8B,EAC9B,0BAA0B,EAC1B,kCAAkC,EAClC,uCAAuC,EACvC,UAAU,EACV,gBAAgB,EAChB,SAAS,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,WAAW,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,kCAAkC,EAClC,oCAAoC,EACpC,mCAAmC,EACnC,iCAAiC,EACjC,yCAAyC,GAC5C,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACH,oCAAoC,EACpC,kCAAkC,EAClC,iC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|
|
|
5
5
|
export { declarativePublisherPageLayoutToYaml, declarativePublisherDocumentToYaml, publisherDocumentDefinitionToYaml, publisherPageLayoutDefinitionToYaml, publisherDocumentPageToAacPage, publisherDocumentTemplateDefinitionToYaml, } from "./from/declarativePublisherDocumentToYaml.js";
|
|
6
6
|
export { yamlPublisherDocumentToDeclarativeV2, yamlPublisherDocumentTemplateToDeclarativeV2, yamlPublisherPageTemplateToDeclarativeV2, yamlPublisherDocumentToDefinitionV2, yamlPublisherDocumentTemplateToDefinitionV2, yamlPublisherPageTemplateToDefinitionV2, } from "./to/yamlPublisherEntityToDeclarativeV2.js";
|
|
7
7
|
export { declarativePublisherDocumentToYamlV2, declarativePublisherDocumentTemplateToYamlV2, declarativePublisherPageTemplateToYamlV2, publisherDocumentDefinitionToYamlV2, publisherDocumentTemplateDefinitionToYamlV2, publisherPageTemplateDefinitionToYamlV2, } from "./from/declarativePublisherEntityToYamlV2.js";
|
|
8
|
+
export { publisherIssueToCodeV2 } from "./to/publisherIssueToCodeV2.js";
|
|
8
9
|
export { validateDeclarativePublisherEntityV2 } from "./validateDeclarativePublisherEntityV2.js";
|
|
9
|
-
export { fillPublisherIdsV2 } from "./fillPublisherIdsV2.js";
|
|
10
|
+
export { fillPublisherIdsV2, fillPublisherIdsInEntityV2 } from "./fillPublisherIdsV2.js";
|
|
10
11
|
// Entity converters: YAML → Declarative API
|
|
11
12
|
export { yamlDatasetToDeclarative, buildAttributeLabels, buildAttributes, buildFacts, buildReferences, } from "./to/yamlDatasetToDeclarative.js";
|
|
12
13
|
export { yamlDateDatesetToDeclarative } from "./to/yamlDateDatasetToDeclarative.js";
|
package/esm/schemas/types.d.ts
CHANGED
|
@@ -48,6 +48,12 @@ export type AacPublisherEntityWithOptionalIdV2<T extends {
|
|
|
48
48
|
}> = Omit<T, "id"> & {
|
|
49
49
|
id?: string;
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* A v2 document, document template or page template as code, as its YAML parses: the id may be left out.
|
|
53
|
+
*
|
|
54
|
+
* @alpha
|
|
55
|
+
*/
|
|
56
|
+
export type AacPublisherEntityWithOptionalIdUnionV2 = AacPublisherEntityWithOptionalIdV2<AacPublisherDocumentV2> | AacPublisherEntityWithOptionalIdV2<AacPublisherDocumentTemplateV2> | AacPublisherEntityWithOptionalIdV2<AacPublisherPageTemplateV2>;
|
|
51
57
|
/** @public */
|
|
52
58
|
export type AacSection = Section;
|
|
53
59
|
/** @public */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schemas/types.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,MAAM,EACN,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,EACN,2BAA2B,EAC3B,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,EACL,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,aAAa,EAChB,MAAM,+BAA+B,CAAC;AAEvC,cAAc;AACd,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AACvD,cAAc;AACd,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AACrD,cAAc;AACd,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;AACrC,cAAc;AACd,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AACnD,cAAc;AACd,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;AACjC,cAAc;AACd,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AACzC,cAAc;AACd,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AACnC,cAAc;AACd,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,cAAc;AACd,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;AACrC,cAAc;AACd,MAAM,MAAM,SAAS,GAAG,MAAM,CAA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DeclarativeFilterContext } from '@gooddata/api-client-tiger';
|
|
|
26
26
|
import { DeclarativeLabel } from '@gooddata/api-client-tiger';
|
|
27
27
|
import { DeclarativeMetric } from '@gooddata/api-client-tiger';
|
|
28
28
|
import { DeclarativeParameter } from '@gooddata/api-client-tiger';
|
|
29
|
+
import { DeclarativePublisherDocument } from '@gooddata/api-client-tiger';
|
|
30
|
+
import { DeclarativePublisherDocumentPageTemplate } from '@gooddata/api-client-tiger';
|
|
31
|
+
import { DeclarativePublisherDocumentTemplate } from '@gooddata/api-client-tiger';
|
|
29
32
|
import { DeclarativeReference } from '@gooddata/api-client-tiger';
|
|
30
33
|
import { DeclarativeReport } from '@gooddata/api-client-tiger';
|
|
31
34
|
import { DeclarativeReportPageLayout } from '@gooddata/api-client-tiger';
|
|
@@ -76,6 +79,7 @@ import { IPublisherDocumentPageV1 } from '@gooddata/sdk-model';
|
|
|
76
79
|
import { IPublisherDocumentTemplateDefinitionV1 } from '@gooddata/sdk-model';
|
|
77
80
|
import { IPublisherDocumentTemplateDefinitionV2 } from '@gooddata/sdk-model';
|
|
78
81
|
import { IPublisherDocumentTemplateV1 } from '@gooddata/sdk-model';
|
|
82
|
+
import { IPublisherPageBodyV2 } from '@gooddata/sdk-model';
|
|
79
83
|
import { IPublisherPageTemplateDefinitionV1 } from '@gooddata/sdk-model';
|
|
80
84
|
import { IPublisherPageTemplateDefinitionV2 } from '@gooddata/sdk-model';
|
|
81
85
|
import { IPublisherPageTemplateV1 } from '@gooddata/sdk-model';
|
|
@@ -97,6 +101,8 @@ import type { Parameter } from '@gooddata/sdk-code-schemas/v1';
|
|
|
97
101
|
import type { Plugin as Plugin_2 } from '@gooddata/sdk-code-schemas/v1';
|
|
98
102
|
import type { PoPMetricField } from '@gooddata/sdk-code-schemas/v1';
|
|
99
103
|
import type { PreviousPeriodMetricField } from '@gooddata/sdk-code-schemas/v1';
|
|
104
|
+
import { PublisherContentVersionV2 } from '@gooddata/sdk-model';
|
|
105
|
+
import { PublisherDocumentContentV2 } from '@gooddata/sdk-model';
|
|
100
106
|
import type { PublisherDocumentTemplateV2 } from '@gooddata/sdk-code-schemas/v1';
|
|
101
107
|
import type { PublisherDocumentV2 } from '@gooddata/sdk-code-schemas/v1';
|
|
102
108
|
import type { PublisherPageTemplateV2 } from '@gooddata/sdk-code-schemas/v1';
|
|
@@ -165,6 +171,13 @@ export declare type AacPublisherDocumentTemplateV2 = PublisherDocumentTemplateV2
|
|
|
165
171
|
/** @alpha */
|
|
166
172
|
export declare type AacPublisherDocumentV2 = PublisherDocumentV2;
|
|
167
173
|
|
|
174
|
+
/**
|
|
175
|
+
* A v2 document, document template or page template as code, as its YAML parses: the id may be left out.
|
|
176
|
+
*
|
|
177
|
+
* @alpha
|
|
178
|
+
*/
|
|
179
|
+
export declare type AacPublisherEntityWithOptionalIdUnionV2 = AacPublisherEntityWithOptionalIdV2<AacPublisherDocumentV2> | AacPublisherEntityWithOptionalIdV2<AacPublisherDocumentTemplateV2> | AacPublisherEntityWithOptionalIdV2<AacPublisherPageTemplateV2>;
|
|
180
|
+
|
|
168
181
|
/**
|
|
169
182
|
* A v2 Publisher entity as code written before the entity has an id.
|
|
170
183
|
*
|
|
@@ -1535,12 +1548,13 @@ export declare function declarativePublisherDocumentTemplateToYamlV2(template: D
|
|
|
1535
1548
|
};
|
|
1536
1549
|
|
|
1537
1550
|
/**
|
|
1538
|
-
* A document template as the declarative API stores it.
|
|
1551
|
+
* A v2 document template as the declarative API stores it, with typed version and content.
|
|
1539
1552
|
*
|
|
1540
1553
|
* @alpha
|
|
1541
1554
|
*/
|
|
1542
|
-
export declare type DeclarativePublisherDocumentTemplateV2 = Omit<
|
|
1543
|
-
|
|
1555
|
+
export declare type DeclarativePublisherDocumentTemplateV2 = Omit<DeclarativePublisherDocumentTemplate, "content" | "version"> & {
|
|
1556
|
+
version: PublisherContentVersionV2;
|
|
1557
|
+
content: PublisherDocumentContentV2;
|
|
1544
1558
|
};
|
|
1545
1559
|
|
|
1546
1560
|
/** @alpha */
|
|
@@ -1560,14 +1574,23 @@ export declare function declarativePublisherDocumentToYamlV2(document: Declarati
|
|
|
1560
1574
|
};
|
|
1561
1575
|
|
|
1562
1576
|
/**
|
|
1563
|
-
* A document as the declarative API stores it
|
|
1577
|
+
* A v2 document as the declarative API stores it, with typed version and content.
|
|
1564
1578
|
*
|
|
1565
1579
|
* @alpha
|
|
1566
1580
|
*/
|
|
1567
|
-
export declare type DeclarativePublisherDocumentV2 = Omit<
|
|
1568
|
-
|
|
1581
|
+
export declare type DeclarativePublisherDocumentV2 = Omit<DeclarativePublisherDocument, "content" | "version"> & {
|
|
1582
|
+
version: PublisherContentVersionV2;
|
|
1583
|
+
content: PublisherDocumentContentV2;
|
|
1569
1584
|
};
|
|
1570
1585
|
|
|
1586
|
+
/**
|
|
1587
|
+
* The kind of a stored v2 Publisher entity. The declarative API stores no `type` key, so the kind is
|
|
1588
|
+
* passed next to the entity.
|
|
1589
|
+
*
|
|
1590
|
+
* @alpha
|
|
1591
|
+
*/
|
|
1592
|
+
export declare type DeclarativePublisherEntityKindV2 = "document" | "documentTemplate" | "pageTemplate";
|
|
1593
|
+
|
|
1571
1594
|
/** @alpha */
|
|
1572
1595
|
export declare function declarativePublisherPageLayoutToYaml(layout: DeclarativeReportPageLayout): {
|
|
1573
1596
|
content: string;
|
|
@@ -1585,13 +1608,13 @@ export declare function declarativePublisherPageTemplateToYamlV2(template: Decla
|
|
|
1585
1608
|
};
|
|
1586
1609
|
|
|
1587
1610
|
/**
|
|
1588
|
-
* A page template as the declarative API stores it
|
|
1589
|
-
* part of the declarative layout.
|
|
1611
|
+
* A v2 page template as the declarative API stores it, with typed version and content.
|
|
1590
1612
|
*
|
|
1591
1613
|
* @alpha
|
|
1592
1614
|
*/
|
|
1593
|
-
export declare type DeclarativePublisherPageTemplateV2 = Omit<
|
|
1594
|
-
|
|
1615
|
+
export declare type DeclarativePublisherPageTemplateV2 = Omit<DeclarativePublisherDocumentPageTemplate, "content" | "version"> & {
|
|
1616
|
+
version: PublisherContentVersionV2;
|
|
1617
|
+
content: IPublisherPageBodyV2;
|
|
1595
1618
|
};
|
|
1596
1619
|
|
|
1597
1620
|
/** @internal */
|
|
@@ -1860,6 +1883,17 @@ export declare type FileNamesUsed = {
|
|
|
1860
1883
|
/** @public */
|
|
1861
1884
|
export declare type FilePath = string[] | string;
|
|
1862
1885
|
|
|
1886
|
+
/**
|
|
1887
|
+
* {@link fillPublisherIdsV2} for an entity already parsed: adds the same section, page and widget ids
|
|
1888
|
+
* by the same rules, and returns a new entity. The entity passed in is not changed.
|
|
1889
|
+
*
|
|
1890
|
+
* @alpha
|
|
1891
|
+
*/
|
|
1892
|
+
export declare function fillPublisherIdsInEntityV2<T extends AacPublisherEntityWithOptionalIdUnionV2>(entity: T): {
|
|
1893
|
+
entity: T;
|
|
1894
|
+
changed: boolean;
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1863
1897
|
/**
|
|
1864
1898
|
* Adds the section, page and widget ids a v2 document, document template or page template as code
|
|
1865
1899
|
* leaves out, so the YAML written by hand states the ids the stored entity keeps. An id counts as
|
|
@@ -3278,6 +3312,19 @@ export declare function publisherDocumentTemplateDefinitionToYamlV2(template: IP
|
|
|
3278
3312
|
json: AacPublisherEntityWithOptionalIdV2<AacPublisherDocumentTemplateV2>;
|
|
3279
3313
|
};
|
|
3280
3314
|
|
|
3315
|
+
/**
|
|
3316
|
+
* Names the place in the code that a v2 Publisher validation issue is about. The validator reports on
|
|
3317
|
+
* the converted entity, whose keys the code-to-entity converters rename; pass the entity it checked.
|
|
3318
|
+
*
|
|
3319
|
+
* @remarks
|
|
3320
|
+
* Filters are a list in the entity and a map keyed by filter id in the code, and the code has no
|
|
3321
|
+
* attribute filter configs of its own, so an issue inside either is reported on the filter's key under
|
|
3322
|
+
* `filters`. A message quoting a renamed key, such as an unknown key, quotes it as the code writes it.
|
|
3323
|
+
*
|
|
3324
|
+
* @alpha
|
|
3325
|
+
*/
|
|
3326
|
+
export declare function publisherIssueToCodeV2(issue: IPublisherValidationIssueV2, entity: unknown): IPublisherValidationIssueV2;
|
|
3327
|
+
|
|
3281
3328
|
/**
|
|
3282
3329
|
* A reusable page. Its body is written at the top level, because the object it is already names it -
|
|
3283
3330
|
* a page written into a document names itself instead.
|
|
@@ -4262,9 +4309,14 @@ export declare function treemapChartSave(_fields: Visualisation["query"]["fields
|
|
|
4262
4309
|
* declarative API stores. It runs the sdk-model validator, and an issue on the reference is reported
|
|
4263
4310
|
* on `id`.
|
|
4264
4311
|
*
|
|
4312
|
+
* @remarks
|
|
4313
|
+
* The declarative API stores no `type`, so the kind is passed next to the entity. Every key the
|
|
4314
|
+
* declarative API does not store for that kind is reported. An id starting with `default.` is
|
|
4315
|
+
* reported, except on a page template flagged `isDefault`: that is one of the backend's defaults.
|
|
4316
|
+
*
|
|
4265
4317
|
* @alpha
|
|
4266
4318
|
*/
|
|
4267
|
-
export declare function validateDeclarativePublisherEntityV2(entity: unknown): IPublisherValidationIssueV2[];
|
|
4319
|
+
export declare function validateDeclarativePublisherEntityV2(entity: unknown, kind: DeclarativePublisherEntityKindV2): IPublisherValidationIssueV2[];
|
|
4268
4320
|
|
|
4269
4321
|
/** @public */
|
|
4270
4322
|
export declare type ValueType = "string" | "bool" | "number" | "bool_auto" | "array";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type IPublisherValidationIssueV2 } from "@gooddata/sdk-model";
|
|
2
|
+
/**
|
|
3
|
+
* Names the place in the code that a v2 Publisher validation issue is about. The validator reports on
|
|
4
|
+
* the converted entity, whose keys the code-to-entity converters rename; pass the entity it checked.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Filters are a list in the entity and a map keyed by filter id in the code, and the code has no
|
|
8
|
+
* attribute filter configs of its own, so an issue inside either is reported on the filter's key under
|
|
9
|
+
* `filters`. A message quoting a renamed key, such as an unknown key, quotes it as the code writes it.
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export declare function publisherIssueToCodeV2(issue: IPublisherValidationIssueV2, entity: unknown): IPublisherValidationIssueV2;
|
|
14
|
+
//# sourceMappingURL=publisherIssueToCodeV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisherIssueToCodeV2.d.ts","sourceRoot":"","sources":["../../src/to/publisherIssueToCodeV2.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAiGvE;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,2BAA2B,EAClC,MAAM,EAAE,OAAO,GAChB,2BAA2B,CAS7B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { snakeKey } from "../utils/keyCase.js";
|
|
3
|
+
function pathSegments(path) {
|
|
4
|
+
return Array.from(path.matchAll(/([^.[\]]+)|\[(\d+)\]/g), ([, key, index]) => index === undefined ? (key ?? "") : Number(index));
|
|
5
|
+
}
|
|
6
|
+
function joinPathSegments(segments) {
|
|
7
|
+
return segments.reduce((path, segment) => {
|
|
8
|
+
if (typeof segment === "number") {
|
|
9
|
+
return `${path}[${segment}]`;
|
|
10
|
+
}
|
|
11
|
+
return path === "" ? segment : `${path}.${segment}`;
|
|
12
|
+
}, "");
|
|
13
|
+
}
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
function child(value, segment) {
|
|
18
|
+
if (typeof segment === "number") {
|
|
19
|
+
return Array.isArray(value) ? value[segment] : undefined;
|
|
20
|
+
}
|
|
21
|
+
return isRecord(value) ? value[segment] : undefined;
|
|
22
|
+
}
|
|
23
|
+
/** A stored filter is `{ <filter kind>: { localIdentifier } }`; an attribute filter config holds it directly. */
|
|
24
|
+
function localIdentifierOf(item) {
|
|
25
|
+
if (!isRecord(item)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const inner = typeof item["localIdentifier"] === "string" ? item : Object.values(item)[0];
|
|
29
|
+
return isRecord(inner) && typeof inner["localIdentifier"] === "string"
|
|
30
|
+
? inner["localIdentifier"]
|
|
31
|
+
: undefined;
|
|
32
|
+
}
|
|
33
|
+
const filterLists = new Set(["filters", "attributeFilterConfigs"]);
|
|
34
|
+
/** The whole code path, when the segment is one the code writes as a single key. */
|
|
35
|
+
function endingPath(segment, { code, stored, next }) {
|
|
36
|
+
if (segment === "visualization") {
|
|
37
|
+
return [...code, "visualization"];
|
|
38
|
+
}
|
|
39
|
+
if (segment === "dateDataSet") {
|
|
40
|
+
return [...code, "date"];
|
|
41
|
+
}
|
|
42
|
+
if (filterLists.has(segment)) {
|
|
43
|
+
const filter = typeof next === "number" ? localIdentifierOf(child(child(stored, segment), next)) : undefined;
|
|
44
|
+
return filter === undefined ? [...code, "filters"] : [...code, "filters", filter];
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
function codePath(segments, entity) {
|
|
49
|
+
const code = [];
|
|
50
|
+
let stored = entity;
|
|
51
|
+
for (const [index, segment] of segments.entries()) {
|
|
52
|
+
if (typeof segment === "number") {
|
|
53
|
+
code.push(segment);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
if (index === 0 && segment === "ref") {
|
|
57
|
+
return { path: ["id"] };
|
|
58
|
+
}
|
|
59
|
+
const ending = endingPath(segment, { code, stored, next: segments[index + 1] });
|
|
60
|
+
if (ending !== undefined) {
|
|
61
|
+
return { path: ending };
|
|
62
|
+
}
|
|
63
|
+
const codeKey = snakeKey(segment);
|
|
64
|
+
code.push(codeKey);
|
|
65
|
+
if (index === segments.length - 1 && codeKey !== segment) {
|
|
66
|
+
return { path: code, renamedKey: { stored: segment, code: codeKey } };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
stored = child(stored, segment);
|
|
70
|
+
}
|
|
71
|
+
return { path: code };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Names the place in the code that a v2 Publisher validation issue is about. The validator reports on
|
|
75
|
+
* the converted entity, whose keys the code-to-entity converters rename; pass the entity it checked.
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Filters are a list in the entity and a map keyed by filter id in the code, and the code has no
|
|
79
|
+
* attribute filter configs of its own, so an issue inside either is reported on the filter's key under
|
|
80
|
+
* `filters`. A message quoting a renamed key, such as an unknown key, quotes it as the code writes it.
|
|
81
|
+
*
|
|
82
|
+
* @alpha
|
|
83
|
+
*/
|
|
84
|
+
export function publisherIssueToCodeV2(issue, entity) {
|
|
85
|
+
const { path, renamedKey } = codePath(pathSegments(issue.path), entity);
|
|
86
|
+
return {
|
|
87
|
+
path: joinPathSegments(path),
|
|
88
|
+
message: renamedKey === undefined
|
|
89
|
+
? issue.message
|
|
90
|
+
: issue.message.replaceAll(`"${renamedKey.stored}"`, `"${renamedKey.code}"`),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yamlPublisherEntityToDeclarativeV2.d.ts","sourceRoot":"","sources":["../../src/to/yamlPublisherEntityToDeclarativeV2.ts"],"names":[],"mappings":"AAUA,OAAO,EAEH,KAAK,8BAA8B,EAEnC,KAAK,sCAAsC,EAE3C,KAAK,kCAAkC,EAO1C,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,KAAK,sCAAsC,EAC3C,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EAC1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAClC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAiB,KAAK,aAAa,EAAgC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"yamlPublisherEntityToDeclarativeV2.d.ts","sourceRoot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ity) {
|
|
|
121
121
|
function documentBody(input, errorContext) {
|
|
122
122
|
assertPublisherContentVersionV2(input, errorContext);
|
|
123
123
|
return {
|
|
124
|
-
type: "document",
|
|
125
124
|
...entityFields(input),
|
|
126
125
|
period: periodToDeclarativeV2(input.period),
|
|
127
126
|
content: contentToDeclarative(input.content, updateErrorContext(errorContext, { path: ["content"] })),
|
|
@@ -130,7 +129,6 @@ function documentBody(input, errorContext) {
|
|
|
130
129
|
function documentTemplateBody(input, errorContext) {
|
|
131
130
|
assertPublisherContentVersionV2(input, errorContext);
|
|
132
131
|
return {
|
|
133
|
-
type: "documentTemplate",
|
|
134
132
|
...entityFields(input),
|
|
135
133
|
content: contentToDeclarative(input.content, updateErrorContext(errorContext, { path: ["content"] })),
|
|
136
134
|
};
|
|
@@ -138,7 +136,6 @@ function documentTemplateBody(input, errorContext) {
|
|
|
138
136
|
function pageTemplateBody(input, errorContext) {
|
|
139
137
|
assertPublisherContentVersionV2(input, errorContext);
|
|
140
138
|
return {
|
|
141
|
-
type: "pageTemplate",
|
|
142
139
|
...entityFields(input),
|
|
143
140
|
content: pageBodyToDeclarative(input.content, updateErrorContext(errorContext, { path: ["content"] })),
|
|
144
141
|
};
|
|
@@ -178,13 +175,13 @@ export function yamlPublisherPageTemplateToDeclarativeV2(input, errorContext) {
|
|
|
178
175
|
* @alpha
|
|
179
176
|
*/
|
|
180
177
|
export function yamlPublisherDocumentToDefinitionV2(input, errorContext) {
|
|
181
|
-
return { ...documentBody(input, errorContext), ...refFromId(input.id) };
|
|
178
|
+
return { type: "document", ...documentBody(input, errorContext), ...refFromId(input.id) };
|
|
182
179
|
}
|
|
183
180
|
/** @alpha */
|
|
184
181
|
export function yamlPublisherDocumentTemplateToDefinitionV2(input, errorContext) {
|
|
185
|
-
return { ...documentTemplateBody(input, errorContext), ...refFromId(input.id) };
|
|
182
|
+
return { type: "documentTemplate", ...documentTemplateBody(input, errorContext), ...refFromId(input.id) };
|
|
186
183
|
}
|
|
187
184
|
/** @alpha */
|
|
188
185
|
export function yamlPublisherPageTemplateToDefinitionV2(input, errorContext) {
|
|
189
|
-
return { ...pageTemplateBody(input, errorContext), ...refFromId(input.id) };
|
|
186
|
+
return { type: "pageTemplate", ...pageTemplateBody(input, errorContext), ...refFromId(input.id) };
|
|
190
187
|
}
|
package/esm/utils/keyCase.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export type CamelKeys<T> = T extends readonly (infer Item)[] ? CamelKeys<Item>[]
|
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export declare function snakeKeys<T>(value: T): SnakeKeys<T>;
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare function snakeKey(key: string): string;
|
|
17
19
|
/**
|
|
18
20
|
* Every key of a plain JSON value, at any depth, in camelCase. Values are kept as they are.
|
|
19
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyCase.d.ts","sourceRoot":"","sources":["../../src/utils/keyCase.ts"],"names":[],"mappings":"AAEA,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,GACnE,GAAG,IAAI,SAAS,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,GAClF,CAAC,CAAC;AAER,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GACpE,GAAG,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,GACvC,CAAC,CAAC;AAER,gBAAgB;AAChB,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GACtD,SAAS,CAAC,IAAI,CAAC,EAAE,GACjB,CAAC,SAAS,MAAM,G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M,IAAI,CAAC,EAAE,GACtD,SAAS,CAAC,IAAI,CAAC,EAAE,GACjB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC1E,CAAC,CAAC;AAEV,gBAAgB;AAChB,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GACtD,SAAS,CAAC,IAAI,CAAC,EAAE,GACjB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC1E,CAAC,CAAC;AAcV;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAGnD;AAED,gBAAgB;AAChB,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAKnD"}
|
package/esm/utils/keyCase.js
CHANGED
|
@@ -14,8 +14,12 @@ function mapKeys(value, rename) {
|
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export function snakeKeys(value) {
|
|
17
|
-
// Sound only while
|
|
18
|
-
return mapKeys(value,
|
|
17
|
+
// Sound only while snakeKey renames exactly as the SnakeCase type does.
|
|
18
|
+
return mapKeys(value, snakeKey);
|
|
19
|
+
}
|
|
20
|
+
/** @internal */
|
|
21
|
+
export function snakeKey(key) {
|
|
22
|
+
return key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Every key of a plain JSON value, at any depth, in camelCase. Values are kept as they are.
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { type IPublisherValidationIssueV2 } from "@gooddata/sdk-model";
|
|
2
|
+
import { type DeclarativePublisherEntityKindV2 } from "./declarativePublisherTypesV2.js";
|
|
3
|
+
/**
|
|
4
|
+
* Without a kind, the kind is read from the entity's own `type` key, which is then the one key allowed
|
|
5
|
+
* beyond the stored ones; without either, one issue asks for the kind. The wasm build exposes this
|
|
6
|
+
* variant, so the Python `kind` argument stays optional.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateDeclarativePublisherEntityWithOptionalKindV2(entity: unknown, kind?: string): IPublisherValidationIssueV2[];
|
|
2
9
|
/**
|
|
3
10
|
* Validates a stored v2 document, document template or page template, named by the bare `id` the
|
|
4
11
|
* declarative API stores. It runs the sdk-model validator, and an issue on the reference is reported
|
|
5
12
|
* on `id`.
|
|
6
13
|
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* The declarative API stores no `type`, so the kind is passed next to the entity. Every key the
|
|
16
|
+
* declarative API does not store for that kind is reported. An id starting with `default.` is
|
|
17
|
+
* reported, except on a page template flagged `isDefault`: that is one of the backend's defaults.
|
|
18
|
+
*
|
|
7
19
|
* @alpha
|
|
8
20
|
*/
|
|
9
|
-
export declare function validateDeclarativePublisherEntityV2(entity: unknown): IPublisherValidationIssueV2[];
|
|
21
|
+
export declare function validateDeclarativePublisherEntityV2(entity: unknown, kind: DeclarativePublisherEntityKindV2): IPublisherValidationIssueV2[];
|
|
10
22
|
//# sourceMappingURL=validateDeclarativePublisherEntityV2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateDeclarativePublisherEntityV2.d.ts","sourceRoot":"","sources":["../src/validateDeclarativePublisherEntityV2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateDeclarativePublisherEntityV2.d.ts","sourceRoot":"","sources":["../src/validateDeclarativePublisherEntityV2.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,2BAA2B,EAKnC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,gCAAgC,EAAE,MAAM,kCAAkC,CAAC;AAwIzF;;;;GAIG;AACH,wBAAgB,oDAAoD,CAChE,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,MAAM,GACd,2BAA2B,EAAE,CAoB/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oCAAoC,CAChD,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,gCAAgC,GACvC,2BAA2B,EAAE,CAE/B"}
|
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
-
import { idRef, validatePublisherEntityV2 } from "@gooddata/sdk-model";
|
|
2
|
+
import { idRef, isPublisherEntityIdV2, isReservedPublisherEntityIdV2, validatePublisherEntityV2, } from "@gooddata/sdk-model";
|
|
3
|
+
const declarativeKeys = {
|
|
4
|
+
document: keySet({
|
|
5
|
+
id: true,
|
|
6
|
+
title: true,
|
|
7
|
+
description: true,
|
|
8
|
+
tags: true,
|
|
9
|
+
version: true,
|
|
10
|
+
period: true,
|
|
11
|
+
content: true,
|
|
12
|
+
}),
|
|
13
|
+
documentTemplate: keySet({
|
|
14
|
+
id: true,
|
|
15
|
+
title: true,
|
|
16
|
+
description: true,
|
|
17
|
+
tags: true,
|
|
18
|
+
version: true,
|
|
19
|
+
content: true,
|
|
20
|
+
}),
|
|
21
|
+
pageTemplate: keySet({
|
|
22
|
+
...{
|
|
23
|
+
id: true,
|
|
24
|
+
title: true,
|
|
25
|
+
description: true,
|
|
26
|
+
tags: true,
|
|
27
|
+
version: true,
|
|
28
|
+
content: true,
|
|
29
|
+
},
|
|
30
|
+
// Marks a default page template, stored under a reserved `default.` id.
|
|
31
|
+
isDefault: true,
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
const kinds = Object.keys(declarativeKeys);
|
|
35
|
+
function isKind(value) {
|
|
36
|
+
return typeof value === "string" && Object.hasOwn(declarativeKeys, value);
|
|
37
|
+
}
|
|
38
|
+
function listOfKinds(format) {
|
|
39
|
+
const named = kinds.map(format);
|
|
40
|
+
return `${named.slice(0, -1).join(", ")} or ${named[named.length - 1]}`;
|
|
41
|
+
}
|
|
42
|
+
function unknownKindIssue(kind) {
|
|
43
|
+
return {
|
|
44
|
+
path: "type",
|
|
45
|
+
message: `Unknown kind ${JSON.stringify(kind)}; expected ${listOfKinds((name) => name)}.`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function keySet(keys) {
|
|
49
|
+
return new Set(Object.keys(keys));
|
|
50
|
+
}
|
|
3
51
|
function isRecord(value) {
|
|
4
52
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
53
|
}
|
|
@@ -8,27 +56,93 @@ function onId(issue) {
|
|
|
8
56
|
? { ...issue, path: `id${issue.path.slice("ref".length)}` }
|
|
9
57
|
: issue;
|
|
10
58
|
}
|
|
59
|
+
function unknownKeyIssues(entity, knownKeys) {
|
|
60
|
+
return Object.keys(entity)
|
|
61
|
+
.filter((key) => entity[key] !== undefined && !knownKeys.has(key))
|
|
62
|
+
.map((key) => ({ path: key, message: `Unknown key "${key}".` }));
|
|
63
|
+
}
|
|
64
|
+
function idIssues(id) {
|
|
65
|
+
if (id === undefined) {
|
|
66
|
+
return [{ path: "id", message: 'Missing required key "id".' }];
|
|
67
|
+
}
|
|
68
|
+
if (typeof id !== "string" || id === "") {
|
|
69
|
+
return [{ path: "id", message: `Expected a non-empty string, got ${JSON.stringify(id)}.` }];
|
|
70
|
+
}
|
|
71
|
+
return isPublisherEntityIdV2(id)
|
|
72
|
+
? []
|
|
73
|
+
: [
|
|
74
|
+
{
|
|
75
|
+
path: "id",
|
|
76
|
+
message: `Expected an id of 1 to 255 letters, digits, dots, underscores or hyphens, not starting with a dot, got ${JSON.stringify(id)}.`,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
const missingKindIssue = {
|
|
81
|
+
path: "type",
|
|
82
|
+
message: `The stored shape has no "type" key; pass the kind (${listOfKinds((name) => JSON.stringify(name))}) to the validator.`,
|
|
83
|
+
};
|
|
84
|
+
function isBackendDefaultPageTemplate(entity, kind) {
|
|
85
|
+
const { id } = entity;
|
|
86
|
+
return (kind === "pageTemplate" &&
|
|
87
|
+
entity["isDefault"] === true &&
|
|
88
|
+
typeof id === "string" &&
|
|
89
|
+
isReservedPublisherEntityIdV2(id));
|
|
90
|
+
}
|
|
91
|
+
// A backend default page template is stored under the `default.` id that the save validation refuses,
|
|
92
|
+
// so it is validated without its reference; idIssues still checks the id itself.
|
|
93
|
+
function asDefinition(entity, kind) {
|
|
94
|
+
const { id, ...rest } = entity;
|
|
95
|
+
const known = Object.fromEntries(Object.entries(rest).filter(([key]) => declarativeKeys[kind].has(key)));
|
|
96
|
+
const typed = { ...known, type: kind };
|
|
97
|
+
return isPublisherEntityIdV2(id) && !isBackendDefaultPageTemplate(entity, kind)
|
|
98
|
+
? { ...typed, ref: idRef(id) }
|
|
99
|
+
: typed;
|
|
100
|
+
}
|
|
101
|
+
function issuesOfKind(entity, kind, knownKeys) {
|
|
102
|
+
return [
|
|
103
|
+
...unknownKeyIssues(entity, knownKeys),
|
|
104
|
+
...idIssues(entity["id"]),
|
|
105
|
+
...validatePublisherEntityV2(asDefinition(entity, kind)).map(onId),
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Without a kind, the kind is read from the entity's own `type` key, which is then the one key allowed
|
|
110
|
+
* beyond the stored ones; without either, one issue asks for the kind. The wasm build exposes this
|
|
111
|
+
* variant, so the Python `kind` argument stays optional.
|
|
112
|
+
*/
|
|
113
|
+
export function validateDeclarativePublisherEntityWithOptionalKindV2(entity, kind) {
|
|
114
|
+
if (kind !== undefined) {
|
|
115
|
+
if (!isKind(kind)) {
|
|
116
|
+
return [unknownKindIssue(kind)];
|
|
117
|
+
}
|
|
118
|
+
return isRecord(entity)
|
|
119
|
+
? issuesOfKind(entity, kind, declarativeKeys[kind])
|
|
120
|
+
: validatePublisherEntityV2(entity);
|
|
121
|
+
}
|
|
122
|
+
if (!isRecord(entity)) {
|
|
123
|
+
return validatePublisherEntityV2(entity);
|
|
124
|
+
}
|
|
125
|
+
const ownType = entity["type"];
|
|
126
|
+
if (ownType === undefined) {
|
|
127
|
+
return [...idIssues(entity["id"]), missingKindIssue];
|
|
128
|
+
}
|
|
129
|
+
if (!isKind(ownType)) {
|
|
130
|
+
return [...idIssues(entity["id"]), unknownKindIssue(ownType)];
|
|
131
|
+
}
|
|
132
|
+
return issuesOfKind(entity, ownType, new Set([...declarativeKeys[ownType], "type"]));
|
|
133
|
+
}
|
|
11
134
|
/**
|
|
12
135
|
* Validates a stored v2 document, document template or page template, named by the bare `id` the
|
|
13
136
|
* declarative API stores. It runs the sdk-model validator, and an issue on the reference is reported
|
|
14
137
|
* on `id`.
|
|
15
138
|
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* The declarative API stores no `type`, so the kind is passed next to the entity. Every key the
|
|
141
|
+
* declarative API does not store for that kind is reported. An id starting with `default.` is
|
|
142
|
+
* reported, except on a page template flagged `isDefault`: that is one of the backend's defaults.
|
|
143
|
+
*
|
|
16
144
|
* @alpha
|
|
17
145
|
*/
|
|
18
|
-
export function validateDeclarativePublisherEntityV2(entity) {
|
|
19
|
-
|
|
20
|
-
return validatePublisherEntityV2(entity);
|
|
21
|
-
}
|
|
22
|
-
const { id, ref, ...rest } = entity;
|
|
23
|
-
const isNamed = typeof id === "string" && id !== "";
|
|
24
|
-
const keyIssues = [
|
|
25
|
-
...(ref === undefined ? [] : [{ path: "ref", message: 'Unknown key "ref".' }]),
|
|
26
|
-
...(id === undefined
|
|
27
|
-
? [{ path: "id", message: 'Missing required key "id".' }]
|
|
28
|
-
: isNamed
|
|
29
|
-
? []
|
|
30
|
-
: [{ path: "id", message: `Expected a non-empty string, got ${JSON.stringify(id)}.` }]),
|
|
31
|
-
];
|
|
32
|
-
const named = isNamed ? { ...rest, ref: idRef(id) } : rest;
|
|
33
|
-
return [...keyIssues, ...validatePublisherEntityV2(named).map(onId)];
|
|
146
|
+
export function validateDeclarativePublisherEntityV2(entity, kind) {
|
|
147
|
+
return validateDeclarativePublisherEntityWithOptionalKindV2(entity, kind);
|
|
34
148
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-code-convertors",
|
|
3
|
-
"version": "11.64.0
|
|
3
|
+
"version": "11.64.0",
|
|
4
4
|
"description": "GoodData AAC declarative converters",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"uuid": "11.1.1",
|
|
28
28
|
"yaml": "2.8.3",
|
|
29
|
-
"@gooddata/api-client-tiger": "11.64.0
|
|
30
|
-
"@gooddata/sdk-
|
|
31
|
-
"@gooddata/sdk-
|
|
29
|
+
"@gooddata/api-client-tiger": "11.64.0",
|
|
30
|
+
"@gooddata/sdk-model": "11.64.0",
|
|
31
|
+
"@gooddata/sdk-code-schemas": "11.64.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@microsoft/api-extractor": "7.59.2",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"oxlint-tsgolint": "7.0.2001",
|
|
49
49
|
"typescript": "7.0.2",
|
|
50
50
|
"vitest": "5.0.4",
|
|
51
|
-
"@gooddata/
|
|
52
|
-
"@gooddata/
|
|
51
|
+
"@gooddata/oxlint-config": "11.64.0",
|
|
52
|
+
"@gooddata/eslint-config": "11.64.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"_phase:build": "npm run build",
|