@abyss-project/reflex 5.8.0 → 5.9.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/.eslintrc.js +32 -32
- package/.prettierrc +5 -5
- package/README.md +15 -15
- package/dist/api/alert-rule.api.d.ts +5 -0
- package/dist/api/alert-rule.api.js +16 -0
- package/dist/api/alert-rule.api.js.map +1 -0
- package/dist/api/application-insights.api.d.ts +3 -0
- package/dist/api/application-insights.api.js +12 -0
- package/dist/api/application-insights.api.js.map +1 -0
- package/dist/api/application-run-settings.api.d.ts +3 -0
- package/dist/api/application-run-settings.api.js +11 -0
- package/dist/api/application-run-settings.api.js.map +1 -0
- package/dist/api/function-settings.api.d.ts +2 -1
- package/dist/api/function-settings.api.js +3 -1
- package/dist/api/function-settings.api.js.map +1 -1
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +4 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/route-stats.api.d.ts +3 -0
- package/dist/api/route-stats.api.js +9 -0
- package/dist/api/route-stats.api.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/insights/index.d.ts +1 -0
- package/dist/insights/index.js +18 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/insights/percentiles.d.ts +2 -0
- package/dist/insights/percentiles.js +28 -0
- package/dist/insights/percentiles.js.map +1 -0
- package/dist/types/enum/index.d.ts +4 -0
- package/dist/types/enum/index.js +4 -0
- package/dist/types/enum/index.js.map +1 -1
- package/dist/types/enum/log-cap-mode.enum.d.ts +5 -0
- package/dist/types/enum/log-cap-mode.enum.js +10 -0
- package/dist/types/enum/log-cap-mode.enum.js.map +1 -0
- package/dist/types/enum/reflex-alert-metric.enum.d.ts +4 -0
- package/dist/types/enum/reflex-alert-metric.enum.js +9 -0
- package/dist/types/enum/reflex-alert-metric.enum.js.map +1 -0
- package/dist/types/enum/reflex-alert-notification-state.enum.d.ts +5 -0
- package/dist/types/enum/reflex-alert-notification-state.enum.js +10 -0
- package/dist/types/enum/reflex-alert-notification-state.enum.js.map +1 -0
- package/dist/types/enum/reflex-alert-scope.enum.d.ts +5 -0
- package/dist/types/enum/reflex-alert-scope.enum.js +10 -0
- package/dist/types/enum/reflex-alert-scope.enum.js.map +1 -0
- package/dist/types/interface/api/requests/alert-rule.request.d.ts +38 -0
- package/dist/types/interface/api/requests/alert-rule.request.js +3 -0
- package/dist/types/interface/api/requests/alert-rule.request.js.map +1 -0
- package/dist/types/interface/api/requests/application-insights.request.d.ts +14 -0
- package/dist/types/interface/api/requests/application-insights.request.js +3 -0
- package/dist/types/interface/api/requests/application-insights.request.js.map +1 -0
- package/dist/types/interface/api/requests/application-run-settings.request.d.ts +9 -0
- package/dist/types/interface/api/requests/application-run-settings.request.js +3 -0
- package/dist/types/interface/api/requests/application-run-settings.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-settings.request.d.ts +6 -1
- package/dist/types/interface/api/requests/index.d.ts +4 -0
- package/dist/types/interface/api/requests/index.js +4 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/route-stats.request.d.ts +18 -0
- package/dist/types/interface/api/requests/route-stats.request.js +3 -0
- package/dist/types/interface/api/requests/route-stats.request.js.map +1 -0
- package/dist/types/interface/api/responses/alert-rule.response.d.ts +17 -0
- package/dist/types/interface/api/responses/alert-rule.response.js +3 -0
- package/dist/types/interface/api/responses/alert-rule.response.js.map +1 -0
- package/dist/types/interface/api/responses/application-insights.response.d.ts +8 -0
- package/dist/types/interface/api/responses/application-insights.response.js +3 -0
- package/dist/types/interface/api/responses/application-insights.response.js.map +1 -0
- package/dist/types/interface/api/responses/application-run-settings.response.d.ts +6 -0
- package/dist/types/interface/api/responses/application-run-settings.response.js +3 -0
- package/dist/types/interface/api/responses/application-run-settings.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-settings.response.d.ts +3 -1
- package/dist/types/interface/api/responses/index.d.ts +4 -0
- package/dist/types/interface/api/responses/index.js +4 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/route-stats.response.d.ts +12 -0
- package/dist/types/interface/api/responses/route-stats.response.js +3 -0
- package/dist/types/interface/api/responses/route-stats.response.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +2 -0
- package/dist/types/interface/models/index.js +2 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-alert-rule.model.d.ts +55 -0
- package/dist/types/interface/models/reflex-alert-rule.model.js +15 -0
- package/dist/types/interface/models/reflex-alert-rule.model.js.map +1 -0
- package/dist/types/interface/models/reflex-discord.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-discord.model.js +4 -1
- package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
- package/dist/types/interface/models/reflex-insights.model.d.ts +63 -0
- package/dist/types/interface/models/reflex-insights.model.js +4 -1
- package/dist/types/interface/models/reflex-insights.model.js.map +1 -1
- package/dist/types/interface/models/reflex-run-settings.model.d.ts +19 -0
- package/dist/types/interface/models/reflex-run-settings.model.js +9 -0
- package/dist/types/interface/models/reflex-run-settings.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +40 -3
- package/dist/types/interface/models/reflex-run.model.js +9 -0
- package/dist/types/interface/models/reflex-run.model.js.map +1 -1
- package/jest.config.ts +11 -11
- package/package.json +15 -10
- package/src/api/alert-rule.api.test.ts +72 -0
- package/src/api/alert-rule.api.ts +57 -0
- package/src/api/application-insights.api.test.ts +42 -0
- package/src/api/application-insights.api.ts +38 -0
- package/src/api/application-run-settings.api.test.ts +51 -0
- package/src/api/application-run-settings.api.ts +30 -0
- package/src/api/function-access.api.ts +36 -36
- package/src/api/function-insights.api.test.ts +27 -27
- package/src/api/function-insights.api.ts +18 -18
- package/src/api/function-run.api.ts +38 -38
- package/src/api/function-settings.api.ts +74 -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 +21 -17
- package/src/api/route-stats.api.test.ts +45 -0
- package/src/api/route-stats.api.ts +36 -0
- package/src/api/service-configuration.api.ts +16 -16
- package/src/api/service-deployment.api.ts +79 -79
- package/src/api/service-discord-event.api.test.ts +106 -106
- package/src/api/service-discord-event.api.ts +78 -78
- package/src/api/service-discord.api.test.ts +197 -197
- package/src/api/service-discord.api.ts +241 -241
- package/src/api/service-insights.api.test.ts +36 -36
- package/src/api/service-insights.api.ts +42 -42
- package/src/api/service-route.api.ts +72 -72
- package/src/api/service-task.api.test.ts +140 -140
- package/src/api/service-task.api.ts +141 -141
- 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/discord/discord-event-filter-cases.ts +261 -261
- package/src/discord/discord-event-filters.test.ts +91 -91
- package/src/discord/discord-event-filters.ts +95 -95
- package/src/discord/discord-event-intents.test.ts +112 -112
- package/src/discord/discord-event-intents.ts +55 -55
- package/src/discord/index.ts +3 -3
- package/src/index.test.ts +87 -75
- package/src/index.ts +371 -317
- package/src/insights/index.ts +1 -0
- package/src/insights/percentiles.test.ts +75 -0
- package/src/insights/percentiles.ts +37 -0
- package/src/types/enum/access-grant-status.enum.ts +12 -12
- package/src/types/enum/access-kind.enum.ts +7 -7
- package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
- package/src/types/enum/configuration-read-as.enum.ts +5 -5
- package/src/types/enum/discord-activity-type.enum.ts +9 -9
- package/src/types/enum/discord-component-kind.enum.ts +7 -7
- package/src/types/enum/discord-event-drop-reason.enum.ts +13 -13
- package/src/types/enum/discord-event-filter-name.enum.ts +11 -11
- package/src/types/enum/discord-event-status.enum.ts +13 -13
- package/src/types/enum/discord-event-type.enum.ts +7 -7
- package/src/types/enum/discord-gateway-failure-code.enum.ts +11 -11
- package/src/types/enum/discord-gateway-state.enum.ts +11 -11
- package/src/types/enum/discord-option-type.enum.ts +12 -12
- package/src/types/enum/discord-presence-status.enum.ts +8 -8
- package/src/types/enum/discord-sync-status.enum.ts +6 -6
- package/src/types/enum/discord-token-state.enum.ts +11 -11
- package/src/types/enum/execution-mode.enum.ts +9 -9
- package/src/types/enum/execution-profile.enum.ts +20 -20
- package/src/types/enum/execution-settings-source.enum.ts +9 -9
- package/src/types/enum/health-status.enum.ts +4 -4
- package/src/types/enum/index.ts +44 -40
- package/src/types/enum/insights-period.enum.ts +8 -8
- package/src/types/enum/log-cap-mode.enum.ts +6 -0
- package/src/types/enum/reflex-alert-metric.enum.ts +5 -0
- package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -0
- package/src/types/enum/reflex-alert-scope.enum.ts +6 -0
- package/src/types/enum/reflex-error-code.enum.ts +43 -43
- package/src/types/enum/route-method.enum.ts +9 -9
- package/src/types/enum/run-log-level.enum.ts +6 -6
- package/src/types/enum/run-mode.enum.ts +11 -11
- package/src/types/enum/run-status.enum.ts +11 -11
- package/src/types/enum/run-step-status.enum.ts +7 -7
- package/src/types/enum/schedule-sync-status.enum.ts +6 -6
- package/src/types/enum/scheduled-run-failure-code.enum.ts +12 -12
- package/src/types/enum/scheduled-run-origin.enum.ts +5 -5
- package/src/types/enum/scheduled-run-status.enum.ts +17 -17
- package/src/types/enum/service-deployment-action.enum.ts +11 -11
- package/src/types/enum/service-deployment-status.enum.ts +5 -5
- package/src/types/enum/service-type.enum.ts +9 -9
- package/src/types/enum/service-version-change-kind.enum.ts +6 -6
- package/src/types/enum/trace-effect-type.enum.ts +12 -12
- package/src/types/enum/trigger-access-mode.enum.ts +12 -12
- package/src/types/enum/trigger-kind.enum.ts +8 -8
- package/src/types/enum/vault-value-source.enum.ts +12 -12
- package/src/types/enum/vault-visibility.enum.ts +5 -5
- package/src/types/index.ts +2 -2
- package/src/types/interface/api/index.ts +3 -3
- package/src/types/interface/api/requests/alert-rule.request.ts +53 -0
- package/src/types/interface/api/requests/application-insights.request.ts +18 -0
- package/src/types/interface/api/requests/application-run-settings.request.ts +11 -0
- package/src/types/interface/api/requests/function-access.request.ts +25 -25
- package/src/types/interface/api/requests/function-run.request.ts +30 -30
- package/src/types/interface/api/requests/function-settings.request.ts +34 -27
- package/src/types/interface/api/requests/function-test.request.ts +39 -39
- package/src/types/interface/api/requests/function-version.request.ts +20 -20
- package/src/types/interface/api/requests/function.request.ts +36 -36
- package/src/types/interface/api/requests/index.ts +19 -15
- package/src/types/interface/api/requests/route-stats.request.ts +22 -0
- package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
- package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
- package/src/types/interface/api/requests/service-discord-event.request.ts +68 -68
- package/src/types/interface/api/requests/service-discord.request.ts +173 -173
- package/src/types/interface/api/requests/service-insights.request.ts +31 -31
- package/src/types/interface/api/requests/service-route.request.ts +44 -44
- package/src/types/interface/api/requests/service-task.request.ts +80 -80
- package/src/types/interface/api/requests/service-version.request.ts +24 -24
- package/src/types/interface/api/requests/service.request.ts +46 -46
- package/src/types/interface/api/response.ts +4 -4
- package/src/types/interface/api/responses/alert-rule.response.ts +24 -0
- package/src/types/interface/api/responses/application-insights.response.ts +11 -0
- package/src/types/interface/api/responses/application-run-settings.response.ts +8 -0
- package/src/types/interface/api/responses/function-access.response.ts +17 -17
- package/src/types/interface/api/responses/function-run.response.ts +18 -18
- package/src/types/interface/api/responses/function-settings.response.ts +40 -36
- package/src/types/interface/api/responses/function-test.response.ts +12 -12
- package/src/types/interface/api/responses/function-version.response.ts +31 -31
- package/src/types/interface/api/responses/function.response.ts +25 -25
- package/src/types/interface/api/responses/index.ts +19 -15
- package/src/types/interface/api/responses/route-stats.response.ts +15 -0
- package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
- package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
- package/src/types/interface/api/responses/service-discord-event.response.ts +24 -24
- package/src/types/interface/api/responses/service-discord.response.ts +122 -122
- package/src/types/interface/api/responses/service-insights.response.ts +11 -11
- package/src/types/interface/api/responses/service-route.response.ts +31 -31
- package/src/types/interface/api/responses/service-task.response.ts +57 -57
- package/src/types/interface/api/responses/service-version.response.ts +106 -106
- package/src/types/interface/api/responses/service.response.ts +31 -31
- package/src/types/interface/health.response.ts +7 -7
- package/src/types/interface/index.ts +3 -3
- package/src/types/interface/models/index.ts +21 -19
- package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
- package/src/types/interface/models/reflex-alert-rule.model.ts +56 -0
- package/src/types/interface/models/reflex-bot-limits.model.ts +92 -92
- package/src/types/interface/models/reflex-definition.model.ts +31 -31
- package/src/types/interface/models/reflex-discord-event-log.model.ts +58 -58
- package/src/types/interface/models/reflex-discord-event.model.ts +79 -79
- package/src/types/interface/models/reflex-discord.model.ts +196 -187
- package/src/types/interface/models/reflex-execution-settings.model.ts +50 -50
- package/src/types/interface/models/reflex-function-version.model.ts +14 -14
- package/src/types/interface/models/reflex-function.model.ts +16 -16
- package/src/types/interface/models/reflex-insights.model.ts +215 -120
- package/src/types/interface/models/reflex-price-list.model.ts +20 -20
- package/src/types/interface/models/reflex-route.model.ts +19 -19
- package/src/types/interface/models/reflex-run-settings.model.ts +28 -0
- package/src/types/interface/models/reflex-run.model.ts +250 -186
- package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
- package/src/types/interface/models/reflex-service-deployment.model.ts +46 -46
- package/src/types/interface/models/reflex-service-version.model.ts +61 -61
- package/src/types/interface/models/reflex-service.model.ts +45 -45
- package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
- package/src/types/interface/models/reflex-task.model.ts +97 -97
- package/tsconfig.check.json +15 -15
- package/tsconfig.json +35 -35
|
@@ -1,187 +1,196 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DiscordActivityType,
|
|
3
|
-
DiscordChannelType,
|
|
4
|
-
DiscordComponentKind,
|
|
5
|
-
DiscordLocale,
|
|
6
|
-
DiscordGatewayFailureCode,
|
|
7
|
-
DiscordGatewayState,
|
|
8
|
-
DiscordOptionType,
|
|
9
|
-
DiscordPresenceStatus,
|
|
10
|
-
DiscordTokenState,
|
|
11
|
-
} from '../../enum';
|
|
12
|
-
|
|
13
|
-
/** Bounds of the commands and components of a Discord bot; the API and its database apply the same ones. */
|
|
14
|
-
export const REFLEX_DISCORD_LIMITS = {
|
|
15
|
-
/** `^[-_a-z0-9]{1,32}$`: the name typed after the slash. */
|
|
16
|
-
commandNamePattern: /^[-_a-z0-9]{1,32}$/,
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
1
|
+
import type {
|
|
2
|
+
DiscordActivityType,
|
|
3
|
+
DiscordChannelType,
|
|
4
|
+
DiscordComponentKind,
|
|
5
|
+
DiscordLocale,
|
|
6
|
+
DiscordGatewayFailureCode,
|
|
7
|
+
DiscordGatewayState,
|
|
8
|
+
DiscordOptionType,
|
|
9
|
+
DiscordPresenceStatus,
|
|
10
|
+
DiscordTokenState,
|
|
11
|
+
} from '../../enum';
|
|
12
|
+
|
|
13
|
+
/** Bounds of the commands and components of a Discord bot; the API and its database apply the same ones. */
|
|
14
|
+
export const REFLEX_DISCORD_LIMITS = {
|
|
15
|
+
/** `^[-_a-z0-9]{1,32}$`: the name typed after the slash. */
|
|
16
|
+
commandNamePattern: /^[-_a-z0-9]{1,32}$/,
|
|
17
|
+
/**
|
|
18
|
+
* Discord's pattern of a translated command or option name: letters and digits of any script, `-`, `_` and
|
|
19
|
+
* `'`, 1 to 32 characters. It must also be lower case where the script has one (see `isValidLocalizedName`).
|
|
20
|
+
*/
|
|
21
|
+
localizedNamePattern: /^[-_'\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$/u,
|
|
22
|
+
commandDescriptionMaxLength: 100,
|
|
23
|
+
commandsPerServiceMax: 100,
|
|
24
|
+
optionsPerCommandMax: 25,
|
|
25
|
+
choicesPerOptionMax: 25,
|
|
26
|
+
/** `^[a-z0-9_-]{1,40}$`: the start of the `custom_id` of a button, a menu or a form. */
|
|
27
|
+
componentPrefixPattern: /^[a-z0-9_-]{1,40}$/,
|
|
28
|
+
syncErrorMaxLength: 500,
|
|
29
|
+
/** Bounds of `minLength` and `maxLength` of a STRING option (`maxLength` is 1 at least). */
|
|
30
|
+
optionLengthMax: 6000,
|
|
31
|
+
/** Length of the name of a choice, localized or not. */
|
|
32
|
+
choiceNameMaxLength: 100,
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
/** A translated command or option name Discord accepts: its pattern, and lower case where the script has one. */
|
|
36
|
+
export const isValidLocalizedName = (name: string): boolean =>
|
|
37
|
+
REFLEX_DISCORD_LIMITS.localizedNamePattern.test(name) && name === name.toLowerCase();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Translations of a name or a description, by Discord locale. A localized command or option name
|
|
41
|
+
* passes `isValidLocalizedName`, a description 1 to 100 characters, a choice name 1 to 100.
|
|
42
|
+
*/
|
|
43
|
+
export type ReflexDiscordLocalizations = Partial<Record<DiscordLocale, string>>;
|
|
44
|
+
|
|
45
|
+
/** A fixed answer a user picks for a STRING, INTEGER or NUMBER option. */
|
|
46
|
+
export interface IReflexDiscordOptionChoice {
|
|
47
|
+
name: string;
|
|
48
|
+
value: string | number;
|
|
49
|
+
nameLocalizations?: ReflexDiscordLocalizations;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An option of a command. Required options come first. A bound only exists on the types it applies
|
|
54
|
+
* to: the API refuses it on another one.
|
|
55
|
+
*/
|
|
56
|
+
export interface IReflexDiscordCommandOption {
|
|
57
|
+
type: DiscordOptionType;
|
|
58
|
+
/** Same pattern as the command name. */
|
|
59
|
+
name: string;
|
|
60
|
+
/** 1 to 100 characters. */
|
|
61
|
+
description: string;
|
|
62
|
+
required: boolean;
|
|
63
|
+
/** 25 at most, only for STRING, INTEGER and NUMBER; within `minValue`/`maxValue` and `minLength`/`maxLength`. */
|
|
64
|
+
choices?: IReflexDiscordOptionChoice[];
|
|
65
|
+
/** INTEGER and NUMBER: safe numbers, `minValue` <= `maxValue`. */
|
|
66
|
+
minValue?: number;
|
|
67
|
+
maxValue?: number;
|
|
68
|
+
/** STRING: 0 to 6000 (`maxLength` 1 at least), `minLength` <= `maxLength`. */
|
|
69
|
+
minLength?: number;
|
|
70
|
+
maxLength?: number;
|
|
71
|
+
/** CHANNEL: the channel types a user may pick, not empty, no duplicate. */
|
|
72
|
+
channelTypes?: DiscordChannelType[];
|
|
73
|
+
nameLocalizations?: ReflexDiscordLocalizations;
|
|
74
|
+
descriptionLocalizations?: ReflexDiscordLocalizations;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** A slash command of the draft of a Discord bot Service. */
|
|
78
|
+
export interface IReflexDiscordCommand {
|
|
79
|
+
id: string;
|
|
80
|
+
serviceId: string;
|
|
81
|
+
/** A function of the same Service. */
|
|
82
|
+
functionId: string;
|
|
83
|
+
/** Unique within the Service. */
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
options: IReflexDiscordCommandOption[];
|
|
87
|
+
/** Discord permission bits as a decimal string, or null for everyone. */
|
|
88
|
+
defaultMemberPermissions: string | null;
|
|
89
|
+
allowedInDirectMessages: boolean;
|
|
90
|
+
/** Null without translations. */
|
|
91
|
+
nameLocalizations: ReflexDiscordLocalizations | null;
|
|
92
|
+
descriptionLocalizations: ReflexDiscordLocalizations | null;
|
|
93
|
+
/**
|
|
94
|
+
* Users may install the bot on their account and use the command outside the servers it is in (in
|
|
95
|
+
* group messages too). It can then act on no server in the bot's name.
|
|
96
|
+
*/
|
|
97
|
+
userInstallable: boolean;
|
|
98
|
+
createdAt: Date;
|
|
99
|
+
updatedAt: Date;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** A button, select menu or form of the draft of a Discord bot Service, routed by the start of its `custom_id`. */
|
|
103
|
+
export interface IReflexDiscordComponent {
|
|
104
|
+
id: string;
|
|
105
|
+
serviceId: string;
|
|
106
|
+
/** A function of the same Service. */
|
|
107
|
+
functionId: string;
|
|
108
|
+
/** Unique within the Service; no prefix starts another one. An interaction matches the prefix followed by `:`, or equal to its `custom_id`. */
|
|
109
|
+
customIdPrefix: string;
|
|
110
|
+
kind: DiscordComponentKind;
|
|
111
|
+
createdAt: Date;
|
|
112
|
+
updatedAt: Date;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* A command as a version of the Service froze it. The fields of card 846 are only there when set (a
|
|
117
|
+
* translation, `userInstallable` true): a command without them keeps the fingerprint it had.
|
|
118
|
+
*/
|
|
119
|
+
export type IReflexDiscordCommandSnapshot = Pick<
|
|
120
|
+
IReflexDiscordCommand,
|
|
121
|
+
| 'id'
|
|
122
|
+
| 'functionId'
|
|
123
|
+
| 'name'
|
|
124
|
+
| 'description'
|
|
125
|
+
| 'options'
|
|
126
|
+
| 'defaultMemberPermissions'
|
|
127
|
+
| 'allowedInDirectMessages'
|
|
128
|
+
> & {
|
|
129
|
+
nameLocalizations?: ReflexDiscordLocalizations;
|
|
130
|
+
descriptionLocalizations?: ReflexDiscordLocalizations;
|
|
131
|
+
userInstallable?: true;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/** A component as a version of the Service froze it. */
|
|
135
|
+
export type IReflexDiscordComponentSnapshot = Pick<
|
|
136
|
+
IReflexDiscordComponent,
|
|
137
|
+
'id' | 'functionId' | 'customIdPrefix' | 'kind'
|
|
138
|
+
>;
|
|
139
|
+
|
|
140
|
+
/** Settings of a Discord bot Service in one environment, kept outside the versions. */
|
|
141
|
+
export interface IReflexDiscordEnvironmentSettings {
|
|
142
|
+
id: string;
|
|
143
|
+
serviceId: string;
|
|
144
|
+
environmentId: string;
|
|
145
|
+
/** Discord server (snowflake) the commands are pushed to outside production; required there. */
|
|
146
|
+
testGuildId: string | null;
|
|
147
|
+
/** Discord permission bits as a decimal string, put in the invitation link. */
|
|
148
|
+
invitePermissions: string;
|
|
149
|
+
/** What the bot shows while connected. */
|
|
150
|
+
presenceStatus: DiscordPresenceStatus;
|
|
151
|
+
/** Null for no activity. */
|
|
152
|
+
activityType: DiscordActivityType | null;
|
|
153
|
+
/** 1 to 128 characters with an `activityType`, null without. */
|
|
154
|
+
activityText: string | null;
|
|
155
|
+
createdAt: Date;
|
|
156
|
+
updatedAt: Date;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** The Gateway connection of the bot of one environment, as its row in the execution plane says. */
|
|
160
|
+
export interface IReflexDiscordPresence {
|
|
161
|
+
state: DiscordGatewayState;
|
|
162
|
+
/** Set if and only if `state` is `FAILED`. */
|
|
163
|
+
failureCode: DiscordGatewayFailureCode | null;
|
|
164
|
+
stateChangedAt: Date;
|
|
165
|
+
/** Null until the bot connected once. */
|
|
166
|
+
lastConnectedAt: Date | null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** What the Connection screen shows of the bot of one environment. Never carries the token. */
|
|
170
|
+
export interface IReflexDiscordEnvironmentConnection {
|
|
171
|
+
environmentId: string;
|
|
172
|
+
/** The Discord application read from the token; null while the token is missing, rejected or unchecked. */
|
|
173
|
+
applicationId: string | null;
|
|
174
|
+
publicKey: string | null;
|
|
175
|
+
botName: string | null;
|
|
176
|
+
botAvatarUrl: string | null;
|
|
177
|
+
tokenState: DiscordTokenState;
|
|
178
|
+
testGuildId: string | null;
|
|
179
|
+
invitePermissions: string;
|
|
180
|
+
presenceStatus: DiscordPresenceStatus;
|
|
181
|
+
activityType: DiscordActivityType | null;
|
|
182
|
+
activityText: string | null;
|
|
183
|
+
/** The Gateway connection; null while the bot is not in service in this environment. */
|
|
184
|
+
presence: IReflexDiscordPresence | null;
|
|
185
|
+
/** Address to give Discord for interactions in this environment. */
|
|
186
|
+
interactionsUrl: string;
|
|
187
|
+
/** Link that adds the bot to a Discord server; null while the application is unknown. */
|
|
188
|
+
inviteUrl: string | null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The Vault entry holding the token, and the bot of each environment of the application. */
|
|
192
|
+
export interface IReflexDiscordConnection {
|
|
193
|
+
/** Vault entry (secret) that holds the bot token, one value per environment; null until chosen. */
|
|
194
|
+
discordTokenSecretId: string | null;
|
|
195
|
+
environments: IReflexDiscordEnvironmentConnection[];
|
|
196
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { ExecutionMode, ExecutionProfile } from '../../enum';
|
|
2
|
-
import type { ExecutionSettingsSource } from '../../enum';
|
|
3
|
-
|
|
4
|
-
/** The execution settings of a function in an environment. */
|
|
5
|
-
export interface IReflexExecutionSettingsValues {
|
|
6
|
-
profile: ExecutionProfile;
|
|
7
|
-
/** Past this, a synchronous caller that got no answer receives 504 and the execution goes on. */
|
|
8
|
-
responseTimeoutMs: number;
|
|
9
|
-
/** Past this, the execution is stopped with TIMEOUT. */
|
|
10
|
-
maxDurationMs: number;
|
|
11
|
-
mode: ExecutionMode;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** Bounds of the settings, in milliseconds. */
|
|
15
|
-
export const REFLEX_EXECUTION_SETTINGS_LIMITS = {
|
|
16
|
-
responseTimeoutMs: { min: 1_000, max: 100_000 },
|
|
17
|
-
maxDurationMs: { min: 1_000, max: 3_600_000 },
|
|
18
|
-
} as const;
|
|
19
|
-
|
|
20
|
-
/** What a function runs with when nothing is set. */
|
|
21
|
-
export const DEFAULT_REFLEX_EXECUTION_SETTINGS: Readonly<IReflexExecutionSettingsValues> = {
|
|
22
|
-
profile: ExecutionProfile.S,
|
|
23
|
-
responseTimeoutMs: 30_000,
|
|
24
|
-
maxDurationMs: 30_000,
|
|
25
|
-
mode: ExecutionMode.SYNC,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/** A row of settings: the default of the function (`environmentId` null) or the override of one environment. */
|
|
29
|
-
export interface IReflexExecutionSettings extends IReflexExecutionSettingsValues {
|
|
30
|
-
id: string;
|
|
31
|
-
functionId: string;
|
|
32
|
-
/** An environment of the application (abyss-main's id); null for the default of every environment. */
|
|
33
|
-
environmentId: string | null;
|
|
34
|
-
updatedByUserId: string;
|
|
35
|
-
createdAt: Date;
|
|
36
|
-
updatedAt: Date;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** What one environment of the application runs with. */
|
|
40
|
-
export interface IReflexEffectiveExecutionSettings {
|
|
41
|
-
environmentId: string;
|
|
42
|
-
/** The name of the environment (abyss-main), immutable. */
|
|
43
|
-
environmentSlug: string;
|
|
44
|
-
/** Changing what a production environment runs with needs REFLEX_PUBLISH_PRODUCTION. */
|
|
45
|
-
isProduction: boolean;
|
|
46
|
-
source: ExecutionSettingsSource;
|
|
47
|
-
settings: IReflexExecutionSettingsValues;
|
|
48
|
-
/** The version promoted in this environment, whose step statistics drive the profile warning; null when none. */
|
|
49
|
-
runningVersionId: string | null;
|
|
50
|
-
}
|
|
1
|
+
import { ExecutionMode, ExecutionProfile } from '../../enum';
|
|
2
|
+
import type { ExecutionSettingsSource } from '../../enum';
|
|
3
|
+
|
|
4
|
+
/** The execution settings of a function in an environment. */
|
|
5
|
+
export interface IReflexExecutionSettingsValues {
|
|
6
|
+
profile: ExecutionProfile;
|
|
7
|
+
/** Past this, a synchronous caller that got no answer receives 504 and the execution goes on. */
|
|
8
|
+
responseTimeoutMs: number;
|
|
9
|
+
/** Past this, the execution is stopped with TIMEOUT. */
|
|
10
|
+
maxDurationMs: number;
|
|
11
|
+
mode: ExecutionMode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Bounds of the settings, in milliseconds. */
|
|
15
|
+
export const REFLEX_EXECUTION_SETTINGS_LIMITS = {
|
|
16
|
+
responseTimeoutMs: { min: 1_000, max: 100_000 },
|
|
17
|
+
maxDurationMs: { min: 1_000, max: 3_600_000 },
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
/** What a function runs with when nothing is set. */
|
|
21
|
+
export const DEFAULT_REFLEX_EXECUTION_SETTINGS: Readonly<IReflexExecutionSettingsValues> = {
|
|
22
|
+
profile: ExecutionProfile.S,
|
|
23
|
+
responseTimeoutMs: 30_000,
|
|
24
|
+
maxDurationMs: 30_000,
|
|
25
|
+
mode: ExecutionMode.SYNC,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** A row of settings: the default of the function (`environmentId` null) or the override of one environment. */
|
|
29
|
+
export interface IReflexExecutionSettings extends IReflexExecutionSettingsValues {
|
|
30
|
+
id: string;
|
|
31
|
+
functionId: string;
|
|
32
|
+
/** An environment of the application (abyss-main's id); null for the default of every environment. */
|
|
33
|
+
environmentId: string | null;
|
|
34
|
+
updatedByUserId: string;
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** What one environment of the application runs with. */
|
|
40
|
+
export interface IReflexEffectiveExecutionSettings {
|
|
41
|
+
environmentId: string;
|
|
42
|
+
/** The name of the environment (abyss-main), immutable. */
|
|
43
|
+
environmentSlug: string;
|
|
44
|
+
/** Changing what a production environment runs with needs REFLEX_PUBLISH_PRODUCTION. */
|
|
45
|
+
isProduction: boolean;
|
|
46
|
+
source: ExecutionSettingsSource;
|
|
47
|
+
settings: IReflexExecutionSettingsValues;
|
|
48
|
+
/** The version promoted in this environment, whose step statistics drive the profile warning; null when none. */
|
|
49
|
+
runningVersionId: string | null;
|
|
50
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { IReflexDefinition } from './reflex-definition.model';
|
|
2
|
-
|
|
3
|
-
export interface IReflexFunctionVersion {
|
|
4
|
-
id: string;
|
|
5
|
-
functionId: string;
|
|
6
|
-
/** 1, 2, 3...: counted per function. */
|
|
7
|
-
number: number;
|
|
8
|
-
/** The frozen definition. */
|
|
9
|
-
definition: IReflexDefinition;
|
|
10
|
-
/** SHA-256 of the definition, lowercase hex. */
|
|
11
|
-
hash: string;
|
|
12
|
-
publishedByUserId: string;
|
|
13
|
-
publishedAt: Date;
|
|
14
|
-
}
|
|
1
|
+
import type { IReflexDefinition } from './reflex-definition.model';
|
|
2
|
+
|
|
3
|
+
export interface IReflexFunctionVersion {
|
|
4
|
+
id: string;
|
|
5
|
+
functionId: string;
|
|
6
|
+
/** 1, 2, 3...: counted per function. */
|
|
7
|
+
number: number;
|
|
8
|
+
/** The frozen definition. */
|
|
9
|
+
definition: IReflexDefinition;
|
|
10
|
+
/** SHA-256 of the definition, lowercase hex. */
|
|
11
|
+
hash: string;
|
|
12
|
+
publishedByUserId: string;
|
|
13
|
+
publishedAt: Date;
|
|
14
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { IReflexDefinition } from './reflex-definition.model';
|
|
2
|
-
|
|
3
|
-
export interface IReflexFunction {
|
|
4
|
-
id: string;
|
|
5
|
-
applicationId: string;
|
|
6
|
-
/** The Service the function belongs to; deleting the Service deletes it. */
|
|
7
|
-
serviceId: string;
|
|
8
|
-
projectId: string;
|
|
9
|
-
name: string;
|
|
10
|
-
/** The definition being edited; a publication freezes a copy of it. */
|
|
11
|
-
draftDefinition: IReflexDefinition;
|
|
12
|
-
createdByUserId: string;
|
|
13
|
-
updatedByUserId: string;
|
|
14
|
-
createdAt: Date;
|
|
15
|
-
updatedAt: Date;
|
|
16
|
-
}
|
|
1
|
+
import type { IReflexDefinition } from './reflex-definition.model';
|
|
2
|
+
|
|
3
|
+
export interface IReflexFunction {
|
|
4
|
+
id: string;
|
|
5
|
+
applicationId: string;
|
|
6
|
+
/** The Service the function belongs to; deleting the Service deletes it. */
|
|
7
|
+
serviceId: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** The definition being edited; a publication freezes a copy of it. */
|
|
11
|
+
draftDefinition: IReflexDefinition;
|
|
12
|
+
createdByUserId: string;
|
|
13
|
+
updatedByUserId: string;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
}
|