@epam/ai-dial-chat-hooks 1.4.0-dev.12 → 1.4.0-dev.126
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/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 +28 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +21 -1
- package/catalog/entity-details.d.ts +5 -2
- package/catalog/entity-details.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.d.ts +4 -0
- package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.js +15 -13
- package/catalog/publish-dependency-icons.d.ts +22 -0
- package/catalog/publish-dependency-icons.d.ts.map +1 -0
- package/catalog/publish-dependency-icons.js +11 -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/publish.d.ts +15 -2
- package/catalog/publish.d.ts.map +1 -1
- package/catalog/publish.js +15 -4
- package/catalog/resource-name-conflict.d.ts.map +1 -1
- package/catalog/resource-name-conflict.js +19 -22
- 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/use-publish-dependencies.d.ts +19 -0
- package/catalog/use-publish-dependencies.d.ts.map +1 -0
- package/catalog/use-publish-dependencies.js +25 -0
- 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 +8 -2
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +29 -29
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +27 -6
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +184 -118
- 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 +39 -31
- package/conversation/announcement-message.d.ts +12 -0
- package/conversation/announcement-message.d.ts.map +1 -1
- package/conversation/announcement-message.js +16 -10
- 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/useConversationStream/generation-resume.d.ts.map +1 -1
- package/conversation/useConversationStream/generation-resume.js +119 -96
- package/conversation.js +44 -44
- package/entry-points/catalog.d.ts +7 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/file-manager.d.ts +1 -0
- package/entry-points/file-manager.d.ts.map +1 -1
- package/entry-points/project.d.ts +5 -0
- package/entry-points/project.d.ts.map +1 -1
- package/entry-points/scheduled-tasks.d.ts +2 -0
- package/entry-points/scheduled-tasks.d.ts.map +1 -1
- package/entry-points/usage-limits.d.ts +1 -0
- package/entry-points/usage-limits.d.ts.map +1 -1
- package/entry-points/utils.d.ts +7 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/file-manager.js +33 -32
- 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/attachment-type-labels.d.ts +3 -0
- package/files/attachment-type-labels.d.ts.map +1 -0
- package/files/attachment-type-labels.js +12 -0
- package/files/attachment-types.d.ts +0 -2
- package/files/attachment-types.d.ts.map +1 -1
- package/files/attachment-types.js +7 -14
- package/files/dial-file.d.ts +24 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +35 -5
- package/index.d.ts +23 -0
- package/index.d.ts.map +1 -1
- package/index.js +266 -244
- package/org-units/models.d.ts +11 -0
- package/org-units/models.d.ts.map +1 -0
- package/org-units/org-unit-guards.d.ts +98 -0
- package/org-units/org-unit-guards.d.ts.map +1 -0
- package/org-units/org-unit-guards.js +41 -0
- package/org-units/types.d.ts +14 -0
- package/org-units/types.d.ts.map +1 -0
- package/org-units/types.js +6 -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 +34 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
- package/org-units/useOrgUnits/useOrgUnits.js +54 -0
- package/package.json +19 -19
- package/project/project-conversation-data-source.js +4 -4
- package/project/project-sharing-client.d.ts +8 -0
- package/project/project-sharing-client.d.ts.map +1 -0
- package/project/project-sharing-client.js +11 -0
- package/project/project-sharing.d.ts +28 -0
- package/project/project-sharing.d.ts.map +1 -0
- package/project/project-sharing.js +22 -0
- package/project/use-pinned-project-chats.d.ts +4 -2
- package/project/use-pinned-project-chats.d.ts.map +1 -1
- package/project/use-pinned-project-chats.js +152 -96
- package/project/use-project-conversations.d.ts.map +1 -1
- package/project/use-project-conversations.js +2 -2
- package/project/use-project-remove-from-list.d.ts +30 -0
- package/project/use-project-remove-from-list.d.ts.map +1 -0
- package/project/use-project-remove-from-list.js +39 -0
- package/project/use-project-revoke-access.d.ts +15 -0
- package/project/use-project-revoke-access.d.ts.map +1 -0
- package/project/use-project-revoke-access.js +32 -0
- package/project/use-project-share-recipients.d.ts +7 -0
- package/project/use-project-share-recipients.d.ts.map +1 -0
- package/project/use-project-share-recipients.js +36 -0
- package/project/use-projects.d.ts +1 -0
- package/project/use-projects.d.ts.map +1 -1
- package/project/use-projects.js +2 -1
- package/project.js +7 -2
- 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 +67 -6
- package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-display.js +55 -43
- package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -5
- package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-next-occurrence.js +16 -16
- 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 +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 +15 -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/usage/map-usage-data-to-dashboard.d.ts +22 -1
- package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
- package/usage/map-usage-data-to-dashboard.js +33 -2
- package/usage/spending-limits-mode.d.ts +37 -0
- package/usage/spending-limits-mode.d.ts.map +1 -0
- package/usage/spending-limits-mode.js +15 -0
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +6 -2
- package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +4 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
- package/usage/useUsageLimitBanner/useUsageLimitBanner.js +55 -47
- package/usage-limits.js +6 -5
- package/usage.js +3 -3
- package/utils.js +28 -22
- 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
|
@@ -10,31 +10,37 @@ export declare enum ScheduledTaskTriggerDescriptionKind {
|
|
|
10
10
|
Custom = "custom",
|
|
11
11
|
Invalid = "invalid"
|
|
12
12
|
}
|
|
13
|
+
/** What a trigger does, in the wall time of the task's own zone. */
|
|
13
14
|
export interface ScheduledTaskTriggerDescription {
|
|
15
|
+
/** Which schedule shape the trigger is. */
|
|
14
16
|
kind: ScheduledTaskTriggerDescriptionKind;
|
|
17
|
+
/** `HH:mm` of a daily, weekly or monthly run, or the two-digit minute of an hourly one. */
|
|
15
18
|
time?: string;
|
|
19
|
+
/** First weekday of a `Weekly` description, `0` (Monday) to `6` (Sunday). */
|
|
16
20
|
dayOfWeek?: string;
|
|
17
|
-
/** Every
|
|
21
|
+
/** Every weekday of a `Weekly` description, Monday first; `dayOfWeek` is its first entry. */
|
|
18
22
|
daysOfWeek?: string[];
|
|
23
|
+
/** Day of the month of a `Monthly` description. */
|
|
19
24
|
dayOfMonth?: string;
|
|
25
|
+
/** Minutes between runs of an `EveryNMinutes` description. */
|
|
20
26
|
intervalMinutes?: number;
|
|
21
|
-
|
|
27
|
+
/** Local `YYYY-MM-DDTHH:mm` of a `OneTime` description, in the task's zone. */
|
|
28
|
+
dateTime?: string;
|
|
29
|
+
/** Raw cron fields of a `Custom` description. */
|
|
22
30
|
expression?: string;
|
|
23
|
-
|
|
31
|
+
/** IANA zone the times above are wall time in. */
|
|
32
|
+
timezone: string;
|
|
24
33
|
}
|
|
34
|
+
/** Options of {@link describeScheduledTaskTrigger}. */
|
|
25
35
|
export interface ScheduledTaskTriggerDescriptionOptions {
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
/** Date whose timezone offset is used. Defaults to now (the existing UTC-storage policy). */
|
|
29
|
-
referenceDate?: Date;
|
|
36
|
+
/** IANA zone the trigger is evaluated in. Defaults to UTC, which is what a task saved without a zone runs in. */
|
|
37
|
+
timezone?: string;
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* Describes the complete trigger without requiring unrelated task metadata.
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* The one exception is `day: 'last'` one day behind local time, which is
|
|
37
|
-
* exactly the local 1st.
|
|
41
|
+
* Times are the stored wall time in the task's zone; nothing is converted to
|
|
42
|
+
* the viewer's zone. Unsupported constraints remain Custom, with the full
|
|
43
|
+
* source expression.
|
|
38
44
|
*/
|
|
39
|
-
export declare const describeScheduledTaskTrigger: (trigger: ScheduleTriggerDto, {
|
|
45
|
+
export declare const describeScheduledTaskTrigger: (trigger: ScheduleTriggerDto, { timezone }?: ScheduledTaskTriggerDescriptionOptions) => ScheduledTaskTriggerDescription;
|
|
40
46
|
//# sourceMappingURL=scheduled-task-description.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-task-description.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"scheduled-task-description.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AASxE,8DAA8D;AAC9D,oBAAY,mCAAmC;IAC7C,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oEAAoE;AACpE,MAAM,WAAW,+BAA+B;IAC9C,2CAA2C;IAC3C,IAAI,EAAE,mCAAmC,CAAC;IAC1C,2FAA2F;IAC3F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,uDAAuD;AACvD,MAAM,WAAW,sCAAsC;IACrD,iHAAiH;IACjH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GACvC,SAAS,kBAAkB,EAC3B,eAAsB,sCAA2C,KAChE,+BAwHF,CAAC"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { padTwoDigits as e } from "../shared/formatting.js";
|
|
2
|
+
import { instantToZonedDateTime as t, isAbsoluteInstant as n } from "@epam/ai-dial-scheduled-tasks";
|
|
2
3
|
//#region src/scheduled-task/scheduled-task-description.ts
|
|
3
|
-
var
|
|
4
|
+
var r = 16, i = /* @__PURE__ */ function(e) {
|
|
4
5
|
return e.OneTime = "oneTime", e.Hourly = "hourly", e.EveryNMinutes = "everyNMinutes", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e.Custom = "custom", e.Invalid = "invalid", e;
|
|
5
|
-
}({}),
|
|
6
|
-
let
|
|
6
|
+
}({}), a = (i, { timezone: a = "UTC" } = {}) => {
|
|
7
|
+
let o = (e, t = {}) => ({
|
|
7
8
|
kind: e,
|
|
8
|
-
|
|
9
|
+
timezone: a,
|
|
9
10
|
...t
|
|
10
11
|
});
|
|
11
|
-
if (
|
|
12
|
-
if (
|
|
13
|
-
let e =
|
|
14
|
-
return Number.isNaN(
|
|
12
|
+
if (i.date && i.cron) return o("invalid");
|
|
13
|
+
if (i.date) {
|
|
14
|
+
let e = n(i.date) ? t(i.date, a) : i.date.slice(0, r);
|
|
15
|
+
return e && !Number.isNaN(Date.parse(`${e}Z`)) ? o("oneTime", { dateTime: e }) : o("invalid");
|
|
15
16
|
}
|
|
16
|
-
let
|
|
17
|
-
if (!
|
|
18
|
-
let
|
|
17
|
+
let s = i.cron?.fields;
|
|
18
|
+
if (!s || Object.keys(s).length === 0) return o("invalid");
|
|
19
|
+
let c = () => o("custom", { expression: JSON.stringify(s) }), l = {
|
|
19
20
|
hour: [0, 23],
|
|
20
21
|
minute: [0, 59],
|
|
21
22
|
day: [1, 31],
|
|
@@ -23,19 +24,19 @@ var t = /* @__PURE__ */ function(e) {
|
|
|
23
24
|
month: [1, 12],
|
|
24
25
|
second: [0, 59]
|
|
25
26
|
};
|
|
26
|
-
for (let [e, t] of Object.entries(
|
|
27
|
+
for (let [e, t] of Object.entries(s)) {
|
|
27
28
|
if (t == null) continue;
|
|
28
|
-
if (!t.trim()) return
|
|
29
|
-
let n =
|
|
30
|
-
if (n && /^-?\d+$/.test(t) && (Number(t) < n[0] || Number(t) > n[1])) return
|
|
29
|
+
if (!t.trim()) return o("invalid");
|
|
30
|
+
let n = l[e];
|
|
31
|
+
if (n && /^-?\d+$/.test(t) && (Number(t) < n[0] || Number(t) > n[1])) return o("invalid");
|
|
31
32
|
if (e === "second" && t !== "0" || ![
|
|
32
33
|
"hour",
|
|
33
34
|
"minute",
|
|
34
35
|
"day",
|
|
35
36
|
"day_of_week"
|
|
36
|
-
].includes(e) && t !== "*" && (e !== "second" || t !== "0")) return
|
|
37
|
+
].includes(e) && t !== "*" && (e !== "second" || t !== "0")) return c();
|
|
37
38
|
}
|
|
38
|
-
let
|
|
39
|
+
let u = s.hour, d = s.minute, f = s.day === "*" ? void 0 : s.day, p = s.day_of_week === "*" ? void 0 : s.day_of_week, m = [
|
|
39
40
|
"monday",
|
|
40
41
|
"tuesday",
|
|
41
42
|
"wednesday",
|
|
@@ -43,48 +44,31 @@ var t = /* @__PURE__ */ function(e) {
|
|
|
43
44
|
"friday",
|
|
44
45
|
"saturday",
|
|
45
46
|
"sunday"
|
|
46
|
-
],
|
|
47
|
-
let t =
|
|
47
|
+
], h = (p?.split(",") ?? []).map((e) => {
|
|
48
|
+
let t = m.findIndex((t) => t === e.toLowerCase() || t.slice(0, 3) === e.toLowerCase());
|
|
48
49
|
return t >= 0 ? String(t) : e;
|
|
49
|
-
}),
|
|
50
|
-
if (
|
|
51
|
-
let
|
|
52
|
-
if (
|
|
53
|
-
let e = Number(
|
|
54
|
-
return e > 0 && e <= 59 ?
|
|
50
|
+
}), g = h[0];
|
|
51
|
+
if (f && g || f && !/^\d+$/.test(f) || h.some((e) => !/^[0-6]$/.test(e)) || new Set(h).size !== h.length) return c();
|
|
52
|
+
let _ = u == null || u === "*", v = d?.match(/^\*\/(\d+)$/);
|
|
53
|
+
if (_ && v && !f && !g) {
|
|
54
|
+
let e = Number(v[1]);
|
|
55
|
+
return e > 0 && e <= 59 ? o("everyNMinutes", { intervalMinutes: e }) : o("invalid");
|
|
55
56
|
}
|
|
56
|
-
if (!
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
let e = (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
let y = new Intl.DateTimeFormat("en-GB", {
|
|
64
|
-
timeZone: n,
|
|
65
|
-
hourCycle: "h23",
|
|
66
|
-
year: "numeric",
|
|
67
|
-
month: "2-digit",
|
|
68
|
-
day: "2-digit",
|
|
69
|
-
hour: "2-digit",
|
|
70
|
-
minute: "2-digit"
|
|
71
|
-
}).formatToParts(v), b = (e) => y.find((t) => t.type === e)?.value ?? "", x = new Date(Date.UTC(Number(b("year")), Number(b("month")) - 1, Number(b("day")))), S = Date.UTC(v.getUTCFullYear(), v.getUTCMonth(), v.getUTCDate()), C = Math.round((x.getTime() - S) / 864e5), w = b("hour") + ":" + b("minute");
|
|
72
|
-
if (g) return i("hourly", { time: b("minute") });
|
|
73
|
-
if (h) {
|
|
74
|
-
let e = m.map((e) => String((Number(e) + C + 7) % 7)).sort((e, t) => Number(e) - Number(t));
|
|
75
|
-
return i("weekly", {
|
|
76
|
-
time: w,
|
|
57
|
+
if (!d || !/^\d+$/.test(d) || !_ && !/^\d+$/.test(u) || _ && (f || g)) return c();
|
|
58
|
+
if (_) return o("hourly", { time: e(Number(d)) });
|
|
59
|
+
let y = `${e(Number(u))}:${e(Number(d))}`;
|
|
60
|
+
if (g) {
|
|
61
|
+
let e = [...h].sort((e, t) => Number(e) - Number(t));
|
|
62
|
+
return o("weekly", {
|
|
63
|
+
time: y,
|
|
77
64
|
dayOfWeek: e[0],
|
|
78
65
|
daysOfWeek: e
|
|
79
66
|
});
|
|
80
67
|
}
|
|
81
|
-
return
|
|
82
|
-
time:
|
|
83
|
-
dayOfMonth:
|
|
84
|
-
}) : o(
|
|
85
|
-
time: w,
|
|
86
|
-
dayOfMonth: String(Number(u) + C)
|
|
87
|
-
}) : o() : i("daily", { time: w });
|
|
68
|
+
return f ? o("monthly", {
|
|
69
|
+
time: y,
|
|
70
|
+
dayOfMonth: String(Number(f))
|
|
71
|
+
}) : o("daily", { time: y });
|
|
88
72
|
};
|
|
89
73
|
//#endregion
|
|
90
|
-
export {
|
|
74
|
+
export { i as ScheduledTaskTriggerDescriptionKind, a as describeScheduledTaskTrigger };
|
|
@@ -9,7 +9,7 @@ export interface ScheduledTaskScheduleLabels {
|
|
|
9
9
|
everyNMinutes: (count: number) => string;
|
|
10
10
|
/** An hourly run at `minute` past the hour. */
|
|
11
11
|
hourlyAt: (minute: string) => string;
|
|
12
|
-
/** A daily run at `time
|
|
12
|
+
/** A daily run at `time`, a locale-formatted clock time such as `9:00 AM` or `09:00`. */
|
|
13
13
|
dailyAt: (time: string) => string;
|
|
14
14
|
/** A weekly run on `day` — one weekday name, or several joined as a locale list — at `time`. */
|
|
15
15
|
weeklyAt: (day: string, time: string) => string;
|
|
@@ -19,6 +19,32 @@ export interface ScheduledTaskScheduleLabels {
|
|
|
19
19
|
invalid: string;
|
|
20
20
|
/** Label for a recurring trigger no other shape describes. */
|
|
21
21
|
recurringFallback: string;
|
|
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
|
+
withTimezone?: (label: string, timezone: string) => string;
|
|
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"
|
|
22
48
|
}
|
|
23
49
|
/** Host-translated duration units for a run. */
|
|
24
50
|
export interface ScheduledTaskRunDurationLabels {
|
|
@@ -38,12 +64,14 @@ export interface ScheduledTaskRunTimestampLabels {
|
|
|
38
64
|
/** A run that started on the short date `date` at `time`. */
|
|
39
65
|
dateAt: (date: string, time: string) => string;
|
|
40
66
|
}
|
|
41
|
-
/** Locale and
|
|
67
|
+
/** Locale and viewer zone used to format a schedule label. */
|
|
42
68
|
export interface ScheduledTaskScheduleLabelOptions {
|
|
43
69
|
/** BCP 47 locale for dates and weekday names. Defaults to the runtime default. */
|
|
44
70
|
locale?: string;
|
|
45
|
-
/** IANA
|
|
46
|
-
|
|
71
|
+
/** The viewer's IANA zone; a task in a different zone gets its zone appended to the label. Defaults to the browser's resolved zone. */
|
|
72
|
+
browserTimezone?: string;
|
|
73
|
+
/** Appends the task's zone even when it equals the viewer's zone. Needs `labels.withTimezone`. Defaults to `false`. */
|
|
74
|
+
alwaysShowTimezone?: boolean;
|
|
47
75
|
}
|
|
48
76
|
/** Inputs for formatting a run's start time. */
|
|
49
77
|
export interface ScheduledTaskRunTimestampOptions {
|
|
@@ -85,8 +113,18 @@ export declare enum ScheduledTaskDeleteErrorKind {
|
|
|
85
113
|
/** Any other failure. */
|
|
86
114
|
Generic = "generic"
|
|
87
115
|
}
|
|
88
|
-
/**
|
|
89
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Formats a stored trigger datetime — a zone-local wall time, or an absolute
|
|
118
|
+
* instant written by an older client — as the wall time it shows in the
|
|
119
|
+
* task's own zone. Returns the raw value when it is not a date.
|
|
120
|
+
*/
|
|
121
|
+
export declare const formatScheduledTaskTriggerTime: (value: string, timezone: string, locale?: string) => string;
|
|
122
|
+
/**
|
|
123
|
+
* Returns the schedule label for a task's trigger in the task's own zone: the
|
|
124
|
+
* stored wall time is shown as is, and the zone is appended when it differs
|
|
125
|
+
* from the viewer's.
|
|
126
|
+
*/
|
|
127
|
+
export declare const formatScheduledTaskScheduleLabel: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, { locale, browserTimezone, alwaysShowTimezone, }?: ScheduledTaskScheduleLabelOptions) => string;
|
|
90
128
|
/** Maps a scheduled-task DTO to the scheduled-tasks lib's card item. */
|
|
91
129
|
export declare const toScheduledTaskItem: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, options?: ScheduledTaskScheduleLabelOptions) => ScheduledTaskItem;
|
|
92
130
|
/** Maps scheduled-task DTOs to card items, preserving order. */
|
|
@@ -103,4 +141,27 @@ export declare const toScheduledTaskRunItems: (runs: ScheduledTaskRunDto[], opti
|
|
|
103
141
|
export declare const classifyScheduledTaskDeleteError: (status: number | undefined) => ScheduledTaskDeleteErrorKind;
|
|
104
142
|
/** Returns the admin-consent message, else the scheduler's own trimmed reason, else the fallback. */
|
|
105
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;
|
|
106
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,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oHAAoH;IACpH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM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AM,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,69 +1,81 @@
|
|
|
1
1
|
import { ScheduledTaskTriggerDescriptionKind as e, describeScheduledTaskTrigger as t } from "./scheduled-task-description.js";
|
|
2
|
-
import {
|
|
3
|
-
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";
|
|
4
8
|
//#region src/scheduled-task/scheduled-task-display.ts
|
|
5
|
-
var
|
|
9
|
+
var y = /* @__PURE__ */ function(e) {
|
|
10
|
+
return e.OneTimeFired = "oneTimeFired", e.WindowEnded = "windowEnded", e;
|
|
11
|
+
}({}), b = /* @__PURE__ */ function(e) {
|
|
6
12
|
return e.NotFound = "notFound", e.Retryable = "retryable", e.Generic = "generic", e;
|
|
7
|
-
}({}),
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
let
|
|
12
|
-
switch (
|
|
13
|
-
case e.OneTime: return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
case e.
|
|
18
|
-
case e.
|
|
19
|
-
case e.
|
|
20
|
-
|
|
21
|
-
case e.Monthly: return r.monthlyAt(o.dayOfMonth ?? "", s);
|
|
22
|
-
case e.Invalid: return r.invalid;
|
|
23
|
-
default: return r.recurringFallback;
|
|
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;
|
|
24
27
|
}
|
|
25
|
-
},
|
|
28
|
+
}, E = (e, t, n) => ({
|
|
26
29
|
id: e.id,
|
|
27
30
|
displayName: e.displayName,
|
|
28
31
|
descriptionPreview: e.description,
|
|
29
|
-
scheduleLabel:
|
|
32
|
+
scheduleLabel: T(e, t, n),
|
|
30
33
|
isActive: e.isActive,
|
|
31
34
|
isCompleted: e.isCompleted
|
|
32
|
-
}),
|
|
35
|
+
}), D = (e, t, n) => e.map((e) => E(e, t, n)), O = (e, t) => {
|
|
33
36
|
if (e == null) return;
|
|
34
37
|
let n = [
|
|
35
|
-
[Math.floor(e /
|
|
36
|
-
[Math.floor(e %
|
|
37
|
-
[e %
|
|
38
|
+
[Math.floor(e / S), t.hours],
|
|
39
|
+
[Math.floor(e % S / x), t.minutes],
|
|
40
|
+
[e % x, t.seconds]
|
|
38
41
|
].filter(([e]) => e > 0).map(([e, t]) => t(e));
|
|
39
42
|
return t.suffix(n.length ? n.join(" ") : t.seconds(0));
|
|
40
|
-
},
|
|
41
|
-
let o = new Date(e), s =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}).format(o), s), l = r ? m(t, r) : void 0;
|
|
45
|
-
return l ? `${c} ${l}` : c;
|
|
46
|
-
}, g = (e) => {
|
|
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) => {
|
|
47
47
|
switch (e) {
|
|
48
|
-
case
|
|
49
|
-
case
|
|
50
|
-
case
|
|
51
|
-
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;
|
|
52
52
|
}
|
|
53
|
-
},
|
|
53
|
+
}, j = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
|
|
54
54
|
let { conversationId: s } = e, c = s ? r.find((e) => i(e.id, s)) : void 0;
|
|
55
55
|
return {
|
|
56
56
|
id: e.id,
|
|
57
|
-
status:
|
|
58
|
-
timestampLabel:
|
|
57
|
+
status: A(e.status),
|
|
58
|
+
timestampLabel: k(e.startTime, void 0, t, {
|
|
59
59
|
locale: a,
|
|
60
60
|
now: o
|
|
61
61
|
}),
|
|
62
|
-
durationLabel:
|
|
62
|
+
durationLabel: O(e.durationSeconds, n),
|
|
63
63
|
conversationId: s,
|
|
64
64
|
isUnread: c?.isUnread === !0,
|
|
65
65
|
errorText: e.errorText
|
|
66
66
|
};
|
|
67
|
-
},
|
|
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
|
+
};
|
|
68
80
|
//#endregion
|
|
69
|
-
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 };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ScheduleCronDto } from '@epam/ai-dial-chat-api-client';
|
|
2
2
|
/**
|
|
3
|
-
* Returns the next
|
|
4
|
-
* `hour`/`minute` fires
|
|
5
|
-
* list of weekdays) or `day` (Monthly) constraint.
|
|
6
|
-
*
|
|
3
|
+
* Returns the next local `YYYY-MM-DDTHH:mm` at which a cron trigger with a
|
|
4
|
+
* fixed `hour`/`minute` fires in `timezone`, honouring its `day_of_week` (a
|
|
5
|
+
* weekday or a comma list of weekdays) or `day` (Monthly) constraint. Cron
|
|
6
|
+
* fields are wall time in the task's zone, so the answer is wall time too.
|
|
7
|
+
* Returns `undefined` when the fields are not plain values this helper can
|
|
8
|
+
* evaluate or the zone is unknown.
|
|
7
9
|
*/
|
|
8
|
-
export declare const getNextCronOccurrence: (cron: ScheduleCronDto, from?: Date) =>
|
|
10
|
+
export declare const getNextCronOccurrence: (cron: ScheduleCronDto, timezone: string, from?: Date) => string | undefined;
|
|
11
|
+
/** Returns whether a cron activity window's `endDate` is at or before `now` (epoch ms, default: the current time). */
|
|
12
|
+
export declare const hasScheduledTaskWindowEnded: (endDate: string, now?: number) => boolean;
|
|
9
13
|
//# sourceMappingURL=scheduled-task-next-occurrence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-task-next-occurrence.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-next-occurrence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"scheduled-task-next-occurrence.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-next-occurrence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AA8BrE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,eAAe,EACrB,UAAU,MAAM,EAChB,OAAM,IAAiB,KACtB,MAAM,GAAG,SAmCX,CAAC;AAEF,sHAAsH;AACtH,eAAO,MAAM,2BAA2B,GACtC,SAAS,MAAM,EACf,MAAK,MAAmB,KACvB,OAA6C,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { padTwoDigits as e } from "../shared/formatting.js";
|
|
2
|
+
import { getZonedNow as t } from "@epam/ai-dial-scheduled-tasks";
|
|
1
3
|
//#region src/scheduled-task/scheduled-task-next-occurrence.ts
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var n = "last", r = 366, i = /^\d+$/, a = 864e5, o = (e, t, r) => t == null ? r === n ? new Date(e.getTime() + a).getUTCDate() === 1 : r == null || Number(r) === e.getUTCDate() : t.split(",").some((t) => (Number(t) + 1) % 7 === e.getUTCDay()), s = (s, c, l = /* @__PURE__ */ new Date()) => {
|
|
5
|
+
let { hour: u, minute: d, day_of_week: f, day: p } = s.fields;
|
|
6
|
+
if (!u || !d || !i.test(u) || !i.test(d) || f != null && !/^[0-6](?:,[0-6])*$/.test(f) || p != null && p !== n && !i.test(p)) return;
|
|
7
|
+
let m;
|
|
8
|
+
try {
|
|
9
|
+
m = t(l, c).dateTime;
|
|
10
|
+
} catch {
|
|
11
|
+
return;
|
|
7
12
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let l = new Date(i);
|
|
13
|
-
l.setUTCHours(Number(a), Number(o), 0, 0);
|
|
14
|
-
for (let e = 0; e <= 366; e++) {
|
|
15
|
-
if (l > i && n(l, s, c)) return l;
|
|
16
|
-
l.setUTCDate(l.getUTCDate() + 1);
|
|
13
|
+
let h = `${e(Number(u))}:${e(Number(d))}`, g = Date.parse(`${m.slice(0, 10)}T00:00:00Z`);
|
|
14
|
+
for (let e = 0; e <= r; e++) {
|
|
15
|
+
let t = new Date(g + e * a), n = `${t.toISOString().slice(0, 10)}T${h}`;
|
|
16
|
+
if (n > m && o(t, f, p)) return n;
|
|
17
17
|
}
|
|
18
|
-
};
|
|
18
|
+
}, c = (e, t = Date.now()) => new Date(e).getTime() <= t;
|
|
19
19
|
//#endregion
|
|
20
|
-
export {
|
|
20
|
+
export { s as getNextCronOccurrence, c as hasScheduledTaskWindowEnded };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** A zone-local `YYYY-MM-DDTHH:mm`, the shape the wall-time formatter can show. */
|
|
2
|
+
export declare const SCHEDULED_TASK_WALL_DATE_TIME_PATTERN: RegExp;
|
|
3
|
+
/** Style of a weekday name. */
|
|
4
|
+
export declare enum ScheduledTaskWeekdayStyle {
|
|
5
|
+
Long = "long",
|
|
6
|
+
Narrow = "narrow"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Formats a stored `HH:mm` wall time as the locale's short clock time (`9:00 AM`
|
|
10
|
+
* or `09:00`) without converting it to another zone. Returns the raw value when
|
|
11
|
+
* it is not a valid `HH:mm`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatScheduledTaskClockTime: (time: string, locale?: string) => string;
|
|
14
|
+
/** Formats a zone-local `YYYY-MM-DDTHH:mm` as a medium date and short time without converting it to another zone. */
|
|
15
|
+
export declare const formatZonedDateTime: (dateTime: string, locale?: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Formats an absolute instant (an ISO string such as `nextRunTime`) as a medium
|
|
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.
|
|
22
|
+
*/
|
|
23
|
+
export declare const formatScheduledTaskInstant: (instant: string, locale?: string, timeZone?: string) => string;
|
|
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`. */
|
|
25
|
+
export declare const formatScheduledTaskRunTime: (date: Date, locale?: string) => string;
|
|
26
|
+
/** Formats the calendar day of an instant without a year in the viewer's zone, e.g. `Nov 17`. */
|
|
27
|
+
export declare const formatScheduledTaskRunDate: (date: Date, locale?: string) => string;
|
|
28
|
+
/**
|
|
29
|
+
* Formats an APScheduler weekday (`'0'` is Monday) as its localized name.
|
|
30
|
+
* 2023-01-02 was a Monday and the formatter runs in UTC, so the name is the
|
|
31
|
+
* segment's own day, not the viewer's local calendar's.
|
|
32
|
+
*/
|
|
33
|
+
export declare const formatScheduledTaskWeekday: (dayOfWeek: string | number | undefined, locale?: string, style?: ScheduledTaskWeekdayStyle) => string;
|
|
34
|
+
/** Formats several APScheduler weekdays as one locale list, e.g. `Monday, Wednesday and Friday`. */
|
|
35
|
+
export declare const formatScheduledTaskWeekdays: (daysOfWeek: string[], locale?: string) => string;
|
|
36
|
+
//# sourceMappingURL=scheduled-task-time-format.d.ts.map
|
|
@@ -0,0 +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;;;;;;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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/scheduled-task/scheduled-task-time-format.ts
|
|
2
|
+
var e = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/, t = /^(\d{1,2}):(\d{2})$/, n = /* @__PURE__ */ function(e) {
|
|
3
|
+
return e.Long = "long", e.Narrow = "narrow", e;
|
|
4
|
+
}({}), r = (e, n) => {
|
|
5
|
+
let r = t.exec(e);
|
|
6
|
+
if (!r) return e;
|
|
7
|
+
let i = Number(r[1]), a = Number(r[2]);
|
|
8
|
+
return i > 23 || a > 59 ? e : new Intl.DateTimeFormat(n, {
|
|
9
|
+
timeStyle: "short",
|
|
10
|
+
timeZone: "UTC"
|
|
11
|
+
}).format(new Date(Date.UTC(1970, 0, 1, i, a)));
|
|
12
|
+
}, i = (e, t) => new Intl.DateTimeFormat(t, {
|
|
13
|
+
dateStyle: "medium",
|
|
14
|
+
timeStyle: "short",
|
|
15
|
+
timeZone: "UTC"
|
|
16
|
+
}).format(/* @__PURE__ */ new Date(`${e}:00Z`)), a = (e, t, n) => {
|
|
17
|
+
try {
|
|
18
|
+
return new Intl.DateTimeFormat(t, {
|
|
19
|
+
dateStyle: "medium",
|
|
20
|
+
timeStyle: "short",
|
|
21
|
+
timeZone: n
|
|
22
|
+
}).format(new Date(e));
|
|
23
|
+
} catch {
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
}, o = (e, t) => new Intl.DateTimeFormat(t, { timeStyle: "short" }).format(e), s = (e, t) => new Intl.DateTimeFormat(t, {
|
|
27
|
+
month: "short",
|
|
28
|
+
day: "numeric"
|
|
29
|
+
}).format(e), c = (e, t, n = "long") => new Intl.DateTimeFormat(t, {
|
|
30
|
+
weekday: n,
|
|
31
|
+
timeZone: "UTC"
|
|
32
|
+
}).format(new Date(Date.UTC(2023, 0, 2 + Number(e)))), l = (e, t) => new Intl.ListFormat(t, { type: "conjunction" }).format(e.map((e) => c(e, t)));
|
|
33
|
+
//#endregion
|
|
34
|
+
export { e as SCHEDULED_TASK_WALL_DATE_TIME_PATTERN, n as ScheduledTaskWeekdayStyle, r as formatScheduledTaskClockTime, a as formatScheduledTaskInstant, s as formatScheduledTaskRunDate, o as formatScheduledTaskRunTime, c as formatScheduledTaskWeekday, l as formatScheduledTaskWeekdays, i as formatZonedDateTime };
|
|
@@ -3,15 +3,17 @@ import { ScheduledTaskCreateFormValues } from '@epam/ai-dial-scheduled-tasks';
|
|
|
3
3
|
import { ScheduledTaskDtoMappingResult } from './scheduled-task-mapping';
|
|
4
4
|
/**
|
|
5
5
|
* Maps validated create-form values to the `POST /api/v1/scheduled-tasks`
|
|
6
|
-
* request body
|
|
7
|
-
*
|
|
8
|
-
* validated required fields (name, model,
|
|
9
|
-
* section's fields) — this function does not
|
|
6
|
+
* request body: `trigger.date` for a one-shot schedule or `trigger.cron` for a
|
|
7
|
+
* recurring one, both in wall time, plus the `timezone` they are read in.
|
|
8
|
+
* Assumes the caller has already validated required fields (name, model,
|
|
9
|
+
* prompt, and the active schedule section's fields) — this function does not
|
|
10
|
+
* re-validate.
|
|
10
11
|
*/
|
|
11
12
|
export declare const mapFormValuesToCreateBody: (values: ScheduledTaskCreateFormValues) => CreateScheduledTaskBodyDto;
|
|
12
13
|
/**
|
|
13
14
|
* Maps a complete, validated edit draft to an update body. An unset skill
|
|
14
15
|
* emits null to remove the saved reference; hydrate from detail before editing.
|
|
16
|
+
* The zone is always present, because the scheduler resets an omitted one to UTC.
|
|
15
17
|
*/
|
|
16
18
|
export declare const mapFormValuesToUpdateBody: (values: ScheduledTaskCreateFormValues) => UpdateScheduledTaskBodyDto;
|
|
17
19
|
/**
|