@fiado/api-invoker 3.0.32 → 3.0.34
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 +3 -0
- package/bin/countries-business/CountriesBusinessApi.d.ts +9 -0
- package/bin/countries-business/CountriesBusinessApi.js +44 -0
- package/bin/countries-business/index.d.ts +2 -0
- package/bin/countries-business/index.js +18 -0
- package/bin/countries-business/interfaces/ICountriesBusinessApi.d.ts +21 -0
- package/bin/countries-business/interfaces/ICountriesBusinessApi.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/package.json +1 -1
- package/src/container.config.ts +6 -0
- package/src/countries-business/CountriesBusinessApi.ts +31 -0
- package/src/countries-business/index.ts +2 -0
- package/src/countries-business/interfaces/ICountriesBusinessApi.ts +22 -0
- package/src/index.ts +1 -0
package/bin/container.config.js
CHANGED
|
@@ -92,6 +92,7 @@ const PlatformErrorEventsPublisher_1 = __importDefault(require("./platform-error
|
|
|
92
92
|
const TeamsNotificationPublisher_1 = __importDefault(require("./teams-connector/queue/TeamsNotificationPublisher"));
|
|
93
93
|
// Legal document
|
|
94
94
|
const legalDocument_1 = require("./legalDocument");
|
|
95
|
+
const CountriesBusinessApi_1 = __importDefault(require("./countries-business/CountriesBusinessApi"));
|
|
95
96
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
96
97
|
// UTILS bindings
|
|
97
98
|
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
@@ -185,4 +186,6 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
185
186
|
bind("ITeamsNotificationPublisher").to(TeamsNotificationPublisher_1.default);
|
|
186
187
|
// Legal document
|
|
187
188
|
bind("ILegalDocumentApi").to(legalDocument_1.LegalDocumentApi);
|
|
189
|
+
// Countries business
|
|
190
|
+
bind("ICountriesBusinessApi").to(CountriesBusinessApi_1.default);
|
|
188
191
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CountriesGetListRequest, ICountriesBusinessApi } from "./interfaces/ICountriesBusinessApi";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
export default class CountriesBusinessApi implements ICountriesBusinessApi {
|
|
4
|
+
private httpRequest;
|
|
5
|
+
private readonly baseUrl;
|
|
6
|
+
constructor(httpRequest: IHttpRequest);
|
|
7
|
+
getAll(): Promise<any>;
|
|
8
|
+
getList(params: CountriesGetListRequest): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 CountriesBusinessApi = class CountriesBusinessApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.COUNTRIES_BUSINESS_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
async getAll() {
|
|
22
|
+
const headers = {
|
|
23
|
+
"operationName": "privateGetAll"
|
|
24
|
+
};
|
|
25
|
+
return await this.httpRequest.post(this.baseUrl, null, headers);
|
|
26
|
+
}
|
|
27
|
+
async getList(params) {
|
|
28
|
+
const queryParams = Object.entries(params)
|
|
29
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
30
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
31
|
+
.join('&');
|
|
32
|
+
const url = queryParams ? `${this.baseUrl}?${queryParams}` : this.baseUrl;
|
|
33
|
+
const headers = {
|
|
34
|
+
"operationName": "privateGetList"
|
|
35
|
+
};
|
|
36
|
+
return await this.httpRequest.post(url, null, headers);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
CountriesBusinessApi = __decorate([
|
|
40
|
+
(0, inversify_1.injectable)(),
|
|
41
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
43
|
+
], CountriesBusinessApi);
|
|
44
|
+
exports.default = CountriesBusinessApi;
|
|
@@ -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/ICountriesBusinessApi"), exports);
|
|
18
|
+
__exportStar(require("./CountriesBusinessApi"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CountriesGetListRequest {
|
|
2
|
+
index?: string;
|
|
3
|
+
pageSize?: number;
|
|
4
|
+
filter1?: string;
|
|
5
|
+
filter2?: string;
|
|
6
|
+
filter3?: string;
|
|
7
|
+
filter4?: string;
|
|
8
|
+
filter5?: string;
|
|
9
|
+
filter6?: string;
|
|
10
|
+
filter7?: string;
|
|
11
|
+
filter8?: string;
|
|
12
|
+
filter9?: string;
|
|
13
|
+
filter10?: string;
|
|
14
|
+
isEnabled?: boolean;
|
|
15
|
+
iso2?: string;
|
|
16
|
+
iso3?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ICountriesBusinessApi {
|
|
19
|
+
getAll(): Promise<any>;
|
|
20
|
+
getList(params: CountriesGetListRequest): Promise<any>;
|
|
21
|
+
}
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -82,3 +82,4 @@ __exportStar(require("./document-generator"), exports);
|
|
|
82
82
|
__exportStar(require("./commission-business"), exports);
|
|
83
83
|
__exportStar(require("./platform-error-events"), exports);
|
|
84
84
|
__exportStar(require("./teams-connector"), exports);
|
|
85
|
+
__exportStar(require("./countries-business"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.34",
|
|
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
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
package/src/container.config.ts
CHANGED
|
@@ -134,6 +134,9 @@ import { ITeamsNotificationPublisher } from "./teams-connector";
|
|
|
134
134
|
import TeamsNotificationPublisher from "./teams-connector/queue/TeamsNotificationPublisher";
|
|
135
135
|
// Legal document
|
|
136
136
|
import { ILegalDocumentApi, LegalDocumentApi } from "./legalDocument";
|
|
137
|
+
// Countries business
|
|
138
|
+
import { ICountriesBusinessApi } from "./countries-business";
|
|
139
|
+
import CountriesBusinessApi from "./countries-business/CountriesBusinessApi";
|
|
137
140
|
|
|
138
141
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
139
142
|
// UTILS bindings
|
|
@@ -234,4 +237,7 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
234
237
|
|
|
235
238
|
// Legal document
|
|
236
239
|
bind<ILegalDocumentApi>("ILegalDocumentApi").to(LegalDocumentApi);
|
|
240
|
+
|
|
241
|
+
// Countries business
|
|
242
|
+
bind<ICountriesBusinessApi>("ICountriesBusinessApi").to(CountriesBusinessApi);
|
|
237
243
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CountriesGetListRequest, ICountriesBusinessApi } from "./interfaces/ICountriesBusinessApi";
|
|
2
|
+
import { inject, injectable } from "inversify";
|
|
3
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
4
|
+
|
|
5
|
+
@injectable()
|
|
6
|
+
export default class CountriesBusinessApi implements ICountriesBusinessApi {
|
|
7
|
+
private readonly baseUrl = process.env.COUNTRIES_BUSINESS_LAMBDA_URL || "";
|
|
8
|
+
|
|
9
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getAll(): Promise<any> {
|
|
13
|
+
const headers = {
|
|
14
|
+
"operationName": "privateGetAll"
|
|
15
|
+
}
|
|
16
|
+
return await this.httpRequest.post(this.baseUrl, null, headers);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async getList(params: CountriesGetListRequest): Promise<any> {
|
|
20
|
+
const queryParams = Object.entries(params)
|
|
21
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
22
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
23
|
+
.join('&');
|
|
24
|
+
|
|
25
|
+
const url = queryParams ? `${this.baseUrl}?${queryParams}` : this.baseUrl;
|
|
26
|
+
const headers = {
|
|
27
|
+
"operationName": "privateGetList"
|
|
28
|
+
}
|
|
29
|
+
return await this.httpRequest.post(url, null, headers);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface CountriesGetListRequest {
|
|
2
|
+
index?: string;
|
|
3
|
+
pageSize?: number;
|
|
4
|
+
filter1?: string;
|
|
5
|
+
filter2?: string;
|
|
6
|
+
filter3?: string;
|
|
7
|
+
filter4?: string;
|
|
8
|
+
filter5?: string;
|
|
9
|
+
filter6?: string;
|
|
10
|
+
filter7?: string;
|
|
11
|
+
filter8?: string;
|
|
12
|
+
filter9?: string;
|
|
13
|
+
filter10?: string;
|
|
14
|
+
isEnabled?: boolean;
|
|
15
|
+
iso2?: string;
|
|
16
|
+
iso3?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ICountriesBusinessApi {
|
|
20
|
+
getAll(): Promise<any>;
|
|
21
|
+
getList(params: CountriesGetListRequest): Promise<any>;
|
|
22
|
+
}
|
package/src/index.ts
CHANGED