@designliquido/delegua-entidades 0.0.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/README.md +96 -0
- package/fontes/analisador-dicas.d.ts +49 -0
- package/fontes/analisador-dicas.d.ts.map +1 -0
- package/fontes/analisador-dicas.js +145 -0
- package/fontes/analisador-dicas.js.map +1 -0
- package/fontes/cache-consultas.d.ts +39 -0
- package/fontes/cache-consultas.d.ts.map +1 -0
- package/fontes/cache-consultas.js +98 -0
- package/fontes/cache-consultas.js.map +1 -0
- package/fontes/carregador-lotes.d.ts +64 -0
- package/fontes/carregador-lotes.d.ts.map +1 -0
- package/fontes/carregador-lotes.js +148 -0
- package/fontes/carregador-lotes.js.map +1 -0
- package/fontes/carregador-preguicoso.d.ts +34 -0
- package/fontes/carregador-preguicoso.d.ts.map +1 -0
- package/fontes/carregador-preguicoso.js +157 -0
- package/fontes/carregador-preguicoso.js.map +1 -0
- package/fontes/colecao.d.ts +74 -0
- package/fontes/colecao.d.ts.map +1 -0
- package/fontes/colecao.js +374 -0
- package/fontes/colecao.js.map +1 -0
- package/fontes/construtor-consulta.d.ts +129 -0
- package/fontes/construtor-consulta.d.ts.map +1 -0
- package/fontes/construtor-consulta.js +446 -0
- package/fontes/construtor-consulta.js.map +1 -0
- package/fontes/contexto-entidades.d.ts +119 -0
- package/fontes/contexto-entidades.d.ts.map +1 -0
- package/fontes/contexto-entidades.js +329 -0
- package/fontes/contexto-entidades.js.map +1 -0
- package/fontes/detector-n-mais-um.d.ts +87 -0
- package/fontes/detector-n-mais-um.d.ts.map +1 -0
- package/fontes/detector-n-mais-um.js +225 -0
- package/fontes/detector-n-mais-um.js.map +1 -0
- package/fontes/entidade.d.ts +82 -0
- package/fontes/entidade.d.ts.map +1 -0
- package/fontes/entidade.js +467 -0
- package/fontes/entidade.js.map +1 -0
- package/fontes/erros/erro-concorrencia.d.ts +11 -0
- package/fontes/erros/erro-concorrencia.d.ts.map +1 -0
- package/fontes/erros/erro-concorrencia.js +18 -0
- package/fontes/erros/erro-concorrencia.js.map +1 -0
- package/fontes/erros/erro-tabela-nao-encontrada.d.ts +4 -0
- package/fontes/erros/erro-tabela-nao-encontrada.d.ts.map +1 -0
- package/fontes/erros/erro-tabela-nao-encontrada.js +11 -0
- package/fontes/erros/erro-tabela-nao-encontrada.js.map +1 -0
- package/fontes/erros/erro-validacao.d.ts +9 -0
- package/fontes/erros/erro-validacao.d.ts.map +1 -0
- package/fontes/erros/erro-validacao.js +13 -0
- package/fontes/erros/erro-validacao.js.map +1 -0
- package/fontes/erros/index.d.ts +4 -0
- package/fontes/erros/index.d.ts.map +1 -0
- package/fontes/erros/index.js +20 -0
- package/fontes/erros/index.js.map +1 -0
- package/fontes/gerenciador-cache.d.ts +87 -0
- package/fontes/gerenciador-cache.d.ts.map +1 -0
- package/fontes/gerenciador-cache.js +147 -0
- package/fontes/gerenciador-cache.js.map +1 -0
- package/fontes/ilc/gerador-definicoes.d.ts +13 -0
- package/fontes/ilc/gerador-definicoes.d.ts.map +1 -0
- package/fontes/ilc/gerador-definicoes.js +96 -0
- package/fontes/ilc/gerador-definicoes.js.map +1 -0
- package/fontes/ilc/gerador-entidades.d.ts +10 -0
- package/fontes/ilc/gerador-entidades.d.ts.map +1 -0
- package/fontes/ilc/gerador-entidades.js +318 -0
- package/fontes/ilc/gerador-entidades.js.map +1 -0
- package/fontes/ilc/leitor-configuracao.d.ts +32 -0
- package/fontes/ilc/leitor-configuracao.d.ts.map +1 -0
- package/fontes/ilc/leitor-configuracao.js +124 -0
- package/fontes/ilc/leitor-configuracao.js.map +1 -0
- package/fontes/ilc/migracoes.d.ts +3 -0
- package/fontes/ilc/migracoes.d.ts.map +1 -0
- package/fontes/ilc/migracoes.js +215 -0
- package/fontes/ilc/migracoes.js.map +1 -0
- package/fontes/ilc/semeadura.d.ts +2 -0
- package/fontes/ilc/semeadura.d.ts.map +1 -0
- package/fontes/ilc/semeadura.js +50 -0
- package/fontes/ilc/semeadura.js.map +1 -0
- package/fontes/indicadores-performance/executor-analise-performance.d.ts +80 -0
- package/fontes/indicadores-performance/executor-analise-performance.d.ts.map +1 -0
- package/fontes/indicadores-performance/executor-analise-performance.js +212 -0
- package/fontes/indicadores-performance/executor-analise-performance.js.map +1 -0
- package/fontes/indicadores-performance/index.d.ts +26 -0
- package/fontes/indicadores-performance/index.d.ts.map +1 -0
- package/fontes/indicadores-performance/index.js +199 -0
- package/fontes/indicadores-performance/index.js.map +1 -0
- package/fontes/interfaces-tipos/analise-n1-interface.d.ts +13 -0
- package/fontes/interfaces-tipos/analise-n1-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/analise-n1-interface.js +3 -0
- package/fontes/interfaces-tipos/analise-n1-interface.js.map +1 -0
- package/fontes/interfaces-tipos/atributo-interface.d.ts +30 -0
- package/fontes/interfaces-tipos/atributo-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/atributo-interface.js +3 -0
- package/fontes/interfaces-tipos/atributo-interface.js.map +1 -0
- package/fontes/interfaces-tipos/coluna-computada-interface.d.ts +16 -0
- package/fontes/interfaces-tipos/coluna-computada-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/coluna-computada-interface.js +3 -0
- package/fontes/interfaces-tipos/coluna-computada-interface.js.map +1 -0
- package/fontes/interfaces-tipos/configuracao-banco-dados-interface.d.ts +48 -0
- package/fontes/interfaces-tipos/configuracao-banco-dados-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/configuracao-banco-dados-interface.js +3 -0
- package/fontes/interfaces-tipos/configuracao-banco-dados-interface.js.map +1 -0
- package/fontes/interfaces-tipos/entidade-interface.d.ts +37 -0
- package/fontes/interfaces-tipos/entidade-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/entidade-interface.js +3 -0
- package/fontes/interfaces-tipos/entidade-interface.js.map +1 -0
- package/fontes/interfaces-tipos/ganchos.d.ts +12 -0
- package/fontes/interfaces-tipos/ganchos.d.ts.map +1 -0
- package/fontes/interfaces-tipos/ganchos.js +3 -0
- package/fontes/interfaces-tipos/ganchos.js.map +1 -0
- package/fontes/interfaces-tipos/index.d.ts +17 -0
- package/fontes/interfaces-tipos/index.d.ts.map +1 -0
- package/fontes/interfaces-tipos/index.js +33 -0
- package/fontes/interfaces-tipos/index.js.map +1 -0
- package/fontes/interfaces-tipos/indice-interface.d.ts +16 -0
- package/fontes/interfaces-tipos/indice-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/indice-interface.js +3 -0
- package/fontes/interfaces-tipos/indice-interface.js.map +1 -0
- package/fontes/interfaces-tipos/informacao-consulta-interface.d.ts +12 -0
- package/fontes/interfaces-tipos/informacao-consulta-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/informacao-consulta-interface.js +3 -0
- package/fontes/interfaces-tipos/informacao-consulta-interface.js.map +1 -0
- package/fontes/interfaces-tipos/muito-para-muitos-interface.d.ts +33 -0
- package/fontes/interfaces-tipos/muito-para-muitos-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/muito-para-muitos-interface.js +3 -0
- package/fontes/interfaces-tipos/muito-para-muitos-interface.js.map +1 -0
- package/fontes/interfaces-tipos/opcoes-serializacao-interface.d.ts +14 -0
- package/fontes/interfaces-tipos/opcoes-serializacao-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/opcoes-serializacao-interface.js +3 -0
- package/fontes/interfaces-tipos/opcoes-serializacao-interface.js.map +1 -0
- package/fontes/interfaces-tipos/polimorfico-interface.d.ts +32 -0
- package/fontes/interfaces-tipos/polimorfico-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/polimorfico-interface.js +3 -0
- package/fontes/interfaces-tipos/polimorfico-interface.js.map +1 -0
- package/fontes/interfaces-tipos/relacionamento-interface.d.ts +23 -0
- package/fontes/interfaces-tipos/relacionamento-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/relacionamento-interface.js +3 -0
- package/fontes/interfaces-tipos/relacionamento-interface.js.map +1 -0
- package/fontes/interfaces-tipos/restricao-interface.d.ts +14 -0
- package/fontes/interfaces-tipos/restricao-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/restricao-interface.js +3 -0
- package/fontes/interfaces-tipos/restricao-interface.js.map +1 -0
- package/fontes/interfaces-tipos/semente-interface.d.ts +7 -0
- package/fontes/interfaces-tipos/semente-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/semente-interface.js +3 -0
- package/fontes/interfaces-tipos/semente-interface.js.map +1 -0
- package/fontes/interfaces-tipos/tabela-interface.d.ts +12 -0
- package/fontes/interfaces-tipos/tabela-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/tabela-interface.js +3 -0
- package/fontes/interfaces-tipos/tabela-interface.js.map +1 -0
- package/fontes/interfaces-tipos/transacao-interface.d.ts +35 -0
- package/fontes/interfaces-tipos/transacao-interface.d.ts.map +1 -0
- package/fontes/interfaces-tipos/transacao-interface.js +3 -0
- package/fontes/interfaces-tipos/transacao-interface.js.map +1 -0
- package/fontes/migracoes/executor-migracoes.d.ts +14 -0
- package/fontes/migracoes/executor-migracoes.d.ts.map +1 -0
- package/fontes/migracoes/executor-migracoes.js +177 -0
- package/fontes/migracoes/executor-migracoes.js.map +1 -0
- package/fontes/migracoes/gerador-migracoes.d.ts +15 -0
- package/fontes/migracoes/gerador-migracoes.d.ts.map +1 -0
- package/fontes/migracoes/gerador-migracoes.js +108 -0
- package/fontes/migracoes/gerador-migracoes.js.map +1 -0
- package/fontes/migracoes/migracao.d.ts +35 -0
- package/fontes/migracoes/migracao.d.ts.map +1 -0
- package/fontes/migracoes/migracao.js +66 -0
- package/fontes/migracoes/migracao.js.map +1 -0
- package/fontes/migracoes/semeador.d.ts +18 -0
- package/fontes/migracoes/semeador.d.ts.map +1 -0
- package/fontes/migracoes/semeador.js +109 -0
- package/fontes/migracoes/semeador.js.map +1 -0
- package/fontes/rastreador-mudancas.d.ts +27 -0
- package/fontes/rastreador-mudancas.d.ts.map +1 -0
- package/fontes/rastreador-mudancas.js +94 -0
- package/fontes/rastreador-mudancas.js.map +1 -0
- package/fontes/relacionamento.d.ts +11 -0
- package/fontes/relacionamento.d.ts.map +1 -0
- package/fontes/relacionamento.js +15 -0
- package/fontes/relacionamento.js.map +1 -0
- package/fontes/roteador-bancos.d.ts +50 -0
- package/fontes/roteador-bancos.d.ts.map +1 -0
- package/fontes/roteador-bancos.js +90 -0
- package/fontes/roteador-bancos.js.map +1 -0
- package/fontes/serializador.d.ts +46 -0
- package/fontes/serializador.d.ts.map +1 -0
- package/fontes/serializador.js +79 -0
- package/fontes/serializador.js.map +1 -0
- package/fontes/taquigrafia.d.ts +41 -0
- package/fontes/taquigrafia.d.ts.map +1 -0
- package/fontes/taquigrafia.js +96 -0
- package/fontes/taquigrafia.js.map +1 -0
- package/fontes/tipos.d.ts +3 -0
- package/fontes/tipos.d.ts.map +1 -0
- package/fontes/tipos.js +3 -0
- package/fontes/tipos.js.map +1 -0
- package/fontes/transacao.d.ts +81 -0
- package/fontes/transacao.d.ts.map +1 -0
- package/fontes/transacao.js +243 -0
- package/fontes/transacao.js.map +1 -0
- package/fontes/validacoes/validador.d.ts +19 -0
- package/fontes/validacoes/validador.d.ts.map +1 -0
- package/fontes/validacoes/validador.js +157 -0
- package/fontes/validacoes/validador.js.map +1 -0
- package/index.d.ts +36 -0
- package/index.d.ts.map +1 -0
- package/index.js +59 -0
- package/index.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DescritorTipoClasse, ObjetoDeleguaClasse } from "@designliquido/delegua/interpretador/estruturas";
|
|
2
|
+
import { Classe } from "@designliquido/delegua/declaracoes";
|
|
3
|
+
import { ColunaEValor, Condicao, Criar } from "@designliquido/lincones-js";
|
|
4
|
+
import { TabelaInterface } from "./interfaces-tipos/tabela-interface";
|
|
5
|
+
import { EntidadeInterface } from "./interfaces-tipos/entidade-interface";
|
|
6
|
+
import { RelacionamentoInterface } from "./interfaces-tipos/relacionamento-interface";
|
|
7
|
+
import { MuitoParaMuitoInterface } from "./interfaces-tipos/muito-para-muitos-interface";
|
|
8
|
+
import { PolimorficInterface } from "./interfaces-tipos/polimorfico-interface";
|
|
9
|
+
import { IndiceInterface } from "./interfaces-tipos/indice-interface";
|
|
10
|
+
import { RestricaoInterface } from "./interfaces-tipos/restricao-interface";
|
|
11
|
+
import { ColunaComputadaInterface } from "./interfaces-tipos/coluna-computada-interface";
|
|
12
|
+
/**
|
|
13
|
+
* Classe responsável por intermediar um registro (normalmente um `ObjetoDeleguaClasse`)
|
|
14
|
+
* e interfaces de manipulação de dados. Normalmente usada por objetos do tipo `Colecao`
|
|
15
|
+
* para gerar comandos de alto nível para bibliotecas como `lincones-js`.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Entidade implements EntidadeInterface {
|
|
18
|
+
modelo: DescritorTipoClasse;
|
|
19
|
+
nomePropriedadeChavePrimaria: string;
|
|
20
|
+
nomePropriedadesChavesPrimarias: string[];
|
|
21
|
+
indices: IndiceInterface[];
|
|
22
|
+
restricoes: RestricaoInterface[];
|
|
23
|
+
colunasComputadas: ColunaComputadaInterface[];
|
|
24
|
+
muitosParaMuitos: MuitoParaMuitoInterface[];
|
|
25
|
+
polimorficos: PolimorficInterface[];
|
|
26
|
+
nomePropriedadeVersao: string;
|
|
27
|
+
/**
|
|
28
|
+
* Construtor da classe Entidades.
|
|
29
|
+
* @param diretorioAtual O diretório atual.
|
|
30
|
+
* @param caminhoModelos O caminho dos modelos de tabelas.
|
|
31
|
+
* @param tecnologia A tecnologia utilizada.
|
|
32
|
+
*/
|
|
33
|
+
constructor(modelo: DescritorTipoClasse | Classe);
|
|
34
|
+
private validarModeloClasse;
|
|
35
|
+
private construirDescritorTipoClasse;
|
|
36
|
+
private validarTipoModelo;
|
|
37
|
+
obterNome(): string;
|
|
38
|
+
possuiCriadoEm(): boolean;
|
|
39
|
+
possuiAtualizadoEm(): boolean;
|
|
40
|
+
obterNomeChavePrimaria(): string;
|
|
41
|
+
obterNomesChavesPrimarias(): string[];
|
|
42
|
+
obterIndices(): IndiceInterface[];
|
|
43
|
+
obterRestricoes(): RestricaoInterface[];
|
|
44
|
+
obterColunasComputadas(): ColunaComputadaInterface[];
|
|
45
|
+
obterMuitosParaMuitos(): MuitoParaMuitoInterface[];
|
|
46
|
+
obterPolimorficos(): PolimorficInterface[];
|
|
47
|
+
obterNomePropriedadeVersao(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Obtém o nome do banco de dados ao qual a entidade pertence.
|
|
50
|
+
* Busca por decorador @banco, senão retorna "padrão".
|
|
51
|
+
*/
|
|
52
|
+
obterNomeBancoDados(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Verifica se a entidade possui exclusão lógica (soft delete) habilitada.
|
|
55
|
+
* Busca por propriedade com decorador @exclusaoLogica ou coluna "excluido_em".
|
|
56
|
+
*/
|
|
57
|
+
possuiExclusaoLogica(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Obtém o nome da coluna de exclusão lógica.
|
|
60
|
+
* Retorna "excluido_em" como padrão.
|
|
61
|
+
*/
|
|
62
|
+
obterNomeColunaExclusaoLogica(): string;
|
|
63
|
+
obterRelacionamentos(): RelacionamentoInterface[];
|
|
64
|
+
obterNomesColunas(): string[];
|
|
65
|
+
obterNomesColunasPersistentes(): string[];
|
|
66
|
+
/**
|
|
67
|
+
* Traduz um tipo Delégua para o equivalente em lincones-js.
|
|
68
|
+
* @param tipo O tipo Delégua a ser traduzido.
|
|
69
|
+
* @returns O tipo no formato lincones-js.
|
|
70
|
+
*/
|
|
71
|
+
traduzirTipo(tipo: string): string;
|
|
72
|
+
obterValoresDasPropriedades(tabela: TabelaInterface, classe: ObjetoDeleguaClasse): string;
|
|
73
|
+
resolverValoresParaColunas(registro: ObjetoDeleguaClasse, colunas: string[]): any[];
|
|
74
|
+
resolverColunasEValores(registro: ObjetoDeleguaClasse, colunas: string[]): ColunaEValor[];
|
|
75
|
+
gerarComandoCriarTabela(): Criar;
|
|
76
|
+
hidratarRegistro(linha: {
|
|
77
|
+
[coluna: string]: any;
|
|
78
|
+
}): ObjetoDeleguaClasse;
|
|
79
|
+
hidratarRegistros(linhas: any[]): ObjetoDeleguaClasse[];
|
|
80
|
+
resolverCondicaoPorChavePrimaria(registro: ObjetoDeleguaClasse): Condicao;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=entidade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entidade.d.ts","sourceRoot":"","sources":["../../fontes/entidade.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EAEnB,mBAAmB,EACtB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAU,YAAY,EAAE,QAAQ,EAAE,KAAK,EAA6B,MAAM,4BAA4B,CAAC;AAG9G,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAGzF;;;;GAIG;AACH,qBAAa,QAAS,YAAW,iBAAiB;IAC9C,MAAM,EAAE,mBAAmB,CAAC;IAC5B,4BAA4B,EAAE,MAAM,CAAC;IACrC,+BAA+B,EAAE,MAAM,EAAE,CAAM;IAC/C,OAAO,EAAE,eAAe,EAAE,CAAM;IAChC,UAAU,EAAE,kBAAkB,EAAE,CAAM;IACtC,iBAAiB,EAAE,wBAAwB,EAAE,CAAM;IACnD,gBA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M,GAAG,GAAG,CAAA;KAAE,GAAG,mBAAmB;IAWvE,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,mBAAmB,EAAE;IAIvD,gCAAgC,CAAC,QAAQ,EAAE,mBAAmB,GAAG,QAAQ;CAyB5E"}
|
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Entidade = void 0;
|
|
4
|
+
const estruturas_1 = require("@designliquido/delegua/interpretador/estruturas");
|
|
5
|
+
const declaracoes_1 = require("@designliquido/delegua/declaracoes");
|
|
6
|
+
const lincones_js_1 = require("@designliquido/lincones-js");
|
|
7
|
+
const relacionamento_1 = require("./relacionamento");
|
|
8
|
+
/**
|
|
9
|
+
* Classe responsável por intermediar um registro (normalmente um `ObjetoDeleguaClasse`)
|
|
10
|
+
* e interfaces de manipulação de dados. Normalmente usada por objetos do tipo `Colecao`
|
|
11
|
+
* para gerar comandos de alto nível para bibliotecas como `lincones-js`.
|
|
12
|
+
*/
|
|
13
|
+
class Entidade {
|
|
14
|
+
/**
|
|
15
|
+
* Construtor da classe Entidades.
|
|
16
|
+
* @param diretorioAtual O diretório atual.
|
|
17
|
+
* @param caminhoModelos O caminho dos modelos de tabelas.
|
|
18
|
+
* @param tecnologia A tecnologia utilizada.
|
|
19
|
+
*/
|
|
20
|
+
constructor(modelo) {
|
|
21
|
+
this.nomePropriedadesChavesPrimarias = [];
|
|
22
|
+
this.indices = [];
|
|
23
|
+
this.restricoes = [];
|
|
24
|
+
this.colunasComputadas = [];
|
|
25
|
+
this.muitosParaMuitos = [];
|
|
26
|
+
this.polimorficos = [];
|
|
27
|
+
if (modelo instanceof estruturas_1.DescritorTipoClasse) {
|
|
28
|
+
this.validarTipoModelo(modelo);
|
|
29
|
+
this.modelo = modelo;
|
|
30
|
+
}
|
|
31
|
+
if (modelo instanceof declaracoes_1.Classe) {
|
|
32
|
+
const descritorClasse = this.validarModeloClasse(modelo);
|
|
33
|
+
this.modelo = descritorClasse;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
validarModeloClasse(modelo) {
|
|
37
|
+
// Validações:
|
|
38
|
+
// Deve ter uma propriedade chamada `id` ou então pelo menos uma propriedade que tenha um
|
|
39
|
+
// decorador @chave.
|
|
40
|
+
for (const propriedade of modelo.propriedades) {
|
|
41
|
+
if (propriedade.nome.lexema === "id") {
|
|
42
|
+
this.nomePropriedadeChavePrimaria = "id";
|
|
43
|
+
this.nomePropriedadesChavesPrimarias.push("id");
|
|
44
|
+
}
|
|
45
|
+
for (const decorador of propriedade.decoradores) {
|
|
46
|
+
if (decorador.nome === "@chave") {
|
|
47
|
+
this.nomePropriedadeChavePrimaria = propriedade.nome.lexema;
|
|
48
|
+
this.nomePropriedadesChavesPrimarias.push(propriedade.nome.lexema);
|
|
49
|
+
}
|
|
50
|
+
// Detectar índices
|
|
51
|
+
if (decorador.nome === "@indice" || decorador.nome === "@indiceUnico") {
|
|
52
|
+
const eUnico = decorador.nome === "@indiceUnico";
|
|
53
|
+
const nomeIndice = decorador.atributos?.nome || `idx_${propriedade.nome.lexema}`;
|
|
54
|
+
this.indices.push({
|
|
55
|
+
nome: nomeIndice,
|
|
56
|
+
colunas: [propriedade.nome.lexema],
|
|
57
|
+
unico: eUnico
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// Detectar restrições
|
|
61
|
+
if (decorador.nome === "@restricao") {
|
|
62
|
+
this.restricoes.push({
|
|
63
|
+
nome: decorador.atributos?.nome || `constr_${propriedade.nome.lexema}`,
|
|
64
|
+
sql: decorador.atributos?.sql || decorador.atributos?.restricao || '',
|
|
65
|
+
tipo: 'CHECK'
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// Detectar colunas computadas
|
|
69
|
+
if (decorador.nome === "@computada") {
|
|
70
|
+
const expressao = decorador.atributos?.expressao || decorador.atributos?.sql;
|
|
71
|
+
if (!expressao) {
|
|
72
|
+
throw new Error(`Coluna computada '${propriedade.nome.lexema}' precisa de expressao.`);
|
|
73
|
+
}
|
|
74
|
+
this.colunasComputadas.push({
|
|
75
|
+
nome: propriedade.nome.lexema,
|
|
76
|
+
tipo: this.traduzirTipo(propriedade.tipo || "texto"),
|
|
77
|
+
expressao: expressao,
|
|
78
|
+
persistida: decorador.atributos?.persistida
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
// Detectar relacionamentos muitos-para-muitos
|
|
82
|
+
if (decorador.nome === "@temMuitosParaMuitos") {
|
|
83
|
+
const entidadeDestino = decorador.atributos?.entidade;
|
|
84
|
+
if (!entidadeDestino)
|
|
85
|
+
continue;
|
|
86
|
+
const nomeEntidade = modelo.simbolo.lexema;
|
|
87
|
+
const nomeEntidadeDestino = entidadeDestino;
|
|
88
|
+
const tabelaIntermediaria = decorador.atributos?.tabelaIntermediaria ||
|
|
89
|
+
`${nomeEntidade.toLowerCase()}_${nomeEntidadeDestino.toLowerCase()}`;
|
|
90
|
+
this.muitosParaMuitos.push({
|
|
91
|
+
tipo: 'muitoParaMuitos',
|
|
92
|
+
nomePropriedade: propriedade.nome.lexema,
|
|
93
|
+
entidadeDestino: entidadeDestino,
|
|
94
|
+
tabelaIntermediaria: tabelaIntermediaria,
|
|
95
|
+
colunaOrigem: decorador.atributos?.colunaOrigem || `${nomeEntidade.toLowerCase()}_id`,
|
|
96
|
+
colunaDestino: decorador.atributos?.colunaDestino || `${nomeEntidadeDestino.toLowerCase()}_id`,
|
|
97
|
+
deletarAoRemover: decorador.atributos?.deletarAoRemover ?? false
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Detectar relacionamentos polimórficos
|
|
101
|
+
if (decorador.nome === "@polimorfico") {
|
|
102
|
+
const entidadesPossiveis = decorador.atributos?.entidades || [];
|
|
103
|
+
this.polimorficos.push({
|
|
104
|
+
tipo: 'polimorfico',
|
|
105
|
+
nomePropriedade: propriedade.nome.lexema,
|
|
106
|
+
colunaTipo: decorador.atributos?.colunaTipo || `${propriedade.nome.lexema}_tipo`,
|
|
107
|
+
colunaId: decorador.atributos?.colunaId || `${propriedade.nome.lexema}_id`,
|
|
108
|
+
entidadesPossiveis: entidadesPossiveis,
|
|
109
|
+
deletarAoRemover: decorador.atributos?.deletarAoRemover ?? false
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// Detectar campo de versão para concorrência otimista (decorador)
|
|
113
|
+
if (decorador.nome === "@versao") {
|
|
114
|
+
this.nomePropriedadeVersao = propriedade.nome.lexema;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Detectar campo de versão para concorrência otimista (por convenção de nome)
|
|
118
|
+
if (propriedade.nome.lexema === "versao") {
|
|
119
|
+
this.nomePropriedadeVersao = propriedade.nome.lexema;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!this.nomePropriedadeChavePrimaria) {
|
|
123
|
+
throw new Error("Modelo não possui uma chave primária definida. " +
|
|
124
|
+
"Para definir uma chave primária, você pode ou declarar uma propriedade `id` com o tipo `número`, " +
|
|
125
|
+
"ou declarar uma propriedade com o tipo número e decorá-la com `@chave`.");
|
|
126
|
+
}
|
|
127
|
+
return this.construirDescritorTipoClasse(modelo);
|
|
128
|
+
}
|
|
129
|
+
construirDescritorTipoClasse(modelo) {
|
|
130
|
+
const metodos = {};
|
|
131
|
+
const definirMetodos = modelo.metodos;
|
|
132
|
+
for (let i = 0; i < modelo.metodos.length; i++) {
|
|
133
|
+
const metodoAtual = definirMetodos[i];
|
|
134
|
+
const eInicializador = metodoAtual.simbolo.lexema === "construtor";
|
|
135
|
+
const funcao = new estruturas_1.DeleguaFuncao(metodoAtual.simbolo.lexema, metodoAtual.funcao, undefined, eInicializador);
|
|
136
|
+
metodos[metodoAtual.simbolo.lexema] = funcao;
|
|
137
|
+
}
|
|
138
|
+
const descritorTipoClasse = new estruturas_1.DescritorTipoClasse(modelo.simbolo, undefined, // Por enquanto não teremos herança.
|
|
139
|
+
metodos, modelo.propriedades);
|
|
140
|
+
return descritorTipoClasse;
|
|
141
|
+
}
|
|
142
|
+
validarTipoModelo(modelo) {
|
|
143
|
+
// Validações:
|
|
144
|
+
// Deve ter uma propriedade chamada `id` ou então pelo menos uma propriedade que tenha um
|
|
145
|
+
// decorador @chave.
|
|
146
|
+
for (const propriedade of modelo.propriedades) {
|
|
147
|
+
if (propriedade.nome.lexema === "id") {
|
|
148
|
+
this.nomePropriedadeChavePrimaria = "id";
|
|
149
|
+
this.nomePropriedadesChavesPrimarias.push("id");
|
|
150
|
+
}
|
|
151
|
+
for (const decorador of propriedade.decoradores) {
|
|
152
|
+
if (decorador.nome === "chave") {
|
|
153
|
+
this.nomePropriedadeChavePrimaria = propriedade.nome.lexema;
|
|
154
|
+
this.nomePropriedadesChavesPrimarias.push(propriedade.nome.lexema);
|
|
155
|
+
}
|
|
156
|
+
// Detectar índices
|
|
157
|
+
if (decorador.nome === "indice" || decorador.nome === "indiceUnico") {
|
|
158
|
+
const eUnico = decorador.nome === "indiceUnico";
|
|
159
|
+
const nomeIndice = decorador.atributos?.nome || `idx_${propriedade.nome.lexema}`;
|
|
160
|
+
this.indices.push({
|
|
161
|
+
nome: nomeIndice,
|
|
162
|
+
colunas: [propriedade.nome.lexema],
|
|
163
|
+
unico: eUnico,
|
|
164
|
+
tipo: decorador.atributos?.tipo
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
// Detectar restrições
|
|
168
|
+
if (decorador.nome === "restricao") {
|
|
169
|
+
this.restricoes.push({
|
|
170
|
+
nome: decorador.atributos?.nome || `constr_${propriedade.nome.lexema}`,
|
|
171
|
+
sql: decorador.atributos?.sql || decorador.atributos?.restricao || '',
|
|
172
|
+
tipo: 'CHECK'
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
// Detectar colunas computadas
|
|
176
|
+
if (decorador.nome === "computada") {
|
|
177
|
+
const expressao = decorador.atributos?.expressao || decorador.atributos?.sql;
|
|
178
|
+
if (!expressao) {
|
|
179
|
+
throw new Error(`Coluna computada '${propriedade.nome.lexema}' precisa de expressao.`);
|
|
180
|
+
}
|
|
181
|
+
this.colunasComputadas.push({
|
|
182
|
+
nome: propriedade.nome.lexema,
|
|
183
|
+
tipo: this.traduzirTipo(propriedade.tipo || "texto"),
|
|
184
|
+
expressao: expressao,
|
|
185
|
+
persistida: decorador.atributos?.persistida
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// Detectar relacionamentos muitos-para-muitos
|
|
189
|
+
if (decorador.nome === "temMuitosParaMuitos") {
|
|
190
|
+
const entidadeDestino = decorador.atributos?.entidade;
|
|
191
|
+
if (!entidadeDestino)
|
|
192
|
+
continue;
|
|
193
|
+
const nomeEntidade = modelo.simboloOriginal.lexema;
|
|
194
|
+
const nomeEntidadeDestino = entidadeDestino;
|
|
195
|
+
const tabelaIntermediaria = decorador.atributos?.tabelaIntermediaria ||
|
|
196
|
+
`${nomeEntidade.toLowerCase()}_${nomeEntidadeDestino.toLowerCase()}`;
|
|
197
|
+
this.muitosParaMuitos.push({
|
|
198
|
+
tipo: 'muitoParaMuitos',
|
|
199
|
+
nomePropriedade: propriedade.nome.lexema,
|
|
200
|
+
entidadeDestino: entidadeDestino,
|
|
201
|
+
tabelaIntermediaria: tabelaIntermediaria,
|
|
202
|
+
colunaOrigem: decorador.atributos?.colunaOrigem || `${nomeEntidade.toLowerCase()}_id`,
|
|
203
|
+
colunaDestino: decorador.atributos?.colunaDestino || `${nomeEntidadeDestino.toLowerCase()}_id`,
|
|
204
|
+
deletarAoRemover: decorador.atributos?.deletarAoRemover ?? false
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// Detectar relacionamentos polimórficos
|
|
208
|
+
if (decorador.nome === "polimorfico") {
|
|
209
|
+
const entidadesPossiveis = decorador.atributos?.entidades || [];
|
|
210
|
+
this.polimorficos.push({
|
|
211
|
+
tipo: 'polimorfico',
|
|
212
|
+
nomePropriedade: propriedade.nome.lexema,
|
|
213
|
+
colunaTipo: decorador.atributos?.colunaTipo || `${propriedade.nome.lexema}_tipo`,
|
|
214
|
+
colunaId: decorador.atributos?.colunaId || `${propriedade.nome.lexema}_id`,
|
|
215
|
+
entidadesPossiveis: entidadesPossiveis,
|
|
216
|
+
deletarAoRemover: decorador.atributos?.deletarAoRemover ?? false
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
// Detectar campo de versão para concorrência otimista (decorador)
|
|
220
|
+
if (decorador.nome === "versao") {
|
|
221
|
+
this.nomePropriedadeVersao = propriedade.nome.lexema;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Detectar campo de versão para concorrência otimista (por convenção de nome)
|
|
225
|
+
if (propriedade.nome.lexema === "versao") {
|
|
226
|
+
this.nomePropriedadeVersao = propriedade.nome.lexema;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// Se nenhuma chave primária foi encontrada, lançar erro
|
|
230
|
+
if (!this.nomePropriedadeChavePrimaria) {
|
|
231
|
+
throw new Error("Modelo não possui uma chave primária definida. " +
|
|
232
|
+
"Para definir uma chave primária, você pode ou declarar uma propriedade `id` com o tipo `número`, " +
|
|
233
|
+
"ou declarar uma propriedade com o tipo número e decorá-la com `@chave`.");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
obterNome() {
|
|
237
|
+
return this.modelo.simboloOriginal.lexema;
|
|
238
|
+
}
|
|
239
|
+
possuiCriadoEm() {
|
|
240
|
+
return this.modelo.propriedades.some(p => p.nome.lexema === 'criado_em');
|
|
241
|
+
}
|
|
242
|
+
possuiAtualizadoEm() {
|
|
243
|
+
return this.modelo.propriedades.some(p => p.nome.lexema === 'atualizado_em');
|
|
244
|
+
}
|
|
245
|
+
obterNomeChavePrimaria() {
|
|
246
|
+
return this.nomePropriedadeChavePrimaria;
|
|
247
|
+
}
|
|
248
|
+
obterNomesChavesPrimarias() {
|
|
249
|
+
return this.nomePropriedadesChavesPrimarias.length > 0
|
|
250
|
+
? this.nomePropriedadesChavesPrimarias
|
|
251
|
+
: [this.nomePropriedadeChavePrimaria];
|
|
252
|
+
}
|
|
253
|
+
obterIndices() {
|
|
254
|
+
return this.indices;
|
|
255
|
+
}
|
|
256
|
+
obterRestricoes() {
|
|
257
|
+
return this.restricoes;
|
|
258
|
+
}
|
|
259
|
+
obterColunasComputadas() {
|
|
260
|
+
return this.colunasComputadas;
|
|
261
|
+
}
|
|
262
|
+
obterMuitosParaMuitos() {
|
|
263
|
+
return this.muitosParaMuitos;
|
|
264
|
+
}
|
|
265
|
+
obterPolimorficos() {
|
|
266
|
+
return this.polimorficos;
|
|
267
|
+
}
|
|
268
|
+
obterNomePropriedadeVersao() {
|
|
269
|
+
return this.nomePropriedadeVersao || "";
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Obtém o nome do banco de dados ao qual a entidade pertence.
|
|
273
|
+
* Busca por decorador @banco, senão retorna "padrão".
|
|
274
|
+
*/
|
|
275
|
+
obterNomeBancoDados() {
|
|
276
|
+
for (const propriedade of this.modelo.propriedades) {
|
|
277
|
+
for (const decorador of propriedade.decoradores) {
|
|
278
|
+
const nomeDecorador = decorador.nome.replace(/^@/, '');
|
|
279
|
+
if (nomeDecorador === 'banco') {
|
|
280
|
+
return decorador.atributos?.nome || 'padrão';
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// Se nenhum decorador @banco foi encontrado, verificar em uma localização padrão
|
|
285
|
+
// (idealmente seria no nível da classe, mas estamos limitados às propriedades)
|
|
286
|
+
return 'padrão';
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Verifica se a entidade possui exclusão lógica (soft delete) habilitada.
|
|
290
|
+
* Busca por propriedade com decorador @exclusaoLogica ou coluna "excluido_em".
|
|
291
|
+
*/
|
|
292
|
+
possuiExclusaoLogica() {
|
|
293
|
+
// Procurar por decorador @exclusaoLogica
|
|
294
|
+
for (const propriedade of this.modelo.propriedades) {
|
|
295
|
+
for (const decorador of propriedade.decoradores) {
|
|
296
|
+
const nomeDecorador = decorador.nome.replace(/^@/, '');
|
|
297
|
+
if (nomeDecorador === 'exclusaoLogica') {
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// Procurar por coluna "excluido_em"
|
|
303
|
+
return this.modelo.propriedades.some(p => p.nome.lexema === 'excluido_em');
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Obtém o nome da coluna de exclusão lógica.
|
|
307
|
+
* Retorna "excluido_em" como padrão.
|
|
308
|
+
*/
|
|
309
|
+
obterNomeColunaExclusaoLogica() {
|
|
310
|
+
for (const propriedade of this.modelo.propriedades) {
|
|
311
|
+
for (const decorador of propriedade.decoradores) {
|
|
312
|
+
const nomeDecorador = decorador.nome.replace(/^@/, '');
|
|
313
|
+
if (nomeDecorador === 'exclusaoLogica') {
|
|
314
|
+
return decorador.atributos?.coluna || 'excluido_em';
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// Se houver uma propriedade "excluido_em", usá-la
|
|
319
|
+
if (this.modelo.propriedades.some(p => p.nome.lexema === 'excluido_em')) {
|
|
320
|
+
return 'excluido_em';
|
|
321
|
+
}
|
|
322
|
+
return 'excluido_em';
|
|
323
|
+
}
|
|
324
|
+
obterRelacionamentos() {
|
|
325
|
+
const relacionamentos = [];
|
|
326
|
+
const nomeEntidade = this.obterNome();
|
|
327
|
+
for (const propriedade of this.modelo.propriedades) {
|
|
328
|
+
for (const decorador of propriedade.decoradores) {
|
|
329
|
+
const nomeDecorador = decorador.nome.replace(/^@/, '');
|
|
330
|
+
if (nomeDecorador === 'temUm' || nomeDecorador === 'temMuitos' || nomeDecorador === 'pertenceA') {
|
|
331
|
+
const entidadeDestino = decorador.atributos?.entidade;
|
|
332
|
+
if (!entidadeDestino)
|
|
333
|
+
continue;
|
|
334
|
+
let colunaOrigem;
|
|
335
|
+
let colunaDestino;
|
|
336
|
+
if (nomeDecorador === 'pertenceA') {
|
|
337
|
+
colunaOrigem = decorador.atributos?.chaveEstrangeira || `${entidadeDestino.toLowerCase()}_id`;
|
|
338
|
+
colunaDestino = 'id';
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
colunaOrigem = 'id';
|
|
342
|
+
colunaDestino = decorador.atributos?.chaveEstrangeira || `${nomeEntidade.toLowerCase()}_id`;
|
|
343
|
+
}
|
|
344
|
+
const cascata = decorador.atributos?.cascata;
|
|
345
|
+
relacionamentos.push(new relacionamento_1.Relacionamento(nomeDecorador, propriedade.nome.lexema, entidadeDestino, colunaOrigem, colunaDestino, cascata));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return relacionamentos;
|
|
350
|
+
}
|
|
351
|
+
obterNomesColunas() {
|
|
352
|
+
let nomesColunas = [];
|
|
353
|
+
for (let propriedade of this.modelo.propriedades) {
|
|
354
|
+
nomesColunas.push(propriedade.nome.lexema);
|
|
355
|
+
}
|
|
356
|
+
return nomesColunas;
|
|
357
|
+
}
|
|
358
|
+
obterNomesColunasPersistentes() {
|
|
359
|
+
const nomesComputadas = new Set(this.colunasComputadas.map((c) => c.nome));
|
|
360
|
+
return this.obterNomesColunas().filter((nome) => !nomesComputadas.has(nome));
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Traduz um tipo Delégua para o equivalente em lincones-js.
|
|
364
|
+
* @param tipo O tipo Delégua a ser traduzido.
|
|
365
|
+
* @returns O tipo no formato lincones-js.
|
|
366
|
+
*/
|
|
367
|
+
traduzirTipo(tipo) {
|
|
368
|
+
switch (tipo) {
|
|
369
|
+
case "numero":
|
|
370
|
+
case "número":
|
|
371
|
+
case "inteiro":
|
|
372
|
+
case "longo":
|
|
373
|
+
return "INTEIRO";
|
|
374
|
+
case "decimal":
|
|
375
|
+
return "NUMERO";
|
|
376
|
+
case "texto":
|
|
377
|
+
return "TEXTO";
|
|
378
|
+
case "caracteres":
|
|
379
|
+
return "CARACTERES";
|
|
380
|
+
case "logico":
|
|
381
|
+
case "lógico":
|
|
382
|
+
return "LOGICO";
|
|
383
|
+
default:
|
|
384
|
+
throw new Error(`EntidadesError: O tipo: ${tipo} não é válido.`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
obterValoresDasPropriedades(tabela, classe) {
|
|
388
|
+
return tabela.atributos
|
|
389
|
+
.map((atributo) => {
|
|
390
|
+
const propriedade = Object.entries(classe.propriedades).find(([key, value]) => key === atributo.nome);
|
|
391
|
+
return propriedade ? propriedade[1] : null;
|
|
392
|
+
})
|
|
393
|
+
.join(", ");
|
|
394
|
+
}
|
|
395
|
+
resolverValoresParaColunas(registro, colunas) {
|
|
396
|
+
const valores = [];
|
|
397
|
+
const nomesComputadas = new Set(this.colunasComputadas.map((c) => c.nome));
|
|
398
|
+
for (const coluna of colunas) {
|
|
399
|
+
if (!this.modelo.propriedades.some(p => p.nome.lexema === coluna)) {
|
|
400
|
+
throw new Error(`Coluna ${coluna} não existe em entidade ${this.modelo.simboloOriginal.lexema}.`);
|
|
401
|
+
}
|
|
402
|
+
if (nomesComputadas.has(coluna)) {
|
|
403
|
+
throw new Error(`Coluna computada ${coluna} nao pode receber valor manual.`);
|
|
404
|
+
}
|
|
405
|
+
valores.push(registro.propriedades[coluna]);
|
|
406
|
+
}
|
|
407
|
+
return valores;
|
|
408
|
+
}
|
|
409
|
+
resolverColunasEValores(registro, colunas) {
|
|
410
|
+
const colunasEValores = [];
|
|
411
|
+
const nomesComputadas = new Set(this.colunasComputadas.map((c) => c.nome));
|
|
412
|
+
for (const coluna of colunas) {
|
|
413
|
+
if (!this.modelo.propriedades.some(p => p.nome.lexema === coluna)) {
|
|
414
|
+
throw new Error(`Coluna ${coluna} não existe em entidade ${this.modelo.simboloOriginal.lexema}.`);
|
|
415
|
+
}
|
|
416
|
+
if (nomesComputadas.has(coluna)) {
|
|
417
|
+
throw new Error(`Coluna computada ${coluna} nao pode ser atualizada.`);
|
|
418
|
+
}
|
|
419
|
+
colunasEValores.push(new lincones_js_1.ColunaEValor(new lincones_js_1.ReferenciaColuna(coluna), new lincones_js_1.Literal(registro.propriedades[coluna])));
|
|
420
|
+
}
|
|
421
|
+
return colunasEValores;
|
|
422
|
+
}
|
|
423
|
+
gerarComandoCriarTabela() {
|
|
424
|
+
const colunas = [];
|
|
425
|
+
const nomesComputadas = new Set(this.colunasComputadas.map((c) => c.nome));
|
|
426
|
+
for (const propriedade of this.modelo.propriedades) {
|
|
427
|
+
const nome = propriedade.nome.lexema;
|
|
428
|
+
if (nomesComputadas.has(nome)) {
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
const tipo = propriedade.tipo ? this.traduzirTipo(propriedade.tipo) : "TEXTO";
|
|
432
|
+
const chavePrimaria = nome === this.nomePropriedadeChavePrimaria;
|
|
433
|
+
colunas.push(new lincones_js_1.Coluna(nome, tipo, undefined, !chavePrimaria, chavePrimaria, false, chavePrimaria));
|
|
434
|
+
}
|
|
435
|
+
return new lincones_js_1.Criar(-1, this.obterNome(), colunas, true);
|
|
436
|
+
}
|
|
437
|
+
hidratarRegistro(linha) {
|
|
438
|
+
const objeto = new estruturas_1.ObjetoDeleguaClasse(this.modelo);
|
|
439
|
+
for (const propriedade of this.modelo.propriedades) {
|
|
440
|
+
const nome = propriedade.nome.lexema;
|
|
441
|
+
if (nome in linha) {
|
|
442
|
+
objeto.propriedades[nome] = linha[nome];
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return objeto;
|
|
446
|
+
}
|
|
447
|
+
hidratarRegistros(linhas) {
|
|
448
|
+
return linhas.map(linha => this.hidratarRegistro(linha));
|
|
449
|
+
}
|
|
450
|
+
resolverCondicaoPorChavePrimaria(registro) {
|
|
451
|
+
const chaves = this.obterNomesChavesPrimarias();
|
|
452
|
+
// Se houver apenas uma chave primária, usar o formato antigo
|
|
453
|
+
if (chaves.length === 1) {
|
|
454
|
+
const chave = chaves[0];
|
|
455
|
+
const valor = registro.propriedades[chave];
|
|
456
|
+
return new lincones_js_1.Condicao(new lincones_js_1.ReferenciaColuna(chave), 'IGUAL', new lincones_js_1.Literal(valor, typeof valor === 'number' ? "INTEIRO" : "TEXTO"));
|
|
457
|
+
}
|
|
458
|
+
// Para chaves compostas, criar múltiplas condições (serão unidas com AND)
|
|
459
|
+
// Para compatibilidade, retornamos a primeira condição aqui
|
|
460
|
+
// e as demais serão adicionadas pela camada de Colecao
|
|
461
|
+
const chave = chaves[0];
|
|
462
|
+
const valor = registro.propriedades[chave];
|
|
463
|
+
return new lincones_js_1.Condicao(new lincones_js_1.ReferenciaColuna(chave), 'IGUAL', new lincones_js_1.Literal(valor, typeof valor === 'number' ? "INTEIRO" : "TEXTO"));
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
exports.Entidade = Entidade;
|
|
467
|
+
//# sourceMappingURL=entidade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entidade.js","sourceRoot":"","sources":["../../fontes/entidade.ts"],"names":[],"mappings":";;;AAAA,gFAIyD;AACzD,oEAA4D;AAC5D,4DAA8G;AAW9G,qDAAkD;AAElD;;;;GAIG;AACH,MAAa,QAAQ;IAWjB;;;;;OAKG;IACH,YAAY,MAAoC;QAdhD,oCAA+B,GAAa,EAAE,CAAC;QAC/C,YAAO,GAAsB,EAAE,CAAC;QAChC,eAAU,GAAyB,EAAE,CAAC;QACtC,sBAAiB,GAA+B,EAAE,CAAC;QACnD,qBAAgB,GAA8B,EAAE,CAAC;QACjD,iBAAY,GAA0B,EAAE,CAAC;QAUrC,IAAI,MAAM,YAAY,gCAAmB,EAAE,CAAC;YACxC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;QAED,IAAI,MAAM,YAAY,oBAAM,EAAE,CAAC;YAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YACzD,IAAI,CAAC,MAAM,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MAAM,CAAC;IAClB,CAAC;IAED,iBAAiB,CAAC,MAAa;QAC3B,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,gCAAgC,CAAC,QAA6B;QAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAEhD,6DAA6D;QAC7D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,IAAI,sBAAQ,CACf,IAAI,8BAAgB,CAAC,KAAK,CAAC,EAC3B,OAAO,EACP,IAAI,qBAAO,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CACtE,CAAC;QACN,CAAC;QAED,0EAA0E;QAC1E,4DAA4D;QAC5D,uDAAuD;QACvD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,IAAI,sBAAQ,CACf,IAAI,8BAAgB,CAAC,KAAK,CAAC,EAC3B,OAAO,EACP,IAAI,qBAAO,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CACtE,CAAC;IACN,CAAC;CACJ;AA5jBD,4BA4jBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Erro lançado quando uma operação de atualização falha
|
|
3
|
+
* devido a um conflito de concorrência otimista.
|
|
4
|
+
*
|
|
5
|
+
* Indica que a versão do registro foi modificada por outro
|
|
6
|
+
* processo desde a última leitura.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ErroConcorrencia extends Error {
|
|
9
|
+
constructor(mensagem?: string);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=erro-concorrencia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erro-concorrencia.d.ts","sourceRoot":"","sources":["../../../fontes/erros/erro-concorrencia.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;gBAEnC,QAAQ,GAAE,MAAkF;CAKnG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErroConcorrencia = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Erro lançado quando uma operação de atualização falha
|
|
6
|
+
* devido a um conflito de concorrência otimista.
|
|
7
|
+
*
|
|
8
|
+
* Indica que a versão do registro foi modificada por outro
|
|
9
|
+
* processo desde a última leitura.
|
|
10
|
+
*/
|
|
11
|
+
class ErroConcorrencia extends Error {
|
|
12
|
+
constructor(mensagem = 'Conflito de concorrência: o registro foi modificado por outro processo.') {
|
|
13
|
+
super(mensagem);
|
|
14
|
+
this.name = 'ErroConcorrencia';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ErroConcorrencia = ErroConcorrencia;
|
|
18
|
+
//# sourceMappingURL=erro-concorrencia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erro-concorrencia.js","sourceRoot":"","sources":["../../../fontes/erros/erro-concorrencia.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IACvC,YACI,WAAmB,yEAAyE;QAE5F,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACnC,CAAC;CACJ;AAPD,4CAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erro-tabela-nao-encontrada.d.ts","sourceRoot":"","sources":["../../../fontes/erros/erro-tabela-nao-encontrada.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAwB,SAAQ,KAAK;gBAClC,UAAU,EAAE,MAAM;CAIjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErroTabelaNaoEncontrada = void 0;
|
|
4
|
+
class ErroTabelaNaoEncontrada extends Error {
|
|
5
|
+
constructor(nomeTabela) {
|
|
6
|
+
super(`Tabela '${nomeTabela}' não encontrada ou não existe.`);
|
|
7
|
+
this.name = 'ErroTabelaNaoEncontrada';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.ErroTabelaNaoEncontrada = ErroTabelaNaoEncontrada;
|
|
11
|
+
//# sourceMappingURL=erro-tabela-nao-encontrada.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erro-tabela-nao-encontrada.js","sourceRoot":"","sources":["../../../fontes/erros/erro-tabela-nao-encontrada.ts"],"names":[],"mappings":";;;AAAA,MAAa,uBAAwB,SAAQ,KAAK;IAC9C,YAAY,UAAkB;QAC1B,KAAK,CAAC,WAAW,UAAU,iCAAiC,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IAC1C,CAAC;CACJ;AALD,0DAKC"}
|