@epam/ai-dial-chat-hooks 1.3.5 → 1.4.0-dev.101
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/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
- package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
- package/catalog/create-publish-api.d.ts +9 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +9 -0
- package/catalog/publish.d.ts +2 -0
- package/catalog/publish.d.ts.map +1 -1
- package/catalog/publish.js +4 -4
- package/catalog/resource-save-adapter.d.ts +7 -2
- package/catalog/resource-save-adapter.d.ts.map +1 -1
- package/catalog/resource-save-adapters.d.ts +32 -7
- package/catalog/resource-save-adapters.d.ts.map +1 -1
- package/catalog/resource-save-adapters.js +47 -41
- package/catalog/resource-save.d.ts +17 -9
- package/catalog/resource-save.d.ts.map +1 -1
- package/catalog/resource-save.js +34 -25
- package/catalog/save-destination-root.d.ts +12 -0
- package/catalog/save-destination-root.d.ts.map +1 -0
- package/catalog/save-destination-root.js +6 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +29 -29
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +7 -3
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +107 -97
- package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
- package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistory.js +49 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
- package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
- package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
- package/catalog/version-history.d.ts +42 -0
- package/catalog/version-history.d.ts.map +1 -0
- package/catalog/version-history.js +27 -0
- package/catalog.js +37 -33
- package/conversation/conversation-transfer/zip-export.d.ts +1 -1
- package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
- package/conversation/conversation-transfer/zip-export.js +7 -8
- package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
- package/conversation/conversation-transfer/zip-import.js +8 -9
- package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
- package/conversation/useConversationExport/useConversationExport.js +3 -1
- package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/generation-resume.js +119 -96
- package/entry-points/catalog.d.ts +3 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/scheduled-tasks.d.ts +1 -0
- package/entry-points/scheduled-tasks.d.ts.map +1 -1
- package/entry-points/utils.d.ts +3 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/file-manager.js +33 -33
- package/files/annotation.d.ts +3 -3
- package/files/annotation.d.ts.map +1 -1
- package/files/annotation.js +12 -11
- package/files/attachment-canvas.d.ts +1 -1
- package/files/attachment-canvas.d.ts.map +1 -1
- package/files/attachment-canvas.js +135 -135
- package/files/dial-file.d.ts +18 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +30 -5
- package/index.d.ts +7 -0
- package/index.d.ts.map +1 -1
- package/index.js +259 -252
- package/org-units/models.d.ts +3 -1
- package/org-units/models.d.ts.map +1 -1
- package/org-units/org-unit-guards.d.ts +64 -0
- package/org-units/org-unit-guards.d.ts.map +1 -0
- package/org-units/org-unit-guards.js +28 -0
- package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
- package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
- package/org-units/useFolderGuards/useFolderGuards.js +50 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts +18 -3
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -1
- package/org-units/useOrgUnits/useOrgUnits.js +43 -23
- package/package.json +19 -19
- package/scheduled-task/scheduled-task-description.d.ts +19 -13
- package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-description.js +39 -55
- package/scheduled-task/scheduled-task-display.d.ts +19 -5
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-display.js +43 -38
- package/scheduled-task/scheduled-task-next-occurrence.d.ts +7 -5
- package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-next-occurrence.js +15 -15
- package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
- package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-trigger.js +92 -115
- package/scheduled-tasks.js +14 -13
- package/shared/timezones.d.ts +30 -0
- package/shared/timezones.d.ts.map +1 -0
- package/shared/timezones.js +102 -0
- package/skill/skill-archive.d.ts.map +1 -1
- package/skill/skill-archive.js +6 -7
- package/skill/skill.d.ts +2 -2
- package/skill/skill.d.ts.map +1 -1
- package/skill/skill.js +33 -34
- package/skill/useSkillEditorLoad.js +1 -1
- package/skill/useSkillEditorSubmit.d.ts +4 -1
- package/skill/useSkillEditorSubmit.d.ts.map +1 -1
- package/skill/useSkillEditorSubmit.js +125 -121
- package/utils.js +19 -16
- package/shared/cron-day-of-month.d.ts +0 -21
- package/shared/cron-day-of-month.d.ts.map +0 -1
- package/shared/cron-day-of-month.js +0 -13
package/catalog/resource-save.js
CHANGED
|
@@ -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 {
|
|
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
|
|
6
|
-
return e.
|
|
7
|
-
}({}),
|
|
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
|
-
}({}),
|
|
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
|
-
},
|
|
18
|
-
let
|
|
19
|
-
if (n(e)) ({id:
|
|
20
|
-
else if (
|
|
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:
|
|
23
|
-
} else ({id:
|
|
24
|
-
let
|
|
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:
|
|
25
|
+
savedId: d,
|
|
27
26
|
isCreated: n(e),
|
|
28
|
-
isNewVersion:
|
|
29
|
-
isPublished: !1
|
|
27
|
+
isNewVersion: o,
|
|
28
|
+
isPublished: !1,
|
|
29
|
+
isWrittenToOrgUnit: !1
|
|
30
30
|
};
|
|
31
|
-
if (
|
|
32
|
-
({id:
|
|
31
|
+
if (f && !n(e)) try {
|
|
32
|
+
({id: p.savedId} = await e.move(d, u));
|
|
33
33
|
} catch (e) {
|
|
34
34
|
return {
|
|
35
|
-
...
|
|
35
|
+
...p,
|
|
36
36
|
outcome: "savedButMoveFailed",
|
|
37
37
|
error: e
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
if (
|
|
41
|
-
await
|
|
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
|
-
...
|
|
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
|
|
58
|
+
return p;
|
|
50
59
|
};
|
|
51
60
|
//#endregion
|
|
52
|
-
export { t as ResourceSaveError,
|
|
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"}
|
|
@@ -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
|
-
/**
|
|
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;
|
|
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 [
|
|
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
|
|
21
|
+
return g.forEach((t) => {
|
|
22
22
|
let n = t ? `${t}/` : "";
|
|
23
|
-
|
|
23
|
+
m.has(n) && e.add(t);
|
|
24
24
|
}), e;
|
|
25
|
-
}, [
|
|
26
|
-
|
|
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
|
-
|
|
29
|
+
h((e) => new Map(e).set(t, n));
|
|
30
30
|
} finally {
|
|
31
|
-
|
|
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
|
-
|
|
38
|
+
C("");
|
|
39
39
|
}, []);
|
|
40
|
-
let
|
|
41
|
-
|
|
40
|
+
let w = t((e) => {
|
|
41
|
+
_(e), e.forEach((e) => {
|
|
42
42
|
let t = `${e}/`;
|
|
43
|
-
!
|
|
43
|
+
!m.has(t) && !v.has(t) && C(t);
|
|
44
44
|
});
|
|
45
45
|
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
]),
|
|
46
|
+
m,
|
|
47
|
+
v,
|
|
48
|
+
C
|
|
49
|
+
]), T = t((e, t) => {
|
|
50
50
|
let n = s([...e, t]);
|
|
51
|
-
return
|
|
52
|
-
}, []),
|
|
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]),
|
|
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(
|
|
59
|
+
return o(f(m, "", []), [...e.map(a), ...b.map(a)]);
|
|
60
60
|
}, [
|
|
61
|
-
|
|
61
|
+
m,
|
|
62
62
|
c,
|
|
63
|
-
|
|
63
|
+
b
|
|
64
64
|
]),
|
|
65
|
-
expandedPaths:
|
|
66
|
-
loadedPaths:
|
|
67
|
-
loadingPaths: r(() => new Set([...
|
|
68
|
-
onExpandedPathsChange:
|
|
69
|
-
onCreatePublishFolder:
|
|
70
|
-
rememberPublishFolder:
|
|
71
|
-
hasPublishWriteAccess:
|
|
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,
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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:
|
|
9
|
-
let
|
|
10
|
-
listFolders:
|
|
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:
|
|
13
|
-
rootKey:
|
|
13
|
+
}), { getPublishRules: S } = h, C = o(() => ee(h), [h]), w = o(() => ({
|
|
14
|
+
rootKey: r.Personal,
|
|
14
15
|
path: f
|
|
15
|
-
}), [f]), [
|
|
16
|
-
if (e?.rootKey !==
|
|
17
|
-
let t =
|
|
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
|
|
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
|
-
}, [
|
|
29
|
-
|
|
30
|
-
l && (V.current = void 0, I([]), R(!1), B(!1),
|
|
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
|
|
33
|
-
if (
|
|
34
|
-
if (!
|
|
35
|
-
if (
|
|
36
|
-
if (
|
|
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
|
-
]),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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:
|
|
54
|
-
versionMode:
|
|
55
|
-
newVersion:
|
|
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,
|
|
60
|
-
e.isPublished &&
|
|
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 (
|
|
68
|
-
M(
|
|
72
|
+
if (U && i === 409) {
|
|
73
|
+
M(W);
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
|
-
P(r ??
|
|
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
|
-
|
|
80
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]),
|
|
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:
|
|
94
|
-
label:
|
|
95
|
-
items:
|
|
96
|
-
expandedPaths:
|
|
97
|
-
onExpandedPathsChange:
|
|
98
|
-
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
|
|
101
|
-
key:
|
|
107
|
+
return m ? [e, {
|
|
108
|
+
key: r.Organization,
|
|
102
109
|
label: Q,
|
|
103
|
-
items:
|
|
104
|
-
expandedPaths:
|
|
105
|
-
onExpandedPathsChange:
|
|
106
|
-
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
|
-
|
|
117
|
+
m,
|
|
111
118
|
Q,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
]), { onCreateFolder:
|
|
118
|
-
e ===
|
|
119
|
-
}, [
|
|
120
|
-
versionMode:
|
|
121
|
-
onVersionModeChange:
|
|
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:
|
|
124
|
-
onNewVersionChange:
|
|
125
|
-
onNewVersionBlur:
|
|
126
|
-
newVersionError:
|
|
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
|
-
|
|
137
|
+
Se,
|
|
138
|
+
le,
|
|
139
|
+
pe,
|
|
131
140
|
k,
|
|
132
|
-
|
|
133
|
-
O,
|
|
134
|
-
K,
|
|
135
|
-
U,
|
|
141
|
+
X,
|
|
136
142
|
W,
|
|
137
|
-
|
|
138
|
-
|
|
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:
|
|
151
|
+
labels: $,
|
|
152
|
+
isHiddenFor: H
|
|
145
153
|
}), [
|
|
146
|
-
|
|
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:
|
|
155
|
-
isSubmitDisabled:
|
|
156
|
-
isSubmitting:
|
|
157
|
-
submitError:
|
|
158
|
-
roots:
|
|
159
|
-
destination:
|
|
160
|
-
onDestinationChange:
|
|
161
|
-
onCreateFolder:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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:
|
|
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"}
|