types-nora-api 0.0.473 → 0.0.474
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/api/graphql/index.d.ts +5 -1
- package/dist/api/graphql/index.js +5 -1
- package/dist/dtos/index.d.ts +2 -456
- package/dist/dtos/index.js +1 -180
- package/dist/menus/index.d.ts +117 -46
- package/dist/menus/index.js +5 -2
- package/dist/paginas/index.d.ts +106 -55
- package/dist/paginas/index.js +55 -2
- package/dist/uploads/index.d.ts +50 -2
- package/dist/ws/index.d.ts +294 -18
- package/dist/ws/index.js +118 -2
- package/package.json +1 -1
package/dist/ws/index.d.ts
CHANGED
|
@@ -1,5 +1,281 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { CaminhoArquivoAvatar, CodigoRecuperarFichaRuntime, J_DadosFichaEmJogo, LogicaJogoUsuario_EstouEmJogoDto, LogicaJogoUsuario_ObjetoEmJogoDto, MensagemSalaJogo, SalaDeJogoDto, SalaDeJogo_Codigo, SalaDeJogo_SessaoDto, UsuarioParaObjetoAutenticacaoDto } from '../dtos';
|
|
2
|
+
import type { PaginaTemplate } from '../paginas';
|
|
3
|
+
interface MensagemChatRecebida {
|
|
4
|
+
salaId: string;
|
|
5
|
+
idUsuario: number;
|
|
6
|
+
conteudo: string;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
}
|
|
9
|
+
interface SalaChat {
|
|
10
|
+
id: string;
|
|
11
|
+
leituraPublica: boolean;
|
|
12
|
+
idUsuariosLeitoresEspecificos?: number[];
|
|
13
|
+
escritaPublica: boolean;
|
|
14
|
+
idUsuariosEscritoresEspecificos?: number[];
|
|
15
|
+
}
|
|
16
|
+
interface SalaChatFront {
|
|
17
|
+
id: string;
|
|
18
|
+
podeEscrever: boolean;
|
|
19
|
+
mensagensIniciais: MensagemChatRecebida[];
|
|
20
|
+
}
|
|
21
|
+
interface MensagemChatPayload {
|
|
22
|
+
salaId: string;
|
|
23
|
+
conteudo: string;
|
|
24
|
+
}
|
|
25
|
+
type PAYLOAD__executaTestePericia = {
|
|
26
|
+
codigoRecuperarFichaRuntime: CodigoRecuperarFichaRuntime;
|
|
27
|
+
idPericia: number;
|
|
28
|
+
};
|
|
29
|
+
type PAYLOAD__emitirMensagemSalaJogo = PAYLOAD__emitirMensagemSalaJogo__Escutando | PAYLOAD__emitirMensagemSalaJogo__Enviando;
|
|
30
|
+
type PAYLOAD__emitirMensagemSalaJogo__Escutando = {
|
|
31
|
+
escutando: true;
|
|
32
|
+
};
|
|
33
|
+
type PAYLOAD__emitirMensagemSalaJogo__Enviando = {
|
|
34
|
+
mensagemSalaJogo: MensagemSalaJogo;
|
|
35
|
+
};
|
|
36
|
+
type PAYLOAD__ExecutaTestePericia_PROTOTIPO = {
|
|
37
|
+
tipo: 'TESTE_NARRADOR';
|
|
38
|
+
} | {
|
|
39
|
+
tipo: 'TESTE_JOGADOR';
|
|
40
|
+
valorAtributo: number;
|
|
41
|
+
valorPericia: number;
|
|
42
|
+
abrevPericia: string;
|
|
43
|
+
};
|
|
44
|
+
type PAYLOAD__NARRADOR_executaAcaoParticipante_PROTOTIPO = {
|
|
45
|
+
codigoSala: SalaDeJogo_Codigo;
|
|
46
|
+
idPericia: number;
|
|
47
|
+
listaIdsFichas: number[];
|
|
48
|
+
};
|
|
49
|
+
type PAYLOAD__INDIVIDUAL__NARRADOR_executaAcaoParticipante_PROTOTIPO = {
|
|
50
|
+
idFicha: number;
|
|
51
|
+
codigoSala: SalaDeJogo_Codigo;
|
|
52
|
+
idPericia: number;
|
|
53
|
+
};
|
|
54
|
+
type PAYLOAD__EmitirFichaEmJogo = {
|
|
55
|
+
codigoSala: SalaDeJogo_Codigo;
|
|
56
|
+
idFicha: number;
|
|
57
|
+
};
|
|
58
|
+
type SOCKET_AcessoUsuario = {
|
|
59
|
+
usuario: UsuarioParaObjetoAutenticacaoDto;
|
|
60
|
+
paginaAtual?: PaginaTemplate | null;
|
|
61
|
+
dataAtualizacao: Date;
|
|
62
|
+
};
|
|
63
|
+
type SOCKET_UsuarioExistente = {
|
|
64
|
+
id: number;
|
|
65
|
+
username: string;
|
|
66
|
+
caminhoArquivoAvatar: CaminhoArquivoAvatar;
|
|
67
|
+
};
|
|
68
|
+
type TelemetryConnectionInfo = {
|
|
69
|
+
socketId: string;
|
|
70
|
+
username?: string;
|
|
71
|
+
ip: string;
|
|
72
|
+
userAgent?: string;
|
|
73
|
+
connectedAt: number;
|
|
74
|
+
};
|
|
75
|
+
type WsEventAudienceUnico<TSocket> = {
|
|
76
|
+
escopo: 'unico';
|
|
77
|
+
socket: TSocket;
|
|
78
|
+
username?: string;
|
|
79
|
+
};
|
|
80
|
+
type WsEventAudienceMultiplo = {
|
|
81
|
+
escopo: 'multiplo';
|
|
82
|
+
socketsCount: number;
|
|
83
|
+
};
|
|
84
|
+
type WsEventAudience<TSocket> = WsEventAudienceUnico<TSocket> | WsEventAudienceMultiplo;
|
|
85
|
+
type TelemetryEventLog<TPayload extends Record<string, unknown> = Record<string, unknown>> = {
|
|
86
|
+
direction: 'in' | 'out';
|
|
87
|
+
event: string;
|
|
88
|
+
audiencia: WsEventAudience<string>;
|
|
89
|
+
payload: TPayload;
|
|
90
|
+
timestamp: number;
|
|
91
|
+
};
|
|
92
|
+
type TelemetrySnapshot = {
|
|
93
|
+
totalConnections: number;
|
|
94
|
+
totalEvents: number;
|
|
95
|
+
connections: TelemetryConnectionInfo[];
|
|
96
|
+
lastEvents: TelemetryEventLog[];
|
|
97
|
+
serverTime: number;
|
|
98
|
+
};
|
|
99
|
+
type WsErrorResponse = {
|
|
100
|
+
_wsErro: true;
|
|
101
|
+
mensagem: string;
|
|
102
|
+
code?: string;
|
|
103
|
+
detalhes?: unknown;
|
|
104
|
+
};
|
|
105
|
+
type WsUnauthorizedErrorResponse = WsErrorResponse & {
|
|
106
|
+
code: 'UNAUTHORIZED';
|
|
107
|
+
};
|
|
108
|
+
type WsResult<T> = T | WsErrorResponse;
|
|
109
|
+
declare function isWsErrorResponse(payload: unknown): payload is WsErrorResponse;
|
|
110
|
+
declare function isWsUnauthorizedErrorResponse(payload: unknown): payload is WsUnauthorizedErrorResponse;
|
|
111
|
+
declare function wsErro(mensagem: string, extra?: {
|
|
112
|
+
code?: string;
|
|
113
|
+
detalhes?: unknown;
|
|
114
|
+
}): WsErrorResponse;
|
|
115
|
+
declare function wsUnauthorized(mensagem?: string, detalhes?: unknown): WsUnauthorizedErrorResponse;
|
|
116
|
+
declare function wsMap<T, R>(value: WsResult<T>, mapper: (value: T) => R): WsResult<R>;
|
|
117
|
+
declare function wsChain<T, R>(value: WsResult<T>, next: (value: T) => WsResult<R>): WsResult<R>;
|
|
118
|
+
type EventoTipo = 'envia' | 'emite' | 'envia-e-recebe';
|
|
119
|
+
type EmitDelivery = 'broadcast' | 'perRecipient';
|
|
120
|
+
type EventoAuthDefault = {
|
|
121
|
+
autenticacao_necessaria?: false;
|
|
122
|
+
};
|
|
123
|
+
type EventoEnvia<P = unknown> = EventoAuthDefault & {
|
|
124
|
+
tipo: 'envia';
|
|
125
|
+
payload: P;
|
|
126
|
+
response?: never;
|
|
127
|
+
};
|
|
128
|
+
type EventoEmite<P = unknown, R = unknown> = EventoAuthDefault & {
|
|
129
|
+
tipo: 'emite';
|
|
130
|
+
payload: P;
|
|
131
|
+
response: R;
|
|
132
|
+
delivery?: EmitDelivery;
|
|
133
|
+
};
|
|
134
|
+
type EventoEnviaERecebe<P = unknown, R = unknown> = EventoAuthDefault & {
|
|
135
|
+
tipo: 'envia-e-recebe';
|
|
136
|
+
payload: P;
|
|
137
|
+
response: R;
|
|
138
|
+
};
|
|
139
|
+
type EventoSchema = EventoEnvia<unknown> | EventoEmite<unknown, unknown> | EventoEnviaERecebe<unknown, unknown>;
|
|
140
|
+
type GatewayDef = Record<string, EventoSchema>;
|
|
141
|
+
declare function createGateway<T extends {
|
|
142
|
+
[K in keyof T]: EventoSchema;
|
|
143
|
+
}>(def: T): T;
|
|
144
|
+
declare namespace EventosWebSocket {
|
|
145
|
+
const gateways: {
|
|
146
|
+
readonly Chat: {
|
|
147
|
+
enviaMensagem: {
|
|
148
|
+
tipo: "envia";
|
|
149
|
+
payload: {
|
|
150
|
+
salaId: string;
|
|
151
|
+
conteudoMensagem: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
emitirSalas: {
|
|
155
|
+
tipo: "envia-e-recebe";
|
|
156
|
+
payload: {};
|
|
157
|
+
response: {
|
|
158
|
+
salas: SalaChatFront[];
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
emitirMensagem: {
|
|
162
|
+
tipo: "emite";
|
|
163
|
+
payload: {
|
|
164
|
+
mensagemId: number;
|
|
165
|
+
};
|
|
166
|
+
response: {
|
|
167
|
+
conteudoMensagem: MensagemChatRecebida;
|
|
168
|
+
};
|
|
169
|
+
delivery: "broadcast";
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
readonly Jogo: {
|
|
173
|
+
requisicaoDeFechamentoDeSalaAberta: {
|
|
174
|
+
tipo: "envia-e-recebe";
|
|
175
|
+
payload: {
|
|
176
|
+
codigoSalaDeJogo: SalaDeJogo_Codigo;
|
|
177
|
+
};
|
|
178
|
+
response: {};
|
|
179
|
+
};
|
|
180
|
+
emitirEstouEmJogo: {
|
|
181
|
+
tipo: "emite";
|
|
182
|
+
payload: {};
|
|
183
|
+
response: {
|
|
184
|
+
objetoEstouEmJogo: LogicaJogoUsuario_EstouEmJogoDto;
|
|
185
|
+
};
|
|
186
|
+
delivery: "perRecipient";
|
|
187
|
+
};
|
|
188
|
+
emitirObjetoEmJogo: {
|
|
189
|
+
tipo: "emite";
|
|
190
|
+
payload: {};
|
|
191
|
+
response: {
|
|
192
|
+
objetoEmJogo: LogicaJogoUsuario_ObjetoEmJogoDto;
|
|
193
|
+
};
|
|
194
|
+
delivery: "perRecipient";
|
|
195
|
+
};
|
|
196
|
+
emitirSessaoEmAndamento: {
|
|
197
|
+
tipo: "emite";
|
|
198
|
+
payload: {};
|
|
199
|
+
response: {
|
|
200
|
+
sessaoEmAndamento: SalaDeJogo_SessaoDto | null;
|
|
201
|
+
};
|
|
202
|
+
delivery: "perRecipient";
|
|
203
|
+
};
|
|
204
|
+
emitirTodasSalas: {
|
|
205
|
+
tipo: "emite";
|
|
206
|
+
payload: {};
|
|
207
|
+
response: {
|
|
208
|
+
salas: SalaDeJogoDto[];
|
|
209
|
+
};
|
|
210
|
+
delivery: "broadcast";
|
|
211
|
+
};
|
|
212
|
+
NARRADOR_executaAcaoParticipante_PROTOTIPO: {
|
|
213
|
+
tipo: "envia";
|
|
214
|
+
payload: PAYLOAD__NARRADOR_executaAcaoParticipante_PROTOTIPO;
|
|
215
|
+
};
|
|
216
|
+
emitirFichaEmJogo: {
|
|
217
|
+
tipo: "emite";
|
|
218
|
+
payload: PAYLOAD__EmitirFichaEmJogo;
|
|
219
|
+
response: {
|
|
220
|
+
fichaAtualizada: J_DadosFichaEmJogo;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
readonly ExecucaoDeJogo: {
|
|
225
|
+
executaTestePericia: {
|
|
226
|
+
tipo: "envia";
|
|
227
|
+
payload: PAYLOAD__executaTestePericia;
|
|
228
|
+
};
|
|
229
|
+
emitirMensagemSalaJogo: {
|
|
230
|
+
tipo: "emite";
|
|
231
|
+
payload: {
|
|
232
|
+
mensagemSalaJogo: PAYLOAD__emitirMensagemSalaJogo;
|
|
233
|
+
};
|
|
234
|
+
response: {
|
|
235
|
+
mensagemSalaJogo: MensagemSalaJogo | null;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
readonly UsuariosConectados: {
|
|
240
|
+
emitirUsuariosConectadosAgora: {
|
|
241
|
+
tipo: "emite";
|
|
242
|
+
payload: {};
|
|
243
|
+
response: {
|
|
244
|
+
usuariosConectados: SOCKET_AcessoUsuario[];
|
|
245
|
+
};
|
|
246
|
+
delivery: "broadcast";
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
readonly UsuariosExistentes: {
|
|
250
|
+
obterTodos: {
|
|
251
|
+
tipo: "envia-e-recebe";
|
|
252
|
+
payload: {};
|
|
253
|
+
response: {
|
|
254
|
+
usuariosExistentes: SOCKET_UsuarioExistente[];
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
261
|
+
declare function getEmitDelivery(gatewayName: string, eventName: string): EmitDelivery | undefined;
|
|
262
|
+
type WsEmitTarget = {
|
|
263
|
+
room: string;
|
|
264
|
+
} | {
|
|
265
|
+
userIds: number[];
|
|
266
|
+
} | {
|
|
267
|
+
scope: 'authenticated';
|
|
268
|
+
} | {
|
|
269
|
+
scope: 'all';
|
|
270
|
+
};
|
|
271
|
+
type WsEmitParams<E extends EventoEmiteAny> = {
|
|
272
|
+
payload?: E['payload'];
|
|
273
|
+
target?: WsEmitTarget;
|
|
274
|
+
};
|
|
275
|
+
type EventosEmiteMap = typeof Eventos_Emite;
|
|
276
|
+
type EventoEmiteAny = {
|
|
277
|
+
[G in keyof EventosEmiteMap]: EventosEmiteMap[G]['eventos'][keyof EventosEmiteMap[G]['eventos']];
|
|
278
|
+
}[keyof EventosEmiteMap];
|
|
3
279
|
type Gateways = typeof EventosWebSocket.gateways;
|
|
4
280
|
type EventoTipoLiteral = EventoTipo;
|
|
5
281
|
type FiltraEventosPorTipo<G extends GatewayDef, Tipo extends EventoTipoLiteral> = {
|
|
@@ -34,7 +310,7 @@ declare const Eventos_Envia: {
|
|
|
34
310
|
eventos: {
|
|
35
311
|
NARRADOR_executaAcaoParticipante_PROTOTIPO: {
|
|
36
312
|
tipo: "envia";
|
|
37
|
-
payload:
|
|
313
|
+
payload: PAYLOAD__NARRADOR_executaAcaoParticipante_PROTOTIPO;
|
|
38
314
|
} & {
|
|
39
315
|
readonly nome: "NARRADOR_executaAcaoParticipante_PROTOTIPO";
|
|
40
316
|
readonly gateway: "Jogo";
|
|
@@ -46,7 +322,7 @@ declare const Eventos_Envia: {
|
|
|
46
322
|
eventos: {
|
|
47
323
|
executaTestePericia: {
|
|
48
324
|
tipo: "envia";
|
|
49
|
-
payload:
|
|
325
|
+
payload: PAYLOAD__executaTestePericia;
|
|
50
326
|
} & {
|
|
51
327
|
readonly nome: "executaTestePericia";
|
|
52
328
|
readonly gateway: "ExecucaoDeJogo";
|
|
@@ -70,7 +346,7 @@ declare const Eventos_Emite: {
|
|
|
70
346
|
mensagemId: number;
|
|
71
347
|
};
|
|
72
348
|
response: {
|
|
73
|
-
conteudoMensagem:
|
|
349
|
+
conteudoMensagem: MensagemChatRecebida;
|
|
74
350
|
};
|
|
75
351
|
delivery: "broadcast";
|
|
76
352
|
} & {
|
|
@@ -86,7 +362,7 @@ declare const Eventos_Emite: {
|
|
|
86
362
|
tipo: "emite";
|
|
87
363
|
payload: {};
|
|
88
364
|
response: {
|
|
89
|
-
objetoEstouEmJogo:
|
|
365
|
+
objetoEstouEmJogo: LogicaJogoUsuario_EstouEmJogoDto;
|
|
90
366
|
};
|
|
91
367
|
delivery: "perRecipient";
|
|
92
368
|
} & {
|
|
@@ -98,7 +374,7 @@ declare const Eventos_Emite: {
|
|
|
98
374
|
tipo: "emite";
|
|
99
375
|
payload: {};
|
|
100
376
|
response: {
|
|
101
|
-
objetoEmJogo:
|
|
377
|
+
objetoEmJogo: LogicaJogoUsuario_ObjetoEmJogoDto;
|
|
102
378
|
};
|
|
103
379
|
delivery: "perRecipient";
|
|
104
380
|
} & {
|
|
@@ -110,7 +386,7 @@ declare const Eventos_Emite: {
|
|
|
110
386
|
tipo: "emite";
|
|
111
387
|
payload: {};
|
|
112
388
|
response: {
|
|
113
|
-
sessaoEmAndamento:
|
|
389
|
+
sessaoEmAndamento: SalaDeJogo_SessaoDto | null;
|
|
114
390
|
};
|
|
115
391
|
delivery: "perRecipient";
|
|
116
392
|
} & {
|
|
@@ -122,7 +398,7 @@ declare const Eventos_Emite: {
|
|
|
122
398
|
tipo: "emite";
|
|
123
399
|
payload: {};
|
|
124
400
|
response: {
|
|
125
|
-
salas:
|
|
401
|
+
salas: SalaDeJogoDto[];
|
|
126
402
|
};
|
|
127
403
|
delivery: "broadcast";
|
|
128
404
|
} & {
|
|
@@ -132,9 +408,9 @@ declare const Eventos_Emite: {
|
|
|
132
408
|
};
|
|
133
409
|
emitirFichaEmJogo: {
|
|
134
410
|
tipo: "emite";
|
|
135
|
-
payload:
|
|
411
|
+
payload: PAYLOAD__EmitirFichaEmJogo;
|
|
136
412
|
response: {
|
|
137
|
-
fichaAtualizada:
|
|
413
|
+
fichaAtualizada: J_DadosFichaEmJogo;
|
|
138
414
|
};
|
|
139
415
|
} & {
|
|
140
416
|
readonly nome: "emitirFichaEmJogo";
|
|
@@ -148,10 +424,10 @@ declare const Eventos_Emite: {
|
|
|
148
424
|
emitirMensagemSalaJogo: {
|
|
149
425
|
tipo: "emite";
|
|
150
426
|
payload: {
|
|
151
|
-
mensagemSalaJogo:
|
|
427
|
+
mensagemSalaJogo: PAYLOAD__emitirMensagemSalaJogo;
|
|
152
428
|
};
|
|
153
429
|
response: {
|
|
154
|
-
mensagemSalaJogo:
|
|
430
|
+
mensagemSalaJogo: MensagemSalaJogo | null;
|
|
155
431
|
};
|
|
156
432
|
} & {
|
|
157
433
|
readonly nome: "emitirMensagemSalaJogo";
|
|
@@ -166,7 +442,7 @@ declare const Eventos_Emite: {
|
|
|
166
442
|
tipo: "emite";
|
|
167
443
|
payload: {};
|
|
168
444
|
response: {
|
|
169
|
-
usuariosConectados:
|
|
445
|
+
usuariosConectados: SOCKET_AcessoUsuario[];
|
|
170
446
|
};
|
|
171
447
|
delivery: "broadcast";
|
|
172
448
|
} & {
|
|
@@ -187,7 +463,7 @@ declare const Eventos_EnviaERecebe: {
|
|
|
187
463
|
tipo: "envia-e-recebe";
|
|
188
464
|
payload: {};
|
|
189
465
|
response: {
|
|
190
|
-
salas:
|
|
466
|
+
salas: SalaChatFront[];
|
|
191
467
|
};
|
|
192
468
|
} & {
|
|
193
469
|
readonly nome: "emitirSalas";
|
|
@@ -201,7 +477,7 @@ declare const Eventos_EnviaERecebe: {
|
|
|
201
477
|
requisicaoDeFechamentoDeSalaAberta: {
|
|
202
478
|
tipo: "envia-e-recebe";
|
|
203
479
|
payload: {
|
|
204
|
-
codigoSalaDeJogo:
|
|
480
|
+
codigoSalaDeJogo: SalaDeJogo_Codigo;
|
|
205
481
|
};
|
|
206
482
|
response: {};
|
|
207
483
|
} & {
|
|
@@ -223,7 +499,7 @@ declare const Eventos_EnviaERecebe: {
|
|
|
223
499
|
tipo: "envia-e-recebe";
|
|
224
500
|
payload: {};
|
|
225
501
|
response: {
|
|
226
|
-
usuariosExistentes:
|
|
502
|
+
usuariosExistentes: SOCKET_UsuarioExistente[];
|
|
227
503
|
};
|
|
228
504
|
} & {
|
|
229
505
|
readonly nome: "obterTodos";
|
|
@@ -233,4 +509,4 @@ declare const Eventos_EnviaERecebe: {
|
|
|
233
509
|
};
|
|
234
510
|
};
|
|
235
511
|
};
|
|
236
|
-
export { EventoTipoLiteral, Eventos_Emite, Eventos_Envia, Eventos_EnviaERecebe, FiltraEventosPorTipo, Gateways, criarEventosFiltrados };
|
|
512
|
+
export { EmitDelivery, EventoAuthDefault, EventoEmite, EventoEmiteAny, EventoEnvia, EventoEnviaERecebe, EventoSchema, EventoTipo, EventoTipoLiteral, EventosEmiteMap, EventosWebSocket, Eventos_Emite, Eventos_Envia, Eventos_EnviaERecebe, FiltraEventosPorTipo, GatewayDef, Gateways, MensagemChatPayload, MensagemChatRecebida, PAYLOAD__EmitirFichaEmJogo, PAYLOAD__ExecutaTestePericia_PROTOTIPO, PAYLOAD__INDIVIDUAL__NARRADOR_executaAcaoParticipante_PROTOTIPO, PAYLOAD__NARRADOR_executaAcaoParticipante_PROTOTIPO, PAYLOAD__emitirMensagemSalaJogo, PAYLOAD__emitirMensagemSalaJogo__Enviando, PAYLOAD__emitirMensagemSalaJogo__Escutando, PAYLOAD__executaTestePericia, SOCKET_AcessoUsuario, SOCKET_UsuarioExistente, SalaChat, SalaChatFront, TelemetryConnectionInfo, TelemetryEventLog, TelemetrySnapshot, WsEmitParams, WsEmitTarget, WsErrorResponse, WsEventAudience, WsEventAudienceMultiplo, WsEventAudienceUnico, WsResult, WsUnauthorizedErrorResponse, createGateway, criarEventosFiltrados, getEmitDelivery, isRecord, isWsErrorResponse, isWsUnauthorizedErrorResponse, wsChain, wsErro, wsMap, wsUnauthorized };
|
package/dist/ws/index.js
CHANGED
|
@@ -1,6 +1,122 @@
|
|
|
1
1
|
// AUTO-GENERATED FILE - DO NOT EDIT
|
|
2
2
|
// Contratos WebSocket
|
|
3
|
-
|
|
3
|
+
function isWsErrorResponse(payload) { return !!payload && typeof payload === "object" && payload._wsErro === true; }
|
|
4
|
+
function isWsUnauthorizedErrorResponse(payload) { return isWsErrorResponse(payload) && payload.code === "UNAUTHORIZED"; }
|
|
5
|
+
function wsErro(mensagem, extra) { return { _wsErro: true, mensagem, ...(extra ?? {}) }; }
|
|
6
|
+
function wsUnauthorized(mensagem = "Não autorizado", detalhes) { return { _wsErro: true, mensagem, code: "UNAUTHORIZED", detalhes }; }
|
|
7
|
+
// helper que elimina o if manual no gateway
|
|
8
|
+
function wsMap(value, mapper) { return isWsErrorResponse(value) ? value : mapper(value); }
|
|
9
|
+
// opcional para encadear fluxos no service/repository se quiser evoluir
|
|
10
|
+
function wsChain(value, next) { return isWsErrorResponse(value) ? value : next(value); }
|
|
11
|
+
function createGateway(def) { return def; }
|
|
12
|
+
//
|
|
13
|
+
var EventosWebSocket;
|
|
14
|
+
(function (EventosWebSocket) {
|
|
15
|
+
const Chat = createGateway({
|
|
16
|
+
enviaMensagem: {
|
|
17
|
+
tipo: 'envia',
|
|
18
|
+
payload: { salaId: '', conteudoMensagem: '' },
|
|
19
|
+
},
|
|
20
|
+
emitirSalas: {
|
|
21
|
+
tipo: 'envia-e-recebe',
|
|
22
|
+
payload: {},
|
|
23
|
+
response: { salas: [] },
|
|
24
|
+
// autenticacao_necessaria: false,
|
|
25
|
+
},
|
|
26
|
+
emitirMensagem: {
|
|
27
|
+
tipo: 'emite',
|
|
28
|
+
payload: { mensagemId: 0 },
|
|
29
|
+
response: { conteudoMensagem: {} },
|
|
30
|
+
delivery: 'broadcast',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const ExecucaoDeJogo = createGateway({
|
|
34
|
+
executaTestePericia: {
|
|
35
|
+
tipo: 'envia',
|
|
36
|
+
payload: {},
|
|
37
|
+
},
|
|
38
|
+
emitirMensagemSalaJogo: {
|
|
39
|
+
tipo: 'emite',
|
|
40
|
+
payload: { mensagemSalaJogo: {} },
|
|
41
|
+
response: { mensagemSalaJogo: {} },
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const Jogo = createGateway({
|
|
45
|
+
requisicaoDeFechamentoDeSalaAberta: {
|
|
46
|
+
tipo: 'envia-e-recebe',
|
|
47
|
+
payload: { codigoSalaDeJogo: {} },
|
|
48
|
+
response: {},
|
|
49
|
+
},
|
|
50
|
+
emitirEstouEmJogo: {
|
|
51
|
+
tipo: 'emite',
|
|
52
|
+
payload: {},
|
|
53
|
+
response: { objetoEstouEmJogo: {} },
|
|
54
|
+
delivery: 'perRecipient',
|
|
55
|
+
},
|
|
56
|
+
emitirObjetoEmJogo: {
|
|
57
|
+
tipo: 'emite',
|
|
58
|
+
payload: {},
|
|
59
|
+
response: { objetoEmJogo: {} },
|
|
60
|
+
delivery: 'perRecipient',
|
|
61
|
+
},
|
|
62
|
+
emitirSessaoEmAndamento: {
|
|
63
|
+
tipo: 'emite',
|
|
64
|
+
payload: {},
|
|
65
|
+
response: { sessaoEmAndamento: {} },
|
|
66
|
+
delivery: 'perRecipient',
|
|
67
|
+
},
|
|
68
|
+
emitirTodasSalas: {
|
|
69
|
+
tipo: 'emite',
|
|
70
|
+
payload: {},
|
|
71
|
+
response: { salas: [] },
|
|
72
|
+
delivery: 'broadcast',
|
|
73
|
+
},
|
|
74
|
+
NARRADOR_executaAcaoParticipante_PROTOTIPO: {
|
|
75
|
+
tipo: 'envia',
|
|
76
|
+
payload: {},
|
|
77
|
+
},
|
|
78
|
+
emitirFichaEmJogo: {
|
|
79
|
+
tipo: 'emite',
|
|
80
|
+
payload: {},
|
|
81
|
+
response: { fichaAtualizada: {} }
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
const UsuariosConectados = createGateway({
|
|
85
|
+
emitirUsuariosConectadosAgora: {
|
|
86
|
+
tipo: 'emite',
|
|
87
|
+
payload: {},
|
|
88
|
+
response: { usuariosConectados: [] },
|
|
89
|
+
delivery: 'broadcast',
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
const UsuariosExistentes = createGateway({
|
|
93
|
+
obterTodos: {
|
|
94
|
+
tipo: 'envia-e-recebe',
|
|
95
|
+
payload: {},
|
|
96
|
+
response: { usuariosExistentes: [] },
|
|
97
|
+
// autenticacao_necessaria: false,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
EventosWebSocket.gateways = { Chat, Jogo, ExecucaoDeJogo, UsuariosConectados, UsuariosExistentes };
|
|
101
|
+
})(EventosWebSocket || (EventosWebSocket = {}));
|
|
102
|
+
function isRecord(value) { return typeof value === 'object' && value !== null; }
|
|
103
|
+
function getEmitDelivery(gatewayName, eventName) {
|
|
104
|
+
const gatewaysUnknown = EventosWebSocket.gateways;
|
|
105
|
+
if (!isRecord(gatewaysUnknown))
|
|
106
|
+
return undefined;
|
|
107
|
+
const gw = gatewaysUnknown[gatewayName];
|
|
108
|
+
if (!isRecord(gw))
|
|
109
|
+
return undefined;
|
|
110
|
+
const schema = gw[eventName];
|
|
111
|
+
if (!isRecord(schema))
|
|
112
|
+
return undefined;
|
|
113
|
+
if (schema.tipo !== 'emite')
|
|
114
|
+
return undefined;
|
|
115
|
+
const delivery = schema.delivery;
|
|
116
|
+
if (delivery === 'broadcast' || delivery === 'perRecipient')
|
|
117
|
+
return delivery;
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
4
120
|
function criarEventosFiltrados(tipo) {
|
|
5
121
|
const result = {};
|
|
6
122
|
for (const [gatewayName, gatewayDef] of Object.entries(EventosWebSocket.gateways)) {
|
|
@@ -17,4 +133,4 @@ function criarEventosFiltrados(tipo) {
|
|
|
17
133
|
const Eventos_Envia = criarEventosFiltrados('envia');
|
|
18
134
|
const Eventos_Emite = criarEventosFiltrados('emite');
|
|
19
135
|
const Eventos_EnviaERecebe = criarEventosFiltrados('envia-e-recebe');
|
|
20
|
-
export { Eventos_Emite, Eventos_Envia, Eventos_EnviaERecebe, criarEventosFiltrados };
|
|
136
|
+
export { EventosWebSocket, Eventos_Emite, Eventos_Envia, Eventos_EnviaERecebe, createGateway, criarEventosFiltrados, getEmitDelivery, isRecord, isWsErrorResponse, isWsUnauthorizedErrorResponse, wsChain, wsErro, wsMap, wsUnauthorized };
|