@epam/ai-dial-chat-hooks 1.3.5 → 1.4.0-dev.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  2. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  3. package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
  4. package/catalog/create-publish-api.d.ts +9 -1
  5. package/catalog/create-publish-api.d.ts.map +1 -1
  6. package/catalog/create-publish-api.js +9 -0
  7. package/catalog/publish.d.ts +2 -0
  8. package/catalog/publish.d.ts.map +1 -1
  9. package/catalog/publish.js +4 -4
  10. package/catalog/resource-save-adapter.d.ts +7 -2
  11. package/catalog/resource-save-adapter.d.ts.map +1 -1
  12. package/catalog/resource-save-adapters.d.ts +32 -7
  13. package/catalog/resource-save-adapters.d.ts.map +1 -1
  14. package/catalog/resource-save-adapters.js +47 -41
  15. package/catalog/resource-save.d.ts +17 -9
  16. package/catalog/resource-save.d.ts.map +1 -1
  17. package/catalog/resource-save.js +34 -25
  18. package/catalog/save-destination-root.d.ts +12 -0
  19. package/catalog/save-destination-root.d.ts.map +1 -0
  20. package/catalog/save-destination-root.js +6 -0
  21. package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
  22. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  23. package/catalog/usePublishFolders/usePublishFolders.js +29 -29
  24. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +7 -3
  25. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
  26. package/catalog/useResourceSavePanel/useResourceSavePanel.js +107 -97
  27. package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
  28. package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
  29. package/catalog/useVersionHistory/useVersionHistory.js +49 -0
  30. package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
  31. package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
  32. package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
  33. package/catalog/version-history.d.ts +42 -0
  34. package/catalog/version-history.d.ts.map +1 -0
  35. package/catalog/version-history.js +27 -0
  36. package/catalog.js +37 -33
  37. package/conversation/conversation-transfer/zip-export.d.ts +1 -1
  38. package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
  39. package/conversation/conversation-transfer/zip-export.js +7 -8
  40. package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
  41. package/conversation/conversation-transfer/zip-import.js +8 -9
  42. package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
  43. package/conversation/useConversationExport/useConversationExport.js +3 -1
  44. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  45. package/conversation/useConversationStream/generation-resume.js +119 -96
  46. package/entry-points/catalog.d.ts +3 -0
  47. package/entry-points/catalog.d.ts.map +1 -1
  48. package/entry-points/scheduled-tasks.d.ts +1 -0
  49. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  50. package/entry-points/utils.d.ts +3 -0
  51. package/entry-points/utils.d.ts.map +1 -1
  52. package/file-manager.js +33 -33
  53. package/files/annotation.d.ts +3 -3
  54. package/files/annotation.d.ts.map +1 -1
  55. package/files/annotation.js +12 -11
  56. package/files/attachment-canvas.d.ts +1 -1
  57. package/files/attachment-canvas.d.ts.map +1 -1
  58. package/files/attachment-canvas.js +135 -135
  59. package/files/dial-file.d.ts +18 -0
  60. package/files/dial-file.d.ts.map +1 -1
  61. package/files/dial-file.js +30 -5
  62. package/index.d.ts +7 -0
  63. package/index.d.ts.map +1 -1
  64. package/index.js +259 -252
  65. package/org-units/models.d.ts +3 -1
  66. package/org-units/models.d.ts.map +1 -1
  67. package/org-units/org-unit-guards.d.ts +64 -0
  68. package/org-units/org-unit-guards.d.ts.map +1 -0
  69. package/org-units/org-unit-guards.js +28 -0
  70. package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
  71. package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
  72. package/org-units/useFolderGuards/useFolderGuards.js +50 -0
  73. package/org-units/useOrgUnits/useOrgUnits.d.ts +18 -3
  74. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -1
  75. package/org-units/useOrgUnits/useOrgUnits.js +43 -23
  76. package/package.json +19 -19
  77. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  78. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  79. package/scheduled-task/scheduled-task-description.js +39 -55
  80. package/scheduled-task/scheduled-task-display.d.ts +19 -5
  81. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  82. package/scheduled-task/scheduled-task-display.js +43 -38
  83. package/scheduled-task/scheduled-task-next-occurrence.d.ts +7 -5
  84. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  85. package/scheduled-task/scheduled-task-next-occurrence.js +15 -15
  86. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  87. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  88. package/scheduled-task/scheduled-task-trigger.js +92 -115
  89. package/scheduled-tasks.js +14 -13
  90. package/shared/timezones.d.ts +30 -0
  91. package/shared/timezones.d.ts.map +1 -0
  92. package/shared/timezones.js +102 -0
  93. package/skill/skill-archive.d.ts.map +1 -1
  94. package/skill/skill-archive.js +6 -7
  95. package/skill/skill.d.ts +2 -2
  96. package/skill/skill.d.ts.map +1 -1
  97. package/skill/skill.js +33 -34
  98. package/skill/useSkillEditorLoad.js +1 -1
  99. package/skill/useSkillEditorSubmit.d.ts +4 -1
  100. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  101. package/skill/useSkillEditorSubmit.js +125 -121
  102. package/utils.js +19 -16
  103. package/shared/cron-day-of-month.d.ts +0 -21
  104. package/shared/cron-day-of-month.d.ts.map +0 -1
  105. package/shared/cron-day-of-month.js +0 -13
@@ -19,6 +19,8 @@ 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;
22
24
  }
23
25
  /** Host-translated duration units for a run. */
