@gooddata/sdk-backend-tiger 11.64.0-alpha.0 → 11.64.0-alpha.2

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.
Files changed (58) hide show
  1. package/esm/__version.d.ts +1 -1
  2. package/esm/__version.js +1 -1
  3. package/esm/backend/dataSources/files.d.ts +16 -0
  4. package/esm/backend/dataSources/files.d.ts.map +1 -0
  5. package/esm/backend/dataSources/files.js +133 -0
  6. package/esm/backend/dataSources/index.d.ts +14 -2
  7. package/esm/backend/dataSources/index.d.ts.map +1 -1
  8. package/esm/backend/dataSources/index.js +163 -2
  9. package/esm/backend/index.d.ts +1 -1
  10. package/esm/backend/localization/aggregate.d.ts +3 -1
  11. package/esm/backend/localization/aggregate.d.ts.map +1 -1
  12. package/esm/backend/localization/aggregate.js +2 -2
  13. package/esm/backend/localization/fromBackend.d.ts +12 -2
  14. package/esm/backend/localization/fromBackend.d.ts.map +1 -1
  15. package/esm/backend/localization/fromBackend.js +45 -6
  16. package/esm/backend/localization/index.d.ts +3 -0
  17. package/esm/backend/localization/index.d.ts.map +1 -1
  18. package/esm/backend/localization/index.js +52 -8
  19. package/esm/backend/organization/cspDirectives.d.ts +13 -0
  20. package/esm/backend/organization/cspDirectives.d.ts.map +1 -0
  21. package/esm/backend/organization/cspDirectives.js +53 -0
  22. package/esm/backend/organization/index.d.ts +4 -2
  23. package/esm/backend/organization/index.d.ts.map +1 -1
  24. package/esm/backend/organization/index.js +23 -9
  25. package/esm/backend/organization/users.d.ts +2 -1
  26. package/esm/backend/organization/users.d.ts.map +1 -1
  27. package/esm/backend/organization/users.js +12 -0
  28. package/esm/backend/settings/mapping.js +1 -0
  29. package/esm/backend/tigerSpecificFunctions.d.ts +38 -1
  30. package/esm/backend/tigerSpecificFunctions.d.ts.map +1 -1
  31. package/esm/backend/tigerSpecificFunctions.js +1 -16
  32. package/esm/backend/tigerSpecificFunctionsProxy.d.ts +2 -2
  33. package/esm/backend/tigerSpecificFunctionsProxy.js +1 -1
  34. package/esm/backend/user/apiTokens.d.ts +11 -0
  35. package/esm/backend/user/apiTokens.d.ts.map +1 -0
  36. package/esm/backend/user/apiTokens.js +38 -0
  37. package/esm/backend/user/index.d.ts +2 -1
  38. package/esm/backend/user/index.d.ts.map +1 -1
  39. package/esm/backend/user/index.js +4 -0
  40. package/esm/backend/workspace/dataFilters/index.d.ts +2 -1
  41. package/esm/backend/workspace/dataFilters/index.d.ts.map +1 -1
  42. package/esm/backend/workspace/dataFilters/index.js +34 -0
  43. package/esm/backend/workspace/genAI/ChatConversations.d.ts +3 -3
  44. package/esm/backend/workspace/genAI/ChatConversations.d.ts.map +1 -1
  45. package/esm/backend/workspace/genAI/ChatConversations.js +26 -4
  46. package/esm/backend/workspace/index.d.ts +1 -0
  47. package/esm/backend/workspace/index.d.ts.map +1 -1
  48. package/esm/backend/workspace/index.js +4 -1
  49. package/esm/backend/workspaces/index.d.ts +2 -1
  50. package/esm/backend/workspaces/index.d.ts.map +1 -1
  51. package/esm/backend/workspaces/index.js +23 -1
  52. package/esm/convertors/fromBackend/genAIConvertor.d.ts.map +1 -1
  53. package/esm/convertors/fromBackend/genAIConvertor.js +11 -0
  54. package/esm/sdk-backend-tiger.d.ts +40 -2
  55. package/esm/utils/apiProblemDetail.d.ts +3 -0
  56. package/esm/utils/apiProblemDetail.d.ts.map +1 -0
  57. package/esm/utils/apiProblemDetail.js +19 -0
  58. package/package.json +11 -11
