@abyss-project/reflex 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/api/index.d.ts +1 -0
  2. package/dist/api/index.js +1 -0
  3. package/dist/api/index.js.map +1 -1
  4. package/dist/api/service-discord.api.d.ts +14 -0
  5. package/dist/api/service-discord.api.js +38 -0
  6. package/dist/api/service-discord.api.js.map +1 -0
  7. package/dist/index.d.ts +22 -0
  8. package/dist/index.js +22 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/types/enum/discord-component-kind.enum.d.ts +4 -0
  11. package/dist/types/enum/discord-component-kind.enum.js +9 -0
  12. package/dist/types/enum/discord-component-kind.enum.js.map +1 -0
  13. package/dist/types/enum/discord-option-type.enum.d.ts +11 -0
  14. package/dist/types/enum/discord-option-type.enum.js +16 -0
  15. package/dist/types/enum/discord-option-type.enum.js.map +1 -0
  16. package/dist/types/enum/discord-sync-status.enum.d.ts +5 -0
  17. package/dist/types/enum/discord-sync-status.enum.js +10 -0
  18. package/dist/types/enum/discord-sync-status.enum.js.map +1 -0
  19. package/dist/types/enum/discord-token-state.enum.d.ts +6 -0
  20. package/dist/types/enum/discord-token-state.enum.js +11 -0
  21. package/dist/types/enum/discord-token-state.enum.js.map +1 -0
  22. package/dist/types/enum/index.d.ts +4 -0
  23. package/dist/types/enum/index.js +4 -0
  24. package/dist/types/enum/index.js.map +1 -1
  25. package/dist/types/enum/reflex-error-code.enum.d.ts +7 -1
  26. package/dist/types/enum/reflex-error-code.enum.js +6 -0
  27. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  28. package/dist/types/enum/service-type.enum.d.ts +2 -1
  29. package/dist/types/enum/service-type.enum.js +1 -0
  30. package/dist/types/enum/service-type.enum.js.map +1 -1
  31. package/dist/types/interface/api/requests/index.d.ts +1 -0
  32. package/dist/types/interface/api/requests/index.js +1 -0
  33. package/dist/types/interface/api/requests/index.js.map +1 -1
  34. package/dist/types/interface/api/requests/service-discord.request.d.ts +94 -0
  35. package/dist/types/interface/api/requests/service-discord.request.js +3 -0
  36. package/dist/types/interface/api/requests/service-discord.request.js.map +1 -0
  37. package/dist/types/interface/api/requests/service.request.d.ts +2 -0
  38. package/dist/types/interface/api/responses/index.d.ts +1 -0
  39. package/dist/types/interface/api/responses/index.js +1 -0
  40. package/dist/types/interface/api/responses/index.js.map +1 -1
  41. package/dist/types/interface/api/responses/service-discord.response.d.ts +50 -0
  42. package/dist/types/interface/api/responses/service-discord.response.js +3 -0
  43. package/dist/types/interface/api/responses/service-discord.response.js.map +1 -0
  44. package/dist/types/interface/api/responses/service-version.response.d.ts +15 -1
  45. package/dist/types/interface/models/index.d.ts +1 -0
  46. package/dist/types/interface/models/index.js +1 -0
  47. package/dist/types/interface/models/index.js.map +1 -1
  48. package/dist/types/interface/models/reflex-discord.model.d.ts +69 -0
  49. package/dist/types/interface/models/reflex-discord.model.js +13 -0
  50. package/dist/types/interface/models/reflex-discord.model.js.map +1 -0
  51. package/dist/types/interface/models/reflex-run.model.d.ts +3 -0
  52. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +5 -1
  53. package/dist/types/interface/models/reflex-service-version.model.d.ts +6 -0
  54. package/dist/types/interface/models/reflex-service.model.d.ts +1 -0
  55. package/package.json +1 -1
  56. package/src/api/index.ts +13 -12
  57. package/src/api/service-configuration.api.ts +16 -16
  58. package/src/api/service-discord.api.test.ts +170 -0
  59. package/src/api/service-discord.api.ts +203 -0
  60. package/src/index.ts +235 -190
  61. package/src/types/enum/configuration-read-as.enum.ts +5 -5
  62. package/src/types/enum/discord-component-kind.enum.ts +7 -0
  63. package/src/types/enum/discord-option-type.enum.ts +12 -0
  64. package/src/types/enum/discord-sync-status.enum.ts +6 -0
  65. package/src/types/enum/discord-token-state.enum.ts +11 -0
  66. package/src/types/enum/index.ts +25 -21
  67. package/src/types/enum/reflex-error-code.enum.ts +12 -0
  68. package/src/types/enum/service-type.enum.ts +2 -0
  69. package/src/types/enum/vault-value-source.enum.ts +12 -12
  70. package/src/types/enum/vault-visibility.enum.ts +5 -5
  71. package/src/types/interface/api/requests/index.ts +12 -11
  72. package/src/types/interface/api/requests/service-configuration.request.ts +4 -4
  73. package/src/types/interface/api/requests/service-discord.request.ts +118 -0
  74. package/src/types/interface/api/requests/service.request.ts +8 -1
  75. package/src/types/interface/api/responses/index.ts +12 -11
  76. package/src/types/interface/api/responses/service-configuration.response.ts +8 -8
  77. package/src/types/interface/api/responses/service-discord.response.ts +72 -0
  78. package/src/types/interface/api/responses/service-version.response.ts +62 -33
  79. package/src/types/interface/models/index.ts +14 -13
  80. package/src/types/interface/models/reflex-discord.model.ts +117 -0
  81. package/src/types/interface/models/reflex-run.model.ts +173 -164
  82. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -22
  83. package/src/types/interface/models/reflex-service-deployment.model.ts +12 -1
  84. package/src/types/interface/models/reflex-service-version.model.ts +12 -0
  85. package/src/types/interface/models/reflex-service.model.ts +2 -0