24
26
  export interface ScheduledTaskRunDurationLabels {
@@ -38,12 +40,12 @@ export interface ScheduledTaskRunTimestampLabels {
38
40
  /** A run that started on the short date `date` at `time`. */
39
41
  dateAt: (date: string, time: string) => string;
40
42
  }
41
- /** Locale and timezone used to format a schedule label. */
43
+ /** Locale and viewer zone used to format a schedule label. */
42
44
  export interface ScheduledTaskScheduleLabelOptions {
43
45
  /** BCP 47 locale for dates and weekday names. Defaults to the runtime default. */
44
46
  locale?: string;
45
- /** IANA timezone the schedule is shown in. Defaults to the browser's resolved timezone. */
46
- timeZone?: string;
47
+ /** 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. */
48
+ browserTimezone?: string;
47
49
  }
48
50
  /** Inputs for formatting a run's start time. */
49
51
  export interface ScheduledTaskRunTimestampOptions {
@@ -85,8 +87,20 @@ export declare enum ScheduledTaskDeleteErrorKind {
85
87
  /** Any other failure. */
86
88
  Generic = "generic"
87
89
  }
88
- /** Returns the schedule label for a task's trigger, shown in `timeZone`. */
89
- export declare const formatScheduledTaskScheduleLabel: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, { locale, timeZone, }?: ScheduledTaskScheduleLabelOptions) => string;
90
+ /** Formats a zone-local `YYYY-MM-DDTHH:mm` as a medium date and short time without converting it to another zone. */
91
+ export declare const formatZonedDateTime: (dateTime: string, locale?: string) => string;
92
+ /**
93
+ * Formats a stored trigger datetime — a zone-local wall time, or an absolute
94
+ * instant written by an older client — as the wall time it shows in the
95
+ * task's own zone. Returns the raw value when it is not a date.
96
+ */
97
+ export declare const formatScheduledTaskTriggerTime: (value: string, timezone: string, locale?: string) => string;
98
+ /**
99
+ * Returns the schedule label for a task's trigger in the task's own zone: the
100
+ * stored wall time is shown as is, and the zone is appended when it differs
101
+ * from the viewer's.
102
+ */
103
+ export declare const formatScheduledTaskScheduleLabel: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, { locale, browserTimezone, }?: ScheduledTaskScheduleLabelOptions) => string;
90
104
  /** Maps a scheduled-task DTO to the scheduled-tasks lib's card item. */
91
105
  export declare const toScheduledTaskItem: (task: ScheduledTaskDto, labels: ScheduledTaskScheduleLabels, options?: ScheduledTaskScheduleLabelOptions) => ScheduledTaskItem;
92
106
  /** Maps scheduled-task DTOs to card items, preserving order. */
@@ -1 +1 @@
1
- {"version":3,"file":"scheduled-task-display.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-display.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,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,uCAAuC;IACvC,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,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,KAC1C,iBAAiB,EAC6C,CAAC;AAElE,uGAAuG;AACvG,eAAO,MAAM,8BAA8B,GACzC,iBAAiB,MAAM,GAAG,IAAI,GAAG,SAAS,EAC1C,QAAQ,8BAA8B,KACrC,MAAM,GAAG,SAgBX,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,+BAA+B,GAC1C,WAAW,MAAM,EACjB,iBAAiB,MAAM,GAAG,IAAI,GAAG,SAAS,EAC1C,QAAQ,+BAA+B,EACvC,mCAIG,gCAAqC,KACvC,MAmBF,CAAC;AAgBF,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,GACjC,KAAK,mBAAmB,EACxB,wFAOG,2BAA2B,KAC7B,oBAyBF,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,uBAAuB,GAClC,MAAM,mBAAmB,EAAE,EAC3B,SAAS,2BAA2B,KACnC,oBAAoB,EACkC,CAAC;AAE1D,4EAA4E;AAC5E,eAAO,MAAM,gCAAgC,GAC3C,QAAQ,MAAM,GAAG,SAAS,KACzB,4BAKF,CAAC;AAEF,qGAAqG;AACrG,eAAO,MAAM,+BAA+B,GAC1C,SAAS,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,iBAAiB,CAAC,EAC1D,oCAAoC,0BAA0B,KAC7D,MAIF,CAAC"}
@@ -1,69 +1,74 @@
1
1
  import { ScheduledTaskTriggerDescriptionKind as e, describeScheduledTaskTrigger as t } from "./scheduled-task-description.js";
2
- import { ScheduledTaskErrorCode as n, ScheduledTaskRunDtoStatusEnum as r } from "@epam/ai-dial-chat-api-client";
3
- import { ScheduledTaskRunStatus as i } from "@epam/ai-dial-scheduled-tasks";
2
+ import { isSameTimezone as n } from "../shared/timezones.js";
3
+ import { ScheduledTaskErrorCode as r, ScheduledTaskRunDtoStatusEnum as i } from "@epam/ai-dial-chat-api-client";
4
+ import { ScheduledTaskRunStatus as a, instantToZonedDateTime as o, isAbsoluteInstant as s } from "@epam/ai-dial-scheduled-tasks";
4
5
  //#region src/scheduled-task/scheduled-task-display.ts