@@ -1,4 +1,4 @@
1
- export declare const LIB_VERSION = "11.64.0-alpha.0";
1
+ export declare const LIB_VERSION = "11.64.0-alpha.2";
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.0";
3
+ export const LIB_VERSION = "11.64.0-alpha.2";
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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Csv, 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,21 @@
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 } 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
+ files(): IDataSourceFilesService;
19
+ private toDescriptor;
8
20
  }
9
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/dataSources/index.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EAAE,MAAM,EACV,UAAU,EAAE,qBAAqB,GAClC,OAAO,CAAC,qBAAqB,CAAC,CAehC;IAEY,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAehG;IAEY,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvD;IAEY,cAAc,CACvB,UAAU,EAAE,yBAAyB,EACrC,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,+BAA+B,CAAC,CAmB1C;IAEY,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOhE;IAEY,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3E;IAEM,KAAK,IAAI,uBAAuB,CAEtC;YAEa,YAAY;CAM7B"}
@@ -1,6 +1,11 @@
1
1
  // (C) 2021-2026 GoodData Corporation
2
- import { ActionsUtilities } from "@gooddata/api-client-tiger";
3
- import { EntitiesApi_GetAllEntitiesDataSourceIdentifiers } from "@gooddata/api-client-tiger/endpoints/entitiesObjects";
2
+ import { ActionsUtilities, OrganizationUtilities, } from "@gooddata/api-client-tiger";
3
+ import { ActionsApi_RegisterUploadNotification } from "@gooddata/api-client-tiger/endpoints/actions";
4
+ import { EntitiesApi_CreateEntityDataSources, EntitiesApi_DeleteEntityDataSources, EntitiesApi_GetAllEntitiesDataSourceIdentifiers, EntitiesApi_GetAllEntitiesDataSources, EntitiesApi_GetEntityDataSources, EntitiesApi_PatchEntityDataSources, EntitiesApi_UpdateEntityDataSources, } from "@gooddata/api-client-tiger/endpoints/entitiesObjects";
5
+ import { ScanModelApi_GetDataSourceSchemata, ScanModelApi_TestDataSource, ScanModelApi_TestDataSourceDefinition, } from "@gooddata/api-client-tiger/endpoints/scanModel";
6
+ import { isNotAuthenticated, } from "@gooddata/sdk-backend-spi";
7
+ import { getDataSourceErrorMessage } from "../../utils/apiProblemDetail.js";
8
+ import { TigerDataSourceFilesService } from "./files.js";
4
9
  function convertdataSourceIdentifier(dataSource) {
5
10
  return {
6
11
  id: dataSource.id,
@@ -9,6 +14,60 @@ function convertdataSourceIdentifier(dataSource) {
9
14
  type: dataSource.attributes.type,
10
15
  };
11
16
  }
17
+ function convertDataSourceIdentifierWithPermissions(dataSource) {
18
+ return {
19
+ ...convertdataSourceIdentifier(dataSource),
20
+ permissions: dataSource.meta?.permissions ?? [],
21
+ };
22
+ }
23
+ function convertDataSource({ data }) {
24
+ const { attributes } = data;
25
+ return {
26
+ id: data.id,
27
+ type: attributes.type,
28
+ name: attributes.name,
29
+ schema: attributes.schema,
30
+ username: attributes.username ?? undefined,
31
+ url: attributes.url,
32
+ clientId: attributes.clientId ?? undefined,
33
+ permissions: data.meta?.permissions ?? [],
34
+ parameters: attributes.parameters,
35
+ decodedParameters: attributes.decodedParameters,
36
+ cacheStrategy: attributes.cacheStrategy,
37
+ cacheRetention: attributes.cacheRetention,
38
+ authenticationType: attributes.authenticationType,
39
+ dateTimeSemantics: attributes.dateTimeSemantics,
40
+ alternativeDataSourceId: attributes.alternativeDataSourceId,
41
+ disableStatistics: attributes.disableStatistics,
42
+ ignoreJwtAud: attributes.ignoreJwtAud,
43
+ };
44
+ }
45
+ function toDataSourceAttributes(dataSource) {
46
+ const attributes = {
47
+ name: dataSource.name,
48
+ password: dataSource.password,
49
+ schema: dataSource.schema,
50
+ token: dataSource.token,
51
+ type: dataSource.type,
52
+ url: dataSource.url,
53
+ username: dataSource.username,
54
+ parameters: dataSource.parameters,
55
+ cacheStrategy: dataSource.cacheStrategy,
56
+ cacheRetention: dataSource.cacheRetention,
57
+ privateKey: dataSource.privateKey,
58
+ privateKeyPassphrase: dataSource.privateKeyPassphrase,
59
+ clientId: dataSource.clientId,
60
+ clientSecret: dataSource.clientSecret,
61
+ dateTimeSemantics: dataSource.dateTimeSemantics,
62
+ authenticationType: dataSource.authenticationType,
63
+ alternativeDataSourceId: dataSource.alternativeDataSourceId,
64
+ disableStatistics: dataSource.disableStatistics,
65
+ ignoreJwtAud: dataSource.ignoreJwtAud,
66
+ };
67
+ // The model type also lists data source types that this backend does not support,
68
+ // and a patch can omit the required attributes. The backend validates both.
69
+ return attributes;
70
+ }
12
71
  export class TigerDataSourcesService {
13
72
  authCall;
14
73
  constructor(authCall) {
@@ -22,4 +81,106 @@ export class TigerDataSourcesService {
22
81
  }).then((response) => response.data.data.map(convertdataSourceIdentifier)));
23
82
  });
