@epam/ai-dial-chat-hooks 1.3.6 → 1.4.0-dev.103

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 (92) hide show
  1. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  2. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  3. package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
  4. package/catalog/create-publish-api.d.ts +9 -1
  5. package/catalog/create-publish-api.d.ts.map +1 -1
  6. package/catalog/create-publish-api.js +9 -0
  7. package/catalog/publish.d.ts +2 -0
  8. package/catalog/publish.d.ts.map +1 -1
  9. package/catalog/publish.js +4 -4
  10. package/catalog/resource-save-adapter.d.ts +7 -2
  11. package/catalog/resource-save-adapter.d.ts.map +1 -1
  12. package/catalog/resource-save-adapters.d.ts +32 -7
  13. package/catalog/resource-save-adapters.d.ts.map +1 -1
  14. package/catalog/resource-save-adapters.js +47 -41
  15. package/catalog/resource-save.d.ts +17 -9
  16. package/catalog/resource-save.d.ts.map +1 -1
  17. package/catalog/resource-save.js +34 -25
  18. package/catalog/save-destination-root.d.ts +12 -0
  19. package/catalog/save-destination-root.d.ts.map +1 -0
  20. package/catalog/save-destination-root.js +6 -0
  21. package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
  22. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  23. package/catalog/usePublishFolders/usePublishFolders.js +29 -29
  24. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +7 -3
  25. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
  26. package/catalog/useResourceSavePanel/useResourceSavePanel.js +107 -97
  27. package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
  28. package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
  29. package/catalog/useVersionHistory/useVersionHistory.js +49 -0
  30. package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
  31. package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
  32. package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
  33. package/catalog/version-history.d.ts +42 -0
  34. package/catalog/version-history.d.ts.map +1 -0
  35. package/catalog/version-history.js +27 -0
  36. package/catalog.js +37 -33
  37. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  38. package/conversation/useConversationStream/generation-resume.js +119 -96
  39. package/entry-points/catalog.d.ts +3 -0
  40. package/entry-points/catalog.d.ts.map +1 -1
  41. package/entry-points/scheduled-tasks.d.ts +1 -0
  42. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  43. package/entry-points/utils.d.ts +3 -0
  44. package/entry-points/utils.d.ts.map +1 -1
  45. package/file-manager.js +33 -33
  46. package/files/annotation.d.ts +3 -3
  47. package/files/annotation.d.ts.map +1 -1
  48. package/files/annotation.js +12 -11
  49. package/files/attachment-canvas.d.ts +1 -1
  50. package/files/attachment-canvas.d.ts.map +1 -1
  51. package/files/attachment-canvas.js +135 -135
  52. package/files/dial-file.d.ts +18 -0
  53. package/files/dial-file.d.ts.map +1 -1
  54. package/files/dial-file.js +30 -5
  55. package/index.d.ts +7 -0
  56. package/index.d.ts.map +1 -1
  57. package/index.js +259 -252
  58. package/org-units/models.d.ts +3 -1
  59. package/org-units/models.d.ts.map +1 -1
  60. package/org-units/org-unit-guards.d.ts +64 -0
  61. package/org-units/org-unit-guards.d.ts.map +1 -0
  62. package/org-units/org-unit-guards.js +28 -0
  63. package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
  64. package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
  65. package/org-units/useFolderGuards/useFolderGuards.js +50 -0
  66. package/org-units/useOrgUnits/useOrgUnits.d.ts +18 -3
  67. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -1
  68. package/org-units/useOrgUnits/useOrgUnits.js +43 -23
  69. package/package.json +19 -19
  70. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  71. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  72. package/scheduled-task/scheduled-task-description.js +39 -55
  73. package/scheduled-task/scheduled-task-display.d.ts +19 -5
  74. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  75. package/scheduled-task/scheduled-task-display.js +43 -38
  76. package/scheduled-task/scheduled-task-next-occurrence.d.ts +7 -5
  77. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  78. package/scheduled-task/scheduled-task-next-occurrence.js +15 -15
  79. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  80. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  81. package/scheduled-task/scheduled-task-trigger.js +92 -115
  82. package/scheduled-tasks.js +14 -13
  83. package/shared/timezones.d.ts +30 -0
  84. package/shared/timezones.d.ts.map +1 -0
  85. package/shared/timezones.js +102 -0
  86. package/skill/useSkillEditorSubmit.d.ts +4 -1
  87. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  88. package/skill/useSkillEditorSubmit.js +125 -121
  89. package/utils.js +19 -16
  90. package/shared/cron-day-of-month.d.ts +0 -21
  91. package/shared/cron-day-of-month.d.ts.map +0 -1
  92. package/shared/cron-day-of-month.js +0 -13
@@ -1,52 +1,61 @@
1
1
  import { toPublishRuleDto as e } from "./create-publish-api.js";
2
2
  import { ResourceSaveError as t, isResourceCreateAdapter as n } from "./resource-save-adapter.js";
3
- import { SaveVersionMode as r, toFolderPathKey as i } from "@epam/ai-dial-publish-panel";
3
+ import { SaveDestinationRoot as r } from "./save-destination-root.js";
4
+ import { SaveVersionMode as i, toFolderPathKey as a } from "@epam/ai-dial-publish-panel";
4
5
  //#region src/catalog/resource-save.ts
