@gooddata/sdk-backend-tiger 11.64.0-alpha.1 → 11.64.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/backend/dataSources/files.d.ts +16 -0
- package/esm/backend/dataSources/files.d.ts.map +1 -0
- package/esm/backend/dataSources/files.js +133 -0
- package/esm/backend/dataSources/index.d.ts +18 -2
- package/esm/backend/dataSources/index.d.ts.map +1 -1
- package/esm/backend/dataSources/index.js +202 -2
- package/esm/backend/features/feature.d.ts.map +1 -1
- package/esm/backend/features/feature.js +1 -0
- package/esm/backend/localization/aggregate.d.ts +4 -1
- package/esm/backend/localization/aggregate.d.ts.map +1 -1
- package/esm/backend/localization/aggregate.js +8 -2
- package/esm/backend/localization/fromBackend.d.ts +12 -2
- package/esm/backend/localization/fromBackend.d.ts.map +1 -1
- package/esm/backend/localization/fromBackend.js +45 -6
- package/esm/backend/localization/index.d.ts +3 -0
- package/esm/backend/localization/index.d.ts.map +1 -1
- package/esm/backend/localization/index.js +52 -8
- package/esm/backend/settings/mapping.js +1 -0
- package/esm/backend/tigerSpecificFunctions.d.ts +0 -1
- package/esm/backend/tigerSpecificFunctions.d.ts.map +1 -1
- package/esm/backend/tigerSpecificFunctions.js +1 -16
- package/esm/backend/uiFeatures.d.ts +3 -0
- package/esm/backend/uiFeatures.d.ts.map +1 -1
- package/esm/backend/uiFeatures.js +3 -0
- package/esm/backend/workspace/customApplicationSettings/index.d.ts +13 -0
- package/esm/backend/workspace/customApplicationSettings/index.d.ts.map +1 -0
- package/esm/backend/workspace/customApplicationSettings/index.js +53 -0
- package/esm/backend/workspace/dataFilters/index.d.ts +2 -1
- package/esm/backend/workspace/dataFilters/index.d.ts.map +1 -1
- package/esm/backend/workspace/dataFilters/index.js +34 -0
- package/esm/backend/workspace/index.d.ts +2 -1
- package/esm/backend/workspace/index.d.ts.map +1 -1
- package/esm/backend/workspace/index.js +4 -0
- package/esm/backend/workspace/ldm/index.d.ts +5 -1
- package/esm/backend/workspace/ldm/index.d.ts.map +1 -1
- package/esm/backend/workspace/ldm/index.js +32 -1
- package/esm/backend/workspace/references/index.d.ts +1 -0
- package/esm/backend/workspace/references/index.d.ts.map +1 -1
- package/esm/backend/workspace/references/index.js +28 -11
- package/esm/backend/workspaces/index.d.ts +1 -1
- package/esm/backend/workspaces/index.d.ts.map +1 -1
- package/esm/backend/workspaces/index.js +9 -2
- package/esm/convertors/fromBackend/DeclarativeModelConverter.d.ts +4 -0
- package/esm/convertors/fromBackend/DeclarativeModelConverter.d.ts.map +1 -0
- package/esm/convertors/fromBackend/DeclarativeModelConverter.js +280 -0
- package/esm/convertors/fromBackend/PhysicalModelConverter.d.ts +5 -0
- package/esm/convertors/fromBackend/PhysicalModelConverter.d.ts.map +1 -0
- package/esm/convertors/fromBackend/PhysicalModelConverter.js +63 -0
- package/esm/convertors/fromBackend/genAIConvertor.d.ts.map +1 -1
- package/esm/convertors/fromBackend/genAIConvertor.js +5 -0
- package/esm/convertors/shared/declarativeFields.d.ts +20 -0
- package/esm/convertors/shared/declarativeFields.d.ts.map +1 -0
- package/esm/convertors/shared/declarativeFields.js +23 -0
- package/esm/convertors/toBackend/DeclarativeModelConverter.d.ts +4 -0
- package/esm/convertors/toBackend/DeclarativeModelConverter.d.ts.map +1 -0
- package/esm/convertors/toBackend/DeclarativeModelConverter.js +277 -0
- package/esm/convertors/toBackend/PhysicalModelConverter.d.ts +5 -0
- package/esm/convertors/toBackend/PhysicalModelConverter.d.ts.map +1 -0
- package/esm/convertors/toBackend/PhysicalModelConverter.js +97 -0
- package/esm/utils/apiProblemDetail.d.ts +3 -0
- package/esm/utils/apiProblemDetail.d.ts.map +1 -0
- package/esm/utils/apiProblemDetail.js +19 -0
- package/package.json +11 -11
package/esm/__version.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "11.64.0-alpha.
|
|
1
|
+
export declare const LIB_VERSION = "11.64.0-alpha.3";
|
|
2
2
|
export declare const LIB_DESCRIPTION = "GoodData Backend SPI implementation for GoodData Cloud and GoodData.CN";
|
|
3
3
|
export declare const LIB_NAME = "@gooddata/sdk-backend-tiger";
|
|
4
4
|
//# sourceMappingURL=__version.d.ts.map
|
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 = "11.64.0-alpha.
|
|
3
|
+
export const LIB_VERSION = "11.64.0-alpha.3";
|
|
4
4
|
export const LIB_DESCRIPTION = "GoodData Backend SPI implementation for GoodData Cloud and GoodData.CN";
|
|
5
5
|
export const LIB_NAME = "@gooddata/sdk-backend-tiger";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IDataSourceFilesService } from "@gooddata/sdk-backend-spi";
|
|
2
|
+
import { type ICsvAnalysis, type ICsvAnalysisRequest, type ICsvFileManifest, type ICsvImportResult, type ICsvImportTable, type IDataSourceFile, type ISavAnalysis, type ISavAnalysisRequest, type ISavImportResult, type ISavImportTable } from "@gooddata/sdk-model";
|
|
3
|
+
import { type TigerAuthenticatedCallGuard } from "../../types/index.js";
|
|
4
|
+
export declare class TigerDataSourceFilesService implements IDataSourceFilesService {
|
|
5
|
+
private readonly authCall;
|
|
6
|
+
constructor(authCall: TigerAuthenticatedCallGuard);
|
|
7
|
+
upload(file: File): Promise<string>;
|
|
8
|
+
analyzeCsv(requests: ICsvAnalysisRequest[]): Promise<ICsvAnalysis[]>;
|
|
9
|
+
importCsv(dataSourceId: string, tables: ICsvImportTable[]): Promise<ICsvImportResult[]>;
|
|
10
|
+
analyzeSav(requests: ISavAnalysisRequest[]): Promise<ISavAnalysis[]>;
|
|
11
|
+
importSav(dataSourceId: string, tables: ISavImportTable[]): Promise<ISavImportResult[]>;
|
|
12
|
+
getFiles(dataSourceId: string): Promise<IDataSourceFile[]>;
|
|
13
|
+
deleteFiles(dataSourceId: string, fileNames: string[]): Promise<void>;
|
|
14
|
+
getCsvManifests(dataSourceId: string, fileNames: string[]): Promise<ICsvFileManifest[]>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/backend/dataSources/files.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,uBAAuB,EAA6B,MAAM,2BAA2B,CAAC;AACpG,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAEpB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAqDxE,qBAAa,2BAA4B,YAAW,uBAAuB;IAC3D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAArC,YAA6B,QAAQ,EAAE,2BAA2B,EAAI;IAEzD,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB/C;IAEY,UAAU,CAAC,QAAQ,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAOhF;IAEY,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAQnG;IAEY,UAAU,CAAC,QAAQ,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAOhF;IAEY,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAanG;IAEY,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAKtE;IAEY,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjF;IAEY,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAUnG;CACJ"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { backOff } from "exponential-backoff";
|
|
3
|
+
import { ResultApi_AnalyzeCsv, ResultApi_AnalyzeSav, ResultApi_DeleteFiles, ResultApi_ImportCsv, ResultApi_ImportSav, ResultApi_ListFiles, ResultApi_ReadCsvFileManifests, ResultApi_StagingUpload, } from "@gooddata/api-client-tiger/endpoints/result";
|
|
4
|
+
import { isUnexpectedResponseError } from "@gooddata/sdk-backend-spi";
|
|
5
|
+
import { convertApiError } from "../../utils/errorHandling.js";
|
|
6
|
+
// The generated client types the escape and quote characters as `object`, but the backend
|
|
7
|
+
// accepts a string or `false` there.
|
|
8
|
+
const toParseOptions = (parseOptions) => parseOptions;
|
|
9
|
+
const fromParseOptions = (parseOptions) => parseOptions;
|
|
10
|
+
const convertAnalysis = (analysis) => ({
|
|
11
|
+
location: analysis.location,
|
|
12
|
+
columns: analysis.columns,
|
|
13
|
+
previewData: analysis.previewData,
|
|
14
|
+
config: analysis.config && {
|
|
15
|
+
...analysis.config,
|
|
16
|
+
parseOptions: fromParseOptions(analysis.config.parseOptions),
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
const convertSavAnalysis = ({ location, columns, previewData }) => ({
|
|
20
|
+
location,
|
|
21
|
+
columns: columns.map(({ name, type, label, valueLabels }) => ({
|
|
22
|
+
name,
|
|
23
|
+
type,
|
|
24
|
+
label,
|
|
25
|
+
valueLabels: valueLabels?.map(({ value, label }) => ({ value, label })),
|
|
26
|
+
})),
|
|
27
|
+
previewData,
|
|
28
|
+
});
|
|
29
|
+
const toImportTable = ({ name, source }) => ({
|
|
30
|
+
name,
|
|
31
|
+
source: {
|
|
32
|
+
location: source.location,
|
|
33
|
+
config: {
|
|
34
|
+
...source.config,
|
|
35
|
+
parseOptions: toParseOptions(source.config.parseOptions),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const convertManifest = ({ name, version, manifest }) => ({
|
|
40
|
+
name,
|
|
41
|
+
version,
|
|
42
|
+
readMethod: manifest.read_method,
|
|
43
|
+
readOptions: manifest.read,
|
|
44
|
+
parseOptions: fromParseOptions(manifest.parse),
|
|
45
|
+
convertOptions: manifest.convert,
|
|
46
|
+
columnDateFormats: manifest.column_date_formats,
|
|
47
|
+
});
|
|
48
|
+
export class TigerDataSourceFilesService {
|
|
49
|
+
authCall;
|
|
50
|
+
constructor(authCall) {
|
|
51
|
+
this.authCall = authCall;
|
|
52
|
+
}
|
|
53
|
+
async upload(file) {
|
|
54
|
+
const upload = () => this.authCall(async (client) => {
|
|
55
|
+
const result = await ResultApi_StagingUpload(client.axios, client.basePath, { file });
|
|
56
|
+
return result.data.location;
|
|
57
|
+
});
|
|
58
|
+
// The upload API has rate limits and responds with 503 when it is overloaded.
|
|
59
|
+
// Retry only then, with a random delay, so that the clients do not retry at the same time.
|
|
60
|
+
return backOff(upload, {
|
|
61
|
+
jitter: "full",
|
|
62
|
+
numOfAttempts: 3,
|
|
63
|
+
startingDelay: 1000,
|
|
64
|
+
maxDelay: 4000,
|
|
65
|
+
retry: (error) => {
|
|
66
|
+
const converted = convertApiError(error);
|
|
67
|
+
return isUnexpectedResponseError(converted) && converted.httpStatus === 503;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async analyzeCsv(requests) {
|
|
72
|
+
return this.authCall(async (client) => {
|
|
73
|
+
const result = await ResultApi_AnalyzeCsv(client.axios, client.basePath, {
|
|
74
|
+
analyzeCsvRequest: { analyzeRequests: requests },
|
|
75
|
+
});
|
|
76
|
+
return result.data.map(convertAnalysis);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async importCsv(dataSourceId, tables) {
|
|
80
|
+
return this.authCall(async (client) => {
|
|
81
|
+
const result = await ResultApi_ImportCsv(client.axios, client.basePath, {
|
|
82
|
+
dataSourceId,
|
|
83
|
+
importCsvRequest: { tables: tables.map(toImportTable) },
|
|
84
|
+
});
|
|
85
|
+
return result.data;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async analyzeSav(requests) {
|
|
89
|
+
return this.authCall(async (client) => {
|
|
90
|
+
const result = await ResultApi_AnalyzeSav(client.axios, client.basePath, {
|
|
91
|
+
analyzeSavRequest: { analyzeRequests: requests },
|
|
92
|
+
});
|
|
93
|
+
return result.data.map(convertSavAnalysis);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
async importSav(dataSourceId, tables) {
|
|
97
|
+
return this.authCall(async (client) => {
|
|
98
|
+
const result = await ResultApi_ImportSav(client.axios, client.basePath, {
|
|
99
|
+
dataSourceId,
|
|
100
|
+
importSavRequest: {
|
|
101
|
+
tables: tables.map(({ name, source }) => ({
|
|
102
|
+
name,
|
|
103
|
+
source: { location: source.location },
|
|
104
|
+
})),
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
return result.data.map(({ name, version }) => ({ name, version }));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async getFiles(dataSourceId) {
|
|
111
|
+
return this.authCall(async (client) => {
|
|
112
|
+
const result = await ResultApi_ListFiles(client.axios, client.basePath, { dataSourceId });
|
|
113
|
+
return result.data;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async deleteFiles(dataSourceId, fileNames) {
|
|
117
|
+
await this.authCall((client) => ResultApi_DeleteFiles(client.axios, client.basePath, {
|
|
118
|
+
dataSourceId,
|
|
119
|
+
deleteFilesRequest: { fileNames },
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
async getCsvManifests(dataSourceId, fileNames) {
|
|
123
|
+
return this.authCall(async (client) => {
|
|
124
|
+
const result = await ResultApi_ReadCsvFileManifests(client.axios, client.basePath, {
|
|
125
|
+
dataSourceId,
|
|
126
|
+
readCsvFileManifestsRequest: {
|
|
127
|
+
manifestRequests: fileNames.map((fileName) => ({ fileName })),
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
return result.data.map(convertManifest);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
import { type IDataSourcesService } from "@gooddata/sdk-backend-spi";
|
|
2
|
-
import { type IDataSourceIdentifierDescriptor } from "@gooddata/sdk-model";
|
|
1
|
+
import { type IDataSourceFilesService, type IDataSourcesService } from "@gooddata/sdk-backend-spi";
|
|
2
|
+
import { type IDataSourceConnectionTest, type IDataSourceConnectionTestResult, type IDataSourceDefinition, type IDataSourceDescriptor, type IDataSourceIdentifierDescriptor, type IDataSourcePatch, type IDataSourceScanRequest, type IDataSourceScanResult, type IDeclarativeLogicalModel, type IGenerateLogicalModelRequest, type ISqlScanResult } from "@gooddata/sdk-model";
|
|
3
3
|
import { type TigerAuthenticatedCallGuard } from "../../types/index.js";
|
|
4
4
|
export declare class TigerDataSourcesService implements IDataSourcesService {
|
|
5
5
|
private readonly authCall;
|
|
6
6
|
constructor(authCall: TigerAuthenticatedCallGuard);
|
|
7
7
|
getDataSourceIdentifiers(): Promise<IDataSourceIdentifierDescriptor[]>;
|
|
8
|
+
getDataSources(): Promise<IDataSourceDescriptor[]>;
|
|
9
|
+
hasDataSources(): Promise<boolean>;
|
|
10
|
+
getDataSource(id: string): Promise<IDataSourceDescriptor>;
|
|
11
|
+
createDataSource(definition: IDataSourceDefinition): Promise<IDataSourceDescriptor>;
|
|
12
|
+
updateDataSource(id: string, definition: IDataSourceDefinition): Promise<IDataSourceDescriptor>;
|
|
13
|
+
patchDataSource(id: string, patch: IDataSourcePatch): Promise<IDataSourceDescriptor>;
|
|
14
|
+
deleteDataSource(id: string): Promise<void>;
|
|
15
|
+
testConnection(connection: IDataSourceConnectionTest, dataSourceId?: string): Promise<IDataSourceConnectionTestResult>;
|
|
16
|
+
getSchemata(dataSourceId: string): Promise<string[]>;
|
|
17
|
+
registerUploadNotification(dataSourceId: string): Promise<void>;
|
|
18
|
+
getDataSourceIdentifier(id: string): Promise<IDataSourceDescriptor>;
|
|
19
|
+
scan(dataSourceId: string, request: IDataSourceScanRequest): Promise<IDataSourceScanResult>;
|
|
20
|
+
scanSql(dataSourceId: string, sql: string): Promise<ISqlScanResult>;
|
|
21
|
+
generateLogicalModel(dataSourceId: string, request: IGenerateLogicalModelRequest): Promise<IDeclarativeLogicalModel>;
|
|
22
|
+
files(): IDataSourceFilesService;
|
|
23
|
+
private toDescriptor;
|
|
8
24
|
}
|
|
9
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/dataSources/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/dataSources/index.ts"],"names":[],"mappings":"AA+BA,OAAO,EACH,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EACpC,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACtB,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,sBAAsB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M,GAAG,OAAO,CAAC,cAAc,CAAC,CAQ/E;IAEY,oBAAoB,CAC7B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,4BAA4B,GACtC,OAAO,CAAC,wBAAwB,CAAC,CAQnC;IAEM,KAAK,IAAI,uBAAuB,CAEtC;YAEa,YAAY;CAM7B"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
// (C) 2021-2026 GoodData Corporation
|
|
2
|
-
import { ActionsUtilities } from "@gooddata/api-client-tiger";
|
|
3
|
-
import {
|
|
2
|
+
import { ActionsUtilities, OrganizationUtilities, } from "@gooddata/api-client-tiger";
|
|
3
|
+
import { ActionsApi_GenerateLogicalModel, ActionsApi_RegisterUploadNotification, } from "@gooddata/api-client-tiger/endpoints/actions";
|
|
4
|
+
import { EntitiesApi_CreateEntityDataSources, EntitiesApi_DeleteEntityDataSources, EntitiesApi_GetAllEntitiesDataSourceIdentifiers, EntitiesApi_GetAllEntitiesDataSources, EntitiesApi_GetEntityDataSourceIdentifiers, EntitiesApi_GetEntityDataSources, EntitiesApi_PatchEntityDataSources, EntitiesApi_UpdateEntityDataSources, } from "@gooddata/api-client-tiger/endpoints/entitiesObjects";
|
|
5
|
+
import { ScanModelApi_GetDataSourceSchemata, ScanModelApi_ScanDataSource, ScanModelApi_ScanSql, ScanModelApi_TestDataSource, ScanModelApi_TestDataSourceDefinition, } from "@gooddata/api-client-tiger/endpoints/scanModel";
|
|
6
|
+
import { isNotAuthenticated, } from "@gooddata/sdk-backend-spi";
|
|
7
|
+
import { convertDeclarativeLdm } from "../../convertors/fromBackend/DeclarativeModelConverter.js";
|
|
8
|
+
import { convertScanResult, convertSqlScanResult, } from "../../convertors/fromBackend/PhysicalModelConverter.js";
|
|
9
|
+
import { convertGenerateLogicalModelRequest, convertScanRequest, } from "../../convertors/toBackend/PhysicalModelConverter.js";
|
|
10
|
+
import { getDataSourceErrorMessage } from "../../utils/apiProblemDetail.js";
|
|
11
|
+
import { TigerDataSourceFilesService } from "./files.js";
|
|
4
12
|
function convertdataSourceIdentifier(dataSource) {
|
|
5
13
|
return {
|
|
6
14
|
id: dataSource.id,
|
|
@@ -9,6 +17,60 @@ function convertdataSourceIdentifier(dataSource) {
|
|
|
9
17
|
type: dataSource.attributes.type,
|
|
10
18
|
};
|
|
11
19
|
}
|
|
20
|
+
function convertDataSourceIdentifierWithPermissions(dataSource) {
|
|
21
|
+
return {
|
|
22
|
+
...convertdataSourceIdentifier(dataSource),
|
|
23
|
+
permissions: dataSource.meta?.permissions ?? [],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function convertDataSource({ data }) {
|
|
27
|
+
const { attributes } = data;
|
|
28
|
+
return {
|
|
29
|
+
id: data.id,
|
|
30
|
+
type: attributes.type,
|
|
31
|
+
name: attributes.name,
|
|
32
|
+
schema: attributes.schema,
|
|
33
|
+
username: attributes.username ?? undefined,
|
|
34
|
+
url: attributes.url,
|
|
35
|
+
clientId: attributes.clientId ?? undefined,
|
|
36
|
+
permissions: data.meta?.permissions ?? [],
|
|
37
|
+
parameters: attributes.parameters,
|
|
38
|
+
decodedParameters: attributes.decodedParameters,
|
|
39
|
+
cacheStrategy: attributes.cacheStrategy,
|
|
40
|
+
cacheRetention: attributes.cacheRetention,
|
|
41
|
+
authenticationType: attributes.authenticationType,
|
|
42
|
+
dateTimeSemantics: attributes.dateTimeSemantics,
|
|
43
|
+
alternativeDataSourceId: attributes.alternativeDataSourceId,
|
|
44
|
+
disableStatistics: attributes.disableStatistics,
|
|
45
|
+
ignoreJwtAud: attributes.ignoreJwtAud,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function toDataSourceAttributes(dataSource) {
|
|
49
|
+
const attributes = {
|
|
50
|
+
name: dataSource.name,
|
|
51
|
+
password: dataSource.password,
|
|
52
|
+
schema: dataSource.schema,
|
|
53
|
+
token: dataSource.token,
|
|
54
|
+
type: dataSource.type,
|
|
55
|
+
url: dataSource.url,
|
|
56
|
+
username: dataSource.username,
|
|
57
|
+
parameters: dataSource.parameters,
|
|
58
|
+
cacheStrategy: dataSource.cacheStrategy,
|
|
59
|
+
cacheRetention: dataSource.cacheRetention,
|
|
60
|
+
privateKey: dataSource.privateKey,
|
|
61
|
+
privateKeyPassphrase: dataSource.privateKeyPassphrase,
|
|
62
|
+
clientId: dataSource.clientId,
|
|
63
|
+
clientSecret: dataSource.clientSecret,
|
|
64
|
+
dateTimeSemantics: dataSource.dateTimeSemantics,
|
|
65
|
+
authenticationType: dataSource.authenticationType,
|
|
66
|
+
alternativeDataSourceId: dataSource.alternativeDataSourceId,
|
|
67
|
+
disableStatistics: dataSource.disableStatistics,
|
|
68
|
+
ignoreJwtAud: dataSource.ignoreJwtAud,
|
|
69
|
+
};
|
|
70
|
+
// The model type also lists data source types that this backend does not support,
|
|
71
|
+
// and a patch can omit the required attributes. The backend validates both.
|
|
72
|
+
return attributes;
|
|
73
|
+
}
|
|
12
74
|
export class TigerDataSourcesService {
|
|
13
75
|
authCall;
|
|
14
76
|
constructor(authCall) {
|
|
@@ -22,4 +84,142 @@ export class TigerDataSourcesService {
|
|
|
22
84
|
}).then((response) => response.data.data.map(convertdataSourceIdentifier)));
|
|
23
85
|
});
|
|
24
86
|
}
|
|
87
|
+
async getDataSources() {
|
|
88
|
+
return this.authCall(async (client) => {
|
|
89
|
+
const result = await OrganizationUtilities.getAllPagesOf(client, EntitiesApi_GetAllEntitiesDataSourceIdentifiers, { sort: ["name"], metaInclude: ["permissions"] }).then(OrganizationUtilities.mergeEntitiesResults);
|
|
90
|
+
return result.data.map(convertDataSourceIdentifierWithPermissions);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async hasDataSources() {
|
|
94
|
+
try {
|
|
95
|
+
return await this.authCall(async (client) => {
|
|
96
|
+
const result = await EntitiesApi_GetAllEntitiesDataSources(client.axios, client.basePath, {
|
|
97
|
+
size: 1,
|
|
98
|
+
});
|
|
99
|
+
return result.data.data.length > 0;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (isNotAuthenticated(error)) {
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async getDataSource(id) {
|
|
110
|
+
return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_GetEntityDataSources(client.axios, client.basePath, { id })));
|
|
111
|
+
}
|
|
112
|
+
async createDataSource(definition) {
|
|
113
|
+
return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_CreateEntityDataSources(client.axios, client.basePath, {
|
|
114
|
+
jsonApiDataSourceInDocument: {
|
|
115
|
+
data: {
|
|
116
|
+
id: definition.id,
|
|
117
|
+
type: "dataSource",
|
|
118
|
+
attributes: toDataSourceAttributes(definition),
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
})));
|
|
122
|
+
}
|
|
123
|
+
async updateDataSource(id, definition) {
|
|
124
|
+
return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_UpdateEntityDataSources(client.axios, client.basePath, {
|
|
125
|
+
id,
|
|
126
|
+
jsonApiDataSourceInDocument: {
|
|
127
|
+
data: {
|
|
128
|
+
id: definition.id,
|
|
129
|
+
type: "dataSource",
|
|
130
|
+
attributes: toDataSourceAttributes(definition),
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
})));
|
|
134
|
+
}
|
|
135
|
+
async patchDataSource(id, patch) {
|
|
136
|
+
return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_PatchEntityDataSources(client.axios, client.basePath, {
|
|
137
|
+
id,
|
|
138
|
+
jsonApiDataSourcePatchDocument: {
|
|
139
|
+
data: {
|
|
140
|
+
id: patch.id,
|
|
141
|
+
type: "dataSource",
|
|
142
|
+
attributes: toDataSourceAttributes(patch),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
})));
|
|
146
|
+
}
|
|
147
|
+
async deleteDataSource(id) {
|
|
148
|
+
await this.authCall((client) => EntitiesApi_DeleteEntityDataSources(client.axios, client.basePath, { id }));
|
|
149
|
+
}
|
|
150
|
+
async testConnection(connection, dataSourceId) {
|
|
151
|
+
// The model type also lists data source types that this backend does not support.
|
|
152
|
+
// The backend rejects them, so the cast does not hide an error.
|
|
153
|
+
const request = connection;
|
|
154
|
+
try {
|
|
155
|
+
return await this.authCall(async (client) => {
|
|
156
|
+
const result = dataSourceId
|
|
157
|
+
? await ScanModelApi_TestDataSource(client.axios, client.basePath, {
|
|
158
|
+
dataSourceId,
|
|
159
|
+
testRequest: request,
|
|
160
|
+
})
|
|
161
|
+
: await ScanModelApi_TestDataSourceDefinition(client.axios, client.basePath, {
|
|
162
|
+
testDefinitionRequest: request,
|
|
163
|
+
});
|
|
164
|
+
return { successful: result.data.successful, error: result.data.error };
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
return { successful: false, error: getDataSourceErrorMessage(error) };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async getSchemata(dataSourceId) {
|
|
172
|
+
return this.authCall(async (client) => {
|
|
173
|
+
const result = await ScanModelApi_GetDataSourceSchemata(client.axios, client.basePath, {
|
|
174
|
+
dataSourceId,
|
|
175
|
+
});
|
|
176
|
+
return result.data.schemaNames;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
async registerUploadNotification(dataSourceId) {
|
|
180
|
+
await this.authCall((client) => ActionsApi_RegisterUploadNotification(client.axios, client.basePath, { dataSourceId }));
|
|
181
|
+
}
|
|
182
|
+
async getDataSourceIdentifier(id) {
|
|
183
|
+
return this.authCall(async (client) => {
|
|
184
|
+
const response = await EntitiesApi_GetEntityDataSourceIdentifiers(client.axios, client.basePath, {
|
|
185
|
+
id,
|
|
186
|
+
metaInclude: ["permissions"],
|
|
187
|
+
});
|
|
188
|
+
return convertDataSourceIdentifierWithPermissions(response.data.data);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async scan(dataSourceId, request) {
|
|
192
|
+
return this.authCall(async (client) => {
|
|
193
|
+
const response = await ScanModelApi_ScanDataSource(client.axios, client.basePath, {
|
|
194
|
+
dataSourceId,
|
|
195
|
+
scanRequest: convertScanRequest(request),
|
|
196
|
+
});
|
|
197
|
+
return convertScanResult(response.data);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
async scanSql(dataSourceId, sql) {
|
|
201
|
+
return this.authCall(async (client) => {
|
|
202
|
+
const response = await ScanModelApi_ScanSql(client.axios, client.basePath, {
|
|
203
|
+
dataSourceId,
|
|
204
|
+
scanSqlRequest: { sql },
|
|
205
|
+
});
|
|
206
|
+
return convertSqlScanResult(response.data);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
async generateLogicalModel(dataSourceId, request) {
|
|
210
|
+
return this.authCall(async (client) => {
|
|
211
|
+
const response = await ActionsApi_GenerateLogicalModel(client.axios, client.basePath, {
|
|
212
|
+
dataSourceId,
|
|
213
|
+
generateLdmRequest: convertGenerateLogicalModelRequest(request),
|
|
214
|
+
});
|
|
215
|
+
return convertDeclarativeLdm(response.data.ldm);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
files() {
|
|
219
|
+
return new TigerDataSourceFilesService(this.authCall);
|
|
220
|
+
}
|
|
221
|
+
async toDescriptor(call) {
|
|
222
|
+
const result = await call();
|
|
223
|
+
return convertDataSource(result.data);
|
|
224
|
+
}
|
|
25
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../src/backend/features/feature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,kBAAkB,EAAsB,MAAM,kBAAkB,CAAC;AAInG,MAAM,MAAM,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,OAAO,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,KAAK,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAErD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../src/backend/features/feature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,kBAAkB,EAAsB,MAAM,kBAAkB,CAAC;AAInG,MAAM,MAAM,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,OAAO,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,KAAK,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAErD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAw5B9E"}
|
|
@@ -131,6 +131,7 @@ export function mapFeatures(features) {
|
|
|
131
131
|
...loadFeature(features, TigerFeaturesNames.EnableBusinessBriefingReportsApp, "enableBusinessBriefingReportsApp", "BOOLEAN", FeatureFlagsValues.enableBusinessBriefingReportsApp),
|
|
132
132
|
...loadFeature(features, TigerFeaturesNames.EnableReportsSubsections, "enableReportsSubsections", "BOOLEAN", FeatureFlagsValues.enableReportsSubsections),
|
|
133
133
|
...loadFeature(features, TigerFeaturesNames.EnablePublisherV2, "enablePublisherV2", "BOOLEAN", FeatureFlagsValues.enablePublisherV2),
|
|
134
|
+
...loadFeature(features, TigerFeaturesNames.EnableGenAiReportTakeaways, "enableGenAiReportTakeaways", "BOOLEAN", FeatureFlagsValues.enableGenAiReportTakeaways),
|
|
134
135
|
...loadFeature(features, TigerFeaturesNames.EnableEmbeddingWriteCommands, "enableEmbeddingWriteCommands", "BOOLEAN", FeatureFlagsValues.enableEmbeddingWriteCommands),
|
|
135
136
|
...loadFeature(features, TigerFeaturesNames.EnableLocalizationOverview, "enableLocalizationOverview", "BOOLEAN", FeatureFlagsValues.enableLocalizationOverview),
|
|
136
137
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ILocalizationPageQuery, type ILocalizationResolvedValue, type ILocalizationStatistics, type ILocalizationStatisticsWorkspace, type ILocalizationTranslationUsage, type ILocalizationUsage, type ILocalizationUsageListQuery, type ILocalizationUsageUser, type ILocalizationUsageWorkspace, type LocalizationSettingType, type LocalizationTranslatedSettingType } from "@gooddata/sdk-backend-spi";
|
|
1
|
+
import { type ILocalizationPageQuery, type ILocalizationResolvedValue, type ILocalizationStatistics, type ILocalizationStatisticsWorkspace, type ILocalizationTranslationUsage, type ILocalizationUsage, type ILocalizationUsageListQuery, type ILocalizationUsageUser, type ILocalizationUsageWorkspace, type LocalizationSettingType, type LocalizationTranslatedSettingType, type LocalizationUsageSource } from "@gooddata/sdk-backend-spi";
|
|
2
2
|
import { type IFixturePerson, type IFixtureWorkspace } from "./fixture.js";
|
|
3
3
|
type ResolvedSettings = Partial<Record<LocalizationSettingType, ILocalizationResolvedValue>>;
|
|
4
4
|
export interface IUsageScope {
|
|
@@ -18,6 +18,9 @@ export interface IUsageScope {
|
|
|
18
18
|
export declare function translationUsage(scope: IUsageScope): ILocalizationTranslationUsage;
|
|
19
19
|
export declare function translatedLocalesOf(workspaces: IFixtureWorkspace[], statistics: ILocalizationStatisticsWorkspace[]): (workspaceId: string, setting: LocalizationTranslatedSettingType) => ReadonlySet<string>;
|
|
20
20
|
export declare function summarize(scope: IUsageScope, peopleWithoutValue: "own" | "effective"): ILocalizationUsage;
|
|
21
|
+
export declare function matchesName(name: string | undefined, candidates: Array<string | undefined>): boolean;
|
|
22
|
+
export declare function matches(settings: ResolvedSettings, query: ILocalizationUsageListQuery): LocalizationUsageSource | undefined;
|
|
23
|
+
export declare function page<T>(items: T[], query: ILocalizationPageQuery): T[];
|
|
21
24
|
export declare function usageWorkspaces(scope: IUsageScope, query: ILocalizationUsageListQuery): {
|
|
22
25
|
workspaces: ILocalizationUsageWorkspace[];
|
|
23
26
|
totalCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../../src/backend/localization/aggregate.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,EAErC,KAAK,6BAA6B,EAElC,KAAK,kBAAkB,EAEvB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAEhC,KAAK,uBAAuB,EAC5B,KAAK,iCAAiC,
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../../src/backend/localization/aggregate.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,EAErC,KAAK,6BAA6B,EAElC,KAAK,kBAAkB,EAEvB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAEhC,KAAK,uBAAuB,EAC5B,KAAK,iCAAiC,EAEtC,KAAK,uBAAuB,EAC/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEzB,MAAM,cAAc,CAAC;AAYtB,KAAK,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAM7F,MAAM,WAAW,WAAW;IACxB,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,MAAM,EAAE,KAAK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C;IAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAqBzD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,gCAAgC,EAAE,GAAG,uBAAuB,CAYnG;AAED,wBAAgB,cAAc,CAC1B,IAAI,EAAE,gCAAgC,EAAE,EACxC,KAAK,EAAE,sBAAsB,GAC9B;IAAE,UAAU,EAAE,gCAAgC,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAExE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAIpE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAOxG"}
|
|
@@ -175,7 +175,11 @@ export function summarize(scope, peopleWithoutValue) {
|
|
|
175
175
|
}
|
|
176
176
|
return { defaults: FIXTURE_DEFAULTS, values: [...entries.values()] };
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
export function matchesName(name, candidates) {
|
|
179
|
+
const term = name?.toLowerCase();
|
|
180
|
+
return !term || candidates.some((candidate) => candidate?.toLowerCase().includes(term));
|
|
181
|
+
}
|
|
182
|
+
export function matches(settings, query) {
|
|
179
183
|
const types = query.setting ? [query.setting] : LOCALIZATION_SETTINGS;
|
|
180
184
|
const sources = types
|
|
181
185
|
.map((type) => settings[type])
|
|
@@ -187,7 +191,7 @@ function matches(settings, query) {
|
|
|
187
191
|
const source = strongest(sources);
|
|
188
192
|
return query.source === undefined || query.source === source ? source : undefined;
|
|
189
193
|
}
|
|
190
|
-
function page(items, query) {
|
|
194
|
+
export function page(items, query) {
|
|
191
195
|
const size = query.size ?? DEFAULT_PAGE_SIZE;
|
|
192
196
|
const start = (query.page ?? 0) * size;
|
|
193
197
|
return items.slice(start, start + size);
|
|
@@ -213,6 +217,7 @@ export function usageWorkspaces(scope, query) {
|
|
|
213
217
|
: matches(workspace.settings, query),
|
|
214
218
|
}))
|
|
215
219
|
.filter((row) => !!row.source)
|
|
220
|
+
.filter(({ workspace }) => matchesName(query.name, [workspace.name]))
|
|
216
221
|
.map(({ workspace, source }) => ({
|
|
217
222
|
id: workspace.id,
|
|
218
223
|
name: workspace.name,
|
|
@@ -234,6 +239,7 @@ export function usageUsers(scope, query) {
|
|
|
234
239
|
: matches(person.settings, query),
|
|
235
240
|
}))
|
|
236
241
|
.filter((row) => Boolean(row.source))
|
|
242
|
+
.filter(({ person }) => matchesName(query.name, [person.name, person.email, person.id]))
|
|
237
243
|
.map(({ person, source }) => ({
|
|
238
244
|
id: person.id,
|
|
239
245
|
name: person.name,
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { type LocalizationStatistics, type LocalizationUsage, type LocalizationUsageUsers, type LocalizationUsageWorkspaces } from "@gooddata/api-client-tiger";
|
|
2
|
-
import { type ILocalizationStatistics, type ILocalizationUsage, type ILocalizationUsageUsersPage, type ILocalizationUsageWorkspacesPage } from "@gooddata/sdk-backend-spi";
|
|
1
|
+
import { type LocalizationStatistics, type LocalizationUsage, type LocalizationUsageUsers, type LocalizationUsageWorkspaces, type WorkspaceLocalizationUsage } from "@gooddata/api-client-tiger";
|
|
2
|
+
import { type ILocalizationStatistics, type ILocalizationUsage, type ILocalizationUsageListQuery, type ILocalizationUsageUsersPage, type ILocalizationUsageWorkspacesPage } from "@gooddata/sdk-backend-spi";
|
|
3
3
|
export declare function convertLocalizationUsage(usage: LocalizationUsage): ILocalizationUsage;
|
|
4
|
+
export declare function convertWorkspaceLocalizationUsage(usage: WorkspaceLocalizationUsage): ILocalizationUsage;
|
|
4
5
|
export declare function convertLocalizationUsageWorkspaces(page: LocalizationUsageWorkspaces): ILocalizationUsageWorkspacesPage;
|
|
5
6
|
export declare function convertLocalizationUsageUsers(page: LocalizationUsageUsers): ILocalizationUsageUsersPage;
|
|
6
7
|
export declare function convertLocalizationStatistics(statistics: LocalizationStatistics): ILocalizationStatistics;
|
|
8
|
+
export interface IWorkspaceLocalizationDescriptor {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
parentId: string | null;
|
|
12
|
+
parentName?: string;
|
|
13
|
+
childrenCount: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function convertWorkspaceLocalizationUsageWorkspaces(usage: WorkspaceLocalizationUsage, workspace: IWorkspaceLocalizationDescriptor, query: ILocalizationUsageListQuery, originNames?: ReadonlyMap<string, string>): ILocalizationUsageWorkspacesPage;
|
|
16
|
+
export declare function originIdsOf(usage: WorkspaceLocalizationUsage): string[];
|
|
7
17
|
//# sourceMappingURL=fromBackend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromBackend.d.ts","sourceRoot":"","sources":["../../../src/backend/localization/fromBackend.ts"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,
|
|
1
|
+
{"version":3,"file":"fromBackend.d.ts","sourceRoot":"","sources":["../../../src/backend/localization/fromBackend.ts"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAE3B,KAAK,2BAA2B,EAEhC,KAAK,0BAA0B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIH,KAAK,uBAAuB,EAE5B,KAAK,kBAAkB,EAEvB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EAIxC,MAAM,2BAA2B,CAAC;AA8DnC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CASrF;AAGD,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,0BAA0B,GAAG,kBAAkB,CASvG;AAED,wBAAgB,kCAAkC,CAC9C,IAAI,EAAE,2BAA2B,GAClC,gCAAgC,CAYlC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,sBAAsB,GAAG,2BAA2B,CAWvG;AAMD,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,sBAAsB,GAAG,uBAAuB,CAKzG;AAED,MAAM,WAAW,gCAAgC;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACzB;AAGD,wBAAgB,2CAA2C,CACvD,KAAK,EAAE,0BAA0B,EACjC,SAAS,EAAE,gCAAgC,EAC3C,KAAK,EAAE,2BAA2B,EAClC,WAAW,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GACrD,gCAAgC,CAclC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,0BAA0B,GAAG,MAAM,EAAE,CAGvE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { matches, matchesName, page } from "./aggregate.js";
|
|
2
3
|
const SETTINGS = ["LOCALE", "METADATA_LOCALE", "DATA_LOCALE"];
|
|
3
4
|
function convertContent(content) {
|
|
4
5
|
return { value: content.value ?? null };
|
|
@@ -32,6 +33,18 @@ function convertBySetting(bySetting, convert) {
|
|
|
32
33
|
}
|
|
33
34
|
return result;
|
|
34
35
|
}
|
|
36
|
+
function convertUsageValue(value) {
|
|
37
|
+
return {
|
|
38
|
+
content: convertContent(value.content),
|
|
39
|
+
workspaces: convertCount(value.workspaces),
|
|
40
|
+
users: convertCount(value.users),
|
|
41
|
+
bySetting: convertBySetting(value.bySetting, convertSettingUsage),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// A setting without a value has no default, like an organization setting that nothing sets.
|
|
45
|
+
function convertWorkspaceSetting(value) {
|
|
46
|
+
return value.content.value ? { content: convertContent(value.content), source: value.source } : null;
|
|
47
|
+
}
|
|
35
48
|
export function convertLocalizationUsage(usage) {
|
|
36
49
|
return {
|
|
37
50
|
defaults: {
|
|
@@ -39,12 +52,18 @@ export function convertLocalizationUsage(usage) {
|
|
|
39
52
|
METADATA_LOCALE: convertDefault(usage.defaults.METADATA_LOCALE),
|
|
40
53
|
DATA_LOCALE: convertDefault(usage.defaults.DATA_LOCALE),
|
|
41
54
|
},
|
|
42
|
-
values: usage.values.map(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
values: usage.values.map(convertUsageValue),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// The defaults of a workspace are the values it gets: set on it, inherited, or the organization defaults.
|
|
59
|
+
export function convertWorkspaceLocalizationUsage(usage) {
|
|
60
|
+
return {
|
|
61
|
+
defaults: {
|
|
62
|
+
LOCALE: convertWorkspaceSetting(usage.settings.LOCALE),
|
|
63
|
+
METADATA_LOCALE: convertWorkspaceSetting(usage.settings.METADATA_LOCALE),
|
|
64
|
+
DATA_LOCALE: convertWorkspaceSetting(usage.settings.DATA_LOCALE),
|
|
65
|
+
},
|
|
66
|
+
values: usage.values.map(convertUsageValue),
|
|
48
67
|
};
|
|
49
68
|
}
|
|
50
69
|
export function convertLocalizationUsageWorkspaces(page) {
|
|
@@ -81,3 +100,23 @@ export function convertLocalizationStatistics(statistics) {
|
|
|
81
100
|
data: { locales: statistics.data.locales.map(convertTranslatedLocale) },
|
|
82
101
|
};
|
|
83
102
|
}
|
|
103
|
+
// The list of one workspace holds the workspace itself, when the query matches the values it gets.
|
|
104
|
+
export function convertWorkspaceLocalizationUsageWorkspaces(usage, workspace, query, originNames = new Map()) {
|
|
105
|
+
const bySetting = convertBySetting(usage.settings, (value) => {
|
|
106
|
+
const resolved = convertResolvedValue(value);
|
|
107
|
+
const originName = resolved.originId ? originNames.get(resolved.originId) : undefined;
|
|
108
|
+
return originName ? { ...resolved, originName } : resolved;
|
|
109
|
+
});
|
|
110
|
+
const source = matchesName(query.name, [workspace.name]) ? matches(bySetting, query) : undefined;
|
|
111
|
+
if (!source) {
|
|
112
|
+
return { workspaces: [], totalCount: 0 };
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
totalCount: 1,
|
|
116
|
+
workspaces: page([{ ...workspace, source, bySetting }], query),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function originIdsOf(usage) {
|
|
120
|
+
const ids = Object.values(usage.settings).flatMap((value) => (value?.originId ? [value.originId] : []));
|
|
121
|
+
return [...new Set(ids)];
|
|
122
|
+
}
|
|
@@ -27,6 +27,9 @@ export declare class TigerWorkspaceLocalizationService extends FixtureLocalizati
|
|
|
27
27
|
constructor(authCall: TigerAuthenticatedCallGuard, workspaceId: string);
|
|
28
28
|
private scope;
|
|
29
29
|
private statisticsRows;
|
|
30
|
+
private loadUsage;
|
|
31
|
+
private loadWorkspace;
|
|
32
|
+
private loadWorkspaceNames;
|
|
30
33
|
getUsage(): Promise<ILocalizationUsage>;
|
|
31
34
|
getUsageWorkspaces(query?: ILocalizationUsageListQuery): Promise<ILocalizationUsageWorkspacesPage>;
|
|
32
35
|
getUsageUsers(query?: ILocalizationUsageListQuery): Promise<ILocalizationUsageUsersPage>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/localization/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/localization/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,EACrC,KAAK,qCAAqC,EAC1C,KAAK,6BAA6B,EAClC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EACrC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,sBAAsB,CA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