@abyss-project/reflex 3.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 (151) hide show
  1. package/dist/api/index.d.ts +2 -1
  2. package/dist/api/index.js +2 -1
  3. package/dist/api/index.js.map +1 -1
  4. package/dist/api/service-configuration.api.d.ts +2 -0
  5. package/dist/api/service-configuration.api.js +7 -0
  6. package/dist/api/service-configuration.api.js.map +1 -0
  7. package/dist/api/service-discord.api.d.ts +14 -0
  8. package/dist/api/service-discord.api.js +38 -0
  9. package/dist/api/service-discord.api.js.map +1 -0
  10. package/dist/index.d.ts +25 -6
  11. package/dist/index.js +25 -6
  12. package/dist/index.js.map +1 -1
  13. package/dist/types/enum/configuration-read-as.enum.d.ts +4 -0
  14. package/dist/types/enum/configuration-read-as.enum.js +9 -0
  15. package/dist/types/enum/configuration-read-as.enum.js.map +1 -0
  16. package/dist/types/enum/discord-component-kind.enum.d.ts +4 -0
  17. package/dist/types/enum/discord-component-kind.enum.js +9 -0
  18. package/dist/types/enum/discord-component-kind.enum.js.map +1 -0
  19. package/dist/types/enum/discord-option-type.enum.d.ts +11 -0
  20. package/dist/types/enum/discord-option-type.enum.js +16 -0
  21. package/dist/types/enum/discord-option-type.enum.js.map +1 -0
  22. package/dist/types/enum/discord-sync-status.enum.d.ts +5 -0
  23. package/dist/types/enum/discord-sync-status.enum.js +10 -0
  24. package/dist/types/enum/discord-sync-status.enum.js.map +1 -0
  25. package/dist/types/enum/discord-token-state.enum.d.ts +6 -0
  26. package/dist/types/enum/discord-token-state.enum.js +11 -0
  27. package/dist/types/enum/discord-token-state.enum.js.map +1 -0
  28. package/dist/types/enum/index.d.ts +7 -1
  29. package/dist/types/enum/index.js +7 -1
  30. package/dist/types/enum/index.js.map +1 -1
  31. package/dist/types/enum/reflex-error-code.enum.d.ts +7 -1
  32. package/dist/types/enum/reflex-error-code.enum.js +6 -0
  33. package/dist/types/enum/reflex-error-code.enum.js.map +1 -1
  34. package/dist/types/enum/service-type.enum.d.ts +2 -1
  35. package/dist/types/enum/service-type.enum.js +1 -0
  36. package/dist/types/enum/service-type.enum.js.map +1 -1
  37. package/dist/types/enum/vault-value-source.enum.d.ts +6 -0
  38. package/dist/types/enum/vault-value-source.enum.js +11 -0
  39. package/dist/types/enum/vault-value-source.enum.js.map +1 -0
  40. package/dist/types/enum/vault-visibility.enum.d.ts +4 -0
  41. package/dist/types/enum/vault-visibility.enum.js +9 -0
  42. package/dist/types/enum/vault-visibility.enum.js.map +1 -0
  43. package/dist/types/interface/api/requests/index.d.ts +2 -1
  44. package/dist/types/interface/api/requests/index.js +2 -1
  45. package/dist/types/interface/api/requests/index.js.map +1 -1
  46. package/dist/types/interface/api/requests/service-configuration.request.d.ts +4 -0
  47. package/dist/types/interface/{models/reflex-service-variable.model.js → api/requests/service-configuration.request.js} +1 -1
  48. package/dist/types/interface/api/requests/service-configuration.request.js.map +1 -0
  49. package/dist/types/interface/api/requests/service-discord.request.d.ts +94 -0
  50. package/dist/types/interface/api/requests/{service-variable.request.js → service-discord.request.js} +1 -1
  51. package/dist/types/interface/api/requests/service-discord.request.js.map +1 -0
  52. package/dist/types/interface/api/requests/service.request.d.ts +2 -0
  53. package/dist/types/interface/api/responses/index.d.ts +2 -1
  54. package/dist/types/interface/api/responses/index.js +2 -1
  55. package/dist/types/interface/api/responses/index.js.map +1 -1
  56. package/dist/types/interface/api/responses/service-configuration.response.d.ts +6 -0
  57. package/dist/types/interface/api/responses/service-configuration.response.js +3 -0
  58. package/dist/types/interface/api/responses/service-configuration.response.js.map +1 -0
  59. package/dist/types/interface/api/responses/service-discord.response.d.ts +50 -0
  60. package/dist/types/interface/api/responses/{service-variable.response.js → service-discord.response.js} +1 -1
  61. package/dist/types/interface/api/responses/service-discord.response.js.map +1 -0
  62. package/dist/types/interface/api/responses/service-version.response.d.ts +15 -1
  63. package/dist/types/interface/models/index.d.ts +2 -1
  64. package/dist/types/interface/models/index.js +2 -1
  65. package/dist/types/interface/models/index.js.map +1 -1
  66. package/dist/types/interface/models/reflex-discord.model.d.ts +69 -0
  67. package/dist/types/interface/models/reflex-discord.model.js +13 -0
  68. package/dist/types/interface/models/reflex-discord.model.js.map +1 -0
  69. package/dist/types/interface/models/reflex-run.model.d.ts +3 -0
  70. package/dist/types/interface/models/reflex-service-configuration.model.d.ts +9 -0
  71. package/dist/types/interface/models/reflex-service-configuration.model.js +3 -0
  72. package/dist/types/interface/models/reflex-service-configuration.model.js.map +1 -0
  73. package/dist/types/interface/models/reflex-service-deployment.model.d.ts +5 -1
  74. package/dist/types/interface/models/reflex-service-version.model.d.ts +6 -0
  75. package/dist/types/interface/models/reflex-service.model.d.ts +1 -2
  76. package/dist/types/interface/models/reflex-service.model.js +0 -2
  77. package/dist/types/interface/models/reflex-service.model.js.map +1 -1
  78. package/package.json +1 -1
  79. package/src/api/function-run.api.ts +38 -38
  80. package/src/api/function-version.api.ts +48 -48
  81. package/src/api/function.api.test.ts +249 -249
  82. package/src/api/index.ts +13 -12
  83. package/src/api/service-configuration.api.ts +16 -0
  84. package/src/api/service-deployment.api.ts +79 -79
  85. package/src/api/service-discord.api.test.ts +170 -0
  86. package/src/api/service-discord.api.ts +203 -0
  87. package/src/api/service-route.api.ts +72 -72
  88. package/src/api/service-version.api.ts +39 -39
  89. package/src/api/service.api.test.ts +209 -234
  90. package/src/api/service.api.ts +55 -55
  91. package/src/index.ts +50 -11
  92. package/src/types/enum/configuration-read-as.enum.ts +5 -0
  93. package/src/types/enum/discord-component-kind.enum.ts +7 -0
  94. package/src/types/enum/discord-option-type.enum.ts +12 -0
  95. package/src/types/enum/discord-sync-status.enum.ts +6 -0
  96. package/src/types/enum/discord-token-state.enum.ts +11 -0
  97. package/src/types/enum/execution-mode.enum.ts +9 -9
  98. package/src/types/enum/index.ts +25 -19
  99. package/src/types/enum/reflex-error-code.enum.ts +37 -25
  100. package/src/types/enum/route-method.enum.ts +9 -9
  101. package/src/types/enum/service-deployment-action.enum.ts +11 -11
  102. package/src/types/enum/service-deployment-status.enum.ts +5 -5
  103. package/src/types/enum/service-type.enum.ts +9 -7
  104. package/src/types/enum/service-version-change-kind.enum.ts +6 -6
  105. package/src/types/enum/trigger-access-mode.enum.ts +12 -12
  106. package/src/types/enum/vault-value-source.enum.ts +12 -0
  107. package/src/types/enum/vault-visibility.enum.ts +5 -0
  108. package/src/types/interface/api/requests/function-run.request.ts +26 -26
  109. package/src/types/interface/api/requests/function-version.request.ts +20 -20
  110. package/src/types/interface/api/requests/function.request.ts +36 -36
  111. package/src/types/interface/api/requests/index.ts +12 -11
  112. package/src/types/interface/api/requests/service-configuration.request.ts +4 -0
  113. package/src/types/interface/api/requests/service-deployment.request.ts +49 -49
  114. package/src/types/interface/api/requests/service-discord.request.ts +118 -0
  115. package/src/types/interface/api/requests/service-route.request.ts +44 -44
  116. package/src/types/interface/api/requests/service-version.request.ts +19 -19
  117. package/src/types/interface/api/requests/service.request.ts +46 -39
  118. package/src/types/interface/api/responses/function-version.response.ts +31 -31
  119. package/src/types/interface/api/responses/index.ts +12 -11
  120. package/src/types/interface/api/responses/service-configuration.response.ts +8 -0
  121. package/src/types/interface/api/responses/service-deployment.response.ts +32 -32
  122. package/src/types/interface/api/responses/service-discord.response.ts +72 -0
  123. package/src/types/interface/api/responses/service-route.response.ts +31 -31
  124. package/src/types/interface/api/responses/service-version.response.ts +30 -1
  125. package/src/types/interface/api/responses/service.response.ts +31 -31
  126. package/src/types/interface/models/index.ts +14 -13
  127. package/src/types/interface/models/reflex-discord.model.ts +117 -0
  128. package/src/types/interface/models/reflex-function.model.ts +16 -16
  129. package/src/types/interface/models/reflex-route.model.ts +19 -19
  130. package/src/types/interface/models/reflex-run.model.ts +10 -1
  131. package/src/types/interface/models/reflex-service-configuration.model.ts +22 -0
  132. package/src/types/interface/models/reflex-service-deployment.model.ts +40 -29
  133. package/src/types/interface/models/reflex-service-version.model.ts +55 -43
  134. package/src/types/interface/models/reflex-service.model.ts +45 -46
  135. package/dist/api/service-variable.api.d.ts +0 -5
  136. package/dist/api/service-variable.api.js +0 -16
  137. package/dist/api/service-variable.api.js.map +0 -1
  138. package/dist/types/enum/secret-source.enum.d.ts +0 -5
  139. package/dist/types/enum/secret-source.enum.js +0 -10
  140. package/dist/types/enum/secret-source.enum.js.map +0 -1
  141. package/dist/types/interface/api/requests/service-variable.request.d.ts +0 -23
  142. package/dist/types/interface/api/requests/service-variable.request.js.map +0 -1
  143. package/dist/types/interface/api/responses/service-variable.response.d.ts +0 -22
  144. package/dist/types/interface/api/responses/service-variable.response.js.map +0 -1
  145. package/dist/types/interface/models/reflex-service-variable.model.d.ts +0 -10
  146. package/dist/types/interface/models/reflex-service-variable.model.js.map +0 -1
  147. package/src/api/service-variable.api.ts +0 -58
  148. package/src/types/enum/secret-source.enum.ts +0 -9
  149. package/src/types/interface/api/requests/service-variable.request.ts +0 -29
  150. package/src/types/interface/api/responses/service-variable.response.ts +0 -31
  151. package/src/types/interface/models/reflex-service-variable.model.ts +0 -16
