@epam/ai-dial-chat-hooks 1.3.0-dev.288 → 1.3.0-dev.289

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 (47) hide show
  1. package/api-error/api-error.d.ts +2 -0
  2. package/api-error/api-error.d.ts.map +1 -1
  3. package/api-error/api-error.js +31 -23
  4. package/catalog/map-skill-to-catalog-item.js +19 -19
  5. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts +2 -4
  6. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts.map +1 -1
  7. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +94 -112
  8. package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts +41 -0
  9. package/catalog/useCatalogItemDelete/useCatalogItemDelete.d.ts.map +1 -0
  10. package/catalog/useCatalogItemDelete/useCatalogItemDelete.js +37 -0
  11. package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -0
  12. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  13. package/catalog/usePublishFolders/usePublishFolders.js +32 -29
  14. package/catalog.js +11 -10
  15. package/conversation/conversation-title-stream.d.ts +33 -0
  16. package/conversation/conversation-title-stream.d.ts.map +1 -0
  17. package/conversation/conversation-title-stream.js +103 -0
  18. package/conversation/useConversationExport/useConversationExport.js +46 -46
  19. package/conversation/useConversationHandlers/useConversationHandlers.js +39 -39
  20. package/conversation/useConversationStream/useConversationStream.js +93 -93
  21. package/conversation.js +5 -4
  22. package/entry-points/catalog.d.ts +1 -0
  23. package/entry-points/catalog.d.ts.map +1 -1
  24. package/entry-points/conversation.d.ts +1 -0
  25. package/entry-points/conversation.d.ts.map +1 -1
  26. package/files/dial-file-manager-copy-move.util.js +16 -16
  27. package/files/dial-file-manager-mapping.util.js +17 -17
  28. package/files/useDialFileListing/useDialFileListing.js +113 -113
  29. package/files/useDialFileMutations/useDialFileMutations.js +47 -47
  30. package/index.d.ts +2 -0
  31. package/index.d.ts.map +1 -1
  32. package/index.js +213 -211
  33. package/oauth/useToolsetLogin/useToolsetLogin.d.ts +7 -1
  34. package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +1 -1
  35. package/oauth/useToolsetLogin/useToolsetLogin.js +40 -21
  36. package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.js +10 -10
  37. package/package.json +18 -18
  38. package/project/project-mapping.js +12 -12
  39. package/project/use-project-actions.js +12 -12
  40. package/project/use-project-watch.js +12 -12
  41. package/prompt/prompt.d.ts +11 -0
  42. package/prompt/prompt.d.ts.map +1 -1
  43. package/prompt/prompt.js +7 -3
  44. package/scheduled-task/use-scheduled-task-runs.js +13 -13
  45. package/usage/map-user-usage-to-model-limits.js +21 -21
  46. package/useShareLink/useShareLink.js +18 -18
  47. package/utils.js +21 -21
@@ -27,4 +27,6 @@ export declare const getApiErrorStatus: (error: unknown) => number | undefined;
27
27
  export declare const getApiErrorMessage: (error: unknown) => Promise<string | null>;
28
28
  /** Normalizes any API error into a `{ status?, message, traceId?, code?, upstreamCode?, upstreamMessage? }` shape. */
29
29
  export declare const getApiErrorDetails: (error: unknown) => Promise<ApiErrorDetails>;
30
+ /** Shared item's title carried by a refused `acceptInvitation` error, when the backend sent one. */
31
+ export declare const getAcceptInvitationErrorItemName: (error: unknown) => Promise<string | undefined>;
30
32
  //# sourceMappingURL=api-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-error.d.ts","sourceRoot":"","sources":["../../src/api-error/api-error.ts"],"names":[],"mappings":"AAMA,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EA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AC,eAAe,CAyDzB,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,gCAAgC,GAC3C,OAAO,OAAO,KACb,OAAO,CAAC,MAAM,GAAG,SAAS,CAY5B,CAAC"}
@@ -1,40 +1,41 @@
1
+ import { ResponseError as e } from "@epam/ai-dial-chat-api-client";
1
2
  //#region src/api-error/api-error.ts
