@abyss-project/reflex 6.3.0 → 6.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/.eslintrc.js +32 -32
- package/README.md +15 -15
- package/dist/api/code-environment.api.d.ts +2 -0
- package/dist/api/code-environment.api.js +7 -0
- package/dist/api/code-environment.api.js.map +1 -0
- package/dist/api/function-run.api.d.ts +2 -1
- package/dist/api/function-run.api.js +3 -1
- package/dist/api/function-run.api.js.map +1 -1
- package/dist/api/function-settings.api.d.ts +3 -1
- package/dist/api/function-settings.api.js +7 -1
- package/dist/api/function-settings.api.js.map +1 -1
- 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-template.api.d.ts +2 -0
- package/dist/api/service-template.api.js +7 -0
- package/dist/api/service-template.api.js.map +1 -0
- package/dist/api/storage-surplus.admin.api.d.ts +5 -0
- package/dist/api/storage-surplus.admin.api.js +17 -0
- package/dist/api/storage-surplus.admin.api.js.map +1 -0
- package/dist/code/index.d.ts +1 -0
- package/dist/code/index.js +18 -0
- package/dist/code/index.js.map +1 -0
- package/dist/code/reflex-code-declarations.d.ts +1 -0
- package/dist/code/reflex-code-declarations.js +644 -0
- package/dist/code/reflex-code-declarations.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- 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/reflex-code-diagnostic-category.enum.d.ts +6 -0
- package/dist/types/enum/reflex-code-diagnostic-category.enum.js +11 -0
- package/dist/types/enum/reflex-code-diagnostic-category.enum.js.map +1 -0
- package/dist/types/enum/reflex-error-code.enum.d.ts +5 -1
- package/dist/types/enum/reflex-error-code.enum.js +4 -0
- package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
- package/dist/types/enum/service-template-follow-up-kind.enum.d.ts +10 -0
- package/dist/types/enum/service-template-follow-up-kind.enum.js +15 -0
- package/dist/types/enum/service-template-follow-up-kind.enum.js.map +1 -0
- package/dist/types/enum/service-template-id.enum.d.ts +10 -0
- package/dist/types/enum/service-template-id.enum.js +15 -0
- package/dist/types/enum/service-template-id.enum.js.map +1 -0
- package/dist/types/enum/service-template-parameter-kind.enum.d.ts +4 -0
- package/dist/types/enum/service-template-parameter-kind.enum.js +9 -0
- package/dist/types/enum/service-template-parameter-kind.enum.js.map +1 -0
- package/dist/types/enum/trigger-access-mode.enum.d.ts +2 -1
- package/dist/types/enum/trigger-access-mode.enum.js +1 -0
- package/dist/types/enum/trigger-access-mode.enum.js.map +1 -1
- package/dist/types/interface/api/requests/application-run-settings.request.d.ts +1 -0
- package/dist/types/interface/api/requests/code-environment.request.d.ts +3 -0
- package/dist/types/interface/api/requests/code-environment.request.js +3 -0
- package/dist/types/interface/api/requests/code-environment.request.js.map +1 -0
- package/dist/types/interface/api/requests/function-run.request.d.ts +8 -0
- package/dist/types/interface/api/requests/function-settings.request.d.ts +12 -0
- package/dist/types/interface/api/requests/index.d.ts +3 -0
- package/dist/types/interface/api/requests/index.js +3 -0
- package/dist/types/interface/api/requests/index.js.map +1 -1
- package/dist/types/interface/api/requests/service-template.request.d.ts +3 -0
- package/dist/types/interface/api/requests/service-template.request.js +3 -0
- package/dist/types/interface/api/requests/service-template.request.js.map +1 -0
- package/dist/types/interface/api/requests/service.request.d.ts +3 -1
- package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +8 -0
- package/dist/types/interface/api/requests/storage-surplus.admin.request.js +3 -0
- package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +1 -0
- package/dist/types/interface/api/responses/code-environment.response.d.ts +6 -0
- package/dist/types/interface/api/responses/code-environment.response.js +3 -0
- package/dist/types/interface/api/responses/code-environment.response.js.map +1 -0
- package/dist/types/interface/api/responses/function-run.response.d.ts +4 -0
- package/dist/types/interface/api/responses/function-settings.response.d.ts +5 -1
- package/dist/types/interface/api/responses/index.d.ts +3 -0
- package/dist/types/interface/api/responses/index.js +3 -0
- package/dist/types/interface/api/responses/index.js.map +1 -1
- package/dist/types/interface/api/responses/service-template.response.d.ts +6 -0
- package/dist/types/interface/api/responses/service-template.response.js +3 -0
- package/dist/types/interface/api/responses/service-template.response.js.map +1 -0
- package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +8 -0
- package/dist/types/interface/api/responses/storage-surplus.admin.response.js +3 -0
- package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +1 -0
- package/dist/types/interface/models/index.d.ts +5 -0
- package/dist/types/interface/models/index.js +5 -0
- package/dist/types/interface/models/index.js.map +1 -1
- package/dist/types/interface/models/reflex-code-diagnostic.model.d.ts +10 -0
- package/dist/types/interface/models/reflex-code-diagnostic.model.js +5 -0
- package/dist/types/interface/models/reflex-code-diagnostic.model.js.map +1 -0
- package/dist/types/interface/models/reflex-code-environment.model.d.ts +9 -0
- package/dist/types/interface/models/reflex-code-environment.model.js +3 -0
- package/dist/types/interface/models/reflex-code-environment.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run-retention.model.d.ts +13 -0
- package/dist/types/interface/models/reflex-run-retention.model.js +8 -0
- package/dist/types/interface/models/reflex-run-retention.model.js.map +1 -0
- package/dist/types/interface/models/reflex-run-settings.model.d.ts +4 -0
- package/dist/types/interface/models/reflex-run.model.d.ts +5 -0
- package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -2
- package/dist/types/interface/models/reflex-service-template.model.d.ts +33 -0
- package/dist/types/interface/models/reflex-service-template.model.js +3 -0
- package/dist/types/interface/models/reflex-service-template.model.js.map +1 -0
- package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
- package/dist/types/interface/models/reflex-storage-surplus.model.d.ts +11 -0
- package/dist/types/interface/models/reflex-storage-surplus.model.js +3 -0
- package/dist/types/interface/models/reflex-storage-surplus.model.js.map +1 -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 +62 -51
- package/src/api/application-run-settings.api.ts +30 -30
- package/src/api/code-environment.api.ts +15 -0
- 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 +53 -38
- package/src/api/function-settings.api.ts +96 -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 +346 -291
- package/src/api/function.api.ts +62 -62
- package/src/api/health.api.ts +10 -10
- package/src/api/index.ts +29 -26
- 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 +97 -97
- package/src/api/service-completion-webhook.api.ts +39 -39
- package/src/api/service-configuration.api.ts +16 -16
- package/src/api/service-consumer.api.test.ts +104 -104
- package/src/api/service-consumer.api.ts +90 -90
- 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 +178 -178
- package/src/api/service-discord.api.ts +222 -222
- 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 -100
- package/src/api/service-limits.api.ts +37 -37
- package/src/api/service-openapi.api.test.ts +52 -52
- package/src/api/service-openapi.api.ts +21 -21
- package/src/api/service-route.api.ts +2 -2
- package/src/api/service-task.api.test.ts +140 -140
- package/src/api/service-task.api.ts +141 -141
- package/src/api/service-template.api.test.ts +41 -0
- package/src/api/service-template.api.ts +12 -0
- package/src/api/service-version.api.ts +54 -54
- package/src/api/service.api.test.ts +220 -215
- package/src/api/service.api.ts +55 -55
- package/src/api/storage-surplus.admin.api.test.ts +66 -0
- package/src/api/storage-surplus.admin.api.ts +45 -0
- package/src/code/index.ts +1 -0
- package/src/code/reflex-code-declarations.ts +646 -0
- 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 +104 -104
- package/src/index.ts +497 -438
- 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 -9
- 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 +37 -37
- 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 +55 -51
- 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-code-diagnostic-category.enum.ts +11 -0
- package/src/types/enum/reflex-error-code.enum.ts +93 -72
- 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 +16 -16
- 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 +14 -14
- 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 -13
- 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-template-follow-up-kind.enum.ts +19 -0
- package/src/types/enum/service-template-id.enum.ts +19 -0
- package/src/types/enum/service-template-parameter-kind.enum.ts +7 -0
- 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 +4 -0
- 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 +13 -11
- package/src/types/interface/api/requests/code-environment.request.ts +3 -0
- package/src/types/interface/api/requests/function-access.request.ts +51 -51
- package/src/types/interface/api/requests/function-run.request.ts +42 -32
- package/src/types/interface/api/requests/function-settings.request.ts +50 -34
- package/src/types/interface/api/requests/function-template.request.ts +29 -29
- package/src/types/interface/api/requests/function-test.request.ts +44 -44
- 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 +27 -24
- package/src/types/interface/api/requests/route-stats.request.ts +22 -22
- package/src/types/interface/api/requests/service-completion-webhook.request.ts +11 -11
- package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
- package/src/types/interface/api/requests/service-consumer.request.ts +51 -51
- 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 +155 -155
- package/src/types/interface/api/requests/service-insights.request.ts +31 -31
- package/src/types/interface/api/requests/service-limits.request.ts +28 -28
- package/src/types/interface/api/requests/service-openapi.request.ts +10 -10
- package/src/types/interface/api/requests/service-route.request.ts +52 -52
- package/src/types/interface/api/requests/service-task.request.ts +80 -80
- package/src/types/interface/api/requests/service-template.request.ts +3 -0
- package/src/types/interface/api/requests/service-version.request.ts +24 -24
- package/src/types/interface/api/requests/service.request.ts +54 -46
- package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -0
- 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/code-environment.response.ts +7 -0
- package/src/types/interface/api/responses/function-access.response.ts +45 -45
- package/src/types/interface/api/responses/function-run.response.ts +23 -18
- package/src/types/interface/api/responses/function-settings.response.ts +57 -50
- package/src/types/interface/api/responses/function-template.response.ts +21 -21
- package/src/types/interface/api/responses/function-test.response.ts +19 -19
- 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 +27 -24
- package/src/types/interface/api/responses/route-stats.response.ts +15 -15
- package/src/types/interface/api/responses/service-completion-webhook.response.ts +13 -13
- package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
- package/src/types/interface/api/responses/service-consumer.response.ts +33 -33
- 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 +110 -110
- package/src/types/interface/api/responses/service-insights.response.ts +11 -11
- package/src/types/interface/api/responses/service-limits.response.ts +13 -13
- package/src/types/interface/api/responses/service-openapi.response.ts +7 -7
- package/src/types/interface/api/responses/service-route.response.ts +2 -2
- package/src/types/interface/api/responses/service-task.response.ts +57 -57
- package/src/types/interface/api/responses/service-template.response.ts +8 -0
- 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/api/responses/storage-surplus.admin.response.ts +10 -0
- package/src/types/interface/health.response.ts +7 -7
- package/src/types/interface/index.ts +3 -3
- package/src/types/interface/models/index.ts +32 -27
- 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 +53 -53
- package/src/types/interface/models/reflex-code-diagnostic.model.ts +15 -0
- package/src/types/interface/models/reflex-code-environment.model.ts +17 -0
- package/src/types/interface/models/reflex-completion-webhook.model.ts +111 -111
- package/src/types/interface/models/reflex-consumer.model.ts +50 -50
- 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 +208 -208
- package/src/types/interface/models/reflex-execution-settings.model.ts +57 -57
- 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 +22 -22
- package/src/types/interface/models/reflex-route-contract.model.ts +46 -46
- package/src/types/interface/models/reflex-route.model.ts +23 -23
- package/src/types/interface/models/reflex-run-retention.model.ts +24 -0
- package/src/types/interface/models/reflex-run-settings.model.ts +39 -28
- package/src/types/interface/models/reflex-run.model.ts +309 -299
- package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
- package/src/types/interface/models/reflex-service-deployment.model.ts +48 -46
- package/src/types/interface/models/reflex-service-limits.model.ts +92 -92
- package/src/types/interface/models/reflex-service-template.model.ts +55 -0
- package/src/types/interface/models/reflex-service-version.model.ts +64 -64
- package/src/types/interface/models/reflex-service.model.ts +47 -45
- package/src/types/interface/models/reflex-step-stats.model.ts +35 -35
- package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -0
- package/src/types/interface/models/reflex-task.model.ts +97 -97
- package/tsconfig.check.json +15 -15
- package/tsconfig.json +35 -35
package/src/insights/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './percentiles';
|
|
1
|
+
export * from './percentiles';
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { DURATION_HISTOGRAM_BOUNDS_MS } from '../types';
|
|
2
|
-
import { percentileOfHistogram } from './percentiles';
|
|
3
|
-
|
|
4
|
-
const emptyHistogram = (): number[] =>
|
|
5
|
-
new Array<number>(DURATION_HISTOGRAM_BOUNDS_MS.length + 1).fill(0);
|
|
6
|
-
|
|
7
|
-
describe('percentileOfHistogram', () => {
|
|
8
|
-
it('reads p50, p95 and p99 at the upper bound of the bucket holding them', () => {
|
|
9
|
-
const histogram = emptyHistogram();
|
|
10
|
-
histogram[2] = 50; // <= 50 ms
|
|
11
|
-
histogram[3] = 40; // <= 100 ms
|
|
12
|
-
histogram[6] = 9; // <= 500 ms
|
|
13
|
-
histogram[10] = 1; // <= 2500 ms
|
|
14
|
-
|
|
15
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
|
|
16
|
-
upperBoundMs: 50,
|
|
17
|
-
open: false,
|
|
18
|
-
});
|
|
19
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
|
|
20
|
-
upperBoundMs: 500,
|
|
21
|
-
open: false,
|
|
22
|
-
});
|
|
23
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
|
|
24
|
-
upperBoundMs: 500,
|
|
25
|
-
open: false,
|
|
26
|
-
});
|
|
27
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 1)).toEqual({
|
|
28
|
-
upperBoundMs: 2500,
|
|
29
|
-
open: false,
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('answers the last bound with open set when the percentile falls in the open bucket', () => {
|
|
34
|
-
const histogram = emptyHistogram();
|
|
35
|
-
histogram[0] = 90;
|
|
36
|
-
histogram[DURATION_HISTOGRAM_BOUNDS_MS.length] = 10;
|
|
37
|
-
|
|
38
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
|
|
39
|
-
upperBoundMs: 10,
|
|
40
|
-
open: false,
|
|
41
|
-
});
|
|
42
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
|
|
43
|
-
upperBoundMs: 30_000,
|
|
44
|
-
open: true,
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('answers null for an empty histogram', () => {
|
|
49
|
-
expect(percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toBeNull();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('answers the bucket of a single run for every quantile', () => {
|
|
53
|
-
const histogram = emptyHistogram();
|
|
54
|
-
histogram[4] = 1;
|
|
55
|
-
|
|
56
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
|
|
57
|
-
upperBoundMs: 200,
|
|
58
|
-
open: false,
|
|
59
|
-
});
|
|
60
|
-
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
|
|
61
|
-
upperBoundMs: 200,
|
|
62
|
-
open: false,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('rejects a histogram that does not match the bounds and a quantile out of range', () => {
|
|
67
|
-
expect(() => percentileOfHistogram([1, 2], DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toThrow();
|
|
68
|
-
expect(() =>
|
|
69
|
-
percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0),
|
|
70
|
-
).toThrow();
|
|
71
|
-
expect(() =>
|
|
72
|
-
percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 1.5),
|
|
73
|
-
).toThrow();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
1
|
+
import { DURATION_HISTOGRAM_BOUNDS_MS } from '../types';
|
|
2
|
+
import { percentileOfHistogram } from './percentiles';
|
|
3
|
+
|
|
4
|
+
const emptyHistogram = (): number[] =>
|
|
5
|
+
new Array<number>(DURATION_HISTOGRAM_BOUNDS_MS.length + 1).fill(0);
|
|
6
|
+
|
|
7
|
+
describe('percentileOfHistogram', () => {
|
|
8
|
+
it('reads p50, p95 and p99 at the upper bound of the bucket holding them', () => {
|
|
9
|
+
const histogram = emptyHistogram();
|
|
10
|
+
histogram[2] = 50; // <= 50 ms
|
|
11
|
+
histogram[3] = 40; // <= 100 ms
|
|
12
|
+
histogram[6] = 9; // <= 500 ms
|
|
13
|
+
histogram[10] = 1; // <= 2500 ms
|
|
14
|
+
|
|
15
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
|
|
16
|
+
upperBoundMs: 50,
|
|
17
|
+
open: false,
|
|
18
|
+
});
|
|
19
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
|
|
20
|
+
upperBoundMs: 500,
|
|
21
|
+
open: false,
|
|
22
|
+
});
|
|
23
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
|
|
24
|
+
upperBoundMs: 500,
|
|
25
|
+
open: false,
|
|
26
|
+
});
|
|
27
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 1)).toEqual({
|
|
28
|
+
upperBoundMs: 2500,
|
|
29
|
+
open: false,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('answers the last bound with open set when the percentile falls in the open bucket', () => {
|
|
34
|
+
const histogram = emptyHistogram();
|
|
35
|
+
histogram[0] = 90;
|
|
36
|
+
histogram[DURATION_HISTOGRAM_BOUNDS_MS.length] = 10;
|
|
37
|
+
|
|
38
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
|
|
39
|
+
upperBoundMs: 10,
|
|
40
|
+
open: false,
|
|
41
|
+
});
|
|
42
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toEqual({
|
|
43
|
+
upperBoundMs: 30_000,
|
|
44
|
+
open: true,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('answers null for an empty histogram', () => {
|
|
49
|
+
expect(percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0.95)).toBeNull();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('answers the bucket of a single run for every quantile', () => {
|
|
53
|
+
const histogram = emptyHistogram();
|
|
54
|
+
histogram[4] = 1;
|
|
55
|
+
|
|
56
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toEqual({
|
|
57
|
+
upperBoundMs: 200,
|
|
58
|
+
open: false,
|
|
59
|
+
});
|
|
60
|
+
expect(percentileOfHistogram(histogram, DURATION_HISTOGRAM_BOUNDS_MS, 0.99)).toEqual({
|
|
61
|
+
upperBoundMs: 200,
|
|
62
|
+
open: false,
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('rejects a histogram that does not match the bounds and a quantile out of range', () => {
|
|
67
|
+
expect(() => percentileOfHistogram([1, 2], DURATION_HISTOGRAM_BOUNDS_MS, 0.5)).toThrow();
|
|
68
|
+
expect(() =>
|
|
69
|
+
percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 0),
|
|
70
|
+
).toThrow();
|
|
71
|
+
expect(() =>
|
|
72
|
+
percentileOfHistogram(emptyHistogram(), DURATION_HISTOGRAM_BOUNDS_MS, 1.5),
|
|
73
|
+
).toThrow();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { IReflexDurationPercentile } from '../types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reads a percentile on a duration histogram: the upper bound of the bucket holding the `q` quantile (the
|
|
5
|
-
* smallest bucket whose cumulative count reaches `ceil(q * total)`). The histogram has one bucket per bound plus
|
|
6
|
-
* an open one; a percentile in the open bucket answers the last bound with `open` true. Null when the histogram
|
|
7
|
-
* holds no run: the denominator is its own sum, never the number of runs.
|
|
8
|
-
*/
|
|
9
|
-
export const percentileOfHistogram = (
|
|
10
|
-
histogram: readonly number[],
|
|
11
|
-
bounds: readonly number[],
|
|
12
|
-
q: number,
|
|
13
|
-
): IReflexDurationPercentile | null => {
|
|
14
|
-
if (bounds.length === 0 || histogram.length !== bounds.length + 1) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`A histogram needs one bucket per bound plus an open one: got ${histogram.length} buckets for ${bounds.length} bounds`,
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
if (!(q > 0 && q <= 1)) {
|
|
20
|
-
throw new Error(`A quantile is in ]0, 1]: got ${q}`);
|
|
21
|
-
}
|
|
22
|
-
const total = histogram.reduce((sum, count) => sum + count, 0);
|
|
23
|
-
if (total === 0) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const rank = Math.max(1, Math.ceil(q * total));
|
|
27
|
-
let cumulative = 0;
|
|
28
|
-
for (let index = 0; index < histogram.length; index += 1) {
|
|
29
|
-
cumulative += histogram[index];
|
|
30
|
-
if (cumulative >= rank) {
|
|
31
|
-
return index < bounds.length
|
|
32
|
-
? { upperBoundMs: bounds[index], open: false }
|
|
33
|
-
: { upperBoundMs: bounds[bounds.length - 1], open: true };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return { upperBoundMs: bounds[bounds.length - 1], open: true };
|
|
37
|
-
};
|
|
1
|
+
import type { IReflexDurationPercentile } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reads a percentile on a duration histogram: the upper bound of the bucket holding the `q` quantile (the
|
|
5
|
+
* smallest bucket whose cumulative count reaches `ceil(q * total)`). The histogram has one bucket per bound plus
|
|
6
|
+
* an open one; a percentile in the open bucket answers the last bound with `open` true. Null when the histogram
|
|
7
|
+
* holds no run: the denominator is its own sum, never the number of runs.
|
|
8
|
+
*/
|
|
9
|
+
export const percentileOfHistogram = (
|
|
10
|
+
histogram: readonly number[],
|
|
11
|
+
bounds: readonly number[],
|
|
12
|
+
q: number,
|
|
13
|
+
): IReflexDurationPercentile | null => {
|
|
14
|
+
if (bounds.length === 0 || histogram.length !== bounds.length + 1) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
`A histogram needs one bucket per bound plus an open one: got ${histogram.length} buckets for ${bounds.length} bounds`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
if (!(q > 0 && q <= 1)) {
|
|
20
|
+
throw new Error(`A quantile is in ]0, 1]: got ${q}`);
|
|
21
|
+
}
|
|
22
|
+
const total = histogram.reduce((sum, count) => sum + count, 0);
|
|
23
|
+
if (total === 0) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const rank = Math.max(1, Math.ceil(q * total));
|
|
27
|
+
let cumulative = 0;
|
|
28
|
+
for (let index = 0; index < histogram.length; index += 1) {
|
|
29
|
+
cumulative += histogram[index];
|
|
30
|
+
if (cumulative >= rank) {
|
|
31
|
+
return index < bounds.length
|
|
32
|
+
? { upperBoundMs: bounds[index], open: false }
|
|
33
|
+
: { upperBoundMs: bounds[bounds.length - 1], open: true };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { upperBoundMs: bounds[bounds.length - 1], open: true };
|
|
37
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State of an access granted to a function.
|
|
3
|
-
* - ACTIVE: the grantor still holds the right the access needs.
|
|
4
|
-
* - SUSPENDED: a publication found the grantor without that right. Publishing is refused
|
|
5
|
-
* (`GRANT_SUSPENDED`) until the access is revoked and granted again; what is already promoted keeps running.
|
|
6
|
-
* - REVOKED: withdrawn on purpose; the row stays as the journal.
|
|
7
|
-
*/
|
|
8
|
-
export enum AccessGrantStatus {
|
|
9
|
-
ACTIVE = 'ACTIVE',
|
|
10
|
-
SUSPENDED = 'SUSPENDED',
|
|
11
|
-
REVOKED = 'REVOKED',
|
|
12
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* State of an access granted to a function.
|
|
3
|
+
* - ACTIVE: the grantor still holds the right the access needs.
|
|
4
|
+
* - SUSPENDED: a publication found the grantor without that right. Publishing is refused
|
|
5
|
+
* (`GRANT_SUSPENDED`) until the access is revoked and granted again; what is already promoted keeps running.
|
|
6
|
+
* - REVOKED: withdrawn on purpose; the row stays as the journal.
|
|
7
|
+
*/
|
|
8
|
+
export enum AccessGrantStatus {
|
|
9
|
+
ACTIVE = 'ACTIVE',
|
|
10
|
+
SUSPENDED = 'SUSPENDED',
|
|
11
|
+
REVOKED = 'REVOKED',
|
|
12
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** The kinds of access a definition declares and a member grants (the format of @abyss-project/runtime). */
|
|
2
|
-
export enum ReflexAccessKind {
|
|
3
|
-
/** Outbound HTTP to a list of host names (exact, or `*.domain` for any sub-domain). */
|
|
4
|
-
HTTP = 'HTTP',
|
|
5
|
-
/** One action of the host catalog (`store.get`, `store.set`, `store.increment`, `secret.get`, `http.respond`). */
|
|
6
|
-
HOST_ACTION = 'HOST_ACTION',
|
|
7
|
-
}
|
|
1
|
+
/** The kinds of access a definition declares and a member grants (the format of @abyss-project/runtime). */
|
|
2
|
+
export enum ReflexAccessKind {
|
|
3
|
+
/** Outbound HTTP to a list of host names (exact, or `*.domain` for any sub-domain). */
|
|
4
|
+
HTTP = 'HTTP',
|
|
5
|
+
/** One action of the host catalog (`store.get`, `store.set`, `store.increment`, `secret.get`, `http.respond`). */
|
|
6
|
+
HOST_ACTION = 'HOST_ACTION',
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State of a request to grant an access a function declares.
|
|
3
|
-
* - PENDING: waiting for a member who holds the right the access needs.
|
|
4
|
-
* - GRANTED: the access was granted (by the request or by another gesture).
|
|
5
|
-
* - DISMISSED: set aside by a member with the right, or because the draft no longer declares the access.
|
|
6
|
-
*/
|
|
7
|
-
export enum AccessRequestStatus {
|
|
8
|
-
PENDING = 'PENDING',
|
|
9
|
-
GRANTED = 'GRANTED',
|
|
10
|
-
DISMISSED = 'DISMISSED',
|
|
11
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* State of a request to grant an access a function declares.
|
|
3
|
+
* - PENDING: waiting for a member who holds the right the access needs.
|
|
4
|
+
* - GRANTED: the access was granted (by the request or by another gesture).
|
|
5
|
+
* - DISMISSED: set aside by a member with the right, or because the draft no longer declares the access.
|
|
6
|
+
*/
|
|
7
|
+
export enum AccessRequestStatus {
|
|
8
|
+
PENDING = 'PENDING',
|
|
9
|
+
GRANTED = 'GRANTED',
|
|
10
|
+
DISMISSED = 'DISMISSED',
|
|
11
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** Why the events of a bot are rejected at the Gateway. */
|
|
2
|
-
export enum BotEventBlockReason {
|
|
3
|
-
/** The monthly spend cap of the bot is reached. */
|
|
4
|
-
MONTHLY_CAP = 'MONTHLY_CAP',
|
|
5
|
-
/** The credits of the organization are spent and the bot has no overage. */
|
|
6
|
-
CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
|
|
7
|
-
}
|
|
1
|
+
/** Why the events of a bot are rejected at the Gateway. */
|
|
2
|
+
export enum BotEventBlockReason {
|
|
3
|
+
/** The monthly spend cap of the bot is reached. */
|
|
4
|
+
MONTHLY_CAP = 'MONTHLY_CAP',
|
|
5
|
+
/** The credits of the organization are spent and the bot has no overage. */
|
|
6
|
+
CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
|
|
7
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/** Where the completion webhook of an async execution stands. */
|
|
2
|
-
export enum CompletionDeliveryStatus {
|
|
3
|
-
/** Not sent yet, or waiting for its next attempt. */
|
|
4
|
-
PENDING = 'PENDING',
|
|
5
|
-
/** The receiver answered 2xx. */
|
|
6
|
-
DELIVERED = 'DELIVERED',
|
|
7
|
-
/** Given up: every attempt failed, or the receiver answered a status that is not retried. */
|
|
8
|
-
FAILED = 'FAILED',
|
|
9
|
-
}
|
|
1
|
+
/** Where the completion webhook of an async execution stands. */
|
|
2
|
+
export enum CompletionDeliveryStatus {
|
|
3
|
+
/** Not sent yet, or waiting for its next attempt. */
|
|
4
|
+
PENDING = 'PENDING',
|
|
5
|
+
/** The receiver answered 2xx. */
|
|
6
|
+
DELIVERED = 'DELIVERED',
|
|
7
|
+
/** Given up: every attempt failed, or the receiver answered a status that is not retried. */
|
|
8
|
+
FAILED = 'FAILED',
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** How a function reads a vault key: `config.NAME` (a VISIBLE entry) or `secrets.NAME` (a SECRET entry). */
|
|
2
|
-
export enum ConfigurationReadAs {
|
|
3
|
-
CONFIG = 'config',
|
|
4
|
-
SECRETS = 'secrets',
|
|
5
|
-
}
|
|
1
|
+
/** How a function reads a vault key: `config.NAME` (a VISIBLE entry) or `secrets.NAME` (a SECRET entry). */
|
|
2
|
+
export enum ConfigurationReadAs {
|
|
3
|
+
CONFIG = 'config',
|
|
4
|
+
SECRETS = 'secrets',
|
|
5
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/** What the activity of a Discord bot says it does ("Playing", "Listening to", "Watching", "Competing in", or a free text). */
|
|
2
|
-
export enum DiscordActivityType {
|
|
3
|
-
PLAYING = 'PLAYING',
|
|
4
|
-
LISTENING = 'LISTENING',
|
|
5
|
-
WATCHING = 'WATCHING',
|
|
6
|
-
COMPETING = 'COMPETING',
|
|
7
|
-
/** The text alone, shown as it is written. */
|
|
8
|
-
CUSTOM = 'CUSTOM',
|
|
9
|
-
}
|
|
1
|
+
/** What the activity of a Discord bot says it does ("Playing", "Listening to", "Watching", "Competing in", or a free text). */
|
|
2
|
+
export enum DiscordActivityType {
|
|
3
|
+
PLAYING = 'PLAYING',
|
|
4
|
+
LISTENING = 'LISTENING',
|
|
5
|
+
WATCHING = 'WATCHING',
|
|
6
|
+
COMPETING = 'COMPETING',
|
|
7
|
+
/** The text alone, shown as it is written. */
|
|
8
|
+
CUSTOM = 'CUSTOM',
|
|
9
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type of a Discord channel a CHANNEL option may be limited to (Discord's names; the API sends their
|
|
3
|
-
* numbers). Same set as the runtime's `DiscordChannelType`, which a parity test keeps equal.
|
|
4
|
-
*/
|
|
5
|
-
export enum DiscordChannelType {
|
|
6
|
-
TEXT = 'TEXT',
|
|
7
|
-
VOICE = 'VOICE',
|
|
8
|
-
CATEGORY = 'CATEGORY',
|
|
9
|
-
ANNOUNCEMENT = 'ANNOUNCEMENT',
|
|
10
|
-
FORUM = 'FORUM',
|
|
11
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Type of a Discord channel a CHANNEL option may be limited to (Discord's names; the API sends their
|
|
3
|
+
* numbers). Same set as the runtime's `DiscordChannelType`, which a parity test keeps equal.
|
|
4
|
+
*/
|
|
5
|
+
export enum DiscordChannelType {
|
|
6
|
+
TEXT = 'TEXT',
|
|
7
|
+
VOICE = 'VOICE',
|
|
8
|
+
CATEGORY = 'CATEGORY',
|
|
9
|
+
ANNOUNCEMENT = 'ANNOUNCEMENT',
|
|
10
|
+
FORUM = 'FORUM',
|
|
11
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** What a component prefix of a Discord bot routes. */
|
|
2
|
-
export enum DiscordComponentKind {
|
|
3
|
-
/** A button or a select menu: interactions of type MESSAGE_COMPONENT. */
|
|
4
|
-
BUTTON_OR_SELECT = 'BUTTON_OR_SELECT',
|
|
5
|
-
/** A form: interactions of type MODAL_SUBMIT. */
|
|
6
|
-
MODAL = 'MODAL',
|
|
7
|
-
}
|
|
1
|
+
/** What a component prefix of a Discord bot routes. */
|
|
2
|
+
export enum DiscordComponentKind {
|
|
3
|
+
/** A button or a select menu: interactions of type MESSAGE_COMPONENT. */
|
|
4
|
+
BUTTON_OR_SELECT = 'BUTTON_OR_SELECT',
|
|
5
|
+
/** A form: interactions of type MODAL_SUBMIT. */
|
|
6
|
+
MODAL = 'MODAL',
|
|
7
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/** Why a Discord event the Gateway received was not kept for execution. */
|
|
2
|
-
export enum DiscordEventDropReason {
|
|
3
|
-
/** A filter of the trigger rejected it (see `DiscordEventFilterName`). */
|
|
4
|
-
FILTERED = 'FILTERED',
|
|
5
|
-
/** The bot went past its events per minute. */
|
|
6
|
-
RATE = 'RATE',
|
|
7
|
-
/** The monthly spend cap of the bot is reached. */
|
|
8
|
-
MONTHLY_CAP = 'MONTHLY_CAP',
|
|
9
|
-
/** The credits of the organization are spent and the bot has no overage. */
|
|
10
|
-
CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
|
|
11
|
-
/** It waited in the inbox past the tolerance. */
|
|
12
|
-
EXPIRED = 'EXPIRED',
|
|
13
|
-
}
|
|
1
|
+
/** Why a Discord event the Gateway received was not kept for execution. */
|
|
2
|
+
export enum DiscordEventDropReason {
|
|
3
|
+
/** A filter of the trigger rejected it (see `DiscordEventFilterName`). */
|
|
4
|
+
FILTERED = 'FILTERED',
|
|
5
|
+
/** The bot went past its events per minute. */
|
|
6
|
+
RATE = 'RATE',
|
|
7
|
+
/** The monthly spend cap of the bot is reached. */
|
|
8
|
+
MONTHLY_CAP = 'MONTHLY_CAP',
|
|
9
|
+
/** The credits of the organization are spent and the bot has no overage. */
|
|
10
|
+
CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
|
|
11
|
+
/** It waited in the inbox past the tolerance. */
|
|
12
|
+
EXPIRED = 'EXPIRED',
|
|
13
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/** A filter of a Discord event trigger; the value is its key in `IReflexDiscordEventFilters` (and the name reported when it rejects an event), except `guildOnly`. */
|
|
2
|
-
export enum DiscordEventFilterName {
|
|
3
|
-
GUILD_IDS = 'guildIds',
|
|
4
|
-
CHANNEL_IDS = 'channelIds',
|
|
5
|
-
ROLE_IDS = 'roleIds',
|
|
6
|
-
CONTENT_PREFIX = 'contentPrefix',
|
|
7
|
-
IGNORE_BOTS = 'ignoreBots',
|
|
8
|
-
IGNORE_SELF = 'ignoreSelf',
|
|
9
|
-
/** Not a setting: events outside a server (direct messages) are always ignored. */
|
|
10
|
-
GUILD_ONLY = 'guildOnly',
|
|
11
|
-
}
|
|
1
|
+
/** A filter of a Discord event trigger; the value is its key in `IReflexDiscordEventFilters` (and the name reported when it rejects an event), except `guildOnly`. */
|
|
2
|
+
export enum DiscordEventFilterName {
|
|
3
|
+
GUILD_IDS = 'guildIds',
|
|
4
|
+
CHANNEL_IDS = 'channelIds',
|
|
5
|
+
ROLE_IDS = 'roleIds',
|
|
6
|
+
CONTENT_PREFIX = 'contentPrefix',
|
|
7
|
+
IGNORE_BOTS = 'ignoreBots',
|
|
8
|
+
IGNORE_SELF = 'ignoreSelf',
|
|
9
|
+
/** Not a setting: events outside a server (direct messages) are always ignored. */
|
|
10
|
+
GUILD_ONLY = 'guildOnly',
|
|
11
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/** Where a retained Discord event is in the inbox of the execution plane. */
|
|
2
|
-
export enum DiscordEventStatus {
|
|
3
|
-
/** Waiting to be taken by an edge. */
|
|
4
|
-
PENDING = 'PENDING',
|
|
5
|
-
/** Taken by an edge, running. */
|
|
6
|
-
CLAIMED = 'CLAIMED',
|
|
7
|
-
/** The function ran to its end. */
|
|
8
|
-
DONE = 'DONE',
|
|
9
|
-
/** The function failed, or the trigger left the version in service: never retried. */
|
|
10
|
-
FAILED = 'FAILED',
|
|
11
|
-
/** Not taken within the tolerance: never run, never billed. */
|
|
12
|
-
EXPIRED = 'EXPIRED',
|
|
13
|
-
}
|
|
1
|
+
/** Where a retained Discord event is in the inbox of the execution plane. */
|
|
2
|
+
export enum DiscordEventStatus {
|
|
3
|
+
/** Waiting to be taken by an edge. */
|
|
4
|
+
PENDING = 'PENDING',
|
|
5
|
+
/** Taken by an edge, running. */
|
|
6
|
+
CLAIMED = 'CLAIMED',
|
|
7
|
+
/** The function ran to its end. */
|
|
8
|
+
DONE = 'DONE',
|
|
9
|
+
/** The function failed, or the trigger left the version in service: never retried. */
|
|
10
|
+
FAILED = 'FAILED',
|
|
11
|
+
/** Not taken within the tolerance: never run, never billed. */
|
|
12
|
+
EXPIRED = 'EXPIRED',
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** A Discord Gateway event a function of a bot Service can be triggered by. */
|
|
2
|
-
export enum DiscordEventType {
|
|
3
|
-
GUILD_MEMBER_ADD = 'GUILD_MEMBER_ADD',
|
|
4
|
-
GUILD_MEMBER_REMOVE = 'GUILD_MEMBER_REMOVE',
|
|
5
|
-
MESSAGE_CREATE = 'MESSAGE_CREATE',
|
|
6
|
-
MESSAGE_REACTION_ADD = 'MESSAGE_REACTION_ADD',
|
|
7
|
-
}
|
|
1
|
+
/** A Discord Gateway event a function of a bot Service can be triggered by. */
|
|
2
|
+
export enum DiscordEventType {
|
|
3
|
+
GUILD_MEMBER_ADD = 'GUILD_MEMBER_ADD',
|
|
4
|
+
GUILD_MEMBER_REMOVE = 'GUILD_MEMBER_REMOVE',
|
|
5
|
+
MESSAGE_CREATE = 'MESSAGE_CREATE',
|
|
6
|
+
MESSAGE_REACTION_ADD = 'MESSAGE_REACTION_ADD',
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/** Why a Gateway connection is `FAILED`. */
|
|
2
|
-
export enum DiscordGatewayFailureCode {
|
|
3
|
-
/** Discord rejected the token (close code 4004). */
|
|
4
|
-
TOKEN_REJECTED = 'TOKEN_REJECTED',
|
|
5
|
-
/** The bot spent its identifications of the UTC day. */
|
|
6
|
-
IDENTIFY_BUDGET = 'IDENTIFY_BUDGET',
|
|
7
|
-
/** Discord refused the connection (close codes 4010 to 4013: invalid shard, sharding required, invalid API version, invalid intents). */
|
|
8
|
-
DISCORD_REFUSED = 'DISCORD_REFUSED',
|
|
9
|
-
/** Discord refused the intents the version in service asks for (close code 4014): a privileged intent is not enabled in the Discord portal. */
|
|
10
|
-
INTENTS_DISALLOWED = 'INTENTS_DISALLOWED',
|
|
11
|
-
}
|
|
1
|
+
/** Why a Gateway connection is `FAILED`. */
|
|
2
|
+
export enum DiscordGatewayFailureCode {
|
|
3
|
+
/** Discord rejected the token (close code 4004). */
|
|
4
|
+
TOKEN_REJECTED = 'TOKEN_REJECTED',
|
|
5
|
+
/** The bot spent its identifications of the UTC day. */
|
|
6
|
+
IDENTIFY_BUDGET = 'IDENTIFY_BUDGET',
|
|
7
|
+
/** Discord refused the connection (close codes 4010 to 4013: invalid shard, sharding required, invalid API version, invalid intents). */
|
|
8
|
+
DISCORD_REFUSED = 'DISCORD_REFUSED',
|
|
9
|
+
/** Discord refused the intents the version in service asks for (close code 4014): a privileged intent is not enabled in the Discord portal. */
|
|
10
|
+
INTENTS_DISALLOWED = 'INTENTS_DISALLOWED',
|
|
11
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/** The state of the Gateway connection that keeps a Discord bot online in one environment. */
|
|
2
|
-
export enum DiscordGatewayState {
|
|
3
|
-
/** Connecting, identifying or resuming. */
|
|
4
|
-
CONNECTING = 'CONNECTING',
|
|
5
|
-
/** Connected: the bot is online. */
|
|
6
|
-
CONNECTED = 'CONNECTED',
|
|
7
|
-
/** No connection: the bot is paused or out of service, or the connection is between two owners. */
|
|
8
|
-
DISCONNECTED = 'DISCONNECTED',
|
|
9
|
-
/** The connection cannot be kept; `DiscordGatewayFailureCode` says why. */
|
|
10
|
-
FAILED = 'FAILED',
|
|
11
|
-
}
|
|
1
|
+
/** The state of the Gateway connection that keeps a Discord bot online in one environment. */
|
|
2
|
+
export enum DiscordGatewayState {
|
|
3
|
+
/** Connecting, identifying or resuming. */
|
|
4
|
+
CONNECTING = 'CONNECTING',
|
|
5
|
+
/** Connected: the bot is online. */
|
|
6
|
+
CONNECTED = 'CONNECTED',
|
|
7
|
+
/** No connection: the bot is paused or out of service, or the connection is between two owners. */
|
|
8
|
+
DISCONNECTED = 'DISCONNECTED',
|
|
9
|
+
/** The connection cannot be kept; `DiscordGatewayFailureCode` says why. */
|
|
10
|
+
FAILED = 'FAILED',
|
|
11
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `discord.*` actions a function of a Discord bot Service can declare in its accesses. Same values
|
|
3
|
-
* as the runtime's `DiscordCapability`, which a parity test keeps equal: the Access screen lists them all.
|
|
4
|
-
*/
|
|
5
|
-
export enum DiscordHostAction {
|
|
6
|
-
REPLY = 'discord.reply',
|
|
7
|
-
UPDATE = 'discord.update',
|
|
8
|
-
SHOW_MODAL = 'discord.showModal',
|
|
9
|
-
FOLLOW_UP = 'discord.followUp',
|
|
10
|
-
SEND_MESSAGE = 'discord.sendMessage',
|
|
11
|
-
EDIT_MESSAGE = 'discord.editMessage',
|
|
12
|
-
DELETE_MESSAGE = 'discord.deleteMessage',
|
|
13
|
-
ADD_ROLE = 'discord.addRole',
|
|
14
|
-
REMOVE_ROLE = 'discord.removeRole',
|
|
15
|
-
SEND_DIRECT_MESSAGE = 'discord.sendDirectMessage',
|
|
16
|
-
GET_MEMBER = 'discord.getMember',
|
|
17
|
-
GET_GUILD_ROLES = 'discord.getGuildRoles',
|
|
18
|
-
GET_CHANNEL = 'discord.getChannel',
|
|
19
|
-
GET_GUILD = 'discord.getGuild',
|
|
20
|
-
KICK_MEMBER = 'discord.kickMember',
|
|
21
|
-
BAN_MEMBER = 'discord.banMember',
|
|
22
|
-
UNBAN_MEMBER = 'discord.unbanMember',
|
|
23
|
-
TIMEOUT_MEMBER = 'discord.timeoutMember',
|
|
24
|
-
BULK_DELETE_MESSAGES = 'discord.bulkDeleteMessages',
|
|
25
|
-
ADD_REACTION = 'discord.addReaction',
|
|
26
|
-
REMOVE_REACTION = 'discord.removeReaction',
|
|
27
|
-
CREATE_CHANNEL = 'discord.createChannel',
|
|
28
|
-
DELETE_CHANNEL = 'discord.deleteChannel',
|
|
29
|
-
SET_CHANNEL_PERMISSION = 'discord.setChannelPermission',
|
|
30
|
-
REMOVE_CHANNEL_PERMISSION = 'discord.removeChannelPermission',
|
|
31
|
-
CREATE_ROLE = 'discord.createRole',
|
|
32
|
-
DELETE_ROLE = 'discord.deleteRole',
|
|
33
|
-
CREATE_THREAD = 'discord.createThread',
|
|
34
|
-
END_POLL = 'discord.endPoll',
|
|
35
|
-
AUTOCOMPLETE = 'discord.autocomplete',
|
|
36
|
-
READ_ATTACHMENT = 'discord.readAttachment',
|
|
37
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* The `discord.*` actions a function of a Discord bot Service can declare in its accesses. Same values
|
|
3
|
+
* as the runtime's `DiscordCapability`, which a parity test keeps equal: the Access screen lists them all.
|
|
4
|
+
*/
|
|
5
|
+
export enum DiscordHostAction {
|
|
6
|
+
REPLY = 'discord.reply',
|
|
7
|
+
UPDATE = 'discord.update',
|
|
8
|
+
SHOW_MODAL = 'discord.showModal',
|
|
9
|
+
FOLLOW_UP = 'discord.followUp',
|
|
10
|
+
SEND_MESSAGE = 'discord.sendMessage',
|
|
11
|
+
EDIT_MESSAGE = 'discord.editMessage',
|
|
12
|
+
DELETE_MESSAGE = 'discord.deleteMessage',
|
|
13
|
+
ADD_ROLE = 'discord.addRole',
|
|
14
|
+
REMOVE_ROLE = 'discord.removeRole',
|
|
15
|
+
SEND_DIRECT_MESSAGE = 'discord.sendDirectMessage',
|
|
16
|
+
GET_MEMBER = 'discord.getMember',
|
|
17
|
+
GET_GUILD_ROLES = 'discord.getGuildRoles',
|
|
18
|
+
GET_CHANNEL = 'discord.getChannel',
|
|
19
|
+
GET_GUILD = 'discord.getGuild',
|
|
20
|
+
KICK_MEMBER = 'discord.kickMember',
|
|
21
|
+
BAN_MEMBER = 'discord.banMember',
|
|
22
|
+
UNBAN_MEMBER = 'discord.unbanMember',
|
|
23
|
+
TIMEOUT_MEMBER = 'discord.timeoutMember',
|
|
24
|
+
BULK_DELETE_MESSAGES = 'discord.bulkDeleteMessages',
|
|
25
|
+
ADD_REACTION = 'discord.addReaction',
|
|
26
|
+
REMOVE_REACTION = 'discord.removeReaction',
|
|
27
|
+
CREATE_CHANNEL = 'discord.createChannel',
|
|
28
|
+
DELETE_CHANNEL = 'discord.deleteChannel',
|
|
29
|
+
SET_CHANNEL_PERMISSION = 'discord.setChannelPermission',
|
|
30
|
+
REMOVE_CHANNEL_PERMISSION = 'discord.removeChannelPermission',
|
|
31
|
+
CREATE_ROLE = 'discord.createRole',
|
|
32
|
+
DELETE_ROLE = 'discord.deleteRole',
|
|
33
|
+
CREATE_THREAD = 'discord.createThread',
|
|
34
|
+
END_POLL = 'discord.endPoll',
|
|
35
|
+
AUTOCOMPLETE = 'discord.autocomplete',
|
|
36
|
+
READ_ATTACHMENT = 'discord.readAttachment',
|
|
37
|
+
}
|