24
83
  }
84
+ async getDataSources() {
85
+ return this.authCall(async (client) => {
86
+ const result = await OrganizationUtilities.getAllPagesOf(client, EntitiesApi_GetAllEntitiesDataSourceIdentifiers, { sort: ["name"], metaInclude: ["permissions"] }).then(OrganizationUtilities.mergeEntitiesResults);
87
+ return result.data.map(convertDataSourceIdentifierWithPermissions);
88
+ });
89
+ }
90
+ async hasDataSources() {
91
+ try {
92
+ return await this.authCall(async (client) => {
93
+ const result = await EntitiesApi_GetAllEntitiesDataSources(client.axios, client.basePath, {
94
+ size: 1,
95
+ });
96
+ return result.data.data.length > 0;
97
+ });
98
+ }
99
+ catch (error) {
100
+ if (isNotAuthenticated(error)) {
101
+ throw error;
102
+ }
103
+ return false;
104
+ }
105
+ }
106
+ async getDataSource(id) {
107
+ return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_GetEntityDataSources(client.axios, client.basePath, { id })));
108
+ }
109
+ async createDataSource(definition) {
110
+ return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_CreateEntityDataSources(client.axios, client.basePath, {
111
+ jsonApiDataSourceInDocument: {
112
+ data: {
113
+ id: definition.id,
114
+ type: "dataSource",
115
+ attributes: toDataSourceAttributes(definition),
116
+ },
117
+ },
118
+ })));
119
+ }
120
+ async updateDataSource(id, definition) {
121
+ return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_UpdateEntityDataSources(client.axios, client.basePath, {
122
+ id,
123
+ jsonApiDataSourceInDocument: {
124
+ data: {
125
+ id: definition.id,
126
+ type: "dataSource",
127
+ attributes: toDataSourceAttributes(definition),
128
+ },
129
+ },
130
+ })));
131
+ }
132
+ async patchDataSource(id, patch) {
133
+ return this.toDescriptor(async () => this.authCall((client) => EntitiesApi_PatchEntityDataSources(client.axios, client.basePath, {
134
+ id,
135
+ jsonApiDataSourcePatchDocument: {
136
+ data: {
137
+ id: patch.id,
138
+ type: "dataSource",
139
+ attributes: toDataSourceAttributes(patch),
140
+ },
141
+ },
142
+ })));
143
+ }
144
+ async deleteDataSource(id) {
145
+ await this.authCall((client) => EntitiesApi_DeleteEntityDataSources(client.axios, client.basePath, { id }));
146
+ }
147
+ async testConnection(connection, dataSourceId) {
148
+ // The model type also lists data source types that this backend does not support.
149
+ // The backend rejects them, so the cast does not hide an error.
150
+ const request = connection;
151
+ try {
152
+ return await this.authCall(async (client) => {
153
+ const result = dataSourceId
154
+ ? await ScanModelApi_TestDataSource(client.axios, client.basePath, {
155
+ dataSourceId,
156
+ testRequest: request,
157
+ })
158
+ : await ScanModelApi_TestDataSourceDefinition(client.axios, client.basePath, {
159
+ testDefinitionRequest: request,
160
+ });
161
+ return { successful: result.data.successful, error: result.data.error };
162
+ });
163
+ }
164
+ catch (error) {
165
+ return { successful: false, error: getDataSourceErrorMessage(error) };
166
+ }
167
+ }
168
+ async getSchemata(dataSourceId) {
169
+ return this.authCall(async (client) => {
170
+ const result = await ScanModelApi_GetDataSourceSchemata(client.axios, client.basePath, {
171
+ dataSourceId,
172
+ });
173
+ return result.data.schemaNames;
174
+ });
175
+ }
176
+ async registerUploadNotification(dataSourceId) {
177
+ await this.authCall((client) => ActionsApi_RegisterUploadNotification(client.axios, client.basePath, { dataSourceId }));
178
+ }
179
+ files() {
180
+ return new TigerDataSourceFilesService(this.authCall);
181
+ }
182
+ async toDescriptor(call) {
183
+ const result = await call();
184
+ return convertDataSource(result.data);
185
+ }
25
186
  }
