@epam/ai-dial-chat-hooks 1.4.0-dev.96 → 1.4.0-rc.1
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/api-error/map-api-error.d.ts +10 -0
- package/api-error/map-api-error.d.ts.map +1 -0
- package/api-error/map-api-error.js +11 -0
- package/catalog/create-publish-api.d.ts +14 -10
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +8 -9
- package/catalog/map-deployment-to-catalog-item.d.ts.map +1 -1
- package/catalog/map-deployment-to-catalog-item.js +1 -0
- package/catalog/publish-target-taken.d.ts +31 -0
- package/catalog/publish-target-taken.d.ts.map +1 -0
- package/catalog/publish-target-taken.js +14 -0
- package/catalog/resource-name-conflict.d.ts.map +1 -1
- package/catalog/resource-name-conflict.js +19 -22
- package/catalog/resource-save.d.ts +2 -4
- package/catalog/resource-save.d.ts.map +1 -1
- package/catalog/resource-save.js +38 -32
- package/catalog/use-publish-target-guard.d.ts +45 -0
- package/catalog/use-publish-target-guard.d.ts.map +1 -0
- package/catalog/use-publish-target-guard.js +18 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts +11 -3
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +41 -31
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +27 -11
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +163 -138
- package/catalog.js +51 -49
- package/conversation/conversation-list.d.ts +7 -1
- package/conversation/conversation-list.d.ts.map +1 -1
- package/conversation/conversation-list.js +11 -2
- 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.js +3 -3
- package/entry-points/catalog.d.ts +2 -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/skill-editor.d.ts +1 -0
- package/entry-points/skill-editor.d.ts.map +1 -1
- package/entry-points/utils.d.ts +1 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/file-manager.js +33 -33
- package/files/dial-file-manager.types.d.ts +4 -2
- package/files/dial-file-manager.types.d.ts.map +1 -1
- package/files/dial-file.d.ts +6 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +17 -12
- package/files/useDialFileListing/useDialFileListing.d.ts +9 -1
- package/files/useDialFileListing/useDialFileListing.d.ts.map +1 -1
- package/files/useDialFileListing/useDialFileListing.js +205 -183
- package/files/useDialFileManager/useDialFileManager.d.ts +1 -1
- package/files/useDialFileManager/useDialFileManager.d.ts.map +1 -1
- package/files/useDialFileManager/useDialFileManager.js +114 -113
- package/files/useDialFileMutations/useDialFileMutations.d.ts +2 -1
- package/files/useDialFileMutations/useDialFileMutations.d.ts.map +1 -1
- package/files/useDialFileMutations/useDialFileMutations.js +5 -5
- package/index.d.ts +5 -0
- package/index.d.ts.map +1 -1
- package/index.js +267 -262
- package/org-units/org-unit-guards.d.ts +95 -1
- package/org-units/org-unit-guards.d.ts.map +1 -1
- package/org-units/org-unit-guards.js +51 -16
- package/org-units/useOrgUnits/useOrgUnits.d.ts +12 -4
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -1
- package/org-units/useOrgUnits/useOrgUnits.js +44 -35
- package/package.json +20 -20
- package/project/project-conversation-data-source.js +4 -4
- package/project/project-refresh.d.ts +2 -0
- package/project/project-refresh.d.ts.map +1 -1
- package/project/project-refresh.js +1 -1
- package/project/use-project-actions.d.ts +3 -1
- package/project/use-project-actions.d.ts.map +1 -1
- package/project/use-project-actions.js +39 -38
- package/project/use-project.d.ts +3 -1
- package/project/use-project.d.ts.map +1 -1
- package/project/use-project.js +57 -44
- package/scheduled-task/scheduled-task-display.d.ts +51 -4
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-display.js +53 -46
- package/scheduled-task/scheduled-task-next-occurrence.d.ts +2 -0
- package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-next-occurrence.js +2 -2
- package/scheduled-task/scheduled-task-time-format.d.ts +36 -0
- package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
- package/scheduled-task/scheduled-task-time-format.js +34 -0
- package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-trigger.js +13 -14
- package/scheduled-tasks.js +14 -13
- package/skill/skill-archive.d.ts.map +1 -1
- package/skill/skill-archive.js +6 -7
- package/skill/skill-file-batch-validation.d.ts +6 -0
- package/skill/skill-file-batch-validation.d.ts.map +1 -1
- package/skill/skill-file-batch-validation.js +39 -37
- package/skill/skill-types.d.ts +0 -6
- package/skill/skill-types.d.ts.map +1 -1
- package/skill/skill-types.js +7 -8
- package/skill/skill.d.ts +2 -9
- package/skill/skill.d.ts.map +1 -1
- package/skill/skill.js +33 -34
- package/skill/types/skill-editor-submit.d.ts +8 -0
- package/skill/types/skill-editor-submit.d.ts.map +1 -0
- package/skill/types/skill-editor-submit.js +6 -0
- package/skill/useSkillEditorLoad.js +1 -1
- package/skill/useSkillEditorSubmit.d.ts +2 -3
- package/skill/useSkillEditorSubmit.d.ts.map +1 -1
- package/skill/useSkillEditorSubmit.js +103 -102
- package/skill/useSkillFileActions.d.ts +7 -1
- package/skill/useSkillFileActions.d.ts.map +1 -1
- package/skill/useSkillFileActions.js +55 -49
- package/skill-editor.js +7 -6
- package/utils.js +28 -27
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OrgUnitNamespace } from '@epam/ai-dial-chat-shared';
|
|
1
|
+
import { OrgUnitNamespace, CatalogEntityType } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { PublishDependencyType } from '@epam/ai-dial-publish-panel';
|
|
2
3
|
import { CatalogPublishEntityType } from '../catalog/publish';
|
|
3
4
|
import { SaveDestinationRoot } from '../catalog/save-destination-root';
|
|
4
5
|
import { OrgUnitsStatus } from './types';
|
|
@@ -61,4 +62,97 @@ export declare const buildFolderGuards: ({ purpose, isEnabled, status, namespace
|
|
|
61
62
|
export declare const toPublishDisabledReason: (getDisabledReason: ((folderPath: string[]) => string | undefined) | undefined) => ((destination: {
|
|
62
63
|
path: string[];
|
|
63
64
|
}) => string | undefined) | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The kind of dependency whose resources live in `namespace`, or `undefined` for a namespace no dependency has.
|
|
67
|
+
* @param namespace - org-unit namespace
|
|
68
|
+
*/
|
|
69
|
+
export declare const getDependencyTypeOfNamespace: (namespace: OrgUnitNamespace) => PublishDependencyType | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* The org-unit namespaces a direct write must hold `write` on to copy the given
|
|
72
|
+
* dependencies, each once. A `file` has none: the files a schema marks travel
|
|
73
|
+
* with the application.
|
|
74
|
+
* @param dependencies - the dependencies the panel lists
|
|
75
|
+
*/
|
|
76
|
+
export declare const getDependencyOrgUnitNamespaces: (dependencies: readonly {
|
|
77
|
+
type: PublishDependencyType;
|
|
78
|
+
}[]) => OrgUnitNamespace[];
|
|
79
|
+
/** Inputs of {@link getMissingDirectWriteNamespaces}. */
|
|
80
|
+
interface MissingDirectWriteNamespacesParams {
|
|
81
|
+
/** Whether the `orgUnitsEnabled` feature flag is on. */
|
|
82
|
+
isEnabled: boolean;
|
|
83
|
+
/** Load status from `useOrgUnits`. */
|
|
84
|
+
status: OrgUnitsStatus;
|
|
85
|
+
/** Strict write check from `useOrgUnits` (`canSaveDirectlyAt`). */
|
|
86
|
+
canSaveDirectlyAt: OrgUnitRightCheck;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The namespaces, among those asked, the user may not write straight into the
|
|
90
|
+
* org unit that owns the folder. Empty while the rights are not known (flag
|
|
91
|
+
* off or status not `Ready`), so missing data never disables a folder.
|
|
92
|
+
* @param params - flag, status and the hook's strict check
|
|
93
|
+
* @param folderPath - the destination folder inside the Organization root
|
|
94
|
+
* @param namespaces - the namespaces the write needs
|
|
95
|
+
*/
|
|
96
|
+
export declare const getMissingDirectWriteNamespaces: ({ isEnabled, status, canSaveDirectlyAt }: MissingDirectWriteNamespacesParams, folderPath: string[], namespaces: readonly OrgUnitNamespace[]) => OrgUnitNamespace[];
|
|
97
|
+
/** What {@link getPublishDirectAvailability} reads of a listed dependency. */
|
|
98
|
+
export interface PublishDirectDependency {
|
|
99
|
+
/** What kind of resource it is. */
|
|
100
|
+
type: PublishDependencyType;
|
|
101
|
+
/** Whether the dependency is a folder of files; only a `file` dependency is ever one. */
|
|
102
|
+
isFolder?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** Outcome of {@link getPublishDirectAvailability}. */
|
|
105
|
+
export interface PublishDirectAvailability {
|
|
106
|
+
/** Whether the publish may write directly: the entity check holds, no dependency namespace is missing and no folder reference blocks it. */
|
|
107
|
+
readonly isDirect: boolean;
|
|
108
|
+
/** Dependency namespaces the user may not write in the owning unit; empty unless the entity check holds. */
|
|
109
|
+
readonly missingNamespaces: readonly OrgUnitNamespace[];
|
|
110
|
+
/** The dependency kinds of `missingNamespaces`, for the host to name; same order, same emptiness. */
|
|
111
|
+
readonly missingTypes: readonly PublishDependencyType[];
|
|
112
|
+
/** Whether an application refers to a folder of files and the user is not a DIAL admin, so a request is filed; `false` unless the entity check holds. */
|
|
113
|
+
readonly hasFolderReference: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** The outcome when nothing can be written directly and nothing is named: frozen, so it is safe to share. */
|
|
116
|
+
export declare const NO_DIRECT_AVAILABILITY: PublishDirectAvailability;
|
|
117
|
+
/** Checks {@link getPublishDirectAvailability} reads, all from `useOrgUnits`. */
|
|
118
|
+
export interface PublishDirectChecks {
|
|
119
|
+
/** The entity's own direct-publish check. */
|
|
120
|
+
canPublishDirectlyAt: OrgUnitRightCheck;
|
|
121
|
+
/** Strict write check, applied to each dependency namespace. */
|
|
122
|
+
canSaveDirectlyAt: OrgUnitRightCheck;
|
|
123
|
+
/** Whether the user is a DIAL admin, the only caller DIAL Core lets copy an application that refers to a folder. */
|
|
124
|
+
hasAdminAccess: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Whether the dependencies and the user make an application a folder-reference
|
|
128
|
+
* case: a listed dependency is a folder of files and the user is not a DIAL
|
|
129
|
+
* admin. Only an application can be one.
|
|
130
|
+
* @param namespace - the entity's org-unit namespace
|
|
131
|
+
* @param dependencies - the private dependencies the panel lists
|
|
132
|
+
* @param hasAdminAccess - whether the user is a DIAL admin
|
|
133
|
+
*/
|
|
134
|
+
export declare const hasBlockingFolderReference: (namespace: OrgUnitNamespace, dependencies: readonly PublishDirectDependency[], hasAdminAccess: boolean) => boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether a publish into the folder writes directly and which reasons block
|
|
137
|
+
* it. A user who may not publish the entity directly gets no missing list and
|
|
138
|
+
* no folder flag, since a request is filed anyway; a plain file dependency
|
|
139
|
+
* never blocks, a folder of files blocks an application unless the user is a
|
|
140
|
+
* DIAL admin.
|
|
141
|
+
* @param folderPath - the destination folder inside the Organization root
|
|
142
|
+
* @param namespace - the entity's org-unit namespace
|
|
143
|
+
* @param dependencies - the private dependencies the panel lists
|
|
144
|
+
* @param checks - the hook's direct-publish and strict write checks, and the DIAL admin flag
|
|
145
|
+
*/
|
|
146
|
+
export declare const getPublishDirectAvailability: (folderPath: string[], namespace: OrgUnitNamespace, dependencies: readonly PublishDirectDependency[], { canPublishDirectlyAt, canSaveDirectlyAt, hasAdminAccess, }: PublishDirectChecks) => PublishDirectAvailability;
|
|
147
|
+
/**
|
|
148
|
+
* {@link getPublishDirectAvailability} for a catalog item type: the entity's
|
|
149
|
+
* namespace comes from its publish entity type, and a type that cannot be
|
|
150
|
+
* published (or has no namespace) is never direct.
|
|
151
|
+
* @param itemType - the catalog entity type of the item being published
|
|
152
|
+
* @param folderPath - the destination folder inside the Organization root
|
|
153
|
+
* @param dependencies - the private dependencies the panel lists
|
|
154
|
+
* @param checks - the hook's direct-publish and strict write checks, and the DIAL admin flag
|
|
155
|
+
*/
|
|
156
|
+
export declare const getCatalogPublishDirectAvailability: (itemType: CatalogEntityType, folderPath: string[], dependencies: readonly PublishDirectDependency[], checks: PublishDirectChecks) => PublishDirectAvailability;
|
|
157
|
+
export {};
|
|
64
158
|
//# sourceMappingURL=org-unit-guards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org-unit-guards.d.ts","sourceRoot":"","sources":["../../src/org-units/org-unit-guards.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"org-unit-guards.d.ts","sourceRoot":"","sources":["../../src/org-units/org-unit-guards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAcnE;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,YAAY,wBAAwB,KACnC,gBAAgB,GAAG,SAAiD,CAAC;AAExE,wEAAwE;AACxE,oBAAY,yBAAyB;IACnC,sGAAsG;IACtG,IAAI,SAAS;IACb,6DAA6D;IAC7D,OAAO,YAAY;CACpB;AAED,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E,iBAAiB,CAAC;IACrC,oHAAoH;IACpH,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,WAAW,gBAAgB,EAC3B,cAAc,SAAS,uBAAuB,EAAE,EAChD,gBAAgB,OAAO,KACtB,OAG8D,CAAC;AAElE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GACvC,YAAY,MAAM,EAAE,EACpB,WAAW,gBAAgB,EAC3B,cAAc,SAAS,uBAAuB,EAAE,EAChD,8DAIG,mBAAmB,KACrB,yBAoBF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC,GAC9C,UAAU,iBAAiB,EAC3B,YAAY,MAAM,EAAE,EACpB,cAAc,SAAS,uBAAuB,EAAE,EAChD,QAAQ,mBAAmB,KAC1B,yBAWF,CAAC"}
|
|
@@ -1,28 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { toPublishEntityType as e } from "../catalog/publish.js";
|
|
2
|
+
import { SaveDestinationRoot as t } from "../catalog/save-destination-root.js";
|
|
3
|
+
import { OrgUnitsStatus as n } from "./types.js";
|
|
4
|
+
import { OrgUnitNamespace as r } from "@epam/ai-dial-chat-shared";
|
|
4
5
|
//#region src/org-units/org-unit-guards.ts
|
|
5
|
-
var
|
|
6
|
+
var i = {
|
|
6
7
|
model: void 0,
|
|
7
|
-
toolset:
|
|
8
|
-
application:
|
|
9
|
-
prompt:
|
|
10
|
-
skill:
|
|
11
|
-
project:
|
|
12
|
-
},
|
|
8
|
+
toolset: r.Toolsets,
|
|
9
|
+
application: r.Applications,
|
|
10
|
+
prompt: r.Prompts,
|
|
11
|
+
skill: r.Skills,
|
|
12
|
+
project: r.Projects
|
|
13
|
+
}, a = (e) => i[e], o = /* @__PURE__ */ function(e) {
|
|
13
14
|
return e.Save = "save", e.Publish = "publish", e;
|
|
14
|
-
}({}),
|
|
15
|
-
if (!r || i !==
|
|
15
|
+
}({}), s = ({ purpose: e, isEnabled: r, status: i, namespace: a, canSaveAt: o, canPublishAt: s, canSaveDirectlyAt: c, getReason: l }) => {
|
|
16
|
+
if (!r || i !== n.Ready || a == null) return {
|
|
16
17
|
isDestinationUsable: void 0,
|
|
17
18
|
getDisabledReason: void 0,
|
|
18
19
|
canSaveDirectlyTo: void 0
|
|
19
20
|
};
|
|
20
|
-
let u =
|
|
21
|
+
let u = e === "save" ? o : s, d = (e, n = t.Organization) => n !== t.Organization || u(e.join("/"), a);
|
|
21
22
|
return {
|
|
22
23
|
isDestinationUsable: d,
|
|
23
|
-
canSaveDirectlyTo: c && ((
|
|
24
|
+
canSaveDirectlyTo: c && ((e, n = t.Organization) => n === t.Organization && c(e.join("/"), a)),
|
|
24
25
|
getDisabledReason: l && ((e, t) => d(e, t) ? void 0 : l(e))
|
|
25
26
|
};
|
|
26
|
-
},
|
|
27
|
+
}, c = (e) => e && ((t) => e(t.path)), l = {
|
|
28
|
+
application: r.Applications,
|
|
29
|
+
toolset: r.Toolsets,
|
|
30
|
+
prompt: r.Prompts,
|
|
31
|
+
skill: r.Skills,
|
|
32
|
+
file: void 0
|
|
33
|
+
}, u = (e) => Object.entries(l).find(([, t]) => t === e)?.[0], d = (e) => {
|
|
34
|
+
let t = /* @__PURE__ */ new Set();
|
|
35
|
+
for (let { type: n } of e) {
|
|
36
|
+
let e = l[n];
|
|
37
|
+
e != null && t.add(e);
|
|
38
|
+
}
|
|
39
|
+
return [...t];
|
|
40
|
+
}, f = ({ isEnabled: e, status: t, canSaveDirectlyAt: r }, i, a) => !e || t !== n.Ready ? [] : a.filter((e) => !r(i.join("/"), e)), p = Object.freeze({
|
|
41
|
+
isDirect: !1,
|
|
42
|
+
missingNamespaces: Object.freeze([]),
|
|
43
|
+
missingTypes: Object.freeze([]),
|
|
44
|
+
hasFolderReference: !1
|
|
45
|
+
}), m = (e, t, n) => e === r.Applications && !n && t.some((e) => e.isFolder === !0), h = (e, t, n, { canPublishDirectlyAt: r, canSaveDirectlyAt: i, hasAdminAccess: a }) => {
|
|
46
|
+
let o = e.join("/");
|
|
47
|
+
if (!r(o, t)) return p;
|
|
48
|
+
let s = d(n).filter((e) => !i(o, e)), c = m(t, n, a);
|
|
49
|
+
return {
|
|
50
|
+
isDirect: s.length === 0 && !c,
|
|
51
|
+
missingNamespaces: s,
|
|
52
|
+
missingTypes: s.flatMap((e) => {
|
|
53
|
+
let t = u(e);
|
|
54
|
+
return t == null ? [] : [t];
|
|
55
|
+
}),
|
|
56
|
+
hasFolderReference: c
|
|
57
|
+
};
|
|
58
|
+
}, g = (t, n, r, i) => {
|
|
59
|
+
let o = e(t), s = o == null ? void 0 : a(o);
|
|
60
|
+
return s == null ? p : h(n, s, r, i);
|
|
61
|
+
};
|
|
27
62
|
//#endregion
|
|
28
|
-
export {
|
|
63
|
+
export { p as NO_DIRECT_AVAILABILITY, o as OrgUnitFolderGuardPurpose, s as buildFolderGuards, g as getCatalogPublishDirectAvailability, d as getDependencyOrgUnitNamespaces, u as getDependencyTypeOfNamespace, f as getMissingDirectWriteNamespaces, a as getOrgUnitNamespace, h as getPublishDirectAvailability, m as hasBlockingFolderReference, c as toPublishDisabledReason };
|
|
@@ -22,12 +22,20 @@ export interface UseOrgUnitsResult {
|
|
|
22
22
|
canSaveDirectlyAt: OrgUnitRightCheck;
|
|
23
23
|
/** Whether a publication request into the path can be sent; `true` until the status is `Ready`. */
|
|
24
24
|
canPublishAt: OrgUnitRightCheck;
|
|
25
|
+
/** Whether the user is a DIAL admin, the global role; a unit's own `admin` role does not count. `false` until the status is `Ready`. */
|
|
26
|
+
hasAdminAccess: boolean;
|
|
27
|
+
/** Whether a publish panel may write straight into the path instead of filing a request: it lies inside an org unit, the user may write the namespace there and may approve publications (`read` and `write` on `publications`, or DIAL admin). `false` until the status is `Ready`. */
|
|
28
|
+
canPublishDirectlyAt: OrgUnitRightCheck;
|
|
29
|
+
/** Whether a public folder stays listed: it is a unit, lies inside one or is an ancestor of one. `true` until the status is `Ready`, so missing data never hides a folder. */
|
|
30
|
+
isPublicFolderVisible: (publicPath: string) => boolean;
|
|
31
|
+
/** Whether a new public folder created inside the path would stay listed by `isPublicFolderVisible`: the path lies inside an org unit. `false` for the public root and an ancestor-only folder once the status is `Ready`; `true` until then. */
|
|
32
|
+
canCreatePublicFolderIn: (publicPath: string) => boolean;
|
|
25
33
|
}
|
|
26
34
|
/**
|
|
27
|
-
* Loads the current user's org units once, on demand, and answers save, direct-save
|
|
28
|
-
* and publication-request rights per path. Until the status is `Ready`
|
|
29
|
-
* `Disabled` and `Error`) every answer is `true` except `canSaveDirectlyAt
|
|
30
|
-
* data never disables a folder.
|
|
35
|
+
* Loads the current user's org units once, on demand, and answers save, direct-save,
|
|
36
|
+
* direct-publish and publication-request rights per path. Until the status is `Ready`
|
|
37
|
+
* (and in `Disabled` and `Error`) every answer is `true` except `canSaveDirectlyAt` and
|
|
38
|
+
* `canPublishDirectlyAt`, so missing data never disables a folder or selects a write.
|
|
31
39
|
* @param options - the host-supplied `listOrgUnits` read
|
|
32
40
|
*/
|
|
33
41
|
export declare const useOrgUnits: ({ listOrgUnits, }: UseOrgUnitsOptions) => UseOrgUnitsResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOrgUnits.d.ts","sourceRoot":"","sources":["../../../src/org-units/useOrgUnits/useOrgUnits.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useOrgUnits.d.ts","sourceRoot":"","sources":["../../../src/org-units/useOrgUnits/useOrgUnits.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,YAAY,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACjD;AAED,mGAAmG;AACnG,MAAM,MAAM,iBAAiB,GAAG,CAC9B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,gBAAgB,KACxB,OAAO,CAAC;AAEb,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,gGAAgG;IAChG,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,mHAAmH;IACnH,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,6IAA6I;IAC7I,SAAS,EAAE,iBAAiB,CAAC;IAC7B,4LAA4L;IAC5L,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,mGAAmG;IACnG,YAAY,EAAE,iBAAiB,CAAC;IAChC,wIAAwI;IACxI,cAAc,EAAE,OAAO,CAAC;IACxB,wRAAwR;IACxR,oBAAoB,EAAE,iBAAiB,CAAC;IACxC,8KAA8K;IAC9K,qBAAqB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IACvD,iPAAiP;IACjP,uBAAuB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1D;AAID;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,mBAEzB,kBAAkB,KAAG,iBA8HvB,CAAC"}
|
|
@@ -1,54 +1,63 @@
|
|
|
1
1
|
import { OrgUnitsStatus as e } from "../types.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback as
|
|
2
|
+
import { canApprovePublicationsAt as t, canRequestPublicationAt as n, canSaveToFolderAt as r, canWriteIntoOrgUnitAt as i, findOwningOrgUnit as a, isOrgUnitTreeFolder as o } from "@epam/ai-dial-chat-shared";
|
|
3
|
+
import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
4
4
|
//#region src/org-units/useOrgUnits/useOrgUnits.ts
|
|
5
|
-
var
|
|
5
|
+
var f = {
|
|
6
6
|
hasAdminAccess: !1,
|
|
7
7
|
units: []
|
|
8
|
-
},
|
|
9
|
-
let [
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
}, p = ({ listOrgUnits: p }) => {
|
|
9
|
+
let [m, h] = d(f), [g, _] = d(e.Idle), v = u(!1), y = u(g);
|
|
10
|
+
y.current = g;
|
|
11
|
+
let b = u(!0), x = u(p);
|
|
12
|
+
x.current = p, c(() => (b.current = !0, () => {
|
|
13
|
+
b.current = !1;
|
|
14
14
|
}), []);
|
|
15
|
-
let
|
|
16
|
-
t ||
|
|
15
|
+
let S = s(async (t) => {
|
|
16
|
+
t || _(e.Loading);
|
|
17
17
|
try {
|
|
18
|
-
let t = await
|
|
19
|
-
if (!
|
|
18
|
+
let t = await x.current();
|
|
19
|
+
if (!b.current) return;
|
|
20
20
|
if (!t.enabled) {
|
|
21
|
-
f
|
|
21
|
+
h(f), _(e.Disabled);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
h({
|
|
25
25
|
hasAdminAccess: t.hasAdminAccess,
|
|
26
26
|
units: t.units
|
|
27
|
-
}),
|
|
27
|
+
}), _(e.Ready);
|
|
28
28
|
} catch {
|
|
29
|
-
if (t || (
|
|
30
|
-
f
|
|
29
|
+
if (t || (v.current = !1, !b.current)) return;
|
|
30
|
+
h(f), _(e.Error);
|
|
31
31
|
}
|
|
32
|
-
}, []),
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
return
|
|
38
|
-
status:
|
|
39
|
-
ensureUnits:
|
|
40
|
-
refreshUnits:
|
|
41
|
-
canSaveAt:
|
|
42
|
-
canSaveDirectlyAt:
|
|
43
|
-
canPublishAt:
|
|
32
|
+
}, []), C = s(() => {
|
|
33
|
+
v.current || (v.current = !0, S(!1));
|
|
34
|
+
}, [S]), w = s(() => {
|
|
35
|
+
y.current !== e.Disabled && (y.current === e.Ready ? S(!0) : C());
|
|
36
|
+
}, [C, S]), T = g === e.Ready, E = s((e, t) => !T || r(m, e, t), [T, m]), D = s((e, t) => T && i(m, e, t), [T, m]), O = s((e, t) => !T || n(m, e, t), [T, m]), k = s((e, n) => T && i(m, e, n) && t(m, e), [T, m]), A = s((e) => !T || o(m.units, e), [T, m]), j = s((e) => !T || a(m.units, e) != null, [T, m]);
|
|
37
|
+
return l(() => ({
|
|
38
|
+
status: g,
|
|
39
|
+
ensureUnits: C,
|
|
40
|
+
refreshUnits: w,
|
|
41
|
+
canSaveAt: E,
|
|
42
|
+
canSaveDirectlyAt: D,
|
|
43
|
+
canPublishAt: O,
|
|
44
|
+
canPublishDirectlyAt: k,
|
|
45
|
+
hasAdminAccess: T && m.hasAdminAccess,
|
|
46
|
+
isPublicFolderVisible: A,
|
|
47
|
+
canCreatePublicFolderIn: j
|
|
44
48
|
}), [
|
|
45
|
-
|
|
46
|
-
b,
|
|
47
|
-
x,
|
|
49
|
+
g,
|
|
48
50
|
C,
|
|
49
51
|
w,
|
|
50
|
-
|
|
52
|
+
E,
|
|
53
|
+
D,
|
|
54
|
+
O,
|
|
55
|
+
k,
|
|
56
|
+
T,
|
|
57
|
+
m.hasAdminAccess,
|
|
58
|
+
A,
|
|
59
|
+
j
|
|
51
60
|
]);
|
|
52
61
|
};
|
|
53
62
|
//#endregion
|
|
54
|
-
export {
|
|
63
|
+
export { p as useOrgUnits };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-chat-hooks",
|
|
3
3
|
"description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
|
|
4
|
-
"version": "1.4.0-
|
|
4
|
+
"version": "1.4.0-rc.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
|
-
"@epam/ai-dial-chat-api-client": "1.4.0-
|
|
134
|
+
"@epam/ai-dial-chat-api-client": "1.4.0-rc.1",
|
|
135
135
|
"dompurify": "3.4.17",
|
|
136
136
|
"fflate": "^0.8.3",
|
|
137
137
|
"lru-cache": "^10.4.3",
|
|
@@ -140,25 +140,25 @@
|
|
|
140
140
|
},
|
|
141
141
|
"peerDependencies": {
|
|
142
142
|
"react": "^19.2.8",
|
|
143
|
-
"@epam/ai-dial-attachment-canvas": "1.4.0-
|
|
144
|
-
"@epam/ai-dial-attachment-input": "1.4.0-
|
|
145
|
-
"@epam/ai-dial-catalog": "1.4.0-
|
|
146
|
-
"@epam/ai-dial-chat-overlay": "1.4.0-
|
|
147
|
-
"@epam/ai-dial-chat-shared": "1.4.0-
|
|
148
|
-
"@epam/ai-dial-conversation-input": "1.4.0-
|
|
149
|
-
"@epam/ai-dial-mcp-apps": "1.4.0-
|
|
150
|
-
"@epam/ai-dial-projects": "1.4.0-
|
|
151
|
-
"@epam/ai-dial-publish-panel": "1.4.0-
|
|
152
|
-
"@epam/ai-dial-quotations": "1.4.0-
|
|
153
|
-
"@epam/ai-dial-react-file-manager": "^0.
|
|
154
|
-
"@epam/ai-dial-scheduled-tasks": "1.4.0-
|
|
155
|
-
"@epam/ai-dial-share": "1.4.0-
|
|
156
|
-
"@epam/ai-dial-skill-editor": "1.4.0-
|
|
157
|
-
"@epam/ai-dial-source-panel": "1.4.0-
|
|
158
|
-
"@epam/ai-dial-ui-kit": "^0.
|
|
159
|
-
"@epam/ai-dial-usage-dashboard": "1.4.0-
|
|
143
|
+
"@epam/ai-dial-attachment-canvas": "1.4.0-rc.1",
|
|
144
|
+
"@epam/ai-dial-attachment-input": "1.4.0-rc.1",
|
|
145
|
+
"@epam/ai-dial-catalog": "1.4.0-rc.1",
|
|
146
|
+
"@epam/ai-dial-chat-overlay": "1.4.0-rc.1",
|
|
147
|
+
"@epam/ai-dial-chat-shared": "1.4.0-rc.1",
|
|
148
|
+
"@epam/ai-dial-conversation-input": "1.4.0-rc.1",
|
|
149
|
+
"@epam/ai-dial-mcp-apps": "1.4.0-rc.1",
|
|
150
|
+
"@epam/ai-dial-projects": "1.4.0-rc.1",
|
|
151
|
+
"@epam/ai-dial-publish-panel": "1.4.0-rc.1",
|
|
152
|
+
"@epam/ai-dial-quotations": "1.4.0-rc.1",
|
|
153
|
+
"@epam/ai-dial-react-file-manager": "^0.5.1",
|
|
154
|
+
"@epam/ai-dial-scheduled-tasks": "1.4.0-rc.1",
|
|
155
|
+
"@epam/ai-dial-share": "1.4.0-rc.1",
|
|
156
|
+
"@epam/ai-dial-skill-editor": "1.4.0-rc.1",
|
|
157
|
+
"@epam/ai-dial-source-panel": "1.4.0-rc.1",
|
|
158
|
+
"@epam/ai-dial-ui-kit": "^0.17.0",
|
|
159
|
+
"@epam/ai-dial-usage-dashboard": "1.4.0-rc.1",
|
|
160
160
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
161
|
-
"@epam/pdf-highlighter-kit": "^0.0.
|
|
161
|
+
"@epam/pdf-highlighter-kit": "^0.0.23"
|
|
162
162
|
},
|
|
163
163
|
"peerDependenciesMeta": {
|
|
164
164
|
"@epam/ai-dial-attachment-canvas": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createChatStreamApi as e } from "../conversation/create-chat-stream-api.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getBrowserTimezone as t } from "../shared/browser-timezone.js";
|
|
3
|
+
import { NO_CONVERSATION_LIST_SYNC as n } from "../conversation/conversation-data-source.js";
|
|
4
4
|
import { sleep as r } from "../shared/sleep.js";
|
|
5
5
|
//#region src/project/project-conversation-data-source.ts
|
|
6
6
|
var i = "projects/", a = 5, o = 2e3, s = 5e3, c = "data: {\"action\":\"UPDATE\"}\n\n", l = (e) => e.startsWith(i) ? e : `${i}${e}`, u = (e) => {
|
|
@@ -28,9 +28,9 @@ var i = "projects/", a = 5, o = 2e3, s = 5e3, c = "data: {\"action\":\"UPDATE\"}
|
|
|
28
28
|
}, f = ({ projectId: r, canEdit: i, client: a, stream: o, routes: s, viewedWriter: c, notFoundMessageKey: f }) => {
|
|
29
29
|
let { streamCompletion: p, stopCompletion: m } = e({
|
|
30
30
|
...o,
|
|
31
|
-
getTimezone:
|
|
31
|
+
getTimezone: t
|
|
32
32
|
}), h = {
|
|
33
|
-
...
|
|
33
|
+
...n,
|
|
34
34
|
markUnread: (e) => c.drop(e),
|
|
35
35
|
markViewed: async (e) => {
|
|
36
36
|
try {
|
|
@@ -4,6 +4,8 @@ export declare enum ProjectRefreshOutcome {
|
|
|
4
4
|
Updated = "updated",
|
|
5
5
|
/** The project no longer exists; the page should leave it. */
|
|
6
6
|
NotFound = "not-found",
|
|
7
|
+
/** The caller lost READ access: the owner stopped sharing the project or deleted it; the page should leave it. */
|
|
8
|
+
AccessLost = "access-lost",
|
|
7
9
|
/** The read failed; the loaded details are kept. */
|
|
8
10
|
Failed = "failed",
|
|
9
11
|
/** No project was loaded, or a newer refresh or an id change superseded this one. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-refresh.d.ts","sourceRoot":"","sources":["../../src/project/project-refresh.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,oBAAY,qBAAqB;IAC/B,qDAAqD;IACrD,OAAO,YAAY;IACnB,8DAA8D;IAC9D,QAAQ,cAAc;IACtB,oDAAoD;IACpD,MAAM,WAAW;IACjB,qFAAqF;IACrF,OAAO,YAAY;CACpB"}
|
|
1
|
+
{"version":3,"file":"project-refresh.d.ts","sourceRoot":"","sources":["../../src/project/project-refresh.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,oBAAY,qBAAqB;IAC/B,qDAAqD;IACrD,OAAO,YAAY;IACnB,8DAA8D;IAC9D,QAAQ,cAAc;IACtB,kHAAkH;IAClH,UAAU,gBAAgB;IAC1B,oDAAoD;IACpD,MAAM,WAAW;IACjB,qFAAqF;IACrF,OAAO,YAAY;CACpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/project/project-refresh.ts
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
|
-
return e.Updated = "updated", e.NotFound = "not-found", e.Failed = "failed", e.Skipped = "skipped", e;
|
|
3
|
+
return e.Updated = "updated", e.NotFound = "not-found", e.AccessLost = "access-lost", e.Failed = "failed", e.Skipped = "skipped", e;
|
|
4
4
|
}({});
|
|
5
5
|
//#endregion
|
|
6
6
|
export { e as ProjectRefreshOutcome };
|
|
@@ -19,6 +19,8 @@ export interface ProjectActionsHandlers {
|
|
|
19
19
|
saveFile: (response: Response, fileName: string) => Promise<string>;
|
|
20
20
|
/** Called after the archive was saved, with the saved file name. */
|
|
21
21
|
onArchiveDownloaded?: (savedName: string) => void;
|
|
22
|
+
/** Called after the pin state was persisted, with the project and its new state. */
|
|
23
|
+
onPinChanged?: (project: ProjectDetailsDto, isPinned: boolean) => void;
|
|
22
24
|
/** Called after the project was deleted; the host updates pins and navigates away. */
|
|
23
25
|
onDeleted: (project: ProjectDetailsDto) => void;
|
|
24
26
|
/** Called with a failed action and its trace id; the host shows the message. */
|
|
@@ -39,7 +41,7 @@ export interface ProjectActionsHandlers {
|
|
|
39
41
|
* @param project - The loaded project, or `null` while none is loaded.
|
|
40
42
|
* @param handlers - Host behaviour the actions delegate to.
|
|
41
43
|
*/
|
|
42
|
-
export declare const useProjectActions: (client: Pick<ProjectsApiClient, "deleteProject" | "downloadProjectArchive">, project: ProjectDetailsDto | null, { isPinned, setPinned, saveFile, onArchiveDownloaded, onDeleted, onError, onReload, isDeleteOpen: controlledDeleteOpen, onDeleteOpenChange, }: ProjectActionsHandlers) => {
|
|
44
|
+
export declare const useProjectActions: (client: Pick<ProjectsApiClient, "deleteProject" | "downloadProjectArchive">, project: ProjectDetailsDto | null, { isPinned, setPinned, saveFile, onArchiveDownloaded, onPinChanged, onDeleted, onError, onReload, isDeleteOpen: controlledDeleteOpen, onDeleteOpenChange, }: ProjectActionsHandlers) => {
|
|
43
45
|
isPinned: boolean;
|
|
44
46
|
isPinPending: boolean;
|
|
45
47
|
togglePin: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-actions.d.ts","sourceRoot":"","sources":["../../src/project/use-project-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,iEAAiE;AACjE,oBAAY,kBAAkB;IAC5B,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,8EAA8E;IAC9E,gBAAgB,sBAAsB;CACvC;AAED,sDAAsD;AACtD,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,yEAAyE;IACzE,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpE,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,sFAAsF;IACtF,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD,gFAAgF;IAChF,OAAO,EAAE,CAAC,KAAK,EAAE,kBAAkB,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gHAAgH;IAChH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gIAAgI;IAChI,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,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IAAI,CAAC;IACjE,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gHAAgH;IAChH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gIAAgI;IAChI,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,wBAAwB,CAAC,EAC3E,SAAS,iBAAiB,GAAG,IAAI,EACjC,6JAWG,sBAAsB;;;;;;;;;;CA6G1B,CAAC"}
|
|
@@ -5,87 +5,88 @@ import { useCallback as r, useMemo as i, useState as a } from "react";
|
|
|
5
5
|
//#region src/project/use-project-actions.ts
|
|
6
6
|
var o = /* @__PURE__ */ function(e) {
|
|
7
7
|
return e.Pin = "pin", e.Unpin = "unpin", e.Download = "download", e.Delete = "delete", e.ChangedElsewhere = "changed-elsewhere", e;
|
|
8
|
-
}({}), s = (o, s, { isPinned: c, setPinned: l, saveFile: u, onArchiveDownloaded: d,
|
|
9
|
-
let [
|
|
10
|
-
|
|
11
|
-
}, [
|
|
8
|
+
}({}), s = (o, s, { isPinned: c, setPinned: l, saveFile: u, onArchiveDownloaded: d, onPinChanged: f, onDeleted: p, onError: m, onReload: h, isDeleteOpen: g, onDeleteOpenChange: _ }) => {
|
|
9
|
+
let [v, y] = a(!1), [b, x] = a(!1), [S, C] = a(!1), w = g != null, T = g ?? b, E = r((e) => {
|
|
10
|
+
w || x(e), _?.(e);
|
|
11
|
+
}, [w, _]), D = r(async (t, n) => {
|
|
12
12
|
let { traceId: r } = await e(t);
|
|
13
|
-
|
|
14
|
-
}, [
|
|
13
|
+
m(n, r);
|
|
14
|
+
}, [m]), O = r(async () => {
|
|
15
15
|
if (s != null) {
|
|
16
|
-
|
|
16
|
+
y(!0);
|
|
17
17
|
try {
|
|
18
|
-
await l(s.id, !c);
|
|
18
|
+
await l(s.id, !c), f?.(s, !c);
|
|
19
19
|
} catch (e) {
|
|
20
|
-
await
|
|
20
|
+
await D(e, c ? "unpin" : "pin");
|
|
21
21
|
} finally {
|
|
22
|
-
|
|
22
|
+
y(!1);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}, [
|
|
26
26
|
s,
|
|
27
27
|
c,
|
|
28
28
|
l,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
f,
|
|
30
|
+
D
|
|
31
|
+
]), k = r(async () => {
|
|
31
32
|
if (s != null) try {
|
|
32
33
|
let e = await u(await o.downloadProjectArchive(s.id), `${t(s.name)}.zip`);
|
|
33
34
|
d?.(e);
|
|
34
35
|
} catch (e) {
|
|
35
|
-
await
|
|
36
|
+
await D(e, "download");
|
|
36
37
|
}
|
|
37
38
|
}, [
|
|
38
39
|
o,
|
|
39
40
|
s,
|
|
40
41
|
u,
|
|
41
42
|
d,
|
|
42
|
-
|
|
43
|
-
]),
|
|
44
|
-
|
|
45
|
-
}, [
|
|
43
|
+
D
|
|
44
|
+
]), A = r(() => E(!0), [E]), j = r(() => {
|
|
45
|
+
S || E(!1);
|
|
46
|
+
}, [S, E]), M = r(async () => {
|
|
46
47
|
if (s != null) {
|
|
47
|
-
|
|
48
|
+
C(!0);
|
|
48
49
|
try {
|
|
49
|
-
await o.deleteProject(s.id, s.contentVersion),
|
|
50
|
+
await o.deleteProject(s.id, s.contentVersion), E(!1), p(s);
|
|
50
51
|
} catch (t) {
|
|
51
52
|
let { code: r, traceId: i } = await e(t);
|
|
52
53
|
if (r === n.ProjectChanged) {
|
|
53
|
-
|
|
54
|
+
E(!1), m("changed-elsewhere", i), h();
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
m("delete", i);
|
|
57
58
|
} finally {
|
|
58
|
-
|
|
59
|
+
C(!1);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
}, [
|
|
62
63
|
o,
|
|
63
64
|
s,
|
|
64
|
-
|
|
65
|
-
f,
|
|
65
|
+
E,
|
|
66
66
|
p,
|
|
67
|
-
m
|
|
67
|
+
m,
|
|
68
|
+
h
|
|
68
69
|
]);
|
|
69
70
|
return i(() => ({
|
|
70
71
|
isPinned: c,
|
|
71
|
-
isPinPending:
|
|
72
|
-
togglePin:
|
|
73
|
-
downloadArchive:
|
|
74
|
-
isDeleteOpen:
|
|
75
|
-
isDeleting:
|
|
76
|
-
requestDelete:
|
|
77
|
-
cancelDelete:
|
|
78
|
-
confirmDelete:
|
|
72
|
+
isPinPending: v,
|
|
73
|
+
togglePin: O,
|
|
74
|
+
downloadArchive: k,
|
|
75
|
+
isDeleteOpen: T,
|
|
76
|
+
isDeleting: S,
|
|
77
|
+
requestDelete: A,
|
|
78
|
+
cancelDelete: j,
|
|
79
|
+
confirmDelete: M
|
|
79
80
|
}), [
|
|
80
81
|
c,
|
|
81
|
-
|
|
82
|
-
D,
|
|
82
|
+
v,
|
|
83
83
|
O,
|
|
84
|
-
w,
|
|
85
|
-
x,
|
|
86
84
|
k,
|
|
85
|
+
T,
|
|
86
|
+
S,
|
|
87
87
|
A,
|
|
88
|
-
j
|
|
88
|
+
j,
|
|
89
|
+
M
|
|
89
90
|
]);
|
|
90
91
|
};
|
|
91
92
|
//#endregion
|
package/project/use-project.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { ProjectsApiClient } from './projects-api-client';
|
|
|
4
4
|
/**
|
|
5
5
|
* Loads one project's details. Loading is derived from whether a result
|
|
6
6
|
* answers the current id and reload token, so a page never renders a stale
|
|
7
|
-
* project for a new id. A `404` is a not-found result,
|
|
7
|
+
* project for a new id. A `404` is a not-found result, a `403` lost access (the
|
|
8
|
+
* owner stopped sharing the project or deleted it), every other failure an
|
|
8
9
|
* error; the request is aborted on unmount and on an id change. `refresh`
|
|
9
10
|
* re-reads the loaded project without the loading state, for live updates.
|
|
10
11
|
*
|
|
@@ -17,6 +18,7 @@ export declare const useProject: (client: Pick<ProjectsApiClient, "getProject">,
|
|
|
17
18
|
isLoading: boolean;
|
|
18
19
|
hasError: boolean;
|
|
19
20
|
isNotFound: boolean;
|
|
21
|
+
isAccessDenied: boolean;
|
|
20
22
|
retry: () => void;
|
|
21
23
|
refresh: () => Promise<ProjectRefreshOutcome>;
|
|
22
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project.d.ts","sourceRoot":"","sources":["../../src/project/use-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-project.d.ts","sourceRoot":"","sources":["../../src/project/use-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAmC/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,GACrB,QAAQ,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,EAC7C,IAAI,MAAM,GAAG,IAAI,EACjB,SAAS,OAAO;;;;;;;mBAgDsB,OAAO,CAAC,qBAAqB,CAAC;CA6BrE,CAAC"}
|