@fiado/api-invoker 5.105.0 → 5.107.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/address/AddressApi.d.ts +3 -1
- package/bin/address/AddressApi.js +7 -0
- package/bin/address/interfaces/IAddressApi.d.ts +2 -0
- package/bin/authentication/AuthenticationApi.d.ts +2 -0
- package/bin/authentication/AuthenticationApi.js +7 -0
- package/bin/authentication/interfaces/IAuthenticationApi.d.ts +2 -0
- package/bin/cognitoBackofficeConnector/api/CognitoBackofficeConnectorApi.d.ts +2 -1
- package/bin/cognitoBackofficeConnector/api/CognitoBackofficeConnectorApi.js +4 -0
- package/bin/cognitoBackofficeConnector/api/interfaces/ICognitoBackofficeConnectorApi.d.ts +3 -1
- package/bin/onboarding/api/OnboardingApi.d.ts +2 -0
- package/bin/onboarding/api/OnboardingApi.js +7 -0
- package/bin/onboarding/api/interfaces/IOnboardingApi.d.ts +2 -0
- package/bin/platformRbac/resolver/ApiInvokerPermissionResolver.d.ts +2 -14
- package/bin/platformRbac/resolver/ApiInvokerPermissionResolver.js +3 -24
- package/bin/riskProfile/api/RiskProfileApi.d.ts +3 -1
- package/bin/riskProfile/api/RiskProfileApi.js +7 -0
- package/bin/riskProfile/api/interfaces/IRiskProfileApi.d.ts +2 -0
- package/package.json +2 -2
- package/src/address/AddressApi.ts +9 -2
- package/src/address/interfaces/IAddressApi.ts +3 -0
- package/src/authentication/AuthenticationApi.ts +7 -0
- package/src/authentication/interfaces/IAuthenticationApi.ts +4 -0
- package/src/cognitoBackofficeConnector/api/CognitoBackofficeConnectorApi.ts +10 -0
- package/src/cognitoBackofficeConnector/api/interfaces/ICognitoBackofficeConnectorApi.ts +5 -0
- package/src/onboarding/api/OnboardingApi.ts +7 -0
- package/src/onboarding/api/interfaces/IOnboardingApi.ts +4 -0
- package/src/platformRbac/resolver/ApiInvokerPermissionResolver.ts +4 -25
- package/src/riskProfile/api/RiskProfileApi.ts +8 -2
- package/src/riskProfile/api/interfaces/IRiskProfileApi.ts +4 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { AddressCreateRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address/index.js";
|
|
3
3
|
import { IAddressApi } from "./interfaces/IAddressApi.js";
|
|
4
4
|
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
@@ -14,5 +14,7 @@ export declare class AddressApi implements IAddressApi {
|
|
|
14
14
|
}>>;
|
|
15
15
|
private validateBaseUrl;
|
|
16
16
|
private validateDirectoryId;
|
|
17
|
+
/** Direcciones por lote (GET users?directoryId=...). Lo usa la actividad diaria del backoffice (helpNeeded). */
|
|
18
|
+
getByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
17
19
|
}
|
|
18
20
|
export {};
|
|
@@ -48,6 +48,13 @@ let AddressApi = class AddressApi {
|
|
|
48
48
|
throw new Error("Directory ID is required.");
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
/** Direcciones por lote (GET users?directoryId=...). Lo usa la actividad diaria del backoffice (helpNeeded). */
|
|
52
|
+
async getByDirectoryIds(directoryIds) {
|
|
53
|
+
if (directoryIds.length === 0)
|
|
54
|
+
return Promise.resolve({ code: "PROCESS_OK", data: [] });
|
|
55
|
+
const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
|
|
56
|
+
return await this.httpRequest.get(`${this.baseUrl}users?${query}`);
|
|
57
|
+
}
|
|
51
58
|
};
|
|
52
59
|
AddressApi = __decorate([
|
|
53
60
|
injectable(),
|
|
@@ -32,5 +32,7 @@ export interface IAddressApi {
|
|
|
32
32
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
33
33
|
deletedCount: number;
|
|
34
34
|
}>>;
|
|
35
|
+
/** Direcciones por lote (envelope con data: dirección[] con directoryId y helpNeeded). */
|
|
36
|
+
getByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
35
37
|
}
|
|
36
38
|
export {};
|
|
@@ -11,4 +11,6 @@ export declare class AuthenticationApi implements IAuthenticationApi {
|
|
|
11
11
|
agentSignInStatus(input: AgentSignInStatusInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
12
12
|
agentSignUpProspect(input: AgentSignUpProspectInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
13
13
|
agentGetSignUpByPhone(phoneNumber: string): Promise<LegacyApiResponse<unknown>>;
|
|
14
|
+
/** Sesiones de autenticación por lote (op getSessionsByDirectoryIds). Lo usa la actividad diaria del backoffice. */
|
|
15
|
+
getSessionsByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
14
16
|
}
|
|
@@ -49,6 +49,13 @@ let AuthenticationApi = class AuthenticationApi {
|
|
|
49
49
|
const operation = "agentGetSignUpByPhoneNumber";
|
|
50
50
|
return await this.httpRequest.post(url, { pathParameters: { phoneNumber } }, { 'operationName': operation });
|
|
51
51
|
}
|
|
52
|
+
/** Sesiones de autenticación por lote (op getSessionsByDirectoryIds). Lo usa la actividad diaria del backoffice. */
|
|
53
|
+
async getSessionsByDirectoryIds(directoryIds) {
|
|
54
|
+
if (directoryIds.length === 0)
|
|
55
|
+
return Promise.resolve({ code: "PROCESS_OK", data: [] });
|
|
56
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
57
|
+
return await this.httpRequest.post(url, { directoryIds }, { 'operationName': 'getSessionsByDirectoryIds' });
|
|
58
|
+
}
|
|
52
59
|
};
|
|
53
60
|
AuthenticationApi = __decorate([
|
|
54
61
|
injectable(),
|
|
@@ -27,4 +27,6 @@ export interface IAuthenticationApi {
|
|
|
27
27
|
agentSignInStatus(input: AgentSignInStatusInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
28
28
|
agentSignUpProspect(input: AgentSignUpProspectInput, actorEmail: string): Promise<LegacyApiResponse<unknown>>;
|
|
29
29
|
agentGetSignUpByPhone(phoneNumber: string): Promise<LegacyApiResponse<unknown>>;
|
|
30
|
+
/** Sesiones por lote (envelope con data: sesión[] con directoryId). */
|
|
31
|
+
getSessionsByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
30
32
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { CreateUserRequest, CreateUserResponse, UpdateUserAttributesRequest, UserActionRequest, ResendInvitationRequest, SetUserPasswordRequest, UserDetailResponse, AuthEventsRequest, AuthEventResponse, InitiateAuthRequest, InitiateAuthResponse, RespondToChallengeRequest, RespondToChallengeResponse, RefreshTokensRequest, RefreshTokensResponse, ForgotPasswordRequest, ConfirmForgotPasswordRequest, ResendConfirmationRequest, ChangePasswordRequest, TotpBeginRequest, TotpBeginResponse, TotpVerifyRequest, MfaVerifyResponse, SetMfaPreferenceRequest, MfaResetRequest, UpdateEmailRequest, VerifyEmailRequest, UpdateProfileRequest, CreatePoolRequest, CreatePoolResponse, HealthcheckResponse, VerifyPasswordRequest, VerifyPasswordResponse, IntrospectRequest, IntrospectResponse } from "@fiado/type-kit/bin/cognitoBackofficeConnector/index.js";
|
|
3
|
+
import { CreateUserRequest, CreateUserResponse, UpdateUserAttributesRequest, UserActionRequest, ResendInvitationRequest, SetUserPasswordRequest, UserDetailResponse, AuthEventsRequest, AuthEventResponse, InitiateAuthRequest, InitiateAuthResponse, RespondToChallengeRequest, RespondToChallengeResponse, RefreshTokensRequest, RefreshTokensResponse, ForgotPasswordRequest, ConfirmForgotPasswordRequest, ResendConfirmationRequest, ChangePasswordRequest, TotpBeginRequest, TotpBeginResponse, TotpVerifyRequest, MfaVerifyResponse, SetMfaPreferenceRequest, MfaResetRequest, UpdateEmailRequest, VerifyEmailRequest, UpdateProfileRequest, CreatePoolRequest, CreatePoolResponse, CreatePoolClientRequest, CreatePoolClientResponse, HealthcheckResponse, VerifyPasswordRequest, VerifyPasswordResponse, IntrospectRequest, IntrospectResponse } from "@fiado/type-kit/bin/cognitoBackofficeConnector/index.js";
|
|
4
4
|
import { ICognitoBackofficeConnectorApi } from "./interfaces/ICognitoBackofficeConnectorApi.js";
|
|
5
5
|
/**
|
|
6
6
|
* Publisher HTTP del lambda `cognito-backoffice-connector` (componente 05 SureKeep Fase 0).
|
|
@@ -52,6 +52,7 @@ export default class CognitoBackofficeConnectorApi implements ICognitoBackoffice
|
|
|
52
52
|
updateProfile(input: UpdateProfileRequest): Promise<ApiGatewayResponse<void>>;
|
|
53
53
|
listUserAuthEvents(cognitoSub: string, input: AuthEventsRequest): Promise<ApiGatewayResponse<AuthEventResponse[]>>;
|
|
54
54
|
createPool(input: CreatePoolRequest): Promise<ApiGatewayResponse<CreatePoolResponse>>;
|
|
55
|
+
createPoolClient(userPoolId: string, input: CreatePoolClientRequest): Promise<ApiGatewayResponse<CreatePoolClientResponse>>;
|
|
55
56
|
deletePool(userPoolId: string, region: string): Promise<ApiGatewayResponse<void>>;
|
|
56
57
|
healthcheck(): Promise<ApiGatewayResponse<HealthcheckResponse>>;
|
|
57
58
|
}
|
|
@@ -147,6 +147,10 @@ let CognitoBackofficeConnectorApi = class CognitoBackofficeConnectorApi {
|
|
|
147
147
|
const url = `${this.baseUrl}/pools`;
|
|
148
148
|
return await this.httpRequest.post(url, input);
|
|
149
149
|
}
|
|
150
|
+
async createPoolClient(userPoolId, input) {
|
|
151
|
+
const url = `${this.baseUrl}/pools/${encodeURIComponent(userPoolId)}/clients`;
|
|
152
|
+
return await this.httpRequest.post(url, input);
|
|
153
|
+
}
|
|
150
154
|
async deletePool(userPoolId, region) {
|
|
151
155
|
const url = `${this.baseUrl}/pools/${encodeURIComponent(userPoolId)}`;
|
|
152
156
|
return await this.httpRequest.delete(url, { region });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiGatewayResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { CreateUserRequest, CreateUserResponse, UpdateUserAttributesRequest, UserActionRequest, ResendInvitationRequest, SetUserPasswordRequest, UserDetailResponse, AuthEventsRequest, AuthEventResponse, InitiateAuthRequest, InitiateAuthResponse, RespondToChallengeRequest, RespondToChallengeResponse, RefreshTokensRequest, RefreshTokensResponse, ForgotPasswordRequest, ConfirmForgotPasswordRequest, ResendConfirmationRequest, ChangePasswordRequest, TotpBeginRequest, TotpBeginResponse, TotpVerifyRequest, MfaVerifyResponse, SetMfaPreferenceRequest, MfaResetRequest, UpdateEmailRequest, VerifyEmailRequest, UpdateProfileRequest, CreatePoolRequest, CreatePoolResponse, HealthcheckResponse, VerifyPasswordRequest, VerifyPasswordResponse, IntrospectRequest, IntrospectResponse } from "@fiado/type-kit/bin/cognitoBackofficeConnector/index.js";
|
|
2
|
+
import { CreateUserRequest, CreateUserResponse, UpdateUserAttributesRequest, UserActionRequest, ResendInvitationRequest, SetUserPasswordRequest, UserDetailResponse, AuthEventsRequest, AuthEventResponse, InitiateAuthRequest, InitiateAuthResponse, RespondToChallengeRequest, RespondToChallengeResponse, RefreshTokensRequest, RefreshTokensResponse, ForgotPasswordRequest, ConfirmForgotPasswordRequest, ResendConfirmationRequest, ChangePasswordRequest, TotpBeginRequest, TotpBeginResponse, TotpVerifyRequest, MfaVerifyResponse, SetMfaPreferenceRequest, MfaResetRequest, UpdateEmailRequest, VerifyEmailRequest, UpdateProfileRequest, CreatePoolRequest, CreatePoolResponse, CreatePoolClientRequest, CreatePoolClientResponse, HealthcheckResponse, VerifyPasswordRequest, VerifyPasswordResponse, IntrospectRequest, IntrospectResponse } from "@fiado/type-kit/bin/cognitoBackofficeConnector/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contrato del publisher HTTP del lambda `cognito-backoffice-connector` (componente 05 SureKeep Fase 0).
|
|
5
5
|
*
|
|
@@ -93,6 +93,8 @@ export interface ICognitoBackofficeConnectorApi {
|
|
|
93
93
|
* SetUserPoolMfaConfig + CreateUserPoolClient con cleanup chain observable.
|
|
94
94
|
*/
|
|
95
95
|
createPool(input: CreatePoolRequest): Promise<ApiGatewayResponse<CreatePoolResponse>>;
|
|
96
|
+
/** POST /pools/{userPoolId}/clients — app client extra sobre un pool existente (usuarios de API). */
|
|
97
|
+
createPoolClient(userPoolId: string, input: CreatePoolClientRequest): Promise<ApiGatewayResponse<CreatePoolClientResponse>>;
|
|
96
98
|
/**
|
|
97
99
|
* DELETE /pools/{userPoolId}?region=X — elimina un user pool vacío (pivote
|
|
98
100
|
* v1.4.1 — compensation chain de saga). Requiere pool sin users; si tiene
|
|
@@ -7,4 +7,6 @@ export default class OnboardingApi implements IOnboardingApi {
|
|
|
7
7
|
getByReferralDirectoryId(referralDirectoryId: string): Promise<any>;
|
|
8
8
|
delete(id: string): Promise<any>;
|
|
9
9
|
getOnboardingSteps(directoryId: string, countryId: string): Promise<OnboardingStepsEnvelope>;
|
|
10
|
+
/** Onboardings por lote de fiado-onboarding-lambda (GET ids?directoryId=...). Lo usa la actividad diaria del backoffice. */
|
|
11
|
+
getByIds(directoryIds: string[]): Promise<any>;
|
|
10
12
|
}
|
|
@@ -30,6 +30,13 @@ let OnboardingApi = class OnboardingApi {
|
|
|
30
30
|
directoryId, countryId, typeOfDirectoryId: "USER",
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
/** Onboardings por lote de fiado-onboarding-lambda (GET ids?directoryId=...). Lo usa la actividad diaria del backoffice. */
|
|
34
|
+
async getByIds(directoryIds) {
|
|
35
|
+
if (directoryIds.length === 0)
|
|
36
|
+
return Promise.resolve({ code: "PROCESS_OK", data: [] });
|
|
37
|
+
const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
|
|
38
|
+
return await this.httpRequest.get(`${this.baseUrl}ids?${query}`);
|
|
39
|
+
}
|
|
33
40
|
};
|
|
34
41
|
OnboardingApi = __decorate([
|
|
35
42
|
injectable(),
|
|
@@ -10,4 +10,6 @@ export interface IOnboardingApi {
|
|
|
10
10
|
delete(id: string): Promise<any>;
|
|
11
11
|
getByReferralDirectoryId(referralDirectoryId: string): Promise<any>;
|
|
12
12
|
getOnboardingSteps(directoryId: string, countryId: string): Promise<OnboardingStepsEnvelope>;
|
|
13
|
+
/** Onboardings por lote (envelope con data: onboarding[] con id = directoryId y referralCode). */
|
|
14
|
+
getByIds(directoryIds: string[]): Promise<any>;
|
|
13
15
|
}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import type { ResolveInput, ResolvedPermissions } from "@fiado/gateway-adapter";
|
|
2
2
|
import type { IPlatformRbacBusinessApi } from "../api/interfaces/IPlatformRbacBusinessApi.js";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* tipado (HTTP sobre VpcEndpoint), reemplazando la lectura directa de DDB. Cachea la rama fallback;
|
|
6
|
-
* la rama token-trust NO se cachea (paridad con DdbPermissionResolver, evita poisoning).
|
|
7
|
-
* Cache key = `${issuer}#${cognitoSub}` (decisión consciente: el cliente no conoce el tenantId antes
|
|
8
|
-
* de invocar; issuer<->tenantId mapean 1:1 vía el pool).
|
|
9
|
-
*
|
|
10
|
-
* NOTA (TD-AI-002): `@fiado/gateway-adapter` NO re-exporta el tipo `IPermissionResolver` desde su
|
|
11
|
-
* barrel (`bin/index.d.ts` solo expone ResolveInput/ResolvedPermissions/ScopedAssignment/PERMISSION_RESOLVER)
|
|
12
|
-
* y su `exports` map bloquea el deep-import del sub-path bajo nodenext. Por eso esta clase implementa
|
|
13
|
-
* el contrato ESTRUCTURALMENTE (`resolve(input): Promise<ResolvedPermissions>`) sin la cláusula
|
|
14
|
-
* `implements IPermissionResolver`. TypeScript es structural-typed: la instancia es asignable al
|
|
15
|
-
* símbolo PERMISSION_RESOLVER en el binding. Ver docs/TECH_DEBT.md.
|
|
16
|
-
*/
|
|
3
|
+
/** Resuelve permisos vía el endpoint privado de rbac-business y cachea solo el fallback (sin roles del token).
|
|
4
|
+
* Llave de caché: `${principalType}#${issuer}#${cognitoSub}`. */
|
|
17
5
|
export declare class ApiInvokerPermissionResolver {
|
|
18
6
|
private readonly _api;
|
|
19
7
|
private readonly _cache;
|
|
@@ -12,20 +12,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
import { injectable, inject } from "inversify";
|
|
14
14
|
import { TtlCache } from "@fiado/gateway-adapter";
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* tipado (HTTP sobre VpcEndpoint), reemplazando la lectura directa de DDB. Cachea la rama fallback;
|
|
18
|
-
* la rama token-trust NO se cachea (paridad con DdbPermissionResolver, evita poisoning).
|
|
19
|
-
* Cache key = `${issuer}#${cognitoSub}` (decisión consciente: el cliente no conoce el tenantId antes
|
|
20
|
-
* de invocar; issuer<->tenantId mapean 1:1 vía el pool).
|
|
21
|
-
*
|
|
22
|
-
* NOTA (TD-AI-002): `@fiado/gateway-adapter` NO re-exporta el tipo `IPermissionResolver` desde su
|
|
23
|
-
* barrel (`bin/index.d.ts` solo expone ResolveInput/ResolvedPermissions/ScopedAssignment/PERMISSION_RESOLVER)
|
|
24
|
-
* y su `exports` map bloquea el deep-import del sub-path bajo nodenext. Por eso esta clase implementa
|
|
25
|
-
* el contrato ESTRUCTURALMENTE (`resolve(input): Promise<ResolvedPermissions>`) sin la cláusula
|
|
26
|
-
* `implements IPermissionResolver`. TypeScript es structural-typed: la instancia es asignable al
|
|
27
|
-
* símbolo PERMISSION_RESOLVER en el binding. Ver docs/TECH_DEBT.md.
|
|
28
|
-
*/
|
|
15
|
+
/** Resuelve permisos vía el endpoint privado de rbac-business y cachea solo el fallback (sin roles del token).
|
|
16
|
+
* Llave de caché: `${principalType}#${issuer}#${cognitoSub}`. */
|
|
29
17
|
let ApiInvokerPermissionResolver = class ApiInvokerPermissionResolver {
|
|
30
18
|
_api;
|
|
31
19
|
_cache;
|
|
@@ -38,16 +26,7 @@ let ApiInvokerPermissionResolver = class ApiInvokerPermissionResolver {
|
|
|
38
26
|
}
|
|
39
27
|
async resolve(input) {
|
|
40
28
|
const cacheable = input.roleAssignmentsFromToken === undefined;
|
|
41
|
-
//
|
|
42
|
-
// —los subs de integración llevan prefijo `INT#` y no chocan con un UUID de Cognito— sino
|
|
43
|
-
// para que el canal quede explícito y un cambio futuro de formato no cause aliasing
|
|
44
|
-
// silencioso entre un usuario y una integración.
|
|
45
|
-
//
|
|
46
|
-
// Se lee con cast en vez de tiparlo desde `ResolveInput` A PROPÓSITO: `principalType` recién
|
|
47
|
-
// existe en `@fiado/gateway-adapter` 4.x, y esta lib la consume toda la flota. Atarla al
|
|
48
|
-
// prerelease obligaría a todos a subir de major. Así compila igual contra 3.x y 4.x, y el
|
|
49
|
-
// reenvío al endpoint privado funciona en runtime porque `resolvePermissions(input)` manda
|
|
50
|
-
// el objeto entero sin filtrar campos.
|
|
29
|
+
// El tipo de principal va en la llave: USER, INTEGRATION y API_USER nunca comparten entrada.
|
|
51
30
|
const principalType = input.principalType ?? "USER";
|
|
52
31
|
const key = `${principalType}#${input.issuer ?? ""}#${input.cognitoSub}`;
|
|
53
32
|
if (cacheable) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRiskProfileApi } from "./interfaces/IRiskProfileApi.js";
|
|
2
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
3
|
import { CreatePrivateAlarm, CreateRiskProfileRequest } from "@fiado/type-kit/bin/riskProfile/index.js";
|
|
4
4
|
type UpdateRiskProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateRiskProfileRequest.js").default;
|
|
5
5
|
type UpdateAlarmProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateAlarmProfileRequest.js").default;
|
|
@@ -34,5 +34,7 @@ export default class RiskProfileApi implements IRiskProfileApi {
|
|
|
34
34
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
35
35
|
deletedCount: number;
|
|
36
36
|
}>>;
|
|
37
|
+
/** Score y nivel de riesgo por lote (GET profiles/directories/scores). Lo usa la actividad diaria del backoffice. */
|
|
38
|
+
getScoreAndLevelByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
37
39
|
}
|
|
38
40
|
export {};
|
|
@@ -75,6 +75,13 @@ let RiskProfileApi = class RiskProfileApi {
|
|
|
75
75
|
const url = `${this.baseUrl}/private/directory/${directoryId}`;
|
|
76
76
|
return await this.httpRequest.delete(url);
|
|
77
77
|
}
|
|
78
|
+
/** Score y nivel de riesgo por lote (GET profiles/directories/scores). Lo usa la actividad diaria del backoffice. */
|
|
79
|
+
async getScoreAndLevelByDirectoryIds(directoryIds) {
|
|
80
|
+
if (directoryIds.length === 0)
|
|
81
|
+
return Promise.resolve({ code: "PROCESS_OK", data: [] });
|
|
82
|
+
const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
|
|
83
|
+
return await this.httpRequest.get(`${this.baseUrl}/profiles/directories/scores?${query}`);
|
|
84
|
+
}
|
|
78
85
|
};
|
|
79
86
|
RiskProfileApi = __decorate([
|
|
80
87
|
injectable(),
|
|
@@ -59,5 +59,7 @@ export interface IRiskProfileApi {
|
|
|
59
59
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
60
60
|
deletedCount: number;
|
|
61
61
|
}>>;
|
|
62
|
+
/** Score y nivel por lote (envelope con data: { directoryId, score, riskLevel, manualRiskLevel }[]). */
|
|
63
|
+
getScoreAndLevelByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
62
64
|
}
|
|
63
65
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.107.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": "^3.9.0",
|
|
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.488.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHttpRequest } from "@fiado/http-client";
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { AddressCreateRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address/index.js";
|
|
3
3
|
import { inject, injectable } from "inversify";
|
|
4
4
|
import { IAddressApi } from "./interfaces/IAddressApi.js";
|
|
@@ -50,4 +50,11 @@ export class AddressApi implements IAddressApi {
|
|
|
50
50
|
throw new Error("Directory ID is required.");
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
|
|
54
|
+
/** Direcciones por lote (GET users?directoryId=...). Lo usa la actividad diaria del backoffice (helpNeeded). */
|
|
55
|
+
async getByDirectoryIds(directoryIds: string[]): Promise<any> {
|
|
56
|
+
if (directoryIds.length === 0) return Promise.resolve({ code: "PROCESS_OK", data: [] } as never);
|
|
57
|
+
const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
|
|
58
|
+
return await this.httpRequest.get(`${this.baseUrl}users?${query}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -37,4 +37,7 @@ export interface IAddressApi {
|
|
|
37
37
|
// TODO(type-kit): swap a Directory.DeleteByDirectoryResponse cuando se publique
|
|
38
38
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>>;
|
|
39
39
|
|
|
40
|
+
/** Direcciones por lote (envelope con data: dirección[] con directoryId y helpNeeded). */
|
|
41
|
+
getByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
42
|
+
|
|
40
43
|
}
|
|
@@ -53,4 +53,11 @@ export class AuthenticationApi implements IAuthenticationApi {
|
|
|
53
53
|
|
|
54
54
|
return await this.httpRequest.post<LegacyApiResponse<unknown>>(url, { pathParameters: { phoneNumber } }, { 'operationName': operation });
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
/** Sesiones de autenticación por lote (op getSessionsByDirectoryIds). Lo usa la actividad diaria del backoffice. */
|
|
58
|
+
async getSessionsByDirectoryIds(directoryIds: string[]): Promise<any> {
|
|
59
|
+
if (directoryIds.length === 0) return Promise.resolve({ code: "PROCESS_OK", data: [] } as never);
|
|
60
|
+
const url = `${process.env.AUTH_LAMBDA_URL}`;
|
|
61
|
+
return await this.httpRequest.post(url, { directoryIds }, { 'operationName': 'getSessionsByDirectoryIds' });
|
|
62
|
+
}
|
|
56
63
|
}
|
|
@@ -46,4 +46,8 @@ export interface IAuthenticationApi {
|
|
|
46
46
|
|
|
47
47
|
// operationName: agentGetSignUpByPhoneNumber — body { pathParameters: { phoneNumber } }
|
|
48
48
|
agentGetSignUpByPhone(phoneNumber: string): Promise<LegacyApiResponse<unknown>>;
|
|
49
|
+
|
|
50
|
+
/** Sesiones por lote (envelope con data: sesión[] con directoryId). */
|
|
51
|
+
getSessionsByDirectoryIds(directoryIds: string[]): Promise<any>;
|
|
52
|
+
|
|
49
53
|
}
|
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
UpdateProfileRequest,
|
|
33
33
|
CreatePoolRequest,
|
|
34
34
|
CreatePoolResponse,
|
|
35
|
+
CreatePoolClientRequest,
|
|
36
|
+
CreatePoolClientResponse,
|
|
35
37
|
DeletePoolRequest,
|
|
36
38
|
HealthcheckResponse,
|
|
37
39
|
VerifyPasswordRequest,
|
|
@@ -269,6 +271,14 @@ export default class CognitoBackofficeConnectorApi implements ICognitoBackoffice
|
|
|
269
271
|
return await this.httpRequest.post(url, input);
|
|
270
272
|
}
|
|
271
273
|
|
|
274
|
+
async createPoolClient(
|
|
275
|
+
userPoolId: string,
|
|
276
|
+
input: CreatePoolClientRequest,
|
|
277
|
+
): Promise<ApiGatewayResponse<CreatePoolClientResponse>> {
|
|
278
|
+
const url = `${this.baseUrl}/pools/${encodeURIComponent(userPoolId)}/clients`;
|
|
279
|
+
return await this.httpRequest.post(url, input);
|
|
280
|
+
}
|
|
281
|
+
|
|
272
282
|
async deletePool(userPoolId: string, region: string): Promise<ApiGatewayResponse<void>> {
|
|
273
283
|
const url = `${this.baseUrl}/pools/${encodeURIComponent(userPoolId)}`;
|
|
274
284
|
return await this.httpRequest.delete(url, { region });
|
|
@@ -30,6 +30,8 @@ import {
|
|
|
30
30
|
UpdateProfileRequest,
|
|
31
31
|
CreatePoolRequest,
|
|
32
32
|
CreatePoolResponse,
|
|
33
|
+
CreatePoolClientRequest,
|
|
34
|
+
CreatePoolClientResponse,
|
|
33
35
|
DeletePoolRequest,
|
|
34
36
|
HealthcheckResponse,
|
|
35
37
|
VerifyPasswordRequest,
|
|
@@ -203,6 +205,9 @@ export interface ICognitoBackofficeConnectorApi {
|
|
|
203
205
|
*/
|
|
204
206
|
createPool(input: CreatePoolRequest): Promise<ApiGatewayResponse<CreatePoolResponse>>;
|
|
205
207
|
|
|
208
|
+
/** POST /pools/{userPoolId}/clients — app client extra sobre un pool existente (usuarios de API). */
|
|
209
|
+
createPoolClient(userPoolId: string, input: CreatePoolClientRequest): Promise<ApiGatewayResponse<CreatePoolClientResponse>>;
|
|
210
|
+
|
|
206
211
|
/**
|
|
207
212
|
* DELETE /pools/{userPoolId}?region=X — elimina un user pool vacío (pivote
|
|
208
213
|
* v1.4.1 — compensation chain de saga). Requiere pool sin users; si tiene
|
|
@@ -26,4 +26,11 @@ export default class OnboardingApi implements IOnboardingApi {
|
|
|
26
26
|
directoryId, countryId, typeOfDirectoryId: "USER",
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
/** Onboardings por lote de fiado-onboarding-lambda (GET ids?directoryId=...). Lo usa la actividad diaria del backoffice. */
|
|
31
|
+
async getByIds(directoryIds: string[]): Promise<any> {
|
|
32
|
+
if (directoryIds.length === 0) return Promise.resolve({ code: "PROCESS_OK", data: [] } as never);
|
|
33
|
+
const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
|
|
34
|
+
return await this.httpRequest.get(`${this.baseUrl}ids?${query}`);
|
|
35
|
+
}
|
|
29
36
|
}
|
|
@@ -11,4 +11,8 @@ export interface IOnboardingApi {
|
|
|
11
11
|
delete(id: string): Promise<any>
|
|
12
12
|
getByReferralDirectoryId(referralDirectoryId: string): Promise<any>
|
|
13
13
|
getOnboardingSteps(directoryId: string, countryId: string): Promise<OnboardingStepsEnvelope>
|
|
14
|
+
|
|
15
|
+
/** Onboardings por lote (envelope con data: onboarding[] con id = directoryId y referralCode). */
|
|
16
|
+
getByIds(directoryIds: string[]): Promise<any>;
|
|
17
|
+
|
|
14
18
|
}
|
|
@@ -3,20 +3,8 @@ import type { ResolveInput, ResolvedPermissions } from "@fiado/gateway-adapter";
|
|
|
3
3
|
import { TtlCache } from "@fiado/gateway-adapter";
|
|
4
4
|
import type { IPlatformRbacBusinessApi } from "../api/interfaces/IPlatformRbacBusinessApi.js";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* tipado (HTTP sobre VpcEndpoint), reemplazando la lectura directa de DDB. Cachea la rama fallback;
|
|
9
|
-
* la rama token-trust NO se cachea (paridad con DdbPermissionResolver, evita poisoning).
|
|
10
|
-
* Cache key = `${issuer}#${cognitoSub}` (decisión consciente: el cliente no conoce el tenantId antes
|
|
11
|
-
* de invocar; issuer<->tenantId mapean 1:1 vía el pool).
|
|
12
|
-
*
|
|
13
|
-
* NOTA (TD-AI-002): `@fiado/gateway-adapter` NO re-exporta el tipo `IPermissionResolver` desde su
|
|
14
|
-
* barrel (`bin/index.d.ts` solo expone ResolveInput/ResolvedPermissions/ScopedAssignment/PERMISSION_RESOLVER)
|
|
15
|
-
* y su `exports` map bloquea el deep-import del sub-path bajo nodenext. Por eso esta clase implementa
|
|
16
|
-
* el contrato ESTRUCTURALMENTE (`resolve(input): Promise<ResolvedPermissions>`) sin la cláusula
|
|
17
|
-
* `implements IPermissionResolver`. TypeScript es structural-typed: la instancia es asignable al
|
|
18
|
-
* símbolo PERMISSION_RESOLVER en el binding. Ver docs/TECH_DEBT.md.
|
|
19
|
-
*/
|
|
6
|
+
/** Resuelve permisos vía el endpoint privado de rbac-business y cachea solo el fallback (sin roles del token).
|
|
7
|
+
* Llave de caché: `${principalType}#${issuer}#${cognitoSub}`. */
|
|
20
8
|
@injectable()
|
|
21
9
|
export class ApiInvokerPermissionResolver {
|
|
22
10
|
private readonly _cache: TtlCache<ResolvedPermissions>;
|
|
@@ -31,17 +19,8 @@ export class ApiInvokerPermissionResolver {
|
|
|
31
19
|
}
|
|
32
20
|
async resolve(input: ResolveInput): Promise<ResolvedPermissions> {
|
|
33
21
|
const cacheable = input.roleAssignmentsFromToken === undefined;
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
// para que el canal quede explícito y un cambio futuro de formato no cause aliasing
|
|
37
|
-
// silencioso entre un usuario y una integración.
|
|
38
|
-
//
|
|
39
|
-
// Se lee con cast en vez de tiparlo desde `ResolveInput` A PROPÓSITO: `principalType` recién
|
|
40
|
-
// existe en `@fiado/gateway-adapter` 4.x, y esta lib la consume toda la flota. Atarla al
|
|
41
|
-
// prerelease obligaría a todos a subir de major. Así compila igual contra 3.x y 4.x, y el
|
|
42
|
-
// reenvío al endpoint privado funciona en runtime porque `resolvePermissions(input)` manda
|
|
43
|
-
// el objeto entero sin filtrar campos.
|
|
44
|
-
const principalType = (input as { principalType?: string }).principalType ?? "USER";
|
|
22
|
+
// El tipo de principal va en la llave: USER, INTEGRATION y API_USER nunca comparten entrada.
|
|
23
|
+
const principalType = input.principalType ?? "USER";
|
|
45
24
|
const key = `${principalType}#${input.issuer ?? ""}#${input.cognitoSub}`;
|
|
46
25
|
if (cacheable) {
|
|
47
26
|
const hit = this._cache.get(key);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {IRiskProfileApi} from "./interfaces/IRiskProfileApi.js";
|
|
2
2
|
import {inject, injectable} from "inversify";
|
|
3
|
-
import {IHttpRequest} from "@fiado/http-client";
|
|
3
|
+
import type {IHttpRequest} from "@fiado/http-client";
|
|
4
4
|
import {CreatePrivateAlarm, CreateRiskProfileRequest} from "@fiado/type-kit/bin/riskProfile/index.js";
|
|
5
5
|
type UpdateRiskProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateRiskProfileRequest.js").default;
|
|
6
6
|
type UpdateAlarmProfileRequest = import("@fiado/type-kit/bin/riskProfile/dtos/UpdateAlarmProfileRequest.js").default;
|
|
@@ -92,4 +92,10 @@ export default class RiskProfileApi implements IRiskProfileApi {
|
|
|
92
92
|
return await this.httpRequest.delete<FiadoApiResponse<{ deletedCount: number }>>(url);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
/** Score y nivel de riesgo por lote (GET profiles/directories/scores). Lo usa la actividad diaria del backoffice. */
|
|
96
|
+
async getScoreAndLevelByDirectoryIds(directoryIds: string[]): Promise<any> {
|
|
97
|
+
if (directoryIds.length === 0) return Promise.resolve({ code: "PROCESS_OK", data: [] } as never);
|
|
98
|
+
const query = directoryIds.map((id) => `directoryId=${encodeURIComponent(id)}`).join("&");
|
|
99
|
+
return await this.httpRequest.get(`${this.baseUrl}/profiles/directories/scores?${query}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -76,4 +76,8 @@ export interface IRiskProfileApi {
|
|
|
76
76
|
*/
|
|
77
77
|
// TODO(type-kit): swap a Directory.DeleteByDirectoryResponse cuando se publique
|
|
78
78
|
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{ deletedCount: number }>>;
|
|
79
|
+
|
|
80
|
+
/** Score y nivel por lote (envelope con data: { directoryId, score, riskLevel, manualRiskLevel }[]). */
|
|
81
|
+
getScoreAndLevelByDirectoryIds(directoryIds: string[]): Promise<any>
|
|
82
|
+
|
|
79
83
|
}
|