@fiado/api-invoker 1.0.64 → 1.0.66
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 +4 -0
- package/bin/contract-generator/ContractGeneratorApi.d.ts +9 -0
- package/bin/contract-generator/ContractGeneratorApi.js +37 -0
- package/bin/contract-generator/index.d.ts +2 -0
- package/bin/contract-generator/index.js +18 -0
- package/bin/contract-generator/interfaces/IContractGeneratorApi.d.ts +14 -0
- package/bin/contract-generator/interfaces/IContractGeneratorApi.js +2 -0
- package/bin/index.d.ts +2 -0
- package/bin/index.js +2 -0
- package/bin/product-catalog/ProductCatalogApi.d.ts +11 -0
- package/bin/product-catalog/ProductCatalogApi.js +35 -0
- package/bin/product-catalog/index.d.ts +2 -0
- package/bin/product-catalog/index.js +18 -0
- package/bin/product-catalog/interfaces/IProductCatalogApi.d.ts +6 -0
- package/bin/product-catalog/interfaces/IProductCatalogApi.js +2 -0
- package/package.json +2 -2
- package/src/container.config.ts +11 -5
- package/src/contract-generator/ContractGeneratorApi.ts +19 -0
- package/src/contract-generator/index.ts +3 -0
- package/src/contract-generator/interfaces/IContractGeneratorApi.ts +16 -0
- package/src/index.ts +3 -1
- package/src/product-catalog/ProductCatalogApi.ts +23 -0
- package/src/product-catalog/index.ts +2 -0
- package/src/product-catalog/interfaces/IProductCatalogApi.ts +9 -0
package/bin/container.config.js
CHANGED
|
@@ -20,6 +20,8 @@ const ExchangeRatesApi_1 = __importDefault(require("./exchangeRates/ExchangeRate
|
|
|
20
20
|
const authentication_1 = require("./authentication");
|
|
21
21
|
const card_1 = require("./card");
|
|
22
22
|
const TransactionPublisher_1 = require("./transaction/queue/TransactionPublisher");
|
|
23
|
+
const ContractGeneratorApi_1 = require("./contract-generator/ContractGeneratorApi");
|
|
24
|
+
const ProductCatalogApi_1 = __importDefault(require("./product-catalog/ProductCatalogApi"));
|
|
23
25
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
24
26
|
bind("IDirectoryApi").to(directory_1.DirectoryApi);
|
|
25
27
|
bind("IIdentityApi").to(identity_1.IdentityApi);
|
|
@@ -36,4 +38,6 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
36
38
|
bind("ITransactionPublisher").to(TransactionPublisher_1.TransactionPublisher);
|
|
37
39
|
bind("IAuthenticationApi").to(authentication_1.AuthenticationApi);
|
|
38
40
|
bind("ICardApi").to(card_1.CardApi);
|
|
41
|
+
bind("IContractGeneratorApi").to(ContractGeneratorApi_1.ContractGeneratorApi);
|
|
42
|
+
bind("IProductCatalogApi").to(ProductCatalogApi_1.default);
|
|
39
43
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IContractGeneratorApi } from "./interfaces/IContractGeneratorApi";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { ContractCreateRequest } from "@fiado/type-kit/bin/contract";
|
|
4
|
+
export declare class ContractGeneratorApi implements IContractGeneratorApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
generate(params: ContractCreateRequest): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ContractGeneratorApi = void 0;
|
|
19
|
+
const inversify_1 = require("inversify");
|
|
20
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
21
|
+
dotenv_1.default.config();
|
|
22
|
+
let ContractGeneratorApi = class ContractGeneratorApi {
|
|
23
|
+
constructor(httpRequest) {
|
|
24
|
+
this.httpRequest = httpRequest;
|
|
25
|
+
this.baseUrl = process.env.CONTRACT_GENERATOR_URL || "";
|
|
26
|
+
}
|
|
27
|
+
async generate(params) {
|
|
28
|
+
const url = `${this.baseUrl}`;
|
|
29
|
+
return await this.httpRequest.post(`${url}`, params, { 'spring.cloud.function.definition': "generateReport" });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.ContractGeneratorApi = ContractGeneratorApi;
|
|
33
|
+
exports.ContractGeneratorApi = ContractGeneratorApi = __decorate([
|
|
34
|
+
(0, inversify_1.injectable)(),
|
|
35
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
36
|
+
__metadata("design:paramtypes", [Object])
|
|
37
|
+
], ContractGeneratorApi);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./interfaces/IContractGeneratorApi"), exports);
|
|
18
|
+
__exportStar(require("./ContractGeneratorApi"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ContractCreateRequest } from "@fiado/type-kit/bin/contract";
|
|
2
|
+
/**
|
|
3
|
+
* Interfaz para el servicio Contract Generator.
|
|
4
|
+
*/
|
|
5
|
+
export interface IContractGeneratorApi {
|
|
6
|
+
/**
|
|
7
|
+
* Obtiene una lista de people por sus IDs.
|
|
8
|
+
* @param ids Array de IDs de peopleId (UUIDs) a buscar.
|
|
9
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
10
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
11
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
12
|
+
*/
|
|
13
|
+
generate(params: ContractCreateRequest): Promise<any>;
|
|
14
|
+
}
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -29,3 +29,5 @@ __exportStar(require("./account-pagoconfiado"), exports);
|
|
|
29
29
|
__exportStar(require("./exchangeRates"), exports);
|
|
30
30
|
__exportStar(require("./authentication"), exports);
|
|
31
31
|
__exportStar(require("./transaction"), exports);
|
|
32
|
+
__exportStar(require("./contract-generator"), exports);
|
|
33
|
+
__exportStar(require("./product-catalog"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IProductCatalogApi } from "./interfaces/IProductCatalogApi";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
4
|
+
import GetProductCatalogResponse from "@fiado/type-kit/bin/productCatalog/dtos/GetProductCatalogResponse";
|
|
5
|
+
export default class ProductCatalogApi implements IProductCatalogApi {
|
|
6
|
+
private httpRequest;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(httpRequest: IHttpRequest);
|
|
9
|
+
getProductCatalog(): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
|
|
10
|
+
getProductCatalogByIds(ids: string[]): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const inversify_1 = require("inversify");
|
|
16
|
+
let ProductCatalogApi = class ProductCatalogApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.PRODUCT_CATALOG_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
async getProductCatalog() {
|
|
22
|
+
const url = `${this.baseUrl}`;
|
|
23
|
+
return await this.httpRequest.get(url);
|
|
24
|
+
}
|
|
25
|
+
async getProductCatalogByIds(ids) {
|
|
26
|
+
const url = `${this.baseUrl}/ids`;
|
|
27
|
+
return await this.httpRequest.get(url, { ids });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
ProductCatalogApi = __decorate([
|
|
31
|
+
(0, inversify_1.injectable)(),
|
|
32
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
33
|
+
__metadata("design:paramtypes", [Object])
|
|
34
|
+
], ProductCatalogApi);
|
|
35
|
+
exports.default = ProductCatalogApi;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./interfaces/IProductCatalogApi"), exports);
|
|
18
|
+
__exportStar(require("./ProductCatalogApi"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import GetProductCatalogResponse from "@fiado/type-kit/bin/productCatalog/dtos/GetProductCatalogResponse";
|
|
3
|
+
export interface IProductCatalogApi {
|
|
4
|
+
getProductCatalog(): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
|
|
5
|
+
getProductCatalogByIds(ids: string[]): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@fiado/api-invoker": "^1.0.19",
|
|
17
17
|
"@fiado/gateway-adapter": "^1.0.30",
|
|
18
18
|
"@fiado/http-client": "^1.0.1",
|
|
19
|
-
"@fiado/type-kit": "^1.1.
|
|
19
|
+
"@fiado/type-kit": "^1.1.18",
|
|
20
20
|
"dotenv": "^16.4.5",
|
|
21
21
|
"inversify": "^6.0.2",
|
|
22
22
|
"reflect-metadata": "^0.2.1",
|
package/src/container.config.ts
CHANGED
|
@@ -19,10 +19,14 @@ import STPAccountApi from "./stpAccount/api/STPAccountApi";
|
|
|
19
19
|
import {ISessionActivityPublisher, SessionActivityPublisher} from "./sessionActivity";
|
|
20
20
|
import {IExchangeRatesApi} from "./exchangeRates";
|
|
21
21
|
import ExchangeRatesApi from "./exchangeRates/ExchangeRatesApi";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
22
|
+
import {AuthenticationApi, IAuthenticationApi} from "./authentication";
|
|
23
|
+
import {CardApi, ICardApi} from "./card";
|
|
24
|
+
import {ITransactionPublisher} from "./transaction/queue/interfaces/ITransactionPublisher";
|
|
25
|
+
import {TransactionPublisher} from "./transaction/queue/TransactionPublisher";
|
|
26
|
+
import {ContractGeneratorApi} from "./contract-generator/ContractGeneratorApi";
|
|
27
|
+
import {IContractGeneratorApi} from "./contract-generator/interfaces/IContractGeneratorApi";
|
|
28
|
+
import {IProductCatalogApi} from "./product-catalog";
|
|
29
|
+
import ProductCatalogApi from "./product-catalog/ProductCatalogApi";
|
|
26
30
|
|
|
27
31
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
28
32
|
bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
|
|
@@ -39,5 +43,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
39
43
|
bind<ISessionActivityPublisher>("ISessionActivityPublisher").to(SessionActivityPublisher);
|
|
40
44
|
bind<ITransactionPublisher>("ITransactionPublisher").to(TransactionPublisher);
|
|
41
45
|
bind<IAuthenticationApi>("IAuthenticationApi").to(AuthenticationApi);
|
|
42
|
-
bind<ICardApi>("ICardApi").to(CardApi)
|
|
46
|
+
bind<ICardApi>("ICardApi").to(CardApi);
|
|
47
|
+
bind<IContractGeneratorApi>("IContractGeneratorApi").to(ContractGeneratorApi);
|
|
48
|
+
bind<IProductCatalogApi>("IProductCatalogApi").to(ProductCatalogApi);
|
|
43
49
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IContractGeneratorApi } from "./interfaces/IContractGeneratorApi";
|
|
3
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
import dotenv from 'dotenv';
|
|
5
|
+
import { ContractCreateRequest } from "@fiado/type-kit/bin/contract";
|
|
6
|
+
dotenv.config();
|
|
7
|
+
|
|
8
|
+
@injectable()
|
|
9
|
+
export class ContractGeneratorApi implements IContractGeneratorApi {
|
|
10
|
+
|
|
11
|
+
private readonly baseUrl = process.env.CONTRACT_GENERATOR_URL || "";
|
|
12
|
+
|
|
13
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
14
|
+
|
|
15
|
+
async generate(params: ContractCreateRequest): Promise<any> {
|
|
16
|
+
const url = `${this.baseUrl}`;
|
|
17
|
+
return await this.httpRequest.post(`${url}`,params, { 'spring.cloud.function.definition': "generateReport" });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ContractCreateRequest } from "@fiado/type-kit/bin/contract";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interfaz para el servicio Contract Generator.
|
|
5
|
+
*/
|
|
6
|
+
export interface IContractGeneratorApi {
|
|
7
|
+
/**
|
|
8
|
+
* Obtiene una lista de people por sus IDs.
|
|
9
|
+
* @param ids Array de IDs de peopleId (UUIDs) a buscar.
|
|
10
|
+
* @returns Una promesa que resuelve a un arreglo de objetos de people.
|
|
11
|
+
* Puede devolver un arreglo vacío si no se encuentran coincidencias.
|
|
12
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
13
|
+
*/
|
|
14
|
+
generate(params:ContractCreateRequest): Promise<any>;
|
|
15
|
+
|
|
16
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -12,4 +12,6 @@ export * from "./account-fiadosa";
|
|
|
12
12
|
export * from "./account-pagoconfiado";
|
|
13
13
|
export * from "./exchangeRates";
|
|
14
14
|
export * from "./authentication";
|
|
15
|
-
export * from "./transaction";
|
|
15
|
+
export * from "./transaction";
|
|
16
|
+
export * from "./contract-generator";
|
|
17
|
+
export * from "./product-catalog";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {IProductCatalogApi} from "./interfaces/IProductCatalogApi";
|
|
2
|
+
import {inject, injectable} from "inversify";
|
|
3
|
+
import {IHttpRequest} from "@fiado/http-client";
|
|
4
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
5
|
+
import GetProductCatalogResponse from "@fiado/type-kit/bin/productCatalog/dtos/GetProductCatalogResponse";
|
|
6
|
+
|
|
7
|
+
@injectable()
|
|
8
|
+
export default class ProductCatalogApi implements IProductCatalogApi {
|
|
9
|
+
private readonly baseUrl = process.env.PRODUCT_CATALOG_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async getProductCatalog(): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>> {
|
|
15
|
+
const url = `${this.baseUrl}`;
|
|
16
|
+
return await this.httpRequest.get(url);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getProductCatalogByIds(ids: string[]): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>> {
|
|
20
|
+
const url = `${this.baseUrl}/ids`;
|
|
21
|
+
return await this.httpRequest.get(url, {ids});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {ApiGatewayResponse} from "@fiado/gateway-adapter";
|
|
2
|
+
import GetProductCatalogResponse from "@fiado/type-kit/bin/productCatalog/dtos/GetProductCatalogResponse";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface IProductCatalogApi {
|
|
6
|
+
getProductCatalog(): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
|
|
7
|
+
|
|
8
|
+
getProductCatalogByIds(ids: string[]): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
|
|
9
|
+
}
|