@fiado/type-kit 3.524.0 → 3.525.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/_test_/unit/pdfRender/pdfRenderDtos.test.ts +10 -0
- package/bin/pdfRender/dtos/DocumentUrlResponse.d.ts +12 -0
- package/bin/pdfRender/dtos/DocumentUrlResponse.js +7 -0
- package/bin/pdfRender/dtos/GeneratePdfRequest.d.ts +2 -0
- package/bin/pdfRender/dtos/GeneratePdfRequest.js +5 -0
- package/bin/pdfRender/dtos/MergePdfsRequest.d.ts +2 -0
- package/bin/pdfRender/dtos/MergePdfsRequest.js +5 -0
- package/bin/pdfRender/dtos/PdfDocumentResponse.d.ts +12 -1
- package/bin/pdfRender/dtos/PdfDocumentResponse.js +4 -0
- package/bin/pdfRender/dtos/RenderDocumentRequest.d.ts +2 -0
- package/bin/pdfRender/dtos/RenderDocumentRequest.js +5 -0
- package/bin/pdfRender/index.d.ts +1 -0
- package/bin/pdfRender/index.js +1 -0
- package/package.json +1 -1
- package/src/pdfRender/dtos/DocumentUrlResponse.ts +12 -0
- package/src/pdfRender/dtos/GeneratePdfRequest.ts +5 -1
- package/src/pdfRender/dtos/MergePdfsRequest.ts +5 -1
- package/src/pdfRender/dtos/PdfDocumentResponse.ts +12 -1
- package/src/pdfRender/dtos/RenderDocumentRequest.ts +5 -1
- package/src/pdfRender/index.ts +1 -0
|
@@ -64,3 +64,13 @@ describe('pdfRender admin DTOs', () => {
|
|
|
64
64
|
expect(await errorsOf(TemplateLocationRequest, {})).toEqual(['enterprise']);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
+
|
|
68
|
+
describe('pdfRender includeContent', () => {
|
|
69
|
+
it('is optional and must be boolean on the three generation requests', async () => {
|
|
70
|
+
const template = { enterprise: 'FIADOSA', documentType: 'X' };
|
|
71
|
+
expect(await errorsOf(RenderDocumentRequest, { template, data: {}, includeContent: true })).toEqual([]);
|
|
72
|
+
expect(await errorsOf(RenderDocumentRequest, { template, data: {}, includeContent: 'yes' })).toEqual(['includeContent']);
|
|
73
|
+
expect(await errorsOf(GeneratePdfRequest, { html: '<p/>', includeContent: false })).toEqual([]);
|
|
74
|
+
expect(await errorsOf(MergePdfsRequest, { pdfs: ['JVBERi0='], includeContent: 1 })).toEqual(['includeContent']);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Nueva URL firmada para un documento ya guardado. */
|
|
2
|
+
export declare class DocumentUrlResponse {
|
|
3
|
+
documentId: string;
|
|
4
|
+
url: string;
|
|
5
|
+
/** ISO-8601. */
|
|
6
|
+
expiresAt: string;
|
|
7
|
+
sha256: string;
|
|
8
|
+
pages: number;
|
|
9
|
+
bytes: number;
|
|
10
|
+
/** ISO-8601 de la generación. */
|
|
11
|
+
createdAt: string;
|
|
12
|
+
}
|
|
@@ -20,3 +20,8 @@ __decorate([
|
|
|
20
20
|
(0, class_validator_1.IsNotEmpty)(),
|
|
21
21
|
__metadata("design:type", String)
|
|
22
22
|
], GeneratePdfRequest.prototype, "html", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
(0, class_validator_1.IsBoolean)(),
|
|
26
|
+
__metadata("design:type", Boolean)
|
|
27
|
+
], GeneratePdfRequest.prototype, "includeContent", void 0);
|
|
@@ -22,3 +22,8 @@ __decorate([
|
|
|
22
22
|
(0, class_validator_1.IsString)({ each: true }),
|
|
23
23
|
__metadata("design:type", Array)
|
|
24
24
|
], MergePdfsRequest.prototype, "pdfs", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsOptional)(),
|
|
27
|
+
(0, class_validator_1.IsBoolean)(),
|
|
28
|
+
__metadata("design:type", Boolean)
|
|
29
|
+
], MergePdfsRequest.prototype, "includeContent", void 0);
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documento PDF generado y guardado por pdf-render-business.
|
|
3
|
+
* La URL firmada vence en `expiresAt`; para una nueva se usa GET /documents/{documentId}/url.
|
|
4
|
+
*/
|
|
1
5
|
export declare class PdfDocumentResponse {
|
|
2
|
-
|
|
6
|
+
documentId: string;
|
|
7
|
+
url: string;
|
|
8
|
+
/** ISO-8601. */
|
|
9
|
+
expiresAt: string;
|
|
10
|
+
/** SHA-256 en hexadecimal del PDF exacto que quedó guardado. */
|
|
11
|
+
sha256: string;
|
|
3
12
|
pages: number;
|
|
4
13
|
bytes: number;
|
|
14
|
+
/** Sólo cuando el request pidió `includeContent: true`. */
|
|
15
|
+
base64?: string;
|
|
5
16
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PdfDocumentResponse = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Documento PDF generado y guardado por pdf-render-business.
|
|
6
|
+
* La URL firmada vence en `expiresAt`; para una nueva se usa GET /documents/{documentId}/url.
|
|
7
|
+
*/
|
|
4
8
|
class PdfDocumentResponse {
|
|
5
9
|
}
|
|
6
10
|
exports.PdfDocumentResponse = PdfDocumentResponse;
|
|
@@ -3,4 +3,6 @@ export declare class RenderDocumentRequest {
|
|
|
3
3
|
template: TemplateRefRequest;
|
|
4
4
|
/** Variables de la plantilla. Se escapan como HTML salvo que la plantilla use {{{triple}}}. */
|
|
5
5
|
data: Record<string, unknown>;
|
|
6
|
+
/** Además de la URL, devuelve el PDF en base64 en la respuesta (tope de 4 MiB). */
|
|
7
|
+
includeContent?: boolean;
|
|
6
8
|
}
|
|
@@ -27,3 +27,8 @@ __decorate([
|
|
|
27
27
|
(0, class_validator_1.IsObject)(),
|
|
28
28
|
__metadata("design:type", Object)
|
|
29
29
|
], RenderDocumentRequest.prototype, "data", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.IsOptional)(),
|
|
32
|
+
(0, class_validator_1.IsBoolean)(),
|
|
33
|
+
__metadata("design:type", Boolean)
|
|
34
|
+
], RenderDocumentRequest.prototype, "includeContent", void 0);
|
package/bin/pdfRender/index.d.ts
CHANGED
package/bin/pdfRender/index.js
CHANGED
|
@@ -27,3 +27,4 @@ __exportStar(require("./dtos/PublishTemplateResponse"), exports);
|
|
|
27
27
|
__exportStar(require("./dtos/UploadAssetRequest"), exports);
|
|
28
28
|
__exportStar(require("./dtos/UploadAssetResponse"), exports);
|
|
29
29
|
__exportStar(require("./dtos/TemplateSummaryResponse"), exports);
|
|
30
|
+
__exportStar(require("./dtos/DocumentUrlResponse"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Nueva URL firmada para un documento ya guardado. */
|
|
2
|
+
export class DocumentUrlResponse {
|
|
3
|
+
documentId!: string;
|
|
4
|
+
url!: string;
|
|
5
|
+
/** ISO-8601. */
|
|
6
|
+
expiresAt!: string;
|
|
7
|
+
sha256!: string;
|
|
8
|
+
pages!: number;
|
|
9
|
+
bytes!: number;
|
|
10
|
+
/** ISO-8601 de la generación. */
|
|
11
|
+
createdAt!: string;
|
|
12
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { IsNotEmpty, IsString } from "class-validator";
|
|
1
|
+
import { IsBoolean, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
|
2
2
|
|
|
3
3
|
/** HTML ya resuelto por el consumidor; se imprime en A4 con márgenes de 2 mm. */
|
|
4
4
|
export class GeneratePdfRequest {
|
|
5
5
|
@IsString() @IsNotEmpty()
|
|
6
6
|
html!: string;
|
|
7
|
+
|
|
8
|
+
/** Además de la URL, devuelve el PDF en base64 en la respuesta (tope de 4 MiB). */
|
|
9
|
+
@IsOptional() @IsBoolean()
|
|
10
|
+
includeContent?: boolean;
|
|
7
11
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ArrayMaxSize, ArrayMinSize, IsArray, IsString } from "class-validator";
|
|
1
|
+
import { ArrayMaxSize, ArrayMinSize, IsArray, IsBoolean, IsOptional, IsString } from "class-validator";
|
|
2
2
|
|
|
3
3
|
/** PDFs en base64, en el orden en que deben quedar en el documento final. */
|
|
4
4
|
export class MergePdfsRequest {
|
|
5
5
|
@IsArray() @ArrayMinSize(1) @ArrayMaxSize(50) @IsString({ each: true })
|
|
6
6
|
pdfs!: string[];
|
|
7
|
+
|
|
8
|
+
/** Además de la URL, devuelve el PDF en base64 en la respuesta (tope de 4 MiB). */
|
|
9
|
+
@IsOptional() @IsBoolean()
|
|
10
|
+
includeContent?: boolean;
|
|
7
11
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documento PDF generado y guardado por pdf-render-business.
|
|
3
|
+
* La URL firmada vence en `expiresAt`; para una nueva se usa GET /documents/{documentId}/url.
|
|
4
|
+
*/
|
|
1
5
|
export class PdfDocumentResponse {
|
|
2
|
-
|
|
6
|
+
documentId!: string;
|
|
7
|
+
url!: string;
|
|
8
|
+
/** ISO-8601. */
|
|
9
|
+
expiresAt!: string;
|
|
10
|
+
/** SHA-256 en hexadecimal del PDF exacto que quedó guardado. */
|
|
11
|
+
sha256!: string;
|
|
3
12
|
pages!: number;
|
|
4
13
|
bytes!: number;
|
|
14
|
+
/** Sólo cuando el request pidió `includeContent: true`. */
|
|
15
|
+
base64?: string;
|
|
5
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsDefined, IsObject, ValidateNested } from "class-validator";
|
|
1
|
+
import { IsBoolean, IsDefined, IsObject, IsOptional, ValidateNested } from "class-validator";
|
|
2
2
|
import { Type } from "class-transformer";
|
|
3
3
|
import { TemplateRefRequest } from "./TemplateRefRequest";
|
|
4
4
|
|
|
@@ -9,4 +9,8 @@ export class RenderDocumentRequest {
|
|
|
9
9
|
/** Variables de la plantilla. Se escapan como HTML salvo que la plantilla use {{{triple}}}. */
|
|
10
10
|
@IsDefined() @IsObject()
|
|
11
11
|
data!: Record<string, unknown>;
|
|
12
|
+
|
|
13
|
+
/** Además de la URL, devuelve el PDF en base64 en la respuesta (tope de 4 MiB). */
|
|
14
|
+
@IsOptional() @IsBoolean()
|
|
15
|
+
includeContent?: boolean;
|
|
12
16
|
}
|
package/src/pdfRender/index.ts
CHANGED