@epam/ai-dial-catalog 1.1.0-dev.51 → 1.1.0-dev.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,71 +0,0 @@
1
- import { CatalogItem } from '../models/catalog-item';
2
- import { PublishFolderNode, PublishHistoryEntry } from '../models/publish';
3
- /** An item publishable through {@link usePublishFlow} — versioned (`CatalogItem`) or not (e.g. a conversation). */
4
- export interface PublishFlowItem {
5
- /** Version, when the item is versioned. `undefined` for unversioned resources. */
6
- version?: string;
7
- }
8
- /** Options for {@link usePublishFlow}. */
9
- export interface UsePublishFlowOptions<TItem extends PublishFlowItem> {
10
- /** The item being published — a `CatalogItem` (versioned) or an unversioned resource (e.g. a conversation). */
11
- item: TItem;
12
- /** Previously published entries for this item. */
13
- history: PublishHistoryEntry[];
14
- /** Root-level destination folder nodes, as currently known to the host. */
15
- folderItems: PublishFolderNode[];
16
- /**
17
- * Resolves whether the current user can publish to a given folder path.
18
- * Defaults to always allowing (`() => true`) when omitted.
19
- */
20
- hasWriteAccess?: (folderPath: string[]) => boolean;
21
- /**
22
- * Called when the user confirms a new folder name. The host owns
23
- * persisting the folder; the hook also adds it locally so it is
24
- * immediately selectable within this session. If the returned promise
25
- * rejects, the optimistically added folder is rolled back and the submit-
26
- * error callout is surfaced.
27
- */
28
- onCreateFolder?: (parentPath: string[], name: string) => void | Promise<void>;
29
- /** Called with the destination folder path when the user confirms publish/update. */
30
- onPublish: (item: TItem, folderPath: string[]) => Promise<void>;
31
- /** Called after a successful publish; the host surfaces its own success notification. */
32
- onPublishSuccess?: (item: TItem, folderPath: string[]) => void;
33
- }
34
- /** State and handlers returned by {@link usePublishFlow}. */
35
- export interface UsePublishFlowResult {
36
- /** Folder tree, including any folders created (but not yet persisted) during this session. */
37
- folderItems: PublishFolderNode[];
38
- /**
39
- * Currently selected destination folder path. `undefined` means nothing
40
- * is selected; `[]` means the bucket root itself is selected (a distinct,
41
- * valid destination).
42
- */
43
- selectedFolderPath?: string[];
44
- /** Selects a destination folder or the root (`[]`); pass `undefined` to deselect. */
45
- setSelectedFolderPath: (path: string[] | undefined) => void;
46
- /** Confirms a new folder name: adds it locally and reports it to the host, rolling back and surfacing an error if the host rejects. */
47
- handleCreateFolder: (parentPath: string[], name: string) => Promise<void>;
48
- /**
49
- * Whether `selectedFolderPath` already has this publication — this exact
50
- * version, for a versioned item, or any prior entry at all, for an
51
- * unversioned item (whose `version` is `undefined`).
52
- */
53
- hasExistingPublicationInFolder: boolean;
54
- /** Whether the current user can publish to `selectedFolderPath`. */
55
- hasWriteAccess: boolean;
56
- /** Whether a publish request is currently in flight. */
57
- isSubmitting: boolean;
58
- /** Whether the most recent submit attempt failed. */
59
- hasSubmitError: boolean;
60
- /**
61
- * Submits the publish/update request for the selected folder. Resolves to
62
- * `true` on success and `false` if `onPublish` rejected, so the caller can
63
- * decide whether to close the flow.
64
- */
65
- handleSubmit: () => Promise<boolean>;
66
- /** Resets folder selection, any locally-created folders, and the submit error back to their initial state. */
67
- reset: () => void;
68
- }
69
- /** Manages all state for the Publish flow: folder selection, local folder creation, existing-publication detection, and submit handling. */
70
- export declare const usePublishFlow: <TItem extends PublishFlowItem = CatalogItem>({ item, history, folderItems: initialFolderItems, hasWriteAccess: resolveWriteAccess, onCreateFolder, onPublish, onPublishSuccess, }: UsePublishFlowOptions<TItem>) => UsePublishFlowResult;
71
- //# sourceMappingURL=use-publish-flow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-publish-flow.d.ts","sourceRoot":"","sources":["../../src/utils/use-publish-flow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,mHAAmH;AACnH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA2DD,0CAA0C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