@abyss-project/reflex 6.4.0 → 6.6.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/.prettierrc +5 -5
  3. package/README.md +15 -15
  4. package/dist/api/function-run.api.d.ts +2 -1
  5. package/dist/api/function-run.api.js +3 -1
  6. package/dist/api/function-run.api.js.map +1 -1
  7. package/dist/discord/discord-command-tree.d.ts +5 -0
  8. package/dist/discord/discord-command-tree.js +38 -0
  9. package/dist/discord/discord-command-tree.js.map +1 -0
  10. package/dist/discord/discord-event-filter-cases.js +27 -11
  11. package/dist/discord/discord-event-filter-cases.js.map +1 -1
  12. package/dist/discord/discord-event-filters.js +7 -3
  13. package/dist/discord/discord-event-filters.js.map +1 -1
  14. package/dist/discord/discord-event-intents.d.ts +8 -2
  15. package/dist/discord/discord-event-intents.js +13 -2
  16. package/dist/discord/discord-event-intents.js.map +1 -1
  17. package/dist/discord/index.d.ts +1 -0
  18. package/dist/discord/index.js +1 -0
  19. package/dist/discord/index.js.map +1 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +1 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/types/enum/discord-command-node-type.enum.d.ts +5 -0
  24. package/dist/types/enum/discord-command-node-type.enum.js +10 -0
  25. package/dist/types/enum/discord-command-node-type.enum.js.map +1 -0
  26. package/dist/types/enum/discord-command-type.enum.d.ts +5 -0
  27. package/dist/types/enum/discord-command-type.enum.js +10 -0
  28. package/dist/types/enum/discord-command-type.enum.js.map +1 -0
  29. package/dist/types/enum/discord-event-type.enum.d.ts +3 -1
  30. package/dist/types/enum/discord-event-type.enum.js +2 -0
  31. package/dist/types/enum/discord-event-type.enum.js.map +1 -1
  32. package/dist/types/enum/index.d.ts +2 -0
  33. package/dist/types/enum/index.js +2 -0
  34. package/dist/types/enum/index.js.map +1 -1
  35. package/dist/types/enum/reflex-error-code.enum.d.ts +10 -0
  36. package/dist/types/enum/reflex-error-code.enum.js +10 -0
  37. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  38. package/dist/types/interface/api/requests/function-run.request.d.ts +8 -0
  39. package/dist/types/interface/api/requests/service-discord.request.d.ts +7 -3
  40. package/dist/types/interface/api/responses/function-run.response.d.ts +8 -0
  41. package/dist/types/interface/models/reflex-discord.model.d.ts +18 -2
  42. package/dist/types/interface/models/reflex-discord.model.js +4 -0
  43. package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
  44. package/dist/types/interface/models/reflex-run.model.d.ts +4 -0
  45. package/dist/types/interface/models/reflex-run.model.js +4 -1
  46. package/dist/types/interface/models/reflex-run.model.js.map +1 -1
  47. package/jest.config.ts +11 -11
  48. package/package.json +1 -1
  49. package/src/api/alert-rule.api.test.ts +72 -72
  50. package/src/api/alert-rule.api.ts +57 -57
  51. package/src/api/application-insights.api.test.ts +42 -42
  52. package/src/api/application-insights.api.ts +38 -38
  53. package/src/api/application-run-settings.api.test.ts +62 -62
  54. package/src/api/application-run-settings.api.ts +30 -30
  55. package/src/api/function-access.api.ts +87 -87
  56. package/src/api/function-insights.api.test.ts +27 -27
  57. package/src/api/function-insights.api.ts +18 -18
  58. package/src/api/function-run.api.ts +19 -0
  59. package/src/api/function-settings.api.ts +96 -96
  60. package/src/api/function-template.api.test.ts +72 -72
  61. package/src/api/function-template.api.ts +52 -52
  62. package/src/api/function-test.api.ts +34 -34
  63. package/src/api/function-version.api.ts +66 -66
  64. package/src/api/function.api.test.ts +346 -346
  65. package/src/api/function.api.ts +62 -62
  66. package/src/api/health.api.ts +10 -10
  67. package/src/api/route-stats.api.test.ts +45 -45
  68. package/src/api/route-stats.api.ts +36 -36
  69. package/src/api/service-completion-webhook.api.test.ts +97 -97
  70. package/src/api/service-completion-webhook.api.ts +39 -39
  71. package/src/api/service-configuration.api.ts +16 -16
  72. package/src/api/service-consumer.api.test.ts +104 -104
  73. package/src/api/service-consumer.api.ts +90 -90
  74. package/src/api/service-deployment.api.ts +79 -79
  75. package/src/api/service-discord-event.api.test.ts +106 -106
  76. package/src/api/service-discord-event.api.ts +78 -78
  77. package/src/api/service-discord.api.test.ts +178 -178
  78. package/src/api/service-discord.api.ts +222 -222
  79. package/src/api/service-insights.api.test.ts +36 -36
  80. package/src/api/service-insights.api.ts +42 -42
  81. package/src/api/service-limits.api.test.ts +100 -100
  82. package/src/api/service-limits.api.ts +37 -37
  83. package/src/api/service-openapi.api.test.ts +52 -52
  84. package/src/api/service-openapi.api.ts +21 -21
  85. package/src/api/service-route.api.ts +74 -74
  86. package/src/api/service-task.api.test.ts +140 -140
  87. package/src/api/service-task.api.ts +141 -141
  88. package/src/api/service-version.api.ts +54 -54
  89. package/src/api/service.api.test.ts +220 -220
  90. package/src/api/service.api.ts +55 -55
  91. package/src/api/storage-surplus.admin.api.test.ts +66 -66
  92. package/src/api/storage-surplus.admin.api.ts +45 -45
  93. package/src/discord/discord-command-tree.test.ts +47 -0
  94. package/src/discord/discord-command-tree.ts +60 -0
  95. package/src/discord/discord-event-filter-cases.ts +299 -261
  96. package/src/discord/discord-event-filters.test.ts +120 -91
  97. package/src/discord/discord-event-filters.ts +103 -95
  98. package/src/discord/discord-event-intents.test.ts +139 -112
  99. package/src/discord/discord-event-intents.ts +80 -55
  100. package/src/discord/index.ts +4 -3
  101. package/src/index.test.ts +104 -104
  102. package/src/index.ts +2 -0
  103. package/src/insights/index.ts +1 -1
  104. package/src/insights/percentiles.test.ts +75 -75
  105. package/src/insights/percentiles.ts +37 -37
  106. package/src/types/enum/discord-command-node-type.enum.ts +10 -0
  107. package/src/types/enum/discord-command-type.enum.ts +9 -0
  108. package/src/types/enum/discord-event-type.enum.ts +4 -0
  109. package/src/types/enum/discord-host-action.enum.ts +37 -37
  110. package/src/types/enum/index.ts +2 -0
  111. package/src/types/enum/reflex-error-code.enum.ts +112 -89
  112. package/src/types/interface/api/requests/application-run-settings.request.ts +13 -13
  113. package/src/types/interface/api/requests/function-run.request.ts +53 -42
  114. package/src/types/interface/api/requests/function-settings.request.ts +50 -50
  115. package/src/types/interface/api/requests/index.ts +25 -25
  116. package/src/types/interface/api/requests/service-discord.request.ts +168 -155
  117. package/src/types/interface/api/requests/service.request.ts +48 -48
  118. package/src/types/interface/api/requests/storage-surplus.admin.request.ts +12 -12
  119. package/src/types/interface/api/responses/function-run.response.ts +35 -23
  120. package/src/types/interface/api/responses/function-settings.response.ts +57 -57
  121. package/src/types/interface/api/responses/index.ts +25 -25
  122. package/src/types/interface/api/responses/storage-surplus.admin.response.ts +10 -10
  123. package/src/types/interface/models/index.ts +29 -29
  124. package/src/types/interface/models/reflex-discord.model.ts +249 -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 -24
  127. package/src/types/interface/models/reflex-run-settings.model.ts +39 -39
  128. package/src/types/interface/models/reflex-run.model.ts +317 -309
  129. package/src/types/interface/models/reflex-service-deployment.model.ts +48 -48
  130. package/src/types/interface/models/reflex-service.model.ts +47 -47
  131. package/src/types/interface/models/reflex-storage-surplus.model.ts +23 -23
  132. package/tsconfig.check.json +15 -15
  133. package/tsconfig.json +35 -35