5
- var a = /* @__PURE__ */ function(e) {
6
+ var c = /* @__PURE__ */ function(e) {
6
7
  return e.NotFound = "notFound", e.Retryable = "retryable", e.Generic = "generic", e;
7
- }({}), o = 60, s = 3600, c = (e, t) => new Intl.DateTimeFormat(t, {
8
+ }({}), l = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/, u = 60, d = 3600, f = (e, t) => new Intl.DateTimeFormat(t, {
8
9
  weekday: "long",
9
10
  timeZone: "UTC"
10
- }).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))), u = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), d = (n, r, { locale: i, timeZone: a = Intl.DateTimeFormat().resolvedOptions().timeZone } = {}) => {
11
- let o = t(n.trigger, { timeZone: a }), s = o.time ?? "";
12
- switch (o.kind) {
13
- case e.OneTime: return r.onceAt(new Intl.DateTimeFormat(i, {
14
- dateStyle: "medium",
15
- timeStyle: "short"
16
- }).format(o.date));
17
- case e.EveryNMinutes: return r.everyNMinutes(o.intervalMinutes ?? 0);
18
- case e.Hourly: return r.hourlyAt(s);
19
- case e.Daily: return r.dailyAt(s);
20
- case e.Weekly: return r.weeklyAt(l(o.daysOfWeek ?? [o.dayOfWeek ?? ""], i), s);
21
- case e.Monthly: return r.monthlyAt(o.dayOfMonth ?? "", s);
22
- case e.Invalid: return r.invalid;
23
- default: return r.recurringFallback;
11
+ }).format(new Date(Date.UTC(2023, 0, 2 + Number(e)))), p = (e, t) => new Intl.ListFormat(t, { type: "conjunction" }).format(e.map((e) => f(e, t))), m = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), h = (e, t) => new Intl.DateTimeFormat(t, {
12
+ dateStyle: "medium",
13
+ timeStyle: "short",
14
+ timeZone: "UTC"
15
+ }).format(/* @__PURE__ */ new Date(`${e}:00Z`)), g = (e, t, n) => {
16
+ let r = s(e) ? o(e, t) : e.slice(0, 16);
17
+ return !r || !l.test(r) ? e : h(r, n);
18
+ }, _ = (r, i, { locale: a, browserTimezone: o = Intl.DateTimeFormat().resolvedOptions().timeZone } = {}) => {
19
+ let s = r.timezone || "UTC", c = t(r.trigger, { timezone: s }), l = c.time ?? "", u = (e) => i.withTimezone && !n(s, o) ? i.withTimezone(e, s) : e;
20
+ switch (c.kind) {
21
+ case e.OneTime: return u(i.onceAt(h(c.dateTime ?? "", a)));
22
+ case e.EveryNMinutes: return i.everyNMinutes(c.intervalMinutes ?? 0);
23
+ case e.Hourly: return u(i.hourlyAt(l));
24
+ case e.Daily: return u(i.dailyAt(l));
25
+ case e.Weekly: return u(i.weeklyAt(p(c.daysOfWeek ?? [c.dayOfWeek ?? ""], a), l));
26
+ case e.Monthly: return u(i.monthlyAt(c.dayOfMonth ?? "", l));
27
+ case e.Invalid: return i.invalid;
28
+ default: return i.recurringFallback;
24
29
  }
25
- }, f = (e, t, n) => ({
30
+ }, v = (e, t, n) => ({
26
31
  id: e.id,
27
32
  displayName: e.displayName,
28
33
  descriptionPreview: e.description,
29
- scheduleLabel: d(e, t, n),
34
+ scheduleLabel: _(e, t, n),
30
35
  isActive: e.isActive,
31
36
  isCompleted: e.isCompleted
32
- }), p = (e, t, n) => e.map((e) => f(e, t, n)), m = (e, t) => {
37
+ }), y = (e, t, n) => e.map((e) => v(e, t, n)), b = (e, t) => {
33
38
  if (e == null) return;
34
39
  let n = [
35
- [Math.floor(e / s), t.hours],
36
- [Math.floor(e % s / o), t.minutes],
37
- [e % o, t.seconds]
40
+ [Math.floor(e / d), t.hours],
41
+ [Math.floor(e % d / u), t.minutes],
42
+ [e % u, t.seconds]
38
43
  ].filter(([e]) => e > 0).map(([e, t]) => t(e));
39
44
  return t.suffix(n.length ? n.join(" ") : t.seconds(0));
40
- }, h = (e, t, n, { durationLabels: r, locale: i, now: a = /* @__PURE__ */ new Date() } = {}) => {
41
- let o = new Date(e), s = new Intl.DateTimeFormat(i, { timeStyle: "short" }).format(o), c = u(o, a) ? n.todayAt(s) : n.dateAt(new Intl.DateTimeFormat(i, {
45
+ }, x = (e, t, n, { durationLabels: r, locale: i, now: a = /* @__PURE__ */ new Date() } = {}) => {
46
+ let o = new Date(e), s = new Intl.DateTimeFormat(i, { timeStyle: "short" }).format(o), c = m(o, a) ? n.todayAt(s) : n.dateAt(new Intl.DateTimeFormat(i, {
42
47
  month: "short",
43
48
  day: "numeric"
44
- }).format(o), s), l = r ? m(t, r) : void 0;
49
+ }).format(o), s), l = r ? b(t, r) : void 0;
45
50
  return l ? `${c} ${l}` : c;
46
- }, g = (e) => {
51
+ }, S = (e) => {
47
52
  switch (e) {
48
- case r.Success: return i.Success;
49
- case r.Error: return i.Error;
50
- case r.InProgress: return i.InProgress;
51
- default: return i.Missed;
53
+ case i.Success: return a.Success;
54
+ case i.Error: return a.Error;
55
+ case i.InProgress: return a.InProgress;
56
+ default: return a.Missed;
52
57
  }
53
- }, _ = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
58
+ }, C = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
54
59
  let { conversationId: s } = e, c = s ? r.find((e) => i(e.id, s)) : void 0;
55
60
  return {
56
61
  id: e.id,
57
- status: g(e.status),
58
- timestampLabel: h(e.startTime, void 0, t, {
62
+ status: S(e.status),
63
+ timestampLabel: x(e.startTime, void 0, t, {
59
64
  locale: a,
60
65
  now: o
61
66
  }),
62
- durationLabel: m(e.durationSeconds, n),
67
+ durationLabel: b(e.durationSeconds, n),
63
68
  conversationId: s,
64
69
  isUnread: c?.isUnread === !0,
65
70
  errorText: e.errorText
66
71
  };
67
- }, v = (e, t) => e.map((e) => _(e, t)), y = (e) => e === 404 || e === 409 ? "notFound" : e === 502 ? "retryable" : "generic", b = (e, { adminConsentRequired: t, fallback: r }) => e.code === n.ScheduledTaskAdminConsentRequired ? t : e.upstreamMessage?.trim() || r;
72
+ }, w = (e, t) => e.map((e) => C(e, t)), T = (e) => e === 404 || e === 409 ? "notFound" : e === 502 ? "retryable" : "generic", E = (e, { adminConsentRequired: t, fallback: n }) => e.code === r.ScheduledTaskAdminConsentRequired ? t : e.upstreamMessage?.trim() || n;
68
73
  //#endregion