5
- var a = /* @__PURE__ */ function(e) {
6
- return e.Personal = "personal", e.Organization = "organization", e;
7
- }({}), o = /* @__PURE__ */ function(e) {
8
- return e.Saved = "saved", e.SavedButMoveFailed = "savedButMoveFailed", e.SavedButPublishFailed = "savedButPublishFailed", e;
9
- }({}), s = /* @__PURE__ */ function(e) {
6
+ var o = (e) => Object.values(r).find((t) => t === e), s = /* @__PURE__ */ function(e) {
7
+ return e.Saved = "saved", e.SavedButMoveFailed = "savedButMoveFailed", e.SavedButPublishFailed = "savedButPublishFailed", e.SavedButOrgUnitWriteFailed = "savedButOrgUnitWriteFailed", e;
8
+ }({}), c = /* @__PURE__ */ function(e) {
10
9
  return e.Invalid = "invalid", e.Unchanged = "unchanged", e.Exists = "exists", e;
11
- }({}), c = (e, t) => i(e) === i(t), l = (t) => async (n, r, i, a, o) => {
10
+ }({}), l = (e, t) => a(e) === a(t), u = (t) => async (n, r, i, a, o) => {
12
11
  await t.publishCatalogEntity(n, r, {
13
12
  folderPath: i.join("/"),
14
13
  ...a ? { version: a } : {},
15
14
  rules: o.map(e)
16
15
  });
17
- }, u = async (e, t, i) => {
18
- let a = e.isVersioned && t.versionMode === r.New, o = t.destination.rootKey === "organization", s = o ? t.currentFolderPath : t.destination.path, l, u = !1;
19
- if (n(e)) ({id: l} = await e.createIn(s));
20
- else if (a) {
16
+ }, d = async (e, t, a) => {
17
+ let o = e.isVersioned && t.versionMode === i.New, s = t.destination.rootKey === r.Organization, c = s && t.isDirectWrite === !0 && e.saveIntoOrgUnit != null, u = s ? t.currentFolderPath : t.destination.path, d, f = !1;
18
+ if (n(e)) ({id: d} = await e.createIn(u));
19
+ else if (o) {
21
20
  if (!e.saveAsNewVersion) throw Error("This resource cannot be saved as a new version");
22
- ({id: l} = await e.saveAsNewVersion(t.newVersion, s));
23
- } else ({id: l} = await e.saveInPlace()), u = !o && !c(s, t.currentFolderPath);
24
- let d = {
21
+ ({id: d} = await e.saveAsNewVersion(t.newVersion, u));
22
+ } else ({id: d} = await e.saveInPlace()), f = !s && !l(u, t.currentFolderPath);
23
+ let p = {
25
24
  outcome: "saved",
26
- savedId: l,
25
+ savedId: d,
27
26
  isCreated: n(e),
28
- isNewVersion: a,
29
- isPublished: !1
27
+ isNewVersion: o,
28
+ isPublished: !1,
29
+ isWrittenToOrgUnit: !1
30
30
  };
31
- if (u && !n(e)) try {
32
- ({id: d.savedId} = await e.move(l, s));
31
+ if (f && !n(e)) try {
32
+ ({id: p.savedId} = await e.move(d, u));
33
33
  } catch (e) {
34
34
  return {
35
- ...d,
35
+ ...p,
36
36
  outcome: "savedButMoveFailed",
37
37
  error: e
38
38
  };
39
39
  }
40
- if (o) try {
41
- await i(e.publishEntityType, d.savedId, t.destination.path, a ? t.newVersion : t.currentVersion, t.rules ?? []), d.isPublished = !0;
40
+ if (s && c) try {
41
+ await e.saveIntoOrgUnit?.(p.savedId, t.destination.path), p.isWrittenToOrgUnit = !0;
42
42
  } catch (e) {
43
43
  return {
44
- ...d,
44
+ ...p,
45
+ outcome: "savedButOrgUnitWriteFailed",
46
+ error: e
47
+ };
48
+ }
49
+ else if (s) try {
50
+ await a(e.publishEntityType, p.savedId, t.destination.path, o ? t.newVersion : t.currentVersion, t.rules ?? []), p.isPublished = !0;
51
+ } catch (e) {
52
+ return {
53
+ ...p,
45
54
  outcome: "savedButPublishFailed",
46
55
  error: e
47
56
  };
48
57
  }
49
- return d;
58
+ return p;
50
59
  };
51
60
  //#endregion
52
- export { t as ResourceSaveError, o as ResourceSaveOutcome, s as ResourceSaveVersionError, a as SaveDestinationRoot, l as createPublishSavedResource, n as isResourceCreateAdapter, u as runResourceSave };
61
+ export { t as ResourceSaveError, s as ResourceSaveOutcome, c as ResourceSaveVersionError, r as SaveDestinationRoot, u as createPublishSavedResource, n as isResourceCreateAdapter, d as runResourceSave, o as toSaveDestinationRoot };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The roots of the Save panel's destination tree. Kept in its own module, free
3
+ * of any `@epam/ai-dial-publish-panel` import, so the lean `./utils` entry can
4
+ * reach it without that optional peer.
5
+ */
6
+ export declare enum SaveDestinationRoot {
7
+ /** The user's own folders for the resource type. */
8
+ Personal = "personal",
9
+ /** The Organization/public bucket; saving here also sends a publish request. */
10
+ Organization = "organization"
11
+ }
12
+ //# sourceMappingURL=save-destination-root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save-destination-root.d.ts","sourceRoot":"","sources":["../../src/catalog/save-destination-root.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,mBAAmB;IAC7B,oDAAoD;IACpD,QAAQ,aAAa;IACrB,gFAAgF;IAChF,YAAY,iBAAiB;CAC9B"}
@@ -0,0 +1,6 @@
1
+ //#region src/catalog/save-destination-root.ts
2
+ var e = /* @__PURE__ */ function(e) {
3
+ return e.Personal = "personal", e.Organization = "organization", e;
4
+ }({});
5
+ //#endregion
6
+ export { e as SaveDestinationRoot };
@@ -26,6 +26,12 @@ export interface UsePublishFoldersParams {
26
26
  * Omit it for a host that does not persist destinations.
27
27
  */
28
28
  onRememberedFolderKeysChange?: (folderKeys: string[]) => void;
29
+ /**
30
+ * Host rule for whether a destination accepts a publish, replacing the
31
+ * `Production` placeholder when given. Omit it while the rule is unknown
32
+ * (feature off, rights not loaded) so the placeholder stays the fallback.
33
+ */
34
+ canPublishTo?: (folderPath: string[]) => boolean;
29
35
  }
30
36
  /** Result returned by {@link usePublishFolders}. */
31
37
  export interface UsePublishFoldersResult {
@@ -57,7 +63,7 @@ export interface UsePublishFoldersResult {
57
63
  * later publishes. Call it after a successful publish.
58
64
  */
59
65
  rememberPublishFolder: (folderPath: string[]) => void;
60
- /** Heuristic write-access check for a folder path (see the TODO above). */
66
+ /** Write-access check for a folder path: the host's `canPublishTo` when given, otherwise the `Production` heuristic (see the TODO above). */
61
67
  hasPublishWriteAccess: (folderPath: string[]) => boolean;
62
68
  }
63
69
  /**
@@ -77,5 +83,5 @@ export interface UsePublishFoldersResult {
77
83
  * Takes `listPublicFiles` as a parameter and hands remembered destinations
78
84
  * back through a callback, so it imports no app context and no storage API.
79
85
  */
80
- export declare const usePublishFolders: ({ listPublicFiles, rememberedFolderKeys, onRememberedFolderKeysChange, }: UsePublishFoldersParams) => UsePublishFoldersResult;
86
+ export declare const usePublishFolders: ({ listPublicFiles, rememberedFolderKeys, onRememberedFolderKeysChange, canPublishTo, }: UsePublishFoldersParams) => UsePublishFoldersResult;
81
87
  //# sourceMappingURL=usePublishFolders.d.ts.map
@@ -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;AAgBrC,gHAAgH;AAChH,eAAO,MAAM,2BAA2B,GAAI,YAAY,MAAM,EAAE,KAAG,OAClB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,OAAO,EACnB,WAAW,MAAM,KAChB,MAAM,EAAE,GAAG,SAUb,CAAC;AAyBF,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,eAAe,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9E;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC/D;AAED,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,uDAAuD;IACvD,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,iEAAiE;IACjE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,gDAAgD;IAChD,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,0EAA0E;IAC1E,qBAAqB,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACpD;;;;;;;;;;OAUG;IACH,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E;;;;OAIG;IACH,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACtD,2EAA2E;IAC3E,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAI,0EAI/B,uBAAuB,KAAG,uBAsH5B,CAAC"}
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;AAgBrC,gHAAgH;AAChH,eAAO,MAAM,2BAA2B,GAAI,YAAY,MAAM,EAAE,KAAG,OAClB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,OAAO,EACnB,WAAW,MAAM,KAChB,MAAM,EAAE,GAAG,SAUb,CAAC;AAyBF,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,eAAe,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9E;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9D;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;CAClD;AAED,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,uDAAuD;IACvD,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,iEAAiE;IACjE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,gDAAgD;IAChD,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,0EAA0E;IAC1E,qBAAqB,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACpD;;;;;;;;;;OAUG;IACH,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E;;;;OAIG;IACH,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACtD,6IAA6I;IAC7I,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAI,wFAK/B,uBAAuB,KAAG,uBAsH5B,CAAC"}
@@ -15,60 +15,60 @@ var c = "Production", l = 50, u = (e) => !e.includes(c), d = (e, t) => {
15
15
  children: t.has(o) ? f(t, o, a) : void 0
16
16
  };
17
17
  });
18
- }, p = ({ listPublicFiles: e, rememberedFolderKeys: c, onRememberedFolderKeysChange: l }) => {
19
- let [p, m] = i(() => /* @__PURE__ */ new Map()), [h, g] = i(() => /* @__PURE__ */ new Set()), [_, v] = i(() => /* @__PURE__ */ new Set()), [y, b] = i([]), x = r(() => {
18
+ }, p = ({ listPublicFiles: e, rememberedFolderKeys: c, onRememberedFolderKeysChange: l, canPublishTo: p }) => {
19
+ let [m, h] = i(() => /* @__PURE__ */ new Map()), [g, _] = i(() => /* @__PURE__ */ new Set()), [v, y] = i(() => /* @__PURE__ */ new Set()), [b, x] = i([]), S = r(() => {
20
20
  let e = /* @__PURE__ */ new Set();
21
- return h.forEach((t) => {
21
+ return g.forEach((t) => {
22
22
  let n = t ? `${t}/` : "";
23
- p.has(n) && e.add(t);
23
+ m.has(n) && e.add(t);
24
24
  }), e;
25
- }, [h, p]), S = t(async (t) => {
26
- v((e) => new Set(e).add(t));
25
+ }, [g, m]), C = t(async (t) => {
26
+ y((e) => new Set(e).add(t));
27
27
  try {
28
28
  let { items: n } = await e({ path: t || void 0 });
29
- m((e) => new Map(e).set(t, n));
29
+ h((e) => new Map(e).set(t, n));
30
30
  } finally {
31
- v((e) => {
31
+ y((e) => {
32
32
  let n = new Set(e);
33
33
  return n.delete(t), n;
34
34
  });
35
35
  }
36
36
  }, [e]);
37
37
  n(() => {
38
- S("");
38
+ C("");
39
39
  }, []);
40
- let C = t((e) => {
41
- g(e), e.forEach((e) => {
40
+ let w = t((e) => {
41
+ _(e), e.forEach((e) => {
42
42
  let t = `${e}/`;
43
- !p.has(t) && !_.has(t) && S(t);
43
+ !m.has(t) && !v.has(t) && C(t);
44
44
  });
45
45
  }, [
46
- p,
47
- _,
48
- S
49
- ]), w = t((e, t) => {
46
+ m,
47
+ v,
48
+ C
49
+ ]), T = t((e, t) => {
50
50
  let n = s([...e, t]);
51
- return b((e) => e.includes(n) ? e : [...e, n]), Promise.resolve();
52
- }, []), T = t((e) => {
51
+ return x((e) => e.includes(n) ? e : [...e, n]), Promise.resolve();
52
+ }, []), E = t((e) => {
53
53
  let t = d(c, s(e));
54
54
  t && l?.(t);
55
- }, [c, l]), E = u;
55
+ }, [c, l]), D = p ?? u;
56
56
  return {
57
57
  folderItems: r(() => {
58
58
  let e = Array.isArray(c) ? c.filter((e) => typeof e == "string") : [];
59
- return o(f(p, "", []), [...e.map(a), ...y.map(a)]);
59
+ return o(f(m, "", []), [...e.map(a), ...b.map(a)]);
60
60
  }, [
61
- p,
61
+ m,
62
62
  c,
63
- y
63
+ b
64
64
  ]),
65
- expandedPaths: h,
66
- loadedPaths: x,
67
- loadingPaths: r(() => new Set([..._].map((e) => e.replace(/\/$/, ""))), [_]),
68
- onExpandedPathsChange: C,
69
- onCreatePublishFolder: w,
70
- rememberPublishFolder: T,
71
- hasPublishWriteAccess: E
65
+ expandedPaths: g,
66
+ loadedPaths: S,
67
+ loadingPaths: r(() => new Set([...v].map((e) => e.replace(/\/$/, ""))), [v]),
68
+ onExpandedPathsChange: w,
69
+ onCreatePublishFolder: T,
70
+ rememberPublishFolder: E,
71
+ hasPublishWriteAccess: D
72
72
  };
73
73
  };
74
74
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { ResourceFoldersResponseDto } from '@epam/ai-dial-chat-api-client';
2
2
  import { PublishAccessRulesLabels, StandaloneSaveToFolderPanelProps } from '@epam/ai-dial-publish-panel';
3
3
  import { PublishApiClient } from '../create-publish-api';
4
- import { ResourceSaveVersionError, ResourceSaveAdapter, ResourceSaveChoice, ResourceSaveResult } from '../resource-save';
4
+ import { ResourceSaveVersionError, SaveDestinationRoot, ResourceSaveAdapter, ResourceSaveChoice, ResourceSaveResult } from '../resource-save';
5
5
  import { UsePublishFoldersResult } from '../usePublishFolders/usePublishFolders';
6
6
  /** Translated copy the Save flow puts into the panel's state; the panel's own labels stay with the host. */
7
7
  export interface UseResourceSavePanelLabels {
@@ -38,6 +38,10 @@ export interface UseResourceSavePanelParams {
38
38
  organizationFolders?: UsePublishFoldersResult;
39
39
  /** Publish operations used for an Organization destination. */
40
40
  publishClient: Pick<PublishApiClient, 'publishCatalogEntity' | 'getPublishRules'>;
41
+ /** Whether an Organization destination takes a direct write into an org unit (the user may write there); omit while the org-unit rule does not apply, which keeps every Organization destination on the publish path. */
42
+ canSaveDirectlyTo?: (folderPath: string[], root: SaveDestinationRoot) => boolean;
43
+ /** Reason a folder is unavailable as a destination in the given root, or `undefined` when usable; omit while the org-unit rule does not apply. A committed destination with a reason shows it and disables Save. */
44
+ getDisabledReason?: (folderPath: string[], root: SaveDestinationRoot) => string | undefined;
41
45
  /** Options offered in the access-rules editor's source picker. */
42
46
  ruleSourceOptions: string[];
43
47
  /** Translated copy. */
@@ -46,7 +50,7 @@ export interface UseResourceSavePanelParams {
46
50
  onSaved: (result: ResourceSaveResult, choice: ResourceSaveChoice) => void;
47
51
  }
48
52
  /** The {@link StandaloneSaveToFolderPanelProps} the Save flow owns; the host adds the open state, resource summary and labels. */
49
- export type ResourceSavePanelStateProps = Pick<StandaloneSaveToFolderPanelProps, 'onSubmit' | 'isSubmitDisabled' | 'isSubmitting' | 'submitError' | 'roots' | 'destination' | 'onDestinationChange' | 'onCreateFolder' | 'version' | 'accessRules' | 'onPendingDestinationChange' | 'foldersError' | 'onRetryFolders'>;
53
+ export type ResourceSavePanelStateProps = Pick<StandaloneSaveToFolderPanelProps, 'onSubmit' | 'isSubmitDisabled' | 'isSubmitting' | 'submitError' | 'roots' | 'destination' | 'onDestinationChange' | 'onCreateFolder' | 'getDisabledReason' | 'version' | 'accessRules' | 'onPendingDestinationChange' | 'foldersError' | 'onRetryFolders'>;
50
54
  /** Result of {@link useResourceSavePanel}. */
51
55
  export interface UseResourceSavePanelResult {
52
56
  /** Props to spread on `StandaloneSaveToFolderPanel`. */
@@ -60,5 +64,5 @@ export interface UseResourceSavePanelResult {
60
64
  * folder's access rules — and runs the choice through the resource's
61
65
  * adapter. Notifications stay with the host through `onSaved`.
62
66
  */
63
- export declare const useResourceSavePanel: ({ isOpen, adapter, resourceId, currentFolderPath, currentVersion, versionPattern, listPersonalFolders, organizationFolders, publishClient, ruleSourceOptions, labels, onSaved, }: UseResourceSavePanelParams) => UseResourceSavePanelResult;
67
+ export declare const useResourceSavePanel: ({ isOpen, adapter, resourceId, currentFolderPath, currentVersion, versionPattern, listPersonalFolders, organizationFolders, publishClient, canSaveDirectlyTo, getDisabledReason: getFolderDisabledReason, ruleSourceOptions, labels, onSaved, }: UseResourceSavePanelParams) => UseResourceSavePanelResult;
64
68
  //# sourceMappingURL=useResourceSavePanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResourceSavePanel.d.ts","sourceRoot":"","sources":["../../../src/catalog/useResourceSavePanel/useResourceSavePanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAML,KAAK,wBAAwB,EAG7B,KAAK,gCAAgC,EACtC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAGL,wBAAwB,EAGxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGtF,4GAA4G;AAC5G,MAAM,WAAW,0BAA0B;IACzC,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,gBAAgB,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,eAAe,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9E,mDAAmD;IACnD,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC;AAED,mDAAmD;AACnD,MAAM,WAAW,0BAA0B;IACzC,wGAAwG;IACxG,MAAM,EAAE,OAAO,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC3E,qGAAqG;IACrG,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;IAC9C,+DAA+D;IAC/D,aAAa,EAAE,IAAI,CACjB,gBAAgB,EAChB,sBAAsB,GAAG,iBAAiB,CAC3C,CAAC;IACF,kEAAkE;IAClE,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,uBAAuB;IACvB,MAAM,EAAE,0BAA0B,CAAC;IACnC,0FAA0F;IAC1F,OAAO,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC3E;AAED,kIAAkI;AAClI,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,gCAAgC,EAC9B,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,aAAa,GACb,OAAO,GACP,aAAa,GACb,qBAAqB,GACrB,gBAAgB,GAChB,SAAS,GACT,aAAa,GACb,4BAA4B,GAC5B,cAAc,GACd,gBAAgB,CACnB,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,0BAA0B;IACzC,wDAAwD;IACxD,UAAU,EAAE,2BAA2B,CAAC;IACxC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,kLAalC,0BAA0B,KAAG,0BAuR/B,CAAC"}
1
+ {"version":3,"file":"useResourceSavePanel.d.ts","sourceRoot":"","sources":["../../../src/catalog/useResourceSavePanel/useResourceSavePanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAML,KAAK,wBAAwB,EAG7B,KAAK,gCAAgC,EACtC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAGL,wBAAwB,EAExB,mBAAmB,EAEnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGtF,4GAA4G;AAC5G,MAAM,WAAW,0BAA0B;IACzC,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,gBAAgB,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,eAAe,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9E,mDAAmD;IACnD,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC;AAED,mDAAmD;AACnD,MAAM,WAAW,0BAA0B;IACzC,wGAAwG;IACxG,MAAM,EAAE,OAAO,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC3E,qGAAqG;IACrG,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;IAC9C,+DAA+D;IAC/D,aAAa,EAAE,IAAI,CACjB,gBAAgB,EAChB,sBAAsB,GAAG,iBAAiB,CAC3C,CAAC;IACF,yNAAyN;IACzN,iBAAiB,CAAC,EAAE,CAClB,UAAU,EAAE,MAAM,EAAE,EACpB,IAAI,EAAE,mBAAmB,KACtB,OAAO,CAAC;IACb,oNAAoN;IACpN,iBAAiB,CAAC,EAAE,CAClB,UAAU,EAAE,MAAM,EAAE,EACpB,IAAI,EAAE,mBAAmB,KACtB,MAAM,GAAG,SAAS,CAAC;IACxB,kEAAkE;IAClE,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,uBAAuB;IACvB,MAAM,EAAE,0BAA0B,CAAC;IACnC,0FAA0F;IAC1F,OAAO,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC3E;AAED,kIAAkI;AAClI,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,gCAAgC,EAC9B,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,aAAa,GACb,OAAO,GACP,aAAa,GACb,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,SAAS,GACT,aAAa,GACb,4BAA4B,GAC5B,cAAc,GACd,gBAAgB,CACnB,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,0BAA0B;IACzC,wDAAwD;IACxD,UAAU,EAAE,2BAA2B,CAAC;IACxC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,iPAelC,0BAA0B,KAAG,0BAuT/B,CAAC"}
@@ -1,23 +1,24 @@
1
1
  import { getApiErrorDetails as e } from "../../api-error/api-error.js";
2
2
  import { useResourceFolders as t } from "../useResourceFolders/useResourceFolders.js";
3
3
  import { ResourceSaveError as n } from "../resource-save-adapter.js";
4
- import { ResourceSaveVersionError as r, SaveDestinationRoot as i, createPublishSavedResource as ee, runResourceSave as te } from "../resource-save.js";
5
- import { useCallback as a, useEffect as ne, useMemo as o, useRef as re, useState as s } from "react";
6
- import { SaveVersionMode as c, toFolderPathKey as ie } from "@epam/ai-dial-publish-panel";
4
+ import { SaveDestinationRoot as r } from "../save-destination-root.js";
5
+ import { ResourceSaveVersionError as i, createPublishSavedResource as ee, runResourceSave as te, toSaveDestinationRoot as ne } from "../resource-save.js";
6
+ import { useCallback as a, useEffect as re, useMemo as o, useRef as ie, useState as s } from "react";
7
+ import { SaveVersionMode as c, toFolderPathKey as ae } from "@epam/ai-dial-publish-panel";
7
8
  //#region src/catalog/useResourceSavePanel/useResourceSavePanel.ts
8
- var l = ({ isOpen: l, adapter: u, resourceId: d, currentFolderPath: f, currentVersion: p, versionPattern: m, listPersonalFolders: ae, organizationFolders: h, publishClient: g, ruleSourceOptions: _, labels: v, onSaved: y }) => {
9
- let b = t({
10
- listFolders: ae,
9
+ var l = ({ isOpen: l, adapter: u, resourceId: d, currentFolderPath: f, currentVersion: p, versionPattern: oe, listPersonalFolders: se, organizationFolders: m, publishClient: h, canSaveDirectlyTo: g, getDisabledReason: _, ruleSourceOptions: v, labels: y, onSaved: b }) => {
10
+ let x = t({
11
+ listFolders: se,
11
12
  isEnabled: l
12
- }), { getPublishRules: x } = g, S = o(() => ee(g), [g]), C = o(() => ({
13
- rootKey: i.Personal,
13
+ }), { getPublishRules: S } = h, C = o(() => ee(h), [h]), w = o(() => ({
14
+ rootKey: r.Personal,
14
15
  path: f
15
- }), [f]), [w, T] = s(C), [E, D] = s(c.Keep), [O, oe] = s(""), [k, A] = s(!1), [j, M] = s(), [se, N] = s(!1), [ce, P] = s(), [F, I] = s([]), [L, R] = s(!1), [z, B] = s(!1), V = re(void 0), le = a((e) => {
16
- if (e?.rootKey !== i.Organization) return;
17
- let t = ie(e.path);
16
+ }), [f]), [T, E] = s(w), [D, O] = s(c.Keep), [k, ce] = s(""), [le, A] = s(!1), [j, M] = s(), [ue, N] = s(!1), [de, P] = s(), [F, I] = s([]), [L, R] = s(!1), [z, B] = s(!1), V = ie(void 0), H = a((e) => e.rootKey === r.Organization && u.saveIntoOrgUnit != null && g?.(e.path, r.Organization) === !0, [u.saveIntoOrgUnit, g]), fe = a((e) => {
17
+ if (e?.rootKey !== r.Organization || H(e)) return;
18
+ let t = ae(e.path);
18
19
  t !== V.current && (V.current = t, I([]), B(!1), R(!0), (async () => {
19
20
  try {
20
- let n = await x(e.path.join("/"));
21
+ let n = await S(e.path.join("/"));
21
22
  V.current === t && I(n);
22
23
  } catch {
23
24
  V.current === t && B(!0);
@@ -25,50 +26,54 @@ var l = ({ isOpen: l, adapter: u, resourceId: d, currentFolderPath: f, currentVe
25
26
  V.current === t && R(!1);
26
27
  }
27
28
  })());
28
- }, [x]);
29
- ne(() => {
30
- l && (V.current = void 0, I([]), R(!1), B(!1), T(C), D(c.Keep), oe(""), A(!1), M(void 0), P(void 0));
29
+ }, [S, H]);
30
+ re(() => {
31
+ l && (V.current = void 0, I([]), R(!1), B(!1), E(w), O(c.Keep), ce(""), A(!1), M(void 0), P(void 0));
31
32
  }, [l]);
32
- let H = u.isVersioned && E === c.New, U = O.trim(), W = o(() => {
33
- if (H) {
34
- if (!m.test(U)) return r.Invalid;
35
- if (U === p) return r.Unchanged;
36
- if (U === j) return r.Exists;
33
+ let U = u.isVersioned && D === c.New, W = k.trim(), G = o(() => {
34
+ if (U) {
35
+ if (!oe.test(W)) return i.Invalid;
36
+ if (W === p) return i.Unchanged;
37
+ if (W === j) return i.Exists;
37
38
  }
38
39
  }, [
39
- H,
40
- m,
41
40
  U,
41
+ oe,
42
+ W,
42
43
  p,
43
44
  j
44
- ]), G = w.rootKey === i.Organization && (L || z), K = a((e) => {
45
- oe(e), P(void 0);
46
- }, []), q = a(() => A(!0), []), J = h?.rememberPublishFolder, { saveError: Y } = v, X = a(async () => {
47
- if (A(!0), W || G) return;
45
+ ]), K = o(() => _ && ((e) => {
46
+ let t = ne(e.rootKey);
47
+ return t ? _(e.path, t) : void 0;
48
+ }), [_]), q = K?.(T), J = H(T), Y = T.rootKey === r.Organization && !J && (L || z), X = a((e) => {
49
+ ce(e), P(void 0);
50
+ }, []), pe = a(() => A(!0), []), me = m?.rememberPublishFolder, { saveError: he } = y, Z = a(async () => {
51
+ if (A(!0), G || Y || q) return;
48
52
  N(!0), P(void 0);
49
53
  let t = {
50
54
  resourceId: d,
51
55
  currentFolderPath: f,
52
56
  currentVersion: p,
53
- destination: w,
54
- versionMode: E,
55
- newVersion: U,
56
- rules: F
57
+ destination: T,
58
+ versionMode: D,
59
+ newVersion: W,
60
+ rules: F,
61
+ isDirectWrite: J
57
62
  };
58
63
  try {
59
- let e = await te(u, t, S);
60
- e.isPublished && J?.(w.path), y(e, t);
64
+ let e = await te(u, t, C);
65
+ e.isPublished && me?.(T.path), b(e, t);
61
66
  } catch (t) {
62
67
  if (t instanceof n) {
63
68
  P(t.message);
64
69
  return;
65
70
  }
66
71
  let { message: r, status: i } = await e(t);
67
- if (H && i === 409) {
68
- M(U);
72
+ if (U && i === 409) {
73
+ M(W);
69
74
  return;
70
75
  }
71
- P(r ?? Y);
76
+ P(r ?? he);
72
77
  } finally {
73
78
  N(!1);
74
79
  }
@@ -76,96 +81,101 @@ var l = ({ isOpen: l, adapter: u, resourceId: d, currentFolderPath: f, currentVe
76
81
  u,
77
82
  f,
78
83
  p,
79
- w,
80
- H,
81
- G,
82
- y,
83
- S,
84
+ T,
85
+ U,
84
86
  J,
87
+ Y,
88
+ q,
89
+ b,
90
+ C,
91
+ me,
85
92
  d,
86
93
  F,
87
- Y,
88
- U,
89
- E,
90
- W
91
- ]), ue = a(() => void X(), [X]), { personalRoot: Z, organizationRoot: Q } = v, de = o(() => {
94
+ he,
95
+ W,
96
+ D,
97
+ G
98
+ ]), ge = a(() => void Z(), [Z]), { personalRoot: _e, organizationRoot: Q } = y, ve = o(() => {
92
99
  let e = {
93
- key: i.Personal,
94
- label: Z,
95
- items: b.folderItems,
96
- expandedPaths: b.expandedPaths,
97
- onExpandedPathsChange: b.onExpandedPathsChange,
98
- loadingPaths: b.loadingPaths
100
+ key: r.Personal,
101
+ label: _e,
102
+ items: x.folderItems,
103
+ expandedPaths: x.expandedPaths,
104
+ onExpandedPathsChange: x.onExpandedPathsChange,
105
+ loadingPaths: x.loadingPaths
99
106
  };
100
- return h ? [e, {
101
- key: i.Organization,
107
+ return m ? [e, {
108
+ key: r.Organization,
102
109
  label: Q,
103
- items: h.folderItems,
104
- expandedPaths: h.expandedPaths,
105
- onExpandedPathsChange: h.onExpandedPathsChange,
106
- loadingPaths: h.loadingPaths,
110
+ items: m.folderItems,
111
+ expandedPaths: m.expandedPaths,
112
+ onExpandedPathsChange: m.onExpandedPathsChange,
113
+ loadingPaths: m.loadingPaths,
107
114
  hasAccessRules: !0
108
115
  }] : [e];
109
116
  }, [
110
- h,
117
+ m,
111
118
  Q,
112
- b.expandedPaths,
113
- b.folderItems,
114
- b.loadingPaths,
115
- b.onExpandedPathsChange,
116
- Z
117
- ]), { onCreateFolder: $ } = b, fe = h?.onCreatePublishFolder, pe = a(async (e, t, n) => {
118
- e === i.Organization ? await fe?.(t, n) : await $(t, n);
119
- }, [$, fe]), { getVersionError: me } = v, he = o(() => u.isVersioned && p != null ? {
120
- versionMode: E,
121
- onVersionModeChange: D,
119
+ x.expandedPaths,
120
+ x.folderItems,
121
+ x.loadingPaths,
122
+ x.onExpandedPathsChange,
123
+ _e
124
+ ]), { onCreateFolder: ye } = x, be = m?.onCreatePublishFolder, xe = a(async (e, t, n) => {
125
+ e === r.Organization ? await be?.(t, n) : await ye(t, n);
126
+ }, [ye, be]), { getVersionError: Se } = y, Ce = o(() => u.isVersioned && p != null ? {
127
+ versionMode: D,
128
+ onVersionModeChange: O,
122
129
  currentVersion: p,
123
- newVersion: O,
124
- onNewVersionChange: K,
125
- onNewVersionBlur: q,
126
- newVersionError: k && W ? me(W, U) : void 0
130
+ newVersion: k,
131
+ onNewVersionChange: X,
132
+ onNewVersionBlur: pe,
133
+ newVersionError: le && G ? Se(G, W) : void 0
127
134
  } : void 0, [
128
135
  u.isVersioned,
129
136
  p,
130
- me,
137
+ Se,
138
+ le,
139
+ pe,
131
140
  k,
132
- q,
133
- O,
134
- K,
135
- U,
141
+ X,
136
142
  W,
137
- E
138
- ]), { accessRules: ge } = v, _e = o(() => ({
143
+ G,
144
+ D
145
+ ]), { accessRules: $ } = y, we = o(() => ({
139
146
  rules: F,
140
147
  onRulesChange: I,
141
- sourceOptions: _,
148
+ sourceOptions: v,
142
149
  isLoading: L,
143
150
  hasLoadError: z,
144
- labels: ge
151
+ labels: $,
152
+ isHiddenFor: H
145
153
  }), [
146
- ge,
154
+ $,
147
155
  z,
156
+ H,
148
157
  L,
149
- _,
158
+ v,
150
159
  F
151
160
  ]);
152
161
  return {
153
162
  panelProps: {
154
- onSubmit: ue,
155
- isSubmitDisabled: H && !!W || G,
156
- isSubmitting: se,
157
- submitError: ce,
158
- roots: de,
159
- destination: w,
160
- onDestinationChange: T,
161
- onCreateFolder: pe,
162
- version: he,
163
- accessRules: _e,
164
- onPendingDestinationChange: le,
165
- foldersError: b.hasError ? v.foldersLoadError : void 0,
166
- onRetryFolders: b.retry
163
+ onSubmit: ge,
164
+ isSubmitDisabled: U && !!G || Y || q != null,
165
+ isSubmitting: ue,
166
+ submitError: de,
167
+ roots: ve,
168
+ destination: T,
169
+ onDestinationChange: E,
170
+ onCreateFolder: xe,
171
+ getDisabledReason: K,
172
+ version: Ce,
173
+ accessRules: we,
174
+ onPendingDestinationChange: fe,
175
+ foldersError: x.hasError ? y.foldersLoadError : void 0,
176
+ onRetryFolders: x.retry
167
177
  },
168
- submit: X
178
+ submit: Z
169
179
  };
170
180
  };
171
181
  //#endregion
@@ -0,0 +1,38 @@
1
+ import { VersionHistoryRow } from '@epam/ai-dial-publish-panel';
2
+ import { PublishApiClient } from '../create-publish-api';
3
+ import { CatalogPublishEntityType } from '../publish';
4
+ import { VersionHistoryFormatters, VersionHistoryListingItem } from '../version-history';
5
+ /** Parameters of {@link useVersionHistory}. */
6
+ export interface UseVersionHistoryParams {
7
+ /** Items of the already-loaded deployments or toolsets listing. */
8
+ items: readonly VersionHistoryListingItem[];
9
+ /** Id of the resource being edited or published. */
10
+ resourceId: string;
11
+ /** Publish API entity type of the resource. */
12
+ entityType: CatalogPublishEntityType;
13
+ /** Whether the panel showing the history is open; statuses load only while it is. */
14
+ isEnabled: boolean;
15
+ /** Configured client that reads the version statuses. */
16
+ client: Pick<PublishApiClient, 'getCatalogVersionStatuses'>;
17
+ /** Host text and date formatting; keep it referentially stable. */
18
+ formatters: VersionHistoryFormatters;
19
+ }
20
+ /** Result of {@link useVersionHistory}. */
21
+ export interface UseVersionHistoryResult {
22
+ /** The other saved versions of the resource, newest first; statuses fill in once loaded. */
23
+ rows: VersionHistoryRow[];
24
+ /** Whether the listing holds another version the section can show; the host renders no section when it is `false`. */
25
+ hasVersions: boolean;
26
+ /** Whether the statuses are being loaded. */
27
+ isLoading: boolean;
28
+ /** Whether the last statuses request failed. */
29
+ hasError: boolean;
30
+ /** Reloads the statuses. */
31
+ onRetry: () => void;
32
+ }
33
+ /**
34
+ * Groups the listing by `versionGroupId`, builds the Versions history rows of the other versions and loads their publication statuses in the background while the panel is open.
35
+ * @param params - listing items, edited resource, open state, client and formatters
36
+ */
37
+ export declare const useVersionHistory: ({ items, resourceId, entityType, isEnabled, client, formatters, }: UseVersionHistoryParams) => UseVersionHistoryResult;
38
+ //# sourceMappingURL=useVersionHistory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVersionHistory.d.ts","sourceRoot":"","sources":["../../../src/catalog/useVersionHistory/useVersionHistory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAE5B,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACtC,mEAAmE;IACnE,KAAK,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC5C,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,UAAU,EAAE,wBAAwB,CAAC;IACrC,qFAAqF;IACrF,SAAS,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,2BAA2B,CAAC,CAAC;IAC5D,mEAAmE;IACnE,UAAU,EAAE,wBAAwB,CAAC;CACtC;AAED,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,4FAA4F;IAC5F,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B,sHAAsH;IACtH,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAOD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,mEAO/B,uBAAuB,KAAG,uBA2D5B,CAAC"}