@abyss-project/reflex 5.0.0 → 5.2.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 (58) hide show
  1. package/dist/api/service-version.api.d.ts +2 -1
  2. package/dist/api/service-version.api.js +3 -1
  3. package/dist/api/service-version.api.js.map +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/types/enum/discord-activity-type.enum.d.ts +7 -0
  8. package/dist/types/enum/discord-activity-type.enum.js +12 -0
  9. package/dist/types/enum/discord-activity-type.enum.js.map +1 -0
  10. package/dist/types/enum/discord-gateway-failure-code.enum.d.ts +5 -0
  11. package/dist/types/enum/discord-gateway-failure-code.enum.js +10 -0
  12. package/dist/types/enum/discord-gateway-failure-code.enum.js.map +1 -0
  13. package/dist/types/enum/discord-gateway-state.enum.d.ts +6 -0
  14. package/dist/types/enum/discord-gateway-state.enum.js +11 -0
  15. package/dist/types/enum/discord-gateway-state.enum.js.map +1 -0
  16. package/dist/types/enum/discord-presence-status.enum.d.ts +5 -0
  17. package/dist/types/enum/discord-presence-status.enum.js +10 -0
  18. package/dist/types/enum/discord-presence-status.enum.js.map +1 -0
  19. package/dist/types/enum/index.d.ts +4 -0
  20. package/dist/types/enum/index.js +4 -0
  21. package/dist/types/enum/index.js.map +1 -1
  22. package/dist/types/interface/api/requests/service-discord.request.d.ts +4 -1
  23. package/dist/types/interface/api/requests/service-version.request.d.ts +4 -0
  24. package/dist/types/interface/api/responses/service-version.response.d.ts +4 -0
  25. package/dist/types/interface/models/reflex-discord.model.d.ts +14 -1
  26. package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/api/function-access.api.ts +36 -36
  29. package/src/api/function-run.api.ts +38 -38
  30. package/src/api/function-settings.api.ts +59 -59
  31. package/src/api/function-test.api.ts +34 -34
  32. package/src/api/function-version.api.ts +48 -48
  33. package/src/api/function.api.test.ts +249 -249
  34. package/src/api/function.api.ts +62 -62
  35. package/src/api/health.api.ts +10 -10
  36. package/src/api/index.ts +13 -13
  37. package/src/api/service-configuration.api.ts +16 -16
  38. package/src/api/service-deployment.api.ts +79 -79
  39. package/src/api/service-route.api.ts +72 -72
  40. package/src/api/service-version.api.ts +54 -39
  41. package/src/api/service.api.test.ts +215 -209
  42. package/src/api/service.api.ts +55 -55
  43. package/src/index.ts +2 -0
  44. package/src/types/enum/discord-activity-type.enum.ts +9 -0
  45. package/src/types/enum/discord-component-kind.enum.ts +7 -7
  46. package/src/types/enum/discord-gateway-failure-code.enum.ts +9 -0
  47. package/src/types/enum/discord-gateway-state.enum.ts +11 -0
  48. package/src/types/enum/discord-option-type.enum.ts +12 -12
  49. package/src/types/enum/discord-presence-status.enum.ts +8 -0
  50. package/src/types/enum/discord-sync-status.enum.ts +6 -6
  51. package/src/types/enum/discord-token-state.enum.ts +11 -11
  52. package/src/types/enum/index.ts +4 -0
  53. package/src/types/interface/api/requests/service-discord.request.ts +128 -118
  54. package/src/types/interface/api/requests/service-version.request.ts +24 -19
  55. package/src/types/interface/api/responses/service-discord.response.ts +72 -72
  56. package/src/types/interface/api/responses/service-version.response.ts +11 -0
  57. package/src/types/interface/models/reflex-discord.model.ts +146 -117
  58. package/src/types/interface/models/reflex-run.model.ts +173 -173
