@gooddata/sdk-backend-tiger 11.61.0-alpha.3 → 11.61.0-alpha.5
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/features/feature.js +1 -1
- package/esm/backend/organization/settings.d.ts +5 -5
- package/esm/backend/organization/settings.d.ts.map +1 -1
- package/esm/backend/settings/activeStyling.d.ts +16 -0
- package/esm/backend/settings/activeStyling.d.ts.map +1 -0
- package/esm/backend/settings/activeStyling.js +30 -0
- package/esm/backend/settings/mapping.d.ts +2 -2
- package/esm/backend/settings/mapping.d.ts.map +1 -1
- package/esm/backend/settings/settings.d.ts +0 -2
- package/esm/backend/settings/settings.d.ts.map +1 -1
- package/esm/backend/settings/settings.js +0 -6
- package/esm/backend/tigerSpecificFunctions.d.ts +1 -0
- package/esm/backend/tigerSpecificFunctions.d.ts.map +1 -1
- package/esm/backend/uiFeatures.d.ts +3 -3
- package/esm/backend/uiFeatures.d.ts.map +1 -1
- package/esm/backend/uiFeatures.js +3 -3
- package/esm/backend/user/settings.d.ts +5 -0
- package/esm/backend/user/settings.d.ts.map +1 -1
- package/esm/backend/user/settings.js +13 -0
- package/esm/backend/workspace/dashboards/referenceAvailability.d.ts +18 -10
- package/esm/backend/workspace/dashboards/referenceAvailability.d.ts.map +1 -1
- package/esm/backend/workspace/dashboards/referenceAvailability.js +52 -22
- package/esm/backend/workspace/genAI/index.d.ts +4 -1
- package/esm/backend/workspace/genAI/index.d.ts.map +1 -1
- package/esm/backend/workspace/genAI/index.js +36 -15
- package/esm/backend/workspace/measures/index.d.ts +2 -1
- package/esm/backend/workspace/measures/index.d.ts.map +1 -1
- package/esm/backend/workspace/measures/index.js +13 -1
- package/esm/backend/workspace/permissions/index.d.ts.map +1 -1
- package/esm/backend/workspace/permissions/index.js +5 -2
- package/esm/backend/workspace/settings/index.d.ts +0 -7
- package/esm/backend/workspace/settings/index.d.ts.map +1 -1
- package/esm/backend/workspace/settings/index.js +3 -25
- package/esm/backend/workspace/styling/index.d.ts +13 -10
- package/esm/backend/workspace/styling/index.d.ts.map +1 -1
- package/esm/backend/workspace/styling/index.js +49 -45
- package/esm/convertors/fromBackend/genAIConvertor.d.ts.map +1 -1
- package/esm/convertors/fromBackend/genAIConvertor.js +65 -20
- package/esm/convertors/fromBackend/reportPartConvertor.d.ts.map +1 -1
- package/esm/convertors/fromBackend/reportPartConvertor.js +1 -0
- package/esm/sdk-backend-tiger.d.ts +1 -0
- package/esm/types/index.d.ts +10 -2
- package/esm/types/index.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { FilterContextApi_GetAllEntitiesFilterContexts, isAfmObjectIdentifier, } from "@gooddata/api-client-tiger";
|
|
3
|
-
import { dashboardAttributeFilterItemDisplayForm, idRef, isComputedAttributeRef, isDashboardAttributeFilterItem, isIdentifierRef, } from "@gooddata/sdk-model";
|
|
3
|
+
import { dashboardAttributeFilterItemDisplayForm, dashboardAttributeFilterItemValidateElementsBy, idRef, isComputedAttributeRef, isDashboardAttributeFilterItem, isDashboardMeasureValueFilter, isIdentifierRef, } from "@gooddata/sdk-model";
|
|
4
4
|
import { getForbiddenReferences, getRelationshipIds, } from "../../../convertors/fromBackend/RestrictedReferencesConverter.js";
|
|
5
5
|
import { objectTypeToTigerIdType } from "../../../types/refTypeMapping.js";
|
|
6
6
|
/**
|
|
7
|
-
* The `include` value under which the dashboard GET links each
|
|
7
|
+
* The `include` value under which the dashboard GET links each type it can link; the same key names
|
|
8
8
|
* the relationship in the response, which keeps "inspected iff requested" structural.
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const DASHBOARD_RELATIONSHIP_KEYS = {
|
|
11
11
|
insight: "visualizationObjects",
|
|
12
12
|
dataSet: "datasets",
|
|
13
13
|
dashboardPlugin: "dashboardPlugins",
|
|
@@ -17,6 +17,13 @@ const RELATIONSHIP_KEYS = {
|
|
|
17
17
|
computedAttribute: "computedAttributes",
|
|
18
18
|
analyticalDashboard: "analyticalDashboards",
|
|
19
19
|
};
|
|
20
|
+
/** The same for the filter-context GET, which links the objects the filters use. */
|
|
21
|
+
const FILTER_CONTEXT_RELATIONSHIP_KEYS = {
|
|
22
|
+
displayForm: "labels",
|
|
23
|
+
computedAttribute: "computedAttributes",
|
|
24
|
+
measure: "metrics",
|
|
25
|
+
fact: "facts",
|
|
26
|
+
};
|
|
20
27
|
/**
|
|
21
28
|
* Collects the `{ identifier: { id, type } }` refs from stored content, grouped by tiger type.
|
|
22
29
|
* Content is free-form JSON, so the walk is structural, not schema-bound.
|
|
@@ -37,13 +44,13 @@ function collectContentRefIds(content, result = new Map()) {
|
|
|
37
44
|
Object.values(content).forEach((value) => collectContentRefIds(value, result));
|
|
38
45
|
return result;
|
|
39
46
|
}
|
|
40
|
-
function diffInspectedTypes(document, inspected) {
|
|
47
|
+
function diffInspectedTypes(document, relationshipKeys, inspected) {
|
|
41
48
|
const contentRefIds = collectContentRefIds(document.data.attributes?.content);
|
|
42
49
|
const unavailable = [];
|
|
43
50
|
for (const type of inspected) {
|
|
44
51
|
const tigerType = objectTypeToTigerIdType[type];
|
|
45
52
|
const selfId = document.data.type === tigerType ? document.data.id : undefined;
|
|
46
|
-
const related = getRelationshipIds(document.data.relationships,
|
|
53
|
+
const related = getRelationshipIds(document.data.relationships, relationshipKeys[type]);
|
|
47
54
|
unavailable.push(...getForbiddenReferences(type, related, document.meta?.restricted ?? [], selfId));
|
|
48
55
|
for (const id of contentRefIds.get(tigerType) ?? []) {
|
|
49
56
|
if (id !== selfId && !related.has(id)) {
|
|
@@ -61,8 +68,8 @@ function diffInspectedTypes(document, inspected) {
|
|
|
61
68
|
* Resolves which of the requested dashboard references are unavailable and why.
|
|
62
69
|
*/
|
|
63
70
|
export function resolveUnavailableReferences(document, types) {
|
|
64
|
-
const inspected = ["filterContext", ...types];
|
|
65
|
-
return diffInspectedTypes(document, inspected);
|
|
71
|
+
const inspected = ["filterContext", ...types].filter((type) => type in DASHBOARD_RELATIONSHIP_KEYS);
|
|
72
|
+
return diffInspectedTypes(document, DASHBOARD_RELATIONSHIP_KEYS, inspected);
|
|
66
73
|
}
|
|
67
74
|
/**
|
|
68
75
|
* Unavailable references of the effective dashboard: the stored document's diff, keeping only the
|
|
@@ -81,20 +88,21 @@ export function resolveUnavailableDashboardReferences(document, dashboard, types
|
|
|
81
88
|
return unavailable.filter((entry) => entry.type !== "filterContext" || (isIdentifierRef(entry.ref) && inUse.has(entry.ref.identifier)));
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
84
|
-
* Resolves which filter display forms
|
|
85
|
-
* unavailable. Each inspected type must have been requested as an include (`labels`,
|
|
86
|
-
* `computedAttributes`) so the response contains both relationship linkages and
|
|
87
|
-
* `meta.restricted` for it.
|
|
91
|
+
* Resolves which filter display forms, computed attributes, metrics and facts referenced by a filter
|
|
92
|
+
* context are unavailable. Each inspected type must have been requested as an include (`labels`,
|
|
93
|
+
* `computedAttributes`, `metrics`, `facts`) so the response contains both relationship linkages and
|
|
94
|
+
* document-level `meta.restricted` for it.
|
|
88
95
|
*/
|
|
89
96
|
export function resolveUnavailableFilterContextReferences(context, restricted, inspected) {
|
|
90
|
-
return diffInspectedTypes({ data: context, meta: { restricted } }, inspected);
|
|
97
|
+
return diffInspectedTypes({ data: context, meta: { restricted } }, FILTER_CONTEXT_RELATIONSHIP_KEYS, inspected);
|
|
91
98
|
}
|
|
92
99
|
/**
|
|
93
|
-
* Filter labels
|
|
94
|
-
* side-loads the filter contexts as bare items (no `relationships`), so the existence
|
|
95
|
-
* filter
|
|
96
|
-
* (and `computedAttributes`), hence this one batched extra request.
|
|
97
|
-
* only when a filter uses
|
|
100
|
+
* Filter labels, computed attributes, metrics and facts relate to their filter-context entities: the
|
|
101
|
+
* dashboard GET side-loads the filter contexts as bare items (no `relationships`), so the existence
|
|
102
|
+
* linkage for filter objects is reachable only through a direct filter-context GET with `include=labels`
|
|
103
|
+
* (and `computedAttributes`, `metrics`, `facts`), hence this one batched extra request. Types other than
|
|
104
|
+
* labels are included only when a filter uses them (metric value filters, filters on computed
|
|
105
|
+
* attributes, metrics and facts limiting a filter's values), so other dashboards never request them.
|
|
98
106
|
* It inspects the contexts of the effective dashboard, so a `filterContextRef` override is covered;
|
|
99
107
|
* the synthetic export-override context has no entity behind it and is skipped.
|
|
100
108
|
* It would become redundant if the backend emitted `relationships.labels` on the filter-context items
|
|
@@ -105,7 +113,8 @@ export function resolveUnavailableFilterContextReferences(context, restricted, i
|
|
|
105
113
|
*/
|
|
106
114
|
export async function fetchUnavailableFilterDisplayForms(authCall, workspaceId, dashboard, types) {
|
|
107
115
|
const filterContextIds = inspectableFilterContextIds(dashboard);
|
|
108
|
-
const
|
|
116
|
+
const used = filterObjectTypes(dashboard);
|
|
117
|
+
const inspected = Object.keys(FILTER_CONTEXT_RELATIONSHIP_KEYS).filter((type) => types.includes(type) && used.has(type));
|
|
109
118
|
if (inspected.length === 0 || filterContextIds.length === 0) {
|
|
110
119
|
return [];
|
|
111
120
|
}
|
|
@@ -113,7 +122,7 @@ export async function fetchUnavailableFilterDisplayForms(authCall, workspaceId,
|
|
|
113
122
|
const list = await authCall((client) => FilterContextApi_GetAllEntitiesFilterContexts(client.axios, client.basePath, {
|
|
114
123
|
workspaceId,
|
|
115
124
|
filter: filterContextIds.map((id) => `id==${id}`).join(","),
|
|
116
|
-
include: inspected.map((type) =>
|
|
125
|
+
include: inspected.map((type) => FILTER_CONTEXT_RELATIONSHIP_KEYS[type]),
|
|
117
126
|
size: filterContextIds.length,
|
|
118
127
|
}).then((result) => result.data));
|
|
119
128
|
return list.data.flatMap((context) => resolveUnavailableFilterContextReferences(context, list.meta?.restricted, inspected));
|
|
@@ -123,10 +132,31 @@ export async function fetchUnavailableFilterDisplayForms(authCall, workspaceId,
|
|
|
123
132
|
return [];
|
|
124
133
|
}
|
|
125
134
|
}
|
|
126
|
-
|
|
135
|
+
/**
|
|
136
|
+
* The filter-context object types the dashboard's filters use: labels always; computed attributes of
|
|
137
|
+
* attribute filters built on them; metrics of metric value filters; metrics and facts that limit an
|
|
138
|
+
* attribute filter's values.
|
|
139
|
+
*/
|
|
140
|
+
function filterObjectTypes(dashboard) {
|
|
141
|
+
const used = new Set(["displayForm"]);
|
|
127
142
|
const contexts = [dashboard.filterContext, ...(dashboard.tabs ?? []).map((tab) => tab.filterContext)];
|
|
128
|
-
|
|
129
|
-
|
|
143
|
+
for (const filter of contexts.flatMap((context) => context?.filters ?? [])) {
|
|
144
|
+
if (isDashboardMeasureValueFilter(filter)) {
|
|
145
|
+
used.add("measure");
|
|
146
|
+
}
|
|
147
|
+
if (!isDashboardAttributeFilterItem(filter)) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (isComputedAttributeRef(dashboardAttributeFilterItemDisplayForm(filter))) {
|
|
151
|
+
used.add("computedAttribute");
|
|
152
|
+
}
|
|
153
|
+
for (const ref of dashboardAttributeFilterItemValidateElementsBy(filter) ?? []) {
|
|
154
|
+
if (isIdentifierRef(ref) && (ref.type === "measure" || ref.type === "fact")) {
|
|
155
|
+
used.add(ref.type);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return used;
|
|
130
160
|
}
|
|
131
161
|
/**
|
|
132
162
|
* Identifiers of the persisted filter contexts the dashboard actually uses (root and tabs; a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IAnalyticsCatalogService, IChatConversations, IDashboardSummary, IDashboardSummaryRequest, IGenAIService, IKnowledgeDocumentsService, IMemoryItemsService, ISemanticQualityService, ISemanticSearchQuery } from "@gooddata/sdk-backend-spi";
|
|
1
|
+
import type { IAnalyticsCatalogService, IChatConversations, IDashboardSummary, IDashboardSummaryRequest, IGenAIService, IKnowledgeDocumentsService, IMemoryItemsService, ISemanticQualityService, ISemanticSearchQuery, IVisualizationsSummaryRequest } from "@gooddata/sdk-backend-spi";
|
|
2
2
|
import { type DateNormalizer } from "../../../convertors/fromBackend/dateFormatting/types.js";
|
|
3
3
|
import { type TigerAuthenticatedCallGuard } from "../../../types/index.js";
|
|
4
4
|
export declare class GenAIService implements IGenAIService {
|
|
@@ -18,5 +18,8 @@ export declare class GenAIService implements IGenAIService {
|
|
|
18
18
|
summarizeDashboard(request: IDashboardSummaryRequest, options?: {
|
|
19
19
|
signal?: AbortSignal;
|
|
20
20
|
}): Promise<IDashboardSummary>;
|
|
21
|
+
summarizeVisualizations(request: IVisualizationsSummaryRequest, options?: {
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}): Promise<IDashboardSummary>;
|
|
21
24
|
}
|
|
22
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/genAI/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/genAI/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACR,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,6BAA6B,EAChC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yDAAyD,CAAC;AAE9F,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAS3E,qBAAa,YAAa,YAAW,aAAa;IAE1C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAHnC,YACqB,QAAQ,EAAE,2BAA2B,EACrC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,EAC/C;IAEJ,oBAAoB,CAAC,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,kBAAkB,CAE1E;IAED,sBAAsB,IAAI,oBAAoB,CAE7C;IAEK,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAOzC;IAED,qBAAqB,IAAI,0BAA0B,CAElD;IAED,cAAc,IAAI,mBAAmB,CAEpC;IAED,mBAAmB,IAAI,wBAAwB,CAE9C;IAED,kBAAkB,IAAI,uBAAuB,CAE5C;IAEK,kBAAkB,CACpB,OAAO,EAAE,wBAAwB,EACjC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAkC5B;IAEK,uBAAuB,CACzB,OAAO,EAAE,6BAA6B,EACtC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAyB5B;CACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
2
|
import { SmartFunctionsAi_ResolveLlmProviders } from "@gooddata/api-client-tiger";
|
|
3
|
-
import { GenAiApi_SummarizeDashboard, } from "@gooddata/api-client-tiger/endpoints/genAI";
|
|
3
|
+
import { GenAiApi_SummarizeDashboard, GenAiApi_SummarizeVisualizations, } from "@gooddata/api-client-tiger/endpoints/genAI";
|
|
4
|
+
import { convertFilter } from "../../../convertors/toBackend/afm/FilterConverter.js";
|
|
4
5
|
import { AnalyticsCatalogService } from "./AnalyticsCatalogService.js";
|
|
5
6
|
import { ChatConversationsService } from "./ChatConversations.js";
|
|
6
7
|
import { KnowledgeDocumentsService } from "./KnowledgeDocumentsService.js";
|
|
@@ -64,20 +65,40 @@ export class GenAIService {
|
|
|
64
65
|
workspaceId: this.workspaceId,
|
|
65
66
|
aiSummarizeRequest,
|
|
66
67
|
}, { signal: options?.signal }));
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
reason: v.reason,
|
|
77
|
-
title: v.title,
|
|
78
|
-
})),
|
|
79
|
-
generatedAt: response.data.generatedAt,
|
|
80
|
-
tabId: response.data.tabId ?? undefined,
|
|
68
|
+
return convertSummaryResponse(response.data);
|
|
69
|
+
}
|
|
70
|
+
async summarizeVisualizations(request, options) {
|
|
71
|
+
const aiSummarizeVisualizationsRequest = {
|
|
72
|
+
visualizations: request.visualizations,
|
|
73
|
+
// Cast bridges the AFM filter definitions to the generated union type of the AI API.
|
|
74
|
+
filterContext: request.filters
|
|
75
|
+
.map((filter) => convertFilter(filter))
|
|
76
|
+
.filter(Boolean),
|
|
81
77
|
};
|
|
78
|
+
if (request.formatHint !== undefined) {
|
|
79
|
+
aiSummarizeVisualizationsRequest.formatHint = request.formatHint;
|
|
80
|
+
}
|
|
81
|
+
const response = await this.authCall((client) => GenAiApi_SummarizeVisualizations(client.axios, client.basePath, {
|
|
82
|
+
workspaceId: this.workspaceId,
|
|
83
|
+
aiSummarizeVisualizationsRequest,
|
|
84
|
+
}, { signal: options?.signal }));
|
|
85
|
+
return convertSummaryResponse(response.data);
|
|
82
86
|
}
|
|
83
87
|
}
|
|
88
|
+
function convertSummaryResponse(data) {
|
|
89
|
+
return {
|
|
90
|
+
summary: data.summary,
|
|
91
|
+
filterContext: data.filterContext,
|
|
92
|
+
visualizationsIncluded: data.visualizationsIncluded.map((v) => ({
|
|
93
|
+
visualizationId: v.visualizationId,
|
|
94
|
+
title: v.title,
|
|
95
|
+
})),
|
|
96
|
+
visualizationsExcluded: data.visualizationsExcluded.map((v) => ({
|
|
97
|
+
visualizationId: v.visualizationId,
|
|
98
|
+
reason: v.reason,
|
|
99
|
+
title: v.title,
|
|
100
|
+
})),
|
|
101
|
+
generatedAt: data.generatedAt,
|
|
102
|
+
tabId: data.tabId ?? undefined,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IConnectedAttributesOptions, IGetMeasureOptions, IMeasureExpressionToken, IMeasureKeyDrivers, IMeasureReferencing, ISaveMeasureOptions, IUpdateMetadataObjectMetaPayload, IWorkspaceMeasuresService } from "@gooddata/sdk-backend-spi";
|
|
1
|
+
import type { IConnectedAttributesOptions, IGetMeasureOptions, IMeasureExpressionToken, IMeasureKeyDrivers, IMeasureOverride, IMeasureReferencing, ISaveMeasureOptions, IUpdateMetadataObjectMetaPayload, IWorkspaceMeasuresService } from "@gooddata/sdk-backend-spi";
|
|
2
2
|
import { type IMeasure, type IMeasureMetadataObject, type IMeasureMetadataObjectDefinition, type IObjectCertificationWrite, type ObjRef } from "@gooddata/sdk-model";
|
|
3
3
|
import { type TigerAuthenticatedCallGuard } from "../../../types/index.js";
|
|
4
4
|
import { MeasuresQuery } from "./measuresQuery.js";
|
|
@@ -9,6 +9,7 @@ export declare class TigerWorkspaceMeasures implements IWorkspaceMeasuresService
|
|
|
9
9
|
computeKeyDrivers(measure: IMeasure, options?: {
|
|
10
10
|
sortDirection: "ASC" | "DESC";
|
|
11
11
|
}): Promise<IMeasureKeyDrivers>;
|
|
12
|
+
checkEntityOverrides(identifiers: string[]): Promise<IMeasureOverride[]>;
|
|
12
13
|
getMeasureExpressionTokens(ref: ObjRef): Promise<IMeasureExpressionToken[]>;
|
|
13
14
|
createMeasure(measure: IMeasureMetadataObjectDefinition, options?: ISaveMeasureOptions): Promise<IMeasureMetadataObject>;
|
|
14
15
|
updateMeasure(measure: IMeasureMetadataObject): Promise<IMeasureMetadataObject>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/measures/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/measures/index.ts"],"names":[],"mappings":"AAyBA,OAAO,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AE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5F;IAEK,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASrD;IAEM,4BAA4B,QAAe,MAAM,KAAG,OAAO,CAAC,mBAAmB,CAAC,CAqCrF;IAEK,gBAAgB,IAAI,aAAa,CAEvC;IAEY,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAYtG;IAEY,sBAAsB,CAC/B,UAAU,EAAE,QAAQ,EACpB,WAAW,CAAC,EAAE,QAAQ,EAAE,EACxB,OAAO,CAAC,EAAE,2BAA2B,GACtC,OAAO,CAAC,MAAM,EAAE,CAAC,CA0BnB;CACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (C) 2019-2026 GoodData Corporation
|
|
2
2
|
import { MetadataUtilities, } from "@gooddata/api-client-tiger";
|
|
3
|
-
import { ActionsApi_SetCertification } from "@gooddata/api-client-tiger/endpoints/actions";
|
|
3
|
+
import { ActionsApi_CheckEntityOverrides, ActionsApi_SetCertification, } from "@gooddata/api-client-tiger/endpoints/actions";
|
|
4
4
|
import { EntitiesApi_CreateEntityMetrics, EntitiesApi_DeleteEntityMetrics, EntitiesApi_GetAllEntitiesMetrics, EntitiesApi_GetAllEntitiesVisualizationObjects, EntitiesApi_GetEntityMetrics, EntitiesApi_PatchEntityMetrics, EntitiesApi_UpdateEntityMetrics, } from "@gooddata/api-client-tiger/endpoints/entitiesObjects";
|
|
5
5
|
import { SmartFunctionsApi_KeyDriverAnalysis, SmartFunctionsApi_KeyDriverAnalysisResult, } from "@gooddata/api-client-tiger/endpoints/smartFunctions";
|
|
6
6
|
import { ActionsApi_ComputeValidObjects } from "@gooddata/api-client-tiger/endpoints/validObjects";
|
|
@@ -46,6 +46,18 @@ export class TigerWorkspaceMeasures {
|
|
|
46
46
|
labels,
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
+
async checkEntityOverrides(identifiers) {
|
|
50
|
+
if (identifiers.length === 0) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const response = await this.authCall((client) => ActionsApi_CheckEntityOverrides(client.axios, client.basePath, {
|
|
54
|
+
workspaceId: this.workspace,
|
|
55
|
+
hierarchyObjectIdentification: identifiers.map((id) => ({ id, type: "metric" })),
|
|
56
|
+
}));
|
|
57
|
+
return response.data
|
|
58
|
+
.filter(({ type }) => type === "metric")
|
|
59
|
+
.map(({ id, origins }) => ({ identifier: id, origins }));
|
|
60
|
+
}
|
|
49
61
|
async getMeasureExpressionTokens(ref) {
|
|
50
62
|
if (!isIdentifierRef(ref)) {
|
|
51
63
|
throw new Error("only identifiers supported");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/permissions/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAK3E,qBAAa,gCAAiC,YAAW,4BAA4B;aAE7D,QAAQ,EAAE,2BAA2B;aACrC,SAAS,EAAE,MAAM;IAFrC,YACoB,QAAQ,EAAE,2BAA2B,EACrC,SAAS,EAAE,MAAM,EACjC;IAES,4BAA4B,IAAI,OAAO,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/permissions/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAK3E,qBAAa,gCAAiC,YAAW,4BAA4B;aAE7D,QAAQ,EAAE,2BAA2B;aACrC,SAAS,EAAE,MAAM;IAFrC,YACoB,QAAQ,EAAE,2BAA2B,EACrC,SAAS,EAAE,MAAM,EACjC;IAES,4BAA4B,IAAI,OAAO,CAAC,qBAAqB,CAAC,CA8D1E;CACJ"}
|
|
@@ -16,7 +16,7 @@ export class TigerWorkspacePermissionsFactory {
|
|
|
16
16
|
// NOTE: From tiger backend there are permissions like MANAGE, ANALYZE, VIEW. Keep on mind that
|
|
17
17
|
// NOTE: if user has MANAGE permissions, there will be also ANALYZE and VIEW in permissions array.
|
|
18
18
|
const permissions = response.data.data.meta.permissions ?? [];
|
|
19
|
-
const { canViewWorkspace, canAnalyzeWorkspace, canManageWorkspace, canExportReport, canExportTabular, canExportPdf, canCreateFilterView, canCreateAutomation, canUseAiAssistant, canCreateMetric, canCreateVisualization, canCreateComputedAttribute, } = getPermission(permissions);
|
|
19
|
+
const { canViewWorkspace, canAnalyzeWorkspace, canManageWorkspace, canExportReport, canExportTabular, canExportPdf, canCreateFilterView, canCreateAutomation, canUseAiAssistant, canCreateMetric, canCreateVisualization, canCreateComputedAttribute, canManageVisualizations, } = getPermission(permissions);
|
|
20
20
|
return {
|
|
21
21
|
//disabled for tiger for now
|
|
22
22
|
canCreateReport: false,
|
|
@@ -51,6 +51,7 @@ export class TigerWorkspacePermissionsFactory {
|
|
|
51
51
|
canCreateAutomation,
|
|
52
52
|
canCreateMetric,
|
|
53
53
|
canCreateComputedAttribute,
|
|
54
|
+
canManageVisualizations,
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -65,7 +66,8 @@ function getPermission(permissions) {
|
|
|
65
66
|
const canCreateAutomation = hasPermission(permissions, "CREATE_AUTOMATION");
|
|
66
67
|
const canUseAiAssistant = hasPermission(permissions, "USE_AI_ASSISTANT");
|
|
67
68
|
const canCreateMetric = hasPermission(permissions, "CREATE_METRIC");
|
|
68
|
-
const
|
|
69
|
+
const canManageVisualizations = canManageWorkspace || hasPermission(permissions, "MANAGE_VISUALIZATIONS");
|
|
70
|
+
const canCreateVisualization = canAnalyzeWorkspace || canManageVisualizations || hasPermission(permissions, "CREATE_VISUALIZATION");
|
|
69
71
|
const canCreateComputedAttribute = hasPermission(permissions, "CREATE_COMPUTED_ATTRIBUTE");
|
|
70
72
|
return {
|
|
71
73
|
canViewWorkspace,
|
|
@@ -80,6 +82,7 @@ function getPermission(permissions) {
|
|
|
80
82
|
canCreateMetric,
|
|
81
83
|
canCreateVisualization,
|
|
82
84
|
canCreateComputedAttribute,
|
|
85
|
+
canManageVisualizations,
|
|
83
86
|
};
|
|
84
87
|
}
|
|
85
88
|
function hasPermission(permissions, need) {
|
|
@@ -39,13 +39,6 @@ export declare class TigerWorkspaceSettings extends TigerSettingsService<IWorksp
|
|
|
39
39
|
deleteExportCsvCustomDelimiter(): Promise<void>;
|
|
40
40
|
setTheme(activeTheme: string | ObjRef): Promise<void>;
|
|
41
41
|
setColorPalette(activeColorPalette: string | ObjRef): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Build the active-styling setting content from a reference. A bare id string (or an untyped/org-typed
|
|
44
|
-
* reference) is treated as organization-scoped; only a reference explicitly typed as the workspace scope
|
|
45
|
-
* activates the workspace collection. The scope must be explicit so the id resolves against the right
|
|
46
|
-
* scope with no cross-scope fallback.
|
|
47
|
-
*/
|
|
48
|
-
private resolveActiveStyleContent;
|
|
49
42
|
deleteTheme(): Promise<any>;
|
|
50
43
|
deleteColorPalette(): Promise<any>;
|
|
51
44
|
deleteMetricFormatOverride(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/settings/index.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EACjC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,KA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AE,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,CAmBlF;CACJ;AAkED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACrC,QAAQ,EAAE,2BAA2B,EACrC,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,sBAAsB,CAAC,CAuEjC"}
|
|
@@ -3,12 +3,11 @@ import { isLiveFeatures, isStaticFeatures } from "@gooddata/api-client-tiger";
|
|
|
3
3
|
import { ActionsApi_WorkspaceResolveAllSettings } from "@gooddata/api-client-tiger/endpoints/actions";
|
|
4
4
|
import { EntitiesApi_CreateEntityWorkspaceSettings, EntitiesApi_DeleteEntityWorkspaceSettings, EntitiesApi_GetAllEntitiesWorkspaceSettings, EntitiesApi_GetEntityWorkspaces, EntitiesApi_UpdateEntityWorkspaceSettings, } from "@gooddata/api-client-tiger/endpoints/entitiesObjects";
|
|
5
5
|
import { ProfileApi_GetCurrent } from "@gooddata/api-client-tiger/endpoints/profile";
|
|
6
|
-
import { isIdentifierRef, } from "@gooddata/sdk-model";
|
|
7
6
|
import { LIB_VERSION } from "../../../__version.js";
|
|
8
7
|
import { convertDateFilterConfig, } from "../../../convertors/fromBackend/DateFilterConfigurationConverter.js";
|
|
9
8
|
import { unwrapSettingContent } from "../../../convertors/fromBackend/SettingsConverter.js";
|
|
10
|
-
import { objRefToIdentifier } from "../../../utils/api.js";
|
|
11
9
|
import { TigerFeaturesService, getControlledFeatureRollout, getOrganizationTier, } from "../../features/index.js";
|
|
10
|
+
import { activeStylingContent } from "../../settings/activeStyling.js";
|
|
12
11
|
import { mapTypeToKey } from "../../settings/mapping.js";
|
|
13
12
|
import { invalidateSettingsResponses, trackSettingsResponse } from "../../settings/responseCacheCoherence.js";
|
|
14
13
|
import { TigerSettingsService } from "../../settings/settings.js";
|
|
@@ -135,31 +134,10 @@ export class TigerWorkspaceSettings extends TigerSettingsService {
|
|
|
135
134
|
return this.deleteSettingByType("EXPORT_CSV_CUSTOM_DELIMITER");
|
|
136
135
|
}
|
|
137
136
|
async setTheme(activeTheme) {
|
|
138
|
-
return this.setSetting("ACTIVE_THEME",
|
|
137
|
+
return this.setSetting("ACTIVE_THEME", activeStylingContent(activeTheme, "theme", "workspaceTheme", this.authCall));
|
|
139
138
|
}
|
|
140
139
|
async setColorPalette(activeColorPalette) {
|
|
141
|
-
return this.setSetting("ACTIVE_COLOR_PALETTE",
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Build the active-styling setting content from a reference. A bare id string (or an untyped/org-typed
|
|
145
|
-
* reference) is treated as organization-scoped; only a reference explicitly typed as the workspace scope
|
|
146
|
-
* activates the workspace collection. The scope must be explicit so the id resolves against the right
|
|
147
|
-
* scope with no cross-scope fallback.
|
|
148
|
-
*/
|
|
149
|
-
resolveActiveStyleContent(ref, organizationType, workspaceType) {
|
|
150
|
-
if (typeof ref === "string") {
|
|
151
|
-
return { id: ref, type: organizationType };
|
|
152
|
-
}
|
|
153
|
-
const id = objRefToIdentifier(ref, this.authCall);
|
|
154
|
-
const refType = isIdentifierRef(ref) ? ref.type : undefined;
|
|
155
|
-
// A bare / uri / untyped reference defaults to the organization scope. A reference whose type is set
|
|
156
|
-
// but is neither the organization nor the workspace scope for this kind is a caller error - reject it
|
|
157
|
-
// rather than silently reinterpreting it as organization-scoped.
|
|
158
|
-
if (refType && refType !== organizationType && refType !== workspaceType) {
|
|
159
|
-
throw new Error(`Cannot set active ${organizationType}: reference type "${refType}" is neither ` +
|
|
160
|
-
`"${organizationType}" nor "${workspaceType}".`);
|
|
161
|
-
}
|
|
162
|
-
return { id, type: refType === workspaceType ? workspaceType : organizationType };
|
|
140
|
+
return this.setSetting("ACTIVE_COLOR_PALETTE", activeStylingContent(activeColorPalette, "colorPalette", "workspaceColorPalette", this.authCall));
|
|
163
141
|
}
|
|
164
142
|
async deleteTheme() {
|
|
165
143
|
return this.deleteSettingByType("ACTIVE_THEME");
|
|
@@ -7,19 +7,22 @@ export declare class TigerWorkspaceStyling implements IWorkspaceStylingService {
|
|
|
7
7
|
private settingsService;
|
|
8
8
|
constructor(authCall: TigerAuthenticatedCallGuard, workspace: string);
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Fetch the active styling object's content from a filtered single-object list and unwrap the first hit.
|
|
11
|
+
* A missing object (or a failed fetch) yields `undefined` rather than throwing, so styling problems never
|
|
12
|
+
* break the application. The caller selects the scope-specific endpoint, so there is no cross-scope
|
|
13
|
+
* fallback here.
|
|
14
14
|
*/
|
|
15
|
-
private
|
|
15
|
+
private fetchActiveStyleContent;
|
|
16
|
+
private resolveActiveStyleContent;
|
|
16
17
|
/**
|
|
17
|
-
* Resolve the active
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Resolve the active theme or color palette for the current user in this workspace. The resolved setting
|
|
19
|
+
* may come from the user layer, which has no workspace: a reference this workspace cannot resolve falls
|
|
20
|
+
* through to the setting resolved without the user layer, so it never masks the workspace's or the
|
|
21
|
+
* organization's own one.
|
|
21
22
|
*/
|
|
22
|
-
private
|
|
23
|
+
private resolveActiveStyle;
|
|
24
|
+
private colorPaletteFetcher;
|
|
25
|
+
private themeFetcher;
|
|
23
26
|
getColorPalette: () => Promise<IColorPaletteItem[]>;
|
|
24
27
|
getTheme: () => Promise<ITheme>;
|
|
25
28
|
private getActiveSetting;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/styling/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,MAAM,EAGd,MAAM,qBAAqB,CAAC;AAe7B,OA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AAC,uBAAuB;CAKlC"}
|
|
@@ -33,65 +33,69 @@ export class TigerWorkspaceStyling {
|
|
|
33
33
|
this.settingsService = new TigerWorkspaceSettings(authCall, workspace);
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
isStylizable(activeStyleId) {
|
|
42
|
-
return activeStyleId !== "";
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Resolve the active styling object's content by fetching a filtered single-object list and unwrapping
|
|
46
|
-
* the first hit. A missing object (or a failed fetch) yields the provided fallback rather than throwing,
|
|
47
|
-
* so styling problems never break the application. The caller selects the scope-specific endpoint, so
|
|
48
|
-
* there is no cross-scope fallback here.
|
|
36
|
+
* Fetch the active styling object's content from a filtered single-object list and unwrap the first hit.
|
|
37
|
+
* A missing object (or a failed fetch) yields `undefined` rather than throwing, so styling problems never
|
|
38
|
+
* break the application. The caller selects the scope-specific endpoint, so there is no cross-scope
|
|
39
|
+
* fallback here.
|
|
49
40
|
*/
|
|
50
|
-
|
|
41
|
+
fetchActiveStyleContent = (fetchList, unwrapContent) => this.authCall((client) => fetchList(client)
|
|
51
42
|
.then((response) => response.data.data.length === 0
|
|
52
|
-
?
|
|
43
|
+
? undefined
|
|
53
44
|
: unwrapContent(response.data.data[0].attributes.content))
|
|
54
45
|
// Failed styling loading should not break the application
|
|
55
|
-
.catch(() =>
|
|
56
|
-
|
|
46
|
+
.catch(() => undefined));
|
|
47
|
+
resolveActiveStyleContent = async (fetchList, unwrapContent, fallback) => (await this.fetchActiveStyleContent(fetchList, unwrapContent)) ?? fallback;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the active theme or color palette for the current user in this workspace. The resolved setting
|
|
50
|
+
* may come from the user layer, which has no workspace: a reference this workspace cannot resolve falls
|
|
51
|
+
* through to the setting resolved without the user layer, so it never masks the workspace's or the
|
|
52
|
+
* organization's own one.
|
|
53
|
+
*/
|
|
54
|
+
async resolveActiveStyle(key, fetchListFor, unwrapContent, fallback) {
|
|
57
55
|
const userSettings = await getSettingsForCurrentUser(this.authCall, this.workspace);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return DefaultColorPalette;
|
|
56
|
+
const active = userSettings[key];
|
|
57
|
+
if (!active?.id) {
|
|
58
|
+
return fallback;
|
|
62
59
|
}
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
const resolved = await this.fetchActiveStyleContent(fetchListFor(active), unwrapContent);
|
|
61
|
+
if (resolved !== undefined) {
|
|
62
|
+
return resolved;
|
|
63
|
+
}
|
|
64
|
+
const workspaceSettings = await this.settingsService.getSettings();
|
|
65
|
+
const workspaceActive = workspaceSettings?.[key];
|
|
66
|
+
if (!workspaceActive?.id ||
|
|
67
|
+
(workspaceActive.id === active.id && workspaceActive.type === active.type)) {
|
|
68
|
+
return fallback;
|
|
69
|
+
}
|
|
70
|
+
return (await this.fetchActiveStyleContent(fetchListFor(workspaceActive), unwrapContent)) ?? fallback;
|
|
71
|
+
}
|
|
72
|
+
// Resolve the id against the scope declared by the setting; no cross-scope fallback.
|
|
73
|
+
colorPaletteFetcher = (active) => (client) => {
|
|
74
|
+
const filter = `id=="${active.id}"`;
|
|
75
|
+
return active.type === "workspaceColorPalette"
|
|
76
|
+
? EntitiesApi_GetAllEntitiesWorkspaceColorPalettes(client.axios, client.basePath, {
|
|
67
77
|
workspaceId: this.workspace,
|
|
68
78
|
filter,
|
|
69
79
|
})
|
|
70
|
-
:
|
|
71
|
-
// Validate the resolved content the same way the listing path does, so malformed backend content
|
|
72
|
-
// falls back to the default rather than flowing through unchecked.
|
|
73
|
-
return this.resolveActiveStyleContent(fetchList, (content) => {
|
|
74
|
-
const colorPalette = unwrapColorPaletteContent(content);
|
|
75
|
-
return isValidColorPalette(colorPalette) ? colorPalette : DefaultColorPalette;
|
|
76
|
-
}, DefaultColorPalette);
|
|
80
|
+
: EntitiesApi_GetAllEntitiesColorPalettes(client.axios, client.basePath, { filter });
|
|
77
81
|
};
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!this.isStylizable(activeThemeId)) {
|
|
83
|
-
return DefaultTheme;
|
|
84
|
-
}
|
|
85
|
-
const filter = `id=="${activeThemeId}"`;
|
|
86
|
-
// Resolve the id against the scope declared by the setting; no cross-scope fallback.
|
|
87
|
-
const fetchList = activeTheme?.type === "workspaceTheme"
|
|
88
|
-
? (client) => EntitiesApi_GetAllEntitiesWorkspaceThemes(client.axios, client.basePath, {
|
|
82
|
+
themeFetcher = (active) => (client) => {
|
|
83
|
+
const filter = `id=="${active.id}"`;
|
|
84
|
+
return active.type === "workspaceTheme"
|
|
85
|
+
? EntitiesApi_GetAllEntitiesWorkspaceThemes(client.axios, client.basePath, {
|
|
89
86
|
workspaceId: this.workspace,
|
|
90
87
|
filter,
|
|
91
88
|
})
|
|
92
|
-
:
|
|
93
|
-
return this.resolveActiveStyleContent(fetchList, (content) => content, DefaultTheme);
|
|
89
|
+
: EntitiesApi_GetAllEntitiesThemes(client.axios, client.basePath, { filter });
|
|
94
90
|
};
|
|
91
|
+
getColorPalette = () =>
|
|
92
|
+
// Validate the resolved content the same way the listing path does, so malformed backend content
|
|
93
|
+
// falls back to the default rather than flowing through unchecked.
|
|
94
|
+
this.resolveActiveStyle("activeColorPalette", this.colorPaletteFetcher, (content) => {
|
|
95
|
+
const colorPalette = unwrapColorPaletteContent(content);
|
|
96
|
+
return isValidColorPalette(colorPalette) ? colorPalette : DefaultColorPalette;
|
|
97
|
+
}, DefaultColorPalette);
|
|
98
|
+
getTheme = () => this.resolveActiveStyle("activeTheme", this.themeFetcher, (content) => content, DefaultTheme);
|
|
95
99
|
async getActiveSetting(setting) {
|
|
96
100
|
const settings = await this.settingsService.getSettings();
|
|
97
101
|
const foundSetting = settings?.[setting];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genAIConvertor.d.ts","sourceRoot":"","sources":["../../../src/convertors/fromBackend/genAIConvertor.ts"],"names":[],"mappings":"AAKA,OAAO,EAGH,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,
|
|
1
|
+
{"version":3,"file":"genAIConvertor.d.ts","sourceRoot":"","sources":["../../../src/convertors/fromBackend/genAIConvertor.ts"],"names":[],"mappings":"AAKA,OAAO,EAGH,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAK/B,KAAK,yBAAyB,EAK9B,KAAK,aAAa,EASrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEH,KAAK,iBAAiB,EAGtB,KAAK,sBAAsB,EAE3B,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAGhC,KAAK,gBAAgB,EAExB,MAAM,2BAA2B,CAAC;AAwCnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKhE,wBAAgB,kCAAkC,CAAC,YAAY,EAAE,sBAAsB,GAAG,iBAAiB,CAS1G;AAED,wBAAgB,sCAAsC,CAClD,IAAI,EAAE,0BAA0B,EAChC,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,GAAG,SAAS,EAC9D,OAAO,EAAE,qBAAqB,EAAE,EAChC,cAAc,EAAE,cAAc,EAC9B,MAAM,CAAC,EAAE,gBAAgB,EACzB,QAAQ,CAAC,EAAE,MAAM,GAClB,qBAAqB,GAAG,SAAS,CA6BnC;AAED,wBAAgB,uCAAuC,CACnD,KAAK,EAAE,0BAA0B,EAAE,EACnC,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,GAAG,SAAS,EAC9D,cAAc,EAAE,cAAc,EAC9B,MAAM,CAAC,EAAE,gBA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