@vef-framework-react/cron 2.13.0
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/LICENSE +201 -0
- package/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/api/index.cjs +1 -0
- package/dist/cjs/api/query.cjs +1 -0
- package/dist/cjs/api/run-api.cjs +1 -0
- package/dist/cjs/api/schedule-api.cjs +1 -0
- package/dist/cjs/components/duration.cjs +1 -0
- package/dist/cjs/components/format.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -0
- package/dist/cjs/components/status/colors.cjs +1 -0
- package/dist/cjs/components/status/index.cjs +1 -0
- package/dist/cjs/components/status/labels.cjs +1 -0
- package/dist/cjs/components/trigger-editor/helpers.cjs +1 -0
- package/dist/cjs/components/trigger-editor/index.cjs +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/pages/index.cjs +1 -0
- package/dist/cjs/pages/run-page/columns.cjs +1 -0
- package/dist/cjs/pages/run-page/detail.cjs +1 -0
- package/dist/cjs/pages/run-page/index.cjs +1 -0
- package/dist/cjs/pages/run-page/search.cjs +1 -0
- package/dist/cjs/pages/schedule-page/columns.cjs +1 -0
- package/dist/cjs/pages/schedule-page/form.cjs +1 -0
- package/dist/cjs/pages/schedule-page/helpers.cjs +1 -0
- package/dist/cjs/pages/schedule-page/index.cjs +1 -0
- package/dist/cjs/pages/schedule-page/model.cjs +1 -0
- package/dist/cjs/pages/schedule-page/search.cjs +1 -0
- package/dist/cjs/permissions.cjs +1 -0
- package/dist/cjs/types/enums.cjs +1 -0
- package/dist/cjs/types/index.cjs +1 -0
- package/dist/es/api/index.js +5 -0
- package/dist/es/api/query.js +13 -0
- package/dist/es/api/run-api.js +18 -0
- package/dist/es/api/schedule-api.js +32 -0
- package/dist/es/components/duration.js +68 -0
- package/dist/es/components/format.js +11 -0
- package/dist/es/components/index.js +9 -0
- package/dist/es/components/status/colors.js +13 -0
- package/dist/es/components/status/index.js +20 -0
- package/dist/es/components/status/labels.js +36 -0
- package/dist/es/components/trigger-editor/helpers.js +64 -0
- package/dist/es/components/trigger-editor/index.js +150 -0
- package/dist/es/index.js +19 -0
- package/dist/es/pages/index.js +7 -0
- package/dist/es/pages/run-page/columns.js +68 -0
- package/dist/es/pages/run-page/detail.js +117 -0
- package/dist/es/pages/run-page/index.js +36 -0
- package/dist/es/pages/run-page/search.js +96 -0
- package/dist/es/pages/schedule-page/columns.js +65 -0
- package/dist/es/pages/schedule-page/form.js +192 -0
- package/dist/es/pages/schedule-page/helpers.js +31 -0
- package/dist/es/pages/schedule-page/index.js +136 -0
- package/dist/es/pages/schedule-page/model.js +89 -0
- package/dist/es/pages/schedule-page/search.js +79 -0
- package/dist/es/permissions.js +11 -0
- package/dist/es/types/enums.js +17 -0
- package/dist/es/types/index.js +3 -0
- package/dist/types/api/index.d.ts +3 -0
- package/dist/types/api/query.d.ts +16 -0
- package/dist/types/api/run-api.d.ts +15 -0
- package/dist/types/api/schedule-api.d.ts +24 -0
- package/dist/types/components/duration.d.ts +33 -0
- package/dist/types/components/format.d.ts +10 -0
- package/dist/types/components/index.d.ts +7 -0
- package/dist/types/components/status/colors.d.ts +6 -0
- package/dist/types/components/status/index.d.ts +13 -0
- package/dist/types/components/status/labels.d.ts +24 -0
- package/dist/types/components/trigger-editor/helpers.d.ts +41 -0
- package/dist/types/components/trigger-editor/index.d.ts +18 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/pages/index.d.ts +7 -0
- package/dist/types/pages/run-page/columns.d.ts +3 -0
- package/dist/types/pages/run-page/detail.d.ts +9 -0
- package/dist/types/pages/run-page/index.d.ts +6 -0
- package/dist/types/pages/run-page/props.d.ts +11 -0
- package/dist/types/pages/run-page/search.d.ts +9 -0
- package/dist/types/pages/schedule-page/columns.d.ts +3 -0
- package/dist/types/pages/schedule-page/form.d.ts +4 -0
- package/dist/types/pages/schedule-page/helpers.d.ts +29 -0
- package/dist/types/pages/schedule-page/index.d.ts +7 -0
- package/dist/types/pages/schedule-page/model.d.ts +62 -0
- package/dist/types/pages/schedule-page/props.d.ts +16 -0
- package/dist/types/pages/schedule-page/search.d.ts +8 -0
- package/dist/types/permissions.d.ts +22 -0
- package/dist/types/types/base.d.ts +14 -0
- package/dist/types/types/enums.d.ts +29 -0
- package/dist/types/types/index.d.ts +5 -0
- package/dist/types/types/json.d.ts +8 -0
- package/dist/types/types/run.d.ts +38 -0
- package/dist/types/types/schedule.d.ts +98 -0
- package/package.json +66 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PaginatedQueryParams } from '@vef-framework-react/components';
|
|
2
|
+
import { ApiResult, MutationFunction, PaginationResult, QueryFunction } from '@vef-framework-react/core';
|
|
3
|
+
import { PreviewFiresParams, PreviewFiresResult, Schedule, ScheduleDetail, ScheduleNameParams, ScheduleParams, ScheduleSearch } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* The query and mutation functions for the durable schedule store. Addressing
|
|
6
|
+
* is by `name` (there is no id-keyed delete and no batch delete), and every
|
|
7
|
+
* mutation shares the single `cron.schedule.manage` permission on the backend.
|
|
8
|
+
*/
|
|
9
|
+
export interface ScheduleApi {
|
|
10
|
+
findPage: QueryFunction<PaginationResult<Schedule>, PaginatedQueryParams<ScheduleSearch>>;
|
|
11
|
+
get: QueryFunction<ScheduleDetail, ScheduleNameParams>;
|
|
12
|
+
listJobs: QueryFunction<string[]>;
|
|
13
|
+
previewFires: QueryFunction<PreviewFiresResult, PreviewFiresParams>;
|
|
14
|
+
create: MutationFunction<ApiResult<unknown>, ScheduleParams>;
|
|
15
|
+
update: MutationFunction<ApiResult<unknown>, ScheduleParams>;
|
|
16
|
+
remove: MutationFunction<ApiResult<unknown>, ScheduleNameParams>;
|
|
17
|
+
pause: MutationFunction<ApiResult<unknown>, ScheduleNameParams>;
|
|
18
|
+
resume: MutationFunction<ApiResult<unknown>, ScheduleNameParams>;
|
|
19
|
+
triggerNow: MutationFunction<ApiResult<unknown>, ScheduleNameParams>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Schedule management API for the durable cron store.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useScheduleApi(): ScheduleApi;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A selectable time unit paired with its size in milliseconds. Used by the
|
|
3
|
+
* interval trigger editor and the timeout editor to present a value+unit input
|
|
4
|
+
* over a single millisecond-valued field.
|
|
5
|
+
*/
|
|
6
|
+
export interface DurationUnit {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
ms: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Units for the fixed-rate interval trigger (`everyMs`).
|
|
13
|
+
*/
|
|
14
|
+
export declare const INTERVAL_UNITS: DurationUnit[];
|
|
15
|
+
/**
|
|
16
|
+
* Units for the per-run timeout (`timeoutMs`).
|
|
17
|
+
*/
|
|
18
|
+
export declare const TIMEOUT_UNITS: DurationUnit[];
|
|
19
|
+
/**
|
|
20
|
+
* Combine a value expressed in `unit` into milliseconds. An unknown unit falls
|
|
21
|
+
* back to the first (smallest) unit; a negative value clamps to zero.
|
|
22
|
+
*/
|
|
23
|
+
export declare function combineDurationMs(value: number, unit: string, units: DurationUnit[]): number;
|
|
24
|
+
/**
|
|
25
|
+
* Split milliseconds into the coarsest unit that divides it evenly, so a saved
|
|
26
|
+
* `everyMs`/`timeoutMs` round-trips to the most readable value+unit. Zero maps
|
|
27
|
+
* to the smallest unit with a zero value; a value divisible by no unit falls
|
|
28
|
+
* back to the smallest unit.
|
|
29
|
+
*/
|
|
30
|
+
export declare function splitDurationMs(ms: number, units: DurationUnit[]): {
|
|
31
|
+
value: number;
|
|
32
|
+
unit: string;
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a naive local wall-clock timestamp for a table cell, or a dash when
|
|
3
|
+
* empty. Backend values already arrive as `YYYY-MM-DD HH:mm:ss`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatTimestamp(value?: string | null): string;
|
|
6
|
+
/**
|
|
7
|
+
* Humanize a run duration in milliseconds: sub-second stays as `ms`, under a
|
|
8
|
+
* minute becomes `s`, longer becomes `min`. A missing/zero duration is a dash.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatDuration(ms?: number | null): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { combineDurationMs, INTERVAL_UNITS, splitDurationMs, TIMEOUT_UNITS, type DurationUnit } from './duration';
|
|
2
|
+
export { formatDuration, formatTimestamp } from './format';
|
|
3
|
+
export { EnabledTag, RunStatusBadge } from './status';
|
|
4
|
+
export { RUN_STATUS_COLORS } from './status/colors';
|
|
5
|
+
export { CONCURRENCY_POLICY_LABELS, CONCURRENCY_POLICY_OPTIONS, MISFIRE_POLICY_LABELS, MISFIRE_POLICY_OPTIONS, RUN_STATUS_LABELS, RUN_STATUS_OPTIONS, TRIGGER_KIND_LABELS, TRIGGER_KIND_OPTIONS } from './status/labels';
|
|
6
|
+
export { TriggerEditor, type TriggerEditorProps } from './trigger-editor';
|
|
7
|
+
export { DEFAULT_TRIGGER, formatTriggerSummary, isTriggerComplete, triggerFormToParams, triggerToFormValues, type TriggerFields, type TriggerFormValues } from './trigger-editor/helpers';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RunStatus } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Run-status colors, expressed as antd Tag color tokens so they resolve through
|
|
4
|
+
* the framework theme (and flip with the dark algorithm) with no hardcoding.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RUN_STATUS_COLORS: Record<RunStatus, string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RunStatus } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A run's lifecycle status as a colored tag.
|
|
4
|
+
*/
|
|
5
|
+
export declare function RunStatusBadge({ status }: {
|
|
6
|
+
status: RunStatus;
|
|
7
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* A schedule's enabled/disabled state as a success/neutral tag.
|
|
10
|
+
*/
|
|
11
|
+
export declare function EnabledTag({ enabled }: {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConcurrencyPolicy, MisfirePolicy, RunStatus, TriggerKind } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Display labels for the shared vocabularies, one place so every view agrees.
|
|
4
|
+
*/
|
|
5
|
+
export declare const RUN_STATUS_LABELS: Record<RunStatus, string>;
|
|
6
|
+
export declare const RUN_STATUS_OPTIONS: Array<{
|
|
7
|
+
label: string;
|
|
8
|
+
value: RunStatus;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const TRIGGER_KIND_LABELS: Record<TriggerKind, string>;
|
|
11
|
+
export declare const TRIGGER_KIND_OPTIONS: Array<{
|
|
12
|
+
label: string;
|
|
13
|
+
value: TriggerKind;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const MISFIRE_POLICY_LABELS: Record<MisfirePolicy, string>;
|
|
16
|
+
export declare const MISFIRE_POLICY_OPTIONS: Array<{
|
|
17
|
+
label: string;
|
|
18
|
+
value: MisfirePolicy;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const CONCURRENCY_POLICY_LABELS: Record<ConcurrencyPolicy, string>;
|
|
21
|
+
export declare const CONCURRENCY_POLICY_OPTIONS: Array<{
|
|
22
|
+
label: string;
|
|
23
|
+
value: ConcurrencyPolicy;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Schedule, TriggerKind, TriggerParams } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* The subset of a schedule row that describes its trigger.
|
|
4
|
+
*/
|
|
5
|
+
export type TriggerFields = Pick<Schedule, "kind" | "expr" | "timezone" | "everyMs" | "fireAt">;
|
|
6
|
+
/**
|
|
7
|
+
* The trigger editor's UI-facing value. The interval is held as a value+unit
|
|
8
|
+
* pair (converted to `everyMs` on submit) so the editor can offer human units.
|
|
9
|
+
*/
|
|
10
|
+
export interface TriggerFormValues {
|
|
11
|
+
kind: TriggerKind;
|
|
12
|
+
expr: string;
|
|
13
|
+
timezone: string;
|
|
14
|
+
intervalValue: number;
|
|
15
|
+
intervalUnit: string;
|
|
16
|
+
at: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Defaults for a fresh trigger: the cron kind with an empty expression, plus
|
|
20
|
+
* a once-a-minute interval prefilled for when the user switches kinds.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_TRIGGER: TriggerFormValues;
|
|
23
|
+
/**
|
|
24
|
+
* Project a saved schedule's trigger fields into editable form values.
|
|
25
|
+
*/
|
|
26
|
+
export declare function triggerToFormValues(schedule: TriggerFields): TriggerFormValues;
|
|
27
|
+
/**
|
|
28
|
+
* Convert the editor's value into the wire trigger params, keeping only the
|
|
29
|
+
* fields the chosen kind needs.
|
|
30
|
+
*/
|
|
31
|
+
export declare function triggerFormToParams(trigger: TriggerFormValues): TriggerParams;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the trigger has enough filled in to preview: a cron expression, an
|
|
34
|
+
* interval of at least the 1000ms floor, or a chosen once time.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isTriggerComplete(trigger: TriggerFormValues): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* A one-line, humanized trigger summary for a schedule row: the cron
|
|
39
|
+
* expression (with timezone), the interval rate, or the single fire time.
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatTriggerSummary(schedule: TriggerFields): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TriggerFormValues } from './helpers';
|
|
2
|
+
export interface TriggerEditorProps {
|
|
3
|
+
value: TriggerFormValues;
|
|
4
|
+
onChange: (value: TriggerFormValues) => void;
|
|
5
|
+
/**
|
|
6
|
+
* The schedule's effective-window start, echoed into the fire preview.
|
|
7
|
+
*/
|
|
8
|
+
startsAt?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The schedule's effective-window end, echoed into the fire preview.
|
|
11
|
+
*/
|
|
12
|
+
endsAt?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A trigger editor: a kind switch (cron / interval / once) revealing the
|
|
16
|
+
* kind-specific fields, plus a debounced live preview of the next fire times.
|
|
17
|
+
*/
|
|
18
|
+
export declare function TriggerEditor({ value, onChange, startsAt, endsAt }: TriggerEditorProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { CronRunPage } from './run-page';
|
|
2
|
+
export { RunDetailDrawer, type RunDetailDrawerProps } from './run-page/detail';
|
|
3
|
+
export { type CronRunPageProps } from './run-page/props';
|
|
4
|
+
export { CronSchedulePage } from './schedule-page';
|
|
5
|
+
export { useJobNames, useScheduleFormMutations, type ScheduleSceneValues } from './schedule-page/helpers';
|
|
6
|
+
export { jsonParamsError, parseJsonParams, SCHEDULE_FORM_DEFAULTS, scheduleToFormValues, scheduleToParams, TIMEOUT_UNIT_OPTIONS, type JsonParamsResult, type ScheduleFormValues } from './schedule-page/model';
|
|
7
|
+
export { type CronSchedulePageProps } from './schedule-page/props';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface RunDetailDrawerProps {
|
|
2
|
+
runId: string | null;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The run detail drawer. It refetches the full row through `find_one` so the
|
|
7
|
+
* complete, untruncated error text is always available.
|
|
8
|
+
*/
|
|
9
|
+
export declare function RunDetailDrawer({ runId, onClose }: RunDetailDrawerProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CronRunPageProps } from './props';
|
|
2
|
+
/**
|
|
3
|
+
* Full-page, read-only browser over the cron run journal. Rows open a detail
|
|
4
|
+
* drawer (also via the 详情 action) carrying the complete error text.
|
|
5
|
+
*/
|
|
6
|
+
export declare function CronRunPage({ columnStorageKey, title }: CronRunPageProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The primary inline search field for the run journal.
|
|
3
|
+
*/
|
|
4
|
+
export declare function RunSearchFields(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Detailed run filters. The scheduled-time range maps to the
|
|
7
|
+
* `scheduledAtFrom` / `scheduledAtTo` gte/lte bounds.
|
|
8
|
+
*/
|
|
9
|
+
export declare function RunAdvancedSearchFields(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CrudBasicSceneFormValues, CrudKit } from '@vef-framework-react/components';
|
|
2
|
+
import { ApiResult, MutationFunction } from '@vef-framework-react/core';
|
|
3
|
+
import { Schedule, ScheduleSearch } from '../../types';
|
|
4
|
+
import { ScheduleFormValues } from './model';
|
|
5
|
+
/**
|
|
6
|
+
* Create and update share the schedule form shape.
|
|
7
|
+
*/
|
|
8
|
+
export type ScheduleSceneValues = CrudBasicSceneFormValues<ScheduleFormValues, ScheduleFormValues>;
|
|
9
|
+
export declare const ScheduleOperationButtonGroup: CrudKit<Schedule, ScheduleSearch, ScheduleSceneValues>["OperationButtonGroup"];
|
|
10
|
+
export declare const ScheduleActionButtonGroup: CrudKit<Schedule, ScheduleSearch, ScheduleSceneValues>["ActionButtonGroup"];
|
|
11
|
+
/**
|
|
12
|
+
* Form mutations that collapse the schedule form into API params before
|
|
13
|
+
* submitting create/update.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useScheduleFormMutations(): {
|
|
16
|
+
create: MutationFunction<ApiResult<unknown>, ScheduleFormValues>;
|
|
17
|
+
update: MutationFunction<ApiResult<unknown>, ScheduleFormValues>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The job names registered on the answering node — the only legal `jobName`
|
|
21
|
+
* values — as select options.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useJobNames(): {
|
|
24
|
+
options: Array<{
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}>;
|
|
28
|
+
loading: boolean;
|
|
29
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CronSchedulePageProps } from './props';
|
|
2
|
+
/**
|
|
3
|
+
* Full-page management of the durable cron schedule store. Schedules are
|
|
4
|
+
* addressed by name (no batch delete, no row selection); every mutation is
|
|
5
|
+
* gated on the single `manage` permission.
|
|
6
|
+
*/
|
|
7
|
+
export declare function CronSchedulePage({ permissions, columnStorageKey, title }: CronSchedulePageProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TriggerFormValues } from '../../components';
|
|
2
|
+
import { ConcurrencyPolicy, JsonObject, MisfirePolicy, Schedule, ScheduleParams } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* The schedule form's values. The trigger is held in the editor's value+unit
|
|
5
|
+
* shape, the timeout as a value+unit pair, and `params` as raw JSON text — all
|
|
6
|
+
* collapsed to the API model on submit. `originalName` is the addressing name
|
|
7
|
+
* captured when editing, so a changed `name` becomes a rename (`newName`).
|
|
8
|
+
*/
|
|
9
|
+
export interface ScheduleFormValues {
|
|
10
|
+
id?: string;
|
|
11
|
+
originalName?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
jobName: string;
|
|
14
|
+
trigger: TriggerFormValues;
|
|
15
|
+
startsAt: string;
|
|
16
|
+
endsAt: string;
|
|
17
|
+
misfirePolicy: MisfirePolicy;
|
|
18
|
+
concurrencyPolicy: ConcurrencyPolicy;
|
|
19
|
+
recover: boolean;
|
|
20
|
+
timeoutValue: number;
|
|
21
|
+
timeoutUnit: string;
|
|
22
|
+
paramsText: string;
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The outcome of parsing the params textarea: an optional object when valid
|
|
27
|
+
* (empty text yields no params), or a message describing why it is invalid.
|
|
28
|
+
*/
|
|
29
|
+
export type JsonParamsResult = {
|
|
30
|
+
ok: true;
|
|
31
|
+
value?: JsonObject;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
error: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Parse the params textarea into a JSON object. Empty text is valid and omits
|
|
38
|
+
* the params entirely; anything that is not a JSON object is rejected.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseJsonParams(text: string): JsonParamsResult;
|
|
41
|
+
/**
|
|
42
|
+
* The field-validator form of {@link parseJsonParams}: an error message when
|
|
43
|
+
* invalid, or undefined when valid.
|
|
44
|
+
*/
|
|
45
|
+
export declare function jsonParamsError(text: string): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Project a saved schedule into editable form values.
|
|
48
|
+
*/
|
|
49
|
+
export declare function scheduleToFormValues(row: Schedule): ScheduleFormValues;
|
|
50
|
+
/**
|
|
51
|
+
* Convert the form values into the API params: address by `originalName`,
|
|
52
|
+
* rename via `newName`, collapse the trigger, timeout and params.
|
|
53
|
+
*/
|
|
54
|
+
export declare function scheduleToParams(values: ScheduleFormValues): ScheduleParams;
|
|
55
|
+
/**
|
|
56
|
+
* Defaults for a newly created schedule.
|
|
57
|
+
*/
|
|
58
|
+
export declare const SCHEDULE_FORM_DEFAULTS: ScheduleFormValues;
|
|
59
|
+
export declare const TIMEOUT_UNIT_OPTIONS: {
|
|
60
|
+
label: string;
|
|
61
|
+
value: string;
|
|
62
|
+
}[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SchedulePermissionCodes } from '../../permissions';
|
|
3
|
+
export interface CronSchedulePageProps {
|
|
4
|
+
/**
|
|
5
|
+
* Override the permission codes the page gates its actions on. Defaults to `CRON_PERMISSIONS.schedule`.
|
|
6
|
+
*/
|
|
7
|
+
permissions?: Partial<SchedulePermissionCodes>;
|
|
8
|
+
/**
|
|
9
|
+
* Storage key for the column-settings panel.
|
|
10
|
+
*/
|
|
11
|
+
columnStorageKey?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional page title rendered above the table.
|
|
14
|
+
*/
|
|
15
|
+
title?: ReactNode;
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The primary inline search field for the schedule list.
|
|
3
|
+
*/
|
|
4
|
+
export declare function ScheduleSearchFields(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Less frequently used schedule filters shown in the expandable search panel.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ScheduleAdvancedSearchFields(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permission codes for the durable cron store management API, mirroring the
|
|
3
|
+
* backend `RequiredPermission` strings verbatim. These are the lockstep
|
|
4
|
+
* anchors between the Go resources and the React pages: every page defaults
|
|
5
|
+
* its permission gates to the matching entry here, and a business system
|
|
6
|
+
* overrides them through the page's `permissions` prop.
|
|
7
|
+
*
|
|
8
|
+
* All schedule mutations (create / update / delete / pause / resume /
|
|
9
|
+
* trigger_now) share the single `manage` code — there are no per-action codes.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CRON_PERMISSIONS: {
|
|
12
|
+
readonly schedule: {
|
|
13
|
+
readonly query: "cron.schedule.query";
|
|
14
|
+
readonly manage: "cron.schedule.manage";
|
|
15
|
+
};
|
|
16
|
+
readonly run: {
|
|
17
|
+
readonly query: "cron.run.query";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type CronPermissions = typeof CRON_PERMISSIONS;
|
|
21
|
+
export type SchedulePermissionCodes = CronPermissions["schedule"];
|
|
22
|
+
export type RunPermissionCodes = CronPermissions["run"];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit envelopes shared by the cron models. They mirror the Go
|
|
3
|
+
* `orm.CreationAuditedModel` and `orm.FullAuditedModel` embeds: a management
|
|
4
|
+
* list row carries the id and the audit fields the server projects.
|
|
5
|
+
*/
|
|
6
|
+
export interface CreationAudited {
|
|
7
|
+
id: string;
|
|
8
|
+
createdAt?: string;
|
|
9
|
+
createdBy?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface FullAudited extends CreationAudited {
|
|
12
|
+
updatedAt?: string;
|
|
13
|
+
updatedBy?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The typed vocabularies the durable cron store shares with the management UI.
|
|
3
|
+
* Each mirrors a Go enum verbatim and must stay in lockstep with it; display
|
|
4
|
+
* labels and colors live with the presentation components, not here.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* How a schedule computes its fire times. `cron` uses a 5- or 6-field cron
|
|
8
|
+
* expression (or an `@daily`-style descriptor); `interval` fires at a fixed
|
|
9
|
+
* rate; `once` fires a single time.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TRIGGER_KINDS: readonly ["cron", "interval", "once"];
|
|
12
|
+
export type TriggerKind = (typeof TRIGGER_KINDS)[number];
|
|
13
|
+
/**
|
|
14
|
+
* What to do with occurrences missed while a node was down or the schedule was
|
|
15
|
+
* paused: `fire_now` runs the gap once immediately, `skip` drops it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MISFIRE_POLICIES: readonly ["fire_now", "skip"];
|
|
18
|
+
export type MisfirePolicy = (typeof MISFIRE_POLICIES)[number];
|
|
19
|
+
/**
|
|
20
|
+
* Whether a new occurrence may start while the previous run is still going:
|
|
21
|
+
* `forbid` skips the overlap, `allow` runs them in parallel.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CONCURRENCY_POLICIES: readonly ["forbid", "allow"];
|
|
24
|
+
export type ConcurrencyPolicy = (typeof CONCURRENCY_POLICIES)[number];
|
|
25
|
+
/**
|
|
26
|
+
* The lifecycle status of one journaled run.
|
|
27
|
+
*/
|
|
28
|
+
export declare const RUN_STATUSES: readonly ["running", "succeeded", "failed", "missed", "skipped", "abandoned", "canceled"];
|
|
29
|
+
export type RunStatus = (typeof RUN_STATUSES)[number];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { CreationAudited, FullAudited } from './base';
|
|
2
|
+
export * from './enums';
|
|
3
|
+
export type { JsonObject, JsonValue } from './json';
|
|
4
|
+
export type { Run, RunIdParams, RunSearch } from './run';
|
|
5
|
+
export type { PreviewFiresParams, PreviewFiresResult, Schedule, ScheduleDetail, ScheduleNameParams, ScheduleParams, ScheduleSearch, TriggerParams } from './schedule';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A JSON value and the object form used for a schedule's opaque `params`
|
|
3
|
+
* payload — carried verbatim to the job handler on the Go side.
|
|
4
|
+
*/
|
|
5
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
6
|
+
[key: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
export type JsonObject = Record<string, JsonValue>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CreationAudited } from './base';
|
|
2
|
+
import { RunStatus } from './enums';
|
|
3
|
+
/**
|
|
4
|
+
* One journaled run of a schedule from `sys/cron/run`. Read-only. Timestamps
|
|
5
|
+
* are naive local wall-clock strings. Mirrors the Go `cron.Run` projection.
|
|
6
|
+
*/
|
|
7
|
+
export interface Run extends CreationAudited {
|
|
8
|
+
scheduleId: string;
|
|
9
|
+
scheduleName: string;
|
|
10
|
+
jobName: string;
|
|
11
|
+
scheduledAt: string;
|
|
12
|
+
status: RunStatus;
|
|
13
|
+
nodeId: string;
|
|
14
|
+
startedAt?: string;
|
|
15
|
+
finishedAt?: string;
|
|
16
|
+
durationMs: number;
|
|
17
|
+
heartbeatAt?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
missedCount?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Search parameters for runs. `scheduledAtFrom` / `scheduledAtTo` bound the
|
|
23
|
+
* scheduled time (gte / lte).
|
|
24
|
+
*/
|
|
25
|
+
export interface RunSearch {
|
|
26
|
+
scheduleName?: string;
|
|
27
|
+
jobName?: string;
|
|
28
|
+
status?: RunStatus;
|
|
29
|
+
nodeId?: string;
|
|
30
|
+
scheduledAtFrom?: string;
|
|
31
|
+
scheduledAtTo?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Addressing payload for the single-run fetch (`find_one`).
|
|
35
|
+
*/
|
|
36
|
+
export interface RunIdParams {
|
|
37
|
+
id: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { FullAudited } from './base';
|
|
2
|
+
import { ConcurrencyPolicy, MisfirePolicy, TriggerKind } from './enums';
|
|
3
|
+
import { JsonObject } from './json';
|
|
4
|
+
/**
|
|
5
|
+
* A durable schedule row from `sys/cron/schedule`. Timestamps are naive local
|
|
6
|
+
* wall-clock strings (`YYYY-MM-DD HH:mm:ss`). Mirrors the Go `cron.Schedule`
|
|
7
|
+
* projection.
|
|
8
|
+
*/
|
|
9
|
+
export interface Schedule extends FullAudited {
|
|
10
|
+
name: string;
|
|
11
|
+
jobName: string;
|
|
12
|
+
kind: TriggerKind;
|
|
13
|
+
expr: string;
|
|
14
|
+
timezone: string;
|
|
15
|
+
everyMs: number;
|
|
16
|
+
fireAt?: string;
|
|
17
|
+
startsAt?: string;
|
|
18
|
+
endsAt?: string;
|
|
19
|
+
params?: JsonObject;
|
|
20
|
+
misfirePolicy: MisfirePolicy;
|
|
21
|
+
concurrencyPolicy: ConcurrencyPolicy;
|
|
22
|
+
recover: boolean;
|
|
23
|
+
timeoutMs: number;
|
|
24
|
+
isEnabled: boolean;
|
|
25
|
+
nextFireAt?: string;
|
|
26
|
+
lastFireAt?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The trigger definition submitted with a schedule save. Only the fields the
|
|
30
|
+
* chosen `kind` needs are populated: `cron` → `expr` (+ optional `timezone`),
|
|
31
|
+
* `interval` → `everyMs` (fixed rate, min 1000), `once` → `at` (a DateTime).
|
|
32
|
+
*/
|
|
33
|
+
export interface TriggerParams {
|
|
34
|
+
kind: TriggerKind;
|
|
35
|
+
expr?: string;
|
|
36
|
+
timezone?: string;
|
|
37
|
+
everyMs?: number;
|
|
38
|
+
at?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create/update parameters for a schedule. Addressing is by `name`; on update
|
|
42
|
+
* an optional `newName` renames the schedule.
|
|
43
|
+
*/
|
|
44
|
+
export interface ScheduleParams {
|
|
45
|
+
name: string;
|
|
46
|
+
newName?: string;
|
|
47
|
+
jobName: string;
|
|
48
|
+
trigger: TriggerParams;
|
|
49
|
+
params?: JsonObject;
|
|
50
|
+
startsAt?: string;
|
|
51
|
+
endsAt?: string;
|
|
52
|
+
misfirePolicy?: MisfirePolicy;
|
|
53
|
+
concurrencyPolicy?: ConcurrencyPolicy;
|
|
54
|
+
recover?: boolean;
|
|
55
|
+
timeoutMs?: number;
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Search parameters for schedules. `isEnabled` is a `"true"` / `"false"`
|
|
60
|
+
* toggle string — framework select values are strings — which `findPage`
|
|
61
|
+
* converts to the boolean the wire eq filter expects.
|
|
62
|
+
*/
|
|
63
|
+
export interface ScheduleSearch {
|
|
64
|
+
name?: string;
|
|
65
|
+
jobName?: string;
|
|
66
|
+
kind?: TriggerKind;
|
|
67
|
+
isEnabled?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Addressing payload for the name-keyed schedule actions (get / delete /
|
|
71
|
+
* pause / resume / trigger_now).
|
|
72
|
+
*/
|
|
73
|
+
export interface ScheduleNameParams {
|
|
74
|
+
name: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The `get` result: the schedule plus a preview of its next fire times (empty
|
|
78
|
+
* when the schedule is paused or spent).
|
|
79
|
+
*/
|
|
80
|
+
export interface ScheduleDetail {
|
|
81
|
+
schedule: Schedule;
|
|
82
|
+
nextFires: string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Parameters for the `preview_fires` probe. The trigger is validated exactly
|
|
86
|
+
* like a save, so an invalid expression comes back as a business error.
|
|
87
|
+
*/
|
|
88
|
+
export interface PreviewFiresParams {
|
|
89
|
+
trigger: TriggerParams;
|
|
90
|
+
startsAt?: string;
|
|
91
|
+
endsAt?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The `preview_fires` result: the next fire times inside the effective window.
|
|
95
|
+
*/
|
|
96
|
+
export interface PreviewFiresResult {
|
|
97
|
+
nextFires: string[];
|
|
98
|
+
}
|