@abyss-project/reflex 5.2.0 → 5.3.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/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/service-task.api.d.ts +9 -0
- package/dist/api/service-task.api.js +24 -0
- package/dist/api/service-task.api.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/index.d.ts +2 -0
- package/dist/types/enum/index.js +2 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/reflex-error-code.enum.d.ts +2 -1
- package/dist/types/enum/reflex-error-code.enum.js +1 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/enum/schedule-sync-status.enum.d.ts +5 -0
- package/dist/types/enum/schedule-sync-status.enum.js +10 -0
- package/dist/types/enum/schedule-sync-status.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-origin.enum.d.ts +4 -0
- package/dist/types/enum/scheduled-run-origin.enum.js +9 -0
- package/dist/types/enum/scheduled-run-origin.enum.js.map +1 -0
- package/dist/types/interface/api/requests/function-run.request.d.ts +2 -0
- package/dist/types/interface/api/requests/function-test.request.d.ts +4 -0
- package/dist/types/interface/api/requests/index.d.ts +1 -0
- package/dist/types/interface/api/requests/index.js +1 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/service-task.request.d.ts +54 -0
- package/dist/types/interface/api/requests/service-task.request.js +3 -0
- package/dist/types/interface/api/requests/service-task.request.js.map +1 -0
- package/dist/types/interface/api/responses/index.d.ts +1 -0
- package/dist/types/interface/api/responses/index.js +1 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/service-task.response.d.ts +31 -0
- package/dist/types/interface/api/responses/service-task.response.js +3 -0
- package/dist/types/interface/api/responses/service-task.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-version.response.d.ts +9 -1
- package/dist/types/interface/models/index.d.ts +1 -0
- package/dist/types/interface/models/index.js +1 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-run.model.d.ts +3 -1
- package/dist/types/interface/models/reflex-service-deployment.model.d.ts +4 -1
- package/dist/types/interface/models/reflex-service-version.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-task.model.d.ts +35 -0
- package/dist/types/interface/models/reflex-task.model.js +15 -0
- package/dist/types/interface/models/reflex-task.model.js.map +1 -0
- package/package.json +1 -1
- package/src/api/function-access.api.ts +36 -36
- package/src/api/function-run.api.ts +38 -38
- package/src/api/function-settings.api.ts +59 -59
- package/src/api/function-test.api.ts +34 -34
- package/src/api/function-version.api.ts +48 -48
- package/src/api/function.api.test.ts +249 -249
- package/src/api/function.api.ts +62 -62
- package/src/api/health.api.ts +10 -10
- package/src/api/index.ts +14 -13
- package/src/api/service-configuration.api.ts +16 -16
- package/src/api/service-deployment.api.ts +79 -79
- package/src/api/service-discord.api.test.ts +170 -170
- package/src/api/service-discord.api.ts +203 -203
- package/src/api/service-route.api.ts +72 -72
- package/src/api/service-task.api.test.ts +124 -0
- package/src/api/service-task.api.ts +122 -0
- package/src/api/service-version.api.ts +54 -54
- package/src/api/service.api.test.ts +215 -215
- package/src/api/service.api.ts +55 -55
- package/src/index.ts +264 -237
- package/src/types/enum/index.ts +2 -0
- package/src/types/enum/reflex-error-code.enum.ts +2 -0
- package/src/types/enum/schedule-sync-status.enum.ts +6 -0
- package/src/types/enum/scheduled-run-origin.enum.ts +5 -0
- package/src/types/interface/api/requests/function-run.request.ts +4 -0
- package/src/types/interface/api/requests/function-test.request.ts +16 -1
- package/src/types/interface/api/requests/index.ts +1 -0
- package/src/types/interface/api/requests/service-task.request.ts +66 -0
- package/src/types/interface/api/requests/service-version.request.ts +24 -24
- package/src/types/interface/api/responses/index.ts +1 -0
- package/src/types/interface/api/responses/service-task.response.ts +48 -0
- package/src/types/interface/api/responses/service-version.response.ts +91 -73
- package/src/types/interface/models/index.ts +1 -0
- package/src/types/interface/models/reflex-run.model.ts +7 -1
- package/src/types/interface/models/reflex-service-deployment.model.ts +6 -0
- package/src/types/interface/models/reflex-service-version.model.ts +3 -0
- package/src/types/interface/models/reflex-task.model.ts +61 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface IListServiceTaskParams {
|
|
2
|
+
applicationId: string;
|
|
3
|
+
serviceId: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface ICreateServiceTaskParams {
|
|
7
|
+
applicationId: string;
|
|
8
|
+
serviceId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ICreateServiceTaskBody {
|
|
11
|
+
/** `^[-_a-z0-9]{1,32}$`, unique within the Service. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** A function of the same Service. */
|
|
14
|
+
functionId: string;
|
|
15
|
+
/** A cron of 5 fields, at most one tick a minute; null (default) for a task only delayed runs start. */
|
|
16
|
+
schedule?: string | null;
|
|
17
|
+
/** IANA time zone the cron is read in; `Etc/UTC` by default. */
|
|
18
|
+
timezone?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IUpdateServiceTaskParams {
|
|
22
|
+
applicationId: string;
|
|
23
|
+
serviceId: string;
|
|
24
|
+
taskId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IUpdateServiceTaskBody {
|
|
27
|
+
name?: string;
|
|
28
|
+
functionId?: string;
|
|
29
|
+
schedule?: string | null;
|
|
30
|
+
timezone?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IDeleteServiceTaskParams {
|
|
34
|
+
applicationId: string;
|
|
35
|
+
serviceId: string;
|
|
36
|
+
taskId: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ITestRunServiceTaskParams {
|
|
40
|
+
applicationId: string;
|
|
41
|
+
serviceId: string;
|
|
42
|
+
taskId: string;
|
|
43
|
+
}
|
|
44
|
+
export interface ITestRunServiceTaskBody {
|
|
45
|
+
/** The environment of the application the test run takes place in (abyss-main's id). */
|
|
46
|
+
environmentId: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IListServiceDelayedRunParams {
|
|
50
|
+
applicationId: string;
|
|
51
|
+
serviceId: string;
|
|
52
|
+
environmentId: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ICancelServiceDelayedRunParams {
|
|
56
|
+
applicationId: string;
|
|
57
|
+
serviceId: string;
|
|
58
|
+
environmentId: string;
|
|
59
|
+
delayedRunId: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IRetryServiceScheduleSyncParams {
|
|
63
|
+
applicationId: string;
|
|
64
|
+
serviceId: string;
|
|
65
|
+
environmentId: string;
|
|
66
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export interface IListServiceVersionParams {
|
|
2
|
-
applicationId: string;
|
|
3
|
-
serviceId: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface ICreateServiceVersionParams {
|
|
7
|
-
applicationId: string;
|
|
8
|
-
serviceId: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ICreateServiceVersionBody {
|
|
11
|
-
/** 500 characters at most. */
|
|
12
|
-
message?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IGetServiceVersionDraftStatusParams {
|
|
16
|
-
applicationId: string;
|
|
17
|
-
serviceId: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface IGetServiceVersionParams {
|
|
21
|
-
applicationId: string;
|
|
22
|
-
serviceId: string;
|
|
23
|
-
versionId: string;
|
|
24
|
-
}
|
|
1
|
+
export interface IListServiceVersionParams {
|
|
2
|
+
applicationId: string;
|
|
3
|
+
serviceId: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface ICreateServiceVersionParams {
|
|
7
|
+
applicationId: string;
|
|
8
|
+
serviceId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ICreateServiceVersionBody {
|
|
11
|
+
/** 500 characters at most. */
|
|
12
|
+
message?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IGetServiceVersionDraftStatusParams {
|
|
16
|
+
applicationId: string;
|
|
17
|
+
serviceId: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IGetServiceVersionParams {
|
|
21
|
+
applicationId: string;
|
|
22
|
+
serviceId: string;
|
|
23
|
+
versionId: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IReflexDelayedRun,
|
|
3
|
+
IReflexRun,
|
|
4
|
+
IReflexServiceDeployment,
|
|
5
|
+
IReflexTask,
|
|
6
|
+
} from '../../models';
|
|
7
|
+
import type { IResponse } from '../response';
|
|
8
|
+
|
|
9
|
+
export interface IListServiceTaskData {
|
|
10
|
+
/** By name. */
|
|
11
|
+
tasks: IReflexTask[];
|
|
12
|
+
}
|
|
13
|
+
export type IListServiceTaskResponse = IResponse<IListServiceTaskData>;
|
|
14
|
+
|
|
15
|
+
export interface ICreateServiceTaskData {
|
|
16
|
+
task: IReflexTask;
|
|
17
|
+
}
|
|
18
|
+
export type ICreateServiceTaskResponse = IResponse<ICreateServiceTaskData>;
|
|
19
|
+
|
|
20
|
+
export interface IUpdateServiceTaskData {
|
|
21
|
+
task: IReflexTask;
|
|
22
|
+
}
|
|
23
|
+
export type IUpdateServiceTaskResponse = IResponse<IUpdateServiceTaskData>;
|
|
24
|
+
|
|
25
|
+
export type IDeleteServiceTaskData = Record<string, never>;
|
|
26
|
+
export type IDeleteServiceTaskResponse = IResponse<IDeleteServiceTaskData>;
|
|
27
|
+
|
|
28
|
+
export interface ITestRunServiceTaskData {
|
|
29
|
+
run: IReflexRun;
|
|
30
|
+
}
|
|
31
|
+
export type ITestRunServiceTaskResponse = IResponse<ITestRunServiceTaskData>;
|
|
32
|
+
|
|
33
|
+
export interface IListServiceDelayedRunData {
|
|
34
|
+
/** The first 100 pending delayed runs of the environment, soonest due first. */
|
|
35
|
+
delayedRuns: IReflexDelayedRun[];
|
|
36
|
+
/** Pending delayed runs of the environment, all of them. */
|
|
37
|
+
total: number;
|
|
38
|
+
}
|
|
39
|
+
export type IListServiceDelayedRunResponse = IResponse<IListServiceDelayedRunData>;
|
|
40
|
+
|
|
41
|
+
export type ICancelServiceDelayedRunData = Record<string, never>;
|
|
42
|
+
export type ICancelServiceDelayedRunResponse = IResponse<ICancelServiceDelayedRunData>;
|
|
43
|
+
|
|
44
|
+
export interface IRetryServiceScheduleSyncData {
|
|
45
|
+
/** The current deployment of the environment, with the new state of the synchronization. */
|
|
46
|
+
deployment: IReflexServiceDeployment;
|
|
47
|
+
}
|
|
48
|
+
export type IRetryServiceScheduleSyncResponse = IResponse<IRetryServiceScheduleSyncData>;
|
|
@@ -1,73 +1,91 @@
|
|
|
1
|
-
import type { ServiceVersionChangeKind } from '../../../enum';
|
|
2
|
-
import type {
|
|
3
|
-
IReflexDiscordCommandSnapshot,
|
|
4
|
-
IReflexDiscordComponentSnapshot,
|
|
5
|
-
IReflexServiceVersion,
|
|
6
|
-
IReflexServiceVersionRoute,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
version
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export interface
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
export type
|
|
61
|
-
|
|
62
|
-
export interface
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
1
|
+
import type { ServiceVersionChangeKind } from '../../../enum';
|
|
2
|
+
import type {
|
|
3
|
+
IReflexDiscordCommandSnapshot,
|
|
4
|
+
IReflexDiscordComponentSnapshot,
|
|
5
|
+
IReflexServiceVersion,
|
|
6
|
+
IReflexServiceVersionRoute,
|
|
7
|
+
IReflexTaskSnapshot,
|
|
8
|
+
} from '../../models';
|
|
9
|
+
import type { IResponse } from '../response';
|
|
10
|
+
|
|
11
|
+
/** How one route differs from the previous version, matched by route id. */
|
|
12
|
+
export interface IReflexServiceVersionRouteChange {
|
|
13
|
+
routeId: string;
|
|
14
|
+
kind: ServiceVersionChangeKind;
|
|
15
|
+
/** The route in the previous version; null when ADDED. */
|
|
16
|
+
before: IReflexServiceVersionRoute | null;
|
|
17
|
+
/** The route in this version; null when REMOVED. */
|
|
18
|
+
after: IReflexServiceVersionRoute | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** How one command of a Discord bot differs from the previous version, matched by command id. */
|
|
22
|
+
export interface IReflexServiceVersionCommandChange {
|
|
23
|
+
commandId: string;
|
|
24
|
+
kind: ServiceVersionChangeKind;
|
|
25
|
+
/** The command in the previous version; null when ADDED. */
|
|
26
|
+
before: IReflexDiscordCommandSnapshot | null;
|
|
27
|
+
/** The command in this version; null when REMOVED. */
|
|
28
|
+
after: IReflexDiscordCommandSnapshot | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** How one component of a Discord bot differs from the previous version, matched by component id. */
|
|
32
|
+
export interface IReflexServiceVersionComponentChange {
|
|
33
|
+
componentId: string;
|
|
34
|
+
kind: ServiceVersionChangeKind;
|
|
35
|
+
/** The component in the previous version; null when ADDED. */
|
|
36
|
+
before: IReflexDiscordComponentSnapshot | null;
|
|
37
|
+
/** The component in this version; null when REMOVED. */
|
|
38
|
+
after: IReflexDiscordComponentSnapshot | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** How one task of the Service differs from the previous version, matched by task id. */
|
|
42
|
+
export interface IReflexServiceVersionTaskChange {
|
|
43
|
+
taskId: string;
|
|
44
|
+
kind: ServiceVersionChangeKind;
|
|
45
|
+
/** The task in the previous version; null when ADDED. */
|
|
46
|
+
before: IReflexTaskSnapshot | null;
|
|
47
|
+
/** The task in this version; null when REMOVED. */
|
|
48
|
+
after: IReflexTaskSnapshot | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IListServiceVersionData {
|
|
52
|
+
/** Newest first. */
|
|
53
|
+
versions: IReflexServiceVersion[];
|
|
54
|
+
}
|
|
55
|
+
export type IListServiceVersionResponse = IResponse<IListServiceVersionData>;
|
|
56
|
+
|
|
57
|
+
export interface ICreateServiceVersionData {
|
|
58
|
+
version: IReflexServiceVersion;
|
|
59
|
+
}
|
|
60
|
+
export type ICreateServiceVersionResponse = IResponse<ICreateServiceVersionData>;
|
|
61
|
+
|
|
62
|
+
export interface IGetServiceVersionDraftStatusData {
|
|
63
|
+
/**
|
|
64
|
+
* How many functions of the Service a version created now would freeze at a version other than the one
|
|
65
|
+
* the last Service version froze: a function new to the Service, a draft that differs from its last
|
|
66
|
+
* version (an invalid draft counts), or a function version published since. Same rule as
|
|
67
|
+
* `POST .../version`; 0 for a Service without functions.
|
|
68
|
+
*/
|
|
69
|
+
changedFunctions: number;
|
|
70
|
+
/**
|
|
71
|
+
* How many tasks of the draft differ from the last Service version: added, modified (function, name,
|
|
72
|
+
* cron or time zone) or removed. 0 for a Service without tasks.
|
|
73
|
+
*/
|
|
74
|
+
changedTasks: number;
|
|
75
|
+
}
|
|
76
|
+
export type IGetServiceVersionDraftStatusResponse = IResponse<IGetServiceVersionDraftStatusData>;
|
|
77
|
+
|
|
78
|
+
export interface IGetServiceVersionData {
|
|
79
|
+
version: IReflexServiceVersion;
|
|
80
|
+
/** The version just before; null for the first one. */
|
|
81
|
+
previousVersion: IReflexServiceVersion | null;
|
|
82
|
+
/** The routes added, removed or modified since `previousVersion` (every route is ADDED for the first one). */
|
|
83
|
+
routeChanges: IReflexServiceVersionRouteChange[];
|
|
84
|
+
/** The commands added, removed or modified since `previousVersion`; empty for a Service that is not a Discord bot. */
|
|
85
|
+
commandChanges: IReflexServiceVersionCommandChange[];
|
|
86
|
+
/** The components added, removed or modified since `previousVersion`; empty for a Service that is not a Discord bot. */
|
|
87
|
+
componentChanges: IReflexServiceVersionComponentChange[];
|
|
88
|
+
/** The tasks added, removed or modified since `previousVersion` (every task is ADDED for the first one). */
|
|
89
|
+
taskChanges: IReflexServiceVersionTaskChange[];
|
|
90
|
+
}
|
|
91
|
+
export type IGetServiceVersionResponse = IResponse<IGetServiceVersionData>;
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
RunMode,
|
|
6
6
|
RunStatus,
|
|
7
7
|
RunStepStatus,
|
|
8
|
+
ScheduledRunOrigin,
|
|
8
9
|
TraceEffectType,
|
|
9
10
|
} from '../../enum';
|
|
10
11
|
|
|
@@ -70,9 +71,14 @@ export interface IReflexRun {
|
|
|
70
71
|
commandId: string | null;
|
|
71
72
|
/** The Discord component that started a LIVE run; null otherwise. */
|
|
72
73
|
componentId: string | null;
|
|
74
|
+
/** The task that started a LIVE run, by a tick of its cron or a delayed run; null otherwise. */
|
|
75
|
+
taskId: string | null;
|
|
76
|
+
/** How the task started the run: RECURRING for a tick of its cron, DELAYED for a delayed run; null when no task did. */
|
|
77
|
+
scheduledRunOrigin: ScheduledRunOrigin | null;
|
|
73
78
|
/**
|
|
74
79
|
* What started the run, for a screen: `METHOD path` for a route, `/name` for a command, the custom id
|
|
75
|
-
* prefix for a component. Null for a test run, and when the route, command
|
|
80
|
+
* prefix for a component, the name for a task. Null for a test run, and when the route, command,
|
|
81
|
+
* component or task was deleted.
|
|
76
82
|
*/
|
|
77
83
|
originLabel: string | null;
|
|
78
84
|
/** The HTTP status the caller of a LIVE run got; null for a test run. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
DiscordSyncStatus,
|
|
3
|
+
ScheduleSyncStatus,
|
|
3
4
|
ServiceDeploymentAction,
|
|
4
5
|
ServiceDeploymentStatus,
|
|
5
6
|
} from '../../enum';
|
|
@@ -32,6 +33,11 @@ export interface IReflexServiceDeployment {
|
|
|
32
33
|
/** Code and message of the Discord refusal when `discordSync` is FAILED (500 characters at most). */
|
|
33
34
|
discordSyncError: string | null;
|
|
34
35
|
discordSyncedAt: Date | null;
|
|
36
|
+
/** Synchronization of the cron tasks of the version with Flow; null when the version has no cron task. */
|
|
37
|
+
scheduleSync: ScheduleSyncStatus | null;
|
|
38
|
+
/** Code and message of the failure when `scheduleSync` is FAILED (500 characters at most). */
|
|
39
|
+
scheduleSyncError: string | null;
|
|
40
|
+
scheduleSyncedAt: Date | null;
|
|
35
41
|
/** The bot was paused by the plan quota (ADR-0277), not by a member: only those resume with the plan. */
|
|
36
42
|
pausedForQuota: boolean;
|
|
37
43
|
isCurrent: boolean;
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
IReflexDiscordComponentSnapshot,
|
|
5
5
|
} from './reflex-discord.model';
|
|
6
6
|
import type { IReflexServiceCors } from './reflex-service.model';
|
|
7
|
+
import type { IReflexTaskSnapshot } from './reflex-task.model';
|
|
7
8
|
|
|
8
9
|
/** A route as a version of the Service froze it. */
|
|
9
10
|
export interface IReflexServiceVersionRoute {
|
|
@@ -38,6 +39,8 @@ export interface IReflexServiceVersionSnapshot {
|
|
|
38
39
|
rateLimitPerIpPerMinute: number;
|
|
39
40
|
/** Only a `DISCORD_BOT` Service has it (its `routes` are then empty); absent otherwise, so the hash of other versions is unchanged. */
|
|
40
41
|
discord?: IReflexServiceVersionDiscord;
|
|
42
|
+
/** The tasks of the Service, by name; absent when it has none, so the hash of other versions is unchanged. */
|
|
43
|
+
tasks?: IReflexTaskSnapshot[];
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
export interface IReflexServiceVersion {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Bounds of the tasks of a Service and of their delayed runs; the API, the edge and their databases apply the same ones. */
|
|
2
|
+
export const REFLEX_TASK_LIMITS = {
|
|
3
|
+
/** `^[-_a-z0-9]{1,32}$`: the name `abyss.schedule.*` targets. */
|
|
4
|
+
namePattern: /^[-_a-z0-9]{1,32}$/,
|
|
5
|
+
maxTasksPerService: 20,
|
|
6
|
+
nameMaxLength: 32,
|
|
7
|
+
/** Characters of the payload of a delayed run, serialized to JSON. */
|
|
8
|
+
payloadMaxLength: 4096,
|
|
9
|
+
/** Shortest delay of a delayed run. */
|
|
10
|
+
delayMinSeconds: 1,
|
|
11
|
+
/** Furthest due date of a delayed run. */
|
|
12
|
+
delayMaxDays: 30,
|
|
13
|
+
/** Lateness past which a tick of a cron is EXPIRED instead of run (after a pause or an outage). */
|
|
14
|
+
recurringToleranceMinutes: 5,
|
|
15
|
+
/** Lateness past which a delayed run is EXPIRED instead of run. */
|
|
16
|
+
delayedToleranceMinutes: 60,
|
|
17
|
+
/** Attempts of a scheduled run interrupted before its end (at least once). */
|
|
18
|
+
maxAttempts: 3,
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
/** A task of the draft of a Service: a named target of a cron and of `abyss.schedule.*`. */
|
|
22
|
+
export interface IReflexTask {
|
|
23
|
+
id: string;
|
|
24
|
+
serviceId: string;
|
|
25
|
+
/** A function of the same Service. */
|
|
26
|
+
functionId: string;
|
|
27
|
+
/** Unique within the Service. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** A cron of 5 fields, read in `timezone`, at most one tick a minute; null for a task only delayed runs start. */
|
|
30
|
+
schedule: string | null;
|
|
31
|
+
/** IANA time zone of the cron; `Etc/UTC` by default. */
|
|
32
|
+
timezone: string;
|
|
33
|
+
createdAt: Date;
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** A task as a version of the Service froze it. */
|
|
38
|
+
export type IReflexTaskSnapshot = Pick<
|
|
39
|
+
IReflexTask,
|
|
40
|
+
'id' | 'functionId' | 'name' | 'schedule' | 'timezone'
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
/** A delayed run waiting for its due date in one environment. */
|
|
44
|
+
export interface IReflexDelayedRun {
|
|
45
|
+
id: string;
|
|
46
|
+
serviceId: string;
|
|
47
|
+
environmentId: string;
|
|
48
|
+
taskId: string;
|
|
49
|
+
/** The name of the task in the version in service; null when that version no longer has it. */
|
|
50
|
+
taskName: string | null;
|
|
51
|
+
dueAt: Date;
|
|
52
|
+
/** The deduplication key it was scheduled with; null without one. */
|
|
53
|
+
key: string | null;
|
|
54
|
+
/** The payload handed to the run; null without one. */
|
|
55
|
+
payload: unknown;
|
|
56
|
+
/** Attempts already made (interrupted runs taken again). */
|
|
57
|
+
attempts: number;
|
|
58
|
+
/** The live run that scheduled it. */
|
|
59
|
+
scheduledByRunId: string | null;
|
|
60
|
+
createdAt: Date;
|
|
61
|
+
}
|