@abyss-project/reflex 6.3.0 → 6.4.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.
Files changed (133) hide show
  1. package/.eslintrc.js +32 -32
  2. package/README.md +15 -15
  3. package/dist/api/function-run.api.d.ts +2 -1
  4. package/dist/api/function-run.api.js +3 -1
  5. package/dist/api/function-run.api.js.map +1 -1
  6. package/dist/api/function-settings.api.d.ts +3 -1
  7. package/dist/api/function-settings.api.js +7 -1
  8. package/dist/api/function-settings.api.js.map +1 -1
  9. package/dist/api/index.d.ts +1 -0
  10. package/dist/api/index.js +1 -0
  11. package/dist/api/index.js.map +1 -1
  12. package/dist/api/storage-surplus.admin.api.d.ts +5 -0
  13. package/dist/api/storage-surplus.admin.api.js +17 -0
  14. package/dist/api/storage-surplus.admin.api.js.map +1 -0
  15. package/dist/index.d.ts +16 -0
  16. package/dist/index.js +19 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/types/enum/reflex-error-code.enum.d.ts +4 -1
  19. package/dist/types/enum/reflex-error-code.enum.js +3 -0
  20. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  21. package/dist/types/interface/api/requests/application-run-settings.request.d.ts +1 -0
  22. package/dist/types/interface/api/requests/function-run.request.d.ts +8 -0
  23. package/dist/types/interface/api/requests/function-settings.request.d.ts +12 -0
  24. package/dist/types/interface/api/requests/index.d.ts +1 -0
  25. package/dist/types/interface/api/requests/index.js +1 -0
  26. package/dist/types/interface/api/requests/index.js.map +1 -1
  27. package/dist/types/interface/api/requests/service.request.d.ts +1 -0
  28. package/dist/types/interface/api/requests/storage-surplus.admin.request.d.ts +8 -0
  29. package/dist/types/interface/api/requests/storage-surplus.admin.request.js +3 -0
  30. package/dist/types/interface/api/requests/storage-surplus.admin.request.js.map +1 -0
  31. package/dist/types/interface/api/responses/function-run.response.d.ts +4 -0
  32. package/dist/types/interface/api/responses/function-settings.response.d.ts +5 -1
  33. package/dist/types/interface/api/responses/index.d.ts +1 -0
  34. package/dist/types/interface/api/responses/index.js +1 -0
  35. package/dist/types/interface/api/responses/index.js.map +1 -1
  36. package/dist/types/interface/api/responses/storage-surplus.admin.response.d.ts +8 -0
  37. package/dist/types/interface/api/responses/storage-surplus.admin.response.js +3 -0
  38. package/dist/types/interface/api/responses/storage-surplus.admin.response.js.map +1 -0
  39. package/dist/types/interface/models/index.d.ts +2 -0
  40. package/dist/types/interface/models/index.js +2 -0
  41. package/dist/types/interface/models/index.js.map +1 -1
  42. package/dist/types/interface/models/reflex-run-retention.model.d.ts +13 -0
  43. package/dist/types/interface/models/reflex-run-retention.model.js +8 -0
  44. package/dist/types/interface/models/reflex-run-retention.model.js.map +1 -0
  45. package/dist/types/interface/models/reflex-run-settings.model.d.ts +4 -0
  46. package/dist/types/interface/models/reflex-run.model.d.ts +5 -0
  47. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +2 -2
  48. package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
  49. package/dist/types/interface/models/reflex-storage-surplus.model.d.ts +11 -0
  50. package/dist/types/interface/models/reflex-storage-surplus.model.js +3 -0
  51. package/dist/types/interface/models/reflex-storage-surplus.model.js.map +1 -0
  52. package/jest.config.ts +11 -11
  53. package/package.json +1 -1
  54. package/src/api/alert-rule.api.test.ts +72 -72
  55. package/src/api/alert-rule.api.ts +57 -57
  56. package/src/api/application-insights.api.test.ts +42 -42
  57. package/src/api/application-insights.api.ts +38 -38
  58. package/src/api/application-run-settings.api.test.ts +11 -0
  59. package/src/api/application-run-settings.api.ts +30 -30
  60. package/src/api/function-access.api.ts +87 -87
  61. package/src/api/function-insights.api.test.ts +27 -27
  62. package/src/api/function-insights.api.ts +18 -18
  63. package/src/api/function-run.api.ts +15 -0
  64. package/src/api/function-settings.api.ts +22 -0
  65. package/src/api/function-template.api.test.ts +72 -72
  66. package/src/api/function-template.api.ts +52 -52
  67. package/src/api/function-test.api.ts +34 -34
  68. package/src/api/function-version.api.ts +66 -66
  69. package/src/api/function.api.test.ts +55 -0
  70. package/src/api/function.api.ts +62 -62
  71. package/src/api/health.api.ts +10 -10
  72. package/src/api/index.ts +27 -26
  73. package/src/api/route-stats.api.test.ts +45 -45
  74. package/src/api/route-stats.api.ts +36 -36
  75. package/src/api/service-completion-webhook.api.test.ts +97 -97
  76. package/src/api/service-completion-webhook.api.ts +39 -39
  77. package/src/api/service-configuration.api.ts +16 -16
  78. package/src/api/service-consumer.api.test.ts +104 -104
  79. package/src/api/service-consumer.api.ts +90 -90
  80. package/src/api/service-deployment.api.ts +79 -79
  81. package/src/api/service-discord-event.api.test.ts +106 -106
  82. package/src/api/service-discord-event.api.ts +78 -78
  83. package/src/api/service-discord.api.test.ts +178 -178
  84. package/src/api/service-discord.api.ts +222 -222
  85. package/src/api/service-insights.api.test.ts +36 -36
  86. package/src/api/service-insights.api.ts +42 -42
  87. package/src/api/service-limits.api.test.ts +100 -100
  88. package/src/api/service-limits.api.ts +37 -37
  89. package/src/api/service-openapi.api.test.ts +52 -52
  90. package/src/api/service-openapi.api.ts +21 -21
  91. package/src/api/service-route.api.ts +74 -74
  92. package/src/api/service-task.api.test.ts +140 -140
  93. package/src/api/service-task.api.ts +141 -141
  94. package/src/api/service-version.api.ts +54 -54
  95. package/src/api/service.api.test.ts +6 -1
  96. package/src/api/service.api.ts +55 -55
  97. package/src/api/storage-surplus.admin.api.test.ts +66 -0
  98. package/src/api/storage-surplus.admin.api.ts +45 -0
  99. package/src/discord/discord-event-filter-cases.ts +261 -261
  100. package/src/discord/discord-event-filters.test.ts +91 -91
  101. package/src/discord/discord-event-filters.ts +95 -95
  102. package/src/discord/discord-event-intents.test.ts +112 -112
  103. package/src/discord/discord-event-intents.ts +55 -55
  104. package/src/discord/index.ts +3 -3
  105. package/src/index.test.ts +104 -104
  106. package/src/index.ts +42 -0
  107. package/src/insights/index.ts +1 -1
  108. package/src/insights/percentiles.test.ts +75 -75
  109. package/src/insights/percentiles.ts +37 -37
  110. package/src/types/enum/discord-host-action.enum.ts +37 -37
  111. package/src/types/enum/reflex-error-code.enum.ts +16 -0
  112. package/src/types/interface/api/requests/application-run-settings.request.ts +2 -0
  113. package/src/types/interface/api/requests/function-run.request.ts +10 -0
  114. package/src/types/interface/api/requests/function-settings.request.ts +16 -0
  115. package/src/types/interface/api/requests/index.ts +1 -0
  116. package/src/types/interface/api/requests/service-discord.request.ts +155 -155
  117. package/src/types/interface/api/requests/service.request.ts +2 -0
  118. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -0
  119. package/src/types/interface/api/responses/function-run.response.ts +5 -0
  120. package/src/types/interface/api/responses/function-settings.response.ts +7 -0
  121. package/src/types/interface/api/responses/index.ts +1 -0
  122. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -0
  123. package/src/types/interface/models/index.ts +2 -0
  124. package/src/types/interface/models/reflex-discord.model.ts +208 -208
  125. package/src/types/interface/models/reflex-price-list.model.ts +22 -22
  126. package/src/types/interface/models/reflex-run-retention.model.ts +24 -0
  127. package/src/types/interface/models/reflex-run-settings.model.ts +11 -0
  128. package/src/types/interface/models/reflex-run.model.ts +10 -0
  129. package/src/types/interface/models/reflex-service-deployment.model.ts +4 -2
  130. package/src/types/interface/models/reflex-service.model.ts +2 -0
  131. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -0
  132. package/tsconfig.check.json +15 -15
  133. package/tsconfig.json +35 -35