@@ -1,31 +1,31 @@
1
- import type { IReflexRoute } from '../../models';
2
- import type { IResponse } from '../response';
3
-
4
- export interface IListServiceRouteData {
5
- routes: IReflexRoute[];
6
- }
7
- export type IListServiceRouteResponse = IResponse<IListServiceRouteData>;
8
-
9
- export interface ICreateServiceRouteData {
10
- route: IReflexRoute;
11
- /** The API key (API_KEY) or the signing secret (SIGNATURE), in clear, ONCE. `null` for PUBLIC. */
12
- secret: string | null;
13
- }
14
- export type ICreateServiceRouteResponse = IResponse<ICreateServiceRouteData>;
15
-
16
- export interface IUpdateServiceRouteData {
17
- route: IReflexRoute;
18
- /** A new key or signing secret, in clear, ONCE, when the change of `accessMode` needs one; `null` otherwise. */
19
- secret: string | null;
20
- }
21
- export type IUpdateServiceRouteResponse = IResponse<IUpdateServiceRouteData>;
22
-
23
- export type IDeleteServiceRouteData = Record<string, never>;
24
- export type IDeleteServiceRouteResponse = IResponse<IDeleteServiceRouteData>;
25
-
26
- export interface IRotateServiceRouteData {
27
- route: IReflexRoute;
28
- /** The new key or signing secret, in clear, ONCE; the previous one stops working at once. */
29
- secret: string;
30
- }
31
- export type IRotateServiceRouteResponse = IResponse<IRotateServiceRouteData>;
1
+ import type { IReflexRoute } from '../../models';
2
+ import type { IResponse } from '../response';
3
+
4
+ export interface IListServiceRouteData {
5
+ routes: IReflexRoute[];
6
+ }
7
+ export type IListServiceRouteResponse = IResponse<IListServiceRouteData>;
8
+
9
+ export interface ICreateServiceRouteData {
10
+ route: IReflexRoute;
11
+ /** The API key (API_KEY) or the signing secret (SIGNATURE), in clear, ONCE. `null` for PUBLIC. */
12
+ secret: string | null;
13
+ }
14
+ export type ICreateServiceRouteResponse = IResponse<ICreateServiceRouteData>;
15
+
16
+ export interface IUpdateServiceRouteData {
17
+ route: IReflexRoute;
18
+ /** A new key or signing secret, in clear, ONCE, when the change of `accessMode` needs one; `null` otherwise. */
19
+ secret: string | null;
20
+ }
21
+ export type IUpdateServiceRouteResponse = IResponse<IUpdateServiceRouteData>;
22
+
23
+ export type IDeleteServiceRouteData = Record<string, never>;
24
+ export type IDeleteServiceRouteResponse = IResponse<IDeleteServiceRouteData>;
25
+
26
+ export interface IRotateServiceRouteData {
27
+ route: IReflexRoute;
28
+ /** The new key or signing secret, in clear, ONCE; the previous one stops working at once. */
29
+ secret: string;
30
+ }
31
+ export type IRotateServiceRouteResponse = IResponse<IRotateServiceRouteData>;
@@ -1,5 +1,10 @@
1
1
  import type { ServiceVersionChangeKind } from '../../../enum';