69
- export { a as ScheduledTaskDeleteErrorKind, y as classifyScheduledTaskDeleteError, m as formatScheduledTaskRunDuration, h as formatScheduledTaskRunTimestamp, d as formatScheduledTaskScheduleLabel, b as selectScheduledTaskErrorMessage, f as toScheduledTaskItem, p as toScheduledTaskItems, _ as toScheduledTaskRunItem, v as toScheduledTaskRunItems };
74
+ export { c as ScheduledTaskDeleteErrorKind, T as classifyScheduledTaskDeleteError, b as formatScheduledTaskRunDuration, x as formatScheduledTaskRunTimestamp, _ as formatScheduledTaskScheduleLabel, g as formatScheduledTaskTriggerTime, h as formatZonedDateTime, E as selectScheduledTaskErrorMessage, v as toScheduledTaskItem, y as toScheduledTaskItems, C as toScheduledTaskRunItem, w as toScheduledTaskRunItems };
@@ -1,9 +1,11 @@
1
1
  import { ScheduleCronDto } from '@epam/ai-dial-chat-api-client';
2
2
  /**
3
- * Returns the next UTC time at which a cron trigger with a fixed
4
- * `hour`/`minute` fires, honouring its `day_of_week` (a weekday or a comma
5
- * list of weekdays) or `day` (Monthly) constraint. Returns `undefined` when
6
- * the fields are not plain values this helper can evaluate.
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) => Date | undefined;
10
+ export declare const getNextCronOccurrence: (cron: ScheduleCronDto, timezone: string, from?: Date) => string | undefined;
9
11
  //# 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;AA6BrE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,eAAe,EACrB,OAAM,IAAiB,KACtB,IAAI,GAAG,SA4BT,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"}
@@ -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 e = "last", t = /^\d+$/, n = (t, n, r) => {
3
- if (n != null) return n.split(",").some((e) => (Number(e) + 1) % 7 === t.getUTCDay());
4
- if (r === e) {
5
- let e = new Date(t);
6
- return e.setUTCDate(t.getUTCDate() + 1), e.getUTCDate() === 1;
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
- return r == null || Number(r) === t.getUTCDate();
9
- }, r = (r, i = /* @__PURE__ */ new Date()) => {
10
- let { hour: a, minute: o, day_of_week: s, day: c } = r.fields;
11
- if (!a || !o || !t.test(a) || !t.test(o) || s != null && !/^[0-6](?:,[0-6])*$/.test(s) || c != null && c !== e && !t.test(c)) return;
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
  };
19
19
  //#endregion
20
- export { r as getNextCronOccurrence };
20
+ export { s as getNextCronOccurrence };
@@ -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, building `trigger.date` for a one-shot schedule or
7
- * `trigger.cron.fields` for a recurring one. Assumes the caller has already
8
- * validated required fields (name, model, prompt, and the active schedule
9
- * section's fields) — this function does not re-validate.
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
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"scheduled-task-trigger.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EAEhB,0BAA0B,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,6BAA6B,EAE9B,MAAM,+BAA+B,CAAC;AAWvC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAgIlC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAsCF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAGD,CAAC;AAoJH;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC1C,KAAK,gBAAgB,KACpB,6BA8GF,CAAC"}
1
+ {"version":3,"file":"scheduled-task-trigger.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/scheduled-task-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EAEhB,0BAA0B,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIL,KAAK,6BAA6B,EACnC,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAuFlC;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAuCF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,6BAA6B,KACpC,0BAGD,CAAC;AA4HH;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC1C,KAAK,gBAAgB,KACpB,6BA4HF,CAAC"}
@@ -1,174 +1,151 @@
1
1
  import { padTwoDigits as e } from "../shared/formatting.js";
2
2
  import { UnsupportedTriggerReason as t } from "./scheduled-task-mapping.js";
3
- import { getUtcDayShift as n, toLocalDayOfMonth as r, toUtcCronDayOfMonth as i } from "../shared/cron-day-of-month.js";
4
- import { apSchedulerDayToJsDay as a, jsDayToApSchedulerDay as o } from "../shared/cron-weekday.js";
5
- import { ScheduledTaskRepeat as s } from "@epam/ai-dial-scheduled-tasks";
3
+ import { isKnownTimezone as n } from "../shared/timezones.js";
4
+ import { ScheduledTaskRepeat as r, instantToZonedDateTime as i, isAbsoluteInstant as a } from "@epam/ai-dial-scheduled-tasks";
6
5
  //#region src/scheduled-task/scheduled-task-trigger.ts
