@epam/ai-dial-chat-hooks 1.4.0-dev.8 → 1.4.0-dev.81

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 (118) hide show
  1. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  2. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  3. package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
  4. package/catalog/create-publish-api.d.ts +9 -1
  5. package/catalog/create-publish-api.d.ts.map +1 -1
  6. package/catalog/create-publish-api.js +8 -0
  7. package/catalog/entity-details.d.ts +5 -2
  8. package/catalog/entity-details.d.ts.map +1 -1
  9. package/catalog/map-entity-details-to-catalog.d.ts +4 -0
  10. package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
  11. package/catalog/map-entity-details-to-catalog.js +15 -13
  12. package/catalog/publish-dependency-icons.d.ts +22 -0
  13. package/catalog/publish-dependency-icons.d.ts.map +1 -0
  14. package/catalog/publish-dependency-icons.js +11 -0
  15. package/catalog/publish.d.ts +15 -2
  16. package/catalog/publish.d.ts.map +1 -1
  17. package/catalog/publish.js +15 -4
  18. package/catalog/use-publish-dependencies.d.ts +19 -0
  19. package/catalog/use-publish-dependencies.d.ts.map +1 -0
  20. package/catalog/use-publish-dependencies.js +25 -0
  21. package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
  22. package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
  23. package/catalog/useVersionHistory/useVersionHistory.js +49 -0
  24. package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
  25. package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
  26. package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
  27. package/catalog/version-history.d.ts +42 -0
  28. package/catalog/version-history.d.ts.map +1 -0
  29. package/catalog/version-history.js +27 -0
  30. package/catalog.js +36 -31
  31. package/conversation/announcement-message.d.ts +12 -0
  32. package/conversation/announcement-message.d.ts.map +1 -1
  33. package/conversation/announcement-message.js +16 -10
  34. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  35. package/conversation/useConversationStream/generation-resume.js +119 -96
  36. package/conversation.js +44 -44
  37. package/entry-points/catalog.d.ts +5 -0
  38. package/entry-points/catalog.d.ts.map +1 -1
  39. package/entry-points/file-manager.d.ts +1 -0
  40. package/entry-points/file-manager.d.ts.map +1 -1
  41. package/entry-points/project.d.ts +5 -0
  42. package/entry-points/project.d.ts.map +1 -1
  43. package/entry-points/scheduled-tasks.d.ts +1 -0
  44. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  45. package/entry-points/utils.d.ts +3 -0
  46. package/entry-points/utils.d.ts.map +1 -1
  47. package/file-manager.js +33 -32
  48. package/files/annotation.d.ts +3 -3
  49. package/files/annotation.d.ts.map +1 -1
  50. package/files/annotation.js +12 -11
  51. package/files/attachment-canvas.d.ts +1 -1
  52. package/files/attachment-canvas.d.ts.map +1 -1
  53. package/files/attachment-canvas.js +135 -135
  54. package/files/attachment-type-labels.d.ts +3 -0
  55. package/files/attachment-type-labels.d.ts.map +1 -0
  56. package/files/attachment-type-labels.js +12 -0
  57. package/files/attachment-types.d.ts +0 -2
  58. package/files/attachment-types.d.ts.map +1 -1
  59. package/files/attachment-types.js +7 -14
  60. package/files/dial-file.d.ts +18 -0
  61. package/files/dial-file.d.ts.map +1 -1
  62. package/files/dial-file.js +30 -5
  63. package/index.d.ts +15 -0
  64. package/index.d.ts.map +1 -1
  65. package/index.js +255 -241
  66. package/org-units/models.d.ts +9 -0
  67. package/org-units/models.d.ts.map +1 -0
  68. package/org-units/types.d.ts +14 -0
  69. package/org-units/types.d.ts.map +1 -0
  70. package/org-units/types.js +6 -0
  71. package/org-units/useOrgUnits/useOrgUnits.d.ts +19 -0
  72. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
  73. package/org-units/useOrgUnits/useOrgUnits.js +34 -0
  74. package/package.json +19 -19
  75. package/project/project-sharing-client.d.ts +8 -0
  76. package/project/project-sharing-client.d.ts.map +1 -0
  77. package/project/project-sharing-client.js +11 -0
  78. package/project/project-sharing.d.ts +28 -0
  79. package/project/project-sharing.d.ts.map +1 -0
  80. package/project/project-sharing.js +22 -0
  81. package/project/use-pinned-project-chats.d.ts +4 -2
  82. package/project/use-pinned-project-chats.d.ts.map +1 -1
  83. package/project/use-pinned-project-chats.js +152 -96
  84. package/project/use-project-conversations.d.ts.map +1 -1
  85. package/project/use-project-conversations.js +2 -2
  86. package/project/use-project-remove-from-list.d.ts +30 -0
  87. package/project/use-project-remove-from-list.d.ts.map +1 -0
  88. package/project/use-project-remove-from-list.js +39 -0
  89. package/project/use-project-revoke-access.d.ts +15 -0
  90. package/project/use-project-revoke-access.d.ts.map +1 -0
  91. package/project/use-project-revoke-access.js +32 -0
  92. package/project/use-project-share-recipients.d.ts +7 -0
  93. package/project/use-project-share-recipients.d.ts.map +1 -0
  94. package/project/use-project-share-recipients.js +36 -0
  95. package/project/use-projects.d.ts +1 -0
  96. package/project/use-projects.d.ts.map +1 -1
  97. package/project/use-projects.js +2 -1
  98. package/project.js +7 -2
  99. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  100. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  101. package/scheduled-task/scheduled-task-description.js +39 -55
  102. package/scheduled-task/scheduled-task-display.d.ts +19 -5
  103. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  104. package/scheduled-task/scheduled-task-display.js +43 -38
  105. package/scheduled-task/scheduled-task-next-occurrence.d.ts +7 -5
  106. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  107. package/scheduled-task/scheduled-task-next-occurrence.js +15 -15
  108. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  109. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  110. package/scheduled-task/scheduled-task-trigger.js +92 -115
  111. package/scheduled-tasks.js +14 -13
  112. package/shared/timezones.d.ts +30 -0
  113. package/shared/timezones.d.ts.map +1 -0
  114. package/shared/timezones.js +102 -0
  115. package/utils.js +5 -3
  116. package/shared/cron-day-of-month.d.ts +0 -21
  117. package/shared/cron-day-of-month.d.ts.map +0 -1
  118. package/shared/cron-day-of-month.js +0 -13
