@epam/ai-dial-chat-hooks 1.4.0-dev.122 → 1.4.0-dev.127
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/catalog/create-publish-api.d.ts +7 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +1 -0
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +22 -5
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +181 -125
- package/file-manager.js +33 -33
- 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/index.js +262 -262
- package/org-units/org-unit-guards.d.ts +72 -1
- package/org-units/org-unit-guards.d.ts.map +1 -1
- package/org-units/org-unit-guards.js +53 -16
- package/org-units/useOrgUnits/useOrgUnits.d.ts +6 -4
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -1
- package/org-units/useOrgUnits/useOrgUnits.js +37 -35
- package/package.json +17 -17
- package/project/project-conversation-data-source.js +4 -4
- package/scheduled-task/scheduled-task-display.d.ts +47 -0
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-display.js +55 -39
- package/scheduled-task/scheduled-task-time-format.d.ts +5 -3
- package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-time-format.js +3 -2
- package/scheduled-tasks.js +14 -14
- package/utils.js +18 -18
|
@@ -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,74 @@ 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
|
+
/** Outcome of {@link getPublishDirectAvailability}. */
|
|
98
|
+
export interface PublishDirectAvailability {
|
|
99
|
+
/** Whether the publish may write directly: the entity check holds and no dependency namespace is missing. */
|
|
100
|
+
isDirect: boolean;
|
|
101
|
+
/** Dependency namespaces the user may not write in the owning unit; empty unless the entity check holds. */
|
|
102
|
+
missingNamespaces: OrgUnitNamespace[];
|
|
103
|
+
/** The dependency kinds of `missingNamespaces`, for the host to name; same order, same emptiness. */
|
|
104
|
+
missingTypes: PublishDependencyType[];
|
|
105
|
+
}
|
|
106
|
+
/** Checks {@link getPublishDirectAvailability} reads, both from `useOrgUnits`. */
|
|
107
|
+
export interface PublishDirectChecks {
|
|
108
|
+
/** The entity's own direct-publish check. */
|
|
109
|
+
canPublishDirectlyAt: OrgUnitRightCheck;
|
|
110
|
+
/** Strict write check, applied to each dependency namespace. */
|
|
111
|
+
canSaveDirectlyAt: OrgUnitRightCheck;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Whether a publish into the folder writes directly and which dependency
|
|
115
|
+
* namespaces block it. A user who may not publish the entity directly gets no
|
|
116
|
+
* missing list, since a request is filed anyway; a dependency type with no
|
|
117
|
+
* namespace (a file) never blocks.
|
|
118
|
+
* @param folderPath - the destination folder inside the Organization root
|
|
119
|
+
* @param namespace - the entity's org-unit namespace
|
|
120
|
+
* @param dependencyTypes - the types of the private dependencies the panel lists
|
|
121
|
+
* @param checks - the hook's direct-publish and strict write checks
|
|
122
|
+
*/
|
|
123
|
+
export declare const getPublishDirectAvailability: (folderPath: string[], namespace: OrgUnitNamespace, dependencyTypes: readonly PublishDependencyType[], { canPublishDirectlyAt, canSaveDirectlyAt }: PublishDirectChecks) => PublishDirectAvailability;
|
|
124
|
+
/**
|
|
125
|
+
* {@link getPublishDirectAvailability} for a catalog item type: the entity's
|
|
126
|
+
* namespace comes from its publish entity type, and a type that cannot be
|
|
127
|
+
* published (or has no namespace) is never direct.
|
|
128
|
+
* @param itemType - the catalog entity type of the item being published
|
|
129
|
+
* @param folderPath - the destination folder inside the Organization root
|
|
130
|
+
* @param dependencyTypes - the types of the private dependencies the panel lists
|
|
131
|
+
* @param checks - the hook's direct-publish and strict write checks
|
|
132
|
+
*/
|
|
133
|
+
export declare const getCatalogPublishDirectAvailability: (itemType: CatalogEntityType, folderPath: string[], dependencyTypes: readonly PublishDependencyType[], checks: PublishDirectChecks) => PublishDirectAvailability;
|
|
134
|
+
export {};
|
|
64
135
|
//# 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;IAC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,YAAY,MAAM,EAAE,EACpB,iBAAiB,SAAS,qBAAqB,EAAE,EACjD,QAAQ,mBAAmB,KAC1B,yBAaF,CAAC"}
|
|
@@ -1,28 +1,65 @@
|
|
|
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 = (e, t, n, { canPublishDirectlyAt: r, canSaveDirectlyAt: i }) => {
|
|
41
|
+
let a = e.join("/");
|
|
42
|
+
if (!r(a, t)) return {
|
|
43
|
+
isDirect: !1,
|
|
44
|
+
missingNamespaces: [],
|
|
45
|
+
missingTypes: []
|
|
46
|
+
};
|
|
47
|
+
let o = d(n.map((e) => ({ type: e }))).filter((e) => !i(a, e));
|
|
48
|
+
return {
|
|
49
|
+
isDirect: o.length === 0,
|
|
50
|
+
missingNamespaces: o,
|
|
51
|
+
missingTypes: o.flatMap((e) => {
|
|
52
|
+
let t = u(e);
|
|
53
|
+
return t == null ? [] : [t];
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
}, m = (t, n, r, i) => {
|
|
57
|
+
let o = e(t), s = o == null ? void 0 : a(o);
|
|
58
|
+
return s == null ? {
|
|
59
|
+
isDirect: !1,
|
|
60
|
+
missingNamespaces: [],
|
|
61
|
+
missingTypes: []
|
|
62
|
+
} : p(n, s, r, i);
|
|
63
|
+
};
|
|
27
64
|
//#endregion
|
|
28
|
-
export {
|
|
65
|
+
export { o as OrgUnitFolderGuardPurpose, s as buildFolderGuards, m as getCatalogPublishDirectAvailability, d as getDependencyOrgUnitNamespaces, u as getDependencyTypeOfNamespace, f as getMissingDirectWriteNamespaces, a as getOrgUnitNamespace, p as getPublishDirectAvailability, c as toPublishDisabledReason };
|
|
@@ -22,12 +22,14 @@ 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 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`. */
|
|
26
|
+
canPublishDirectlyAt: OrgUnitRightCheck;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
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.
|
|
29
|
+
* Loads the current user's org units once, on demand, and answers save, direct-save,
|
|
30
|
+
* direct-publish and publication-request rights per path. Until the status is `Ready`
|
|
31
|
+
* (and in `Disabled` and `Error`) every answer is `true` except `canSaveDirectlyAt` and
|
|
32
|
+
* `canPublishDirectlyAt`, so missing data never disables a folder or selects a write.
|
|
31
33
|
* @param options - the host-supplied `listOrgUnits` read
|
|
32
34
|
*/
|
|
33
35
|
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,EAML,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,wRAAwR;IACxR,oBAAoB,EAAE,iBAAiB,CAAC;CACzC;AAID;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,mBAEzB,kBAAkB,KAAG,iBA2GvB,CAAC"}
|
|
@@ -1,54 +1,56 @@
|
|
|
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 } from "@epam/ai-dial-chat-shared";
|
|
3
|
+
import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
4
4
|
//#region src/org-units/useOrgUnits/useOrgUnits.ts
|
|
5
|
-
var
|
|
5
|
+
var u = {
|
|
6
6
|
hasAdminAccess: !1,
|
|
7
7
|
units: []
|
|
8
|
-
},
|
|
9
|
-
let [
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
}, d = ({ listOrgUnits: d }) => {
|
|
9
|
+
let [f, p] = l(u), [m, h] = l(e.Idle), g = c(!1), _ = c(m);
|
|
10
|
+
_.current = m;
|
|
11
|
+
let v = c(!0), y = c(d);
|
|
12
|
+
y.current = d, o(() => (v.current = !0, () => {
|
|
13
|
+
v.current = !1;
|
|
14
14
|
}), []);
|
|
15
|
-
let
|
|
16
|
-
t ||
|
|
15
|
+
let b = a(async (t) => {
|
|
16
|
+
t || h(e.Loading);
|
|
17
17
|
try {
|
|
18
|
-
let t = await
|
|
19
|
-
if (!
|
|
18
|
+
let t = await y.current();
|
|
19
|
+
if (!v.current) return;
|
|
20
20
|
if (!t.enabled) {
|
|
21
|
-
|
|
21
|
+
p(u), h(e.Disabled);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
p({
|
|
25
25
|
hasAdminAccess: t.hasAdminAccess,
|
|
26
26
|
units: t.units
|
|
27
|
-
}),
|
|
27
|
+
}), h(e.Ready);
|
|
28
28
|
} catch {
|
|
29
|
-
if (t || (
|
|
30
|
-
|
|
29
|
+
if (t || (g.current = !1, !v.current)) return;
|
|
30
|
+
p(u), h(e.Error);
|
|
31
31
|
}
|
|
32
|
-
}, []),
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
return
|
|
38
|
-
status:
|
|
39
|
-
ensureUnits:
|
|
40
|
-
refreshUnits:
|
|
41
|
-
canSaveAt:
|
|
42
|
-
canSaveDirectlyAt:
|
|
43
|
-
canPublishAt:
|
|
32
|
+
}, []), x = a(() => {
|
|
33
|
+
g.current || (g.current = !0, b(!1));
|
|
34
|
+
}, [b]), S = a(() => {
|
|
35
|
+
_.current !== e.Disabled && (_.current === e.Ready ? b(!0) : x());
|
|
36
|
+
}, [x, b]), C = m === e.Ready, w = a((e, t) => !C || r(f, e, t), [C, f]), T = a((e, t) => C && i(f, e, t), [C, f]), E = a((e, t) => !C || n(f, e, t), [C, f]), D = a((e, n) => C && i(f, e, n) && t(f, e), [C, f]);
|
|
37
|
+
return s(() => ({
|
|
38
|
+
status: m,
|
|
39
|
+
ensureUnits: x,
|
|
40
|
+
refreshUnits: S,
|
|
41
|
+
canSaveAt: w,
|
|
42
|
+
canSaveDirectlyAt: T,
|
|
43
|
+
canPublishAt: E,
|
|
44
|
+
canPublishDirectlyAt: D
|
|
44
45
|
}), [
|
|
45
|
-
|
|
46
|
-
b,
|
|
46
|
+
m,
|
|
47
47
|
x,
|
|
48
|
-
|
|
48
|
+
S,
|
|
49
49
|
w,
|
|
50
|
-
T
|
|
50
|
+
T,
|
|
51
|
+
E,
|
|
52
|
+
D
|
|
51
53
|
]);
|
|
52
54
|
};
|
|
53
55
|
//#endregion
|
|
54
|
-
export {
|
|
56
|
+
export { d 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-dev.
|
|
4
|
+
"version": "1.4.0-dev.127",
|
|
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-dev.
|
|
134
|
+
"@epam/ai-dial-chat-api-client": "1.4.0-dev.127",
|
|
135
135
|
"dompurify": "3.4.17",
|
|
136
136
|
"fflate": "^0.8.3",
|
|
137
137
|
"lru-cache": "^10.4.3",
|
|
@@ -140,23 +140,23 @@
|
|
|
140
140
|
},
|
|
141
141
|
"peerDependencies": {
|
|
142
142
|
"react": "^19.2.8",
|
|
143
|
-
"@epam/ai-dial-attachment-canvas": "1.4.0-dev.
|
|
144
|
-
"@epam/ai-dial-attachment-input": "1.4.0-dev.
|
|
145
|
-
"@epam/ai-dial-catalog": "1.4.0-dev.
|
|
146
|
-
"@epam/ai-dial-chat-overlay": "1.4.0-dev.
|
|
147
|
-
"@epam/ai-dial-chat-shared": "1.4.0-dev.
|
|
148
|
-
"@epam/ai-dial-conversation-input": "1.4.0-dev.
|
|
149
|
-
"@epam/ai-dial-mcp-apps": "1.4.0-dev.
|
|
150
|
-
"@epam/ai-dial-projects": "1.4.0-dev.
|
|
151
|
-
"@epam/ai-dial-publish-panel": "1.4.0-dev.
|
|
152
|
-
"@epam/ai-dial-quotations": "1.4.0-dev.
|
|
143
|
+
"@epam/ai-dial-attachment-canvas": "1.4.0-dev.127",
|
|
144
|
+
"@epam/ai-dial-attachment-input": "1.4.0-dev.127",
|
|
145
|
+
"@epam/ai-dial-catalog": "1.4.0-dev.127",
|
|
146
|
+
"@epam/ai-dial-chat-overlay": "1.4.0-dev.127",
|
|
147
|
+
"@epam/ai-dial-chat-shared": "1.4.0-dev.127",
|
|
148
|
+
"@epam/ai-dial-conversation-input": "1.4.0-dev.127",
|
|
149
|
+
"@epam/ai-dial-mcp-apps": "1.4.0-dev.127",
|
|
150
|
+
"@epam/ai-dial-projects": "1.4.0-dev.127",
|
|
151
|
+
"@epam/ai-dial-publish-panel": "1.4.0-dev.127",
|
|
152
|
+
"@epam/ai-dial-quotations": "1.4.0-dev.127",
|
|
153
153
|
"@epam/ai-dial-react-file-manager": "^0.4.3",
|
|
154
|
-
"@epam/ai-dial-scheduled-tasks": "1.4.0-dev.
|
|
155
|
-
"@epam/ai-dial-share": "1.4.0-dev.
|
|
156
|
-
"@epam/ai-dial-skill-editor": "1.4.0-dev.
|
|
157
|
-
"@epam/ai-dial-source-panel": "1.4.0-dev.
|
|
154
|
+
"@epam/ai-dial-scheduled-tasks": "1.4.0-dev.127",
|
|
155
|
+
"@epam/ai-dial-share": "1.4.0-dev.127",
|
|
156
|
+
"@epam/ai-dial-skill-editor": "1.4.0-dev.127",
|
|
157
|
+
"@epam/ai-dial-source-panel": "1.4.0-dev.127",
|
|
158
158
|
"@epam/ai-dial-ui-kit": "^0.16.0",
|
|
159
|
-
"@epam/ai-dial-usage-dashboard": "1.4.0-dev.
|
|
159
|
+
"@epam/ai-dial-usage-dashboard": "1.4.0-dev.127",
|
|
160
160
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
161
161
|
"@epam/pdf-highlighter-kit": "^0.0.23"
|
|
162
162
|
},
|
|
@@ -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 {
|
|
@@ -22,6 +22,30 @@ export interface ScheduledTaskScheduleLabels {
|
|
|
22
22
|
/** Appends the task's zone to a schedule label, e.g. "Daily at 09:00 (Asia/Tokyo)". Omit to never show the zone. */
|
|
23
23
|
withTimezone?: (label: string, timezone: string) => string;
|
|
24
24
|
}
|
|
25
|
+
/** Host-translated zone suffix for a detail value, e.g. "{label} ({timezone})". */
|
|
26
|
+
export interface ScheduledTaskZoneLabels {
|
|
27
|
+
/** Appends `timezone` to an already formatted date or time. */
|
|
28
|
+
withTimezone: (label: string, timezone: string) => string;
|
|
29
|
+
}
|
|
30
|
+
/** Host-translated wording for a cron activity window. */
|
|
31
|
+
export interface ScheduledTaskActiveWindowLabels extends ScheduledTaskZoneLabels {
|
|
32
|
+
/** The window between two locale-formatted task-zone wall times, e.g. "{startDate} – {endDate}". */
|
|
33
|
+
range: (startDate: string, endDate: string) => string;
|
|
34
|
+
}
|
|
35
|
+
/** Locale and viewer zone used to format a task's next run. */
|
|
36
|
+
export interface ScheduledTaskNextRunOptions {
|
|
37
|
+
/** BCP 47 locale for the date and time. Defaults to the runtime default. */
|
|
38
|
+
locale?: string;
|
|
39
|
+
/** The viewer's IANA zone the instant is shown in and named after. Defaults to `getBrowserTimezone()`. */
|
|
40
|
+
browserTimezone?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Why a task that is not completed still cannot be turned on. */
|
|
43
|
+
export declare enum ScheduledTaskActivationBlock {
|
|
44
|
+
/** A one-time (`date`) schedule with no next run has already fired. */
|
|
45
|
+
OneTimeFired = "oneTimeFired",
|
|
46
|
+
/** A recurring (`cron`) schedule's activity window `endDate` has passed. */
|
|
47
|
+
WindowEnded = "windowEnded"
|
|
48
|
+
}
|
|
25
49
|
/** Host-translated duration units for a run. */
|
|
26
50
|
export interface ScheduledTaskRunDurationLabels {
|
|
27
51
|
/** `count` hours, e.g. "1h". */
|
|
@@ -117,4 +141,27 @@ export declare const toScheduledTaskRunItems: (runs: ScheduledTaskRunDto[], opti
|
|
|
117
141
|
export declare const classifyScheduledTaskDeleteError: (status: number | undefined) => ScheduledTaskDeleteErrorKind;
|
|
118
142
|
/** Returns the admin-consent message, else the scheduler's own trimmed reason, else the fallback. */
|
|
119
143
|
export declare const selectScheduledTaskErrorMessage: (details: Pick<ApiErrorDetails, "code" | "upstreamMessage">, { adminConsentRequired, fallback }: ScheduledTaskErrorMessages) => string;
|
|
144
|
+
/**
|
|
145
|
+
* Formats a task's `nextRunTime`, an absolute instant, in the viewer's zone and
|
|
146
|
+
* names that zone, e.g. `Nov 19, 2026, 5:45 PM (Europe/Kyiv)`. The instant is
|
|
147
|
+
* formatted in the same zone the suffix names, so the two cannot disagree.
|
|
148
|
+
* Without a resolvable viewer zone the instant is shown in the runtime's
|
|
149
|
+
* default zone with no suffix.
|
|
150
|
+
*/
|
|
151
|
+
export declare const formatScheduledTaskNextRunTime: (nextRunTime: string, labels: ScheduledTaskZoneLabels, { locale, browserTimezone, }?: ScheduledTaskNextRunOptions) => string;
|
|
152
|
+
/**
|
|
153
|
+
* Formats a cron activity window as task-zone wall times and always names the
|
|
154
|
+
* task's zone (`UTC` when it has none). Without an explicit start date the
|
|
155
|
+
* window begins at the next scheduled occurrence: the server's `nextRunTime`,
|
|
156
|
+
* or one computed from the cron fields when the server has none (e.g. an
|
|
157
|
+
* inactive task). Returns `undefined` when the window has no end date.
|
|
158
|
+
*/
|
|
159
|
+
export declare const formatScheduledTaskActiveWindow: (task: Pick<ScheduledTaskDto, "trigger" | "timezone" | "nextRunTime">, labels: ScheduledTaskActiveWindowLabels, locale?: string) => string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Returns why the task cannot be turned on, or `undefined` when it can. This is
|
|
162
|
+
* the fallback for tasks whose `isCompleted` is missing (a failed runs check)
|
|
163
|
+
* or whose last run is still in flight: a one-time schedule with no next run
|
|
164
|
+
* has already fired, and a cron schedule whose window ended cannot run again.
|
|
165
|
+
*/
|
|
166
|
+
export declare const getScheduledTaskActivationBlock: (task: Pick<ScheduledTaskDto, "triggerType" | "nextRunTime" | "trigger">, now?: number) => ScheduledTaskActivationBlock | undefined;
|
|
120
167
|
//# sourceMappingURL=scheduled-task-display.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-task-display.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-display.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"scheduled-task-display.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-display.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAqB9D,mGAAmG;AACnG,MAAM,WAAW,2BAA2B;IAC1C,6CAA6C;IAC7C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACjC,mCAAmC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,yFAAyF;IACzF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC,gGAAgG;IAChG,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,qDAAqD;IACrD,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D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aAAa,MAAM,EACnB,QAAQ,uBAAuB,EAC/B,+BAGG,2BAAgC,KAClC,MAOF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,GAC1C,MAAM,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC,EACpE,QAAQ,+BAA+B,EACvC,SAAS,MAAM,KACd,MAAM,GAAG,SAgBX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,GAC1C,MAAM,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC,EACvE,MAAK,MAAmB,KACvB,4BAA4B,GAAG,SAcjC,CAAC"}
|
|
@@ -1,65 +1,81 @@
|
|
|
1
1
|
import { ScheduledTaskTriggerDescriptionKind as e, describeScheduledTaskTrigger as t } from "./scheduled-task-description.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { getBrowserTimezone as n } from "../shared/browser-timezone.js";
|
|
3
|
+
import { isSameTimezone as r } from "../shared/timezones.js";
|
|
4
|
+
import { getNextCronOccurrence as i, hasScheduledTaskWindowEnded as a } from "./scheduled-task-next-occurrence.js";
|
|
5
|
+
import { SCHEDULED_TASK_WALL_DATE_TIME_PATTERN as o, formatScheduledTaskClockTime as s, formatScheduledTaskInstant as c, formatScheduledTaskRunDate as l, formatScheduledTaskRunTime as u, formatScheduledTaskWeekdays as d, formatZonedDateTime as f } from "./scheduled-task-time-format.js";
|
|
6
|
+
import { ScheduledTaskDtoTriggerTypeEnum as p, ScheduledTaskErrorCode as m, ScheduledTaskRunDtoStatusEnum as h } from "@epam/ai-dial-chat-api-client";
|
|
7
|
+
import { ScheduledTaskRunStatus as g, instantToZonedDateTime as _, isAbsoluteInstant as v } from "@epam/ai-dial-scheduled-tasks";
|
|
6
8
|
//#region src/scheduled-task/scheduled-task-display.ts
|
|
7
|
-
var
|
|
9
|
+
var y = /* @__PURE__ */ function(e) {
|
|
10
|
+
return e.OneTimeFired = "oneTimeFired", e.WindowEnded = "windowEnded", e;
|
|
11
|
+
}({}), b = /* @__PURE__ */ function(e) {
|
|
8
12
|
return e.NotFound = "notFound", e.Retryable = "retryable", e.Generic = "generic", e;
|
|
9
|
-
}({}),
|
|
10
|
-
let
|
|
11
|
-
return !
|
|
12
|
-
},
|
|
13
|
-
let
|
|
14
|
-
switch (
|
|
15
|
-
case e.OneTime: return h(
|
|
16
|
-
case e.EveryNMinutes: return
|
|
17
|
-
case e.Hourly: return h(
|
|
18
|
-
case e.Daily: return h(
|
|
19
|
-
case e.Weekly: return h(
|
|
20
|
-
case e.Monthly: return h(
|
|
21
|
-
case e.Invalid: return
|
|
22
|
-
default: return
|
|
13
|
+
}({}), x = 60, S = 3600, C = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), w = (e, t, n) => {
|
|
14
|
+
let r = v(e) ? _(e, t) : e.slice(0, 16);
|
|
15
|
+
return !r || !o.test(r) ? e : f(r, n);
|
|
16
|
+
}, T = (n, i, { locale: a, browserTimezone: o = Intl.DateTimeFormat().resolvedOptions().timeZone, alwaysShowTimezone: c = !1 } = {}) => {
|
|
17
|
+
let l = n.timezone || "UTC", u = t(n.trigger, { timezone: l }), p = u.time ?? "", m = s(p, a), h = (e) => i.withTimezone && (c || !r(l, o)) ? i.withTimezone(e, l) : e;
|
|
18
|
+
switch (u.kind) {
|
|
19
|
+
case e.OneTime: return h(i.onceAt(f(u.dateTime ?? "", a)));
|
|
20
|
+
case e.EveryNMinutes: return i.everyNMinutes(u.intervalMinutes ?? 0);
|
|
21
|
+
case e.Hourly: return h(i.hourlyAt(p));
|
|
22
|
+
case e.Daily: return h(i.dailyAt(m));
|
|
23
|
+
case e.Weekly: return h(i.weeklyAt(d(u.daysOfWeek ?? [u.dayOfWeek ?? ""], a), m));
|
|
24
|
+
case e.Monthly: return h(i.monthlyAt(u.dayOfMonth ?? "", m));
|
|
25
|
+
case e.Invalid: return i.invalid;
|
|
26
|
+
default: return i.recurringFallback;
|
|
23
27
|
}
|
|
24
|
-
},
|
|
28
|
+
}, E = (e, t, n) => ({
|
|
25
29
|
id: e.id,
|
|
26
30
|
displayName: e.displayName,
|
|
27
31
|
descriptionPreview: e.description,
|
|
28
|
-
scheduleLabel:
|
|
32
|
+
scheduleLabel: T(e, t, n),
|
|
29
33
|
isActive: e.isActive,
|
|
30
34
|
isCompleted: e.isCompleted
|
|
31
|
-
}),
|
|
35
|
+
}), D = (e, t, n) => e.map((e) => E(e, t, n)), O = (e, t) => {
|
|
32
36
|
if (e == null) return;
|
|
33
37
|
let n = [
|
|
34
|
-
[Math.floor(e /
|
|
35
|
-
[Math.floor(e %
|
|
36
|
-
[e %
|
|
38
|
+
[Math.floor(e / S), t.hours],
|
|
39
|
+
[Math.floor(e % S / x), t.minutes],
|
|
40
|
+
[e % x, t.seconds]
|
|
37
41
|
].filter(([e]) => e > 0).map(([e, t]) => t(e));
|
|
38
42
|
return t.suffix(n.length ? n.join(" ") : t.seconds(0));
|
|
39
|
-
},
|
|
40
|
-
let
|
|
41
|
-
return d ? `${
|
|
42
|
-
},
|
|
43
|
+
}, k = (e, t, n, { durationLabels: r, locale: i, now: a = /* @__PURE__ */ new Date() } = {}) => {
|
|
44
|
+
let o = new Date(e), s = u(o, i), c = C(o, a) ? n.todayAt(s) : n.dateAt(l(o, i), s), d = r ? O(t, r) : void 0;
|
|
45
|
+
return d ? `${c} ${d}` : c;
|
|
46
|
+
}, A = (e) => {
|
|
43
47
|
switch (e) {
|
|
44
|
-
case
|
|
45
|
-
case
|
|
46
|
-
case
|
|
47
|
-
default: return
|
|
48
|
+
case h.Success: return g.Success;
|
|
49
|
+
case h.Error: return g.Error;
|
|
50
|
+
case h.InProgress: return g.InProgress;
|
|
51
|
+
default: return g.Missed;
|
|
48
52
|
}
|
|
49
|
-
},
|
|
53
|
+
}, j = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
|
|
50
54
|
let { conversationId: s } = e, c = s ? r.find((e) => i(e.id, s)) : void 0;
|
|
51
55
|
return {
|
|
52
56
|
id: e.id,
|
|
53
|
-
status:
|
|
54
|
-
timestampLabel:
|
|
57
|
+
status: A(e.status),
|
|
58
|
+
timestampLabel: k(e.startTime, void 0, t, {
|
|
55
59
|
locale: a,
|
|
56
60
|
now: o
|
|
57
61
|
}),
|
|
58
|
-
durationLabel:
|
|
62
|
+
durationLabel: O(e.durationSeconds, n),
|
|
59
63
|
conversationId: s,
|
|
60
64
|
isUnread: c?.isUnread === !0,
|
|
61
65
|
errorText: e.errorText
|
|
62
66
|
};
|
|
63
|
-
},
|
|
67
|
+
}, M = (e, t) => e.map((e) => j(e, t)), N = (e) => e === 404 || e === 409 ? "notFound" : e === 502 ? "retryable" : "generic", P = (e, { adminConsentRequired: t, fallback: n }) => e.code === m.ScheduledTaskAdminConsentRequired ? t : e.upstreamMessage?.trim() || n, F = (e, t, { locale: r, browserTimezone: i = n() } = {}) => {
|
|
68
|
+
let a = c(e, r, i);
|
|
69
|
+
return i ? t.withTimezone(a, i) : a;
|
|
70
|
+
}, I = (e, t, n) => {
|
|
71
|
+
let r = e.trigger.cron;
|
|
72
|
+
if (!r?.endDate) return;
|
|
73
|
+
let a = e.timezone || "UTC", o = r.startDate ?? e.nextRunTime ?? i(r, a);
|
|
74
|
+
if (o) return t.withTimezone(t.range(w(o, a, n), w(r.endDate, a, n)), a);
|
|
75
|
+
}, L = (e, t = Date.now()) => {
|
|
76
|
+
if (e.triggerType === p.Date && e.nextRunTime == null) return "oneTimeFired";
|
|
77
|
+
let n = e.trigger.cron?.endDate;
|
|
78
|
+
if (e.triggerType === p.Cron && n != null && a(n, t)) return "windowEnded";
|
|
79
|
+
};
|
|
64
80
|
//#endregion
|
|
65
|
-
export {
|
|
81
|
+
export { y as ScheduledTaskActivationBlock, b as ScheduledTaskDeleteErrorKind, N as classifyScheduledTaskDeleteError, I as formatScheduledTaskActiveWindow, F as formatScheduledTaskNextRunTime, O as formatScheduledTaskRunDuration, k as formatScheduledTaskRunTimestamp, T as formatScheduledTaskScheduleLabel, w as formatScheduledTaskTriggerTime, L as getScheduledTaskActivationBlock, P as selectScheduledTaskErrorMessage, E as toScheduledTaskItem, D as toScheduledTaskItems, j as toScheduledTaskRunItem, M as toScheduledTaskRunItems };
|
|
@@ -15,10 +15,12 @@ export declare const formatScheduledTaskClockTime: (time: string, locale?: strin
|
|
|
15
15
|
export declare const formatZonedDateTime: (dateTime: string, locale?: string) => string;
|
|
16
16
|
/**
|
|
17
17
|
* Formats an absolute instant (an ISO string such as `nextRunTime`) as a medium
|
|
18
|
-
* date and short time in the viewer's zone
|
|
19
|
-
*
|
|
18
|
+
* date and short time in `timeZone`, or in the viewer's zone when it is
|
|
19
|
+
* omitted. A host that labels the value with a zone passes that same zone, so
|
|
20
|
+
* the clock time and the label cannot disagree. Returns the raw value when the
|
|
21
|
+
* instant is not a date or the zone is unknown.
|
|
20
22
|
*/
|
|
21
|
-
export declare const formatScheduledTaskInstant: (instant: string, locale?: string) => string;
|
|
23
|
+
export declare const formatScheduledTaskInstant: (instant: string, locale?: string, timeZone?: string) => string;
|
|
22
24
|
/** Formats the time of day of an instant as the locale's short time in the viewer's zone, e.g. `11:00 AM`. */
|
|
23
25
|
export declare const formatScheduledTaskRunTime: (date: Date, locale?: string) => string;
|
|
24
26
|
/** Formats the calendar day of an instant without a year in the viewer's zone, e.g. `Nov 17`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-task-time-format.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-time-format.ts"],"names":[],"mappings":"AAcA,mFAAmF;AACnF,eAAO,MAAM,qCAAqC,QACf,CAAC;AAIpC,+BAA+B;AAC/B,oBAAY,yBAAyB;IACnC,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACvC,MAAM,MAAM,EACZ,SAAS,MAAM,KACd,MAUF,CAAC;AAEF,qHAAqH;AACrH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,SAAS,MAAM,KACd,MAKqC,CAAC;AAEzC
|
|
1
|
+
{"version":3,"file":"scheduled-task-time-format.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-time-format.ts"],"names":[],"mappings":"AAcA,mFAAmF;AACnF,eAAO,MAAM,qCAAqC,QACf,CAAC;AAIpC,+BAA+B;AAC/B,oBAAY,yBAAyB;IACnC,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACvC,MAAM,MAAM,EACZ,SAAS,MAAM,KACd,MAUF,CAAC;AAEF,qHAAqH;AACrH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,SAAS,MAAM,KACd,MAKqC,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,SAAS,MAAM,EACf,SAAS,MAAM,EACf,WAAW,MAAM,KAChB,MAUF,CAAC;AAEF,8GAA8G;AAC9G,eAAO,MAAM,0BAA0B,GACrC,MAAM,IAAI,EACV,SAAS,MAAM,KACd,MACmE,CAAC;AAEvE,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,GACrC,MAAM,IAAI,EACV,SAAS,MAAM,KACd,MAGA,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GACrC,WAAW,MAAM,GAAG,MAAM,GAAG,SAAS,EACtC,SAAS,MAAM,EACf,QAAO,yBAA0D,KAChE,MAGA,CAAC;AAEJ,oGAAoG;AACpG,eAAO,MAAM,2BAA2B,GACtC,YAAY,MAAM,EAAE,EACpB,SAAS,MAAM,KACd,MAKA,CAAC"}
|