@epam/ai-dial-chat-hooks 1.4.0-dev.12 → 1.4.0-dev.122

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 (189) 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 +22 -1
  8. package/catalog/create-publish-api.d.ts.map +1 -1
  9. package/catalog/create-publish-api.js +20 -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 +7 -3
  47. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
  48. package/catalog/useResourceSavePanel/useResourceSavePanel.js +107 -97
  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 +18 -0
  101. package/files/dial-file.d.ts.map +1 -1
  102. package/files/dial-file.js +30 -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 +64 -0
  109. package/org-units/org-unit-guards.d.ts.map +1 -0
  110. package/org-units/org-unit-guards.js +28 -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-sharing-client.d.ts +8 -0
  122. package/project/project-sharing-client.d.ts.map +1 -0
  123. package/project/project-sharing-client.js +11 -0
  124. package/project/project-sharing.d.ts +28 -0
  125. package/project/project-sharing.d.ts.map +1 -0
  126. package/project/project-sharing.js +22 -0
  127. package/project/use-pinned-project-chats.d.ts +4 -2
  128. package/project/use-pinned-project-chats.d.ts.map +1 -1
  129. package/project/use-pinned-project-chats.js +152 -96
  130. package/project/use-project-conversations.d.ts.map +1 -1
  131. package/project/use-project-conversations.js +2 -2
  132. package/project/use-project-remove-from-list.d.ts +30 -0
  133. package/project/use-project-remove-from-list.d.ts.map +1 -0
  134. package/project/use-project-remove-from-list.js +39 -0
  135. package/project/use-project-revoke-access.d.ts +15 -0
  136. package/project/use-project-revoke-access.d.ts.map +1 -0
  137. package/project/use-project-revoke-access.js +32 -0
  138. package/project/use-project-share-recipients.d.ts +7 -0
  139. package/project/use-project-share-recipients.d.ts.map +1 -0
  140. package/project/use-project-share-recipients.js +36 -0
  141. package/project/use-projects.d.ts +1 -0
  142. package/project/use-projects.d.ts.map +1 -1
  143. package/project/use-projects.js +2 -1
  144. package/project.js +7 -2
  145. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  146. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  147. package/scheduled-task/scheduled-task-description.js +39 -55
  148. package/scheduled-task/scheduled-task-display.d.ts +20 -6
  149. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  150. package/scheduled-task/scheduled-task-display.js +39 -43
  151. package/scheduled-task/scheduled-task-next-occurrence.d.ts +9 -5
  152. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  153. package/scheduled-task/scheduled-task-next-occurrence.js +16 -16
  154. package/scheduled-task/scheduled-task-time-format.d.ts +34 -0
  155. package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
  156. package/scheduled-task/scheduled-task-time-format.js +33 -0
  157. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  158. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  159. package/scheduled-task/scheduled-task-trigger.js +92 -115
  160. package/scheduled-tasks.js +15 -13
  161. package/shared/timezones.d.ts +30 -0
  162. package/shared/timezones.d.ts.map +1 -0
  163. package/shared/timezones.js +102 -0
  164. package/skill/skill-archive.d.ts.map +1 -1
  165. package/skill/skill-archive.js +6 -7
  166. package/skill/skill.d.ts +2 -2
  167. package/skill/skill.d.ts.map +1 -1
  168. package/skill/skill.js +33 -34
  169. package/skill/useSkillEditorLoad.js +1 -1
  170. package/skill/useSkillEditorSubmit.d.ts +4 -1
  171. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  172. package/skill/useSkillEditorSubmit.js +125 -121
  173. package/usage/map-usage-data-to-dashboard.d.ts +22 -1
  174. package/usage/map-usage-data-to-dashboard.d.ts.map +1 -1
  175. package/usage/map-usage-data-to-dashboard.js +33 -2
  176. package/usage/spending-limits-mode.d.ts +37 -0
  177. package/usage/spending-limits-mode.d.ts.map +1 -0
  178. package/usage/spending-limits-mode.js +15 -0
  179. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts +6 -2
  180. package/usage/useDeploymentUsageLimits/useDeploymentUsageLimits.d.ts.map +1 -1
  181. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts +4 -1
  182. package/usage/useUsageLimitBanner/useUsageLimitBanner.d.ts.map +1 -1
  183. package/usage/useUsageLimitBanner/useUsageLimitBanner.js +55 -47
  184. package/usage-limits.js +6 -5
  185. package/usage.js +3 -3
  186. package/utils.js +27 -21
  187. package/shared/cron-day-of-month.d.ts +0 -21
  188. package/shared/cron-day-of-month.d.ts.map +0 -1
  189. 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,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,14 @@ 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;