@@ -37,7 +37,7 @@ export type TigerBackendConfig = {
37
37
  */
38
38
  type TigerSpecificFunctionsSubscription = {
39
39
  /**
40
- * @deprecated - use internal_backendSpecificFunctions instead
40
+ * @deprecated Tiger-specific functions are legacy and will be removed in the next major version. Use the services of IAnalyticalBackend instead.
41
41
  */
42
42
  onTigerSpecificFunctionsReady?: (functions: TigerSpecificFunctions) => void;
43
43
  onContractExpired?: (tier: string) => void;
@@ -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,8 @@ 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 matches(settings: ResolvedSettings, query: ILocalizationUsageListQuery): LocalizationUsageSource | undefined;
22
+ export declare function page<T>(items: T[], query: ILocalizationPageQuery): T[];
21
23
  export declare function usageWorkspaces(scope: IUsageScope, query: ILocalizationUsageListQuery): {
22
24
  workspaces: ILocalizationUsageWorkspace[];
23
25
  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,EAGzC,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,CAAC,cAAc,GAAG;QAAE,QAAQ,EAAE,gBAAgB,CAAA;KAAE,CAAC,CAAC;IAC/D;;OAEG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAChB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,iCAAiC,KACzC,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B;AA4CD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,6BAA6B,CA2DlF;AAED,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,iBAAiB,EAAE,EAC/B,UAAU,EAAE,gCAAgC,EAAE,GAC/C,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,iCAAiC,KAAK,WAAW,CAAC,MAAM,CAAC,CAkB1F;AAgCD,wBAAgB,SAAS,CAAC,K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;AAED,wBAAgB,UAAU,CACtB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,2BAA2B,GACnC;IAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAoBzD;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,7 @@ export function summarize(scope, peopleWithoutValue) {
175
175
  }
176
176
  return { defaults: FIXTURE_DEFAULTS, values: [...entries.values()] };
177
177
  }
178
- function matches(settings, query) {
178
+ export function matches(settings, query) {
179
179
  const types = query.setting ? [query.setting] : LOCALIZATION_SETTINGS;
180
180
  const sources = types
181
181
  .map((type) => settings[type])
@@ -187,7 +187,7 @@ function matches(settings, query) {
187
187
  const source = strongest(sources);
188
188
  return query.source === undefined || query.source === source ? source : undefined;
189
189
  }
190
- function page(items, query) {
190
+ export function page(items, query) {
191
191
  const size = query.size ?? DEFAULT_PAGE_SIZE;
192
192
  const start = (query.page ?? 0) * size;
193
193
  return items.slice(start, start + size);
@@ -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,EAC3B,KAAK,2BAA2B,EAEnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIH,KAAK,uBAAuB,EAE5B,KAAK,kBAAkB,EAEvB,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EAGxC,MAAM,2BAA2B,CAAC;AA8CnC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,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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, 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((value) => ({
43
- content: convertContent(value.content),
44
- workspaces: convertCount(value.workspaces),
45
- users: convertCount(value.users),
46
- bySetting: convertBySetting(value.bySetting, convertSettingUsage),
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 = matches(bySetting, query);
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":"AAUA,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAA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CAAC,2BAA2B,CAAC,CAUtC;IAEY,aAAa,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAM7D;IAEY,mBAAmB,IAAI,OAAO,CAAC,6BAA6B,CAAC,CAEzE;IAEY,uBAAuB,CAChC,KAAK,GAAE,sBAA2B,GACnC,OAAO,CAAC,qCAAqC,CAAC,CAEhD;CACJ"}
@@ -1,10 +1,11 @@
1
1
  // (C) 2026 GoodData Corporation
2
2
  import { ActionsUtilities } from "@gooddata/api-client-tiger";
3
- import { ActionsApi_OrganizationLocalizationStatistics, ActionsApi_OrganizationLocalizationUsage, ActionsApi_OrganizationLocalizationUsageUsers, ActionsApi_OrganizationLocalizationUsageWorkspaces, } from "@gooddata/api-client-tiger/endpoints/actions";
4
- import { EntitiesApi_GetAllEntitiesWorkspaces } from "@gooddata/api-client-tiger/endpoints/entitiesObjects";
5
- import { effectiveSettings, ownSettings, statisticsPage, statisticsSummary, summarize, translatedLocalesOf, translationUsage, usageUsers, usageWorkspaces, } from "./aggregate.js";
3
+ import { ActionsApi_OrganizationLocalizationStatistics, ActionsApi_OrganizationLocalizationUsage, ActionsApi_OrganizationLocalizationUsageUsers, ActionsApi_OrganizationLocalizationUsageWorkspaces, ActionsApi_WorkspaceLocalizationStatistics, ActionsApi_WorkspaceLocalizationUsage, ActionsApi_WorkspaceLocalizationUsageUsers, } from "@gooddata/api-client-tiger/endpoints/actions";
4
+ import { EntitiesApi_GetAllEntitiesWorkspaces, EntitiesApi_GetEntityWorkspaces, } from "@gooddata/api-client-tiger/endpoints/entitiesObjects";
5
+ import { buildListClause } from "../common/filtering.js";
6
+ import { effectiveSettings, ownSettings, statisticsPage, translatedLocalesOf, translationUsage, usageUsers, usageWorkspaces, } from "./aggregate.js";
6
7
  import { acmePeople, acmeStatisticsWorkspaces, acmeWorkspaces } from "./fixture.js";
7
- import { convertLocalizationStatistics, convertLocalizationUsage, convertLocalizationUsageUsers, convertLocalizationUsageWorkspaces, } from "./fromBackend.js";
8
+ import { convertLocalizationStatistics, convertLocalizationUsage, convertLocalizationUsageUsers, convertLocalizationUsageWorkspaces, convertWorkspaceLocalizationUsage, convertWorkspaceLocalizationUsageWorkspaces, originIdsOf, } from "./fromBackend.js";
8
9
  async function loadRealWorkspaces(authCall) {
9
10
  return ActionsUtilities.loadAllPages(({ page, size }) => authCall((client) => EntitiesApi_GetAllEntitiesWorkspaces(client.axios, client.basePath, {
10
11
  page,
@@ -134,17 +135,60 @@ export class TigerWorkspaceLocalizationService extends FixtureLocalizationServic
134
135
  }
135
136
  return statistics.filter((row) => lineage.has(row.id));
136
137
  }
138
+ loadUsage() {
139
+ return this.authCall((client) => ActionsApi_WorkspaceLocalizationUsage(client.axios, client.basePath, {
140
+ workspaceId: this.workspaceId,
141
+ })).then((result) => result.data);
142
+ }
143
+ loadWorkspace() {
144
+ return this.authCall((client) => EntitiesApi_GetEntityWorkspaces(client.axios, client.basePath, {
145
+ id: this.workspaceId,
146
+ include: ["parent"],
147
+ metaInclude: ["hierarchy"],
148
+ })).then(({ data: document }) => {
149
+ const parentId = document.data.relationships?.parent?.data?.id ?? null;
150
+ const parent = document.included?.find((item) => item.id === parentId);
151
+ return {
152
+ id: document.data.id,
153
+ name: document.data.attributes?.name ?? document.data.id,
154
+ parentId,
155
+ parentName: parent?.attributes?.name ?? undefined,
156
+ childrenCount: document.data.meta?.hierarchy?.childrenCount ?? 0,
157
+ };
158
+ });
159
+ }
160
+ async loadWorkspaceNames(ids) {
161
+ const filter = buildListClause("id", "in", ids);
162
+ if (!filter) {
163
+ return new Map();
164
+ }
165
+ const result = await this.authCall((client) => EntitiesApi_GetAllEntitiesWorkspaces(client.axios, client.basePath, { filter, size: ids.length }));
166
+ return new Map(result.data.data.map((item) => [item.id, item.attributes?.name ?? item.id]));
167
+ }
137
168
  async getUsage() {
138
- return summarize(await this.scope(), "effective");
169
+ return convertWorkspaceLocalizationUsage(await this.loadUsage());
139
170
  }
140
171
  async getUsageWorkspaces(query = {}) {
141
- return usageWorkspaces(await this.scope(), query);
172
+ if (query.translation) {
173
+ return usageWorkspaces(await this.scope(), query);
174
+ }
175
+ const [usage, workspace] = await Promise.all([this.loadUsage(), this.loadWorkspace()]);
176
+ const originNames = await this.loadWorkspaceNames(originIdsOf(usage));
177
+ return convertWorkspaceLocalizationUsageWorkspaces(usage, workspace, query, originNames);
142
178
  }
143
179
  async getUsageUsers(query = {}) {
144
- return usageUsers(await this.scope(), query);
180
+ if (query.translation) {
181
+ return usageUsers(await this.scope(), query);
182
+ }
183
+ return this.authCall((client) => ActionsApi_WorkspaceLocalizationUsageUsers(client.axios, client.basePath, {
184
+ ...query,
185
+ workspaceId: this.workspaceId,
186
+ })).then((result) => convertLocalizationUsageUsers(result.data));
145
187
  }
146
188
  async getStatistics() {
147
- return statisticsSummary(await this.statisticsRows());
189
+ return this.authCall((client) => ActionsApi_WorkspaceLocalizationStatistics(client.axios, client.basePath, {
190
+ workspaceId: this.workspaceId,
191
+ })).then((result) => convertLocalizationStatistics(result.data));
148
192
  }
149
193
  async getTranslationUsage() {
150
194
  return translationUsage(await this.scope());