types-nora-api 0.0.228 → 0.0.236
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/classes.d.ts +29 -10
- package/dist/classes.js +50 -17
- package/package.json +1 -1
package/dist/classes.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
type CtxAcesso = {
|
|
2
|
-
estaAutenticado: boolean;
|
|
3
|
-
verificarCapacidade: (capacidade: Capacidade) => boolean;
|
|
4
|
-
};
|
|
5
|
-
declare function temSudoBurlarCapacidades(ctx: CtxAcesso): boolean;
|
|
6
1
|
declare const CAPACIDADES: {
|
|
7
2
|
readonly ADMINISTRADOR__PERMISSOES__ALTERACAO_CAPACIDADES_GERAIS_USUARIOS: "ADMINISTRADOR.PERMISSOES.ALTERACAO_CAPACIDADES_GERAIS_USUARIOS";
|
|
8
3
|
readonly ADMINISTRADOR__SUDO__BURLAR_CAPACIDADES: "ADMINISTRADOR.SUDO.BURLAR_CAPACIDADES";
|
|
9
4
|
readonly ADMINISTRADOR__SUDO__BURLAR_MODO_MANUTENÇÃO: "ADMINISTRADOR.SUDO.BURLAR_MODO_MANUTENÇÃO";
|
|
10
|
-
readonly
|
|
5
|
+
readonly ARTISTA__CRIACAO__UPLOAD_IMAGEM: "ARTISTA.CRIACAO.UPLOAD_IMAGEM";
|
|
11
6
|
};
|
|
7
|
+
type CtxAcesso = {
|
|
8
|
+
estaAutenticado: boolean;
|
|
9
|
+
verificarCapacidade: (capacidade: Capacidade) => boolean;
|
|
10
|
+
};
|
|
11
|
+
declare function temSudoBurlarCapacidades(ctx: CtxAcesso): boolean;
|
|
12
12
|
interface IPermissoesEstado {
|
|
13
13
|
id: number;
|
|
14
14
|
chave: string;
|
|
@@ -794,6 +794,16 @@ type MenuGrupoNode = {
|
|
|
794
794
|
type MenuNode = MenuItemNode | MenuGrupoNode;
|
|
795
795
|
declare function menuItem(titulo: string, destino: PaginaDestino): MenuItemNode;
|
|
796
796
|
declare function menuGrupo(titulo: string, itens: readonly MenuNode[]): MenuGrupoNode;
|
|
797
|
+
type PaginaLike = {
|
|
798
|
+
readonly template: unknown;
|
|
799
|
+
readonly hrefTemplate: string;
|
|
800
|
+
};
|
|
801
|
+
type MenuInternoTree<P> = P extends PaginaLike ? readonly MenuNode[] : P extends Record<string, unknown> ? {
|
|
802
|
+
readonly [K in keyof P]?: MenuInternoTree<P[K]>;
|
|
803
|
+
} : never;
|
|
804
|
+
type MenusInternos<P> = {
|
|
805
|
+
readonly PAGINAS: MenuInternoTree<P>;
|
|
806
|
+
};
|
|
797
807
|
type Brand<T, B extends string> = T & {
|
|
798
808
|
readonly __brand: B;
|
|
799
809
|
};
|
|
@@ -1474,7 +1484,8 @@ declare const PAGINAS: {
|
|
|
1474
1484
|
readonly href: "/minhas-paginas/mestre";
|
|
1475
1485
|
};
|
|
1476
1486
|
readonly artista: {
|
|
1477
|
-
readonly
|
|
1487
|
+
readonly minhasImagens: PaginaDef<"/minhas-paginas/artista/minhas_imagens">;
|
|
1488
|
+
readonly adicionarImagem: PaginaDef<"/minhas-paginas/artista/adicionar_imagem">;
|
|
1478
1489
|
readonly label: string;
|
|
1479
1490
|
readonly comCabecalho?: true;
|
|
1480
1491
|
readonly acesso?: AcessoPagina;
|
|
@@ -1506,8 +1517,16 @@ type PaginaHref = PaginaFolha['href'];
|
|
|
1506
1517
|
type PaginaDefAny = PaginaDef<string>;
|
|
1507
1518
|
type PaginaTemplateAny = PaginaTemplate<string>;
|
|
1508
1519
|
declare function filtrarMenuPorAcesso(nodes: readonly MenuNode[], ctx: CtxAcesso): MenuNode[];
|
|
1509
|
-
type Key = `${PaginaTemplateFolha}`;
|
|
1510
1520
|
declare const MENU_PRINCIPAL: readonly MenuNode[];
|
|
1511
|
-
declare const MENUS_INTERNOS:
|
|
1521
|
+
declare const MENUS_INTERNOS: {
|
|
1522
|
+
readonly PAGINAS: {
|
|
1523
|
+
readonly minhasPaginas: {
|
|
1524
|
+
readonly admin: readonly [MenuItemNode, MenuItemNode, MenuItemNode, MenuItemNode];
|
|
1525
|
+
readonly artista: readonly [MenuItemNode, MenuItemNode];
|
|
1526
|
+
};
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
declare const MENUS_INTERNOS_POR_PAGINA: ReadonlyMap<PaginaFolha, readonly MenuNode[]>;
|
|
1530
|
+
declare function obterMenuInterno(pagina: PaginaFolha): readonly MenuNode[] | undefined;
|
|
1512
1531
|
declare function resolverMenuInterno(pagina: PaginaFolha): readonly PaginaFolha[] | undefined;
|
|
1513
|
-
export { CtxAcesso, temSudoBurlarCapacidades,
|
|
1532
|
+
export { CAPACIDADES, CtxAcesso, temSudoBurlarCapacidades, IPermissoesEstado, PermissoesEstadoDto, IPermissoesItem, PermissoesItemDto, IPermissoesUsuario, PermissoesUsuarioDto, IPermissoesUsuariosHistorico, PermissoesUsuariosHistoricoDto, IArcoAventura, ArcoAventuraDto, IAventura, AventuraDto, IConviteGrupoAventuraPersonagem, ConviteGrupoAventuraPersonagemDto, IGrupoAventura, GrupoAventuraDto, IGrupoAventuraPersonagem, GrupoAventuraPersonagemDto, IRespostaConvite, RespostaConviteDto, IVariavelAmbiente, VariavelAmbienteDto, IConquista, ConquistaDto, ITipoConquista, TipoConquistaDto, IDetalheSessaoAventura, DetalheSessaoAventuraDto, IDetalheSessaoCanonica, DetalheSessaoCanonicaDto, CapituloSessaoCanonica, IDetalheSessaoUnica, DetalheSessaoUnicaDto, IParticipanteSessaoUnica, ParticipanteSessaoUnicaDto, ICoeficienteGanhoEstatisticaClasse, CoeficienteGanhoEstatisticaClasseDto, IGanhoNivelClasse, GanhoNivelClasseDto, DadosDoTipoGanho, DadosGanho_Atributos, DadosGanho_Pericias, DadosGanho_Estatisticas, DadosGanho_Classes, DadosGanho_ValorMaximoAtributo, DadosGanho_PontosHabilidadesEspeciais, DadosGanho_PontosHabilidadesParanormais, DadosGanho_PontosHabilidadeElemental, IGanhoRelativoCoeficienteAtributo, GanhoRelativoCoeficienteAtributoDto, ITipoGanhoNivel, TipoGanhoNivelDto, IGeracao, GeracaoDto, IImagem, ImagemDto, ITipoImagem, TipoImagemDto, IAlcance, AlcanceDto, IAtributo, AtributoDto, ICategoriaRitual, CategoriaRitualDto, ICirculoRitual, CirculoRitualDto, IClasse, ClasseDto, IDuracao, DuracaoDto, IElemento, ElementoDto, IEstatisticaDanificavel, EstatisticaDanificavelDto, IExecucao, ExecucaoDto, IFormatoAlcance, FormatoAlcanceDto, ILinhaEfeito, LinhaEfeitoDto, INivel, NivelDto, INivelComponente, NivelComponenteDto, INivelProficiencia, NivelProficienciaDto, INivelRitual, NivelRitualDto, IPatentePericia, PatentePericiaDto, IPericia, PericiaDto, IProficiencia, ProficienciaDto, ITipoAlvo, TipoAlvoDto, ITipoCategoria, TipoCategoriaDto, ITipoDano, TipoDanoDto, ITipoEfeito, TipoEfeitoDto, ITipoItem, TipoItemDto, ITipoProficiencia, TipoProficienciaDto, ILink, LinkDto, ITipoLink, TipoLinkDto, IDificuldadeSessao, DificuldadeSessaoDto, IEstiloSessaoMestrada, EstiloSessaoMestradaDto, ITipoSessao, TipoSessaoDto, IPerfilAdmin, PerfilAdminDto, IPerfilJogador, PerfilJogadorDto, IPerfilMestre, PerfilMestreDto, IFichaPersonagem, FichaPersonagemDto, ObjetoFicha, DetalheEvolucao, DetalhesExtras, FichaDeJogo, AtributoFicha, PericiaFicha, EstatisticaDanificavelFicha, DetalheFicha, RegistroPericiaLivre, IInformacaoPersonagem, InformacaoPersonagemDto, IPersonagem, PersonagemDto, PersonagemSalaJogoDto, IResumoPersonagemAventura, ResumoPersonagemAventuraDto, ITipoPersonagem, TipoPersonagemDto, IDetalheRascunhoAventura, DetalheRascunhoAventuraDto, IDetalheRascunhoSessaoUnicaCanonica, DetalheRascunhoSessaoUnicaCanonicaDto, IDetalheRascunhoSessaoUnicaNaoCanonica, DetalheRascunhoSessaoUnicaNaoCanonicaDto, IRascunho, RascunhoDto, IEstudo, EstudoDto, IRegistroSessao, RegistroSessaoDto, ISessao, SessaoDto, SessaoDadosGerais, ParticipanteSessao, AuthSession, ICustomizacaoUsuario, CustomizacaoUsuarioDto, IDisponibilidadeUsuario, DisponibilidadeUsuarioDto, ListaDisponibilidadesUsuario, DisponibilidadesDDS, JanelaDisponibilidade, IUsuario, UsuarioDto, SalaDeJogo_Codigo, SalaDeJogoParams, SalaDeJogo_Tipo, SalaDeJogo_Estado, SalaDeJogo_TipoMestre, SalaDeJogo_Mestre, SalaDeJogo_Mestre_Mestrada, SalaDeJogo_Mestre_Inteligente, SalaDeJogo_TipoParticipante, SalaDeJogo_Participante, SalaDeJogo_Participante_Narrador, SalaDeJogo_Participante_Jogador, SalaDeJogo_FUNC_AtualizaParticipanteParams, SalaDeJogoDto, MenuItemNode, MenuGrupoNode, MenuNode, menuItem, menuGrupo, PaginaLike, MenuInternoTree, MenusInternos, Brand, ExtrairParamsDoTemplate, PaginaParamsDoTemplate, PaginaInfo, PaginaTemplate, PaginaDef, PaginaParams, montarHref, pagina, RequiredKeys, ParamsProps, MensagemChatRecebida, SalaChat, SalaChatFront, MensagemChatPayload, SOCKET_AcessoUsuario, SOCKET_UsuarioExistente, TelemetryConnectionInfo, WsEventAudienceUnico, WsEventAudienceMultiplo, WsEventAudience, TelemetryEventLog, TelemetrySnapshot, WsErrorResponse, WsUnauthorizedErrorResponse, WsResult, isWsErrorResponse, isWsUnauthorizedErrorResponse, wsErro, wsUnauthorized, wsMap, wsChain, EventoTipo, EmitDelivery, EventoAuthDefault, EventoEnvia, EventoEmite, EventoEnviaERecebe, EventoSchema, GatewayDef, createGateway, EventosWebSocket, isRecord, getEmitDelivery, WsEmitTarget, WsEmitParams, EventosEmiteMap, EventoEmiteAny, PaletaCores, EstruturaPaginaDefinicao, ConteudoItem, DefinicaoElemento, ListaItem, AventuraEstado, EstadoPendenciaPersonagem, EstadoPendenciaAdministrativaPersonagem, EstadoOcupacaoPersonagem, EstadoSessao, DiaDaSemana, obtemDiaDaSemanaPorExtensoPorDDS, NumeroHora24, NumeroMomento, MomentoFormatado24, MomentoFormatado, CargoExibicaoUsuario, CargosUsuario, ObjetoAutenticacao, ObjetoCache, ObjetoPendeciaPersonagem, TipoVariavelAmbiente, ObjetoEvolucaoCompleto, ObjetoEvolucao, ObjetoGanhosEvolucao, GanhoEstatistica, FormatoMomento, DetalheUtilizacaoRascunho, EstiloSessao, PathTokenPadrao, TituloSessaoInteligente, Capacidade, LISTA_CAPACIDADES, PermissaoItemMinimo, ListaCapacidadesNecessarias, AcessoPagina, Gateways, EventoTipoLiteral, FiltraEventosPorTipo, criarEventosFiltrados, Eventos_Envia, Eventos_Emite, Eventos_EnviaERecebe, DecisaoAcessoPagina, ResolverMenuInterno, Opts, decidirAcessoPagina, decidirAcessoPagina_Rec, PAGINAS, Folhas, PaginaFolha, PaginaTemplateFolha, PaginaDestino, PaginaDestinoPagina, PaginaHrefTemplate, PaginaHref, PaginaDefAny, PaginaTemplateAny, filtrarMenuPorAcesso, MENU_PRINCIPAL, MENUS_INTERNOS, MENUS_INTERNOS_POR_PAGINA, obterMenuInterno, resolverMenuInterno };
|
package/dist/classes.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// AUTO-GENERATED FILE - DO NOT EDIT
|
|
2
2
|
// Gerado automaticamente por extrairClasses.ts
|
|
3
|
-
function temSudoBurlarCapacidades(ctx) { return ctx.estaAutenticado && ctx.verificarCapacidade(CAPACIDADES.ADMINISTRADOR__SUDO__BURLAR_CAPACIDADES); }
|
|
4
3
|
/* eslint-disable */
|
|
5
4
|
// Arquivo gerado automaticamente. Não edite manualmente.
|
|
6
|
-
// npm run
|
|
5
|
+
// Para atualizar: npm run codegen:contratos
|
|
7
6
|
const CAPACIDADES = {
|
|
8
7
|
ADMINISTRADOR__PERMISSOES__ALTERACAO_CAPACIDADES_GERAIS_USUARIOS: 'ADMINISTRADOR.PERMISSOES.ALTERACAO_CAPACIDADES_GERAIS_USUARIOS',
|
|
9
8
|
ADMINISTRADOR__SUDO__BURLAR_CAPACIDADES: 'ADMINISTRADOR.SUDO.BURLAR_CAPACIDADES',
|
|
10
9
|
ADMINISTRADOR__SUDO__BURLAR_MODO_MANUTENÇÃO: 'ADMINISTRADOR.SUDO.BURLAR_MODO_MANUTENÇÃO',
|
|
11
|
-
|
|
10
|
+
ARTISTA__CRIACAO__UPLOAD_IMAGEM: 'ARTISTA.CRIACAO.UPLOAD_IMAGEM',
|
|
12
11
|
};
|
|
12
|
+
function temSudoBurlarCapacidades(ctx) { return ctx.estaAutenticado && ctx.verificarCapacidade(CAPACIDADES.ADMINISTRADOR__SUDO__BURLAR_CAPACIDADES); }
|
|
13
13
|
class AuthSession {
|
|
14
14
|
expiredAt;
|
|
15
15
|
id;
|
|
@@ -389,7 +389,8 @@ const PAGINAS = {
|
|
|
389
389
|
},
|
|
390
390
|
artista: {
|
|
391
391
|
...pagina('minhas-paginas/artista', { label: 'Área do Artista', acesso: { autenticado: true }, acessoPorMenuInterno: true }),
|
|
392
|
-
|
|
392
|
+
minhasImagens: pagina('/minhas-paginas/artista/minhas_imagens', { label: 'Minhas Imagens', acesso: { listaDeCapacidadesNecessarias: [CAPACIDADES.ARTISTA__CRIACAO__UPLOAD_IMAGEM] } }),
|
|
393
|
+
adicionarImagem: pagina('/minhas-paginas/artista/adicionar_imagem', { label: 'Adicionar Imagem', acesso: { listaDeCapacidadesNecessarias: [CAPACIDADES.ARTISTA__CRIACAO__UPLOAD_IMAGEM] } }),
|
|
393
394
|
},
|
|
394
395
|
minhasDisponibilidades: pagina('/minhas-paginas/minhas-disponibilidades', { label: 'Minhas Disponibilidades', acesso: { autenticado: true } }),
|
|
395
396
|
},
|
|
@@ -413,6 +414,9 @@ function filtrarMenuPorAcesso(nodes, ctx) {
|
|
|
413
414
|
}
|
|
414
415
|
return out;
|
|
415
416
|
}
|
|
417
|
+
/*
|
|
418
|
+
MENU_PRINCIPAL é o menu “final” (view-model) já pronto pra ser filtrado + renderizado.
|
|
419
|
+
*/
|
|
416
420
|
const MENU_PRINCIPAL = [
|
|
417
421
|
menuGrupo('Minhas Páginas', [
|
|
418
422
|
menuItem('Administrador', { pagina: PAGINAS.minhasPaginas.admin }),
|
|
@@ -430,22 +434,51 @@ const MENU_PRINCIPAL = [
|
|
|
430
434
|
menuItem('Dicas', { pagina: PAGINAS.dicas, params: { slug: [] } }),
|
|
431
435
|
];
|
|
432
436
|
/*
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
- reuso do acesso (SSOT)
|
|
436
|
-
- montar href com montarHref/hrefTemplate (SSOT)
|
|
437
|
-
- sem strings mágicas
|
|
437
|
+
MENUS_INTERNOS: árvore tipada e “descobrível” (DX).
|
|
438
|
+
Note que isso NÃO é “páginas /admin/*”, e sim o menu interno “da página admin”.
|
|
438
439
|
*/
|
|
439
440
|
const MENUS_INTERNOS = {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
441
|
+
PAGINAS: {
|
|
442
|
+
minhasPaginas: {
|
|
443
|
+
admin: [
|
|
444
|
+
menuItem('Upload', { pagina: PAGINAS.minhasPaginas.admin.uploads }),
|
|
445
|
+
menuItem('Variáveis de Ambiente', { pagina: PAGINAS.minhasPaginas.admin.variaveisAmbiente }),
|
|
446
|
+
menuItem('Aventuras', { pagina: PAGINAS.minhasPaginas.admin.aventuras }),
|
|
447
|
+
menuItem('Dashboard WebSocket', { pagina: PAGINAS.minhasPaginas.admin.dashboardWs }),
|
|
448
|
+
],
|
|
449
|
+
artista: [
|
|
450
|
+
menuItem('Minhas Imagens', { pagina: PAGINAS.minhasPaginas.artista.minhasImagens }),
|
|
451
|
+
menuItem('Adicionar Nova Imagem', { pagina: PAGINAS.minhasPaginas.artista.adicionarImagem }),
|
|
452
|
+
],
|
|
453
|
+
},
|
|
454
|
+
},
|
|
446
455
|
};
|
|
456
|
+
/*
|
|
457
|
+
Map derivado automaticamente da árvore acima.
|
|
458
|
+
Sem duplicar listas, sem string key, sem “ordem de execução” frágil.
|
|
459
|
+
*/
|
|
460
|
+
const MENUS_INTERNOS_POR_PAGINA = (() => {
|
|
461
|
+
const out = new Map();
|
|
462
|
+
const rec = (paginasNode, menusNode) => {
|
|
463
|
+
if (Array.isArray(menusNode)) {
|
|
464
|
+
if (paginasNode && typeof paginasNode === 'object' && 'template' in paginasNode)
|
|
465
|
+
out.set(paginasNode, menusNode);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (!menusNode || typeof menusNode !== 'object')
|
|
469
|
+
return;
|
|
470
|
+
for (const k of Object.keys(menusNode)) {
|
|
471
|
+
const nextPaginas = paginasNode && typeof paginasNode === 'object' ? paginasNode[k] : undefined;
|
|
472
|
+
const nextMenus = menusNode[k];
|
|
473
|
+
rec(nextPaginas, nextMenus);
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
rec(PAGINAS, MENUS_INTERNOS.PAGINAS);
|
|
477
|
+
return out;
|
|
478
|
+
})();
|
|
479
|
+
function obterMenuInterno(pagina) { return MENUS_INTERNOS_POR_PAGINA.get(pagina); }
|
|
447
480
|
function resolverMenuInterno(pagina) {
|
|
448
|
-
const nodes =
|
|
481
|
+
const nodes = obterMenuInterno(pagina);
|
|
449
482
|
if (!nodes)
|
|
450
483
|
return undefined;
|
|
451
484
|
const folhas = [];
|
|
@@ -459,4 +492,4 @@ function resolverMenuInterno(pagina) {
|
|
|
459
492
|
}
|
|
460
493
|
return folhas;
|
|
461
494
|
}
|
|
462
|
-
export {
|
|
495
|
+
export { CAPACIDADES, temSudoBurlarCapacidades, AuthSession, SalaDeJogo_Tipo, SalaDeJogo_Estado, SalaDeJogo_TipoMestre, SalaDeJogo_TipoParticipante, menuItem, menuGrupo, montarHref, pagina, isWsErrorResponse, isWsUnauthorizedErrorResponse, wsErro, wsUnauthorized, wsMap, wsChain, createGateway, EventosWebSocket, isRecord, getEmitDelivery, AventuraEstado, EstadoPendenciaPersonagem, EstadoPendenciaAdministrativaPersonagem, EstadoOcupacaoPersonagem, EstadoSessao, DiaDaSemana, obtemDiaDaSemanaPorExtensoPorDDS, CargoExibicaoUsuario, FormatoMomento, EstiloSessao, PathTokenPadrao, LISTA_CAPACIDADES, criarEventosFiltrados, Eventos_Envia, Eventos_Emite, Eventos_EnviaERecebe, decidirAcessoPagina, decidirAcessoPagina_Rec, PAGINAS, filtrarMenuPorAcesso, MENU_PRINCIPAL, MENUS_INTERNOS, MENUS_INTERNOS_POR_PAGINA, obterMenuInterno, resolverMenuInterno };
|