@mostfeatured/dbi 0.0.69 → 0.0.70
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/data/eventMap.json +244 -234
- package/dist/methods/publishInteractions.d.ts.map +1 -1
- package/dist/methods/publishInteractions.js.map +1 -1
- package/dist/types/ApplicationRoleConnectionMetadata.d.ts +23 -0
- package/dist/types/ApplicationRoleConnectionMetadata.d.ts.map +1 -0
- package/dist/types/ApplicationRoleConnectionMetadata.js +15 -0
- package/dist/types/ApplicationRoleConnectionMetadata.js.map +1 -0
- package/dist/types/Event.d.ts +275 -265
- package/dist/types/Event.d.ts.map +1 -1
- package/dist/types/Event.js.map +1 -1
- package/package.json +2 -2
- package/src/data/eventMap.json +10 -0
- package/src/methods/publishInteractions.ts +1 -0
- package/src/types/ApplicationRoleConnectionMetadata.ts +19 -0
- package/src/types/Event.ts +3 -0
package/dist/data/eventMap.json
CHANGED
|
@@ -1,234 +1,244 @@
|
|
|
1
|
-
{
|
|
2
|
-
"applicationCommandPermissionsUpdate": [
|
|
3
|
-
"data"
|
|
4
|
-
],
|
|
5
|
-
"cacheSweep": [
|
|
6
|
-
"message"
|
|
7
|
-
],
|
|
8
|
-
"channelCreate": [
|
|
9
|
-
"channel"
|
|
10
|
-
],
|
|
11
|
-
"channelDelete": [
|
|
12
|
-
"channel"
|
|
13
|
-
],
|
|
14
|
-
"channelPinsUpdate": [
|
|
15
|
-
"channel",
|
|
16
|
-
"date"
|
|
17
|
-
],
|
|
18
|
-
"channelUpdate": [
|
|
19
|
-
"oldChannel",
|
|
20
|
-
"newChannel"
|
|
21
|
-
],
|
|
22
|
-
"debug": [
|
|
23
|
-
"message"
|
|
24
|
-
],
|
|
25
|
-
"warn": [
|
|
26
|
-
"message"
|
|
27
|
-
],
|
|
28
|
-
"emojiCreate": [
|
|
29
|
-
"emoji"
|
|
30
|
-
],
|
|
31
|
-
"emojiDelete": [
|
|
32
|
-
"emoji"
|
|
33
|
-
],
|
|
34
|
-
"emojiUpdate": [
|
|
35
|
-
"oldEmoji",
|
|
36
|
-
"newEmoji"
|
|
37
|
-
],
|
|
38
|
-
"error": [
|
|
39
|
-
"error"
|
|
40
|
-
],
|
|
41
|
-
"guildBanAdd": [
|
|
42
|
-
"ban"
|
|
43
|
-
],
|
|
44
|
-
"guildBanRemove": [
|
|
45
|
-
"ban"
|
|
46
|
-
],
|
|
47
|
-
"guildCreate": [
|
|
48
|
-
"guild"
|
|
49
|
-
],
|
|
50
|
-
"guildDelete": [
|
|
51
|
-
"guild"
|
|
52
|
-
],
|
|
53
|
-
"guildUnavailable": [
|
|
54
|
-
"guild"
|
|
55
|
-
],
|
|
56
|
-
"guildIntegrationsUpdate": [
|
|
57
|
-
"guild"
|
|
58
|
-
],
|
|
59
|
-
"guildMemberAdd": [
|
|
60
|
-
"member"
|
|
61
|
-
],
|
|
62
|
-
"guildMemberAvailable": [
|
|
63
|
-
"member"
|
|
64
|
-
],
|
|
65
|
-
"guildMemberRemove": [
|
|
66
|
-
"member"
|
|
67
|
-
],
|
|
68
|
-
"guildMembersChunk": [
|
|
69
|
-
"members",
|
|
70
|
-
"guild",
|
|
71
|
-
"data"
|
|
72
|
-
],
|
|
73
|
-
"guildMemberUpdate": [
|
|
74
|
-
"oldMember",
|
|
75
|
-
"newMember"
|
|
76
|
-
],
|
|
77
|
-
"guildUpdate": [
|
|
78
|
-
"oldGuild",
|
|
79
|
-
"newGuild"
|
|
80
|
-
],
|
|
81
|
-
"inviteCreate": [
|
|
82
|
-
"invite"
|
|
83
|
-
],
|
|
84
|
-
"inviteDelete": [
|
|
85
|
-
"invite"
|
|
86
|
-
],
|
|
87
|
-
"messageCreate": [
|
|
88
|
-
"message"
|
|
89
|
-
],
|
|
90
|
-
"messageDelete": [
|
|
91
|
-
"message"
|
|
92
|
-
],
|
|
93
|
-
"messageReactionRemoveAll": [
|
|
94
|
-
"message",
|
|
95
|
-
"reactions"
|
|
96
|
-
],
|
|
97
|
-
"messageReactionRemoveEmoji": [
|
|
98
|
-
"reaction"
|
|
99
|
-
],
|
|
100
|
-
"messageDeleteBulk": [
|
|
101
|
-
"messages",
|
|
102
|
-
"channel"
|
|
103
|
-
],
|
|
104
|
-
"messageReactionAdd": [
|
|
105
|
-
"reaction",
|
|
106
|
-
"user"
|
|
107
|
-
],
|
|
108
|
-
"messageReactionRemove": [
|
|
109
|
-
"reaction",
|
|
110
|
-
"user"
|
|
111
|
-
],
|
|
112
|
-
"messageUpdate": [
|
|
113
|
-
"oldMessage",
|
|
114
|
-
"newMessage"
|
|
115
|
-
],
|
|
116
|
-
"presenceUpdate": [
|
|
117
|
-
"oldPresence",
|
|
118
|
-
"newPresence"
|
|
119
|
-
],
|
|
120
|
-
"ready": [
|
|
121
|
-
"client"
|
|
122
|
-
],
|
|
123
|
-
"invalidated": [
|
|
124
|
-
"undefined"
|
|
125
|
-
],
|
|
126
|
-
"roleCreate": [
|
|
127
|
-
"role"
|
|
128
|
-
],
|
|
129
|
-
"roleDelete": [
|
|
130
|
-
"role"
|
|
131
|
-
],
|
|
132
|
-
"roleUpdate": [
|
|
133
|
-
"oldRole",
|
|
134
|
-
"newRole"
|
|
135
|
-
],
|
|
136
|
-
"threadCreate": [
|
|
137
|
-
"thread",
|
|
138
|
-
"newlyCreated"
|
|
139
|
-
],
|
|
140
|
-
"threadDelete": [
|
|
141
|
-
"thread"
|
|
142
|
-
],
|
|
143
|
-
"threadListSync": [
|
|
144
|
-
"threads",
|
|
145
|
-
"guild"
|
|
146
|
-
],
|
|
147
|
-
"threadMemberUpdate": [
|
|
148
|
-
"oldMember",
|
|
149
|
-
"newMember"
|
|
150
|
-
],
|
|
151
|
-
"threadMembersUpdate": [
|
|
152
|
-
"addedMembers",
|
|
153
|
-
"removedMembers",
|
|
154
|
-
"thread"
|
|
155
|
-
],
|
|
156
|
-
"threadUpdate": [
|
|
157
|
-
"oldThread",
|
|
158
|
-
"newThread"
|
|
159
|
-
],
|
|
160
|
-
"typingStart": [
|
|
161
|
-
"typing"
|
|
162
|
-
],
|
|
163
|
-
"userUpdate": [
|
|
164
|
-
"oldUser",
|
|
165
|
-
"newUser"
|
|
166
|
-
],
|
|
167
|
-
"voiceStateUpdate": [
|
|
168
|
-
"oldState",
|
|
169
|
-
"newState"
|
|
170
|
-
],
|
|
171
|
-
"webhookUpdate": [
|
|
172
|
-
"channel"
|
|
173
|
-
],
|
|
174
|
-
"interactionCreate": [
|
|
175
|
-
"interaction"
|
|
176
|
-
],
|
|
177
|
-
"shardDisconnect": [
|
|
178
|
-
"closeEvent",
|
|
179
|
-
"shardId"
|
|
180
|
-
],
|
|
181
|
-
"shardError": [
|
|
182
|
-
"error",
|
|
183
|
-
"shardId"
|
|
184
|
-
],
|
|
185
|
-
"shardReady": [
|
|
186
|
-
"shardId",
|
|
187
|
-
"unavailableGuilds"
|
|
188
|
-
],
|
|
189
|
-
"shardReconnecting": [
|
|
190
|
-
"shardId"
|
|
191
|
-
],
|
|
192
|
-
"shardResume": [
|
|
193
|
-
"shardId",
|
|
194
|
-
"replayedEvents"
|
|
195
|
-
],
|
|
196
|
-
"stageInstanceCreate": [
|
|
197
|
-
"stageInstance"
|
|
198
|
-
],
|
|
199
|
-
"stageInstanceUpdate": [
|
|
200
|
-
"oldStageInstance",
|
|
201
|
-
"newStageInstance"
|
|
202
|
-
],
|
|
203
|
-
"stageInstanceDelete": [
|
|
204
|
-
"stageInstance"
|
|
205
|
-
],
|
|
206
|
-
"stickerCreate": [
|
|
207
|
-
"sticker"
|
|
208
|
-
],
|
|
209
|
-
"stickerDelete": [
|
|
210
|
-
"sticker"
|
|
211
|
-
],
|
|
212
|
-
"stickerUpdate": [
|
|
213
|
-
"oldSticker",
|
|
214
|
-
"newSticker"
|
|
215
|
-
],
|
|
216
|
-
"guildScheduledEventCreate": [
|
|
217
|
-
"guildScheduledEvent"
|
|
218
|
-
],
|
|
219
|
-
"guildScheduledEventUpdate": [
|
|
220
|
-
"oldGuildScheduledEvent",
|
|
221
|
-
"newGuildScheduledEvent"
|
|
222
|
-
],
|
|
223
|
-
"guildScheduledEventDelete": [
|
|
224
|
-
"guildScheduledEvent"
|
|
225
|
-
],
|
|
226
|
-
"guildScheduledEventUserAdd": [
|
|
227
|
-
"guildScheduledEvent",
|
|
228
|
-
"user"
|
|
229
|
-
],
|
|
230
|
-
"guildScheduledEventUserRemove": [
|
|
231
|
-
"guildScheduledEvent",
|
|
232
|
-
"user"
|
|
233
|
-
]
|
|
234
|
-
|
|
1
|
+
{
|
|
2
|
+
"applicationCommandPermissionsUpdate": [
|
|
3
|
+
"data"
|
|
4
|
+
],
|
|
5
|
+
"cacheSweep": [
|
|
6
|
+
"message"
|
|
7
|
+
],
|
|
8
|
+
"channelCreate": [
|
|
9
|
+
"channel"
|
|
10
|
+
],
|
|
11
|
+
"channelDelete": [
|
|
12
|
+
"channel"
|
|
13
|
+
],
|
|
14
|
+
"channelPinsUpdate": [
|
|
15
|
+
"channel",
|
|
16
|
+
"date"
|
|
17
|
+
],
|
|
18
|
+
"channelUpdate": [
|
|
19
|
+
"oldChannel",
|
|
20
|
+
"newChannel"
|
|
21
|
+
],
|
|
22
|
+
"debug": [
|
|
23
|
+
"message"
|
|
24
|
+
],
|
|
25
|
+
"warn": [
|
|
26
|
+
"message"
|
|
27
|
+
],
|
|
28
|
+
"emojiCreate": [
|
|
29
|
+
"emoji"
|
|
30
|
+
],
|
|
31
|
+
"emojiDelete": [
|
|
32
|
+
"emoji"
|
|
33
|
+
],
|
|
34
|
+
"emojiUpdate": [
|
|
35
|
+
"oldEmoji",
|
|
36
|
+
"newEmoji"
|
|
37
|
+
],
|
|
38
|
+
"error": [
|
|
39
|
+
"error"
|
|
40
|
+
],
|
|
41
|
+
"guildBanAdd": [
|
|
42
|
+
"ban"
|
|
43
|
+
],
|
|
44
|
+
"guildBanRemove": [
|
|
45
|
+
"ban"
|
|
46
|
+
],
|
|
47
|
+
"guildCreate": [
|
|
48
|
+
"guild"
|
|
49
|
+
],
|
|
50
|
+
"guildDelete": [
|
|
51
|
+
"guild"
|
|
52
|
+
],
|
|
53
|
+
"guildUnavailable": [
|
|
54
|
+
"guild"
|
|
55
|
+
],
|
|
56
|
+
"guildIntegrationsUpdate": [
|
|
57
|
+
"guild"
|
|
58
|
+
],
|
|
59
|
+
"guildMemberAdd": [
|
|
60
|
+
"member"
|
|
61
|
+
],
|
|
62
|
+
"guildMemberAvailable": [
|
|
63
|
+
"member"
|
|
64
|
+
],
|
|
65
|
+
"guildMemberRemove": [
|
|
66
|
+
"member"
|
|
67
|
+
],
|
|
68
|
+
"guildMembersChunk": [
|
|
69
|
+
"members",
|
|
70
|
+
"guild",
|
|
71
|
+
"data"
|
|
72
|
+
],
|
|
73
|
+
"guildMemberUpdate": [
|
|
74
|
+
"oldMember",
|
|
75
|
+
"newMember"
|
|
76
|
+
],
|
|
77
|
+
"guildUpdate": [
|
|
78
|
+
"oldGuild",
|
|
79
|
+
"newGuild"
|
|
80
|
+
],
|
|
81
|
+
"inviteCreate": [
|
|
82
|
+
"invite"
|
|
83
|
+
],
|
|
84
|
+
"inviteDelete": [
|
|
85
|
+
"invite"
|
|
86
|
+
],
|
|
87
|
+
"messageCreate": [
|
|
88
|
+
"message"
|
|
89
|
+
],
|
|
90
|
+
"messageDelete": [
|
|
91
|
+
"message"
|
|
92
|
+
],
|
|
93
|
+
"messageReactionRemoveAll": [
|
|
94
|
+
"message",
|
|
95
|
+
"reactions"
|
|
96
|
+
],
|
|
97
|
+
"messageReactionRemoveEmoji": [
|
|
98
|
+
"reaction"
|
|
99
|
+
],
|
|
100
|
+
"messageDeleteBulk": [
|
|
101
|
+
"messages",
|
|
102
|
+
"channel"
|
|
103
|
+
],
|
|
104
|
+
"messageReactionAdd": [
|
|
105
|
+
"reaction",
|
|
106
|
+
"user"
|
|
107
|
+
],
|
|
108
|
+
"messageReactionRemove": [
|
|
109
|
+
"reaction",
|
|
110
|
+
"user"
|
|
111
|
+
],
|
|
112
|
+
"messageUpdate": [
|
|
113
|
+
"oldMessage",
|
|
114
|
+
"newMessage"
|
|
115
|
+
],
|
|
116
|
+
"presenceUpdate": [
|
|
117
|
+
"oldPresence",
|
|
118
|
+
"newPresence"
|
|
119
|
+
],
|
|
120
|
+
"ready": [
|
|
121
|
+
"client"
|
|
122
|
+
],
|
|
123
|
+
"invalidated": [
|
|
124
|
+
"undefined"
|
|
125
|
+
],
|
|
126
|
+
"roleCreate": [
|
|
127
|
+
"role"
|
|
128
|
+
],
|
|
129
|
+
"roleDelete": [
|
|
130
|
+
"role"
|
|
131
|
+
],
|
|
132
|
+
"roleUpdate": [
|
|
133
|
+
"oldRole",
|
|
134
|
+
"newRole"
|
|
135
|
+
],
|
|
136
|
+
"threadCreate": [
|
|
137
|
+
"thread",
|
|
138
|
+
"newlyCreated"
|
|
139
|
+
],
|
|
140
|
+
"threadDelete": [
|
|
141
|
+
"thread"
|
|
142
|
+
],
|
|
143
|
+
"threadListSync": [
|
|
144
|
+
"threads",
|
|
145
|
+
"guild"
|
|
146
|
+
],
|
|
147
|
+
"threadMemberUpdate": [
|
|
148
|
+
"oldMember",
|
|
149
|
+
"newMember"
|
|
150
|
+
],
|
|
151
|
+
"threadMembersUpdate": [
|
|
152
|
+
"addedMembers",
|
|
153
|
+
"removedMembers",
|
|
154
|
+
"thread"
|
|
155
|
+
],
|
|
156
|
+
"threadUpdate": [
|
|
157
|
+
"oldThread",
|
|
158
|
+
"newThread"
|
|
159
|
+
],
|
|
160
|
+
"typingStart": [
|
|
161
|
+
"typing"
|
|
162
|
+
],
|
|
163
|
+
"userUpdate": [
|
|
164
|
+
"oldUser",
|
|
165
|
+
"newUser"
|
|
166
|
+
],
|
|
167
|
+
"voiceStateUpdate": [
|
|
168
|
+
"oldState",
|
|
169
|
+
"newState"
|
|
170
|
+
],
|
|
171
|
+
"webhookUpdate": [
|
|
172
|
+
"channel"
|
|
173
|
+
],
|
|
174
|
+
"interactionCreate": [
|
|
175
|
+
"interaction"
|
|
176
|
+
],
|
|
177
|
+
"shardDisconnect": [
|
|
178
|
+
"closeEvent",
|
|
179
|
+
"shardId"
|
|
180
|
+
],
|
|
181
|
+
"shardError": [
|
|
182
|
+
"error",
|
|
183
|
+
"shardId"
|
|
184
|
+
],
|
|
185
|
+
"shardReady": [
|
|
186
|
+
"shardId",
|
|
187
|
+
"unavailableGuilds"
|
|
188
|
+
],
|
|
189
|
+
"shardReconnecting": [
|
|
190
|
+
"shardId"
|
|
191
|
+
],
|
|
192
|
+
"shardResume": [
|
|
193
|
+
"shardId",
|
|
194
|
+
"replayedEvents"
|
|
195
|
+
],
|
|
196
|
+
"stageInstanceCreate": [
|
|
197
|
+
"stageInstance"
|
|
198
|
+
],
|
|
199
|
+
"stageInstanceUpdate": [
|
|
200
|
+
"oldStageInstance",
|
|
201
|
+
"newStageInstance"
|
|
202
|
+
],
|
|
203
|
+
"stageInstanceDelete": [
|
|
204
|
+
"stageInstance"
|
|
205
|
+
],
|
|
206
|
+
"stickerCreate": [
|
|
207
|
+
"sticker"
|
|
208
|
+
],
|
|
209
|
+
"stickerDelete": [
|
|
210
|
+
"sticker"
|
|
211
|
+
],
|
|
212
|
+
"stickerUpdate": [
|
|
213
|
+
"oldSticker",
|
|
214
|
+
"newSticker"
|
|
215
|
+
],
|
|
216
|
+
"guildScheduledEventCreate": [
|
|
217
|
+
"guildScheduledEvent"
|
|
218
|
+
],
|
|
219
|
+
"guildScheduledEventUpdate": [
|
|
220
|
+
"oldGuildScheduledEvent",
|
|
221
|
+
"newGuildScheduledEvent"
|
|
222
|
+
],
|
|
223
|
+
"guildScheduledEventDelete": [
|
|
224
|
+
"guildScheduledEvent"
|
|
225
|
+
],
|
|
226
|
+
"guildScheduledEventUserAdd": [
|
|
227
|
+
"guildScheduledEvent",
|
|
228
|
+
"user"
|
|
229
|
+
],
|
|
230
|
+
"guildScheduledEventUserRemove": [
|
|
231
|
+
"guildScheduledEvent",
|
|
232
|
+
"user"
|
|
233
|
+
],
|
|
234
|
+
"autoModerationRuleCreate": [
|
|
235
|
+
"autoModerationRule"
|
|
236
|
+
],
|
|
237
|
+
"autoModerationRuleDelete": [
|
|
238
|
+
"autoModerationRule"
|
|
239
|
+
],
|
|
240
|
+
"autoModerationRuleUpdate": [
|
|
241
|
+
"oldAutoModerationRule",
|
|
242
|
+
"newAutoModerationRule"
|
|
243
|
+
]
|
|
244
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishInteractions.d.ts","sourceRoot":"","sources":["../../src/methods/publishInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK5D,OAAO,EAAO,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"publishInteractions.d.ts","sourceRoot":"","sources":["../../src/methods/publishInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK5D,OAAO,EAAO,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAM/D,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EACxC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC,EACtE,mBAAmB,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACrE,WAAW,EAAE,OAAO,GAAG,QAAQ,EAC/B,OAAO,CAAC,EAAE,MAAM,iBA0KjB;AAED,wBAAgB,gBAAgB,CAAC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;oBAElE,YAAY,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;gBACxC,CAAC,CAAC,CAAC;gBAEH,YAAY,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC;gBACvD,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC;YACvE,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,WAAW;QACX,cAAc;QACd,kBAAkB;QAClB,cAAc;KACf,CAAA;AACH,CAAC;AAhDD,oCAgDC","sourcesContent":["import Discord from \"discord.js\";\r\nimport { DBIChatInput } from \"../types/ChatInput/ChatInput\";\r\nimport { REST } from \"@discordjs/rest\";\r\nimport { Routes, RESTGetAPIUserResult, RESTPutAPIApplicationCommandsJSONBody, ApplicationCommandType, ApplicationCommandOptionType } from \"discord-api-types/v9\";\r\nimport { reducePermissions } from \"../utils/permissions\";\r\nimport snakecaseKeys from \"snakecase-keys\";\r\nimport { DBI, DBIClientData } from \"../DBI\";\r\nimport { DBIInteractionLocale } from \"../types/InteractionLocale\";\r\nimport { NamespaceEnums } from \"../../generated/namespaceData\";\r\n\r\nconst PUBLISHABLE_TYPES = [\"ChatInput\", \"UserContextMenu\", \"MessageContextMenu\"];\r\nconst ORIGINAL_LOCALES = [\"da\", \"de\", \"en-GB\", \"en-US\", \"es-ES\", \"fr\", \"hr\", \"it\", \"lt\", \"hu\", \"nl\", \"no\", \"pl\", \"pt-BR\", \"ro\", \"fi\", \"sv-SE\", \"vi\", \"tr\", \"cs\", \"el\", \"bg\", \"ru\", \"uk\", \"hi\", \"th\", \"zh-CN\", \"ja\", \"zh-TW\", \"ko\"];\r\n\r\nexport async function publishInteractions(\r\n clients: DBIClientData<NamespaceEnums>[],\r\n interactions: Discord.Collection<string, DBIChatInput<NamespaceEnums>>,\r\n interactionsLocales: Discord.Collection<string, DBIInteractionLocale>,\r\n publishType: \"Guild\" | \"Global\",\r\n guildId?: string\r\n) {\r\n interactions = interactions.filter(i => PUBLISHABLE_TYPES.includes(i.type));\r\n interactions = interactions.sort((a, b) => b.name.split(\" \").length - a.name.split(\" \").length);\r\n\r\n let body: {[k: string]: RESTPutAPIApplicationCommandsJSONBody} =\r\n interactions.reduce((all, current) => {\r\n if (current.publish && !all[current.publish]) all[current.publish] = [];\r\n switch (current.type) {\r\n case \"ChatInput\": {\r\n let nameSplitted = current.name.split(\" \");\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n switch (nameSplitted.length) {\r\n case 1: {\r\n all[current.publish].push({\r\n type: ApplicationCommandType.ChatInput,\r\n description: current.description,\r\n name: nameSplitted[0],\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(0),\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n break;\r\n }\r\n case 2: {\r\n let baseItem = all[current.publish].find(i => i.name == current.name.split(\" \")[0] && i.type == ApplicationCommandType.ChatInput);\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n let option = {\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[1],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(1),\r\n description_localizations: localeData.descriptionLocales,\r\n };\r\n if (!baseItem) {\r\n all[current.publish].push({\r\n type: ApplicationCommandType.ChatInput,\r\n name: nameSplitted[0],\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n name_localizations: localeData.nameLocales(0),\r\n description: \"...\",\r\n options: [\r\n option\r\n ]\r\n });\r\n } else {\r\n baseItem.options.push(option);\r\n }\r\n break;\r\n }\r\n case 3: {\r\n let level1Item = all[current.publish].find(i => i.name == current.name.split(\" \")[0] && i.type == ApplicationCommandType.ChatInput);\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n if (!level1Item) {\r\n all[current.publish].push({\r\n type: ApplicationCommandType.ChatInput,\r\n name: nameSplitted[0],\r\n name_localizations: localeData.nameLocales(0),\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n description: \"...\",\r\n options: [\r\n {\r\n type: ApplicationCommandOptionType.SubcommandGroup,\r\n name: nameSplitted[1],\r\n name_localizations: localeData.nameLocales(1),\r\n description: \"...\",\r\n options: [\r\n {\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[2],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(2),\r\n description_localizations: localeData.descriptionLocales,\r\n }\r\n ]\r\n }\r\n ]\r\n });\r\n } else {\r\n let level2Item = level1Item.options.find(i => i.name == current.name.split(\" \")[1]);\r\n if (!level2Item) {\r\n level1Item.options.push({\r\n type: ApplicationCommandOptionType.SubcommandGroup,\r\n name: nameSplitted[1],\r\n name_localizations: localeData.nameLocales(1),\r\n description: \"...\",\r\n options: [\r\n {\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[2],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(2),\r\n description_localizations: localeData.descriptionLocales\r\n }\r\n ]\r\n })\r\n } else {\r\n level2Item.options.push({\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[2],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(2),\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n case \"MessageContextMenu\": {\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n all[current.publish].push({\r\n type: ApplicationCommandType.Message,\r\n name: current.name,\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n dm_permission: current.directMessages,\r\n name_localizations: localeData.allNameLocales,\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n break;\r\n }\r\n case \"UserContextMenu\": {\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n all[current.publish].push({\r\n type: ApplicationCommandType.User,\r\n name: current.name,\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n dm_permission: current.directMessages,\r\n name_localizations: localeData.allNameLocales,\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n break;\r\n }\r\n }\r\n\r\n return all;\r\n }, {} as {[k: string]: any});\r\n \r\n\r\n for (let i = 0; i < clients.length; i++) {\r\n const client = clients[i];\r\n const rest = new REST({ version: \"10\" });\r\n rest.setToken(client.token);\r\n \r\n const me: RESTGetAPIUserResult = await rest.get(Routes.user()) as any;\r\n \r\n switch (publishType) {\r\n case \"Guild\": {\r\n await rest.put(Routes.applicationGuildCommands(me.id, guildId), { body: body[client.namespace] || [] });\r\n break;\r\n }\r\n case \"Global\": {\r\n await rest.put(Routes.applicationCommands(me.id), { body: body[client.namespace] || [] });\r\n break;\r\n }\r\n }\r\n }\r\n \r\n}\r\n\r\nexport function localeifyOptions(options: any[], localeData: any): any[] {\r\n return options.map(i => {\r\n let optionData = localeData[i.name];\r\n return optionData ? Object.assign(i, {\r\n name_localizations: optionData.nameLocales,\r\n description_localizations: optionData.descriptionLocales,\r\n choices: i.choices ? i.choices.map((j) => {\r\n let choiceLocale = optionData.choiceLocales[j.name];\r\n return choiceLocale ? Object.assign(j, {\r\n name_localizations: choiceLocale\r\n }) : j;\r\n }) : undefined\r\n }) : i;\r\n })\r\n}\r\n\r\nexport function formatLocale(locale: DBIInteractionLocale): any {\r\n let allNameLocales = {};\r\n let descriptionLocales = {};\r\n let optionsLocales = {};\r\n\r\n function nameLocales(index) {\r\n return Object.fromEntries(Object.entries(allNameLocales).map(i => [i[0], (i[1] as string).split(\" \").at(index)]));\r\n }\r\n\r\n if (!locale?.data) return {\r\n nameLocales,\r\n allNameLocales,\r\n descriptionLocales,\r\n optionsLocales\r\n };\r\n\r\n Object.entries(locale.data).forEach(([shortLocale, localeData]) => {\r\n let longAliases = ORIGINAL_LOCALES.filter(i => i.split(\"-\").at(0) == shortLocale);\r\n longAliases.forEach((longLocale) => {\r\n allNameLocales[longLocale] = localeData.name;\r\n descriptionLocales[longLocale] = localeData.description;\r\n Object.entries(localeData?.options || {}).forEach(([optionName, optionData]) => {\r\n if (!optionsLocales[optionName]) optionsLocales[optionName] = {};\r\n let optionLocale = optionsLocales[optionName];\r\n if (!optionLocale.nameLocales) optionLocale.nameLocales = {};\r\n if (!optionLocale.descriptionLocales) optionLocale.descriptionLocales = {};\r\n if (!optionLocale.choiceLocales) optionLocale.choiceLocales = {};\r\n\r\n Object.entries(optionData?.choices || {}).forEach(([choiceOriginalName, choiceName]) => {\r\n if (!optionLocale.choiceLocales) optionLocale.choiceLocales = {};\r\n if (!optionLocale.choiceLocales[choiceOriginalName]) optionLocale.choiceLocales[choiceOriginalName] = {};\r\n let choiceLocale = optionLocale.choiceLocales[choiceOriginalName];\r\n \r\n choiceLocale[longLocale] = choiceName;\r\n });\r\n\r\n optionLocale.nameLocales[longLocale] = optionData.name;\r\n optionLocale.descriptionLocales[longLocale] = optionData.description;\r\n })\r\n });\r\n });\r\n \r\n return {\r\n nameLocales,\r\n allNameLocales,\r\n descriptionLocales,\r\n optionsLocales\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"file":"publishInteractions.js","sourceRoot":"","sources":["../../src/methods/publishInteractions.ts"],"names":[],"mappings":";;;AAEA,0CAAuC;AACvC,6CAAiK;AACjK,sDAAyD;AAOzD,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;AACjF,MAAM,gBAAg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cesContent":["import Discord from \"discord.js\";\r\nimport { DBIChatInput } from \"../types/ChatInput/ChatInput\";\r\nimport { REST } from \"@discordjs/rest\";\r\nimport { Routes, RESTGetAPIUserResult, RESTPutAPIApplicationCommandsJSONBody, ApplicationCommandType, ApplicationCommandOptionType } from \"discord-api-types/v9\";\r\nimport { reducePermissions } from \"../utils/permissions\";\r\nimport snakecaseKeys from \"snakecase-keys\";\r\nimport { DBI, DBIClientData } from \"../DBI\";\r\nimport { DBIInteractionLocale } from \"../types/InteractionLocale\";\r\nimport { NamespaceEnums } from \"../../generated/namespaceData\";\r\nimport { ApplicationRoleConnectionMetadataType, ApplicationRoleConnectionMetadata } from \"../types/ApplicationRoleConnectionMetadata\";\r\n\r\nconst PUBLISHABLE_TYPES = [\"ChatInput\", \"UserContextMenu\", \"MessageContextMenu\"];\r\nconst ORIGINAL_LOCALES = [\"da\", \"de\", \"en-GB\", \"en-US\", \"es-ES\", \"fr\", \"hr\", \"it\", \"lt\", \"hu\", \"nl\", \"no\", \"pl\", \"pt-BR\", \"ro\", \"fi\", \"sv-SE\", \"vi\", \"tr\", \"cs\", \"el\", \"bg\", \"ru\", \"uk\", \"hi\", \"th\", \"zh-CN\", \"ja\", \"zh-TW\", \"ko\"];\r\n\r\nexport async function publishInteractions(\r\n clients: DBIClientData<NamespaceEnums>[],\r\n interactions: Discord.Collection<string, DBIChatInput<NamespaceEnums>>,\r\n interactionsLocales: Discord.Collection<string, DBIInteractionLocale>,\r\n publishType: \"Guild\" | \"Global\",\r\n guildId?: string\r\n) {\r\n interactions = interactions.filter(i => PUBLISHABLE_TYPES.includes(i.type));\r\n interactions = interactions.sort((a, b) => b.name.split(\" \").length - a.name.split(\" \").length);\r\n\r\n let body: {[k: string]: RESTPutAPIApplicationCommandsJSONBody} =\r\n interactions.reduce((all, current) => {\r\n if (current.publish && !all[current.publish]) all[current.publish] = [];\r\n switch (current.type) {\r\n case \"ChatInput\": {\r\n let nameSplitted = current.name.split(\" \");\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n switch (nameSplitted.length) {\r\n case 1: {\r\n all[current.publish].push({\r\n type: ApplicationCommandType.ChatInput,\r\n description: current.description,\r\n name: nameSplitted[0],\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(0),\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n break;\r\n }\r\n case 2: {\r\n let baseItem = all[current.publish].find(i => i.name == current.name.split(\" \")[0] && i.type == ApplicationCommandType.ChatInput);\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n let option = {\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[1],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(1),\r\n description_localizations: localeData.descriptionLocales,\r\n };\r\n if (!baseItem) {\r\n all[current.publish].push({\r\n type: ApplicationCommandType.ChatInput,\r\n name: nameSplitted[0],\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n name_localizations: localeData.nameLocales(0),\r\n description: \"...\",\r\n options: [\r\n option\r\n ]\r\n });\r\n } else {\r\n baseItem.options.push(option);\r\n }\r\n break;\r\n }\r\n case 3: {\r\n let level1Item = all[current.publish].find(i => i.name == current.name.split(\" \")[0] && i.type == ApplicationCommandType.ChatInput);\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n if (!level1Item) {\r\n all[current.publish].push({\r\n type: ApplicationCommandType.ChatInput,\r\n name: nameSplitted[0],\r\n name_localizations: localeData.nameLocales(0),\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n description: \"...\",\r\n options: [\r\n {\r\n type: ApplicationCommandOptionType.SubcommandGroup,\r\n name: nameSplitted[1],\r\n name_localizations: localeData.nameLocales(1),\r\n description: \"...\",\r\n options: [\r\n {\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[2],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(2),\r\n description_localizations: localeData.descriptionLocales,\r\n }\r\n ]\r\n }\r\n ]\r\n });\r\n } else {\r\n let level2Item = level1Item.options.find(i => i.name == current.name.split(\" \")[1]);\r\n if (!level2Item) {\r\n level1Item.options.push({\r\n type: ApplicationCommandOptionType.SubcommandGroup,\r\n name: nameSplitted[1],\r\n name_localizations: localeData.nameLocales(1),\r\n description: \"...\",\r\n options: [\r\n {\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[2],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(2),\r\n description_localizations: localeData.descriptionLocales\r\n }\r\n ]\r\n })\r\n } else {\r\n level2Item.options.push({\r\n type: ApplicationCommandOptionType.Subcommand,\r\n name: nameSplitted[2],\r\n description: current.description,\r\n dm_permission: current.directMessages,\r\n options: localeifyOptions(current.options || [], localeData.optionsLocales),\r\n name_localizations: localeData.nameLocales(2),\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n case \"MessageContextMenu\": {\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n all[current.publish].push({\r\n type: ApplicationCommandType.Message,\r\n name: current.name,\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n dm_permission: current.directMessages,\r\n name_localizations: localeData.allNameLocales,\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n break;\r\n }\r\n case \"UserContextMenu\": {\r\n let localeData = formatLocale(interactionsLocales.get(current.name) ?? {} as any);\r\n all[current.publish].push({\r\n type: ApplicationCommandType.User,\r\n name: current.name,\r\n default_member_permissions: reducePermissions(current.defaultMemberPermissions).toString(),\r\n dm_permission: current.directMessages,\r\n name_localizations: localeData.allNameLocales,\r\n description_localizations: localeData.descriptionLocales,\r\n });\r\n break;\r\n }\r\n }\r\n\r\n return all;\r\n }, {} as {[k: string]: any});\r\n \r\n\r\n for (let i = 0; i < clients.length; i++) {\r\n const client = clients[i];\r\n const rest = new REST({ version: \"10\" });\r\n rest.setToken(client.token);\r\n \r\n const me: RESTGetAPIUserResult = await rest.get(Routes.user()) as any;\r\n \r\n switch (publishType) {\r\n case \"Guild\": {\r\n await rest.put(Routes.applicationGuildCommands(me.id, guildId), { body: body[client.namespace] || [] });\r\n break;\r\n }\r\n case \"Global\": {\r\n await rest.put(Routes.applicationCommands(me.id), { body: body[client.namespace] || [] });\r\n break;\r\n }\r\n }\r\n }\r\n \r\n}\r\n\r\nexport function localeifyOptions(options: any[], localeData: any): any[] {\r\n return options.map(i => {\r\n let optionData = localeData[i.name];\r\n return optionData ? Object.assign(i, {\r\n name_localizations: optionData.nameLocales,\r\n description_localizations: optionData.descriptionLocales,\r\n choices: i.choices ? i.choices.map((j) => {\r\n let choiceLocale = optionData.choiceLocales[j.name];\r\n return choiceLocale ? Object.assign(j, {\r\n name_localizations: choiceLocale\r\n }) : j;\r\n }) : undefined\r\n }) : i;\r\n })\r\n}\r\n\r\nexport function formatLocale(locale: DBIInteractionLocale): any {\r\n let allNameLocales = {};\r\n let descriptionLocales = {};\r\n let optionsLocales = {};\r\n\r\n function nameLocales(index) {\r\n return Object.fromEntries(Object.entries(allNameLocales).map(i => [i[0], (i[1] as string).split(\" \").at(index)]));\r\n }\r\n\r\n if (!locale?.data) return {\r\n nameLocales,\r\n allNameLocales,\r\n descriptionLocales,\r\n optionsLocales\r\n };\r\n\r\n Object.entries(locale.data).forEach(([shortLocale, localeData]) => {\r\n let longAliases = ORIGINAL_LOCALES.filter(i => i.split(\"-\").at(0) == shortLocale);\r\n longAliases.forEach((longLocale) => {\r\n allNameLocales[longLocale] = localeData.name;\r\n descriptionLocales[longLocale] = localeData.description;\r\n Object.entries(localeData?.options || {}).forEach(([optionName, optionData]) => {\r\n if (!optionsLocales[optionName]) optionsLocales[optionName] = {};\r\n let optionLocale = optionsLocales[optionName];\r\n if (!optionLocale.nameLocales) optionLocale.nameLocales = {};\r\n if (!optionLocale.descriptionLocales) optionLocale.descriptionLocales = {};\r\n if (!optionLocale.choiceLocales) optionLocale.choiceLocales = {};\r\n\r\n Object.entries(optionData?.choices || {}).forEach(([choiceOriginalName, choiceName]) => {\r\n if (!optionLocale.choiceLocales) optionLocale.choiceLocales = {};\r\n if (!optionLocale.choiceLocales[choiceOriginalName]) optionLocale.choiceLocales[choiceOriginalName] = {};\r\n let choiceLocale = optionLocale.choiceLocales[choiceOriginalName];\r\n \r\n choiceLocale[longLocale] = choiceName;\r\n });\r\n\r\n optionLocale.nameLocales[longLocale] = optionData.name;\r\n optionLocale.descriptionLocales[longLocale] = optionData.description;\r\n })\r\n });\r\n });\r\n \r\n return {\r\n nameLocales,\r\n allNameLocales,\r\n descriptionLocales,\r\n optionsLocales\r\n }\r\n}"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum ApplicationRoleConnectionMetadataType {
|
|
2
|
+
INTEGER_LESS_THAN_OR_EQUAL = 1,
|
|
3
|
+
INTEGER_GREATER_THAN_OR_EQUAL = 2,
|
|
4
|
+
INTEGER_EQUAL = 3,
|
|
5
|
+
INTEGER_NOT_EQUAL = 4,
|
|
6
|
+
DATETIME_LESS_THAN_OR_EQUAL = 5,
|
|
7
|
+
DATETIME_GREATER_THAN_OR_EQUAL = 6,
|
|
8
|
+
BOOLEAN_EQUAL = 7,
|
|
9
|
+
BOOLEAN_NOT_EQUAL = 8
|
|
10
|
+
}
|
|
11
|
+
export interface ApplicationRoleConnectionMetadata {
|
|
12
|
+
type: ApplicationRoleConnectionMetadataType;
|
|
13
|
+
key: string;
|
|
14
|
+
name: string;
|
|
15
|
+
name_localizations?: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
18
|
+
description: string;
|
|
19
|
+
description_localizations?: {
|
|
20
|
+
[key: string]: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ApplicationRoleConnectionMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationRoleConnectionMetadata.d.ts","sourceRoot":"","sources":["../../src/types/ApplicationRoleConnectionMetadata.ts"],"names":[],"mappings":"AAAA,oBAAY,qCAAqC;IAC7C,0BAA0B,IAAI;IAC9B,6BAA6B,IAAI;IACjC,aAAa,IAAI;IACjB,iBAAiB,IAAI;IACrB,2BAA2B,IAAI;IAC/B,8BAA8B,IAAI;IAClC,aAAa,IAAI;IACjB,iBAAiB,IAAI;CACxB;AAED,MAAM,WAAW,iCAAiC;IAC9C,IAAI,EAAE,qCAAqC,CAAC;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACzD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplicationRoleConnectionMetadataType = void 0;
|
|
4
|
+
var ApplicationRoleConnectionMetadataType;
|
|
5
|
+
(function (ApplicationRoleConnectionMetadataType) {
|
|
6
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["INTEGER_LESS_THAN_OR_EQUAL"] = 1] = "INTEGER_LESS_THAN_OR_EQUAL";
|
|
7
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["INTEGER_GREATER_THAN_OR_EQUAL"] = 2] = "INTEGER_GREATER_THAN_OR_EQUAL";
|
|
8
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["INTEGER_EQUAL"] = 3] = "INTEGER_EQUAL";
|
|
9
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["INTEGER_NOT_EQUAL"] = 4] = "INTEGER_NOT_EQUAL";
|
|
10
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["DATETIME_LESS_THAN_OR_EQUAL"] = 5] = "DATETIME_LESS_THAN_OR_EQUAL";
|
|
11
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["DATETIME_GREATER_THAN_OR_EQUAL"] = 6] = "DATETIME_GREATER_THAN_OR_EQUAL";
|
|
12
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["BOOLEAN_EQUAL"] = 7] = "BOOLEAN_EQUAL";
|
|
13
|
+
ApplicationRoleConnectionMetadataType[ApplicationRoleConnectionMetadataType["BOOLEAN_NOT_EQUAL"] = 8] = "BOOLEAN_NOT_EQUAL";
|
|
14
|
+
})(ApplicationRoleConnectionMetadataType = exports.ApplicationRoleConnectionMetadataType || (exports.ApplicationRoleConnectionMetadataType = {}));
|
|
15
|
+
//# sourceMappingURL=ApplicationRoleConnectionMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationRoleConnectionMetadata.js","sourceRoot":"","sources":["../../src/types/ApplicationRoleConnectionMetadata.ts"],"names":[],"mappings":";;;AAAA,IAAY,qCASX;AATD,WAAY,qCAAqC;IAC7C,6IAA8B,CAAA;IAC9B,mJAAiC,CAAA;IACjC,mHAAiB,CAAA;IACjB,2HAAqB,CAAA;IACrB,+IAA+B,CAAA;IAC/B,qJAAkC,CAAA;IAClC,mHAAiB,CAAA;IACjB,2HAAqB,CAAA;AACzB,CAAC,EATW,qCAAqC,GAArC,6CAAqC,KAArC,6CAAqC,QAShD","sourcesContent":["export enum ApplicationRoleConnectionMetadataType {\r\n INTEGER_LESS_THAN_OR_EQUAL = 1,\r\n INTEGER_GREATER_THAN_OR_EQUAL = 2,\r\n INTEGER_EQUAL = 3,\r\n INTEGER_NOT_EQUAL = 4,\r\n DATETIME_LESS_THAN_OR_EQUAL = 5,\r\n DATETIME_GREATER_THAN_OR_EQUAL = 6,\r\n BOOLEAN_EQUAL = 7,\r\n BOOLEAN_NOT_EQUAL = 8,\r\n}\r\n\r\nexport interface ApplicationRoleConnectionMetadata {\r\n type: ApplicationRoleConnectionMetadataType;\r\n key: string;\r\n name: string;\r\n name_localizations?: { [key: string]: string };\r\n description: string;\r\n description_localizations?: { [key: string]: string };\r\n}\r\n"]}
|