7
- var c = /* @__PURE__ */ new Set([
6
+ var o = /* @__PURE__ */ new Set([
8
7
  "hour",
9
8
  "minute",
10
9
  "day_of_week",
11
10
  "day"
12
- ]), l = /^[0-6]$/, u = (e) => [...e].sort((e, t) => Number(e) - Number(t)), d = "09:00", f = (e) => {
13
- if (e.repeat === s.Hourly) {
14
- let t = /* @__PURE__ */ new Date();
15
- return t.setHours(0, Number(e.minute), 0, 0), {
16
- hour: "*",
17
- minute: String(t.getUTCMinutes())
18
- };
19
- }
20
- let [t, r] = e.time.split(":"), c = Number(t), l = Number(r), d = /* @__PURE__ */ new Date();
21
- d.setHours(c, l, 0, 0);
22
- let f = e.repeat === s.Weekly && !!e.dayOfWeek, p = e.repeat === s.Custom ? u(e.daysOfWeek ?? []) : [], m = e.repeat === s.Monthly && !!e.dayOfMonth, h = f ? e.dayOfWeek : p[0];
23
- if (h !== void 0) {
24
- let e = (a(Number(h)) - d.getDay() + 7) % 7;
25
- d.setDate(d.getDate() + e);
26
- }
27
- let g = {
28
- hour: String(d.getUTCHours()),
29
- minute: String(d.getUTCMinutes())
11
+ ]), s = "UTC", c = /^[0-6]$/, l = /^\d+$/, u = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2}))?/, d = 10, f = 16, p = (e) => [...e].sort((e, t) => Number(e) - Number(t)), m = "09:00", h = (e) => {
12
+ if (e.repeat === r.Hourly) return {
13
+ hour: "*",
14
+ minute: String(Number(e.minute))
30
15
  };
31
- if (f && (g.day_of_week = String(o(d.getUTCDay()))), m && (g.day = i(Number(e.dayOfMonth), n(d))), p.length) {
32
- let e = n(d);
33
- g.day_of_week = u(p.map((t) => String((Number(t) + e + 7) % 7))).join(",");
16
+ let [t, n] = e.time.split(":"), i = {
17
+ hour: String(Number(t)),
18
+ minute: String(Number(n))
19
+ };
20
+ if (e.repeat === r.Weekly && e.dayOfWeek && (i.day_of_week = e.dayOfWeek), e.repeat === r.Monthly && e.dayOfMonth && (i.day = String(Number(e.dayOfMonth))), e.repeat === r.Custom) {
21
+ let t = p(e.daysOfWeek ?? []);
22
+ t.length && (i.day_of_week = t.join(","));
34
23
  }
35
- return g;
36
- }, p = (e, t) => {
37
- let [n, r, i] = e.split("-").map(Number), a = new Date(n, r - 1, i);
38
- return t === "start" ? a.setHours(0, 0, 0, 0) : a.setHours(23, 59, 59, 999), a.toISOString();
39
- }, m = (e) => {
40
- let t = e.repeat === s.OneTime ? { date: new Date(e.runAt ?? "").toISOString() } : { cron: {
41
- fields: f(e),
42
- ...e.startDate ? { startDate: p(e.startDate, "start") } : {},
43
- ...e.endDate ? { endDate: p(e.endDate, "end") } : {}
24
+ return i;
25
+ }, g = (e, t) => t === "start" ? `${e}T00:00:00.000` : `${e}T23:59:59.999`, _ = (e) => {
26
+ let t = u.exec(e);
27
+ return t ? `${t[1]}:${t[2] ?? "00"}` : e;
28
+ }, v = (e) => {
29
+ let t = e.repeat === r.OneTime ? { date: _(e.runAt ?? "") } : { cron: {
30
+ fields: h(e),
31
+ ...e.startDate ? { startDate: g(e.startDate, "start") } : {},
32
+ ...e.endDate ? { endDate: g(e.endDate, "end") } : {}
44
33
  } }, n = e.description?.trim();
45
34
  return {
46
35
  displayName: e.displayName.trim(),
47
36
  trigger: t,
37
+ timezone: e.timezone,
48
38
  model: e.modelId,
49
39
  prompt: e.prompt.trim(),
50
40
  ...e.skillUrls?.length ? { skillUrls: [...new Set(e.skillUrls)] } : {},
51
41
  ...n ? { description: n } : {}
52
42
  };
53
- }, h = (e) => ({
54
- ...m(e),
43
+ }, y = (e) => ({
44
+ ...v(e),
55
45
  skillUrls: [...new Set(e.skillUrls ?? [])]
56
- }), g = (t) => {
57
- let n = new Date(t);
58
- return `${n.getFullYear()}-${e(n.getMonth() + 1)}-${e(n.getDate())}T${e(n.getHours())}:${e(n.getMinutes())}`;
59
- }, _ = (t) => {
60
- let n = new Date(t);
61
- return `${n.getFullYear()}-${e(n.getMonth() + 1)}-${e(n.getDate())}`;
62
- }, v = (t) => {
63
- let i = new Set(Object.entries(t).filter(([, e]) => e != null).map(([e]) => e)), s = [...i].filter((e) => !c.has(e)), d = i.has("day_of_week"), f = i.has("day");
64
- if (s.length > 0 || d && f || !i.has("hour") || !i.has("minute")) return { ok: !1 };
65
- if (t.hour === "*" && /^\d+$/.test(String(t.minute)) && !d && !f) {
66
- let e = /* @__PURE__ */ new Date();
67
- return e.setUTCHours(0, Number(t.minute), 0, 0), {
68
- ok: !0,
69
- isHourly: !0,
70
- minute: String(e.getMinutes())
71
- };
72
- }
73
- let p = Number(t.hour), m = Number(t.minute);
74
- if (Number.isNaN(p) || Number.isNaN(m)) return { ok: !1 };
75
- let h = /* @__PURE__ */ new Date();
76
- h.setUTCHours(p, m, 0, 0);
77
- let g = d ? String(t.day_of_week).split(",") : [];
78
- if (g.some((e) => !l.test(e)) || new Set(g).size !== g.length) return { ok: !1 };
79
- if (g.length) {
80
- let e = (a(Number(g[0])) - h.getUTCDay() + 7) % 7;
81
- h.setUTCDate(h.getUTCDate() + e);
82
- }
83
- let _ = `${e(h.getHours())}:${e(h.getMinutes())}`;
84
- if (g.length > 1) {
85
- let e = n(h);
86
- return {
87
- ok: !0,
88
- isHourly: !1,
89
- isCustom: !0,
90
- time: _,
91
- daysOfWeek: u(g.map((t) => String((Number(t) - e + 7) % 7)))
92
- };
93
- }
94
- let v = f ? r(String(t.day), n(h)) : void 0;
95
- return f && !v ? { ok: !1 } : {
46
+ }), b = (e, t) => a(e) ? i(e, t) ?? e.slice(0, f) : e.slice(0, f), x = (e, t) => b(e, t).slice(0, d), S = (t) => {
47
+ let n = new Set(Object.entries(t).filter(([, e]) => e != null).map(([e]) => e)), r = [...n].filter((e) => !o.has(e)), i = n.has("day_of_week"), a = n.has("day");
48
+ if (r.length > 0 || i && a || !n.has("hour") || !n.has("minute")) return { ok: !1 };
49
+ if (t.hour === "*" && l.test(String(t.minute)) && !i && !a) return {
50
+ ok: !0,
51
+ isHourly: !0,
52
+ minute: String(Number(t.minute))
53
+ };
54
+ if (!l.test(String(t.hour)) || !l.test(String(t.minute))) return { ok: !1 };
55
+ let s = `${e(Number(t.hour))}:${e(Number(t.minute))}`, u = i ? String(t.day_of_week).split(",") : [];
56
+ if (u.some((e) => !c.test(e)) || new Set(u).size !== u.length) return { ok: !1 };
57
+ if (u.length > 1) return {
96
58
  ok: !0,
97
59
  isHourly: !1,
98
- time: _,
99
- ...d ? { dayOfWeek: String(o(h.getDay())) } : {},
100
- ...v ? { dayOfMonth: v } : {}
60
+ isCustom: !0,
61
+ time: s,
62
+ daysOfWeek: p(u)
101
63
  };
102
- }, y = (e) => {
64
+ let d = a ? String(t.day) : void 0;
65
+ return d !== void 0 && (!l.test(d) || Number(d) < 1 || Number(d) > 31) ? { ok: !1 } : {
66
+ ok: !0,
67
+ isHourly: !1,
68
+ time: s,
69
+ ...u.length ? { dayOfWeek: u[0] } : {},
70
+ ...d ? { dayOfMonth: String(Number(d)) } : {}
71
+ };
72
+ }, C = (e) => {
103
73
  if (!e.model || typeof e.prompt != "string" || !e.prompt.trim() && !e.skillUrls?.length) return {
104
74
  ok: !1,
105
75
  reason: t.MissingRequiredFields
106
76
  };
107
- let { date: n, cron: r } = e.trigger, i = !!n;
108
- if (i === !!r) return {
77
+ let { date: i, cron: a } = e.trigger, o = !!i;
78
+ if (o === !!a) return {
109
79
  ok: !1,
110
80
  reason: t.UnsupportedTriggerType
111
81
  };
112
- let a = {
82
+ let c = e.timezone || s;
83
+ if (!n(c)) return {
84
+ ok: !1,
85
+ reason: t.UnsupportedTriggerType
86
+ };
87
+ let l = {
113
88
  displayName: e.displayName,
114
89
  modelId: e.model,
115
90
  prompt: e.prompt,
116
91
  skillUrls: [...new Set(e.skillUrls ?? [])],
92
+ timezone: c,
117
93
  ...e.description ? { description: e.description } : {}
118
94
  };
119
- if (i) return {
95
+ if (o) return {
120
96
  ok: !0,
121
97
  values: {
122
- ...a,
123
- repeat: s.OneTime,
124
- runAt: g(n),
125
- time: d
98
+ ...l,
99
+ repeat: r.OneTime,
100
+ runAt: b(i, c),
101
+ time: m
126
102
  }
127
103
  };
128
- if (!r) return {
104
+ if (!a) return {
129
105
  ok: !1,
130
106
  reason: t.UnsupportedTriggerType
131
107
  };
132
- let o = v(r.fields);
133
- if (!o.ok) return {
108
+ let u = S(a.fields);
109
+ if (!u.ok) return {
134
110
  ok: !1,
135
111
  reason: t.UnsupportedCronShape
136
112
  };
137
- if (o.isHourly) return {
113
+ let d = {
114
+ ...a.startDate ? { startDate: x(a.startDate, c) } : {},
115
+ ...a.endDate ? { endDate: x(a.endDate, c) } : {}
116
+ };
117
+ if (u.isHourly) return {
138
118
  ok: !0,
139
119
  values: {
140
- ...a,
141
- repeat: s.Hourly,
142
- time: d,
143
- minute: o.minute,
144
- ...r.startDate ? { startDate: _(r.startDate) } : {},
145
- ...r.endDate ? { endDate: _(r.endDate) } : {}
120
+ ...l,
121
+ repeat: r.Hourly,
122
+ time: m,
123
+ minute: u.minute,
124
+ ...d
146
125
  }
147
126
  };
148
- if (o.isCustom) return {
127
+ if (u.isCustom) return {
149
128
  ok: !0,
150
129
  values: {
151
- ...a,
152
- repeat: s.Custom,
153
- time: o.time,
154
- daysOfWeek: o.daysOfWeek,
155
- ...r.startDate ? { startDate: _(r.startDate) } : {},
156
- ...r.endDate ? { endDate: _(r.endDate) } : {}
130
+ ...l,
131
+ repeat: r.Custom,
132
+ time: u.time,
133
+ daysOfWeek: u.daysOfWeek,
134
+ ...d
157
135
  }
158
136
  };
159
- let c = s.Daily;
160
- return o.dayOfWeek ? c = s.Weekly : o.dayOfMonth && (c = s.Monthly), {
137
+ let f = r.Daily;
138
+ return u.dayOfWeek ? f = r.Weekly : u.dayOfMonth && (f = r.Monthly), {
161
139
  ok: !0,
162
140
  values: {
163
- ...a,
164
- repeat: c,
165
- time: o.time,
166
- ...o.dayOfWeek ? { dayOfWeek: o.dayOfWeek } : {},
167
- ...o.dayOfMonth ? { dayOfMonth: o.dayOfMonth } : {},
168
- ...r.startDate ? { startDate: _(r.startDate) } : {},
169
- ...r.endDate ? { endDate: _(r.endDate) } : {}
141
+ ...l,
142
+ repeat: f,
143
+ time: u.time,
144
+ ...u.dayOfWeek ? { dayOfWeek: u.dayOfWeek } : {},
145
+ ...u.dayOfMonth ? { dayOfMonth: u.dayOfMonth } : {},
146
+ ...d
170
147
  }
171
148
  };
172
149
  };
173
150
  //#endregion
174
- export { m as mapFormValuesToCreateBody, h as mapFormValuesToUpdateBody, y as mapScheduledTaskDtoToFormValues };
151
+ export { v as mapFormValuesToCreateBody, y as mapFormValuesToUpdateBody, C as mapScheduledTaskDtoToFormValues };
@@ -1,15 +1,16 @@
1
1
  import { UnsupportedTriggerReason as e } from "./scheduled-task/scheduled-task-mapping.js";
2
2
  import { ScheduledTaskTriggerDescriptionKind as t, describeScheduledTaskTrigger as n } from "./scheduled-task/scheduled-task-description.js";
3
- import { ScheduledTaskDeleteErrorKind as r, classifyScheduledTaskDeleteError as i, formatScheduledTaskRunDuration as a, formatScheduledTaskRunTimestamp as o, formatScheduledTaskScheduleLabel as s, selectScheduledTaskErrorMessage as c, toScheduledTaskItem as l, toScheduledTaskItems as u, toScheduledTaskRunItem as d, toScheduledTaskRunItems as f } from "./scheduled-task/scheduled-task-display.js";
4
- import { mapFormValuesToCreateBody as p, mapFormValuesToUpdateBody as m, mapScheduledTaskDtoToFormValues as h } from "./scheduled-task/scheduled-task-trigger.js";
5
- import { prepareScheduledTaskCreateBody as g, prepareScheduledTaskUpdateBody as _ } from "./scheduled-task/scheduled-task-preparation.js";
6
- import { createScheduledTasksApiClient as v } from "./scheduled-task/scheduled-tasks-api-client.js";
7
- import { useScheduledTasks as y } from "./scheduled-task/use-scheduled-tasks.js";
8
- import { mergeRunsById as b, useScheduledTaskRuns as x } from "./scheduled-task/use-scheduled-task-runs.js";
9
- import { ScheduledTaskRunStatusFeedback as S, mergeScheduledTaskRuns as C, useStartScheduledTask as w } from "./scheduled-task/useStartScheduledTask.js";
10
- import { getNextCronOccurrence as T } from "./scheduled-task/scheduled-task-next-occurrence.js";
11
- import { checkScheduledTaskAuthSessionError as E } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
12
- import { useScheduledTaskSkillDisplayNames as D } from "./scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js";
13
- import { ActiveScheduledTaskDetailState as O, ActiveScheduledTaskStatus as k, resolveActiveScheduledTask as A } from "./scheduled-task/active-scheduled-task.js";
14
- import { useActiveScheduledTaskDetails as j } from "./scheduled-task/useActiveScheduledTaskDetails.js";
15
- export { O as ActiveScheduledTaskDetailState, k as ActiveScheduledTaskStatus, r as ScheduledTaskDeleteErrorKind, S as ScheduledTaskRunStatusFeedback, t as ScheduledTaskTriggerDescriptionKind, e as UnsupportedTriggerReason, E as checkScheduledTaskAuthSessionError, i as classifyScheduledTaskDeleteError, v as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, a as formatScheduledTaskRunDuration, o as formatScheduledTaskRunTimestamp, s as formatScheduledTaskScheduleLabel, T as getNextCronOccurrence, p as mapFormValuesToCreateBody, m as mapFormValuesToUpdateBody, h as mapScheduledTaskDtoToFormValues, b as mergeRunsById, C as mergeScheduledTaskRuns, g as prepareScheduledTaskCreateBody, _ as prepareScheduledTaskUpdateBody, A as resolveActiveScheduledTask, c as selectScheduledTaskErrorMessage, l as toScheduledTaskItem, u as toScheduledTaskItems, d as toScheduledTaskRunItem, f as toScheduledTaskRunItems, j as useActiveScheduledTaskDetails, x as useScheduledTaskRuns, D as useScheduledTaskSkillDisplayNames, y as useScheduledTasks, w as useStartScheduledTask };
3
+ import { UTC_TIMEZONE_ID as r, findTimezoneOption as i, getTimezoneOptions as a, isKnownTimezone as o, isSameTimezone as s } from "./shared/timezones.js";
4
+ import { ScheduledTaskDeleteErrorKind as c, classifyScheduledTaskDeleteError as l, formatScheduledTaskRunDuration as u, formatScheduledTaskRunTimestamp as d, formatScheduledTaskScheduleLabel as f, formatScheduledTaskTriggerTime as p, formatZonedDateTime as m, selectScheduledTaskErrorMessage as h, toScheduledTaskItem as g, toScheduledTaskItems as _, toScheduledTaskRunItem as v, toScheduledTaskRunItems as y } from "./scheduled-task/scheduled-task-display.js";
5
+ import { mapFormValuesToCreateBody as b, mapFormValuesToUpdateBody as x, mapScheduledTaskDtoToFormValues as S } from "./scheduled-task/scheduled-task-trigger.js";
6
+ import { prepareScheduledTaskCreateBody as C, prepareScheduledTaskUpdateBody as w } from "./scheduled-task/scheduled-task-preparation.js";
7
+ import { createScheduledTasksApiClient as T } from "./scheduled-task/scheduled-tasks-api-client.js";
8
+ import { useScheduledTasks as E } from "./scheduled-task/use-scheduled-tasks.js";
9
+ import { mergeRunsById as D, useScheduledTaskRuns as O } from "./scheduled-task/use-scheduled-task-runs.js";
10
+ import { ScheduledTaskRunStatusFeedback as k, mergeScheduledTaskRuns as A, useStartScheduledTask as j } from "./scheduled-task/useStartScheduledTask.js";
11
+ import { getNextCronOccurrence as M } from "./scheduled-task/scheduled-task-next-occurrence.js";
12
+ import { checkScheduledTaskAuthSessionError as N } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
13
+ import { useScheduledTaskSkillDisplayNames as P } from "./scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js";
14
+ import { ActiveScheduledTaskDetailState as F, ActiveScheduledTaskStatus as I, resolveActiveScheduledTask as L } from "./scheduled-task/active-scheduled-task.js";
15
+ import { useActiveScheduledTaskDetails as R } from "./scheduled-task/useActiveScheduledTaskDetails.js";
16
+ export { F as ActiveScheduledTaskDetailState, I as ActiveScheduledTaskStatus, c as ScheduledTaskDeleteErrorKind, k as ScheduledTaskRunStatusFeedback, t as ScheduledTaskTriggerDescriptionKind, r as UTC_TIMEZONE_ID, e as UnsupportedTriggerReason, N as checkScheduledTaskAuthSessionError, l as classifyScheduledTaskDeleteError, T as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, i as findTimezoneOption, u as formatScheduledTaskRunDuration, d as formatScheduledTaskRunTimestamp, f as formatScheduledTaskScheduleLabel, p as formatScheduledTaskTriggerTime, m as formatZonedDateTime, M as getNextCronOccurrence, a as getTimezoneOptions, o as isKnownTimezone, s as isSameTimezone, b as mapFormValuesToCreateBody, x as mapFormValuesToUpdateBody, S as mapScheduledTaskDtoToFormValues, D as mergeRunsById, A as mergeScheduledTaskRuns, C as prepareScheduledTaskCreateBody, w as prepareScheduledTaskUpdateBody, L as resolveActiveScheduledTask, h as selectScheduledTaskErrorMessage, g as toScheduledTaskItem, _ as toScheduledTaskItems, v as toScheduledTaskRunItem, y as toScheduledTaskRunItems, R as useActiveScheduledTaskDetails, O as useScheduledTaskRuns, P as useScheduledTaskSkillDisplayNames, E as useScheduledTasks, j as useStartScheduledTask };
@@ -0,0 +1,30 @@
1
+ import { ScheduledTaskTimezoneOption } from '@epam/ai-dial-scheduled-tasks';
2
+ /** Zone every task falls back to and the one engines may leave out of their supported list. */
3
+ export declare const UTC_TIMEZONE_ID = "UTC";
4
+ /** Options of {@link getTimezoneOptions}. */
5
+ export interface GetTimezoneOptionsParams {
6
+ /** Moment the offsets and the current abbreviation are read at. Defaults to now. */
7
+ now?: Date;
8
+ /** BCP 47 locale the abbreviations are written in. Defaults to the platform default. */
9
+ locale?: string;
10
+ }
11
+ /** True when the identifier looks like an IANA id and `Intl` can format in it; an unknown name, an offset such as `+02:00` or an empty string is not a zone. */
12
+ export declare const isKnownTimezone: (timezone: string) => boolean;
13
+ /** True when both identifiers name the same zone once legacy names are resolved (`Europe/Kiev` and `Europe/Kyiv`). */
14
+ export declare const isSameTimezone: (a: string, b: string) => boolean;
15
+ /**
16
+ * Returns every selectable IANA zone as a picker row, sorted by UTC offset and
17
+ * then by identifier. Offsets and the abbreviation are read at `now`; the
18
+ * abbreviation falls back to English (`CET`) where the locale gives none. Search
19
+ * terms also carry the January and July abbreviations and the long names
20
+ * (`Central European Time`), so `CEST` or a region name is found in any month;
21
+ * they are computed when a row's `searchTerms` is first read.
22
+ */
23
+ export declare const getTimezoneOptions: ({ now, locale, }?: GetTimezoneOptionsParams) => ScheduledTaskTimezoneOption[];
24
+ /**
25
+ * Finds the option naming the same zone as `timezone`: an exact id match, else
26
+ * the option for its canonical form, so a browser reporting `Asia/Calcutta`
27
+ * still lands on the listed `Asia/Kolkata` row. Returns `undefined` when none.
28
+ */
29
+ export declare const findTimezoneOption: (options: readonly ScheduledTaskTimezoneOption[], timezone: string | undefined) => ScheduledTaskTimezoneOption | undefined;
30
+ //# sourceMappingURL=timezones.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timezones.d.ts","sourceRoot":"","sources":["../../src/shared/timezones.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,+FAA+F;AAC/F,eAAO,MAAM,eAAe,QAAQ,CAAC;AA6BrC,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,oFAAoF;IACpF,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2DD,gKAAgK;AAChK,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,OACc,CAAC;AAoBlE,sHAAsH;AACtH,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OACR,CAAC;AAiG/C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,mBAGhC,wBAA6B,KAAG,2BAA2B,EAyC7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,SAAS,2BAA2B,EAAE,EAC/C,UAAU,MAAM,GAAG,SAAS,KAC3B,2BAA2B,GAAG,SAMhC,CAAC"}