@@ -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
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The place of a row in the tree of a slash command: a command (the root), a subcommand group, or a
3
+ * subcommand. A command without children, a subcommand and a context menu run a function (a leaf); a command
4
+ * with children and a group do not.
5
+ */
6
+ export enum DiscordCommandNodeType {
7
+ COMMAND = 'COMMAND',
8
+ SUBCOMMAND_GROUP = 'SUBCOMMAND_GROUP',
9
+ SUBCOMMAND = 'SUBCOMMAND',
10
+ }
@@ -0,0 +1,9 @@
1
+ /** The type of a Discord application command: a slash command, or a context menu (right click, then "Apps"). */
2
+ export enum DiscordCommandType {
3
+ /** A slash command, `/name`. */
4
+ CHAT_INPUT = 'CHAT_INPUT',
5
+ /** A context menu on a member. */
6
+ USER = 'USER',
7
+ /** A context menu on a message. */
8
+ MESSAGE = 'MESSAGE',
9
+ }
@@ -4,4 +4,8 @@ export enum DiscordEventType {
4
4
  GUILD_MEMBER_REMOVE = 'GUILD_MEMBER_REMOVE',
5
5
  MESSAGE_CREATE = 'MESSAGE_CREATE',
6
6
  MESSAGE_REACTION_ADD = 'MESSAGE_REACTION_ADD',
7
+ /** A member votes for an answer of a poll (one event per answer). Received only when the bot turns poll votes on. */
8
+ MESSAGE_POLL_VOTE_ADD = 'MESSAGE_POLL_VOTE_ADD',
9
+ /** A member withdraws a vote. Received only when the bot turns poll votes on. */
10
+ MESSAGE_POLL_VOTE_REMOVE = 'MESSAGE_POLL_VOTE_REMOVE',
7
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
+ }
@@ -20,6 +20,8 @@ export * from './vault-visibility.enum';
20
20
  export * from './configuration-read-as.enum';
