@cargolift-cdi/types 0.1.162 → 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.js +6 -6
- 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/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" })
|
|
@@ -106,10 +106,10 @@ __decorate([
|
|
|
106
106
|
Column({ type: "varchar", length: 500, nullable: true })
|
|
107
107
|
], IntegrationInbound.prototype, "description", void 0);
|
|
108
108
|
__decorate([
|
|
109
|
-
Column({ type: "jsonb", nullable: true })
|
|
109
|
+
Column({ name: "routing_entity", type: "jsonb", nullable: true })
|
|
110
110
|
], IntegrationInbound.prototype, "routingEntity", void 0);
|
|
111
111
|
__decorate([
|
|
112
|
-
Column({ type: "jsonb", nullable: true })
|
|
112
|
+
Column({ name: "routing_action", type: "jsonb", nullable: true })
|
|
113
113
|
], IntegrationInbound.prototype, "routingAction", void 0);
|
|
114
114
|
__decorate([
|
|
115
115
|
Column({ type: "jsonb", nullable: true })
|
|
@@ -121,16 +121,16 @@ __decorate([
|
|
|
121
121
|
Column({ type: "jsonb", nullable: true })
|
|
122
122
|
], IntegrationInbound.prototype, "rules", void 0);
|
|
123
123
|
__decorate([
|
|
124
|
-
Column({ type: "text", nullable: true })
|
|
124
|
+
Column({ name: "ref_extraction", type: "text", nullable: true })
|
|
125
125
|
], IntegrationInbound.prototype, "refExtraction", void 0);
|
|
126
126
|
__decorate([
|
|
127
|
-
Column({ type: "varchar", nullable: true })
|
|
127
|
+
Column({ name: "ref_type", type: "varchar", nullable: true })
|
|
128
128
|
], IntegrationInbound.prototype, "refType", void 0);
|
|
129
129
|
__decorate([
|
|
130
|
-
Column({ type: "text", nullable: true })
|
|
130
|
+
Column({ name: "additional_refs_extraction", type: "text", nullable: true })
|
|
131
131
|
], IntegrationInbound.prototype, "additionalRefsExtraction", void 0);
|
|
132
132
|
__decorate([
|
|
133
|
-
Column({ type: "varchar", length: 20, nullable: true })
|
|
133
|
+
Column({ name: "override_routing_mode", type: "varchar", length: 20, nullable: true })
|
|
134
134
|
], IntegrationInbound.prototype, "overrideRoutingMode", void 0);
|
|
135
135
|
__decorate([
|
|
136
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 {};
|
|
@@ -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 {};
|