2
- import type { IReflexServiceVersion, IReflexServiceVersionRoute } from '../../models';
2
+ import type {
3
+ IReflexDiscordCommandSnapshot,
4
+ IReflexDiscordComponentSnapshot,
5
+ IReflexServiceVersion,
6
+ IReflexServiceVersionRoute,
7
+ } from '../../models';
3
8
  import type { IResponse } from '../response';
4
9
 
5
10
  /** How one route differs from the previous version, matched by route id. */
@@ -12,6 +17,26 @@ export interface IReflexServiceVersionRouteChange {
12
17
  after: IReflexServiceVersionRoute | null;
13
18
  }
14
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
+
15
40
  export interface IListServiceVersionData {
16
41
  /** Newest first. */
17
42
  versions: IReflexServiceVersion[];
@@ -29,5 +54,9 @@ export interface IGetServiceVersionData {
29
54
  previousVersion: IReflexServiceVersion | null;
30
55
  /** The routes added, removed or modified since `previousVersion` (every route is ADDED for the first one). */
31
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[];
32
61
  }
33
62
  export type IGetServiceVersionResponse = IResponse<IGetServiceVersionData>;
@@ -1,31 +1,31 @@
1
- import type { IReflexService, IReflexServiceDeployment } from '../../models';
2
- import type { IResponse } from '../response';
3
-
4
- /** A Service with what runs in each environment of the application. */
5
- export interface IReflexServiceListItem extends IReflexService {
6
- /** The current deployment of each environment where the Service was ever put in service. */
7
- currentDeployments: IReflexServiceDeployment[];
8
- }
9
-
10
- export interface IListServiceData {
11
- services: IReflexServiceListItem[];
12
- }
13
- export type IListServiceResponse = IResponse<IListServiceData>;
14
-
15
- export interface ICreateServiceData {
16
- service: IReflexService;
17
- }
18
- export type ICreateServiceResponse = IResponse<ICreateServiceData>;
19
-
20
- export interface IGetServiceData {
21
- service: IReflexService;
22
- }
23
- export type IGetServiceResponse = IResponse<IGetServiceData>;
24
-
25
- export interface IUpdateServiceData {
26
- service: IReflexService;
27
- }
28
- export type IUpdateServiceResponse = IResponse<IUpdateServiceData>;
29
-
30
- export type IDeleteServiceData = Record<string, never>;
31
- export type IDeleteServiceResponse = IResponse<IDeleteServiceData>;
1
+ import type { IReflexService, IReflexServiceDeployment } from '../../models';
2
+ import type { IResponse } from '../response';
3
+
4
+ /** A Service with what runs in each environment of the application. */
5
+ export interface IReflexServiceListItem extends IReflexService {
6
+ /** The current deployment of each environment where the Service was ever put in service. */
7
+ currentDeployments: IReflexServiceDeployment[];
8
+ }
9
+
10
+ export interface IListServiceData {
11
+ services: IReflexServiceListItem[];
12
+ }
13
+ export type IListServiceResponse = IResponse<IListServiceData>;
14
+
15
+ export interface ICreateServiceData {
16
+ service: IReflexService;
17
+ }
18
+ export type ICreateServiceResponse = IResponse<ICreateServiceData>;
19
+
20
+ export interface IGetServiceData {
21
+ service: IReflexService;
22
+ }
23
+ export type IGetServiceResponse = IResponse<IGetServiceData>;
24
+
25
+ export interface IUpdateServiceData {
26
+ service: IReflexService;
27
+ }
28
+ export type IUpdateServiceResponse = IResponse<IUpdateServiceData>;
29
+
30
+ export type IDeleteServiceData = Record<string, never>;
31
+ export type IDeleteServiceResponse = IResponse<IDeleteServiceData>;
@@ -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-variable.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
+ }
@@ -1,16 +1,16 @@
1
- import type { IReflexDefinition } from './reflex-definition.model';
2
-
3
- export interface IReflexFunction {
4
- id: string;
5
- applicationId: string;
6
- /** The Service the function belongs to; deleting the Service deletes it. */
7
- serviceId: string;
8
- projectId: string;
9
- name: string;
10
- /** The definition being edited; a publication freezes a copy of it. */
11
- draftDefinition: IReflexDefinition;
12
- createdByUserId: string;
13
- updatedByUserId: string;
14
- createdAt: Date;
15
- updatedAt: Date;
16
- }
1
+ import type { IReflexDefinition } from './reflex-definition.model';
2
+
3
+ export interface IReflexFunction {
4
+ id: string;
5
+ applicationId: string;
6
+ /** The Service the function belongs to; deleting the Service deletes it. */
7
+ serviceId: string;
8
+ projectId: string;
9
+ name: string;
10
+ /** The definition being edited; a publication freezes a copy of it. */
11
+ draftDefinition: IReflexDefinition;
12
+ createdByUserId: string;
13
+ updatedByUserId: string;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
@@ -1,19 +1,19 @@
1
- import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
-
3
- /**
4
- * A route of the draft of a Service: callable only once a version that holds it is in service in the
5
- * environment. Never carries the key or the signing secret: they are shown once, when created or rotated.
6
- */
7
- export interface IReflexRoute {
8
- id: string;
9
- serviceId: string;
10
- /** A function of the same Service. */
11
- functionId: string;
12
- method: RouteMethod;
13
- /** Segments of `[a-z0-9._~-]` or `:param` joined by `/`, without leading or trailing slash; 20 at most. */
14
- path: string;
15
- accessMode: TriggerAccessMode;
16
- createdByUserId: string;
17
- createdAt: Date;
18
- updatedAt: Date;
19
- }
1
+ import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
+
3
+ /**
4
+ * A route of the draft of a Service: callable only once a version that holds it is in service in the
5
+ * environment. Never carries the key or the signing secret: they are shown once, when created or rotated.
6
+ */
7
+ export interface IReflexRoute {
8
+ id: string;
9
+ serviceId: string;
10
+ /** A function of the same Service. */
11
+ functionId: string;
12
+ method: RouteMethod;
13
+ /** Segments of `[a-z0-9._~-]` or `:param` joined by `/`, without leading or trailing slash; 20 at most. */
14
+ path: string;
15
+ accessMode: TriggerAccessMode;
16
+ createdByUserId: string;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ }
@@ -64,8 +64,17 @@ export interface IReflexRun {
64
64
  durationMs: number;
65
65
  /** The effects of a test run; null for a LIVE run, which records no trace (nothing of the caller is kept). */
66
66
  trace: IReflexRunTrace | null;
67
- /** The route that started a LIVE run; null for a test run. */
67
+ /** The route that started a LIVE run; null for a test run and for a run a Discord command or component started. */
68
68
  routeId: string | null;
69
+ /** The Discord command that started a LIVE run; null otherwise. */
70
+ commandId: string | null;
71
+ /** The Discord component that started a LIVE run; null otherwise. */
72
+ componentId: string | null;
73
+ /**
74
+ * What started the run, for a screen: `METHOD path` for a route, `/name` for a command, the custom id
75
+ * prefix for a component. Null for a test run, and when the route, command or component was deleted.
76
+ */
77
+ originLabel: string | null;
69
78
  /** The HTTP status the caller of a LIVE run got; null for a test run. */
70
79
  httpStatus: number | null;
71
80
  /** The code of the error a failed LIVE run answered (FUNCTION_FAILED, FUNCTION_TIMEOUT, RUNNER_UNAVAILABLE, RUNNER_SATURATED, INTERNAL_ERROR); null otherwise, an interrupted run included. */
@@ -0,0 +1,22 @@
1
+ import type { ConfigurationReadAs, VaultValueSource, VaultVisibility } from '../../enum';
2
+
3
+ /**
4
+ * A key the functions of a Service read (its draft and its versions in service), and what the Console
5
+ * vault gives it in each environment of the application. Never a value.
6
+ */
7
+ export interface IReflexServiceConfigurationEntry {
8
+ key: string;
9
+ /** `config` for `config.KEY` / `{{ config.KEY }}`, `secrets` for `secrets.KEY` / `{{ secrets.KEY }}`. */
10
+ readAs: ConfigurationReadAs;
11
+ /** The Console vault entry of that key in the project; null when there is none. */
12
+ secretId: string | null;
13
+ /** The visibility of that entry; null when there is none. */
14
+ visibility: VaultVisibility | null;
15
+ /**
16
+ * True when the entry cannot answer this read: a `config` key bound to a SECRET entry, or a `secrets`
17
+ * key bound to a VISIBLE one. Every source is then ABSENT, the key never resolves.
18
+ */
19
+ mismatch: boolean;
20
+ /** By environment id of the application. */
21
+ sources: Record<string, VaultValueSource>;
22
+ }
@@ -1,29 +1,40 @@
1
- import type { ServiceDeploymentAction, ServiceDeploymentStatus } from '../../enum';
2
- import type { IReflexAccessDeclaration } from './reflex-definition.model';
3
-
4
- /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
5
- export interface IReflexServiceDeploymentGrant {
6
- functionId: string;
7
- grants: IReflexAccessDeclaration[];
8
- }
9
-
10
- /**
11
- * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
12
- * is paused) there; the others are the history a rollback reads.
13
- */
14
- export interface IReflexServiceDeployment {
15
- id: string;
16
- serviceId: string;
17
- /** The environment of the application (abyss-main's id). */
18
- environmentId: string;
19
- /** The name of that environment, second segment of the address. */
20
- environmentSlug: string;
21
- serviceVersionId: string;
22
- serviceVersionNumber: number;
23
- action: ServiceDeploymentAction;
24
- status: ServiceDeploymentStatus;
25
- grants: IReflexServiceDeploymentGrant[];
26
- isCurrent: boolean;
27
- byUserId: string;
28
- at: Date;
29
- }
1
+ import type {
2
+ DiscordSyncStatus,
3
+ ServiceDeploymentAction,
4
+ ServiceDeploymentStatus,
5
+ } from '../../enum';
6
+ import type { IReflexAccessDeclaration } from './reflex-definition.model';
7
+
8
+ /** The accesses granted to one member function when the gesture was made: what the execution plane holds. */
9
+ export interface IReflexServiceDeploymentGrant {
10
+ functionId: string;
11
+ grants: IReflexAccessDeclaration[];
12
+ }
13
+
14
+ /**
15
+ * One gesture on the Service in an environment of the application. The `isCurrent` row is what runs (or
16
+ * is paused) there; the others are the history a rollback reads.
17
+ */
18
+ export interface IReflexServiceDeployment {
19
+ id: string;
20
+ serviceId: string;
21
+ /** The environment of the application (abyss-main's id). */
22
+ environmentId: string;
23
+ /** The name of that environment, second segment of the address. */
24
+ environmentSlug: string;
25
+ serviceVersionId: string;
26
+ serviceVersionNumber: number;
27
+ action: ServiceDeploymentAction;
28
+ status: ServiceDeploymentStatus;
29
+ grants: IReflexServiceDeploymentGrant[];
30
+ /** Push of the interactions address and the commands to Discord; null for a Service that is not a Discord bot. */
31
+ discordSync: DiscordSyncStatus | null;
32
+ /** Code and message of the Discord refusal when `discordSync` is FAILED (500 characters at most). */
33
+ discordSyncError: string | null;
34
+ discordSyncedAt: Date | null;
35
+ /** The bot was paused by the plan quota (ADR-0277), not by a member: only those resume with the plan. */
36
+ pausedForQuota: boolean;
37
+ isCurrent: boolean;
38
+ byUserId: string;
39
+ at: Date;
40
+ }
@@ -1,43 +1,55 @@
1
- import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
- import type { IReflexServiceCors } from './reflex-service.model';
3
-
4
- /** A route as a version of the Service froze it. */
5
- export interface IReflexServiceVersionRoute {
6
- routeId: string;
7
- method: RouteMethod;
8
- path: string;
9
- functionId: string;
10
- accessMode: TriggerAccessMode;
11
- }
12
-
13
- /** The version of a member function a version of the Service runs. */
14
- export interface IReflexServiceVersionFunction {
15
- functionId: string;
16
- functionVersionId: string;
17
- functionVersionNumber: number;
18
- }
19
-
20
- /**
21
- * What a version of the Service freezes. Routes sorted by path then method, functions by id: the same
22
- * Service always gives the same snapshot, and the same `hash`.
23
- */
24
- export interface IReflexServiceVersionSnapshot {
25
- routes: IReflexServiceVersionRoute[];
26
- functions: IReflexServiceVersionFunction[];
27
- cors: IReflexServiceCors;
28
- rateLimitPerIpPerMinute: number;
29
- }
30
-
31
- export interface IReflexServiceVersion {
32
- id: string;
33
- serviceId: string;
34
- /** 1, 2, 3...: counted per Service. */
35
- number: number;
36
- /** 500 characters at most. */
37
- message: string | null;
38
- snapshot: IReflexServiceVersionSnapshot;
39
- /** SHA-256 of the snapshot as canonical JSON (keys sorted), lowercase hex. */
40
- hash: string;
41
- publishedByUserId: string;
42
- publishedAt: Date;
43
- }
1
+ import type { RouteMethod, TriggerAccessMode } from '../../enum';
2
+ import type {
3
+ IReflexDiscordCommandSnapshot,
4
+ IReflexDiscordComponentSnapshot,
5
+ } from './reflex-discord.model';
6
+ import type { IReflexServiceCors } from './reflex-service.model';
7
+
8
+ /** A route as a version of the Service froze it. */
9
+ export interface IReflexServiceVersionRoute {
10
+ routeId: string;
11
+ method: RouteMethod;
12
+ path: string;
13
+ functionId: string;
14
+ accessMode: TriggerAccessMode;
15
+ }
16
+
17
+ /** The version of a member function a version of the Service runs. */
18
+ export interface IReflexServiceVersionFunction {
19
+ functionId: string;
20
+ functionVersionId: string;
21
+ functionVersionNumber: number;
22
+ }
23
+
24
+ /** What a version of a Discord bot freezes: its commands and components, identifiers included. */
25
+ export interface IReflexServiceVersionDiscord {
26
+ commands: IReflexDiscordCommandSnapshot[];
27
+ components: IReflexDiscordComponentSnapshot[];
28
+ }
29
+
30
+ /**
31
+ * What a version of the Service freezes. Routes sorted by path then method, functions by id: the same
32
+ * Service always gives the same snapshot, and the same `hash`.
33
+ */
34
+ export interface IReflexServiceVersionSnapshot {
35
+ routes: IReflexServiceVersionRoute[];
36
+ functions: IReflexServiceVersionFunction[];
37
+ cors: IReflexServiceCors;
38
+ rateLimitPerIpPerMinute: number;
39
+ /** Only a `DISCORD_BOT` Service has it (its `routes` are then empty); absent otherwise, so the hash of other versions is unchanged. */
40
+ discord?: IReflexServiceVersionDiscord;
41
+ }
42
+
43
+ export interface IReflexServiceVersion {
44
+ id: string;
45
+ serviceId: string;
46
+ /** 1, 2, 3...: counted per Service. */
47
+ number: number;
48
+ /** 500 characters at most. */
49
+ message: string | null;
50
+ snapshot: IReflexServiceVersionSnapshot;
51
+ /** SHA-256 of the snapshot as canonical JSON (keys sorted), lowercase hex. */
52
+ hash: string;
53
+ publishedByUserId: string;
54
+ publishedAt: Date;
55
+ }