@abyss-project/reflex 5.3.0 → 5.5.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/function-insights.api.d.ts +2 -0
- package/dist/api/function-insights.api.js +7 -0
- package/dist/api/function-insights.api.js.map +1 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/service-discord-event.api.d.ts +6 -0
- package/dist/api/service-discord-event.api.js +18 -0
- package/dist/api/service-discord-event.api.js.map +1 -0
- package/dist/api/service-discord.api.d.ts +3 -1
- package/dist/api/service-discord.api.js +5 -1
- package/dist/api/service-discord.api.js.map +1 -1
- package/dist/api/service-insights.api.d.ts +3 -0
- package/dist/api/service-insights.api.js +12 -0
- package/dist/api/service-insights.api.js.map +1 -0
- package/dist/api/service-task.api.d.ts +2 -1
- package/dist/api/service-task.api.js +3 -1
- package/dist/api/service-task.api.js.map +1 -1
- package/dist/discord/discord-event-filter-cases.d.ts +15 -0
- package/dist/discord/discord-event-filter-cases.js +77 -0
- package/dist/discord/discord-event-filter-cases.js.map +1 -0
- package/dist/discord/discord-event-filters.d.ts +20 -0
- package/dist/discord/discord-event-filters.js +50 -0
- package/dist/discord/discord-event-filters.js.map +1 -0
- package/dist/discord/discord-event-intents.d.ts +14 -0
- package/dist/discord/discord-event-intents.js +38 -0
- package/dist/discord/discord-event-intents.js.map +1 -0
- package/dist/discord/index.d.ts +3 -0
- package/dist/discord/index.js +20 -0
- package/dist/discord/index.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/dist/types/enum/bot-event-block-reason.enum.d.ts +4 -0
- package/dist/types/enum/bot-event-block-reason.enum.js +9 -0
- package/dist/types/enum/bot-event-block-reason.enum.js.map +1 -0
- package/dist/types/enum/discord-event-drop-reason.enum.d.ts +7 -0
- package/dist/types/enum/discord-event-drop-reason.enum.js +12 -0
- package/dist/types/enum/discord-event-drop-reason.enum.js.map +1 -0
- package/dist/types/enum/discord-event-filter-name.enum.d.ts +9 -0
- package/dist/types/enum/discord-event-filter-name.enum.js +14 -0
- package/dist/types/enum/discord-event-filter-name.enum.js.map +1 -0
- package/dist/types/enum/discord-event-status.enum.d.ts +7 -0
- package/dist/types/enum/discord-event-status.enum.js +12 -0
- package/dist/types/enum/discord-event-status.enum.js.map +1 -0
- package/dist/types/enum/discord-event-type.enum.d.ts +6 -0
- package/dist/types/enum/discord-event-type.enum.js +11 -0
- package/dist/types/enum/discord-event-type.enum.js.map +1 -0
- package/dist/types/enum/discord-gateway-failure-code.enum.d.ts +2 -1
- package/dist/types/enum/discord-gateway-failure-code.enum.js +1 -0
- package/dist/types/enum/discord-gateway-failure-code.enum.js.map +1 -1
- package/dist/types/enum/index.d.ts +9 -0
- package/dist/types/enum/index.js +9 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/insights-period.enum.d.ts +7 -0
- package/dist/types/enum/insights-period.enum.js +12 -0
- package/dist/types/enum/insights-period.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.d.ts +5 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.js +10 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.js.map +1 -0
- package/dist/types/enum/scheduled-run-status.enum.d.ts +9 -0
- package/dist/types/enum/scheduled-run-status.enum.js +14 -0
- package/dist/types/enum/scheduled-run-status.enum.js.map +1 -0
- package/dist/types/enum/trigger-kind.enum.d.ts +7 -0
- package/dist/types/enum/trigger-kind.enum.js +12 -0
- package/dist/types/enum/trigger-kind.enum.js.map +1 -0
- package/dist/types/interface/api/requests/index.d.ts +2 -0
- package/dist/types/interface/api/requests/index.js +2 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/service-discord-event.request.d.ts +51 -0
- package/dist/types/interface/api/requests/service-discord-event.request.js +3 -0
- package/dist/types/interface/api/requests/service-discord-event.request.js.map +1 -0
- package/dist/types/interface/api/requests/service-discord.request.d.ts +22 -1
- package/dist/types/interface/api/requests/service-insights.request.d.ts +25 -0
- package/dist/types/interface/api/requests/service-insights.request.js +3 -0
- package/dist/types/interface/api/requests/service-insights.request.js.map +1 -0
- package/dist/types/interface/api/requests/service-task.request.d.ts +10 -0
- package/dist/types/interface/api/responses/index.d.ts +2 -0
- package/dist/types/interface/api/responses/index.js +2 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/service-discord-event.response.d.ts +18 -0
- package/dist/types/interface/api/responses/service-discord-event.response.js +3 -0
- package/dist/types/interface/api/responses/service-discord-event.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-discord.response.d.ts +30 -5
- package/dist/types/interface/api/responses/service-insights.response.d.ts +8 -0
- package/dist/types/interface/api/responses/service-insights.response.js +3 -0
- package/dist/types/interface/api/responses/service-insights.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-task.response.d.ts +6 -1
- package/dist/types/interface/api/responses/service-version.response.d.ts +9 -1
- package/dist/types/interface/models/index.d.ts +4 -0
- package/dist/types/interface/models/index.js +4 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-bot-limits.model.d.ts +56 -0
- package/dist/types/interface/models/reflex-bot-limits.model.js +16 -0
- package/dist/types/interface/models/reflex-bot-limits.model.js.map +1 -0
- package/dist/types/interface/models/reflex-discord-event-log.model.d.ts +38 -0
- package/dist/types/interface/models/reflex-discord-event-log.model.js +3 -0
- package/dist/types/interface/models/reflex-discord-event-log.model.js.map +1 -0
- package/dist/types/interface/models/reflex-discord-event.model.d.ts +41 -0
- package/dist/types/interface/models/reflex-discord-event.model.js +23 -0
- package/dist/types/interface/models/reflex-discord-event.model.js.map +1 -0
- package/dist/types/interface/models/reflex-insights.model.d.ts +83 -0
- package/dist/types/interface/models/reflex-insights.model.js +16 -0
- package/dist/types/interface/models/reflex-insights.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-service-version.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-task.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-task.model.js +1 -0
- package/dist/types/interface/models/reflex-task.model.js.map +1 -1
- package/package.json +1 -1
- package/src/api/function-insights.api.test.ts +27 -0
- package/src/api/function-insights.api.ts +18 -0
- package/src/api/index.ts +17 -14
- package/src/api/service-discord-event.api.test.ts +106 -0
- package/src/api/service-discord-event.api.ts +78 -0
- package/src/api/service-discord.api.test.ts +197 -170
- package/src/api/service-discord.api.ts +241 -203
- package/src/api/service-insights.api.test.ts +36 -0
- package/src/api/service-insights.api.ts +42 -0
- package/src/api/service-task.api.test.ts +140 -124
- package/src/api/service-task.api.ts +141 -122
- package/src/discord/discord-event-filter-cases.ts +261 -0
- package/src/discord/discord-event-filters.test.ts +91 -0
- package/src/discord/discord-event-filters.ts +95 -0
- package/src/discord/discord-event-intents.test.ts +112 -0
- package/src/discord/discord-event-intents.ts +55 -0
- package/src/discord/index.ts +3 -0
- package/src/index.test.ts +75 -50
- package/src/index.ts +317 -264
- package/src/types/enum/bot-event-block-reason.enum.ts +7 -0
- package/src/types/enum/discord-event-drop-reason.enum.ts +13 -0
- package/src/types/enum/discord-event-filter-name.enum.ts +11 -0
- package/src/types/enum/discord-event-status.enum.ts +13 -0
- package/src/types/enum/discord-event-type.enum.ts +7 -0
- package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -9
- package/src/types/enum/index.ts +40 -31
- package/src/types/enum/insights-period.enum.ts +8 -0
- package/src/types/enum/schedule-sync-status.enum.ts +6 -6
- package/src/types/enum/scheduled-run-failure-code.enum.ts +12 -0
- package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
- package/src/types/enum/scheduled-run-status.enum.ts +17 -0
- package/src/types/enum/trigger-kind.enum.ts +8 -0
- package/src/types/interface/api/requests/index.ts +15 -13
- package/src/types/interface/api/requests/service-discord-event.request.ts +68 -0
- package/src/types/interface/api/requests/service-discord.request.ts +161 -128
- package/src/types/interface/api/requests/service-insights.request.ts +31 -0
- package/src/types/interface/api/requests/service-task.request.ts +80 -66
- package/src/types/interface/api/responses/index.ts +15 -13
- package/src/types/interface/api/responses/service-discord-event.response.ts +24 -0
- package/src/types/interface/api/responses/service-discord.response.ts +119 -72
- package/src/types/interface/api/responses/service-insights.response.ts +11 -0
- package/src/types/interface/api/responses/service-task.response.ts +57 -48
- package/src/types/interface/api/responses/service-version.response.ts +106 -91
- package/src/types/interface/models/index.ts +19 -15
- package/src/types/interface/models/reflex-bot-limits.model.ts +92 -0
- package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -0
- package/src/types/interface/models/reflex-discord-event.model.ts +77 -0
- package/src/types/interface/models/reflex-insights.model.ts +120 -0
- package/src/types/interface/models/reflex-run.model.ts +183 -179
- package/src/types/interface/models/reflex-service-version.model.ts +61 -58
- package/src/types/interface/models/reflex-task.model.ts +97 -61
|
@@ -1,179 +1,183 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ExecutionMode,
|
|
3
|
-
ExecutionProfile,
|
|
4
|
-
RunLogLevel,
|
|
5
|
-
RunMode,
|
|
6
|
-
RunStatus,
|
|
7
|
-
RunStepStatus,
|
|
8
|
-
ScheduledRunOrigin,
|
|
9
|
-
TraceEffectType,
|
|
10
|
-
} from '../../enum';
|
|
11
|
-
|
|
12
|
-
export interface IReflexTraceError {
|
|
13
|
-
code: string;
|
|
14
|
-
message: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* One call the run made to the host, in the order they were served. `recorded` is true when the effect
|
|
19
|
-
* was recorded instead of executed (a stubbed HTTP call, a Store write kept aside, a wait not waited).
|
|
20
|
-
*/
|
|
21
|
-
export interface IReflexTraceEntry {
|
|
22
|
-
stepId: string;
|
|
23
|
-
type: TraceEffectType;
|
|
24
|
-
/** The host action, for a HOST effect. */
|
|
25
|
-
action?: string;
|
|
26
|
-
request?: unknown;
|
|
27
|
-
response?: unknown;
|
|
28
|
-
error?: IReflexTraceError;
|
|
29
|
-
recorded: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** What the RESPOND step (or `abyss.respond`) built: the response the caller of the route would get. */
|
|
33
|
-
export interface IReflexTraceResponse {
|
|
34
|
-
status: number;
|
|
35
|
-
headers: Record<string, string>;
|
|
36
|
-
body: unknown;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Bounded: past 100 entries, or a value of more than 4 KB, the trace is cut and says so (`truncated`).
|
|
41
|
-
* Every secret value the run was given or read is masked (`***`).
|
|
42
|
-
*/
|
|
43
|
-
export interface IReflexRunTrace {
|
|
44
|
-
entries: IReflexTraceEntry[];
|
|
45
|
-
outcome: {
|
|
46
|
-
status: RunStatus;
|
|
47
|
-
output?: unknown;
|
|
48
|
-
error?: IReflexTraceError & { stepId?: string };
|
|
49
|
-
};
|
|
50
|
-
response?: IReflexTraceResponse;
|
|
51
|
-
truncated: boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface IReflexRun {
|
|
55
|
-
id: string;
|
|
56
|
-
functionId: string;
|
|
57
|
-
versionId: string | null;
|
|
58
|
-
/**
|
|
59
|
-
* The environment the run took place in: the promoted version's for a LIVE run, the one named in the
|
|
60
|
-
* request for a test run. Null only for a test run recorded before test runs named an environment.
|
|
61
|
-
*/
|
|
62
|
-
environmentId: string | null;
|
|
63
|
-
mode: RunMode;
|
|
64
|
-
status: RunStatus;
|
|
65
|
-
durationMs: number;
|
|
66
|
-
/** The effects of a test run; null for a LIVE run, which records no trace (nothing of the caller is kept). */
|
|
67
|
-
trace: IReflexRunTrace | null;
|
|
68
|
-
/** The route that started a LIVE run; null for a test run and for a run a Discord command or component started. */
|
|
69
|
-
routeId: string | null;
|
|
70
|
-
/** The Discord command that started a LIVE run; null otherwise. */
|
|
71
|
-
commandId: string | null;
|
|
72
|
-
/** The Discord component that started a LIVE run; null otherwise. */
|
|
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
|
-
/**
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/** The
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
/** The
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
/** The
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
|
|
179
|
-
|
|
1
|
+
import type {
|
|
2
|
+
ExecutionMode,
|
|
3
|
+
ExecutionProfile,
|
|
4
|
+
RunLogLevel,
|
|
5
|
+
RunMode,
|
|
6
|
+
RunStatus,
|
|
7
|
+
RunStepStatus,
|
|
8
|
+
ScheduledRunOrigin,
|
|
9
|
+
TraceEffectType,
|
|
10
|
+
} from '../../enum';
|
|
11
|
+
|
|
12
|
+
export interface IReflexTraceError {
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* One call the run made to the host, in the order they were served. `recorded` is true when the effect
|
|
19
|
+
* was recorded instead of executed (a stubbed HTTP call, a Store write kept aside, a wait not waited).
|
|
20
|
+
*/
|
|
21
|
+
export interface IReflexTraceEntry {
|
|
22
|
+
stepId: string;
|
|
23
|
+
type: TraceEffectType;
|
|
24
|
+
/** The host action, for a HOST effect. */
|
|
25
|
+
action?: string;
|
|
26
|
+
request?: unknown;
|
|
27
|
+
response?: unknown;
|
|
28
|
+
error?: IReflexTraceError;
|
|
29
|
+
recorded: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** What the RESPOND step (or `abyss.respond`) built: the response the caller of the route would get. */
|
|
33
|
+
export interface IReflexTraceResponse {
|
|
34
|
+
status: number;
|
|
35
|
+
headers: Record<string, string>;
|
|
36
|
+
body: unknown;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Bounded: past 100 entries, or a value of more than 4 KB, the trace is cut and says so (`truncated`).
|
|
41
|
+
* Every secret value the run was given or read is masked (`***`).
|
|
42
|
+
*/
|
|
43
|
+
export interface IReflexRunTrace {
|
|
44
|
+
entries: IReflexTraceEntry[];
|
|
45
|
+
outcome: {
|
|
46
|
+
status: RunStatus;
|
|
47
|
+
output?: unknown;
|
|
48
|
+
error?: IReflexTraceError & { stepId?: string };
|
|
49
|
+
};
|
|
50
|
+
response?: IReflexTraceResponse;
|
|
51
|
+
truncated: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface IReflexRun {
|
|
55
|
+
id: string;
|
|
56
|
+
functionId: string;
|
|
57
|
+
versionId: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* The environment the run took place in: the promoted version's for a LIVE run, the one named in the
|
|
60
|
+
* request for a test run. Null only for a test run recorded before test runs named an environment.
|
|
61
|
+
*/
|
|
62
|
+
environmentId: string | null;
|
|
63
|
+
mode: RunMode;
|
|
64
|
+
status: RunStatus;
|
|
65
|
+
durationMs: number;
|
|
66
|
+
/** The effects of a test run; null for a LIVE run, which records no trace (nothing of the caller is kept). */
|
|
67
|
+
trace: IReflexRunTrace | null;
|
|
68
|
+
/** The route that started a LIVE run; null for a test run and for a run a Discord command or component started. */
|
|
69
|
+
routeId: string | null;
|
|
70
|
+
/** The Discord command that started a LIVE run; null otherwise. */
|
|
71
|
+
commandId: string | null;
|
|
72
|
+
/** The Discord component that started a LIVE run; null otherwise. */
|
|
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
|
+
/** The event trigger that started a LIVE run; null otherwise. */
|
|
77
|
+
eventTriggerId: string | null;
|
|
78
|
+
/** Trace id of an execution of an event: the id of its inbox row without dashes, the same at every attempt; null for the other origins. */
|
|
79
|
+
traceId: string | null;
|
|
80
|
+
/** How the task started the run: RECURRING for a tick of its cron, DELAYED for a delayed run; null when no task did. */
|
|
81
|
+
scheduledRunOrigin: ScheduledRunOrigin | null;
|
|
82
|
+
/**
|
|
83
|
+
* What started the run, for a screen: `METHOD path` for a route, `/name` for a command, the custom id
|
|
84
|
+
* prefix for a component, the name for a task or an event trigger. Null for a test run, and when the route, command,
|
|
85
|
+
* component, task or event trigger was deleted.
|
|
86
|
+
*/
|
|
87
|
+
originLabel: string | null;
|
|
88
|
+
/** The HTTP status the caller of a LIVE run got; null for a test run. */
|
|
89
|
+
httpStatus: number | null;
|
|
90
|
+
/** The code of the error a failed LIVE run answered (FUNCTION_FAILED, FUNCTION_TIMEOUT, RUNNER_UNAVAILABLE, RUNNER_SATURATED, INTERNAL_ERROR); null otherwise, an interrupted run included. */
|
|
91
|
+
errorCode: string | null;
|
|
92
|
+
/** The execution mode of the function when a LIVE run started; null for a test run. */
|
|
93
|
+
executionMode: ExecutionMode | null;
|
|
94
|
+
/** When the caller of a LIVE run got its answer; null for a test run, or before any answer. */
|
|
95
|
+
responseSentAt: Date | null;
|
|
96
|
+
/**
|
|
97
|
+
* What the run consumed and cost: measured by the runner for a live run and for a test run (with the
|
|
98
|
+
* function's effective settings in the run's environment, and the network of its stubs); null for a running execution, or a run
|
|
99
|
+
* recorded before the measures.
|
|
100
|
+
*/
|
|
101
|
+
metrics: IReflexRunMetrics | null;
|
|
102
|
+
createdByUserId: string | null;
|
|
103
|
+
createdAt: Date;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** What a live execution consumed, and what it costs (ADR-0244). */
|
|
107
|
+
export interface IReflexRunMetrics {
|
|
108
|
+
/** The profile it ran with, and the memory that profile allocates. */
|
|
109
|
+
profile: ExecutionProfile;
|
|
110
|
+
memoryLimitMb: number;
|
|
111
|
+
/** Measured by the runner in the isolate. */
|
|
112
|
+
cpuMs: number;
|
|
113
|
+
heapPeakBytes: number;
|
|
114
|
+
/** Measured by the host: bytes sent and received by `fetch`, plus the answer sent to the caller. */
|
|
115
|
+
netOutBytes: number;
|
|
116
|
+
netInBytes: number;
|
|
117
|
+
httpCalls: number;
|
|
118
|
+
storeWrites: number;
|
|
119
|
+
/** In thousandths of a credit; 0 for an interrupted execution, which is offered. */
|
|
120
|
+
costMillicredits: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** What one step of a run consumed; its cost is its share of the run's, the fixed price aside. */
|
|
124
|
+
export interface IReflexRunStep {
|
|
125
|
+
/** 0 for the first step that ran. */
|
|
126
|
+
position: number;
|
|
127
|
+
stepId: string;
|
|
128
|
+
status: RunStepStatus;
|
|
129
|
+
durationMs: number;
|
|
130
|
+
cpuMs: number;
|
|
131
|
+
heapPeakBytes: number;
|
|
132
|
+
netOutBytes: number;
|
|
133
|
+
netInBytes: number;
|
|
134
|
+
httpCalls: number;
|
|
135
|
+
storeWrites: number;
|
|
136
|
+
costMillicredits: number;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* One log line a run wrote: a LOG step, `abyss.log.*` or `console.*`. Secrets masked (`***`); a message
|
|
141
|
+
* is cut at 2048 characters, and data whose JSON is longer becomes `{ truncated: true, preview }`. At most
|
|
142
|
+
* 100 lines per run are kept; `IReflexRunDetail.droppedLogLines` counts the others.
|
|
143
|
+
*/
|
|
144
|
+
export interface IReflexRunLog {
|
|
145
|
+
/** 0 for the first line. */
|
|
146
|
+
position: number;
|
|
147
|
+
/** The step that wrote it. */
|
|
148
|
+
stepId: string;
|
|
149
|
+
level: RunLogLevel;
|
|
150
|
+
message: string;
|
|
151
|
+
/** The value given with the message; null when none was. */
|
|
152
|
+
data: unknown;
|
|
153
|
+
loggedAt: Date;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* One run with the steps it ran and the lines it logged, in order. Both are empty for a run recorded
|
|
158
|
+
* before the measures (and the steps for a running execution).
|
|
159
|
+
*/
|
|
160
|
+
export interface IReflexRunDetail extends IReflexRun {
|
|
161
|
+
steps: IReflexRunStep[];
|
|
162
|
+
logs: IReflexRunLog[];
|
|
163
|
+
/** The log lines written past the 100 kept in `logs`; 0 when none was dropped. */
|
|
164
|
+
droppedLogLines: number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** The state of a live execution, read by its id (the `executionId` an async route answers with). */
|
|
168
|
+
export interface IReflexExecutionState {
|
|
169
|
+
id: string;
|
|
170
|
+
status: RunStatus;
|
|
171
|
+
executionMode: ExecutionMode;
|
|
172
|
+
startedAt: Date;
|
|
173
|
+
/** When the caller got its answer; for an async execution, the 202. */
|
|
174
|
+
responseSentAt: Date | null;
|
|
175
|
+
/** Null while it runs. */
|
|
176
|
+
finishedAt: Date | null;
|
|
177
|
+
/** The status the caller got. */
|
|
178
|
+
httpStatus: number;
|
|
179
|
+
/** Set when the execution failed. */
|
|
180
|
+
errorCode: string | null;
|
|
181
|
+
/** Null while it runs, or for an execution recorded before the measures. */
|
|
182
|
+
costMillicredits: number | null;
|
|
183
|
+
}
|
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
import type { RouteMethod, TriggerAccessMode } from '../../enum';
|
|
2
|
-
import type {
|
|
3
|
-
IReflexDiscordCommandSnapshot,
|
|
4
|
-
IReflexDiscordComponentSnapshot,
|
|
5
|
-
} from './reflex-discord.model';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
import type { RouteMethod, TriggerAccessMode } from '../../enum';
|
|
2
|
+
import type {
|
|
3
|
+
IReflexDiscordCommandSnapshot,
|
|
4
|
+
IReflexDiscordComponentSnapshot,
|
|
5
|
+
} from './reflex-discord.model';
|
|
6
|
+
import type { IReflexDiscordEventSnapshot } from './reflex-discord-event.model';
|
|
7
|
+
import type { IReflexServiceCors } from './reflex-service.model';
|
|
8
|
+
import type { IReflexTaskSnapshot } from './reflex-task.model';
|
|
9
|
+
|
|
10
|
+
/** A route as a version of the Service froze it. */
|
|
11
|
+
export interface IReflexServiceVersionRoute {
|
|
12
|
+
routeId: string;
|
|
13
|
+
method: RouteMethod;
|
|
14
|
+
path: string;
|
|
15
|
+
functionId: string;
|
|
16
|
+
accessMode: TriggerAccessMode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The version of a member function a version of the Service runs. */
|
|
20
|
+
export interface IReflexServiceVersionFunction {
|
|
21
|
+
functionId: string;
|
|
22
|
+
functionVersionId: string;
|
|
23
|
+
functionVersionNumber: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** What a version of a Discord bot freezes: its commands and components, identifiers included. */
|
|
27
|
+
export interface IReflexServiceVersionDiscord {
|
|
28
|
+
commands: IReflexDiscordCommandSnapshot[];
|
|
29
|
+
components: IReflexDiscordComponentSnapshot[];
|
|
30
|
+
/** The event triggers; absent when the bot has none, so the hash of other versions is unchanged. */
|
|
31
|
+
events?: IReflexDiscordEventSnapshot[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* What a version of the Service freezes. Routes sorted by path then method, functions by id: the same
|
|
36
|
+
* Service always gives the same snapshot, and the same `hash`.
|
|
37
|
+
*/
|
|
38
|
+
export interface IReflexServiceVersionSnapshot {
|
|
39
|
+
routes: IReflexServiceVersionRoute[];
|
|
40
|
+
functions: IReflexServiceVersionFunction[];
|
|
41
|
+
cors: IReflexServiceCors;
|
|
42
|
+
rateLimitPerIpPerMinute: number;
|
|
43
|
+
/** Only a `DISCORD_BOT` Service has it (its `routes` are then empty); absent otherwise, so the hash of other versions is unchanged. */
|
|
44
|
+
discord?: IReflexServiceVersionDiscord;
|
|
45
|
+
/** The tasks of the Service, by name; absent when it has none, so the hash of other versions is unchanged. */
|
|
46
|
+
tasks?: IReflexTaskSnapshot[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IReflexServiceVersion {
|
|
50
|
+
id: string;
|
|
51
|
+
serviceId: string;
|
|
52
|
+
/** 1, 2, 3...: counted per Service. */
|
|
53
|
+
number: number;
|
|
54
|
+
/** 500 characters at most. */
|
|
55
|
+
message: string | null;
|
|
56
|
+
snapshot: IReflexServiceVersionSnapshot;
|
|
57
|
+
/** SHA-256 of the snapshot as canonical JSON (keys sorted), lowercase hex. */
|
|
58
|
+
hash: string;
|
|
59
|
+
publishedByUserId: string;
|
|
60
|
+
publishedAt: Date;
|
|
61
|
+
}
|