@@ -0,0 +1,118 @@
1
+ import type { DiscordComponentKind } from '../../../enum';
2
+ import type { IReflexDiscordCommandOption } from '../../models';
3
+
4
+ export interface IListServiceDiscordCommandParams {
5
+ applicationId: string;
6
+ serviceId: string;
7
+ }
8
+
9
+ export interface ICreateServiceDiscordCommandParams {
10
+ applicationId: string;
11
+ serviceId: string;
12
+ }
13
+ export interface ICreateServiceDiscordCommandBody {
14
+ /** `^[-_a-z0-9]{1,32}$`, unique within the Service. */
15
+ name: string;
16
+ /** 1 to 100 characters. */
17
+ description: string;
18
+ /** 25 at most, required options first; empty by default. */
19
+ options?: IReflexDiscordCommandOption[];
20
+ /** A function of the same Service. */
21
+ functionId: string;
22
+ /** Discord permission bits as a decimal string; null (default) for everyone. */
23
+ defaultMemberPermissions?: string | null;
24
+ /** `true` by default. */
25
+ allowedInDirectMessages?: boolean;
26
+ }
27
+
28
+ export interface IUpdateServiceDiscordCommandParams {
29
+ applicationId: string;
30
+ serviceId: string;
31
+ commandId: string;
32
+ }
33
+ export interface IUpdateServiceDiscordCommandBody {
34
+ name?: string;
35
+ description?: string;
36
+ options?: IReflexDiscordCommandOption[];
37
+ functionId?: string;
38
+ defaultMemberPermissions?: string | null;
39
+ allowedInDirectMessages?: boolean;
40
+ }
41
+
42
+ export interface IDeleteServiceDiscordCommandParams {
43
+ applicationId: string;
44
+ serviceId: string;
45
+ commandId: string;
46
+ }
47
+
48
+ export interface IListServiceDiscordComponentParams {
49
+ applicationId: string;
50
+ serviceId: string;
51
+ }
52
+
53
+ export interface ICreateServiceDiscordComponentParams {
54
+ applicationId: string;
55
+ serviceId: string;
56
+ }
57
+ export interface ICreateServiceDiscordComponentBody {
58
+ /** `^[a-z0-9_-]{1,40}$`; no prefix of the Service equals, starts or is started by another one. */
59
+ customIdPrefix: string;
60
+ kind: DiscordComponentKind;
61
+ /** A function of the same Service. */
62
+ functionId: string;
63
+ }
64
+
65
+ export interface IUpdateServiceDiscordComponentParams {
66
+ applicationId: string;
67
+ serviceId: string;
68
+ componentId: string;
69
+ }
70
+ export interface IUpdateServiceDiscordComponentBody {
71
+ customIdPrefix?: string;
72
+ kind?: DiscordComponentKind;
73
+ functionId?: string;
74
+ }
75
+
76
+ export interface IDeleteServiceDiscordComponentParams {
77
+ applicationId: string;
78
+ serviceId: string;
79
+ componentId: string;
80
+ }
81
+
82
+ export interface IGetServiceDiscordConnectionParams {
83
+ applicationId: string;
84
+ serviceId: string;
85
+ }
86
+
87
+ export interface ISetServiceDiscordTokenSecretParams {
88
+ applicationId: string;
89
+ serviceId: string;
90
+ }
91
+ export interface ISetServiceDiscordTokenSecretBody {
92
+ /** The Vault entry (a secret of the project) that holds the bot token, one value per environment. */
93
+ discordTokenSecretId: string;
94
+ }
95
+
96
+ export interface ISetServiceDiscordEnvironmentParams {
97
+ applicationId: string;
98
+ serviceId: string;
99
+ environmentId: string;
100
+ }
101
+ export interface ISetServiceDiscordEnvironmentBody {
102
+ /** Discord server (snowflake) the commands are pushed to outside production; null removes it. */
103
+ testGuildId?: string | null;
104
+ /** Discord permission bits as a decimal string, put in the invitation link. */
105
+ invitePermissions: string;
106
+ }
107
+
108
+ export interface ICheckServiceDiscordConnectionParams {
109
+ applicationId: string;
110
+ serviceId: string;
111
+ environmentId: string;
112
+ }
113
+
114
+ export interface IRetryServiceDiscordSyncParams {
115
+ applicationId: string;
116
+ serviceId: string;
117
+ environmentId: string;
118
+ }
@@ -14,6 +14,10 @@ export interface ICreateServiceBody {
14
14
  /** `^[a-z0-9][a-z0-9-]{0,39}$`, unique within the application, immutable. */
15
15
  slug: string;
16
16
  type: ServiceType;
17
+ /** Not for a `DISCORD_BOT` Service: `400 SERVICE_TYPE_FIELD_REFUSED`. */
18
+ cors?: IReflexServiceCors;
19
+ /** 1 to 6000. Not for a `DISCORD_BOT` Service: `400 SERVICE_TYPE_FIELD_REFUSED`. */
20
+ rateLimitPerIpPerMinute?: number;
17
21
  }
