@fiado/api-invoker 5.136.0 → 5.137.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/bin/container.config.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/pdf-generator-business/api/PdfGeneratorBusinessApi.d.ts +10 -0
- package/bin/pdf-generator-business/api/PdfGeneratorBusinessApi.js +33 -0
- package/bin/pdf-generator-business/api/interfaces/IPdfGeneratorBusinessApi.d.ts +16 -0
- package/bin/pdf-generator-business/api/interfaces/IPdfGeneratorBusinessApi.js +1 -0
- package/bin/pdf-generator-business/index.d.ts +2 -0
- package/bin/pdf-generator-business/index.js +2 -0
- package/package.json +2 -2
- package/src/container.config.ts +3 -0
- package/src/index.ts +1 -0
- package/src/pdf-generator-business/api/PdfGeneratorBusinessApi.ts +21 -0
- package/src/pdf-generator-business/api/interfaces/IPdfGeneratorBusinessApi.ts +17 -0
- package/src/pdf-generator-business/index.ts +2 -0
package/bin/container.config.js
CHANGED
|
@@ -22,6 +22,7 @@ import { TransactionPublisher } from "./transaction/index.js";
|
|
|
22
22
|
import { ContractGeneratorApi } from "./contract-generator/index.js";
|
|
23
23
|
import ContractBusinessApi from "./contract-business/api/ContractBusinessApi.js";
|
|
24
24
|
import PdfRenderBusinessApi from "./pdf-render-business/api/PdfRenderBusinessApi.js";
|
|
25
|
+
import PdfGeneratorBusinessApi from "./pdf-generator-business/api/PdfGeneratorBusinessApi.js";
|
|
25
26
|
import MilestoneBusinessApi from "./milestone-business/api/MilestoneBusinessApi.js";
|
|
26
27
|
import CreditStatementsApi from "./credit-statements/api/CreditStatementsApi.js";
|
|
27
28
|
import ProductCatalogApi from "./product-catalog/ProductCatalogApi.js";
|
|
@@ -179,6 +180,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
179
180
|
bind("IContractGeneratorApi").to(ContractGeneratorApi);
|
|
180
181
|
bind("IContractBusinessApi").to(ContractBusinessApi);
|
|
181
182
|
bind("IPdfRenderBusinessApi").to(PdfRenderBusinessApi);
|
|
183
|
+
bind("IPdfGeneratorBusinessApi").to(PdfGeneratorBusinessApi);
|
|
182
184
|
bind("IMilestoneBusinessApi").to(MilestoneBusinessApi);
|
|
183
185
|
bind("ICreditStatementsApi").to(CreditStatementsApi);
|
|
184
186
|
bind("ICollectorApi").to(CollectorApi);
|
package/bin/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./transaction/index.js";
|
|
|
20
20
|
export * from "./contract-generator/index.js";
|
|
21
21
|
export * from "./contract-business/index.js";
|
|
22
22
|
export * from "./pdf-render-business/index.js";
|
|
23
|
+
export * from "./pdf-generator-business/index.js";
|
|
23
24
|
export * from "./credit-statements/index.js";
|
|
24
25
|
export * from "./product-catalog/index.js";
|
|
25
26
|
export * from "./collector/index.js";
|
package/bin/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./transaction/index.js";
|
|
|
20
20
|
export * from "./contract-generator/index.js";
|
|
21
21
|
export * from "./contract-business/index.js";
|
|
22
22
|
export * from "./pdf-render-business/index.js";
|
|
23
|
+
export * from "./pdf-generator-business/index.js";
|
|
23
24
|
export * from "./credit-statements/index.js";
|
|
24
25
|
export * from "./product-catalog/index.js";
|
|
25
26
|
export * from "./collector/index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import type { PdfGeneratorRequest, PdfGeneratorResponse } from "@fiado/type-kit/bin/pdfGenerator/index.js";
|
|
3
|
+
import type { IPdfGeneratorBusinessApi } from "./interfaces/IPdfGeneratorBusinessApi.js";
|
|
4
|
+
export default class PdfGeneratorBusinessApi implements IPdfGeneratorBusinessApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
constructor(httpRequest: IHttpRequest);
|
|
7
|
+
generatePdf(request: PdfGeneratorRequest): Promise<PdfGeneratorResponse>;
|
|
8
|
+
/** La URL base se lee en cada llamada y se normaliza para no duplicar "/" al concatenar. */
|
|
9
|
+
private url;
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
let PdfGeneratorBusinessApi = class PdfGeneratorBusinessApi {
|
|
15
|
+
httpRequest;
|
|
16
|
+
constructor(httpRequest) {
|
|
17
|
+
this.httpRequest = httpRequest;
|
|
18
|
+
}
|
|
19
|
+
async generatePdf(request) {
|
|
20
|
+
return await this.httpRequest.post(this.url("generate-pdf"), request);
|
|
21
|
+
}
|
|
22
|
+
/** La URL base se lee en cada llamada y se normaliza para no duplicar "/" al concatenar. */
|
|
23
|
+
url(path) {
|
|
24
|
+
const baseUrl = (process.env.PDF_GENERATOR_BUSINESS_LAMBDA_URL || "").replace(/\/+$/, "");
|
|
25
|
+
return `${baseUrl}/${path}`;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
PdfGeneratorBusinessApi = __decorate([
|
|
29
|
+
injectable(),
|
|
30
|
+
__param(0, inject("IHttpRequest")),
|
|
31
|
+
__metadata("design:paramtypes", [Object])
|
|
32
|
+
], PdfGeneratorBusinessApi);
|
|
33
|
+
export default PdfGeneratorBusinessApi;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PdfGeneratorRequest, PdfGeneratorResponse } from "@fiado/type-kit/bin/pdfGenerator/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Cliente de pdf-generator-business (API privada): HTML ya armado → PDF.
|
|
4
|
+
*
|
|
5
|
+
* El Lambda responde `{ base64 }` directo, SIN el envoltorio `ApiResponse`. Validaciones del
|
|
6
|
+
* request (html vacío, `page` inválido, provider desconocido) vuelven como 400; documentos de
|
|
7
|
+
* más de 1000 páginas como 422. Una respuesta distinta de 2xx se propaga como el error del
|
|
8
|
+
* cliente HTTP (axios).
|
|
9
|
+
*
|
|
10
|
+
* Variable de entorno requerida en el consumidor: `PDF_GENERATOR_BUSINESS_LAMBDA_URL`
|
|
11
|
+
* (`{{resolve:ssm:pdf-generator-business}}`).
|
|
12
|
+
*/
|
|
13
|
+
export interface IPdfGeneratorBusinessApi {
|
|
14
|
+
/** POST /generate-pdf */
|
|
15
|
+
generatePdf(request: PdfGeneratorRequest): Promise<PdfGeneratorResponse>;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.137.0",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fiado/gateway-adapter": "^3.14.0",
|
|
35
35
|
"@fiado/http-client": "^2.0.1",
|
|
36
36
|
"@fiado/logger": "^1.1.3",
|
|
37
|
-
"@fiado/type-kit": "^3.
|
|
37
|
+
"@fiado/type-kit": "^3.564.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/container.config.ts
CHANGED
|
@@ -32,6 +32,8 @@ import { IContractBusinessApi } from "./contract-business/index.js";
|
|
|
32
32
|
import ContractBusinessApi from "./contract-business/api/ContractBusinessApi.js";
|
|
33
33
|
import { IPdfRenderBusinessApi } from "./pdf-render-business/index.js";
|
|
34
34
|
import PdfRenderBusinessApi from "./pdf-render-business/api/PdfRenderBusinessApi.js";
|
|
35
|
+
import { IPdfGeneratorBusinessApi } from "./pdf-generator-business/index.js";
|
|
36
|
+
import PdfGeneratorBusinessApi from "./pdf-generator-business/api/PdfGeneratorBusinessApi.js";
|
|
35
37
|
import { IMilestoneBusinessApi } from "./milestone-business/index.js";
|
|
36
38
|
import MilestoneBusinessApi from "./milestone-business/api/MilestoneBusinessApi.js";
|
|
37
39
|
import { ICreditStatementsApi } from "./credit-statements/index.js";
|
|
@@ -252,6 +254,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
252
254
|
bind<IContractGeneratorApi>("IContractGeneratorApi").to(ContractGeneratorApi);
|
|
253
255
|
bind<IContractBusinessApi>("IContractBusinessApi").to(ContractBusinessApi);
|
|
254
256
|
bind<IPdfRenderBusinessApi>("IPdfRenderBusinessApi").to(PdfRenderBusinessApi);
|
|
257
|
+
bind<IPdfGeneratorBusinessApi>("IPdfGeneratorBusinessApi").to(PdfGeneratorBusinessApi);
|
|
255
258
|
bind<IMilestoneBusinessApi>("IMilestoneBusinessApi").to(MilestoneBusinessApi);
|
|
256
259
|
bind<ICreditStatementsApi>("ICreditStatementsApi").to(CreditStatementsApi);
|
|
257
260
|
bind<ICollectorApi>("ICollectorApi").to(CollectorApi);
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./transaction/index.js";
|
|
|
20
20
|
export * from "./contract-generator/index.js";
|
|
21
21
|
export * from "./contract-business/index.js";
|
|
22
22
|
export * from "./pdf-render-business/index.js";
|
|
23
|
+
export * from "./pdf-generator-business/index.js";
|
|
23
24
|
export * from "./credit-statements/index.js";
|
|
24
25
|
export * from "./product-catalog/index.js";
|
|
25
26
|
export * from "./collector/index.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import type { PdfGeneratorRequest, PdfGeneratorResponse } from "@fiado/type-kit/bin/pdfGenerator/index.js";
|
|
4
|
+
import type { IPdfGeneratorBusinessApi } from "./interfaces/IPdfGeneratorBusinessApi.js";
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export default class PdfGeneratorBusinessApi implements IPdfGeneratorBusinessApi {
|
|
8
|
+
|
|
9
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async generatePdf(request: PdfGeneratorRequest): Promise<PdfGeneratorResponse> {
|
|
13
|
+
return await this.httpRequest.post<PdfGeneratorResponse>(this.url("generate-pdf"), request);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** La URL base se lee en cada llamada y se normaliza para no duplicar "/" al concatenar. */
|
|
17
|
+
private url(path: string): string {
|
|
18
|
+
const baseUrl = (process.env.PDF_GENERATOR_BUSINESS_LAMBDA_URL || "").replace(/\/+$/, "");
|
|
19
|
+
return `${baseUrl}/${path}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PdfGeneratorRequest, PdfGeneratorResponse } from "@fiado/type-kit/bin/pdfGenerator/index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cliente de pdf-generator-business (API privada): HTML ya armado → PDF.
|
|
5
|
+
*
|
|
6
|
+
* El Lambda responde `{ base64 }` directo, SIN el envoltorio `ApiResponse`. Validaciones del
|
|
7
|
+
* request (html vacío, `page` inválido, provider desconocido) vuelven como 400; documentos de
|
|
8
|
+
* más de 1000 páginas como 422. Una respuesta distinta de 2xx se propaga como el error del
|
|
9
|
+
* cliente HTTP (axios).
|
|
10
|
+
*
|
|
11
|
+
* Variable de entorno requerida en el consumidor: `PDF_GENERATOR_BUSINESS_LAMBDA_URL`
|
|
12
|
+
* (`{{resolve:ssm:pdf-generator-business}}`).
|
|
13
|
+
*/
|
|
14
|
+
export interface IPdfGeneratorBusinessApi {
|
|
15
|
+
/** POST /generate-pdf */
|
|
16
|
+
generatePdf(request: PdfGeneratorRequest): Promise<PdfGeneratorResponse>;
|
|
17
|
+
}
|