@gooddata/sdk-backend-tiger 11.65.0-alpha.1 → 11.65.0-alpha.11
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.d.ts.map +1 -1
- package/esm/__version.js +1 -1
- package/esm/backend/features/feature.d.ts.map +1 -1
- package/esm/backend/features/feature.js +14 -143
- package/esm/backend/features/hub.d.ts.map +1 -1
- package/esm/backend/features/hub.js +4 -5
- package/esm/backend/features/index.d.ts.map +1 -1
- package/esm/backend/features/index.js +15 -14
- package/esm/backend/uiFeatures.d.ts +536 -404
- package/esm/backend/uiFeatures.d.ts.map +1 -1
- package/esm/backend/uiFeatures.js +143 -406
- package/esm/backend/workspace/genAI/ChatConversations.d.ts +4 -2
- package/esm/backend/workspace/genAI/ChatConversations.d.ts.map +1 -1
- package/esm/backend/workspace/genAI/ChatConversations.js +46 -8
- 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 +35 -1
- package/esm/convertors/fromBackend/genAIConvertor.d.ts.map +1 -1
- package/esm/convertors/fromBackend/genAIConvertor.js +3 -0
- package/esm/convertors/fromBackend/publisherDocumentPartConvertorV2.d.ts +8 -0
- package/esm/convertors/fromBackend/publisherDocumentPartConvertorV2.d.ts.map +1 -0
- package/esm/convertors/fromBackend/publisherDocumentPartConvertorV2.js +42 -0
- package/package.json +11 -11
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
2
|
import { EventSourceParserStream } from "eventsource-parser/stream";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
|
-
import { GenAiApi_DeleteConversation, GenAiApi_GetConversation, GenAiApi_GetConversationItems, GenAiApi_GetConversationResponses, GenAiApi_GetConversations, GenAiApi_PatchConversation, GenAiApi_PatchDashboard, GenAiApi_PatchReport, GenAiApi_PatchVisualization, GenAiApi_PostConversationFeedback, GenAiApi_PostConversations, GenAiApi_PostGenerateConversationTitle, GenAiApi_PostMessages, GenAiApi_SwitchAgent, } from "@gooddata/api-client-tiger/endpoints/genAI";
|
|
4
|
+
import { GenAiApi_DeleteConversation, GenAiApi_GetConversation, GenAiApi_GetConversationItems, GenAiApi_GetConversationResponses, GenAiApi_GetConversations, GenAiApi_PatchConversation, GenAiApi_PatchDashboard, GenAiApi_PatchPublisherDocument, GenAiApi_PatchReport, GenAiApi_PatchVisualization, GenAiApi_PostConversationFeedback, GenAiApi_PostConversations, GenAiApi_PostGenerateConversationTitle, GenAiApi_PostMessages, GenAiApi_SwitchAgent, } from "@gooddata/api-client-tiger/endpoints/genAI";
|
|
5
5
|
import { ServerPaging } from "@gooddata/sdk-backend-base";
|
|
6
|
-
import { declarativeDashboardToYaml, publisherDocumentDefinitionToYaml } from "@gooddata/sdk-code-convertors";
|
|
6
|
+
import { declarativeDashboardToYaml, publisherDocumentDefinitionToYaml, publisherDocumentDefinitionToYamlV2, } from "@gooddata/sdk-code-convertors";
|
|
7
7
|
import { isIdentifierRef, isTempFilterContext, objRefToString, } from "@gooddata/sdk-model";
|
|
8
8
|
import { convertChatConversationErrorFromBackend, convertChatConversationFromBackend, convertChatConversationInteractionStepFromBackend, convertChatConversationItemFromBackend, convertChatConversationItemsFromBackend, } from "../../../convertors/fromBackend/genAIConvertor.js";
|
|
9
9
|
import { convertAnalyticalDashboard, convertFilterContextToBackend, } from "../../../convertors/toBackend/AnalyticalDashboardConverter.js";
|
|
@@ -235,12 +235,20 @@ export class ConversationThread {
|
|
|
235
235
|
/**
|
|
236
236
|
* Records the saved document that a document drafted in the conversation became.
|
|
237
237
|
*/
|
|
238
|
-
async resavePublisherDocument(documentRef, savedDocumentId) {
|
|
238
|
+
async resavePublisherDocument(documentRef, savedDocumentId, options) {
|
|
239
239
|
const conversationId = this.conversationId;
|
|
240
240
|
if (!conversationId) {
|
|
241
241
|
throw new Error("Conversation ID is not set");
|
|
242
242
|
}
|
|
243
243
|
await this.authCall((client) => {
|
|
244
|
+
if (options?.format === "aac-v2") {
|
|
245
|
+
return GenAiApi_PatchPublisherDocument(client.axios, client.basePath, {
|
|
246
|
+
workspaceId: this.workspaceId,
|
|
247
|
+
conversationId,
|
|
248
|
+
documentRef,
|
|
249
|
+
aiPublisherDocumentIdUpdateRequest: { id: savedDocumentId },
|
|
250
|
+
});
|
|
251
|
+
}
|
|
244
252
|
return GenAiApi_PatchReport(client.axios, client.basePath, {
|
|
245
253
|
workspaceId: this.workspaceId,
|
|
246
254
|
conversationId,
|
|
@@ -261,6 +269,7 @@ export class ConversationThread {
|
|
|
261
269
|
workspaceId: this.workspaceId,
|
|
262
270
|
userQuestion: userMessage,
|
|
263
271
|
conversationId,
|
|
272
|
+
documentFormat: "aac-v1",
|
|
264
273
|
});
|
|
265
274
|
}
|
|
266
275
|
}
|
|
@@ -325,6 +334,12 @@ export class ChatConversationThreadQuery {
|
|
|
325
334
|
effort,
|
|
326
335
|
});
|
|
327
336
|
}
|
|
337
|
+
withPublisherDocumentFormat(documentFormat) {
|
|
338
|
+
return new ChatConversationThreadQuery(this.authCall, this.dateNormalizer, {
|
|
339
|
+
...this.requestParameters,
|
|
340
|
+
documentFormat,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
328
343
|
stream(history) {
|
|
329
344
|
// We are using Axios <1.7, which does not support streaming,
|
|
330
345
|
// as it can't use fetch API instead of XHR.
|
|
@@ -355,8 +370,9 @@ export class ChatConversationThreadQuery {
|
|
|
355
370
|
includeTags: requestParameters.includeTags,
|
|
356
371
|
},
|
|
357
372
|
reasoningEffort: requestParameters.effort,
|
|
373
|
+
documentFormat: requestParameters.documentFormat,
|
|
358
374
|
},
|
|
359
|
-
userContext: convertUserContext(requestParameters.userContext),
|
|
375
|
+
userContext: convertUserContext(requestParameters.userContext, requestParameters.documentFormat),
|
|
360
376
|
},
|
|
361
377
|
}, {
|
|
362
378
|
// Abort signal only affecting the request, as the stream is generally
|
|
@@ -474,7 +490,7 @@ class ServerSentEventsDataConverter extends TransformStream {
|
|
|
474
490
|
/**
|
|
475
491
|
* Convert SDK model user context (with ObjRef) to the API user context (with plain string IDs).
|
|
476
492
|
*/
|
|
477
|
-
function convertUserContext(userContext) {
|
|
493
|
+
function convertUserContext(userContext, documentFormat) {
|
|
478
494
|
if (!userContext) {
|
|
479
495
|
return undefined;
|
|
480
496
|
}
|
|
@@ -482,9 +498,7 @@ function convertUserContext(userContext) {
|
|
|
482
498
|
...(userContext.view?.dashboard
|
|
483
499
|
? { dashboard: convertDashboardView(userContext.view.dashboard) }
|
|
484
500
|
: {}),
|
|
485
|
-
...(userContext
|
|
486
|
-
? { report: convertPublisherDocumentView(userContext.view.publisherDocument) }
|
|
487
|
-
: {}),
|
|
501
|
+
...convertPublisherDocumentViewOfFormat(userContext, documentFormat),
|
|
488
502
|
};
|
|
489
503
|
return {
|
|
490
504
|
...convertActiveObject(userContext),
|
|
@@ -492,6 +506,30 @@ function convertUserContext(userContext) {
|
|
|
492
506
|
...convertReferencedObjects(userContext),
|
|
493
507
|
};
|
|
494
508
|
}
|
|
509
|
+
function convertPublisherDocumentViewOfFormat({ view }, documentFormat) {
|
|
510
|
+
if (documentFormat === "aac-v2") {
|
|
511
|
+
return view?.publisherDocumentV2
|
|
512
|
+
? { document: convertPublisherDocumentViewV2(view.publisherDocumentV2) }
|
|
513
|
+
: {};
|
|
514
|
+
}
|
|
515
|
+
return view?.publisherDocument ? { report: convertPublisherDocumentView(view.publisherDocument) } : {};
|
|
516
|
+
}
|
|
517
|
+
function convertPublisherDocumentViewV2({ ref, title, definition, }) {
|
|
518
|
+
return {
|
|
519
|
+
id: ref ? objRefToString(ref) : null,
|
|
520
|
+
...(title ? { title } : {}),
|
|
521
|
+
...(definition ? convertPublisherDocumentDefinitionV2({ ...definition, ref }) : {}),
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
function convertPublisherDocumentDefinitionV2(definition) {
|
|
525
|
+
try {
|
|
526
|
+
return { definition: publisherDocumentDefinitionToYamlV2(definition).json };
|
|
527
|
+
}
|
|
528
|
+
catch (error) {
|
|
529
|
+
console.warn("Document cannot be written as code, sending the AI assistant only its id: ", error);
|
|
530
|
+
return {};
|
|
531
|
+
}
|
|
532
|
+
}
|
|
495
533
|
function convertPublisherDocumentView({ ref, title, definition, draftRef, }) {
|
|
496
534
|
return {
|
|
497
535
|
id: ref ? objRefToString(ref) : null,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IAnalyticsCatalogService, IChatConversations, IDashboardSummary, IDashboardSummaryRequest, IGenAIService, IKnowledgeDocumentsService, IMemoryItemsService, ISemanticQualityService, ISemanticSearchQuery, IVisualizationsSummaryRequest } from "@gooddata/sdk-backend-spi";
|
|
1
|
+
import type { IAnalyticsCatalogService, IChatConversations, IDashboardSummary, IDashboardSummaryRequest, IGenAIService, IKnowledgeDocumentsService, IMemoryItemsService, ISemanticQualityService, ISemanticSearchQuery, ITakeawayRequest, ITakeawayResult, 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 {
|
|
@@ -21,5 +21,8 @@ export declare class GenAIService implements IGenAIService {
|
|
|
21
21
|
summarizeVisualizations(request: IVisualizationsSummaryRequest, options?: {
|
|
22
22
|
signal?: AbortSignal;
|
|
23
23
|
}): Promise<IDashboardSummary>;
|
|
24
|
+
generateTakeaway(request: ITakeawayRequest, options?: {
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
}): Promise<ITakeawayResult>;
|
|
24
27
|
}
|
|
25
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/backend/workspace/genAI/index.ts"],"names":[],"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CAAA;KAAE,GACnC,OAAO,CAAC,iBAAiB,CAAC,CA6B5B;IAEK,gBAAgB,CAClB,OAAO,EAAE,gBAAgB,EACzB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACnC,OAAO,CAAC,eAAe,CAAC,CAiC1B;CACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (C) 2024-2026 GoodData Corporation
|
|
2
2
|
import { SmartFunctionsAi_ResolveLlmProviders } from "@gooddata/api-client-tiger";
|
|
3
|
-
import { GenAiApi_SummarizeDashboard, GenAiApi_SummarizeVisualizations, } from "@gooddata/api-client-tiger/endpoints/genAI";
|
|
3
|
+
import { GenAiApi_GenerateTakeaway, GenAiApi_SummarizeDashboard, GenAiApi_SummarizeVisualizations, } from "@gooddata/api-client-tiger/endpoints/genAI";
|
|
4
4
|
import { convertFilter } from "../../../convertors/toBackend/afm/FilterConverter.js";
|
|
5
5
|
import { AnalyticsCatalogService } from "./AnalyticsCatalogService.js";
|
|
6
6
|
import { ChatConversationsService } from "./ChatConversations.js";
|
|
@@ -86,6 +86,31 @@ export class GenAIService {
|
|
|
86
86
|
}, { signal: options?.signal }));
|
|
87
87
|
return convertSummaryResponse(response.data);
|
|
88
88
|
}
|
|
89
|
+
async generateTakeaway(request, options) {
|
|
90
|
+
const aiTakeawayRequest = {
|
|
91
|
+
data: {
|
|
92
|
+
visualizations: request.visualizations.map((placement) => ({
|
|
93
|
+
visualizationId: placement.visualizationId,
|
|
94
|
+
filters: convertSummaryFilters(placement.filters),
|
|
95
|
+
})),
|
|
96
|
+
filterContext: convertSummaryFilters(request.filters),
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
if (request.instructions !== undefined) {
|
|
100
|
+
aiTakeawayRequest.instructions = request.instructions;
|
|
101
|
+
}
|
|
102
|
+
if (request.maxCharacters !== undefined) {
|
|
103
|
+
aiTakeawayRequest.maxCharacters = request.maxCharacters;
|
|
104
|
+
}
|
|
105
|
+
if (request.agentId !== undefined) {
|
|
106
|
+
aiTakeawayRequest.agentId = request.agentId;
|
|
107
|
+
}
|
|
108
|
+
const response = await this.authCall((client) => GenAiApi_GenerateTakeaway(client.axios, client.basePath, {
|
|
109
|
+
workspaceId: this.workspaceId,
|
|
110
|
+
aiTakeawayRequest,
|
|
111
|
+
}, { signal: options?.signal }));
|
|
112
|
+
return convertTakeawayResponse(response.data);
|
|
113
|
+
}
|
|
89
114
|
}
|
|
90
115
|
// Cast bridges the AFM filter definitions to the generated union type of the AI API.
|
|
91
116
|
function convertSummaryFilters(filters) {
|
|
@@ -110,3 +135,12 @@ function convertSummaryResponse(data) {
|
|
|
110
135
|
tabId: data.tabId ?? undefined,
|
|
111
136
|
};
|
|
112
137
|
}
|
|
138
|
+
function convertTakeawayResponse(data) {
|
|
139
|
+
return {
|
|
140
|
+
takeaway: data.takeaway,
|
|
141
|
+
noData: data.noData,
|
|
142
|
+
generatedAt: data.generatedAt,
|
|
143
|
+
agentId: data.agentId,
|
|
144
|
+
contextOmitted: data.contextOmitted,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
@@ -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,EAK/B,KAAK,yBAAyB,EAM9B,KAAK,aAAa,EAUrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEH,KAAK,iBAAiB,EAGtB,KAAK,sBAAsB,EAE3B,KAAK,gCAAgC,EACrC,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAIhC,KAAK,gBAAgB,EAExB,MAAM,2BAA2B,CAAC;AAyCnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,KAAK,cAAc,E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AAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACrE,OAAO,CAAC,EAAE,MAAM,GACjB,sBAAsB,CAQxB;AAED;;;GAGG;AACH,wBAAgB,iDAAiD,CAC7D,IAAI,EAAE,yBAAyB,EAC/B,OAAO,CAAC,EAAE,MAAM,GACjB,gCAAgC,CAgBlC;AAED;;;;GAIG;AACH,wBAAgB,4CAA4C,CACxD,MAAM,EAAE,gCAAgC,GAAG,IAAI,GAAG,SAAS,GAC5D,2BAA2B,GAAG,SAAS,CAgEzC;AA2FD,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACvC,gBAAgB,CAQlB"}
|
|
@@ -11,6 +11,7 @@ import { convertAlert } from "./AutomationConverter.js";
|
|
|
11
11
|
import { cloneWithSanitizedIds } from "./IdSanitization.js";
|
|
12
12
|
import { visualizationObjectsItemToInsight } from "./InsightConverter.js";
|
|
13
13
|
import { convertPublisherDocumentPart } from "./publisherDocumentPartConvertor.js";
|
|
14
|
+
import { convertPublisherDocumentPartV2 } from "./publisherDocumentPartConvertorV2.js";
|
|
14
15
|
export function convertChatConversationFromBackend(conversation) {
|
|
15
16
|
return {
|
|
16
17
|
id: conversation.conversationId,
|
|
@@ -187,6 +188,8 @@ function convertMultipartPart(part, history, siblings, dateNormalizer, locale, t
|
|
|
187
188
|
}
|
|
188
189
|
case "report":
|
|
189
190
|
return convertPublisherDocumentPart(part);
|
|
191
|
+
case "document":
|
|
192
|
+
return convertPublisherDocumentPartV2(part);
|
|
190
193
|
case "kda":
|
|
191
194
|
if (!part.kda) {
|
|
192
195
|
return undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AiPublisherDocumentPart } from "@gooddata/api-client-tiger";
|
|
2
|
+
import { type IChatConversationPublisherDocumentContentV2 } from "@gooddata/sdk-backend-spi";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a document part. A document that cannot be read still yields a part, with `publisherDocument`
|
|
5
|
+
* null, so the chat can say the document is unavailable instead of dropping it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertPublisherDocumentPartV2(part: AiPublisherDocumentPart): IChatConversationPublisherDocumentContentV2;
|
|
8
|
+
//# sourceMappingURL=publisherDocumentPartConvertorV2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisherDocumentPartConvertorV2.d.ts","sourceRoot":"","sources":["../../../src/convertors/fromBackend/publisherDocumentPartConvertorV2.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,KAAK,2CAA2C,EAAE,MAAM,2BAA2B,CAAC;AAmC7F;;;GAGG;AACH,wBAAgB,8BAA8B,CAC1C,IAAI,EAAE,uBAAuB,GAC9B,2CAA2C,CAU7C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { yamlPublisherDocumentToDefinitionV2, } from "@gooddata/sdk-code-convertors";
|
|
3
|
+
import { validateLoadedPublisherEntityV2 } from "@gooddata/sdk-model";
|
|
4
|
+
// The convertor throws on a document it cannot read, so this only has to tell a document from any other
|
|
5
|
+
// value; what is inside is the convertor's and the validator's to reject.
|
|
6
|
+
function isAacPublisherDocumentV2(value) {
|
|
7
|
+
return typeof value === "object" && value !== null && "type" in value && value.type === "document";
|
|
8
|
+
}
|
|
9
|
+
function toPublisherDocumentDefinitionV2(document) {
|
|
10
|
+
if (!isAacPublisherDocumentV2(document)) {
|
|
11
|
+
console.error("The document part does not carry a document.");
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const definition = yamlPublisherDocumentToDefinitionV2(document);
|
|
16
|
+
const issues = validateLoadedPublisherEntityV2(definition);
|
|
17
|
+
if (issues.length > 0) {
|
|
18
|
+
console.error("The document part's document is not valid.", issues);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return definition;
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error(e);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Converts a document part. A document that cannot be read still yields a part, with `publisherDocument`
|
|
30
|
+
* null, so the chat can say the document is unavailable instead of dropping it.
|
|
31
|
+
*/
|
|
32
|
+
export function convertPublisherDocumentPartV2(part) {
|
|
33
|
+
return {
|
|
34
|
+
type: "publisherDocumentV2",
|
|
35
|
+
publisherDocument: part.document ? toPublisherDocumentDefinitionV2(part.document) : null,
|
|
36
|
+
saved: part.saved_document_id,
|
|
37
|
+
ref: part.document_ref,
|
|
38
|
+
baseDocumentId: part.base_document_id,
|
|
39
|
+
refines: part.refines_ref,
|
|
40
|
+
...(part.reworks_open_document ? { reworksOpenDocument: true } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-backend-tiger",
|
|
3
|
-
"version": "11.65.0-alpha.
|
|
3
|
+
"version": "11.65.0-alpha.11",
|
|
4
4
|
"description": "GoodData Backend SPI implementation for GoodData Cloud and GoodData.CN",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"ts-invariant": "0.10.3",
|
|
35
35
|
"tslib": "2.8.1",
|
|
36
36
|
"uuid": "11.1.1",
|
|
37
|
-
"@gooddata/api-client-tiger": "11.65.0-alpha.
|
|
38
|
-
"@gooddata/sdk-backend-
|
|
39
|
-
"@gooddata/sdk-
|
|
40
|
-
"@gooddata/sdk-
|
|
41
|
-
"@gooddata/
|
|
42
|
-
"@gooddata/
|
|
37
|
+
"@gooddata/api-client-tiger": "11.65.0-alpha.11",
|
|
38
|
+
"@gooddata/sdk-backend-spi": "11.65.0-alpha.11",
|
|
39
|
+
"@gooddata/sdk-backend-base": "11.65.0-alpha.11",
|
|
40
|
+
"@gooddata/sdk-code-convertors": "11.65.0-alpha.11",
|
|
41
|
+
"@gooddata/sdk-model": "11.65.0-alpha.11",
|
|
42
|
+
"@gooddata/util": "11.65.0-alpha.11"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@gooddata/fixtures": "3.7.0",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"oxlint-tsgolint": "7.0.2001",
|
|
65
65
|
"typescript": "7.0.2",
|
|
66
66
|
"vitest": "5.0.4",
|
|
67
|
-
"@gooddata/catalog-export": "11.65.0-alpha.
|
|
68
|
-
"@gooddata/eslint-config": "11.65.0-alpha.
|
|
69
|
-
"@gooddata/oxlint-config": "11.65.0-alpha.
|
|
70
|
-
"@gooddata/reference-workspace": "11.65.0-alpha.
|
|
67
|
+
"@gooddata/catalog-export": "11.65.0-alpha.11",
|
|
68
|
+
"@gooddata/eslint-config": "11.65.0-alpha.11",
|
|
69
|
+
"@gooddata/oxlint-config": "11.65.0-alpha.11",
|
|
70
|
+
"@gooddata/reference-workspace": "11.65.0-alpha.11"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"_phase:build": "npm run build",
|