@epam/ai-dial-scheduled-tasks 1.2.0-dev.163 → 1.2.0-dev.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-scheduled-tasks",
|
|
3
3
|
"description": "Presentational Scheduled Tasks page shell — header, toolbar, and empty state",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.170",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@tabler/icons-react": "^3.44.0",
|
|
26
26
|
"@uiw/react-markdown-preview": "^5.2.1",
|
|
27
27
|
"@uiw/react-md-editor": "^4.1.1",
|
|
28
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
28
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.170"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
31
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.170",
|
|
32
32
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.20",
|
|
33
33
|
"react": "^19.2.8"
|
|
34
34
|
},
|
package/validation/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ScheduledTaskValidationErrorCode, validateScheduledTaskFormValues, } from './scheduled-task-validation';
|
|
2
|
-
export type { ScheduledTaskValidationErrors, ScheduledTaskValidationOptions, } from './scheduled-task-validation';
|
|
1
|
+
export { ScheduledTaskValidationErrorCode, validateScheduledTaskFormValues, validateScheduledTaskTextField, } from './scheduled-task-validation';
|
|
2
|
+
export type { ScheduledTaskTextField, ScheduledTaskValidationErrors, ScheduledTaskValidationOptions, } from './scheduled-task-validation';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,sBAAsB,EACtB,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC"}
|
|
@@ -2,8 +2,14 @@ import { ScheduledTaskCreateFormValues } from '../models/scheduled-task-create-f
|
|
|
2
2
|
/** Stable error codes that a host translates at its application boundary. */
|
|
3
3
|
export declare enum ScheduledTaskValidationErrorCode {
|
|
4
4
|
DisplayNameRequired = "displayNameRequired",
|
|
5
|
+
/** The display name exceeds the shared entity-name length limit. */
|
|
6
|
+
DisplayNameTooLong = "displayNameTooLong",
|
|
7
|
+
/** The display name contains a control character (line break, tab, …). */
|
|
8
|
+
DisplayNameControlCharacters = "displayNameControlCharacters",
|
|
5
9
|
ModelRequired = "modelRequired",
|
|
6
10
|
PromptRequired = "promptRequired",
|
|
11
|
+
/** The instructions exceed the shared instructions length limit. */
|
|
12
|
+
PromptTooLong = "promptTooLong",
|
|
7
13
|
/** Neither instructions nor a skill was provided. */
|
|
8
14
|
InstructionsOrSkillRequired = "instructionsOrSkillRequired",
|
|
9
15
|
/** A selected skill requires explicit capability support. */
|
|
@@ -26,6 +32,14 @@ export interface ScheduledTaskValidationOptions {
|
|
|
26
32
|
/** Explicit capability of the draft's selected model; omitted means unsupported. */
|
|
27
33
|
isSkillsSupported?: boolean;
|
|
28
34
|
}
|
|
35
|
+
/** Scheduled-task form fields that carry free text with a length limit. */
|
|
36
|
+
export type ScheduledTaskTextField = 'displayName' | 'description' | 'prompt';
|
|
37
|
+
/**
|
|
38
|
+
* Checks one free-text field against its length limit (and, for the display
|
|
39
|
+
* name, control characters) as the BFF will see it — trimmed. An empty value
|
|
40
|
+
* passes; required checks live in `validateScheduledTaskFormValues`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const validateScheduledTaskTextField: (field: ScheduledTaskTextField, value: string | undefined) => ScheduledTaskValidationErrorCode | undefined;
|
|
29
43
|
/**
|
|
30
44
|
* Validates only the fields active for the selected repeat cadence. This pure
|
|
31
45
|
* function deliberately has no translation, DOM, network, or implicit-clock
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-task-validation.d.ts","sourceRoot":"","sources":["../../src/validation/scheduled-task-validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scheduled-task-validation.d.ts","sourceRoot":"","sources":["../../src/validation/scheduled-task-validation.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAIhG,6EAA6E;AAC7E,oBAAY,gCAAgC;IAC1C,mBAAmB,wBAAwB;IAC3C,oEAAoE;IACpE,kBAAkB,uBAAuB;IACzC,0EAA0E;IAC1E,4BAA4B,iCAAiC;IAC7D,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;IACjC,oEAAoE;IACpE,aAAa,kBAAkB;IAC/B,qDAAqD;IACrD,2BAA2B,gCAAgC;IAC3D,6DAA6D;IAC7D,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,cAAc,mBAAmB;CAClC;AAED,+EAA+E;AAC/E,MAAM,MAAM,6BAA6B,GAAG,OAAO,CACjD,MAAM,CAAC,MAAM,6BAA6B,EAAE,gCAAgC,CAAC,CAC9E,CAAC;AAEF,kFAAkF;AAClF,MAAM,WAAW,8BAA8B;IAC7C,GAAG,EAAE,IAAI,CAAC;IACV,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,2EAA2E;AAC3E,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,aAAa,GAAG,QAAQ,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,GACzC,OAAO,sBAAsB,EAC7B,OAAO,MAAM,GAAG,SAAS,KACxB,gCAAgC,GAAG,SAoBrC,CAAC;AAyBF;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,GAC1C,QAAQ,6BAA6B,EACrC,4CAIG,8BAA8B,KAChC,6BAgFF,CAAC"}
|
package/validation.js
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { c as e, t } from "./calendar-value-B41Uk26Z.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ENTITY_INSTRUCTIONS_MAX_LENGTH as n, ENTITY_NAME_MAX_LENGTH as r, exceedsMaxLength as i, hasControlCharacters as a, isSkillSelectionUnsupported as o } from "@epam/ai-dial-chat-shared";
|
|
3
3
|
//#region src/validation/scheduled-task-validation.ts
|
|
4
|
-
var
|
|
5
|
-
return e.DisplayNameRequired = "displayNameRequired", e.ModelRequired = "modelRequired", e.PromptRequired = "promptRequired", e.InstructionsOrSkillRequired = "instructionsOrSkillRequired", e.SkillUnsupported = "skillUnsupported", e.DescriptionTooLong = "descriptionTooLong", e.RunAtInvalid = "runAtInvalid", e.TimeInvalid = "timeInvalid", e.MinuteInvalid = "minuteInvalid", e.DayOfWeekInvalid = "dayOfWeekInvalid", e.DayOfMonthInvalid = "dayOfMonthInvalid", e.StartDateInvalid = "startDateInvalid", e.EndDateInvalid = "endDateInvalid", e;
|
|
6
|
-
}({}),
|
|
7
|
-
|
|
4
|
+
var s = /* @__PURE__ */ function(e) {
|
|
5
|
+
return e.DisplayNameRequired = "displayNameRequired", e.DisplayNameTooLong = "displayNameTooLong", e.DisplayNameControlCharacters = "displayNameControlCharacters", e.ModelRequired = "modelRequired", e.PromptRequired = "promptRequired", e.PromptTooLong = "promptTooLong", e.InstructionsOrSkillRequired = "instructionsOrSkillRequired", e.SkillUnsupported = "skillUnsupported", e.DescriptionTooLong = "descriptionTooLong", e.RunAtInvalid = "runAtInvalid", e.TimeInvalid = "timeInvalid", e.MinuteInvalid = "minuteInvalid", e.DayOfWeekInvalid = "dayOfWeekInvalid", e.DayOfMonthInvalid = "dayOfMonthInvalid", e.StartDateInvalid = "startDateInvalid", e.EndDateInvalid = "endDateInvalid", e;
|
|
6
|
+
}({}), c = (e, t) => {
|
|
7
|
+
let o = t?.trim() ?? "";
|
|
8
|
+
switch (e) {
|
|
9
|
+
case "displayName": return i(o, r) ? "displayNameTooLong" : a(o) ? "displayNameControlCharacters" : void 0;
|
|
10
|
+
case "description": return i(o, 500) ? "descriptionTooLong" : void 0;
|
|
11
|
+
case "prompt": return i(o, n) ? "promptTooLong" : void 0;
|
|
12
|
+
}
|
|
13
|
+
}, l = 6e4, u = /^(?:[0-9]|[1-5][0-9])$/, d = /^[0-6]$/, f = /^(?:[1-9]|[12][0-9]|3[01])$/, p = /^\d{4}-\d{2}-\d{2}$/, m = (e) => {
|
|
14
|
+
if (!p.test(e)) return !1;
|
|
8
15
|
let [t, n, r] = e.split("-").map(Number), i = new Date(t, n - 1, r);
|
|
9
16
|
return i.getFullYear() === t && i.getMonth() === n - 1 && i.getDate() === r;
|
|
10
|
-
},
|
|
17
|
+
}, h = (e) => {
|
|
11
18
|
let t = new Date(e).getTime();
|
|
12
19
|
return Number.isFinite(t);
|
|
13
|
-
},
|
|
14
|
-
let p = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
}, g = (n, { now: r, minimumLeadMs: i = l, isSkillsSupported: a }) => {
|
|
21
|
+
let s = {}, p = (e, t) => {
|
|
22
|
+
let n = c(e, t);
|
|
23
|
+
n && (s[e] = n);
|
|
24
|
+
};
|
|
25
|
+
if (n.displayName.trim() ? p("displayName", n.displayName) : s.displayName = "displayNameRequired", n.modelId.trim() || (s.modelId = "modelRequired"), !n.prompt.trim() && !n.skillUrl?.trim() ? s.prompt = "instructionsOrSkillRequired" : p("prompt", n.prompt), o(n.skillUrl, a) && (s.skillUrl = "skillUnsupported"), p("description", n.description), n.repeat === e.OneTime) {
|
|
26
|
+
let e = n.runAt ? new Date(n.runAt).getTime() : NaN;
|
|
27
|
+
return (!n.runAt || !h(n.runAt) || !Number.isFinite(e) || e < r.getTime() + i) && (s.runAt = "runAtInvalid"), s;
|
|
18
28
|
}
|
|
19
|
-
return
|
|
29
|
+
return n.repeat === e.Hourly ? u.test(n.minute ?? "") || (s.minute = "minuteInvalid") : t.test(n.time) || (s.time = "timeInvalid"), n.repeat === e.Weekly && !d.test(n.dayOfWeek ?? "") && (s.dayOfWeek = "dayOfWeekInvalid"), n.repeat === e.Monthly && !f.test(n.dayOfMonth ?? "") && (s.dayOfMonth = "dayOfMonthInvalid"), n.startDate && !m(n.startDate) && (s.startDate = "startDateInvalid"), n.endDate && !m(n.endDate) && (s.endDate = "endDateInvalid"), n.startDate && n.endDate && m(n.startDate) && m(n.endDate) && n.endDate <= n.startDate && (s.endDate = "endDateInvalid"), s;
|
|
20
30
|
};
|
|
21
31
|
//#endregion
|
|
22
|
-
export {
|
|
32
|
+
export { s as ScheduledTaskValidationErrorCode, g as validateScheduledTaskFormValues, c as validateScheduledTaskTextField };
|