@fiado/api-invoker 1.5.18 → 1.5.20

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.
@@ -0,0 +1,46 @@
1
+ import { ChangePasswordRequest, GetUserRequest, GetUserResponse, RefreshTokenRequest, RefreshTokenResponse, RespondToAuthChallengeRequest, SetPasswordRequest, SignInRequest, SignInResponse, SignUpConfirmRequest, SignUpRequest, SignUpResponse } from "@fiado/type-kit/bin/cognitoConnector";
2
+ export interface ICognitoApi {
3
+ /**
4
+ * Healthcheck for the cognito-connector
5
+ */
6
+ healthcheck(): Promise<HealthcheckResponse>;
7
+ /**
8
+ * Create a new user in Cognito
9
+ */
10
+ signUp(request: SignUpRequest): Promise<SignUpResponse>;
11
+ /**
12
+ * Confirm sign-up for a user in Cognito
13
+ */
14
+ signUpConfirm(request: SignUpConfirmRequest): Promise<void>;
15
+ /**
16
+ * Sign in a user
17
+ */
18
+ signIn(request: SignInRequest): Promise<SignInResponse>;
19
+ /**
20
+ * Sign out a user
21
+ */
22
+ signOut(): Promise<void>;
23
+ /**
24
+ * Change a user's password
25
+ */
26
+ changePassword(request: ChangePasswordRequest): Promise<void>;
27
+ /**
28
+ * Retrieve user details
29
+ */
30
+ getUser(request: GetUserRequest): Promise<GetUserResponse>;
31
+ /**
32
+ * Refresh a user's tokens
33
+ */
34
+ refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
35
+ /**
36
+ * Respond to an auth challenge
37
+ */
38
+ respondToAuthChallenge(request: RespondToAuthChallengeRequest): Promise<any>;
39
+ /**
40
+ * Reset a user's password
41
+ */
42
+ resetPassword(request: SetPasswordRequest): Promise<void>;
43
+ }
44
+ export interface HealthcheckResponse {
45
+ status: string;
46
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
File without changes
File without changes
@@ -35,9 +35,21 @@ let EventHistoryApi = class EventHistoryApi {
35
35
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
36
36
  */
37
37
  async findDirectoryUserEventsByDirectoryId(directoryId, periodDate, index, pageSize) {
38
- const url = `${this.baseUrl}directoryuser/events/search?directoryId=${directoryId}&periodDate=${periodDate}&index=${index}&pageSize=${pageSize}`;
39
- const operationName = "findDirectoryUserEventsByDirectoryId";
40
- return await this.httpRequest.get(`${url}`, null, { 'operationName': operationName });
38
+ const queryParams = [];
39
+ if (directoryId) {
40
+ queryParams.push(`directoryId=${directoryId}`);
41
+ }
42
+ if (periodDate) {
43
+ queryParams.push(`periodDate=${periodDate}`);
44
+ }
45
+ if (pageSize) {
46
+ queryParams.push(`pageSize=${pageSize}`);
47
+ }
48
+ if (index) {
49
+ queryParams.push(`index=${index}`);
50
+ }
51
+ const url = `${this.baseUrl}directoryuser/events/search?${queryParams.join('&')}`;
52
+ return await this.httpRequest.get(`${url}`);
41
53
  }
42
54
  /**
43
55
  * Crea un evento de cambio asociado a un Directorio o Usuario.
@@ -60,7 +72,20 @@ let EventHistoryApi = class EventHistoryApi {
60
72
  * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
61
73
  */
62
74
  async findAccountEventsByDirectoryId(directoryId, periodDate, index, pageSize) {
63
- const url = `${this.baseUrl}accounts/events/search?directoryId=${directoryId}&periodDate=${periodDate}&index=${index}&pageSize=${pageSize}`;
75
+ const queryParams = [];
76
+ if (directoryId) {
77
+ queryParams.push(`directoryId=${directoryId}`);
78
+ }
79
+ if (periodDate) {
80
+ queryParams.push(`periodDate=${periodDate}`);
81
+ }
82
+ if (pageSize) {
83
+ queryParams.push(`pageSize=${pageSize}`);
84
+ }
85
+ if (index) {
86
+ queryParams.push(`index=${index}`);
87
+ }
88
+ const url = `${this.baseUrl}accounts/events/search?${queryParams.join('&')}`;
64
89
  return await this.httpRequest.get(`${url}`);
65
90
  }
66
91
  /**
package/bin/index.d.ts CHANGED
@@ -53,3 +53,4 @@ export * from "./onboarding-business";
53
53
  export * from "./payroll-business";
54
54
  export * from "./referral-business";
55
55
  export * from "./event-history-business";
56
+ export * from "./report-processor-business";
package/bin/index.js CHANGED
@@ -69,3 +69,4 @@ __exportStar(require("./onboarding-business"), exports);
69
69
  __exportStar(require("./payroll-business"), exports);
70
70
  __exportStar(require("./referral-business"), exports);
71
71
  __exportStar(require("./event-history-business"), exports);
72
+ __exportStar(require("./report-processor-business"), exports);
@@ -0,0 +1,3 @@
1
+ export interface IReportProcessorBusiness {
2
+ processReports(key: string): Promise<void>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ export default class ReportProcessorBusinessApi {
3
+ private httpRequest;
4
+ private readonly baseUrl;
5
+ constructor(httpRequest: IHttpRequest);
6
+ processReports(key: string): Promise<{
7
+ url: string;
8
+ expiresInSeconds: number;
9
+ }>;
10
+ }
@@ -0,0 +1,31 @@
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 ReportProcessorBusinessApi = class ReportProcessorBusinessApi {
17
+ constructor(httpRequest) {
18
+ this.httpRequest = httpRequest;
19
+ this.baseUrl = process.env.REPORT_PROCESSOR_LAMBDA_URL || "";
20
+ }
21
+ async processReports(key) {
22
+ const url = `${this.baseUrl}/report-link?key=${key}`;
23
+ return await this.httpRequest.get(url);
24
+ }
25
+ };
26
+ ReportProcessorBusinessApi = __decorate([
27
+ (0, inversify_1.injectable)(),
28
+ __param(0, (0, inversify_1.inject)("IHttpRequest")),
29
+ __metadata("design:paramtypes", [Object])
30
+ ], ReportProcessorBusinessApi);
31
+ exports.default = ReportProcessorBusinessApi;
@@ -0,0 +1,2 @@
1
+ export * from './api/ReportProcessorBusinessApi';
2
+ export * from './api/IReportProcessorBusiness';
@@ -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("./api/ReportProcessorBusinessApi"), exports);
18
+ __exportStar(require("./api/IReportProcessorBusiness"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.5.18",
3
+ "version": "1.5.20",
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",
@@ -27,9 +27,26 @@ export class EventHistoryApi implements IEventHistoryApi {
27
27
  */
28
28
  public async findDirectoryUserEventsByDirectoryId(directoryId: string, periodDate: string, index: string, pageSize: number): Promise<any> {
29
29
 
30
- const url = `${this.baseUrl}directoryuser/events/search?directoryId=${directoryId}&periodDate=${periodDate}&index=${index}&pageSize=${pageSize}`;
31
- const operationName = "findDirectoryUserEventsByDirectoryId";
32
- return await this.httpRequest.get(`${url}`, null, { 'operationName': operationName });
30
+ const queryParams = []
31
+
32
+ if (directoryId) {
33
+ queryParams.push(`directoryId=${directoryId}`)
34
+ }
35
+
36
+ if (periodDate) {
37
+ queryParams.push(`periodDate=${periodDate}`)
38
+ }
39
+
40
+ if (pageSize) {
41
+ queryParams.push(`pageSize=${pageSize}`)
42
+ }
43
+
44
+ if (index) {
45
+ queryParams.push(`index=${index}`)
46
+ }
47
+
48
+ const url = `${this.baseUrl}directoryuser/events/search?${queryParams.join('&')}`;
49
+ return await this.httpRequest.get(`${url}`);
33
50
  }
34
51
 
35
52
  /**
@@ -56,8 +73,26 @@ export class EventHistoryApi implements IEventHistoryApi {
56
73
  */
57
74
  public async findAccountEventsByDirectoryId(directoryId: string, periodDate: string, index: string, pageSize: number): Promise<any> {
58
75
 
59
- const url = `${this.baseUrl}accounts/events/search?directoryId=${directoryId}&periodDate=${periodDate}&index=${index}&pageSize=${pageSize}`;
60
- return await this.httpRequest.get(`${url}`);
76
+ const queryParams = []
77
+
78
+ if (directoryId) {
79
+ queryParams.push(`directoryId=${directoryId}`)
80
+ }
81
+
82
+ if (periodDate) {
83
+ queryParams.push(`periodDate=${periodDate}`)
84
+ }
85
+
86
+ if (pageSize) {
87
+ queryParams.push(`pageSize=${pageSize}`)
88
+ }
89
+
90
+ if (index) {
91
+ queryParams.push(`index=${index}`)
92
+ }
93
+
94
+ const url = `${this.baseUrl}accounts/events/search?${queryParams.join('&')}`;
95
+ return await this.httpRequest.get(`${url}`);
61
96
  }
62
97
 
63
98
  /**
package/src/index.ts CHANGED
@@ -52,4 +52,5 @@ export * from "./onboarding";
52
52
  export * from "./onboarding-business";
53
53
  export * from "./payroll-business";
54
54
  export * from "./referral-business";
55
- export * from "./event-history-business";
55
+ export * from "./event-history-business";
56
+ export * from "./report-processor-business";
@@ -0,0 +1,5 @@
1
+
2
+
3
+ export interface IReportProcessorBusiness {
4
+ processReports(key: string): Promise<void>;
5
+ }
@@ -0,0 +1,17 @@
1
+ import { IHttpRequest } from "@fiado/http-client";
2
+ import { inject, injectable } from "inversify";
3
+
4
+ @injectable()
5
+ export default class ReportProcessorBusinessApi {
6
+
7
+ private readonly baseUrl = process.env.REPORT_PROCESSOR_LAMBDA_URL || "";
8
+
9
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
10
+ }
11
+ async processReports(key: string): Promise<{ url: string, expiresInSeconds: number }> {
12
+
13
+ const url = `${this.baseUrl}/report-link?key=${key}`;
14
+
15
+ return await this.httpRequest.get<{ url: string, expiresInSeconds: number }>(url);
16
+ }
17
+ }
@@ -0,0 +1,5 @@
1
+
2
+
3
+ export * from './api/ReportProcessorBusinessApi';
4
+ export * from './api/IReportProcessorBusiness';
5
+