@gooddata/mock-handling 10.35.0-alpha.33 → 10.35.0-alpha.34
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/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/codegen/catalog.d.ts +1 -2
- package/esm/codegen/catalog.d.ts.map +1 -1
- package/esm/codegen/catalog.js +8 -23
- package/esm/codegen/catalog.js.map +1 -1
- package/esm/codegen/dashboard.d.ts +1 -2
- package/esm/codegen/dashboard.d.ts.map +1 -1
- package/esm/codegen/dashboard.js +12 -22
- package/esm/codegen/dashboard.js.map +1 -1
- package/esm/codegen/dataSample.d.ts +2 -2
- package/esm/codegen/dataSample.d.ts.map +1 -1
- package/esm/codegen/dataSample.js +5 -27
- package/esm/codegen/dataSample.js.map +1 -1
- package/esm/codegen/displayForm.d.ts +1 -2
- package/esm/codegen/displayForm.d.ts.map +1 -1
- package/esm/codegen/displayForm.js +12 -22
- package/esm/codegen/displayForm.js.map +1 -1
- package/esm/codegen/execution.d.ts +1 -2
- package/esm/codegen/execution.d.ts.map +1 -1
- package/esm/codegen/execution.js +16 -32
- package/esm/codegen/execution.js.map +1 -1
- package/esm/codegen/index.d.ts +2 -2
- package/esm/codegen/index.d.ts.map +1 -1
- package/esm/codegen/index.js +101 -65
- package/esm/codegen/index.js.map +1 -1
- package/esm/codegen/insight.d.ts +1 -2
- package/esm/codegen/insight.d.ts.map +1 -1
- package/esm/codegen/insight.js +13 -32
- package/esm/codegen/insight.js.map +1 -1
- package/esm/codegen/visClasses.d.ts +1 -2
- package/esm/codegen/visClasses.d.ts.map +1 -1
- package/esm/codegen/visClasses.js +8 -23
- package/esm/codegen/visClasses.js.map +1 -1
- package/package.json +5 -6
package/esm/__version.d.ts
CHANGED
package/esm/__version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// (C) 2021 GoodData Corporation
|
|
2
2
|
// DO NOT CHANGE THIS FILE, IT IS RE-GENERATED ON EVERY BUILD
|
|
3
|
-
export const LIB_VERSION = "10.35.0-alpha.
|
|
3
|
+
export const LIB_VERSION = "10.35.0-alpha.34";
|
|
4
4
|
export const LIB_NAME = "@gooddata/mock-handling";
|
|
5
5
|
//# sourceMappingURL=__version.js.map
|
package/esm/codegen/catalog.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { OptionalKind, VariableStatementStructure } from "ts-morph";
|
|
2
1
|
import { CatalogRecording } from "../recordings/catalog.js";
|
|
3
2
|
/**
|
|
4
3
|
* Generate constants for catalog recording. This function will return non-exported constant per recording.
|
|
@@ -7,5 +6,5 @@ import { CatalogRecording } from "../recordings/catalog.js";
|
|
|
7
6
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
8
7
|
* made relative for require()
|
|
9
8
|
*/
|
|
10
|
-
export declare function generateConstantsForCatalog(recording: CatalogRecording
|
|
9
|
+
export declare function generateConstantsForCatalog(recording: CatalogRecording, targetDir: string): string[];
|
|
11
10
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/codegen/catalog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/codegen/catalog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAcpG"}
|
package/esm/codegen/catalog.js
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
// (C) 2020 GoodData Corporation
|
|
1
|
+
// (C) 2020-2025 GoodData Corporation
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { VariableDeclarationKind } from "ts-morph";
|
|
4
|
-
import compact from "lodash/compact.js";
|
|
5
3
|
// const CatalogIndexConstName = "Catalog";
|
|
6
|
-
function catalogRecordingInit(rec, targetDir) {
|
|
7
|
-
const entries = Object.entries(rec.getEntryForRecordingIndex());
|
|
8
|
-
const entryRows = entries
|
|
9
|
-
.map(([type, file]) => `${type}: require('./${path.relative(targetDir, file)}')`)
|
|
10
|
-
.join(",");
|
|
11
|
-
return `{ ${entryRows} }`;
|
|
12
|
-
}
|
|
13
|
-
function generateRecordingConst(rec, targetDir) {
|
|
14
|
-
return {
|
|
15
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
16
|
-
isExported: false,
|
|
17
|
-
declarations: [
|
|
18
|
-
{
|
|
19
|
-
name: rec.getRecordingName(),
|
|
20
|
-
initializer: catalogRecordingInit(rec, targetDir),
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
4
|
/**
|
|
26
5
|
* Generate constants for catalog recording. This function will return non-exported constant per recording.
|
|
27
6
|
*
|
|
@@ -30,6 +9,12 @@ function generateRecordingConst(rec, targetDir) {
|
|
|
30
9
|
* made relative for require()
|
|
31
10
|
*/
|
|
32
11
|
export function generateConstantsForCatalog(recording, targetDir) {
|
|
33
|
-
|
|
12
|
+
const entries = Object.entries(recording.getEntryForRecordingIndex());
|
|
13
|
+
const recordingName = recording.getRecordingName();
|
|
14
|
+
const entryRows = entries.map(([type, _]) => `${type}: ${recordingName}_${type}`).join(",");
|
|
15
|
+
return [
|
|
16
|
+
...entries.map(([type, file]) => `import ${recordingName}_${type} from "./${path.relative(targetDir, file)}" with { type: "json" };`),
|
|
17
|
+
`const ${recordingName} = { ${entryRows} };`,
|
|
18
|
+
];
|
|
34
19
|
}
|
|
35
20
|
//# sourceMappingURL=catalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/codegen/catalog.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/codegen/catalog.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,2CAA2C;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAA2B,EAAE,SAAiB;IACtF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAEtE,MAAM,aAAa,GAAG,SAAS,CAAC,gBAAgB,EAAE,CAAC;IAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE5F,OAAO;QACH,GAAG,OAAO,CAAC,GAAG,CACV,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CACb,UAAU,aAAa,IAAI,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,0BAA0B,CAC1G;QACD,SAAS,aAAa,QAAQ,SAAS,KAAK;KAC/C,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { OptionalKind, VariableStatementStructure } from "ts-morph";
|
|
2
1
|
import { DashboardRecording } from "../recordings/dashboards.js";
|
|
3
2
|
/**
|
|
4
3
|
* Generate constants for the dashboard recordings. This function will return non-exported constant per recording.
|
|
@@ -7,5 +6,5 @@ import { DashboardRecording } from "../recordings/dashboards.js";
|
|
|
7
6
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
8
7
|
* made relative for require()
|
|
9
8
|
*/
|
|
10
|
-
export declare function generateConstantsForDashboards(recordings: DashboardRecording[], targetDir: string):
|
|
9
|
+
export declare function generateConstantsForDashboards(recordings: DashboardRecording[], targetDir: string): string[];
|
|
11
10
|
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/codegen/dashboard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/codegen/dashboard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC1C,UAAU,EAAE,kBAAkB,EAAE,EAChC,SAAS,EAAE,MAAM,GAClB,MAAM,EAAE,CAkBV"}
|
package/esm/codegen/dashboard.js
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
// (C) 2007-
|
|
1
|
+
// (C) 2007-2025 GoodData Corporation
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { VariableDeclarationKind } from "ts-morph";
|
|
4
|
-
function displayFormRecordingInit(rec, targetDir) {
|
|
5
|
-
const entries = Object.entries(rec.getEntryForRecordingIndex());
|
|
6
|
-
const entryRows = entries
|
|
7
|
-
.map(([type, file]) => `${type}: require('./${path.relative(targetDir, file)}')`)
|
|
8
|
-
.join(",");
|
|
9
|
-
return `{ ${entryRows} }`;
|
|
10
|
-
}
|
|
11
|
-
function generateRecordingConst(rec, targetDir) {
|
|
12
|
-
return {
|
|
13
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
14
|
-
isExported: false,
|
|
15
|
-
declarations: [
|
|
16
|
-
{
|
|
17
|
-
name: rec.getRecordingName(),
|
|
18
|
-
initializer: displayFormRecordingInit(rec, targetDir),
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
3
|
/**
|
|
24
4
|
* Generate constants for the dashboard recordings. This function will return non-exported constant per recording.
|
|
25
5
|
*
|
|
@@ -28,6 +8,16 @@ function generateRecordingConst(rec, targetDir) {
|
|
|
28
8
|
* made relative for require()
|
|
29
9
|
*/
|
|
30
10
|
export function generateConstantsForDashboards(recordings, targetDir) {
|
|
31
|
-
return recordings
|
|
11
|
+
return recordings
|
|
12
|
+
.map((r) => {
|
|
13
|
+
const entries = Object.entries(r.getEntryForRecordingIndex());
|
|
14
|
+
const recordingName = r.getRecordingName();
|
|
15
|
+
const entryRows = entries.map(([type, _]) => `${type}: ${recordingName}_${type}`).join(",");
|
|
16
|
+
return [
|
|
17
|
+
...entries.map(([type, file]) => `import ${recordingName}_${type} from "./${path.relative(targetDir, file)}" with { type: "json" }`),
|
|
18
|
+
`const ${recordingName} = { ${entryRows} };`,
|
|
19
|
+
];
|
|
20
|
+
})
|
|
21
|
+
.reduce((acc, curr) => acc.concat(curr), []);
|
|
32
22
|
}
|
|
33
23
|
//# sourceMappingURL=dashboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/codegen/dashboard.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/codegen/dashboard.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC1C,UAAgC,EAChC,SAAiB;IAEjB,OAAO,UAAU;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACP,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,EAAE,CAAC,CAAC;QAE9D,MAAM,aAAa,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAE3C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5F,OAAO;YACH,GAAG,OAAO,CAAC,GAAG,CACV,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CACb,UAAU,aAAa,IAAI,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,yBAAyB,CACzG;YACD,SAAS,aAAa,QAAQ,SAAS,KAAK;SAC/C,CAAC;IACN,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OptionalKind, VariableStatementStructure } from "ts-morph";
|
|
2
1
|
import { DisplayFormRecording } from "../recordings/displayForms.js";
|
|
2
|
+
export declare function generateDataSampleConst(recordings: DisplayFormRecording[]): string;
|
|
3
3
|
/**
|
|
4
4
|
* Generate constants for the display form recordings and data sample. This function will return non-exported constant per recording
|
|
5
5
|
* and then also an exported 'DataSamples' constant that is a map from data sample ⇒ display form ⇒ recording.
|
|
@@ -8,5 +8,5 @@ import { DisplayFormRecording } from "../recordings/displayForms.js";
|
|
|
8
8
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
9
9
|
* made relative for require()
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function generateImportsForDataSamples(recordings: DisplayFormRecording[], targetDir: string): string[];
|
|
12
12
|
//# sourceMappingURL=dataSample.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataSample.d.ts","sourceRoot":"","sources":["../../src/codegen/dataSample.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataSample.d.ts","sourceRoot":"","sources":["../../src/codegen/dataSample.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AA0DrE,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAclF;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CACzC,UAAU,EAAE,oBAAoB,EAAE,EAClC,SAAS,EAAE,MAAM,GAClB,MAAM,EAAE,CAQV"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// (C) 2020-
|
|
2
|
-
import { VariableDeclarationKind } from "ts-morph";
|
|
1
|
+
// (C) 2020-2025 GoodData Corporation
|
|
3
2
|
import * as path from "path";
|
|
4
3
|
import { createUniqueVariableName } from "../base/variableNaming.js";
|
|
5
4
|
import groupBy from "lodash/groupBy.js";
|
|
@@ -43,7 +42,7 @@ function comparatorDataSample(a, b) {
|
|
|
43
42
|
}
|
|
44
43
|
return 0;
|
|
45
44
|
}
|
|
46
|
-
function generateDataSampleConst(recordings) {
|
|
45
|
+
export function generateDataSampleConst(recordings) {
|
|
47
46
|
const recsWithDataSample = recordings.map((rec) => [
|
|
48
47
|
createUniqueVariableName(rec.getDisplayFormTitle()),
|
|
49
48
|
rec,
|
|
@@ -52,16 +51,7 @@ function generateDataSampleConst(recordings) {
|
|
|
52
51
|
const dataSampleRows = entriesDataSample
|
|
53
52
|
.map(([title, rec]) => `${title}: ${generateRecordingForDataSample(rec)}`)
|
|
54
53
|
.join(",");
|
|
55
|
-
return {
|
|
56
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
57
|
-
isExported: true,
|
|
58
|
-
declarations: [
|
|
59
|
-
{
|
|
60
|
-
name: DataSampleConstName,
|
|
61
|
-
initializer: `{ ${dataSampleRows} }`,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
};
|
|
54
|
+
return `export const ${DataSampleConstName} = { ${dataSampleRows} }`;
|
|
65
55
|
}
|
|
66
56
|
/**
|
|
67
57
|
* Generate constants for the display form recordings and data sample. This function will return non-exported constant per recording
|
|
@@ -71,19 +61,7 @@ function generateDataSampleConst(recordings) {
|
|
|
71
61
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
72
62
|
* made relative for require()
|
|
73
63
|
*/
|
|
74
|
-
export function
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
78
|
-
isExported: false,
|
|
79
|
-
declarations: [
|
|
80
|
-
{
|
|
81
|
-
name: rec.getRecordingName(),
|
|
82
|
-
initializer: `require('./${path.relative(targetDir, rec.elementFile)}')`,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
return [...recConsts, generateDataSampleConst(recordings)];
|
|
64
|
+
export function generateImportsForDataSamples(recordings, targetDir) {
|
|
65
|
+
return recordings.map((rec) => `import ${rec.getRecordingName()} from "./${path.relative(targetDir, rec.elementFile)}" with { type: "json" };`);
|
|
88
66
|
}
|
|
89
67
|
//# sourceMappingURL=dataSample.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataSample.js","sourceRoot":"","sources":["../../src/codegen/dataSample.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"dataSample.js","sourceRoot":"","sources":["../../src/codegen/dataSample.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAiB,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,GAAG,MAAM,eAAe,CAAC;AAEhC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAI1C,SAAS,uBAAuB,CAAC,YAAoB,EAAE,UAAkB,EAAE,KAAU;IACjF,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,YAAY,CAAC,CAAC;IACrE,IAAI,GAAG,CAAC,KAAK,EAAE,qBAAqB,CAAC,EAAE,CAAC;QACpC,O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{ OptionalKind, VariableStatementStructure } from "ts-morph";
|
|
2
1
|
import { DisplayFormRecording } from "../recordings/displayForms.js";
|
|
3
2
|
/**
|
|
4
3
|
* Generate constants for the valid element recordings. This function will return non-exported constant per recording.
|
|
@@ -7,5 +6,5 @@ import { DisplayFormRecording } from "../recordings/displayForms.js";
|
|
|
7
6
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
8
7
|
* made relative for require()
|
|
9
8
|
*/
|
|
10
|
-
export declare function generateConstantsForDisplayForms(recordings: DisplayFormRecording[], targetDir: string):
|
|
9
|
+
export declare function generateConstantsForDisplayForms(recordings: DisplayFormRecording[], targetDir: string): string[];
|
|
11
10
|
//# sourceMappingURL=displayForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayForm.d.ts","sourceRoot":"","sources":["../../src/codegen/displayForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"displayForm.d.ts","sourceRoot":"","sources":["../../src/codegen/displayForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC5C,UAAU,EAAE,oBAAoB,EAAE,EAClC,SAAS,EAAE,MAAM,GAClB,MAAM,EAAE,CAkBV"}
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
// (C) 2007-
|
|
1
|
+
// (C) 2007-2025 GoodData Corporation
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { VariableDeclarationKind } from "ts-morph";
|
|
4
|
-
function displayFormRecordingInit(rec, targetDir) {
|
|
5
|
-
const entries = Object.entries(rec.getEntryForRecordingIndex());
|
|
6
|
-
const entryRows = entries
|
|
7
|
-
.map(([type, file]) => `${type}: require('./${path.relative(targetDir, file)}')`)
|
|
8
|
-
.join(",");
|
|
9
|
-
return `{ ${entryRows} }`;
|
|
10
|
-
}
|
|
11
|
-
function generateRecordingConst(rec, targetDir) {
|
|
12
|
-
return {
|
|
13
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
14
|
-
isExported: false,
|
|
15
|
-
declarations: [
|
|
16
|
-
{
|
|
17
|
-
name: rec.getRecordingName(),
|
|
18
|
-
initializer: displayFormRecordingInit(rec, targetDir),
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
3
|
/**
|
|
24
4
|
* Generate constants for the valid element recordings. This function will return non-exported constant per recording.
|
|
25
5
|
*
|
|
@@ -28,6 +8,16 @@ function generateRecordingConst(rec, targetDir) {
|
|
|
28
8
|
* made relative for require()
|
|
29
9
|
*/
|
|
30
10
|
export function generateConstantsForDisplayForms(recordings, targetDir) {
|
|
31
|
-
return recordings
|
|
11
|
+
return recordings
|
|
12
|
+
.map((r) => {
|
|
13
|
+
const entries = Object.entries(r.getEntryForRecordingIndex());
|
|
14
|
+
const recordingName = r.getRecordingName();
|
|
15
|
+
const entryRows = entries.map(([type, _]) => `${type}: ${recordingName}_${type}`).join(",");
|
|
16
|
+
return [
|
|
17
|
+
...entries.map(([type, file]) => `import ${recordingName}_${type} from "./${path.relative(targetDir, file)}" with { type: "json" };`),
|
|
18
|
+
`const ${recordingName} = { ${entryRows} }`,
|
|
19
|
+
];
|
|
20
|
+
})
|
|
21
|
+
.reduce((acc, curr) => acc.concat(curr), []);
|
|
32
22
|
}
|
|
33
23
|
//# sourceMappingURL=displayForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"displayForm.js","sourceRoot":"","sources":["../../src/codegen/displayForm.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"displayForm.js","sourceRoot":"","sources":["../../src/codegen/displayForm.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAC5C,UAAkC,EAClC,SAAiB;IAEjB,OAAO,UAAU;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACP,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,EAAE,CAAC,CAAC;QAE9D,MAAM,aAAa,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC;QAE3C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE5F,OAAO;YACH,GAAG,OAAO,CAAC,GAAG,CACV,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CACb,UAAU,aAAa,IAAI,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,0BAA0B,CAC1G;YACD,SAAS,aAAa,QAAQ,SAAS,IAAI;SAC9C,CAAC;IACN,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { OptionalKind, VariableStatementStructure } from "ts-morph";
|
|
2
1
|
import { ExecutionRecording } from "../recordings/execution.js";
|
|
3
2
|
/**
|
|
4
3
|
* Generate constants for the execution recordings. This function will return non-exported constant per recording
|
|
@@ -9,5 +8,5 @@ import { ExecutionRecording } from "../recordings/execution.js";
|
|
|
9
8
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
10
9
|
* made relative for require()
|
|
11
10
|
*/
|
|
12
|
-
export declare function generateConstantsForExecutions(recordings: ExecutionRecording[], targetDir: string):
|
|
11
|
+
export declare function generateConstantsForExecutions(recordings: ExecutionRecording[], targetDir: string): string[];
|
|
13
12
|
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/codegen/execution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/codegen/execution.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAkDhE;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAC1C,UAAU,EAAE,kBAAkB,EAAE,EAChC,SAAS,EAAE,MAAM,GAClB,MAAM,EAAE,CAgCV"}
|
package/esm/codegen/execution.js
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
// (C) 2007-
|
|
1
|
+
// (C) 2007-2025 GoodData Corporation
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { VariableDeclarationKind } from "ts-morph";
|
|
4
3
|
import { createUniqueVariableName } from "../base/variableNaming.js";
|
|
5
4
|
import flatMap from "lodash/flatMap.js";
|
|
6
5
|
import groupBy from "lodash/groupBy.js";
|
|
7
6
|
const ScenariosConstName = "Scenarios";
|
|
8
|
-
function executionRecordingInit(rec, targetDir) {
|
|
9
|
-
const entries = Object.entries(rec.getEntryForRecordingIndex());
|
|
10
|
-
const entryRows = entries
|
|
11
|
-
.map(([type, file]) => `${type}: require('./${path.relative(targetDir, file)}')`)
|
|
12
|
-
.join(",");
|
|
13
|
-
return `{ ${entryRows} }`;
|
|
14
|
-
}
|
|
15
|
-
function generateRecordingConst(rec, targetDir) {
|
|
16
|
-
return {
|
|
17
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
18
|
-
isExported: false,
|
|
19
|
-
declarations: [
|
|
20
|
-
{
|
|
21
|
-
name: rec.getRecordingName(),
|
|
22
|
-
initializer: executionRecordingInit(rec, targetDir),
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
7
|
function generateScenarioForVis(entries) {
|
|
28
8
|
const entryRows = entries
|
|
29
9
|
.map(([_, entryName, entryRecording, scenarioIndex]) => {
|
|
@@ -53,16 +33,7 @@ function generateScenariosConst(recordings) {
|
|
|
53
33
|
const entryRows = entriesByVis
|
|
54
34
|
.map(([vis, visScenarios]) => `${vis}: ${generateScenarioForVis(visScenarios)}`)
|
|
55
35
|
.join(",");
|
|
56
|
-
return {
|
|
57
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
58
|
-
isExported: true,
|
|
59
|
-
declarations: [
|
|
60
|
-
{
|
|
61
|
-
name: ScenariosConstName,
|
|
62
|
-
initializer: `{ ${entryRows} }`,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
};
|
|
36
|
+
return `export const ${ScenariosConstName} = { ${entryRows} }`;
|
|
66
37
|
}
|
|
67
38
|
/**
|
|
68
39
|
* Generate constants for the execution recordings. This function will return non-exported constant per recording
|
|
@@ -84,6 +55,19 @@ export function generateConstantsForExecutions(recordings, targetDir) {
|
|
|
84
55
|
}
|
|
85
56
|
return acc;
|
|
86
57
|
}, []);
|
|
87
|
-
return [
|
|
58
|
+
return [
|
|
59
|
+
...unique
|
|
60
|
+
.map((r) => {
|
|
61
|
+
const entries = Object.entries(r.getEntryForRecordingIndex());
|
|
62
|
+
const recordingName = r.getRecordingName();
|
|
63
|
+
const entryRows = entries.map(([type, _]) => `${type}: ${recordingName}_${type}`).join(",");
|
|
64
|
+
return [
|
|
65
|
+
...entries.map(([type, file]) => `import ${recordingName}_${type} from "./${path.relative(targetDir, file)}" with { type: "json" };`),
|
|
66
|
+
`const ${recordingName} = { ${entryRows} };`,
|
|
67
|
+
];
|
|
68
|
+
})
|
|
69
|
+
.reduce((acc, curr) => acc.concat(curr), []),
|
|
70
|
+
generateScenariosConst(unique),
|
|
71
|
+
];
|
|
88
72
|
}
|
|
89
73
|
//# sourceMappingURL=execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/codegen/execution.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/codegen/execution.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAGxC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAQvC,SAAS,sBAAsB,CAAC,OAA+B;IAC3D,MAAM,SAAS,GAAG,OAAO;SACpB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,wBAAwB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAErD,OAAO;YACH,KAAK,EAAE,GAAG,IAAI,sBAAsB,aAAa,gBAAgB,cAAc,CAAC,gBAAgB,EAAE,GAAG;YACrG,IAAI;SACP,CAAC;IACN,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,GAAsC,EAAE,MAAuC,EAAE,EAAE;QACxF,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAAE,CA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CAAC,GAAG,GAAG,CAAC;QAC3B,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACH,GAAG,MAAM;aACJ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACP,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,EAAE,CAAC,CAAC;YAE9D,MAAM,aAAa,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC;YAE3C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAE5F,OAAO;gBACH,GAAG,OAAO,CAAC,GAAG,CACV,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CACb,UAAU,aAAa,IAAI,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,0BAA0B,CAC1G;gBACD,SAAS,aAAa,QAAQ,SAAS,KAAK;aAC/C,CAAC;QACN,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QAChD,sBAAsB,CAAC,MAAM,CAAC;KACjC,CAAC;AACN,CAAC"}
|
package/esm/codegen/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IRecording } from "../recordings/common.js";
|
|
2
2
|
/**
|
|
3
|
-
* Given various types of recordings, this function will generate and write `dataSample.ts and index.ts` file in the root of
|
|
3
|
+
* Given various types of recordings, this function will generate and write `dataSample.ts` and `index.ts` file in the root of
|
|
4
4
|
* the recordings directory.
|
|
5
5
|
*
|
|
6
|
-
* The index will use
|
|
6
|
+
* The index will use import to reference the JSON files. It is assumed that all paths on input to this function
|
|
7
7
|
* are absolute, the code will relativize paths as needed.
|
|
8
8
|
*
|
|
9
9
|
* @param recordings - recordings to include in the index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAiB,MAAM,yBAAyB,CAAC;AA6LpE;;;;;;;;;GASG;AAEH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKjG"}
|
package/esm/codegen/index.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
// (C) 2007-2025 GoodData Corporation
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { format } from "prettier";
|
|
5
|
-
import { Project, VariableDeclarationKind, } from "ts-morph";
|
|
2
|
+
import { writeFileSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
6
4
|
import { RecordingType } from "../recordings/common.js";
|
|
7
5
|
import { generateConstantsForDisplayForms } from "./displayForm.js";
|
|
8
|
-
import {
|
|
6
|
+
import { generateDataSampleConst, generateImportsForDataSamples } from "./dataSample.js";
|
|
9
7
|
import { generateConstantsForExecutions } from "./execution.js";
|
|
10
8
|
import { generateConstantsForInsights } from "./insight.js";
|
|
11
9
|
import { generateConstantsForCatalog } from "./catalog.js";
|
|
12
10
|
import { generateConstantsForVisClasses } from "./visClasses.js";
|
|
13
11
|
import groupBy from "lodash/groupBy.js";
|
|
14
12
|
import { generateConstantsForDashboards } from "./dashboard.js";
|
|
15
|
-
const FILE_DIRECTIVES = [
|
|
16
|
-
"/* eslint-disable @typescript-eslint/no-var-requires */",
|
|
17
|
-
"/* eslint-disable header/header */",
|
|
18
|
-
];
|
|
19
13
|
const FILE_HEADER = `/* THIS FILE WAS AUTO-GENERATED USING MOCK HANDLING TOOL; YOU SHOULD NOT EDIT THIS FILE; GENERATE TIME: ${new Date().toISOString()}; */`;
|
|
20
14
|
const MainIndexConstName = "Recordings";
|
|
21
|
-
function initialize(targetDir, fileName) {
|
|
22
|
-
const outputFile = path.join(targetDir, fileName);
|
|
23
|
-
const project = new Project({});
|
|
24
|
-
const sourceFile = project.createSourceFile(outputFile, {
|
|
25
|
-
leadingTrivia: [...FILE_DIRECTIVES, FILE_HEADER],
|
|
26
|
-
}, { overwrite: true });
|
|
27
|
-
return {
|
|
28
|
-
project,
|
|
29
|
-
sourceFile,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
15
|
function recNameList(recs) {
|
|
33
16
|
return recs.map((r) => r.getRecordingName()).join(",");
|
|
34
17
|
}
|
|
@@ -47,33 +30,104 @@ function generateIndexConst(input) {
|
|
|
47
30
|
dashboards: { ${recNameList(input.dashboards())} }
|
|
48
31
|
}
|
|
49
32
|
`;
|
|
50
|
-
return {
|
|
51
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
52
|
-
isExported: true,
|
|
53
|
-
declarations: [
|
|
54
|
-
{
|
|
55
|
-
name: MainIndexConstName,
|
|
56
|
-
initializer: `{ ${executionsInit}, ${metadataInit} }`,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
};
|
|
33
|
+
return `export const ${MainIndexConstName}: RecordingIndex = { ${executionsInit}, ${metadataInit} } as unknown as RecordingIndex;`;
|
|
60
34
|
}
|
|
61
|
-
function transformToTypescript(input, targetDir, fileName) {
|
|
62
|
-
const
|
|
63
|
-
const sourceFile = output.sourceFile;
|
|
35
|
+
async function transformToTypescript(input, targetDir, fileName) {
|
|
36
|
+
const fileContents = [`// (C) ${new Date().getFullYear()} GoodData Corporation`, "", FILE_HEADER, ""];
|
|
64
37
|
if (fileName === "dataSample.ts") {
|
|
65
|
-
|
|
38
|
+
const displayForms = input.displayForms();
|
|
39
|
+
generateImportsForDataSamples(displayForms, targetDir).forEach((l) => fileContents.push(l));
|
|
40
|
+
fileContents.push("");
|
|
41
|
+
fileContents.push(generateDataSampleConst(displayForms));
|
|
66
42
|
}
|
|
67
43
|
else {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
44
|
+
generateConstantsForExecutions(input.executions(), targetDir).forEach((l) => fileContents.push(l));
|
|
45
|
+
fileContents.push("");
|
|
46
|
+
generateConstantsForDisplayForms(input.displayForms(), targetDir).forEach((l) => fileContents.push(l));
|
|
47
|
+
fileContents.push("");
|
|
48
|
+
generateConstantsForInsights(input.insights(), targetDir).forEach((l) => fileContents.push(l));
|
|
49
|
+
fileContents.push("");
|
|
50
|
+
const catalog = input.catalog();
|
|
51
|
+
if (catalog) {
|
|
52
|
+
generateConstantsForCatalog(catalog, targetDir).forEach((l) => fileContents.push(l));
|
|
53
|
+
fileContents.push("");
|
|
54
|
+
}
|
|
55
|
+
const visClasses = input.visClasses();
|
|
56
|
+
if (visClasses) {
|
|
57
|
+
generateConstantsForVisClasses(visClasses, targetDir).forEach((l) => fileContents.push(l));
|
|
58
|
+
fileContents.push("");
|
|
59
|
+
}
|
|
60
|
+
generateConstantsForDashboards(input.dashboards(), targetDir).forEach((l) => fileContents.push(l));
|
|
61
|
+
fileContents.push("");
|
|
62
|
+
fileContents.push(`import {
|
|
63
|
+
IExecutionDefinition,
|
|
64
|
+
CatalogItem,
|
|
65
|
+
ICatalogGroup,
|
|
66
|
+
IVisualizationClass,
|
|
67
|
+
IAttributeDisplayFormMetadataObject,
|
|
68
|
+
IAttributeElement,
|
|
69
|
+
IInsight,
|
|
70
|
+
IDashboard,
|
|
71
|
+
IDashboardPlugin,
|
|
72
|
+
IDataSetMetadataObject,
|
|
73
|
+
} from "@gooddata/sdk-model";
|
|
74
|
+
|
|
75
|
+
type ExecutionRecording = {
|
|
76
|
+
scenarios?: any[];
|
|
77
|
+
definition: IExecutionDefinition;
|
|
78
|
+
executionResult: any;
|
|
79
|
+
[dataViews: string]: any;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type CatalogRecording = {
|
|
83
|
+
items: CatalogItem[];
|
|
84
|
+
groups: ICatalogGroup[];
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type DisplayFormRecording = {
|
|
88
|
+
obj: IAttributeDisplayFormMetadataObject;
|
|
89
|
+
elements: IAttributeElement[];
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
type InsightRecording = {
|
|
93
|
+
obj: IInsight;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
type VisClassesRecording = {
|
|
97
|
+
items: IVisualizationClass[];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
interface IDashboardReferences {
|
|
101
|
+
insights: IInsight[];
|
|
102
|
+
plugins: IDashboardPlugin[];
|
|
103
|
+
dataSets?: IDataSetMetadataObject[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface IDashboardWithReferences {
|
|
107
|
+
dashboard: IDashboard;
|
|
108
|
+
references: IDashboardReferences;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
type DashboardRecording = {
|
|
112
|
+
obj: IDashboardWithReferences;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
type RecordingIndex = {
|
|
116
|
+
executions?: {
|
|
117
|
+
[fp: string]: ExecutionRecording;
|
|
118
|
+
};
|
|
119
|
+
metadata?: {
|
|
120
|
+
catalog?: CatalogRecording;
|
|
121
|
+
displayForms?: Record<string, DisplayFormRecording>;
|
|
122
|
+
insights?: Record<string, InsightRecording>;
|
|
123
|
+
visClasses?: VisClassesRecording;
|
|
124
|
+
dashboards?: Record<string, DashboardRecording>;
|
|
125
|
+
};
|
|
126
|
+
};`);
|
|
127
|
+
fileContents.push("");
|
|
128
|
+
fileContents.push(generateIndexConst(input));
|
|
75
129
|
}
|
|
76
|
-
|
|
130
|
+
writeFileSync(join(targetDir, fileName), fileContents.join("\n"), { encoding: "utf-8" });
|
|
77
131
|
}
|
|
78
132
|
function createGeneratorInput(recordings) {
|
|
79
133
|
const categorized = groupBy(recordings, (rec) => rec.getRecordingType());
|
|
@@ -98,37 +152,19 @@ function createGeneratorInput(recordings) {
|
|
|
98
152
|
},
|
|
99
153
|
};
|
|
100
154
|
}
|
|
101
|
-
async function generateRecordingIndex(recordings, targetDir) {
|
|
102
|
-
const input = createGeneratorInput(recordings);
|
|
103
|
-
const output = transformToTypescript(input, targetDir, "index.ts");
|
|
104
|
-
const sourceFile = output.sourceFile;
|
|
105
|
-
const generatedTypescript = sourceFile.getFullText();
|
|
106
|
-
const formattedTypescript = await format(generatedTypescript, { parser: "typescript", printWidth: 120 });
|
|
107
|
-
fs.writeFileSync(sourceFile.getFilePath(), formattedTypescript, { encoding: "utf-8" });
|
|
108
|
-
}
|
|
109
|
-
async function generateDataSample(recordings, targetDir) {
|
|
110
|
-
const input = createGeneratorInput(recordings);
|
|
111
|
-
const output = transformToTypescript(input, targetDir, "dataSample.ts");
|
|
112
|
-
const sourceFile = output.sourceFile;
|
|
113
|
-
const generatedTypescriptForDataSample = sourceFile.getFullText();
|
|
114
|
-
const formattedTypescriptForDataSample = await format(generatedTypescriptForDataSample, {
|
|
115
|
-
parser: "typescript",
|
|
116
|
-
printWidth: 120,
|
|
117
|
-
});
|
|
118
|
-
fs.writeFileSync(sourceFile.getFilePath(), formattedTypescriptForDataSample, { encoding: "utf-8" });
|
|
119
|
-
}
|
|
120
155
|
/**
|
|
121
|
-
* Given various types of recordings, this function will generate and write `dataSample.ts and index.ts` file in the root of
|
|
156
|
+
* Given various types of recordings, this function will generate and write `dataSample.ts` and `index.ts` file in the root of
|
|
122
157
|
* the recordings directory.
|
|
123
158
|
*
|
|
124
|
-
* The index will use
|
|
159
|
+
* The index will use import to reference the JSON files. It is assumed that all paths on input to this function
|
|
125
160
|
* are absolute, the code will relativize paths as needed.
|
|
126
161
|
*
|
|
127
162
|
* @param recordings - recordings to include in the index
|
|
128
163
|
* @param targetDir - absolute path to directory where the index should be created
|
|
129
164
|
*/
|
|
130
165
|
export async function generateAllFiles(recordings, targetDir) {
|
|
131
|
-
|
|
132
|
-
await
|
|
166
|
+
const input = createGeneratorInput(recordings);
|
|
167
|
+
await transformToTypescript(input, targetDir, "index.ts");
|
|
168
|
+
await transformToTypescript(input, targetDir, "dataSample.ts");
|
|
133
169
|
}
|
|
134
170
|
//# sourceMappingURL=index.js.map
|
package/esm/codegen/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAc,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAGhE,MAAM,WAAW,GAAG,2GAA2G,IAAI,IAAI,EAAE,CAAC,WAA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AC;QACD,YAAY,EAAE,GAAG,EAAE;YACf,OAAQ,WAAW,CAAC,aAAa,CAAC,YAAY,CAAuC,IAAI,EAAE,CAAC;QAChG,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE;YACX,OAAQ,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAmC,IAAI,EAAE,CAAC;QACxF,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,CACV,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC;YAC9B,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAiC,CAAC;YAC3E,IAAI;QACR,UAAU,EAAE,GAAG,EAAE,CACb,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC;YACjC,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAyB,CAAC;YACtE,IAAI;QACR,UAAU,EAAE,GAAG,EAAE;YACb,OAAQ,WAAW,CAAC,aAAa,CAAC,UAAU,CAAqC,IAAI,EAAE,CAAC;QAC5F,CAAC;KACJ,CAAC;AACN,CAAC;AAED;;;;;;;;;GASG;AAEH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAwB,EAAE,SAAiB;IAC9E,MAAM,KAAK,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAE/C,MAAM,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC1D,MAAM,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AACnE,CAAC"}
|
package/esm/codegen/insight.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { OptionalKind, VariableStatementStructure } from "ts-morph";
|
|
2
1
|
import { InsightRecording } from "../recordings/insights.js";
|
|
3
2
|
/**
|
|
4
3
|
* Generate constants for insight recordings. This function will return non-exported constant per recording.
|
|
@@ -7,5 +6,5 @@ import { InsightRecording } from "../recordings/insights.js";
|
|
|
7
6
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
8
7
|
* made relative for require()
|
|
9
8
|
*/
|
|
10
|
-
export declare function generateConstantsForInsights(recordings: InsightRecording[], targetDir: string):
|
|
9
|
+
export declare function generateConstantsForInsights(recordings: InsightRecording[], targetDir: string): string[];
|
|
11
10
|
//# sourceMappingURL=insight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insight.d.ts","sourceRoot":"","sources":["../../src/codegen/insight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insight.d.ts","sourceRoot":"","sources":["../../src/codegen/insight.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAuC7D;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,gBAAgB,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBxG"}
|
package/esm/codegen/insight.js
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
// (C) 2007-
|
|
1
|
+
// (C) 2007-2025 GoodData Corporation
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { VariableDeclarationKind } from "ts-morph";
|
|
4
3
|
import { createUniqueVariableName } from "../base/variableNaming.js";
|
|
5
4
|
import groupBy from "lodash/groupBy.js";
|
|
6
5
|
const InsightIndexConstName = "Insights";
|
|
7
|
-
function insightRecordingInit(rec, targetDir) {
|
|
8
|
-
const entries = Object.entries(rec.getEntryForRecordingIndex());
|
|
9
|
-
const entryPairs = entries
|
|
10
|
-
.map(([type, file]) => `${type}: require('./${path.relative(targetDir, file)}')`)
|
|
11
|
-
.join(",");
|
|
12
|
-
return `{ ${entryPairs} }`;
|
|
13
|
-
}
|
|
14
|
-
function generateRecordingConst(rec, targetDir) {
|
|
15
|
-
return {
|
|
16
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
17
|
-
isExported: false,
|
|
18
|
-
declarations: [
|
|
19
|
-
{
|
|
20
|
-
name: rec.getRecordingName(),
|
|
21
|
-
initializer: insightRecordingInit(rec, targetDir),
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
6
|
function generateScenarioForVis(entries) {
|
|
27
7
|
const scope = {};
|
|
28
8
|
const entryRows = entries
|
|
@@ -42,16 +22,7 @@ function generateInsightsConst(recordings) {
|
|
|
42
22
|
const entryRows = entriesByVis
|
|
43
23
|
.map(([vis, visScenarios]) => `${vis}: ${generateScenarioForVis(visScenarios)}`)
|
|
44
24
|
.join(",");
|
|
45
|
-
return {
|
|
46
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
47
|
-
isExported: true,
|
|
48
|
-
declarations: [
|
|
49
|
-
{
|
|
50
|
-
name: InsightIndexConstName,
|
|
51
|
-
initializer: `{ ${entryRows} }`,
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
};
|
|
25
|
+
return `export const ${InsightIndexConstName} = { ${entryRows} };`;
|
|
55
26
|
}
|
|
56
27
|
/**
|
|
57
28
|
* Generate constants for insight recordings. This function will return non-exported constant per recording.
|
|
@@ -62,7 +33,17 @@ function generateInsightsConst(recordings) {
|
|
|
62
33
|
*/
|
|
63
34
|
export function generateConstantsForInsights(recordings, targetDir) {
|
|
64
35
|
return [
|
|
65
|
-
...recordings
|
|
36
|
+
...recordings
|
|
37
|
+
.map((r) => {
|
|
38
|
+
const entries = Object.entries(r.getEntryForRecordingIndex());
|
|
39
|
+
const recordingName = r.getRecordingName();
|
|
40
|
+
const entryPairs = entries.map(([type, _]) => `${type}: ${recordingName}_${type}`).join(",");
|
|
41
|
+
return [
|
|
42
|
+
...entries.map(([type, file]) => `import ${recordingName}_${type} from "./${path.relative(targetDir, file)}" with { type: "json" };`),
|
|
43
|
+
`const ${recordingName} = { ${entryPairs} };`,
|
|
44
|
+
];
|
|
45
|
+
})
|
|
46
|
+
.reduce((acc, curr) => acc.concat(curr), []),
|
|
66
47
|
generateInsightsConst(recordings),
|
|
67
48
|
];
|
|
68
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insight.js","sourceRoot":"","sources":["../../src/codegen/insight.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"insight.js","sourceRoot":"","sources":["../../src/codegen/insight.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAiB,MAAM,2BAA2B,CAAC;AAEpF,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAQzC,SAAS,sBAAsB,CAAC,OAA+B;IAC3D,MAAM,KAAK,GAAkB,EAAE,CAAC;IAEhC,MAAM,SAAS,GAAG,OAAO;SACpB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,EAAE;QACpC,MAAM,OAAO,GAAG,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC3D,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QAEtB,OAAO,GAAG,OAAO,KAAK,cAAc,CAAC,gBAAgB,EAAE,EAAE,CAAC;IAC9D,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEf,OAAO,KAAK,SAAS,IAAI,CAAC;AAC9B,CAAC;AAED,SAAS,qBAAqB,CAAC,UAA8B;IACzD,MAAM,sBAAsB,GAA2B,UAAU;SAC5D,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;SAC5C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,eAAe,EAAE,EAAE,GAAG,CAAC,CAAC,CA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AC,EAAE,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC;KACpC,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { OptionalKind, VariableStatementStructure } from "ts-morph";
|
|
2
1
|
import { VisClassesRecording } from "../recordings/visClasses.js";
|
|
3
2
|
/**
|
|
4
3
|
* Generate constants for visClasses recording. This function will return non-exported constant per recording.
|
|
@@ -7,5 +6,5 @@ import { VisClassesRecording } from "../recordings/visClasses.js";
|
|
|
7
6
|
* @param targetDir - absolute path to directory where index will be stored, this is needed so that paths can be
|
|
8
7
|
* made relative for require()
|
|
9
8
|
*/
|
|
10
|
-
export declare function generateConstantsForVisClasses(recording: VisClassesRecording
|
|
9
|
+
export declare function generateConstantsForVisClasses(recording: VisClassesRecording, targetDir: string): string[];
|
|
11
10
|
//# sourceMappingURL=visClasses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visClasses.d.ts","sourceRoot":"","sources":["../../src/codegen/visClasses.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"visClasses.d.ts","sourceRoot":"","sources":["../../src/codegen/visClasses.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAc1G"}
|
|
@@ -1,26 +1,5 @@
|
|
|
1
|
-
// (C) 2020 GoodData Corporation
|
|
1
|
+
// (C) 2020-2025 GoodData Corporation
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { VariableDeclarationKind } from "ts-morph";
|
|
4
|
-
import compact from "lodash/compact.js";
|
|
5
|
-
function visClassesRecordingInit(rec, targetDir) {
|
|
6
|
-
const entries = Object.entries(rec.getEntryForRecordingIndex());
|
|
7
|
-
const entryRows = entries
|
|
8
|
-
.map(([type, file]) => `${type}: require('./${path.relative(targetDir, file)}')`)
|
|
9
|
-
.join(",");
|
|
10
|
-
return `{ ${entryRows} }`;
|
|
11
|
-
}
|
|
12
|
-
function generateRecordingConst(rec, targetDir) {
|
|
13
|
-
return {
|
|
14
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
15
|
-
isExported: false,
|
|
16
|
-
declarations: [
|
|
17
|
-
{
|
|
18
|
-
name: rec.getRecordingName(),
|
|
19
|
-
initializer: visClassesRecordingInit(rec, targetDir),
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
3
|
/**
|
|
25
4
|
* Generate constants for visClasses recording. This function will return non-exported constant per recording.
|
|
26
5
|
*
|
|
@@ -29,6 +8,12 @@ function generateRecordingConst(rec, targetDir) {
|
|
|
29
8
|
* made relative for require()
|
|
30
9
|
*/
|
|
31
10
|
export function generateConstantsForVisClasses(recording, targetDir) {
|
|
32
|
-
|
|
11
|
+
const entries = Object.entries(recording.getEntryForRecordingIndex());
|
|
12
|
+
const recordingName = recording.getRecordingName();
|
|
13
|
+
const entryRows = entries.map(([type, _]) => `${type}: ${recordingName}_${type}`).join(",");
|
|
14
|
+
return [
|
|
15
|
+
...entries.map(([type, file]) => `import ${recordingName}_${type} from "./${path.relative(targetDir, file)}" with { type: "json" };`),
|
|
16
|
+
`const ${recordingName} = { ${entryRows} };`,
|
|
17
|
+
];
|
|
33
18
|
}
|
|
34
19
|
//# sourceMappingURL=visClasses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visClasses.js","sourceRoot":"","sources":["../../src/codegen/visClasses.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"visClasses.js","sourceRoot":"","sources":["../../src/codegen/visClasses.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAAC,SAA8B,EAAE,SAAiB;IAC5F,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAEtE,MAAM,aAAa,GAAG,SAAS,CAAC,gBAAgB,EAAE,CAAC;IAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,aAAa,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE5F,OAAO;QACH,GAAG,OAAO,CAAC,GAAG,CACV,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CACb,UAAU,aAAa,IAAI,IAAI,YAAY,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,0BAA0B,CAC1G;QACD,SAAS,aAAa,QAAQ,SAAS,KAAK;KAC/C,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/mock-handling",
|
|
3
|
-
"version": "10.35.0-alpha.
|
|
3
|
+
"version": "10.35.0-alpha.34",
|
|
4
4
|
"author": "GoodData",
|
|
5
5
|
"description": "GoodData SDK Mock data capture and management tool",
|
|
6
6
|
"repository": {
|
|
@@ -31,11 +31,10 @@
|
|
|
31
31
|
"p-map": "^3.0.0",
|
|
32
32
|
"prettier": "^3.6.2",
|
|
33
33
|
"rimraf": "^3.0.0",
|
|
34
|
-
"ts-morph": "^26.0.0",
|
|
35
34
|
"tslib": "^2.5.0",
|
|
36
|
-
"@gooddata/sdk-backend-tiger": "10.35.0-alpha.
|
|
37
|
-
"@gooddata/sdk-
|
|
38
|
-
"@gooddata/sdk-
|
|
35
|
+
"@gooddata/sdk-backend-tiger": "10.35.0-alpha.34",
|
|
36
|
+
"@gooddata/sdk-backend-spi": "10.35.0-alpha.34",
|
|
37
|
+
"@gooddata/sdk-model": "10.35.0-alpha.34"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
40
|
"@gooddata/eslint-config": "^4.1.1",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
"eslint-plugin-sonarjs": "^0.16.0",
|
|
61
60
|
"eslint-plugin-tsdoc": "^0.2.14",
|
|
62
61
|
"typescript": "5.8.3",
|
|
63
|
-
"vitest": "3.
|
|
62
|
+
"vitest": "3.2.4"
|
|
64
63
|
},
|
|
65
64
|
"scripts": {
|
|
66
65
|
"clean": "rm -rf ci dist esm coverage *.log tsconfig.tsbuildinfo",
|