@@ -1,174 +1,151 @@
1
1
  import { padTwoDigits as e } from "../shared/formatting.js";
2
2
  import { UnsupportedTriggerReason as t } from "./scheduled-task-mapping.js";
3
- import { getUtcDayShift as n, toLocalDayOfMonth as r, toUtcCronDayOfMonth as i } from "../shared/cron-day-of-month.js";
4
- import { apSchedulerDayToJsDay as a, jsDayToApSchedulerDay as o } from "../shared/cron-weekday.js";
5
- import { ScheduledTaskRepeat as s } from "@epam/ai-dial-scheduled-tasks";
3
+ import { isKnownTimezone as n } from "../shared/timezones.js";
4
+ import { ScheduledTaskRepeat as r, instantToZonedDateTime as i, isAbsoluteInstant as a } from "@epam/ai-dial-scheduled-tasks";
6
5
  //#region src/scheduled-task/scheduled-task-trigger.ts
7
- var c = /* @__PURE__ */ new Set([
6
+ var o = /* @__PURE__ */ new Set([
8
7
  "hour",
9
8
  "minute",
10
9
  "day_of_week",
11
10
  "day"
12
- ]), l = /^[0-6]$/, u = (e) => [...e].sort((e, t) => Number(e) - Number(t)), d = "09:00", f = (e) => {
13
- if (e.repeat === s.Hourly) {
14
- let t = /* @__PURE__ */ new Date();
15
- return t.setHours(0, Number(e.minute), 0, 0), {
16
- hour: "*",
17
- minute: String(t.getUTCMinutes())
18
- };
19
- }
20
- let [t, r] = e.time.split(":"), c = Number(t), l = Number(r), d = /* @__PURE__ */ new Date();
21
- d.setHours(c, l, 0, 0);
22
- let f = e.repeat === s.Weekly && !!e.dayOfWeek, p = e.repeat === s.Custom ? u(e.daysOfWeek ?? []) : [], m = e.repeat === s.Monthly && !!e.dayOfMonth, h = f ? e.dayOfWeek : p[0];
23
- if (h !== void 0) {
24
- let e = (a(Number(h)) - d.getDay() + 7) % 7;
25
- d.setDate(d.getDate() + e);
26
- }
27
- let g = {
28
- hour: String(d.getUTCHours()),
29
- minute: String(d.getUTCMinutes())
11
+ ]), s = "UTC", c = /^[0-6]$/, l = /^\d+$/, u = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2}))?/, d = 10, f = 16, p = (e) => [...e].sort((e, t) => Number(e) - Number(t)), m = "09:00", h = (e) => {
12
+ if (e.repeat === r.Hourly) return {
13
+ hour: "*",
14
+ minute: String(Number(e.minute))
30
15
  };
31
- if (f && (g.day_of_week = String(o(d.getUTCDay()))), m && (g.day = i(Number(e.dayOfMonth), n(d))), p.length) {
32
- let e = n(d);
33
- g.day_of_week = u(p.map((t) => String((Number(t) + e + 7) % 7))).join(",");
16
+ let [t, n] = e.time.split(":"), i = {
17
+ hour: String(Number(t)),
18
+ minute: String(Number(n))
19
+ };
20
+ if (e.repeat === r.Weekly && e.dayOfWeek && (i.day_of_week = e.dayOfWeek), e.repeat === r.Monthly && e.dayOfMonth && (i.day = String(Number(e.dayOfMonth))), e.repeat === r.Custom) {
21
+ let t = p(e.daysOfWeek ?? []);
22
+ t.length && (i.day_of_week = t.join(","));
34
23
  }
35
- return g;
36
- }, p = (e, t) => {
37
- let [n, r, i] = e.split("-").map(Number), a = new Date(n, r - 1, i);
38
- return t === "start" ? a.setHours(0, 0, 0, 0) : a.setHours(23, 59, 59, 999), a.toISOString();
39
- }, m = (e) => {
40
- let t = e.repeat === s.OneTime ? { date: new Date(e.runAt ?? "").toISOString() } : { cron: {
41
- fields: f(e),
42
- ...e.startDate ? { startDate: p(e.startDate, "start") } : {},
43
- ...e.endDate ? { endDate: p(e.endDate, "end") } : {}
24
+ return i;
25
+ }, g = (e, t) => t === "start" ? `${e}T00:00:00.000` : `${e}T23:59:59.999`, _ = (e) => {
26
+ let t = u.exec(e);
27
+ return t ? `${t[1]}:${t[2] ?? "00"}` : e;
28
+ }, v = (e) => {
29
+ let t = e.repeat === r.OneTime ? { date: _(e.runAt ?? "") } : { cron: {
30
+ fields: h(e),
31
+ ...e.startDate ? { startDate: g(e.startDate, "start") } : {},
32
+ ...e.endDate ? { endDate: g(e.endDate, "end") } : {}
44
33
  } }, n = e.description?.trim();
45
34
  return {
46
35
  displayName: e.displayName.trim(),
47
36
  trigger: t,
37
+ timezone: e.timezone,
48
38
  model: e.modelId,
49
39
  prompt: e.prompt.trim(),
50
40
  ...e.skillUrls?.length ? { skillUrls: [...new Set(e.skillUrls)] } : {},
51
41
  ...n ? { description: n } : {}
52
42
  };
53
- }, h = (e) => ({
54
- ...m(e),
43
+ }, y = (e) => ({
44
+ ...v(e),
55
45
  skillUrls: [...new Set(e.skillUrls ?? [])]
56
- }), g = (t) => {
57
- let n = new Date(t);
58
- return `${n.getFullYear()}-${e(n.getMonth() + 1)}-${e(n.getDate())}T${e(n.getHours())}:${e(n.getMinutes())}`;
59
- }, _ = (t) => {
60
- let n = new Date(t);
61
- return `${n.getFullYear()}-${e(n.getMonth() + 1)}-${e(n.getDate())}`;
62
- }, v = (t) => {
63
- let i = new Set(Object.entries(t).filter(([, e]) => e != null).map(([e]) => e)), s = [...i].filter((e) => !c.has(e)), d = i.has("day_of_week"), f = i.has("day");
64
- if (s.length > 0 || d && f || !i.has("hour") || !i.has("minute")) return { ok: !1 };
65
- if (t.hour === "*" && /^\d+$/.test(String(t.minute)) && !d && !f) {
66
- let e = /* @__PURE__ */ new Date();
67
- return e.setUTCHours(0, Number(t.minute), 0, 0), {
68
- ok: !0,
69
- isHourly: !0,
70
- minute: String(e.getMinutes())
71
- };
72
- }
73
- let p = Number(t.hour), m = Number(t.minute);
74
- if (Number.isNaN(p) || Number.isNaN(m)) return { ok: !1 };
75
- let h = /* @__PURE__ */ new Date();
76
- h.setUTCHours(p, m, 0, 0);
77
- let g = d ? String(t.day_of_week).split(",") : [];
78
- if (g.some((e) => !l.test(e)) || new Set(g).size !== g.length) return { ok: !1 };
79
- if (g.length) {
80
- let e = (a(Number(g[0])) - h.getUTCDay() + 7) % 7;
81
- h.setUTCDate(h.getUTCDate() + e);
82
- }
83
- let _ = `${e(h.getHours())}:${e(h.getMinutes())}`;
84
- if (g.length > 1) {
85
- let e = n(h);
86
- return {
87
- ok: !0,
88
- isHourly: !1,
89
- isCustom: !0,
90
- time: _,
91
- daysOfWeek: u(g.map((t) => String((Number(t) - e + 7) % 7)))
92
- };
93
- }
94
- let v = f ? r(String(t.day), n(h)) : void 0;
95
- return f && !v ? { ok: !1 } : {
46
+ }), b = (e, t) => a(e) ? i(e, t) ?? e.slice(0, f) : e.slice(0, f), x = (e, t) => b(e, t).slice(0, d), S = (t) => {
47
+ let n = new Set(Object.entries(t).filter(([, e]) => e != null).map(([e]) => e)), r = [...n].filter((e) => !o.has(e)), i = n.has("day_of_week"), a = n.has("day");
48
+ if (r.length > 0 || i && a || !n.has("hour") || !n.has("minute")) return { ok: !1 };
49
+ if (t.hour === "*" && l.test(String(t.minute)) && !i && !a) return {
50
+ ok: !0,
51
+ isHourly: !0,
52
+ minute: String(Number(t.minute))
53
+ };
54
+ if (!l.test(String(t.hour)) || !l.test(String(t.minute))) return { ok: !1 };
55
+ let s = `${e(Number(t.hour))}:${e(Number(t.minute))}`, u = i ? String(t.day_of_week).split(",") : [];
56
+ if (u.some((e) => !c.test(e)) || new Set(u).size !== u.length) return { ok: !1 };
57
+ if (u.length > 1) return {
96
58
  ok: !0,
97
59
  isHourly: !1,
98
- time: _,
99
- ...d ? { dayOfWeek: String(o(h.getDay())) } : {},
100
- ...v ? { dayOfMonth: v } : {}
60
+ isCustom: !0,
61
+ time: s,
62
+ daysOfWeek: p(u)
101
63
  };
102
- }, y = (e) => {
64
+ let d = a ? String(t.day) : void 0;
65
+ return d !== void 0 && (!l.test(d) || Number(d) < 1 || Number(d) > 31) ? { ok: !1 } : {
66
+ ok: !0,
67
+ isHourly: !1,
68
+ time: s,
69
+ ...u.length ? { dayOfWeek: u[0] } : {},
70
+ ...d ? { dayOfMonth: String(Number(d)) } : {}
71
+ };
72
+ }, C = (e) => {
103
73
  if (!e.model || typeof e.prompt != "string" || !e.prompt.trim() && !e.skillUrls?.length) return {
104
74
  ok: !1,
105
75
  reason: t.MissingRequiredFields
106
76
  };
107
- let { date: n, cron: r } = e.trigger, i = !!n;
108
- if (i === !!r) return {
77
+ let { date: i, cron: a } = e.trigger, o = !!i;
78
+ if (o === !!a) return {
109
79
  ok: !1,
110
80
  reason: t.UnsupportedTriggerType
111
81
  };
112
- let a = {
82
+ let c = e.timezone || s;
83
+ if (!n(c)) return {
84
+ ok: !1,
85
+ reason: t.UnsupportedTriggerType
86
+ };
87
+ let l = {
113
88
  displayName: e.displayName,
114
89
  modelId: e.model,
115
90
  prompt: e.prompt,
116
91
  skillUrls: [...new Set(e.skillUrls ?? [])],
92
+ timezone: c,
117
93
  ...e.description ? { description: e.description } : {}
118
94
  };
119
- if (i) return {
95
+ if (o) return {
120
96
  ok: !0,
121
97
  values: {
122
- ...a,
123
- repeat: s.OneTime,
124
- runAt: g(n),
125
- time: d
98
+ ...l,
99
+ repeat: r.OneTime,
100
+ runAt: b(i, c),
101
+ time: m
126
102
  }
127
103
  };
128
- if (!r) return {
104
+ if (!a) return {
129
105
  ok: !1,
130
106
  reason: t.UnsupportedTriggerType
131
107
  };
132
- let o = v(r.fields);
133
- if (!o.ok) return {
108
+ let u = S(a.fields);
109
+ if (!u.ok) return {
134
110
  ok: !1,
135
111
  reason: t.UnsupportedCronShape
136
112
  };
137
- if (o.isHourly) return {
113
+ let d = {
114
+ ...a.startDate ? { startDate: x(a.startDate, c) } : {},
115
+ ...a.endDate ? { endDate: x(a.endDate, c) } : {}
116
+ };
117
+ if (u.isHourly) return {
138
118
  ok: !0,
139
119
  values: {
140
- ...a,
141
- repeat: s.Hourly,
142
- time: d,
143
- minute: o.minute,
144
- ...r.startDate ? { startDate: _(r.startDate) } : {},
145
- ...r.endDate ? { endDate: _(r.endDate) } : {}
120
+ ...l,
121
+ repeat: r.Hourly,
122
+ time: m,
123
+ minute: u.minute,
124
+ ...d
146
125
  }
147
126
  };
148
- if (o.isCustom) return {
127
+ if (u.isCustom) return {
149
128
  ok: !0,
150
129
  values: {
151
- ...a,
152
- repeat: s.Custom,
153
- time: o.time,
154
- daysOfWeek: o.daysOfWeek,
155
- ...r.startDate ? { startDate: _(r.startDate) } : {},
156
- ...r.endDate ? { endDate: _(r.endDate) } : {}
130
+ ...l,
131
+ repeat: r.Custom,
132
+ time: u.time,
133
+ daysOfWeek: u.daysOfWeek,
134
+ ...d
157
135
  }
158
136
  };
159
- let c = s.Daily;
160
- return o.dayOfWeek ? c = s.Weekly : o.dayOfMonth && (c = s.Monthly), {
137
+ let f = r.Daily;
138
+ return u.dayOfWeek ? f = r.Weekly : u.dayOfMonth && (f = r.Monthly), {
161
139
  ok: !0,
162
140
  values: {
163
- ...a,
164
- repeat: c,
165
- time: o.time,
166
- ...o.dayOfWeek ? { dayOfWeek: o.dayOfWeek } : {},
167
- ...o.dayOfMonth ? { dayOfMonth: o.dayOfMonth } : {},
168
- ...r.startDate ? { startDate: _(r.startDate) } : {},
169
- ...r.endDate ? { endDate: _(r.endDate) } : {}
141
+ ...l,
142
+ repeat: f,
143
+ time: u.time,
144
+ ...u.dayOfWeek ? { dayOfWeek: u.dayOfWeek } : {},
145
+ ...u.dayOfMonth ? { dayOfMonth: u.dayOfMonth } : {},
146
+ ...d
170
147
  }
171
148
  };
172
149
  };
173
150
  //#endregion
174
- export { m as mapFormValuesToCreateBody, h as mapFormValuesToUpdateBody, y as mapScheduledTaskDtoToFormValues };
151
+ export { v as mapFormValuesToCreateBody, y as mapFormValuesToUpdateBody, C as mapScheduledTaskDtoToFormValues };
@@ -1,15 +1,16 @@
1
1
  import { UnsupportedTriggerReason as e } from "./scheduled-task/scheduled-task-mapping.js";
2
2
  import { ScheduledTaskTriggerDescriptionKind as t, describeScheduledTaskTrigger as n } from "./scheduled-task/scheduled-task-description.js";
3
- import { ScheduledTaskDeleteErrorKind as r, classifyScheduledTaskDeleteError as i, formatScheduledTaskRunDuration as a, formatScheduledTaskRunTimestamp as o, formatScheduledTaskScheduleLabel as s, selectScheduledTaskErrorMessage as c, toScheduledTaskItem as l, toScheduledTaskItems as u, toScheduledTaskRunItem as d, toScheduledTaskRunItems as f } from "./scheduled-task/scheduled-task-display.js";
4
- import { mapFormValuesToCreateBody as p, mapFormValuesToUpdateBody as m, mapScheduledTaskDtoToFormValues as h } from "./scheduled-task/scheduled-task-trigger.js";
5
- import { prepareScheduledTaskCreateBody as g, prepareScheduledTaskUpdateBody as _ } from "./scheduled-task/scheduled-task-preparation.js";
6
- import { createScheduledTasksApiClient as v } from "./scheduled-task/scheduled-tasks-api-client.js";
7
- import { useScheduledTasks as y } from "./scheduled-task/use-scheduled-tasks.js";
8
- import { mergeRunsById as b, useScheduledTaskRuns as x } from "./scheduled-task/use-scheduled-task-runs.js";
9
- import { ScheduledTaskRunStatusFeedback as S, mergeScheduledTaskRuns as C, useStartScheduledTask as w } from "./scheduled-task/useStartScheduledTask.js";
10
- import { getNextCronOccurrence as T } from "./scheduled-task/scheduled-task-next-occurrence.js";
11
- import { checkScheduledTaskAuthSessionError as E } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
12
- import { useScheduledTaskSkillDisplayNames as D } from "./scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js";
13
- import { ActiveScheduledTaskDetailState as O, ActiveScheduledTaskStatus as k, resolveActiveScheduledTask as A } from "./scheduled-task/active-scheduled-task.js";
14
- import { useActiveScheduledTaskDetails as j } from "./scheduled-task/useActiveScheduledTaskDetails.js";
15
- export { O as ActiveScheduledTaskDetailState, k as ActiveScheduledTaskStatus, r as ScheduledTaskDeleteErrorKind, S as ScheduledTaskRunStatusFeedback, t as ScheduledTaskTriggerDescriptionKind, e as UnsupportedTriggerReason, E as checkScheduledTaskAuthSessionError, i as classifyScheduledTaskDeleteError, v as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, a as formatScheduledTaskRunDuration, o as formatScheduledTaskRunTimestamp, s as formatScheduledTaskScheduleLabel, T as getNextCronOccurrence, p as mapFormValuesToCreateBody, m as mapFormValuesToUpdateBody, h as mapScheduledTaskDtoToFormValues, b as mergeRunsById, C as mergeScheduledTaskRuns, g as prepareScheduledTaskCreateBody, _ as prepareScheduledTaskUpdateBody, A as resolveActiveScheduledTask, c as selectScheduledTaskErrorMessage, l as toScheduledTaskItem, u as toScheduledTaskItems, d as toScheduledTaskRunItem, f as toScheduledTaskRunItems, j as useActiveScheduledTaskDetails, x as useScheduledTaskRuns, D as useScheduledTaskSkillDisplayNames, y as useScheduledTasks, w as useStartScheduledTask };
3
+ import { UTC_TIMEZONE_ID as r, findTimezoneOption as i, getTimezoneOptions as a, isKnownTimezone as o, isSameTimezone as s } from "./shared/timezones.js";
4
+ import { ScheduledTaskDeleteErrorKind as c, classifyScheduledTaskDeleteError as l, formatScheduledTaskRunDuration as u, formatScheduledTaskRunTimestamp as d, formatScheduledTaskScheduleLabel as f, formatScheduledTaskTriggerTime as p, formatZonedDateTime as m, selectScheduledTaskErrorMessage as h, toScheduledTaskItem as g, toScheduledTaskItems as _, toScheduledTaskRunItem as v, toScheduledTaskRunItems as y } from "./scheduled-task/scheduled-task-display.js";
5
+ import { mapFormValuesToCreateBody as b, mapFormValuesToUpdateBody as x, mapScheduledTaskDtoToFormValues as S } from "./scheduled-task/scheduled-task-trigger.js";
6
+ import { prepareScheduledTaskCreateBody as C, prepareScheduledTaskUpdateBody as w } from "./scheduled-task/scheduled-task-preparation.js";
7
+ import { createScheduledTasksApiClient as T } from "./scheduled-task/scheduled-tasks-api-client.js";
8
+ import { useScheduledTasks as E } from "./scheduled-task/use-scheduled-tasks.js";
9
+ import { mergeRunsById as D, useScheduledTaskRuns as O } from "./scheduled-task/use-scheduled-task-runs.js";
10
+ import { ScheduledTaskRunStatusFeedback as k, mergeScheduledTaskRuns as A, useStartScheduledTask as j } from "./scheduled-task/useStartScheduledTask.js";
11
+ import { getNextCronOccurrence as M } from "./scheduled-task/scheduled-task-next-occurrence.js";
12
+ import { checkScheduledTaskAuthSessionError as N } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
13
+ import { useScheduledTaskSkillDisplayNames as P } from "./scheduled-task/useScheduledTaskSkillDisplayNames/useScheduledTaskSkillDisplayNames.js";
14
+ import { ActiveScheduledTaskDetailState as F, ActiveScheduledTaskStatus as I, resolveActiveScheduledTask as L } from "./scheduled-task/active-scheduled-task.js";
15
+ import { useActiveScheduledTaskDetails as R } from "./scheduled-task/useActiveScheduledTaskDetails.js";
16
+ export { F as ActiveScheduledTaskDetailState, I as ActiveScheduledTaskStatus, c as ScheduledTaskDeleteErrorKind, k as ScheduledTaskRunStatusFeedback, t as ScheduledTaskTriggerDescriptionKind, r as UTC_TIMEZONE_ID, e as UnsupportedTriggerReason, N as checkScheduledTaskAuthSessionError, l as classifyScheduledTaskDeleteError, T as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, i as findTimezoneOption, u as formatScheduledTaskRunDuration, d as formatScheduledTaskRunTimestamp, f as formatScheduledTaskScheduleLabel, p as formatScheduledTaskTriggerTime, m as formatZonedDateTime, M as getNextCronOccurrence, a as getTimezoneOptions, o as isKnownTimezone, s as isSameTimezone, b as mapFormValuesToCreateBody, x as mapFormValuesToUpdateBody, S as mapScheduledTaskDtoToFormValues, D as mergeRunsById, A as mergeScheduledTaskRuns, C as prepareScheduledTaskCreateBody, w as prepareScheduledTaskUpdateBody, L as resolveActiveScheduledTask, h as selectScheduledTaskErrorMessage, g as toScheduledTaskItem, _ as toScheduledTaskItems, v as toScheduledTaskRunItem, y as toScheduledTaskRunItems, R as useActiveScheduledTaskDetails, O as useScheduledTaskRuns, P as useScheduledTaskSkillDisplayNames, E as useScheduledTasks, j as useStartScheduledTask };
@@ -0,0 +1,30 @@
1
+ import { ScheduledTaskTimezoneOption } from '@epam/ai-dial-scheduled-tasks';
2
+ /** Zone every task falls back to and the one engines may leave out of their supported list. */
3
+ export declare const UTC_TIMEZONE_ID = "UTC";
4
+ /** Options of {@link getTimezoneOptions}. */
5
+ export interface GetTimezoneOptionsParams {
6
+ /** Moment the offsets and the current abbreviation are read at. Defaults to now. */
7
+ now?: Date;
8
+ /** BCP 47 locale the abbreviations are written in. Defaults to the platform default. */
9
+ locale?: string;
10
+ }
11
+ /** True when the identifier looks like an IANA id and `Intl` can format in it; an unknown name, an offset such as `+02:00` or an empty string is not a zone. */
12
+ export declare const isKnownTimezone: (timezone: string) => boolean;
13
+ /** True when both identifiers name the same zone once legacy names are resolved (`Europe/Kiev` and `Europe/Kyiv`). */
14
+ export declare const isSameTimezone: (a: string, b: string) => boolean;
15
+ /**
16
+ * Returns every selectable IANA zone as a picker row, sorted by UTC offset and
17
+ * then by identifier. Offsets and the abbreviation are read at `now`; the
18
+ * abbreviation falls back to English (`CET`) where the locale gives none. Search
19
+ * terms also carry the January and July abbreviations and the long names
20
+ * (`Central European Time`), so `CEST` or a region name is found in any month;
21
+ * they are computed when a row's `searchTerms` is first read.
22
+ */
23
+ export declare const getTimezoneOptions: ({ now, locale, }?: GetTimezoneOptionsParams) => ScheduledTaskTimezoneOption[];
24
+ /**
25
+ * Finds the option naming the same zone as `timezone`: an exact id match, else
26
+ * the option for its canonical form, so a browser reporting `Asia/Calcutta`
27
+ * still lands on the listed `Asia/Kolkata` row. Returns `undefined` when none.
28
+ */
29
+ export declare const findTimezoneOption: (options: readonly ScheduledTaskTimezoneOption[], timezone: string | undefined) => ScheduledTaskTimezoneOption | undefined;
30
+ //# sourceMappingURL=timezones.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timezones.d.ts","sourceRoot":"","sources":["../../src/shared/timezones.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEjF,+FAA+F;AAC/F,eAAO,MAAM,eAAe,QAAQ,CAAC;AA6BrC,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,oFAAoF;IACpF,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2DD,gKAAgK;AAChK,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,OACc,CAAC;AAoBlE,sHAAsH;AACtH,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OACR,CAAC;AAiG/C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,mBAGhC,wBAA6B,KAAG,2BAA2B,EAyC7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,SAAS,2BAA2B,EAAE,EAC/C,UAAU,MAAM,GAAG,SAAS,KAC3B,2BAA2B,GAAG,SAMhC,CAAC"}
@@ -0,0 +1,102 @@
1
+ //#region src/shared/timezones.ts
2
+ var e = "UTC", t = {
3
+ "Africa/Asmera": "Africa/Asmara",
4
+ "America/Buenos_Aires": "America/Argentina/Buenos_Aires",
5
+ "America/Godthab": "America/Nuuk",
6
+ "America/Indianapolis": "America/Indiana/Indianapolis",
7
+ "America/Louisville": "America/Kentucky/Louisville",
8
+ "Asia/Calcutta": "Asia/Kolkata",
9
+ "Asia/Katmandu": "Asia/Kathmandu",
10
+ "Asia/Rangoon": "Asia/Yangon",
11
+ "Asia/Saigon": "Asia/Ho_Chi_Minh",
12
+ "Atlantic/Faeroe": "Atlantic/Faroe",
13
+ "Europe/Kiev": "Europe/Kyiv",
14
+ "Pacific/Enderbury": "Pacific/Kanton",
15
+ "Pacific/Ponape": "Pacific/Pohnpei",
16
+ "Pacific/Truk": "Pacific/Chuuk"
17
+ }, n = /^GMT(?:([+-])(\d{1,2})(?::(\d{2}))?)?$/, r = /^[A-Za-z]{2,6}$/, i = 60, a = (e, t, n, r) => {
18
+ try {
19
+ return new Intl.DateTimeFormat(r ?? "en-US", {
20
+ timeZone: e,
21
+ timeZoneName: t
22
+ }).formatToParts(n).find((e) => e.type === "timeZoneName")?.value.replace("−", "-");
23
+ } catch {
24
+ return;
25
+ }
26
+ }, o = (e) => {
27
+ let t = n.exec(e ?? "");
28
+ return t?.[1] ? (t[1] === "-" ? -1 : 1) * (Number(t[2]) * i + Number(t[3] ?? 0)) : 0;
29
+ }, s = (e) => String(e).padStart(2, "0"), c = (e) => {
30
+ let t = e < 0 ? "-" : "+", n = Math.abs(e);
31
+ return `GMT${t}${s(Math.floor(n / i))}:${s(n % i)}`;
32
+ }, l = () => {
33
+ let e = [];
34
+ try {
35
+ e = Intl.supportedValuesOf("timeZone");
36
+ } catch {
37
+ e = [];
38
+ }
39
+ return e.includes("UTC") ? e : [...e, "UTC"];
40
+ }, u = (e) => {
41
+ try {
42
+ return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
43
+ } catch {
44
+ return !1;
45
+ }
46
+ }, d = /^[A-Za-z][A-Za-z0-9_+\-/]*$/, f = (e) => d.test(e) && u(e), p = (e) => {
47
+ let n = t[e];
48
+ return n && u(n) ? n : e;
49
+ }, m = (e) => {
50
+ try {
51
+ return p(new Intl.DateTimeFormat("en-US", { timeZone: e }).resolvedOptions().timeZone || e);
52
+ } catch {
53
+ return e;
54
+ }
55
+ }, h = (e, t) => e === t || p(e) === p(t), g = (e) => [...new Set(e.map(m))], _ = ["en-GB", "en-US"], v = (e) => [.../* @__PURE__ */ new Set([e, ..._])], y = (e, t, n) => {
56
+ for (let i of v(n)) {
57
+ let n = a(e, "short", t, i);
58
+ if (n && r.test(n) && n.toUpperCase() !== "GMT") return n;
59
+ }
60
+ }, b = (e, t, n) => t.flatMap((t) => v(n).map((n) => a(e, "short", t, n))).filter((e) => !!e && r.test(e) && e.toUpperCase() !== "GMT"), x = (e, t, n) => {
61
+ let r = [.../* @__PURE__ */ new Set([n, "en-US"])];
62
+ return t.flatMap((t) => r.flatMap((n) => ["long", "longGeneric"].map((r) => a(e, r, t, n)))).filter((e) => !!e && !e.startsWith("GMT"));
63
+ }, S = (e, t, n) => {
64
+ let r = t < 0 ? "-" : "+", a = Math.abs(t), o = Math.floor(a / i), l = a % i, u = [
65
+ c(t),
66
+ `${r}${s(o)}:${s(l)}`,
67
+ `${r}${o}:${s(l)}`,
68
+ `${r}${s(o)}`,
69
+ `${r}${o}`,
70
+ e,
71
+ e.replace(/[_/]/g, " "),
72
+ ...n
73
+ ];
74
+ return [...new Set(u.filter((e) => !!e).map((e) => e.toLowerCase()))];
75
+ }, C = ({ now: e = /* @__PURE__ */ new Date(), locale: t } = {}) => {
76
+ let n = e.getUTCFullYear(), r = new Date(Date.UTC(n, 0, 15, 12)), i = new Date(Date.UTC(n, 6, 15, 12));
77
+ return g(l()).map((n) => {
78
+ let s = o(a(n, "longOffset", e, "en-US")), l = y(n, e, t), u = l?.toUpperCase() === n.toUpperCase() ? void 0 : l, d = {
79
+ id: n,
80
+ offsetLabel: c(s),
81
+ offsetMinutes: s,
82
+ ...u ? { abbreviation: u } : {},
83
+ searchTerms: []
84
+ }, f;
85
+ return Object.defineProperty(d, "searchTerms", {
86
+ enumerable: !0,
87
+ get: () => (f ??= S(n, s, [...b(n, [
88
+ e,
89
+ r,
90
+ i
91
+ ], t), ...x(n, [r, i], t)]), f)
92
+ }), d;
93
+ }).sort((e, t) => e.offsetMinutes === t.offsetMinutes ? e.id === t.id ? 0 : e.id < t.id ? -1 : 1 : e.offsetMinutes - t.offsetMinutes);
94
+ }, w = (e, t) => {
95
+ if (!t) return;
96
+ let n = e.find((e) => e.id === t);
97
+ if (n) return n;
98
+ let r = m(t);
99
+ return e.find((e) => e.id === r);
100
+ };
101
+ //#endregion
102
+ export { e as UTC_TIMEZONE_ID, w as findTimezoneOption, C as getTimezoneOptions, f as isKnownTimezone, h as isSameTimezone };
package/utils.js CHANGED
@@ -10,8 +10,8 @@ import { buildExternalServiceScopeId as T, getExternalServiceFallbackName as E,
10
10
  import { buildPromptExportEnvelope as O, buildPromptExportFileName as k, serializePromptExport as A } from "./prompt/export-prompt.js";
11
11
  import { PROMPT_CONTENT_MAX_LENGTH as j, PROMPT_COUNTER_ANNOUNCE_THRESHOLD as M, PROMPT_DESCRIPTION_MAX_LENGTH as N, PROMPT_FIELD_VALIDATORS as P, PROMPT_NAME_MAX_LENGTH as F, PromptFieldError as I, buildPromptPath as L, getRemainingCharacters as R, validatePromptContent as z, validatePromptDescription as B, validatePromptName as V } from "./prompt/prompt.js";
12
12
  import { usePromptsState as H } from "./prompt/usePromptsState/usePromptsState.js";
13
- import { apSchedulerDayToJsDay as U, jsDayToApSchedulerDay as W } from "./shared/cron-weekday.js";
14
- import { getBrowserTimezone as G } from "./shared/browser-timezone.js";
13
+ import { getBrowserTimezone as U } from "./shared/browser-timezone.js";
14
+ import { apSchedulerDayToJsDay as W, jsDayToApSchedulerDay as G } from "./shared/cron-weekday.js";
15
15
  import { isValidAbsoluteUrl as K, isValidFeaturesData as q, parseFeaturesData as J } from "./shared/custom-apps.js";
16
16
  import { EXTERNAL_SERVICE_SIGNIN_METHOD as Y, PendingSigninEventKind as X, TOOLSET_SIGNIN_METHOD as Z } from "./shared/client-channel.js";
17
17
  import { ColorScheme as Q, applyThemeColors as $, getOsPreferredTheme as ee } from "./shared/theme-colors.js";
@@ -20,4 +20,6 @@ import { triggerBrowserDownload as ne } from "./files/browser-download.js";
20
20
  import { usePersistedState as re } from "./shared/usePersistedState/usePersistedState.js";
21
21
  import { useAppVersionCheck as ie } from "./shared/useAppVersionCheck/useAppVersionCheck.js";
22
22
  import { getCleanedLocationTarget as ae } from "./shared/url-cleanup.js";
23
- export { Q as ColorScheme, Y as EXTERNAL_SERVICE_SIGNIN_METHOD, j as PROMPT_CONTENT_MAX_LENGTH, M as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, N as PROMPT_DESCRIPTION_MAX_LENGTH, P as PROMPT_FIELD_VALIDATORS, F as PROMPT_NAME_MAX_LENGTH, X as PendingSigninEventKind, I as PromptFieldError, b as PromptSource, Z as TOOLSET_SIGNIN_METHOD, U as apSchedulerDayToJsDay, f as appendLocaleCode, $ as applyThemeColors, p as buildAdditionalLocaleOptions, T as buildExternalServiceScopeId, O as buildPromptExportEnvelope, k as buildPromptExportFileName, L as buildPromptPath, m as composeLocalePayload, a as createCsrfMiddleware, o as createUnauthorizedMiddleware, h as decomposeLocalizedFields, v as formatCalendarDate, e as getAcceptInvitationErrorItemName, t as getApiErrorDetails, n as getApiErrorMessage, r as getApiErrorStatus, G as getBrowserTimezone, ae as getCleanedLocationTarget, E as getExternalServiceFallbackName, ee as getOsPreferredTheme, R as getRemainingCharacters, S as getRunnerSchemas, s as includesIgnoreCase, i as isConversationNotFoundError, C as isCustomAppSchema, w as isQuickAppSchema, K as isValidAbsoluteUrl, q as isValidFeaturesData, W as jsDayToApSchedulerDay, y as padTwoDigits, D as parseExternalServiceUrl, J as parseFeaturesData, x as parsePromptResourceUrl, g as resolveLocalizedText, c as safeDecodeURI, l as safeDecodeURIComponent, A as serializePromptExport, u as stripSurroundingSlashes, d as stripTrailingSlashes, _ as toBaseLocale, ne as triggerBrowserDownload, ie as useAppVersionCheck, re as usePersistedState, H as usePromptsState, te as useUsageData, z as validatePromptContent, B as validatePromptDescription, V as validatePromptName };
23
+ import { OrgUnitsStatus as oe } from "./org-units/types.js";
24
+ import { useOrgUnits as se } from "./org-units/useOrgUnits/useOrgUnits.js";
25
+ export { Q as ColorScheme, Y as EXTERNAL_SERVICE_SIGNIN_METHOD, oe as OrgUnitsStatus, j as PROMPT_CONTENT_MAX_LENGTH, M as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, N as PROMPT_DESCRIPTION_MAX_LENGTH, P as PROMPT_FIELD_VALIDATORS, F as PROMPT_NAME_MAX_LENGTH, X as PendingSigninEventKind, I as PromptFieldError, b as PromptSource, Z as TOOLSET_SIGNIN_METHOD, W as apSchedulerDayToJsDay, f as appendLocaleCode, $ as applyThemeColors, p as buildAdditionalLocaleOptions, T as buildExternalServiceScopeId, O as buildPromptExportEnvelope, k as buildPromptExportFileName, L as buildPromptPath, m as composeLocalePayload, a as createCsrfMiddleware, o as createUnauthorizedMiddleware, h as decomposeLocalizedFields, v as formatCalendarDate, e as getAcceptInvitationErrorItemName, t as getApiErrorDetails, n as getApiErrorMessage, r as getApiErrorStatus, U as getBrowserTimezone, ae as getCleanedLocationTarget, E as getExternalServiceFallbackName, ee as getOsPreferredTheme, R as getRemainingCharacters, S as getRunnerSchemas, s as includesIgnoreCase, i as isConversationNotFoundError, C as isCustomAppSchema, w as isQuickAppSchema, K as isValidAbsoluteUrl, q as isValidFeaturesData, G as jsDayToApSchedulerDay, y as padTwoDigits, D as parseExternalServiceUrl, J as parseFeaturesData, x as parsePromptResourceUrl, g as resolveLocalizedText, c as safeDecodeURI, l as safeDecodeURIComponent, A as serializePromptExport, u as stripSurroundingSlashes, d as stripTrailingSlashes, _ as toBaseLocale, ne as triggerBrowserDownload, ie as useAppVersionCheck, se as useOrgUnits, re as usePersistedState, H as usePromptsState, te as useUsageData, z as validatePromptContent, B as validatePromptDescription, V as validatePromptName };
@@ -1,21 +0,0 @@
1
- /** APScheduler `day` expression for the last day of the month. */
2
- export declare const CRON_LAST_DAY_OF_MONTH = "last";
3
- /**
4
- * Calendar days between `date`'s UTC date and its local date: `-1` when UTC is
5
- * still on the previous day (east of UTC), `1` when it has reached the next.
6
- */
7
- export declare const getUtcDayShift: (date: Date) => number;
8
- /**
9
- * Converts a local day-of-month to the UTC `day` cron value. The local 1st
10
- * shifted back is always the previous month's last day, hence `'last'`. The
11
- * local 31st shifted forward stays `'1'`: a single cron field cannot express
12
- * "the 1st after a 31-day month only".
13
- */
14
- export declare const toUtcCronDayOfMonth: (localDay: number, utcDayShift: number) => string;
15
- /**
16
- * Inverts {@link toUtcCronDayOfMonth}; returns `undefined` for a value the
17
- * form cannot represent. A UTC 31st shifted forward maps to the 1st, so tasks
18
- * saved before `'last'` was emitted still open in the editor.
19
- */
20
- export declare const toLocalDayOfMonth: (utcDay: string, utcDayShift: number) => string | undefined;
21
- //# sourceMappingURL=cron-day-of-month.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cron-day-of-month.d.ts","sourceRoot":"","sources":["../../src/shared/cron-day-of-month.ts"],"names":[],"mappings":"AAQA,kEAAkE;AAClE,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAK7C;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,KAAG,MAKzC,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,aAAa,MAAM,KAClB,MAKF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,EACd,aAAa,MAAM,KAClB,MAAM,GAAG,SAcX,CAAC"}
@@ -1,13 +0,0 @@
1
- //#region src/shared/cron-day-of-month.ts
2
- var e = "last", t = (e) => Math.round((Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / 864e5), n = (t, n) => {
3
- let r = t + n;
4
- return r < 1 ? e : r > 31 ? "1" : String(r);
5
- }, r = (e, t) => {
6
- if (e === "last") return t === -1 ? "1" : void 0;
7
- let n = Number(e);
8
- if (!/^\d+$/.test(e) || n < 1 || n > 31) return;
9
- let r = n - t;
10
- return r < 1 ? "31" : r > 31 ? "1" : String(r);
11
- };
12
- //#endregion
13
- export { e as CRON_LAST_DAY_OF_MONTH, t as getUtcDayShift, r as toLocalDayOfMonth, n as toUtcCronDayOfMonth };