@cargolift-cdi/types 0.1.161 → 0.1.163
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/entities/integration-entity.entity.d.ts +5 -0
- package/dist/entities/integration-entity.entity.d.ts.map +1 -1
- package/dist/entities/integration-entity.entity.js +10 -1
- package/dist/entities/integration-inbound.entity.d.ts +4 -2
- package/dist/entities/integration-inbound.entity.d.ts.map +1 -1
- package/dist/entities/integration-inbound.entity.js +10 -8
- package/dist/interfaces/entity-metadados.interface.d.ts +18 -0
- package/dist/interfaces/entity-metadados.interface.d.ts.map +1 -0
- package/dist/interfaces/entity-metadados.interface.js +1 -0
- package/dist/interfaces/envelope-message.interface.d.ts +1 -1
- package/dist/interfaces/envelope-message.interface.d.ts.map +1 -1
- package/dist/interfaces/field-access-control.interface.d.ts +41 -0
- package/dist/interfaces/field-access-control.interface.d.ts.map +1 -0
- package/dist/interfaces/field-access-control.interface.js +18 -0
- package/dist/interfaces/schema-validation.interface.d.ts +52 -0
- package/dist/interfaces/schema-validation.interface.d.ts.map +1 -0
- package/dist/interfaces/schema-validation.interface.js +1 -0
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Schema } from "../interfaces/schema-validation.interface.js";
|
|
2
|
+
import { EntityMetadados } from "../interfaces/entity-metadados.interface.js";
|
|
1
3
|
export declare class IntegrationEntity {
|
|
2
4
|
id: string;
|
|
3
5
|
/** Entidade (e.g., 'driver') */
|
|
@@ -8,6 +10,9 @@ export declare class IntegrationEntity {
|
|
|
8
10
|
active: boolean;
|
|
9
11
|
/** Descrição opcional amigável ao usuário */
|
|
10
12
|
description?: string | null;
|
|
13
|
+
/** Schema JSON para validação da entidade */
|
|
14
|
+
schema?: Schema[] | null;
|
|
15
|
+
metadados?: EntityMetadados | null;
|
|
11
16
|
/**
|
|
12
17
|
* Modo de roteamento da entidade
|
|
13
18
|
* - 'direct': Roteia diretamente para entidades de destino sem passar pelo ODS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-entity.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-entity.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integration-entity.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-entity.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E,qBAMa,iBAAiB;IAE5B,EAAE,EAAG,MAAM,CAAC;IAEZ,gCAAgC;IAEhC,MAAM,EAAG,MAAM,CAAC;IAEhB,oHAAoH;IAEpH,OAAO,EAAG,MAAM,CAAC;IAEjB,8BAA8B;IAE9B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,6CAA6C;IAE7C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAGzB,SAAS,CAAC,EAAE,eAAe,GAAE,IAAI,CAAC;IAElC;;;;;OAKG;IAEH,WAAW,EAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;IAEvC,oDAAoD;IAKpD,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAClB"}
|
|
@@ -26,6 +26,9 @@ let IntegrationEntity = class IntegrationEntity {
|
|
|
26
26
|
active;
|
|
27
27
|
/** Descrição opcional amigável ao usuário */
|
|
28
28
|
description;
|
|
29
|
+
/** Schema JSON para validação da entidade */
|
|
30
|
+
schema;
|
|
31
|
+
metadados;
|
|
29
32
|
/**
|
|
30
33
|
* Modo de roteamento da entidade
|
|
31
34
|
* - 'direct': Roteia diretamente para entidades de destino sem passar pelo ODS
|
|
@@ -55,7 +58,13 @@ __decorate([
|
|
|
55
58
|
Column({ type: "varchar", length: 500, nullable: true })
|
|
56
59
|
], IntegrationEntity.prototype, "description", void 0);
|
|
57
60
|
__decorate([
|
|
58
|
-
Column({ type: "
|
|
61
|
+
Column({ type: "jsonb", nullable: true })
|
|
62
|
+
], IntegrationEntity.prototype, "schema", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Column({ type: "jsonb", nullable: true })
|
|
65
|
+
], IntegrationEntity.prototype, "metadados", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
Column({ name: "routing_mode", type: "varchar", length: 20 })
|
|
59
68
|
], IntegrationEntity.prototype, "routingMode", void 0);
|
|
60
69
|
__decorate([
|
|
61
70
|
CreateDateColumn({ name: "created_at", type: "timestamptz" })
|
|
@@ -25,13 +25,15 @@ export declare class IntegrationInbound {
|
|
|
25
25
|
active: boolean;
|
|
26
26
|
/** Descrição opcional amigável ao usuário */
|
|
27
27
|
description?: string | null;
|
|
28
|
-
/** Condições de definição para entidades (entity) baseadas no payload
|
|
28
|
+
/** Condições de definição para entidades (entity) baseadas no payload canônico (transformado).
|
|
29
|
+
* É aplicado dentro do ESB
|
|
29
30
|
* Sobrepõe a entidade definida no campo 'entity' para roteamento condicional baseado no conteúdo do payload.
|
|
30
31
|
* Ex: Uma integração de pessoa física (people) quando no payload tiver um campo "type" com valor "driver", então a entidade será 'driver' ao invés de 'people'
|
|
31
32
|
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a entidade a ser processada depende do conteúdo do payload.
|
|
32
33
|
*/
|
|
33
34
|
routingEntity?: IntegrationInboundRouting[];
|
|
34
|
-
/** Condições de definição para ações (action) baseadas no payload
|
|
35
|
+
/** Condições de definição para ações (action) baseadas no payload canônico (transformado).
|
|
36
|
+
* É aplicado dentro do ESB
|
|
35
37
|
* Sobrepõe a ação definida no campo 'action' para roteamento condicional baseado no conteúdo do payload.
|
|
36
38
|
* Ex: Se o payload tiver um campo "operation" com valor "update", então a ação será 'update' ao invés de 'create', mesmo que o método HTTP seja 'POST'.
|
|
37
39
|
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a ação a ser executada depende do conteúdo do payload.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration-inbound.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-inbound.entity.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;GAGG;AACH,qBAMa,kBAAkB;IAE7B,EAAE,EAAG,MAAM,CAAC;IAEZ,mDAAmD;IAEnD,KAAK,EAAG,MAAM,CAAC;IAEf,qFAAqF;IAErF,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;OAKG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB,0EAA0E;IAE1E,MAAM,EAAG,kBAAkB,CAAC;IAE5B,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,0BAA0B;IAE1B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B
|
|
1
|
+
{"version":3,"file":"integration-inbound.entity.d.ts","sourceRoot":"","sources":["../../src/entities/integration-inbound.entity.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;GAGG;AACH,qBAMa,kBAAkB;IAE7B,EAAE,EAAG,MAAM,CAAC;IAEZ,mDAAmD;IAEnD,KAAK,EAAG,MAAM,CAAC;IAEf,qFAAqF;IAErF,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;OAKG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB,0EAA0E;IAE1E,MAAM,EAAG,kBAAkB,CAAC;IAE5B,gHAAgH;IAEhH,OAAO,EAAG,MAAM,CAAC;IAEjB,0BAA0B;IAE1B,MAAM,EAAG,OAAO,CAAC;IAEjB,6CAA6C;IAE7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IAEH,aAAa,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAE5C;;;;;OAKG;IAEH,aAAa,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAG5C,wGAAwG;IAExG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAExC,yFAAyF;IAEzF,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,8FAA8F;IAE9F,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAInC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAIxB,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzC;;;;;OAKG;IAEH,mBAAmB,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;IAIlE,SAAS,EAAG,IAAI,CAAC;IAGjB,SAAS,EAAG,IAAI,CAAC;CAClB"}
|
|
@@ -45,13 +45,15 @@ let IntegrationInbound = class IntegrationInbound {
|
|
|
45
45
|
active;
|
|
46
46
|
/** Descrição opcional amigável ao usuário */
|
|
47
47
|
description;
|
|
48
|
-
/** Condições de definição para entidades (entity) baseadas no payload
|
|
48
|
+
/** Condições de definição para entidades (entity) baseadas no payload canônico (transformado).
|
|
49
|
+
* É aplicado dentro do ESB
|
|
49
50
|
* Sobrepõe a entidade definida no campo 'entity' para roteamento condicional baseado no conteúdo do payload.
|
|
50
51
|
* Ex: Uma integração de pessoa física (people) quando no payload tiver um campo "type" com valor "driver", então a entidade será 'driver' ao invés de 'people'
|
|
51
52
|
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a entidade a ser processada depende do conteúdo do payload.
|
|
52
53
|
*/
|
|
53
54
|
routingEntity;
|
|
54
|
-
/** Condições de definição para ações (action) baseadas no payload
|
|
55
|
+
/** Condições de definição para ações (action) baseadas no payload canônico (transformado).
|
|
56
|
+
* É aplicado dentro do ESB
|
|
55
57
|
* Sobrepõe a ação definida no campo 'action' para roteamento condicional baseado no conteúdo do payload.
|
|
56
58
|
* Ex: Se o payload tiver um campo "operation" com valor "update", então a ação será 'update' ao invés de 'create', mesmo que o método HTTP seja 'POST'.
|
|
57
59
|
* Útil para casos onde o mesmo endpoint de integração recebe chamadas com a mesma combinação de método HTTP e entidade, mas a ação a ser executada depende do conteúdo do payload.
|
|
@@ -104,10 +106,10 @@ __decorate([
|
|
|
104
106
|
Column({ type: "varchar", length: 500, nullable: true })
|
|
105
107
|
], IntegrationInbound.prototype, "description", void 0);
|
|
106
108
|
__decorate([
|
|
107
|
-
Column({ type: "jsonb", nullable: true })
|
|
109
|
+
Column({ name: "routing_entity", type: "jsonb", nullable: true })
|
|
108
110
|
], IntegrationInbound.prototype, "routingEntity", void 0);
|
|
109
111
|
__decorate([
|
|
110
|
-
Column({ type: "jsonb", nullable: true })
|
|
112
|
+
Column({ name: "routing_action", type: "jsonb", nullable: true })
|
|
111
113
|
], IntegrationInbound.prototype, "routingAction", void 0);
|
|
112
114
|
__decorate([
|
|
113
115
|
Column({ type: "jsonb", nullable: true })
|
|
@@ -119,16 +121,16 @@ __decorate([
|
|
|
119
121
|
Column({ type: "jsonb", nullable: true })
|
|
120
122
|
], IntegrationInbound.prototype, "rules", void 0);
|
|
121
123
|
__decorate([
|
|
122
|
-
Column({ type: "text", nullable: true })
|
|
124
|
+
Column({ name: "ref_extraction", type: "text", nullable: true })
|
|
123
125
|
], IntegrationInbound.prototype, "refExtraction", void 0);
|
|
124
126
|
__decorate([
|
|
125
|
-
Column({ type: "varchar", nullable: true })
|
|
127
|
+
Column({ name: "ref_type", type: "varchar", nullable: true })
|
|
126
128
|
], IntegrationInbound.prototype, "refType", void 0);
|
|
127
129
|
__decorate([
|
|
128
|
-
Column({ type: "text", nullable: true })
|
|
130
|
+
Column({ name: "additional_refs_extraction", type: "text", nullable: true })
|
|
129
131
|
], IntegrationInbound.prototype, "additionalRefsExtraction", void 0);
|
|
130
132
|
__decorate([
|
|
131
|
-
Column({ type: "varchar", length: 20, nullable: true })
|
|
133
|
+
Column({ name: "override_routing_mode", type: "varchar", length: 20, nullable: true })
|
|
132
134
|
], IntegrationInbound.prototype, "overrideRoutingMode", void 0);
|
|
133
135
|
__decorate([
|
|
134
136
|
CreateDateColumn({ name: "created_at", type: "timestamptz" })
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PermissionRules } from "./field-access-control.interface.js";
|
|
2
|
+
import { Schema } from "./schema-validation.interface.js";
|
|
3
|
+
/**
|
|
4
|
+
* Define propriedades de metadados para uma entidade e seus campos.
|
|
5
|
+
*/
|
|
6
|
+
export interface EntityMetadados {
|
|
7
|
+
globalPermissions?: PermissionRules[];
|
|
8
|
+
fields?: FieldMetadados[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Define propriedades de metadados para um campo específico.
|
|
12
|
+
*/
|
|
13
|
+
export interface FieldMetadados {
|
|
14
|
+
field: string;
|
|
15
|
+
schema?: Schema;
|
|
16
|
+
permissions?: PermissionRules[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=entity-metadados.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-metadados.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/entity-metadados.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D;;EAEE;AACF,MAAM,WAAW,eAAe;IAC5B,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope-message.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/envelope-message.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG7E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,
|
|
1
|
+
{"version":3,"file":"envelope-message.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/envelope-message.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG7E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACvC,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACpC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Condition } from "@cargolift-cdi/types";
|
|
2
|
+
type RoleType = "agent" | "user" | "group";
|
|
3
|
+
/**
|
|
4
|
+
* Interfaces para controle de acesso
|
|
5
|
+
* Serve tanto para a criação de novos registros como para controle de acesso por campo dependendo da operação
|
|
6
|
+
* Ex 1: Apenas usuários com permissão de criação podem criar novos registros
|
|
7
|
+
* Ex 2: Durante a atualização de um registro, o campo "salario" só pode ser atualizado se o usuário tiver permissão de update neste campo
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Objeto de permissões padrão que nega todas as ações.
|
|
11
|
+
* Pode ser usado como base para criar regras específicas, garantindo que por padrão nenhuma permissão seja concedida.
|
|
12
|
+
*/
|
|
13
|
+
declare const permissionsDeny: Permissions;
|
|
14
|
+
/**
|
|
15
|
+
* Interface que define as permissões para um campo específico ou para toda a entidade.
|
|
16
|
+
*/
|
|
17
|
+
interface Permissions {
|
|
18
|
+
create?: boolean;
|
|
19
|
+
update?: boolean;
|
|
20
|
+
delete?: boolean;
|
|
21
|
+
clean?: boolean;
|
|
22
|
+
view?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A interface Rule define as permissões associadas a um papel/role específico,
|
|
26
|
+
* e pode incluir condições para aplicar essas permissões apenas em determinados contextos ou para determinados registros.
|
|
27
|
+
*/
|
|
28
|
+
interface Rule extends Permissions {
|
|
29
|
+
condition?: Condition[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A interface PermissionRules associa um conjunto de regras de permissão a um papel/role específico,
|
|
33
|
+
* permitindo definir diferentes níveis de acesso para diferentes tipos de usuários ou grupos.
|
|
34
|
+
*/
|
|
35
|
+
interface PermissionRules {
|
|
36
|
+
roleType: RoleType;
|
|
37
|
+
role: string[];
|
|
38
|
+
rules: Rule[];
|
|
39
|
+
}
|
|
40
|
+
export type { RoleType, Permissions, permissionsDeny, Rule, PermissionRules };
|
|
41
|
+
//# sourceMappingURL=field-access-control.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-access-control.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/field-access-control.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAG3C;;;;;EAKE;AAGF;;;GAGG;AACH,QAAA,MAAM,eAAe,EAAE,WAMtB,CAAC;AAEF;;GAEG;AACH,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IAIjB,MAAM,CAAC,EAAE,OAAO,CAAC;IAIjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD;;;GAGG;AACH,UAAU,IAAK,SAAQ,WAAW;IAChC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,UAAU,eAAe;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAID,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interfaces para controle de acesso
|
|
3
|
+
* Serve tanto para a criação de novos registros como para controle de acesso por campo dependendo da operação
|
|
4
|
+
* Ex 1: Apenas usuários com permissão de criação podem criar novos registros
|
|
5
|
+
* Ex 2: Durante a atualização de um registro, o campo "salario" só pode ser atualizado se o usuário tiver permissão de update neste campo
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Objeto de permissões padrão que nega todas as ações.
|
|
9
|
+
* Pode ser usado como base para criar regras específicas, garantindo que por padrão nenhuma permissão seja concedida.
|
|
10
|
+
*/
|
|
11
|
+
const permissionsDeny = {
|
|
12
|
+
create: false,
|
|
13
|
+
update: false,
|
|
14
|
+
delete: false,
|
|
15
|
+
clean: false,
|
|
16
|
+
view: false,
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type SchemaFieldType = "string" | "number" | "boolean" | "date" | "object" | "array" | "email";
|
|
2
|
+
/**
|
|
3
|
+
* Interface base que define o esquema de validação.
|
|
4
|
+
*/
|
|
5
|
+
export interface Schema {
|
|
6
|
+
type?: SchemaFieldType;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
length?: {
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
};
|
|
12
|
+
range?: {
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
};
|
|
16
|
+
minItems?: number;
|
|
17
|
+
maxItems?: number;
|
|
18
|
+
allowedValues?: string[] | number[];
|
|
19
|
+
allowNull?: boolean;
|
|
20
|
+
ignoreCase?: boolean;
|
|
21
|
+
pattern?: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Exemplo:
|
|
26
|
+
* {
|
|
27
|
+
* "campo_a": { "type": "string", "required": true, "length": { "min": 3, "max": 50 } },
|
|
28
|
+
* "campo_b": { "type": "number", "required": false, "range": { "min": 0, "max": 100 } },
|
|
29
|
+
* "campo_c": { "type": "string", "required": true, "allowedValues": ["opcao1", "opcao2"] }
|
|
30
|
+
* "campo_d/child_a": { "type": "string", "required": true, "allowedValues": ["opcao1", "opcao2"] }
|
|
31
|
+
* "campo_d/child_b": { "type": "string", "required": false }
|
|
32
|
+
* }
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* A interface SchemaValidation é um objeto onde cada chave é o caminho para um campo a ser validado
|
|
36
|
+
* (pode ser um campo simples ou um caminho JSON Pointer para campos aninhados)
|
|
37
|
+
* e o valor é um objeto do tipo Schema que define as regras de validação para aquele campo específico.
|
|
38
|
+
*/
|
|
39
|
+
export interface SchemaValidation {
|
|
40
|
+
[fieldPath: string]: Schema;
|
|
41
|
+
}
|
|
42
|
+
export interface SchemaValidationResult {
|
|
43
|
+
success: boolean;
|
|
44
|
+
errors: {
|
|
45
|
+
field: string;
|
|
46
|
+
value: any;
|
|
47
|
+
error: string;
|
|
48
|
+
schema?: Schema;
|
|
49
|
+
}[];
|
|
50
|
+
errorsList: string[];
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=schema-validation.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-validation.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/schema-validation.interface.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,MAAM;IACnB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAA;IACD,KAAK,CAAC,EAAE;QACJ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAA;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAID,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,GAAG,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IAEJ,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|