@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.
Files changed (190) hide show
  1. package/api-error/map-api-error.d.ts +10 -0
  2. package/api-error/map-api-error.d.ts.map +1 -0
  3. package/api-error/map-api-error.js +11 -0
  4. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  5. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  6. package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
  7. package/catalog/create-publish-api.d.ts +28 -1
  8. package/catalog/create-publish-api.d.ts.map +1 -1
  9. package/catalog/create-publish-api.js +21 -1
  10. package/catalog/entity-details.d.ts +5 -2
  11. package/catalog/entity-details.d.ts.map +1 -1
  12. package/catalog/map-entity-details-to-catalog.d.ts +4 -0
  13. package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
  14. package/catalog/map-entity-details-to-catalog.js +15 -13
  15. package/catalog/publish-dependency-icons.d.ts +22 -0
  16. package/catalog/publish-dependency-icons.d.ts.map +1 -0
  17. package/catalog/publish-dependency-icons.js +11 -0
  18. package/catalog/publish-target-taken.d.ts +31 -0
  19. package/catalog/publish-target-taken.d.ts.map +1 -0
  20. package/catalog/publish-target-taken.js +14 -0
  21. package/catalog/publish.d.ts +15 -2
  22. package/catalog/publish.d.ts.map +1 -1
  23. package/catalog/publish.js +15 -4
  24. package/catalog/resource-name-conflict.d.ts.map +1 -1
  25. package/catalog/resource-name-conflict.js +19 -22
  26. package/catalog/resource-save-adapter.d.ts +7 -2
  27. package/catalog/resource-save-adapter.d.ts.map +1 -1
  28. package/catalog/resource-save-adapters.d.ts +32 -7
  29. package/catalog/resource-save-adapters.d.ts.map +1 -1
  30. package/catalog/resource-save-adapters.js +47 -41
  31. package/catalog/resource-save.d.ts +17 -9
  32. package/catalog/resource-save.d.ts.map +1 -1
  33. package/catalog/resource-save.js +34 -25
  34. package/catalog/save-destination-root.d.ts +12 -0
  35. package/catalog/save-destination-root.d.ts.map +1 -0
  36. package/catalog/save-destination-root.js +6 -0
  37. package/catalog/use-publish-dependencies.d.ts +19 -0
  38. package/catalog/use-publish-dependencies.d.ts.map +1 -0
  39. package/catalog/use-publish-dependencies.js +25 -0
  40. package/catalog/use-publish-target-guard.d.ts +45 -0
  41. package/catalog/use-publish-target-guard.d.ts.map +1 -0
  42. package/catalog/use-publish-target-guard.js +18 -0
  43. package/catalog/usePublishFolders/usePublishFolders.d.ts +8 -2
  44. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  45. package/catalog/usePublishFolders/usePublishFolders.js +29 -29
  46. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +27 -6
  47. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
  48. package/catalog/useResourceSavePanel/useResourceSavePanel.js +184 -118
  49. package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
  50. package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
  51. package/catalog/useVersionHistory/useVersionHistory.js +49 -0
  52. package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
  53. package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
  54. package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
  55. package/catalog/version-history.d.ts +42 -0
  56. package/catalog/version-history.d.ts.map +1 -0
  57. package/catalog/version-history.js +27 -0
  58. package/catalog.js +39 -31
  59. package/conversation/announcement-message.d.ts +12 -0
  60. package/conversation/announcement-message.d.ts.map +1 -1
  61. package/conversation/announcement-message.js +16 -10
  62. package/conversation/conversation-list.d.ts +7 -1
  63. package/conversation/conversation-list.d.ts.map +1 -1
  64. package/conversation/conversation-list.js +11 -2
  65. package/conversation/conversation-transfer/zip-export.d.ts +1 -1
  66. package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
  67. package/conversation/conversation-transfer/zip-export.js +7 -8
  68. package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
  69. package/conversation/conversation-transfer/zip-import.js +8 -9
  70. package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
  71. package/conversation/useConversationExport/useConversationExport.js +3 -1
  72. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  73. package/conversation/useConversationStream/generation-resume.js +119 -96
  74. package/conversation.js +44 -44
  75. package/entry-points/catalog.d.ts +7 -0
  76. package/entry-points/catalog.d.ts.map +1 -1
  77. package/entry-points/file-manager.d.ts +1 -0
  78. package/entry-points/file-manager.d.ts.map +1 -1
  79. package/entry-points/project.d.ts +5 -0
  80. package/entry-points/project.d.ts.map +1 -1
  81. package/entry-points/scheduled-tasks.d.ts +2 -0
  82. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  83. package/entry-points/usage-limits.d.ts +1 -0
  84. package/entry-points/usage-limits.d.ts.map +1 -1
  85. package/entry-points/utils.d.ts +7 -0
  86. package/entry-points/utils.d.ts.map +1 -1
  87. package/file-manager.js +33 -32
  88. package/files/annotation.d.ts +3 -3
  89. package/files/annotation.d.ts.map +1 -1
  90. package/files/annotation.js +12 -11
  91. package/files/attachment-canvas.d.ts +1 -1
  92. package/files/attachment-canvas.d.ts.map +1 -1
  93. package/files/attachment-canvas.js +135 -135
  94. package/files/attachment-type-labels.d.ts +3 -0
  95. package/files/attachment-type-labels.d.ts.map +1 -0
  96. package/files/attachment-type-labels.js +12 -0
  97. package/files/attachment-types.d.ts +0 -2
  98. package/files/attachment-types.d.ts.map +1 -1
  99. package/files/attachment-types.js +7 -14
  100. package/files/dial-file.d.ts +24 -0
  101. package/files/dial-file.d.ts.map +1 -1
  102. package/files/dial-file.js +35 -5
  103. package/index.d.ts +23 -0
  104. package/index.d.ts.map +1 -1
  105. package/index.js +266 -244
  106. package/org-units/models.d.ts +11 -0
  107. package/org-units/models.d.ts.map +1 -0
  108. package/org-units/org-unit-guards.d.ts +98 -0
  109. package/org-units/org-unit-guards.d.ts.map +1 -0
  110. package/org-units/org-unit-guards.js +41 -0
  111. package/org-units/types.d.ts +14 -0
  112. package/org-units/types.d.ts.map +1 -0
  113. package/org-units/types.js +6 -0
  114. package/org-units/useFolderGuards/useFolderGuards.d.ts +31 -0
  115. package/org-units/useFolderGuards/useFolderGuards.d.ts.map +1 -0
  116. package/org-units/useFolderGuards/useFolderGuards.js +50 -0
  117. package/org-units/useOrgUnits/useOrgUnits.d.ts +34 -0
  118. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
  119. package/org-units/useOrgUnits/useOrgUnits.js +54 -0
  120. package/package.json +19 -19
  121. package/project/project-conversation-data-source.js +4 -4
  122. package/project/project-sharing-client.d.ts +8 -0
  123. package/project/project-sharing-client.d.ts.map +1 -0
  124. package/project/project-sharing-client.js +11 -0
  125. package/project/project-sharing.d.ts +28 -0
  126. package/project/project-sharing.d.ts.map +1 -0
  127. package/project/project-sharing.js +22 -0
  128. package/project/use-pinned-project-chats.d.ts +4 -2
  129. package/project/use-pinned-project-chats.d.ts.map +1 -1
  130. package/project/use-pinned-project-chats.js +152 -96
  131. package/project/use-project-conversations.d.ts.map +1 -1
  132. package/project/use-project-conversations.js +2 -2
  133. package/project/use-project-remove-from-list.d.ts +30 -0
  134. package/project/use-project-remove-from-list.d.ts.map +1 -0
  135. package/project/use-project-remove-from-list.js +39 -0
  136. package/project/use-project-revoke-access.d.ts +15 -0
  137. package/project/use-project-revoke-access.d.ts.map +1 -0
  138. package/project/use-project-revoke-access.js +32 -0
  139. package/project/use-project-share-recipients.d.ts +7 -0
  140. package/project/use-project-share-recipients.d.ts.map +1 -0
  141. package/project/use-project-share-recipients.js +36 -0
  142. package/project/use-projects.d.ts +1 -0
  143. package/project/use-projects.d.ts.map +1 -1
  144. package/project/use-projects.js +2 -1
  145. package/project.js +7 -2
  146. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  147. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  148. package/scheduled-task/scheduled-task-description.js +39 -55
  149. package/scheduled-task/scheduled-task-display.d.ts +67 -6
  150. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  151. package/scheduled-task/scheduled-task-display.js +55 -43
  152. package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -5
  153. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  154. package/scheduled-task/scheduled-task-next-occurrence.js +16 -16
  155. package/scheduled-task/scheduled-task-time-format.d.ts +36 -0
  156. package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
  157. package/scheduled-task/scheduled-task-time-format.js +34 -0
  158. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  159. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  160. package/scheduled-task/scheduled-task-trigger.js +92 -115
  161. package/scheduled-tasks.js +15 -13
  162. package/shared/timezones.d.ts +30 -0
  163. package/shared/timezones.d.ts.map +1 -0
  164. package/shared/timezones.js +102 -0
  165. package/skill/skill-archive.d.ts.map +1 -1
  166. package/skill/skill-archive.js +6 -7
  167. package/skill/skill.d.ts +2 -2
  168. package/skill/skill.d.ts.map +1 -1
  169. package/skill/skill.js +33 -34
  170. package/skill/useSkillEditorLoad.js +1 -1
  171. package/skill/useSkillEditorSubmit.d.ts +4 -1
  172. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  173. package/skill/useSkillEditorSubmit.js +125 -121
  174. package/usage/map-usage-data-to-dashboard.d.ts +22 -1
  175. package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
  176. package/usage/map-usage-data-to-dashboard.js +33 -2
  177. package/usage/spending-limits-mode.d.ts +37 -0
  178. package/usage/spending-limits-mode.d.ts.map +1 -0
  179. package/usage/spending-limits-mode.js +15 -0
  180. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +6 -2
  181. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
  182. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +4 -1
  183. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
  184. package/usage/useUsageLimitBanner/useUsageLimitBanner.js +55 -47
  185. package/usage-limits.js +6 -5
  186. package/usage.js +3 -3
  187. package/utils.js +28 -22
  188. package/shared/cron-day-of-month.d.ts +0 -21
  189. package/shared/cron-day-of-month.d.ts.map +0 -1
  190. 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 display-timezone weekday of a `Weekly` description, Monday first; `dayOfWeek` is its first entry. */
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
- date?: Date;
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
- sourceTimezone: 'utc';
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
- /** Display timezone; defaults to UTC for backwards compatibility. */
27
- timeZone?: string;
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
- * Unsupported constraints remain Custom, with the full source expression.
34
- * Calendar-month shifts crossing month boundaries or days 29–31 remain
35
- * Custom because a shifted monthly day is not equivalent around short months.
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, { timeZone, referenceDate, }?: ScheduledTaskTriggerDescriptionOptions) => ScheduledTaskTriggerDescription;
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;AAGxE,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,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,mCAAmC,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8GAA8G;IAC9G,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,sCAAsC;IACrD,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACvC,SAAS,kBAAkB,EAC3B,+BAGG,sCAA2C,KAC7C,+BAuKF,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 { CRON_LAST_DAY_OF_MONTH as e } from "../shared/cron-day-of-month.js";
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 t = /* @__PURE__ */ function(e) {
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
- }({}), n = (t, { timeZone: n = "UTC", referenceDate: r = /* @__PURE__ */ new Date() } = {}) => {
6
- let i = (e, t = {}) => ({
6
+ }({}), a = (i, { timezone: a = "UTC" } = {}) => {
7
+ let o = (e, t = {}) => ({
7
8
  kind: e,
8
- sourceTimezone: "utc",
9
+ timezone: a,
9
10
  ...t
10
11
  });
11
- if (t.date && t.cron) return i("invalid");
12
- if (t.date) {
13
- let e = new Date(t.date);
14
- return Number.isNaN(e.getTime()) ? i("invalid") : i("oneTime", { date: e });
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 a = t.cron?.fields;
17
- if (!a || Object.keys(a).length === 0) return i("invalid");
18
- let o = () => i("custom", { expression: JSON.stringify(a) }), s = {
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(a)) {
27
+ for (let [e, t] of Object.entries(s)) {
27
28
  if (t == null) continue;
28
- if (!t.trim()) return i("invalid");
29
- let n = s[e];
30
- if (n && /^-?\d+$/.test(t) && (Number(t) < n[0] || Number(t) > n[1])) return i("invalid");
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 o();
37
+ ].includes(e) && t !== "*" && (e !== "second" || t !== "0")) return c();
37
38
  }
38
- let c = a.hour, l = a.minute, u = a.day === "*" ? void 0 : a.day, d = u === e, f = a.day_of_week === "*" ? void 0 : a.day_of_week, p = [
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
- ], m = (f?.split(",") ?? []).map((e) => {
47
- let t = p.findIndex((t) => t === e.toLowerCase() || t.slice(0, 3) === e.toLowerCase());
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
- }), h = m[0];
50
- if (u && h || u && !d && !/^\d+$/.test(u) || m.some((e) => !/^[0-6]$/.test(e)) || new Set(m).size !== m.length) return o();
51
- let g = c == null || c === "*", _ = l?.match(/^\*\/(\d+)$/);
52
- if (g && _ && !u && !h) {
53
- let e = Number(_[1]);
54
- return e > 0 && e <= 59 ? i("everyNMinutes", { intervalMinutes: e }) : i("invalid");
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 (!l || !/^\d+$/.test(l) || !g && !/^\d+$/.test(c) || g && (u || h)) return o();
57
- let v = new Date(r);
58
- if (Number.isNaN(v.getTime())) return i("invalid");
59
- if (v.setUTCHours(g ? 0 : Number(c), Number(l), 0, 0), h) {
60
- let e = (Number(h) + 1) % 7;
61
- v.setUTCDate(v.getUTCDate() + (e - v.getUTCDay() + 7) % 7);
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 d ? C === 1 ? i("monthly", {
82
- time: w,
83
- dayOfMonth: "1"
84
- }) : o() : u ? C === 0 || Number(u) <= 28 && Number(u) + C >= 1 && Number(u) + C <= 28 ? i("monthly", {
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 { t as ScheduledTaskTriggerDescriptionKind, n as describeScheduledTaskTrigger };
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` (`HH:mm`). */
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 timezone used to format a schedule label. */
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 timezone the schedule is shown in. Defaults to the browser's resolved timezone. */
46
- timeZone?: string;
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
- /** 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;
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,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,QA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AOG,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;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,GACzC,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,69 +1,81 @@
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 { 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 a = /* @__PURE__ */ function(e) {
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
- }({}), o = 60, s = 3600, c = (e, t) => new Intl.DateTimeFormat(t, {
8
- weekday: "long",
9
- 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;
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
- }, f = (e, t, n) => ({
28
+ }, E = (e, t, n) => ({
26
29
  id: e.id,
27
30
  displayName: e.displayName,
28
31
  descriptionPreview: e.description,
29
- scheduleLabel: d(e, t, n),
32
+ scheduleLabel: T(e, t, n),
30
33
  isActive: e.isActive,
31
34
  isCompleted: e.isCompleted
32
- }), p = (e, t, n) => e.map((e) => f(e, t, n)), m = (e, t) => {
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 / s), t.hours],
36
- [Math.floor(e % s / o), t.minutes],
37
- [e % o, t.seconds]
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
- }, 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, {
42
- month: "short",
43
- day: "numeric"
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 r.Success: return i.Success;
49
- case r.Error: return i.Error;
50
- case r.InProgress: return i.InProgress;
51
- default: return i.Missed;
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
- }, _ = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
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: g(e.status),
58
- timestampLabel: h(e.startTime, void 0, t, {
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: m(e.durationSeconds, n),
62
+ durationLabel: O(e.durationSeconds, n),
63
63
  conversationId: s,
64
64
  isUnread: c?.isUnread === !0,
65
65
  errorText: e.errorText
66
66
  };
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;
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 { 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 };
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 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;
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;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;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 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
+ }, c = (e, t = Date.now()) => new Date(e).getTime() <= t;
19
19
  //#endregion
20
- export { r as getNextCronOccurrence };
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, 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
  /**