@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
2
|
-
/** Resolves a DIAL Core file id to a downloadable URL. Host-owned — encodes the app's own file-download
|
|
2
|
+
/** Resolves a DIAL Core file id or project file id to a downloadable URL, or `undefined` when the host serves none. Host-owned — encodes the app's own file-download endpoints. */
|
|
3
3
|
export type ResolveDownloadUrl = (fileId: string) => string | undefined;
|
|
4
4
|
/** Parameters for {@link useAttachmentAction}. */
|
|
5
5
|
export interface UseAttachmentActionParams {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAttachmentAction.d.ts","sourceRoot":"","sources":["../../../src/attachment/useAttachmentAction/useAttachmentAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"useAttachmentAction.d.ts","sourceRoot":"","sources":["../../../src/attachment/useAttachmentAction/useAttachmentAction.ts"],"names":[],"mappings":"AAKA,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAWnC,mLAAmL;AACnL,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AAExE,kDAAkD;AAClD,MAAM,WAAW,yBAAyB;IACxC,0DAA0D;IAC1D,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;AAED,mDAAmD;AACnD,MAAM,WAAW,yBAAyB;IACxC,kGAAkG;IAClG,qBAAqB,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAChE;AASD,oIAAoI;AACpI,eAAO,MAAM,wBAAwB,GACnC,YAAY,iBAAiB,KAC5B,OACkE,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,iBAAiB,EAC7B,oBAAoB,kBAAkB,KACrC,OA0BF,CAAC;AAiCF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,yBAEjC,yBAAyB,KAAG,yBAmC9B,CAAC"}
|
|
@@ -1,43 +1,34 @@
|
|
|
1
|
-
import { isDialFileId as e, isDialFolderId as t } from "../../files/dial-file.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { isDialFileId as e, isDialFolderId as t, isDialProjectFileId as n, isDialStoredFileId as r } from "../../files/dial-file.js";
|
|
2
|
+
import { openAnnotationAttachment as i } from "../../files/annotation.js";
|
|
3
|
+
import { AttachmentContentType as a, useAttachmentCanvas as o } from "@epam/ai-dial-attachment-canvas";
|
|
4
|
+
import { MIMEType as s, base64ToBlob as c, ensureDownloadFilename as l, triggerAnchorDownload as u, triggerBlobDownload as d } from "@epam/ai-dial-chat-shared";
|
|
5
|
+
import { parsePdfPageReference as f } from "@epam/ai-dial-quotations";
|
|
6
|
+
import { useCallback as p } from "react";
|
|
6
7
|
//#region src/attachment/useAttachmentAction/useAttachmentAction.ts
|
|
7
|
-
var
|
|
8
|
-
let { url: n, name: r, contentType:
|
|
9
|
-
if (
|
|
8
|
+
var m = (r) => r != null && (e(r) && !t(r) || n(r)), h = (e) => m(e.url) || e.data != null, g = (e, t) => {
|
|
9
|
+
let { url: n, name: r, contentType: i, data: a } = e;
|
|
10
|
+
if (m(n)) {
|
|
10
11
|
let e = t(n);
|
|
11
|
-
return e != null && (
|
|
12
|
+
return e != null && (u(e, l(r, n, i)), !0);
|
|
12
13
|
}
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
let i = r.
|
|
18
|
-
if (e(i)) {
|
|
19
|
-
let e = n(i);
|
|
20
|
-
if (e == null) return;
|
|
21
|
-
let r = t.title ?? i.split("/").pop() ?? "";
|
|
22
|
-
s(e, o(r, i, t.type));
|
|
23
|
-
} else window.open(r, "_blank", "noopener,noreferrer");
|
|
24
|
-
}, h = (t, r) => {
|
|
25
|
-
let i = l(t.url);
|
|
14
|
+
return a != null && (d(c(a, i || s.Plain), l(r, n, i)), !0);
|
|
15
|
+
}, _ = (e, t) => {
|
|
16
|
+
let n = f(e.url);
|
|
17
|
+
if (n == null) return null;
|
|
18
|
+
let i = r(n.baseUrl) ? t(n.baseUrl) : n.baseUrl;
|
|
26
19
|
if (i == null) return null;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type: n.Pdf,
|
|
31
|
-
url: a
|
|
20
|
+
if (n.page == null) return {
|
|
21
|
+
type: a.Pdf,
|
|
22
|
+
url: i
|
|
32
23
|
};
|
|
33
|
-
let o = `reference-page-${
|
|
24
|
+
let o = `reference-page-${n.page}`;
|
|
34
25
|
return {
|
|
35
|
-
type:
|
|
36
|
-
url:
|
|
26
|
+
type: a.Pdf,
|
|
27
|
+
url: i,
|
|
37
28
|
highlights: [{
|
|
38
29
|
id: o,
|
|
39
30
|
bboxes: [{
|
|
40
|
-
page:
|
|
31
|
+
page: n.page,
|
|
41
32
|
x1: 0,
|
|
42
33
|
y1: 0,
|
|
43
34
|
x2: 0,
|
|
@@ -50,22 +41,22 @@ var d = (n) => n != null && e(n) && !t(n), f = (e) => d(e.url) || e.data != null
|
|
|
50
41
|
}],
|
|
51
42
|
selectedHighlightId: o
|
|
52
43
|
};
|
|
53
|
-
},
|
|
54
|
-
let { openCanvas: t } =
|
|
55
|
-
return { handleAttachmentClick:
|
|
56
|
-
let { url: r, referenceUrl:
|
|
57
|
-
if (r != null ||
|
|
58
|
-
|
|
44
|
+
}, v = ({ resolveDownloadUrl: e }) => {
|
|
45
|
+
let { openCanvas: t } = o();
|
|
46
|
+
return { handleAttachmentClick: p((n) => {
|
|
47
|
+
let { url: r, referenceUrl: a, data: o, name: s } = n;
|
|
48
|
+
if (r != null || o != null) {
|
|
49
|
+
g(n, e);
|
|
59
50
|
return;
|
|
60
51
|
}
|
|
61
|
-
if (
|
|
62
|
-
let
|
|
52
|
+
if (a == null) return;
|
|
53
|
+
let c = {
|
|
63
54
|
type: n.contentType,
|
|
64
|
-
url:
|
|
65
|
-
title:
|
|
66
|
-
},
|
|
67
|
-
|
|
55
|
+
url: a,
|
|
56
|
+
title: s
|
|
57
|
+
}, l = _(c, e);
|
|
58
|
+
l ? t(l, s) : i(c, e);
|
|
68
59
|
}, [t, e]) };
|
|
69
60
|
};
|
|
70
61
|
//#endregion
|
|
71
|
-
export {
|
|
62
|
+
export { g as downloadAttachment, h as isDownloadableAttachment, v as useAttachmentAction };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublishApi, PublishCatalogEntityDto, PublishHistoryEntryDto, PublishResultDto, PublishRuleDto, ResourceDependenciesResultDto, UnpublishAccessDto, UnpublishCatalogEntityDto, UnpublishResultDto } from '@epam/ai-dial-chat-api-client';
|
|
1
|
+
import { CopyCatalogEntityToOrgUnitDto, PublishApi, PublishCatalogEntityDto, PublishHistoryEntryDto, PublishResultDto, PublishRuleDto, ResourceIdResponseDto, ResourceDependenciesResultDto, UnpublishAccessDto, UnpublishCatalogEntityDto, UnpublishResultDto, VersionStatusEntryDto } from '@epam/ai-dial-chat-api-client';
|
|
2
2
|
import { PublicationRule } from '@epam/ai-dial-publish-panel';
|
|
3
3
|
import { CatalogPublishEntityType } from './publish';
|
|
4
4
|
/**
|
|
@@ -11,6 +11,12 @@ export declare const toPublishRuleDto: (rule: PublicationRule) => PublishRuleDto
|
|
|
11
11
|
export interface PublishApiClient {
|
|
12
12
|
/** Submits a publication request for one catalog entity into `folderPath`. */
|
|
13
13
|
publishCatalogEntity: (entityType: CatalogPublishEntityType, entityId: string, body: PublishCatalogEntityDto) => Promise<PublishResultDto>;
|
|
14
|
+
/**
|
|
15
|
+
* Copies one own catalog entity into an org-unit folder of the public bucket
|
|
16
|
+
* without a publication request; DIAL Core decides the right and its 403 and
|
|
17
|
+
* 409 reject the promise. Resolves to the id of the copy.
|
|
18
|
+
*/
|
|
19
|
+
copyCatalogEntityToOrgUnit: (entityType: CatalogPublishEntityType, entityId: string, body: CopyCatalogEntityToOrgUnitDto) => Promise<ResourceIdResponseDto>;
|
|
14
20
|
/**
|
|
15
21
|
* Submits a removal request for one already-published folder of a catalog
|
|
16
22
|
* entity. The removal takes effect only after an administrator approves it,
|
|
@@ -27,6 +33,8 @@ export interface PublishApiClient {
|
|
|
27
33
|
getCatalogPublishDependencies: (entityType: CatalogPublishEntityType, entityId: string) => Promise<ResourceDependenciesResultDto>;
|
|
28
34
|
/** Reads whether the caller may request removal of one catalog entity. */
|
|
29
35
|
getCatalogUnpublishAccess: (entityType: CatalogPublishEntityType, entityId: string) => Promise<UnpublishAccessDto>;
|
|
36
|
+
/** Reads the publication status of every saved version of one application or toolset. */
|
|
37
|
+
getCatalogVersionStatuses: (entityType: CatalogPublishEntityType, entityId: string) => Promise<VersionStatusEntryDto[]>;
|
|
30
38
|
/** Reads a destination folder's already-configured access rules. */
|
|
31
39
|
getPublishRules: (folderPath: string) => Promise<PublicationRule[]>;
|
|
32
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-publish-api.d.ts","sourceRoot":"","sources":["../../src/catalog/create-publish-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,6BAA6B,EAC7B,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"create-publish-api.d.ts","sourceRoot":"","sources":["../../src/catalog/create-publish-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,UAAU,EACV,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,6BAA6B,EAC7B,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,eAAe,KAAG,cAIvD,CAAC;AAEH,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,oBAAoB,EAAE,CACpB,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,uBAAuB,KAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/B;;;;OAIG;IACH,0BAA0B,EAAE,CAC1B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,6BAA6B,KAChC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC;;;;OAIG;IACH,sBAAsB,EAAE,CACtB,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,yBAAyB,KAC5B,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjC,oEAAoE;IACpE,wBAAwB,EAAE,CACxB,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACvC;;;;OAIG;IACH,6BAA6B,EAAE,CAC7B,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC5C,0EAA0E;IAC1E,yBAAyB,EAAE,CACzB,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjC,yFAAyF;IACzF,yBAAyB,EAAE,CACzB,UAAU,EAAE,wBAAwB,EACpC,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACtC,oEAAoE;IACpE,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACrE;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,UAAU,KACrB,gBAkCD,CAAC"}
|
|
@@ -9,6 +9,11 @@ var e = (e) => ({
|
|
|
9
9
|
entityId: n,
|
|
10
10
|
publishCatalogEntityDto: r
|
|
11
11
|
}),
|
|
12
|
+
copyCatalogEntityToOrgUnit: (t, n, r) => e.copyCatalogEntityToOrgUnit({
|
|
13
|
+
entityType: t,
|
|
14
|
+
entityId: n,
|
|
15
|
+
copyCatalogEntityToOrgUnitDto: r
|
|
16
|
+
}),
|
|
12
17
|
unpublishCatalogEntity: (t, n, r) => e.unpublishCatalogEntity({
|
|
13
18
|
entityType: t,
|
|
14
19
|
entityId: n,
|
|
@@ -26,6 +31,10 @@ var e = (e) => ({
|
|
|
26
31
|
entityType: t,
|
|
27
32
|
entityId: n
|
|
28
33
|
}),
|
|
34
|
+
getCatalogVersionStatuses: (t, n) => e.getCatalogVersionStatuses({
|
|
35
|
+
entityType: t,
|
|
36
|
+
entityId: n
|
|
37
|
+
}),
|
|
29
38
|
getPublishRules: async (t) => (await e.getPublishRules({ folderPath: t })).rules.map(({ function: e, ...t }) => ({
|
|
30
39
|
...t,
|
|
31
40
|
function: e
|
package/catalog/publish.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { PublishDependency, PublishHistoryEntry } from '@epam/ai-dial-publish-pa
|
|
|
10
10
|
export type CatalogPublishEntityType = 'model' | 'toolset' | 'application' | 'prompt' | 'skill' | 'project';
|
|
11
11
|
/** Maps a catalog item's entity type to the publish API's entity-type path param, or `undefined` if that type is not publishable. */
|
|
12
12
|
export declare const toPublishEntityType: (type: CatalogEntityType) => CatalogPublishEntityType | undefined;
|
|
13
|
+
/** Whether a catalog entity type has saved versions, and so a Versions history section. */
|
|
14
|
+
export declare const isVersionedCatalogEntityType: (type: CatalogEntityType) => boolean;
|
|
13
15
|
/**
|
|
14
16
|
* Whether a catalog entity id addresses the shared `public` bucket
|
|
15
17
|
* (`{resourceType}/public/{folder…}/{name}`), i.e. the id names a published
|
package/catalog/publish.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/catalog/publish.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,2BAA2B,CAAC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AM,mBAAmB,GAC9B,MAAM,iBAAiB,KACtB,wBAAwB,GAAG,SAA2C,CAAC;AAE1E,2FAA2F;AAC3F,eAAO,MAAM,4BAA4B,GACvC,MAAM,iBAAiB,KACtB,OACqE,CAAC;AAEzE;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,KAAG,OACjB,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,GAAI,UAAU,MAAM,KAAG,MAAM,EAGlE,CAAC;AAET,kGAAkG;AAClG,eAAO,MAAM,yBAAyB,GACpC,KAAK,sBAAsB,KAC1B,mBAKD,CAAC;AAEH,iHAAiH;AACjH,eAAO,MAAM,+BAA+B,GAC1C,KAAK,4BAA4B,KAChC,mBAKD,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACnC,KAAK,qBAAqB,EAC1B,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,KAAK,MAAM,GAAG,SAAS,KAClE,iBAWF,CAAC"}
|
package/catalog/publish.js
CHANGED
|
@@ -7,15 +7,15 @@ var r = {
|
|
|
7
7
|
[t.Agent]: "application",
|
|
8
8
|
[t.Prompt]: "prompt",
|
|
9
9
|
[t.Skill]: "skill"
|
|
10
|
-
}, i = (e) => r[e], a = (e) => e.split("/")[1] === n,
|
|
10
|
+
}, i = (e) => r[e], a = (e) => e === t.Agent || e === t.Toolset, o = (e) => e.split("/")[1] === n, s = (t) => o(t) ? t.split("/").slice(2, -1).map(e) : [], c = (e) => ({
|
|
11
11
|
version: e.version,
|
|
12
12
|
publishedAt: Date.parse(e.publishedAt),
|
|
13
13
|
folderPath: e.folderPath.split("/").filter(Boolean),
|
|
14
14
|
publishCredentials: e.publishCredentials
|
|
15
|
-
}),
|
|
15
|
+
}), l = (e) => ({
|
|
16
16
|
publishedAt: Date.parse(e.publishedAt),
|
|
17
17
|
folderPath: e.folderPath.split("/").filter(Boolean)
|
|
18
|
-
}),
|
|
18
|
+
}), u = (e, t) => {
|
|
19
19
|
let n = t?.(e);
|
|
20
20
|
return {
|
|
21
21
|
id: e.id,
|
|
@@ -28,4 +28,4 @@ var r = {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
//#endregion
|
|
31
|
-
export {
|
|
31
|
+
export { s as getPublicCatalogEntityFolderPath, o as isPublicCatalogEntityId, a as isVersionedCatalogEntityType, l as mapPublishConversationResultDto, c as mapPublishHistoryEntryDto, u as mapResourceDependencyDto, i as toPublishEntityType };
|
|
@@ -4,8 +4,13 @@ export interface SavedResource {
|
|
|
4
4
|
/** Full DIAL Core id `{type}/{bucket}/{path}`. */
|
|
5
5
|
id: string;
|
|
6
6
|
}
|
|
7
|
+
/** The optional direct write of a saved resource into an org-unit folder, shared by both adapter kinds. */
|
|
8
|
+
export interface ResourceOrgUnitWriter {
|
|
9
|
+
/** Writes the saved resource `id` into `folderPath` of the public bucket without a publication request; omit it while the resource type has no direct write. */
|
|
10
|
+
saveIntoOrgUnit?: (id: string, folderPath: string[]) => Promise<SavedResource>;
|
|
11
|
+
}
|
|
7
12
|
/** The operations the Save panel runs for a resource that already exists, supplied by each editor. */
|
|
8
|
-
export interface ResourceEditSaveAdapter {
|
|
13
|
+
export interface ResourceEditSaveAdapter extends ResourceOrgUnitWriter {
|
|
9
14
|
/** The publish API entity type of the resource. */
|
|
10
15
|
publishEntityType: CatalogPublishEntityType;
|
|
11
16
|
/** Whether the resource has versions; an unversioned one never forks. */
|
|
@@ -18,7 +23,7 @@ export interface ResourceEditSaveAdapter {
|
|
|
18
23
|
move: (id: string, folderPath: string[]) => Promise<SavedResource>;
|
|
19
24
|
}
|
|
20
25
|
/** The operation the Save panel runs for a resource being created, supplied by each editor. */
|
|
21
|
-
export interface ResourceCreateSaveAdapter {
|
|
26
|
+
export interface ResourceCreateSaveAdapter extends ResourceOrgUnitWriter {
|
|
22
27
|
/** The publish API entity type of the resource. */
|
|
23
28
|
publishEntityType: CatalogPublishEntityType;
|
|
24
29
|
/** Always `false`: a new resource takes its version from the form, so the panel offers no version choice. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-save-adapter.d.ts","sourceRoot":"","sources":["../../src/catalog/resource-save-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAE1D,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,sGAAsG;AACtG,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"resource-save-adapter.d.ts","sourceRoot":"","sources":["../../src/catalog/resource-save-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAE1D,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,2GAA2G;AAC3G,MAAM,WAAW,qBAAqB;IACpC,gKAAgK;IAChK,eAAe,CAAC,EAAE,CAChB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,EAAE,KACjB,OAAO,CAAC,aAAa,CAAC,CAAC;CAC7B;AAED,sGAAsG;AACtG,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE,mDAAmD;IACnD,iBAAiB,EAAE,wBAAwB,CAAC;IAC5C,yEAAyE;IACzE,WAAW,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,WAAW,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1C,uIAAuI;IACvI,gBAAgB,CAAC,EAAE,CACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAAE,KACjB,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5B,yEAAyE;IACzE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CACpE;AAED,+FAA+F;AAC/F,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE,mDAAmD;IACnD,iBAAiB,EAAE,wBAAwB,CAAC;IAC5C,6GAA6G;IAC7G,WAAW,EAAE,KAAK,CAAC;IACnB,wGAAwG;IACxG,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;CAC5D;AAED,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,GAC7B,uBAAuB,GAAG,yBAAyB,CAAC;AAEtD,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB,GAClC,SAAS,mBAAmB,KAC3B,OAAO,IAAI,yBAAkD,CAAC;AAEjE,8GAA8G;AAC9G,qBAAa,iBAAkB,SAAQ,KAAK;CAAG"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { ApplicationsApi, CreatePromptDto, PromptsApi, ResourceFoldersResponseDto, SkillsApi, ToolsetBodyDto, ToolsetsApi, UpdatePromptDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
-
import {
|
|
2
|
+
import { PublishApiClient } from './create-publish-api';
|
|
3
|
+
import { CatalogPublishEntityType } from './publish';
|
|
4
|
+
import { ResourceCreateSaveAdapter, ResourceEditSaveAdapter, ResourceOrgUnitWriter } from './resource-save';
|
|
5
|
+
/** The org-unit copy operation the adapters' direct write calls. */
|
|
6
|
+
export type ResourceSavePublishClient = Pick<PublishApiClient, 'copyCatalogEntityToOrgUnit'>;
|
|
3
7
|
/** The application operations the application save adapters call. */
|
|
4
8
|
export type ResourceSaveApplicationsApi = Pick<ApplicationsApi, 'moveApplication' | 'forkApplicationVersion' | 'commitApplicationVersion' | 'deleteApplication'>;
|
|
5
9
|
/** The toolset operations {@link createToolsetSaveAdapter} calls. */
|
|
@@ -16,6 +20,8 @@ export interface EmbeddedApplicationSaveAdapterParams {
|
|
|
16
20
|
runEmbeddedSave: () => Promise<void>;
|
|
17
21
|
/** Translated message for a fork whose commit failed, naming the new version. */
|
|
18
22
|
getCommitFailedMessage: (version: string) => string;
|
|
23
|
+
/** Client whose `copyCatalogEntityToOrgUnit` the direct write into an org unit calls; without it the adapter offers no direct write. */
|
|
24
|
+
publishClient?: ResourceSavePublishClient;
|
|
19
25
|
}
|
|
20
26
|
/** Parameters for {@link createHostApplicationSaveAdapter}. */
|
|
21
27
|
export interface HostApplicationSaveAdapterParams {
|
|
@@ -29,6 +35,8 @@ export interface HostApplicationSaveAdapterParams {
|
|
|
29
35
|
createVersion: (version: string, folderPath: string[]) => Promise<{
|
|
30
36
|
id?: string;
|
|
31
37
|
} | void>;
|
|
38
|
+
/** Client whose `copyCatalogEntityToOrgUnit` the direct write into an org unit calls; without it the adapter offers no direct write. */
|
|
39
|
+
publishClient?: ResourceSavePublishClient;
|
|
32
40
|
}
|
|
33
41
|
/** Parameters for {@link createToolsetSaveAdapter}. */
|
|
34
42
|
export interface ToolsetSaveAdapterParams {
|
|
@@ -38,6 +46,8 @@ export interface ToolsetSaveAdapterParams {
|
|
|
38
46
|
toolsetId: string;
|
|
39
47
|
/** The edited values, already mapped to the write body. */
|
|
40
48
|
body: ToolsetBodyDto;
|
|
49
|
+
/** Client whose `copyCatalogEntityToOrgUnit` the direct write into an org unit calls; without it the adapter offers no direct write. */
|
|
50
|
+
publishClient?: ResourceSavePublishClient;
|
|
41
51
|
}
|
|
42
52
|
/** Parameters for {@link createPromptSaveAdapter}. */
|
|
43
53
|
export interface PromptSaveAdapterParams {
|
|
@@ -47,7 +57,18 @@ export interface PromptSaveAdapterParams {
|
|
|
47
57
|
promptId: string;
|
|
48
58
|
/** The edited values. */
|
|
49
59
|
body: UpdatePromptDto;
|
|
60
|
+
/** Client whose `copyCatalogEntityToOrgUnit` the direct write into an org unit calls; without it the adapter offers no direct write. */
|
|
61
|
+
publishClient?: ResourceSavePublishClient;
|
|
50
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* The direct write of a saved resource into an org-unit folder, for every
|
|
65
|
+
* adapter of the resource type `entityType`. It never overwrites: a
|
|
66
|
+
* same-named resource already in the folder answers 409. Without a client it
|
|
67
|
+
* is empty, so the adapter keeps offering only the publish path.
|
|
68
|
+
* @param publishClient - client with the generic org-unit copy, or `undefined` for none
|
|
69
|
+
* @param entityType - publish API entity type of the resource
|
|
70
|
+
*/
|
|
71
|
+
export declare const createOrgUnitWriter: (publishClient: ResourceSavePublishClient | undefined, entityType: CatalogPublishEntityType) => ResourceOrgUnitWriter;
|
|
51
72
|
/**
|
|
52
73
|
* Save operations for an application whose embedded editor is the single
|
|
53
74
|
* writer (Quick Apps). A new version is a fork of the stored application,
|
|
@@ -55,23 +76,25 @@ export interface PromptSaveAdapterParams {
|
|
|
55
76
|
* bodies, so the edits land in the new version and the original keeps its
|
|
56
77
|
* last saved content.
|
|
57
78
|
*/
|
|
58
|
-
export declare const createEmbeddedApplicationSaveAdapter: ({ applicationsApi, applicationId, runEmbeddedSave, getCommitFailedMessage, }: EmbeddedApplicationSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
79
|
+
export declare const createEmbeddedApplicationSaveAdapter: ({ applicationsApi, applicationId, runEmbeddedSave, getCommitFailedMessage, publishClient, }: EmbeddedApplicationSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
59
80
|
/**
|
|
60
81
|
* Save operations for an application the host writes itself (schema-form
|
|
61
82
|
* and custom apps). A new version is a create-only write of the edited
|
|
62
83
|
* values, so the stored current version is never touched.
|
|
63
84
|
*/
|
|
64
|
-
export declare const createHostApplicationSaveAdapter: ({ applicationsApi, applicationId, update, createVersion, }: HostApplicationSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
85
|
+
export declare const createHostApplicationSaveAdapter: ({ applicationsApi, applicationId, update, createVersion, publishClient, }: HostApplicationSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
65
86
|
/** Save operations for a toolset; a new version is a create-only write into the chosen folder. */
|
|
66
|
-
export declare const createToolsetSaveAdapter: ({ toolsetsApi, toolsetId, body, }: ToolsetSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
87
|
+
export declare const createToolsetSaveAdapter: ({ toolsetsApi, toolsetId, body, publishClient, }: ToolsetSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
67
88
|
/** Save operations for a prompt: unversioned, so it is updated in place and then moved when its folder changes. */
|
|
68
|
-
export declare const createPromptSaveAdapter: ({ promptsApi, promptId, body, }: PromptSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
89
|
+
export declare const createPromptSaveAdapter: ({ promptsApi, promptId, body, publishClient, }: PromptSaveAdapterParams) => ResourceEditSaveAdapter;
|
|
69
90
|
/** Parameters for {@link createToolsetCreateAdapter}. */
|
|
70
91
|
export interface ToolsetCreateAdapterParams {
|
|
71
92
|
/** Configured toolsets client. */
|
|
72
93
|
toolsetsApi: Pick<ResourceSaveToolsetsApi, 'createToolset'>;
|
|
73
94
|
/** The new toolset's values, already mapped to the write body. */
|
|
74
95
|
body: ToolsetBodyDto;
|
|
96
|
+
/** Client whose `copyCatalogEntityToOrgUnit` the direct write into an org unit calls; without it the adapter offers no direct write. */
|
|
97
|
+
publishClient?: ResourceSavePublishClient;
|
|
75
98
|
}
|
|
76
99
|
/** Parameters for {@link createPromptCreateAdapter}. */
|
|
77
100
|
export interface PromptCreateAdapterParams {
|
|
@@ -79,11 +102,13 @@ export interface PromptCreateAdapterParams {
|
|
|
79
102
|
promptsApi: Pick<ResourceSavePromptsApi, 'createPrompt'>;
|
|
80
103
|
/** The new prompt's values; its folder comes from the panel. */
|
|
81
104
|
body: Omit<CreatePromptDto, 'folderId'>;
|
|
105
|
+
/** Client whose `copyCatalogEntityToOrgUnit` the direct write into an org unit calls; without it the adapter offers no direct write. */
|
|
106
|
+
publishClient?: ResourceSavePublishClient;
|
|
82
107
|
}
|
|
83
108
|
/** Creates a new toolset in the chosen Personal folder, never overwriting an existing one. */
|
|
84
|
-
export declare const createToolsetCreateAdapter: ({ toolsetsApi, body, }: ToolsetCreateAdapterParams) => ResourceCreateSaveAdapter;
|
|
109
|
+
export declare const createToolsetCreateAdapter: ({ toolsetsApi, body, publishClient, }: ToolsetCreateAdapterParams) => ResourceCreateSaveAdapter;
|
|
85
110
|
/** Creates a new prompt in the chosen Personal folder. */
|
|
86
|
-
export declare const createPromptCreateAdapter: ({ promptsApi, body, }: PromptCreateAdapterParams) => ResourceCreateSaveAdapter;
|
|
111
|
+
export declare const createPromptCreateAdapter: ({ promptsApi, body, publishClient, }: PromptCreateAdapterParams) => ResourceCreateSaveAdapter;
|
|
87
112
|
/** Returns a lister of the caller's prompt folders directly under `path` (plain text, `''` for the root). */
|
|
88
113
|
export declare const createPromptFolderLister: (promptsApi: Pick<ResourceSavePromptsApi, "listPrompts">) => (path: string) => Promise<ResourceFoldersResponseDto>;
|
|
89
114
|
/** The skill operation {@link createSkillFolderLister} calls. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-save-adapters.d.ts","sourceRoot":"","sources":["../../src/catalog/resource-save-adapters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,UAAU,EACV,0BAA0B,EAC1B,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"resource-save-adapters.d.ts","sourceRoot":"","sources":["../../src/catalog/resource-save-adapters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,UAAU,EACV,0BAA0B,EAC1B,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,qB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xI,aAAa,CAAC,EAAE,yBAAyB,CAAC;CAC3C;AAED,wDAAwD;AACxD,MAAM,WAAW,yBAAyB;IACxC,iCAAiC;IACjC,UAAU,EAAE,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;IACzD,gEAAgE;IAChE,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IACxC,wIAAwI;IACxI,aAAa,CAAC,EAAE,yBAAyB,CAAC;CAC3C;AAED,8FAA8F;AAC9F,eAAO,MAAM,0BAA0B,GAAI,uCAIxC,0BAA0B,KAAG,yBAY9B,CAAC;AAEH,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB,GAAI,sCAIvC,yBAAyB,KAAG,yBAW7B,CAAC;AAEH,6GAA6G;AAC7G,eAAO,MAAM,wBAAwB,GAClC,YAAY,IAAI,CAAC,sBAAsB,EAAE,aAAa,CAAC,MACjD,MAAM,MAAM,KAAG,OAAO,CAAC,0BAA0B,CAcvD,CAAC;AAEJ,iEAAiE;AACjE,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAElE,yIAAyI;AACzI,eAAO,MAAM,uBAAuB,GACjC,WAAW,qBAAqB,EAAE,QAAQ,MAAM,MAC1C,MAAM,MAAM,KAAG,OAAO,CAAC,0BAA0B,CAuBvD,CAAC"}
|
|
@@ -1,95 +1,101 @@
|
|
|
1
1
|
import { ResourceSaveError as e } from "./resource-save-adapter.js";
|
|
2
2
|
//#region src/catalog/resource-save-adapters.ts
|
|
3
|
-
var t = (e) => (t, n) => e.moveApplication({
|
|
3
|
+
var t = (e, t) => e ? { saveIntoOrgUnit: (n, r) => e.copyCatalogEntityToOrgUnit(t, n, { folderPath: r.join("/") }) } : {}, n = (e) => (t, n) => e.moveApplication({
|
|
4
4
|
applicationName: t,
|
|
5
5
|
moveResourceDto: { folderPath: n.join("/") }
|
|
6
|
-
}),
|
|
6
|
+
}), r = ({ applicationsApi: r, applicationId: i, runEmbeddedSave: a, getCommitFailedMessage: o, publishClient: s }) => ({
|
|
7
7
|
publishEntityType: "application",
|
|
8
8
|
isVersioned: !0,
|
|
9
|
-
saveInPlace: async () => (await
|
|
10
|
-
saveAsNewVersion: async (t,
|
|
11
|
-
let { id: s } = await
|
|
12
|
-
applicationName:
|
|
9
|
+
saveInPlace: async () => (await a(), { id: i }),
|
|
10
|
+
saveAsNewVersion: async (t, n) => {
|
|
11
|
+
let { id: s } = await r.forkApplicationVersion({
|
|
12
|
+
applicationName: i,
|
|
13
13
|
forkApplicationVersionDto: {
|
|
14
14
|
version: t,
|
|
15
|
-
folderPath:
|
|
15
|
+
folderPath: n.join("/")
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
try {
|
|
19
|
-
await
|
|
19
|
+
await a();
|
|
20
20
|
} catch (e) {
|
|
21
|
-
throw await
|
|
21
|
+
throw await r.deleteApplication({ applicationName: s }).catch(() => void 0), e;
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
|
-
return await
|
|
25
|
-
applicationName:
|
|
24
|
+
return await r.commitApplicationVersion({
|
|
25
|
+
applicationName: i,
|
|
26
26
|
commitApplicationVersionDto: { snapshotId: s }
|
|
27
27
|
});
|
|
28
28
|
} catch {
|
|
29
|
-
throw new e(
|
|
29
|
+
throw new e(o(t));
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
move:
|
|
33
|
-
|
|
32
|
+
move: n(r),
|
|
33
|
+
...t(s, "application")
|
|
34
|
+
}), i = ({ applicationsApi: e, applicationId: r, update: i, createVersion: a, publishClient: o }) => ({
|
|
34
35
|
publishEntityType: "application",
|
|
35
36
|
isVersioned: !0,
|
|
36
|
-
saveInPlace: async () => (await
|
|
37
|
+
saveInPlace: async () => (await i(), { id: r }),
|
|
37
38
|
saveAsNewVersion: async (e, t) => {
|
|
38
|
-
let n = await
|
|
39
|
+
let n = await a(e, t);
|
|
39
40
|
if (!n?.id) throw Error("Created version has no id");
|
|
40
41
|
return { id: n.id };
|
|
41
42
|
},
|
|
42
|
-
move:
|
|
43
|
-
|
|
43
|
+
move: n(e),
|
|
44
|
+
...t(o, "application")
|
|
45
|
+
}), a = ({ toolsetsApi: e, toolsetId: n, body: r, publishClient: i }) => ({
|
|
44
46
|
publishEntityType: "toolset",
|
|
45
47
|
isVersioned: !0,
|
|
46
48
|
saveInPlace: () => e.updateToolset({
|
|
47
|
-
toolsetName:
|
|
48
|
-
toolsetBodyDto:
|
|
49
|
+
toolsetName: n,
|
|
50
|
+
toolsetBodyDto: r
|
|
49
51
|
}),
|
|
50
|
-
saveAsNewVersion: (t,
|
|
51
|
-
...
|
|
52
|
+
saveAsNewVersion: (t, n) => e.createToolset({ createToolsetBodyDto: {
|
|
53
|
+
...r,
|
|
52
54
|
version: t,
|
|
53
55
|
createOnly: !0,
|
|
54
|
-
...
|
|
56
|
+
...n.length > 0 ? { folderPath: n.join("/") } : {}
|
|
55
57
|
} }),
|
|
56
58
|
move: (t, n) => e.moveToolset({
|
|
57
59
|
toolsetName: t,
|
|
58
60
|
moveResourceDto: { folderPath: n.join("/") }
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
+
}),
|
|
62
|
+
...t(i, "toolset")
|
|
63
|
+
}), o = ({ promptsApi: e, promptId: n, body: r, publishClient: i }) => ({
|
|
61
64
|
publishEntityType: "prompt",
|
|
62
65
|
isVersioned: !1,
|
|
63
66
|
saveInPlace: () => e.updatePrompt({
|
|
64
|
-
id:
|
|
65
|
-
updatePromptDto:
|
|
67
|
+
id: n,
|
|
68
|
+
updatePromptDto: r
|
|
66
69
|
}),
|
|
67
70
|
move: (t, n) => e.movePrompt({
|
|
68
71
|
id: t,
|
|
69
72
|
movePromptDto: { targetFolderId: n.join("/") }
|
|
70
|
-
})
|
|
71
|
-
|
|
73
|
+
}),
|
|
74
|
+
...t(i, "prompt")
|
|
75
|
+
}), s = ({ toolsetsApi: e, body: n, publishClient: r }) => ({
|
|
72
76
|
publishEntityType: "toolset",
|
|
73
77
|
isVersioned: !1,
|
|
74
|
-
createIn: (
|
|
75
|
-
...
|
|
78
|
+
createIn: (t) => e.createToolset({ createToolsetBodyDto: {
|
|
79
|
+
...n,
|
|
76
80
|
createOnly: !0,
|
|
77
|
-
...
|
|
78
|
-
} })
|
|
79
|
-
|
|
81
|
+
...t.length > 0 ? { folderPath: t.join("/") } : {}
|
|
82
|
+
} }),
|
|
83
|
+
...t(r, "toolset")
|
|
84
|
+
}), c = ({ promptsApi: e, body: n, publishClient: r }) => ({
|
|
80
85
|
publishEntityType: "prompt",
|
|
81
86
|
isVersioned: !1,
|
|
82
|
-
createIn: (
|
|
83
|
-
...
|
|
84
|
-
...
|
|
85
|
-
} })
|
|
86
|
-
|
|
87
|
+
createIn: (t) => e.createPrompt({ createPromptDto: {
|
|
88
|
+
...n,
|
|
89
|
+
...t.length > 0 ? { folderId: t.join("/") } : {}
|
|
90
|
+
} }),
|
|
91
|
+
...t(r, "prompt")
|
|
92
|
+
}), l = (e) => async (t) => {
|
|
87
93
|
let { folders: n } = await e.listPrompts(), r = t ? `${t}/` : "";
|
|
88
94
|
return { folders: n.filter((e) => e.id.startsWith(r) && e.id.length > r.length && !e.id.slice(r.length).includes("/")).map((e) => ({
|
|
89
95
|
name: e.name,
|
|
90
96
|
path: e.id
|
|
91
97
|
})) };
|
|
92
|
-
},
|
|
98
|
+
}, u = (e, t) => async (n) => {
|
|
93
99
|
let r = [], i = /* @__PURE__ */ new Set(), a;
|
|
94
100
|
do {
|
|
95
101
|
let o = await e.listSkills({
|
|
@@ -113,4 +119,4 @@ var t = (e) => (t, n) => e.moveApplication({
|
|
|
113
119
|
return { folders: r };
|
|
114
120
|
};
|
|
115
121
|
//#endregion
|
|
116
|
-
export {
|
|
122
|
+
export { r as createEmbeddedApplicationSaveAdapter, i as createHostApplicationSaveAdapter, t as createOrgUnitWriter, c as createPromptCreateAdapter, l as createPromptFolderLister, o as createPromptSaveAdapter, u as createSkillFolderLister, s as createToolsetCreateAdapter, a as createToolsetSaveAdapter };
|
|
@@ -2,14 +2,15 @@ import { SaveVersionMode, FolderDestination, PublicationRule } from '@epam/ai-di
|
|
|
2
2
|
import { PublishApiClient } from './create-publish-api';
|
|
3
3
|
import { CatalogPublishEntityType } from './publish';
|
|
4
4
|
import { ResourceSaveAdapter } from './resource-save-adapter';
|
|
5
|
+
import { SaveDestinationRoot } from './save-destination-root';
|
|
5
6
|
export * from './resource-save-adapter';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export { SaveDestinationRoot };
|
|
8
|
+
/**
|
|
9
|
+
* Returns the Save panel root a destination's `rootKey` names, or `undefined`
|
|
10
|
+
* for a key that is not one of its roots.
|
|
11
|
+
* @param rootKey - the `rootKey` of a `FolderDestination`
|
|
12
|
+
*/
|
|
13
|
+
export declare const toSaveDestinationRoot: (rootKey: string) => SaveDestinationRoot | undefined;
|
|
13
14
|
/** How a save that reached at least its first step ended. */
|
|
14
15
|
export declare enum ResourceSaveOutcome {
|
|
15
16
|
/** Every step succeeded. */
|
|
@@ -17,7 +18,9 @@ export declare enum ResourceSaveOutcome {
|
|
|
17
18
|
/** The save succeeded but moving into the chosen Personal folder failed. */
|
|
18
19
|
SavedButMoveFailed = "savedButMoveFailed",
|
|
19
20
|
/** The save succeeded but the publish request failed. */
|
|
20
|
-
SavedButPublishFailed = "savedButPublishFailed"
|
|
21
|
+
SavedButPublishFailed = "savedButPublishFailed",
|
|
22
|
+
/** The save succeeded but the direct write into the org-unit folder failed. */
|
|
23
|
+
SavedButOrgUnitWriteFailed = "savedButOrgUnitWriteFailed"
|
|
21
24
|
}
|
|
22
25
|
/** Why the new version typed in the Save panel cannot be used. */
|
|
23
26
|
export declare enum ResourceSaveVersionError {
|
|
@@ -44,6 +47,8 @@ export interface ResourceSaveChoice {
|
|
|
44
47
|
newVersion: string;
|
|
45
48
|
/** Access rules sent with the publish request for an Organization destination. */
|
|
46
49
|
rules?: PublicationRule[];
|
|
50
|
+
/** Whether the Organization destination takes a direct write (an org unit the user may write to) instead of a publish request. Defaults to `false`. */
|
|
51
|
+
isDirectWrite?: boolean;
|
|
47
52
|
}
|
|
48
53
|
/** Sends the publish request for a saved resource. */
|
|
49
54
|
export type PublishSavedResource = (entityType: CatalogPublishEntityType, id: string, folderPath: string[], version: string | undefined, rules: PublicationRule[]) => Promise<void>;
|
|
@@ -59,6 +64,8 @@ export interface ResourceSaveResult {
|
|
|
59
64
|
isNewVersion: boolean;
|
|
60
65
|
/** Whether a publish request was sent successfully. */
|
|
61
66
|
isPublished: boolean;
|
|
67
|
+
/** Whether the resource was written directly into an org-unit folder; `false` or absent when it was not. */
|
|
68
|
+
isWrittenToOrgUnit?: boolean;
|
|
62
69
|
/** The error of the step that failed after the save, if any. */
|
|
63
70
|
error?: unknown;
|
|
64
71
|
}
|
|
@@ -68,7 +75,8 @@ export declare const createPublishSavedResource: (client: Pick<PublishApiClient,
|
|
|
68
75
|
* Runs the Save panel's choice through `adapter`: create the resource in the
|
|
69
76
|
* chosen Personal folder, or save it in place or as a new version and then
|
|
70
77
|
* move it into a different Personal folder; for an Organization folder, save
|
|
71
|
-
* where it lives and publish
|
|
78
|
+
* where it lives and publish, or write it into the org-unit folder directly
|
|
79
|
+
* when the choice says so and the adapter can. Rejects only when the first step fails; a failure
|
|
72
80
|
* after the save resolves with the matching partial outcome, because the
|
|
73
81
|
* save itself already happened.
|
|
74
82
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-save.d.ts","sourceRoot":"","sources":["../../src/catalog/resource-save.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC1D,O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