49
+ /** Appends the task's zone even when it equals the viewer's zone. Needs `labels.withTimezone`. Defaults to `false`. */
50
+ alwaysShowTimezone?: boolean;
47
51
  }
48
52
  /** Inputs for formatting a run's start time. */
49
53
  export interface ScheduledTaskRunTimestampOptions {
@@ -85,8 +89,18 @@ export declare enum ScheduledTaskDeleteErrorKind {
85
89
  /** Any other failure. */
86
90
  Generic = "generic"
87
91
  }
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;
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, alwaysShowTimezone, }?: 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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AO,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,65 @@
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 { SCHEDULED_TASK_WALL_DATE_TIME_PATTERN as r, formatScheduledTaskClockTime as i, formatScheduledTaskRunDate as a, formatScheduledTaskRunTime as o, formatScheduledTaskWeekdays as s, formatZonedDateTime as c } from "./scheduled-task-time-format.js";
4
+ import { ScheduledTaskErrorCode as l, ScheduledTaskRunDtoStatusEnum as u } from "@epam/ai-dial-chat-api-client";
5
+ import { ScheduledTaskRunStatus as d, instantToZonedDateTime as f, isAbsoluteInstant as p } from "@epam/ai-dial-scheduled-tasks";
4
6
  //#region src/scheduled-task/scheduled-task-display.ts
5
- var a = /* @__PURE__ */ function(e) {
7
+ var m = /* @__PURE__ */ function(e) {
6
8
  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;
9
+ }({}), h = 60, g = 3600, _ = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), v = (e, t, n) => {
10
+ let i = p(e) ? f(e, t) : e.slice(0, 16);
11
+ return !i || !r.test(i) ? e : c(i, n);
12
+ }, y = (r, a, { locale: o, browserTimezone: l = Intl.DateTimeFormat().resolvedOptions().timeZone, alwaysShowTimezone: u = !1 } = {}) => {
13
+ let d = r.timezone || "UTC", f = t(r.trigger, { timezone: d }), p = f.time ?? "", m = i(p, o), h = (e) => a.withTimezone && (u || !n(d, l)) ? a.withTimezone(e, d) : e;
14
+ switch (f.kind) {
15
+ case e.OneTime: return h(a.onceAt(c(f.dateTime ?? "", o)));
16
+ case e.EveryNMinutes: return a.everyNMinutes(f.intervalMinutes ?? 0);
17
+ case e.Hourly: return h(a.hourlyAt(p));
18
+ case e.Daily: return h(a.dailyAt(m));
19
+ case e.Weekly: return h(a.weeklyAt(s(f.daysOfWeek ?? [f.dayOfWeek ?? ""], o), m));
20
+ case e.Monthly: return h(a.monthlyAt(f.dayOfMonth ?? "", m));
21
+ case e.Invalid: return a.invalid;
22
+ default: return a.recurringFallback;
24
23
  }
25
- }, f = (e, t, n) => ({
24
+ }, b = (e, t, n) => ({
26
25
  id: e.id,
27
26
  displayName: e.displayName,
28
27
  descriptionPreview: e.description,
29
- scheduleLabel: d(e, t, n),
28
+ scheduleLabel: y(e, t, n),
30
29
  isActive: e.isActive,
31
30
  isCompleted: e.isCompleted
32
- }), p = (e, t, n) => e.map((e) => f(e, t, n)), m = (e, t) => {
31
+ }), x = (e, t, n) => e.map((e) => b(e, t, n)), S = (e, t) => {
33
32
  if (e == null) return;
34
33
  let n = [
35
- [Math.floor(e / s), t.hours],
36
- [Math.floor(e % s / o), t.minutes],
37
- [e % o, t.seconds]
34
+ [Math.floor(e / g), t.hours],
35
+ [Math.floor(e % g / h), t.minutes],
36
+ [e % h, t.seconds]
38
37
  ].filter(([e]) => e > 0).map(([e, t]) => t(e));
39
38
  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) => {
39
+ }, C = (e, t, n, { durationLabels: r, locale: i, now: s = /* @__PURE__ */ new Date() } = {}) => {
40
+ let c = new Date(e), l = o(c, i), u = _(c, s) ? n.todayAt(l) : n.dateAt(a(c, i), l), d = r ? S(t, r) : void 0;
41
+ return d ? `${u} ${d}` : u;
42
+ }, w = (e) => {
47
43
  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;
44
+ case u.Success: return d.Success;
45
+ case u.Error: return d.Error;
46
+ case u.InProgress: return d.InProgress;
47
+ default: return d.Missed;
52
48
  }
