@abyss-project/reflex 6.2.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/enum/discord-host-action.enum.d.ts +3 -1
- package/dist/types/enum/discord-host-action.enum.js +2 -0
- package/dist/types/enum/discord-host-action.enum.js.map +1 -1
- package/dist/types/interface/api/requests/service-discord.request.d.ts +1 -0
- package/dist/types/interface/models/reflex-discord.model.d.ts +5 -0
- package/dist/types/interface/models/reflex-discord.model.js +2 -0
- package/dist/types/interface/models/reflex-discord.model.js.map +1 -1
- package/dist/types/interface/models/reflex-price-list.model.d.ts +1 -0
- package/package.json +1 -1
- package/src/types/enum/discord-host-action.enum.ts +37 -35
- package/src/types/interface/api/requests/service-discord.request.ts +155 -149
- package/src/types/interface/models/reflex-discord.model.ts +208 -196
- package/src/types/interface/models/reflex-price-list.model.ts +22 -20
|
@@ -27,5 +27,7 @@ export declare enum DiscordHostAction {
|
|
|
27
27
|
CREATE_ROLE = "discord.createRole",
|
|
28
28
|
DELETE_ROLE = "discord.deleteRole",
|
|
29
29
|
CREATE_THREAD = "discord.createThread",
|
|
30
|
-
END_POLL = "discord.endPoll"
|
|
30
|
+
END_POLL = "discord.endPoll",
|
|
31
|
+
AUTOCOMPLETE = "discord.autocomplete",
|
|
32
|
+
READ_ATTACHMENT = "discord.readAttachment"
|
|
31
33
|
}
|
|
@@ -32,5 +32,7 @@ var DiscordHostAction;
|
|
|
32
32
|
DiscordHostAction["DELETE_ROLE"] = "discord.deleteRole";
|
|
33
33
|
DiscordHostAction["CREATE_THREAD"] = "discord.createThread";
|
|
34
34
|
DiscordHostAction["END_POLL"] = "discord.endPoll";
|
|
35
|
+
DiscordHostAction["AUTOCOMPLETE"] = "discord.autocomplete";
|
|
36
|
+
DiscordHostAction["READ_ATTACHMENT"] = "discord.readAttachment";
|
|
35
37
|
})(DiscordHostAction || (exports.DiscordHostAction = DiscordHostAction = {}));
|
|
36
38
|
//# sourceMappingURL=discord-host-action.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discord-host-action.enum.js","sourceRoot":"","sources":["../../../src/types/enum/discord-host-action.enum.ts"],"names":[],"mappings":";;;AAIA,IAAY,
|
|
1
|
+
{"version":3,"file":"discord-host-action.enum.js","sourceRoot":"","sources":["../../../src/types/enum/discord-host-action.enum.ts"],"names":[],"mappings":";;;AAIA,IAAY,iBAgCX;AAhCD,WAAY,iBAAiB;IAC3B,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;IACzB,qDAAgC,CAAA;IAChC,mDAA8B,CAAA;IAC9B,yDAAoC,CAAA;IACpC,yDAAoC,CAAA;IACpC,6DAAwC,CAAA;IACxC,iDAA4B,CAAA;IAC5B,uDAAkC,CAAA;IAClC,sEAAiD,CAAA;IACjD,qDAAgC,CAAA;IAChC,8DAAyC,CAAA;IACzC,uDAAkC,CAAA;IAClC,mDAA8B,CAAA;IAC9B,uDAAkC,CAAA;IAClC,qDAAgC,CAAA;IAChC,yDAAoC,CAAA;IACpC,6DAAwC,CAAA;IACxC,wEAAmD,CAAA;IACnD,yDAAoC,CAAA;IACpC,+DAA0C,CAAA;IAC1C,6DAAwC,CAAA;IACxC,6DAAwC,CAAA;IACxC,4EAAuD,CAAA;IACvD,kFAA6D,CAAA;IAC7D,uDAAkC,CAAA;IAClC,uDAAkC,CAAA;IAClC,2DAAsC,CAAA;IACtC,iDAA4B,CAAA;IAC5B,0DAAqC,CAAA;IACrC,+DAA0C,CAAA;AAC5C,CAAC,EAhCW,iBAAiB,iCAAjB,iBAAiB,QAgC5B"}
|
|
@@ -90,6 +90,7 @@ export interface ISetServiceDiscordEnvironmentBody {
|
|
|
90
90
|
presenceStatus?: DiscordPresenceStatus;
|
|
91
91
|
activityType?: DiscordActivityType | null;
|
|
92
92
|
activityText?: string | null;
|
|
93
|
+
maxAttachmentBytes?: number;
|
|
93
94
|
}
|
|
94
95
|
export interface ICheckServiceDiscordConnectionParams {
|
|
95
96
|
applicationId: string;
|
|
@@ -10,6 +10,8 @@ export declare const REFLEX_DISCORD_LIMITS: {
|
|
|
10
10
|
readonly syncErrorMaxLength: 500;
|
|
11
11
|
readonly optionLengthMax: 6000;
|
|
12
12
|
readonly choiceNameMaxLength: 100;
|
|
13
|
+
readonly attachmentMaxBytesDefault: number;
|
|
14
|
+
readonly attachmentMaxBytesBound: number;
|
|
13
15
|
};
|
|
14
16
|
export declare const isValidLocalizedName: (name: string) => boolean;
|
|
15
17
|
export type ReflexDiscordLocalizations = Partial<Record<DiscordLocale, string>>;
|
|
@@ -24,6 +26,7 @@ export interface IReflexDiscordCommandOption {
|
|
|
24
26
|
description: string;
|
|
25
27
|
required: boolean;
|
|
26
28
|
choices?: IReflexDiscordOptionChoice[];
|
|
29
|
+
autocomplete?: boolean;
|
|
27
30
|
minValue?: number;
|
|
28
31
|
maxValue?: number;
|
|
29
32
|
minLength?: number;
|
|
@@ -71,6 +74,7 @@ export interface IReflexDiscordEnvironmentSettings {
|
|
|
71
74
|
presenceStatus: DiscordPresenceStatus;
|
|
72
75
|
activityType: DiscordActivityType | null;
|
|
73
76
|
activityText: string | null;
|
|
77
|
+
maxAttachmentBytes: number;
|
|
74
78
|
createdAt: Date;
|
|
75
79
|
updatedAt: Date;
|
|
76
80
|
}
|
|
@@ -92,6 +96,7 @@ export interface IReflexDiscordEnvironmentConnection {
|
|
|
92
96
|
presenceStatus: DiscordPresenceStatus;
|
|
93
97
|
activityType: DiscordActivityType | null;
|
|
94
98
|
activityText: string | null;
|
|
99
|
+
maxAttachmentBytes: number;
|
|
95
100
|
presence: IReflexDiscordPresence | null;
|
|
96
101
|
interactionsUrl: string;
|
|
97
102
|
inviteUrl: string | null;
|
|
@@ -12,6 +12,8 @@ exports.REFLEX_DISCORD_LIMITS = {
|
|
|
12
12
|
syncErrorMaxLength: 500,
|
|
13
13
|
optionLengthMax: 6000,
|
|
14
14
|
choiceNameMaxLength: 100,
|
|
15
|
+
attachmentMaxBytesDefault: 2 * 1024 * 1024,
|
|
16
|
+
attachmentMaxBytesBound: 8 * 1024 * 1024,
|
|
15
17
|
};
|
|
16
18
|
const isValidLocalizedName = (name) => exports.REFLEX_DISCORD_LIMITS.localizedNamePattern.test(name) && name === name.toLowerCase();
|
|
17
19
|
exports.isValidLocalizedName = isValidLocalizedName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflex-discord.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-discord.model.ts"],"names":[],"mappings":";;;AAaa,QAAA,qBAAqB,GAAG;IAEnC,kBAAkB,EAAE,oBAAoB;IAKxC,oBAAoB,EAAE,gDAAgD;IACtE,2BAA2B,EAAE,GAAG;IAChC,qBAAqB,EAAE,GAAG;IAC1B,oBAAoB,EAAE,EAAE;IACxB,mBAAmB,EAAE,EAAE;IAEvB,sBAAsB,EAAE,oBAAoB;IAC5C,kBAAkB,EAAE,GAAG;IAEvB,eAAe,EAAE,IAAI;IAErB,mBAAmB,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"reflex-discord.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/reflex-discord.model.ts"],"names":[],"mappings":";;;AAaa,QAAA,qBAAqB,GAAG;IAEnC,kBAAkB,EAAE,oBAAoB;IAKxC,oBAAoB,EAAE,gDAAgD;IACtE,2BAA2B,EAAE,GAAG;IAChC,qBAAqB,EAAE,GAAG;IAC1B,oBAAoB,EAAE,EAAE;IACxB,mBAAmB,EAAE,EAAE;IAEvB,sBAAsB,EAAE,oBAAoB;IAC5C,kBAAkB,EAAE,GAAG;IAEvB,eAAe,EAAE,IAAI;IAErB,mBAAmB,EAAE,GAAG;IAExB,yBAAyB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;IAC1C,uBAAuB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;CAChC,CAAC;AAGJ,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAW,EAAE,CAC5D,6BAAqB,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;AAD1E,QAAA,oBAAoB,wBACsD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ExecutionProfile } from '../../enum';
|
|
2
2
|
export interface IReflexPriceList {
|
|
3
3
|
executionMillicredits: number;
|
|
4
|
+
autocompleteExecutionMillicredits: number;
|
|
4
5
|
cpuMillicreditsPerSecond: number;
|
|
5
6
|
memoryMillicreditsPerGbSecond: number;
|
|
6
7
|
networkOutMillicreditsPerMb: number;
|
package/package.json
CHANGED
|
@@ -1,35 +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
|
-
|
|
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,149 +1,155 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DiscordActivityType,
|
|
3
|
-
DiscordComponentKind,
|
|
4
|
-
DiscordPresenceStatus,
|
|
5
|
-
} from '../../../enum';
|
|
6
|
-
import type { IReflexDiscordCommandOption, ReflexDiscordLocalizations } 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
|
-
/** Null (default) for none. */
|
|
31
|
-
nameLocalizations?: ReflexDiscordLocalizations | null;
|
|
32
|
-
descriptionLocalizations?: ReflexDiscordLocalizations | null;
|
|
33
|
-
/** `false` by default. */
|
|
34
|
-
userInstallable?: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface IUpdateServiceDiscordCommandParams {
|
|
38
|
-
applicationId: string;
|
|
39
|
-
serviceId: string;
|
|
40
|
-
commandId: string;
|
|
41
|
-
}
|
|
42
|
-
export interface IUpdateServiceDiscordCommandBody {
|
|
43
|
-
name?: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
options?: IReflexDiscordCommandOption[];
|
|
46
|
-
functionId?: string;
|
|
47
|
-
defaultMemberPermissions?: string | null;
|
|
48
|
-
allowedInDirectMessages?: boolean;
|
|
49
|
-
nameLocalizations?: ReflexDiscordLocalizations | null;
|
|
50
|
-
descriptionLocalizations?: ReflexDiscordLocalizations | null;
|
|
51
|
-
userInstallable?: boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface IDeleteServiceDiscordCommandParams {
|
|
55
|
-
applicationId: string;
|
|
56
|
-
serviceId: string;
|
|
57
|
-
commandId: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface IListServiceDiscordComponentParams {
|
|
61
|
-
applicationId: string;
|
|
62
|
-
serviceId: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface ICreateServiceDiscordComponentParams {
|
|
66
|
-
applicationId: string;
|
|
67
|
-
serviceId: string;
|
|
68
|
-
}
|
|
69
|
-
export interface ICreateServiceDiscordComponentBody {
|
|
70
|
-
/** `^[a-z0-9_-]{1,40}$`; no prefix of the Service equals, starts or is started by another one. */
|
|
71
|
-
customIdPrefix: string;
|
|
72
|
-
kind: DiscordComponentKind;
|
|
73
|
-
/** A function of the same Service. */
|
|
74
|
-
functionId: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface IUpdateServiceDiscordComponentParams {
|
|
78
|
-
applicationId: string;
|
|
79
|
-
serviceId: string;
|
|
80
|
-
componentId: string;
|
|
81
|
-
}
|
|
82
|
-
export interface IUpdateServiceDiscordComponentBody {
|
|
83
|
-
customIdPrefix?: string;
|
|
84
|
-
kind?: DiscordComponentKind;
|
|
85
|
-
functionId?: string;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface IDeleteServiceDiscordComponentParams {
|
|
89
|
-
applicationId: string;
|
|
90
|
-
serviceId: string;
|
|
91
|
-
componentId: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface IGetServiceDiscordConnectionParams {
|
|
95
|
-
applicationId: string;
|
|
96
|
-
serviceId: string;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface ISetServiceDiscordTokenSecretParams {
|
|
100
|
-
applicationId: string;
|
|
101
|
-
serviceId: string;
|
|
102
|
-
}
|
|
103
|
-
export interface ISetServiceDiscordTokenSecretBody {
|
|
104
|
-
/** The Vault entry (a secret of the project) that holds the bot token, one value per environment. */
|
|
105
|
-
discordTokenSecretId: string;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface ISetServiceDiscordEnvironmentParams {
|
|
109
|
-
applicationId: string;
|
|
110
|
-
serviceId: string;
|
|
111
|
-
environmentId: string;
|
|
112
|
-
}
|
|
113
|
-
export interface ISetServiceDiscordEnvironmentBody {
|
|
114
|
-
/** Discord server (snowflake) the commands are pushed to outside production; null removes it. */
|
|
115
|
-
testGuildId?: string | null;
|
|
116
|
-
/** Discord permission bits as a decimal string, put in the invitation link. */
|
|
117
|
-
invitePermissions: string;
|
|
118
|
-
/** What the bot shows while connected. */
|
|
119
|
-
presenceStatus?: DiscordPresenceStatus;
|
|
120
|
-
/** The kind of activity; null removes it. */
|
|
121
|
-
activityType?: DiscordActivityType | null;
|
|
122
|
-
/** 1 to 128 characters, required with an `activityType`, null without. */
|
|
123
|
-
activityText?: string | null;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface
|
|
133
|
-
applicationId: string;
|
|
134
|
-
serviceId: string;
|
|
135
|
-
environmentId: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface
|
|
139
|
-
applicationId: string;
|
|
140
|
-
serviceId: string;
|
|
141
|
-
environmentId: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
1
|
+
import type {
|
|
2
|
+
DiscordActivityType,
|
|
3
|
+
DiscordComponentKind,
|
|
4
|
+
DiscordPresenceStatus,
|
|
5
|
+
} from '../../../enum';
|
|
6
|
+
import type { IReflexDiscordCommandOption, ReflexDiscordLocalizations } 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
|
+
/** Null (default) for none. */
|
|
31
|
+
nameLocalizations?: ReflexDiscordLocalizations | null;
|
|
32
|
+
descriptionLocalizations?: ReflexDiscordLocalizations | null;
|
|
33
|
+
/** `false` by default. */
|
|
34
|
+
userInstallable?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface IUpdateServiceDiscordCommandParams {
|
|
38
|
+
applicationId: string;
|
|
39
|
+
serviceId: string;
|
|
40
|
+
commandId: string;
|
|
41
|
+
}
|
|
42
|
+
export interface IUpdateServiceDiscordCommandBody {
|
|
43
|
+
name?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
options?: IReflexDiscordCommandOption[];
|
|
46
|
+
functionId?: string;
|
|
47
|
+
defaultMemberPermissions?: string | null;
|
|
48
|
+
allowedInDirectMessages?: boolean;
|
|
49
|
+
nameLocalizations?: ReflexDiscordLocalizations | null;
|
|
50
|
+
descriptionLocalizations?: ReflexDiscordLocalizations | null;
|
|
51
|
+
userInstallable?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface IDeleteServiceDiscordCommandParams {
|
|
55
|
+
applicationId: string;
|
|
56
|
+
serviceId: string;
|
|
57
|
+
commandId: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface IListServiceDiscordComponentParams {
|
|
61
|
+
applicationId: string;
|
|
62
|
+
serviceId: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ICreateServiceDiscordComponentParams {
|
|
66
|
+
applicationId: string;
|
|
67
|
+
serviceId: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ICreateServiceDiscordComponentBody {
|
|
70
|
+
/** `^[a-z0-9_-]{1,40}$`; no prefix of the Service equals, starts or is started by another one. */
|
|
71
|
+
customIdPrefix: string;
|
|
72
|
+
kind: DiscordComponentKind;
|
|
73
|
+
/** A function of the same Service. */
|
|
74
|
+
functionId: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface IUpdateServiceDiscordComponentParams {
|
|
78
|
+
applicationId: string;
|
|
79
|
+
serviceId: string;
|
|
80
|
+
componentId: string;
|
|
81
|
+
}
|
|
82
|
+
export interface IUpdateServiceDiscordComponentBody {
|
|
83
|
+
customIdPrefix?: string;
|
|
84
|
+
kind?: DiscordComponentKind;
|
|
85
|
+
functionId?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface IDeleteServiceDiscordComponentParams {
|
|
89
|
+
applicationId: string;
|
|
90
|
+
serviceId: string;
|
|
91
|
+
componentId: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface IGetServiceDiscordConnectionParams {
|
|
95
|
+
applicationId: string;
|
|
96
|
+
serviceId: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ISetServiceDiscordTokenSecretParams {
|
|
100
|
+
applicationId: string;
|
|
101
|
+
serviceId: string;
|
|
102
|
+
}
|
|
103
|
+
export interface ISetServiceDiscordTokenSecretBody {
|
|
104
|
+
/** The Vault entry (a secret of the project) that holds the bot token, one value per environment. */
|
|
105
|
+
discordTokenSecretId: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ISetServiceDiscordEnvironmentParams {
|
|
109
|
+
applicationId: string;
|
|
110
|
+
serviceId: string;
|
|
111
|
+
environmentId: string;
|
|
112
|
+
}
|
|
113
|
+
export interface ISetServiceDiscordEnvironmentBody {
|
|
114
|
+
/** Discord server (snowflake) the commands are pushed to outside production; null removes it. */
|
|
115
|
+
testGuildId?: string | null;
|
|
116
|
+
/** Discord permission bits as a decimal string, put in the invitation link. */
|
|
117
|
+
invitePermissions: string;
|
|
118
|
+
/** What the bot shows while connected. */
|
|
119
|
+
presenceStatus?: DiscordPresenceStatus;
|
|
120
|
+
/** The kind of activity; null removes it. */
|
|
121
|
+
activityType?: DiscordActivityType | null;
|
|
122
|
+
/** 1 to 128 characters, required with an `activityType`, null without. */
|
|
123
|
+
activityText?: string | null;
|
|
124
|
+
/**
|
|
125
|
+
* Largest file the bot receives or sends, in bytes, 1 to `REFLEX_DISCORD_LIMITS.attachmentMaxBytesBound`; omitted,
|
|
126
|
+
* the current size is kept (the default until one is set), unlike the other fields of this body, which an
|
|
127
|
+
* omission resets: a screen sends it only when it changed it.
|
|
128
|
+
*/
|
|
129
|
+
maxAttachmentBytes?: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface ICheckServiceDiscordConnectionParams {
|
|
133
|
+
applicationId: string;
|
|
134
|
+
serviceId: string;
|
|
135
|
+
environmentId: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface IRetryServiceDiscordSyncParams {
|
|
139
|
+
applicationId: string;
|
|
140
|
+
serviceId: string;
|
|
141
|
+
environmentId: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface ISetServiceDiscordAllocationParams {
|
|
145
|
+
applicationId: string;
|
|
146
|
+
serviceId: string;
|
|
147
|
+
environmentId: string;
|
|
148
|
+
}
|
|
149
|
+
export interface ISetServiceDiscordAllocationBody {
|
|
150
|
+
/**
|
|
151
|
+
* Lots of 500 events per minute of the reserve of the organization this bot holds in this environment,
|
|
152
|
+
* from 0 to `rate.lotsMax`; 0 releases them. The sum over the organization cannot go past its reserve.
|
|
153
|
+
*/
|
|
154
|
+
lots: number;
|
|
155
|
+
}
|
|
@@ -1,196 +1,208 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DiscordActivityType,
|
|
3
|
-
DiscordChannelType,
|
|
4
|
-
DiscordComponentKind,
|
|
5
|
-
DiscordLocale,
|
|
6
|
-
DiscordGatewayFailureCode,
|
|
7
|
-
DiscordGatewayState,
|
|
8
|
-
DiscordOptionType,
|
|
9
|
-
DiscordPresenceStatus,
|
|
10
|
-
DiscordTokenState,
|
|
11
|
-
} from '../../enum';
|
|
12
|
-
|
|
13
|
-
/** Bounds of the commands and components of a Discord bot; the API and its database apply the same ones. */
|
|
14
|
-
export const REFLEX_DISCORD_LIMITS = {
|
|
15
|
-
/** `^[-_a-z0-9]{1,32}$`: the name typed after the slash. */
|
|
16
|
-
commandNamePattern: /^[-_a-z0-9]{1,32}$/,
|
|
17
|
-
/**
|
|
18
|
-
* Discord's pattern of a translated command or option name: letters and digits of any script, `-`, `_` and
|
|
19
|
-
* `'`, 1 to 32 characters. It must also be lower case where the script has one (see `isValidLocalizedName`).
|
|
20
|
-
*/
|
|
21
|
-
localizedNamePattern: /^[-_'\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$/u,
|
|
22
|
-
commandDescriptionMaxLength: 100,
|
|
23
|
-
commandsPerServiceMax: 100,
|
|
24
|
-
optionsPerCommandMax: 25,
|
|
25
|
-
choicesPerOptionMax: 25,
|
|
26
|
-
/** `^[a-z0-9_-]{1,40}$`: the start of the `custom_id` of a button, a menu or a form. */
|
|
27
|
-
componentPrefixPattern: /^[a-z0-9_-]{1,40}$/,
|
|
28
|
-
syncErrorMaxLength: 500,
|
|
29
|
-
/** Bounds of `minLength` and `maxLength` of a STRING option (`maxLength` is 1 at least). */
|
|
30
|
-
optionLengthMax: 6000,
|
|
31
|
-
/** Length of the name of a choice, localized or not. */
|
|
32
|
-
choiceNameMaxLength: 100,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
minValue
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
export interface
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
1
|
+
import type {
|
|
2
|
+
DiscordActivityType,
|
|
3
|
+
DiscordChannelType,
|
|
4
|
+
DiscordComponentKind,
|
|
5
|
+
DiscordLocale,
|
|
6
|
+
DiscordGatewayFailureCode,
|
|
7
|
+
DiscordGatewayState,
|
|
8
|
+
DiscordOptionType,
|
|
9
|
+
DiscordPresenceStatus,
|
|
10
|
+
DiscordTokenState,
|
|
11
|
+
} from '../../enum';
|
|
12
|
+
|
|
13
|
+
/** Bounds of the commands and components of a Discord bot; the API and its database apply the same ones. */
|
|
14
|
+
export const REFLEX_DISCORD_LIMITS = {
|
|
15
|
+
/** `^[-_a-z0-9]{1,32}$`: the name typed after the slash. */
|
|
16
|
+
commandNamePattern: /^[-_a-z0-9]{1,32}$/,
|
|
17
|
+
/**
|
|
18
|
+
* Discord's pattern of a translated command or option name: letters and digits of any script, `-`, `_` and
|
|
19
|
+
* `'`, 1 to 32 characters. It must also be lower case where the script has one (see `isValidLocalizedName`).
|
|
20
|
+
*/
|
|
21
|
+
localizedNamePattern: /^[-_'\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$/u,
|
|
22
|
+
commandDescriptionMaxLength: 100,
|
|
23
|
+
commandsPerServiceMax: 100,
|
|
24
|
+
optionsPerCommandMax: 25,
|
|
25
|
+
choicesPerOptionMax: 25,
|
|
26
|
+
/** `^[a-z0-9_-]{1,40}$`: the start of the `custom_id` of a button, a menu or a form. */
|
|
27
|
+
componentPrefixPattern: /^[a-z0-9_-]{1,40}$/,
|
|
28
|
+
syncErrorMaxLength: 500,
|
|
29
|
+
/** Bounds of `minLength` and `maxLength` of a STRING option (`maxLength` is 1 at least). */
|
|
30
|
+
optionLengthMax: 6000,
|
|
31
|
+
/** Length of the name of a choice, localized or not. */
|
|
32
|
+
choiceNameMaxLength: 100,
|
|
33
|
+
/** Largest file a bot receives or sends, per bot and environment (#915): the default, and the bound the setting may not pass. */
|
|
34
|
+
attachmentMaxBytesDefault: 2 * 1024 * 1024,
|
|
35
|
+
attachmentMaxBytesBound: 8 * 1024 * 1024,
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
/** A translated command or option name Discord accepts: its pattern, and lower case where the script has one. */
|
|
39
|
+
export const isValidLocalizedName = (name: string): boolean =>
|
|
40
|
+
REFLEX_DISCORD_LIMITS.localizedNamePattern.test(name) && name === name.toLowerCase();
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Translations of a name or a description, by Discord locale. A localized command or option name
|
|
44
|
+
* passes `isValidLocalizedName`, a description 1 to 100 characters, a choice name 1 to 100.
|
|
45
|
+
*/
|
|
46
|
+
export type ReflexDiscordLocalizations = Partial<Record<DiscordLocale, string>>;
|
|
47
|
+
|
|
48
|
+
/** A fixed answer a user picks for a STRING, INTEGER or NUMBER option. */
|
|
49
|
+
export interface IReflexDiscordOptionChoice {
|
|
50
|
+
name: string;
|
|
51
|
+
value: string | number;
|
|
52
|
+
nameLocalizations?: ReflexDiscordLocalizations;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* An option of a command. Required options come first. A bound only exists on the types it applies
|
|
57
|
+
* to: the API refuses it on another one.
|
|
58
|
+
*/
|
|
59
|
+
export interface IReflexDiscordCommandOption {
|
|
60
|
+
type: DiscordOptionType;
|
|
61
|
+
/** Same pattern as the command name. */
|
|
62
|
+
name: string;
|
|
63
|
+
/** 1 to 100 characters. */
|
|
64
|
+
description: string;
|
|
65
|
+
required: boolean;
|
|
66
|
+
/** 25 at most, only for STRING, INTEGER and NUMBER; within `minValue`/`maxValue` and `minLength`/`maxLength`. */
|
|
67
|
+
choices?: IReflexDiscordOptionChoice[];
|
|
68
|
+
/**
|
|
69
|
+
* Discord asks the function for the choices while the user types. Only for STRING, INTEGER and NUMBER,
|
|
70
|
+
* never together with `choices`. Absent means false.
|
|
71
|
+
*/
|
|
72
|
+
autocomplete?: boolean;
|
|
73
|
+
/** INTEGER and NUMBER: safe numbers, `minValue` <= `maxValue`. */
|
|
74
|
+
minValue?: number;
|
|
75
|
+
maxValue?: number;
|
|
76
|
+
/** STRING: 0 to 6000 (`maxLength` 1 at least), `minLength` <= `maxLength`. */
|
|
77
|
+
minLength?: number;
|
|
78
|
+
maxLength?: number;
|
|
79
|
+
/** CHANNEL: the channel types a user may pick, not empty, no duplicate. */
|
|
80
|
+
channelTypes?: DiscordChannelType[];
|
|
81
|
+
nameLocalizations?: ReflexDiscordLocalizations;
|
|
82
|
+
descriptionLocalizations?: ReflexDiscordLocalizations;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A slash command of the draft of a Discord bot Service. */
|
|
86
|
+
export interface IReflexDiscordCommand {
|
|
87
|
+
id: string;
|
|
88
|
+
serviceId: string;
|
|
89
|
+
/** A function of the same Service. */
|
|
90
|
+
functionId: string;
|
|
91
|
+
/** Unique within the Service. */
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
options: IReflexDiscordCommandOption[];
|
|
95
|
+
/** Discord permission bits as a decimal string, or null for everyone. */
|
|
96
|
+
defaultMemberPermissions: string | null;
|
|
97
|
+
allowedInDirectMessages: boolean;
|
|
98
|
+
/** Null without translations. */
|
|
99
|
+
nameLocalizations: ReflexDiscordLocalizations | null;
|
|
100
|
+
descriptionLocalizations: ReflexDiscordLocalizations | null;
|
|
101
|
+
/**
|
|
102
|
+
* Users may install the bot on their account and use the command outside the servers it is in (in
|
|
103
|
+
* group messages too). It can then act on no server in the bot's name.
|
|
104
|
+
*/
|
|
105
|
+
userInstallable: boolean;
|
|
106
|
+
createdAt: Date;
|
|
107
|
+
updatedAt: Date;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** A button, select menu or form of the draft of a Discord bot Service, routed by the start of its `custom_id`. */
|
|
111
|
+
export interface IReflexDiscordComponent {
|
|
112
|
+
id: string;
|
|
113
|
+
serviceId: string;
|
|
114
|
+
/** A function of the same Service. */
|
|
115
|
+
functionId: string;
|
|
116
|
+
/** Unique within the Service; no prefix starts another one. An interaction matches the prefix followed by `:`, or equal to its `custom_id`. */
|
|
117
|
+
customIdPrefix: string;
|
|
118
|
+
kind: DiscordComponentKind;
|
|
119
|
+
createdAt: Date;
|
|
120
|
+
updatedAt: Date;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A command as a version of the Service froze it. The fields of card 846 are only there when set (a
|
|
125
|
+
* translation, `userInstallable` true): a command without them keeps the fingerprint it had.
|
|
126
|
+
*/
|
|
127
|
+
export type IReflexDiscordCommandSnapshot = Pick<
|
|
128
|
+
IReflexDiscordCommand,
|
|
129
|
+
| 'id'
|
|
130
|
+
| 'functionId'
|
|
131
|
+
| 'name'
|
|
132
|
+
| 'description'
|
|
133
|
+
| 'options'
|
|
134
|
+
| 'defaultMemberPermissions'
|
|
135
|
+
| 'allowedInDirectMessages'
|
|
136
|
+
> & {
|
|
137
|
+
nameLocalizations?: ReflexDiscordLocalizations;
|
|
138
|
+
descriptionLocalizations?: ReflexDiscordLocalizations;
|
|
139
|
+
userInstallable?: true;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** A component as a version of the Service froze it. */
|
|
143
|
+
export type IReflexDiscordComponentSnapshot = Pick<
|
|
144
|
+
IReflexDiscordComponent,
|
|
145
|
+
'id' | 'functionId' | 'customIdPrefix' | 'kind'
|
|
146
|
+
>;
|
|
147
|
+
|
|
148
|
+
/** Settings of a Discord bot Service in one environment, kept outside the versions. */
|
|
149
|
+
export interface IReflexDiscordEnvironmentSettings {
|
|
150
|
+
id: string;
|
|
151
|
+
serviceId: string;
|
|
152
|
+
environmentId: string;
|
|
153
|
+
/** Discord server (snowflake) the commands are pushed to outside production; required there. */
|
|
154
|
+
testGuildId: string | null;
|
|
155
|
+
/** Discord permission bits as a decimal string, put in the invitation link. */
|
|
156
|
+
invitePermissions: string;
|
|
157
|
+
/** What the bot shows while connected. */
|
|
158
|
+
presenceStatus: DiscordPresenceStatus;
|
|
159
|
+
/** Null for no activity. */
|
|
160
|
+
activityType: DiscordActivityType | null;
|
|
161
|
+
/** 1 to 128 characters with an `activityType`, null without. */
|
|
162
|
+
activityText: string | null;
|
|
163
|
+
/** Largest file the bot receives or sends, in bytes: `REFLEX_DISCORD_LIMITS.attachmentMaxBytesDefault` until set. */
|
|
164
|
+
maxAttachmentBytes: number;
|
|
165
|
+
createdAt: Date;
|
|
166
|
+
updatedAt: Date;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** The Gateway connection of the bot of one environment, as its row in the execution plane says. */
|
|
170
|
+
export interface IReflexDiscordPresence {
|
|
171
|
+
state: DiscordGatewayState;
|
|
172
|
+
/** Set if and only if `state` is `FAILED`. */
|
|
173
|
+
failureCode: DiscordGatewayFailureCode | null;
|
|
174
|
+
stateChangedAt: Date;
|
|
175
|
+
/** Null until the bot connected once. */
|
|
176
|
+
lastConnectedAt: Date | null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** What the Connection screen shows of the bot of one environment. Never carries the token. */
|
|
180
|
+
export interface IReflexDiscordEnvironmentConnection {
|
|
181
|
+
environmentId: string;
|
|
182
|
+
/** The Discord application read from the token; null while the token is missing, rejected or unchecked. */
|
|
183
|
+
applicationId: string | null;
|
|
184
|
+
publicKey: string | null;
|
|
185
|
+
botName: string | null;
|
|
186
|
+
botAvatarUrl: string | null;
|
|
187
|
+
tokenState: DiscordTokenState;
|
|
188
|
+
testGuildId: string | null;
|
|
189
|
+
invitePermissions: string;
|
|
190
|
+
presenceStatus: DiscordPresenceStatus;
|
|
191
|
+
activityType: DiscordActivityType | null;
|
|
192
|
+
activityText: string | null;
|
|
193
|
+
/** Largest file the bot receives or sends, in bytes (1 to `REFLEX_DISCORD_LIMITS.attachmentMaxBytesBound`). */
|
|
194
|
+
maxAttachmentBytes: number;
|
|
195
|
+
/** The Gateway connection; null while the bot is not in service in this environment. */
|
|
196
|
+
presence: IReflexDiscordPresence | null;
|
|
197
|
+
/** Address to give Discord for interactions in this environment. */
|
|
198
|
+
interactionsUrl: string;
|
|
199
|
+
/** Link that adds the bot to a Discord server; null while the application is unknown. */
|
|
200
|
+
inviteUrl: string | null;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** The Vault entry holding the token, and the bot of each environment of the application. */
|
|
204
|
+
export interface IReflexDiscordConnection {
|
|
205
|
+
/** Vault entry (secret) that holds the bot token, one value per environment; null until chosen. */
|
|
206
|
+
discordTokenSecretId: string | null;
|
|
207
|
+
environments: IReflexDiscordEnvironmentConnection[];
|
|
208
|
+
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import type { ExecutionProfile } from '../../enum';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The price list an execution is billed with (ADR-0244), served by the API from the runtime's
|
|
5
|
-
* `COST_RATES` and `RESOURCE_PROFILES`, so that a screen that estimates a cost never holds a copy of it.
|
|
6
|
-
* Prices are in millicredits (thousandths of a credit).
|
|
7
|
-
*/
|
|
8
|
-
export interface IReflexPriceList {
|
|
9
|
-
/** Once per execution; 0 for an interrupted or refused execution. */
|
|
10
|
-
executionMillicredits: number;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** Per
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import type { ExecutionProfile } from '../../enum';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The price list an execution is billed with (ADR-0244), served by the API from the runtime's
|
|
5
|
+
* `COST_RATES` and `RESOURCE_PROFILES`, so that a screen that estimates a cost never holds a copy of it.
|
|
6
|
+
* Prices are in millicredits (thousandths of a credit).
|
|
7
|
+
*/
|
|
8
|
+
export interface IReflexPriceList {
|
|
9
|
+
/** Once per execution; 0 for an interrupted or refused execution. */
|
|
10
|
+
executionMillicredits: number;
|
|
11
|
+
/** Once per autocomplete execution, in place of `executionMillicredits`; its CPU and memory are not billed. */
|
|
12
|
+
autocompleteExecutionMillicredits: number;
|
|
13
|
+
cpuMillicreditsPerSecond: number;
|
|
14
|
+
/** Per GB-second of the memory the profile allocates, GB = 1024 MB. */
|
|
15
|
+
memoryMillicreditsPerGbSecond: number;
|
|
16
|
+
/** Per MB sent out, MB = 1024 x 1024 bytes. */
|
|
17
|
+
networkOutMillicreditsPerMb: number;
|
|
18
|
+
httpCallMillicredits: number;
|
|
19
|
+
storeWriteMillicredits: number;
|
|
20
|
+
/** The memory of each profile, and the coefficient its CPU part is multiplied by. */
|
|
21
|
+
profiles: Record<ExecutionProfile, { memoryMb: number; cpuCoefficient: number }>;
|
|
22
|
+
}
|