21
21
  export * from './service-version-change-kind.enum';
22
22
  export * from './discord-option-type.enum';
23
+ export * from './discord-command-type.enum';
24
+ export * from './discord-command-node-type.enum';
23
25
  export * from './discord-component-kind.enum';
24
26
  export * from './discord-sync-status.enum';
25
27
  export * from './discord-token-state.enum';
@@ -1,89 +1,112 @@
1
- /** `error.code` of the refusals a client acts on. */
2
- export enum ReflexErrorCode {
3
- /** 400: the definition does not match the format; `error.details` holds the path of each fault. */
4
- INVALID_DEFINITION = 'INVALID_DEFINITION',
5
- /** 409: an access granted to the function is suspended; revoke it and grant it again. */
6
- GRANT_SUSPENDED = 'GRANT_SUSPENDED',
7
- /** 409: the function has no frozen version of its own draft yet, or none to go back to. */
8
- NO_VERSION = 'NO_VERSION',
9
- /** 409: the access to grant is not declared by the draft of the function. */
10
- ACCESS_NOT_DECLARED = 'ACCESS_NOT_DECLARED',
11
- /** 404: the environment is not one of the application's environments (abyss-main). */
12
- ENVIRONMENT_NOT_FOUND = 'ENVIRONMENT_NOT_FOUND',
13
- /** 409: a name, a path or an access already exists. */
14
- ALREADY_EXISTS = 'ALREADY_EXISTS',
15
- /** 403: the function is promoted in a production environment and the member lacks REFLEX_PUBLISH_PRODUCTION. */
16
- PUBLISH_PRODUCTION_REQUIRED = 'PUBLISH_PRODUCTION_REQUIRED',
17
- /** 503 (edge): the Service is paused in this environment; nothing ran, nothing is billed. */
18
- SERVICE_PAUSED = 'SERVICE_PAUSED',
19
- /** 429: the caller went past the limit; `Retry-After` and `RateLimit-*` say when to come back. */
20
- RATE_LIMIT_EXCEEDED = 'RATE_LIMIT_EXCEEDED',
21
- /** 409: the route would hide another one of the Service (same method, paths equal but for their parameters). */
22
- ROUTE_CONFLICT = 'ROUTE_CONFLICT',
23
- /** 409: the Service has not changed since its last version. */
24
- VERSION_UNCHANGED = 'VERSION_UNCHANGED',
25
- /** 409: the Discord bot token has no value in this environment's Vault entry. */
26
- DISCORD_TOKEN_MISSING = 'DISCORD_TOKEN_MISSING',
27
- /** 409: Discord refused the bot token (401). */
28
- DISCORD_TOKEN_REJECTED = 'DISCORD_TOKEN_REJECTED',
29
- /** 409: a non-production environment needs a test server before a Discord bot goes live there. */
30
- DISCORD_TEST_GUILD_REQUIRED = 'DISCORD_TEST_GUILD_REQUIRED',
31
- /** 409: a command of that name already exists in the Service. */
32
- DISCORD_COMMAND_CONFLICT = 'DISCORD_COMMAND_CONFLICT',
33
- /** 409: the component prefix equals, starts or is started by another prefix of the Service. */
34
- DISCORD_COMPONENT_PREFIX_CONFLICT = 'DISCORD_COMPONENT_PREFIX_CONFLICT',
35
- /** 400: the field does not exist for this type of Service (CORS or rate limit on a Discord bot). */
36
- SERVICE_TYPE_FIELD_REFUSED = 'SERVICE_TYPE_FIELD_REFUSED',
37
- /**
38
- * 400: a route path cannot start with `_`: the edge keeps those paths for its own addresses (`_abyss` for the ticks
39
- * of the cron tasks, `_executions` for the state of an async execution).
40
- */
41
- ROUTE_SEGMENT_RESERVED = 'ROUTE_SEGMENT_RESERVED',
42
- /** 409: the bot bills credit overage but the organization does not allow overage of the credits metric. */
43
- CREDIT_OVERAGE_NOT_ALLOWED = 'CREDIT_OVERAGE_NOT_ALLOWED',
44
- /** 409: the lots asked for do not fit in the event rate reserve of the organization (the sum of its allocations would go past it). */
45
- BOT_EVENT_RESERVE_EXCEEDED = 'BOT_EVENT_RESERVE_EXCEEDED',
46
- /**
47
- * 422 (edge): the body or the query of the request does not match the contract of the route; `error.errors` holds
48
- * at most `REFLEX_CONTRACT_LIMITS.maxErrors` faults (`IReflexContractError`). Nothing ran, nothing is billed.
49
- */
50
- REQUEST_INVALID = 'REQUEST_INVALID',
51
- /**
52
- * 503 (edge): the credits of the organization are spent and the Service has no overage in this environment;
53
- * `Retry-After` points at the first day of the next month (UTC). Nothing ran, nothing is billed.
54
- */
55
- CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
56
- /**
57
- * 503 (edge): the monthly spend cap of the Service in this environment is reached; `Retry-After` points at the
58
- * first day of the next month (UTC), and raising the cap lifts the stop at the next computation. Nothing ran,
59
- * nothing is billed.
60
- */
61
- BUDGET_REACHED = 'BUDGET_REACHED',
62
- /** 400: the contract of a route is not a valid one; `error.details` holds each fault (`IReflexContractError`). */
63
- CONTRACT_INVALID = 'CONTRACT_INVALID',
64
- /** 409: the Service already has `REFLEX_CONSUMER_LIMITS.perService` consumers. */
65
- CONSUMER_LIMIT_REACHED = 'CONSUMER_LIMIT_REACHED',
66
- /** 409: the consumer already has `REFLEX_CONSUMER_LIMITS.activeKeysPerConsumer` keys that are not revoked. */
67
- CONSUMER_KEY_LIMIT_REACHED = 'CONSUMER_KEY_LIMIT_REACHED',
68
- /**
69
- * 400: the completion webhook URL is refused: not `https`, a private or internal address, or a name that resolves
70
- * to one or does not resolve.
71
- */
72
- COMPLETION_WEBHOOK_URL_REFUSED = 'COMPLETION_WEBHOOK_URL_REFUSED',
73
- /**
74
- * 503: the run detail is in the customer's archive and the archive cannot be read now (Storage unreachable, key
75
- * unavailable, object failing its check). The run itself is untouched; asking again later may succeed.
76
- */
77
- ARCHIVE_UNAVAILABLE = 'ARCHIVE_UNAVAILABLE',
78
- /**
79
- * 404: the detail of the run was in the customer's archive and the archive was deleted (day 90 of the storage
80
- * surplus). The run's row stays; its detail, steps and log lines are gone for good.
81
- */
82
- ARCHIVE_DELETED = 'ARCHIVE_DELETED',
83
- /**
84
- * 409: the version cannot be published because the AbyssReflex storage of the organization is full: its online quota
85
- * is reached, or the personal threshold of AbyssReflex is, with "Block deposits" on. Nothing was published; the
86
- * versions that exist and the executions go on. Delete versions, or raise the quota or the threshold.
87
- */
88
- STORAGE_PUBLISH_REFUSED = 'STORAGE_PUBLISH_REFUSED',
89
- }
1
+ /** `error.code` of the refusals a client acts on. */
2
+ export enum ReflexErrorCode {
3
+ /** 400: the definition does not match the format; `error.details` holds the path of each fault. */
4
+ INVALID_DEFINITION = 'INVALID_DEFINITION',
5
+ /** 409: an access granted to the function is suspended; revoke it and grant it again. */
6
+ GRANT_SUSPENDED = 'GRANT_SUSPENDED',
7
+ /** 409: the function has no frozen version of its own draft yet, or none to go back to. */
8
+ NO_VERSION = 'NO_VERSION',
9
+ /** 409: the access to grant is not declared by the draft of the function. */
10
+ ACCESS_NOT_DECLARED = 'ACCESS_NOT_DECLARED',
11
+ /** 404: the environment is not one of the application's environments (abyss-main). */
12
+ ENVIRONMENT_NOT_FOUND = 'ENVIRONMENT_NOT_FOUND',
13
+ /** 409: a name, a path or an access already exists. */
14
+ ALREADY_EXISTS = 'ALREADY_EXISTS',
15
+ /** 403: the function is promoted in a production environment and the member lacks REFLEX_PUBLISH_PRODUCTION. */
16
+ PUBLISH_PRODUCTION_REQUIRED = 'PUBLISH_PRODUCTION_REQUIRED',
17
+ /** 503 (edge): the Service is paused in this environment; nothing ran, nothing is billed. */
18
+ SERVICE_PAUSED = 'SERVICE_PAUSED',
19
+ /** 429: the caller went past the limit; `Retry-After` and `RateLimit-*` say when to come back. */
20
+ RATE_LIMIT_EXCEEDED = 'RATE_LIMIT_EXCEEDED',
21
+ /** 409: the route would hide another one of the Service (same method, paths equal but for their parameters). */
22
+ ROUTE_CONFLICT = 'ROUTE_CONFLICT',
23
+ /** 409: the Service has not changed since its last version. */
24
+ VERSION_UNCHANGED = 'VERSION_UNCHANGED',
25
+ /** 409: the Discord bot token has no value in this environment's Vault entry. */
26
+ DISCORD_TOKEN_MISSING = 'DISCORD_TOKEN_MISSING',
27
+ /** 409: Discord refused the bot token (401). */
28
+ DISCORD_TOKEN_REJECTED = 'DISCORD_TOKEN_REJECTED',
29
+ /** 409: a non-production environment needs a test server before a Discord bot goes live there. */
30
+ DISCORD_TEST_GUILD_REQUIRED = 'DISCORD_TEST_GUILD_REQUIRED',
31
+ /** 409: a command of that name already exists in the Service. */
32
+ DISCORD_COMMAND_CONFLICT = 'DISCORD_COMMAND_CONFLICT',
33
+ /**
34
+ * 422: the tree of a slash command is refused: a group under a group or under a subcommand, a child of a context menu
35
+ * or of a leaf, options on a command that has subcommands, or more than `subcommandsPerLevelMax` children.
36
+ */
37
+ DISCORD_COMMAND_TREE_INVALID = 'DISCORD_COMMAND_TREE_INVALID',
38
+ /** 422: a field Discord only reads on the root (default permissions, direct messages, user install) is set on a child. */
39
+ DISCORD_COMMAND_ROOT_ONLY_FIELD = 'DISCORD_COMMAND_ROOT_ONLY_FIELD',
40
+ /** 422: a version is refused while a command with subcommands, or a group, has no child; `error.data.commandIds` names them. */
41
+ DISCORD_COMMAND_EMPTY_PARENT = 'DISCORD_COMMAND_EMPTY_PARENT',
42
+ /** 409: the Service already has the most commands of that type (100 slash commands, 15 menus of each type). */
43
+ DISCORD_COMMAND_LIMIT = 'DISCORD_COMMAND_LIMIT',
44
+ /** 422: the run cannot be replayed: it was not started by a Discord event trigger. */
45
+ REPLAY_NOT_EVENT_RUN = 'REPLAY_NOT_EVENT_RUN',
46
+ /** 410: the detail of the run is gone (retention of the plan): nothing to replay. */
47
+ RUN_DETAIL_GONE = 'RUN_DETAIL_GONE',
48
+ /** 422: the kept input of the run was cut to fit its budget: replaying it would mislead the function. */
49
+ REPLAY_INPUT_TRUNCATED = 'REPLAY_INPUT_TRUNCATED',
50
+ /** 409: the event trigger of the run is no longer in service in its environment. */
51
+ REPLAY_TRIGGER_GONE = 'REPLAY_TRIGGER_GONE',
52
+ /** 409: the events of the bot are stopped in that environment (credits spent or monthly cap reached). */
53
+ BOT_EVENTS_BLOCKED = 'BOT_EVENTS_BLOCKED',
54
+ /** 429: the bot already has `REFLEX_REPLAY_LIMITS.liveReplaysPerMinute` real replays in the last minute in that environment. */
55
+ REPLAY_RATE_LIMITED = 'REPLAY_RATE_LIMITED',
56
+ /** 409: the component prefix equals, starts or is started by another prefix of the Service. */
57
+ DISCORD_COMPONENT_PREFIX_CONFLICT = 'DISCORD_COMPONENT_PREFIX_CONFLICT',
58
+ /** 400: the field does not exist for this type of Service (CORS or rate limit on a Discord bot). */
59
+ SERVICE_TYPE_FIELD_REFUSED = 'SERVICE_TYPE_FIELD_REFUSED',
60
+ /**
61
+ * 400: a route path cannot start with `_`: the edge keeps those paths for its own addresses (`_abyss` for the ticks
62
+ * of the cron tasks, `_executions` for the state of an async execution).
63
+ */
64
+ ROUTE_SEGMENT_RESERVED = 'ROUTE_SEGMENT_RESERVED',
65
+ /** 409: the bot bills credit overage but the organization does not allow overage of the credits metric. */
66
+ CREDIT_OVERAGE_NOT_ALLOWED = 'CREDIT_OVERAGE_NOT_ALLOWED',
67
+ /** 409: the lots asked for do not fit in the event rate reserve of the organization (the sum of its allocations would go past it). */
68
+ BOT_EVENT_RESERVE_EXCEEDED = 'BOT_EVENT_RESERVE_EXCEEDED',
69
+ /**
70
+ * 422 (edge): the body or the query of the request does not match the contract of the route; `error.errors` holds
71
+ * at most `REFLEX_CONTRACT_LIMITS.maxErrors` faults (`IReflexContractError`). Nothing ran, nothing is billed.
72
+ */
73
+ REQUEST_INVALID = 'REQUEST_INVALID',
74
+ /**
75
+ * 503 (edge): the credits of the organization are spent and the Service has no overage in this environment;
76
+ * `Retry-After` points at the first day of the next month (UTC). Nothing ran, nothing is billed.
77
+ */
78
+ CREDITS_EXHAUSTED = 'CREDITS_EXHAUSTED',
79
+ /**
80
+ * 503 (edge): the monthly spend cap of the Service in this environment is reached; `Retry-After` points at the
81
+ * first day of the next month (UTC), and raising the cap lifts the stop at the next computation. Nothing ran,
82
+ * nothing is billed.
83
+ */
84
+ BUDGET_REACHED = 'BUDGET_REACHED',
85
+ /** 400: the contract of a route is not a valid one; `error.details` holds each fault (`IReflexContractError`). */
86
+ CONTRACT_INVALID = 'CONTRACT_INVALID',
87
+ /** 409: the Service already has `REFLEX_CONSUMER_LIMITS.perService` consumers. */
88
+ CONSUMER_LIMIT_REACHED = 'CONSUMER_LIMIT_REACHED',
89
+ /** 409: the consumer already has `REFLEX_CONSUMER_LIMITS.activeKeysPerConsumer` keys that are not revoked. */
90
+ CONSUMER_KEY_LIMIT_REACHED = 'CONSUMER_KEY_LIMIT_REACHED',
91
+ /**
92
+ * 400: the completion webhook URL is refused: not `https`, a private or internal address, or a name that resolves
93
+ * to one or does not resolve.
94
+ */
95
+ COMPLETION_WEBHOOK_URL_REFUSED = 'COMPLETION_WEBHOOK_URL_REFUSED',
96
+ /**
97
+ * 503: the run detail is in the customer's archive and the archive cannot be read now (Storage unreachable, key
98
+ * unavailable, object failing its check). The run itself is untouched; asking again later may succeed.
99
+ */
100
+ ARCHIVE_UNAVAILABLE = 'ARCHIVE_UNAVAILABLE',
101
+ /**
102
+ * 404: the detail of the run was in the customer's archive and the archive was deleted (day 90 of the storage
103
+ * surplus). The run's row stays; its detail, steps and log lines are gone for good.
104
+ */
105
+ ARCHIVE_DELETED = 'ARCHIVE_DELETED',
106
+ /**
107
+ * 409: the version cannot be published because the AbyssReflex storage of the organization is full: its online quota
108
+ * is reached, or the personal threshold of AbyssReflex is, with "Block deposits" on. Nothing was published; the
109
+ * versions that exist and the executions go on. Delete versions, or raise the quota or the threshold.
110
+ */
111
+ STORAGE_PUBLISH_REFUSED = 'STORAGE_PUBLISH_REFUSED',
112
+ }
@@ -1,13 +1,13 @@
1
- export interface IGetApplicationRunSettingsParams {
2
- applicationId: string;
3
- }
4
-
5
- export interface ISetApplicationRunSettingsParams {
6
- applicationId: string;
7
- }
8
- export interface ISetApplicationRunSettingsBody {
9
- /** Cap of log lines per run, 1 to 10 000; null for no cap. */
10
- maxLogLinesPerRun: number | null;
11
- /** The retention tier of the runs, one of `REFLEX_RUN_RETENTION_TIER_DAYS`; null to follow the plan. Left alone when absent. */
12
- runRetentionDays?: number | null;
13
- }
1
+ export interface IGetApplicationRunSettingsParams {
2
+ applicationId: string;
3
+ }
4
+
5
+ export interface ISetApplicationRunSettingsParams {
6
+ applicationId: string;
7
+ }
8
+ export interface ISetApplicationRunSettingsBody {
9
+ /** Cap of log lines per run, 1 to 10 000; null for no cap. */
10
+ maxLogLinesPerRun: number | null;
11
+ /** The retention tier of the runs, one of `REFLEX_RUN_RETENTION_TIER_DAYS`; null to follow the plan. Left alone when absent. */
12
+ runRetentionDays?: number | null;
13
+ }