@gooddata/sdk-backend-tiger 11.51.0-alpha.4 → 11.51.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.
@@ -1,4 +1,4 @@
1
- export declare const LIB_VERSION = "11.51.0-alpha.4";
1
+ export declare const LIB_VERSION = "11.51.0-alpha.5";
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.51.0-alpha.4";
3
+ export const LIB_VERSION = "11.51.0-alpha.5";
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";
@@ -422,7 +422,12 @@ class ServerSentEventsDataConverter extends TransformStream {
422
422
  controller.enqueue(convertChatConversationErrorFromBackend(event.data, traceIdProvider()));
423
423
  }
424
424
  else if (event.type === "item" && "item" in event.data) {
425
- controller.enqueue(convertChatConversationItemFromBackend(event.data.item, undefined, dateNormalizer, locale, timezone));
425
+ const item = convertChatConversationItemFromBackend(event.data.item, undefined, dateNormalizer, locale, timezone);
426
+ // Item is dropped (undefined) when its content type is unrecognized by
427
+ // this frontend version - do not enqueue anything for it.
428
+ if (item) {
429
+ controller.enqueue(item);
430
+ }
426
431
  }
427
432
  },
428
433
  });
@@ -3,7 +3,7 @@ import { type IChatConversation, type IChatConversationError, type IChatConversa
3
3
  import type { FormattingLocale } from "./dateFormatting/defaultDateFormatter.js";
4
4
  import { type DateNormalizer } from "./dateFormatting/types.js";
5
5
  export declare function convertChatConversationFromBackend(conversation: AiConversationResponse): IChatConversation;
6
- export declare function convertChatConversationItemFromBackend(item: AiConversationItemResponse, responses: AiConversationResponseList["responses"] | undefined, dateNormalizer: DateNormalizer, locale?: FormattingLocale, timezone?: string): IChatConversationItem;
6
+ export declare function convertChatConversationItemFromBackend(item: AiConversationItemResponse, responses: AiConversationResponseList["responses"] | undefined, dateNormalizer: DateNormalizer, locale?: FormattingLocale, timezone?: string): IChatConversationItem | undefined;
7
7
  export declare function convertChatConversationItemsFromBackend(items: AiConversationItemResponse[], responses: AiConversationResponseList["responses"] | undefined, dateNormalizer: DateNormalizer, locale?: FormattingLocale, timezone?: string): IChatConversationItem[];
8
8
  export declare function convertChatConversationErrorFromBackend(item: Partial<{
9
9
  statusCode: number;
@@ -1 +1 @@
1
- {"version":3,"file":"genAIConvertor.d.ts","sourceRoot":"","sources":["../../../src/convertors/fromBackend/genAIConvertor.ts"],"names":[],"mappings":"AAIA,OAAO,EAGH,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAK/B,KAAK,aAAa,EAQrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEH,KAAK,iBAAiB,EAEtB,KAAK,sBAAsB,EAE3B,KAAK,qBAAqB,EAE1B,KAAK,gBAAgB,EAExB,MAAM,2BAA2B,CAAC;AA4BnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,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,cAAc,EAAE,cAAc,EAC9B,MAAM,CAAC,EAAE,gBAAgB,EACzB,QAAQ,CAAC,EAAE,MAAM,GAClB,qBAAqB,CAevB;AAED,wBAAgB,uCAAuC,CACnD,KAAK,EAAE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B,GAAG,SAAS,CAoBnC;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,gBAAgB,EACzB,QAAQ,CAAC,EAAE,MAAM,GAClB,qBAAqB,EAAE,CAMzB;AA0JD,wBAAgB,uCAAuC,CACnD,IAAI,EAAE,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACrE,OAAO,CAAC,EAAE,MAAM,GACjB,sBAAsB,CAQxB;AA2FD,wBAAgB,oCAAoC,CAChD,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GACvC,gBAAgB,CAQlB"}
@@ -20,6 +20,10 @@ export function convertChatConversationFromBackend(conversation) {
20
20
  };
21
21
  }
22
22
  export function convertChatConversationItemFromBackend(item, responses, dateNormalizer, locale, timezone) {
23
+ const content = convertChatConversationContentFromBackend(item.content, dateNormalizer, locale, timezone);
24
+ if (!content) {
25
+ return undefined;
26
+ }
23
27
  const response = responses?.find((r) => r.responseId === item.responseId);
24
28
  return {
25
29
  type: "item",
@@ -29,13 +33,15 @@ export function convertChatConversationItemFromBackend(item, responses, dateNorm
29
33
  replyTo: item.replyTo ?? undefined,
30
34
  createdAt: new Date(item.createdAt).getTime(),
31
35
  feedback: convertChatConversationFeedbackFromBackend(response),
32
- content: convertChatConversationContentFromBackend(item.content, dateNormalizer, locale, timezone),
36
+ content,
33
37
  agentId: item.newAgentId ?? undefined,
34
38
  oldAgentId: item.oldAgentId ?? undefined,
35
39
  };
36
40
  }
37
41
  export function convertChatConversationItemsFromBackend(items, responses, dateNormalizer, locale, timezone) {
38
- return items.map((item) => convertChatConversationItemFromBackend(item, responses, dateNormalizer, locale, timezone));
42
+ return items
43
+ .map((item) => convertChatConversationItemFromBackend(item, responses, dateNormalizer, locale, timezone))
44
+ .filter((item) => item !== undefined);
39
45
  }
40
46
  function convertChatConversationFeedbackFromBackend(response) {
41
47
  if (!response?.feedback) {
@@ -64,7 +70,10 @@ function convertChatConversationContentFromBackend(content, dateNormalizer, loca
64
70
  case "multipart":
65
71
  return {
66
72
  type: "multipart",
67
- parts: content.parts.map((part) => {
73
+ // Unknown parts are dropped rather than failing the whole item, so the rest
74
+ // of the message (known parts) keeps rendering normally.
75
+ parts: content.parts
76
+ .map((part) => {
68
77
  switch (part.type) {
69
78
  case "text":
70
79
  return {
@@ -117,10 +126,13 @@ function convertChatConversationContentFromBackend(content, dateNormalizer, loca
117
126
  relationships: convertSearchRelationships(part.relationships),
118
127
  };
119
128
  default:
129
+ // Unknown part type (e.g. sent by a newer backend): log and drop
130
+ // it, do not fail the whole item.
120
131
  assertNever(part);
121
- throw new Error(`Unexpected part: ${JSON.stringify(part)}`);
132
+ return undefined;
122
133
  }
123
- }),
134
+ })
135
+ .filter((part) => part !== undefined),
124
136
  suggestions: convertChatSuggestionItemFromBackend(content.suggestions),
125
137
  };
126
138
  case "toolCall":
@@ -138,8 +150,10 @@ function convertChatConversationContentFromBackend(content, dateNormalizer, loca
138
150
  result: tryParseJson(content.result),
139
151
  };
140
152
  default:
153
+ // Unknown content type (e.g. sent by a newer backend): log and drop the item,
154
+ // do not fail the whole conversation stream.
141
155
  assertNever(content);
142
- throw new Error(`Unexpected content: ${JSON.stringify(content)}`);
156
+ return undefined;
143
157
  }
144
158
  }
145
159
  function tryParseJson(jsonString) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-backend-tiger",
3
- "version": "11.51.0-alpha.4",
3
+ "version": "11.51.0-alpha.5",
4
4
  "description": "GoodData Backend SPI implementation for GoodData Cloud and GoodData.CN",
5
5
  "license": "MIT",
6
6
  "author": "GoodData",
@@ -33,12 +33,12 @@
33
33
  "ts-invariant": "0.10.3",
34
34
  "tslib": "2.8.1",
35
35
  "uuid": "11.1.1",
36
- "@gooddata/api-client-tiger": "11.51.0-alpha.4",
37
- "@gooddata/sdk-backend-spi": "11.51.0-alpha.4",
38
- "@gooddata/sdk-backend-base": "11.51.0-alpha.4",
39
- "@gooddata/sdk-code-convertors": "11.51.0-alpha.4",
40
- "@gooddata/sdk-model": "11.51.0-alpha.4",
41
- "@gooddata/util": "11.51.0-alpha.4"
36
+ "@gooddata/sdk-backend-spi": "11.51.0-alpha.5",
37
+ "@gooddata/api-client-tiger": "11.51.0-alpha.5",
38
+ "@gooddata/sdk-code-convertors": "11.51.0-alpha.5",
39
+ "@gooddata/sdk-backend-base": "11.51.0-alpha.5",
40
+ "@gooddata/sdk-model": "11.51.0-alpha.5",
41
+ "@gooddata/util": "11.51.0-alpha.5"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@gooddata/fixtures": "3.7.0",
@@ -65,10 +65,10 @@
65
65
  "oxlint-tsgolint": "0.15.0",
66
66
  "typescript": "5.9.3",
67
67
  "vitest": "4.1.8",
68
- "@gooddata/catalog-export": "11.51.0-alpha.4",
69
- "@gooddata/eslint-config": "11.51.0-alpha.4",
70
- "@gooddata/oxlint-config": "11.51.0-alpha.4",
71
- "@gooddata/reference-workspace": "11.51.0-alpha.4"
68
+ "@gooddata/catalog-export": "11.51.0-alpha.5",
69
+ "@gooddata/eslint-config": "11.51.0-alpha.5",
70
+ "@gooddata/reference-workspace": "11.51.0-alpha.5",
71
+ "@gooddata/oxlint-config": "11.51.0-alpha.5"
72
72
  },
73
73
  "scripts": {
74
74
  "_phase:build": "npm run build",