@abyss-project/reflex 5.12.0 → 6.0.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/index.d.ts +4 -0
- package/dist/api/index.js +4 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/service-completion-webhook.api.d.ts +3 -0
- package/dist/api/service-completion-webhook.api.js +10 -0
- package/dist/api/service-completion-webhook.api.js.map +1 -0
- package/dist/api/service-consumer.api.d.ts +7 -0
- package/dist/api/service-consumer.api.js +19 -0
- package/dist/api/service-consumer.api.js.map +1 -0
- package/dist/api/service-discord.api.d.ts +1 -2
- package/dist/api/service-discord.api.js +1 -3
- package/dist/api/service-discord.api.js.map +1 -1
- package/dist/api/service-limits.api.d.ts +3 -0
- package/dist/api/service-limits.api.js +10 -0
- package/dist/api/service-limits.api.js.map +1 -0
- package/dist/api/service-openapi.api.d.ts +2 -0
- package/dist/api/service-openapi.api.js +7 -0
- package/dist/api/service-openapi.api.js.map +1 -0
- package/dist/api/service-route.api.js.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/types/enum/completion-delivery-status.enum.d.ts +5 -0
- package/dist/types/enum/completion-delivery-status.enum.js +10 -0
- package/dist/types/enum/completion-delivery-status.enum.js.map +1 -0
- 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 +8 -1
- package/dist/types/enum/reflex-error-code.enum.js +7 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/enum/run-status.enum.d.ts +2 -1
- package/dist/types/enum/run-status.enum.js +1 -0
- package/dist/types/enum/run-status.enum.js.map +1 -1
- package/dist/types/enum/scheduled-run-failure-code.enum.d.ts +2 -1
- package/dist/types/enum/scheduled-run-failure-code.enum.js +1 -0
- package/dist/types/enum/scheduled-run-failure-code.enum.js.map +1 -1
- package/dist/types/enum/service-block-reason.enum.d.ts +4 -0
- package/dist/types/enum/service-block-reason.enum.js +9 -0
- package/dist/types/enum/service-block-reason.enum.js.map +1 -0
- package/dist/types/interface/api/requests/function-run.request.d.ts +1 -0
- package/dist/types/interface/api/requests/function-test.request.d.ts +1 -0
- 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/service-completion-webhook.request.d.ts +9 -0
- package/dist/types/interface/api/requests/service-completion-webhook.request.js +3 -0
- package/dist/types/interface/api/requests/service-completion-webhook.request.js.map +1 -0
- package/dist/types/interface/api/requests/service-consumer.request.d.ts +41 -0
- package/dist/types/interface/api/requests/service-consumer.request.js +3 -0
- package/dist/types/interface/api/requests/service-consumer.request.js.map +1 -0
- package/dist/types/interface/api/requests/service-discord.request.d.ts +1 -14
- package/dist/types/interface/api/requests/service-limits.request.d.ts +18 -0
- package/dist/types/interface/api/requests/service-limits.request.js +3 -0
- package/dist/types/interface/api/requests/service-limits.request.js.map +1 -0
- package/dist/types/interface/api/requests/service-openapi.request.d.ts +8 -0
- package/dist/types/interface/api/requests/service-openapi.request.js +3 -0
- package/dist/types/interface/api/requests/service-openapi.request.js.map +1 -0
- package/dist/types/interface/api/requests/service-route.request.d.ts +3 -0
- package/dist/types/interface/api/responses/function-settings.response.d.ts +3 -1
- package/dist/types/interface/api/responses/function-test.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/service-completion-webhook.response.d.ts +8 -0
- package/dist/types/interface/api/responses/service-completion-webhook.response.js +3 -0
- package/dist/types/interface/api/responses/service-completion-webhook.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-consumer.response.d.ts +25 -0
- package/dist/types/interface/api/responses/service-consumer.response.js +3 -0
- package/dist/types/interface/api/responses/service-consumer.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-discord.response.d.ts +1 -9
- package/dist/types/interface/api/responses/service-limits.response.d.ts +10 -0
- package/dist/types/interface/api/responses/service-limits.response.js +3 -0
- package/dist/types/interface/api/responses/service-limits.response.js.map +1 -0
- package/dist/types/interface/api/responses/service-openapi.response.d.ts +5 -0
- package/dist/types/interface/api/responses/service-openapi.response.js +3 -0
- package/dist/types/interface/api/responses/service-openapi.response.js.map +1 -0
- 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 +0 -25
- package/dist/types/interface/models/reflex-bot-limits.model.js +8 -7
- package/dist/types/interface/models/reflex-bot-limits.model.js.map +1 -1
- package/dist/types/interface/models/reflex-completion-webhook.model.d.ts +48 -0
- package/dist/types/interface/models/reflex-completion-webhook.model.js +12 -0
- package/dist/types/interface/models/reflex-completion-webhook.model.js.map +1 -0
- package/dist/types/interface/models/reflex-consumer.model.d.ts +30 -0
- package/dist/types/interface/models/reflex-consumer.model.js +11 -0
- package/dist/types/interface/models/reflex-consumer.model.js.map +1 -0
- package/dist/types/interface/models/reflex-execution-settings.model.d.ts +1 -0
- package/dist/types/interface/models/reflex-execution-settings.model.js +1 -0
- package/dist/types/interface/models/reflex-execution-settings.model.js.map +1 -1
- package/dist/types/interface/models/reflex-route-contract.model.d.ts +22 -0
- package/dist/types/interface/models/reflex-route-contract.model.js +13 -0
- package/dist/types/interface/models/reflex-route-contract.model.js.map +1 -0
- package/dist/types/interface/models/reflex-route.model.d.ts +2 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +21 -0
- package/dist/types/interface/models/reflex-run.model.js.map +1 -1
- package/dist/types/interface/models/reflex-service-limits.model.d.ts +41 -0
- package/dist/types/interface/models/reflex-service-limits.model.js +13 -0
- package/dist/types/interface/models/reflex-service-limits.model.js.map +1 -0
- package/dist/types/interface/models/reflex-service-version.model.d.ts +2 -0
- package/jest.config.ts +11 -11
- package/package.json +1 -1
- package/src/api/alert-rule.api.test.ts +72 -72
- package/src/api/alert-rule.api.ts +57 -57
- package/src/api/application-insights.api.test.ts +42 -42
- package/src/api/application-insights.api.ts +38 -38
- package/src/api/application-run-settings.api.test.ts +51 -51
- package/src/api/application-run-settings.api.ts +30 -30
- package/src/api/function-access.api.ts +87 -87
- 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 -74
- package/src/api/function-template.api.test.ts +72 -72
- package/src/api/function-template.api.ts +52 -52
- package/src/api/function-test.api.ts +34 -34
- package/src/api/function-version.api.ts +66 -66
- package/src/api/function.api.test.ts +2 -1
- package/src/api/function.api.ts +62 -62
- package/src/api/health.api.ts +10 -10
- package/src/api/index.ts +4 -0
- package/src/api/route-stats.api.test.ts +45 -45
- package/src/api/route-stats.api.ts +36 -36
- package/src/api/service-completion-webhook.api.test.ts +87 -0
- package/src/api/service-completion-webhook.api.ts +37 -0
- package/src/api/service-configuration.api.ts +16 -16
- package/src/api/service-consumer.api.test.ts +104 -0
- package/src/api/service-consumer.api.ts +88 -0
- 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 +0 -19
- package/src/api/service-discord.api.ts +0 -19
- package/src/api/service-insights.api.test.ts +36 -36
- package/src/api/service-insights.api.ts +42 -42
- package/src/api/service-limits.api.test.ts +100 -0
- package/src/api/service-limits.api.ts +37 -0
- package/src/api/service-openapi.api.test.ts +52 -0
- package/src/api/service-openapi.api.ts +21 -0
- package/src/api/service-route.api.ts +8 -6
- 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 +18 -1
- package/src/index.ts +46 -3
- package/src/insights/index.ts +1 -1
- package/src/insights/percentiles.test.ts +75 -75
- package/src/insights/percentiles.ts +37 -37
- 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/access-request-status.enum.ts +11 -11
- package/src/types/enum/bot-event-block-reason.enum.ts +7 -7
- package/src/types/enum/completion-delivery-status.enum.ts +9 -0
- 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-channel-type.enum.ts +11 -11
- 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-host-action.enum.ts +35 -35
- package/src/types/enum/discord-locale.enum.ts +35 -35
- 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 +2 -0
- package/src/types/enum/insights-period.enum.ts +8 -8
- package/src/types/enum/log-cap-mode.enum.ts +6 -6
- package/src/types/enum/log-drop-cause.enum.ts +8 -8
- package/src/types/enum/reflex-alert-metric.enum.ts +5 -5
- package/src/types/enum/reflex-alert-notification-state.enum.ts +6 -6
- package/src/types/enum/reflex-alert-scope.enum.ts +6 -6
- package/src/types/enum/reflex-error-code.enum.ts +31 -1
- 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 +5 -0
- 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 +3 -1
- 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-block-reason.enum.ts +13 -0
- 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 -53
- package/src/types/interface/api/requests/application-insights.request.ts +18 -18
- package/src/types/interface/api/requests/application-run-settings.request.ts +11 -11
- package/src/types/interface/api/requests/function-access.request.ts +51 -51
- package/src/types/interface/api/requests/function-run.request.ts +2 -0
- package/src/types/interface/api/requests/function-settings.request.ts +34 -34
- package/src/types/interface/api/requests/function-template.request.ts +29 -29
- package/src/types/interface/api/requests/function-test.request.ts +5 -0
- package/src/types/interface/api/requests/function-version.request.ts +38 -38
- package/src/types/interface/api/requests/function.request.ts +36 -36
- package/src/types/interface/api/requests/index.ts +4 -0
- package/src/types/interface/api/requests/route-stats.request.ts +22 -22
- package/src/types/interface/api/requests/service-completion-webhook.request.ts +11 -0
- package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
- package/src/types/interface/api/requests/service-consumer.request.ts +51 -0
- 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 +1 -25
- package/src/types/interface/api/requests/service-insights.request.ts +31 -31
- package/src/types/interface/api/requests/service-limits.request.ts +28 -0
- package/src/types/interface/api/requests/service-openapi.request.ts +10 -0
- package/src/types/interface/api/requests/service-route.request.ts +8 -0
- 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 -24
- package/src/types/interface/api/responses/application-insights.response.ts +11 -11
- package/src/types/interface/api/responses/application-run-settings.response.ts +8 -8
- package/src/types/interface/api/responses/function-access.response.ts +45 -45
- package/src/types/interface/api/responses/function-run.response.ts +18 -18
- package/src/types/interface/api/responses/function-settings.response.ts +8 -0
- package/src/types/interface/api/responses/function-template.response.ts +21 -21
- package/src/types/interface/api/responses/function-test.response.ts +8 -1
- package/src/types/interface/api/responses/function-version.response.ts +42 -42
- package/src/types/interface/api/responses/function.response.ts +25 -25
- package/src/types/interface/api/responses/index.ts +4 -0
- package/src/types/interface/api/responses/route-stats.response.ts +15 -15
- package/src/types/interface/api/responses/service-completion-webhook.response.ts +13 -0
- package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
- package/src/types/interface/api/responses/service-consumer.response.ts +33 -0
- 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 +4 -16
- package/src/types/interface/api/responses/service-insights.response.ts +11 -11
- package/src/types/interface/api/responses/service-limits.response.ts +13 -0
- package/src/types/interface/api/responses/service-openapi.response.ts +7 -0
- package/src/types/interface/api/responses/service-route.response.ts +3 -3
- package/src/types/interface/api/responses/service-task.response.ts +57 -57
- package/src/types/interface/api/responses/service-version.response.ts +112 -112
- 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 +4 -0
- package/src/types/interface/models/reflex-access-grant.model.ts +14 -14
- package/src/types/interface/models/reflex-access-request.model.ts +15 -15
- package/src/types/interface/models/reflex-alert-rule.model.ts +56 -56
- package/src/types/interface/models/reflex-bot-limits.model.ts +12 -51
- package/src/types/interface/models/reflex-completion-webhook.model.ts +85 -0
- package/src/types/interface/models/reflex-consumer.model.ts +50 -0
- 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 -196
- package/src/types/interface/models/reflex-execution-settings.model.ts +7 -0
- package/src/types/interface/models/reflex-function-template.model.ts +18 -18
- package/src/types/interface/models/reflex-function-version.model.ts +19 -19
- package/src/types/interface/models/reflex-function.model.ts +30 -30
- package/src/types/interface/models/reflex-insights.model.ts +215 -215
- package/src/types/interface/models/reflex-price-list.model.ts +20 -20
- package/src/types/interface/models/reflex-route-contract.model.ts +46 -0
- package/src/types/interface/models/reflex-route.model.ts +5 -1
- package/src/types/interface/models/reflex-run-settings.model.ts +28 -28
- package/src/types/interface/models/reflex-run.model.ts +47 -3
- 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-limits.model.ts +73 -0
- package/src/types/interface/models/reflex-service-version.model.ts +3 -0
- 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,19 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { REFLEX_SERVICE_SPEND_LIMITS } from './reflex-service-limits.model';
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Bounds of the per-bot limits and of their alerts. The monthly spend cap and its alerts are those of every
|
|
5
|
+
* Service (`REFLEX_SERVICE_SPEND_LIMITS`).
|
|
6
|
+
*/
|
|
4
7
|
export const REFLEX_BOT_LIMITS = {
|
|
5
8
|
/** Events per minute added by one lot of the `reflex-bot-events` module. */
|
|
6
9
|
eventsPerMinutePerLot: 500,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
alertThresholdMax: 100,
|
|
15
|
-
/** Thresholds a bot starts with, for the monthly spend cap. */
|
|
16
|
-
spendCapDefaultThresholds: [80, 100],
|
|
10
|
+
monthlySpendCapDefaultCents: REFLEX_SERVICE_SPEND_LIMITS.monthlySpendCapDefaultCents,
|
|
11
|
+
monthlySpendCapMinCents: REFLEX_SERVICE_SPEND_LIMITS.monthlySpendCapMinCents,
|
|
12
|
+
monthlySpendCapMaxCents: REFLEX_SERVICE_SPEND_LIMITS.monthlySpendCapMaxCents,
|
|
13
|
+
alertThresholdsMax: REFLEX_SERVICE_SPEND_LIMITS.alertThresholdsMax,
|
|
14
|
+
alertThresholdMin: REFLEX_SERVICE_SPEND_LIMITS.alertThresholdMin,
|
|
15
|
+
alertThresholdMax: REFLEX_SERVICE_SPEND_LIMITS.alertThresholdMax,
|
|
16
|
+
spendCapDefaultThresholds: REFLEX_SERVICE_SPEND_LIMITS.spendCapDefaultThresholds,
|
|
17
17
|
/** Rate alert: minutes of the UTC day above `rateAlertDefaultPercent` of the rate, by default. */
|
|
18
18
|
rateAlertDefaultMinutes: 5,
|
|
19
19
|
rateAlertDefaultPercent: 80,
|
|
@@ -51,42 +51,3 @@ export interface IReflexBotRateExcess {
|
|
|
51
51
|
/** Minutes in which at least one event was rejected for the rate. */
|
|
52
52
|
minutesAtCap: number;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
/** The monthly spend cap of a bot: all its consumption of the month, included credits too, at the price of the lot. */
|
|
56
|
-
export interface IReflexBotMonthlySpendCap {
|
|
57
|
-
capCents: number;
|
|
58
|
-
spentCents: number;
|
|
59
|
-
/** `spentCents / capCents`, in percent; may go past 100. */
|
|
60
|
-
usedPercent: number;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** Credits of the month a bot consumed, and its overage setting. */
|
|
64
|
-
export interface IReflexBotCredits {
|
|
65
|
-
/** `YYYY-MM`. */
|
|
66
|
-
month: string;
|
|
67
|
-
consumedMillicredits: number;
|
|
68
|
-
/** True when the bot bills overage past the credits of the organization. */
|
|
69
|
-
overageEnabled: boolean;
|
|
70
|
-
/** True when the organization allows overage of the credits metric at all. */
|
|
71
|
-
overageAllowedByOrganization: boolean;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** Alert settings of one limit of a bot. */
|
|
75
|
-
export interface IReflexBotAlertSettings {
|
|
76
|
-
/** Percent values, at most 5, each from 1 to 100. */
|
|
77
|
-
thresholds: number[];
|
|
78
|
-
email: boolean;
|
|
79
|
-
inApp: boolean;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/** Alert settings of a bot in one environment. */
|
|
83
|
-
export interface IReflexBotAlerts {
|
|
84
|
-
rate: IReflexBotAlertSettings;
|
|
85
|
-
monthlySpendCap: IReflexBotAlertSettings;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** What stops the events of a bot at the Gateway. */
|
|
89
|
-
export interface IReflexBotBlock {
|
|
90
|
-
reason: BotEventBlockReason;
|
|
91
|
-
since: Date;
|
|
92
|
-
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { CompletionDeliveryStatus, RunStatus } from '../../enum';
|
|
2
|
+
|
|
3
|
+
/** The header that carries the id of a delivery, the same at every attempt: the receiver drops a repeat by it. */
|
|
4
|
+
export const COMPLETION_DELIVERY_ID_HEADER = 'x-abyss-delivery-id';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The first path segment the edge keeps for the state of an async execution:
|
|
8
|
+
* `GET /<application>/<environment>/<service>/_executions/:executionId`, with the key of the consumer that started it.
|
|
9
|
+
*/
|
|
10
|
+
export const RESERVED_EXECUTIONS_SEGMENT = '_executions';
|
|
11
|
+
|
|
12
|
+
/** Bounds of the completion webhook. */
|
|
13
|
+
export const REFLEX_COMPLETION_WEBHOOK_LIMITS = {
|
|
14
|
+
/** Characters of the URL; `https` only. */
|
|
15
|
+
urlMaxLength: 2048,
|
|
16
|
+
/** Minutes before each retry, after the first attempt: 5 retries at most. */
|
|
17
|
+
retryDelaysMinutes: [1, 5, 15, 30, 60],
|
|
18
|
+
/** Timeout of one attempt. */
|
|
19
|
+
sendTimeoutMs: 10_000,
|
|
20
|
+
/** Bytes of the UTF-8 JSON of `output`; past it, `output` is null and `outputTruncated` true. */
|
|
21
|
+
outputMaxBytes: 65_536,
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The JSON body the edge `POST`s to the completion webhook URL once an async execution finished, signed
|
|
26
|
+
* `x-abyss-signature: t=<seconds>,v1=<hmac>` (ADR-0257) with the secret of the Service and the environment, and
|
|
27
|
+
* sent with `COMPLETION_DELIVERY_ID_HEADER`. The body is the same at every attempt.
|
|
28
|
+
*/
|
|
29
|
+
export interface IReflexCompletionWebhookPayload {
|
|
30
|
+
executionId: string;
|
|
31
|
+
functionId: string;
|
|
32
|
+
status: RunStatus;
|
|
33
|
+
/** The status of the response the function built. */
|
|
34
|
+
httpStatus: number;
|
|
35
|
+
/** The body of that response; null when none, or when it was cut. */
|
|
36
|
+
output: unknown | null;
|
|
37
|
+
/** True when the output went past `REFLEX_COMPLETION_WEBHOOK_LIMITS.outputMaxBytes`. */
|
|
38
|
+
outputTruncated: boolean;
|
|
39
|
+
/** Set when the execution failed. */
|
|
40
|
+
error: { code: string; message: string } | null;
|
|
41
|
+
durationMs: number;
|
|
42
|
+
/** The cost of the execution in credits, the deliveries left out (each attempt costs 0.01 credit on its own). */
|
|
43
|
+
costCredits: number;
|
|
44
|
+
/** ISO 8601. */
|
|
45
|
+
finishedAt: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** One attempt to deliver the completion webhook. Each attempt costs 0.01 credit, retries included. */
|
|
49
|
+
export interface IReflexCompletionDeliveryAttempt {
|
|
50
|
+
/** 1 for the first send, then 2 to 6 for the retries. */
|
|
51
|
+
attempt: number;
|
|
52
|
+
attemptedAt: Date;
|
|
53
|
+
/** The status the receiver answered; null when it did not answer (network, timeout, refused address). */
|
|
54
|
+
httpStatus: number | null;
|
|
55
|
+
durationMs: number;
|
|
56
|
+
/** Why the attempt failed; null for a 2xx. */
|
|
57
|
+
error: string | null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The delivery of the completion webhook of one async execution, with its attempts. */
|
|
61
|
+
export interface IReflexCompletionDelivery {
|
|
62
|
+
/** The value of `COMPLETION_DELIVERY_ID_HEADER`. */
|
|
63
|
+
id: string;
|
|
64
|
+
url: string;
|
|
65
|
+
status: CompletionDeliveryStatus;
|
|
66
|
+
/** In order. */
|
|
67
|
+
attempts: IReflexCompletionDeliveryAttempt[];
|
|
68
|
+
/** When the next attempt is due; null once DELIVERED or FAILED. */
|
|
69
|
+
nextAttemptAt: Date | null;
|
|
70
|
+
createdAt: Date;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** A signing secret of the completion webhook, in clear, shown ONCE when created or rotated. */
|
|
74
|
+
export interface IReflexIssuedCompletionSecret {
|
|
75
|
+
environmentId: string;
|
|
76
|
+
secret: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The signing secret of the completion webhook of a Service in one environment. Never carries the secret. */
|
|
80
|
+
export interface IReflexCompletionWebhookSecret {
|
|
81
|
+
environmentId: string;
|
|
82
|
+
createdAt: Date;
|
|
83
|
+
/** Null until rotated once. */
|
|
84
|
+
rotatedAt: Date | null;
|
|
85
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A key of a consumer: `rfx_` followed by 48 hexadecimal characters, kept as its SHA-256 only. The key itself is
|
|
3
|
+
* shown once, when created.
|
|
4
|
+
*/
|
|
5
|
+
export interface IReflexConsumerKey {
|
|
6
|
+
id: string;
|
|
7
|
+
consumerId: string;
|
|
8
|
+
/**
|
|
9
|
+
* The first 8 characters of the key, to recognize it; null for a key migrated from a route, whose clear value
|
|
10
|
+
* was never kept.
|
|
11
|
+
*/
|
|
12
|
+
prefix: string | null;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
/** The last call the edge accepted with it, written at most once a minute; null when never used. */
|
|
15
|
+
lastUsedAt: Date | null;
|
|
16
|
+
/** Null while it is active; a revoked key is refused (`401`) as soon as the revocation answered. */
|
|
17
|
+
revokedAt: Date | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Who calls the `API_KEY` routes of a Service: the edge identifies it by its key and passes
|
|
22
|
+
* `consumer: { id, name }` to the function. Not versioned: a change applies at once wherever the Service is in
|
|
23
|
+
* service.
|
|
24
|
+
*/
|
|
25
|
+
export interface IReflexConsumer {
|
|
26
|
+
id: string;
|
|
27
|
+
serviceId: string;
|
|
28
|
+
/** 1 to 64 characters, unique in the Service whatever the case. */
|
|
29
|
+
name: string;
|
|
30
|
+
/** 500 characters at most; null when none. */
|
|
31
|
+
description: string | null;
|
|
32
|
+
/** The `API_KEY` routes of the Service it may call; null for all of them. */
|
|
33
|
+
routeIds: string[] | null;
|
|
34
|
+
/** Calls per minute of its own, on top of the limit per IP; null for no limit of its own. */
|
|
35
|
+
rateLimitPerMinute: number | null;
|
|
36
|
+
/** Its keys, active and revoked, newest first. */
|
|
37
|
+
keys: IReflexConsumerKey[];
|
|
38
|
+
createdByUserId: string;
|
|
39
|
+
createdAt: Date;
|
|
40
|
+
updatedAt: Date;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Bounds of the consumers of a Service (system limits, not quotas of a plan). */
|
|
44
|
+
export const REFLEX_CONSUMER_LIMITS = {
|
|
45
|
+
perService: 100,
|
|
46
|
+
activeKeysPerConsumer: 5,
|
|
47
|
+
nameMaxLength: 64,
|
|
48
|
+
descriptionMaxLength: 500,
|
|
49
|
+
rateLimitPerMinute: { min: 1, max: 100_000 },
|
|
50
|
+
} as const;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import type { ReflexAccessKind } from '../../enum';
|
|
2
|
-
|
|
3
|
-
export interface IReflexHttpAccess {
|
|
4
|
-
kind: ReflexAccessKind.HTTP;
|
|
5
|
-
hosts: string[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface IReflexHostActionAccess {
|
|
9
|
-
kind: ReflexAccessKind.HOST_ACTION;
|
|
10
|
-
action: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type IReflexAccessDeclaration = IReflexHttpAccess | IReflexHostActionAccess;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A function's definition, in the format of @abyss-project/runtime (`formatVersion` 1). The steps are
|
|
17
|
-
* the core's own and validated by the API; the SDK only carries them.
|
|
18
|
-
*/
|
|
19
|
-
export interface IReflexDefinition {
|
|
20
|
-
formatVersion: number;
|
|
21
|
-
accesses: IReflexAccessDeclaration[];
|
|
22
|
-
steps: Array<Record<string, unknown>>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Bounds of the status a RESPOND step (or `abyss.respond`) may answer with, both included: the
|
|
27
|
-
* runtime's `MIN_RESPONSE_STATUS` and `MAX_RESPONSE_STATUS`, which publication and the edge apply.
|
|
28
|
-
* The API's tests check that they are equal.
|
|
29
|
-
*/
|
|
30
|
-
export const RESPOND_STATUS_MIN = 200;
|
|
31
|
-
export const RESPOND_STATUS_MAX = 599;
|
|
1
|
+
import type { ReflexAccessKind } from '../../enum';
|
|
2
|
+
|
|
3
|
+
export interface IReflexHttpAccess {
|
|
4
|
+
kind: ReflexAccessKind.HTTP;
|
|
5
|
+
hosts: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IReflexHostActionAccess {
|
|
9
|
+
kind: ReflexAccessKind.HOST_ACTION;
|
|
10
|
+
action: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type IReflexAccessDeclaration = IReflexHttpAccess | IReflexHostActionAccess;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A function's definition, in the format of @abyss-project/runtime (`formatVersion` 1). The steps are
|
|
17
|
+
* the core's own and validated by the API; the SDK only carries them.
|
|
18
|
+
*/
|
|
19
|
+
export interface IReflexDefinition {
|
|
20
|
+
formatVersion: number;
|
|
21
|
+
accesses: IReflexAccessDeclaration[];
|
|
22
|
+
steps: Array<Record<string, unknown>>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Bounds of the status a RESPOND step (or `abyss.respond`) may answer with, both included: the
|
|
27
|
+
* runtime's `MIN_RESPONSE_STATUS` and `MAX_RESPONSE_STATUS`, which publication and the edge apply.
|
|
28
|
+
* The API's tests check that they are equal.
|
|
29
|
+
*/
|
|
30
|
+
export const RESPOND_STATUS_MIN = 200;
|
|
31
|
+
export const RESPOND_STATUS_MAX = 599;
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DiscordEventDropReason,
|
|
3
|
-
DiscordEventFilterName,
|
|
4
|
-
DiscordEventStatus,
|
|
5
|
-
DiscordEventType,
|
|
6
|
-
} from '../../enum';
|
|
7
|
-
|
|
8
|
-
/** A retained event, from the inbox of the execution plane. */
|
|
9
|
-
export interface IReflexDiscordEventLogRetained {
|
|
10
|
-
id: string;
|
|
11
|
-
eventType: DiscordEventType;
|
|
12
|
-
guildId: string | null;
|
|
13
|
-
channelId: string | null;
|
|
14
|
-
authorId: string | null;
|
|
15
|
-
receivedAt: Date;
|
|
16
|
-
status: DiscordEventStatus;
|
|
17
|
-
triggerId: string;
|
|
18
|
-
/** The name of the trigger in the version in service; null when that version no longer has it. */
|
|
19
|
-
triggerName: string | null;
|
|
20
|
-
functionId: string | null;
|
|
21
|
-
/** The execution it started; null before it ran. */
|
|
22
|
-
liveRunId: string | null;
|
|
23
|
-
durationMs: number | null;
|
|
24
|
-
costMillicredits: number | null;
|
|
25
|
-
/** Failure code of a FAILED event: `EVENT_TRIGGER_REMOVED` or the error code of the run; null otherwise. */
|
|
26
|
-
failureCode: string | null;
|
|
27
|
-
/** The id of its inbox row without dashes. */
|
|
28
|
-
traceId: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** A dropped event, from the sample kept per bot and per reason. */
|
|
32
|
-
export interface IReflexDiscordEventLogDropped {
|
|
33
|
-
id: string;
|
|
34
|
-
eventType: DiscordEventType;
|
|
35
|
-
guildId: string | null;
|
|
36
|
-
channelId: string | null;
|
|
37
|
-
authorId: string | null;
|
|
38
|
-
receivedAt: Date;
|
|
39
|
-
reason: DiscordEventDropReason;
|
|
40
|
-
/** The filter that rejected it, when `reason` is FILTERED; null otherwise. */
|
|
41
|
-
filterName: DiscordEventFilterName | null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Shown instead of the events when Discord refused the intents (close code 4014): it sends none, so none can be listed. */
|
|
45
|
-
export interface IReflexDiscordEventLogIntentsRefused {
|
|
46
|
-
since: Date;
|
|
47
|
-
/** The privileged intents the version in service asks for, as Discord intent bits. */
|
|
48
|
-
privilegedIntents: number[];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** One page of the event log of a bot in one environment. */
|
|
52
|
-
export interface IReflexDiscordEventLogPage {
|
|
53
|
-
retained: IReflexDiscordEventLogRetained[];
|
|
54
|
-
dropped: IReflexDiscordEventLogDropped[];
|
|
55
|
-
/** Null unless the bot is refused its intents. */
|
|
56
|
-
intentsRefused: IReflexDiscordEventLogIntentsRefused | null;
|
|
57
|
-
nextCursor: string | null;
|
|
58
|
-
}
|
|
1
|
+
import type {
|
|
2
|
+
DiscordEventDropReason,
|
|
3
|
+
DiscordEventFilterName,
|
|
4
|
+
DiscordEventStatus,
|
|
5
|
+
DiscordEventType,
|
|
6
|
+
} from '../../enum';
|
|
7
|
+
|
|
8
|
+
/** A retained event, from the inbox of the execution plane. */
|
|
9
|
+
export interface IReflexDiscordEventLogRetained {
|
|
10
|
+
id: string;
|
|
11
|
+
eventType: DiscordEventType;
|
|
12
|
+
guildId: string | null;
|
|
13
|
+
channelId: string | null;
|
|
14
|
+
authorId: string | null;
|
|
15
|
+
receivedAt: Date;
|
|
16
|
+
status: DiscordEventStatus;
|
|
17
|
+
triggerId: string;
|
|
18
|
+
/** The name of the trigger in the version in service; null when that version no longer has it. */
|
|
19
|
+
triggerName: string | null;
|
|
20
|
+
functionId: string | null;
|
|
21
|
+
/** The execution it started; null before it ran. */
|
|
22
|
+
liveRunId: string | null;
|
|
23
|
+
durationMs: number | null;
|
|
24
|
+
costMillicredits: number | null;
|
|
25
|
+
/** Failure code of a FAILED event: `EVENT_TRIGGER_REMOVED` or the error code of the run; null otherwise. */
|
|
26
|
+
failureCode: string | null;
|
|
27
|
+
/** The id of its inbox row without dashes. */
|
|
28
|
+
traceId: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A dropped event, from the sample kept per bot and per reason. */
|
|
32
|
+
export interface IReflexDiscordEventLogDropped {
|
|
33
|
+
id: string;
|
|
34
|
+
eventType: DiscordEventType;
|
|
35
|
+
guildId: string | null;
|
|
36
|
+
channelId: string | null;
|
|
37
|
+
authorId: string | null;
|
|
38
|
+
receivedAt: Date;
|
|
39
|
+
reason: DiscordEventDropReason;
|
|
40
|
+
/** The filter that rejected it, when `reason` is FILTERED; null otherwise. */
|
|
41
|
+
filterName: DiscordEventFilterName | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Shown instead of the events when Discord refused the intents (close code 4014): it sends none, so none can be listed. */
|
|
45
|
+
export interface IReflexDiscordEventLogIntentsRefused {
|
|
46
|
+
since: Date;
|
|
47
|
+
/** The privileged intents the version in service asks for, as Discord intent bits. */
|
|
48
|
+
privilegedIntents: number[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** One page of the event log of a bot in one environment. */
|
|
52
|
+
export interface IReflexDiscordEventLogPage {
|
|
53
|
+
retained: IReflexDiscordEventLogRetained[];
|
|
54
|
+
dropped: IReflexDiscordEventLogDropped[];
|
|
55
|
+
/** Null unless the bot is refused its intents. */
|
|
56
|
+
intentsRefused: IReflexDiscordEventLogIntentsRefused | null;
|
|
57
|
+
nextCursor: string | null;
|
|
58
|
+
}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import type { DiscordEventType } from '../../enum';
|
|
2
|
-
|
|
3
|
-
/** Bounds of the Discord event triggers of a bot; the API, the Gateway and their databases apply the same ones. */
|
|
4
|
-
export const REFLEX_DISCORD_EVENT_LIMITS = {
|
|
5
|
-
/** `^[-_a-z0-9]{1,32}$`: the name of a trigger, unique within the Service. */
|
|
6
|
-
namePattern: /^[-_a-z0-9]{1,32}$/,
|
|
7
|
-
nameMaxLength: 32,
|
|
8
|
-
maxTriggersPerService: 25,
|
|
9
|
-
guildIdsMax: 25,
|
|
10
|
-
channelIdsMax: 50,
|
|
11
|
-
roleIdsMax: 25,
|
|
12
|
-
contentPrefixMaxLength: 32,
|
|
13
|
-
/** Characters of the payload of a retained event, serialized to JSON. */
|
|
14
|
-
payloadMaxLength: 8192,
|
|
15
|
-
/** Characters of the summary kept with an event, retained or dropped. */
|
|
16
|
-
summaryMaxLength: 512,
|
|
17
|
-
/** Dropped events kept as a sample, per bot and per reason. */
|
|
18
|
-
dropSamplesPerReason: 200,
|
|
19
|
-
/** Lateness past which a retained event is EXPIRED instead of run. */
|
|
20
|
-
toleranceMinutes: 15,
|
|
21
|
-
} as const;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* What one bot can take in (decision 6 of the J2 spec, ADR-0307). Measured on staging (C1, run 2, 24/11/2026, after
|
|
25
|
-
* the per-bot claim and the sharded rollups): a bot sustains about 3 000 events per minute, bounded by the database
|
|
26
|
-
* (WAL and the `execution_counters` row) more than by its slots: 20 usable slots at 150 each on staging. The formula
|
|
27
|
-
* `min(lotsMaxCeiling, floor((maxConcurrencyPerBot * runsPerSlotPerMinute - base) / 500))` is kept, with
|
|
28
|
-
* `maxConcurrencyPerBot × runsPerSlotPerMinute` = 30 × 100 = the measured 3 000; `lotsMax` is its value for the largest base.
|
|
29
|
-
*/
|
|
30
|
-
export const REFLEX_BOT_EVENT_CAPACITY = {
|
|
31
|
-
/** With `maxConcurrencyPerBot` (the configuration ceiling 30), keeps the product at the measured 3 000 per bot. */
|
|
32
|
-
runsPerSlotPerMinute: 100,
|
|
33
|
-
/** `maxReplicas` (3) times the ceiling per pod (10) of the edge fleet. */
|
|
34
|
-
maxConcurrencyPerBot: 30,
|
|
35
|
-
/** The most lots of 500 events per minute a bot can be allocated, whatever the measure says. */
|
|
36
|
-
lotsMaxCeiling: 40,
|
|
37
|
-
/** The most lots a bot can be allocated: floor((30 × 100 − 500) / 500) = 5. */
|
|
38
|
-
lotsMax: 5,
|
|
39
|
-
} as const;
|
|
40
|
-
|
|
41
|
-
/** Optional filters of a trigger, combined with AND. An absent or empty list is no filter. */
|
|
42
|
-
export interface IReflexDiscordEventFilters {
|
|
43
|
-
/** 25 at most, every type. */
|
|
44
|
-
guildIds?: string[];
|
|
45
|
-
/** 50 at most, message and reaction. */
|
|
46
|
-
channelIds?: string[];
|
|
47
|
-
/** 25 at most, member arrival, message and reaction: the member has one of these roles. */
|
|
48
|
-
roleIds?: string[];
|
|
49
|
-
/** 32 characters at most, message: the content starts with it; needs the MESSAGE_CONTENT intent. */
|
|
50
|
-
contentPrefix?: string;
|
|
51
|
-
/** True when absent: an author or member that is a bot is ignored. */
|
|
52
|
-
ignoreBots?: boolean;
|
|
53
|
-
/** True when absent, message and reaction: the bot itself is ignored. */
|
|
54
|
-
ignoreSelf?: boolean;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** A Discord event trigger of the draft of a bot Service: a named target of one event type. */
|
|
58
|
-
export interface IReflexDiscordEvent {
|
|
59
|
-
id: string;
|
|
60
|
-
serviceId: string;
|
|
61
|
-
/** A function of the same Service. */
|
|
62
|
-
functionId: string;
|
|
63
|
-
/** Unique within the Service. */
|
|
64
|
-
name: string;
|
|
65
|
-
eventType: DiscordEventType;
|
|
66
|
-
filters: IReflexDiscordEventFilters;
|
|
67
|
-
/** True by default: events of one channel (or one server for member events) run one after the other. */
|
|
68
|
-
ordered: boolean;
|
|
69
|
-
/** False by default, MESSAGE_CREATE only: the function receives the message content. */
|
|
70
|
-
includeContent: boolean;
|
|
71
|
-
createdAt: Date;
|
|
72
|
-
updatedAt: Date;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** A Discord event trigger as a version of the Service froze it. */
|
|
76
|
-
export type IReflexDiscordEventSnapshot = Pick<
|
|
77
|
-
IReflexDiscordEvent,
|
|
78
|
-
'id' | 'functionId' | 'name' | 'eventType' | 'filters' | 'ordered' | 'includeContent'
|
|
79
|
-
>;
|
|
1
|
+
import type { DiscordEventType } from '../../enum';
|
|
2
|
+
|
|
3
|
+
/** Bounds of the Discord event triggers of a bot; the API, the Gateway and their databases apply the same ones. */
|
|
4
|
+
export const REFLEX_DISCORD_EVENT_LIMITS = {
|
|
5
|
+
/** `^[-_a-z0-9]{1,32}$`: the name of a trigger, unique within the Service. */
|
|
6
|
+
namePattern: /^[-_a-z0-9]{1,32}$/,
|
|
7
|
+
nameMaxLength: 32,
|
|
8
|
+
maxTriggersPerService: 25,
|
|
9
|
+
guildIdsMax: 25,
|
|
10
|
+
channelIdsMax: 50,
|
|
11
|
+
roleIdsMax: 25,
|
|
12
|
+
contentPrefixMaxLength: 32,
|
|
13
|
+
/** Characters of the payload of a retained event, serialized to JSON. */
|
|
14
|
+
payloadMaxLength: 8192,
|
|
15
|
+
/** Characters of the summary kept with an event, retained or dropped. */
|
|
16
|
+
summaryMaxLength: 512,
|
|
17
|
+
/** Dropped events kept as a sample, per bot and per reason. */
|
|
18
|
+
dropSamplesPerReason: 200,
|
|
19
|
+
/** Lateness past which a retained event is EXPIRED instead of run. */
|
|
20
|
+
toleranceMinutes: 15,
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* What one bot can take in (decision 6 of the J2 spec, ADR-0307). Measured on staging (C1, run 2, 24/11/2026, after
|
|
25
|
+
* the per-bot claim and the sharded rollups): a bot sustains about 3 000 events per minute, bounded by the database
|
|
26
|
+
* (WAL and the `execution_counters` row) more than by its slots: 20 usable slots at 150 each on staging. The formula
|
|
27
|
+
* `min(lotsMaxCeiling, floor((maxConcurrencyPerBot * runsPerSlotPerMinute - base) / 500))` is kept, with
|
|
28
|
+
* `maxConcurrencyPerBot × runsPerSlotPerMinute` = 30 × 100 = the measured 3 000; `lotsMax` is its value for the largest base.
|
|
29
|
+
*/
|
|
30
|
+
export const REFLEX_BOT_EVENT_CAPACITY = {
|
|
31
|
+
/** With `maxConcurrencyPerBot` (the configuration ceiling 30), keeps the product at the measured 3 000 per bot. */
|
|
32
|
+
runsPerSlotPerMinute: 100,
|
|
33
|
+
/** `maxReplicas` (3) times the ceiling per pod (10) of the edge fleet. */
|
|
34
|
+
maxConcurrencyPerBot: 30,
|
|
35
|
+
/** The most lots of 500 events per minute a bot can be allocated, whatever the measure says. */
|
|
36
|
+
lotsMaxCeiling: 40,
|
|
37
|
+
/** The most lots a bot can be allocated: floor((30 × 100 − 500) / 500) = 5. */
|
|
38
|
+
lotsMax: 5,
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
/** Optional filters of a trigger, combined with AND. An absent or empty list is no filter. */
|
|
42
|
+
export interface IReflexDiscordEventFilters {
|
|
43
|
+
/** 25 at most, every type. */
|
|
44
|
+
guildIds?: string[];
|
|
45
|
+
/** 50 at most, message and reaction. */
|
|
46
|
+
channelIds?: string[];
|
|
47
|
+
/** 25 at most, member arrival, message and reaction: the member has one of these roles. */
|
|
48
|
+
roleIds?: string[];
|
|
49
|
+
/** 32 characters at most, message: the content starts with it; needs the MESSAGE_CONTENT intent. */
|
|
50
|
+
contentPrefix?: string;
|
|
51
|
+
/** True when absent: an author or member that is a bot is ignored. */
|
|
52
|
+
ignoreBots?: boolean;
|
|
53
|
+
/** True when absent, message and reaction: the bot itself is ignored. */
|
|
54
|
+
ignoreSelf?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** A Discord event trigger of the draft of a bot Service: a named target of one event type. */
|
|
58
|
+
export interface IReflexDiscordEvent {
|
|
59
|
+
id: string;
|
|
60
|
+
serviceId: string;
|
|
61
|
+
/** A function of the same Service. */
|
|
62
|
+
functionId: string;
|
|
63
|
+
/** Unique within the Service. */
|
|
64
|
+
name: string;
|
|
65
|
+
eventType: DiscordEventType;
|
|
66
|
+
filters: IReflexDiscordEventFilters;
|
|
67
|
+
/** True by default: events of one channel (or one server for member events) run one after the other. */
|
|
68
|
+
ordered: boolean;
|
|
69
|
+
/** False by default, MESSAGE_CREATE only: the function receives the message content. */
|
|
70
|
+
includeContent: boolean;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
updatedAt: Date;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** A Discord event trigger as a version of the Service froze it. */
|
|
76
|
+
export type IReflexDiscordEventSnapshot = Pick<
|
|
77
|
+
IReflexDiscordEvent,
|
|
78
|
+
'id' | 'functionId' | 'name' | 'eventType' | 'filters' | 'ordered' | 'includeContent'
|
|
79
|
+
>;
|