18
22
 
19
23
  export interface IGetServiceParams {
@@ -25,7 +29,10 @@ export interface IUpdateServiceParams {
25
29
  applicationId: string;
26
30
  serviceId: string;
27
31
  }
28
- /** Changes the draft: the next version freezes `cors` and `rateLimitPerIpPerMinute`. */
32
+ /**
33
+ * Changes the draft: the next version freezes `cors` and `rateLimitPerIpPerMinute`. Neither exists for a
34
+ * `DISCORD_BOT` Service (`400 SERVICE_TYPE_FIELD_REFUSED`).
35
+ */
29
36
  export interface IUpdateServiceBody {
30
37
  name?: string;
31
38
  cors?: IReflexServiceCors;
@@ -1,11 +1,12 @@
1
- export * from './function.response';
2
- export * from './function-access.response';
3
- export * from './function-test.response';
4
- export * from './function-version.response';
5
- export * from './function-run.response';
6
- export * from './function-settings.response';
7
- export * from './service.response';
8
- export * from './service-route.response';
9
- export * from './service-version.response';
10
- export * from './service-deployment.response';
11
- export * from './service-configuration.response';
1
+ export * from './function.response';
2
+ export * from './function-access.response';
3
+ export * from './function-test.response';
4
+ export * from './function-version.response';
5
+ export * from './function-run.response';
6
+ export * from './function-settings.response';
7
+ export * from './service.response';
8
+ export * from './service-route.response';
9
+ export * from './service-version.response';
10
+ export * from './service-deployment.response';
11
+ export * from './service-configuration.response';
12
+ export * from './service-discord.response';
@@ -1,8 +1,8 @@
1
- import type { IReflexServiceConfigurationEntry } from '../../models';
2
- import type { IResponse } from '../response';
3
-
4
- export interface IListServiceConfigurationData {
5
- /** One entry per key and way of reading it, by key then `readAs`. */
6
- configuration: IReflexServiceConfigurationEntry[];
7
- }
8
- export type IListServiceConfigurationResponse = IResponse<IListServiceConfigurationData>;
1
+ import type { IReflexServiceConfigurationEntry } from '../../models';
2
+ import type { IResponse } from '../response';
3
+
4
+ export interface IListServiceConfigurationData {
5
+ /** One entry per key and way of reading it, by key then `readAs`. */
6
+ configuration: IReflexServiceConfigurationEntry[];
7
+ }
8
+ export type IListServiceConfigurationResponse = IResponse<IListServiceConfigurationData>;
@@ -0,0 +1,72 @@
1
+ import type {
2
+ IReflexDiscordCommand,
3
+ IReflexDiscordComponent,
4
+ IReflexDiscordConnection,
5
+ IReflexDiscordEnvironmentConnection,
6
+ IReflexServiceDeployment,
7
+ } from '../../models';
8
+ import type { IResponse } from '../response';
9
+
10
+ export interface IListServiceDiscordCommandData {
11
+ /** By name. */
12
+ commands: IReflexDiscordCommand[];
13
+ }
14
+ export type IListServiceDiscordCommandResponse = IResponse<IListServiceDiscordCommandData>;
15
+
16
+ export interface ICreateServiceDiscordCommandData {
17
+ command: IReflexDiscordCommand;
18
+ }
19
+ export type ICreateServiceDiscordCommandResponse = IResponse<ICreateServiceDiscordCommandData>;
20
+
21
+ export interface IUpdateServiceDiscordCommandData {
22
+ command: IReflexDiscordCommand;
23
+ }
24
+ export type IUpdateServiceDiscordCommandResponse = IResponse<IUpdateServiceDiscordCommandData>;
25
+
26
+ export type IDeleteServiceDiscordCommandData = Record<string, never>;
27
+ export type IDeleteServiceDiscordCommandResponse = IResponse<IDeleteServiceDiscordCommandData>;
28
+
29
+ export interface IListServiceDiscordComponentData {
30
+ /** By prefix. */
31
+ components: IReflexDiscordComponent[];
32
+ }
33
+ export type IListServiceDiscordComponentResponse = IResponse<IListServiceDiscordComponentData>;
34
+
35
+ export interface ICreateServiceDiscordComponentData {
36
+ component: IReflexDiscordComponent;
37
+ }
38
+ export type ICreateServiceDiscordComponentResponse = IResponse<ICreateServiceDiscordComponentData>;
39
+
40
+ export interface IUpdateServiceDiscordComponentData {
41
+ component: IReflexDiscordComponent;
42
+ }
43
+ export type IUpdateServiceDiscordComponentResponse = IResponse<IUpdateServiceDiscordComponentData>;
44
+
45
+ export type IDeleteServiceDiscordComponentData = Record<string, never>;
46
+ export type IDeleteServiceDiscordComponentResponse = IResponse<IDeleteServiceDiscordComponentData>;
47
+
48
+ export interface IGetServiceDiscordConnectionData {
49
+ connection: IReflexDiscordConnection;
50
+ }
51
+ export type IGetServiceDiscordConnectionResponse = IResponse<IGetServiceDiscordConnectionData>;
52
+
53
+ export interface ISetServiceDiscordTokenSecretData {
54
+ connection: IReflexDiscordConnection;
55
+ }
56
+ export type ISetServiceDiscordTokenSecretResponse = IResponse<ISetServiceDiscordTokenSecretData>;
57
+
58
+ export interface ISetServiceDiscordEnvironmentData {
59
+ environment: IReflexDiscordEnvironmentConnection;
60
+ }
61
+ export type ISetServiceDiscordEnvironmentResponse = IResponse<ISetServiceDiscordEnvironmentData>;
62
+
63
+ export interface ICheckServiceDiscordConnectionData {
64
+ environment: IReflexDiscordEnvironmentConnection;
65
+ }
66
+ export type ICheckServiceDiscordConnectionResponse = IResponse<ICheckServiceDiscordConnectionData>;
67
+
68
+ export interface IRetryServiceDiscordSyncData {
69
+ /** The current deployment of the environment, with the new state of the synchronization. */
70
+ deployment: IReflexServiceDeployment;
71
+ }
72
+ export type IRetryServiceDiscordSyncResponse = IResponse<IRetryServiceDiscordSyncData>;
@@ -1,33 +1,62 @@
1
- import type { ServiceVersionChangeKind } from '../../../enum';
2
- import type { IReflexServiceVersion, IReflexServiceVersionRoute } from '../../models';
3
- import type { IResponse } from '../response';
4
-
5
- /** How one route differs from the previous version, matched by route id. */
6
- export interface IReflexServiceVersionRouteChange {
7
- routeId: string;
8
- kind: ServiceVersionChangeKind;
9
- /** The route in the previous version; null when ADDED. */
10
- before: IReflexServiceVersionRoute | null;
11
- /** The route in this version; null when REMOVED. */
12
- after: IReflexServiceVersionRoute | null;
13
- }
14
-
15
- export interface IListServiceVersionData {
16
- /** Newest first. */
17
- versions: IReflexServiceVersion[];
18
- }
19
- export type IListServiceVersionResponse = IResponse<IListServiceVersionData>;
20
-
21
- export interface ICreateServiceVersionData {
22
- version: IReflexServiceVersion;
23
- }
24
- export type ICreateServiceVersionResponse = IResponse<ICreateServiceVersionData>;
25
-
26
- export interface IGetServiceVersionData {
27
- version: IReflexServiceVersion;
28
- /** The version just before; null for the first one. */
29
- previousVersion: IReflexServiceVersion | null;
30
- /** The routes added, removed or modified since `previousVersion` (every route is ADDED for the first one). */
31
- routeChanges: IReflexServiceVersionRouteChange[];
32
- }
33
- export type IGetServiceVersionResponse = IResponse<IGetServiceVersionData>;
1
+ import type { ServiceVersionChangeKind } from '../../../enum';
2
+ import type {
3
+ IReflexDiscordCommandSnapshot,
4
+ IReflexDiscordComponentSnapshot,
5
+ IReflexServiceVersion,
6
+ IReflexServiceVersionRoute,
7
+ } from '../../models';
8
+ import type { IResponse } from '../response';
9
+
10
+ /** How one route differs from the previous version, matched by route id. */
11
+ export interface IReflexServiceVersionRouteChange {
12
+ routeId: string;
13
+ kind: ServiceVersionChangeKind;
14
+ /** The route in the previous version; null when ADDED. */
15
+ before: IReflexServiceVersionRoute | null;
16
+ /** The route in this version; null when REMOVED. */
17
+ after: IReflexServiceVersionRoute | null;
18
+ }
19
+
20
+ /** How one command of a Discord bot differs from the previous version, matched by command id. */
21
+ export interface IReflexServiceVersionCommandChange {
22
+ commandId: string;
23
+ kind: ServiceVersionChangeKind;
24
+ /** The command in the previous version; null when ADDED. */
25
+ before: IReflexDiscordCommandSnapshot | null;
26
+ /** The command in this version; null when REMOVED. */
27
+ after: IReflexDiscordCommandSnapshot | null;
28
+ }
29
+
30
+ /** How one component of a Discord bot differs from the previous version, matched by component id. */
31
+ export interface IReflexServiceVersionComponentChange {
32
+ componentId: string;
33
+ kind: ServiceVersionChangeKind;
34
+ /** The component in the previous version; null when ADDED. */
35
+ before: IReflexDiscordComponentSnapshot | null;
36
+ /** The component in this version; null when REMOVED. */
37
+ after: IReflexDiscordComponentSnapshot | null;
38
+ }
39
+
40
+ export interface IListServiceVersionData {
41
+ /** Newest first. */
42
+ versions: IReflexServiceVersion[];
43
+ }
44
+ export type IListServiceVersionResponse = IResponse<IListServiceVersionData>;
45
+
46
+ export interface ICreateServiceVersionData {
47
+ version: IReflexServiceVersion;
48
+ }
49
+ export type ICreateServiceVersionResponse = IResponse<ICreateServiceVersionData>;
50
+
51
+ export interface IGetServiceVersionData {
52
+ version: IReflexServiceVersion;
53
+ /** The version just before; null for the first one. */
54
+ previousVersion: IReflexServiceVersion | null;
55
+ /** The routes added, removed or modified since `previousVersion` (every route is ADDED for the first one). */
56
+ routeChanges: IReflexServiceVersionRouteChange[];
57
+ /** The commands added, removed or modified since `previousVersion`; empty for a Service that is not a Discord bot. */
58
+ commandChanges: IReflexServiceVersionCommandChange[];
59
+ /** The components added, removed or modified since `previousVersion`; empty for a Service that is not a Discord bot. */
60
+ componentChanges: IReflexServiceVersionComponentChange[];
61
+ }
62
+ export type IGetServiceVersionResponse = IResponse<IGetServiceVersionData>;
@@ -1,13 +1,14 @@
1
- export * from './reflex-definition.model';
2
- export * from './reflex-function.model';
3
- export * from './reflex-function-version.model';
4
- export * from './reflex-access-grant.model';
5
- export * from './reflex-run.model';
6
- export * from './reflex-execution-settings.model';
7
- export * from './reflex-step-stats.model';
8
- export * from './reflex-price-list.model';
9
- export * from './reflex-service.model';
10
- export * from './reflex-route.model';
11
- export * from './reflex-service-version.model';
12
- export * from './reflex-service-deployment.model';
13
- export * from './reflex-service-configuration.model';
1
+ export * from './reflex-definition.model';
2
+ export * from './reflex-function.model';
3
+ export * from './reflex-function-version.model';
4
+ export * from './reflex-access-grant.model';
5
+ export * from './reflex-run.model';
6
+ export * from './reflex-execution-settings.model';
7
+ export * from './reflex-step-stats.model';
8
+ export * from './reflex-price-list.model';
9
+ export * from './reflex-service.model';
10
+ export * from './reflex-route.model';
11
+ export * from './reflex-service-version.model';
12
+ export * from './reflex-service-deployment.model';
13
+ export * from './reflex-service-configuration.model';
14
+ export * from './reflex-discord.model';
@@ -0,0 +1,117 @@
1
+ import type { DiscordComponentKind, DiscordOptionType, DiscordTokenState } from '../../enum';
2
+
3
+ /** Bounds of the commands and components of a Discord bot; the API and its database apply the same ones. */
4
+ export const REFLEX_DISCORD_LIMITS = {
5
+ /** `^[-_a-z0-9]{1,32}$`: the name typed after the slash. */
6
+ commandNamePattern: /^[-_a-z0-9]{1,32}$/,
7
+ commandDescriptionMaxLength: 100,
8
+ commandsPerServiceMax: 100,
9
+ optionsPerCommandMax: 25,
10
+ choicesPerOptionMax: 25,
11
+ /** `^[a-z0-9_-]{1,40}$`: the start of the `custom_id` of a button, a menu or a form. */
12
+ componentPrefixPattern: /^[a-z0-9_-]{1,40}$/,
13
+ syncErrorMaxLength: 500,
14
+ } as const;
15
+
16
+ /** A fixed answer a user picks for a STRING, INTEGER or NUMBER option. */
17
+ export interface IReflexDiscordOptionChoice {
18
+ name: string;
19
+ value: string | number;
20
+ }
21
+
22
+ /** An option of a command. Required options come first. */
23
+ export interface IReflexDiscordCommandOption {
24
+ type: DiscordOptionType;
25
+ /** Same pattern as the command name. */
26
+ name: string;
27
+ /** 1 to 100 characters. */
28
+ description: string;
29
+ required: boolean;
30
+ /** 25 at most, only for STRING, INTEGER and NUMBER. */
31
+ choices?: IReflexDiscordOptionChoice[];
32
+ }
33
+
34
+ /** A slash command of the draft of a Discord bot Service. */
35
+ export interface IReflexDiscordCommand {
36
+ id: string;
37
+ serviceId: string;
38
+ /** A function of the same Service. */
39
+ functionId: string;
40
+ /** Unique within the Service. */
41
+ name: string;
42
+ description: string;
43
+ options: IReflexDiscordCommandOption[];
44
+ /** Discord permission bits as a decimal string, or null for everyone. */
45
+ defaultMemberPermissions: string | null;
46
+ allowedInDirectMessages: boolean;
47
+ createdAt: Date;
48
+ updatedAt: Date;
49
+ }
50
+
51
+ /** A button, select menu or form of the draft of a Discord bot Service, routed by the start of its `custom_id`. */
52
+ export interface IReflexDiscordComponent {
53
+ id: string;
54
+ serviceId: string;
55
+ /** A function of the same Service. */
56
+ functionId: string;
57
+ /** Unique within the Service; no prefix starts another one. An interaction matches the prefix followed by `:`, or equal to its `custom_id`. */
58
+ customIdPrefix: string;
59
+ kind: DiscordComponentKind;
60
+ createdAt: Date;
61
+ updatedAt: Date;
62
+ }
63
+
64
+ /** A command as a version of the Service froze it. */
65
+ export type IReflexDiscordCommandSnapshot = Pick<
66
+ IReflexDiscordCommand,
67
+ | 'id'
68
+ | 'functionId'
69
+ | 'name'
70
+ | 'description'
71
+ | 'options'
72
+ | 'defaultMemberPermissions'
73
+ | 'allowedInDirectMessages'
74
+ >;
75
+
76
+ /** A component as a version of the Service froze it. */
77
+ export type IReflexDiscordComponentSnapshot = Pick<
78
+ IReflexDiscordComponent,
79
+ 'id' | 'functionId' | 'customIdPrefix' | 'kind'
80
+ >;
81
+
82
+ /** Settings of a Discord bot Service in one environment, kept outside the versions. */
83
+ export interface IReflexDiscordEnvironmentSettings {
84
+ id: string;
85
+ serviceId: string;
86
+ environmentId: string;
87
+ /** Discord server (snowflake) the commands are pushed to outside production; required there. */
88
+ testGuildId: string | null;
89
+ /** Discord permission bits as a decimal string, put in the invitation link. */
90
+ invitePermissions: string;
91
+ createdAt: Date;
92
+ updatedAt: Date;
93
+ }
94
+
95
+ /** What the Connection screen shows of the bot of one environment. Never carries the token. */
96
+ export interface IReflexDiscordEnvironmentConnection {
97
+ environmentId: string;
98
+ /** The Discord application read from the token; null while the token is missing, rejected or unchecked. */
99
+ applicationId: string | null;
100
+ publicKey: string | null;
101
+ botName: string | null;
102
+ botAvatarUrl: string | null;
103
+ tokenState: DiscordTokenState;
104
+ testGuildId: string | null;
105
+ invitePermissions: string;
106
+ /** Address to give Discord for interactions in this environment. */
107
+ interactionsUrl: string;
108
+ /** Link that adds the bot to a Discord server; null while the application is unknown. */
109
+ inviteUrl: string | null;
110
+ }
111
+
112
+ /** The Vault entry holding the token, and the bot of each environment of the application. */
113
+ export interface IReflexDiscordConnection {
114
+ /** Vault entry (secret) that holds the bot token, one value per environment; null until chosen. */
115
+ discordTokenSecretId: string | null;
116
+ environments: IReflexDiscordEnvironmentConnection[];
117
+ }