@@ -1,11 +1,11 @@
1
- /** What Reflex knows of the bot token of an environment. */
2
- export enum DiscordTokenState {
3
- /** Discord accepted the token at the last check. */
4
- VALID = 'VALID',
5
- /** Discord answered 401 to the token. */
6
- REJECTED = 'REJECTED',
7
- /** The Vault entry has no value in this environment. */
8
- MISSING = 'MISSING',
9
- /** The token has not been checked yet. */
10
- UNCHECKED = 'UNCHECKED',
11
- }
1
+ /** What Reflex knows of the bot token of an environment. */
2
+ export enum DiscordTokenState {
3
+ /** Discord accepted the token at the last check. */
4
+ VALID = 'VALID',
5
+ /** Discord answered 401 to the token. */
6
+ REJECTED = 'REJECTED',
7
+ /** The Vault entry has no value in this environment. */
8
+ MISSING = 'MISSING',
9
+ /** The token has not been checked yet. */
10
+ UNCHECKED = 'UNCHECKED',
11
+ }
@@ -23,3 +23,7 @@ export * from './discord-option-type.enum';
23
23
  export * from './discord-component-kind.enum';
24
24
  export * from './discord-sync-status.enum';
25
25
  export * from './discord-token-state.enum';
26
+ export * from './discord-presence-status.enum';
27
+ export * from './discord-activity-type.enum';
28
+ export * from './discord-gateway-state.enum';
29
+ export * from './discord-gateway-failure-code.enum';
@@ -1,118 +1,128 @@
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
- }
1
+ import type {
2
+ DiscordActivityType,
3
+ DiscordComponentKind,
4
+ DiscordPresenceStatus,
5
+ } from '../../../enum';
6
+ import type { IReflexDiscordCommandOption } from '../../models';
7
+
8
+ export interface IListServiceDiscordCommandParams {
9
+ applicationId: string;
10
+ serviceId: string;
11
+ }
12
+
13
+ export interface ICreateServiceDiscordCommandParams {
14
+ applicationId: string;
15
+ serviceId: string;
16
+ }
17
+ export interface ICreateServiceDiscordCommandBody {
18
+ /** `^[-_a-z0-9]{1,32}$`, unique within the Service. */
19
+ name: string;
20
+ /** 1 to 100 characters. */
21
+ description: string;
22
+ /** 25 at most, required options first; empty by default. */
23
+ options?: IReflexDiscordCommandOption[];
24
+ /** A function of the same Service. */
25
+ functionId: string;
26
+ /** Discord permission bits as a decimal string; null (default) for everyone. */
27
+ defaultMemberPermissions?: string | null;
28
+ /** `true` by default. */
29
+ allowedInDirectMessages?: boolean;
30
+ }
31
+
32
+ export interface IUpdateServiceDiscordCommandParams {
33
+ applicationId: string;
34
+ serviceId: string;
35
+ commandId: string;
36
+ }
37
+ export interface IUpdateServiceDiscordCommandBody {
38
+ name?: string;
39
+ description?: string;
40
+ options?: IReflexDiscordCommandOption[];
41
+ functionId?: string;
42
+ defaultMemberPermissions?: string | null;
43
+ allowedInDirectMessages?: boolean;
44
+ }
45
+
46
+ export interface IDeleteServiceDiscordCommandParams {
47
+ applicationId: string;
48
+ serviceId: string;
49
+ commandId: string;
50
+ }
51
+
52
+ export interface IListServiceDiscordComponentParams {
53
+ applicationId: string;
54
+ serviceId: string;
55
+ }
56
+
57
+ export interface ICreateServiceDiscordComponentParams {
58
+ applicationId: string;
59
+ serviceId: string;
60
+ }
61
+ export interface ICreateServiceDiscordComponentBody {
62
+ /** `^[a-z0-9_-]{1,40}$`; no prefix of the Service equals, starts or is started by another one. */
63
+ customIdPrefix: string;
64
+ kind: DiscordComponentKind;
65
+ /** A function of the same Service. */
66
+ functionId: string;
67
+ }
68
+
69
+ export interface IUpdateServiceDiscordComponentParams {
70
+ applicationId: string;
71
+ serviceId: string;
72
+ componentId: string;
73
+ }
74
+ export interface IUpdateServiceDiscordComponentBody {
75
+ customIdPrefix?: string;
76
+ kind?: DiscordComponentKind;
77
+ functionId?: string;
78
+ }
79
+
80
+ export interface IDeleteServiceDiscordComponentParams {
81
+ applicationId: string;
82
+ serviceId: string;
83
+ componentId: string;
84
+ }
85
+
86
+ export interface IGetServiceDiscordConnectionParams {
87
+ applicationId: string;
88
+ serviceId: string;
89
+ }
90
+
91
+ export interface ISetServiceDiscordTokenSecretParams {
92
+ applicationId: string;
93
+ serviceId: string;
94
+ }
95
+ export interface ISetServiceDiscordTokenSecretBody {
96
+ /** The Vault entry (a secret of the project) that holds the bot token, one value per environment. */
97
+ discordTokenSecretId: string;
98
+ }
99
+
100
+ export interface ISetServiceDiscordEnvironmentParams {
101
+ applicationId: string;
102
+ serviceId: string;
103
+ environmentId: string;
104
+ }
105
+ export interface ISetServiceDiscordEnvironmentBody {
106
+ /** Discord server (snowflake) the commands are pushed to outside production; null removes it. */
107
+ testGuildId?: string | null;
108
+ /** Discord permission bits as a decimal string, put in the invitation link. */
109
+ invitePermissions: string;
110
+ /** What the bot shows while connected. */
111
+ presenceStatus?: DiscordPresenceStatus;
112
+ /** The kind of activity; null removes it. */
113
+ activityType?: DiscordActivityType | null;
114
+ /** 1 to 128 characters, required with an `activityType`, null without. */
115
+ activityText?: string | null;
116
+ }
117
+
118
+ export interface ICheckServiceDiscordConnectionParams {
119
+ applicationId: string;
120
+ serviceId: string;
121
+ environmentId: string;
122
+ }
123
+
124
+ export interface IRetryServiceDiscordSyncParams {
125
+ applicationId: string;
126
+ serviceId: string;
127
+ environmentId: string;
128
+ }
@@ -1,19 +1,24 @@
1
- export interface IListServiceVersionParams {
2
- applicationId: string;
3
- serviceId: string;
4
- }
5
-
6
- export interface ICreateServiceVersionParams {
7
- applicationId: string;
8
- serviceId: string;
9
- }
10
- export interface ICreateServiceVersionBody {
11
- /** 500 characters at most. */
12
- message?: string;
13
- }
14
-
15
- export interface IGetServiceVersionParams {
16
- applicationId: string;
17
- serviceId: string;
18
- versionId: string;
19
- }
1
+ export interface IListServiceVersionParams {
2
+ applicationId: string;
3
+ serviceId: string;
4
+ }
5
+
6
+ export interface ICreateServiceVersionParams {
7
+ applicationId: string;
8
+ serviceId: string;
9
+ }
10
+ export interface ICreateServiceVersionBody {
11
+ /** 500 characters at most. */
12
+ message?: string;
13
+ }
14
+
15
+ export interface IGetServiceVersionDraftStatusParams {
16
+ applicationId: string;
17
+ serviceId: string;
18
+ }
19
+
20
+ export interface IGetServiceVersionParams {
21
+ applicationId: string;
22
+ serviceId: string;
23
+ versionId: string;
24
+ }
@@ -1,72 +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
+ 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>;
@@ -48,6 +48,17 @@ export interface ICreateServiceVersionData {
48
48
  }
49
49
  export type ICreateServiceVersionResponse = IResponse<ICreateServiceVersionData>;
50
50
 
51
+ export interface IGetServiceVersionDraftStatusData {
52
+ /**
53
+ * How many functions of the Service a version created now would freeze at a version other than the one
54
+ * the last Service version froze: a function new to the Service, a draft that differs from its last
55
+ * version (an invalid draft counts), or a function version published since. Same rule as
56
+ * `POST .../version`; 0 for a Service without functions.
57
+ */
58
+ changedFunctions: number;
59
+ }
60
+ export type IGetServiceVersionDraftStatusResponse = IResponse<IGetServiceVersionDraftStatusData>;
61
+
51
62
  export interface IGetServiceVersionData {
52
63
  version: IReflexServiceVersion;
53
64
  /** The version just before; null for the first one. */