tychat-contracts 1.6.53 → 1.6.56
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/legal-terms/default-legal-term-document.d.ts +23 -0
- package/dist/legal-terms/default-legal-term-document.d.ts.map +1 -0
- package/dist/legal-terms/default-legal-term-document.js +170 -0
- package/dist/legal-terms/index.d.ts +4 -0
- package/dist/legal-terms/index.d.ts.map +1 -1
- package/dist/legal-terms/index.js +4 -0
- package/dist/legal-terms/legal-term-body-format.d.ts +1 -1
- package/dist/legal-terms/legal-term-body-format.d.ts.map +1 -1
- package/dist/legal-terms/legal-term-body-format.js +1 -1
- package/dist/legal-terms/legal-term-document-compile.d.ts +3 -0
- package/dist/legal-terms/legal-term-document-compile.d.ts.map +1 -0
- package/dist/legal-terms/legal-term-document-compile.js +166 -0
- package/dist/legal-terms/legal-term-document-compile.spec.d.ts +2 -0
- package/dist/legal-terms/legal-term-document-compile.spec.d.ts.map +1 -0
- package/dist/legal-terms/legal-term-document-compile.spec.js +49 -0
- package/dist/legal-terms/legal-term-document.dto.d.ts +21 -0
- package/dist/legal-terms/legal-term-document.dto.d.ts.map +1 -0
- package/dist/legal-terms/legal-term-document.dto.js +127 -0
- package/dist/legal-terms/legal-term-document.types.d.ts +30 -0
- package/dist/legal-terms/legal-term-document.types.d.ts.map +1 -0
- package/dist/legal-terms/legal-term-document.types.js +14 -0
- package/dist/legal-terms/legal-term-preview.dto.d.ts +2 -0
- package/dist/legal-terms/legal-term-preview.dto.d.ts.map +1 -1
- package/dist/legal-terms/legal-term-preview.dto.js +14 -1
- package/dist/legal-terms/legal-term-template.dto.d.ts +4 -1
- package/dist/legal-terms/legal-term-template.dto.d.ts.map +1 -1
- package/dist/legal-terms/legal-term-template.dto.js +25 -6
- package/package.json +1 -1
- package/src/legal-terms/default-legal-term-document.ts +170 -0
- package/src/legal-terms/index.ts +4 -0
- package/src/legal-terms/legal-term-body-format.ts +1 -1
- package/src/legal-terms/legal-term-document-compile.spec.ts +53 -0
- package/src/legal-terms/legal-term-document-compile.ts +192 -0
- package/src/legal-terms/legal-term-document.dto.ts +100 -0
- package/src/legal-terms/legal-term-document.types.ts +42 -0
- package/src/legal-terms/legal-term-preview.dto.ts +13 -1
- package/src/legal-terms/legal-term-template.dto.ts +23 -7
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import {
|
|
4
|
+
IsArray,
|
|
5
|
+
IsIn,
|
|
6
|
+
IsInt,
|
|
7
|
+
IsOptional,
|
|
8
|
+
IsString,
|
|
9
|
+
Max,
|
|
10
|
+
MaxLength,
|
|
11
|
+
Min,
|
|
12
|
+
MinLength,
|
|
13
|
+
ValidateNested,
|
|
14
|
+
} from 'class-validator';
|
|
15
|
+
import {
|
|
16
|
+
LEGAL_TERM_BLOCK_TYPES,
|
|
17
|
+
LEGAL_TERM_DOCUMENT_VERSION,
|
|
18
|
+
type LegalTermBlockType,
|
|
19
|
+
type LegalTermDocument,
|
|
20
|
+
type LegalTermSectionLevel,
|
|
21
|
+
} from './legal-term-document.types';
|
|
22
|
+
|
|
23
|
+
export class LegalTermDocumentBlockDto {
|
|
24
|
+
@ApiProperty({ description: 'Identificador estável do bloco (UUID ou id preset CFM)' })
|
|
25
|
+
@IsString()
|
|
26
|
+
@MinLength(1)
|
|
27
|
+
@MaxLength(64)
|
|
28
|
+
id: string;
|
|
29
|
+
|
|
30
|
+
@ApiProperty({ enum: LEGAL_TERM_BLOCK_TYPES })
|
|
31
|
+
@IsIn([...LEGAL_TERM_BLOCK_TYPES])
|
|
32
|
+
type: LegalTermBlockType;
|
|
33
|
+
|
|
34
|
+
@ApiPropertyOptional({ enum: [1, 2, 3] })
|
|
35
|
+
@IsOptional()
|
|
36
|
+
@IsInt()
|
|
37
|
+
@Min(1)
|
|
38
|
+
@Max(3)
|
|
39
|
+
level?: LegalTermSectionLevel;
|
|
40
|
+
|
|
41
|
+
@ApiPropertyOptional({ maxLength: 500 })
|
|
42
|
+
@IsOptional()
|
|
43
|
+
@IsString()
|
|
44
|
+
@MaxLength(500)
|
|
45
|
+
title?: string;
|
|
46
|
+
|
|
47
|
+
@ApiPropertyOptional({ maxLength: 50_000 })
|
|
48
|
+
@IsOptional()
|
|
49
|
+
@IsString()
|
|
50
|
+
@MaxLength(50_000)
|
|
51
|
+
body?: string;
|
|
52
|
+
|
|
53
|
+
@ApiPropertyOptional({ enum: ['left', 'center', 'right'] })
|
|
54
|
+
@IsOptional()
|
|
55
|
+
@IsIn(['left', 'center', 'right'])
|
|
56
|
+
titleAlign?: 'left' | 'center' | 'right';
|
|
57
|
+
|
|
58
|
+
@ApiPropertyOptional()
|
|
59
|
+
@IsOptional()
|
|
60
|
+
titleBold?: boolean;
|
|
61
|
+
|
|
62
|
+
@ApiPropertyOptional()
|
|
63
|
+
@IsOptional()
|
|
64
|
+
titleItalic?: boolean;
|
|
65
|
+
|
|
66
|
+
@ApiPropertyOptional()
|
|
67
|
+
@IsOptional()
|
|
68
|
+
titleUnderline?: boolean;
|
|
69
|
+
|
|
70
|
+
@ApiPropertyOptional({ enum: ['left', 'center', 'right'] })
|
|
71
|
+
@IsOptional()
|
|
72
|
+
@IsIn(['left', 'center', 'right'])
|
|
73
|
+
bodyAlign?: 'left' | 'center' | 'right';
|
|
74
|
+
|
|
75
|
+
@ApiPropertyOptional()
|
|
76
|
+
@IsOptional()
|
|
77
|
+
bodyBold?: boolean;
|
|
78
|
+
|
|
79
|
+
@ApiPropertyOptional()
|
|
80
|
+
@IsOptional()
|
|
81
|
+
bodyItalic?: boolean;
|
|
82
|
+
|
|
83
|
+
@ApiPropertyOptional()
|
|
84
|
+
@IsOptional()
|
|
85
|
+
bodyUnderline?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export class LegalTermDocumentDto implements LegalTermDocument {
|
|
89
|
+
@ApiProperty({ enum: [LEGAL_TERM_DOCUMENT_VERSION] })
|
|
90
|
+
@IsInt()
|
|
91
|
+
@Min(1)
|
|
92
|
+
@Max(1)
|
|
93
|
+
version: 1;
|
|
94
|
+
|
|
95
|
+
@ApiProperty({ type: [LegalTermDocumentBlockDto] })
|
|
96
|
+
@IsArray()
|
|
97
|
+
@ValidateNested({ each: true })
|
|
98
|
+
@Type(() => LegalTermDocumentBlockDto)
|
|
99
|
+
blocks: LegalTermDocumentBlockDto[];
|
|
100
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Blocos do editor visual do termo jurídico (sem HTML do usuário). */
|
|
2
|
+
export const LEGAL_TERM_BLOCK_TYPES = [
|
|
3
|
+
'document_title',
|
|
4
|
+
'legal_reference',
|
|
5
|
+
'section',
|
|
6
|
+
'paragraph',
|
|
7
|
+
'table_side_effects',
|
|
8
|
+
'signature_footer',
|
|
9
|
+
] as const;
|
|
10
|
+
|
|
11
|
+
export type LegalTermBlockType = (typeof LEGAL_TERM_BLOCK_TYPES)[number];
|
|
12
|
+
|
|
13
|
+
export type LegalTermSectionLevel = 1 | 2 | 3;
|
|
14
|
+
|
|
15
|
+
export const LEGAL_TERM_TEXT_ALIGNS = ['left', 'center', 'right'] as const;
|
|
16
|
+
export type LegalTermTextAlign = (typeof LEGAL_TERM_TEXT_ALIGNS)[number];
|
|
17
|
+
|
|
18
|
+
export type LegalTermDocumentBlock = {
|
|
19
|
+
id: string;
|
|
20
|
+
type: LegalTermBlockType;
|
|
21
|
+
/** Nível de numeração para `section` (1 → 1., 2 → 1.1., 3 → 1.1.1.). */
|
|
22
|
+
level?: LegalTermSectionLevel;
|
|
23
|
+
/** Título visível (seção) ou ignorado em tipos sem título. */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Texto com placeholders `{{ token }}`; vazio em blocos só estruturais. */
|
|
26
|
+
body?: string;
|
|
27
|
+
titleAlign?: LegalTermTextAlign;
|
|
28
|
+
titleBold?: boolean;
|
|
29
|
+
titleItalic?: boolean;
|
|
30
|
+
titleUnderline?: boolean;
|
|
31
|
+
bodyAlign?: LegalTermTextAlign;
|
|
32
|
+
bodyBold?: boolean;
|
|
33
|
+
bodyItalic?: boolean;
|
|
34
|
+
bodyUnderline?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type LegalTermDocument = {
|
|
38
|
+
version: 1;
|
|
39
|
+
blocks: LegalTermDocumentBlock[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const LEGAL_TERM_DOCUMENT_VERSION = 1 as const;
|
|
@@ -11,8 +11,11 @@ import {
|
|
|
11
11
|
MaxLength,
|
|
12
12
|
MinLength,
|
|
13
13
|
ValidateIf,
|
|
14
|
+
ValidateNested,
|
|
14
15
|
} from 'class-validator';
|
|
16
|
+
import { Type } from 'class-transformer';
|
|
15
17
|
import { LEGAL_TERM_BODY_FORMATS, type LegalTermBodyFormat } from './legal-term-body-format';
|
|
18
|
+
import { LegalTermDocumentDto } from './legal-term-document.dto';
|
|
16
19
|
|
|
17
20
|
const LEGAL_TERM_SIGNATURE_METHODS = ['digital', 'printed'] as const;
|
|
18
21
|
export type LegalTermSignatureMethodDto = (typeof LEGAL_TERM_SIGNATURE_METHODS)[number];
|
|
@@ -20,7 +23,16 @@ export type LegalTermSignatureMethodDto = (typeof LEGAL_TERM_SIGNATURE_METHODS)[
|
|
|
20
23
|
/** Valores explícitos para substituição na pré-visualização (sem inferência heurística). */
|
|
21
24
|
export class LegalTermPreviewRequestDto {
|
|
22
25
|
@ApiPropertyOptional({
|
|
23
|
-
description: '
|
|
26
|
+
description: 'Rascunho do documento visual; se omitido, usa o modelo salvo',
|
|
27
|
+
type: LegalTermDocumentDto,
|
|
28
|
+
})
|
|
29
|
+
@IsOptional()
|
|
30
|
+
@ValidateNested()
|
|
31
|
+
@Type(() => LegalTermDocumentDto)
|
|
32
|
+
body_document?: LegalTermDocumentDto;
|
|
33
|
+
|
|
34
|
+
@ApiPropertyOptional({
|
|
35
|
+
description: 'HTML legado (rascunho); ignorado se body_document for enviado',
|
|
24
36
|
maxLength: 500_000,
|
|
25
37
|
})
|
|
26
38
|
@IsOptional()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
2
3
|
import {
|
|
3
4
|
IsArray,
|
|
4
5
|
IsIn,
|
|
@@ -7,24 +8,32 @@ import {
|
|
|
7
8
|
IsUUID,
|
|
8
9
|
MaxLength,
|
|
9
10
|
MinLength,
|
|
11
|
+
ValidateNested,
|
|
10
12
|
} from 'class-validator';
|
|
11
13
|
import { LEGAL_TERM_BODY_FORMATS, type LegalTermBodyFormat } from './legal-term-body-format';
|
|
14
|
+
import { LegalTermDocumentDto } from './legal-term-document.dto';
|
|
12
15
|
|
|
13
16
|
export class LegalTermTemplateDto {
|
|
14
17
|
@ApiProperty({ format: 'uuid' })
|
|
15
18
|
id: string;
|
|
16
19
|
|
|
17
20
|
@ApiProperty({
|
|
18
|
-
description: '
|
|
21
|
+
description: 'HTML compilado a partir de body_document (cache para PDF)',
|
|
19
22
|
})
|
|
20
23
|
body_html: string;
|
|
21
24
|
|
|
22
25
|
@ApiProperty({
|
|
23
26
|
enum: LEGAL_TERM_BODY_FORMATS,
|
|
24
|
-
description: '
|
|
27
|
+
description: 'structured: editor visual; demais formatos legados',
|
|
25
28
|
})
|
|
26
29
|
body_format: LegalTermBodyFormat;
|
|
27
30
|
|
|
31
|
+
@ApiProperty({
|
|
32
|
+
description: 'Documento estruturado do editor visual',
|
|
33
|
+
type: LegalTermDocumentDto,
|
|
34
|
+
})
|
|
35
|
+
body_document: LegalTermDocumentDto;
|
|
36
|
+
|
|
28
37
|
@ApiProperty({
|
|
29
38
|
type: [String],
|
|
30
39
|
format: 'uuid',
|
|
@@ -41,18 +50,25 @@ export class LegalTermTemplateDto {
|
|
|
41
50
|
|
|
42
51
|
export class UpsertLegalTermTemplateDto {
|
|
43
52
|
@ApiProperty({
|
|
44
|
-
description: '
|
|
45
|
-
|
|
53
|
+
description: 'Documento do editor visual (obrigatório no fluxo structured)',
|
|
54
|
+
type: LegalTermDocumentDto,
|
|
55
|
+
})
|
|
56
|
+
@ValidateNested()
|
|
57
|
+
@Type(() => LegalTermDocumentDto)
|
|
58
|
+
body_document: LegalTermDocumentDto;
|
|
59
|
+
|
|
60
|
+
@ApiPropertyOptional({
|
|
61
|
+
description: 'Ignorado no fluxo structured; servidor compila body_html',
|
|
46
62
|
maxLength: 500_000,
|
|
47
63
|
})
|
|
64
|
+
@IsOptional()
|
|
48
65
|
@IsString()
|
|
49
|
-
@MinLength(1)
|
|
50
66
|
@MaxLength(500_000)
|
|
51
|
-
body_html
|
|
67
|
+
body_html?: string;
|
|
52
68
|
|
|
53
69
|
@ApiPropertyOptional({
|
|
54
70
|
enum: LEGAL_TERM_BODY_FORMATS,
|
|
55
|
-
description: 'Padrão:
|
|
71
|
+
description: 'Padrão: structured',
|
|
56
72
|
})
|
|
57
73
|
@IsOptional()
|
|
58
74
|
@IsIn(LEGAL_TERM_BODY_FORMATS)
|