@fiado/api-invoker 4.20.2 → 4.22.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 +2 -1
- package/bin/complaint/ComplaintApi.js +4 -0
- package/bin/complaint/interfaces/IComplaintApi.d.ts +3 -1
- 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 +6 -0
- package/src/complaint/interfaces/IComplaintApi.ts +4 -0
- package/src/platformRbac/api/PlatformRbacBusinessApi.ts +9 -1
- package/src/platformRbac/api/interfaces/IPlatformRbacBusinessApi.ts +4 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { ResponseOptions } from "@fiado/gateway-adapter";
|
|
3
|
-
import { CreateComplaintRequest, CreateComplaintResponse, ComplaintResponse } from "@fiado/type-kit/bin/complaint/index.js";
|
|
3
|
+
import { CreateComplaintRequest, CreateComplaintResponse, ComplaintResponse, UpdateComplaintStatusRequest } from "@fiado/type-kit/bin/complaint/index.js";
|
|
4
4
|
import { IComplaintApi } from "./interfaces/IComplaintApi.js";
|
|
5
5
|
export declare class ComplaintApi implements IComplaintApi {
|
|
6
6
|
private httpRequest;
|
|
@@ -8,4 +8,5 @@ export declare class ComplaintApi implements IComplaintApi {
|
|
|
8
8
|
constructor(httpRequest: IHttpRequest);
|
|
9
9
|
createComplaint(request: CreateComplaintRequest): Promise<ResponseOptions<CreateComplaintResponse>>;
|
|
10
10
|
getComplaint(complaintId: string): Promise<ResponseOptions<ComplaintResponse>>;
|
|
11
|
+
updateComplaintStatus(complaintId: string, request: UpdateComplaintStatusRequest): Promise<ResponseOptions<ComplaintResponse>>;
|
|
11
12
|
}
|
|
@@ -25,6 +25,10 @@ let ComplaintApi = class ComplaintApi {
|
|
|
25
25
|
const url = `${this.baseUrl}complaints/${complaintId}`;
|
|
26
26
|
return await this.httpRequest.get(url);
|
|
27
27
|
}
|
|
28
|
+
async updateComplaintStatus(complaintId, request) {
|
|
29
|
+
const url = `${this.baseUrl}complaints/${complaintId}/status`;
|
|
30
|
+
return await this.httpRequest.post(url, request);
|
|
31
|
+
}
|
|
28
32
|
};
|
|
29
33
|
ComplaintApi = __decorate([
|
|
30
34
|
injectable(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResponseOptions } from "@fiado/gateway-adapter";
|
|
2
|
-
import { CreateComplaintRequest, CreateComplaintResponse, ComplaintResponse } from "@fiado/type-kit/bin/complaint/index.js";
|
|
2
|
+
import { CreateComplaintRequest, CreateComplaintResponse, ComplaintResponse, UpdateComplaintStatusRequest } from "@fiado/type-kit/bin/complaint/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Cliente del buzón anónimo de denuncias (`complaint-mailbox-business`, BO-19).
|
|
5
5
|
* URL base en `COMPLAINT_MAILBOX_LAMBDA_URL` (API Gateway privado VPC-only).
|
|
@@ -9,4 +9,6 @@ export interface IComplaintApi {
|
|
|
9
9
|
createComplaint(request: CreateComplaintRequest): Promise<ResponseOptions<CreateComplaintResponse>>;
|
|
10
10
|
/** Lee una denuncia (sin exponer la identidad del denunciante). `GET /complaints/{complaintId}` */
|
|
11
11
|
getComplaint(complaintId: string): Promise<ResponseOptions<ComplaintResponse>>;
|
|
12
|
+
/** Sincroniza el dictamen del OC (hook BO-19b). `POST /complaints/{complaintId}/status` */
|
|
13
|
+
updateComplaintStatus(complaintId: string, request: UpdateComplaintStatusRequest): Promise<ResponseOptions<ComplaintResponse>>;
|
|
12
14
|
}
|
|
@@ -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.22.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.81.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
CreateComplaintRequest,
|
|
6
6
|
CreateComplaintResponse,
|
|
7
7
|
ComplaintResponse,
|
|
8
|
+
UpdateComplaintStatusRequest,
|
|
8
9
|
} from "@fiado/type-kit/bin/complaint/index.js";
|
|
9
10
|
import { IComplaintApi } from "./interfaces/IComplaintApi.js";
|
|
10
11
|
|
|
@@ -24,4 +25,9 @@ export class ComplaintApi implements IComplaintApi {
|
|
|
24
25
|
const url = `${this.baseUrl}complaints/${complaintId}`;
|
|
25
26
|
return await this.httpRequest.get(url);
|
|
26
27
|
}
|
|
28
|
+
|
|
29
|
+
async updateComplaintStatus(complaintId: string, request: UpdateComplaintStatusRequest): Promise<ResponseOptions<ComplaintResponse>> {
|
|
30
|
+
const url = `${this.baseUrl}complaints/${complaintId}/status`;
|
|
31
|
+
return await this.httpRequest.post(url, request);
|
|
32
|
+
}
|
|
27
33
|
}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
CreateComplaintRequest,
|
|
4
4
|
CreateComplaintResponse,
|
|
5
5
|
ComplaintResponse,
|
|
6
|
+
UpdateComplaintStatusRequest,
|
|
6
7
|
} from "@fiado/type-kit/bin/complaint/index.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -15,4 +16,7 @@ export interface IComplaintApi {
|
|
|
15
16
|
|
|
16
17
|
/** Lee una denuncia (sin exponer la identidad del denunciante). `GET /complaints/{complaintId}` */
|
|
17
18
|
getComplaint(complaintId: string): Promise<ResponseOptions<ComplaintResponse>>;
|
|
19
|
+
|
|
20
|
+
/** Sincroniza el dictamen del OC (hook BO-19b). `POST /complaints/{complaintId}/status` */
|
|
21
|
+
updateComplaintStatus(complaintId: string, request: UpdateComplaintStatusRequest): Promise<ResponseOptions<ComplaintResponse>>;
|
|
18
22
|
}
|
|
@@ -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
|
}
|