2
- var e = (e) => typeof e == "object" && !!e, t = (t) => {
3
- if (!e(t)) return !1;
4
- let { message: n, error: r } = t;
3
+ var t = (e) => typeof e == "object" && !!e, n = (e) => {
4
+ if (!t(e)) return !1;
5
+ let { message: n, error: r } = e;
5
6
  return typeof n == "string" || Array.isArray(n) && n.every((e) => typeof e == "string") || typeof r == "string";
6
- }, n = (e) => t(e) ? Array.isArray(e.message) ? e.message.join("\n") : e.message ? e.message : e.error ? e.error : null : null, r = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/, i = "0".repeat(32), a = "0".repeat(16), o = (e) => {
7
+ }, r = (e) => n(e) ? Array.isArray(e.message) ? e.message.join("\n") : e.message ? e.message : e.error ? e.error : null : null, i = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/, a = "0".repeat(32), o = "0".repeat(16), s = (e) => {
7
8
  if (typeof e != "string") return;
8
- let t = r.exec(e);
9
+ let t = i.exec(e);
9
10
  if (!t) return;
10
- let [, n, o] = t;
11
- if (n !== i && o !== a) return n;
12
- }, s = (t) => {
13
- if (!e(t)) return;
14
- let n = t.response;
15
- if (e(n) && typeof n.json == "function") return n;
11
+ let [, n, r] = t;
12
+ if (n !== a && r !== o) return n;
16
13
  }, c = (e) => {
17
- let t = s(e);
14
+ if (!t(e)) return;
15
+ let n = e.response;
16
+ if (t(n) && typeof n.json == "function") return n;
17
+ }, l = (e) => {
18
+ let t = c(e);
18
19
  return t?.status ? t.status === 404 : !1;
19
- }, l = (e) => s(e)?.status, u = async (e) => {
20
- let t = s(e);
20
+ }, u = (e) => c(e)?.status, d = async (e) => {
21
+ let t = c(e);
21
22
  if (t) try {
22
- let e = n(await t.json());
23
+ let e = r(await t.json());
23
24
  if (e !== null) return e;
24
25
  } catch {
25
26
  return null;
26
27
  }
27
28
  return e instanceof Error && e.message ? e.message : null;
28
- }, d = async (t) => {
29
- let r = s(t), i = r?.status, a = null, c, l = !1, u, d, f;
30
- if (r) try {
31
- let t = await (typeof r.clone == "function" ? r.clone() : r).json();
32
- a = n(t), e(t) && (u = typeof t.code == "string" ? t.code : void 0, d = typeof t.upstreamCode == "string" ? t.upstreamCode : void 0, f = typeof t.upstreamMessage == "string" ? t.upstreamMessage : void 0, c = o(t.traceparent));
29
+ }, f = async (e) => {
30
+ let n = c(e), i = n?.status, a = null, o, l = !1, u, d, f;
31
+ if (n) try {
32
+ let e = await (typeof n.clone == "function" ? n.clone() : n).json();
33
+ a = r(e), t(e) && (u = typeof e.code == "string" ? e.code : void 0, d = typeof e.upstreamCode == "string" ? e.upstreamCode : void 0, f = typeof e.upstreamMessage == "string" ? e.upstreamMessage : void 0, o = s(e.traceparent));
33
34
  } catch {
34
35
  l = !0;
35
36
  }
36
- !l && a === null && t instanceof Error && t.message && (a = t.message);
37
- let p = c ?? o(typeof r?.headers?.get == "function" ? r.headers.get("traceparent") : void 0);
37
+ !l && a === null && e instanceof Error && e.message && (a = e.message);
38
+ let p = o ?? s(typeof n?.headers?.get == "function" ? n.headers.get("traceparent") : void 0);
38
39
  return {
39
40
  status: i,
40
41
  message: a,
@@ -43,6 +44,13 @@ var e = (e) => typeof e == "object" && !!e, t = (t) => {
43
44
  ...d ? { upstreamCode: d } : {},
44
45
  ...f ? { upstreamMessage: f } : {}
45
46
  };
47
+ }, p = async (t) => {
48
+ if (t instanceof e) try {
49
+ let e = await t.response.clone().json();
50
+ return typeof e.itemName == "string" && e.itemName ? e.itemName : void 0;
51
+ } catch {
52
+ return;
53
+ }
46
54
  };
47
55
  //#endregion
48
- export { d as getApiErrorDetails, u as getApiErrorMessage, l as getApiErrorStatus, c as isConversationNotFoundError };
56
+ export { p as getAcceptInvitationErrorItemName, f as getApiErrorDetails, d as getApiErrorMessage, u as getApiErrorStatus, l as isConversationNotFoundError };
@@ -2,9 +2,9 @@ import { safeDecodeURIComponent as e, stripSurroundingSlashes as t } from "../sh
2
2
  import { formatCalendarDate as n } from "../shared/formatting.js";
3
3
  import { SKILL_FOLDER_MARKER as r } from "../skill/skill.js";
4
4
  import { SkillSource as i } from "../skill/skill-types.js";
5
- import { CatalogEntityType as a, formatLastUsed as o } from "@epam/ai-dial-chat-shared";
6
- import { CatalogContentNodeType as s } from "@epam/ai-dial-catalog";
7
- import { SkillMetadataItemDtoNodeTypeEnum as c } from "@epam/ai-dial-chat-api-client";
5
+ import { SkillMetadataItemDtoNodeTypeEnum as a } from "@epam/ai-dial-chat-api-client";
6
+ import { CatalogEntityType as o, formatLastUsed as s } from "@epam/ai-dial-chat-shared";
7
+ import { CatalogContentNodeType as c } from "@epam/ai-dial-catalog";
8
8
  //#region src/catalog/map-skill-to-catalog-item.ts
9
9
  var l = {
10
10
  [i.Personal]: "personal",
@@ -14,21 +14,21 @@ var l = {
14
14
  let r = (n ?? "").split("/").filter(Boolean), i = t.split("/").filter(Boolean).slice(2, -1);
15
15
  return i.length === r.length ? i.map(e) : r;
16
16
  }, d = (e, t, n) => [n[l[t]], ...u(e.url, e.parentPath)], f = (e, { folderLabels: t, source: n, favoriteIds: r }) => {
17
- let s = r.has(e.url), c = n === i.Public, l = n === i.Personal;
17
+ let a = r.has(e.url), c = n === i.Public, l = n === i.Personal;
18
18
  return {
19
19
  id: e.url,
20
- type: a.Skill,
20
+ type: o.Skill,
21
21
  name: e.name,
22
22
  description: e.description ?? "",
23
23
  version: "",
24
- lastUsed: o(e.updatedAt),
24
+ lastUsed: s(e.updatedAt),
25
25
  createdAt: e.createdAt,
26
26
  updatedAt: e.updatedAt,
27
27
  isFeatured: !1,
28
28
  isHidden: !1,
29
29
  topics: [],
30
- isUserFavorite: s,
31
- isStarred: s,
30
+ isUserFavorite: a,
31
+ isStarred: a,
32
32
  isMyApp: l && (e.isMy ?? !0),
33
33
  sharedWithMe: e.sharedWithMe ?? n === i.SharedWithMe,
34
34
  isEditable: !c && (e.canEdit ?? l),
@@ -47,7 +47,7 @@ var l = {
47
47
  label: t.bundledResourcesLabel,
48
48
  value: p(e.bundledResources)
49
49
  }), n;
50
- }, h = (e) => e.filter((e) => e.nodeType === c.Item), g = (e, n) => {
50
+ }, h = (e) => e.filter((e) => e.nodeType === a.Item), g = (e, n) => {
51
51
  let r = t(n), i = r ? `${r}/files` : "files";
52
52
  return h(e).find((e) => {
53
53
  let n = t(e.path);
@@ -76,7 +76,7 @@ var l = {
76
76
  let r = t.get(e);
77
77
  if (r != null) return r.items;
78
78
  let i = e.split("/"), a = b(i.slice(0, -1).join("/"), t, n), o = {
79
- type: s.Folder,
79
+ type: c.Folder,
80
80
  id: e,
81
81
  name: i[i.length - 1],
82
82
  items: []
@@ -90,21 +90,21 @@ var l = {
90
90
  }
91
91
  return e.name.localeCompare(n.name);
92
92
  });
93
- for (let t of e) t.type === s.Folder && x(t.items, !1);
93
+ for (let t of e) t.type === c.Folder && x(t.items, !1);
94
94
  }, S = (e, t) => {
95
95
  let n = /* @__PURE__ */ new Map(), i = [];
96
- for (let a of e) {
97
- let e = _(a.path, t);
96
+ for (let o of e) {
97
+ let e = _(o.path, t);
98
98
  if (e == null) continue;
99
- if (a.nodeType === c.Folder) {
99
+ if (o.nodeType === a.Folder) {
100
100
  b(e, n, i);
101
101
  continue;
102
102
  }
103
- let o = e.lastIndexOf("/"), l = o === -1 ? "" : e.slice(0, o);
104
- a.name === r ? b(l, n, i) : b(l, n, i).push({
105
- type: s.File,
106
- id: a.path,
107
- name: a.name
103
+ let s = e.lastIndexOf("/"), l = s === -1 ? "" : e.slice(0, s);
104
+ o.name === r ? b(l, n, i) : b(l, n, i).push({
105
+ type: c.File,
106
+ id: o.path,
107
+ name: o.name
108
108
  });
109
109
  }
110
110
  return x(i, !0), i;
@@ -2,11 +2,9 @@ import { CatalogCreateSearch, CatalogItem, CatalogTabCreateMenu } from '@epam/ai
2
2
  import { ApplicationSchemaSummaryDto, DeploymentItemDto } from '@epam/ai-dial-chat-api-client';
3
3
  import { CatalogEntityType } from '@epam/ai-dial-chat-shared';
4
4
  import { DropdownItem } from '@epam/ai-dial-ui-kit';
5
+ import { CatalogItemDeleteNotification } from '../useCatalogItemDelete/useCatalogItemDelete';
5
6
  /** A host notification `useCatalogEditNavigation` asks to be shown for a failed delete. */
6
- export interface CatalogEditNavigationNotification {
7
- message: string;
8
- requestId?: string;
9
- }
7
+ export type CatalogEditNavigationNotification = CatalogItemDeleteNotification;
10
8
  /** Localized copy `useCatalogEditNavigation` needs for the Create menu and delete errors. */
11
9
  export interface CatalogEditNavigationLabels {
12
10
  createToolset: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useCatalogEditNavigation.d.ts","sourceRoot":"","sources":["../../../src/catalog/useCatalogEditNavigation/useCatalogEditNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAoB,MAAM,sBAAsB,CAAC;AAqBtE,2FAA2F;AAC3F,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,6FAA6F;AAC7F,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B,EAAE,MAAM,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IAC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I,CAAC;IACxC,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;;OAKG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,6FAA6F;IAC7F,YAAY,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9C,uGAAuG;IACvG,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAC3E,4GAA4G;IAC5G,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,4aA2BtC,8BAA8B,KAAG,8BAqRnC,CAAC"}
1
+ {"version":3,"file":"useCatalogEditNavigation.d.ts","sourceRoot":"","sources":["../../../src/catalog/useCatalogEditNavigation/useCatalogEditNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAoB,MAAM,sBAAsB,CAAC;AAOtE,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,8CAA8C,CAAC;AAatD,2FAA2F;AAC3F,MAAM,MAAM,iCAAiC,GAAG,6BAA6B,CAAC;AAE9E,6FAA6F;AAC7F,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B,EAAE,MAAM,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,sFAAsF;IACtF,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,E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,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;;OAKG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,6FAA6F;IAC7F,YAAY,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9C,uGAAuG;IACvG,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAC3E,4GAA4G;IAC5G,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GAAI,4aA2BtC,8BAA8B,KAAG,8BAqPnC,CAAC"}
@@ -1,166 +1,148 @@
1
- import { getApiErrorDetails as e } from "../../api-error/api-error.js";
2
- import { findDeploymentByIdOrReference as t } from "../deployment-id.js";
3
- import { parseSkillResourceUrl as n } from "../../skill/skill-types.js";
4
- import { getRunnerSchemas as r, isQuickAppSchema as i } from "../../shared/application-schema.js";
5
- import { CatalogEntityType as a } from "@epam/ai-dial-chat-shared";
6
- import { useCallback as o, useMemo as s, useState as c } from "react";
7
- import { DropdownItemType as l } from "@epam/ai-dial-ui-kit";
1
+ import { findDeploymentByIdOrReference as e } from "../deployment-id.js";
2
+ import { getRunnerSchemas as t, isQuickAppSchema as n } from "../../shared/application-schema.js";
3
+ import { useCatalogItemDelete as r } from "../useCatalogItemDelete/useCatalogItemDelete.js";
4
+ import { CatalogEntityType as i } from "@epam/ai-dial-chat-shared";
5
+ import { useCallback as a, useMemo as o, useState as s } from "react";
6
+ import { DropdownItemType as c } from "@epam/ai-dial-ui-kit";
8
7
  //#region src/catalog/useCatalogEditNavigation/useCatalogEditNavigation.ts
9
- var u = () => !0, d = (e) => [...e].sort((e, t) => String(e.label ?? "").localeCompare(String(t.label ?? ""), void 0, { sensitivity: "base" })), f = ({ deployments: f, isCustomAppsEnabled: p, isSchemaAppsEnabled: m, isHideCustomAppCreationEnabled: h, isToolsetsEnabled: g, isPromptsEnabled: _, schemas: v, urls: y, onNavigate: b, deletePrompt: x, deleteToolset: S, deleteSkill: C, deleteApplication: w, refetchPrompts: T, refetchToolsets: E, refetchSkills: D, refetchDeployments: O, onDeleteSuccess: k, labels: A, onNotify: j, onSkillUploadClick: M, canCreateCustomApp: N = !0, canCreateToolset: P = !0, canCreatePrompt: F = !0, canCreateSkill: I = !0, canCreateSchema: L = u }) => {
10
- let R = s(() => r(v), [v]), [z, B] = c(""), V = m && !h, H = s(() => V ? R.filter((e) => L(e.id)) : [], [
11
- V,
12
- R,
13
- L
14
- ]), U = g && P, W = p && !h && N, G = _ && F, K = H.length > 0 || U || W || I || G, q = o((e) => {
15
- if (e.type === a.Prompt) {
16
- b(y.buildPromptEditUrl(e.id));
8
+ var l = () => !0, u = (e) => [...e].sort((e, t) => String(e.label ?? "").localeCompare(String(t.label ?? ""), void 0, { sensitivity: "base" })), d = ({ deployments: d, isCustomAppsEnabled: f, isSchemaAppsEnabled: p, isHideCustomAppCreationEnabled: m, isToolsetsEnabled: h, isPromptsEnabled: g, schemas: _, urls: v, onNavigate: y, deletePrompt: b, deleteToolset: x, deleteSkill: S, deleteApplication: C, refetchPrompts: w, refetchToolsets: T, refetchSkills: E, refetchDeployments: D, onDeleteSuccess: O, labels: k, onNotify: A, onSkillUploadClick: j, canCreateCustomApp: M = !0, canCreateToolset: N = !0, canCreatePrompt: P = !0, canCreateSkill: F = !0, canCreateSchema: I = l }) => {
9
+ let L = o(() => t(_), [_]), [R, z] = s(""), B = p && !m, V = o(() => B ? L.filter((e) => I(e.id)) : [], [
10
+ B,
11
+ L,
12
+ I
13
+ ]), H = h && N, U = f && !m && M, W = g && P, G = V.length > 0 || H || U || F || W, K = a((t) => {
14
+ if (t.type === i.Prompt) {
15
+ y(v.buildPromptEditUrl(t.id));
17
16
  return;
18
17
  }
19
- if (e.type === a.Skill) {
20
- b(y.buildSkillEditUrl(e.id));
18
+ if (t.type === i.Skill) {
19
+ y(v.buildSkillEditUrl(t.id));
21
20
  return;
22
21
  }
23
- if (e.type === a.Toolset) {
24
- b(y.buildToolsetEditUrl(e.id));
22
+ if (t.type === i.Toolset) {
23
+ y(v.buildToolsetEditUrl(t.id));
25
24
  return;
26
25
  }
27
- let n = t(f, e.id);
28
- if (p && n != null && !n.applicationTypeSchemaId) {
29
- b(y.buildCustomAppEditUrl(e.id));
26
+ let r = e(d, t.id);
27
+ if (f && r != null && !r.applicationTypeSchemaId) {
28
+ y(v.buildCustomAppEditUrl(t.id));
30
29
  return;
31
30
  }
32
- let r = R.find((e) => e.id === n?.applicationTypeSchemaId)?.id ?? R.find((e) => i(e))?.id;
33
- r && b(y.buildQuickAppEditUrl(r, e.id));
31
+ let a = L.find((e) => e.id === r?.applicationTypeSchemaId)?.id ?? L.find((e) => n(e))?.id;
32
+ a && y(v.buildQuickAppEditUrl(a, t.id));
34
33
  }, [
34
+ d,
35
35
  f,
36
- p,
37
- R,
38
- b,
39
- y
40
- ]), J = o(async (t) => {
41
- try {
42
- if (t.type === a.Prompt) await x(t.id), await T();
43
- else if (t.type === a.Toolset) await S(t.id), await E();
44
- else if (t.type === a.Skill) {
45
- let e = n(t.id);
46
- if (e == null) throw Error(`Invalid skill resource url: ${t.id}`);
47
- await C(e.bucket, e.path), await D();
48
- } else await w(t.id), await O();
49
- k(t);
50
- } catch (t) {
51
- let { traceId: n } = await e(t);
52
- throw j({
53
- message: A.deleteError,
54
- requestId: n
55
- }), t;
56
- }
57
- }, [
58
- x,
59
- S,
60
- C,
61
- w,
62
- E,
63
- O,
64
- T,
65
- D,
66
- k,
67
- A,
68
- j
69
- ]), Y = s(() => {
70
- let e = z.trim().toLocaleLowerCase(), t = (t) => !e || t.toLocaleLowerCase().includes(e), n = H.map((e) => ({
36
+ L,
37
+ y,
38
+ v
39
+ ]), q = r({
40
+ deletePrompt: b,
41
+ deleteToolset: x,
42
+ deleteSkill: S,
43
+ deleteApplication: C,
44
+ refetchPrompts: w,
45
+ refetchToolsets: T,
46
+ refetchSkills: E,
47
+ refetchDeployments: D,
48
+ onDeleteSuccess: O,
49
+ deleteErrorLabel: k.deleteError,
50
+ onNotify: A
51
+ }), J = o(() => {
52
+ let e = R.trim().toLocaleLowerCase(), t = (t) => !e || t.toLocaleLowerCase().includes(e), n = V.map((e) => ({
71
53
  id: e.id,
72
54
  label: e.displayName || e.id
73
55
  })).filter((e) => t(e.label)).map((e) => ({
74
56
  key: `runner:${e.id}`,
75
57
  label: e.label,
76
- onClick: () => b(y.buildQuickAppCreateUrl(e.id))
77
- })), r = U && t(A.createToolset) ? {
58
+ onClick: () => y(v.buildQuickAppCreateUrl(e.id))
59
+ })), r = H && t(k.createToolset) ? {
78
60
  key: "toolset",
79
- label: A.createToolset,
80
- onClick: () => b(y.buildToolsetCreateUrl())
81
- } : void 0, i = W && t(A.createCustomApp) ? {
61
+ label: k.createToolset,
62
+ onClick: () => y(v.buildToolsetCreateUrl())
63
+ } : void 0, i = U && t(k.createCustomApp) ? {
82
64
  key: "custom-app",
83
- label: A.createCustomApp,
84
- onClick: () => b(y.buildCustomAppCreateUrl())
85
- } : void 0, a = I ? [{
65
+ label: k.createCustomApp,
66
+ onClick: () => y(v.buildCustomAppCreateUrl())
67
+ } : void 0, a = F ? [{
86
68
  key: "skill-write-instructions",
87
- label: A.createSkillWriteInstructions,
88
- onClick: () => b(y.buildSkillCreateUrl())
69
+ label: k.createSkillWriteInstructions,
70
+ onClick: () => y(v.buildSkillCreateUrl())
89
71
  }, {
90
72
  key: "skill-upload",
91
- label: A.createSkillUpload,
92
- onClick: M
73
+ label: k.createSkillUpload,
74
+ onClick: j
93
75
  }] : [];
94
76
  return {
95
77
  runnerOptions: n,
96
78
  toolsetOption: r,
97
79
  customAppOption: i,
98
- visibleSkillChildren: t(A.createSkill) ? a : a.filter((e) => t(String(e.label))),
99
- promptOption: G && t(A.createPrompt) ? {
80
+ visibleSkillChildren: t(k.createSkill) ? a : a.filter((e) => t(String(e.label))),
81
+ promptOption: W && t(k.createPrompt) ? {
100
82
  key: "prompt",
101
- label: A.createPrompt,
102
- onClick: () => b(y.buildPromptCreateUrl())
83
+ label: k.createPrompt,
84
+ onClick: () => y(v.buildPromptCreateUrl())
103
85
  } : void 0
104
86
  };
105
87
  }, [
106
- z,
107
- H,
108
- b,
88
+ R,
89
+ V,
109
90
  y,
110
- G,
111
- A,
112
- U,
91
+ v,
113
92
  W,
114
- I,
115
- M
116
- ]), X = s(() => {
117
- let { runnerOptions: e, toolsetOption: t, customAppOption: n, visibleSkillChildren: r, promptOption: i } = Y, a = [];
93
+ k,
94
+ H,
95
+ U,
96
+ F,
97
+ j
98
+ ]), Y = o(() => {
99
+ let { runnerOptions: e, toolsetOption: t, customAppOption: n, visibleSkillChildren: r, promptOption: i } = J, a = [];
118
100
  t && a.push(t), r.length > 0 && a.push({
119
101
  key: "skill",
120
- label: A.createSkill,
102
+ label: k.createSkill,
121
103
  children: r
122
104
  }), i && a.push(i);
123
- let o = d(n ? [n, ...e] : e), s = d(a);
105
+ let o = u(n ? [n, ...e] : e), s = u(a);
124
106
  return s.length === 0 || o.length === 0 ? [...s, ...o] : [
125
107
  ...s,
126
108
  {
127
109
  key: "create-sections-divider",
128
- type: l.Divider
110
+ type: c.Divider
129
111
  },
130
112
  {
131
113
  key: "runners-header",
132
- type: l.PlainText,
133
- label: A.createRunners
114
+ type: c.PlainText,
115
+ label: k.createRunners
134
116
  },
135
117
  ...o
136
118
  ];
137
119
  }, [
138
- Y,
139
- A.createSkill,
140
- A.createRunners
141
- ]), Z = s(() => H.length > 0 ? {
142
- value: z,
143
- onChange: B
144
- } : void 0, [H.length, z]);
120
+ J,
121
+ k.createSkill,
122
+ k.createRunners
123
+ ]), X = o(() => V.length > 0 ? {
124
+ value: R,
125
+ onChange: z
126
+ } : void 0, [V.length, R]);
145
127
  return {
146
- handleEdit: q,
147
- handleDelete: J,
148
- createOptions: X,
149
- createSearch: Z,
150
- createMenuByType: s(() => {
151
- let { runnerOptions: e, toolsetOption: t, customAppOption: n, visibleSkillChildren: r, promptOption: i } = Y;
128
+ handleEdit: K,
129
+ handleDelete: q,
130
+ createOptions: Y,
131
+ createSearch: X,
132
+ createMenuByType: o(() => {
133
+ let { runnerOptions: e, toolsetOption: t, customAppOption: n, visibleSkillChildren: r, promptOption: a } = J;
152
134
  return {
153
- [a.Agent]: {
154
- options: d(n ? [...e, n] : e),
155
- search: Z
135
+ [i.Agent]: {
136
+ options: u(n ? [...e, n] : e),
137
+ search: X
156
138
  },
157
- [a.Toolset]: { options: t ? [t] : [] },
158
- [a.Skill]: { options: r },
159
- [a.Prompt]: { options: i ? [i] : [] }
139
+ [i.Toolset]: { options: t ? [t] : [] },
140
+ [i.Skill]: { options: r },
141
+ [i.Prompt]: { options: a ? [a] : [] }
160
142
  };
161
- }, [Y, Z]),
162
- hasCreateOptions: K
143
+ }, [J, X]),
144
+ hasCreateOptions: G
163
145
  };
164
146
  };
165
147
  //#endregion
166
- export { f as useCatalogEditNavigation };
148
+ export { d as useCatalogEditNavigation };
@@ -0,0 +1,41 @@
1
+ import { CatalogItem } from '@epam/ai-dial-catalog';
2
+ /** A host notification `useCatalogItemDelete` asks to be shown for a failed delete. */
3
+ export interface CatalogItemDeleteNotification {
4
+ /** Localized error message. */
5
+ message: string;
6
+ /** Trace id of the failed request, when the API returned one. */
7
+ requestId?: string;
8
+ }
9
+ /** Parameters accepted by {@link useCatalogItemDelete}. */
10
+ export interface UseCatalogItemDeleteParams {
11
+ /** Already-configured DIAL Core operation: deletes a personal or shared prompt. */
12
+ deletePrompt: (id: string) => Promise<unknown>;
13
+ /** Already-configured DIAL Core operation: deletes a toolset. */
14
+ deleteToolset: (id: string) => Promise<unknown>;
15
+ /** Already-configured DIAL Core operation: deletes a skill package. */
16
+ deleteSkill: (bucket: string, path: string) => Promise<unknown>;
17
+ /** Already-configured DIAL Core operation: deletes a deployment/application. */
18
+ deleteApplication: (id: string) => Promise<unknown>;
19
+ /** Refetches the prompt listing after a prompt is deleted. */
20
+ refetchPrompts: () => Promise<void>;
21
+ /** Refetches the toolset listing after a toolset is deleted. */
22
+ refetchToolsets: () => Promise<void>;
23
+ /** Refetches the skill listing after a skill is deleted. */
24
+ refetchSkills: () => Promise<void>;
25
+ /** Refetches the deployment listing after an application is deleted. */
26
+ refetchDeployments: () => Promise<void>;
27
+ /** Called after a successful delete, so the host can notify with its own entity/operation vocabulary. */
28
+ onDeleteSuccess: (item: CatalogItem) => void;
29
+ /** Localized message shown when a delete fails. */
30
+ deleteErrorLabel: string;
31
+ /** Called to surface a host notification when a delete fails. */
32
+ onNotify: (notification: CatalogItemDeleteNotification) => void;
33
+ }
34
+ /**
35
+ * Returns a delete handler that removes a catalog item through the endpoint
36
+ * its type owns, refetches that listing and reports success; on failure it
37
+ * notifies with the request's trace id and rethrows, so a confirmation stays
38
+ * open.
39
+ */
40
+ export declare const useCatalogItemDelete: ({ deletePrompt, deleteToolset, deleteSkill, deleteApplication, refetchPrompts, refetchToolsets, refetchSkills, refetchDeployments, onDeleteSuccess, deleteErrorLabel, onNotify, }: UseCatalogItemDeleteParams) => ((item: CatalogItem) => Promise<void>);
41
+ //# sourceMappingURL=useCatalogItemDelete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCatalogItemDelete.d.ts","sourceRoot":"","sources":["../../../src/catalog/useCatalogItemDelete/useCatalogItemDelete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMzD,uFAAuF;AACvF,MAAM,WAAW,6BAA6B;IAC5C,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,2DAA2D;AAC3D,MAAM,WAAW,0BAA0B;IACzC,mFAAmF;IACnF,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,iEAAiE;IACjE,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,uEAAuE;IACvE,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChE,gFAAgF;IAChF,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACpD,8DAA8D;IAC9D,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,gEAAgE;IAChE,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,4DAA4D;IAC5D,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,wEAAwE;IACxE,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,yGAAyG;IACzG,eAAe,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC7C,mDAAmD;IACnD,gBAAgB,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,QAAQ,EAAE,CAAC,YAAY,EAAE,6BAA6B,KAAK,IAAI,CAAC;CACjE;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,mLAYlC,0BAA0B,KAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CA0ClE,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { getApiErrorDetails as e } from "../../api-error/api-error.js";
2
+ import { parseSkillResourceUrl as t } from "../../skill/skill-types.js";
3
+ import { CatalogEntityType as n } from "@epam/ai-dial-chat-shared";
4
+ import { useCallback as r } from "react";
5
+ //#region src/catalog/useCatalogItemDelete/useCatalogItemDelete.ts
6
+ var i = ({ deletePrompt: i, deleteToolset: a, deleteSkill: o, deleteApplication: s, refetchPrompts: c, refetchToolsets: l, refetchSkills: u, refetchDeployments: d, onDeleteSuccess: f, deleteErrorLabel: p, onNotify: m }) => r(async (r) => {
7
+ try {
8
+ if (r.type === n.Prompt) await i(r.id), await c();
9
+ else if (r.type === n.Toolset) await a(r.id), await l();
10
+ else if (r.type === n.Skill) {
11
+ let e = t(r.id);
12
+ if (e == null) throw Error(`Invalid skill resource url: ${r.id}`);
13
+ await o(e.bucket, e.path), await u();
14
+ } else await s(r.id), await d();
15
+ f(r);
16
+ } catch (t) {
17
+ let { traceId: n } = await e(t);
18
+ throw m({
19
+ message: p,
20
+ requestId: n
21
+ }), t;
22
+ }
23
+ }, [
24
+ i,
25
+ a,
26
+ o,
27
+ s,
28
+ c,
29
+ l,
30
+ u,
31
+ d,
32
+ f,
33
+ p,
34
+ m
35
+ ]);
36
+ //#endregion
37
+ export { i as useCatalogItemDelete };
@@ -1,5 +1,13 @@
1
1
  import { ListFilesResponseDto } from '@epam/ai-dial-chat-api-client';
2
2
  import { PublishFolderNode } from '@epam/ai-dial-publish-panel';
3
+ /** Returns whether a publish destination folder accepts writes: any folder not under a `Production` segment. */
4
+ export declare const hasPublishFolderWriteAccess: (folderPath: string[]) => boolean;
5
+ /**
6
+ * Returns the remembered destination keys with `folderKey` moved to the front
7
+ * and the list capped at 50, or `undefined` when nothing changes (an empty
8
+ * key, or one already first). Ignores a stored value that is not an array.
9
+ */
10
+ export declare const rememberPublishFolderKey: (storedKeys: unknown, folderKey: string) => string[] | undefined;
3
11
  /** Parameters for {@link usePublishFolders}. */
4
12
  export interface UsePublishFoldersParams {
5
13
  /** Lists one folder level of the Organization/public files bucket. */
@@ -1 +1 @@
1
- {"version":3,"file":"usePublishFolders.d.ts","sourceRoot":"","sources":["../../../src/catalog/usePublishFolders/usePublishFolders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAuCrC,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,eAAe,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,CA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