@fiado/api-invoker 1.0.65 → 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.
@@ -21,6 +21,7 @@ const authentication_1 = require("./authentication");
21
21
  const card_1 = require("./card");
22
22
  const TransactionPublisher_1 = require("./transaction/queue/TransactionPublisher");
23
23
  const ContractGeneratorApi_1 = require("./contract-generator/ContractGeneratorApi");
24
+ const ProductCatalogApi_1 = __importDefault(require("./product-catalog/ProductCatalogApi"));
24
25
  exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
25
26
  bind("IDirectoryApi").to(directory_1.DirectoryApi);
26
27
  bind("IIdentityApi").to(identity_1.IdentityApi);
@@ -38,4 +39,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
38
39
  bind("IAuthenticationApi").to(authentication_1.AuthenticationApi);
39
40
  bind("ICardApi").to(card_1.CardApi);
40
41
  bind("IContractGeneratorApi").to(ContractGeneratorApi_1.ContractGeneratorApi);
42
+ bind("IProductCatalogApi").to(ProductCatalogApi_1.default);
41
43
  });
package/bin/index.d.ts CHANGED
@@ -14,3 +14,4 @@ export * from "./exchangeRates";
14
14
  export * from "./authentication";
15
15
  export * from "./transaction";
16
16
  export * from "./contract-generator";
17
+ export * from "./product-catalog";
package/bin/index.js CHANGED
@@ -30,3 +30,4 @@ __exportStar(require("./exchangeRates"), exports);
30
30
  __exportStar(require("./authentication"), exports);
31
31
  __exportStar(require("./transaction"), exports);
32
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,2 @@
1
+ export * from './interfaces/IProductCatalogApi';
2
+ export * from './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
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.0.65",
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",
@@ -19,12 +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 { 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";
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";
28
30
 
29
31
  export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
30
32
  bind<IDirectoryApi>("IDirectoryApi").to(DirectoryApi);
@@ -41,6 +43,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
41
43
  bind<ISessionActivityPublisher>("ISessionActivityPublisher").to(SessionActivityPublisher);
42
44
  bind<ITransactionPublisher>("ITransactionPublisher").to(TransactionPublisher);
43
45
  bind<IAuthenticationApi>("IAuthenticationApi").to(AuthenticationApi);
44
- bind<ICardApi>("ICardApi").to(CardApi)
45
- bind<IContractGeneratorApi>("IContractGeneratorApi").to(ContractGeneratorApi)
46
+ bind<ICardApi>("ICardApi").to(CardApi);
47
+ bind<IContractGeneratorApi>("IContractGeneratorApi").to(ContractGeneratorApi);
48
+ bind<IProductCatalogApi>("IProductCatalogApi").to(ProductCatalogApi);
46
49
  });
package/src/index.ts CHANGED
@@ -13,4 +13,5 @@ export * from "./account-pagoconfiado";
13
13
  export * from "./exchangeRates";
14
14
  export * from "./authentication";
15
15
  export * from "./transaction";
16
- export * from "./contract-generator";
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,2 @@
1
+ export * from './interfaces/IProductCatalogApi';
2
+ export * from './ProductCatalogApi';
@@ -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
+ }