@fiado/api-invoker 4.20.1 → 4.21.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/complaint/ComplaintApi.d.ts +11 -0
- package/bin/complaint/ComplaintApi.js +34 -0
- package/bin/complaint/index.d.ts +2 -0
- package/bin/complaint/index.js +2 -0
- package/bin/complaint/interfaces/IComplaintApi.d.ts +12 -0
- package/bin/complaint/interfaces/IComplaintApi.js +1 -0
- package/bin/container.config.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/platformRbac/api/PlatformRbacBusinessApi.d.ts +1 -1
- package/bin/platformRbac/api/PlatformRbacBusinessApi.js +9 -2
- package/bin/platformRbac/api/interfaces/IPlatformRbacBusinessApi.d.ts +4 -1
- package/package.json +2 -2
- package/src/complaint/ComplaintApi.ts +27 -0
- package/src/complaint/index.ts +2 -0
- package/src/complaint/interfaces/IComplaintApi.ts +18 -0
- package/src/container.config.ts +2 -0
- package/src/index.ts +1 -0
- package/src/platformRbac/api/PlatformRbacBusinessApi.ts +9 -1
- package/src/platformRbac/api/interfaces/IPlatformRbacBusinessApi.ts +4 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { ResponseOptions } from "@fiado/gateway-adapter";
|
|
3
|
+
import { CreateComplaintRequest, CreateComplaintResponse, ComplaintResponse } from "@fiado/type-kit/bin/complaint/index.js";
|
|
4
|
+
import { IComplaintApi } from "./interfaces/IComplaintApi.js";
|
|
5
|
+
export declare class ComplaintApi implements IComplaintApi {
|
|
6
|
+
private httpRequest;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(httpRequest: IHttpRequest);
|
|
9
|
+
createComplaint(request: CreateComplaintRequest): Promise<ResponseOptions<CreateComplaintResponse>>;
|
|
10
|
+
getComplaint(complaintId: string): Promise<ResponseOptions<ComplaintResponse>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 ComplaintApi = class ComplaintApi {
|
|
15
|
+
httpRequest;
|
|
16
|
+
baseUrl = process.env.COMPLAINT_MAILBOX_LAMBDA_URL || "";
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
}
|
|
20
|
+
async createComplaint(request) {
|
|
21
|
+
const url = `${this.baseUrl}backoffice/create`;
|
|
22
|
+
return await this.httpRequest.post(url, request);
|
|
23
|
+
}
|
|
24
|
+
async getComplaint(complaintId) {
|
|
25
|
+
const url = `${this.baseUrl}complaints/${complaintId}`;
|
|
26
|
+
return await this.httpRequest.get(url);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
ComplaintApi = __decorate([
|
|
30
|
+
injectable(),
|
|
31
|
+
__param(0, inject("IHttpRequest")),
|
|
32
|
+
__metadata("design:paramtypes", [Object])
|
|
33
|
+
], ComplaintApi);
|
|
34
|
+
export { ComplaintApi };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResponseOptions } from "@fiado/gateway-adapter";
|
|
2
|
+
import { CreateComplaintRequest, CreateComplaintResponse, ComplaintResponse } from "@fiado/type-kit/bin/complaint/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Cliente del buzón anónimo de denuncias (`complaint-mailbox-business`, BO-19).
|
|
5
|
+
* URL base en `COMPLAINT_MAILBOX_LAMBDA_URL` (API Gateway privado VPC-only).
|
|
6
|
+
*/
|
|
7
|
+
export interface IComplaintApi {
|
|
8
|
+
/** Crea una denuncia. `POST /backoffice/create` */
|
|
9
|
+
createComplaint(request: CreateComplaintRequest): Promise<ResponseOptions<CreateComplaintResponse>>;
|
|
10
|
+
/** Lee una denuncia (sin exponer la identidad del denunciante). `GET /complaints/{complaintId}` */
|
|
11
|
+
getComplaint(complaintId: string): Promise<ResponseOptions<ComplaintResponse>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/bin/container.config.js
CHANGED
|
@@ -41,6 +41,7 @@ import CnbvApi from "./cnbv-business/CnbvApi.js";
|
|
|
41
41
|
import TransactionApi from "./transaction/api/TransactionApi.js";
|
|
42
42
|
import { PomeloProcessorApi } from "./pomeloProcessor/index.js";
|
|
43
43
|
import { DisputesApi } from "./disputes/index.js";
|
|
44
|
+
import { ComplaintApi } from "./complaint/index.js";
|
|
44
45
|
import TransactionAlertApi from "./riskProfile/api/TransactionAlertApi.js";
|
|
45
46
|
import { DirectoriesApi } from "./directories/index.js";
|
|
46
47
|
import CognitoConnectorApi from "./cognitoConnector/CognitoConnectorApi.js";
|
|
@@ -152,6 +153,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
152
153
|
bind("ICnbvApi").to(CnbvApi);
|
|
153
154
|
bind("IPomeloProcessorApi").to(PomeloProcessorApi);
|
|
154
155
|
bind("IDisputesApi").to(DisputesApi);
|
|
156
|
+
bind("IComplaintApi").to(ComplaintApi);
|
|
155
157
|
bind("ITransactionAlertApi").to(TransactionAlertApi);
|
|
156
158
|
bind("IDirectoriesApi").to(DirectoriesApi);
|
|
157
159
|
bind("ICognitoConnectorApi").to(CognitoConnectorApi);
|
package/bin/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export * from "./fiadoMessages/index.js";
|
|
|
34
34
|
export * from "./cnbv-business/index.js";
|
|
35
35
|
export * from "./pomeloProcessor/index.js";
|
|
36
36
|
export * from "./disputes/index.js";
|
|
37
|
+
export * from "./complaint/index.js";
|
|
37
38
|
export * from "./directories/index.js";
|
|
38
39
|
export * from "./cognitoConnector/index.js";
|
|
39
40
|
export * from "./centralPayments/index.js";
|
package/bin/index.js
CHANGED
|
@@ -34,6 +34,7 @@ export * from "./fiadoMessages/index.js";
|
|
|
34
34
|
export * from "./cnbv-business/index.js";
|
|
35
35
|
export * from "./pomeloProcessor/index.js";
|
|
36
36
|
export * from "./disputes/index.js";
|
|
37
|
+
export * from "./complaint/index.js";
|
|
37
38
|
export * from "./directories/index.js";
|
|
38
39
|
export * from "./cognitoConnector/index.js";
|
|
39
40
|
export * from "./centralPayments/index.js";
|
|
@@ -24,5 +24,5 @@ export default class PlatformRbacBusinessApi implements IPlatformRbacBusinessApi
|
|
|
24
24
|
prepareChallenge(input: PrepareChallengeRequest): Promise<ApiGatewayResponse<PrepareChallengeResponse>>;
|
|
25
25
|
verifyChallenge(input: VerifyChallengeRequest): Promise<ApiGatewayResponse<VerifyChallengeResponse>>;
|
|
26
26
|
authorize(input: AuthorizeRequest): Promise<ApiGatewayResponse<AuthorizeResponse>>;
|
|
27
|
-
effectivePermissions(cognitoSub: string): Promise<ApiGatewayResponse<EffectivePermissionsResponse>>;
|
|
27
|
+
effectivePermissions(cognitoSub: string, tenantId?: string): Promise<ApiGatewayResponse<EffectivePermissionsResponse>>;
|
|
28
28
|
}
|
|
@@ -47,8 +47,15 @@ let PlatformRbacBusinessApi = class PlatformRbacBusinessApi {
|
|
|
47
47
|
const url = `${this.baseUrl}/internal/authorize`;
|
|
48
48
|
return await this.httpRequest.post(url, input);
|
|
49
49
|
}
|
|
50
|
-
async effectivePermissions(cognitoSub) {
|
|
51
|
-
const
|
|
50
|
+
async effectivePermissions(cognitoSub, tenantId) {
|
|
51
|
+
const base = `${this.baseUrl}/internal/users/${encodeURIComponent(cognitoSub)}/effective-permissions`;
|
|
52
|
+
// El tenantId es opcional: los usuarios de plataforma resuelven por el silo PlatformUser
|
|
53
|
+
// sin él, pero los usuarios de un tenant LO NECESITAN para que el rbac sepa en qué silo
|
|
54
|
+
// buscarlos (sin él, el resolve cae a la rama platform y devuelve 404). Lo manda el
|
|
55
|
+
// jwt-inyector con el tenantId que ya resolvió del userPoolId.
|
|
56
|
+
const url = tenantId
|
|
57
|
+
? `${base}?tenantId=${encodeURIComponent(tenantId)}`
|
|
58
|
+
: base;
|
|
52
59
|
return await this.httpRequest.get(url);
|
|
53
60
|
}
|
|
54
61
|
};
|
|
@@ -50,6 +50,9 @@ export interface IPlatformRbacBusinessApi {
|
|
|
50
50
|
* efectivos (más epoch y role assignments) de un usuario. Invocado por el
|
|
51
51
|
* `jwt-inyector-trigger` al emitir el token para embeber el bitset RBAC.
|
|
52
52
|
* El `cognitoSub` va en el path param (encodeURIComponent en el publisher).
|
|
53
|
+
* `tenantId` es opcional y va como query param `?tenantId=`: los usuarios de
|
|
54
|
+
* plataforma resuelven sin él, pero los de un tenant LO NECESITAN para que el
|
|
55
|
+
* rbac identifique el silo (sin él, el resolve cae a la rama platform → 404).
|
|
53
56
|
*/
|
|
54
|
-
effectivePermissions(cognitoSub: string): Promise<ApiGatewayResponse<EffectivePermissionsResponse>>;
|
|
57
|
+
effectivePermissions(cognitoSub: string, tenantId?: string): Promise<ApiGatewayResponse<EffectivePermissionsResponse>>;
|
|
55
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.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": "^2.0.2",
|
|
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.77.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { ResponseOptions } from "@fiado/gateway-adapter";
|
|
4
|
+
import {
|
|
5
|
+
CreateComplaintRequest,
|
|
6
|
+
CreateComplaintResponse,
|
|
7
|
+
ComplaintResponse,
|
|
8
|
+
} from "@fiado/type-kit/bin/complaint/index.js";
|
|
9
|
+
import { IComplaintApi } from "./interfaces/IComplaintApi.js";
|
|
10
|
+
|
|
11
|
+
@injectable()
|
|
12
|
+
export class ComplaintApi implements IComplaintApi {
|
|
13
|
+
|
|
14
|
+
private readonly baseUrl = process.env.COMPLAINT_MAILBOX_LAMBDA_URL || "";
|
|
15
|
+
|
|
16
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
|
|
17
|
+
|
|
18
|
+
async createComplaint(request: CreateComplaintRequest): Promise<ResponseOptions<CreateComplaintResponse>> {
|
|
19
|
+
const url = `${this.baseUrl}backoffice/create`;
|
|
20
|
+
return await this.httpRequest.post(url, request);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async getComplaint(complaintId: string): Promise<ResponseOptions<ComplaintResponse>> {
|
|
24
|
+
const url = `${this.baseUrl}complaints/${complaintId}`;
|
|
25
|
+
return await this.httpRequest.get(url);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ResponseOptions } from "@fiado/gateway-adapter";
|
|
2
|
+
import {
|
|
3
|
+
CreateComplaintRequest,
|
|
4
|
+
CreateComplaintResponse,
|
|
5
|
+
ComplaintResponse,
|
|
6
|
+
} from "@fiado/type-kit/bin/complaint/index.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Cliente del buzón anónimo de denuncias (`complaint-mailbox-business`, BO-19).
|
|
10
|
+
* URL base en `COMPLAINT_MAILBOX_LAMBDA_URL` (API Gateway privado VPC-only).
|
|
11
|
+
*/
|
|
12
|
+
export interface IComplaintApi {
|
|
13
|
+
/** Crea una denuncia. `POST /backoffice/create` */
|
|
14
|
+
createComplaint(request: CreateComplaintRequest): Promise<ResponseOptions<CreateComplaintResponse>>;
|
|
15
|
+
|
|
16
|
+
/** Lee una denuncia (sin exponer la identidad del denunciante). `GET /complaints/{complaintId}` */
|
|
17
|
+
getComplaint(complaintId: string): Promise<ResponseOptions<ComplaintResponse>>;
|
|
18
|
+
}
|
package/src/container.config.ts
CHANGED
|
@@ -65,6 +65,7 @@ import { ICnbvApi } from "./cnbv-business/index.js";
|
|
|
65
65
|
import TransactionApi from "./transaction/api/TransactionApi.js";
|
|
66
66
|
import { IPomeloProcessorApi, PomeloProcessorApi } from "./pomeloProcessor/index.js";
|
|
67
67
|
import { DisputesApi, IDisputesApi } from "./disputes/index.js";
|
|
68
|
+
import { ComplaintApi, IComplaintApi } from "./complaint/index.js";
|
|
68
69
|
import TransactionAlertApi from "./riskProfile/api/TransactionAlertApi.js";
|
|
69
70
|
import { DirectoriesApi, IDirectoriesApi } from "./directories/index.js";
|
|
70
71
|
import { ICognitoConnectorApi, ICognitoV2Api } from "./cognitoConnector/index.js";
|
|
@@ -213,6 +214,7 @@ export const apiInvokerBindings = new ContainerModule(({ bind }) => {
|
|
|
213
214
|
bind<ICnbvApi>("ICnbvApi").to(CnbvApi);
|
|
214
215
|
bind<IPomeloProcessorApi>("IPomeloProcessorApi").to(PomeloProcessorApi);
|
|
215
216
|
bind<IDisputesApi>("IDisputesApi").to(DisputesApi);
|
|
217
|
+
bind<IComplaintApi>("IComplaintApi").to(ComplaintApi);
|
|
216
218
|
bind<ITransactionAlertApi>("ITransactionAlertApi").to(TransactionAlertApi);
|
|
217
219
|
bind<IDirectoriesApi>("IDirectoriesApi").to(DirectoriesApi);
|
|
218
220
|
bind<ICognitoConnectorApi>("ICognitoConnectorApi").to(CognitoConnectorApi);
|
package/src/index.ts
CHANGED
|
@@ -34,6 +34,7 @@ export * from "./fiadoMessages/index.js";
|
|
|
34
34
|
export * from "./cnbv-business/index.js";
|
|
35
35
|
export * from "./pomeloProcessor/index.js";
|
|
36
36
|
export * from "./disputes/index.js";
|
|
37
|
+
export * from "./complaint/index.js";
|
|
37
38
|
export * from "./directories/index.js";
|
|
38
39
|
export * from "./cognitoConnector/index.js";
|
|
39
40
|
export * from "./centralPayments/index.js";
|
|
@@ -65,8 +65,16 @@ export default class PlatformRbacBusinessApi implements IPlatformRbacBusinessApi
|
|
|
65
65
|
|
|
66
66
|
async effectivePermissions(
|
|
67
67
|
cognitoSub: string,
|
|
68
|
+
tenantId?: string,
|
|
68
69
|
): Promise<ApiGatewayResponse<EffectivePermissionsResponse>> {
|
|
69
|
-
const
|
|
70
|
+
const base = `${this.baseUrl}/internal/users/${encodeURIComponent(cognitoSub)}/effective-permissions`;
|
|
71
|
+
// El tenantId es opcional: los usuarios de plataforma resuelven por el silo PlatformUser
|
|
72
|
+
// sin él, pero los usuarios de un tenant LO NECESITAN para que el rbac sepa en qué silo
|
|
73
|
+
// buscarlos (sin él, el resolve cae a la rama platform y devuelve 404). Lo manda el
|
|
74
|
+
// jwt-inyector con el tenantId que ya resolvió del userPoolId.
|
|
75
|
+
const url = tenantId
|
|
76
|
+
? `${base}?tenantId=${encodeURIComponent(tenantId)}`
|
|
77
|
+
: base;
|
|
70
78
|
return await this.httpRequest.get(url);
|
|
71
79
|
}
|
|
72
80
|
}
|
|
@@ -73,8 +73,12 @@ export interface IPlatformRbacBusinessApi {
|
|
|
73
73
|
* efectivos (más epoch y role assignments) de un usuario. Invocado por el
|
|
74
74
|
* `jwt-inyector-trigger` al emitir el token para embeber el bitset RBAC.
|
|
75
75
|
* El `cognitoSub` va en el path param (encodeURIComponent en el publisher).
|
|
76
|
+
* `tenantId` es opcional y va como query param `?tenantId=`: los usuarios de
|
|
77
|
+
* plataforma resuelven sin él, pero los de un tenant LO NECESITAN para que el
|
|
78
|
+
* rbac identifique el silo (sin él, el resolve cae a la rama platform → 404).
|
|
76
79
|
*/
|
|
77
80
|
effectivePermissions(
|
|
78
81
|
cognitoSub: string,
|
|
82
|
+
tenantId?: string,
|
|
79
83
|
): Promise<ApiGatewayResponse<EffectivePermissionsResponse>>;
|
|
80
84
|
}
|