@@ -1,208 +1,208 @@
1
- import type {
2
- DiscordActivityType,
3
- DiscordChannelType,
4
- DiscordComponentKind,
5
- DiscordLocale,
6
- DiscordGatewayFailureCode,
7
- DiscordGatewayState,
8
- DiscordOptionType,
9
- DiscordPresenceStatus,
10
- DiscordTokenState,
11
- } from '../../enum';
12
-
13
- /** Bounds of the commands and components of a Discord bot; the API and its database apply the same ones. */
14
- export const REFLEX_DISCORD_LIMITS = {
15
- /** `^[-_a-z0-9]{1,32}$`: the name typed after the slash. */
16
- commandNamePattern: /^[-_a-z0-9]{1,32}$/,
17
- /**
18
- * Discord's pattern of a translated command or option name: letters and digits of any script, `-`, `_` and
19
- * `'`, 1 to 32 characters. It must also be lower case where the script has one (see `isValidLocalizedName`).
20
- */
21
- localizedNamePattern: /^[-_'\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$/u,
22
- commandDescriptionMaxLength: 100,
23
- commandsPerServiceMax: 100,
24
- optionsPerCommandMax: 25,
25
- choicesPerOptionMax: 25,
26
- /** `^[a-z0-9_-]{1,40}$`: the start of the `custom_id` of a button, a menu or a form. */
27
- componentPrefixPattern: /^[a-z0-9_-]{1,40}$/,
28
- syncErrorMaxLength: 500,
29
- /** Bounds of `minLength` and `maxLength` of a STRING option (`maxLength` is 1 at least). */
30
- optionLengthMax: 6000,
31
- /** Length of the name of a choice, localized or not. */
32
- choiceNameMaxLength: 100,
33
- /** Largest file a bot receives or sends, per bot and environment (#915): the default, and the bound the setting may not pass. */
34
- attachmentMaxBytesDefault: 2 * 1024 * 1024,
35
- attachmentMaxBytesBound: 8 * 1024 * 1024,
36
- } as const;
37
-
38
- /** A translated command or option name Discord accepts: its pattern, and lower case where the script has one. */
39
- export const isValidLocalizedName = (name: string): boolean =>
40
- REFLEX_DISCORD_LIMITS.localizedNamePattern.test(name) && name === name.toLowerCase();
41
-
42
- /**
43
- * Translations of a name or a description, by Discord locale. A localized command or option name
44
- * passes `isValidLocalizedName`, a description 1 to 100 characters, a choice name 1 to 100.
45
- */
46
- export type ReflexDiscordLocalizations = Partial<Record<DiscordLocale, string>>;
47
-
48
- /** A fixed answer a user picks for a STRING, INTEGER or NUMBER option. */
49
- export interface IReflexDiscordOptionChoice {
50
- name: string;
51
- value: string | number;
52
- nameLocalizations?: ReflexDiscordLocalizations;
53
- }
54
-
55
- /**
56
- * An option of a command. Required options come first. A bound only exists on the types it applies
57
- * to: the API refuses it on another one.
58
- */
59
- export interface IReflexDiscordCommandOption {
60
- type: DiscordOptionType;
61
- /** Same pattern as the command name. */
62
- name: string;
63
- /** 1 to 100 characters. */
64
- description: string;
65
- required: boolean;
66
- /** 25 at most, only for STRING, INTEGER and NUMBER; within `minValue`/`maxValue` and `minLength`/`maxLength`. */
67
- choices?: IReflexDiscordOptionChoice[];
68
- /**
69
- * Discord asks the function for the choices while the user types. Only for STRING, INTEGER and NUMBER,
70
- * never together with `choices`. Absent means false.
71
- */
72
- autocomplete?: boolean;
73
- /** INTEGER and NUMBER: safe numbers, `minValue` <= `maxValue`. */
74
- minValue?: number;
75
- maxValue?: number;
76
- /** STRING: 0 to 6000 (`maxLength` 1 at least), `minLength` <= `maxLength`. */
77
- minLength?: number;
78
- maxLength?: number;
79
- /** CHANNEL: the channel types a user may pick, not empty, no duplicate. */
80
- channelTypes?: DiscordChannelType[];
81
- nameLocalizations?: ReflexDiscordLocalizations;
82
- descriptionLocalizations?: ReflexDiscordLocalizations;
83
- }
84
-
85
- /** A slash command of the draft of a Discord bot Service. */
86
- export interface IReflexDiscordCommand {
87
- id: string;
88
- serviceId: string;
89
- /** A function of the same Service. */
90
- functionId: string;
91
- /** Unique within the Service. */
92
- name: string;
93
- description: string;
94
- options: IReflexDiscordCommandOption[];
95
- /** Discord permission bits as a decimal string, or null for everyone. */
96
- defaultMemberPermissions: string | null;
97
- allowedInDirectMessages: boolean;
98
- /** Null without translations. */
99
- nameLocalizations: ReflexDiscordLocalizations | null;
100
- descriptionLocalizations: ReflexDiscordLocalizations | null;
101
- /**
102
- * Users may install the bot on their account and use the command outside the servers it is in (in
103
- * group messages too). It can then act on no server in the bot's name.
104
- */
105
- userInstallable: boolean;
106
- createdAt: Date;
107
- updatedAt: Date;
108
- }
109
-
110
- /** A button, select menu or form of the draft of a Discord bot Service, routed by the start of its `custom_id`. */
111
- export interface IReflexDiscordComponent {
112
- id: string;
113
- serviceId: string;
114
- /** A function of the same Service. */
115
- functionId: string;
116
- /** Unique within the Service; no prefix starts another one. An interaction matches the prefix followed by `:`, or equal to its `custom_id`. */
117
- customIdPrefix: string;
118
- kind: DiscordComponentKind;
119
- createdAt: Date;
120
- updatedAt: Date;
121
- }
122
-
123
- /**
124
- * A command as a version of the Service froze it. The fields of card 846 are only there when set (a
125
- * translation, `userInstallable` true): a command without them keeps the fingerprint it had.
126
- */
127
- export type IReflexDiscordCommandSnapshot = Pick<
128
- IReflexDiscordCommand,
129
- | 'id'
130
- | 'functionId'
131
- | 'name'
132
- | 'description'
133
- | 'options'
134
- | 'defaultMemberPermissions'
135
- | 'allowedInDirectMessages'
136
- > & {
137
- nameLocalizations?: ReflexDiscordLocalizations;
138
- descriptionLocalizations?: ReflexDiscordLocalizations;
139
- userInstallable?: true;
140
- };
141
-
142
- /** A component as a version of the Service froze it. */
143
- export type IReflexDiscordComponentSnapshot = Pick<
144
- IReflexDiscordComponent,
145
- 'id' | 'functionId' | 'customIdPrefix' | 'kind'
146
- >;
147
-
148
- /** Settings of a Discord bot Service in one environment, kept outside the versions. */
149
- export interface IReflexDiscordEnvironmentSettings {
150
- id: string;
151
- serviceId: string;
152
- environmentId: string;
153
- /** Discord server (snowflake) the commands are pushed to outside production; required there. */
154
- testGuildId: string | null;
155
- /** Discord permission bits as a decimal string, put in the invitation link. */
156
- invitePermissions: string;
157
- /** What the bot shows while connected. */
158
- presenceStatus: DiscordPresenceStatus;
159
- /** Null for no activity. */
160
- activityType: DiscordActivityType | null;
161
- /** 1 to 128 characters with an `activityType`, null without. */
162
- activityText: string | null;
163
- /** Largest file the bot receives or sends, in bytes: `REFLEX_DISCORD_LIMITS.attachmentMaxBytesDefault` until set. */
164
- maxAttachmentBytes: number;
165
- createdAt: Date;
166
- updatedAt: Date;
167
- }
168
-
169
- /** The Gateway connection of the bot of one environment, as its row in the execution plane says. */
170
- export interface IReflexDiscordPresence {
171
- state: DiscordGatewayState;
172
- /** Set if and only if `state` is `FAILED`. */
173
- failureCode: DiscordGatewayFailureCode | null;
174
- stateChangedAt: Date;
175
- /** Null until the bot connected once. */
176
- lastConnectedAt: Date | null;
177
- }
178
-
179
- /** What the Connection screen shows of the bot of one environment. Never carries the token. */
180
- export interface IReflexDiscordEnvironmentConnection {
181
- environmentId: string;
182
- /** The Discord application read from the token; null while the token is missing, rejected or unchecked. */
183
- applicationId: string | null;
184
- publicKey: string | null;
185
- botName: string | null;
186
- botAvatarUrl: string | null;
187
- tokenState: DiscordTokenState;
188
- testGuildId: string | null;
189
- invitePermissions: string;
190
- presenceStatus: DiscordPresenceStatus;
191
- activityType: DiscordActivityType | null;
192
- activityText: string | null;
193
- /** Largest file the bot receives or sends, in bytes (1 to `REFLEX_DISCORD_LIMITS.attachmentMaxBytesBound`). */
194
- maxAttachmentBytes: number;
195
- /** The Gateway connection; null while the bot is not in service in this environment. */
196
- presence: IReflexDiscordPresence | null;
197
- /** Address to give Discord for interactions in this environment. */
198
- interactionsUrl: string;
199
- /** Link that adds the bot to a Discord server; null while the application is unknown. */
200
- inviteUrl: string | null;
201
- }
202
-
203
- /** The Vault entry holding the token, and the bot of each environment of the application. */
204
- export interface IReflexDiscordConnection {
205
- /** Vault entry (secret) that holds the bot token, one value per environment; null until chosen. */
206
- discordTokenSecretId: string | null;
207
- environments: IReflexDiscordEnvironmentConnection[];
208
- }
1
+ import type {
2
+ DiscordActivityType,
3
+ DiscordChannelType,
4
+ DiscordComponentKind,
5
+ DiscordLocale,
6
+ DiscordGatewayFailureCode,
7
+ DiscordGatewayState,
8
+ DiscordOptionType,
9
+ DiscordPresenceStatus,
10
+ DiscordTokenState,
11
+ } from '../../enum';
12
+
13
+ /** Bounds of the commands and components of a Discord bot; the API and its database apply the same ones. */
14
+ export const REFLEX_DISCORD_LIMITS = {
15
+ /** `^[-_a-z0-9]{1,32}$`: the name typed after the slash. */
16
+ commandNamePattern: /^[-_a-z0-9]{1,32}$/,
17
+ /**
18
+ * Discord's pattern of a translated command or option name: letters and digits of any script, `-`, `_` and
19
+ * `'`, 1 to 32 characters. It must also be lower case where the script has one (see `isValidLocalizedName`).
20
+ */
21
+ localizedNamePattern: /^[-_'\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$/u,
22
+ commandDescriptionMaxLength: 100,
23
+ commandsPerServiceMax: 100,
24
+ optionsPerCommandMax: 25,
25
+ choicesPerOptionMax: 25,
26
+ /** `^[a-z0-9_-]{1,40}$`: the start of the `custom_id` of a button, a menu or a form. */
27
+ componentPrefixPattern: /^[a-z0-9_-]{1,40}$/,
28
+ syncErrorMaxLength: 500,
29
+ /** Bounds of `minLength` and `maxLength` of a STRING option (`maxLength` is 1 at least). */
30
+ optionLengthMax: 6000,
31
+ /** Length of the name of a choice, localized or not. */
32
+ choiceNameMaxLength: 100,
33
+ /** Largest file a bot receives or sends, per bot and environment (#915): the default, and the bound the setting may not pass. */
34
+ attachmentMaxBytesDefault: 2 * 1024 * 1024,
35
+ attachmentMaxBytesBound: 8 * 1024 * 1024,
36
+ } as const;
37
+
38
+ /** A translated command or option name Discord accepts: its pattern, and lower case where the script has one. */
39
+ export const isValidLocalizedName = (name: string): boolean =>
40
+ REFLEX_DISCORD_LIMITS.localizedNamePattern.test(name) && name === name.toLowerCase();
41
+
42
+ /**
43
+ * Translations of a name or a description, by Discord locale. A localized command or option name
44
+ * passes `isValidLocalizedName`, a description 1 to 100 characters, a choice name 1 to 100.
45
+ */
46
+ export type ReflexDiscordLocalizations = Partial<Record<DiscordLocale, string>>;
47
+
48
+ /** A fixed answer a user picks for a STRING, INTEGER or NUMBER option. */
49
+ export interface IReflexDiscordOptionChoice {
50
+ name: string;
51
+ value: string | number;
52
+ nameLocalizations?: ReflexDiscordLocalizations;
53
+ }
54
+
55
+ /**
56
+ * An option of a command. Required options come first. A bound only exists on the types it applies
57
+ * to: the API refuses it on another one.
58
+ */
59
+ export interface IReflexDiscordCommandOption {
60
+ type: DiscordOptionType;
61
+ /** Same pattern as the command name. */
62
+ name: string;
63
+ /** 1 to 100 characters. */
64
+ description: string;
65
+ required: boolean;
66
+ /** 25 at most, only for STRING, INTEGER and NUMBER; within `minValue`/`maxValue` and `minLength`/`maxLength`. */
67
+ choices?: IReflexDiscordOptionChoice[];
68
+ /**
69
+ * Discord asks the function for the choices while the user types. Only for STRING, INTEGER and NUMBER,
70
+ * never together with `choices`. Absent means false.
71
+ */
72
+ autocomplete?: boolean;
73
+ /** INTEGER and NUMBER: safe numbers, `minValue` <= `maxValue`. */
74
+ minValue?: number;
75
+ maxValue?: number;
76
+ /** STRING: 0 to 6000 (`maxLength` 1 at least), `minLength` <= `maxLength`. */
77
+ minLength?: number;
78
+ maxLength?: number;
79
+ /** CHANNEL: the channel types a user may pick, not empty, no duplicate. */
80
+ channelTypes?: DiscordChannelType[];
81
+ nameLocalizations?: ReflexDiscordLocalizations;
82
+ descriptionLocalizations?: ReflexDiscordLocalizations;
83
+ }
84
+
85
+ /** A slash command of the draft of a Discord bot Service. */
86
+ export interface IReflexDiscordCommand {
87
+ id: string;
88
+ serviceId: string;
89
+ /** A function of the same Service. */
90
+ functionId: string;
91
+ /** Unique within the Service. */
92
+ name: string;
93
+ description: string;
94
+ options: IReflexDiscordCommandOption[];
95
+ /** Discord permission bits as a decimal string, or null for everyone. */
96
+ defaultMemberPermissions: string | null;
97
+ allowedInDirectMessages: boolean;
98
+ /** Null without translations. */
99
+ nameLocalizations: ReflexDiscordLocalizations | null;
100
+ descriptionLocalizations: ReflexDiscordLocalizations | null;
101
+ /**
102
+ * Users may install the bot on their account and use the command outside the servers it is in (in
103
+ * group messages too). It can then act on no server in the bot's name.
104
+ */
105
+ userInstallable: boolean;
106
+ createdAt: Date;
107
+ updatedAt: Date;
108
+ }
109
+
110
+ /** A button, select menu or form of the draft of a Discord bot Service, routed by the start of its `custom_id`. */
111
+ export interface IReflexDiscordComponent {
112
+ id: string;
113
+ serviceId: string;
114
+ /** A function of the same Service. */
115
+ functionId: string;
116
+ /** Unique within the Service; no prefix starts another one. An interaction matches the prefix followed by `:`, or equal to its `custom_id`. */
117
+ customIdPrefix: string;
118
+ kind: DiscordComponentKind;
119
+ createdAt: Date;
120
+ updatedAt: Date;
121
+ }
122
+
123
+ /**
124
+ * A command as a version of the Service froze it. The fields of card 846 are only there when set (a
125
+ * translation, `userInstallable` true): a command without them keeps the fingerprint it had.
126
+ */
127
+ export type IReflexDiscordCommandSnapshot = Pick<
128
+ IReflexDiscordCommand,
129
+ | 'id'
130
+ | 'functionId'
131
+ | 'name'
132
+ | 'description'
133
+ | 'options'
134
+ | 'defaultMemberPermissions'
135
+ | 'allowedInDirectMessages'
136
+ > & {
137
+ nameLocalizations?: ReflexDiscordLocalizations;
138
+ descriptionLocalizations?: ReflexDiscordLocalizations;
139
+ userInstallable?: true;
140
+ };
141
+
142
+ /** A component as a version of the Service froze it. */
143
+ export type IReflexDiscordComponentSnapshot = Pick<
144
+ IReflexDiscordComponent,
145
+ 'id' | 'functionId' | 'customIdPrefix' | 'kind'
146
+ >;
147
+
148
+ /** Settings of a Discord bot Service in one environment, kept outside the versions. */
149
+ export interface IReflexDiscordEnvironmentSettings {
150
+ id: string;
151
+ serviceId: string;
152
+ environmentId: string;
153
+ /** Discord server (snowflake) the commands are pushed to outside production; required there. */
154
+ testGuildId: string | null;
155
+ /** Discord permission bits as a decimal string, put in the invitation link. */
156
+ invitePermissions: string;
157
+ /** What the bot shows while connected. */
158
+ presenceStatus: DiscordPresenceStatus;
159
+ /** Null for no activity. */
160
+ activityType: DiscordActivityType | null;
161
+ /** 1 to 128 characters with an `activityType`, null without. */
162
+ activityText: string | null;
163
+ /** Largest file the bot receives or sends, in bytes: `REFLEX_DISCORD_LIMITS.attachmentMaxBytesDefault` until set. */
164
+ maxAttachmentBytes: number;
165
+ createdAt: Date;
166
+ updatedAt: Date;
167
+ }
168
+
169
+ /** The Gateway connection of the bot of one environment, as its row in the execution plane says. */
170
+ export interface IReflexDiscordPresence {
171
+ state: DiscordGatewayState;
172
+ /** Set if and only if `state` is `FAILED`. */
173
+ failureCode: DiscordGatewayFailureCode | null;
174
+ stateChangedAt: Date;
175
+ /** Null until the bot connected once. */
176
+ lastConnectedAt: Date | null;
177
+ }
178
+
179
+ /** What the Connection screen shows of the bot of one environment. Never carries the token. */
180
+ export interface IReflexDiscordEnvironmentConnection {
181
+ environmentId: string;
182
+ /** The Discord application read from the token; null while the token is missing, rejected or unchecked. */
183
+ applicationId: string | null;
184
+ publicKey: string | null;
185
+ botName: string | null;
186
+ botAvatarUrl: string | null;
187
+ tokenState: DiscordTokenState;
188
+ testGuildId: string | null;
189
+ invitePermissions: string;
190
+ presenceStatus: DiscordPresenceStatus;
191
+ activityType: DiscordActivityType | null;
192
+ activityText: string | null;
193
+ /** Largest file the bot receives or sends, in bytes (1 to `REFLEX_DISCORD_LIMITS.attachmentMaxBytesBound`). */
194
+ maxAttachmentBytes: number;
195
+ /** The Gateway connection; null while the bot is not in service in this environment. */
196
+ presence: IReflexDiscordPresence | null;
197
+ /** Address to give Discord for interactions in this environment. */
198
+ interactionsUrl: string;
199
+ /** Link that adds the bot to a Discord server; null while the application is unknown. */
200
+ inviteUrl: string | null;
201
+ }
202
+
203
+ /** The Vault entry holding the token, and the bot of each environment of the application. */
204
+ export interface IReflexDiscordConnection {
205
+ /** Vault entry (secret) that holds the bot token, one value per environment; null until chosen. */
206
+ discordTokenSecretId: string | null;
207
+ environments: IReflexDiscordEnvironmentConnection[];
208
+ }
@@ -1,22 +1,22 @@
1
- import type { ExecutionProfile } from '../../enum';
2
-
3
- /**
4
- * The price list an execution is billed with (ADR-0244), served by the API from the runtime's
5
- * `COST_RATES` and `RESOURCE_PROFILES`, so that a screen that estimates a cost never holds a copy of it.
6
- * Prices are in millicredits (thousandths of a credit).
7
- */
8
- export interface IReflexPriceList {
9
- /** Once per execution; 0 for an interrupted or refused execution. */
10
- executionMillicredits: number;
11
- /** Once per autocomplete execution, in place of `executionMillicredits`; its CPU and memory are not billed. */
12
- autocompleteExecutionMillicredits: number;
13
- cpuMillicreditsPerSecond: number;
14
- /** Per GB-second of the memory the profile allocates, GB = 1024 MB. */
15
- memoryMillicreditsPerGbSecond: number;
16
- /** Per MB sent out, MB = 1024 x 1024 bytes. */
17
- networkOutMillicreditsPerMb: number;
18
- httpCallMillicredits: number;
19
- storeWriteMillicredits: number;
20
- /** The memory of each profile, and the coefficient its CPU part is multiplied by. */
21
- profiles: Record<ExecutionProfile, { memoryMb: number; cpuCoefficient: number }>;
22
- }
1
+ import type { ExecutionProfile } from '../../enum';
2
+
3
+ /**
4
+ * The price list an execution is billed with (ADR-0244), served by the API from the runtime's
5
+ * `COST_RATES` and `RESOURCE_PROFILES`, so that a screen that estimates a cost never holds a copy of it.
6
+ * Prices are in millicredits (thousandths of a credit).
7
+ */
8
+ export interface IReflexPriceList {
9
+ /** Once per execution; 0 for an interrupted or refused execution. */
10
+ executionMillicredits: number;
11
+ /** Once per autocomplete execution, in place of `executionMillicredits`; its CPU and memory are not billed. */
12
+ autocompleteExecutionMillicredits: number;
13
+ cpuMillicreditsPerSecond: number;
14
+ /** Per GB-second of the memory the profile allocates, GB = 1024 MB. */
15
+ memoryMillicreditsPerGbSecond: number;
16
+ /** Per MB sent out, MB = 1024 x 1024 bytes. */
17
+ networkOutMillicreditsPerMb: number;
18
+ httpCallMillicredits: number;
19
+ storeWriteMillicredits: number;
20
+ /** The memory of each profile, and the coefficient its CPU part is multiplied by. */
21
+ profiles: Record<ExecutionProfile, { memoryMb: number; cpuCoefficient: number }>;
22
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The retention tiers of the runs a customer may choose, in days (AbyssReflex L3a, #893). The plan's retention is
3
+ * the default; a tier is chosen per application, and per function over it. Same list as the database CHECKs.
4
+ */
5
+ export const REFLEX_RUN_RETENTION_TIER_DAYS = [3, 7, 15, 30, 90, 180, 365] as const;
6
+
7
+ /** Bounds of the number of versions the purge keeps, per function and per Service. */
8
+ export const REFLEX_VERSIONS_KEPT = { default: 20, min: 5, max: 100 } as const;
9
+
10
+ /** The detail of a run (detail, steps, log lines) moves to the archive past this age, in days, when its tier allows it. */
11
+ export const REFLEX_RUN_ARCHIVE_AFTER_DAYS = 30;
12
+
13
+ /** The runs of a tier under this number of days are never archived: they are purged before they would be. */
14
+ export const REFLEX_RUN_ARCHIVE_MIN_TIER_DAYS = 90;
15
+
16
+ /** The run retention of a function: its own tier, the one it inherits, and how many versions are kept. */
17
+ export interface IReflexFunctionRunRetention {
18
+ /** The tier of the function itself, one of `REFLEX_RUN_RETENTION_TIER_DAYS`; null follows the application. */
19
+ runRetentionDays: number | null;
20
+ /** The tier the function follows when it has none: the application's, else null for the plan's retention. Read only. */
21
+ inheritedDays: number | null;
22
+ /** How many versions of the function the purge keeps, `REFLEX_VERSIONS_KEPT.min` to `REFLEX_VERSIONS_KEPT.max`. */
23
+ versionsKept: number;
24
+ }
@@ -17,6 +17,17 @@ export interface IReflexApplicationRunSettings {
17
17
  maxLogLinesPerRun: number | null;
18
18
  /** How long runs are kept, from the Monitor plan; null until the first synchronization answered. Read only. */
19
19
  retentionDays: number | null;
20
+ /**
21
+ * The retention tier the customer chose for the runs of the application, one of `REFLEX_RUN_RETENTION_TIER_DAYS`;
22
+ * null follows the plan (`retentionDays`). A function's own tier wins over it.
23
+ */
24
+ runRetentionDays: number | null;
25
+ /** The owner's storage is cut: the runs recorded now keep no detail, steps or log lines. Read only. */
26
+ historyMinimal: boolean;
27
+ /** Bytes the runs of the application hold online (detail, steps, log lines). Read only. */
28
+ storedBytesOnline: number;
29
+ /** Bytes the runs of the application hold in the customer's archive. Read only. */
30
+ storedBytesArchive: number;
20
31
  /** Whether the application has Monitor activated. Read only. */
21
32
  monitorActivated: boolean;
22
33
  }
@@ -184,6 +184,16 @@ export interface IReflexRun {
184
184
  delivery?: IReflexCompletionDelivery;
185
185
  createdByUserId: string | null;
186
186
  createdAt: Date;
187
+ /** When the run is purged (its start plus the retention in force); null for a test run, and while no retention is known. */
188
+ expiresAt: string | null;
189
+ /** A favorite run is never purged. */
190
+ isFavorite: boolean;
191
+ /** The run was recorded while the owner's storage was cut: no detail, steps or log lines were kept. */
192
+ historyMinimal: boolean;
193
+ /** Bytes the run holds online (detail, steps, log lines); null for a test run, and for a run whose size was never computed. */
194
+ storedBytes: number | null;
195
+ /** When the detail, steps and log lines moved to the customer's archive; null while they are online. */
196
+ detailArchivedAt: string | null;
187
197
  }
188
198
 
189
199
  /** The consumer of a Service that called a route, as the edge passed it to the function. */
@@ -23,8 +23,10 @@ export interface IReflexServiceDeployment {
23
23
  environmentId: string;
24
24
  /** The name of that environment, second segment of the address. */
25
25
  environmentSlug: string;
26
- serviceVersionId: string;
27
- serviceVersionNumber: number;
26
+ /** The version this gesture put in service; null once the purge deleted it (the row stays in the history, no way back to it). */
27
+ serviceVersionId: string | null;
28
+ /** Number of that version; null with `serviceVersionId`. */
29
+ serviceVersionNumber: number | null;
28
30
  action: ServiceDeploymentAction;
29
31
  status: ServiceDeploymentStatus;
30
32
  grants: IReflexServiceDeploymentGrant[];
@@ -38,6 +38,8 @@ export interface IReflexService {
38
38
  cors: IReflexServiceCors;
39
39
  /** Draft: frozen by the next version. Calls per minute and per client IP, in each environment. */
40
40
  rateLimitPerIpPerMinute: number;
41
+ /** How many versions of the Service the purge keeps, `REFLEX_VERSIONS_KEPT.min` to `REFLEX_VERSIONS_KEPT.max`. */
42
+ versionsKept: number;
41
43
  createdByUserId: string;
42
44
  updatedByUserId: string;
43
45
  createdAt: Date;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Whose storage a day-90 operation is about (the storage surplus contract of abyss-main, #889): the owner of an
3
+ * application is an organization, so `organizationId` is the one Reflex acts on.
4
+ */
5
+ export interface IReflexStorageSurplusOwner {
6
+ organizationId?: string | null;
7
+ userId?: string | null;
8
+ }
9
+
10
+ /**
11
+ * One item of the day-90 contract: a day of the runs of one function. Online (archivable) its `id` names the day; in
12
+ * the archive it is the id of the archive object of that day.
13
+ */
14
+ export interface IReflexStorageSurplusItem {
15
+ id: string;
16
+ sizeBytes: number;
17
+ /** The day the item holds the runs of, UTC. */
18
+ createdAt: Date | string;
19
+ /** The day holds a favorite run. A favorite protects nothing against the quota. */
20
+ isFavorite: boolean;
21
+ /** What the customer recognises the day by: the function and the day. */
22
+ label: string;
23
+ }
@@ -1,15 +1,15 @@
1
- {
2
- // Perimetre de VERIFICATION, distinct de celui du build.
3
- //
4
- // `tsconfig.json` exclut `src/**/*.spec.ts` parce qu'il sert a emettre `dist/`, ou une spec
5
- // n'a rien a faire. Mais eslint s'appuie sur ce meme fichier via `parserOptions.project` :
6
- // les cinq specs du paquet sortaient donc en « Parsing error: that TSConfig does not include
7
- // this file », mesure du 2026-09-09, et n'etaient lintees par personne.
8
- //
9
- // Ce fichier sert uniquement a eslint. Il n'emet rien et ne change pas ce que `build` produit.
10
- "extends": "./tsconfig.json",
11
- "compilerOptions": {
12
- "noEmit": true
13
- },
14
- "exclude": ["./dist/**/*"]
15
- }
1
+ {
2
+ // Perimetre de VERIFICATION, distinct de celui du build.
3
+ //
4
+ // `tsconfig.json` exclut `src/**/*.spec.ts` parce qu'il sert a emettre `dist/`, ou une spec
5
+ // n'a rien a faire. Mais eslint s'appuie sur ce meme fichier via `parserOptions.project` :
6
+ // les cinq specs du paquet sortaient donc en « Parsing error: that TSConfig does not include
7
+ // this file », mesure du 2026-09-09, et n'etaient lintees par personne.
8
+ //
9
+ // Ce fichier sert uniquement a eslint. Il n'emet rien et ne change pas ce que `build` produit.
10
+ "extends": "./tsconfig.json",
11
+ "compilerOptions": {
12
+ "noEmit": true
13
+ },
14
+ "exclude": ["./dist/**/*"]
15
+ }