53
- }, _ = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
49
+ }, T = (e, { timestampLabels: t, durationLabels: n, conversations: r, conversationIdsMatch: i, locale: a, now: o }) => {
54
50
  let { conversationId: s } = e, c = s ? r.find((e) => i(e.id, s)) : void 0;
55
51
  return {
56
52
  id: e.id,
57
- status: g(e.status),
58
- timestampLabel: h(e.startTime, void 0, t, {
53
+ status: w(e.status),
54
+ timestampLabel: C(e.startTime, void 0, t, {
59
55
  locale: a,
60
56
  now: o
61
57
  }),
62
- durationLabel: m(e.durationSeconds, n),
58
+ durationLabel: S(e.durationSeconds, n),
63
59
  conversationId: s,
64
60
  isUnread: c?.isUnread === !0,
65
61
  errorText: e.errorText
66
62
  };
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;
63
+ }, E = (e, t) => e.map((e) => T(e, t)), D = (e) => e === 404 || e === 409 ? "notFound" : e === 502 ? "retryable" : "generic", O = (e, { adminConsentRequired: t, fallback: n }) => e.code === l.ScheduledTaskAdminConsentRequired ? t : e.upstreamMessage?.trim() || n;
68
64
  //#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 };
65
+ export { m as ScheduledTaskDeleteErrorKind, D as classifyScheduledTaskDeleteError, S as formatScheduledTaskRunDuration, C as formatScheduledTaskRunTimestamp, y as formatScheduledTaskScheduleLabel, v as formatScheduledTaskTriggerTime, O as selectScheduledTaskErrorMessage, b as toScheduledTaskItem, x as toScheduledTaskItems, T as toScheduledTaskRunItem, E 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,34 @@
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 the viewer's zone. Returns the raw value when it is
19
+ * not a date.
20
+ */
21
+ export declare const formatScheduledTaskInstant: (instant: string, locale?: string) => string;
22
+ /** Formats the time of day of an instant as the locale's short time in the viewer's zone, e.g. `11:00 AM`. */
23
+ export declare const formatScheduledTaskRunTime: (date: Date, locale?: string) => string;
24
+ /** Formats the calendar day of an instant without a year in the viewer's zone, e.g. `Nov 17`. */
25
+ export declare const formatScheduledTaskRunDate: (date: Date, locale?: string) => string;
26
+ /**
27
+ * Formats an APScheduler weekday (`'0'` is Monday) as its localized name.
28
+ * 2023-01-02 was a Monday and the formatter runs in UTC, so the name is the
29
+ * segment's own day, not the viewer's local calendar's.
30
+ */
31
+ export declare const formatScheduledTaskWeekday: (dayOfWeek: string | number | undefined, locale?: string, style?: ScheduledTaskWeekdayStyle) => string;
32
+ /** Formats several APScheduler weekdays as one locale list, e.g. `Monday, Wednesday and Friday`. */
33
+ export declare const formatScheduledTaskWeekdays: (daysOfWeek: string[], locale?: string) => string;
34
+ //# 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;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GACrC,SAAS,MAAM,EACf,SAAS,MAAM,KACd,MASF,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,33 @@
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) => {
17
+ try {
18
+ return new Intl.DateTimeFormat(t, {
19
+ dateStyle: "medium",
20
+ timeStyle: "short"
21
+ }).format(new Date(e));
22
+ } catch {
23
+ return e;
24
+ }
25
+ }, o = (e, t) => new Intl.DateTimeFormat(t, { timeStyle: "short" }).format(e), s = (e, t) => new Intl.DateTimeFormat(t, {
26
+ month: "short",
27
+ day: "numeric"
28
+ }).format(e), c = (e, t, n = "long") => new Intl.DateTimeFormat(t, {
29
+ weekday: n,
30
+ timeZone: "UTC"
31
+ }).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)));
32
+ //#endregion
33
+ 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
  /**
@@ -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"}