@fiado/api-invoker 5.136.0 → 5.138.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/bin/retailPromotions/api/RetailPromotionsBusinessApi.d.ts +2 -1
- package/bin/retailPromotions/api/RetailPromotionsBusinessApi.js +3 -0
- package/bin/retailPromotions/api/interfaces/IRetailPromotionsBusinessApi.d.ts +6 -1
- 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/src/retailPromotions/api/RetailPromotionsBusinessApi.ts +5 -0
- package/src/retailPromotions/api/interfaces/IRetailPromotionsBusinessApi.ts +7 -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 {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, PrivateReleaseSalePromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
3
|
+
import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, PrivateReleaseSalePromotionResponse, WelcomeBonusPromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
4
4
|
import { IRetailPromotionsBusinessApi } from "./interfaces/IRetailPromotionsBusinessApi.js";
|
|
5
5
|
/** Publisher HTTP de los privados de `retail-promotions-business`. Contrato -> `IRetailPromotionsBusinessApi`. */
|
|
6
6
|
export default class RetailPromotionsBusinessApi implements IRetailPromotionsBusinessApi {
|
|
@@ -9,4 +9,5 @@ export default class RetailPromotionsBusinessApi implements IRetailPromotionsBus
|
|
|
9
9
|
constructor(httpRequest: IHttpRequest);
|
|
10
10
|
releaseSalePromotion(tenantId: string, sessionId: string): Promise<StandardResponse<PrivateReleaseSalePromotionResponse>>;
|
|
11
11
|
listActiveSalePromotionsBySkus(input: ActiveSalePromotionsBySkusRequest): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>>;
|
|
12
|
+
getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>>;
|
|
12
13
|
}
|
|
@@ -27,6 +27,9 @@ let RetailPromotionsBusinessApi = class RetailPromotionsBusinessApi {
|
|
|
27
27
|
async listActiveSalePromotionsBySkus(input) {
|
|
28
28
|
return await this.httpRequest.post(`${this.baseUrl}/private/sale-promotions/active-by-skus`, input);
|
|
29
29
|
}
|
|
30
|
+
async getWelcomeBonus(retailerId) {
|
|
31
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/welcome-bonus`);
|
|
32
|
+
}
|
|
30
33
|
};
|
|
31
34
|
RetailPromotionsBusinessApi = __decorate([
|
|
32
35
|
injectable(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, PrivateReleaseSalePromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
2
|
+
import type { ActiveSalePromotionsBySkusRequest, ActiveSalePromotionsBySkusResponse, PrivateReleaseSalePromotionResponse, WelcomeBonusPromotionResponse } from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
3
3
|
export interface IRetailPromotionsBusinessApi {
|
|
4
4
|
/**
|
|
5
5
|
* `DELETE /private/sessions/{sessionId}/sale-promotion`: suelta el apartado de la promo de venta.
|
|
@@ -11,4 +11,9 @@ export interface IRetailPromotionsBusinessApi {
|
|
|
11
11
|
* Una entrada por SKU en el orden pedido; `UNAVAILABLE` por entrada si no se pudieron leer.
|
|
12
12
|
*/
|
|
13
13
|
listActiveSalePromotionsBySkus(input: ActiveSalePromotionsBySkusRequest): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>>;
|
|
14
|
+
/**
|
|
15
|
+
* `GET /private/retailers/{retailerId}/welcome-bonus`: promo de sistema del bono de bienvenida.
|
|
16
|
+
* Sin `tenantId`; la siembra si no existe. `active=false` = pausada, el wizard no paga bono.
|
|
17
|
+
*/
|
|
18
|
+
getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>>;
|
|
14
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.138.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
|
+
}
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
ActiveSalePromotionsBySkusRequest,
|
|
6
6
|
ActiveSalePromotionsBySkusResponse,
|
|
7
7
|
PrivateReleaseSalePromotionResponse,
|
|
8
|
+
WelcomeBonusPromotionResponse,
|
|
8
9
|
} from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
9
10
|
import { IRetailPromotionsBusinessApi } from "./interfaces/IRetailPromotionsBusinessApi.js";
|
|
10
11
|
|
|
@@ -30,4 +31,8 @@ export default class RetailPromotionsBusinessApi implements IRetailPromotionsBus
|
|
|
30
31
|
): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>> {
|
|
31
32
|
return await this.httpRequest.post(`${this.baseUrl}/private/sale-promotions/active-by-skus`, input);
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
async getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>> {
|
|
36
|
+
return await this.httpRequest.get(`${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/welcome-bonus`);
|
|
37
|
+
}
|
|
33
38
|
}
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
ActiveSalePromotionsBySkusRequest,
|
|
4
4
|
ActiveSalePromotionsBySkusResponse,
|
|
5
5
|
PrivateReleaseSalePromotionResponse,
|
|
6
|
+
WelcomeBonusPromotionResponse,
|
|
6
7
|
} from "@fiado/type-kit/bin/retailPromotions/index.js";
|
|
7
8
|
|
|
8
9
|
// Contrato de los privados de `retail-promotions-business`; el caller manda `tenantId` por query o en el body.
|
|
@@ -24,4 +25,10 @@ export interface IRetailPromotionsBusinessApi {
|
|
|
24
25
|
listActiveSalePromotionsBySkus(
|
|
25
26
|
input: ActiveSalePromotionsBySkusRequest,
|
|
26
27
|
): Promise<StandardResponse<ActiveSalePromotionsBySkusResponse>>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* `GET /private/retailers/{retailerId}/welcome-bonus`: promo de sistema del bono de bienvenida.
|
|
31
|
+
* Sin `tenantId`; la siembra si no existe. `active=false` = pausada, el wizard no paga bono.
|
|
32
|
+
*/
|
|
33
|
+
getWelcomeBonus(retailerId: string): Promise<StandardResponse<WelcomeBonusPromotionResponse>>;
|
|
27
34
|
}
|